firefox compiled fix

master
Mark MacKay 2012-07-31 04:41:35 -05:00
parent 962d755d89
commit 4d167554ea
4 changed files with 500 additions and 500 deletions

View File

@ -75,19 +75,19 @@ var supportsPathInsertItemBefore_ = (function() {
// text character positioning (for IE9) // text character positioning (for IE9)
var supportsGoodTextCharPos_ = (function() { var supportsGoodTextCharPos_ = (function() {
var retValue = false; // var retValue = false;
var svgroot = document.createElementNS(svgns, 'svg'); // var svgroot = document.createElementNS(svgns, 'svg');
var svgcontent = document.createElementNS(svgns, 'svg'); // var svgcontent = document.createElementNS(svgns, 'svg');
document.documentElement.appendChild(svgroot); // document.documentElement.appendChild(svgroot);
svgcontent.setAttribute('x', 5); // svgcontent.setAttribute('x', 5);
svgroot.appendChild(svgcontent); // svgroot.appendChild(svgcontent);
var text = document.createElementNS(svgns,'text'); // var text = document.createElementNS(svgns,'text');
text.textContent = 'a'; // text.textContent = 'a';
svgcontent.appendChild(text); // svgcontent.appendChild(text);
var pos = text.getStartPositionOfChar(0) // var pos = text.getStartPositionOfChar(0)
pos = pos.x; //if you put it on one line it fails when compiled // pos = pos.x; //if you put it on one line it fails when compiled
document.documentElement.removeChild(svgroot); // document.documentElement.removeChild(svgroot);
return (pos === 0); // return (pos === 0);
})(); })();
var supportsPathBBox_ = (function() { var supportsPathBBox_ = (function() {

View File

@ -1,31 +1,31 @@
function touchHandler(a){var q=a.changedTouches,h=q[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var n=document.createEvent("MouseEvent");n.initMouseEvent(b,true,true,window,1,h.screenX,h.screenY,h.clientX,h.clientY,false,false,false,false,0,null);if(q.length<2){h.target.dispatchEvent(n);a.preventDefault()}};(function(a){function q(h){if(typeof h.data==="string"){var b=h.handler,n=h.data.toLowerCase().split(" ");h.handler=function(u){if(!(this!==u.target&&(/textarea|select/i.test(u.target.nodeName)||u.target.type==="text"))){var c=u.type!=="keypress"&&a.hotkeys.specialKeys[u.which],f=String.fromCharCode(u.which).toLowerCase(),d="",l={};if(u.altKey&&c!=="alt")d+="alt+";if(u.ctrlKey&&c!=="ctrl")d+="ctrl+";if(u.metaKey&&!u.ctrlKey&&c!=="meta")d+="meta+";if(u.shiftKey&&c!=="shift")d+="shift+";if(c)l[d+c]= function touchHandler(a){var q=a.changedTouches,h=q[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var n=document.createEvent("MouseEvent");n.initMouseEvent(b,true,true,window,1,h.screenX,h.screenY,h.clientX,h.clientY,false,false,false,false,0,null);if(q.length<2){h.target.dispatchEvent(n);a.preventDefault()}};(function(a){function q(h){if(typeof h.data==="string"){var b=h.handler,n=h.data.toLowerCase().split(" ");h.handler=function(u){if(!(this!==u.target&&(/textarea|select/i.test(u.target.nodeName)||u.target.type==="text"))){var c=u.type!=="keypress"&&a.hotkeys.specialKeys[u.which],f=String.fromCharCode(u.which).toLowerCase(),d="",l={};if(u.altKey&&c!=="alt")d+="alt+";if(u.ctrlKey&&c!=="ctrl")d+="ctrl+";if(u.metaKey&&!u.ctrlKey&&c!=="meta")d+="meta+";if(u.shiftKey&&c!=="shift")d+="shift+";if(c)l[d+c]=
true;else{l[d+f]=true;l[d+a.hotkeys.shiftNums[f]]=true;if(d==="shift+")l[a.hotkeys.shiftNums[f]]=true}c=0;for(f=n.length;c<f;c++)if(l[n[c]])return b.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9", true;else{l[d+f]=true;l[d+a.hotkeys.shiftNums[f]]=true;if(d==="shift+")l[a.hotkeys.shiftNums[f]]=true}c=0;for(f=n.length;c<f;c++)if(l[n[c]])return b.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",
106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:q}})})(jQuery);(function(a,q){function h(da){return typeof da==="string"}function b(da){var U=d.call(arguments,1);return function(){return da.apply(this,U.concat(d.call(arguments)))}}function n(da,U,Y,oa,pa){var la;if(oa!==f){U=Y.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Y=U[3]||"";if(pa===2&&h(oa))oa=oa.replace(da?V:aa,"");else{la=p(U[2]);oa=h(oa)?p[da?ha:M](oa):oa;oa=pa===2?oa:pa===1?a.extend({},oa,la):a.extend({},la,oa);oa=s(oa);if(da)oa=oa.replace(ra,l)}da=U[1]+(da?"#":oa||!U[1]?"?":"")+oa+Y}else da= 106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:q}})})(jQuery);(function(a,q){function h(ea){return typeof ea==="string"}function b(ea){var U=d.call(arguments,1);return function(){return ea.apply(this,U.concat(d.call(arguments)))}}function n(ea,U,Y,na,oa){var la;if(na!==f){U=Y.match(ea?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Y=U[3]||"";if(oa===2&&h(na))na=na.replace(ea?W:ca,"");else{la=p(U[2]);na=h(na)?p[ea?aa:M](na):na;na=oa===2?na:oa===1?a.extend({},na,la):a.extend({},la,na);na=s(na);if(ea)na=na.replace(ra,l)}ea=U[1]+(ea?"#":na||!U[1]?"?":"")+na+Y}else ea=
U(Y!==f?Y:q[na][fa]);return da}function u(da,U,Y){if(U===f||typeof U==="boolean"){Y=U;U=s[da?ha:M]()}else U=h(U)?U.replace(da?V:aa,""):U;return p(U,Y)}function c(da,U,Y,oa){if(!h(Y)&&typeof Y!=="object"){oa=Y;Y=U;U=f}return this.each(function(){var pa=a(this),la=U||P()[(this.nodeName||"").toLowerCase()]||"",ma=la&&pa.attr(la)||"";pa.attr(la,s[da](ma,Y,oa))})}var f,d=Array.prototype.slice,l=decodeURIComponent,s=a.param,C,p,L,R=a.bbq=a.bbq||{},O,K,P,T=a.event.special,M="querystring",ha="fragment",na= U(Y!==f?Y:q[qa][ha]);return ea}function u(ea,U,Y){if(U===f||typeof U==="boolean"){Y=U;U=s[ea?aa:M]()}else U=h(U)?U.replace(ea?W:ca,""):U;return p(U,Y)}function c(ea,U,Y,na){if(!h(Y)&&typeof Y!=="object"){na=Y;Y=U;U=f}return this.each(function(){var oa=a(this),la=U||P()[(this.nodeName||"").toLowerCase()]||"",ma=la&&oa.attr(la)||"";oa.attr(la,s[ea](ma,Y,na))})}var f,d=Array.prototype.slice,l=decodeURIComponent,s=a.param,C,p,L,R=a.bbq=a.bbq||{},O,K,P,T=a.event.special,M="querystring",aa="fragment",qa=
"location",fa="href",aa=/^.*\?|#.*$/g,V=/^.*\#/,ra,ia={};s[M]=b(n,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});s[ha]=C=b(n,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);ra=RegExp(da.join("|"),"g")};C.noEscape(",/");a.deparam=p=function(da,U){var Y={},oa={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(pa,la){var ma=la.split("="),Ba=l(ma[0]),Ea=Y,Ia= "location",ha="href",ca=/^.*\?|#.*$/g,W=/^.*\#/,ra,ia={};s[M]=b(n,0,function(ea){return ea.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});s[aa]=C=b(n,1,function(ea){return ea.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(ea){ea=ea||"";ea=a.map(ea.split(""),encodeURIComponent);ra=RegExp(ea.join("|"),"g")};C.noEscape(",/");a.deparam=p=function(ea,U){var Y={},na={"true":true,"false":false,"null":null};a.each(ea.replace(/\+/g," ").split("&"),function(oa,la){var ma=la.split("="),Ba=l(ma[0]),Ea=Y,Ia=
0,za=Ba.split("]["),Ka=za.length-1;if(/\[/.test(za[0])&&/\]$/.test(za[Ka])){za[Ka]=za[Ka].replace(/\]$/,"");za=za.shift().split("[").concat(za);Ka=za.length-1}else Ka=0;if(ma.length===2){ma=l(ma[1]);if(U)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?f:oa[ma]!==f?oa[ma]:ma;if(Ka)for(;Ia<=Ka;Ia++){Ba=za[Ia]===""?Ea.length:za[Ia];Ea=Ea[Ba]=Ia<Ka?Ea[Ba]||(za[Ia+1]&&isNaN(za[Ia+1])?{}:[]):ma}else if(a.isArray(Y[Ba]))Y[Ba].push(ma);else Y[Ba]=Y[Ba]!==f?[Y[Ba],ma]:ma}else if(Ba)Y[Ba]=U?f:""});return Y};p[M]=b(u, 0,za=Ba.split("]["),Ka=za.length-1;if(/\[/.test(za[0])&&/\]$/.test(za[Ka])){za[Ka]=za[Ka].replace(/\]$/,"");za=za.shift().split("[").concat(za);Ka=za.length-1}else Ka=0;if(ma.length===2){ma=l(ma[1]);if(U)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?f:na[ma]!==f?na[ma]:ma;if(Ka)for(;Ia<=Ka;Ia++){Ba=za[Ia]===""?Ea.length:za[Ia];Ea=Ea[Ba]=Ia<Ka?Ea[Ba]||(za[Ia+1]&&isNaN(za[Ia+1])?{}:[]):ma}else if(a.isArray(Y[Ba]))Y[Ba].push(ma);else Y[Ba]=Y[Ba]!==f?[Y[Ba],ma]:ma}else if(Ba)Y[Ba]=U?f:""});return Y};p[M]=b(u,
0);p[ha]=L=b(u,1);a.elemUrlAttr||(a.elemUrlAttr=function(da){return a.extend(ia,da)})({a:fa,base:fa,iframe:"src",img:"src",input:"src",form:"action",link:fa,script:"src"});P=a.elemUrlAttr;a.fn[M]=b(c,M);a.fn[ha]=b(c,ha);R.pushState=O=function(da,U){if(h(da)&&/^#/.test(da)&&U===f)U=2;var Y=da!==f;Y=C(q[na][fa],Y?da:{},Y?U:2);q[na][fa]=Y+(/#/.test(Y)?"":"#")};R.getState=K=function(da,U){return da===f||typeof da==="boolean"?L(da):L(U)[da]};R.removeState=function(da){var U={};if(da!==f){U=K();a.each(a.isArray(da)? 0);p[aa]=L=b(u,1);a.elemUrlAttr||(a.elemUrlAttr=function(ea){return a.extend(ia,ea)})({a:ha,base:ha,iframe:"src",img:"src",input:"src",form:"action",link:ha,script:"src"});P=a.elemUrlAttr;a.fn[M]=b(c,M);a.fn[aa]=b(c,aa);R.pushState=O=function(ea,U){if(h(ea)&&/^#/.test(ea)&&U===f)U=2;var Y=ea!==f;Y=C(q[qa][ha],Y?ea:{},Y?U:2);q[qa][ha]=Y+(/#/.test(Y)?"":"#")};R.getState=K=function(ea,U){return ea===f||typeof ea==="boolean"?L(ea):L(U)[ea]};R.removeState=function(ea){var U={};if(ea!==f){U=K();a.each(a.isArray(ea)?
da:arguments,function(Y,oa){delete U[oa]})}O(U,2)};T.hashchange=a.extend(T.hashchange,{add:function(da){function U(oa){var pa=oa[ha]=C();oa.getState=function(la,ma){return la===f||typeof la==="boolean"?p(pa,la):p(pa,ma)[la]};Y.apply(this,arguments)}var Y;if(a.isFunction(da)){Y=da;return U}else{Y=da.handler;da.handler=U}}})})(jQuery,this); ea:arguments,function(Y,na){delete U[na]})}O(U,2)};T.hashchange=a.extend(T.hashchange,{add:function(ea){function U(na){var oa=na[aa]=C();na.getState=function(la,ma){return la===f||typeof la==="boolean"?p(oa,la):p(oa,ma)[la]};Y.apply(this,arguments)}var Y;if(a.isFunction(ea)){Y=ea;return U}else{Y=ea.handler;ea.handler=U}}})})(jQuery,this);
(function(a,q,h){function b(C){C=C||q[c][f];return C.replace(/^[^#]*#?(.*)$/,"$1")}var n,u=a.event.special,c="location",f="href",d=document.documentMode,l=a.browser.msie&&(d===h||d<8),s="onhashchange"in q&&!l;a.hashchangeDelay=100;u.hashchange=a.extend(u.hashchange,{setup:function(){if(s)return false;a(n.start)},teardown:function(){if(s)return false;a(n.stop)}});n=function(){function C(){O=K=function(P){return P};if(l){R=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow; (function(a,q,h){function b(C){C=C||q[c][f];return C.replace(/^[^#]*#?(.*)$/,"$1")}var n,u=a.event.special,c="location",f="href",d=document.documentMode,l=a.browser.msie&&(d===h||d<8),s="onhashchange"in q&&!l;a.hashchangeDelay=100;u.hashchange=a.extend(u.hashchange,{setup:function(){if(s)return false;a(n.start)},teardown:function(){if(s)return false;a(n.stop)}});n=function(){function C(){O=K=function(P){return P};if(l){R=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;
K=function(){return b(R.document[c][f])};O=function(P,T){if(P!==T){var M=R.document;M.open().close();M[c].hash="#"+P}};O(b())}}var p={},L,R,O,K;p.start=function(){if(!L){var P=b();O||C();(function T(){var M=b(),ha=K(P);if(M!==P){O(P=M,ha);a(q).trigger("hashchange")}else if(ha!==P)q[c][f]=q[c][f].replace(/#.*/,"")+"#"+ha;L=setTimeout(T,a.hashchangeDelay)})()}};p.stop=function(){if(!R){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var q={},h;a.svgIcons=function(b,n){function u(da,U){if(da!=="ajax"){if(P)return;var Y=(R=fa[0].contentDocument)&&R.getElementById("svg_eof");if(!Y&&!(U&&Y)){T++;if(T<50)setTimeout(u,20);else{f();P=true}return}P=true}L=a(R.firstChild).children();if(n.no_img)setTimeout(function(){K||c()},500);else{Y=na+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";O=a(new Image).attr({src:Y,width:0,height:0}).appendTo("body").load(function(){c(true)}).error(function(){c()})}} K=function(){return b(R.document[c][f])};O=function(P,T){if(P!==T){var M=R.document;M.open().close();M[c].hash="#"+P}};O(b())}}var p={},L,R,O,K;p.start=function(){if(!L){var P=b();O||C();(function T(){var M=b(),aa=K(P);if(M!==P){O(P=M,aa);a(q).trigger("hashchange")}else if(aa!==P)q[c][f]=q[c][f].replace(/#.*/,"")+"#"+aa;L=setTimeout(T,a.hashchangeDelay)})()}};p.stop=function(){if(!R){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var q={},h;a.svgIcons=function(b,n){function u(ea,U){if(ea!=="ajax"){if(P)return;var Y=(R=ha[0].contentDocument)&&R.getElementById("svg_eof");if(!Y&&!(U&&Y)){T++;if(T<50)setTimeout(u,20);else{f();P=true}return}P=true}L=a(R.firstChild).children();if(n.no_img)setTimeout(function(){K||c()},500);else{Y=qa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";O=a(new Image).attr({src:Y,width:0,height:0}).appendTo("body").load(function(){c(true)}).error(function(){c()})}}
function c(da,U){if(!K){if(n.no_img)da=false;if(da){var Y=a(document.createElement("div"));Y.hide().appendTo("body")}if(U){var oa=n.fallback_path?n.fallback_path:"";a.each(U,function(Ka,Na){a("#"+Ka);var Aa=a(new Image).attr({"class":"svg_icon",src:oa+Na,width:C,height:p,alt:"icon"});ia(Aa,Ka)})}else for(var pa=L.length,la=0;la<pa;la++){var ma=L[la],Ba=ma.id;if(Ba==="svg_eof")break;a("#"+Ba);ma=ma.getElementsByTagNameNS(l,"svg")[0];var Ea=document.createElementNS(l,"svg");Ea.setAttributeNS(l,"viewBox", function c(ea,U){if(!K){if(n.no_img)ea=false;if(ea){var Y=a(document.createElement("div"));Y.hide().appendTo("body")}if(U){var na=n.fallback_path?n.fallback_path:"";a.each(U,function(Ka,Na){a("#"+Ka);var Aa=a(new Image).attr({"class":"svg_icon",src:na+Na,width:C,height:p,alt:"icon"});ia(Aa,Ka)})}else for(var oa=L.length,la=0;la<oa;la++){var ma=L[la],Ba=ma.id;if(Ba==="svg_eof")break;a("#"+Ba);ma=ma.getElementsByTagNameNS(l,"svg")[0];var Ea=document.createElementNS(l,"svg");Ea.setAttributeNS(l,"viewBox",
[0,0,C,p].join(" "));var Ia=ma.getAttribute("width"),za=ma.getAttribute("height");ma.removeAttribute("width");ma.removeAttribute("height");ma.getAttribute("viewBox")||ma.setAttribute("viewBox",[0,0,Ia,za].join(" "));Ea.setAttribute("xmlns",l);Ea.setAttribute("width",C);Ea.setAttribute("height",p);Ea.setAttribute("xmlns:xlink",s);Ea.setAttribute("class","svg_icon");ha||(ma=ma.cloneNode(true));Ea.appendChild(ma);if(da){ha||Ea.cloneNode(true);Y.empty().append(Ea);ma=na+d(Y.html());ma=a(new Image).attr({"class":"svg_icon", [0,0,C,p].join(" "));var Ia=ma.getAttribute("width"),za=ma.getAttribute("height");ma.removeAttribute("width");ma.removeAttribute("height");ma.getAttribute("viewBox")||ma.setAttribute("viewBox",[0,0,Ia,za].join(" "));Ea.setAttribute("xmlns",l);Ea.setAttribute("width",C);Ea.setAttribute("height",p);Ea.setAttribute("xmlns:xlink",s);Ea.setAttribute("class","svg_icon");aa||(ma=ma.cloneNode(true));Ea.appendChild(ma);if(ea){aa||Ea.cloneNode(true);Y.empty().append(Ea);ma=qa+d(Y.html());ma=a(new Image).attr({"class":"svg_icon",
src:ma})}else ma=h(a(Ea),la);ia(ma,Ba)}n.placement&&a.each(n.placement,function(Ka,Na){q[Na]&&a(Ka).each(function(Aa){var ya=q[Na].clone();if(Aa>0&&!da)ya=h(ya,Aa,true);ra(a(this),ya,Na)})});if(!U){da&&Y.remove();fa&&fa.remove();O&&O.remove()}n.resize&&a.resizeSvgIcons(n.resize);K=true;n.callback&&n.callback(q)}}function f(){if(b.indexOf(".svgz")!=-1){var da=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(da,n)}else n.fallback&&c(false,n.fallback)} src:ma})}else ma=h(a(Ea),la);ia(ma,Ba)}n.placement&&a.each(n.placement,function(Ka,Na){q[Na]&&a(Ka).each(function(Aa){var ya=q[Na].clone();if(Aa>0&&!ea)ya=h(ya,Aa,true);ra(a(this),ya,Na)})});if(!U){ea&&Y.remove();ha&&ha.remove();O&&O.remove()}n.resize&&a.resizeSvgIcons(n.resize);K=true;n.callback&&n.callback(q)}}function f(){if(b.indexOf(".svgz")!=-1){var ea=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ea,n)}else n.fallback&&c(false,n.fallback)}
function d(da){if(window.btoa)return window.btoa(da);var U=Array(Math.floor((da.length+2)/3)*4),Y,oa,pa,la,ma,Ba,Ea=0,Ia=0;do{Y=da.charCodeAt(Ea++);oa=da.charCodeAt(Ea++);pa=da.charCodeAt(Ea++);la=Y>>2;Y=(Y&3)<<4|oa>>4;ma=(oa&15)<<2|pa>>6;Ba=pa&63;if(isNaN(oa))ma=Ba=64;else if(isNaN(pa))Ba=64;U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Y);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma); function d(ea){if(window.btoa)return window.btoa(ea);var U=Array(Math.floor((ea.length+2)/3)*4),Y,na,oa,la,ma,Ba,Ea=0,Ia=0;do{Y=ea.charCodeAt(Ea++);na=ea.charCodeAt(Ea++);oa=ea.charCodeAt(Ea++);la=Y>>2;Y=(Y&3)<<4|na>>4;ma=(na&15)<<2|oa>>6;Ba=oa&63;if(isNaN(na))ma=Ba=64;else if(isNaN(oa))Ba=64;U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Y);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);
U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ba)}while(Ea<da.length);return U.join("")}var l="http://www.w3.org/2000/svg",s="http://www.w3.org/1999/xlink",C=n.w?n.w:24,p=n.h?n.h:24,L,R,O,K=false,P=false,T=0,M=navigator.userAgent,ha=!!window.opera;M.indexOf("Safari/")>-1&&M.indexOf("Chrome/");var na="data:image/svg+xml;charset=utf-8;base64,";if(n.svgz){var fa=a('<object data="'+b+'" type=image/svg+xml>').appendTo("body").hide();try{R=fa[0].contentDocument;fa.load(u); U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ba)}while(Ea<ea.length);return U.join("")}var l="http://www.w3.org/2000/svg",s="http://www.w3.org/1999/xlink",C=n.w?n.w:24,p=n.h?n.h:24,L,R,O,K=false,P=false,T=0,M=navigator.userAgent,aa=!!window.opera;M.indexOf("Safari/")>-1&&M.indexOf("Chrome/");var qa="data:image/svg+xml;charset=utf-8;base64,";if(n.svgz){var ha=a('<object data="'+b+'" type=image/svg+xml>').appendTo("body").hide();try{R=ha[0].contentDocument;ha.load(u);
u(0,true)}catch(aa){f()}}else{var V=new DOMParser;a.ajax({url:b,dataType:"string",success:function(da){if(da){R=V.parseFromString(da,"text/xml");a(function(){u("ajax")})}else a(f)},error:function(da){if(window.opera)a(function(){f()});else if(da.responseText){R=V.parseFromString(da.responseText,"text/xml");R.childNodes.length||a(f);a(function(){u("ajax")})}else a(f)}})}var ra=function(da,U,Y,oa){ha&&U.css("visibility","hidden");if(n.replace){oa&&U.attr("id",Y);(Y=da.attr("class"))&&U.attr("class", u(0,true)}catch(ca){f()}}else{var W=new DOMParser;a.ajax({url:b,dataType:"string",success:function(ea){if(ea){R=W.parseFromString(ea,"text/xml");a(function(){u("ajax")})}else a(f)},error:function(ea){if(window.opera)a(function(){f()});else if(ea.responseText){R=W.parseFromString(ea.responseText,"text/xml");R.childNodes.length||a(f);a(function(){u("ajax")})}else a(f)}})}var ra=function(ea,U,Y,na){aa&&U.css("visibility","hidden");if(n.replace){na&&U.attr("id",Y);(Y=ea.attr("class"))&&U.attr("class",
"svg_icon "+Y);da.replaceWith(U)}else da.append(U);ha&&setTimeout(function(){U.removeAttr("style")},1)},ia=function(da,U){if(n.id_match===undefined||n.id_match!==false)ra(holder,da,U,true);q[U]=da};h=function(da,U){var Y=da.find("defs");if(!Y.length)return da;Y=ha?Y.find("*").filter(function(){return!!this.id}):Y.find("[id]");var oa=da[0].getElementsByTagName("*"),pa=oa.length;Y.each(function(la){var ma=this.id;a(R).find("#"+ma);this.id=la="x"+ma+U+la;ma="url(#"+ma+")";var Ba="url(#"+la+")";for(la= "svg_icon "+Y);ea.replaceWith(U)}else ea.append(U);aa&&setTimeout(function(){U.removeAttr("style")},1)},ia=function(ea,U){if(n.id_match===undefined||n.id_match!==false)ra(holder,ea,U,true);q[U]=ea};h=function(ea,U){var Y=ea.find("defs");if(!Y.length)return ea;Y=aa?Y.find("*").filter(function(){return!!this.id}):Y.find("[id]");var na=ea[0].getElementsByTagName("*"),oa=na.length;Y.each(function(la){var ma=this.id;a(R).find("#"+ma);this.id=la="x"+ma+U+la;ma="url(#"+ma+")";var Ba="url(#"+la+")";for(la=
0;la<pa;la++){var Ea=oa[la];Ea.getAttribute("fill")===ma&&Ea.setAttribute("fill",Ba);Ea.getAttribute("stroke")===ma&&Ea.setAttribute("stroke",Ba);Ea.getAttribute("filter")===ma&&Ea.setAttribute("filter",Ba)}});return da}};a.getSvgIcon=function(b,n){var u=q[b];if(n&&u)u=h(u,0,true).clone(true);return u};a.resizeSvgIcons=function(b){var n=!a(".svg_icon:first").length;a.each(b,function(u,c){var f=a.isArray(c),d=f?c[0]:c,l=f?c[1]:c;if(n)u=u.replace(/\.svg_icon/g,"svg");a(u).each(function(){this.setAttribute("width", 0;la<oa;la++){var Ea=na[la];Ea.getAttribute("fill")===ma&&Ea.setAttribute("fill",Ba);Ea.getAttribute("stroke")===ma&&Ea.setAttribute("stroke",Ba);Ea.getAttribute("filter")===ma&&Ea.setAttribute("filter",Ba)}});return ea}};a.getSvgIcon=function(b,n){var u=q[b];if(n&&u)u=h(u,0,true).clone(true);return u};a.resizeSvgIcons=function(b){var n=!a(".svg_icon:first").length;a.each(b,function(u,c){var f=a.isArray(c),d=f?c[0]:c,l=f?c[1]:c;if(n)u=u.replace(/\.svg_icon/g,"svg");a(u).each(function(){this.setAttribute("width",
d);this.setAttribute("height",l);if(window.opera&&window.widget){this.parentNode.style.width=d+"px";this.parentNode.style.height=l+"px"}})})}})(jQuery);(function(){function a(b,n,u){b=document.createElementNS(q.svg,b);if(h)for(var c in n)b.setAttribute(c,n[c]);else for(c in n){var f=n[c],d=b[c];if(d&&d.constructor==="SVGLength")d.baseVal.value=f;else b.setAttribute(c,f)}u&&u.appendChild(b);return b}var q={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(b){b=b||{};this.alpha=isNaN(b.alpha)?100:b.alpha;if(b.copy){this.type= d);this.setAttribute("height",l);if(window.opera&&window.widget){this.parentNode.style.width=d+"px";this.parentNode.style.height=l+"px"}})})}})(jQuery);(function(){function a(b,n,u){b=document.createElementNS(q.svg,b);if(h)for(var c in n)b.setAttribute(c,n[c]);else for(c in n){var f=n[c],d=b[c];if(d&&d.constructor==="SVGLength")d.baseVal.value=f;else b.setAttribute(c,f)}u&&u.appendChild(b);return b}var q={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(b){b=b||{};this.alpha=isNaN(b.alpha)?100:b.alpha;if(b.copy){this.type=
b.copy.type;this.alpha=b.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=b.copy.solidColor;break;case "linearGradient":this.linearGradient=b.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=b.copy.radialGradient.cloneNode(true)}}else if(b.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=b.linearGradient.cloneNode(true)}else if(b.radialGradient){this.type= b.copy.type;this.alpha=b.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=b.copy.solidColor;break;case "linearGradient":this.linearGradient=b.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=b.copy.radialGradient.cloneNode(true)}}else if(b.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=b.linearGradient.cloneNode(true)}else if(b.radialGradient){this.type=
"radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=b.radialGradient.cloneNode(true)}else if(b.solidColor){this.type="solidColor";this.solidColor=b.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 h=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(b){var n= "radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=b.radialGradient.cloneNode(true)}else if(b.solidColor){this.type="solidColor";this.solidColor=b.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 h=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(b){var n=
arguments;return this.each(function(){function u(ja,ba,ka,N,Q){var ea=Q||a("stop",{"stop-color":ba,"stop-opacity":ka,offset:ja},V);if(Q){ba=Q.getAttribute("stop-color");ka=Q.getAttribute("stop-opacity");ja=Q.getAttribute("offset")}else V.appendChild(ea);if(ka===null)ka=1;Q=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+ja*ha)+", 26)"},nb);var Fa= arguments;return this.each(function(){function u(ja,ba,ka,N,Q){var fa=Q||a("stop",{"stop-color":ba,"stop-opacity":ka,offset:ja},W);if(Q){ba=Q.getAttribute("stop-color");ka=Q.getAttribute("stop-opacity");ja=Q.getAttribute("offset")}else W.appendChild(fa);if(ka===null)ka=1;Q=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+ja*aa)+", 26)"},nb);var Fa=
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":ka,transform:"translate("+(10+ja*ha)+", 26)",stroke:"#000","stroke-width":1.5},nb);$(Fa).mousedown(function(Oa){c(this);Wa=fb;P.mousemove(l).mouseup(f);wa=Ya.offset();Oa.preventDefault();return false}).data("stop",ea).data("bg",Q).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Va=+ea.getAttribute("stop-opacity")|| 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":ka,transform:"translate("+(10+ja*aa)+", 26)",stroke:"#000","stroke-width":1.5},nb);$(Fa).mousedown(function(Oa){c(this);Wa=fb;P.mousemove(l).mouseup(f);wa=Ya.offset();Oa.preventDefault();return false}).data("stop",fa).data("bg",Q).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Va=+fa.getAttribute("stop-opacity")||
1,$a=ea.getAttribute("stop-color")||1,qb=(parseFloat(Va)*255).toString(16);qb.length<2;)qb="0"+qb;ba=$a.substr(1)+qb;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:C.images.clientPath},color:{active:ba,alphaSupport:true}},function(Qa){$a=Qa.val("hex")?"#"+Qa.val("hex"):"none";Va=Qa.val("a")!==null?Qa.val("a")/256:1;Oa.setAttribute("fill",$a);Oa.setAttribute("fill-opacity",Va);ea.setAttribute("stop-color", 1,$a=fa.getAttribute("stop-color")||1,qb=(parseFloat(Va)*255).toString(16);qb.length<2;)qb="0"+qb;ba=$a.substr(1)+qb;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:C.images.clientPath},color:{active:ba,alphaSupport:true}},function(Qa){$a=Qa.val("hex")?"#"+Qa.val("hex"):"none";Va=Qa.val("a")!==null?Qa.val("a")/256:1;Oa.setAttribute("fill",$a);Oa.setAttribute("fill-opacity",Va);fa.setAttribute("stop-color",
$a);ea.setAttribute("stop-opacity",Va);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(V).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ja){if(!ba){var Va=this.getAttribute("stop-color"),$a=this.getAttribute("stop-opacity");ea.setAttribute("stop-color",Va);Fa.setAttribute("fill",Va);ea.setAttribute("stop-opacity",$a===null?1:$a);Fa.setAttribute("fill-opacity", $a);fa.setAttribute("stop-opacity",Va);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(W).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ja){if(!ba){var Va=this.getAttribute("stop-color"),$a=this.getAttribute("stop-opacity");fa.setAttribute("stop-color",Va);Fa.setAttribute("fill",Va);fa.setAttribute("stop-opacity",$a===null?1:$a);Fa.setAttribute("fill-opacity",
$a===null?1:$a)}Oa.before(ea);return false}});N&&c(Fa);return ea}function c(ja){fb&&fb.setAttribute("stroke","#000");ja.setAttribute("stroke","blue");fb=ja;fb.parentNode.appendChild(fb)}function f(){P.unbind("mousemove",l);if(Ca.getAttribute("display")!=="none"){Ca.setAttribute("display","none");var ja=$(fb),ba=ja.data("stop");ja=ja.data("bg");$([fb,ba,ja]).remove()}Wa=null}function d(){var ja=Ra?"rotate("+Ra+","+Da+","+gb+") ":"";db===1&&La===1?V.removeAttribute("gradientTransform"):V.setAttribute("gradientTransform", $a===null?1:$a)}Oa.before(fa);return false}});N&&c(Fa);return fa}function c(ja){fb&&fb.setAttribute("stroke","#000");ja.setAttribute("stroke","blue");fb=ja;fb.parentNode.appendChild(fb)}function f(){P.unbind("mousemove",l);if(Ca.getAttribute("display")!=="none"){Ca.setAttribute("display","none");var ja=$(fb),ba=ja.data("stop");ja=ja.data("bg");$([fb,ba,ja]).remove()}Wa=null}function d(){var ja=Ra?"rotate("+Ra+","+Da+","+gb+") ":"";db===1&&La===1?W.removeAttribute("gradientTransform"):W.setAttribute("gradientTransform",
ja+"translate("+-Da*(db-1)+","+-gb*(La-1)+") scale("+db+","+La+")")}function l(ja){var ba=ja.pageX-wa.left;ja=ja.pageY-wa.top;ba=ba<10?10:ba>ha+10?ha+10:ba;var ka="translate("+ba+", 26)";if(ja<-60||ja>130){Ca.setAttribute("display","block");Ca.setAttribute("transform",ka)}else Ca.setAttribute("display","none");Wa.setAttribute("transform",ka);$.data(Wa,"bg").setAttribute("transform",ka);$.data(Wa,"stop").setAttribute("offset",(ba-10)/ha);var N=0;$(V).find("stop").each(function(){var Q=this.getAttribute("offset"), ja+"translate("+-Da*(db-1)+","+-gb*(La-1)+") scale("+db+","+La+")")}function l(ja){var ba=ja.pageX-wa.left;ja=ja.pageY-wa.top;ba=ba<10?10:ba>aa+10?aa+10:ba;var ka="translate("+ba+", 26)";if(ja<-60||ja>130){Ca.setAttribute("display","block");Ca.setAttribute("transform",ka)}else Ca.setAttribute("display","none");Wa.setAttribute("transform",ka);$.data(Wa,"bg").setAttribute("transform",ka);$.data(Wa,"stop").setAttribute("offset",(ba-10)/aa);var N=0;$(W).find("stop").each(function(){var Q=this.getAttribute("offset"),
ea=$(this);if(Q<N){ea.prev().before(ea);xa=$(V).find("stop")}N=Q})}var s=$(this),C=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),p=s.attr("id"),L="#"+s.attr("id")+" ";if(L){var R=function(){switch(s.paint.type){case "radialGradient":s.paint.linearGradient=null;break;case "linearGradient":s.paint.radialGradient=null;break;case "solidColor":s.paint.radialGradient=s.paint.linearGradient=null}$.isFunction(s.okCallback)&&s.okCallback(s.paint);s.hide()},O=function(){$.isFunction(s.cancelCallback)&&s.cancelCallback(); fa=$(this);if(Q<N){fa.prev().before(fa);xa=$(W).find("stop")}N=Q})}var s=$(this),C=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),p=s.attr("id"),L="#"+s.attr("id")+" ";if(L){var R=function(){switch(s.paint.type){case "radialGradient":s.paint.linearGradient=null;break;case "linearGradient":s.paint.radialGradient=null;break;case "solidColor":s.paint.radialGradient=s.paint.linearGradient=null}$.isFunction(s.okCallback)&&s.okCallback(s.paint);s.hide()},O=function(){$.isFunction(s.cancelCallback)&&s.cancelCallback();
s.hide()};$.extend(true,s,{paint:new $.jGraduate.Paint({copy:C.paint}),okCallback:$.isFunction(n[1])&&n[1]||null,cancelCallback:$.isFunction(n[2])&&n[2]||null});s.position();var K=null,P=$(window);if(s.paint.type=="none")s.paint=$.jGraduate.Paint({solidColor:"ffffff"});s.addClass("jGraduate_Picker");s.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="'+ s.hide()};$.extend(true,s,{paint:new $.jGraduate.Paint({copy:C.paint}),okCallback:$.isFunction(n[1])&&n[1]||null,cancelCallback:$.isFunction(n[2])&&n[2]||null});s.position();var K=null,P=$(window);if(s.paint.type=="none")s.paint=$.jGraduate.Paint({solidColor:"ffffff"});s.addClass("jGraduate_Picker");s.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="'+
p+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var T=$(L+"> .jGraduate_colPick"),M=$(L+"> .jGraduate_gradPick");M.html('<div id="'+p+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+C.window.pickerTitle+'</h2><div id="'+p+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+p+'_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+ p+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var T=$(L+"> .jGraduate_colPick"),M=$(L+"> .jGraduate_gradPick");M.html('<div id="'+p+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+C.window.pickerTitle+'</h2><div id="'+p+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+p+'_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+
p+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+p+'_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+p+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+ p+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+p+'_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+p+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+
@ -34,25 +34,25 @@ p+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'
p+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+p+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+p+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+ p+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+p+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+p+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+
p+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+p+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+p+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+C.images.clientPath+ p+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+p+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+p+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+C.images.clientPath+
'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba&nbsp;</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+p+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+p+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+ 'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba&nbsp;</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+p+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+p+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+
p+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+p+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var ha=256,na=ha-0,fa=ha-0,aa,V,ra,ia={};$(".jGraduate_SliderBar").width(145);var da=$("#"+p+"_jGraduate_GradContainer")[0],U=a("svg",{id:p+"_jgraduate_svg",width:ha,height:ha,xmlns:q.svg},da);aa=aa||s.paint.type;var Y=V=s.paint[aa],oa=s.paint.alpha,pa=aa==="solidColor";switch(aa){case "solidColor":case "linearGradient":if(!pa){V.id=p+"_lg_jgraduate_grad"; p+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+p+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var aa=256,qa=aa-0,ha=aa-0,ca,W,ra,ia={};$(".jGraduate_SliderBar").width(145);var ea=$("#"+p+"_jGraduate_GradContainer")[0],U=a("svg",{id:p+"_jgraduate_svg",width:aa,height:aa,xmlns:q.svg},ea);ca=ca||s.paint.type;var Y=W=s.paint[ca],na=s.paint.alpha,oa=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!oa){W.id=p+"_lg_jgraduate_grad";
Y=V=U.appendChild(V)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},U);if(aa==="linearGradient")break;case "radialGradient":if(!pa){V.id=p+"_rg_jgraduate_grad";Y=V=U.appendChild(V)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},U)}if(pa){Y=V=$("#"+p+"_lg_jgraduate_grad")[0];K=s.paint[aa];u(0,"#"+K,1);var la=typeof C.newstop;if(la==="string")switch(C.newstop){case "same":u(1,"#"+K,1);break;case "inverse":la="";for(var ma=0;ma<6;ma+=2){K.substr(ma,2);var Ba=(255-parseInt(K.substr(ma,2),16)).toString(16); Y=W=U.appendChild(W)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},U);if(ca==="linearGradient")break;case "radialGradient":if(!oa){W.id=p+"_rg_jgraduate_grad";Y=W=U.appendChild(W)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},U)}if(oa){Y=W=$("#"+p+"_lg_jgraduate_grad")[0];K=s.paint[ca];u(0,"#"+K,1);var la=typeof C.newstop;if(la==="string")switch(C.newstop){case "same":u(1,"#"+K,1);break;case "inverse":la="";for(var ma=0;ma<6;ma+=2){K.substr(ma,2);var Ba=(255-parseInt(K.substr(ma,2),16)).toString(16);
if(Ba.length<2)Ba=0+Ba;la+=Ba}u(1,"#"+la,1);break;case "white":u(1,"#ffffff",1);break;case "black":u(1,"#000000",1)}else if(la==="object")u(1,C.newstop.color||"#"+K,"opac"in C.newstop?C.newstop.opac:1)}K=parseFloat(Y.getAttribute("x1")||0);la=parseFloat(Y.getAttribute("y1")||0);ma=parseFloat(Y.getAttribute("x2")||1);Ba=parseFloat(Y.getAttribute("y2")||0);var Ea=parseFloat(Y.getAttribute("cx")||0.5),Ia=parseFloat(Y.getAttribute("cy")||0.5),za=parseFloat(Y.getAttribute("fx")||Ea),Ka=parseFloat(Y.getAttribute("fy")|| if(Ba.length<2)Ba=0+Ba;la+=Ba}u(1,"#"+la,1);break;case "white":u(1,"#ffffff",1);break;case "black":u(1,"#000000",1)}else if(la==="object")u(1,C.newstop.color||"#"+K,"opac"in C.newstop?C.newstop.opac:1)}K=parseFloat(Y.getAttribute("x1")||0);la=parseFloat(Y.getAttribute("y1")||0);ma=parseFloat(Y.getAttribute("x2")||1);Ba=parseFloat(Y.getAttribute("y2")||0);var Ea=parseFloat(Y.getAttribute("cx")||0.5),Ia=parseFloat(Y.getAttribute("cy")||0.5),za=parseFloat(Y.getAttribute("fx")||Ea),Ka=parseFloat(Y.getAttribute("fy")||
Ia);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:na,height:fa,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":oa/100},U);var Na=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:la*ha,left:K*ha}).data("coord","start").appendTo(da),Aa=Na.clone().text(2).css({top:Ba*ha,left:ma*ha}).attr("title","End stop").data("coord","end").appendTo(da),ya=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ia*ha,left:Ea* Ia);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:qa,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":na/100},U);var Na=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:la*aa,left:K*aa}).data("coord","start").appendTo(ea),Aa=Na.clone().text(2).css({top:Ba*aa,left:ma*aa}).attr("title","End stop").data("coord","end").appendTo(ea),ya=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ia*aa,left:Ea*
ha}).data("coord","center").appendTo(da),Ga=ya.clone().text("F").css({top:Ka*ha,left:za*ha,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);Ga[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ja,ba){var ka=V.getAttribute(ba),N=isNaN(ba[1]);ka||(ka=N?"0.5":ba==="x2"?"1.0":"0.0");ia[ba]=$("#"+p+"_jGraduate_"+ba).val(ka).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> aa}).data("coord","center").appendTo(ea),Ga=ya.clone().text("F").css({top:Ka*aa,left:za*aa,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ea);Ga[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ja,ba){var ka=W.getAttribute(ba),N=isNaN(ba[1]);ka||(ka=N?"0.5":ba==="x2"?"1.0":"0.0");ia[ba]=$("#"+p+"_jGraduate_"+ba).val(ka).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"&&!hb))if(N&&aa==="radialGradient"||!N&&aa==="linearGradient")V.setAttribute(ba,this.value);var Q=N?ba[0]==="c"?ya:Ga:ba[1]==="1"?Na:Aa,ea=ba.indexOf("x")>=0?"left":"top";Q.css(ea,this.value*ha)}).change()});var xa,nb,Ya=$("#"+p+"_jGraduate_StopSlider"),fb,Sa,Wa,Ca=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Sa),wa,db=1,La=1,Ra=0,Da=Ea,gb=Ia;Sa=a("svg",{width:"100%",height:45},Ya[0]);da=a("pattern",{width:16, 1)this.value=1;if(!(ba[0]==="f"&&!hb))if(N&&ca==="radialGradient"||!N&&ca==="linearGradient")W.setAttribute(ba,this.value);var Q=N?ba[0]==="c"?ya:Ga:ba[1]==="1"?Na:Aa,fa=ba.indexOf("x")>=0?"left":"top";Q.css(fa,this.value*aa)}).change()});var xa,nb,Ya=$("#"+p+"_jGraduate_StopSlider"),fb,Sa,Wa,Ca=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Sa),wa,db=1,La=1,Ra=0,Da=Ea,gb=Ia;Sa=a("svg",{width:"100%",height:45},Ya[0]);ea=a("pattern",{width:16,
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Sa);a("image",{width:16,height:16},da).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Sa).on("click touchstart",function(ja){wa=Ya.offset();if(ja.target.tagName!=="path"){var ba=ja.pageX-wa.left-8;ba=ba<10?10:ba>ha+10?ha+10:ba;u(ba/ha,0,0,true);ja.stopPropagation()}});$(Sa).mouseover(function(){Sa.appendChild(Ca)});nb=a("g",{},Sa);a("line",{x1:10,y1:15,x2:ha+10,y2:15,"stroke-width":2,stroke:"#000"},Sa);var rb= height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Sa);a("image",{width:16,height:16},ea).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Sa).on("click touchstart",function(ja){wa=Ya.offset();if(ja.target.tagName!=="path"){var ba=ja.pageX-wa.left-8;ba=ba<10?10:ba>aa+10?aa+10:ba;u(ba/aa,0,0,true);ja.stopPropagation()}});$(Sa).mouseover(function(){Sa.appendChild(Ca)});nb=a("g",{},Sa);a("line",{x1:10,y1:15,x2:aa+10,y2:15,"stroke-width":2,stroke:"#000"},Sa);var rb=
M.find(".jGraduate_spreadMethod").change(function(){V.setAttribute("spreadMethod",$(this).val())}),Xa=null,ab=function(ja){var ba=ja.pageX-jb.left,ka=ja.pageY-jb.top;ba=ba<0?0:ba>ha?ha:ba;ka=ka<0?0:ka>ha?ha:ka;Xa.css("left",ba).css("top",ka);ba=ba/na;ka=ka/fa;var N=Xa.data("coord"),Q=V;switch(N){case "start":ia.x1.val(ba);ia.y1.val(ka);Q.setAttribute("x1",ba);Q.setAttribute("y1",ka);break;case "end":ia.x2.val(ba);ia.y2.val(ka);Q.setAttribute("x2",ba);Q.setAttribute("y2",ka);break;case "center":ia.cx.val(ba); M.find(".jGraduate_spreadMethod").change(function(){W.setAttribute("spreadMethod",$(this).val())}),Xa=null,ab=function(ja){var ba=ja.pageX-jb.left,ka=ja.pageY-jb.top;ba=ba<0?0:ba>aa?aa:ba;ka=ka<0?0:ka>aa?aa:ka;Xa.css("left",ba).css("top",ka);ba=ba/qa;ka=ka/ha;var N=Xa.data("coord"),Q=W;switch(N){case "start":ia.x1.val(ba);ia.y1.val(ka);Q.setAttribute("x1",ba);Q.setAttribute("y1",ka);break;case "end":ia.x2.val(ba);ia.y2.val(ka);Q.setAttribute("x2",ba);Q.setAttribute("y2",ka);break;case "center":ia.cx.val(ba);
ia.cy.val(ka);Q.setAttribute("cx",ba);Q.setAttribute("cy",ka);Da=ba;gb=ka;d();break;case "focus":ia.fx.val(ba);ia.fy.val(ka);Q.setAttribute("fx",ba);Q.setAttribute("fy",ka);d()}ja.preventDefault()},xb=function(){Xa=null;P.unbind("mousemove",ab).unbind("mouseup",xb)};xa=V.getElementsByTagNameNS(q.svg,"stop");if(ua<2){for(;ua<2;){V.appendChild(document.createElementNS(q.svg,"stop"));++ua}xa=V.getElementsByTagNameNS(q.svg,"stop")}var ua=xa.length;for(ma=0;ma<ua;ma++)u(0,0,0,0,xa[ma]);rb.val(V.getAttribute("spreadMethod")|| ia.cy.val(ka);Q.setAttribute("cx",ba);Q.setAttribute("cy",ka);Da=ba;gb=ka;d();break;case "focus":ia.fx.val(ba);ia.fy.val(ka);Q.setAttribute("fx",ba);Q.setAttribute("fy",ka);d()}ja.preventDefault()},xb=function(){Xa=null;P.unbind("mousemove",ab).unbind("mouseup",xb)};xa=W.getElementsByTagNameNS(q.svg,"stop");if(ua<2){for(;ua<2;){W.appendChild(document.createElementNS(q.svg,"stop"));++ua}xa=W.getElementsByTagNameNS(q.svg,"stop")}var ua=xa.length;for(ma=0;ma<ua;ma++)u(0,0,0,0,xa[ma]);rb.val(W.getAttribute("spreadMethod")||
"pad");var jb,hb=false;ra.setAttribute("fill-opacity",oa/100);$("#"+p+" div.grad_coord").mousedown(function(ja){ja.preventDefault();Xa=$(this);Xa.offset();jb=Xa.parent().offset();P.mousemove(ab).mouseup(xb)});$("#"+p+"_jGraduate_Ok").bind("click touchstart",function(){s.paint.type=aa;s.paint[aa]=V.cloneNode(true);s.paint.solidColor=null;R()});$("#"+p+"_jGraduate_Cancel").bind("click touchstart",function(){O()});if(aa==="radialGradient")if(hb)Ga.show();else{Ga.hide();ia.fx.val("");ia.fy.val("")}$("#"+ "pad");var jb,hb=false;ra.setAttribute("fill-opacity",na/100);$("#"+p+" div.grad_coord").mousedown(function(ja){ja.preventDefault();Xa=$(this);Xa.offset();jb=Xa.parent().offset();P.mousemove(ab).mouseup(xb)});$("#"+p+"_jGraduate_Ok").bind("click touchstart",function(){s.paint.type=ca;s.paint[ca]=W.cloneNode(true);s.paint.solidColor=null;R()});$("#"+p+"_jGraduate_Cancel").bind("click touchstart",function(){O()});if(ca==="radialGradient")if(hb)Ga.show();else{Ga.hide();ia.fx.val("");ia.fy.val("")}$("#"+
p+"_jGraduate_match_ctr")[0].checked=!hb;var ub,lb;$("#"+p+"_jGraduate_match_ctr").change(function(){hb=!this.checked;Ga.toggle(hb);ia.fx.val("");ia.fy.val("");var ja=V;if(hb){var ba=ub||0.5,ka=lb||0.5;ja.setAttribute("fx",ba);ja.setAttribute("fy",ka);ia.fx.val(ba);ia.fy.val(ka)}else{ub=ja.getAttribute("fx");lb=ja.getAttribute("fy");ja.removeAttribute("fx");ja.removeAttribute("fy")}});xa=V.getElementsByTagNameNS(q.svg,"stop");ua=xa.length;if(ua<2){for(;ua<2;){V.appendChild(document.createElementNS(q.svg, p+"_jGraduate_match_ctr")[0].checked=!hb;var ub,lb;$("#"+p+"_jGraduate_match_ctr").change(function(){hb=!this.checked;Ga.toggle(hb);ia.fx.val("");ia.fy.val("");var ja=W;if(hb){var ba=ub||0.5,ka=lb||0.5;ja.setAttribute("fx",ba);ja.setAttribute("fy",ka);ia.fx.val(ba);ia.fy.val(ka)}else{ub=ja.getAttribute("fx");lb=ja.getAttribute("fy");ja.removeAttribute("fx");ja.removeAttribute("fy")}});xa=W.getElementsByTagNameNS(q.svg,"stop");ua=xa.length;if(ua<2){for(;ua<2;){W.appendChild(document.createElementNS(q.svg,
"stop"));++ua}xa=V.getElementsByTagNameNS(q.svg,"stop")}var eb;oa=M=0;if(aa==="radialGradient"){U=V.gradientTransform.baseVal;if(U.numberOfItems===2){ua=U.getItem(0);U=U.getItem(1);if(ua.type===2&&U.type===3){ua=U.matrix;if(ua.a!==1)M=Math.round(-(1-ua.a)*100);else if(ua.d!==1)M=Math.round((1-ua.d)*100)}}else if(U.numberOfItems===3){da=U.getItem(0);ua=U.getItem(1);U=U.getItem(2);if(da.type===4&&ua.type===2&&U.type===3){oa=Math.round(da.angle);ua=U.matrix;if(ua.a!==1)M=Math.round(-(1-ua.a)*100);else if(ua.d!== "stop"));++ua}xa=W.getElementsByTagNameNS(q.svg,"stop")}var eb;na=M=0;if(ca==="radialGradient"){U=W.gradientTransform.baseVal;if(U.numberOfItems===2){ua=U.getItem(0);U=U.getItem(1);if(ua.type===2&&U.type===3){ua=U.matrix;if(ua.a!==1)M=Math.round(-(1-ua.a)*100);else if(ua.d!==1)M=Math.round((1-ua.d)*100)}}else if(U.numberOfItems===3){ea=U.getItem(0);ua=U.getItem(1);U=U.getItem(2);if(ea.type===4&&ua.type===2&&U.type===3){na=Math.round(ea.angle);ua=U.matrix;if(ua.a!==1)M=Math.round(-(1-ua.a)*100);else if(ua.d!==
1)M=Math.round((1-ua.d)*100)}}}M={radius:{handle:"#"+p+"_jGraduate_RadiusArrows",input:"#"+p+"_jGraduate_RadiusInput",val:(V.getAttribute("r")||0.5)*100},opacity:{handle:"#"+p+"_jGraduate_OpacArrows",input:"#"+p+"_jGraduate_OpacInput",val:s.paint.alpha||100},ellip:{handle:"#"+p+"_jGraduate_EllipArrows",input:"#"+p+"_jGraduate_EllipInput",val:M},angle:{handle:"#"+p+"_jGraduate_AngleArrows",input:"#"+p+"_jGraduate_AngleInput",val:oa}};$.each(M,function(ja,ba){var ka=$(ba.handle);ka.mousedown(function(N){var Q= 1)M=Math.round((1-ua.d)*100)}}}M={radius:{handle:"#"+p+"_jGraduate_RadiusArrows",input:"#"+p+"_jGraduate_RadiusInput",val:(W.getAttribute("r")||0.5)*100},opacity:{handle:"#"+p+"_jGraduate_OpacArrows",input:"#"+p+"_jGraduate_OpacInput",val:s.paint.alpha||100},ellip:{handle:"#"+p+"_jGraduate_EllipArrows",input:"#"+p+"_jGraduate_EllipInput",val:M},angle:{handle:"#"+p+"_jGraduate_AngleArrows",input:"#"+p+"_jGraduate_AngleInput",val:na}};$.each(M,function(ja,ba){var ka=$(ba.handle);ka.mousedown(function(N){var Q=
ka.parent();eb={type:ja,elem:ka,input:$(ba.input),parent:Q,offset:Q.offset()};P.mousemove(sb).mouseup(ob);N.preventDefault()});$(ba.input).val(ba.val).change(function(){var N=+this.value,Q=0,ea=aa==="radialGradient";switch(ja){case "radius":ea&&V.setAttribute("r",N/100);Q=Math.pow(N/100,0.4)/2*145;break;case "opacity":s.paint.alpha=N;ra.setAttribute("fill-opacity",N/100);Q=N*1.45;break;case "ellip":db=La=1;if(N===0){Q=72.5;break}if(N>99.5)N=99.5;if(N>0)La=1-N/100;else db=-(N/100)-1;Q=145*((N+100)/ ka.parent();eb={type:ja,elem:ka,input:$(ba.input),parent:Q,offset:Q.offset()};P.mousemove(sb).mouseup(ob);N.preventDefault()});$(ba.input).val(ba.val).change(function(){var N=+this.value,Q=0,fa=ca==="radialGradient";switch(ja){case "radius":fa&&W.setAttribute("r",N/100);Q=Math.pow(N/100,0.4)/2*145;break;case "opacity":s.paint.alpha=N;ra.setAttribute("fill-opacity",N/100);Q=N*1.45;break;case "ellip":db=La=1;if(N===0){Q=72.5;break}if(N>99.5)N=99.5;if(N>0)La=1-N/100;else db=-(N/100)-1;Q=145*((N+100)/
2)/100;ea&&d();break;case "angle":Ra=N;Q=Ra/180;Q+=0.5;Q*=145;ea&&d()}if(Q>145)Q=145;else if(Q<0)Q=0;ka.css({"margin-left":Q-5})}).change()});var sb=function(ja){var ba=ja.pageX-eb.offset.left-parseInt(eb.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var ka=ba-5;ba/=145;switch(eb.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;V.setAttribute("r",ba);break;case "opacity":s.paint.alpha=parseInt(ba*100);ra.setAttribute("fill-opacity",ba);break; 2)/100;fa&&d();break;case "angle":Ra=N;Q=Ra/180;Q+=0.5;Q*=145;fa&&d()}if(Q>145)Q=145;else if(Q<0)Q=0;ka.css({"margin-left":Q-5})}).change()});var sb=function(ja){var ba=ja.pageX-eb.offset.left-parseInt(eb.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var ka=ba-5;ba/=145;switch(eb.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;W.setAttribute("r",ba);break;case "opacity":s.paint.alpha=parseInt(ba*100);ra.setAttribute("fill-opacity",ba);break;
case "ellip":La=db=1;if(ba<0.5){ba/=0.5;db=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5;ba=2-ba;La=ba<=0?0.01:ba}d();ba-=1;if(La===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Ra=ba*=180;d();ba/=100}eb.elem.css({"margin-left":ka});ba=Math.round(ba*100);eb.input.val(ba);ja.preventDefault()},ob=function(){P.unbind("mousemove",sb).unbind("mouseup",ob);eb=null};for(M=(s.paint.alpha*255/100).toString(16);M.length<2;)M="0"+M;M=M.split(".")[0];K=s.paint.solidColor=="none"?"":s.paint.solidColor+M;pa||(K=xa[0].getAttribute("stop-color")); case "ellip":La=db=1;if(ba<0.5){ba/=0.5;db=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5;ba=2-ba;La=ba<=0?0.01:ba}d();ba-=1;if(La===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Ra=ba*=180;d();ba/=100}eb.elem.css({"margin-left":ka});ba=Math.round(ba*100);eb.input.val(ba);ja.preventDefault()},ob=function(){P.unbind("mousemove",sb).unbind("mouseup",ob);eb=null};for(M=(s.paint.alpha*255/100).toString(16);M.length<2;)M="0"+M;M=M.split(".")[0];K=s.paint.solidColor=="none"?"":s.paint.solidColor+M;oa||(K=xa[0].getAttribute("stop-color"));
$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});T.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:K,alphaSupport:true}},function(ja){s.paint.type="solidColor";s.paint.alpha=ja.val("ahex")?Math.round(ja.val("a")/255*100):100;s.paint.solidColor=ja.val("hex")?ja.val("hex"):"none";s.paint.radialGradient=null;R()},null,function(){O()});var yb=$(L+" .jGraduate_tabs li");yb.on("click touchstart",function(){yb.removeClass("jGraduate_tab_current"); $.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});T.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:K,alphaSupport:true}},function(ja){s.paint.type="solidColor";s.paint.alpha=ja.val("ahex")?Math.round(ja.val("a")/255*100):100;s.paint.solidColor=ja.val("hex")?ja.val("hex"):"none";s.paint.radialGradient=null;R()},null,function(){O()});var yb=$(L+" .jGraduate_tabs li");yb.on("click touchstart",function(){yb.removeClass("jGraduate_tab_current");
$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ja=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ja==="rg"||ja==="lg"){$(".jGraduate_"+ja+"_field").show();$(".jGraduate_"+(ja==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ja+"_jgraduate_grad)");aa=ja==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(s.paint.alpha).change();var ba=$("#"+p+"_"+ja+"_jgraduate_grad")[0];if(V!==ba){var ka= $(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ja=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ja==="rg"||ja==="lg"){$(".jGraduate_"+ja+"_field").show();$(".jGraduate_"+(ja==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ja+"_jgraduate_grad)");ca=ja==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(s.paint.alpha).change();var ba=$("#"+p+"_"+ja+"_jgraduate_grad")[0];if(W!==ba){var ka=
$(V).find("stop");$(ba).empty().append(ka);V=ba;ba=rb.val();V.setAttribute("spreadMethod",ba)}hb=ja==="rg"&&V.getAttribute("fx")!=null&&!(Ea==za&&Ia==Ka);$("#"+p+"_jGraduate_focusCoord").toggle(hb);if(hb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();yb.removeClass("jGraduate_tab_current");var zb;switch(s.paint.type){case "linearGradient":zb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":zb= $(W).find("stop");$(ba).empty().append(ka);W=ba;ba=rb.val();W.setAttribute("spreadMethod",ba)}hb=ja==="rg"&&W.getAttribute("fx")!=null&&!(Ea==za&&Ia==Ka);$("#"+p+"_jGraduate_focusCoord").toggle(hb);if(hb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();yb.removeClass("jGraduate_tab_current");var zb;switch(s.paint.type){case "linearGradient":zb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":zb=
$(L+" .jGraduate_tab_radgrad");break;default:zb=$(L+" .jGraduate_tab_color")}s.show();setTimeout(function(){zb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),q=$(document);$.extend($.fn,{contextMenu:function(h,b){if(h.menu==undefined)return false;if(h.inSpeed==undefined)h.inSpeed=150;if(h.outSpeed==undefined)h.outSpeed=75;if(h.inSpeed==0)h.inSpeed=-1;if(h.outSpeed==0)h.outSpeed=-1;$(this).each(function(){var n=$(this),u=$(n).offset(),c=$("#"+h.menu);c.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(l){var s=$(this);s.unbind("mouseup");$(".contextMenu").hide();if(d.button===2|| $(L+" .jGraduate_tab_radgrad");break;default:zb=$(L+" .jGraduate_tab_color")}s.show();setTimeout(function(){zb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),q=$(document);$.extend($.fn,{contextMenu:function(h,b){if(h.menu==undefined)return false;if(h.inSpeed==undefined)h.inSpeed=150;if(h.outSpeed==undefined)h.outSpeed=75;if(h.inSpeed==0)h.inSpeed=-1;if(h.outSpeed==0)h.outSpeed=-1;$(this).each(function(){var n=$(this),u=$(n).offset(),c=$("#"+h.menu);c.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(l){var s=$(this);s.unbind("mouseup");$(".contextMenu").hide();if(d.button===2||
h.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||f(l,d,s)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var l=$(this);l.unbind("mouseup");f(d,d,l)});var f=function(d,l,s){if(typeof l=="undefined")l=d;d.stopPropagation();if(n.hasClass("disabled")||l.altKey)return false;var C=d.pageX,p=d.pageY;if(svgedit.browser.isTouch()){C=d.originalEvent.touches[0].pageX;p=d.originalEvent.touches[0].pageY}d=a.width()-c.width();l=a.height()-c.height();if(C>d-15)C=d-15; h.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||f(l,d,s)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var l=$(this);l.unbind("mouseup");f(d,d,l)});var f=function(d,l,s){if(typeof l=="undefined")l=d;d.stopPropagation();if(n.hasClass("disabled")||l.altKey)return false;var C=d.pageX,p=d.pageY;if(svgedit.browser.isTouch()){C=d.originalEvent.touches[0].pageX;p=d.originalEvent.touches[0].pageY}d=a.width()-c.width();l=a.height()-c.height();if(C>d-15)C=d-15;
if(p>l-30)p=l-30;if(svgedit.browser.isTouch())p-=c.height()/2;q.unbind("click");c.css({top:p,left:C}).fadeIn(h.inSpeed);c.find("A").mouseover(function(){c.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){c.find("LI.hover").removeClass("hover")});q.keypress(function(L){switch(L.keyCode){case 38:if(c.find("LI.hover").length){c.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:last").addClass("hover")}else c.find("LI:last").addClass("hover"); if(p>l-30)p=l-30;if(svgedit.browser.isTouch())p-=c.height()/2;q.unbind("click");c.css({top:p,left:C}).fadeIn(h.inSpeed);c.find("A").mouseover(function(){c.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){c.find("LI.hover").removeClass("hover")});q.keypress(function(L){switch(L.keyCode){case 38:if(c.find("LI.hover").length){c.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:last").addClass("hover")}else c.find("LI:last").addClass("hover");
@ -61,13 +61,13 @@ $(s),{x:C-u.left,y:p-u.top,docX:C,docY:p});return false});setTimeout(function(){
function(){return false})});return $(this)},disableContextMenuItems:function(h){if(h==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(h!=undefined)for(var b=h.split(","),n=0;n<b.length;n++)$(this).find('A[href="'+b[n]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(h){if(h==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(h!=undefined)for(var b=h.split(","),n= function(){return false})});return $(this)},disableContextMenuItems:function(h){if(h==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(h!=undefined)for(var b=h.split(","),n=0;n<b.length;n++)$(this).find('A[href="'+b[n]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(h){if(h==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(h!=undefined)for(var b=h.split(","),n=
0;n<b.length;n++)$(this).find('A[href="'+b[n]+'"]').parent().removeClass("disabled")});return $(this)},disableContextMenu:function(){$(this).each(function(){$(this).addClass("disabled")});return $(this)},enableContextMenu:function(){$(this).each(function(){$(this).removeClass("disabled")});return $(this)},destroyContextMenu:function(){$(this).each(function(){$(this).unbind("mousedown").unbind("mouseup")});return $(this)}})}(jQuery);var svgedit=svgedit||{}; 0;n<b.length;n++)$(this).find('A[href="'+b[n]+'"]').parent().removeClass("disabled")});return $(this)},disableContextMenu:function(){$(this).each(function(){$(this).addClass("disabled")});return $(this)},enableContextMenu:function(){$(this).each(function(){$(this).removeClass("disabled")});return $(this)},destroyContextMenu:function(){$(this).each(function(){$(this).unbind("mousedown").unbind("mouseup")});return $(this)}})}(jQuery);var svgedit=svgedit||{};
(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 q=navigator.userAgent,h=document.createElementNS("http://www.w3.org/2000/svg","svg"),b=!!window.opera,n=q.indexOf("AppleWebKit")>=0,u=q.indexOf("Gecko/")>=0,c=q.indexOf("MSIE")>=0,f=q.indexOf("Chrome/")>=0,d=q.indexOf("Windows")>=0,l=q.indexOf("Macintosh")>= (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 q=navigator.userAgent,h=document.createElementNS("http://www.w3.org/2000/svg","svg"),b=!!window.opera,n=q.indexOf("AppleWebKit")>=0,u=q.indexOf("Gecko/")>=0,c=q.indexOf("MSIE")>=0,f=q.indexOf("Chrome/")>=0,d=q.indexOf("Windows")>=0,l=q.indexOf("Macintosh")>=
0,s="ontouchstart"in window,C=!!h.querySelector,p=!!document.evaluate,L=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var fa=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{fa.replaceItem(na,0);return true}catch(aa){}return false}(),R=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var fa=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{fa.insertItemBefore(na, 0,s="ontouchstart"in window,C=!!h.querySelector,p=!!document.evaluate,L=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","path");aa.setAttribute("d","M0,0 10,10");var qa=aa.pathSegList;aa=aa.createSVGPathSegLinetoAbs(5,5);try{qa.replaceItem(aa,0);return true}catch(ha){}return false}(),R=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","path");aa.setAttribute("d","M0,0 10,10");var qa=aa.pathSegList;aa=aa.createSVGPathSegLinetoAbs(5,5);try{qa.insertItemBefore(aa,
0);return true}catch(aa){}return false}(),O=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg"),fa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);fa.setAttribute("x",5);na.appendChild(fa);var aa=document.createElementNS("http://www.w3.org/2000/svg","text");aa.textContent="a";fa.appendChild(aa);fa=aa.getStartPositionOfChar(0);fa=fa.x;document.documentElement.removeChild(na);return fa===0}(),K=function(){var na=document.createElementNS("http://www.w3.org/2000/svg", 0);return true}catch(ha){}return false}(),O=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(aa);var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 C0,0 10,10 10,0");aa.appendChild(qa);qa=qa.getBBox();document.documentElement.removeChild(aa);return qa.height>4&&qa.height<5}(),K=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(aa);
"svg");document.documentElement.appendChild(na);var fa=document.createElementNS("http://www.w3.org/2000/svg","path");fa.setAttribute("d","M0,0 C0,0 10,10 10,0");na.appendChild(fa);fa=fa.getBBox();document.documentElement.removeChild(na);return fa.height>4&&fa.height<5}(),P=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);var fa=document.createElementNS("http://www.w3.org/2000/svg","path");fa.setAttribute("d","M0,0 10,0");var aa= var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 10,0");var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M5,0 15,0");var ca=document.createElementNS("http://www.w3.org/2000/svg","g");ca.appendChild(qa);ca.appendChild(ha);aa.appendChild(ca);qa=ca.getBBox();document.documentElement.removeChild(aa);return qa.width==15}(),P=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","rect");aa.setAttribute("x",
document.createElementNS("http://www.w3.org/2000/svg","path");aa.setAttribute("d","M5,0 15,0");var V=document.createElementNS("http://www.w3.org/2000/svg","g");V.appendChild(fa);V.appendChild(aa);na.appendChild(V);fa=V.getBBox();document.documentElement.removeChild(na);return fa.width==15}(),T=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect");na.setAttribute("x",0.1);(na=na.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 <a href='http://opera.com'>latest version</a> in which the problems have been fixed."); 0.1);(aa=aa.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 <a href='http://opera.com'>latest version</a> in which the problems have been fixed.");return aa}(),T=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","rect");aa.setAttribute("style","vector-effect:non-scaling-stroke");return aa.style.vectorEffect==="non-scaling-stroke"}(),M=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg",
return na}(),M=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect");na.setAttribute("style","vector-effect:non-scaling-stroke");return na.style.vectorEffect==="non-scaling-stroke"}(),ha=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,fa=h.createSVGTransform();na.appendItem(fa);return na.getItem(0)==fa}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return n};svgedit.browser.isGecko=function(){return u}; "rect").transform.baseVal,qa=h.createSVGTransform();aa.appendItem(qa);return aa.getItem(0)==qa}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return n};svgedit.browser.isGecko=function(){return u};svgedit.browser.isIE=function(){return c};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return s};svgedit.browser.supportsSelectors=function(){return C};
svgedit.browser.isIE=function(){return c};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return s};svgedit.browser.supportsSelectors=function(){return C};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return R};svgedit.browser.supportsPathBBox=function(){return K}; svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return R};svgedit.browser.supportsPathBBox=function(){return O};svgedit.browser.supportsHVLineContainerBBox=function(){return K};svgedit.browser.supportsGoodTextCharPos=function(){};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return P};svgedit.browser.supportsNonScalingStroke=
svgedit.browser.supportsHVLineContainerBBox=function(){return P};svgedit.browser.supportsGoodTextCharPos=function(){return O};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return T};svgedit.browser.supportsNonScalingStroke=function(){return M};svgedit.browser.supportsNativeTransformLists=function(){return ha}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; function(){return T};svgedit.browser.supportsNativeTransformLists=function(){return M}}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"),q={};svgedit.transformlist.SVGTransformList=function(h){this._elem=h||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var n=0;n<this.numberOfItems;++n){var u=this._list.getItem(n);b=b;u=u;var c=u.matrix,f="";switch(u.type){case 1:f="matrix("+[c.a,c.b,c.c,c.d,c.e,c.f].join(",")+")";break;case 2:f="translate("+c.e+","+c.f+")";break;case 3:f= (function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),q={};svgedit.transformlist.SVGTransformList=function(h){this._elem=h||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var n=0;n<this.numberOfItems;++n){var u=this._list.getItem(n);b=b;u=u;var c=u.matrix,f="";switch(u.type){case 1:f="matrix("+[c.a,c.b,c.c,c.d,c.e,c.f].join(",")+")";break;case 2:f="translate("+c.e+","+c.f+")";break;case 3:f=
c.a==c.d?"scale("+c.a+")":"scale("+c.a+","+c.d+")";break;case 4:var d=0;f=0;if(u.angle!=0){d=1-c.a;f=(d*c.f+c.b*c.e)/(d*d+c.b*c.b);d=(c.e-c.b*f)/d}f="rotate("+u.angle+" "+d+","+f+")"}b=b+(f+" ")}this._elem.setAttribute("transform",b)};this._list=this;this._init=function(){var b=this._elem.getAttribute("transform");if(b)for(var n=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,u=true;u;){u=b.match(n);b=b.replace(n,"");if(u&&u[1]){var c=u[1].split(/\s*\(/),f=c[0];c=c[1].match(/\s*(.*?)\s*\)/); c.a==c.d?"scale("+c.a+")":"scale("+c.a+","+c.d+")";break;case 4:var d=0;f=0;if(u.angle!=0){d=1-c.a;f=(d*c.f+c.b*c.e)/(d*d+c.b*c.b);d=(c.e-c.b*f)/d}f="rotate("+u.angle+" "+d+","+f+")"}b=b+(f+" ")}this._elem.setAttribute("transform",b)};this._list=this;this._init=function(){var b=this._elem.getAttribute("transform");if(b)for(var n=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,u=true;u;){u=b.match(n);b=b.replace(n,"");if(u&&u[1]){var c=u[1].split(/\s*\(/),f=c[0];c=c[1].match(/\s*(.*?)\s*\)/);
c[1]=c[1].replace(/(\d)-/g,"$1 -");var d=c[1].split(/[, ]+/),l="abcdef".split(""),s=a.createSVGMatrix();$.each(d,function(L,R){d[L]=parseFloat(R);if(f=="matrix")s[l[L]]=d[L]});c=a.createSVGTransform();var C="set"+f.charAt(0).toUpperCase()+f.slice(1),p=f=="matrix"?[s]:d;if(f=="scale"&&p.length==1)p.push(p[0]);else if(f=="translate"&&p.length==1)p.push(0);else if(f=="rotate"&&p.length==1){p.push(0);p.push(0)}c[C].apply(c,p);this._list.appendItem(c)}}};this._removeFromOtherLists=function(b){if(b){var n= c[1]=c[1].replace(/(\d)-/g,"$1 -");var d=c[1].split(/[, ]+/),l="abcdef".split(""),s=a.createSVGMatrix();$.each(d,function(L,R){d[L]=parseFloat(R);if(f=="matrix")s[l[L]]=d[L]});c=a.createSVGTransform();var C="set"+f.charAt(0).toUpperCase()+f.slice(1),p=f=="matrix"?[s]:d;if(f=="scale"&&p.length==1)p.push(p[0]);else if(f=="translate"&&p.length==1)p.push(0);else if(f=="rotate"&&p.length==1){p.push(0);p.push(0)}c[C].apply(c,p);this._list.appendItem(c)}}};this._removeFromOtherLists=function(b){if(b){var n=
@ -93,7 +93,7 @@ d=d<<2|l>>4;l=(l&15)<<4|C>>2;s=(C&3)<<6|p;f+=String.fromCharCode(d);if(C!=64)f+=
new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{f=d.loadXML?d.loadXML(c)?d:false:d.parseFromString(c,"text/xml")}catch(s){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(c){return{x:c.x,y:c.y,width:c.width,height:c.height}};svgedit.utilities.walkTree=function(c,f){if(c&&c.nodeType==1){f(c);for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f)}}; new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{f=d.loadXML?d.loadXML(c)?d:false:d.parseFromString(c,"text/xml")}catch(s){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(c){return{x:c.x,y:c.y,width:c.width,height:c.height}};svgedit.utilities.walkTree=function(c,f){if(c&&c.nodeType==1){f(c);for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f)}};
svgedit.utilities.walkTreePost=function(c,f){if(c&&c.nodeType==1){for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f);f(c)}};svgedit.utilities.getUrlFromAttr=function(c){if(c)if(c.indexOf('url("')===0)return c.substring(5,c.indexOf('"',6));else if(c.indexOf("url('")===0)return c.substring(5,c.indexOf("'",6));else if(c.indexOf("url(")===0)return c.substring(4,c.indexOf(")"));return null};svgedit.utilities.getHref=function(c){return c.getAttributeNS("http://www.w3.org/1999/xlink", svgedit.utilities.walkTreePost=function(c,f){if(c&&c.nodeType==1){for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f);f(c)}};svgedit.utilities.getUrlFromAttr=function(c){if(c)if(c.indexOf('url("')===0)return c.substring(5,c.indexOf('"',6));else if(c.indexOf("url('")===0)return c.substring(5,c.indexOf("'",6));else if(c.indexOf("url(")===0)return c.substring(4,c.indexOf(")"));return null};svgedit.utilities.getHref=function(c){return c.getAttributeNS("http://www.w3.org/1999/xlink",
"href")};svgedit.utilities.setHref=function(c,f){c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(c){c=h.getSVGContent().documentElement;var f=c.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:c.insertBefore(c.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),c.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(c){var f=c.pathSegList,d=f.numberOfItems;c=[[],[]];var l=f.getItem(0), "href")};svgedit.utilities.setHref=function(c,f){c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(c){c=h.getSVGContent().documentElement;var f=c.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:c.insertBefore(c.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),c.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(c){var f=c.pathSegList,d=f.numberOfItems;c=[[],[]];var l=f.getItem(0),
s=[l.x,l.y];for(l=0;l<d;l++){var C=f.getItem(l);if(typeof C.x!="undefined"){c[0].push(s[0]);c[1].push(s[1]);if(C.x1){for(var p=[C.x1,C.y1],L=[C.x2,C.y2],R=[C.x,C.y],O=0;O<2;O++){C=function(ha){return Math.pow(1-ha,3)*s[O]+3*Math.pow(1-ha,2)*ha*p[O]+3*(1-ha)*Math.pow(ha,2)*L[O]+Math.pow(ha,3)*R[O]};var K=6*s[O]-12*p[O]+6*L[O],P=-3*s[O]+9*p[O]-9*L[O]+3*R[O],T=3*p[O]-3*s[O];if(P==0){if(K!=0){K=-T/K;0<K&&K<1&&c[O].push(C(K))}}else{T=Math.pow(K,2)-4*T*P;if(!(T<0)){var M=(-K+Math.sqrt(T))/(2*P);0<M&&M< s=[l.x,l.y];for(l=0;l<d;l++){var C=f.getItem(l);if(typeof C.x!="undefined"){c[0].push(s[0]);c[1].push(s[1]);if(C.x1){for(var p=[C.x1,C.y1],L=[C.x2,C.y2],R=[C.x,C.y],O=0;O<2;O++){C=function(aa){return Math.pow(1-aa,3)*s[O]+3*Math.pow(1-aa,2)*aa*p[O]+3*(1-aa)*Math.pow(aa,2)*L[O]+Math.pow(aa,3)*R[O]};var K=6*s[O]-12*p[O]+6*L[O],P=-3*s[O]+9*p[O]-9*L[O]+3*R[O],T=3*p[O]-3*s[O];if(P==0){if(K!=0){K=-T/K;0<K&&K<1&&c[O].push(C(K))}}else{T=Math.pow(K,2)-4*T*P;if(!(T<0)){var M=(-K+Math.sqrt(T))/(2*P);0<M&&M<
1&&c[O].push(C(M));K=(-K-Math.sqrt(T))/(2*P);0<K&&K<1&&c[O].push(C(K))}}}s=R}else{c[0].push(C.x);c[1].push(C.y)}}}f=Math.min.apply(null,c[0]);d=Math.max.apply(null,c[0])-f;l=Math.min.apply(null,c[1]);c=Math.max.apply(null,c[1])-l;return{x:f,y:l,width:d,height:c}};svgedit.utilities.getBBox=function(c){var f=c||h.geSelectedElements()[0];if(c.nodeType!=1)return null;c=null;var d=f.nodeName;switch(d){case "text":if(f.textContent===""){f.textContent="a";c=f.getBBox();f.textContent=""}else try{c=f.getBBox()}catch(l){}break; 1&&c[O].push(C(M));K=(-K-Math.sqrt(T))/(2*P);0<K&&K<1&&c[O].push(C(K))}}}s=R}else{c[0].push(C.x);c[1].push(C.y)}}}f=Math.min.apply(null,c[0]);d=Math.max.apply(null,c[0])-f;l=Math.min.apply(null,c[1]);c=Math.max.apply(null,c[1])-l;return{x:f,y:l,width:d,height:c}};svgedit.utilities.getBBox=function(c){var f=c||h.geSelectedElements()[0];if(c.nodeType!=1)return null;c=null;var d=f.nodeName;switch(d){case "text":if(f.textContent===""){f.textContent="a";c=f.getBBox();f.textContent=""}else try{c=f.getBBox()}catch(l){}break;
case "path":if(svgedit.browser.supportsPathBBox())try{c=f.getBBox()}catch(s){}else c=svgedit.utilities.getPathBBox(f);break;case "g":case "a":c=a(f);break;default:if(d==="use")c=a(f,true);if(d==="use"){c||(c=f.getBBox());if(!svgedit.browser.isWebkit()){d={};d.width=c.width;d.height=c.height;d.x=c.x+parseFloat(f.getAttribute("x")||0);d.y=c.y+parseFloat(f.getAttribute("y")||0);c=d}}else if(~q.indexOf(d))try{c=f.getBBox()}catch(C){f=$(f).closest("foreignObject");if(f.length)try{c=f[0].getBBox()}catch(p){c= case "path":if(svgedit.browser.supportsPathBBox())try{c=f.getBBox()}catch(s){}else c=svgedit.utilities.getPathBBox(f);break;case "g":case "a":c=a(f);break;default:if(d==="use")c=a(f,true);if(d==="use"){c||(c=f.getBBox());if(!svgedit.browser.isWebkit()){d={};d.width=c.width;d.height=c.height;d.x=c.x+parseFloat(f.getAttribute("x")||0);d.y=c.y+parseFloat(f.getAttribute("y")||0);c=d}}else if(~q.indexOf(d))try{c=f.getBBox()}catch(C){f=$(f).closest("foreignObject");if(f.length)try{c=f[0].getBBox()}catch(p){c=
null}else c=null}}if(c)c=svgedit.utilities.bboxToObj(c);return c};svgedit.utilities.getRotationAngle=function(c,f){var d=c||h.getSelectedElements()[0];d=svgedit.transformlist.getTransformList(d);if(!d)return 0;for(var l=d.numberOfItems,s=0;s<l;++s){var C=d.getItem(s);if(C.type==4)return f?C.angle*Math.PI/180:C.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(c){return u.querySelector("#"+c)}:svgedit.browser.supportsXpath()?function(c){return b.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+ null}else c=null}}if(c)c=svgedit.utilities.bboxToObj(c);return c};svgedit.utilities.getRotationAngle=function(c,f){var d=c||h.getSelectedElements()[0];d=svgedit.transformlist.getTransformList(d);if(!d)return 0;for(var l=d.numberOfItems,s=0;s<l;++s){var C=d.getItem(s);if(C.type==4)return f?C.angle*Math.PI/180:C.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(c){return u.querySelector("#"+c)}:svgedit.browser.supportsXpath()?function(c){return b.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+
@ -199,14 +199,14 @@ G=G.cloneNode(true);$(G).attr(E);G.id=ka();kb().appendChild(G);e.setAttribute(z,
true);a.appendChild(d);var l=f.createElementNS(b,"svg");(c.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:u[0],height:u[1],x:u[0],y:u[1],overflow:n.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");l.appendChild(e)})();var s="svg_";c.setIdPrefix= true);a.appendChild(d);var l=f.createElementNS(b,"svg");(c.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:u[0],height:u[1],x:u[0],y:u[1],overflow:n.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");l.appendChild(e)})();var s="svg_";c.setIdPrefix=
function(e){s=e};c.current_drawing_=new svgedit.draw.Drawing(l,s);var C=c.getCurrentDrawing=function(){return c.current_drawing_},p=1,L=null,R={shape:{fill:(n.initFill.color=="none"?"":"#")+n.initFill.color,fill_paint:null,fill_opacity:n.initFill.opacity,stroke:"#"+n.initStroke.color,stroke_paint:null,stroke_opacity:n.initStroke.opacity,stroke_width:n.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:n.initOpacity}};R.text=$.extend(true,{},R.shape);$.extend(R.text, function(e){s=e};c.current_drawing_=new svgedit.draw.Drawing(l,s);var C=c.getCurrentDrawing=function(){return c.current_drawing_},p=1,L=null,R={shape:{fill:(n.initFill.color=="none"?"":"#")+n.initFill.color,fill_paint:null,fill_opacity:n.initFill.opacity,stroke:"#"+n.initStroke.color,stroke_paint:null,stroke_opacity:n.initStroke.opacity,stroke_width:n.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:n.initOpacity}};R.text=$.extend(true,{},R.shape);$.extend(R.text,
{fill:"#000000",stroke_width:0,font_size:24,font_family:"Helvetica, Arial, sans-serif"});var O=R.shape,K=Array(1),P=this.addSvgElementFromJson=function(e){var k=svgedit.utilities.getElem(e.attr.id),m=C().getCurrentLayer();if(k&&e.element!=k.tagName){m.removeChild(k);k=null}if(!k){k=f.createElementNS(b,e.element);if(m)(L||m).appendChild(k)}e.curStyles&&svgedit.utilities.assignAttributes(k,{fill:O.fill,stroke:O.stroke,"stroke-width":O.stroke_width,"stroke-dasharray":O.stroke_dasharray,"stroke-linejoin":O.stroke_linejoin, {fill:"#000000",stroke_width:0,font_size:24,font_family:"Helvetica, Arial, sans-serif"});var O=R.shape,K=Array(1),P=this.addSvgElementFromJson=function(e){var k=svgedit.utilities.getElem(e.attr.id),m=C().getCurrentLayer();if(k&&e.element!=k.tagName){m.removeChild(k);k=null}if(!k){k=f.createElementNS(b,e.element);if(m)(L||m).appendChild(k)}e.curStyles&&svgedit.utilities.assignAttributes(k,{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(k,e.attr,100);svgedit.utilities.cleanupElement(k);return k},T=c.getTransformList=svgedit.transformlist.getTransformList,M=svgedit.math.transformPoint,ha=c.matrixMultiply=svgedit.math.matrixMultiply,na=c.hasMatrixTransform=svgedit.math.hasMatrixTransform,fa=c.transformListToTransform=svgedit.math.transformListToTransform, "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(k,e.attr,100);svgedit.utilities.cleanupElement(k);return k},T=c.getTransformList=svgedit.transformlist.getTransformList,M=svgedit.math.transformPoint,aa=c.matrixMultiply=svgedit.math.matrixMultiply,qa=c.hasMatrixTransform=svgedit.math.hasMatrixTransform,ha=c.transformListToTransform=svgedit.math.transformListToTransform,
aa=svgedit.math.snapToAngle,V=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return n.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/p},getWidth:function(){return l.getAttribute("width")/p},getRoundDigits:function(){return db.round_digits}});var ra=c.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return K}, ca=svgedit.math.snapToAngle,W=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return n.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/p},getWidth:function(){return l.getAttribute("width")/p},getRoundDigits:function(){return db.round_digits}});var ra=c.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return K},
getSVGContent:function(){return l}});var ia=c.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,da=c.getHref=svgedit.utilities.getHref,U=c.setHref=svgedit.utilities.setHref,Y=svgedit.utilities.getPathBBox;c.getBBox=svgedit.utilities.getBBox;var oa=c.getRotationAngle=svgedit.utilities.getRotationAngle,pa=c.getElem=svgedit.utilities.getElem,la=c.assignAttributes=svgedit.utilities.assignAttributes,ma=this.cleanupElement=svgedit.utilities.cleanupElement,Ba=svgedit.sanitize.getNSMap(),Ea=c.sanitizeSvg=svgedit.sanitize.sanitizeSvg, getSVGContent:function(){return l}});var ia=c.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ea=c.getHref=svgedit.utilities.getHref,U=c.setHref=svgedit.utilities.setHref,Y=svgedit.utilities.getPathBBox;c.getBBox=svgedit.utilities.getBBox;var na=c.getRotationAngle=svgedit.utilities.getRotationAngle,oa=c.getElem=svgedit.utilities.getElem,la=c.assignAttributes=svgedit.utilities.assignAttributes,ma=this.cleanupElement=svgedit.utilities.cleanupElement,Ba=svgedit.sanitize.getNSMap(),Ea=c.sanitizeSvg=svgedit.sanitize.sanitizeSvg,
Ia=svgedit.history.MoveElementCommand,za=svgedit.history.InsertElementCommand,Ka=svgedit.history.RemoveElementCommand,Na=svgedit.history.ChangeElementCommand,Aa=svgedit.history.BatchCommand;c.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,k){var m=svgedit.history.HistoryEventTypes;if(e==m.BEFORE_UNAPPLY||e==m.BEFORE_APPLY)c.clearSelection();else if(e==m.AFTER_APPLY||e==m.AFTER_UNAPPLY){var A=k.elements();c.pathActions.clear();N("changed",A);A=k.type();m=e==m.AFTER_APPLY;if(A== Ia=svgedit.history.MoveElementCommand,za=svgedit.history.InsertElementCommand,Ka=svgedit.history.RemoveElementCommand,Na=svgedit.history.ChangeElementCommand,Aa=svgedit.history.BatchCommand;c.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,k){var m=svgedit.history.HistoryEventTypes;if(e==m.BEFORE_UNAPPLY||e==m.BEFORE_APPLY)c.clearSelection();else if(e==m.AFTER_APPLY||e==m.AFTER_UNAPPLY){var A=k.elements();c.pathActions.clear();N("changed",A);A=k.type();m=e==m.AFTER_APPLY;if(A==
Ia.type()){m=m?k.newParent:k.oldParent;m==l&&c.identifyLayers()}else if(A==za.type()||A==Ka.type()){k.parent==l&&c.identifyLayers();if(A==za.type())m&&Sa(k.elem);else m||Sa(k.elem);k.elem.tagName==="use"&&Jb(k.elem)}else if(A==Na.type()){k.elem.tagName=="title"&&k.elem.parentNode.parentNode==l&&c.identifyLayers();m=m?k.newValues:k.oldValues;m.stdDeviation&&c.setBlurOffsets(k.elem.parentNode,m.stdDeviation);if(k.elem.tagName==="use"&&svgedit.browser.isWebkit()){A=k.elem;if(!A.getAttribute("x")&&!A.getAttribute("y")){m= Ia.type()){m=m?k.newParent:k.oldParent;m==l&&c.identifyLayers()}else if(A==za.type()||A==Ka.type()){k.parent==l&&c.identifyLayers();if(A==za.type())m&&Sa(k.elem);else m||Sa(k.elem);k.elem.tagName==="use"&&Jb(k.elem)}else if(A==Na.type()){k.elem.tagName=="title"&&k.elem.parentNode.parentNode==l&&c.identifyLayers();m=m?k.newValues:k.oldValues;m.stdDeviation&&c.setBlurOffsets(k.elem.parentNode,m.stdDeviation);if(k.elem.tagName==="use"&&svgedit.browser.isWebkit()){A=k.elem;if(!A.getAttribute("x")&&!A.getAttribute("y")){m=
A.parentNode;var z=A.nextSibling;m.removeChild(A);m.insertBefore(A,z)}}}}}});var ya=function(e){c.undoMgr.addCommandToHistory(e)};svgedit.select.init(n,{createSVGElement:function(e){return c.addSvgElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(e){return c.getStrokedBBox([e])}});var Ga=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return d}}); A.parentNode;var z=A.nextSibling;m.removeChild(A);m.insertBefore(A,z)}}}}}});var ya=function(e){c.undoMgr.addCommandToHistory(e)};svgedit.select.init(n,{createSVGElement:function(e){return c.addSvgElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(e){return c.getStrokedBBox([e])}});var Ga=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return d}});
svgedit.utilities.snapToGrid=function(e){var k=n.snappingStep,m=n.baseUnit;if(m!=="px")k*=svgedit.units.getTypeMap()[m];return e=Math.round(e/k)*k};var xa=svgedit.utilities.snapToGrid,nb={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"},Ya=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],fb=$.data, svgedit.utilities.snapToGrid=function(e){var k=n.snappingStep,m=n.baseUnit;if(m!=="px")k*=svgedit.units.getTypeMap()[m];return e=Math.round(e/k)*k};var xa=svgedit.utilities.snapToGrid,nb={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"},Ya=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],fb=$.data,
Sa=function(e){var k=$(e).attr(Ya),m;for(m in k){var A=k[m];if(A&&A.indexOf("url(")===0){A=ia(A).substr(1);if(!pa(A)){kb().appendChild(ub[A]);delete ub[A]}}}e=e.getElementsByTagName("*");if(e.length){k=0;for(m=e.length;k<m;k++)Sa(e[k])}},Wa={},Ca=n.imgPath+"logo.png",wa=[],db={round_digits:5},La=false,Ra=null,Da="select",gb="none",rb={},Xa=R.text,ab=O,xb=null,ua=null,jb=[],hb={},ub={};c.clipBoard=[];var lb=this.runExtensions=function(e,k,m){var A=false;if(m)A=[];$.each(hb,function(z,G){if(e in G)if(m)A.push(G[e](k)); Sa=function(e){var k=$(e).attr(Ya),m;for(m in k){var A=k[m];if(A&&A.indexOf("url(")===0){A=ia(A).substr(1);if(!oa(A)){kb().appendChild(ub[A]);delete ub[A]}}}e=e.getElementsByTagName("*");if(e.length){k=0;for(m=e.length;k<m;k++)Sa(e[k])}},Wa={},Ca=n.imgPath+"logo.png",wa=[],db={round_digits:5},La=false,Ra=null,Da="select",gb="none",rb={},Xa=R.text,ab=O,xb=null,ua=null,jb=[],hb={},ub={};c.clipBoard=[];var lb=this.runExtensions=function(e,k,m){var A=false;if(m)A=[];$.each(hb,function(z,G){if(e in G)if(m)A.push(G[e](k));
else A=G[e](k)});return A};this.addExtension=function(e,k){if(e in hb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var m=$.isFunction(k)?k($.extend(c.getPrivateMethods(),{svgroot:d,svgcontent:l,nonce:C().getNonce(),selectorManager:Ga})):k;hb[e]=m;N("extension_added",m)}};var eb=this.round=function(e){return parseInt(e*p)/p},sb=this.getIntersectionList=function(e){if(ua==null)return null;var k=L||C().getCurrentLayer();jb.length||(jb=yb(k));var m=null; else A=G[e](k)});return A};this.addExtension=function(e,k){if(e in hb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var m=$.isFunction(k)?k($.extend(c.getPrivateMethods(),{svgroot:d,svgcontent:l,nonce:C().getNonce(),selectorManager:Ga})):k;hb[e]=m;N("extension_added",m)}};var eb=this.round=function(e){return parseInt(e*p)/p},sb=this.getIntersectionList=function(e){if(ua==null)return null;var k=L||C().getCurrentLayer();jb.length||(jb=yb(k));var m=null;
try{m=k.getIntersectionList(e,null)}catch(A){}if(m==null||typeof m.item!="function"){m=[];if(e)e=e;else{e=ua.getBBox();k={};for(var z in e)k[z]=e[z]/p;e=k}for(z=jb.length;z--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,jb[z].bbox)&&m.push(jb[z].elem)}return m};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=ob());if(!e.length)return false;var k=function(I){try{var F=svgedit.utilities.getBBox(I),g=svgedit.utilities.getRotationAngle(I);if(g&&g%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(I))){g= try{m=k.getIntersectionList(e,null)}catch(A){}if(m==null||typeof m.item!="function"){m=[];if(e)e=e;else{e=ua.getBBox();k={};for(var z in e)k[z]=e[z]/p;e=k}for(z=jb.length;z--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,jb[z].bbox)&&m.push(jb[z].elem)}return m};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=ob());if(!e.length)return false;var k=function(I){try{var F=svgedit.utilities.getBBox(I),g=svgedit.utilities.getRotationAngle(I);if(g&&g%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(I))){g=
false;if(["ellipse","path","line","polyline","polygon"].indexOf(I.tagName)>=0)F=g=c.convertToPath(I,true);else if(I.tagName=="rect"){var o=I.getAttribute("rx"),v=I.getAttribute("ry");if(o||v)F=g=c.convertToPath(I,true)}if(!g){var D=I.cloneNode(true),H=document.createElementNS(b,"g"),J=I.parentNode;J.appendChild(H);H.appendChild(D);F=svgedit.utilities.bboxToObj(H.getBBox());J.removeChild(H)}}return F}catch(X){console.log(I,X);return null}},m;$.each(e,function(){if(!m)if(this.parentNode)m=k(this)}); false;if(["ellipse","path","line","polyline","polygon"].indexOf(I.tagName)>=0)F=g=c.convertToPath(I,true);else if(I.tagName=="rect"){var o=I.getAttribute("rx"),v=I.getAttribute("ry");if(o||v)F=g=c.convertToPath(I,true)}if(!g){var D=I.cloneNode(true),H=document.createElementNS(b,"g"),J=I.parentNode;J.appendChild(H);H.appendChild(D);F=svgedit.utilities.bboxToObj(H.getBBox());J.removeChild(H)}}return F}catch(X){console.log(I,X);return null}},m;$.each(e,function(){if(!m)if(this.parentNode)m=k(this)});
@ -214,81 +214,81 @@ if(m==null)return null;var A=m.x+m.width,z=m.y+m.height,G=m.x,B=m.y,w=function(I
(e=$(l).children());e.find("#canvas_background").length&&e.splice(0,1);var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push(A)}catch(z){}});return k.reverse()},yb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(l).children());var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push({elem:A,bbox:getStrokedBBox([A])})}catch(z){}});return k.reverse()},zb=this.groupSvgElem=function(e){var k=document.createElementNS(b,"g");e.parentNode.replaceChild(k,e);$(k).append(e).data("gsvg", (e=$(l).children());e.find("#canvas_background").length&&e.splice(0,1);var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push(A)}catch(z){}});return k.reverse()},yb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(l).children());var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push({elem:A,bbox:getStrokedBBox([A])})}catch(z){}});return k.reverse()},zb=this.groupSvgElem=function(e){var k=document.createElementNS(b,"g");e.parentNode.replaceChild(k,e);$(k).append(e).data("gsvg",
e)[0].id=ka()},ja=function(e){var k=document.createElementNS(e.namespaceURI,e.nodeName);k.removeAttribute("id");$.each(e.attributes,function(A,z){z.localName!="-moz-math-font-style"&&k.setAttributeNS(z.namespaceURI,z.nodeName,z.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var m=Ja.convertPath(e);k.setAttribute("d",m)}$.each(e.childNodes,function(A,z){switch(z.nodeType){case 1:k.appendChild(ja(z));break;case 3:k.textContent=z.nodeValue}});if($(e).data("gsvg"))$(k).data("gsvg",k.firstChild); e)[0].id=ka()},ja=function(e){var k=document.createElementNS(e.namespaceURI,e.nodeName);k.removeAttribute("id");$.each(e.attributes,function(A,z){z.localName!="-moz-math-font-style"&&k.setAttributeNS(z.namespaceURI,z.nodeName,z.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var m=Ja.convertPath(e);k.setAttribute("d",m)}$.each(e.childNodes,function(A,z){switch(z.nodeType){case 1:k.appendChild(ja(z));break;case 3:k.textContent=z.nodeValue}});if($(e).data("gsvg"))$(k).data("gsvg",k.firstChild);
else if($(e).data("symbol")){e=$(e).data("symbol");$(k).data("ref",e).data("symbol",e)}else k.tagName=="image"&&Gb(k);k.id=ka();return k},ba,ka,N;(function(e){var k={};ba=e.getId=function(){return C().getId()};ka=e.getNextId=function(){return C().getNextId()};N=e.call=function(m,A){if(k[m])return k[m](this,A)};e.bind=function(m,A){var z=k[m];k[m]=A;return z}})(c);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var k=0,m=e.length;k<m;++k){var A= else if($(e).data("symbol")){e=$(e).data("symbol");$(k).data("ref",e).data("symbol",e)}else k.tagName=="image"&&Gb(k);k.id=ka();return k},ba,ka,N;(function(e){var k={};ba=e.getId=function(){return C().getId()};ka=e.getNextId=function(){return C().getNextId()};N=e.call=function(m,A){if(k[m])return k[m](this,A)};e.bind=function(m,A){var z=k[m];k[m]=A;return z}})(c);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var k=0,m=e.length;k<m;++k){var A=
e[k];A.setAttribute("d",Ja.convertPath(A));Ja.fixEnd(A)}};var Q=this.getRefElem=function(e){return pa(ia(e).substr(1))},ea=function(e){if(!svgedit.browser.isGecko())return e;var k=e.cloneNode(true);e.parentNode.insertBefore(k,e);e.parentNode.removeChild(e);Ga.releaseSelector(e);K[0]=k;Ga.requestSelector(k).showGrips(true);return k};this.setRotationAngle=function(e,k){e=parseFloat(e);var m=K[0],A=m.getAttribute("transform"),z=svgedit.utilities.getBBox(m),G=z.x+z.width/2,B=z.y+z.height/2;z=T(m);z.numberOfItems> e[k];A.setAttribute("d",Ja.convertPath(A));Ja.fixEnd(A)}};var Q=this.getRefElem=function(e){return oa(ia(e).substr(1))},fa=function(e){if(!svgedit.browser.isGecko())return e;var k=e.cloneNode(true);e.parentNode.insertBefore(k,e);e.parentNode.removeChild(e);Ga.releaseSelector(e);K[0]=k;Ga.requestSelector(k).showGrips(true);return k};this.setRotationAngle=function(e,k){e=parseFloat(e);var m=K[0],A=m.getAttribute("transform"),z=svgedit.utilities.getBBox(m),G=z.x+z.width/2,B=z.y+z.height/2;z=T(m);z.numberOfItems>
0&&z.getItem(0).type==4&&z.removeItem(0);if(e!=0){G=M(G,B,fa(z).matrix);B=d.createSVGTransform();B.setRotate(e,G.x,G.y);z.numberOfItems?z.insertItemBefore(B,0):z.appendItem(B)}else z.numberOfItems==0&&m.removeAttribute("transform");if(!k){z=m.getAttribute("transform");m.setAttribute("transform",A);ib("transform",z,K);N("changed",K)}pa("pathpointgrip_container");m=Ga.requestSelector(K[0]);m.resize();m.updateGripCursors(e)};var Fa=this.recalculateAllSelectedDimensions=function(){for(var e=new Aa(gb== 0&&z.getItem(0).type==4&&z.removeItem(0);if(e!=0){G=M(G,B,ha(z).matrix);B=d.createSVGTransform();B.setRotate(e,G.x,G.y);z.numberOfItems?z.insertItemBefore(B,0):z.appendItem(B)}else z.numberOfItems==0&&m.removeAttribute("transform");if(!k){z=m.getAttribute("transform");m.setAttribute("transform",A);ib("transform",z,K);N("changed",K)}oa("pathpointgrip_container");m=Ga.requestSelector(K[0]);m.resize();m.updateGripCursors(e)};var Fa=this.recalculateAllSelectedDimensions=function(){for(var e=new Aa(gb==
"none"?"position":"size"),k=K.length;k--;){var m=Qa(K[k]);m&&e.addSubCommand(m)}if(!e.isEmpty()){ya(e);N("changed",K)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Va=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},$a=this.remapElement=function(e,k,m){var A=n.gridSnapping&&e.parentNode.parentNode.localName==="svg",z=function(){if(A)for(var g in k)k[g]=xa(k[g]);la(e,k,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var B=G===0?"fill":"stroke", "none"?"position":"size"),k=K.length;k--;){var m=Qa(K[k]);m&&e.addSubCommand(m)}if(!e.isEmpty()){ya(e);N("changed",K)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Va=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},$a=this.remapElement=function(e,k,m){var A=n.gridSnapping&&e.parentNode.parentNode.localName==="svg",z=function(){if(A)for(var g in k)k[g]=xa(k[g]);la(e,k,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var B=G===0?"fill":"stroke",
w=e.getAttribute(B);if(w&&w.indexOf("url(")===0)if(m.a<0||m.d<0){w=Q(w).cloneNode(true);if(m.a<0){var E=w.getAttribute("x1"),I=w.getAttribute("x2");w.setAttribute("x1",-(E-1));w.setAttribute("x2",-(I-1))}if(m.d<0){E=w.getAttribute("y1");I=w.getAttribute("y2");w.setAttribute("y1",-(E-1));w.setAttribute("y2",-(I-1))}w.id=ka();kb().appendChild(w);e.setAttribute(B,"url(#"+w.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(m.a==1&&m.b==0&&m.c==0&&m.d==1&&(m.e!=0||m.f!=0)){B=fa(e).matrix;B=ha(B.inverse(), w=e.getAttribute(B);if(w&&w.indexOf("url(")===0)if(m.a<0||m.d<0){w=Q(w).cloneNode(true);if(m.a<0){var E=w.getAttribute("x1"),I=w.getAttribute("x2");w.setAttribute("x1",-(E-1));w.setAttribute("x2",-(I-1))}if(m.d<0){E=w.getAttribute("y1");I=w.getAttribute("y2");w.setAttribute("y1",-(E-1));w.setAttribute("y2",-(I-1))}w.id=ka();kb().appendChild(w);e.setAttribute(B,"url(#"+w.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(m.a==1&&m.b==0&&m.c==0&&m.d==1&&(m.e!=0||m.f!=0)){B=ha(e).matrix;B=aa(B.inverse(),
m,B);k.x=parseFloat(k.x)+B.e;k.y=parseFloat(k.y)+B.f}else{B=T(e);w=d.createSVGTransform();w.setMatrix(ha(fa(B).matrix,m));B.clear();B.appendItem(w)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(m.a<0||m.d<0)){B=T(e);w=d.createSVGTransform();w.setMatrix(ha(fa(B).matrix,m));B.clear();B.appendItem(w)}else{B=M(k.x,k.y,m);k.width=m.a*k.width;k.height=m.d*k.height;k.x=B.x+Math.min(0,k.width);k.y=B.y+Math.min(0,k.height);k.width=Math.abs(k.width);k.height=Math.abs(k.height)}z(); m,B);k.x=parseFloat(k.x)+B.e;k.y=parseFloat(k.y)+B.f}else{B=T(e);w=d.createSVGTransform();w.setMatrix(aa(ha(B).matrix,m));B.clear();B.appendItem(w)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(m.a<0||m.d<0)){B=T(e);w=d.createSVGTransform();w.setMatrix(aa(ha(B).matrix,m));B.clear();B.appendItem(w)}else{B=M(k.x,k.y,m);k.width=m.a*k.width;k.height=m.d*k.height;k.x=B.x+Math.min(0,k.width);k.y=B.y+Math.min(0,k.height);k.width=Math.abs(k.width);k.height=Math.abs(k.height)}z();
break;case "ellipse":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;k.rx=m.a*k.rx;k.ry=m.d*k.ry;k.rx=Math.abs(k.rx);k.ry=Math.abs(k.ry);z();break;case "circle":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,m);k.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(k.r)k.r=Math.abs(k.r);z();break;case "line":B=M(k.x1,k.y1,m);E=M(k.x2,k.y2,m);k.x1=B.x;k.y1=B.y;k.x2=E.x;k.y2=E.y;case "text":m=e.querySelectorAll("tspan");for(G=m.length;G--;){B=ra("x",e.getAttribute("x")); break;case "ellipse":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;k.rx=m.a*k.rx;k.ry=m.d*k.ry;k.rx=Math.abs(k.rx);k.ry=Math.abs(k.ry);z();break;case "circle":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,m);k.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(k.r)k.r=Math.abs(k.r);z();break;case "line":B=M(k.x1,k.y1,m);E=M(k.x2,k.y2,m);k.x1=B.x;k.y1=B.y;k.x2=E.x;k.y2=E.y;case "text":m=e.querySelectorAll("tspan");for(G=m.length;G--;){B=ra("x",e.getAttribute("x"));
w=ra("x",m[G].getAttribute("x"));E=ra("y",e.getAttribute("y"));I=ra("y",m[G].getAttribute("y"));var F={};if(!isNaN(B)&&!isNaN(w)&&B!=0&&w!=0&&k.x)F.x=k.x-(B-w);if(!isNaN(E)&&!isNaN(I)&&E!=0&&I!=0&&k.y)F.y=k.y-(E-I);if(F.x||F.y)la(m[G],F,1E3,true)}z();break;case "use":z();break;case "g":(z=$(e).data("gsvg"))&&la(z,k,1E3,true);break;case "polyline":case "polygon":z=k.points.length;for(G=0;G<z;++G){I=k.points[G];I=M(I.x,I.y,m);k.points[G].x=I.x;k.points[G].y=I.y}z=k.points.length;m="";for(G=0;G<z;++G){I= w=ra("x",m[G].getAttribute("x"));E=ra("y",e.getAttribute("y"));I=ra("y",m[G].getAttribute("y"));var F={};if(!isNaN(B)&&!isNaN(w)&&B!=0&&w!=0&&k.x)F.x=k.x-(B-w);if(!isNaN(E)&&!isNaN(I)&&E!=0&&I!=0&&k.y)F.y=k.y-(E-I);if(F.x||F.y)la(m[G],F,1E3,true)}z();break;case "use":z();break;case "g":(z=$(e).data("gsvg"))&&la(z,k,1E3,true);break;case "polyline":case "polygon":z=k.points.length;for(G=0;G<z;++G){I=k.points[G];I=M(I.x,I.y,m);k.points[G].x=I.x;k.points[G].y=I.y}z=k.points.length;m="";for(G=0;G<z;++G){I=
k.points[G];m+=I.x+","+I.y+" "}e.setAttribute("points",m);break;case "path":B=e.pathSegList;z=B.numberOfItems;k.d=Array(z);for(G=0;G<z;++G){w=B.getItem(G);k.d[G]={type:w.pathSegType,x:w.x,y:w.y,x1:w.x1,y1:w.y1,x2:w.x2,y2:w.y2,r1:w.r1,r2:w.r2,angle:w.angle,largeArcFlag:w.largeArcFlag,sweepFlag:w.sweepFlag}}z=k.d.length;G=k.d[0];F=M(G.x,G.y,m);k.d[0].x=F.x;k.d[0].y=F.y;for(G=1;G<z;++G){w=k.d[G];B=w.type;if(B%2==0){I=M(w.x!=undefined?w.x:F.x,w.y!=undefined?w.y:F.y,m);B=M(w.x1,w.y1,m);E=M(w.x2,w.y2,m); k.points[G];m+=I.x+","+I.y+" "}e.setAttribute("points",m);break;case "path":B=e.pathSegList;z=B.numberOfItems;k.d=Array(z);for(G=0;G<z;++G){w=B.getItem(G);k.d[G]={type:w.pathSegType,x:w.x,y:w.y,x1:w.x1,y1:w.y1,x2:w.x2,y2:w.y2,r1:w.r1,r2:w.r2,angle:w.angle,largeArcFlag:w.largeArcFlag,sweepFlag:w.sweepFlag}}z=k.d.length;G=k.d[0];F=M(G.x,G.y,m);k.d[0].x=F.x;k.d[0].y=F.y;for(G=1;G<z;++G){w=k.d[G];B=w.type;if(B%2==0){I=M(w.x!=undefined?w.x:F.x,w.y!=undefined?w.y:F.y,m);B=M(w.x1,w.y1,m);E=M(w.x2,w.y2,m);
w.x=I.x;w.y=I.y;w.x1=B.x;w.y1=B.y;w.x2=E.x;w.y2=E.y}else{w.x=m.a*w.x;w.y=m.d*w.y;w.x1=m.a*w.x1;w.y1=m.d*w.y1;w.x2=m.a*w.x2;w.y2=m.d*w.y2}w.r1=m.a*w.r1;w.r2=m.d*w.r2}m="";z=k.d.length;for(G=0;G<z;++G){w=k.d[G];B=w.type;m+=Oa[B];switch(B){case 13:case 12:m+=w.x+" ";break;case 15:case 14:m+=w.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:m+=w.x+","+w.y+" ";break;case 7:case 6:m+=w.x1+","+w.y1+" "+w.x2+","+w.y2+" "+w.x+","+w.y+" ";break;case 9:case 8:m+=w.x1+","+w.y1+" "+w.x+","+w.y+" ";break; w.x=I.x;w.y=I.y;w.x1=B.x;w.y1=B.y;w.x2=E.x;w.y2=E.y}else{w.x=m.a*w.x;w.y=m.d*w.y;w.x1=m.a*w.x1;w.y1=m.d*w.y1;w.x2=m.a*w.x2;w.y2=m.d*w.y2}w.r1=m.a*w.r1;w.r2=m.d*w.r2}m="";z=k.d.length;for(G=0;G<z;++G){w=k.d[G];B=w.type;m+=Oa[B];switch(B){case 13:case 12:m+=w.x+" ";break;case 15:case 14:m+=w.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:m+=w.x+","+w.y+" ";break;case 7:case 6:m+=w.x1+","+w.y1+" "+w.x2+","+w.y2+" "+w.x+","+w.y+" ";break;case 9:case 8:m+=w.x1+","+w.y1+" "+w.x+","+w.y+" ";break;
case 11:case 10:m+=w.r1+","+w.r2+" "+w.angle+" "+ +w.largeArcFlag+" "+ +w.sweepFlag+" "+w.x+","+w.y+" ";break;case 17:case 16:m+=w.x2+","+w.y2+" "+w.x+","+w.y+" "}}e.setAttribute("d",m)}},qb=function(e,k,m){e=Q(e).firstChild;var A=T(e),z=d.createSVGTransform();z.setTranslate(k,m);A.appendItem(z);Qa(e)},Qa=this.recalculateDimensions=function(e){if(e==null)return null;var k=T(e);if(k&&k.numberOfItems>0){for(var m=k.numberOfItems;m--;){var A=k.getItem(m);if(A.type===0)k.removeItem(m);else if(A.type=== case 11:case 10:m+=w.r1+","+w.r2+" "+w.angle+" "+ +w.largeArcFlag+" "+ +w.sweepFlag+" "+w.x+","+w.y+" ";break;case 17:case 16:m+=w.x2+","+w.y2+" "+w.x+","+w.y+" "}}e.setAttribute("d",m)}},qb=function(e,k,m){e=Q(e).firstChild;var A=T(e),z=d.createSVGTransform();z.setTranslate(k,m);A.appendItem(z);Qa(e)},Qa=this.recalculateDimensions=function(e){if(e==null)return null;var k=T(e);if(k&&k.numberOfItems>0){for(var m=k.numberOfItems;m--;){var A=k.getItem(m);if(A.type===0)k.removeItem(m);else if(A.type===
1)svgedit.math.isIdentity(A.matrix)&&k.removeItem(m);else A.type===4&&A.angle===0&&k.removeItem(m)}if(k.numberOfItems===1&&oa(e))return null}if(!k||k.numberOfItems==0){e.removeAttribute("transform");return null}if(k){m=k.numberOfItems;for(var z=[];m--;){A=k.getItem(m);if(A.type===1)z.push([A.matrix,m]);else if(z.length)z=[]}if(z.length===2){m=d.createSVGTransformFromMatrix(ha(z[1][0],z[0][0]));k.removeItem(z[0][1]);k.removeItem(z[1][1]);k.insertItemBefore(m,z[1][1])}m=k.numberOfItems;if(m>=2&&k.getItem(m- 1)svgedit.math.isIdentity(A.matrix)&&k.removeItem(m);else A.type===4&&A.angle===0&&k.removeItem(m)}if(k.numberOfItems===1&&na(e))return null}if(!k||k.numberOfItems==0){e.removeAttribute("transform");return null}if(k){m=k.numberOfItems;for(var z=[];m--;){A=k.getItem(m);if(A.type===1)z.push([A.matrix,m]);else if(z.length)z=[]}if(z.length===2){m=d.createSVGTransformFromMatrix(aa(z[1][0],z[0][0]));k.removeItem(z[0][1]);k.removeItem(z[1][1]);k.insertItemBefore(m,z[1][1])}m=k.numberOfItems;if(m>=2&&k.getItem(m-
2).type===1&&k.getItem(m-1).type===2){z=d.createSVGTransform();A=ha(k.getItem(m-2).matrix,k.getItem(m-1).matrix);z.setMatrix(A);k.removeItem(m-2);k.removeItem(m-2);k.appendItem(z)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(k.numberOfItems===1&&k.getItem(0).type===1||k.numberOfItems===2&&k.getItem(0).type===1&&k.getItem(0).type===4)return null}var G=$(e).data("gsvg");m=new Aa("Transform");var B={},w=null;A=[];switch(e.tagName){case "line":A=["x1","y1", 2).type===1&&k.getItem(m-1).type===2){z=d.createSVGTransform();A=aa(k.getItem(m-2).matrix,k.getItem(m-1).matrix);z.setMatrix(A);k.removeItem(m-2);k.removeItem(m-2);k.appendItem(z)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(k.numberOfItems===1&&k.getItem(0).type===1||k.numberOfItems===2&&k.getItem(0).type===1&&k.getItem(0).type===4)return null}var G=$(e).data("gsvg");m=new Aa("Transform");var B={},w=null;A=[];switch(e.tagName){case "line":A=["x1","y1",
"x2","y2"];break;case "circle":A=["cx","cy","r"];break;case "ellipse":A=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":A=["width","height","x","y"];break;case "use":case "text":case "tspan":A=["x","y"];break;case "polygon":case "polyline":w={};w.points=e.getAttribute("points");z=e.points;var E=z.numberOfItems;B.points=Array(E);for(var I=0;I<E;++I){var F=z.getItem(I);B.points[I]={x:F.x,y:F.y}}break;case "path":w={};w.d=e.getAttribute("d");B.d=e.getAttribute("d")}if(A.length){B= "x2","y2"];break;case "circle":A=["cx","cy","r"];break;case "ellipse":A=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":A=["width","height","x","y"];break;case "use":case "text":case "tspan":A=["x","y"];break;case "polygon":case "polyline":w={};w.points=e.getAttribute("points");z=e.points;var E=z.numberOfItems;B.points=Array(E);for(var I=0;I<E;++I){var F=z.getItem(I);B.points[I]={x:F.x,y:F.y}}break;case "path":w={};w.d=e.getAttribute("d");B.d=e.getAttribute("d")}if(A.length){B=
$(e).attr(A);$.each(B,function(Ha,sa){B[Ha]=ra(Ha,sa)})}else if(G)B={x:$(G).attr("x")||0,y:$(G).attr("y")||0};if(w==null){w=$.extend(true,{},B);$.each(w,function(Ha,sa){w[Ha]=ra(Ha,sa)})}w.transform=Ra?Ra:"";if(e.tagName=="g"&&!G||e.tagName=="a"){z=svgedit.utilities.getBBox(e);var g={x:z.x+z.width/2,y:z.y+z.height/2},o=M(z.x+z.width/2,z.y+z.height/2,fa(k).matrix);A=d.createSVGMatrix();if(z=oa(e)){I=z*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I<k.numberOfItems;++I){A= $(e).attr(A);$.each(B,function(Ha,sa){B[Ha]=ra(Ha,sa)})}else if(G)B={x:$(G).attr("x")||0,y:$(G).attr("y")||0};if(w==null){w=$.extend(true,{},B);$.each(w,function(Ha,sa){w[Ha]=ra(Ha,sa)})}w.transform=Ra?Ra:"";if(e.tagName=="g"&&!G||e.tagName=="a"){z=svgedit.utilities.getBBox(e);var g={x:z.x+z.width/2,y:z.y+z.height/2},o=M(z.x+z.width/2,z.y+z.height/2,ha(k).matrix);A=d.createSVGMatrix();if(z=na(e)){I=z*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I<k.numberOfItems;++I){A=
k.getItem(I);if(A.type==4){A=A.matrix;g.y=(E*A.e+A.f)/2;g.x=(A.e-E*A.f)/2;k.removeItem(I);break}}}I=A=G=0;var v=k.numberOfItems;if(v)var D=k.getItem(0).matrix;if(v>=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;var H=k.getItem(v-3).matrix,J=k.getItem(v-2).matrix,X=k.getItem(v-1).matrix;E=e.childNodes;for(F=E.length;F--;){var ca=E.item(F);A=G=0;if(ca.nodeType==1){var S=T(ca);if(S){A=fa(S).matrix;G=oa(ca);var W=Ra,Z=[];Ra=ca.getAttribute("transform");if(G||na(S)){var qa= k.getItem(I);if(A.type==4){A=A.matrix;g.y=(E*A.e+A.f)/2;g.x=(A.e-E*A.f)/2;k.removeItem(I);break}}}I=A=G=0;var v=k.numberOfItems;if(v)var D=k.getItem(0).matrix;if(v>=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;var H=k.getItem(v-3).matrix,J=k.getItem(v-2).matrix,X=k.getItem(v-1).matrix;E=e.childNodes;for(F=E.length;F--;){var da=E.item(F);A=G=0;if(da.nodeType==1){var S=T(da);if(S){A=ha(S).matrix;G=na(da);var V=Ra,Z=[];Ra=da.getAttribute("transform");if(G||qa(S)){var pa=
d.createSVGTransform();qa.setMatrix(ha(H,J,X,A));S.clear();S.appendItem(qa);Z.push(qa)}else{G=ha(A.inverse(),X,A);qa=d.createSVGMatrix();qa.e=-G.e;qa.f=-G.f;A=ha(qa.inverse(),A.inverse(),H,J,X,A,G.inverse());var ta=d.createSVGTransform(),ga=d.createSVGTransform(),Ta=d.createSVGTransform();ta.setTranslate(G.e,G.f);ga.setScale(A.a,A.d);Ta.setTranslate(qa.e,qa.f);S.appendItem(Ta);S.appendItem(ga);S.appendItem(ta);Z.push(Ta);Z.push(ga);Z.push(ta)}m.addSubCommand(Qa(ca));Ra=W}}}k.removeItem(v-1);k.removeItem(v- d.createSVGTransform();pa.setMatrix(aa(H,J,X,A));S.clear();S.appendItem(pa);Z.push(pa)}else{G=aa(A.inverse(),X,A);pa=d.createSVGMatrix();pa.e=-G.e;pa.f=-G.f;A=aa(pa.inverse(),A.inverse(),H,J,X,A,G.inverse());var ta=d.createSVGTransform(),ga=d.createSVGTransform(),Ta=d.createSVGTransform();ta.setTranslate(G.e,G.f);ga.setScale(A.a,A.d);Ta.setTranslate(pa.e,pa.f);S.appendItem(Ta);S.appendItem(ga);S.appendItem(ta);Z.push(Ta);Z.push(ga);Z.push(ta)}m.addSubCommand(Qa(da));Ra=V}}}k.removeItem(v-1);k.removeItem(v-
2);k.removeItem(v-3)}else if(v>=3&&k.getItem(v-1).type==1){I=3;A=fa(k).matrix;qa=d.createSVGTransform();qa.setMatrix(A);k.clear();k.appendItem(qa)}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;G=fa(k).matrix;k.removeItem(0);A=fa(k).matrix.inverse();A=ha(A,G);G=A.e;A=A.f;if(G!=0||A!=0){E=e.childNodes;F=E.length;for(v=[];F--;){ca=E.item(F);if(ca.nodeType==1){if(ca.getAttribute("clip-path")){W=ca.getAttribute("clip-path");if(v.indexOf(W)===-1){qb(W,G,A);v.push(W)}}W=Ra;Ra=ca.getAttribute("transform"); 2);k.removeItem(v-3)}else if(v>=3&&k.getItem(v-1).type==1){I=3;A=ha(k).matrix;pa=d.createSVGTransform();pa.setMatrix(A);k.clear();k.appendItem(pa)}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;G=ha(k).matrix;k.removeItem(0);A=ha(k).matrix.inverse();A=aa(A,G);G=A.e;A=A.f;if(G!=0||A!=0){E=e.childNodes;F=E.length;for(v=[];F--;){da=E.item(F);if(da.nodeType==1){if(da.getAttribute("clip-path")){V=da.getAttribute("clip-path");if(v.indexOf(V)===-1){qb(V,G,A);v.push(V)}}V=Ra;Ra=da.getAttribute("transform");
if(S=T(ca)){H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H,0):S.appendItem(H);m.addSubCommand(Qa(ca));S=e.getElementsByTagNameNS(b,"use");ca="#"+ca.id;for(H=S.length;H--;){J=S.item(H);if(ca==da(J)){X=d.createSVGTransform();X.setTranslate(-G,-A);T(J).insertItemBefore(X,0);m.addSubCommand(Qa(J))}}Ra=W}}}v=[];Ra=W}}else if(v==1&&k.getItem(0).type==1&&!z){I=1;A=k.getItem(0).matrix;E=e.childNodes;for(F=E.length;F--;){ca=E.item(F);if(ca.nodeType==1){W=Ra;Ra=ca.getAttribute("transform"); if(S=T(da)){H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H,0):S.appendItem(H);m.addSubCommand(Qa(da));S=e.getElementsByTagNameNS(b,"use");da="#"+da.id;for(H=S.length;H--;){J=S.item(H);if(da==ea(J)){X=d.createSVGTransform();X.setTranslate(-G,-A);T(J).insertItemBefore(X,0);m.addSubCommand(Qa(J))}}Ra=V}}}v=[];Ra=V}}else if(v==1&&k.getItem(0).type==1&&!z){I=1;A=k.getItem(0).matrix;E=e.childNodes;for(F=E.length;F--;){da=E.item(F);if(da.nodeType==1){V=Ra;Ra=da.getAttribute("transform");
if(S=T(ca)){G=ha(A,fa(S).matrix);v=d.createSVGTransform();v.setMatrix(G);S.clear();S.appendItem(v,0);m.addSubCommand(Qa(ca));Ra=W;W=ca.getAttribute("stroke-width");ca.getAttribute("stroke")!=="none"&&!isNaN(W)&&ca.setAttribute("stroke-width",W*((Math.abs(G.a)+Math.abs(G.d))/2))}}}k.clear()}else{if(z){g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==2){if(z){o={x:g.x+D.e,y:g.y+ if(S=T(da)){G=aa(A,ha(S).matrix);v=d.createSVGTransform();v.setMatrix(G);S.clear();S.appendItem(v,0);m.addSubCommand(Qa(da));Ra=V;V=da.getAttribute("stroke-width");da.getAttribute("stroke")!=="none"&&!isNaN(V)&&da.setAttribute("stroke-width",V*((Math.abs(G.a)+Math.abs(G.d))/2))}}}k.clear()}else{if(z){g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==2){if(z){o={x:g.x+D.e,y:g.y+
D.f};g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I==3){A=fa(k).matrix;D=d.createSVGTransform();D.setRotate(z,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(z,o.x,o.y);o=g.matrix.inverse();W=A.inverse();o=ha(W,o,D,A);G=o.e;A=o.f;if(G!=0||A!=0){E=e.childNodes;for(F=E.length;F--;){ca=E.item(F);if(ca.nodeType==1){W=Ra;Ra=ca.getAttribute("transform");S=T(ca);H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H, D.f};g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I==3){A=ha(k).matrix;D=d.createSVGTransform();D.setRotate(z,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(z,o.x,o.y);o=g.matrix.inverse();V=A.inverse();o=aa(V,o,D,A);G=o.e;A=o.f;if(G!=0||A!=0){E=e.childNodes;for(F=E.length;F--;){da=E.item(F);if(da.nodeType==1){V=Ra;Ra=da.getAttribute("transform");S=T(da);H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H,
0):S.appendItem(H);m.addSubCommand(Qa(ca));Ra=W}}}if(z)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else{z=svgedit.utilities.getBBox(e);if(!z&&e.tagName!="path")return null;A=d.createSVGMatrix();if(G=oa(e)){g={x:z.x+z.width/2,y:z.y+z.height/2};o=M(z.x+z.width/2,z.y+z.height/2,fa(k).matrix);I=G*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I<k.numberOfItems;++I){A=k.getItem(I);if(A.type==4){A=A.matrix;g.y=(E*A.e+A.f)/2;g.x=(A.e-E*A.f)/2;k.removeItem(I);break}}}I= 0):S.appendItem(H);m.addSubCommand(Qa(da));Ra=V}}}if(z)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else{z=svgedit.utilities.getBBox(e);if(!z&&e.tagName!="path")return null;A=d.createSVGMatrix();if(G=na(e)){g={x:z.x+z.width/2,y:z.y+z.height/2};o=M(z.x+z.width/2,z.y+z.height/2,ha(k).matrix);I=G*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I<k.numberOfItems;++I){A=k.getItem(I);if(A.type==4){A=A.matrix;g.y=(E*A.e+A.f)/2;g.x=(A.e-E*A.f)/2;k.removeItem(I);break}}}I=
0;v=k.numberOfItems;if(!svgedit.browser.isWebkit())if((D=e.getAttribute("fill"))&&D.indexOf("url(")===0){D=Q(D);W="pattern";if(D.tagName!==W)W="gradient";if(D.getAttribute(W+"Units")==="userSpaceOnUse"){A=fa(k).matrix;z=T(D);z=fa(z).matrix;A=ha(A,z);z="matrix("+[A.a,A.b,A.c,A.d,A.e,A.f].join(",")+")";D.setAttribute(W+"Transform",z)}}if(v>=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;A=fa(k,v-3,v-1).matrix;k.removeItem(v-1);k.removeItem(v-2);k.removeItem(v-3)}else if(v== 0;v=k.numberOfItems;if(!svgedit.browser.isWebkit())if((D=e.getAttribute("fill"))&&D.indexOf("url(")===0){D=Q(D);V="pattern";if(D.tagName!==V)V="gradient";if(D.getAttribute(V+"Units")==="userSpaceOnUse"){A=ha(k).matrix;z=T(D);z=ha(z).matrix;A=aa(A,z);z="matrix("+[A.a,A.b,A.c,A.d,A.e,A.f].join(",")+")";D.setAttribute(V+"Transform",z)}}if(v>=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;A=ha(k,v-3,v-1).matrix;k.removeItem(v-1);k.removeItem(v-2);k.removeItem(v-3)}else if(v==
4&&k.getItem(v-1).type==1){I=3;A=fa(k).matrix;qa=d.createSVGTransform();qa.setMatrix(A);k.clear();k.appendItem(qa);A=d.createSVGMatrix()}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;D=k.getItem(0).matrix;W=fa(k,1).matrix;z=W.inverse();A=ha(z,D,W);k.removeItem(0)}else if(v==1&&k.getItem(0).type==1&&!G){A=fa(k).matrix;switch(e.tagName){case "line":B=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":B.points=e.getAttribute("points");if(B.points){z=e.points;E=z.numberOfItems; 4&&k.getItem(v-1).type==1){I=3;A=ha(k).matrix;pa=d.createSVGTransform();pa.setMatrix(A);k.clear();k.appendItem(pa);A=d.createSVGMatrix()}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;D=k.getItem(0).matrix;V=ha(k,1).matrix;z=V.inverse();A=aa(z,D,V);k.removeItem(0)}else if(v==1&&k.getItem(0).type==1&&!G){A=ha(k).matrix;switch(e.tagName){case "line":B=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":B.points=e.getAttribute("points");if(B.points){z=e.points;E=z.numberOfItems;
B.points=Array(E);for(I=0;I<E;++I){F=z.getItem(I);B.points[I]={x:F.x,y:F.y}}}case "path":B.d=e.getAttribute("d");I=1;k.clear()}}else{I=4;if(G){g=d.createSVGTransform();g.setRotate(G,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==1||I==2||I==3)$a(e,B,A);if(I==2){if(G){na(k)||(o={x:g.x+A.e,y:g.y+A.f});g=d.createSVGTransform();g.setRotate(G,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I== B.points=Array(E);for(I=0;I<E;++I){F=z.getItem(I);B.points[I]={x:F.x,y:F.y}}}case "path":B.d=e.getAttribute("d");I=1;k.clear()}}else{I=4;if(G){g=d.createSVGTransform();g.setRotate(G,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==1||I==2||I==3)$a(e,B,A);if(I==2){if(G){qa(k)||(o={x:g.x+A.e,y:g.y+A.f});g=d.createSVGTransform();g.setRotate(G,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I==
3&&G){A=fa(k).matrix;D=d.createSVGTransform();D.setRotate(G,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(G,o.x,o.y);o=g.matrix.inverse();W=A.inverse();o=ha(W,o,D,A);$a(e,B,o);if(G)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}k.numberOfItems==0&&e.removeAttribute("transform");m.addSubCommand(new Na(e,w));return m},pb=null,Pa=this.clearSelection=function(e){if(K[0]!=null)for(var k=K.length,m=0;m<k;++m){var A=K[m];if(A==null)break;Ga.releaseSelector(A);K[m]=null}e||N("selected", 3&&G){A=ha(k).matrix;D=d.createSVGTransform();D.setRotate(G,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(G,o.x,o.y);o=g.matrix.inverse();V=A.inverse();o=aa(V,o,D,A);$a(e,B,o);if(G)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}k.numberOfItems==0&&e.removeAttribute("transform");m.addSubCommand(new Na(e,w));return m},pb=null,Pa=this.clearSelection=function(e){if(K[0]!=null)for(var k=K.length,m=0;m<k;++m){var A=K[m];if(A==null)break;Ga.releaseSelector(A);K[m]=null}e||N("selected",
K)},tb=this.addToSelection=function(e,k){if(e.length!=0){for(var m=0;m<K.length;){if(K[m]==null)break;++m}for(var A=e.length;A--;){var z=e[A];if(z&&svgedit.utilities.getBBox(z)){if(z.tagName==="a"&&z.childNodes.length===1)z=z.firstChild;if(K.indexOf(z)==-1){K[m]=z;m++;z=Ga.requestSelector(z);K.length>1&&z.showGrips(false)}}}N("selected",K);k||K.length==1?Ga.requestSelector(K[0]).showGrips(true):Ga.requestSelector(K[0]).showGrips(false);for(K.sort(function(G,B){if(G&&B&&G.compareDocumentPosition)return 3- K)},tb=this.addToSelection=function(e,k){if(e.length!=0){for(var m=0;m<K.length;){if(K[m]==null)break;++m}for(var A=e.length;A--;){var z=e[A];if(z&&svgedit.utilities.getBBox(z)){if(z.tagName==="a"&&z.childNodes.length===1)z=z.firstChild;if(K.indexOf(z)==-1){K[m]=z;m++;z=Ga.requestSelector(z);K.length>1&&z.showGrips(false)}}}N("selected",K);k||K.length==1?Ga.requestSelector(K[0]).showGrips(true):Ga.requestSelector(K[0]).showGrips(false);for(K.sort(function(G,B){if(G&&B&&G.compareDocumentPosition)return 3-
(B.compareDocumentPosition(G)&6);else if(G==null)return 1});K[0]==null;)K.shift(0)}},vb=this.selectOnly=function(e,k){Pa(true);tb(e,k)};this.removeFromSelection=function(e){if(K[0]!=null)if(e.length!=0){var k=Array(K.length);j=0;len=K.length;for(var m=0;m<len;++m){var A=K[m];if(A)if(e.indexOf(A)==-1){k[j]=A;j++}else Ga.releaseSelector(A)}K=k}};this.selectAllInCurrentLayer=function(){var e=C().getCurrentLayer();if(e){Da="select";vb($(L||e).children())}};var mb=this.getMouseTarget=function(e){if(e== (B.compareDocumentPosition(G)&6);else if(G==null)return 1});K[0]==null;)K.shift(0)}},vb=this.selectOnly=function(e,k){Pa(true);tb(e,k)};this.removeFromSelection=function(e){if(K[0]!=null)if(e.length!=0){var k=Array(K.length);j=0;len=K.length;for(var m=0;m<len;++m){var A=K[m];if(A)if(e.indexOf(A)==-1){k[j]=A;j++}else Ga.releaseSelector(A)}K=k}};this.selectAllInCurrentLayer=function(){var e=C().getCurrentLayer();if(e){Da="select";vb($(L||e).children())}};var mb=this.getMouseTarget=function(e){if(e==
null)return null;e=e.target;if(e.correspondingUseElement)e=e.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(e.namespaceURI)>=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var k=C().getCurrentLayer();if([d,a,l,k].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ga.selectorParentGroup;for(;e.parentNode!==(L||k);)e=e.parentNode;return e};(function(){var e=null,k=null,m=null,A= null)return null;e=e.target;if(e.correspondingUseElement)e=e.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(e.namespaceURI)>=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var k=C().getCurrentLayer();if([d,a,l,k].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ga.selectorParentGroup;for(;e.parentNode!==(L||k);)e=e.parentNode;return e};(function(){var e=null,k=null,m=null,A=
null,z=null,G={},B={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(w){if(!(w.originalEvent.touches&&w.originalEvent.touches>1)){var E=w.button===2;pb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);w.preventDefault();if(E)Da="select";F=F/p;I=I/p;var g=mb(w);if(g.tagName==="a"&&g.childNodes.length===1)g=g.firstChild;var o=A=k=F,v=z=m=I;if(n.gridSnapping){F=xa(F);I=xa(I);k=xa(k);m=xa(m)}if(g== null,z=null,G={},B={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(w){if(!(w.originalEvent.touches&&w.originalEvent.touches>1)){var E=w.button===2;pb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);w.preventDefault();if(E)Da="select";F=F/p;I=I/p;var g=mb(w);if(g.tagName==="a"&&g.childNodes.length===1)g=g.firstChild;var o=A=k=F,v=z=m=I;if(n.gridSnapping){F=xa(F);I=xa(I);k=xa(k);m=xa(m)}if(g==
Ga.selectorParentGroup&&K[0]!=null){g=w.target;var D=fb(g,"type");if(D=="rotate"){Da="rotate";current_rotate_mode=fb(g,"dir")}else if(D=="resize"){Da="resize";gb=fb(g,"dir")}g=K[0]}Ra=g.getAttribute("transform");D=T(g);switch(Da){case "select":La=true;gb="none";if(E)La=false;if(g!=d){if(K.indexOf(g)==-1){w.shiftKey||Pa(true);tb([g]);xb=g;Ja.clear()}if(!E)for(E=0;E<K.length;++E)if(K[E]!=null){var H=T(K[E]);H.numberOfItems?H.insertItemBefore(d.createSVGTransform(),0):H.appendItem(d.createSVGTransform())}}else if(!E){Pa(); Ga.selectorParentGroup&&K[0]!=null){g=w.target;var D=fb(g,"type");if(D=="rotate"){Da="rotate";current_rotate_mode=fb(g,"dir")}else if(D=="resize"){Da="resize";gb=fb(g,"dir")}g=K[0]}Ra=g.getAttribute("transform");D=T(g);switch(Da){case "select":La=true;gb="none";if(E)La=false;if(g!=d){if(K.indexOf(g)==-1){w.shiftKey||Pa(true);tb([g]);xb=g;Ja.clear()}if(!E)for(E=0;E<K.length;++E)if(K[E]!=null){var H=T(K[E]);H.numberOfItems?H.insertItemBefore(d.createSVGTransform(),0):H.appendItem(d.createSVGTransform())}}else if(!E){Pa();
Da="multiselect";if(ua==null)ua=Ga.getRubberBandBox();A*=p;z*=p;la(ua,{x:A,y:z,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ua==null)ua=Ga.getRubberBandBox();la(ua,{x:o*p,y:o*p,width:0,height:0,display:"inline"},100);break;case "resize":La=true;k=F;m=I;G=svgedit.utilities.getBBox($("#selectedBox0")[0]);var J={};$.each(G,function(X,ca){J[X]=ca/p});G=J;E=oa(g)?1:0;if(na(D)){D.insertItemBefore(d.createSVGTransform(),E);D.insertItemBefore(d.createSVGTransform(),E);D.insertItemBefore(d.createSVGTransform(), Da="multiselect";if(ua==null)ua=Ga.getRubberBandBox();A*=p;z*=p;la(ua,{x:A,y:z,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ua==null)ua=Ga.getRubberBandBox();la(ua,{x:o*p,y:o*p,width:0,height:0,display:"inline"},100);break;case "resize":La=true;k=F;m=I;G=svgedit.utilities.getBBox($("#selectedBox0")[0]);var J={};$.each(G,function(X,da){J[X]=da/p});G=J;E=na(g)?1:0;if(qa(D)){D.insertItemBefore(d.createSVGTransform(),E);D.insertItemBefore(d.createSVGTransform(),E);D.insertItemBefore(d.createSVGTransform(),
E)}else{D.appendItem(d.createSVGTransform());D.appendItem(d.createSVGTransform());D.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(F=svgedit.browser.isChrome())H=function(X){var ca=X.getAttributeNS(null,"stroke");X.removeAttributeNS(null,"stroke");setTimeout(function(){X.setAttributeNS(null,"stroke",ca)},1)};g.style.vectorEffect="non-scaling-stroke";F&&H(g);I=g.getElementsByTagName("*");o=I.length;for(E=0;E<o;E++){I[E].style.vectorEffect="non-scaling-stroke"; E)}else{D.appendItem(d.createSVGTransform());D.appendItem(d.createSVGTransform());D.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(F=svgedit.browser.isChrome())H=function(X){var da=X.getAttributeNS(null,"stroke");X.removeAttributeNS(null,"stroke");setTimeout(function(){X.setAttributeNS(null,"stroke",da)},1)};g.style.vectorEffect="non-scaling-stroke";F&&H(g);I=g.getElementsByTagName("*");o=I.length;for(E=0;E<o;E++){I[E].style.vectorEffect="non-scaling-stroke";
F&&H(I[E])}}}break;case "fhellipse":case "fhrect":case "fhpath":La=true;e=o+","+v+" ";H=O.stroke_width==0?1:O.stroke_width;P({element:"polyline",curStyles:true,attr:{points:e,id:ka(),fill:"none",opacity:O.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});B.minx=o;B.maxx=o;B.miny=v;B.maxy=v;break;case "image":La=true;H=P({element:"image",attr:{x:F,y:I,width:0,height:0,id:ka(),opacity:O.opacity/2,style:"pointer-events:inherit"}});U(H,Ca);Gb(H);break;case "square":case "rect":La=true; F&&H(I[E])}}}break;case "fhellipse":case "fhrect":case "fhpath":La=true;e=o+","+v+" ";H=O.stroke_width==0?1:O.stroke_width;P({element:"polyline",curStyles:true,attr:{points:e,id:ka(),fill:"none",opacity:O.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});B.minx=o;B.maxx=o;B.miny=v;B.maxy=v;break;case "image":La=true;H=P({element:"image",attr:{x:F,y:I,width:0,height:0,id:ka(),opacity:O.opacity/2,style:"pointer-events:inherit"}});U(H,Ca);Gb(H);break;case "square":case "rect":La=true;
k=F;m=I;P({element:"rect",curStyles:true,attr:{x:F,y:I,width:0,height:0,id:ka(),opacity:O.opacity/2}});break;case "line":La=true;H=O.stroke_width==0?1:O.stroke_width;P({element:"line",curStyles:true,attr:{x1:F,y1:I,x2:F,y2:I,id:ka(),stroke:O.stroke,"stroke-width":H,"stroke-dasharray":O.stroke_dasharray,"stroke-linejoin":O.stroke_linejoin,"stroke-linecap":O.stroke_linecap,"stroke-opacity":O.stroke_opacity,fill:"none",opacity:O.opacity/2,style:"pointer-events:none"}});break;case "circle":La=true;P({element:"circle", k=F;m=I;P({element:"rect",curStyles:true,attr:{x:F,y:I,width:0,height:0,id:ka(),opacity:O.opacity/2}});break;case "line":La=true;H=O.stroke_width==0?1:O.stroke_width;P({element:"line",curStyles:true,attr:{x1:F,y1:I,x2:F,y2:I,id:ka(),stroke:O.stroke,"stroke-width":H,"stroke-dasharray":O.stroke_dasharray,"stroke-linejoin":O.stroke_linejoin,"stroke-linecap":O.stroke_linecap,"stroke-opacity":O.stroke_opacity,fill:"none",opacity:O.opacity/2,style:"pointer-events:none"}});break;case "circle":La=true;P({element:"circle",
curStyles:true,attr:{cx:F,cy:I,r:0,id:ka(),opacity:O.opacity/2}});break;case "ellipse":La=true;P({element:"ellipse",curStyles:true,attr:{cx:F,cy:I,rx:0,ry:0,id:ka(),opacity:O.opacity/2}});break;case "text":La=true;P({element:"text",curStyles:true,attr:{x:F,y:I,id:ka(),fill:Xa.fill,"stroke-width":Xa.stroke_width,"font-size":Xa.font_size,"font-family":Xa.font_family,"text-anchor":"left","xml:space":"preserve",opacity:O.opacity}});break;case "path":case "pathedit":k*=p;m*=p;Ja.mouseDown(w,g,k,m);La= curStyles:true,attr:{cx:F,cy:I,r:0,id:ka(),opacity:O.opacity/2}});break;case "ellipse":La=true;P({element:"ellipse",curStyles:true,attr:{cx:F,cy:I,rx:0,ry:0,id:ka(),opacity:O.opacity/2}});break;case "text":La=true;P({element:"text",curStyles:true,attr:{x:F,y:I,id:ka(),fill:Xa.fill,"stroke-width":Xa.stroke_width,"font-size":Xa.font_size,"font-family":Xa.font_family,"text-anchor":"left","xml:space":"preserve",opacity:O.opacity}});break;case "path":case "pathedit":k*=p;m*=p;Ja.mouseDown(w,g,k,m);La=
true;break;case "textedit":k*=p;m*=p;cb.mouseDown(w,g,k,m);La=true;break;case "rotate":La=true;c.undoMgr.beginUndoableChange("transform",K);document.getElementById("workarea").className="rotate"}H=lb("mouseDown",{event:w,start_x:k,start_y:m,selectedElements:K},true);$.each(H,function(X,ca){if(ca&&ca.started)La=true});if(Da)document.getElementById("workarea").className=Da=="resize"?w.target.style.cursor:Da}}).mousemove(function(w){if(!(w.originalEvent.touches&&w.originalEvent.touches.length>1))if(La)if(!(w.button=== true;break;case "textedit":k*=p;m*=p;cb.mouseDown(w,g,k,m);La=true;break;case "rotate":La=true;c.undoMgr.beginUndoableChange("transform",K);document.getElementById("workarea").className="rotate"}H=lb("mouseDown",{event:w,start_x:k,start_y:m,selectedElements:K},true);$.each(H,function(X,da){if(da&&da.started)La=true});if(Da)document.getElementById("workarea").className=Da=="resize"?w.target.style.cursor:Da}}).mousemove(function(w){if(!(w.originalEvent.touches&&w.originalEvent.touches.length>1))if(La)if(!(w.button===
1||c.spaceKey)){var E=K[0],I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);var g=pa(ba()),o=x=F/p,v=y=I/p;if(n.gridSnapping){x=xa(x);y=xa(y)}w.preventDefault();switch(Da){case "select":if(K[0]!==null){o=x-k;var D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D)}if(w.shiftKey){var H=aa(k,m,x,y);x=H.x;y=H.y}if(o!=0||D!=0){H=K.length;for(v=0;v<H;++v){E=K[v];if(E==null)break;var J=d.createSVGTransform();g=T(E);J.setTranslate(o,D);g.numberOfItems?g.replaceItem(J,0):g.appendItem(J);Ga.requestSelector(E).resize()}if(w.altKey)if(!c.addClones){c.addClones= 1||c.spaceKey)){var E=K[0],I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);var g=oa(ba()),o=x=F/p,v=y=I/p;if(n.gridSnapping){x=xa(x);y=xa(y)}w.preventDefault();switch(Da){case "select":if(K[0]!==null){o=x-k;var D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D)}if(w.shiftKey){var H=ca(k,m,x,y);x=H.x;y=H.y}if(o!=0||D!=0){H=K.length;for(v=0;v<H;++v){E=K[v];if(E==null)break;var J=d.createSVGTransform();g=T(E);J.setTranslate(o,D);g.numberOfItems?g.replaceItem(J,0):g.appendItem(J);Ga.requestSelector(E).resize()}if(w.altKey)if(!c.addClones){c.addClones=
c.cloneSelectedElements(0,0,J);c.removeClones=function(){c.addClones&&c.addClones.forEach(function(ga){ga.parentNode&&ga.parentNode.removeChild(ga);c.addClones=false})};window.addEventListener("keyup",c.removeClones)}N("transition",K)}}break;case "multiselect":o*=p;v*=p;la(ua,{x:Math.min(A,o),y:Math.min(z,v),width:Math.abs(o-A),height:Math.abs(v-z)},100);g=[];o=[];J=sb();H=K.length;for(v=0;v<H;++v){D=J.indexOf(K[v]);if(D==-1)g.push(K[v]);else J[D]=null}H=J.length;for(v=0;v<H;++v)J[v]&&o.push(J[v]); c.cloneSelectedElements(0,0,J);c.removeClones=function(){c.addClones&&c.addClones.forEach(function(ga){ga.parentNode&&ga.parentNode.removeChild(ga);c.addClones=false})};window.addEventListener("keyup",c.removeClones)}N("transition",K)}}break;case "multiselect":o*=p;v*=p;la(ua,{x:Math.min(A,o),y:Math.min(z,v),width:Math.abs(o-A),height:Math.abs(v-z)},100);g=[];o=[];J=sb();H=K.length;for(v=0;v<H;++v){D=J.indexOf(K[v]);if(D==-1)g.push(K[v]);else J[D]=null}H=J.length;for(v=0;v<H;++v)J[v]&&o.push(J[v]);
g.length>0&&c.removeFromSelection(g);o.length>0&&tb(o);break;case "resize":g=T(E);o=(J=na(g))?G:svgedit.utilities.getBBox(E);H=o.x;v=o.y;var X=o.width,ca=o.height;o=x-k;D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D);ca=xa(ca);X=xa(X)}var S=oa(E);if(S){var W=Math.sqrt(o*o+D*D);D=Math.atan2(D,o)-S*Math.PI/180;o=W*Math.cos(D);D=W*Math.sin(D)}if(gb.indexOf("n")==-1&&gb.indexOf("s")==-1)D=0;if(gb.indexOf("e")==-1&&gb.indexOf("w")==-1)o=0;var Z=W=0,qa=ca?(ca+D)/ca:1,ta=X?(X+o)/X:1;if(gb.indexOf("n")>=0){qa=ca? g.length>0&&c.removeFromSelection(g);o.length>0&&tb(o);break;case "resize":g=T(E);o=(J=qa(g))?G:svgedit.utilities.getBBox(E);H=o.x;v=o.y;var X=o.width,da=o.height;o=x-k;D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D);da=xa(da);X=xa(X)}var S=na(E);if(S){var V=Math.sqrt(o*o+D*D);D=Math.atan2(D,o)-S*Math.PI/180;o=V*Math.cos(D);D=V*Math.sin(D)}if(gb.indexOf("n")==-1&&gb.indexOf("s")==-1)D=0;if(gb.indexOf("e")==-1&&gb.indexOf("w")==-1)o=0;var Z=V=0,pa=da?(da+D)/da:1,ta=X?(X+o)/X:1;if(gb.indexOf("n")>=0){pa=da?
(ca-D)/ca:1;Z=ca}if(gb.indexOf("w")>=0){ta=X?(X-o)/X:1;W=X}o=d.createSVGTransform();D=d.createSVGTransform();X=d.createSVGTransform();if(n.gridSnapping){H=xa(H);W=xa(W);v=xa(v);Z=xa(Z)}o.setTranslate(-(H+W),-(v+Z));if(w.shiftKey)if(ta==1)ta=qa;else qa=ta;D.setScale(ta,qa);X.setTranslate(H+W,v+Z);if(J){J=S?1:0;g.replaceItem(o,2+J);g.replaceItem(D,1+J);g.replaceItem(X,0+J)}else{J=g.numberOfItems;g.replaceItem(X,J-3);g.replaceItem(D,J-2);g.replaceItem(o,J-1)}Ga.requestSelector(E).resize();N("transition", (da-D)/da:1;Z=da}if(gb.indexOf("w")>=0){ta=X?(X-o)/X:1;V=X}o=d.createSVGTransform();D=d.createSVGTransform();X=d.createSVGTransform();if(n.gridSnapping){H=xa(H);V=xa(V);v=xa(v);Z=xa(Z)}o.setTranslate(-(H+V),-(v+Z));if(w.shiftKey)if(ta==1)ta=pa;else pa=ta;D.setScale(ta,pa);X.setTranslate(H+V,v+Z);if(J){J=S?1:0;g.replaceItem(o,2+J);g.replaceItem(D,1+J);g.replaceItem(X,0+J)}else{J=g.numberOfItems;g.replaceItem(X,J-3);g.replaceItem(D,J-2);g.replaceItem(o,J-1)}Ga.requestSelector(E).resize();N("transition",
K);break;case "zoom":o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100);break;case "text":la(g,{x:x,y:y},1E3);break;case "line":o=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=xa(x);y=xa(y)}J=x;H=y;if(w.shiftKey){H=aa(k,m,J,H);J=H.x;H=H.y}g.setAttributeNS(null,"x2",J);g.setAttributeNS(null,"y2",H);window.opera||d.unsuspendRedraw(o);break;case "foreignObject":case "square":case "rect":case "image":o=Math.abs(x-k);J=Math.abs(y-m);if(Da== K);break;case "zoom":o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100);break;case "text":la(g,{x:x,y:y},1E3);break;case "line":o=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=xa(x);y=xa(y)}J=x;H=y;if(w.shiftKey){H=ca(k,m,J,H);J=H.x;H=H.y}g.setAttributeNS(null,"x2",J);g.setAttributeNS(null,"y2",H);window.opera||d.unsuspendRedraw(o);break;case "foreignObject":case "square":case "rect":case "image":o=Math.abs(x-k);J=Math.abs(y-m);if(Da==
"square"||w.shiftKey){o=J=Math.max(o,J);H=k<x?k:k-o;v=m<y?m:m-J}else{H=Math.min(k,x);v=Math.min(m,y)}if(w.altKey){o*=2;J*=2;H=k-o/2;v=m-J/2}if(n.gridSnapping){o=xa(o);J=xa(J);H=xa(H);v=xa(v)}la(g,{width:o,height:J,x:H,y:v},1E3);break;case "circle":o=$(g).attr(["cx","cy"]);J=o.cx;H=o.cy;o=Math.sqrt((x-J)*(x-J)+(y-H)*(y-H));if(n.gridSnapping)o=xa(o);g.setAttributeNS(null,"r",o);break;case "ellipse":o=$(g).attr(["cx","cy"]);J=Math.abs(k+(x-k)/2);H=Math.abs(m+(y-m)/2);o=null;window.opera||d.suspendRedraw(1E3); "square"||w.shiftKey){o=J=Math.max(o,J);H=k<x?k:k-o;v=m<y?m:m-J}else{H=Math.min(k,x);v=Math.min(m,y)}if(w.altKey){o*=2;J*=2;H=k-o/2;v=m-J/2}if(n.gridSnapping){o=xa(o);J=xa(J);H=xa(H);v=xa(v)}la(g,{width:o,height:J,x:H,y:v},1E3);break;case "circle":o=$(g).attr(["cx","cy"]);J=o.cx;H=o.cy;o=Math.sqrt((x-J)*(x-J)+(y-H)*(y-H));if(n.gridSnapping)o=xa(o);g.setAttributeNS(null,"r",o);break;case "ellipse":o=$(g).attr(["cx","cy"]);J=Math.abs(k+(x-k)/2);H=Math.abs(m+(y-m)/2);o=null;window.opera||d.suspendRedraw(1E3);
if(n.gridSnapping){x=xa(x);J=xa(J);y=xa(y);H=xa(H)}v=Math.abs(k-J);D=Math.abs(m-H);if(w.shiftKey){D=v;H=y>m?m+v:m-v}if(w.altKey){J=k;H=m;v=Math.abs(x-J);D=w.shiftKey?v:Math.abs(y-H)}g.setAttributeNS(null,"rx",v);g.setAttributeNS(null,"ry",D);g.setAttributeNS(null,"cx",J);g.setAttributeNS(null,"cy",H);window.opera||d.unsuspendRedraw(o);break;case "fhellipse":case "fhrect":B.minx=Math.min(o,B.minx);B.maxx=Math.max(o,B.maxx);B.miny=Math.min(v,B.miny);B.maxy=Math.max(v,B.maxy);case "fhpath":e+=+o+","+ if(n.gridSnapping){x=xa(x);J=xa(J);y=xa(y);H=xa(H)}v=Math.abs(k-J);D=Math.abs(m-H);if(w.shiftKey){D=v;H=y>m?m+v:m-v}if(w.altKey){J=k;H=m;v=Math.abs(x-J);D=w.shiftKey?v:Math.abs(y-H)}g.setAttributeNS(null,"rx",v);g.setAttributeNS(null,"ry",D);g.setAttributeNS(null,"cx",J);g.setAttributeNS(null,"cy",H);window.opera||d.unsuspendRedraw(o);break;case "fhellipse":case "fhrect":B.minx=Math.min(o,B.minx);B.maxx=Math.max(o,B.maxx);B.miny=Math.min(v,B.miny);B.maxy=Math.max(v,B.maxy);case "fhpath":e+=+o+","+
v+" ";g.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=p;y*=p;if(n.gridSnapping){x=xa(x);y=xa(y);k=xa(k);m=xa(m)}if(w.shiftKey){if(J=svgedit.path.path){g=J.dragging?J.dragging[0]:k;J=J.dragging?J.dragging[1]:m}else{g=k;J=m}H=aa(g,J,x,y);x=H.x;y=H.y}if(ua&&ua.getAttribute("display")!=="none"){o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100)}Ja.mouseMove(w,x,y);break;case "textedit":x*=p;y*=p;cb.mouseMove(F,I);break;case "rotate":o= v+" ";g.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=p;y*=p;if(n.gridSnapping){x=xa(x);y=xa(y);k=xa(k);m=xa(m)}if(w.shiftKey){if(J=svgedit.path.path){g=J.dragging?J.dragging[0]:k;J=J.dragging?J.dragging[1]:m}else{g=k;J=m}H=ca(g,J,x,y);x=H.x;y=H.y}if(ua&&ua.getAttribute("display")!=="none"){o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100)}Ja.mouseMove(w,x,y);break;case "textedit":x*=p;y*=p;cb.mouseMove(F,I);break;case "rotate":o=
svgedit.utilities.getBBox(E);J=o.x+o.width/2;H=o.y+o.height/2;g=V(E);g=M(J,H,g);J=g.x;H=g.y;g=o.x;v=o.y;if(current_rotate_mode=="nw")g=o.x+o.width;if(current_rotate_mode=="se")v=o.y+o.height;if(current_rotate_mode=="sw"){g=o.x+o.width;v=o.y+o.height}compensation_angle=(Math.atan2(H-v,J-g)*(180/Math.PI)-90)%360;S=(Math.atan2(H-y,J-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=xa(S);if(w.shiftKey)S=Math.round(S/45)*45;c.setRotationAngle(S<-180?360+S:S,true);N("transition",K)}lb("mouseMove", svgedit.utilities.getBBox(E);J=o.x+o.width/2;H=o.y+o.height/2;g=W(E);g=M(J,H,g);J=g.x;H=g.y;g=o.x;v=o.y;if(current_rotate_mode=="nw")g=o.x+o.width;if(current_rotate_mode=="se")v=o.y+o.height;if(current_rotate_mode=="sw"){g=o.x+o.width;v=o.y+o.height}compensation_angle=(Math.atan2(H-v,J-g)*(180/Math.PI)-90)%360;S=(Math.atan2(H-y,J-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=xa(S);if(w.shiftKey)S=Math.round(S/45)*45;c.setRotationAngle(S<-180?360+S:S,true);N("transition",K)}lb("mouseMove",
{event:w,mouse_x:F,mouse_y:I,selected:E})}}).click(function(w){w.preventDefault();return false}).dblclick(function(w){var E=w.target.parentNode;if(E!==L){var I=mb(w),F=I.tagName;if(F==="text"&&Da!=="textedit"){w=M(w.pageX,w.pageY,pb);cb.select(I,w.x,w.y)}if((F==="g"||F==="a")&&oa(I)){Kb(I);I=K[0];Pa(true)}L&&Hb();E.tagName!=="g"&&E.tagName!=="a"||E===C().getCurrentLayer()||I===Ga.selectorParentGroup||Pb(I)}}).mouseup(function(w){c.addClones=false;window.removeEventListener("keyup",c.removeClones); {event:w,mouse_x:F,mouse_y:I,selected:E})}}).click(function(w){w.preventDefault();return false}).dblclick(function(w){var E=w.target.parentNode;if(E!==L){var I=mb(w),F=I.tagName;if(F==="text"&&Da!=="textedit"){w=M(w.pageX,w.pageY,pb);cb.select(I,w.x,w.y)}if((F==="g"||F==="a")&&na(I)){Kb(I);I=K[0];Pa(true)}L&&Hb();E.tagName!=="g"&&E.tagName!=="a"||E===C().getCurrentLayer()||I===Ga.selectorParentGroup||Pb(I)}}).mouseup(function(w){c.addClones=false;window.removeEventListener("keyup",c.removeClones);
K=K.filter(Boolean);if(w.button!==2){var E=xb;xb=null;if(La){var I=M(w.pageX,w.pageY,pb),F=I.x*p;I=I.y*p;var g=F/p,o=I/p,v=pa(ba()),D=false;La=false;switch(Da){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");jb=[]}Da="select";case "select":if(K[0]!=null){if(K.length==1){F=K[0];switch(F.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ab.fill=F.getAttribute("fill");ab.fill_opacity=F.getAttribute("fill-opacity");ab.stroke=F.getAttribute("stroke"); K=K.filter(Boolean);if(w.button!==2){var E=xb;xb=null;if(La){var I=M(w.pageX,w.pageY,pb),F=I.x*p;I=I.y*p;var g=F/p,o=I/p,v=oa(ba()),D=false;La=false;switch(Da){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");jb=[]}Da="select";case "select":if(K[0]!=null){if(K.length==1){F=K[0];switch(F.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ab.fill=F.getAttribute("fill");ab.fill_opacity=F.getAttribute("fill-opacity");ab.stroke=F.getAttribute("stroke");
ab.stroke_opacity=F.getAttribute("stroke-opacity");ab.stroke_width=F.getAttribute("stroke-width");ab.stroke_dasharray=F.getAttribute("stroke-dasharray");ab.stroke_linejoin=F.getAttribute("stroke-linejoin");ab.stroke_linecap=F.getAttribute("stroke-linecap")}if(F.tagName=="text"){Xa.font_size=F.getAttribute("font-size");Xa.font_family=F.getAttribute("font-family")}Ga.requestSelector(F).showGrips(true)}Fa();if(g!=A||o!=z){w=K.length;for(F=0;F<w;++F){if(K[F]==null)break;K[F].firstChild||Ga.requestSelector(K[F]).resize()}}else{F= ab.stroke_opacity=F.getAttribute("stroke-opacity");ab.stroke_width=F.getAttribute("stroke-width");ab.stroke_dasharray=F.getAttribute("stroke-dasharray");ab.stroke_linejoin=F.getAttribute("stroke-linejoin");ab.stroke_linecap=F.getAttribute("stroke-linecap")}if(F.tagName=="text"){Xa.font_size=F.getAttribute("font-size");Xa.font_family=F.getAttribute("font-family")}Ga.requestSelector(F).showGrips(true)}Fa();if(g!=A||o!=z){w=K.length;for(F=0;F<w;++F){if(K[F]==null)break;K[F].firstChild||Ga.requestSelector(K[F]).resize()}}else{F=
w.target;if(K[0].nodeName==="path"&&K[1]==null)Ja.select(K[0]);else w.shiftKey&&E!=F&&c.removeFromSelection([F])}if(svgedit.browser.supportsNonScalingStroke())if(w=K[0]){w.removeAttribute("style");svgedit.utilities.walkTree(w,function(X){X.removeAttribute("style")})}}return;case "zoom":ua!=null&&ua.setAttribute("display","none");N("zoomed",{x:Math.min(A,g),y:Math.min(z,o),width:Math.abs(g-A),height:Math.abs(o-z),factor:w.altKey?0.5:2});return;case "fhpath":E=v.getAttribute("points");g=E.indexOf(","); w.target;if(K[0].nodeName==="path"&&K[1]==null)Ja.select(K[0]);else w.shiftKey&&E!=F&&c.removeFromSelection([F])}if(svgedit.browser.supportsNonScalingStroke())if(w=K[0]){w.removeAttribute("style");svgedit.utilities.walkTree(w,function(X){X.removeAttribute("style")})}}return;case "zoom":ua!=null&&ua.setAttribute("display","none");N("zoomed",{x:Math.min(A,g),y:Math.min(z,o),width:Math.abs(g-A),height:Math.abs(o-z),factor:w.altKey?0.5:2});return;case "fhpath":E=v.getAttribute("points");g=E.indexOf(",");
if(D=g>=0?E.indexOf(",",g+1)>=0:E.indexOf(" ",E.indexOf(" ")+1)>=0)v=Ja.smoothPolylineIntoPath(v);break;case "line":E=$(v).attr(["x1","x2","y1","y2"]);D=E.x1!=E.x2||E.y1!=E.y2;break;case "foreignObject":case "square":case "rect":case "image":E=$(v).attr(["width","height"]);D=E.width!=0||E.height!=0||Da==="image";break;case "circle":D=v.getAttribute("r")!=0;break;case "ellipse":E=$(v).attr(["rx","ry"]);D=E.rx!=null||E.ry!=null;break;case "fhellipse":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"ellipse", if(D=g>=0?E.indexOf(",",g+1)>=0:E.indexOf(" ",E.indexOf(" ")+1)>=0)v=Ja.smoothPolylineIntoPath(v);break;case "line":E=$(v).attr(["x1","x2","y1","y2"]);D=E.x1!=E.x2||E.y1!=E.y2;break;case "foreignObject":case "square":case "rect":case "image":E=$(v).attr(["width","height"]);D=E.width!=0||E.height!=0||Da==="image";break;case "circle":D=v.getAttribute("r")!=0;break;case "ellipse":E=$(v).attr(["rx","ry"]);D=E.rx!=null||E.ry!=null;break;case "fhellipse":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"ellipse",
curStyles:true,attr:{cx:(B.minx+B.maxx)/2,cy:(B.miny+B.maxy)/2,rx:(B.maxx-B.minx)/2,ry:(B.maxy-B.miny)/2,id:ba()}});N("changed",[v]);D=true}break;case "fhrect":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"rect",curStyles:true,attr:{x:B.minx,y:B.miny,width:B.maxx-B.minx,height:B.maxy-B.miny,id:ba()}});N("changed",[v]);D=true}break;case "text":D=true;vb([v]);cb.start(v);break;case "path":v=null;La=true;E=Ja.mouseUp(w,v,F,I);v=E.element;D=E.keep;break;case "pathedit":D=true;v=null;Ja.mouseUp(w); curStyles:true,attr:{cx:(B.minx+B.maxx)/2,cy:(B.miny+B.maxy)/2,rx:(B.maxx-B.minx)/2,ry:(B.maxy-B.miny)/2,id:ba()}});N("changed",[v]);D=true}break;case "fhrect":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"rect",curStyles:true,attr:{x:B.minx,y:B.miny,width:B.maxx-B.minx,height:B.maxy-B.miny,id:ba()}});N("changed",[v]);D=true}break;case "text":D=true;vb([v]);cb.start(v);break;case "path":v=null;La=true;E=Ja.mouseUp(w,v,F,I);v=E.element;D=E.keep;break;case "pathedit":D=true;v=null;Ja.mouseUp(w);
break;case "textedit":D=false;v=null;cb.mouseUp(w,F,I);break;case "rotate":D=true;v=null;Da="select";E=c.undoMgr.finishUndoableChange();E.isEmpty()||ya(E);Fa();N("changed",K)}F=lb("mouseUp",{event:w,mouse_x:F,mouse_y:I},true);$.each(F,function(X,ca){if(ca){D=ca.keep||D;v=ca.element;La=ca.started||La}});if(!D&&v!=null){C().releaseId(ba());v.parentNode.removeChild(v);v=null;for(F=w.target;F.parentNode.parentNode.tagName=="g";)F=F.parentNode;if((Da!="path"||!drawn_path)&&F.parentNode.id!="selectorParentGroup"&& break;case "textedit":D=false;v=null;cb.mouseUp(w,F,I);break;case "rotate":D=true;v=null;Da="select";E=c.undoMgr.finishUndoableChange();E.isEmpty()||ya(E);Fa();N("changed",K)}F=lb("mouseUp",{event:w,mouse_x:F,mouse_y:I},true);$.each(F,function(X,da){if(da){D=da.keep||D;v=da.element;La=da.started||La}});if(!D&&v!=null){C().releaseId(ba());v.parentNode.removeChild(v);v=null;for(F=w.target;F.parentNode.parentNode.tagName=="g";)F=F.parentNode;if((Da!="path"||!drawn_path)&&F.parentNode.id!="selectorParentGroup"&&
F.id!="svgcanvas"&&F.id!="svgroot"){c.setMode("select");vb([F],true)}}else if(v!=null){c.addedNew=true;w=0.2;var H;if(false.beginElement&&v.getAttribute("opacity")!=O.opacity){H=$(false).clone().attr({to:O.opacity,dur:w}).appendTo(v);try{H[0].beginElement()}catch(J){}}else w=0;setTimeout(function(){H&&H.remove();v.setAttribute("opacity",O.opacity);v.setAttribute("style","pointer-events:inherit");ma(v);if(Da==="path")Ja.toEditMode(v);else n.selectNew&&vb([v],true);ya(new za(v));N("changed",[v])},w* F.id!="svgcanvas"&&F.id!="svgroot"){c.setMode("select");vb([F],true)}}else if(v!=null){c.addedNew=true;w=0.2;var H;if(false.beginElement&&v.getAttribute("opacity")!=O.opacity){H=$(false).clone().attr({to:O.opacity,dur:w}).appendTo(v);try{H[0].beginElement()}catch(J){}}else w=0;setTimeout(function(){H&&H.remove();v.setAttribute("opacity",O.opacity);v.setAttribute("style","pointer-events:inherit");ma(v);if(Da==="path")Ja.toEditMode(v);else n.selectNew&&vb([v],true);ya(new za(v));N("changed",[v])},w*
1E3)}Ra=null}}});$(a).bind("mousewheel DOMMouseScroll",function(w){if(w.shiftKey){w.preventDefault();pb=l.getScreenCTM().inverse();var E=M(w.pageX,w.pageY,pb);E={x:E.x,y:E.y,width:0,height:0};if(w.wheelDelta)if(w.wheelDelta>=120)E.factor=2;else{if(w.wheelDelta<=-120)E.factor=0.5}else if(w.detail)if(w.detail>0)E.factor=0.5;else if(w.detail<0)E.factor=2;E.factor&&N("zoomed",E)}})})();var Gb=function(e){$(e).click(function(k){k.preventDefault()})},cb=c.textActions=function(){function e(S){var W=I.value=== 1E3)}Ra=null}}});$(a).bind("mousewheel DOMMouseScroll",function(w){if(w.shiftKey){w.preventDefault();pb=l.getScreenCTM().inverse();var E=M(w.pageX,w.pageY,pb);E={x:E.x,y:E.y,width:0,height:0};if(w.wheelDelta)if(w.wheelDelta>=120)E.factor=2;else{if(w.wheelDelta<=-120)E.factor=0.5}else if(w.detail)if(w.detail>0)E.factor=0.5;else if(w.detail<0)E.factor=2;E.factor&&N("zoomed",E)}})})();var Gb=function(e){$(e).click(function(k){k.preventDefault()})},cb=c.textActions=function(){function e(S){var V=I.value===
"";$(I).focus();if(!arguments.length)if(W)S=0;else{if(I.selectionEnd!==I.selectionStart)return;S=I.selectionEnd}var Z;Z=v[S];W||I.setSelectionRange(S,S);F=pa("text_cursor");if(!F){F=document.createElementNS(b,"line");la(F,{id:"text_cursor",stroke:"#333","stroke-width":1});F=pa("selectorParentGroup").appendChild(F)}o||(o=setInterval(function(){var qa=F.getAttribute("display")==="none";F.setAttribute("display",qa?"inline":"none")},600));W=G(Z.x,D.y);Z=G(Z.x,D.y+D.height);la(F,{x1:W.x,y1:W.y,x2:Z.x, "";$(I).focus();if(!arguments.length)if(V)S=0;else{if(I.selectionEnd!==I.selectionStart)return;S=I.selectionEnd}var Z;Z=v[S];V||I.setSelectionRange(S,S);F=oa("text_cursor");if(!F){F=document.createElementNS(b,"line");la(F,{id:"text_cursor",stroke:"#333","stroke-width":1});F=oa("selectorParentGroup").appendChild(F)}o||(o=setInterval(function(){var pa=F.getAttribute("display")==="none";F.setAttribute("display",pa?"inline":"none")},600));V=G(Z.x,D.y);Z=G(Z.x,D.y+D.height);la(F,{x1:V.x,y1:V.y,x2:Z.x,
y2:Z.y,visibility:"visible",display:"inline"});g&&g.setAttribute("d","")}function k(S,W,Z){if(S===W)e(W);else{Z||I.setSelectionRange(S,W);g=pa("text_selectblock");if(!g){g=document.createElementNS(b,"path");la(g,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(g)}S=v[S];var qa=v[W];F.setAttribute("visibility","hidden");W=G(S.x,D.y);Z=G(S.x+(qa.x-S.x),D.y);var ta=G(S.x,D.y+D.height);S=G(S.x+(qa.x-S.x),D.y+D.height);la(g,{d:"M"+W.x+ y2:Z.y,visibility:"visible",display:"inline"});g&&g.setAttribute("d","")}function k(S,V,Z){if(S===V)e(V);else{Z||I.setSelectionRange(S,V);g=oa("text_selectblock");if(!g){g=document.createElementNS(b,"path");la(g,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});oa("selectorParentGroup").appendChild(g)}S=v[S];var pa=v[V];F.setAttribute("visibility","hidden");V=G(S.x,D.y);Z=G(S.x+(pa.x-S.x),D.y);var ta=G(S.x,D.y+D.height);S=G(S.x+(pa.x-S.x),D.y+D.height);la(g,{d:"M"+V.x+
","+W.y+" L"+Z.x+","+Z.y+" "+S.x+","+S.y+" "+ta.x+","+ta.y+"z",display:"inline"})}}function m(S,W){var Z=d.createSVGPoint();Z.x=S;Z.y=W;if(v.length==1)return 0;Z=E.getCharNumAtPosition(Z);if(Z<0){Z=v.length-2;if(S<=v[0].x)Z=0}else if(Z>=v.length-2)Z=v.length-2;var qa=v[Z];S>qa.x+qa.width/2&&Z++;return Z}function A(S,W,Z){var qa=I.selectionStart;S=m(S,W);k(Math.min(qa,S),Math.max(qa,S),!Z)}function z(S,W){var Z={x:S,y:W};Z.x/=p;Z.y/=p;if(H){var qa=M(Z.x,Z.y,H.inverse());Z.x=qa.x;Z.y=qa.y}return Z} ","+V.y+" L"+Z.x+","+Z.y+" "+S.x+","+S.y+" "+ta.x+","+ta.y+"z",display:"inline"})}}function m(S,V){var Z=d.createSVGPoint();Z.x=S;Z.y=V;if(v.length==1)return 0;Z=E.getCharNumAtPosition(Z);if(Z<0){Z=v.length-2;if(S<=v[0].x)Z=0}else if(Z>=v.length-2)Z=v.length-2;var pa=v[Z];S>pa.x+pa.width/2&&Z++;return Z}function A(S,V,Z){var pa=I.selectionStart;S=m(S,V);k(Math.min(pa,S),Math.max(pa,S),!Z)}function z(S,V){var Z={x:S,y:V};Z.x/=p;Z.y/=p;if(H){var pa=M(Z.x,Z.y,H.inverse());Z.x=pa.x;Z.y=pa.y}return Z}
function G(S,W){var Z={x:S,y:W};if(H){var qa=M(Z.x,Z.y,H);Z.x=qa.x;Z.y=qa.y}Z.x*=p;Z.y*=p;return Z}function B(S){k(0,E.textContent.length);$(this).unbind(S)}function w(S){if(ca&&E){var W=M(S.pageX,S.pageY,pb);W=z(W.x*p,W.y*p);W=m(W.x,W.y);var Z=E.textContent,qa=Z.substr(0,W).replace(/[a-z0-9]+$/i,"").length;Z=Z.substr(W).match(/^[a-z0-9]+/i);k(qa,(Z?Z[0].length:0)+W);$(S.target).click(B);setTimeout(function(){$(S.target).unbind("click",B)},300)}}var E,I,F,g,o,v=[],D,H,J,X,ca;return{select:function(S, function G(S,V){var Z={x:S,y:V};if(H){var pa=M(Z.x,Z.y,H);Z.x=pa.x;Z.y=pa.y}Z.x*=p;Z.y*=p;return Z}function B(S){k(0,E.textContent.length);$(this).unbind(S)}function w(S){if(da&&E){var V=M(S.pageX,S.pageY,pb);V=z(V.x*p,V.y*p);V=m(V.x,V.y);var Z=E.textContent,pa=Z.substr(0,V).replace(/[a-z0-9]+$/i,"").length;Z=Z.substr(V).match(/^[a-z0-9]+/i);k(pa,(Z?Z[0].length:0)+V);$(S.target).click(B);setTimeout(function(){$(S.target).unbind("click",B)},300)}}var E,I,F,g,o,v=[],D,H,J,X,da;return{select:function(S,
W,Z){E=S;cb.toEditMode(W,Z)},start:function(S){E=S;cb.toEditMode()},mouseDown:function(S,W,Z,qa){S=z(Z,qa);I.focus();e(m(S.x,S.y));J=Z;X=qa},mouseMove:function(S,W){var Z=z(S,W);A(Z.x,Z.y)},mouseUp:function(S,W,Z){var qa=z(W,Z);A(qa.x,qa.y,true);S.target!==E&&W<J+2&&W>J-2&&Z<X+2&&Z>X-2&&cb.toSelectMode(true)},setCursor:e,toEditMode:function(S,W){vb([E],false);ca=false;Da="textedit";Ga.requestSelector(E).showGrips(false);Ga.requestSelector(E);cb.init();$(E).css("cursor","text");if(arguments.length){var Z= V,Z){E=S;cb.toEditMode(V,Z)},start:function(S){E=S;cb.toEditMode()},mouseDown:function(S,V,Z,pa){S=z(Z,pa);I.focus();e(m(S.x,S.y));J=Z;X=pa},mouseMove:function(S,V){var Z=z(S,V);A(Z.x,Z.y)},mouseUp:function(S,V,Z){var pa=z(V,Z);A(pa.x,pa.y,true);S.target!==E&&V<J+2&&V>J-2&&Z<X+2&&Z>X-2&&cb.toSelectMode(true)},setCursor:e,toEditMode:function(S,V){vb([E],false);da=false;Da="textedit";Ga.requestSelector(E).showGrips(false);Ga.requestSelector(E);cb.init();$(E).css("cursor","text");if(arguments.length){var Z=
z(S,W);e(m(Z.x,Z.y))}else e();setTimeout(function(){ca=true},300)},toSelectMode:function(S){Da="select";clearInterval(o);o=null;g&&$(g).attr("display","none");F&&$(F).attr("visibility","hidden");$(E).css("cursor","move");if(S){Pa();$(E).css("cursor","move");N("selected",[E]);tb([E],true)}E&&!E.textContent.length&&c.deleteSelectedElements();$(I).blur();E=false},setInputElem:function(S){I=S},clear:function(){Da=="textedit"&&cb.toSelectMode()},init:function(){if(E){if(!E.parentNode){E=K[0];Ga.requestSelector(E).showGrips(false)}var S= z(S,V);e(m(Z.x,Z.y))}else e();setTimeout(function(){da=true},300)},toSelectMode:function(S){Da="select";clearInterval(o);o=null;g&&$(g).attr("display","none");F&&$(F).attr("visibility","hidden");$(E).css("cursor","move");if(S){Pa();$(E).css("cursor","move");N("selected",[E]);tb([E],true)}E&&!E.textContent.length&&c.deleteSelectedElements();$(I).blur();E=false},setInputElem:function(S){I=S},clear:function(){Da=="textedit"&&cb.toSelectMode()},init:function(){if(E){if(!E.parentNode){E=K[0];Ga.requestSelector(E).showGrips(false)}var S=
E.textContent.length,W=E.getAttribute("transform");D=svgedit.utilities.getBBox(E);H=W?V(E):null;v=Array(S);I.focus();$(E).unbind("dblclick",w).dblclick(w);if(!S)var Z={x:D.x+D.width/2,width:0};for(W=0;W<S;W++){var qa=E.getStartPositionOfChar(W);Z=E.getEndPositionOfChar(W);if(!svgedit.browser.supportsGoodTextCharPos()){var ta=c.contentW*p;qa.x-=ta;Z.x-=ta;qa.x/=p;Z.x/=p}v[W]={x:qa.x,y:D.y,width:Z.x-qa.x,height:D.height}}v.push({x:Z.x,width:0});k(I.selectionStart,I.selectionEnd,true)}}}}(),Ja=c.pathActions= E.textContent.length,V=E.getAttribute("transform");D=svgedit.utilities.getBBox(E);H=V?W(E):null;v=Array(S);I.focus();$(E).unbind("dblclick",w).dblclick(w);if(!S)var Z={x:D.x+D.width/2,width:0};for(V=0;V<S;V++){var pa=E.getStartPositionOfChar(V);Z=E.getEndPositionOfChar(V);if(!svgedit.browser.supportsGoodTextCharPos()){var ta=c.contentW*p;pa.x-=ta;Z.x-=ta;pa.x/=p;Z.x/=p}v[V]={x:pa.x,y:D.y,width:Z.x-pa.x,height:D.height}}v.push({x:Z.x,width:0});k(I.selectionStart,I.selectionEnd,true)}}}}(),Ja=c.pathActions=
function(){var e=false,k,m,A;svgedit.path.Path.prototype.endChanges=function(B){if(svgedit.browser.isWebkit()){var w=this.elem;w.setAttribute("d",Ja.convertPath(w))}B=new Na(this.elem,{d:this.last_d},B);ya(B);N("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(B){$.isArray(B)||(B=[B]);for(var w=0;w<B.length;w++){var E=B[w],I=this.segs[E];I.ptgrip&&this.selected_pts.indexOf(E)==-1&&E>=0&&this.selected_pts.push(E)}this.selected_pts.sort();w=this.selected_pts.length;for(B= function(){var e=false,k,m,A;svgedit.path.Path.prototype.endChanges=function(B){if(svgedit.browser.isWebkit()){var w=this.elem;w.setAttribute("d",Ja.convertPath(w))}B=new Na(this.elem,{d:this.last_d},B);ya(B);N("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(B){$.isArray(B)||(B=[B]);for(var w=0;w<B.length;w++){var E=B[w],I=this.segs[E];I.ptgrip&&this.selected_pts.indexOf(E)==-1&&E>=0&&this.selected_pts.push(E)}this.selected_pts.sort();w=this.selected_pts.length;for(B=
Array(w);w--;){I=this.segs[this.selected_pts[w]];I.select(true);B[w]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);N("selected",B)};var z=k=null,G=false;return{mouseDown:function(B,w,E,I){if(Da==="path"){mouse_x=E;mouse_y=I;I=mouse_x/p;w=mouse_y/p;E=pa("path_stretch_line");m=[I,w];if(n.gridSnapping){I=xa(I);w=xa(w);mouse_x=xa(mouse_x);mouse_y=xa(mouse_y)}if(!E){E=document.createElementNS(b,"path");la(E,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5", Array(w);w--;){I=this.segs[this.selected_pts[w]];I.select(true);B[w]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);N("selected",B)};var z=k=null,G=false;return{mouseDown:function(B,w,E,I){if(Da==="path"){mouse_x=E;mouse_y=I;I=mouse_x/p;w=mouse_y/p;E=oa("path_stretch_line");m=[I,w];if(n.gridSnapping){I=xa(I);w=xa(w);mouse_x=xa(mouse_x);mouse_y=xa(mouse_y)}if(!E){E=document.createElementNS(b,"path");la(E,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",
fill:"none"});E=pa("selectorParentGroup").appendChild(E)}E.setAttribute("display","inline");var F=null;if(z){F=z.pathSegList;for(var g=F.numberOfItems,o=6/p,v=false;g;){g--;var D=F.getItem(g),H=D.x;D=D.y;if(I>=H-o&&I<=H+o&&w>=D-o&&w<=D+o){v=true;break}}o=ba();svgedit.path.removePath_(o);o=pa(o);H=F.numberOfItems;if(v){if(g<=1&&H>=2){I=F.getItem(0).x;w=F.getItem(0).y;B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(I,w):z.createSVGPathSegCurvetoCubicAbs(I,w,B.x1/p,B.y1/p, fill:"none"});E=oa("selectorParentGroup").appendChild(E)}E.setAttribute("display","inline");var F=null;if(z){F=z.pathSegList;for(var g=F.numberOfItems,o=6/p,v=false;g;){g--;var D=F.getItem(g),H=D.x;D=D.y;if(I>=H-o&&I<=H+o&&w>=D-o&&w<=D+o){v=true;break}}o=ba();svgedit.path.removePath_(o);o=oa(o);H=F.numberOfItems;if(v){if(g<=1&&H>=2){I=F.getItem(0).x;w=F.getItem(0).y;B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(I,w):z.createSVGPathSegCurvetoCubicAbs(I,w,B.x1/p,B.y1/p,
I,w);I=z.createSVGPathSegClosePath();F.appendItem(B);F.appendItem(I)}else if(H<3)return F=false;$(E).remove();element=o;z=null;La=false;if(e){svgedit.path.path.matrix&&$a(o,{},svgedit.path.path.matrix.inverse());E=o.getAttribute("d");B=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",B+E);$(o).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a, I,w);I=z.createSVGPathSegClosePath();F.appendItem(B);F.appendItem(I)}else if(H<3)return F=false;$(E).remove();element=o;z=null;La=false;if(e){svgedit.path.path.matrix&&$a(o,{},svgedit.path.path.matrix.inverse());E=o.getAttribute("d");B=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",B+E);$(o).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,
mb(B))){console.log("Clicked outside canvas");return false}F=z.pathSegList.numberOfItems;g=z.pathSegList.getItem(F-1);o=g.x;g=g.y;if(B.shiftKey){B=aa(o,g,I,w);I=B.x;w=B.y}B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(eb(I),eb(w)):z.createSVGPathSegCurvetoCubicAbs(eb(I),eb(w),B.x1/p,B.y1/p,B.x2/p,B.y2/p);z.pathSegList.appendItem(B);I*=p;w*=p;E.setAttribute("d",["M",I,w,I,w].join(" "));E=F;if(e)E+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(E,I,w)}}else{d_attr= mb(B))){console.log("Clicked outside canvas");return false}F=z.pathSegList.numberOfItems;g=z.pathSegList.getItem(F-1);o=g.x;g=g.y;if(B.shiftKey){B=ca(o,g,I,w);I=B.x;w=B.y}B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(eb(I),eb(w)):z.createSVGPathSegCurvetoCubicAbs(eb(I),eb(w),B.x1/p,B.y1/p,B.x2/p,B.y2/p);z.pathSegList.appendItem(B);I*=p;w*=p;E.setAttribute("d",["M",I,w,I,w].join(" "));E=F;if(e)E+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(E,I,w)}}else{d_attr=
"M"+I+","+w+" ";z=P({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:O.opacity/2}});E.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));E=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(E,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();o=B.target.id;if(o.substr(0,14)=="pathpointgrip_"){w=svgedit.path.path.cur_pt=parseInt(o.substr(14));svgedit.path.path.dragging=[E,I];F=svgedit.path.path.segs[w];if(B.shiftKey)F.selected?svgedit.path.path.removePtFromSelection(w): "M"+I+","+w+" ";z=P({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:O.opacity/2}});E.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));E=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(E,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();o=B.target.id;if(o.substr(0,14)=="pathpointgrip_"){w=svgedit.path.path.cur_pt=parseInt(o.substr(14));svgedit.path.path.dragging=[E,I];F=svgedit.path.path.segs[w];if(B.shiftKey)F.selected?svgedit.path.path.removePtFromSelection(w):
svgedit.path.path.addPtsToSelection(w);else{if(svgedit.path.path.selected_pts.length<=1||!F.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(w)}}else if(o.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[E,I];B=o.split("_")[1].split("c");w=B[0]-0;svgedit.path.path.selectPt(w,B[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ga.getRubberBandBox();la(ua,{x:E*p,y:I*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(B,w,E){G=true;if(Da==="path"){if(z){var I= svgedit.path.path.addPtsToSelection(w);else{if(svgedit.path.path.selected_pts.length<=1||!F.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(w)}}else if(o.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[E,I];B=o.split("_")[1].split("c");w=B[0]-0;svgedit.path.path.selectPt(w,B[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ga.getRubberBandBox();la(ua,{x:E*p,y:I*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(B,w,E){G=true;if(Da==="path"){if(z){var I=
z.pathSegList;B=I.numberOfItems-1;if(m){var F=svgedit.path.addCtrlGrip("1c1"),g=svgedit.path.addCtrlGrip("0c2");g.getAttribute("cx");g.getAttribute("cy");F.setAttribute("cx",w);F.setAttribute("cy",E);F.setAttribute("display","inline");F=m[0];var o=m[1];I.getItem(B);var v=F+(F-w/p),D=o+(o-E/p);g.setAttribute("cx",v*p);g.setAttribute("cy",D*p);g.setAttribute("display","inline");g=svgedit.path.getCtrlLine(1);var H=svgedit.path.getCtrlLine(2);la(g,{x1:w,y1:E,x2:F*p,y2:o*p,display:"inline"});la(H,{x1:v* z.pathSegList;B=I.numberOfItems-1;if(m){var F=svgedit.path.addCtrlGrip("1c1"),g=svgedit.path.addCtrlGrip("0c2");g.getAttribute("cx");g.getAttribute("cy");F.setAttribute("cx",w);F.setAttribute("cy",E);F.setAttribute("display","inline");F=m[0];var o=m[1];I.getItem(B);var v=F+(F-w/p),D=o+(o-E/p);g.setAttribute("cx",v*p);g.setAttribute("cy",D*p);g.setAttribute("display","inline");g=svgedit.path.getCtrlLine(1);var H=svgedit.path.getCtrlLine(2);la(g,{x1:w,y1:E,x2:F*p,y2:o*p,display:"inline"});la(H,{x1:v*
p,y1:D*p,x2:F*p,y2:o*p,display:"inline"});if(B===0)A=[w,E];else{I=I.getItem(B-1);w=I.x;E=I.y;if(I.pathSegType===6){w+=w-I.x2;E+=E-I.y2}else if(A){w=A[0]/p;E=A[1]/p}svgedit.path.replacePathSeg(6,B,[F,o,w,E,v,D],z)}}else if(F=pa("path_stretch_line")){B=I.getItem(B);if(B.pathSegType===6)svgedit.path.replacePathSeg(6,1,[w,E,(B.x+(B.x-B.x2))*p,(B.y+(B.y-B.y2))*p,w,E],F);else A?svgedit.path.replacePathSeg(6,1,[w,E,A[0],A[1],w,E],F):svgedit.path.replacePathSeg(4,1,[w,E],F)}}}else if(svgedit.path.path.dragging){F= p,y1:D*p,x2:F*p,y2:o*p,display:"inline"});if(B===0)A=[w,E];else{I=I.getItem(B-1);w=I.x;E=I.y;if(I.pathSegType===6){w+=w-I.x2;E+=E-I.y2}else if(A){w=A[0]/p;E=A[1]/p}svgedit.path.replacePathSeg(6,B,[F,o,w,E,v,D],z)}}else if(F=oa("path_stretch_line")){B=I.getItem(B);if(B.pathSegType===6)svgedit.path.replacePathSeg(6,1,[w,E,(B.x+(B.x-B.x2))*p,(B.y+(B.y-B.y2))*p,w,E],F);else A?svgedit.path.replacePathSeg(6,1,[w,E,A[0],A[1],w,E],F):svgedit.path.replacePathSeg(4,1,[w,E],F)}}}else if(svgedit.path.path.dragging){F=
svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);o=svgedit.path.getPointFromGrip({x:w,y:E},svgedit.path.path);B=o.x-F.x;F=o.y-F.y;svgedit.path.path.dragging=[w,E];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(B,F):svgedit.path.path.movePts(B,F)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var J=ua.getBBox(),X=svgedit.path.getGripPt(this);J=svgedit.math.rectsIntersect(J, svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);o=svgedit.path.getPointFromGrip({x:w,y:E},svgedit.path.path);B=o.x-F.x;F=o.y-F.y;svgedit.path.path.dragging=[w,E];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(B,F):svgedit.path.path.movePts(B,F)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var J=ua.getBBox(),X=svgedit.path.getGripPt(this);J=svgedit.math.rectsIntersect(J,
{x:X.x,y:X.y,width:0,height:0});this.select(J);J&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(B,w){if(Da==="path"){m=null;if(!z){w=pa(ba());La=false;A=null}return{keep:true,element:w}}if(svgedit.path.path.dragging){var E=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)");!B.shiftKey&&!G&&svgedit.path.path.selectPt(E)}else if(ua&&ua.getAttribute("display")!= {x:X.x,y:X.y,width:0,height:0});this.select(J);J&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(B,w){if(Da==="path"){m=null;if(!z){w=oa(ba());La=false;A=null}return{keep:true,element:w}}if(svgedit.path.path.dragging){var E=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)");!B.shiftKey&&!G&&svgedit.path.path.selectPt(E)}else if(ua&&ua.getAttribute("display")!=
"none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=2&&Ja.toSelectMode(B.target)}else Ja.toSelectMode(B.target);G=false},toEditMode:function(B){svgedit.path.path=svgedit.path.getPath_(B);Da="pathedit";Pa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(B){var w=B==svgedit.path.path.elem;Da="select";svgedit.path.path.show(false);k=false;Pa();svgedit.path.path.matrix&& "none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=2&&Ja.toSelectMode(B.target)}else Ja.toSelectMode(B.target);G=false},toEditMode:function(B){svgedit.path.path=svgedit.path.getPath_(B);Da="pathedit";Pa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(B){var w=B==svgedit.path.path.elem;Da="select";svgedit.path.path.show(false);k=false;Pa();svgedit.path.path.matrix&&
svgedit.path.recalcRotatedPath();if(w){N("selected",[B]);tb([B],true)}},addSubPath:function(B){if(B){Da="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(B){if(k===B){Ja.toEditMode(B);Da="pathedit"}else k=B},reorient:function(){var B=K[0];if(B)if(oa(B)!=0){var w=new Aa("Reorient path"),E={d:B.getAttribute("d"),transform:B.getAttribute("transform")};w.addSubCommand(new Na(B,E));Pa();this.resetOrientation(B);ya(w);svgedit.path.getPath_(B).show(false).matrix=null; svgedit.path.recalcRotatedPath();if(w){N("selected",[B]);tb([B],true)}},addSubPath:function(B){if(B){Da="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(B){if(k===B){Ja.toEditMode(B);Da="pathedit"}else k=B},reorient:function(){var B=K[0];if(B)if(na(B)!=0){var w=new Aa("Reorient path"),E={d:B.getAttribute("d"),transform:B.getAttribute("transform")};w.addSubCommand(new Na(B,E));Pa();this.resetOrientation(B);ya(w);svgedit.path.getPath_(B).show(false).matrix=null;
this.clear();tb([B],true);N("changed",K)}},clear:function(){k=null;if(z){var B=pa(ba());$(pa("path_stretch_line")).remove();$(B).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");z=A=null;La=false}else Da=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(B){if(B==null||B.nodeName!="path")return false;var w=T(B),E=fa(w).matrix;w.clear();B.removeAttribute("transform");w=B.pathSegList;for(var I=w.numberOfItems, this.clear();tb([B],true);N("changed",K)}},clear:function(){k=null;if(z){var B=oa(ba());$(oa("path_stretch_line")).remove();$(B).remove();$(oa("pathpointgrip_container")).find("*").attr("display","none");z=A=null;La=false}else Da=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(B){if(B==null||B.nodeName!="path")return false;var w=T(B),E=ha(w).matrix;w.clear();B.removeAttribute("transform");w=B.pathSegList;for(var I=w.numberOfItems,
F=0;F<I;++F){var g=w.getItem(F),o=g.pathSegType;if(o!=1){var v=[];$.each(["",1,2],function(D,H){var J=g["x"+H],X=g["y"+H];if(J!==undefined&&X!==undefined){J=M(J,X,E);v.splice(v.length,0,J.x,J.y)}});svgedit.path.replacePathSeg(o,F,v,B)}}h(B,E)},zoomChange:function(){Da=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var B=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:B.item.x,y:B.item.y,type:B.type}},linkControlPoints:function(B){svgedit.path.setLinkControlPoints(B)}, F=0;F<I;++F){var g=w.getItem(F),o=g.pathSegType;if(o!=1){var v=[];$.each(["",1,2],function(D,H){var J=g["x"+H],X=g["y"+H];if(J!==undefined&&X!==undefined){J=M(J,X,E);v.splice(v.length,0,J.x,J.y)}});svgedit.path.replacePathSeg(o,F,v,B)}}h(B,E)},zoomChange:function(){Da=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var B=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:B.item.x,y:B.item.y,type:B.type}},linkControlPoints:function(B){svgedit.path.setLinkControlPoints(B)},
clonePathNode:function(){svgedit.path.path.storeD();for(var B=svgedit.path.path.selected_pts,w=B.length,E=[];w--;){var I=B[w];svgedit.path.path.addSeg(I);E.push(I+w);E.push(I+w+1)}svgedit.path.path.init().addPtsToSelection(E);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var B=svgedit.path.path.selected_pts;if(B.length===1){var w=svgedit.path.path.elem,E=w.pathSegList,I=B[0],F=null,g=null;svgedit.path.path.eachSeg(function(H){if(this.type===2&&H<=I)g=this.item;if(H<= clonePathNode:function(){svgedit.path.path.storeD();for(var B=svgedit.path.path.selected_pts,w=B.length,E=[];w--;){var I=B[w];svgedit.path.path.addSeg(I);E.push(I+w);E.push(I+w+1)}svgedit.path.path.init().addPtsToSelection(E);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var B=svgedit.path.path.selected_pts;if(B.length===1){var w=svgedit.path.path.elem,E=w.pathSegList,I=B[0],F=null,g=null;svgedit.path.path.eachSeg(function(H){if(this.type===2&&H<=I)g=this.item;if(H<=
I)return true;if(this.type===2){F=H;return false}else if(this.type===1)return F=false});if(F==null)F=svgedit.path.path.segs.length-1;if(F!==false){var o=w.createSVGPathSegLinetoAbs(g.x,g.y),v=w.createSVGPathSegClosePath();if(F==svgedit.path.path.segs.length-1){E.appendItem(o);E.appendItem(v)}else{svgedit.path.insertItemBefore(w,v,F);svgedit.path.insertItemBefore(w,o,F)}svgedit.path.path.init().selectPt(F+1)}else if(svgedit.path.path.segs[I].mate){E.removeItem(I);E.removeItem(I);svgedit.path.path.init().selectPt(I- I)return true;if(this.type===2){F=H;return false}else if(this.type===1)return F=false});if(F==null)F=svgedit.path.path.segs.length-1;if(F!==false){var o=w.createSVGPathSegLinetoAbs(g.x,g.y),v=w.createSVGPathSegClosePath();if(F==svgedit.path.path.segs.length-1){E.appendItem(o);E.appendItem(v)}else{svgedit.path.insertItemBefore(w,v,F);svgedit.path.insertItemBefore(w,o,F)}svgedit.path.path.init().selectPt(F+1)}else if(svgedit.path.path.segs[I].mate){E.removeItem(I);E.removeItem(I);svgedit.path.path.init().selectPt(I-
@ -297,10 +297,10 @@ var E=function(){var I=svgedit.path.path.elem.pathSegList,F=I.numberOfItems,g=fu
1){Ja.toSelectMode(svgedit.path.path.elem);c.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){B=$(svgedit.path.path.elem);B.attr("d",B.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(B){var w=B.points,E=w.numberOfItems;if(E>=4){var I=w.getItem(0),F=null;B=[];B.push(["M",I.x,",",I.y," C"].join(""));for(var g=1;g<=E-4;g+=3){var o=w.getItem(g),v=w.getItem(g+1),D=w.getItem(g+2);if(F)if((I=svgedit.path.smoothControlPoints(F, 1){Ja.toSelectMode(svgedit.path.path.elem);c.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){B=$(svgedit.path.path.elem);B.attr("d",B.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(B){var w=B.points,E=w.numberOfItems;if(E>=4){var I=w.getItem(0),F=null;B=[];B.push(["M",I.x,",",I.y," C"].join(""));for(var g=1;g<=E-4;g+=3){var o=w.getItem(g),v=w.getItem(g+1),D=w.getItem(g+2);if(F)if((I=svgedit.path.smoothControlPoints(F,
o,I))&&I.length==2){o=B[B.length-1].split(",");o[2]=I[0].x;o[3]=I[0].y;B[B.length-1]=o.join(",");o=I[1]}B.push([o.x,o.y,v.x,v.y,D.x,D.y].join(","));I=D;F=v}for(B.push("L");g<E;++g){v=w.getItem(g);B.push([v.x,v.y].join(","))}B=B.join(" ");B=P({element:"path",curStyles:true,attr:{id:ba(),d:B,fill:"none"}})}return B},setSegType:function(B){svgedit.path.path.setSegType(B)},moveNode:function(B,w){var E=svgedit.path.path.selected_pts;if(E.length){svgedit.path.path.storeD();E=svgedit.path.path.segs[E[0]]; o,I))&&I.length==2){o=B[B.length-1].split(",");o[2]=I[0].x;o[3]=I[0].y;B[B.length-1]=o.join(",");o=I[1]}B.push([o.x,o.y,v.x,v.y,D.x,D.y].join(","));I=D;F=v}for(B.push("L");g<E;++g){v=w.getItem(g);B.push([v.x,v.y].join(","))}B=B.join(" ");B=P({element:"path",curStyles:true,attr:{id:ba(),d:B,fill:"none"}})}return B},setSegType:function(B){svgedit.path.path.setSegType(B)},moveNode:function(B,w){var E=svgedit.path.path.selected_pts;if(E.length){svgedit.path.path.storeD();E=svgedit.path.path.segs[E[0]];
var I={x:0,y:0};I[B]=w-E.item[B];E.move(I.x,I.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(B){for(var w=B.pathSegList,E=w.numberOfItems,I,F=0;F<E;++F){var g=w.getItem(F);if(g.pathSegType===2)I=g;if(g.pathSegType===1){g=w.getItem(F-1);if(g.x!=I.x||g.y!=I.y){w=B.createSVGPathSegLinetoAbs(I.x,I.y);svgedit.path.insertItemBefore(B,w,F);Ja.fixEnd(B);break}}}svgedit.browser.isWebkit()&&B.setAttribute("d",Ja.convertPath(B))},convertPath:function(B,w){for(var E=B.pathSegList,I=E.numberOfItems, var I={x:0,y:0};I[B]=w-E.item[B];E.move(I.x,I.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(B){for(var w=B.pathSegList,E=w.numberOfItems,I,F=0;F<E;++F){var g=w.getItem(F);if(g.pathSegType===2)I=g;if(g.pathSegType===1){g=w.getItem(F-1);if(g.x!=I.x||g.y!=I.y){w=B.createSVGPathSegLinetoAbs(I.x,I.y);svgedit.path.insertItemBefore(B,w,F);Ja.fixEnd(B);break}}}svgedit.browser.isWebkit()&&B.setAttribute("d",Ja.convertPath(B))},convertPath:function(B,w){for(var E=B.pathSegList,I=E.numberOfItems,
F=0,g=0,o="",v=null,D=0;D<I;++D){var H=E.getItem(D),J=H.x||0,X=H.y||0,ca=H.x1||0,S=H.y1||0,W=H.x2||0,Z=H.y2||0,qa=H.pathSegType,ta=Oa[qa]["to"+(w?"Lower":"Upper")+"Case"](),ga=function(Ta,Ha,sa){Ha=Ha?" "+Ha.join(" "):"";sa=sa?" "+svgedit.units.shortFloat(sa):"";$.each(Ta,function(Ma,va){Ta[Ma]=svgedit.units.shortFloat(va)});o+=ta+Ta.join(" ")+Ha+sa};switch(qa){case 1:o+="z";break;case 12:J-=F;case 13:if(w){F+=J;ta="l"}else{J+=F;F=J;ta="L"}ga([[J,g]]);break;case 14:X-=g;case 15:if(w){g+=X;ta="l"}else{X+= F=0,g=0,o="",v=null,D=0;D<I;++D){var H=E.getItem(D),J=H.x||0,X=H.y||0,da=H.x1||0,S=H.y1||0,V=H.x2||0,Z=H.y2||0,pa=H.pathSegType,ta=Oa[pa]["to"+(w?"Lower":"Upper")+"Case"](),ga=function(Ta,Ha,sa){Ha=Ha?" "+Ha.join(" "):"";sa=sa?" "+svgedit.units.shortFloat(sa):"";$.each(Ta,function(Ma,va){Ta[Ma]=svgedit.units.shortFloat(va)});o+=ta+Ta.join(" ")+Ha+sa};switch(pa){case 1:o+="z";break;case 12:J-=F;case 13:if(w){F+=J;ta="l"}else{J+=F;F=J;ta="L"}ga([[J,g]]);break;case 14:X-=g;case 15:if(w){g+=X;ta="l"}else{X+=
g;g=X;ta="L"}ga([[F,X]]);break;case 2:case 4:case 18:J-=F;X-=g;case 5:case 3:if(v&&E.getItem(D-1).pathSegType===1&&!w){F=v[0];g=v[1]}case 19:if(w){F+=J;g+=X}else{J+=F;X+=g;F=J;g=X}if(qa===3)v=[F,g];ga([[J,X]]);break;case 6:J-=F;ca-=F;W-=F;X-=g;S-=g;Z-=g;case 7:if(w){F+=J;g+=X}else{J+=F;ca+=F;W+=F;X+=g;S+=g;Z+=g;F=J;g=X}ga([[ca,S],[W,Z],[J,X]]);break;case 8:J-=F;ca-=F;X-=g;S-=g;case 9:if(w){F+=J;g+=X}else{J+=F;ca+=F;X+=g;S+=g;F=J;g=X}ga([[ca,S],[J,X]]);break;case 10:J-=F;X-=g;case 11:if(w){F+=J;g+= g;g=X;ta="L"}ga([[F,X]]);break;case 2:case 4:case 18:J-=F;X-=g;case 5:case 3:if(v&&E.getItem(D-1).pathSegType===1&&!w){F=v[0];g=v[1]}case 19:if(w){F+=J;g+=X}else{J+=F;X+=g;F=J;g=X}if(pa===3)v=[F,g];ga([[J,X]]);break;case 6:J-=F;da-=F;V-=F;X-=g;S-=g;Z-=g;case 7:if(w){F+=J;g+=X}else{J+=F;da+=F;V+=F;X+=g;S+=g;Z+=g;F=J;g=X}ga([[da,S],[V,Z],[J,X]]);break;case 8:J-=F;da-=F;X-=g;S-=g;case 9:if(w){F+=J;g+=X}else{J+=F;da+=F;X+=g;S+=g;F=J;g=X}ga([[da,S],[J,X]]);break;case 10:J-=F;X-=g;case 11:if(w){F+=J;g+=
X}else{J+=F;X+=g;F=J;g=X}ga([[H.r1,H.r2]],[H.angle,H.largeArcFlag?1:0,H.sweepFlag?1:0],[J,X]);break;case 16:J-=F;W-=F;X-=g;Z-=g;case 17:if(w){F+=J;g+=X}else{J+=F;W+=F;X+=g;Z+=g;F=J;g=X}ga([[W,Z],[J,X]])}}return o}}}(),Nb=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(b,"defs");if(!e||!e.length)return 0;for(var k=[],m=0,A=["fill","stroke","filter","marker-start","marker-mid","marker-end"],z=A.length,G=l.getElementsByTagNameNS(b,"*"),B=G.length,w=0;w<B;w++){for(var E=G[w],I=0;I< X}else{J+=F;X+=g;F=J;g=X}ga([[H.r1,H.r2]],[H.angle,H.largeArcFlag?1:0,H.sweepFlag?1:0],[J,X]);break;case 16:J-=F;V-=F;X-=g;Z-=g;case 17:if(w){F+=J;g+=X}else{J+=F;V+=F;X+=g;Z+=g;F=J;g=X}ga([[V,Z],[J,X]])}}return o}}}(),Nb=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(b,"defs");if(!e||!e.length)return 0;for(var k=[],m=0,A=["fill","stroke","filter","marker-start","marker-mid","marker-end"],z=A.length,G=l.getElementsByTagNameNS(b,"*"),B=G.length,w=0;w<B;w++){for(var E=G[w],I=0;I<
z;I++){var F=ia(E.getAttribute(A[I]));F&&k.push(F.substr(1))}(E=da(E))&&E.indexOf("#")===0&&k.push(E.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(w=e.length;w--;){A=e[w];z=A.id;if(k.indexOf(z)<0){ub[z]=A;A.parentNode.removeChild(A);m++}}return m};this.svgCanvasToString=function(){for(;Nb()>0;);Ja.clear(true);$.each(l.childNodes,function(m,A){m&&A.nodeType===8&&A.data.indexOf("Created with")>=0&&l.insertBefore(A,l.firstChild)});if(L){Hb(); z;I++){var F=ia(E.getAttribute(A[I]));F&&k.push(F.substr(1))}(E=ea(E))&&E.indexOf("#")===0&&k.push(E.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(w=e.length;w--;){A=e[w];z=A.id;if(k.indexOf(z)<0){ub[z]=A;A.parentNode.removeChild(A);m++}}return m};this.svgCanvasToString=function(){for(;Nb()>0;);Ja.clear(true);$.each(l.childNodes,function(m,A){m&&A.nodeType===8&&A.data.indexOf("Created with")>=0&&l.insertBefore(A,l.firstChild)});if(L){Hb();
vb([L])}var e=[];$(l).find("g:data(gsvg)").each(function(){for(var m=this.attributes,A=m.length,z=0;z<A;z++)if(m[z].nodeName=="id"||m[z].nodeName=="style")A--;if(A<=0){m=this.firstChild;e.push(m);$(this).replaceWith(m)}});var k=this.svgToString(l,0);e.length&&$(e).each(function(){zb(this)});return k};this.svgToString=function(e,k){var m=[],A=svgedit.utilities.toXml,z=n.baseUnit,G=RegExp("^-?[\\d\\.]+"+z+"$");if(e){ma(e);var B=e.attributes,w,E,I=e.childNodes;for(E=0;E<k;E++)m.push(" ");m.push("<"); vb([L])}var e=[];$(l).find("g:data(gsvg)").each(function(){for(var m=this.attributes,A=m.length,z=0;z<A;z++)if(m[z].nodeName=="id"||m[z].nodeName=="style")A--;if(A<=0){m=this.firstChild;e.push(m);$(this).replaceWith(m)}});var k=this.svgToString(l,0);e.length&&$(e).each(function(){zb(this)});return k};this.svgToString=function(e,k){var m=[],A=svgedit.utilities.toXml,z=n.baseUnit,G=RegExp("^-?[\\d\\.]+"+z+"$");if(e){ma(e);var B=e.attributes,w,E,I=e.childNodes;for(E=0;E<k;E++)m.push(" ");m.push("<");
m.push(e.nodeName);if(e.id==="svgcontent"){E=Ab();if(z!=="px"){E.w=svgedit.units.convertUnit(E.w,z)+z;E.h=svgedit.units.convertUnit(E.h,z)+z}m.push(' width="'+E.w+'" height="'+E.h+'" xmlns="'+b+'"');var F={};$(e).find("*").andSelf().each(function(){$.each(this.attributes,function(D,H){var J=H.namespaceURI;if(J&&!F[J]&&Ba[J]!=="xmlns"&&Ba[J]!=="xml"){F[J]=true;m.push(" xmlns:"+Ba[J]+'="'+J+'"')}})});E=B.length;for(z=["width","height","xmlns","x","y","viewBox","id","overflow"];E--;){w=B.item(E);var g= m.push(e.nodeName);if(e.id==="svgcontent"){E=Ab();if(z!=="px"){E.w=svgedit.units.convertUnit(E.w,z)+z;E.h=svgedit.units.convertUnit(E.h,z)+z}m.push(' width="'+E.w+'" height="'+E.h+'" xmlns="'+b+'"');var F={};$(e).find("*").andSelf().each(function(){$.each(this.attributes,function(D,H){var J=H.namespaceURI;if(J&&!F[J]&&Ba[J]!=="xmlns"&&Ba[J]!=="xml"){F[J]=true;m.push(" xmlns:"+Ba[J]+'="'+J+'"')}})});E=B.length;for(z=["width","height","xmlns","x","y","viewBox","id","overflow"];E--;){w=B.item(E);var g=
A(w.nodeValue);if(w.nodeName.indexOf("xmlns:")!==0)if(g!=""&&z.indexOf(w.localName)==-1)if(!w.namespaceURI||Ba[w.namespaceURI]){m.push(" ");m.push(w.nodeName);m.push('="');m.push(g);m.push('"')}}}else{if(e.nodeName==="defs"&&!e.firstChild)return;var o=["-moz-math-font-style","_moz-math-font-style"];for(E=B.length-1;E>=0;E--){w=B.item(E);g=A(w.nodeValue);if(!(o.indexOf(w.localName)>=0))if(g!="")if(g.indexOf("pointer-events")!==0)if(!(w.localName==="class"&&g.indexOf("se_")===0)){m.push(" ");if(w.localName=== A(w.nodeValue);if(w.nodeName.indexOf("xmlns:")!==0)if(g!=""&&z.indexOf(w.localName)==-1)if(!w.namespaceURI||Ba[w.namespaceURI]){m.push(" ");m.push(w.nodeName);m.push('="');m.push(g);m.push('"')}}}else{if(e.nodeName==="defs"&&!e.firstChild)return;var o=["-moz-math-font-style","_moz-math-font-style"];for(E=B.length-1;E>=0;E--){w=B.item(E);g=A(w.nodeValue);if(!(o.indexOf(w.localName)>=0))if(g!="")if(g.indexOf("pointer-events")!==0)if(!(w.localName==="class"&&g.indexOf("se_")===0)){m.push(" ");if(w.localName===
@ -309,13 +309,13 @@ k));break;case 3:z=z.nodeValue.replace(/^\s+|\s+$/g,"");if(z!=""){B=true;m.push(
m.width=this.width;m.height=this.height;m.getContext("2d").drawImage(this,0,0);try{var A=";svgedit_url="+encodeURIComponent(e);A=m.toDataURL().replace(";base64",A+";base64");Wa[e]=A}catch(z){Wa[e]=false}Ca=e;k&&k(Wa[e])}).attr("src",e)};this.setGoodImage=function(e){Ca=e};this.open=function(){};this.save=function(e){Pa();e&&$.extend(db,e);db.apply=true;e=this.svgCanvasToString();N("saved",e)};this.rasterExport=function(){Pa();var e=[],k={feGaussianBlur:nb.exportNoBlur,foreignObject:nb.exportNoforeignObject, m.width=this.width;m.height=this.height;m.getContext("2d").drawImage(this,0,0);try{var A=";svgedit_url="+encodeURIComponent(e);A=m.toDataURL().replace(";base64",A+";base64");Wa[e]=A}catch(z){Wa[e]=false}Ca=e;k&&k(Wa[e])}).attr("src",e)};this.setGoodImage=function(e){Ca=e};this.open=function(){};this.save=function(e){Pa();e&&$.extend(db,e);db.apply=true;e=this.svgCanvasToString();N("saved",e)};this.rasterExport=function(){Pa();var e=[],k={feGaussianBlur:nb.exportNoBlur,foreignObject:nb.exportNoforeignObject,
"[stroke-dasharray]":nb.exportNoDashArray},m=$(l);if(!("font"in $("<canvas>")[0].getContext("2d")))k.text=nb.exportNoText;$.each(k,function(A,z){m.find(A).length&&e.push(z)});k=this.svgCanvasToString();N("exported",{svg:k,issues:e})};this.getSvgString=function(){db.apply=false;return this.svgCanvasToString()};this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,C()):svgedit.draw.randomizeIds(true,C())};var Lb=this.uniquifyElems=function(e){var k={}, "[stroke-dasharray]":nb.exportNoDashArray},m=$(l);if(!("font"in $("<canvas>")[0].getContext("2d")))k.text=nb.exportNoText;$.each(k,function(A,z){m.find(A).length&&e.push(z)});k=this.svgCanvasToString();N("exported",{svg:k,issues:e})};this.getSvgString=function(){db.apply=false;return this.svgCanvasToString()};this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,C()):svgedit.draw.randomizeIds(true,C())};var Lb=this.uniquifyElems=function(e){var k={},
m=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(e,function(w){if(w.nodeType==1){if(w.id){w.id in k||(k[w.id]={elem:null,attrs:[],hrefs:[]});k[w.id].elem=w}$.each(Ya,function(I,F){var g=w.getAttributeNode(F);if(g){var o=svgedit.utilities.getUrlFromAttr(g.value);if(o=o?o.substr(1):null){o in k||(k[o]={elem:null,attrs:[],hrefs:[]});k[o].attrs.push(g)}}});var E=svgedit.utilities.getHref(w);if(E&&m.indexOf(w.nodeName)>=0)if(E=E.substr(1)){E in m=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(e,function(w){if(w.nodeType==1){if(w.id){w.id in k||(k[w.id]={elem:null,attrs:[],hrefs:[]});k[w.id].elem=w}$.each(Ya,function(I,F){var g=w.getAttributeNode(F);if(g){var o=svgedit.utilities.getUrlFromAttr(g.value);if(o=o?o.substr(1):null){o in k||(k[o]={elem:null,attrs:[],hrefs:[]});k[o].attrs.push(g)}}});var E=svgedit.utilities.getHref(w);if(E&&m.indexOf(w.nodeName)>=0)if(E=E.substr(1)){E in
k||(k[E]={elem:null,attrs:[],hrefs:[]});k[E].hrefs.push(w)}}});for(var A in k)if(A){var z=k[A].elem;if(z){e=ka();z.id=e;z=k[A].attrs;for(var G=z.length;G--;){var B=z[G];B.ownerElement.setAttribute(B.name,"url(#"+e+")")}z=k[A].hrefs;for(G=z.length;G--;)svgedit.utilities.setHref(z[G],"#"+e)}}},Jb=this.setUseData=function(e){var k=$(e);if(e.tagName!=="use")k=k.find("use");k.each(function(){var m=da(this).substr(1);if(m=pa(m)){$(this).data("ref",m);if(m.tagName=="symbol"||m.tagName=="svg")$(this).data("symbol", k||(k[E]={elem:null,attrs:[],hrefs:[]});k[E].hrefs.push(w)}}});for(var A in k)if(A){var z=k[A].elem;if(z){e=ka();z.id=e;z=k[A].attrs;for(var G=z.length;G--;){var B=z[G];B.ownerElement.setAttribute(B.name,"url(#"+e+")")}z=k[A].hrefs;for(G=z.length;G--;)svgedit.utilities.setHref(z[G],"#"+e)}}},Jb=this.setUseData=function(e){var k=$(e);if(e.tagName!=="use")k=k.find("use");k.each(function(){var m=ea(this).substr(1);if(m=oa(m)){$(this).data("ref",m);if(m.tagName=="symbol"||m.tagName=="svg")$(this).data("symbol",
m).data("ref",m)}})},Bb=this.convertGradients=function(e){var k=$(e).find("linearGradient, radialGradient");if(!k.length&&svgedit.browser.isWebkit())k=$(e).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});k.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var m=$(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(m.length)if(m=svgedit.utilities.getBBox(m[0]))if(this.tagName==="linearGradient"){var A=$(this).attr(["x1","y1","x2","y2"]), m).data("ref",m)}})},Bb=this.convertGradients=function(e){var k=$(e).find("linearGradient, radialGradient");if(!k.length&&svgedit.browser.isWebkit())k=$(e).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});k.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var m=$(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(m.length)if(m=svgedit.utilities.getBBox(m[0]))if(this.tagName==="linearGradient"){var A=$(this).attr(["x1","y1","x2","y2"]),
z=this.gradientTransform.baseVal;if(z&&z.numberOfItems>0){var G=fa(z).matrix;z=M(A.x1,A.y1,G);G=M(A.x2,A.y2,G);A.x1=z.x;A.y1=z.y;A.x2=G.x;A.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(A.x1-m.x)/m.width,y1:(A.y1-m.y)/m.height,x2:(A.x2-m.x)/m.width,y2:(A.y2-m.y)/m.height});this.removeAttribute("gradientUnits")}}})},Ob=this.convertToGroup=function(e){e||(e=K[0]);var k=$(e),m=new Aa,A;if(k.data("gsvg")){m=$(e.firstChild).attr(["x","y"]);$(e.firstChild.firstChild).unwrap();$(e).removeData("gsvg"); z=this.gradientTransform.baseVal;if(z&&z.numberOfItems>0){var G=ha(z).matrix;z=M(A.x1,A.y1,G);G=M(A.x2,A.y2,G);A.x1=z.x;A.y1=z.y;A.x2=G.x;A.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(A.x1-m.x)/m.width,y1:(A.y1-m.y)/m.height,x2:(A.x2-m.x)/m.width,y2:(A.y2-m.y)/m.height});this.removeAttribute("gradientUnits")}}})},Ob=this.convertToGroup=function(e){e||(e=K[0]);var k=$(e),m=new Aa,A;if(k.data("gsvg")){m=$(e.firstChild).attr(["x","y"]);$(e.firstChild.firstChild).unwrap();$(e).removeData("gsvg");
A=T(e);var z=d.createSVGTransform();z.setTranslate(m.x,m.y);A.appendItem(z);Qa(e);N("selected",[e])}else if(k.data("symbol")){e=k.data("symbol");A=k.attr("transform");z=k.attr(["x","y"]);var G=e.getAttribute("viewBox");if(G){G=G.split(" ");z.x-=+G[0];z.y-=+G[1]}A+=" translate("+(z.x||0)+","+(z.y||0)+")";z=k.prev();m.addSubCommand(new Ka(k[0],k[0].nextSibling,k[0].parentNode));k.remove();G=$(l).find("use:data(symbol)").length;k=f.createElementNS(b,"g");for(var B=e.childNodes,w=0;w<B.length;w++)k.appendChild(B[w].cloneNode(true)); A=T(e);var z=d.createSVGTransform();z.setTranslate(m.x,m.y);A.appendItem(z);Qa(e);N("selected",[e])}else if(k.data("symbol")){e=k.data("symbol");A=k.attr("transform");z=k.attr(["x","y"]);var G=e.getAttribute("viewBox");if(G){G=G.split(" ");z.x-=+G[0];z.y-=+G[1]}A+=" translate("+(z.x||0)+","+(z.y||0)+")";z=k.prev();m.addSubCommand(new Ka(k[0],k[0].nextSibling,k[0].parentNode));k.remove();G=$(l).find("use:data(symbol)").length;k=f.createElementNS(b,"g");for(var B=e.childNodes,w=0;w<B.length;w++)k.appendChild(B[w].cloneNode(true));
if(svgedit.browser.isGecko()){B=$(kb()).children("linearGradient,radialGradient,pattern").clone();$(k).append(B)}A&&k.setAttribute("transform",A);A=e.parentNode;Lb(k);svgedit.browser.isGecko()&&$(kb()).append($(k).find("linearGradient,radialGradient,pattern"));k.id=ka();z.after(k);if(A){if(!G){z=e.nextSibling;A.removeChild(e);m.addSubCommand(new Ka(e,z,A))}m.addSubCommand(new za(k))}Jb(k);svgedit.browser.isGecko()?Bb(kb()):Bb(k);svgedit.utilities.walkTreePost(k,function(E){try{Qa(E)}catch(I){console.log(I)}}); if(svgedit.browser.isGecko()){B=$(kb()).children("linearGradient,radialGradient,pattern").clone();$(k).append(B)}A&&k.setAttribute("transform",A);A=e.parentNode;Lb(k);svgedit.browser.isGecko()&&$(kb()).append($(k).find("linearGradient,radialGradient,pattern"));k.id=ka();z.after(k);if(A){if(!G){z=e.nextSibling;A.removeChild(e);m.addSubCommand(new Ka(e,z,A))}m.addSubCommand(new za(k))}Jb(k);svgedit.browser.isGecko()?Bb(kb()):Bb(k);svgedit.utilities.walkTreePost(k,function(E){try{Qa(E)}catch(I){console.log(I)}});
$(k).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});vb([k]);(e=Kb(k,true))&&m.addSubCommand(e);ya(m)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e){try{var k=svgedit.utilities.text2xml(e);this.prepareSvg(k);var m=new Aa("Change Source"),A=l.nextSibling,z=d.removeChild(l);m.addSubCommand(new Ka(z,A,d));l=f.adoptNode?f.adoptNode(k.documentElement):f.importNode(k.documentElement, $(k).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});vb([k]);(e=Kb(k,true))&&m.addSubCommand(e);ya(m)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e){try{var k=svgedit.utilities.text2xml(e);this.prepareSvg(k);var m=new Aa("Change Source"),A=l.nextSibling,z=d.removeChild(l);m.addSubCommand(new Ka(z,A,d));l=f.adoptNode?f.adoptNode(k.documentElement):f.importNode(k.documentElement,
true);d.appendChild(l);var G=$(l);c.current_drawing_=new svgedit.draw.Drawing(l,s);var B=C().getNonce();B?N("setnonce",B):N("unsetnonce");G.find("image").each(function(){var v=this;Gb(v);var D=da(this);if(D.indexOf("data:")===0){var H=D.match(/svgedit_url=(.*?);/);if(H){var J=decodeURIComponent(H[1]);$(new Image).load(function(){v.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",J)}).attr("src",J)}}c.embedImage(D)});G.find("svg").each(function(){if(!$(this).closest("defs").length){Lb(this); true);d.appendChild(l);var G=$(l);c.current_drawing_=new svgedit.draw.Drawing(l,s);var B=C().getNonce();B?N("setnonce",B):N("unsetnonce");G.find("image").each(function(){var v=this;Gb(v);var D=ea(this);if(D.indexOf("data:")===0){var H=D.match(/svgedit_url=(.*?);/);if(H){var J=decodeURIComponent(H[1]);$(new Image).load(function(){v.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",J)}).attr("src",J)}}c.embedImage(D)});G.find("svg").each(function(){if(!$(this).closest("defs").length){Lb(this);
var v=this.parentNode;if(v.childNodes.length===1&&v.nodeName==="g"){$(v).data("gsvg",this);v.id=v.id||ka()}else zb(this)}});svgedit.browser.isGecko()&&G.find("linearGradient, radialGradient, pattern").appendTo(kb());Jb(G);Bb(G[0]);svgedit.utilities.walkTreePost(l,function(v){try{Qa(v)}catch(D){console.log(D)}});var w={id:"svgcontent",overflow:n.show_outside_canvas?"visible":"hidden"},E=false;if(G.attr("viewBox")){var I=G.attr("viewBox").split(" ");w.width=I[2];w.height=I[3]}else $.each(["width","height"], var v=this.parentNode;if(v.childNodes.length===1&&v.nodeName==="g"){$(v).data("gsvg",this);v.id=v.id||ka()}else zb(this)}});svgedit.browser.isGecko()&&G.find("linearGradient, radialGradient, pattern").appendTo(kb());Jb(G);Bb(G[0]);svgedit.utilities.walkTreePost(l,function(v){try{Qa(v)}catch(D){console.log(D)}});var w={id:"svgcontent",overflow:n.show_outside_canvas?"visible":"hidden"},E=false;if(G.attr("viewBox")){var I=G.attr("viewBox").split(" ");w.width=I[2];w.height=I[3]}else $.each(["width","height"],
function(v,D){var H=G.attr(D);H||(H="100%");if((H+"").substr(-1)==="%")E=true;else w[D]=ra(D,H)});Db();G.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});if(E){var F=getStrokedBBox();w.width=F.width+F.x;w.height=F.height+F.y}if(w.width<=0)w.width=100;if(w.height<=0)w.height=100;G.attr(w);this.contentW=w.width;this.contentH=w.height;m.addSubCommand(new za(l));var g=G.attr(["width","height"]);m.addSubCommand(new Na(d, function(v,D){var H=G.attr(D);H||(H="100%");if((H+"").substr(-1)==="%")E=true;else w[D]=ra(D,H)});Db();G.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});if(E){var F=getStrokedBBox();w.width=F.width+F.x;w.height=F.height+F.y}if(w.width<=0)w.width=100;if(w.height<=0)w.height=100;G.attr(w);this.contentW=w.width;this.contentH=w.height;m.addSubCommand(new za(l));var g=G.attr(["width","height"]);m.addSubCommand(new Na(d,
g));p=1;svgedit.transformlist.resetListMap();Pa();svgedit.path.clearData();d.appendChild(Ga.selectorParentGroup);ya(m);N("changed",[l])}catch(o){console.log(o);return false}return true};this.importSvgString=function(e){try{var k=svgedit.utilities.encode64(e.length+e).substr(0,32),m=false;if(rb[k])if($(rb[k].symbol).parents("#svgroot").length)m=true;var A=new Aa("Import SVG");if(m)var z=rb[k].symbol,G=rb[k].xform;else{var B=svgedit.utilities.text2xml(e);this.prepareSvg(B);var w;w=f.adoptNode?f.adoptNode(B.documentElement): g));p=1;svgedit.transformlist.resetListMap();Pa();svgedit.path.clearData();d.appendChild(Ga.selectorParentGroup);ya(m);N("changed",[l])}catch(o){console.log(o);return false}return true};this.importSvgString=function(e){try{var k=svgedit.utilities.encode64(e.length+e).substr(0,32),m=false;if(rb[k])if($(rb[k].symbol).parents("#svgroot").length)m=true;var A=new Aa("Import SVG");if(m)var z=rb[k].symbol,G=rb[k].xform;else{var B=svgedit.utilities.text2xml(e);this.prepareSvg(B);var w;w=f.adoptNode?f.adoptNode(B.documentElement):
@ -327,7 +327,7 @@ m)break;var G=k.getLayerName(z);k.all_layers[z][0]=svgedit.utilities.toXml(e);va
if(m==k.getNumLayers())return false;if(m!=e){var A=null,z=k.current_layer.nextSibling;if(e>m){if(e<k.getNumLayers()-1)A=k.all_layers[e+1][1]}else A=k.all_layers[e][1];l.insertBefore(k.current_layer,A);ya(new Ia(k.current_layer,z,l));Db();c.setCurrentLayer(k.getLayerName(e));return true}}return false};this.setLayerVisibility=function(e,k){var m=C(),A=m.getLayerVisibility(e),z=m.setLayerVisibility(e,k);if(z)ya(new Na(z,{display:A?"inline":"none"},"Layer Visibility"));else return false;if(z==m.getCurrentLayer()){Pa(); if(m==k.getNumLayers())return false;if(m!=e){var A=null,z=k.current_layer.nextSibling;if(e>m){if(e<k.getNumLayers()-1)A=k.all_layers[e+1][1]}else A=k.all_layers[e][1];l.insertBefore(k.current_layer,A);ya(new Ia(k.current_layer,z,l));Db();c.setCurrentLayer(k.getLayerName(e));return true}}return false};this.setLayerVisibility=function(e,k){var m=C(),A=m.getLayerVisibility(e),z=m.setLayerVisibility(e,k);if(z)ya(new Na(z,{display:A?"inline":"none"},"Layer Visibility"));else return false;if(z==m.getCurrentLayer()){Pa();
Ja.clear()}return true};this.moveSelectedToLayer=function(e){for(var k=null,m=C(),A=0;A<m.getNumLayers();++A)if(m.getLayerName(A)==e){k=m.all_layers[A][1];break}if(!k)return false;e=new Aa("Move Elements to Layer");m=K;for(A=m.length;A--;){var z=m[A];if(z){var G=z.nextSibling,B=z.parentNode;k.appendChild(z);e.addSubCommand(new Ia(z,G,B))}}ya(e);return true};this.mergeLayer=function(e){var k=new Aa("Merge Layer"),m=C(),A=$(m.current_layer).prev()[0];if(A){for(k.addSubCommand(new Ka(m.current_layer, Ja.clear()}return true};this.moveSelectedToLayer=function(e){for(var k=null,m=C(),A=0;A<m.getNumLayers();++A)if(m.getLayerName(A)==e){k=m.all_layers[A][1];break}if(!k)return false;e=new Aa("Move Elements to Layer");m=K;for(A=m.length;A--;){var z=m[A];if(z){var G=z.nextSibling,B=z.parentNode;k.appendChild(z);e.addSubCommand(new Ia(z,G,B))}}ya(e);return true};this.mergeLayer=function(e){var k=new Aa("Merge Layer"),m=C(),A=$(m.current_layer).prev()[0];if(A){for(k.addSubCommand(new Ka(m.current_layer,
m.current_layer.nextSibling,l));m.current_layer.firstChild;){var z=m.current_layer.firstChild;if(z.localName=="title"){k.addSubCommand(new Ka(z,z.nextSibling,m.current_layer));m.current_layer.removeChild(z)}else{var G=z.nextSibling;A.appendChild(z);k.addSubCommand(new Ia(z,G,m.current_layer))}}l.removeChild(m.current_layer);if(!e){Pa();Db();N("changed",[l]);ya(k)}m.current_layer=A;return k}};this.mergeAllLayers=function(){var e=new Aa("Merge all Layers"),k=C();for(k.current_layer=k.all_layers[k.getNumLayers()- m.current_layer.nextSibling,l));m.current_layer.firstChild;){var z=m.current_layer.firstChild;if(z.localName=="title"){k.addSubCommand(new Ka(z,z.nextSibling,m.current_layer));m.current_layer.removeChild(z)}else{var G=z.nextSibling;A.appendChild(z);k.addSubCommand(new Ia(z,G,m.current_layer))}}l.removeChild(m.current_layer);if(!e){Pa();Db();N("changed",[l]);ya(k)}m.current_layer=A;return k}};this.mergeAllLayers=function(){var e=new Aa("Merge all Layers"),k=C();for(k.current_layer=k.all_layers[k.getNumLayers()-
1][1];$(l).children("g").length>1;)e.addSubCommand(c.mergeLayer(true));Pa();Db();N("changed",[l]);ya(e)};var Hb=this.leaveContext=function(){var e=wa.length;if(e){for(var k=0;k<e;k++){var m=wa[k],A=fb(m,"orig_opac");A!==1?m.setAttribute("opacity",A):m.removeAttribute("opacity");m.setAttribute("style","pointer-events: inherit")}wa=[];Pa(true);N("contextset",null)}L=null},Pb=this.setContext=function(e){Hb();if(typeof e==="string")e=pa(e);L=e;$(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var k= 1][1];$(l).children("g").length>1;)e.addSubCommand(c.mergeLayer(true));Pa();Db();N("changed",[l]);ya(e)};var Hb=this.leaveContext=function(){var e=wa.length;if(e){for(var k=0;k<e;k++){var m=wa[k],A=fb(m,"orig_opac");A!==1?m.setAttribute("opacity",A):m.removeAttribute("opacity");m.setAttribute("style","pointer-events: inherit")}wa=[];Pa(true);N("contextset",null)}L=null},Pb=this.setContext=function(e){Hb();if(typeof e==="string")e=oa(e);L=e;$(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var k=
this.getAttribute("opacity")||1;fb(this,"orig_opac",k);this.setAttribute("opacity",k*0.33);this.setAttribute("style","pointer-events: none");wa.push(this)});Pa();N("contextset",L)};this.clear=function(){Ja.clear();Pa();c.clearSvgContentElement();c.current_drawing_=new svgedit.draw.Drawing(l);c.createLayer("Layer 1");c.undoMgr.resetUndoStack();Ga.initGroup();ua=Ga.getRubberBandBox();N("cleared")};this.linkControlPoints=Ja.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem= this.getAttribute("opacity")||1;fb(this,"orig_opac",k);this.setAttribute("opacity",k*0.33);this.setAttribute("style","pointer-events: none");wa.push(this)});Pa();N("contextset",L)};this.clear=function(){Ja.clear();Pa();c.clearSvgContentElement();c.current_drawing_=new svgedit.draw.Drawing(l);c.createLayer("Layer 1");c.undoMgr.resetUndoStack();Ga.initGroup();ua=Ga.getRubberBandBox();N("cleared")};this.linkControlPoints=Ja.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem=
function(){return d};this.getSelectedElems=function(){return K};var Ab=this.getResolution=function(){var e=l.getAttribute("width")/p,k=l.getAttribute("height")/p;return{w:e,h:k,zoom:p}};this.getZoom=function(){return p};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};this.setUiStrings=function(e){$.extend(nb,e.notification)};this.setConfig=function(e){$.extend(n,e)};this.getTitle=function(e){if(e=e||K[0]){e=$(e).data("gsvg")||$(e).data("symbol")||e;e=e.childNodes;for(var k=0;k<e.length;k++)if(e[k].nodeName== function(){return d};this.getSelectedElems=function(){return K};var Ab=this.getResolution=function(){var e=l.getAttribute("width")/p,k=l.getAttribute("height")/p;return{w:e,h:k,zoom:p}};this.getZoom=function(){return p};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};this.setUiStrings=function(e){$.extend(nb,e.notification)};this.setConfig=function(e){$.extend(n,e)};this.getTitle=function(e){if(e=e||K[0]){e=$(e).data("gsvg")||$(e).data("symbol")||e;e=e.childNodes;for(var k=0;k<e.length;k++)if(e[k].nodeName==
"title")return e[k].textContent;return""}};this.setGroupTitle=function(e){var k=K[0];k=$(k).data("gsvg")||k;var m=$(k).children("title"),A=new Aa("Set Label");if(e.length)if(m.length){m=m[0];A.addSubCommand(new Na(m,{"#text":m.textContent}));m.textContent=e}else{m=f.createElementNS(b,"title");m.textContent=e;$(k).prepend(m);A.addSubCommand(new za(m))}else{A.addSubCommand(new Ka(m[0],m.nextSibling,k));m.remove()}ya(A)};this.getDocumentTitle=function(){return c.getTitle(l)};this.setDocumentTitle=function(e){for(var k= "title")return e[k].textContent;return""}};this.setGroupTitle=function(e){var k=K[0];k=$(k).data("gsvg")||k;var m=$(k).children("title"),A=new Aa("Set Label");if(e.length)if(m.length){m=m[0];A.addSubCommand(new Na(m,{"#text":m.textContent}));m.textContent=e}else{m=f.createElementNS(b,"title");m.textContent=e;$(k).prepend(m);A.addSubCommand(new za(m))}else{A.addSubCommand(new Ka(m[0],m.nextSibling,k));m.remove()}ya(A)};this.getDocumentTitle=function(){return c.getTitle(l)};this.setDocumentTitle=function(e){for(var k=
@ -342,27 +342,27 @@ z.getAttribute("y1")||e.getAttribute("x2")!=z.getAttribute("x2")||e.getAttribute
o.getAttribute("stop-color"))break}if(F==-1)return z}}return null};this.setPaint=function(e,k){var m=new $.jGraduate.Paint(k);this.setPaintOpacity(e,m.alpha/100,true);ab[e+"_paint"]=m;switch(m.type){case "solidColor":if(m.solidColor!="none"&&m.solidColor!="#none")this.setColor(e,"#"+m.solidColor);else{this.setColor(e,"none");document.querySelector(e=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","none")}break;case "linearGradient":case "radialGradient":c[e+"Grad"]=m[m.type]; o.getAttribute("stop-color"))break}if(F==-1)return z}}return null};this.setPaint=function(e,k){var m=new $.jGraduate.Paint(k);this.setPaintOpacity(e,m.alpha/100,true);ab[e+"_paint"]=m;switch(m.type){case "solidColor":if(m.solidColor!="none"&&m.solidColor!="#none")this.setColor(e,"#"+m.solidColor);else{this.setColor(e,"none");document.querySelector(e=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","none")}break;case "linearGradient":case "radialGradient":c[e+"Grad"]=m[m.type];
Mb(e)}};this.getStrokeWidth=function(){return ab.stroke_width};this.setStrokeWidth=function(e){if(e==0&&["line","path"].indexOf(Da)>=0)c.setStrokeWidth(1);else{ab.stroke_width=e;for(var k=[],m=K.length;m--;){var A=K[m];if(A)A.tagName=="g"?svgedit.utilities.walkTree(A,function(z){z.nodeName!="g"&&k.push(z)}):k.push(A)}if(k.length>0){ib("stroke-width",e,k);N("changed",K)}}};this.setStrokeAttr=function(e,k){O[e.replace("-","_")]=k;for(var m=[],A=K.length;A--;){var z=K[A];if(z)z.tagName=="g"?svgedit.utilities.walkTree(z, Mb(e)}};this.getStrokeWidth=function(){return ab.stroke_width};this.setStrokeWidth=function(e){if(e==0&&["line","path"].indexOf(Da)>=0)c.setStrokeWidth(1);else{ab.stroke_width=e;for(var k=[],m=K.length;m--;){var A=K[m];if(A)A.tagName=="g"?svgedit.utilities.walkTree(A,function(z){z.nodeName!="g"&&k.push(z)}):k.push(A)}if(k.length>0){ib("stroke-width",e,k);N("changed",K)}}};this.setStrokeAttr=function(e,k){O[e.replace("-","_")]=k;for(var m=[],A=K.length;A--;){var z=K[A];if(z)z.tagName=="g"?svgedit.utilities.walkTree(z,
function(G){G.nodeName!="g"&&m.push(G)}):m.push(z)}if(m.length>0){ib(e,k,m);N("changed",K)}};this.getStyle=function(){return O};this.getOpacity=function(){return O.opacity};this.setOpacity=function(e){O.opacity=e;ib("opacity",e)};this.getFillOpacity=function(){return O.fill_opacity};this.getStrokeOpacity=function(){return O.stroke_opacity};this.setPaintOpacity=function(e,k,m){O[e+"_opacity"]=k;m?Cb(e+"-opacity",k):ib(e+"-opacity",k)};this.getBlur=function(e){var k=0;if(e)if(e.getAttribute("filter"))if(e= function(G){G.nodeName!="g"&&m.push(G)}):m.push(z)}if(m.length>0){ib(e,k,m);N("changed",K)}};this.getStyle=function(){return O};this.getOpacity=function(){return O.opacity};this.setOpacity=function(e){O.opacity=e;ib("opacity",e)};this.getFillOpacity=function(){return O.fill_opacity};this.getStrokeOpacity=function(){return O.stroke_opacity};this.setPaintOpacity=function(e,k,m){O[e+"_opacity"]=k;m?Cb(e+"-opacity",k):ib(e+"-opacity",k)};this.getBlur=function(e){var k=0;if(e)if(e.getAttribute("filter"))if(e=
pa(e.id+"_blur"))k=e.firstChild.getAttribute("stdDeviation");return k};(function(){function e(){var z=c.undoMgr.finishUndoableChange();k.addSubCommand(z);ya(k);m=k=null}var k=null,m=null,A=false;c.setBlurNoUndo=function(z){if(m)if(z===0){Cb("filter","");A=true}else{var G=K[0];A&&Cb("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter");G.setAttribute("filter","url(#"+G.id+"_blur)")}Cb("stdDeviation",z,[m.firstChild]);c.setBlurOffsets(m,z)}else c.setBlur(z)};c.setBlurOffsets= oa(e.id+"_blur"))k=e.firstChild.getAttribute("stdDeviation");return k};(function(){function e(){var z=c.undoMgr.finishUndoableChange();k.addSubCommand(z);ya(k);m=k=null}var k=null,m=null,A=false;c.setBlurNoUndo=function(z){if(m)if(z===0){Cb("filter","");A=true}else{var G=K[0];A&&Cb("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter");G.setAttribute("filter","url(#"+G.id+"_blur)")}Cb("stdDeviation",z,[m.firstChild]);c.setBlurOffsets(m,z)}else c.setBlur(z)};c.setBlurOffsets=
function(z,G){if(G>3)la(z,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){z.removeAttribute("x");z.removeAttribute("y");z.removeAttribute("width");z.removeAttribute("height")}};c.setBlur=function(z,G){if(k)e();else{var B=K[0],w=B.id;m=pa(w+"_blur");z-=0;var E=new Aa;if(m){if(z===0)m=null}else{var I=P({element:"feGaussianBlur",attr:{"in":"SourceGraphic",stdDeviation:z}});m=P({element:"filter",attr:{id:w+"_blur"}});m.appendChild(I);kb().appendChild(m);E.addSubCommand(new za(m))}I= function(z,G){if(G>3)la(z,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){z.removeAttribute("x");z.removeAttribute("y");z.removeAttribute("width");z.removeAttribute("height")}};c.setBlur=function(z,G){if(k)e();else{var B=K[0],w=B.id;m=oa(w+"_blur");z-=0;var E=new Aa;if(m){if(z===0)m=null}else{var I=P({element:"feGaussianBlur",attr:{"in":"SourceGraphic",stdDeviation:z}});m=P({element:"filter",attr:{id:w+"_blur"}});m.appendChild(I);kb().appendChild(m);E.addSubCommand(new za(m))}I=
{filter:B.getAttribute("filter")};if(z===0){B.removeAttribute("filter");E.addSubCommand(new Na(B,I))}else{ib("filter","url(#"+w+"_blur)");E.addSubCommand(new Na(B,I));c.setBlurOffsets(m,z);k=E;c.undoMgr.beginUndoableChange("stdDeviation",[m?m.firstChild:null]);if(G){c.setBlurNoUndo(z);e()}}}}})();this.getBold=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-weight")=="bold";return false};this.setBold=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&& {filter:B.getAttribute("filter")};if(z===0){B.removeAttribute("filter");E.addSubCommand(new Na(B,I))}else{ib("filter","url(#"+w+"_blur)");E.addSubCommand(new Na(B,I));c.setBlurOffsets(m,z);k=E;c.undoMgr.beginUndoableChange("stdDeviation",[m?m.firstChild:null]);if(G){c.setBlurNoUndo(z);e()}}}}})();this.getBold=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-weight")=="bold";return false};this.setBold=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&&
K[1]==null)ib("font-weight",e?"bold":"normal");K[0].textContent||cb.setCursor()};this.getItalic=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-style")=="italic";return false};this.setItalic=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&&K[1]==null)ib("font-style",e?"italic":"normal");K[0].textContent||cb.setCursor()};this.getFontFamily=function(){return Xa.font_family};this.setFontFamily=function(e){Xa.font_family=e;ib("font-family",e);K[0]&&!K[0].textContent&& K[1]==null)ib("font-weight",e?"bold":"normal");K[0].textContent||cb.setCursor()};this.getItalic=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-style")=="italic";return false};this.setItalic=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&&K[1]==null)ib("font-style",e?"italic":"normal");K[0].textContent||cb.setCursor()};this.getFontFamily=function(){return Xa.font_family};this.setFontFamily=function(e){Xa.font_family=e;ib("font-family",e);K[0]&&!K[0].textContent&&
cb.setCursor()};this.setFontColor=function(e){Xa.fill=e;ib("fill",e)};this.getFontSize=function(){return Xa.fill};this.getFontSize=function(){return Xa.font_size};this.setFontSize=function(e){Xa.font_size=e;ib("font-size",e);K[0].textContent||cb.setCursor()};this.getText=function(){var e=K[0];if(e==null)return"";return e.textContent};this.setTextContent=function(e){ib("#text",e);cb.init(e);cb.setCursor()};this.setImageURL=function(e){var k=K[0];if(k){var m=$(k).attr(["width","height"]);m=!m.width|| cb.setCursor()};this.setFontColor=function(e){Xa.fill=e;ib("fill",e)};this.getFontSize=function(){return Xa.fill};this.getFontSize=function(){return Xa.font_size};this.setFontSize=function(e){Xa.font_size=e;ib("font-size",e);K[0].textContent||cb.setCursor()};this.getText=function(){var e=K[0];if(e==null)return"";return e.textContent};this.setTextContent=function(e){ib("#text",e);cb.init(e);cb.setCursor()};this.setImageURL=function(e){var k=K[0];if(k){var m=$(k).attr(["width","height"]);m=!m.width||
!m.height;var A=da(k);if(A!==e)m=true;else if(!m)return;var z=new Aa("Change Image URL");U(k,e);z.addSubCommand(new Na(k,{"#href":A}));m?$(new Image).load(function(){var G=$(k).attr(["width","height"]);$(k).attr({width:this.width,height:this.height});Ga.requestSelector(k).resize();z.addSubCommand(new Na(k,G));ya(z);N("changed",[k])}).attr("src",e):ya(z)}};this.setLinkURL=function(e){var k=K[0];if(k){if(k.tagName!=="a"){k=$(k).parents("a");if(k.length)k=k[0];else return}var m=da(k);if(m!==e){var A= !m.height;var A=ea(k);if(A!==e)m=true;else if(!m)return;var z=new Aa("Change Image URL");U(k,e);z.addSubCommand(new Na(k,{"#href":A}));m?$(new Image).load(function(){var G=$(k).attr(["width","height"]);$(k).attr({width:this.width,height:this.height});Ga.requestSelector(k).resize();z.addSubCommand(new Na(k,G));ya(z);N("changed",[k])}).attr("src",e):ya(z)}};this.setLinkURL=function(e){var k=K[0];if(k){if(k.tagName!=="a"){k=$(k).parents("a");if(k.length)k=k[0];else return}var m=ea(k);if(m!==e){var A=
new Aa("Change Link URL");U(k,e);A.addSubCommand(new Na(k,{"#href":m}));ya(A)}}};this.elementsAreSame=function(e){return!e.length||e[0]==null?null:K.every(function(k){return k&&K[0]?k.nodeName==K[0].nodeName:null})};this.setRectRadius=function(e){c.elementsAreSame(K)&&K[0].tagName=="rect"&&K.forEach(function(k){var m=k.getAttribute("rx");if(m!=e){k.setAttribute("rx",e);k.setAttribute("ry",e);ya(new Na(k,{rx:m,ry:m},"Radius"));N("changed",[k])}})};this.makeHyperlink=function(e){c.groupSelectedElements("a", new Aa("Change Link URL");U(k,e);A.addSubCommand(new Na(k,{"#href":m}));ya(A)}}};this.elementsAreSame=function(e){return!e.length||e[0]==null?null:K.every(function(k){return k&&K[0]?k.nodeName==K[0].nodeName:null})};this.setRectRadius=function(e){c.elementsAreSame(K)&&K[0].tagName=="rect"&&K.forEach(function(k){var m=k.getAttribute("rx");if(m!=e){k.setAttribute("rx",e);k.setAttribute("ry",e);ya(new Na(k,{rx:m,ry:m},"Radius"));N("changed",[k])}})};this.makeHyperlink=function(e){c.groupSelectedElements("a",
e)};this.removeHyperlink=function(){c.ungroupSelectedElement()};this.setSegType=function(e){Ja.setSegType(e)};this.convertToPath=function(e,k){if(e==null)$.each(K,function(ca,S){S&&c.convertToPath(S)});else{if(!k)var m=new Aa("Convert element to Path");var A=k?{}:{fill:O.fill,"fill-opacity":O.fill_opacity,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,opacity:O.opacity, e)};this.removeHyperlink=function(){c.ungroupSelectedElement()};this.setSegType=function(e){Ja.setSegType(e)};this.convertToPath=function(e,k){if(e==null)$.each(K,function(da,S){S&&c.convertToPath(S)});else{if(!k)var m=new Aa("Convert element to Path");var A=k?{}:{fill:O.fill,"fill-opacity":O.fill_opacity,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,opacity:O.opacity,
visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(e.getAttribute(this))A[this]=e.getAttribute(this)});var z=P({element:"path",attr:A}),G=e.getAttribute("transform");G&&z.setAttribute("transform",G);var B=e.id,w=e.parentNode;e.nextSibling?w.insertBefore(z,e):w.appendChild(z);var E="",I=function(ca){$.each(ca,function(S,W){var Z=W[1];E+=W[0];for(var qa=0;qa<Z.length;qa+=2)E+=Z[qa]+","+Z[qa+1]+" "})},F=1.81;switch(e.tagName){case "ellipse":case "circle":var g= visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(e.getAttribute(this))A[this]=e.getAttribute(this)});var z=P({element:"path",attr:A}),G=e.getAttribute("transform");G&&z.setAttribute("transform",G);var B=e.id,w=e.parentNode;e.nextSibling?w.insertBefore(z,e):w.appendChild(z);var E="",I=function(da){$.each(da,function(S,V){var Z=V[1];E+=V[0];for(var pa=0;pa<Z.length;pa+=2)E+=Z[pa]+","+Z[pa+1]+" "})},F=1.81;switch(e.tagName){case "ellipse":case "circle":var g=
$(e).attr(["rx","ry","cx","cy"]),o=g.cx,v=g.cy,D=g.rx;g=g.ry;if(e.tagName=="circle")D=g=$(e).attr("r");I([["M",[o-D,v]],["C",[o-D,v-g/F,o-D/F,v-g,o,v-g]],["C",[o+D/F,v-g,o+D,v-g/F,o+D,v]],["C",[o+D,v+g/F,o+D/F,v+g,o,v+g]],["C",[o-D/F,v+g,o-D,v+g/F,o-D,v]],["Z",[]]]);break;case "path":E=e.getAttribute("d");break;case "line":g=$(e).attr(["x1","y1","x2","y2"]);E="M"+g.x1+","+g.y1+"L"+g.x2+","+g.y2;break;case "polyline":case "polygon":E="M"+e.getAttribute("points");break;case "rect":g=$(e).attr(["rx", $(e).attr(["rx","ry","cx","cy"]),o=g.cx,v=g.cy,D=g.rx;g=g.ry;if(e.tagName=="circle")D=g=$(e).attr("r");I([["M",[o-D,v]],["C",[o-D,v-g/F,o-D/F,v-g,o,v-g]],["C",[o+D/F,v-g,o+D,v-g/F,o+D,v]],["C",[o+D,v+g/F,o+D/F,v+g,o,v+g]],["C",[o-D/F,v+g,o-D,v+g/F,o-D,v]],["Z",[]]]);break;case "path":E=e.getAttribute("d");break;case "line":g=$(e).attr(["x1","y1","x2","y2"]);E="M"+g.x1+","+g.y1+"L"+g.x2+","+g.y2;break;case "polyline":case "polygon":E="M"+e.getAttribute("points");break;case "rect":g=$(e).attr(["rx",
"ry"]);D=g.rx;g=g.ry;var H=e.getBBox();o=H.x;v=H.y;var J=H.width;H=H.height;F=4-F;if(!D&&!g)I([["M",[o,v]],["L",[o+J,v]],["L",[o+J,v+H]],["L",[o,v+H]],["L",[o,v]],["Z",[]]]);else{g||(g=D);I([["M",[o,v+g]],["C",[o,v+g/F,o+D/F,v,o+D,v]],["L",[o+J-D,v]],["C",[o+J-D/F,v,o+J,v+g/F,o+J,v+g]],["L",[o+J,v+H-g]],["C",[o+J,v+H-g/F,o+J-D/F,v+H,o+J-D,v+H]],["L",[o+D,v+H]],["C",[o+D/F,v+H,o,v+H-g/F,o,v+H-g]],["L",[o,v+g]],["Z",[]]])}break;default:z.parentNode.removeChild(z)}E&&z.setAttribute("d",E);if(k){Ja.resetOrientation(z); "ry"]);D=g.rx;g=g.ry;var H=e.getBBox();o=H.x;v=H.y;var J=H.width;H=H.height;F=4-F;if(!D&&!g)I([["M",[o,v]],["L",[o+J,v]],["L",[o+J,v+H]],["L",[o,v+H]],["L",[o,v]],["Z",[]]]);else{g||(g=D);I([["M",[o,v+g]],["C",[o,v+g/F,o+D/F,v,o+D,v]],["L",[o+J-D,v]],["C",[o+J-D/F,v,o+J,v+g/F,o+J,v+g]],["L",[o+J,v+H-g]],["C",[o+J,v+H-g/F,o+J-D/F,v+H,o+J-D,v+H]],["L",[o+D,v+H]],["C",[o+D/F,v+H,o,v+H-g/F,o,v+H-g]],["L",[o,v+g]],["Z",[]]])}break;default:z.parentNode.removeChild(z)}E&&z.setAttribute("d",E);if(k){Ja.resetOrientation(z);
m=false;try{m=z.getBBox()}catch(X){}z.parentNode.removeChild(z);return m}else{if(G){G=T(z);na(G)&&Ja.resetOrientation(z)}m.addSubCommand(new Ka(e,e.nextSibling,w));m.addSubCommand(new za(z));Pa();e.parentNode.removeChild(e);z.setAttribute("id",B);z.removeAttribute("visibility");tb([z],true);ya(m)}}};var Cb=this.changeSelectedAttributeNoUndo=function(e,k,m){var A=d.suspendRedraw(1E3);Da=="pathedit"&&Ja.moveNode(e,k);m=m||K;for(var z=m.length,G=["g","polyline","path"];z--;){var B=m[z];if(B!=null){Da=== m=false;try{m=z.getBBox()}catch(X){}z.parentNode.removeChild(z);return m}else{if(G){G=T(z);qa(G)&&Ja.resetOrientation(z)}m.addSubCommand(new Ka(e,e.nextSibling,w));m.addSubCommand(new za(z));Pa();e.parentNode.removeChild(e);z.setAttribute("id",B);z.removeAttribute("visibility");tb([z],true);ya(m)}}};var Cb=this.changeSelectedAttributeNoUndo=function(e,k,m){var A=d.suspendRedraw(1E3);Da=="pathedit"&&Ja.moveNode(e,k);m=m||K;for(var z=m.length,G=["g","polyline","path"];z--;){var B=m[z];if(B!=null){Da===
"textedit"&&e!=="#text"&&B.textContent.length&&cb.toSelectMode(B);if((e==="x"||e==="y")&&G.indexOf(B.tagName)>=0){var w=getStrokedBBox([B]);c.moveSelectedElements((e==="x"?k-w.x:0)*p,(e==="y"?k-w.y:0)*p,true)}else{w=e==="#text"?B.textContent:B.getAttribute(e);if(w==null)w="";if(w!==String(k)){if(e=="#text"){svgedit.utilities.getBBox(B);B.textContent=k}else e=="#href"?U(B,k):B.setAttribute(e,k);K.indexOf(B)>=0&&setTimeout(function(){B.parentNode&&Ga.requestSelector(B).resize()},0);w=oa(B);if(w!=0&& "textedit"&&e!=="#text"&&B.textContent.length&&cb.toSelectMode(B);if((e==="x"||e==="y")&&G.indexOf(B.tagName)>=0){var w=getStrokedBBox([B]);c.moveSelectedElements((e==="x"?k-w.x:0)*p,(e==="y"?k-w.y:0)*p,true)}else{w=e==="#text"?B.textContent:B.getAttribute(e);if(w==null)w="";if(w!==String(k)){if(e=="#text"){svgedit.utilities.getBBox(B);B.textContent=k}else e=="#href"?U(B,k):B.setAttribute(e,k);K.indexOf(B)>=0&&setTimeout(function(){B.parentNode&&Ga.requestSelector(B).resize()},0);w=na(B);if(w!=0&&
e!="transform")for(var E=T(B),I=E.numberOfItems;I--;)if(E.getItem(I).type==4){E.removeItem(I);var F=svgedit.utilities.getBBox(B),g=M(F.x+F.width/2,F.y+F.height/2,fa(E).matrix);F=g.x;g=g.y;var o=d.createSVGTransform();o.setRotate(w,F,g);E.insertItemBefore(o,I);break}}}}}d.unsuspendRedraw(A)},ib=this.changeSelectedAttribute=function(e,k,m){m=m||K;c.undoMgr.beginUndoableChange(e,m);Cb(e,k,m);e=c.undoMgr.finishUndoableChange();e.isEmpty()||ya(e)};this.deleteSelectedElements=function(){for(var e=new Aa("Delete Elements"), e!="transform")for(var E=T(B),I=E.numberOfItems;I--;)if(E.getItem(I).type==4){E.removeItem(I);var F=svgedit.utilities.getBBox(B),g=M(F.x+F.width/2,F.y+F.height/2,ha(E).matrix);F=g.x;g=g.y;var o=d.createSVGTransform();o.setRotate(w,F,g);E.insertItemBefore(o,I);break}}}}}d.unsuspendRedraw(A)},ib=this.changeSelectedAttribute=function(e,k,m){m=m||K;c.undoMgr.beginUndoableChange(e,m);Cb(e,k,m);e=c.undoMgr.finishUndoableChange();e.isEmpty()||ya(e)};this.deleteSelectedElements=function(){for(var e=new Aa("Delete Elements"),
k=K.length,m=[],A=0;A<k;++A){var z=K[A];if(z==null)break;var G=z.parentNode,B=z;Ga.releaseSelector(B);svgedit.path.removePath_(B.id);if(G.tagName==="a"&&G.childNodes.length===1){B=G;G=G.parentNode}var w=B.nextSibling;B=G.removeChild(B);m.push(z);K[A]=null;e.addSubCommand(new Ka(B,w,G))}e.isEmpty()||ya(e);N("changed",m);Pa()};this.cutSelectedElements=function(){for(var e=new Aa("Cut Elements"),k=K.length,m=[],A=0;A<k;++A){var z=K[A];if(z==null)break;var G=z.parentNode,B=z;Ga.releaseSelector(B);svgedit.path.removePath_(B.id); k=K.length,m=[],A=0;A<k;++A){var z=K[A];if(z==null)break;var G=z.parentNode,B=z;Ga.releaseSelector(B);svgedit.path.removePath_(B.id);if(G.tagName==="a"&&G.childNodes.length===1){B=G;G=G.parentNode}var w=B.nextSibling;B=G.removeChild(B);m.push(z);K[A]=null;e.addSubCommand(new Ka(B,w,G))}e.isEmpty()||ya(e);N("changed",m);Pa()};this.cutSelectedElements=function(){for(var e=new Aa("Cut Elements"),k=K.length,m=[],A=0;A<k;++A){var z=K[A];if(z==null)break;var G=z.parentNode,B=z;Ga.releaseSelector(B);svgedit.path.removePath_(B.id);
var w=B.nextSibling;B=G.removeChild(B);m.push(z);K[A]=null;e.addSubCommand(new Ka(B,w,G))}e.isEmpty()||ya(e);N("changed",m);Pa();c.clipBoard=m};this.copySelectedElements=function(){c.clipBoard=$.merge([],K)};this.pasteElements=function(){var e=c.clipBoard,k=e.length;if(k){for(var m=[],A=new Aa("Paste elements");k--;){var z=e[k];if(z){var G=ja(z);if(!pa(z.id))G.id=z.id;m.push(G);(L||C().getCurrentLayer()).appendChild(G);A.addSubCommand(new za(G))}}svgCanvas.clearSelection();setTimeout(function(){vb(m)}, var w=B.nextSibling;B=G.removeChild(B);m.push(z);K[A]=null;e.addSubCommand(new Ka(B,w,G))}e.isEmpty()||ya(e);N("changed",m);Pa();c.clipBoard=m};this.copySelectedElements=function(){c.clipBoard=$.merge([],K)};this.pasteElements=function(){var e=c.clipBoard,k=e.length;if(k){for(var m=[],A=new Aa("Paste elements");k--;){var z=e[k];if(z){var G=ja(z);if(!oa(z.id))G.id=z.id;m.push(G);(L||C().getCurrentLayer()).appendChild(G);A.addSubCommand(new za(G))}}svgCanvas.clearSelection();setTimeout(function(){vb(m)},
100);ya(A);N("changed",m)}};this.groupSelectedElements=function(e){e||(e="g");var k="";switch(e){case "a":k="Make hyperlink";var m="";if(arguments.length>1)m=arguments[1];break;default:e="g";k="Group Elements"}k=new Aa(k);var A=P({element:e,attr:{id:ka()}});e==="a"&&U(A,m);k.addSubCommand(new za(A));for(m=K.length;m--;){var z=K[m];if(z!=null){if(z.parentNode.tagName==="a"&&z.parentNode.childNodes.length===1)z=z.parentNode;var G=z.nextSibling,B=z.parentNode;A.appendChild(z);k.addSubCommand(new Ia(z, 100);ya(A);N("changed",m)}};this.groupSelectedElements=function(e){e||(e="g");var k="";switch(e){case "a":k="Make hyperlink";var m="";if(arguments.length>1)m=arguments[1];break;default:e="g";k="Group Elements"}k=new Aa(k);var A=P({element:e,attr:{id:ka()}});e==="a"&&U(A,m);k.addSubCommand(new za(A));for(m=K.length;m--;){var z=K[m];if(z!=null){if(z.parentNode.tagName==="a"&&z.parentNode.childNodes.length===1)z=z.parentNode;var G=z.nextSibling,B=z.parentNode;A.appendChild(z);k.addSubCommand(new Ia(z,
G,B))}}k.isEmpty()||ya(k);vb([A],true)};var Kb=this.pushGroupProperties=function(e,k){var m=e.childNodes,A=m.length,z=e.getAttribute("transform"),G=T(e),B=fa(G).matrix,w=new Aa("Push group properties"),E=0,I=oa(e),F=$(e).attr(["filter","opacity"]),g,o;for(E=0;E<A;E++){var v=m[E];if(v.nodeType===1){if(F.opacity!==null&&F.opacity!==1){v.getAttribute("opacity");var D=Math.round((v.getAttribute("opacity")||1)*F.opacity*100)/100;ib("opacity",D,[v])}if(F.filter){var H=D=this.getBlur(v);o||(o=this.getBlur(e)); G,B))}}k.isEmpty()||ya(k);vb([A],true)};var Kb=this.pushGroupProperties=function(e,k){var m=e.childNodes,A=m.length,z=e.getAttribute("transform"),G=T(e),B=ha(G).matrix,w=new Aa("Push group properties"),E=0,I=na(e),F=$(e).attr(["filter","opacity"]),g,o;for(E=0;E<A;E++){var v=m[E];if(v.nodeType===1){if(F.opacity!==null&&F.opacity!==1){v.getAttribute("opacity");var D=Math.round((v.getAttribute("opacity")||1)*F.opacity*100)/100;ib("opacity",D,[v])}if(F.filter){var H=D=this.getBlur(v);o||(o=this.getBlur(e));
if(D)D=o-0+(D-0);else if(D===0)D=o;if(H)g=Q(v.getAttribute("filter"));else if(g){g=ja(g);kb().appendChild(g)}else g=Q(F.filter);g.id=v.id+"_"+(g.firstChild.tagName==="feGaussianBlur"?"blur":"filter");ib("filter","url(#"+g.id+")",[v]);if(D){ib("stdDeviation",D,[g.firstChild]);c.setBlurOffsets(g,D)}}D=T(v);if(~v.tagName.indexOf("Gradient"))D=null;if(D)if(v.tagName!=="defs")if(G.numberOfItems){if(I&&G.numberOfItems==1){var J=G.getItem(0).matrix,X=d.createSVGMatrix();if(H=oa(v))X=D.getItem(0).matrix; if(D)D=o-0+(D-0);else if(D===0)D=o;if(H)g=Q(v.getAttribute("filter"));else if(g){g=ja(g);kb().appendChild(g)}else g=Q(F.filter);g.id=v.id+"_"+(g.firstChild.tagName==="feGaussianBlur"?"blur":"filter");ib("filter","url(#"+g.id+")",[v]);if(D){ib("stdDeviation",D,[g.firstChild]);c.setBlurOffsets(g,D)}}D=T(v);if(~v.tagName.indexOf("Gradient"))D=null;if(D)if(v.tagName!=="defs")if(G.numberOfItems){if(I&&G.numberOfItems==1){var J=G.getItem(0).matrix,X=d.createSVGMatrix();if(H=na(v))X=D.getItem(0).matrix;
var ca=svgedit.utilities.getBBox(v),S=fa(D).matrix,W=M(ca.x+ca.width/2,ca.y+ca.height/2,S);ca=I+H;S=d.createSVGTransform();S.setRotate(ca,W.x,W.y);J=ha(J,X,S.matrix.inverse());H&&D.removeItem(0);if(ca)D.numberOfItems?D.insertItemBefore(S,0):D.appendItem(S);if(J.e||J.f){H=d.createSVGTransform();H.setTranslate(J.e,J.f);D.numberOfItems?D.insertItemBefore(H,0):D.appendItem(H)}}else{H=v.getAttribute("transform");J={};J.transform=H?H:"";H=d.createSVGTransform();J=fa(D).matrix;X=J.inverse();J=ha(X,B,J); var da=svgedit.utilities.getBBox(v),S=ha(D).matrix,V=M(da.x+da.width/2,da.y+da.height/2,S);da=I+H;S=d.createSVGTransform();S.setRotate(da,V.x,V.y);J=aa(J,X,S.matrix.inverse());H&&D.removeItem(0);if(da)D.numberOfItems?D.insertItemBefore(S,0):D.appendItem(S);if(J.e||J.f){H=d.createSVGTransform();H.setTranslate(J.e,J.f);D.numberOfItems?D.insertItemBefore(H,0):D.appendItem(H)}}else{H=v.getAttribute("transform");J={};J.transform=H?H:"";H=d.createSVGTransform();J=ha(D).matrix;X=J.inverse();J=aa(X,B,J);
H.setMatrix(J);D.appendItem(H)}(v=Qa(v))&&w.addSubCommand(v)}}}if(z){J={};J.transform=z;e.setAttribute("transform","");e.removeAttribute("transform");w.addSubCommand(new Na(e,J))}if(k&&!w.isEmpty())return w};this.ungroupSelectedElement=function(){var e=K[0];if($(e).data("gsvg")||$(e).data("symbol"))Ob(e);else if(e.tagName==="use"){var k=pa(da(e).substr(1));$(e).data("symbol",k).data("ref",k);Ob(e)}else{k=$(e).parents("a");if(k.length)e=k[0];if(e.tagName==="g"||e.tagName==="a"){k=new Aa("Ungroup Elements"); H.setMatrix(J);D.appendItem(H)}(v=Qa(v))&&w.addSubCommand(v)}}}if(z){J={};J.transform=z;e.setAttribute("transform","");e.removeAttribute("transform");w.addSubCommand(new Na(e,J))}if(k&&!w.isEmpty())return w};this.ungroupSelectedElement=function(){var e=K[0];if($(e).data("gsvg")||$(e).data("symbol"))Ob(e);else if(e.tagName==="use"){var k=oa(ea(e).substr(1));$(e).data("symbol",k).data("ref",k);Ob(e)}else{k=$(e).parents("a");if(k.length)e=k[0];if(e.tagName==="g"||e.tagName==="a"){k=new Aa("Ungroup Elements");
var m=Kb(e,true);m&&k.addSubCommand(m);m=e.parentNode;for(var A=e.nextSibling,z=Array(e.childNodes.length),G=0;e.firstChild;){var B=e.firstChild,w=B.nextSibling,E=B.parentNode;if(B.tagName==="title"){k.addSubCommand(new Ka(B,B.nextSibling,E));E.removeChild(B)}else{z[G++]=B=m.insertBefore(B,A);k.addSubCommand(new Ia(B,w,E))}}Pa();A=e.nextSibling;e=m.removeChild(e);k.addSubCommand(new Ka(e,A,m));k.isEmpty()||ya(k);tb(z)}}};this.moveToTopSelectedElement=function(){var e=K[0];if(e!=null){e=e;var k=e.parentNode, var m=Kb(e,true);m&&k.addSubCommand(m);m=e.parentNode;for(var A=e.nextSibling,z=Array(e.childNodes.length),G=0;e.firstChild;){var B=e.firstChild,w=B.nextSibling,E=B.parentNode;if(B.tagName==="title"){k.addSubCommand(new Ka(B,B.nextSibling,E));E.removeChild(B)}else{z[G++]=B=m.insertBefore(B,A);k.addSubCommand(new Ia(B,w,E))}}Pa();A=e.nextSibling;e=m.removeChild(e);k.addSubCommand(new Ka(e,A,m));k.isEmpty()||ya(k);tb(z)}}};this.moveToTopSelectedElement=function(){var e=K[0];if(e!=null){e=e;var k=e.parentNode,
m=e.nextSibling;e=e.parentNode.appendChild(e);if(m!=e.nextSibling){ya(new Ia(e,m,k,"top"));N("changed",[e])}}};this.moveToBottomSelectedElement=function(){var e=K[0];if(e!=null){e=e;var k=e.parentNode,m=e.nextSibling,A=e.parentNode.firstChild;if(A.tagName=="title")A=A.nextSibling;if(A.tagName=="defs")A=A.nextSibling;e=e.parentNode.insertBefore(e,A);if(m!=e.nextSibling){ya(new Ia(e,m,k,"bottom"));N("changed",[e])}}};this.moveUpDownSelected=function(e){var k=K[0];if(k){jb=[];var m,A,z=$(sb(getStrokedBBox([k]))).toArray(); m=e.nextSibling;e=e.parentNode.appendChild(e);if(m!=e.nextSibling){ya(new Ia(e,m,k,"top"));N("changed",[e])}}};this.moveToBottomSelectedElement=function(){var e=K[0];if(e!=null){e=e;var k=e.parentNode,m=e.nextSibling,A=e.parentNode.firstChild;if(A.tagName=="title")A=A.nextSibling;if(A.tagName=="defs")A=A.nextSibling;e=e.parentNode.insertBefore(e,A);if(m!=e.nextSibling){ya(new Ia(e,m,k,"bottom"));N("changed",[e])}}};this.moveUpDownSelected=function(e){var k=K[0];if(k){jb=[];var m,A,z=$(sb(getStrokedBBox([k]))).toArray();
e=="Down"&&z.reverse();$.each(z,function(){if(A){m=this;return false}else if(this==k)A=true});if(m){z=k.parentNode;var G=k.nextSibling;$(m)[e=="Down"?"before":"after"](k);if(G!=k.nextSibling){ya(new Ia(k,G,z,"Move "+e));N("changed",[k])}}}};this.moveSelectedElements=function(e,k,m){if(e.constructor!=Array){e/=p;k/=p}m=m||true;for(var A=new Aa("position"),z=K.length;z--;){var G=K[z];if(G!=null){var B=d.createSVGTransform(),w=T(G);e.constructor==Array?B.setTranslate(e[z],k[z]):B.setTranslate(e,k);w.numberOfItems? e=="Down"&&z.reverse();$.each(z,function(){if(A){m=this;return false}else if(this==k)A=true});if(m){z=k.parentNode;var G=k.nextSibling;$(m)[e=="Down"?"before":"after"](k);if(G!=k.nextSibling){ya(new Ia(k,G,z,"Move "+e));N("changed",[k])}}}};this.moveSelectedElements=function(e,k,m){if(e.constructor!=Array){e/=p;k/=p}m=m||true;for(var A=new Aa("position"),z=K.length;z--;){var G=K[z];if(G!=null){var B=d.createSVGTransform(),w=T(G);e.constructor==Array?B.setTranslate(e[z],k[z]):B.setTranslate(e,k);w.numberOfItems?
@ -370,19 +370,19 @@ w.insertItemBefore(B,0):w.appendItem(B);(B=Qa(G))&&A.addSubCommand(B);Ga.request
m||this.moveSelectedElements(e,k,false);ya(A)}return clones};this.alignSelectedElements=function(e,k){var m=[],A=Number.MAX_VALUE,z=Number.MIN_VALUE,G=Number.MAX_VALUE,B=Number.MIN_VALUE,w=Number.MIN_VALUE,E=Number.MIN_VALUE,I=K.length;if(I){for(var F=0;F<I;++F){if(K[F]==null)break;m[F]=getStrokedBBox([K[F]]);switch(k){case "smallest":if((e=="l"||e=="c"||e=="r")&&(w==Number.MIN_VALUE||w>m[F].width)||(e=="t"||e=="m"||e=="b")&&(E==Number.MIN_VALUE||E>m[F].height)){A=m[F].x;G=m[F].y;z=m[F].x+m[F].width; m||this.moveSelectedElements(e,k,false);ya(A)}return clones};this.alignSelectedElements=function(e,k){var m=[],A=Number.MAX_VALUE,z=Number.MIN_VALUE,G=Number.MAX_VALUE,B=Number.MIN_VALUE,w=Number.MIN_VALUE,E=Number.MIN_VALUE,I=K.length;if(I){for(var F=0;F<I;++F){if(K[F]==null)break;m[F]=getStrokedBBox([K[F]]);switch(k){case "smallest":if((e=="l"||e=="c"||e=="r")&&(w==Number.MIN_VALUE||w>m[F].width)||(e=="t"||e=="m"||e=="b")&&(E==Number.MIN_VALUE||E>m[F].height)){A=m[F].x;G=m[F].y;z=m[F].x+m[F].width;
B=m[F].y+m[F].height;w=m[F].width;E=m[F].height}break;case "largest":if((e=="l"||e=="c"||e=="r")&&(w==Number.MIN_VALUE||w<m[F].width)||(e=="t"||e=="m"||e=="b")&&(E==Number.MIN_VALUE||E<m[F].height)){A=m[F].x;G=m[F].y;z=m[F].x+m[F].width;B=m[F].y+m[F].height;w=m[F].width;E=m[F].height}break;default:if(m[F].x<A)A=m[F].x;if(m[F].y<G)G=m[F].y;if(m[F].x+m[F].width>z)z=m[F].x+m[F].width;if(m[F].y+m[F].height>B)B=m[F].y+m[F].height}}if(k=="page"){G=A=0;z=c.contentW;B=c.contentH}w=Array(I);E=Array(I);for(F= B=m[F].y+m[F].height;w=m[F].width;E=m[F].height}break;case "largest":if((e=="l"||e=="c"||e=="r")&&(w==Number.MIN_VALUE||w<m[F].width)||(e=="t"||e=="m"||e=="b")&&(E==Number.MIN_VALUE||E<m[F].height)){A=m[F].x;G=m[F].y;z=m[F].x+m[F].width;B=m[F].y+m[F].height;w=m[F].width;E=m[F].height}break;default:if(m[F].x<A)A=m[F].x;if(m[F].y<G)G=m[F].y;if(m[F].x+m[F].width>z)z=m[F].x+m[F].width;if(m[F].y+m[F].height>B)B=m[F].y+m[F].height}}if(k=="page"){G=A=0;z=c.contentW;B=c.contentH}w=Array(I);E=Array(I);for(F=
0;F<I;++F){if(K[F]==null)break;var g=m[F];w[F]=0;E[F]=0;switch(e){case "l":w[F]=A-g.x;break;case "c":w[F]=(A+z)/2-(g.x+g.width/2);break;case "r":w[F]=z-(g.x+g.width);break;case "t":E[F]=G-g.y;break;case "m":E[F]=(G+B)/2-(g.y+g.height/2);break;case "b":E[F]=B-(g.y+g.height)}}this.moveSelectedElements(w,E)}};this.contentW=Ab().w;this.contentH=Ab().h;this.updateCanvas=function(e,k){d.setAttribute("width",e);d.setAttribute("height",k);var m=$("#canvasBackground")[0],A=l.getAttribute("x"),z=l.getAttribute("y"), 0;F<I;++F){if(K[F]==null)break;var g=m[F];w[F]=0;E[F]=0;switch(e){case "l":w[F]=A-g.x;break;case "c":w[F]=(A+z)/2-(g.x+g.width/2);break;case "r":w[F]=z-(g.x+g.width);break;case "t":E[F]=G-g.y;break;case "m":E[F]=(G+B)/2-(g.y+g.height/2);break;case "b":E[F]=B-(g.y+g.height)}}this.moveSelectedElements(w,E)}};this.contentW=Ab().w;this.contentH=Ab().h;this.updateCanvas=function(e,k){d.setAttribute("width",e);d.setAttribute("height",k);var m=$("#canvasBackground")[0],A=l.getAttribute("x"),z=l.getAttribute("y"),
G=e/2-this.contentW*p/2,B=k/2-this.contentH*p/2;la(l,{width:this.contentW*p,height:this.contentH*p,x:G,y:B,viewBox:"0 0 "+this.contentW+" "+this.contentH});la(m,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:G,y:B});(m=pa("background_image"))&&la(m,{width:"100%",height:"100%"});Ga.selectorParentGroup.setAttribute("transform","translate("+G+","+B+")");return{x:G,y:B,old_x:A,old_y:z,d_x:G-A,d_y:B-z}};this.setBackground=function(e,k){var m=pa("canvasBackground"),A=$(m).find("rect")[0], G=e/2-this.contentW*p/2,B=k/2-this.contentH*p/2;la(l,{width:this.contentW*p,height:this.contentH*p,x:G,y:B,viewBox:"0 0 "+this.contentW+" "+this.contentH});la(m,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:G,y:B});(m=oa("background_image"))&&la(m,{width:"100%",height:"100%"});Ga.selectorParentGroup.setAttribute("transform","translate("+G+","+B+")");return{x:G,y:B,old_x:A,old_y:z,d_x:G-A,d_y:B-z}};this.setBackground=function(e,k){var m=oa("canvasBackground"),A=$(m).find("rect")[0],
z=pa("background_image");A.setAttribute("fill",e);if(k){if(!z){z=f.createElementNS(b,"image");la(z,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}U(z,k);m.appendChild(z)}else z&&z.parentNode.removeChild(z)};this.cycleElement=function(e){var k=K[0],m=false,A=ob(L||C().getCurrentLayer());if(A.length){if(k==null){e=e?A.length-1:0;m=A[e]}else for(var z=A.length;z--;)if(A[z]==k){e=e?z-1:z+1;if(e>=A.length)e=0;else if(e<0)e=A.length-1;m=A[e]; z=oa("background_image");A.setAttribute("fill",e);if(k){if(!z){z=f.createElementNS(b,"image");la(z,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}U(z,k);m.appendChild(z)}else z&&z.parentNode.removeChild(z)};this.cycleElement=function(e){var k=K[0],m=false,A=ob(L||C().getCurrentLayer());if(A.length){if(k==null){e=e?A.length-1:0;m=A[e]}else for(var z=A.length;z--;)if(A[z]==k){e=e?z-1:z+1;if(e>=A.length)e=0;else if(e<0)e=A.length-1;m=A[e];
break}vb([m],true);N("selected",K)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:ya,setGradient:Mb,addSvgElementFromJson:P,assignAttributes:la,BatchCommand:Aa,call:N,ChangeElementCommand:Na,copyElem:ja,ffClone:ea,findDefs:kb,findDuplicateGradient:Ib,getElem:pa,getId:ba,getIntersectionList:sb,getMouseTarget:mb,getNextId:ka,getPathBBox:Y,getUrlFromAttr:ia,hasMatrixTransform:na,identifyLayers:Db,InsertElementCommand:za,isIdentity:svgedit.math.isIdentity,logMatrix:Va,matrixMultiply:ha, break}vb([m],true);N("selected",K)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:ya,setGradient:Mb,addSvgElementFromJson:P,assignAttributes:la,BatchCommand:Aa,call:N,ChangeElementCommand:Na,copyElem:ja,ffClone:fa,findDefs:kb,findDuplicateGradient:Ib,getElem:oa,getId:ba,getIntersectionList:sb,getMouseTarget:mb,getNextId:ka,getPathBBox:Y,getUrlFromAttr:ia,hasMatrixTransform:qa,identifyLayers:Db,InsertElementCommand:za,isIdentity:svgedit.math.isIdentity,logMatrix:Va,matrixMultiply:aa,
MoveElementCommand:Ia,preventClickDefault:Gb,recalculateAllSelectedDimensions:Fa,recalculateDimensions:Qa,remapElement:$a,RemoveElementCommand:Ka,removeUnusedDefElems:Nb,round:eb,runExtensions:lb,sanitizeSvg:Ea,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:fa,transformPoint:M,walkTree:svgedit.utilities.walkTree}}};(function(){document.addEventListener("touchstart",touchHandler,true);document.addEventListener("touchmove",touchHandler,true);document.addEventListener("touchend",touchHandler,true);document.addEventListener("touchcancel",touchHandler,true);if(!window.svgEditor)window.svgEditor=function(a){function q(d,l){var s=h.setSvgString(d)!==false;l=l||a.noop;s?l(true):a.alert(uiStrings.notification.errorLoadingSVG,function(){l(false)})}var h,b={},n=false;curConfig={canvas_expansion:1,dimensions:[580,400], MoveElementCommand:Ia,preventClickDefault:Gb,recalculateAllSelectedDimensions:Fa,recalculateDimensions:Qa,remapElement:$a,RemoveElementCommand:Ka,removeUnusedDefElems:Nb,round:eb,runExtensions:lb,sanitizeSvg:Ea,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:ha,transformPoint:M,walkTree:svgedit.utilities.walkTree}}};(function(){document.addEventListener("touchstart",touchHandler,true);document.addEventListener("touchmove",touchHandler,true);document.addEventListener("touchend",touchHandler,true);document.addEventListener("touchcancel",touchHandler,true);if(!window.svgEditor)window.svgEditor=function(a){function q(d,l){var s=h.setSvgString(d)!==false;l=l||a.noop;s?l(true):a.alert(uiStrings.notification.errorLoadingSVG,function(){l(false)})}var h,b={},n=false;curConfig={canvas_expansion:1,dimensions:[580,400],
initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:[],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:svgedit.browser.isTouch()?false:true,show_outside_canvas:false,no_save_warning:true,initFont:"Helvetica, Arial, sans-serif"};uiStrings=b.uiStrings={common:{ok:"OK",cancel:"Cancel",key_up:"Up", initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:[],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:svgedit.browser.isTouch()?false:true,show_outside_canvas:false,no_save_warning:true,initFont:"Helvetica, Arial, sans-serif"};uiStrings=b.uiStrings={common:{ok:"OK",cancel:"Cancel",key_up:"Up",
key_down:"Down",key_backspace:"Backspace",key_del:"Del"},layers:{layer:"Layer"},notification:{invalidAttrValGiven:"Invalid value given",noContentToFitTo:"No content to fit to",dupeLayerName:"There is already a layer named that!",enterUniqueLayerName:"Please enter a unique layer name",enterNewLayerName:"Please enter the new layer name",layerHasThatName:"Layer already has that name",QmoveElemsToLayer:'Move selected elements to layer "%s"?',QwantToClear:"Do you want to clear the drawing?\nThis will also erase your undo history!", key_down:"Down",key_backspace:"Backspace",key_del:"Del"},layers:{layer:"Layer"},notification:{invalidAttrValGiven:"Invalid value given",noContentToFitTo:"No content to fit to",dupeLayerName:"There is already a layer named that!",enterUniqueLayerName:"Please enter a unique layer name",enterNewLayerName:"Please enter the new layer name",layerHasThatName:"Layer already has that name",QmoveElemsToLayer:'Move selected elements to layer "%s"?',QwantToClear:"Do you want to clear the drawing?\nThis will also erase your undo history!",
QwantToOpen:"Do you want to open a new file?\nThis will also erase your undo history!",QerrorsRevertToSource:"There were parsing errors in your SVG source.\nRevert back to original SVG source?",QignoreSourceChanges:"Ignore changes made to SVG source?",featNotSupported:"Feature not supported",enterNewImgURL:"Enter the new image URL",defsFailOnSave:"NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.",loadingImage:"Loading image, please wait...", QwantToOpen:"Do you want to open a new file?\nThis will also erase your undo history!",QerrorsRevertToSource:"There were parsing errors in your SVG source.\nRevert back to original SVG source?",QignoreSourceChanges:"Ignore changes made to SVG source?",featNotSupported:"Feature not supported",enterNewImgURL:"Enter the new image URL",defsFailOnSave:"NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.",loadingImage:"Loading image, please wait...",
saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};var u={},c={};b.curConfig=curConfig;b.tool_scale=1;b.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions}; saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};var u={},c={};b.curConfig=curConfig;b.tool_scale=1;b.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions};
b.setCustomHandlers=function(d){b.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();h.open=d.open}if(d.save){b.show_save_warning=false;h.bind("saved",d.save)}d.pngsave&&h.bind("exported",d.pngsave);c=d})};b.randomizeIds=function(){h.randomizeIds(arguments)};b.init=function(){function d(g,o){var v=g.id,D=v.split("_"),H=D[0];D=D[1];o&&h.setStrokeAttr("stroke-"+H,D);nb();Ib("#cur_"+H,v,20);a(g).addClass("current").siblings().removeClass("current")}function l(g, b.setCustomHandlers=function(d){b.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();h.open=d.open}if(d.save){b.show_save_warning=false;h.bind("saved",d.save)}d.pngsave&&h.bind("exported",d.pngsave);c=d})};b.randomizeIds=function(){h.randomizeIds(arguments)};b.init=function(){function d(g,o){var v=g.id,D=v.split("_"),H=D[0];D=D[1];o&&h.setStrokeAttr("stroke-"+H,D);nb();Ib("#cur_"+H,v,20);a(g).addClass("current").siblings().removeClass("current")}function l(g,
o){var v=document.getElementById("ruler_x_cursor"),D=document.getElementById("ruler_y_cursor"),H=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()&&a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(Qb){Qb.stopPropagation();v.style.left=Qb.pageX-66+H.scrollLeft+"px";D.style.top=Qb.pageY-48+H.scrollTop+"px"});o||(o=h.getZoom());g||(g=a("#svgcanvas"));for(var J=h.getContentElem(),X=svgedit.units.getTypeMap()[curConfig.baseUnit], o){var v=document.getElementById("ruler_x_cursor"),D=document.getElementById("ruler_y_cursor"),H=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()&&a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(Qb){Qb.stopPropagation();v.style.left=Qb.pageX-66+H.scrollLeft+"px";D.style.top=Qb.pageY-48+H.scrollTop+"px"});o||(o=h.getZoom());g||(g=a("#svgcanvas"));for(var J=h.getContentElem(),X=svgedit.units.getTypeMap()[curConfig.baseUnit],
ca=0;ca<2;ca++){var S=ca===0,W=S?"x":"y",Z=S?"width":"height",qa=J.getAttribute(W)-0;W=a("#ruler_"+W+" canvas:first");$hcanv=W.clone();W.replaceWith($hcanv);var ta=$hcanv[0];var ga=W=g[Z]()*2;ta.parentNode.style[Z]=ga+"px";var Ta=0,Ha,sa=ta.getContext("2d");sa.fillStyle="rgb(200,0,0)";sa.fillRect(0,0,ta.width,ta.height);$hcanv.siblings().remove();if(W>=3E4){var Ma=parseInt(W/3E4)+1;Ha=Array(Ma);Ha[0]=sa;for(var va=1;va<Ma;va++){ta[Z]=3E4;var Za=ta.cloneNode(true);ta.parentNode.appendChild(Za);Ha[va]= da=0;da<2;da++){var S=da===0,V=S?"x":"y",Z=S?"width":"height",pa=J.getAttribute(V)-0;V=a("#ruler_"+V+" canvas:first");$hcanv=V.clone();V.replaceWith($hcanv);var ta=$hcanv[0];var ga=V=g[Z]()*2;ta.parentNode.style[Z]=ga+"px";var Ta=0,Ha,sa=ta.getContext("2d");sa.fillStyle="rgb(200,0,0)";sa.fillRect(0,0,ta.width,ta.height);$hcanv.siblings().remove();if(V>=3E4){var Ma=parseInt(V/3E4)+1;Ha=Array(Ma);Ha[0]=sa;for(var va=1;va<Ma;va++){ta[Z]=3E4;var Za=ta.cloneNode(true);ta.parentNode.appendChild(Za);Ha[va]=
Za.getContext("2d")}Za[Z]=W%3E4;W=3E4}ta[Z]=W;Z=X*o;var Ua=50/Z;ta=1;for(va=0;va<E.length;va++){ta=Ma=E[va];if(Ua<=Ma)break}Ua=ta*Z;sa.font="normal 9px 'Lucida Grande', sans-serif";sa.fillStyle="#777";for(var bb=qa/Z%ta*Z,Fb=bb-Ua;bb<ga;bb+=Ua){Fb+=Ua;va=Math.round(bb)+0.5;if(S){sa.moveTo(va,15);sa.lineTo(va,0)}else{sa.moveTo(15,va);sa.lineTo(0,va)}Ma=(Fb-qa)/Z;if(ta>=1)va=Math.round(Ma);else{va=(ta+"").split(".")[1].length;va=Ma.toFixed(va)-0}if(va!==0&&va!==1E3&&va%1E3===0)va=va/1E3+"K";if(S){sa.fillText(va, Za.getContext("2d")}Za[Z]=V%3E4;V=3E4}ta[Z]=V;Z=X*o;var Ua=50/Z;ta=1;for(va=0;va<E.length;va++){ta=Ma=E[va];if(Ua<=Ma)break}Ua=ta*Z;sa.font="normal 9px 'Lucida Grande', sans-serif";sa.fillStyle="#777";for(var bb=pa/Z%ta*Z,Fb=bb-Ua;bb<ga;bb+=Ua){Fb+=Ua;va=Math.round(bb)+0.5;if(S){sa.moveTo(va,15);sa.lineTo(va,0)}else{sa.moveTo(15,va);sa.lineTo(0,va)}Ma=(Fb-pa)/Z;if(ta>=1)va=Math.round(Ma);else{va=(ta+"").split(".")[1].length;va=Ma.toFixed(va)-0}if(va!==0&&va!==1E3&&va%1E3===0)va=va/1E3+"K";if(S){sa.fillText(va,
bb+2,8);sa.fillStyle="#777"}else{Ma=(va+"").split("");for(va=0;va<Ma.length;va++){sa.fillText(Ma[va],1,bb+9+va*9);sa.fillStyle="#777"}}Ma=Ua/10;for(va=1;va<10;va++){var wb=Math.round(bb+Ma*va)+0.5;if(Ha&&wb>W){Ta++;sa.stroke();if(Ta>=Ha.length){va=10;bb=ga;continue}sa=Ha[Ta];bb-=3E4;wb=Math.round(bb+Ma*va)+0.5}var Eb=va%2?12:10;if(S){sa.moveTo(wb,15);sa.lineTo(wb,Eb)}else{sa.moveTo(15,wb);sa.lineTo(Eb,wb)}}}sa.strokeStyle="#666";sa.stroke()}}(function(){var g=window.opener;if(g)try{var o=g.document.createEvent("Event"); bb+2,8);sa.fillStyle="#777"}else{Ma=(va+"").split("");for(va=0;va<Ma.length;va++){sa.fillText(Ma[va],1,bb+9+va*9);sa.fillStyle="#777"}}Ma=Ua/10;for(va=1;va<10;va++){var wb=Math.round(bb+Ma*va)+0.5;if(Ha&&wb>V){Ta++;sa.stroke();if(Ta>=Ha.length){va=10;bb=ga;continue}sa=Ha[Ta];bb-=3E4;wb=Math.round(bb+Ma*va)+0.5}var Eb=va%2?12:10;if(S){sa.moveTo(wb,15);sa.lineTo(wb,Eb)}else{sa.moveTo(15,wb);sa.lineTo(Eb,wb)}}}sa.strokeStyle="#666";sa.stroke()}}(function(){var g=window.opener;if(g)try{var o=g.document.createEvent("Event");
o.initEvent("svgEditorReady",true,true);g.document.documentElement.dispatchEvent(o)}catch(v){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var g=a.deparam.querystring(true);if(!a.isEmptyObject(g)){if(g.dimensions)g.dimensions=g.dimensions.split(",");if(g.extensions)g.extensions=g.extensions.split(",");if(g.bkgd_color)g.bkgd_color="#"+g.bkgd_color;svgEditor.setConfig(g);var o= o.initEvent("svgEditorReady",true,true);g.document.documentElement.dispatchEvent(o)}catch(v){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var g=a.deparam.querystring(true);if(!a.isEmptyObject(g)){if(g.dimensions)g.dimensions=g.dimensions.split(",");if(g.extensions)g.extensions=g.extensions.split(",");if(g.bkgd_color)g.bkgd_color="#"+g.bkgd_color;svgEditor.setConfig(g);var o=
g.source,v=a.param.querystring();if(!o)if(v.indexOf("source=data:")>=0)o=v.match(/source=(data:[^&]*)/)[1];if(o)if(o.indexOf("data:")===0){o=o.replace(/ /g,"+");b.loadFromDataURI(o)}else b.loadFromString(o);else if(v.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(v.substr(9));else g.url&&svgEditor.loadFromURL(g.url)}})();var s=function(){a.each(curConfig.extensions,function(){var g=this;a.getScript(curConfig.extPath+g,function(o){if(!o){o=document.createElement("script");o.src=curConfig.extPath+ g.source,v=a.param.querystring();if(!o)if(v.indexOf("source=data:")>=0)o=v.match(/source=(data:[^&]*)/)[1];if(o)if(o.indexOf("data:")===0){o=o.replace(/ /g,"+");b.loadFromDataURI(o)}else b.loadFromString(o);else if(v.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(v.substr(9));else g.url&&svgEditor.loadFromURL(g.url)}})();var s=function(){a.each(curConfig.extensions,function(){var g=this;a.getScript(curConfig.extPath+g,function(o){if(!o){o=document.createElement("script");o.src=curConfig.extPath+
g;document.querySelector("head").appendChild(o)}})})};document.location.protocol==="file:"?setTimeout(s,100):s();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png",node_delete:"node_delete.png", g;document.querySelector("head").appendChild(o)}})})};document.location.protocol==="file:"?setTimeout(s,100):s();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png",node_delete:"node_delete.png",
@ -391,45 +391,45 @@ align_left:"align-left.png",align_center:"align-center.png",align_right:"align-r
resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var g=a("#tools_left");if(g.length!=0){g.offset();g.outerHeight()}a(".tools_flyout").each(function(){var o= resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var g=a("#tools_left");if(g.length!=0){g.offset();g.outerHeight()}a(".tools_flyout").each(function(){var o=
a("#"+this.id+"_show"),v=o.attr("data-curopt");if(!o.children("svg, img").length){v=a(v).children().clone();if(v.length){v[0].removeAttribute("style");o.append(v)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(g){a("#base_unit_container").css({top:g.pageY-10,left:g.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter", a("#"+this.id+"_show"),v=o.attr("data-curopt");if(!o.children("svg, img").length){v=a(v).children().clone();if(v.length){v[0].removeAttribute("style");o.append(v)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(g){a("#base_unit_container").css({top:g.pageY-10,left:g.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",
function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=h=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};s=navigator.platform.indexOf("Mac")>=0;var C=navigator.userAgent.indexOf("AppleWebKit")>=0,p=s?"meta+":"ctrl+",L=h.pathActions,R=h.undoMgr,O=svgedit.utilities,K=curConfig.imgPath+ function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=h=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};s=navigator.platform.indexOf("Mac")>=0;var C=navigator.userAgent.indexOf("AppleWebKit")>=0,p=s?"meta+":"ctrl+",L=h.pathActions,R=h.undoMgr,O=svgedit.utilities,K=curConfig.imgPath+
"placeholder.svg",P=a("#workarea"),T=a("#cmenu_canvas"),M=null,ha=1,na="toolbars",fa="";s||a(".shortcut").each(function(){var g=a(this).text();a(this).text(g.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var g=a("#dialog_box"),o=a("#dialog_buttons"),v=function(D,H,J,X){a("#dialog_content").html("<p>"+H.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",D=="prompt");o.empty();var ca=a('<input type="button" value="'+ "placeholder.svg",P=a("#workarea"),T=a("#cmenu_canvas"),M=null,aa=1,qa="toolbars",ha="";s||a(".shortcut").each(function(){var g=a(this).text();a(this).text(g.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var g=a("#dialog_box"),o=a("#dialog_buttons"),v=function(D,H,J,X){a("#dialog_content").html("<p>"+H.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",D=="prompt");o.empty();var da=a('<input type="button" value="'+
uiStrings.common.ok+'">').appendTo(o);D!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(o).on("click, touchstart",function(){g.hide();J(false)});if(D=="prompt"){var S=a('<input type="text">').prependTo(o);S.val(X||"");S.bind("keydown","return",function(){ca.trigger("click touchstart")})}D=="process"&&ca.hide();g.show();ca.on("click touchstart",function(){g.hide();var W=D=="prompt"?S.val():true;J&&J(W)}).focus();D=="prompt"&&S.focus()};a.alert=function(D,H){v("alert", uiStrings.common.ok+'">').appendTo(o);D!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(o).on("click, touchstart",function(){g.hide();J(false)});if(D=="prompt"){var S=a('<input type="text">').prependTo(o);S.val(X||"");S.bind("keydown","return",function(){da.trigger("click touchstart")})}D=="process"&&da.hide();g.show();da.on("click touchstart",function(){g.hide();var V=D=="prompt"?S.val():true;J&&J(V)}).focus();D=="prompt"&&S.focus()};a.alert=function(D,H){v("alert",
D,H)};a.confirm=function(D,H){v("confirm",D,H)};a.process_cancel=function(D,H){v("process",D,H)};a.prompt=function(D,H,J){v("prompt",D,J,H)}})();var aa=function(){var g=a(".tool_button_current");if(g.length&&g[0].id!=="tool_select"){g.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}h.setMode("select")},V=null,ra=false,ia=false,da="",U=function(g,o){var v=h.getResolution();a("#svgcanvas").position();var D=h.setBBoxZoom(o, D,H)};a.confirm=function(D,H){v("confirm",D,H)};a.process_cancel=function(D,H){v("process",D,H)};a.prompt=function(D,H,J){v("prompt",D,J,H)}})();var ca=function(){var g=a(".tool_button_current");if(g.length&&g[0].id!=="tool_select"){g.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}h.setMode("select")},W=null,ra=false,ia=false,ea="",U=function(g,o){var v=h.getResolution();a("#svgcanvas").position();var D=h.setBBoxZoom(o,
P.width()-15,P.height()-15);if(D){var H=D.zoom;D=D.bbox;if(H<0.0010)xa({value:0.1});else{typeof animatedZoom!="undefined"&&g.cancelAnimationFrame(animatedZoom);var J=Date.now(),X=H-v.zoom;a("#zoom");var ca=v.zoom,S=function(W){W=(W-J)/500;W=Math.pow(W-1,3)+1;h.setZoom(ca+X*W);w();if(W<1)g.animatedZoom=requestAnimationFrame(S);else{a("#zoom").val(parseInt(H*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(H*100)+"]","#zoom_select").attr("selected","selected")}};S(Date.now()); P.width()-15,P.height()-15);if(D){var H=D.zoom;D=D.bbox;if(H<0.0010)xa({value:0.1});else{typeof animatedZoom!="undefined"&&g.cancelAnimationFrame(animatedZoom);var J=Date.now(),X=H-v.zoom;a("#zoom");var da=v.zoom,S=function(V){V=(V-J)/500;V=Math.pow(V-1,3)+1;h.setZoom(da+X*V);w();if(V<1)g.animatedZoom=requestAnimationFrame(S);else{a("#zoom").val(parseInt(H*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(H*100)+"]","#zoom_select").attr("selected","selected")}};S(Date.now());
h.getMode()=="zoom"&&D.width&&aa();Ab()}}};a("#cur_context_panel").delegate("a","click",function(){var g=a(this);g.attr("data-root")?h.leaveContext():h.setContext(g.text());return false});var Y=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},oa={},pa=function(g){a.each(g,function(o,v){var D=a(o).children(),H=o+"_show",J=a(H),X=false;D.addClass("tool_button").unbind("click mousedown mouseup").each(function(W){var Z=v[W];oa[Z.sel]=Z.fn;if(Z.isDefault)X=W;W=function(qa){var ta=Z;if(qa.type=== h.getMode()=="zoom"&&D.width&&ca();Ab()}}};a("#cur_context_panel").delegate("a","click",function(){var g=a(this);g.attr("data-root")?h.leaveContext():h.setContext(g.text());return false});var Y=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},na={},oa=function(g){a.each(g,function(o,v){var D=a(o).children(),H=o+"_show",J=a(H),X=false;D.addClass("tool_button").unbind("click mousedown mouseup").each(function(V){var Z=v[V];na[Z.sel]=Z.fn;if(Z.isDefault)X=V;V=function(pa){var ta=Z;if(pa.type===
"keydown"){var ga=a(ta.parent+"_show").hasClass("tool_button_current"),Ta=a(ta.parent+"_show").attr("data-curopt");a.each(g[Z.parent],function(sa,Ma){if(Ma.sel==Ta)ta=!qa.shiftKey||!ga?Ma:g[Z.parent][sa+1]||g[Z.parent][0]})}if(a(this).hasClass("disabled"))return false;Ya(H)&&ta.fn();var Ha=ta.icon?a.getSvgIcon(ta.icon,true):a(ta.sel).children().eq(0).clone();Ha[0].setAttribute("width",J.width());Ha[0].setAttribute("height",J.height());J.children(":not(.flyout_arrow_horiz)").remove();J.append(Ha).attr("data-curopt", "keydown"){var ga=a(ta.parent+"_show").hasClass("tool_button_current"),Ta=a(ta.parent+"_show").attr("data-curopt");a.each(g[Z.parent],function(sa,Ma){if(Ma.sel==Ta)ta=!pa.shiftKey||!ga?Ma:g[Z.parent][sa+1]||g[Z.parent][0]})}if(a(this).hasClass("disabled"))return false;Ya(H)&&ta.fn();var Ha=ta.icon?a.getSvgIcon(ta.icon,true):a(ta.sel).children().eq(0).clone();Ha[0].setAttribute("width",J.width());Ha[0].setAttribute("height",J.height());J.children(":not(.flyout_arrow_horiz)").remove();J.append(Ha).attr("data-curopt",
ta.sel)};a(this).mouseup(W);Z.key&&a(document).bind("keydown",Z.key[0]+" shift+"+Z.key[0],W)});if(X)J.attr("data-curopt",v[X].sel);else J.attr("data-curopt")||J.attr("data-curopt",v[0].sel);var ca,S=a(H).position();a(o).css({left:S.left+34,top:S.top+77});J.mousedown(function(W){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&Ya(H,false);if(J.hasClass("disabled"))return false;var Z=a(o),qa=S.left+34,ta=Z.width()*-1,ga=Z.data("shown_popop")? ta.sel)};a(this).mouseup(V);Z.key&&a(document).bind("keydown",Z.key[0]+" shift+"+Z.key[0],V)});if(X)J.attr("data-curopt",v[X].sel);else J.attr("data-curopt")||J.attr("data-curopt",v[0].sel);var da,S=a(H).position();a(o).css({left:S.left+34,top:S.top+77});J.mousedown(function(V){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&Ya(H,false);if(J.hasClass("disabled"))return false;var Z=a(o),pa=S.left+34,ta=Z.width()*-1,ga=Z.data("shown_popop")?
200:0;ca=setTimeout(function(){J.data("isLibrary")?Z.css("left",qa).show():Z.css("left",ta).show().animate({left:qa},50);Z.data("shown_popop",true)},ga);W.preventDefault()}).mouseup(function(){clearTimeout(ca);var W=a(this).attr("data-curopt");if(J.data("isLibrary")&&a(H.replace("_show","")).is(":visible"))Ya(H,true);else Ya(H)&&W in oa&&oa[W]()})});Ba()},la=function(g,o){return a("<div>",{"class":"tools_flyout",id:g}).appendTo("#svg_editor").append(o)},ma=function(){a(".tools_flyout").each(function(){var g= 200:0;da=setTimeout(function(){J.data("isLibrary")?Z.css("left",pa).show():Z.css("left",ta).show().animate({left:pa},50);Z.data("shown_popop",true)},ga);V.preventDefault()}).mouseup(function(){clearTimeout(da);var V=a(this).attr("data-curopt");if(J.data("isLibrary")&&a(H.replace("_show","")).is(":visible"))Ya(H,true);else Ya(H)&&V in na&&na[V]()})});Ba()},la=function(g,o){return a("<div>",{"class":"tools_flyout",id:g}).appendTo("#svg_editor").append(o)},ma=function(){a(".tools_flyout").each(function(){var g=
a("#"+this.id+"_show"),o=g.offset();g=g.outerWidth();a(this).css({left:(o.left+g)*ha,top:o.top})})},Ba=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show");if(!g.data("isLibrary")){var o=[];a(this).children().each(function(){o.push(this.title)});g[0].title=o.join(" / ")}})},Ea,Ia=function(g,o,v){var D=null;if(g.indexOf("url(#")===0){g=(g=h.getRefElem(g))?g.cloneNode(true):a("#"+v+"_color defs *")[0];D={alpha:o};D[g.tagName]=g}else D=g.indexOf("#")===0?{alpha:o,solidColor:g.substr(1)}: a("#"+this.id+"_show"),o=g.offset();g=g.outerWidth();a(this).css({left:(o.left+g)*aa,top:o.top})})},Ba=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show");if(!g.data("isLibrary")){var o=[];a(this).children().each(function(){o.push(this.title)});g[0].title=o.join(" / ")}})},Ea,Ia=function(g,o,v){var D=null;if(g.indexOf("url(#")===0){g=(g=h.getRefElem(g))?g.cloneNode(true):a("#"+v+"_color defs *")[0];D={alpha:o};D[g.tagName]=g}else D=g.indexOf("#")===0?{alpha:o,solidColor:g.substr(1)}:
{alpha:o,solidColor:"none"};return new a.jGraduate.Paint(D)},za=h.getResolution();if(curConfig.baseUnit!=="px"){za.w=svgedit.units.convertUnit(za.w)+curConfig.baseUnit;za.h=svgedit.units.convertUnit(za.h)+curConfig.baseUnit}var Ka=function(g){h.createLayer("background");cur_shape=h.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:za.w+2,height:za.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:g||"#fff",style:"pointer-events:none"}});h.setCurrentLayer("Layer 1");h.setCurrentLayerPosition("1")}; {alpha:o,solidColor:"none"};return new a.jGraduate.Paint(D)},za=h.getResolution();if(curConfig.baseUnit!=="px"){za.w=svgedit.units.convertUnit(za.w)+curConfig.baseUnit;za.h=svgedit.units.convertUnit(za.h)+curConfig.baseUnit}var Ka=function(g){h.createLayer("background");cur_shape=h.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:za.w+2,height:za.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:g||"#fff",style:"pointer-events:none"}});h.setCurrentLayer("Layer 1");h.setCurrentLayerPosition("1")};
document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");var Na=b.setImageURL=function(g){g||(g=K);h.setImageURL(g);a("#image_url").val(g)},Aa=function(){var g=V;if(g!=null&&!g.parentNode)g=null;if(ra&&ra[0]!=null&&!ra[0].parentNode)ra=false;var o=h.getCurrentDrawing().getCurrentLayerName(),v=h.getMode(),D=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,H=v=="pathedit";if(H){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide(); document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");var Na=b.setImageURL=function(g){g||(g=K);h.setImageURL(g);a("#image_url").val(g)},Aa=function(){var g=W;if(g!=null&&!g.parentNode)g=null;if(ra&&ra[0]!=null&&!ra[0].parentNode)ra=false;var o=h.getCurrentDrawing().getCurrentLayerName(),v=h.getMode(),D=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,H=v=="pathedit";if(H){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();
o=L.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!L.canDeleteNodes);Ib("#tool_openclose_path",L.closed_subpath?"open_path":"close_path");if(o){H=a("#seg_type");if(D){o.x=svgedit.units.convertUnit(o.x);o.y=svgedit.units.convertUnit(o.y)}a("#path_node_x").val(Math.round(o.x));a("#path_node_y").val(Math.round(o.y));o.type?H.val(o.type).removeAttr("disabled"):H.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected"); o=L.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!L.canDeleteNodes);Ib("#tool_openclose_path",L.closed_subpath?"open_path":"close_path");if(o){H=a("#seg_type");if(D){o.x=svgedit.units.convertUnit(o.x);o.y=svgedit.units.convertUnit(o.y)}a("#path_node_x").val(Math.round(o.x));a("#path_node_y").val(Math.round(o.y));o.type?H.val(o.type).removeAttr("disabled"):H.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");
a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var J=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(ra){ra=ra.filter(Boolean);(g=h.elementsAreSame(ra)?ra[0]:null)&&a("#tools_top").addClass("multiselected")}if(!g&&!ra){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(g!=null){a("#stroke_panel").show();var X=g.nodeName,ca=h.getRotationAngle(g); a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var J=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(ra){ra=ra.filter(Boolean);(g=h.elementsAreSame(ra)?ra[0]:null)&&a("#tools_top").addClass("multiselected")}if(!g&&!ra){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(g!=null){a("#stroke_panel").show();var X=g.nodeName,da=h.getRotationAngle(g);
a("#angle").val(Math.round(ca));ca=h.getBlur(g);a("#blur").val(ca);if(!H&&v!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var S,W;if(["g","polyline","path"].indexOf(X)>=0)if(v=h.getStrokedBBox([g])){S=v.x;W=v.y}if(D){S=svgedit.units.convertUnit(S);W=svgedit.units.convertUnit(W)}a("#"+X+"_x").val(Math.round(S));a("#"+X+"_y").val(Math.round(W));if(X==="polyline"){a("#path_x").val(Math.round(S));a("#path_y").val(Math.round(W))}["image","text","path","g","use"].indexOf(X)== a("#angle").val(Math.round(da));da=h.getBlur(g);a("#blur").val(da);if(!H&&v!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var S,V;if(["g","polyline","path"].indexOf(X)>=0)if(v=h.getStrokedBBox([g])){S=v.x;V=v.y}if(D){S=svgedit.units.convertUnit(S);V=svgedit.units.convertUnit(V)}a("#"+X+"_x").val(Math.round(S));a("#"+X+"_y").val(Math.round(V));if(X==="polyline"){a("#path_x").val(Math.round(S));a("#path_y").val(Math.round(V))}["image","text","path","g","use"].indexOf(X)==
-1&&a(".action_path_convert_selected").removeClass("disabled");X==="path"&&a(".action_path_selected").removeClass("disabled")}D=null;if(Z==="a"){D=h.getHref(g);a("#g_panel").show()}if(g.parentNode.tagName==="a")if(!a(g).siblings().length){a("#a_panel").show();D=h.getHref(g.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1", -1&&a(".action_path_convert_selected").removeClass("disabled");X==="path"&&a(".action_path_selected").removeClass("disabled")}D=null;if(Z==="a"){D=h.getHref(g);a("#g_panel").show()}if(g.parentNode.tagName==="a")if(!a(g).siblings().length){a("#a_panel").show();D=h.getHref(g.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1",
"y1","x2","y2"],text:["x","y"],use:[],path:[]};var Z=g.tagName;a(g).data("gsvg")&&a("#g_panel").show();if(Z=="path"||Z=="polyline")a("#path_panel").show();if(D[Z]){D=D[Z];a("#"+Z+"_panel").show();Z=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(D,function(qa,ta){var ga=g.getAttribute(ta);if(curConfig.baseUnit!=="px"&&g[ta])ga=svgedit.units.convertUnit(g[ta].baseVal.value);var Ta=document.getElementById(Z+"_"+ta);Ta.value=Math.round(ga)||0;Ta.getAttribute("data-cursor")=== "y1","x2","y2"],text:["x","y"],use:[],path:[]};var Z=g.tagName;a(g).data("gsvg")&&a("#g_panel").show();if(Z=="path"||Z=="polyline")a("#path_panel").show();if(D[Z]){D=D[Z];a("#"+Z+"_panel").show();Z=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(D,function(pa,ta){var ga=g.getAttribute(ta);if(curConfig.baseUnit!=="px"&&g[ta])ga=svgedit.units.convertUnit(g[ta].baseVal.value);var Ta=document.getElementById(Z+"_"+ta);Ta.value=Math.round(ga)||0;Ta.getAttribute("data-cursor")===
"true"&&a.fn.dragInput.updateCursor(Ta)});if(Z=="text"){D=g.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",h.getItalic());a("#tool_bold").toggleClass("active",h.getBold());a("#font_family").val(D);a("#font_size").val(g.getAttribute("font-size"));a("#text").val(g.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);h.addedNew&&setTimeout(function(){a("#text").focus().select()}, "true"&&a.fn.dragInput.updateCursor(Ta)});if(Z=="text"){D=g.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",h.getItalic());a("#tool_bold").toggleClass("active",h.getBold());a("#font_family").val(D);a("#font_size").val(g.getAttribute("font-size"));a("#text").val(g.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);h.addedNew&&setTimeout(function(){a("#text").focus().select()},
100)}else if(Z=="image")Na(h.getHref(g));else if(Z==="g"||Z==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");h.getTitle()}}J[(Z==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");J[(Z==="g"||!ra?"dis":"en")+"ableContextMenuItems"]("#group")}if(ra){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");J.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}g||J.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back"); 100)}else if(Z=="image")Na(h.getHref(g));else if(Z==="g"||Z==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");h.getTitle()}}J[(Z==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");J[(Z==="g"||!ra?"dis":"en")+"ableContextMenuItems"]("#group")}if(ra){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");J.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}g||J.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
R.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");R.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");h.addedNew=false;if(g&&!H||ra){a("#selLayerNames").removeAttr("disabled").val(o);T.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});h.bind("selected",function(g,o){var v=h.getMode();v==="select"&& R.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");R.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");h.addedNew=false;if(g&&!H||ra){a("#selLayerNames").removeAttr("disabled").val(o);T.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});h.bind("selected",function(g,o){var v=h.getMode();v==="select"&&
aa();if(v==="pathedit")return Aa();V=o.length==1||o[1]==null?o[0]:null;o=o.filter(Boolean);ra=o.length>=2?o:false;if(h.elementsAreSame(ra))V=ra[0];if(V!=null){a("#multiselected_panel").hide();if(V!=null)switch(V.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":v=null;for(var D=V.getElementsByTagName("*"),H=0,J=D.length;H<J;H++){var X=D[H].getAttribute("stroke-width");if(H===0)v=X;else if(v!==X)v=null}a("#stroke_width").val(v===null?"":v);break;default:a("#stroke_width").val(V.getAttribute("stroke-width")|| ca();if(v==="pathedit")return Aa();W=o.length==1||o[1]==null?o[0]:null;o=o.filter(Boolean);ra=o.length>=2?o:false;if(h.elementsAreSame(ra))W=ra[0];if(W!=null){a("#multiselected_panel").hide();if(W!=null)switch(W.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":v=null;for(var D=W.getElementsByTagName("*"),H=0,J=D.length;H<J;H++){var X=D[H].getAttribute("stroke-width");if(H===0)v=X;else if(v!==X)v=null}a("#stroke_width").val(v===null?"":v);break;default:a("#stroke_width").val(W.getAttribute("stroke-width")||
1);v=V.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+v+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);v=V.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+v).length!=0&&d(a("#linejoin_"+v)[0]);v=V.getAttribute("stroke-linecap")||"butt";a("#linecap_"+v).length!=0&&d(a("#linecap_"+v)[0])}if(V!=null){v=(V.getAttribute("opacity")||1)*100;a("#group_opacity").val(v); 1);v=W.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+v+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);v=W.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+v).length!=0&&d(a("#linejoin_"+v)[0]);v=W.getAttribute("stroke-linecap")||"butt";a("#linecap_"+v).length!=0&&d(a("#linecap_"+v)[0])}if(W!=null){v=(W.getAttribute("opacity")||1)*100;a("#group_opacity").val(v);
a.fn.dragInput.updateCursor(a("#group_opacity")[0])}ra.length&&a("#tools_top").addClass("multiselected")}else if(ra.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}h.runExtensions("selectedChanged",{elems:o,selectedElement:V,multiselected:ra})});h.bind("transition",function(g,o){var v=h.getMode(),D=o[0];if(D){ra=o.length>=2&&o[1]!= a.fn.dragInput.updateCursor(a("#group_opacity")[0])}ra.length&&a("#tools_top").addClass("multiselected")}else if(ra.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}h.runExtensions("selectedChanged",{elems:o,selectedElement:W,multiselected:ra})});h.bind("transition",function(g,o){var v=h.getMode(),D=o[0];if(D){ra=o.length>=2&&o[1]!=
null?o:null;if(!ra)switch(v){case "rotate":v=h.getRotationAngle(D);a("#angle").val(Math.round(v));rotateCursor(v);a("#tool_reorient").toggleClass("disabled",v==0)}h.runExtensions("elementTransition",{elems:o})}});h.bind("changed",function(g,o){var v=h.getMode();v==="select"&&aa();for(var D=0;D<o.length;++D){var H=o[D];if(H&&H.tagName==="svg")w();else if(H&&V&&V.parentNode==null)V=H}b.show_save_warning=true;Aa();if(V&&v==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}h.runExtensions("elementChanged", null?o:null;if(!ra)switch(v){case "rotate":v=h.getRotationAngle(D);a("#angle").val(Math.round(v));rotateCursor(v);a("#tool_reorient").toggleClass("disabled",v==0)}h.runExtensions("elementTransition",{elems:o})}});h.bind("changed",function(g,o){var v=h.getMode();v==="select"&&ca();for(var D=0;D<o.length;++D){var H=o[D];if(H&&H.tagName==="svg")w();else if(H&&W&&W.parentNode==null)W=H}b.show_save_warning=true;Aa();if(W&&v==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}h.runExtensions("elementChanged",
{elems:o})});h.bind("saved",function(g,o){b.show_save_warning=false;o='<?xml version="1.0"?>\n'+o;var v=navigator.userAgent;if(~v.indexOf("Chrome")&&a.browser.version>=533||~v.indexOf("MSIE"))kb(0,true);else{var D=g.open("data:image/svg+xml;base64,"+O.encode64(o)),H=a.pref("save_notice_done");if(H!=="all"){var J=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(v.indexOf("Gecko/")!==-1)if(o.indexOf("<defs")!==-1){J+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done", {elems:o})});h.bind("saved",function(g,o){b.show_save_warning=false;o='<?xml version="1.0"?>\n'+o;var v=navigator.userAgent;if(~v.indexOf("Chrome")&&a.browser.version>=533||~v.indexOf("MSIE"))kb(0,true);else{var D=g.open("data:image/svg+xml;base64,"+O.encode64(o)),H=a.pref("save_notice_done");if(H!=="all"){var J=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(v.indexOf("Gecko/")!==-1)if(o.indexOf("<defs")!==-1){J+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done",
"all");H="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");H!=="part"&&D.alert(J)}}});h.bind("exported",function(g,o){var v=o.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=h.contentW;D.height=h.contentH;canvg(D,o.svg,{renderCallback:function(){var H=D.toDataURL("image/png");M.location.href=H;if(a.pref("export_notice_done")!=="all"){H=uiStrings.notification.saveFromBrowser.replace("%s", "all");H="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");H!=="part"&&D.alert(J)}}});h.bind("exported",function(g,o){var v=o.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=h.contentW;D.height=h.contentH;canvg(D,o.svg,{renderCallback:function(){var H=D.toDataURL("image/png");M.location.href=H;if(a.pref("export_notice_done")!=="all"){H=uiStrings.notification.saveFromBrowser.replace("%s",
"PNG");if(v.length)H+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+v.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(H)}}})});h.bind("zoomed",U);h.bind("contextset",function(g,o){var v="";if(o){var D="";v='<a href="#" data-root="y">'+h.getCurrentDrawing().getCurrentLayerName()+"</a>";a(o).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;v+=this!==o?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!o).html(v)}); "PNG");if(v.length)H+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+v.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(H)}}})});h.bind("zoomed",U);h.bind("contextset",function(g,o){var v="";if(o){var D="";v='<a href="#" data-root="y">'+h.getCurrentDrawing().getCurrentLayerName()+"</a>";a(o).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;v+=this!==o?' > <a href="#">'+this.id+"</a>":" > "+this.id}});ea=D}else ea=null;a("#cur_context_panel").toggle(!!o).html(v)});
h.bind("extension_added",function(g,o){function v(){if(Ea){clearTimeout(Ea);Ea=null}H||(Ea=setTimeout(function(){H=true;Kb(u.iconsize)},50))}var D=false,H=false,J=true,X=function(){if(o.callback&&!D&&J){D=true;o.callback()}},ca=[];o.context_tools&&a.each(o.context_tools,function(ta,ga){var Ta=ga.container_id?' id="'+ga.container_id+'"':"",Ha=a("#"+ga.panel);Ha.length||(Ha=a("<div>",{id:ga.panel}).appendTo("#tools_top").hide());switch(ga.type){case "tool_button":var sa='<div class="tool_button">'+ h.bind("extension_added",function(g,o){function v(){if(Ea){clearTimeout(Ea);Ea=null}H||(Ea=setTimeout(function(){H=true;Kb(u.iconsize)},50))}var D=false,H=false,J=true,X=function(){if(o.callback&&!D&&J){D=true;o.callback()}},da=[];o.context_tools&&a.each(o.context_tools,function(ta,ga){var Ta=ga.container_id?' id="'+ga.container_id+'"':"",Ha=a("#"+ga.panel);Ha.length||(Ha=a("<div>",{id:ga.panel}).appendTo("#tools_top").hide());switch(ga.type){case "tool_button":var sa='<div class="tool_button">'+
ga.id+"</div>",Ma=a(sa).appendTo(Ha);ga.events&&a.each(ga.events,function(Ua,bb){a(Ma).bind(Ua,bb)});break;case "select":sa="<label"+Ta+'><select id="'+ga.id+'">';a.each(ga.options,function(Ua,bb){sa+='<option value="'+Ua+'"'+(Ua==ga.defval?" selected":"")+">"+bb+"</option>"});sa+="</select></label>";var va=a(sa).appendTo(Ha).find("select");a.each(ga.events,function(Ua,bb){a(va).bind(Ua,bb)});break;case "button-select":sa='<div id="'+ga.id+'" class="dropdown toolset" title="'+ga.title+'"><div id="cur_'+ ga.id+"</div>",Ma=a(sa).appendTo(Ha);ga.events&&a.each(ga.events,function(Ua,bb){a(Ma).bind(Ua,bb)});break;case "select":sa="<label"+Ta+'><select id="'+ga.id+'">';a.each(ga.options,function(Ua,bb){sa+='<option value="'+Ua+'"'+(Ua==ga.defval?" selected":"")+">"+bb+"</option>"});sa+="</select></label>";var va=a(sa).appendTo(Ha).find("select");a.each(ga.events,function(Ua,bb){a(va).bind(Ua,bb)});break;case "button-select":sa='<div id="'+ga.id+'" class="dropdown toolset" title="'+ga.title+'"><div id="cur_'+
ga.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ga.id+'_opts"></ul>').appendTo("#option_lists");ga.colnum&&Ta.addClass("optcols"+ga.colnum);a(sa).appendTo(Ha).children();ca.push({elem:"#"+ga.id,list:"#"+ga.id+"_opts",title:ga.title,callback:ga.events.change,cur:"#cur_"+ga.id});break;case "input":sa="<label"+Ta+'><span id="'+ga.id+'_label">'+ga.label+':</span><input id="'+ga.id+'" title="'+ga.title+'" size="'+(ga.size||"4")+'" value="'+(ga.defval||"")+'" type="text"/></label>'; ga.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ga.id+'_opts"></ul>').appendTo("#option_lists");ga.colnum&&Ta.addClass("optcols"+ga.colnum);a(sa).appendTo(Ha).children();da.push({elem:"#"+ga.id,list:"#"+ga.id+"_opts",title:ga.title,callback:ga.events.change,cur:"#cur_"+ga.id});break;case "input":sa="<label"+Ta+'><span id="'+ga.id+'_label">'+ga.label+':</span><input id="'+ga.id+'" title="'+ga.title+'" size="'+(ga.size||"4")+'" value="'+(ga.defval||"")+'" type="text"/></label>';
var Za=a(sa).appendTo(Ha).find("input");ga.spindata&&Za.SpinButton(ga.spindata);ga.events&&a.each(ga.events,function(Ua,bb){Za.bind(Ua,bb)})}});if(o.buttons){var S={},W={},Z=o.svgicons,qa={};a.each(o.buttons,function(ta,ga){for(var Ta,Ha=ga.id,sa=ta;a("#"+Ha).length;)Ha=ga.id+"_"+ ++sa;if(Z){S[Ha]=ga.icon;sa=ga.svgicon?ga.svgicon:ga.id;if(ga.type=="app_menu")W["#"+Ha+" > div"]=sa;else W["#"+Ha]=sa}else Ta=ga.type=="menu"?"":a('<img src="'+ga.icon+'">');var Ma,va;switch(ga.type){case "mode_flyout":case "mode":Ma= var Za=a(sa).appendTo(Ha).find("input");ga.spindata&&Za.SpinButton(ga.spindata);ga.events&&a.each(ga.events,function(Ua,bb){Za.bind(Ua,bb)})}});if(o.buttons){var S={},V={},Z=o.svgicons,pa={};a.each(o.buttons,function(ta,ga){for(var Ta,Ha=ga.id,sa=ta;a("#"+Ha).length;)Ha=ga.id+"_"+ ++sa;if(Z){S[Ha]=ga.icon;sa=ga.svgicon?ga.svgicon:ga.id;if(ga.type=="app_menu")V["#"+Ha+" > div"]=sa;else V["#"+Ha]=sa}else Ta=ga.type=="menu"?"":a('<img src="'+ga.icon+'">');var Ma,va;switch(ga.type){case "mode_flyout":case "mode":Ma=
"tool_button";if(ga.cls)Ma+=" "+ga.cls;va="#tools_left";break;case "context":Ma="tool_button";va="#"+ga.panel;a(va).length||a("<div>",{id:ga.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";va="#"+(ga.after||ga.panel);break;case "app_menu":Ma="";va=ga.parent||"#main_menu ul";a(va).length||a("<div>",{id:ga.panel}).appendTo("#tools_top")}var Za=a(ga.list||ga.type=="app_menu"?"<li/>":"<div/>").attr("id",Ha).attr("title",ga.title).addClass(Ma);if(!ga.includeWith&&!ga.list){if("position"in "tool_button";if(ga.cls)Ma+=" "+ga.cls;va="#tools_left";break;case "context":Ma="tool_button";va="#"+ga.panel;a(va).length||a("<div>",{id:ga.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";va="#"+(ga.after||ga.panel);break;case "app_menu":Ma="";va=ga.parent||"#main_menu ul";a(va).length||a("<div>",{id:ga.panel}).appendTo("#tools_top")}var Za=a(ga.list||ga.type=="app_menu"?"<li/>":"<div/>").attr("id",Ha).attr("title",ga.title).addClass(Ma);if(!ga.includeWith&&!ga.list){if("position"in
ga)a(va).children().eq(ga.position).before(Za);else ga.type!="menu"||!ga.after?Za.appendTo(va):a(va).after(Za);if(ga.type=="mode_flyout"){sa=a(Za);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){var Ua=sa[0].id.replace("tool_","tools_"),bb=sa.clone().attr("id",Ua+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));sa.before(bb);Ma=la(Ua,sa);Ma.data("isLibrary",true);bb.data("isLibrary",true)}W["#"+Ua+"_show"]=ga.id;Ha=qa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,isDefault:true}, ga)a(va).children().eq(ga.position).before(Za);else ga.type!="menu"||!ga.after?Za.appendTo(va):a(va).after(Za);if(ga.type=="mode_flyout"){sa=a(Za);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){var Ua=sa[0].id.replace("tool_","tools_"),bb=sa.clone().attr("id",Ua+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));sa.before(bb);Ma=la(Ua,sa);Ma.data("isLibrary",true);bb.data("isLibrary",true)}V["#"+Ua+"_show"]=ga.id;Ha=pa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,isDefault:true},
Fb]}else if(ga.type=="app_menu"||ga.type=="menu")Za.append(ga.title)}else if(ga.list){Za.addClass("push_button");a("#"+ga.list+"_opts").append(Za);if(ga.isDefault){a("#cur_"+ga.list).append(Za.children().clone());sa=ga.svgicon?ga.svgicon:ga.id;W["#cur_"+ga.list]=sa}}else if(ga.includeWith){va=ga.includeWith;sa=a(va.button);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){Ua=sa[0].id.replace("tool_","tools_");bb=sa.clone().attr("id",Ua+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"})); Fb]}else if(ga.type=="app_menu"||ga.type=="menu")Za.append(ga.title)}else if(ga.list){Za.addClass("push_button");a("#"+ga.list+"_opts").append(Za);if(ga.isDefault){a("#cur_"+ga.list).append(Za.children().clone());sa=ga.svgicon?ga.svgicon:ga.id;V["#cur_"+ga.list]=sa}}else if(ga.includeWith){va=ga.includeWith;sa=a(va.button);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){Ua=sa[0].id.replace("tool_","tools_");bb=sa.clone().attr("id",Ua+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));
sa.before(bb);Ma=la(Ua,sa)}var Fb=B.getButtonData(va.button);if(va.isDefault)W["#"+Ua+"_show"]=ga.id;Ha=qa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,key:ga.key,isDefault:ga.includeWith?ga.includeWith.isDefault:0},Fb];Ua="position"in va?va.position:"last";Fb=Ma.children().length;if(!isNaN(Ua)&&Ua>=0&&Ua<Fb)Ma.children().eq(Ua).before(Za);else{Ma.append(Za);Ha.reverse()}}Z||Za.append(Ta);ga.list||a.each(ga.events,function(wb,Eb){if(wb=="click")if(ga.type=="mode"){ga.includeWith?Za.bind(wb, sa.before(bb);Ma=la(Ua,sa)}var Fb=B.getButtonData(va.button);if(va.isDefault)V["#"+Ua+"_show"]=ga.id;Ha=pa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,key:ga.key,isDefault:ga.includeWith?ga.includeWith.isDefault:0},Fb];Ua="position"in va?va.position:"last";Fb=Ma.children().length;if(!isNaN(Ua)&&Ua>=0&&Ua<Fb)Ma.children().eq(Ua).before(Za);else{Ma.append(Za);Ha.reverse()}}Z||Za.append(Ta);ga.list||a.each(ga.events,function(wb,Eb){if(wb=="click")if(ga.type=="mode"){ga.includeWith?Za.bind(wb,
Eb):Za.bind(wb,function(){Ya(Za)&&Eb()});if(ga.key){a(document).bind("keydown",ga.key,Eb);ga.title&&Za.attr("title",ga.title+" ["+ga.key+"]")}}else Za.bind(wb,Eb);else Za.bind(wb,Eb)});pa(qa)});a.each(ca,function(){Wa(this.elem,this.list,this.callback,{seticon:true})});if(Z)J=false;a.svgIcons(Z,{w:27,h:27,id_match:false,no_img:!C,fallback:S,placement:W,callback:function(){u.iconsize&&u.iconsize!="m"&&v();J=true;X()}})}X()});h.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>'; Eb):Za.bind(wb,function(){Ya(Za)&&Eb()});if(ga.key){a(document).bind("keydown",ga.key,Eb);ga.title&&Za.attr("title",ga.title+" ["+ga.key+"]")}}else Za.bind(wb,Eb);else Za.bind(wb,Eb)});oa(pa)});a.each(da,function(){Wa(this.elem,this.list,this.callback,{seticon:true})});if(Z)J=false;a.svgIcons(Z,{w:27,h:27,id_match:false,no_img:!C,fallback:S,placement:V,callback:function(){u.iconsize&&u.iconsize!="m"&&v();J=true;X()}})}X()});h.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';
a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(g,o){ya+='<div class="palette_item" style="background-color: '+o+';" data-rgb="'+o+'"></div>'});a("#palette").append(ya); a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(g,o){ya+='<div class="palette_item" style="background-color: '+o+';" data-rgb="'+o+'"></div>'});a("#palette").append(ya);
var Ga=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(g){g="rotate("+g+"deg)";Ga.css({"-webkit-transform":g,"-moz-transform":g,"-o-transform":g,"-ms-transform":g,transform:g})};var xa=function(g){var o=g.value/100;if(o<0.0010)g.value=0.1;else{g=h.getZoom();U(window,{width:0,height:0,x:(P[0].scrollLeft+P.width()/2)/g,y:(P[0].scrollTop+P.height()/2)/g,zoom:o},true)}},nb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){h.setStrokeAttr("stroke-dasharray", var Ga=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(g){g="rotate("+g+"deg)";Ga.css({"-webkit-transform":g,"-moz-transform":g,"-o-transform":g,"-ms-transform":g,transform:g})};var xa=function(g){var o=g.value/100;if(o<0.0010)g.value=0.1;else{g=h.getZoom();U(window,{width:0,height:0,x:(P[0].scrollLeft+P.width()/2)/g,y:(P[0].scrollTop+P.height()/2)/g,zoom:o},true)}},nb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){h.setStrokeAttr("stroke-dasharray",
a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);nb()});a("#seg_type").change(function(){h.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){h.setFontFamily(this.value)});a("#text").keyup(function(){h.setTextContent(this.value)});changeAttribute=function(g){var o=g.getAttribute("data-attr"),v=g.getAttribute("data-multiplier")||1;v=parseFloat(v); a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);nb()});a("#seg_type").change(function(){h.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){h.setFontFamily(this.value)});a("#text").keyup(function(){h.setTextContent(this.value)});changeAttribute=function(g){var o=g.getAttribute("data-attr"),v=g.getAttribute("data-multiplier")||1;v=parseFloat(v);
v=g.value*v;if(!svgedit.units.isValidUnit(o,v,V)){a.alert(uiStrings.notification.invalidAttrValGiven);g.value=V.getAttribute(o);return false}h.changeSelectedAttributeNoUndo(o,v)};a("#palette").mouseover(function(){var g=a('<input type="hidden">');a(this).append(g);g.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var g=a("#tool_stroke").hasClass("active"),o=g?"stroke":"fill",v=a(this).attr("data-rgb"),D=null;if(v==="transparent"||v==="initial"||v==="#none"){v= v=g.value*v;if(!svgedit.units.isValidUnit(o,v,W)){a.alert(uiStrings.notification.invalidAttrValGiven);g.value=W.getAttribute(o);return false}h.changeSelectedAttributeNoUndo(o,v)};a("#palette").mouseover(function(){var g=a('<input type="hidden">');a(this).append(g);g.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var g=a("#tool_stroke").hasClass("active"),o=g?"stroke":"fill",v=a(this).attr("data-rgb"),D=null;if(v==="transparent"||v==="initial"||v==="#none"){v=
"none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:v.substr(1)});b.paintBox[o].setPaint(D);if(g){h.setColor("stroke",v);v!="none"&&h.getStrokeOpacity()!=1&&h.setPaintOpacity("stroke",1)}else{h.setColor("fill",v);v!="none"&&h.getFillOpacity()!=1&&h.setPaintOpacity("fill",1)}}).bind("contextmenu",function(g){g.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");m()},function(){a(".stroke_tool").css("display", "none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:v.substr(1)});b.paintBox[o].setPaint(D);if(g){h.setColor("stroke",v);v!="none"&&h.getStrokeOpacity()!=1&&h.setPaintOpacity("stroke",1)}else{h.setColor("fill",v);v!="none"&&h.getFillOpacity()!=1&&h.setPaintOpacity("fill",1)}}).bind("contextmenu",function(g){g.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");m()},function(){a(".stroke_tool").css("display",
"none");a(this).removeClass("expanded");m()});var Ya=function(g,o){if(a(g).hasClass("disabled"))return false;if(a(g).parent().hasClass("tools_flyout"))return true;var v=v||"normal";o||a(".tools_flyout").fadeOut(v);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(g).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var g=null,o=null,v=P[0],D=false,H=false;a("#svgcanvas").bind("mousemove mouseup touchend", "none");a(this).removeClass("expanded");m()});var Ya=function(g,o){if(a(g).hasClass("disabled"))return false;if(a(g).parent().hasClass("tools_flyout"))return true;var v=v||"normal";o||a(".tools_flyout").fadeOut(v);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(g).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var g=null,o=null,v=P[0],D=false,H=false;a("#svgcanvas").bind("mousemove mouseup touchend",
function(J){if(D!==false){v.scrollLeft-=J.clientX-g;v.scrollTop-=J.clientY-o;g=J.clientX;o=J.clientY;if(J.type==="mouseup"||J.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(J){if(J.button===1||H===true||J.originalEvent.touches&&J.originalEvent.touches.length>=2){D=true;g=J.clientX;o=J.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(J){J.preventDefault();h.spaceKey=H=true}).bind("keyup", function(J){if(D!==false){v.scrollLeft-=J.clientX-g;v.scrollTop-=J.clientY-o;g=J.clientX;o=J.clientY;if(J.type==="mouseup"||J.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(J){if(J.button===1||H===true||J.originalEvent.touches&&J.originalEvent.touches.length>=2){D=true;g=J.clientX;o=J.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(J){J.preventDefault();h.spaceKey=H=true}).bind("keyup",
@ -437,63 +437,63 @@ function(J){if(D!==false){v.scrollLeft-=J.clientX-g;v.scrollTop-=J.clientY-o;g=J
""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(g){Sa(g)});a("svg, body").on("mousedown touchstart",function(g){if(g.target.nodeName.toLowerCase()!=="input")if(!a(g.target).hasClass("menu_title")&&!a(g.target).parent().hasClass("menu_title"))!a(g.target).hasClass("disabled")&&a(g.target).hasClass("menu_item")?Sa(g):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(g,o,v,D){if(g.altKey){g.preventDefault(); ""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(g){Sa(g)});a("svg, body").on("mousedown touchstart",function(g){if(g.target.nodeName.toLowerCase()!=="input")if(!a(g.target).hasClass("menu_title")&&!a(g.target).parent().hasClass("menu_title"))!a(g.target).hasClass("disabled")&&a(g.target).hasClass("menu_item")?Sa(g):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(g,o,v,D){if(g.altKey){g.preventDefault();
zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+D*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");fb.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){fb.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(g,o,v){if(a(g).length!=0){var D=a(g).find("button"),H=a(g).find("ul").attr("id",a(g)[0].id+"-list");v||a("#option_lists").append(H);var J=false;v&& zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+D*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");fb.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){fb.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(g,o,v){if(a(g).length!=0){var D=a(g).find("button"),H=a(g).find("ul").attr("id",a(g)[0].id+"-list");v||a("#option_lists").append(H);var J=false;v&&
a(g).addClass("dropup");H.find("li").bind("mouseup",o);a(window).mouseup(function(){if(!J){D.removeClass("down");H.hide()}J=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");H.hide()}else{D.addClass("down");if(!v){var X=a(g).offset();H.css({top:X.top,left:X.left-110})}H.show();J=true}}).hover(function(){J=true}).mouseout(function(){J=false})}};var Wa=function(g,o,v,D){var H=a(g);o=a(o);var J=false,X=D.dropUp;X&&a(g).addClass("dropup");o.find("li").bind("mouseup",function(){if(D.seticon){Ib("#cur_"+ a(g).addClass("dropup");H.find("li").bind("mouseup",o);a(window).mouseup(function(){if(!J){D.removeClass("down");H.hide()}J=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");H.hide()}else{D.addClass("down");if(!v){var X=a(g).offset();H.css({top:X.top,left:X.left-110})}H.show();J=true}}).hover(function(){J=true}).mouseout(function(){J=false})}};var Wa=function(g,o,v,D){var H=a(g);o=a(o);var J=false,X=D.dropUp;X&&a(g).addClass("dropup");o.find("li").bind("mouseup",function(){if(D.seticon){Ib("#cur_"+
H[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}v.apply(this,arguments)});a(window).mouseup(function(){if(!J){H.removeClass("down");o.hide();o.css({top:0,left:0})}J=false});o.height();a(g).bind("mousedown",function(){var ca=a(g).offset();if(X){ca.top-=o.height();ca.left+=8}else ca.top+=a(g).height();a(o).offset(ca);if(H.hasClass("down")){H.removeClass("down");o.hide();o.css({top:0,left:0})}else{H.addClass("down");o.show();J=true;return false}}).hover(function(){J= H[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}v.apply(this,arguments)});a(window).mouseup(function(){if(!J){H.removeClass("down");o.hide();o.css({top:0,left:0})}J=false});o.height();a(g).bind("mousedown",function(){var da=a(g).offset();if(X){da.top-=o.height();da.left+=8}else da.top+=a(g).height();a(o).offset(da);if(H.hasClass("down")){H.removeClass("down");o.hide();o.css({top:0,left:0})}else{H.addClass("down");o.show();J=true;return false}}).hover(function(){J=
true}).mouseout(function(){J=false});D.multiclick&&o.mousedown(function(){J=true})};a("#font_family_dropdown").change(function(){var g=this.options[this.selectedIndex].value,o=this.options[this.selectedIndex].text;a("#preview_font").html(o).css("font-family",g);a("#font_family").val(g).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var g=this.id.replace("tool_pos","").charAt(0);h.alignSelectedElements(g,"page")})});(function(){var g,o=function(){a(g).blur()}; true}).mouseout(function(){J=false});D.multiclick&&o.mousedown(function(){J=true})};a("#font_family_dropdown").change(function(){var g=this.options[this.selectedIndex].value,o=this.options[this.selectedIndex].text;a("#preview_font").html(o).css("font-family",g);a("#font_family").val(g).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var g=this.id.replace("tool_pos","").charAt(0);h.alignSelectedElements(g,"page")})});(function(){var g,o=function(){a(g).blur()};
a("#svg_editor").find("button, select, input:not(#text)").focus(function(){g=this;na="toolbars";P.mousedown(o)}).blur(function(){na="canvas";P.unbind("mousedown",o);h.getMode()=="textedit"&&a("#text").focus()})})();var Ca=function(){Ya("#tool_select")&&h.setMode("select")},wa=function(){Ya("#tool_fhpath")&&h.setMode("fhpath")},db=function(){Ya("#tool_line")&&h.setMode("line")},La=function(){Ya("#tool_rect")&&h.setMode("rect")},Ra=function(){Ya("#tool_ellipse")&&h.setMode("ellipse")},Da=function(){Ya("#tool_image")&& a("#svg_editor").find("button, select, input:not(#text)").focus(function(){g=this;qa="toolbars";P.mousedown(o)}).blur(function(){qa="canvas";P.unbind("mousedown",o);h.getMode()=="textedit"&&a("#text").focus()})})();var Ca=function(){Ya("#tool_select")&&h.setMode("select")},wa=function(){Ya("#tool_fhpath")&&h.setMode("fhpath")},db=function(){Ya("#tool_line")&&h.setMode("line")},La=function(){Ya("#tool_rect")&&h.setMode("rect")},Ra=function(){Ya("#tool_ellipse")&&h.setMode("ellipse")},Da=function(){Ya("#tool_image")&&
h.setMode("image")},gb=function(){Ya("#tool_zoom")&&h.setMode("zoom")},rb=function(){if(Ya("#tool_zoom")){Bb();aa()}},Xa=function(){Ya("#tool_text")&&h.setMode("text")},ab=function(){Ya("#tool_path")&&h.setMode("path")},xb=function(){if(V!=null||ra)h.deleteSelectedElements()},ua=function(){if(V!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cutSelectedElements()}},jb=function(){if(V!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.copySelectedElements()}},hb=function(){window.event.type=== h.setMode("image")},gb=function(){Ya("#tool_zoom")&&h.setMode("zoom")},rb=function(){if(Ya("#tool_zoom")){Bb();ca()}},Xa=function(){Ya("#tool_text")&&h.setMode("text")},ab=function(){Ya("#tool_path")&&h.setMode("path")},xb=function(){if(W!=null||ra)h.deleteSelectedElements()},ua=function(){if(W!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cutSelectedElements()}},jb=function(){if(W!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.copySelectedElements()}},hb=function(){window.event.type===
"keydown"&&mb(a("#edit_menu"));var g=h.getZoom(),o=(P[0].scrollLeft+P.width()/2)/g-h.contentW;g=(P[0].scrollTop+P.height()/2)/g-h.contentH;h.pasteElements("point",o,g)},ub=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToTopSelectedElement()}},lb=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToBottomSelectedElement()}},eb=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Up")}},sb= "keydown"&&mb(a("#edit_menu"));var g=h.getZoom(),o=(P[0].scrollLeft+P.width()/2)/g-h.contentW;g=(P[0].scrollTop+P.height()/2)/g-h.contentH;h.pasteElements("point",o,g)},ub=function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToTopSelectedElement()}},lb=function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToBottomSelectedElement()}},eb=function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Up")}},sb=
function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Down")}},ob=function(g){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected(g)}},yb=function(){if(V!=null){h.convertToPath();elems=h.getSelectedElems();h.selectorManager.requestSelector(elems[0]).reset(elems[0]);h.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");h.setMode("pathedit");L.toEditMode(elems[0]);h.clearSelection();Aa()}}, function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Down")}},ob=function(g){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected(g)}},yb=function(){if(W!=null){h.convertToPath();elems=h.getSelectedElems();h.selectorManager.requestSelector(elems[0]).reset(elems[0]);h.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");h.setMode("pathedit");L.toEditMode(elems[0]);h.clearSelection();Aa()}},
zb=function(){V!=null&&L.reorient()},ja=function(){if(V!=null||ra)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(g){g&&h.makeHyperlink(g)})},ba=function(g,o){if(V!=null||ra){if(curConfig.gridSnapping){var v=h.getZoom()*curConfig.snappingStep;g*=v;o*=v}a("input").blur();h.moveSelectedElements(g,o)}},ka=function(){var g=!a("#tool_node_link").hasClass("checked");g?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked", zb=function(){W!=null&&L.reorient()},ja=function(){if(W!=null||ra)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(g){g&&h.makeHyperlink(g)})},ba=function(g,o){if(W!=null||ra){if(curConfig.gridSnapping){var v=h.getZoom()*curConfig.snappingStep;g*=v;o*=v}a("input").blur();h.moveSelectedElements(g,o)}},ka=function(){var g=!a("#tool_node_link").hasClass("checked");g?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
false);L.linkControlPoints(g)},N=function(){L.getNodePoint()&&L.clonePathNode()},Q=function(){L.getNodePoint()&&L.deletePathNode()},ea=function(){var g=a("#tool_add_subpath"),o=!g.hasClass("push_button_pressed");o?g.addClass("push_button_pressed").removeClass("tool_button"):g.removeClass("push_button_pressed").addClass("tool_button");L.addSubPath(o)},Fa=function(){L.opencloseSubPath()},Oa=function(){h.cycleElement(1)},Va=function(){h.cycleElement(0)},$a=function(g,o){if(!(V==null||ra)){g||(o*=-1); false);L.linkControlPoints(g)},N=function(){L.getNodePoint()&&L.clonePathNode()},Q=function(){L.getNodePoint()&&L.deletePathNode()},fa=function(){var g=a("#tool_add_subpath"),o=!g.hasClass("push_button_pressed");o?g.addClass("push_button_pressed").removeClass("tool_button"):g.removeClass("push_button_pressed").addClass("tool_button");L.addSubPath(o)},Fa=function(){L.opencloseSubPath()},Oa=function(){h.cycleElement(1)},Va=function(){h.cycleElement(0)},$a=function(g,o){if(!(W==null||ra)){g||(o*=-1);
var v=a("#angle").val()*1+o;h.setRotationAngle(v);Aa()}},qb=function(){var g=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(o){if(o){aa();h.clear();h.setResolution(g[0],g[1]);w(true);Bb();Aa();Y();h.runExtensions("onNewDocument")}})},Qa=function(){h.setBold(!h.getBold());Aa()},pb=function(){h.setItalic(!h.getItalic());Aa()},Pa=function(){if(!c.pngsave){var g=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+g+"</title><h1>"+g+"</h1>")}window.canvg? var v=a("#angle").val()*1+o;h.setRotationAngle(v);Aa()}},qb=function(){var g=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(o){if(o){ca();h.clear();h.setResolution(g[0],g[1]);w(true);Bb();Aa();Y();h.runExtensions("onNewDocument")}})},Qa=function(){h.setBold(!h.getBold());Aa()},pb=function(){h.setItalic(!h.getItalic());Aa()},Pa=function(){if(!c.pngsave){var g=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+g+"</title><h1>"+g+"</h1>")}window.canvg?
h.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){h.rasterExport()})})},tb=function(){h.open()},vb=function(){},mb=function(g){var o=g.prev();o.css("background","#09f");setTimeout(function(){o.css("background","")},200)},Gb=function(){if(R.getUndoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.undo()}},cb=function(){if(R.getRedoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.redo()}},Ja=function(){if(ra)h.groupSelectedElements(); h.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){h.rasterExport()})})},tb=function(){h.open()},vb=function(){},mb=function(g){var o=g.prev();o.css("background","#09f");setTimeout(function(){o.css("background","")},200)},Gb=function(){if(R.getUndoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.undo()}},cb=function(){if(R.getRedoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.redo()}},Ja=function(){if(ra)h.groupSelectedElements();
else V&&h.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cloneSelectedElements(20,20)},Lb=function(){var g=this.id.replace("tool_align","").charAt(0);h.alignSelectedElements(g,a("#align_relative_to").val())},Jb=function(){var g=document.querySelector("#tool_stroke rect"),o=document.querySelector("#tool_fill rect"),v=o.getAttribute("fill"),D=g.getAttribute("fill");g=parseFloat(g.getAttribute("stroke-opacity"));if(isNaN(g))g=100;o=parseFloat(o.getAttribute("fill-opacity")); else W&&h.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cloneSelectedElements(20,20)},Lb=function(){var g=this.id.replace("tool_align","").charAt(0);h.alignSelectedElements(g,a("#align_relative_to").val())},Jb=function(){var g=document.querySelector("#tool_stroke rect"),o=document.querySelector("#tool_fill rect"),v=o.getAttribute("fill"),D=g.getAttribute("fill");g=parseFloat(g.getAttribute("stroke-opacity"));if(isNaN(g))g=100;o=parseFloat(o.getAttribute("fill-opacity"));
if(isNaN(o))o=100;D=Ia(D,g,"stroke");v=Ia(v,o,"fill");b.paintBox.fill.setPaint(D,true);b.paintBox.stroke.setPaint(v,true)},Bb=function(g){var o=h.getResolution();g=g?o.zoom*g:1;a("#zoom").val(g*100);h.setZoom(g);Ab();w(true)},Ob=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");P.toggleClass("wireframe");if(!z){var g=a("#wireframe_rules");g.length?g.empty():a('<style id="wireframe_rules"></style>').appendTo("head"); if(isNaN(o))o=100;D=Ia(D,g,"stroke");v=Ia(v,o,"fill");b.paintBox.fill.setPaint(D,true);b.paintBox.stroke.setPaint(v,true)},Bb=function(g){var o=h.getResolution();g=g?o.zoom*g:1;a("#zoom").val(g*100);h.setZoom(g);Ab();w(true)},Ob=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");P.toggleClass("wireframe");if(!z){var g=a("#wireframe_rules");g.length?g.empty():a('<style id="wireframe_rules"></style>').appendTo("head");
Ab()}},Db=function(){var g=!a("#tool_snap").hasClass("push_button_pressed");g?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=g},Hb=function(){window.self!=window.top&&top.exit_fullscreen()},Pb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed"); Ab()}},Db=function(){var g=!a("#tool_snap").hasClass("push_button_pressed");g?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=g},Hb=function(){window.self!=window.top&&top.exit_fullscreen()},Pb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");
a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},Ab=function(){if(!z){var g="#workarea.wireframe #svgcontent * { stroke-width: "+1/h.getZoom()+"px; }";a("#wireframe_rules").text(P.hasClass("wireframe")?g:"")}},kb=function(g,o){if(!ia){ia=true;a("#save_output_btns").toggle(!!o);a("#tool_source_back").toggle(!o);var v=fa=h.getSvgString();a("#svg_source_textarea").val(v);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}}, a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},Ab=function(){if(!z){var g="#workarea.wireframe #svgcontent * { stroke-width: "+1/h.getZoom()+"px; }";a("#wireframe_rules").text(P.hasClass("wireframe")?g:"")}},kb=function(g,o){if(!ia){ia=true;a("#save_output_btns").toggle(!!o);a("#tool_source_back").toggle(!o);var v=ha=h.getSvgString();a("#svg_source_textarea").val(v);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},
Mb=function(){if(ia){if(h.setSvgString(a("#svg_source_textarea").val())){h.clearSelection();k();Bb();Y()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(g){if(!g)return false;h.clearSelection();k();Bb();Y()});aa()}},Ib=b.setIcon=function(g,o){var v=typeof o==="string"?a.getSvgIcon(o,true):o.clone();v?a(g).find("img").replaceWith(v):console.log("NOTE: Icon image missing: "+o)},Cb;Cb=function(){var g=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,o=document.getElementsByTagName("script")[0], Mb=function(){if(ia){if(h.setSvgString(a("#svg_source_textarea").val())){h.clearSelection();k();Bb();Y()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(g){if(!g)return false;h.clearSelection();k();Bb();Y()});ca()}},Ib=b.setIcon=function(g,o){var v=typeof o==="string"?a.getSvgIcon(o,true):o.clone();v?a(g).find("img").replaceWith(v):console.log("NOTE: Icon image missing: "+o)},Cb;Cb=function(){var g=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,o=document.getElementsByTagName("script")[0],
v;for(v in o.style)if(g.test(v))return v.match(g)[0];if("WebkitOpacity"in o.style)return"Webkit";if("KhtmlOpacity"in o.style)return"Khtml";return""}();var ib=function(g,o){Cb.toLowerCase();var v=["top","left","bottom","right"];g.each(function(){for(var D=a(this),H=D.outerWidth()*(o-1),J=D.outerHeight()*(o-1),X=0;X<4;X++){var ca=v[X],S=D.data("orig_margin-"+ca);if(S==null){S=parseInt(D.css("margin-"+ca));D.data("orig_margin-"+ca,S)}S=S*o;if(ca==="right")S+=H;else if(ca==="bottom")S+=J;D.css("margin-"+ v;for(v in o.style)if(g.test(v))return v.match(g)[0];if("WebkitOpacity"in o.style)return"Webkit";if("KhtmlOpacity"in o.style)return"Khtml";return""}();var ib=function(g,o){Cb.toLowerCase();var v=["top","left","bottom","right"];g.each(function(){for(var D=a(this),H=D.outerWidth()*(o-1),J=D.outerHeight()*(o-1),X=0;X<4;X++){var da=v[X],S=D.data("orig_margin-"+da);if(S==null){S=parseInt(D.css("margin-"+da));D.data("orig_margin-"+da,S)}S=S*o;if(da==="right")S+=H;else if(da==="bottom")S+=J;D.css("margin-"+
ca,S)}})},Kb=b.setIconSize=function(g,o){if(!(g==u.size&&!o)){var v=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof g=="number"?g:{s:0.75,m:1,l:1.25,xl:1.5}[g];b.tool_scale=ha=D;ma();var H=v.parents(":hidden");H.css("visibility","hidden").show();ib(v,D);H.css("visibility","visible").hide();v=a("#tool_size_rules");if(v.length)v.empty(); da,S)}})},Kb=b.setIconSize=function(g,o){if(!(g==u.size&&!o)){var v=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof g=="number"?g:{s:0.75,m:1,l:1.25,xl:1.5}[g];b.tool_scale=aa=D;ma();var H=v.parents(":hidden");H.css("visibility","hidden").show();ib(v,D);H.css("visibility","visible").hide();v=a("#tool_size_rules");if(v.length)v.empty();
else v=a('<style id="tool_size_rules"></style>').appendTo("head");if(g!="m"){var J="";a.each(cssResizeRules,function(X,ca){X="#svg_editor "+X.replace(/,/g,", #svg_editor");J+=X+"{";a.each(ca,function(S,W){if(typeof W==="number")var Z=W*D+"px";else if(W[g]||W.all)Z=W[g]||W.all;J+=S+":"+Z+";"});J+="}"});H="-"+Cb.toLowerCase()+"-";J+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+ else v=a('<style id="tool_size_rules"></style>').appendTo("head");if(g!="m"){var J="";a.each(cssResizeRules,function(X,da){X="#svg_editor "+X.replace(/,/g,", #svg_editor");J+=X+"{";a.each(da,function(S,V){if(typeof V==="number")var Z=V*D+"px";else if(V[g]||V.all)Z=V[g]||V.all;J+=S+":"+Z+";"});J+="}"});H="-"+Cb.toLowerCase()+"-";J+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
H+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+H+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+H+"transform: scale("+1/D+");}";v.text(J)}ma()}},e=function(){a("#dialog_box").hide();if(ia){if(ia)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(g){g&&k()}):k();m()}else da&&h.leaveContext()},k=function(){a("#svg_source_editor").hide();ia=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height(); H+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+H+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+H+"transform: scale("+1/D+");}";v.text(J)}ma()}},e=function(){a("#dialog_box").hide();if(ia){if(ia)ha!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(g){g&&k()}):k();m()}else ea&&h.leaveContext()},k=function(){a("#svg_source_editor").hide();ia=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
var m=a.noop;a(window).resize(function(){w()});(function(){P.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=P[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=P[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var g=h.getHref(V);g=g.indexOf("data:")===0?"":g;a.prompt(uiStrings.notification.enterNewImgURL,g,function(o){o&&Na(o)})});var A=function(g){var o=g[0].id=="stroke_color"?"stroke": var m=a.noop;a(window).resize(function(){w()});(function(){P.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=P[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=P[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var g=h.getHref(W);g=g.indexOf("data:")===0?"":g;a.prompt(uiStrings.notification.enterNewImgURL,g,function(o){o&&Na(o)})});var A=function(g){var o=g[0].id=="stroke_color"?"stroke":
"fill",v=g[0].id=="canvas_color";if(v)o="canvas";var D=b.paintBox[o].paint;g=o=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";v=v?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(v).jGraduate({paint:D,window:{pickerTitle:g},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(H){D=new a.jGraduate.Paint(H);b.paintBox[o].setPaint(D); "fill",v=g[0].id=="canvas_color";if(v)o="canvas";var D=b.paintBox[o].paint;g=o=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";v=v?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(v).jGraduate({paint:D,window:{pickerTitle:g},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(H){D=new a.jGraduate.Paint(H);b.paintBox[o].setPaint(D);
h.setPaint(o,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};s=function(g,o){var v=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(o=="stroke")D=curConfig.initStroke;if(o=="fill")D=curConfig.initFill;if(o=="canvas"&&v)if(v=v.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(v[1],10).toString(16)).slice(-2)+("0"+parseInt(v[2],10).toString(16)).slice(-2)+("0"+parseInt(v[3],10).toString(16)).slice(-2),opacity:1};v=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+ h.setPaint(o,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};s=function(g,o){var v=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(o=="stroke")D=curConfig.initStroke;if(o=="fill")D=curConfig.initFill;if(o=="canvas"&&v)if(v=v.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(v[1],10).toString(16)).slice(-2)+("0"+parseInt(v[2],10).toString(16)).slice(-2)+("0"+parseInt(v[3],10).toString(16)).slice(-2),opacity:1};v=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;v=a(g)[0].appendChild(document.importNode(v,true));o==="canvas"?v.setAttribute("width",60.5):v.setAttribute("width","100%");this.rect=v.firstChild;this.defs=v.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=o;this.setPaint=function(H,J){this.paint=H;var X="none",ca=H.type,S=H.alpha/100;switch(ca){case "solidColor":X= D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;v=a(g)[0].appendChild(document.importNode(v,true));o==="canvas"?v.setAttribute("width",60.5):v.setAttribute("width","100%");this.rect=v.firstChild;this.defs=v.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=o;this.setPaint=function(H,J){this.paint=H;var X="none",da=H.type,S=H.alpha/100;switch(da){case "solidColor":X=
H[ca]=="none"||H[ca]=="one"?"none":"#"+H[ca];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(H[ca]);X="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",X);this.rect.setAttribute("opacity",S);if(J){h.setColor(this.type,X,true);h.setPaintOpacity(this.type,S,true)}if(this.type=="canvas")if(ca=document.getElementById("canvas_background")){za=h.getResolution();ca.setAttribute("x",-1);ca.setAttribute("y",-1); H[da]=="none"||H[da]=="one"?"none":"#"+H[da];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(H[da]);X="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",X);this.rect.setAttribute("opacity",S);if(J){h.setColor(this.type,X,true);h.setPaintOpacity(this.type,S,true)}if(this.type=="canvas")if(da=document.getElementById("canvas_background")){za=h.getResolution();da.setAttribute("x",-1);da.setAttribute("y",-1);
ca.setAttribute("width",za.w+2);ca.setAttribute("height",za.h+2);ca.setAttribute("fill",X)}else Ka(X)};this.update=function(H){if(V){var J=this.type;switch(V.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var X=null,ca=V.getElementsByTagName("*"),S=0,W=ca.length;S<W;S++){var Z=ca[S].getAttribute(J);if(S===0)X=Z;else if(X!==Z){X=null;break}}if(X===null){ca=null;return}ca=X;X=1;break;default:X=parseFloat(V.getAttribute(J+"-opacity"));if(isNaN(X))X=1;ca=J==="fill"? da.setAttribute("width",za.w+2);da.setAttribute("height",za.h+2);da.setAttribute("fill",X)}else Ka(X)};this.update=function(H){if(W){var J=this.type;switch(W.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var X=null,da=W.getElementsByTagName("*"),S=0,V=da.length;S<V;S++){var Z=da[S].getAttribute(J);if(S===0)X=Z;else if(X!==Z){X=null;break}}if(X===null){da=null;return}da=X;X=1;break;default:X=parseFloat(W.getAttribute(J+"-opacity"));if(isNaN(X))X=1;da=J==="fill"?
"black":"none";ca=V.getAttribute(J)||ca}if(H){h.setColor(J,ca,true);h.setPaintOpacity(J,X,true)}X*=100;this.setPaint(Ia(ca,X,J))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var H=new a.jGraduate.Paint({copy:this.paint});h.setPaint(o,H)}}};b.paintBox.fill=new s("#fill_color","fill");b.paintBox.stroke=new s("#stroke_color","stroke");b.paintBox.canvas=new s("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity* "black":"none";da=W.getAttribute(J)||da}if(H){h.setColor(J,da,true);h.setPaintOpacity(J,X,true)}X*=100;this.setPaint(Ia(da,X,J))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var H=new a.jGraduate.Paint({copy:this.paint});h.setPaint(o,H)}}};b.paintBox.fill=new s("#fill_color","fill");b.paintBox.stroke=new s("#stroke_color","stroke");b.paintBox.canvas=new s("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*
100);s=b.paintBox.fill.rect.cloneNode(false);s.setAttribute("style","vector-effect:non-scaling-stroke");var z=s.style.vectorEffect==="non-scaling-stroke";s.removeAttribute("style");s=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof s.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(s).remove();setTimeout(function(){h.embedImage("images/placeholder.svg",function(g){if(!g){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]); 100);s=b.paintBox.fill.rect.cloneNode(false);s.setAttribute("style","vector-effect:non-scaling-stroke");var z=s.style.vectorEffect==="non-scaling-stroke";s.removeAttribute("style");s=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof s.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(s).remove();setTimeout(function(){h.embedImage("images/placeholder.svg",function(g){if(!g){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);
u.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))A(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))A(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart", u.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))A(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))A(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",
function(){A(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");A(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");A(a("#fill_color"))});a("#zoom_select").on("change",function(){var g=this.options[this.selectedIndex].text;g=g.split("%")[0];a("#zoom").val(g).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")|| function(){A(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");A(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");A(a("#fill_color"))});a("#zoom_select").on("change",function(){var g=this.options[this.selectedIndex].text;g=g.split("%")[0];a("#zoom").val(g).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||
a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){P.css("line-height",P.height()+"px")});var G=function(){var g=a("#canvas_width"),o=a("#canvas_height"),v=g.val(),D=o.val();if(v!="fit"&&!svgedit.units.isValidUnit("width",v)){a.alert(uiStrings.notification.invalidAttrValGiven); a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){P.css("line-height",P.height()+"px")});var G=function(){var g=a("#canvas_width"),o=a("#canvas_height"),v=g.val(),D=o.val();if(v!="fit"&&!svgedit.units.isValidUnit("width",v)){a.alert(uiStrings.notification.invalidAttrValGiven);
g.parent().addClass("error");return false}g.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);o.parent().addClass("error");return false}o.parent().removeClass("error");if(!h.setResolution(v,D)){a.alert(uiStrings.notification.noContentToFitTo);v=h.getResolution();g.val(v.w);o.val(v.h);return false}w()};a("#resolution").change(function(){var g=a("#canvas_width")[0],o=a("#canvas_height")[0];if(this.selectedIndex)if(this.value== g.parent().addClass("error");return false}g.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);o.parent().addClass("error");return false}o.parent().removeClass("error");if(!h.setResolution(v,D)){a.alert(uiStrings.notification.noContentToFitTo);v=h.getResolution();g.val(v.w);o.val(v.h);return false}w()};a("#resolution").change(function(){var g=a("#canvas_width")[0],o=a("#canvas_height")[0];if(this.selectedIndex)if(this.value==
"content"){g.value="fit";o.value="fit";G();var v=h.getResolution();g.value=v.w;o.value=v.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var H=D[0]-g.value,J=D[1]-o.value,X=Date.now(),ca=function(S){S=(S-X)/1E3;S=Math.pow(S-1,3)+1;g.value=(D[0]-H+S*H).toFixed(0);o.value=(D[1]-J+S*J).toFixed(0);G();if(S>=1){S=h.getResolution();a("#canvas_width").val(S.w.toFixed());a("#canvas_height").val(S.h.toFixed());a("#resolution_label").html("<div class='pull'>"+S.w+"<span>\u00d7</span></br>"+ "content"){g.value="fit";o.value="fit";G();var v=h.getResolution();g.value=v.w;o.value=v.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var H=D[0]-g.value,J=D[1]-o.value,X=Date.now(),da=function(S){S=(S-X)/1E3;S=Math.pow(S-1,3)+1;g.value=(D[0]-H+S*H).toFixed(0);o.value=(D[1]-J+S*J).toFixed(0);G();if(S>=1){S=h.getResolution();a("#canvas_width").val(S.w.toFixed());a("#canvas_height").val(S.h.toFixed());a("#resolution_label").html("<div class='pull'>"+S.w+"<span>\u00d7</span></br>"+
S.h+"</div>")}else requestAnimationFrame(ca)};ca(Date.now())}else{a("#resolution_label").html("Custom");g.removeAttribute("readonly");g.focus();g.select();if(g.value=="fit"){g.value=100;o.value=100}}});a("#zoom").change(function(){xa(this)});a("input,select").attr("autocomplete","off");var B=function(){var g=[{sel:"#tool_select",fn:Ca,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:wa,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:db,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:La,evt:"click", S.h+"</div>")}else requestAnimationFrame(da)};da(Date.now())}else{a("#resolution_label").html("Custom");g.removeAttribute("readonly");g.focus();g.select();if(g.value=="fit"){g.value=100;o.value=100}}});a("#zoom").change(function(){xa(this)});a("input,select").attr("autocomplete","off");var B=function(){var g=[{sel:"#tool_select",fn:Ca,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:wa,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:db,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:La,evt:"click",
key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ra,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:ab,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Xa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Da,evt:"mouseup"},{sel:"#tool_zoom",fn:gb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:qb,evt:"mouseup",key:[p+"N",true]},{sel:"#tool_save",fn:function(){ia?Mb():h.save({images:u.img_save,round_digits:6})},evt:"mouseup",key:[p+"S",true]},{sel:"#tool_export",fn:Pa,evt:"mouseup"}, key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ra,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:ab,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Xa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Da,evt:"mouseup"},{sel:"#tool_zoom",fn:gb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:qb,evt:"mouseup",key:[p+"N",true]},{sel:"#tool_save",fn:function(){ia?Mb():h.save({images:u.img_save,round_digits:6})},evt:"mouseup",key:[p+"S",true]},{sel:"#tool_export",fn:Pa,evt:"mouseup"},
{sel:"#tool_open",fn:tb,evt:"mouseup"},{sel:"#tool_import",fn:vb,evt:"mouseup"},{sel:"#tool_source",fn:kb,evt:"click",key:[p+"U",true]},{sel:"#tool_wireframe",fn:Ob,evt:"click"},{sel:"#tool_snap",fn:Db,evt:"click"},{sel:"#tool_rulers",fn:Pb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:e,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Mb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:xb,evt:"click",key:["del/backspace", {sel:"#tool_open",fn:tb,evt:"mouseup"},{sel:"#tool_import",fn:vb,evt:"mouseup"},{sel:"#tool_source",fn:kb,evt:"click",key:[p+"U",true]},{sel:"#tool_wireframe",fn:Ob,evt:"click"},{sel:"#tool_snap",fn:Db,evt:"click"},{sel:"#tool_rulers",fn:Pb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:e,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Mb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:xb,evt:"click",key:["del/backspace",
true]},{sel:"#tool_reorient",fn:zb,evt:"click"},{sel:"#tool_node_link",fn:ka,evt:"click"},{sel:"#tool_node_clone",fn:N,evt:"click"},{sel:"#tool_node_delete",fn:Q,evt:"click"},{sel:"#tool_openclose_path",fn:Fa,evt:"click"},{sel:"#tool_add_subpath",fn:ea,evt:"click"},{sel:"#tool_move_top",fn:ub,evt:"click",key:p+"shift+up"},{sel:"#tool_move_bottom",fn:lb,evt:"click",key:p+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[p+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[p+"down",true]}, true]},{sel:"#tool_reorient",fn:zb,evt:"click"},{sel:"#tool_node_link",fn:ka,evt:"click"},{sel:"#tool_node_clone",fn:N,evt:"click"},{sel:"#tool_node_delete",fn:Q,evt:"click"},{sel:"#tool_openclose_path",fn:Fa,evt:"click"},{sel:"#tool_add_subpath",fn:fa,evt:"click"},{sel:"#tool_move_top",fn:ub,evt:"click",key:p+"shift+up"},{sel:"#tool_move_bottom",fn:lb,evt:"click",key:p+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[p+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[p+"down",true]},
{sel:"#tool_topath",fn:yb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ja,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[p+"D",true]},{sel:"#tool_group",fn:Ja,evt:"click",key:[p+"G",true]},{sel:"#tool_ungroup",fn:Ja,evt:"click",key:p+"shift+G"},{sel:"#tool_unlink_use",fn:Ja,evt:"click"},{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:Gb,evt:"click",key:p+"z"},{sel:"#tool_redo",fn:cb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:ua,evt:"click", {sel:"#tool_topath",fn:yb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ja,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[p+"D",true]},{sel:"#tool_group",fn:Ja,evt:"click",key:[p+"G",true]},{sel:"#tool_ungroup",fn:Ja,evt:"click",key:p+"shift+G"},{sel:"#tool_unlink_use",fn:Ja,evt:"click"},{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:Gb,evt:"click",key:p+"z"},{sel:"#tool_redo",fn:cb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:ua,evt:"click",
key:[p+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:p+"c"},{sel:"#tool_paste",fn:hb,evt:"click",key:p+"v"},{sel:"#tool_switch",fn:Jb,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Qa,evt:"mousedown",key:[p+"B",true]},{sel:"#tool_italic",fn:pb,evt:"mousedown",key:[p+"I",true]},{sel:"#copy_save_done",fn:e,evt:"click"},{key:"ctrl+left",fn:function(){$a(0,1)}},{key:"ctrl+right",fn:function(){$a(1,1)}},{key:"ctrl+shift+left",fn:function(){$a(0,5)}},{key:"ctrl+shift+right",fn:function(){$a(1,5)}}, key:[p+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:p+"c"},{sel:"#tool_paste",fn:hb,evt:"click",key:p+"v"},{sel:"#tool_switch",fn:Jb,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Qa,evt:"mousedown",key:[p+"B",true]},{sel:"#tool_italic",fn:pb,evt:"mousedown",key:[p+"I",true]},{sel:"#copy_save_done",fn:e,evt:"click"},{key:"ctrl+left",fn:function(){$a(0,1)}},{key:"ctrl+right",fn:function(){$a(1,1)}},{key:"ctrl+shift+left",fn:function(){$a(0,5)}},{key:"ctrl+shift+right",fn:function(){$a(1,5)}},
{key:"shift+O",fn:Va},{key:"shift+P",fn:Oa},{key:[p+"+",true],fn:function(){Bb(2)}},{key:[p+"-",true],fn:function(){Bb(0.5)}},{key:["up",true],fn:function(){ba(0,-1)}},{key:["down",true],fn:function(){ba(0,1)}},{key:["left",true],fn:function(){ba(-1,0)}},{key:["right",true],fn:function(){ba(1,0)}},{key:"shift+up",fn:function(){ba(0,-10)}},{key:"shift+down",fn:function(){ba(0,10)}},{key:"shift+left",fn:function(){ba(-10,0)}},{key:"shift+right",fn:function(){ba(10,0)}},{key:["alt+up",true],fn:function(){h.cloneSelectedElements(0, {key:"shift+O",fn:Va},{key:"shift+P",fn:Oa},{key:[p+"+",true],fn:function(){Bb(2)}},{key:[p+"-",true],fn:function(){Bb(0.5)}},{key:["up",true],fn:function(){ba(0,-1)}},{key:["down",true],fn:function(){ba(0,1)}},{key:["left",true],fn:function(){ba(-1,0)}},{key:["right",true],fn:function(){ba(1,0)}},{key:"shift+up",fn:function(){ba(0,-10)}},{key:"shift+down",fn:function(){ba(0,10)}},{key:"shift+left",fn:function(){ba(-10,0)}},{key:"shift+right",fn:function(){ba(10,0)}},{key:["alt+up",true],fn:function(){h.cloneSelectedElements(0,
-1)}},{key:["alt+down",true],fn:function(){h.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){h.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){h.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){h.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){h.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){h.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){h.cloneSelectedElements(10, -1)}},{key:["alt+down",true],fn:function(){h.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){h.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){h.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){h.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){h.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){h.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){h.cloneSelectedElements(10,
0)}},{key:p+"A",fn:function(){h.selectAllInCurrentLayer()}},{key:"I",fn:function(){var v=a(".tool_button_current");if(v.length&&v[0].id!=="tool_eyedropper"){v.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}h.setMode("eyedropper")}},{key:p+"shift+z",fn:cb},{key:"esc",fn:Hb}],o={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var v={};a.each(g,function(D,H){if(H.sel){var J= 0)}},{key:p+"A",fn:function(){h.selectAllInCurrentLayer()}},{key:"I",fn:function(){var v=a(".tool_button_current");if(v.length&&v[0].id!=="tool_eyedropper"){v.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}h.setMode("eyedropper")}},{key:p+"shift+z",fn:cb},{key:"esc",fn:Hb}],o={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var v={};a.each(g,function(D,H){if(H.sel){var J=
a(H.sel);if(J.length==0)return true;if(H.evt){if(svgedit.browser.isTouch()&&H.evt==="click")H.evt="mousedown";J[H.evt](H.fn)}if(H.parent&&a(H.parent+"_show").length!=0){var X=a(H.parent);X.length||(X=la(H.parent.substr(1)));X.append(J);a.isArray(v[H.parent])||(v[H.parent]=[]);v[H.parent].push(H)}}if(H.key){var ca=H.fn,S=false;if(a.isArray(H.key)){X=H.key[0];if(H.key.length>1)S=H.key[1]}else X=H.key;X+="";svgedit.browser.isMac&&X.indexOf("+")!=-1&&X.split("+")[0]=="ctrl"&&X.replace("ctrl","cmd");a.each(X.split("/"), a(H.sel);if(J.length==0)return true;if(H.evt){if(svgedit.browser.isTouch()&&H.evt==="click")H.evt="mousedown";J[H.evt](H.fn)}if(H.parent&&a(H.parent+"_show").length!=0){var X=a(H.parent);X.length||(X=la(H.parent.substr(1)));X.append(J);a.isArray(v[H.parent])||(v[H.parent]=[]);v[H.parent].push(H)}}if(H.key){var da=H.fn,S=false;if(a.isArray(H.key)){X=H.key[0];if(H.key.length>1)S=H.key[1]}else X=H.key;X+="";svgedit.browser.isMac&&X.indexOf("+")!=-1&&X.split("+")[0]=="ctrl"&&X.replace("ctrl","cmd");a.each(X.split("/"),
function(Z,qa){a(document).bind("keydown",qa,function(ta){ca();S&&ta.preventDefault();return false})});if(H.sel&&!H.hidekey&&J.attr("title")){var W=J.attr("title").split("[")[0]+" ("+X+")";o[X]=H.sel;J.parents("#main_menu").length||J.attr("title",W)}}});pa(v);a(window).bind("keydown","tab",function(D){if(na==="canvas"){D.preventDefault();Oa()}}).bind("keydown","shift+tab",function(D){if(na==="canvas"){D.preventDefault();Va()}});a("#tool_zoom").dblclick(rb)},setTitles:function(){a.each(o,function(v, function(Z,pa){a(document).bind("keydown",pa,function(ta){da();S&&ta.preventDefault();return false})});if(H.sel&&!H.hidekey&&J.attr("title")){var V=J.attr("title").split("[")[0]+" ("+X+")";o[X]=H.sel;J.parents("#main_menu").length||J.attr("title",V)}}});oa(v);a(window).bind("keydown","tab",function(D){if(qa==="canvas"){D.preventDefault();Oa()}}).bind("keydown","shift+tab",function(D){if(qa==="canvas"){D.preventDefault();Va()}});a("#tool_zoom").dblclick(rb)},setTitles:function(){a.each(o,function(v,
D){var H=a(D).parents("#main_menu").length;a(D).each(function(){var J=H?a(this).text().split(" [")[0]:this.title.split(" [")[0],X="";a.each(v.split("/"),function(ca,S){var W=S.split("+"),Z="";if(W.length>1){Z=W[0]+"+";S=W[1]}X+=(ca?"/":"")+Z+(uiStrings["key_"+S]||S)});if(H)this.lastChild.textContent=J+" ["+X+"]";else this.title=J+" ["+X+"]"})})},getButtonData:function(v){var D;a.each(g,function(H,J){if(J.sel===v)D=J});return D}}}();B.setAll();b.ready(function(){var g=curConfig.initTool,o=a("#tools_left, #svg_editor .tools_flyout"), D){var H=a(D).parents("#main_menu").length;a(D).each(function(){var J=H?a(this).text().split(" [")[0]:this.title.split(" [")[0],X="";a.each(v.split("/"),function(da,S){var V=S.split("+"),Z="";if(V.length>1){Z=V[0]+"+";S=V[1]}X+=(da?"/":"")+Z+(uiStrings["key_"+S]||S)});if(H)this.lastChild.textContent=J+" ["+X+"]";else this.title=J+" ["+X+"]"})})},getButtonData:function(v){var D;a.each(g,function(H,J){if(J.sel===v)D=J});return D}}}();B.setAll();b.ready(function(){var g=curConfig.initTool,o=a("#tools_left, #svg_editor .tools_flyout"),
v=o.find("#tool_"+g);g=o.find("#"+g);(v.length?v:g.length?g:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false}); v=o.find("#tool_"+g);g=o.find("#"+g);(v.length?v:g.length?g:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});
a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1, a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1,
callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null, callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute, max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,
cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null, cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,
step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null, step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(g){var o=g.value;if(o==0&&V&&["line","polyline"].indexOf(V.nodeName)>=0)o=g.value=1;h.setStrokeWidth(o)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(g){h.setRotationAngle(g.value);rotateCursor(g.value);a("#tool_reorient").toggleClass("disabled", max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(g){var o=g.value;if(o==0&&W&&["line","polyline"].indexOf(W.nodeName)>=0)o=g.value=1;h.setStrokeWidth(o)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(g){h.setRotationAngle(g.value);rotateCursor(g.value);a("#tool_reorient").toggleClass("disabled",
g.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(g){h.setFontSize(g.value)},cursor:true,stepfunc:function(g,o){var v=g.value-0,D=v+o,H=D>=v;if(o===0)return v;return v>=24?H?Math.round(v*1.1):Math.round(v/1.1):v<=1?H?v*2:v/2:D},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(g){val=g.value;a("#blur").val(val); g.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(g){h.setFontSize(g.value)},cursor:true,stepfunc:function(g,o){var v=g.value-0,D=v+o,H=D>=v;if(o===0)return v;return v>=24?H?Math.round(v*1.1):Math.round(v/1.1):v<=1?H?v*2:v/2:D},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(g){val=g.value;a("#blur").val(val);
h.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(h.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(g){switch(g){case "delete":xb();break;case "cut":ua();break;case "copy":jb();break;case "paste":h.pasteElements();break;case "paste_in_place":h.pasteElements("in_place");break;case "group":h.groupSelectedElements();break;case "ungroup":h.ungroupSelectedElement();break;case "move_front":ub();break;case "move_up":ob("Up");break;case "move_down":ob("Down");break; h.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(h.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(g){switch(g){case "delete":xb();break;case "cut":ua();break;case "copy":jb();break;case "paste":h.pasteElements();break;case "paste_in_place":h.pasteElements("in_place");break;case "group":h.groupSelectedElements();break;case "ungroup":h.ungroupSelectedElement();break;case "move_front":ub();break;case "move_up":ob("Up");break;case "move_down":ob("Down");break;
case "move_back":lb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(g)&&svgedit.contextmenu.getCustomHandler(g).call()}});a(".contextMenu li").mousedown(function(g){g.preventDefault()});a("#cmenu_canvas li").disableContextMenu();T.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(R.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(g){a("#main_menu").hide(); case "move_back":lb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(g)&&svgedit.contextmenu.getCustomHandler(g).call()}});a(".contextMenu li").mousedown(function(g){g.preventDefault()});a("#cmenu_canvas li").disableContextMenu();T.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(R.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(g){a("#main_menu").hide();
R.getUndoStackSize()===0?g(true):a.confirm(uiStrings.notification.QwantToOpen,g)};if(window.FileReader){s=a('<input type="file">').change(function(){var g=this;b.openPrep(function(o){if(o){h.clear();if(g.files.length==1){o=new FileReader;o.onloadend=function(v){q(v.target.result);w()};o.readAsText(g.files[0])}}})});a("#tool_open").show().prepend(s);s=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var g=new FileReader;g.onloadend=function(o){h.importSvgString(o.target.result, R.getUndoStackSize()===0?g(true):a.confirm(uiStrings.notification.QwantToOpen,g)};if(window.FileReader){s=a('<input type="file">').change(function(){var g=this;b.openPrep(function(o){if(o){h.clear();if(g.files.length==1){o=new FileReader;o.onloadend=function(v){q(v.target.result);w()};o.readAsText(g.files[0])}}})});a("#tool_open").show().prepend(s);s=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var g=new FileReader;g.onloadend=function(o){h.importSvgString(o.target.result,
true);w()};g.readAsText(this.files[0])}});a("#tool_import").show().prepend(s)}var w=b.updateCanvas=function(g,o){var v=P.width(),D=P.height(),H=v,J=D,X=h.getZoom(),ca=a("#svgcanvas"),S={x:P[0].scrollLeft+H/2,y:P[0].scrollTop+J/2},W=curConfig.canvas_expansion;v=Math.max(H,h.contentW*X*W);D=Math.max(J,h.contentH*X*W);v==H&&D==J?P.css("overflow","hidden"):P.css("overflow","scroll");W=ca.height()/2;var Z=ca.width()/2;ca.width(v).height(D);var qa=D/2,ta=v/2,ga=h.updateCanvas(v,D),Ta=ta/Z;v=v/2-H/2;D=D/ true);w()};g.readAsText(this.files[0])}});a("#tool_import").show().prepend(s)}var w=b.updateCanvas=function(g,o){var v=P.width(),D=P.height(),H=v,J=D,X=h.getZoom(),da=a("#svgcanvas"),S={x:P[0].scrollLeft+H/2,y:P[0].scrollTop+J/2},V=curConfig.canvas_expansion;v=Math.max(H,h.contentW*X*V);D=Math.max(J,h.contentH*X*V);v==H&&D==J?P.css("overflow","hidden"):P.css("overflow","scroll");V=da.height()/2;var Z=da.width()/2;da.width(v).height(D);var pa=D/2,ta=v/2,ga=h.updateCanvas(v,D),Ta=ta/Z;v=v/2-H/2;D=D/
2-J/2;if(o){o.x+=ga.x;o.y+=ga.y}else o={x:ta+(S.x-Z)*Ta,y:qa+(S.y-W)*Ta};if(g)if(h.contentW>P.width()){P[0].scrollLeft=ga.x-10;P[0].scrollTop=ga.y-10}else{P[0].scrollLeft=v;P[0].scrollTop=D}else{P[0].scrollLeft=o.x-H/2;P[0].scrollTop=o.y-J/2}if(curConfig.showRulers){l(ca,X);P.scroll()}},E=[];for(s=0.1;s<1E5;s*=10){E.push(1*s);E.push(2*s);E.push(5*s)}w(true);try{var I=function(g){if(window.JSON&&JSON.stringify)return JSON.stringify(g);var o=arguments.callee;if(typeof g=="boolean"||typeof g=="number")return g+ 2-J/2;if(o){o.x+=ga.x;o.y+=ga.y}else o={x:ta+(S.x-Z)*Ta,y:pa+(S.y-V)*Ta};if(g)if(h.contentW>P.width()){P[0].scrollLeft=ga.x-10;P[0].scrollTop=ga.y-10}else{P[0].scrollLeft=v;P[0].scrollTop=D}else{P[0].scrollLeft=o.x-H/2;P[0].scrollTop=o.y-J/2}if(curConfig.showRulers){l(da,X);P.scroll()}},E=[];for(s=0.1;s<1E5;s*=10){E.push(1*s);E.push(2*s);E.push(5*s)}w(true);try{var I=function(g){if(window.JSON&&JSON.stringify)return JSON.stringify(g);var o=arguments.callee;if(typeof g=="boolean"||typeof g=="number")return g+
"";else if(typeof g=="string")return'"'+g.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(H){return"\\u"+("0000"+H.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(g.length){for(var v=0;v<g.length;v++)g[v]=o(g[v]);return"["+g.join(",")+"]"}else{v=[];for(var D in g)v.push(o(D)+":"+o(g[D]));return"{"+v.join(",")+"}"}};window.addEventListener("message",function(g){var o=parseInt(g.data.substr(0,g.data.indexOf(";"))); "";else if(typeof g=="string")return'"'+g.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(H){return"\\u"+("0000"+H.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(g.length){for(var v=0;v<g.length;v++)g[v]=o(g[v]);return"["+g.join(",")+"]"}else{v=[];for(var D in g)v.push(o(D)+":"+o(g[D]));return"{"+v.join(",")+"}"}};window.addEventListener("message",function(g){var o=parseInt(g.data.substr(0,g.data.indexOf(";")));
try{g.source.postMessage("SVGe"+o+";"+I(eval(g.data)),"*")}catch(v){g.source.postMessage("SVGe"+o+";error:"+v.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=h;h.ready=svgEditor.ready});b.setLang=function(g,o){a.pref("lang",g);a("#lang_select").val(g);if(o){h.runExtensions("langChanged",g);Ba();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"}, try{g.source.postMessage("SVGe"+o+";"+I(eval(g.data)),"*")}catch(v){g.source.postMessage("SVGe"+o+";error:"+v.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=h;h.ready=svgEditor.ready});b.setLang=function(g,o){a.pref("lang",g);a("#lang_select").val(g);if(o){h.runExtensions("langChanged",g);Ba();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},
function(v,D){a(D).attr("title",a(v)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var f=[];b.ready=function(d){n?d():f.push(d)};b.runCallbacks=function(){a.each(f,function(){this()});n=true};b.loadFromString=function(d){b.ready(function(){q(d)})};b.loadFromURL=function(d,l){l||(l={});var s=l.cache,C=l.callback;b.ready(function(){a.ajax({url:d,dataType:"text",cache:!!s,success:function(p){q(p,C)},error:function(p, function(v,D){a(D).attr("title",a(v)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var f=[];b.ready=function(d){n?d():f.push(d)};b.runCallbacks=function(){a.each(f,function(){this()});n=true};b.loadFromString=function(d){b.ready(function(){q(d)})};b.loadFromURL=function(d,l){l||(l={});var s=l.cache,C=l.callback;b.ready(function(){a.ajax({url:d,dataType:"text",cache:!!s,success:function(p){q(p,C)},error:function(p,
@ -501,9 +501,9 @@ L,R){p.status!=404&&p.responseText?q(p.responseText,C):a.alert(uiStrings.notific
a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var q=this.dragCfg.dragAdjust,h=$(this).parent(),b=$(this),n=this.dragCfg.height,u=this.dragCfg.min,c=this.dragCfg.max,f=this.dragCfg.step,d=c-u>0?(c-u)/f:200,l=d/n*f,s=0,C=this.getAttribute("data-attr"),p=svgEditor.canvas,L=p.getSelectedElems(),R=svgedit.browser.isTouch(),O=true,K=d&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(h):false;b.attr("readonly","readonly");K&&!isNaN(this.dragCfg.start)&&K.css("top",this.dragCfg.start* a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var q=this.dragCfg.dragAdjust,h=$(this).parent(),b=$(this),n=this.dragCfg.height,u=this.dragCfg.min,c=this.dragCfg.max,f=this.dragCfg.step,d=c-u>0?(c-u)/f:200,l=d/n*f,s=0,C=this.getAttribute("data-attr"),p=svgEditor.canvas,L=p.getSelectedElems(),R=svgedit.browser.isTouch(),O=true,K=d&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(h):false;b.attr("readonly","readonly");K&&!isNaN(this.dragCfg.start)&&K.css("top",this.dragCfg.start*
-1/l+n);this.adjustValue=function(P,T){var M;P=parseFloat(P);if(isNaN(this.value))M=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){M=this.dragCfg.stepfunc(this,P);console.log(M)}else M=Number((Number(this.value)+Number(P)).toFixed(5));if(c!==null)M=Math.min(M,c);if(u!==null)M=Math.max(M,u);K&&this.updateCursor(M);this.value=M;h.attr("data-value",M);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,T)};h.toggleClass("draginput",h.is("label"));this.move=function(P,T,M){if(R)P= -1/l+n);this.adjustValue=function(P,T){var M;P=parseFloat(P);if(isNaN(this.value))M=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){M=this.dragCfg.stepfunc(this,P);console.log(M)}else M=Number((Number(this.value)+Number(P)).toFixed(5));if(c!==null)M=Math.min(M,c);if(u!==null)M=Math.max(M,u);K&&this.updateCursor(M);this.value=M;h.attr("data-value",M);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,T)};h.toggleClass("draginput",h.is("label"));this.move=function(P,T,M){if(R)P=
P.originalEvent.touches[0];if(s===0)s=T;T=(P.pageY-s)*-1;s=P.pageY;M=T*l*q;this.adjustValue(M.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");h.removeClass("active");O=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");s=0;if(L[0]){var P=p.undoMgr.finishUndoableChange();P.isEmpty()||p.undoMgr.addCommandToHistory(P)}this.adjustValue(0,O)};this.updateCursor=function(){var P=parseFloat(this.value)*-1/l+n;K.css("top",P)};this.start= P.originalEvent.touches[0];if(s===0)s=T;T=(P.pageY-s)*-1;s=P.pageY;M=T*l*q;this.adjustValue(M.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");h.removeClass("active");O=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");s=0;if(L[0]){var P=p.undoMgr.finishUndoableChange();P.isEmpty()||p.undoMgr.addCommandToHistory(P)}this.adjustValue(0,O)};this.updateCursor=function(){var P=parseFloat(this.value)*-1/l+n;K.css("top",P)};this.start=
function(P){if(R)P=P.originalEvent.touches[0];var T=P.pageY,M=this.value,ha=this;p.undoMgr.beginUndoableChange(C,L);$("body").addClass("dragging");h.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(na){ha.move(na,T,parseFloat(M))});$(window).bind("mouseup.draginput touchend.draginput",function(){ha.stop()})};$(this).attr("readonly","readonly").attr("data-scale",l).attr("data-domain",n).attr("data-cursor",K!=false).bind("mousedown touchstart",function(P){this.blur(); function(P){if(R)P=P.originalEvent.touches[0];var T=P.pageY,M=this.value,aa=this;p.undoMgr.beginUndoableChange(C,L);$("body").addClass("dragging");h.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(qa){aa.move(qa,T,parseFloat(M))});$(window).bind("mouseup.draginput touchend.draginput",function(){aa.stop()})};$(this).attr("readonly","readonly").attr("data-scale",l).attr("data-domain",n).attr("data-cursor",K!=false).bind("mousedown touchstart",function(P){this.blur();
this.start(P)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(P){switch(P.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(P,T,M,ha){O&&p.undoMgr.beginUndoableChange(C,L);O=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){na.stop()}, this.start(P)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(P){switch(P.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(P,T,M,aa){O&&p.undoMgr.beginUndoableChange(C,L);O=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){qa.stop()},
1E3);var na=this;if(ha>0)this.adjustValue(this.dragCfg.step);else ha<0&&this.adjustValue(-this.dragCfg.step);P.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),h=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/h+b+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=q};svgedit=svgedit||{}; 1E3);var qa=this;if(aa>0)this.adjustValue(this.dragCfg.step);else aa<0&&this.adjustValue(-this.dragCfg.step);P.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),h=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/h+b+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=q};svgedit=svgedit||{};
(function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var q=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("<li class='separator'>");var h=q.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+q.id+"'>"+q.label+"<span class='shortcut'>"+h+"</span></a></li>")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions= (function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var q=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("<li class='separator'>");var h=q.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+q.id+"'>"+q.label+"<span class='shortcut'>"+h+"</span></a></li>")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions=
{}};svgedit.contextmenu.add=function(q){if(q&&q.id&&q.label&&q.action&&typeof q.action=="function")if(q.id in a.contextMenuExtensions)console.error('Cannot add extension "'+q.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+q.id+", label:"+q.label+"}");a.contextMenuExtensions[q.id]=q}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler= {}};svgedit.contextmenu.add=function(q){if(q&&q.id&&q.label&&q.action&&typeof q.action=="function")if(q.id in a.contextMenuExtensions)console.error('Cannot add extension "'+q.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+q.id+", label:"+q.label+"}");a.contextMenuExtensions[q.id]=q}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler=
function(q){return a.contextMenuExtensions[q]&&true};svgedit.contextmenu.getCustomHandler=function(q){return a.contextMenuExtensions[q].action}})();(function(a,q){function h(n){return!a(n).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function b(n,u){var c=n.nodeName.toLowerCase();if("area"===c){c=n.parentNode;var f=c.name;if(!n.href||!f||c.nodeName.toLowerCase()!=="map")return false;c=a("img[usemap=#"+f+"]")[0];return!!c&&h(c)}return(/input|select|textarea|button|object/.test(c)?!n.disabled:"a"==c?n.href||u:u)&&h(n)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17", function(q){return a.contextMenuExtensions[q]&&true};svgedit.contextmenu.getCustomHandler=function(q){return a.contextMenuExtensions[q].action}})();(function(a,q){function h(n){return!a(n).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function b(n,u){var c=n.nodeName.toLowerCase();if("area"===c){c=n.parentNode;var f=c.name;if(!n.href||!f||c.nodeName.toLowerCase()!=="map")return false;c=a("img[usemap=#"+f+"]")[0];return!!c&&h(c)}return(/input|select|textarea|button|object/.test(c)?!n.disabled:"a"==c?n.href||u:u)&&h(n)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",
@ -580,73 +580,73 @@ this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui
return h=this._trimAlignValue(h)}h=this.options.values.slice();for(b=0;b<h.length;b+=1)h[b]=this._trimAlignValue(h[b]);return h},_trimAlignValue:function(q){if(q<=this._valueMin())return this._valueMin();if(q>=this._valueMax())return this._valueMax();var h=this.options.step>0?this.options.step:1,b=(q-this._valueMin())%h;q=q-b;Math.abs(b)*2>=h&&(q+=b>0?h:-h);return parseFloat(q.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var q= return h=this._trimAlignValue(h)}h=this.options.values.slice();for(b=0;b<h.length;b+=1)h[b]=this._trimAlignValue(h[b]);return h},_trimAlignValue:function(q){if(q<=this._valueMin())return this._valueMin();if(q>=this._valueMax())return this._valueMax();var h=this.options.step>0?this.options.step:1,b=(q-this._valueMin())%h;q=q-b;Math.abs(b)*2>=h&&(q+=b>0?h:-h);return parseFloat(q.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var q=
this.options.range,h=this.options,b=this,n=this._animateOff?false:h.animate,u,c={},f,d,l,s;this.options.values&&this.options.values.length?this.handles.each(function(C){u=(b.values(C)-b._valueMin())/(b._valueMax()-b._valueMin())*100;c[b.orientation==="horizontal"?"left":"bottom"]=u+"%";a(this).stop(1,1)[n?"animate":"css"](c,h.animate);b.options.range===true&&(b.orientation==="horizontal"?(C===0&&b.range.stop(1,1)[n?"animate":"css"]({left:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({width:u- this.options.range,h=this.options,b=this,n=this._animateOff?false:h.animate,u,c={},f,d,l,s;this.options.values&&this.options.values.length?this.handles.each(function(C){u=(b.values(C)-b._valueMin())/(b._valueMax()-b._valueMin())*100;c[b.orientation==="horizontal"?"left":"bottom"]=u+"%";a(this).stop(1,1)[n?"animate":"css"](c,h.animate);b.options.range===true&&(b.orientation==="horizontal"?(C===0&&b.range.stop(1,1)[n?"animate":"css"]({left:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({width:u-
f+"%"},{queue:false,duration:h.animate})):(C===0&&b.range.stop(1,1)[n?"animate":"css"]({bottom:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({height:u-f+"%"},{queue:false,duration:h.animate})));f=u}):(d=this.value(),l=this._valueMin(),s=this._valueMax(),u=s!==l?(d-l)/(s-l)*100:0,c[b.orientation==="horizontal"?"left":"bottom"]=u+"%",this.handle.stop(1,1)[n?"animate":"css"](c,h.animate),q==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[n?"animate":"css"]({width:u+"%"},h.animate), f+"%"},{queue:false,duration:h.animate})):(C===0&&b.range.stop(1,1)[n?"animate":"css"]({bottom:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({height:u-f+"%"},{queue:false,duration:h.animate})));f=u}):(d=this.value(),l=this._valueMin(),s=this._valueMax(),u=s!==l?(d-l)/(s-l)*100:0,c[b.orientation==="horizontal"?"left":"bottom"]=u+"%",this.handle.stop(1,1)[n?"animate":"css"](c,h.animate),q==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[n?"animate":"css"]({width:u+"%"},h.animate),
q==="max"&&this.orientation==="horizontal"&&this.range[n?"animate":"css"]({width:100-u+"%"},{queue:false,duration:h.animate}),q==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[n?"animate":"css"]({height:u+"%"},h.animate),q==="max"&&this.orientation==="vertical"&&this.range[n?"animate":"css"]({height:100-u+"%"},{queue:false,duration:h.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(c,f){if(f===undefined)f=0;return Math.round(c*Math.pow(10,f))/Math.pow(10,f)};var q=function(c,f){var d=this,l=c.find("img:first"),s=0,C=100,p=100,L=0,R=100,O=100,K=0,P=0,T,M,ha=[],na=function(U){for(var Y=0;Y<ha.length;Y++)ha[Y].call(d,d,U)},fa=function(U){var Y=c.offset();T={l:Y.left|0,t:Y.top|0};clearTimeout(M);M=setTimeout(function(){ra.call(d,U)},0);a(document).bind("mousemove",aa).bind("mouseup",V);U.preventDefault()},aa=function(U){clearTimeout(M);M=setTimeout(function(){ra.call(d, q==="max"&&this.orientation==="horizontal"&&this.range[n?"animate":"css"]({width:100-u+"%"},{queue:false,duration:h.animate}),q==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[n?"animate":"css"]({height:u+"%"},h.animate),q==="max"&&this.orientation==="vertical"&&this.range[n?"animate":"css"]({height:100-u+"%"},{queue:false,duration:h.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(c,f){if(f===undefined)f=0;return Math.round(c*Math.pow(10,f))/Math.pow(10,f)};var q=function(c,f){var d=this,l=c.find("img:first"),s=0,C=100,p=100,L=0,R=100,O=100,K=0,P=0,T,M,aa=[],qa=function(U){for(var Y=0;Y<aa.length;Y++)aa[Y].call(d,d,U)},ha=function(U){var Y=c.offset();T={l:Y.left|0,t:Y.top|0};clearTimeout(M);M=setTimeout(function(){ra.call(d,U)},0);a(document).bind("mousemove",ca).bind("mouseup",W);U.preventDefault()},ca=function(U){clearTimeout(M);M=setTimeout(function(){ra.call(d,
U)},0);U.stopPropagation();U.preventDefault();return false},V=function(U){a(document).unbind("mouseup",V).unbind("mousemove",aa);U.stopPropagation();U.preventDefault();return false},ra=function(U){var Y=U.pageX-T.l;U=U.pageY-T.t;var oa=c.w,pa=c.h;if(Y<0)Y=0;else if(Y>oa)Y=oa;if(U<0)U=0;else if(U>pa)U=pa;ia.call(d,"xy",{x:Y/oa*p+s,y:U/pa*O+L})},ia=function(U,Y,oa){if(Y===undefined){if(U===undefined||U==null)U="xy";switch(U.toLowerCase()){case "x":return K;case "y":return P;default:return{x:K,y:P}}}if(!(oa!= U)},0);U.stopPropagation();U.preventDefault();return false},W=function(U){a(document).unbind("mouseup",W).unbind("mousemove",ca);U.stopPropagation();U.preventDefault();return false},ra=function(U){var Y=U.pageX-T.l;U=U.pageY-T.t;var na=c.w,oa=c.h;if(Y<0)Y=0;else if(Y>na)Y=na;if(U<0)U=0;else if(U>oa)U=oa;ia.call(d,"xy",{x:Y/na*p+s,y:U/oa*O+L})},ia=function(U,Y,na){if(Y===undefined){if(U===undefined||U==null)U="xy";switch(U.toLowerCase()){case "x":return K;case "y":return P;default:return{x:K,y:P}}}if(!(na!=
null&&oa==d)){var pa=false,la,ma;if(U==null)U="xy";switch(U.toLowerCase()){case "x":la=Y&&(Y.x&&Y.x|0||Y|0)||0;break;case "y":ma=Y&&(Y.y&&Y.y|0||Y|0)||0;break;default:la=Y&&Y.x&&Y.x|0||0;ma=Y&&Y.y&&Y.y|0||0}if(la!=null){if(la<s)la=s;else if(la>C)la=C;if(K!=la){K=la;pa=true}}if(ma!=null){if(ma<L)ma=L;else if(ma>R)ma=R;if(P!=ma){P=ma;pa=true}}pa&&na.call(d,oa||d)}},da=function(U){a.isFunction(U)&&ha.push(U)};a.extend(true,d,{val:ia,range:function(U,Y){if(Y===undefined){if(U===undefined||U==null)U="all"; null&&na==d)){var oa=false,la,ma;if(U==null)U="xy";switch(U.toLowerCase()){case "x":la=Y&&(Y.x&&Y.x|0||Y|0)||0;break;case "y":ma=Y&&(Y.y&&Y.y|0||Y|0)||0;break;default:la=Y&&Y.x&&Y.x|0||0;ma=Y&&Y.y&&Y.y|0||0}if(la!=null){if(la<s)la=s;else if(la>C)la=C;if(K!=la){K=la;oa=true}}if(ma!=null){if(ma<L)ma=L;else if(ma>R)ma=R;if(P!=ma){P=ma;oa=true}}oa&&qa.call(d,na||d)}},ea=function(U){a.isFunction(U)&&aa.push(U)};a.extend(true,d,{val:ia,range:function(U,Y){if(Y===undefined){if(U===undefined||U==null)U="all";
switch(U.toLowerCase()){case "minx":return s;case "maxx":return C;case "rangex":return{minX:s,maxX:C,rangeX:p};case "miny":return L;case "maxy":return R;case "rangey":return{minY:L,maxY:R,rangeY:O};default:return{minX:s,maxX:C,rangeX:p,minY:L,maxY:R,rangeY:O}}}var oa,pa,la,ma;if(U==null)U="all";switch(U.toLowerCase()){case "minx":oa=Y&&(Y.minX&&Y.minX|0||Y|0)||0;break;case "maxx":pa=Y&&(Y.maxX&&Y.maxX|0||Y|0)||0;break;case "rangex":oa=Y&&Y.minX&&Y.minX|0||0;pa=Y&&Y.maxX&&Y.maxX|0||0;break;case "miny":la= switch(U.toLowerCase()){case "minx":return s;case "maxx":return C;case "rangex":return{minX:s,maxX:C,rangeX:p};case "miny":return L;case "maxy":return R;case "rangey":return{minY:L,maxY:R,rangeY:O};default:return{minX:s,maxX:C,rangeX:p,minY:L,maxY:R,rangeY:O}}}var na,oa,la,ma;if(U==null)U="all";switch(U.toLowerCase()){case "minx":na=Y&&(Y.minX&&Y.minX|0||Y|0)||0;break;case "maxx":oa=Y&&(Y.maxX&&Y.maxX|0||Y|0)||0;break;case "rangex":na=Y&&Y.minX&&Y.minX|0||0;oa=Y&&Y.maxX&&Y.maxX|0||0;break;case "miny":la=
Y&&(Y.minY&&Y.minY|0||Y|0)||0;break;case "maxy":ma=Y&&(Y.maxY&&Y.maxY|0||Y|0)||0;break;case "rangey":la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0;break;default:oa=Y&&Y.minX&&Y.minX|0||0;pa=Y&&Y.maxX&&Y.maxX|0||0;la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0}if(oa!=null&&s!=oa){s=oa;p=C-s}if(pa!=null&&C!=pa){C=pa;p=C-s}if(la!=null&&L!=la){L=la;O=R-L}if(ma!=null&&R!=ma){R=ma;O=R-L}},bind:da,unbind:function(U){if(a.isFunction(U))for(var Y;(Y=a.inArray(U,ha))!=-1;)ha.splice(Y,1)},destroy:function(){a(document).unbind("mouseup", Y&&(Y.minY&&Y.minY|0||Y|0)||0;break;case "maxy":ma=Y&&(Y.maxY&&Y.maxY|0||Y|0)||0;break;case "rangey":la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0;break;default:na=Y&&Y.minX&&Y.minX|0||0;oa=Y&&Y.maxX&&Y.maxX|0||0;la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0}if(na!=null&&s!=na){s=na;p=C-s}if(oa!=null&&C!=oa){C=oa;p=C-s}if(la!=null&&L!=la){L=la;O=R-L}if(ma!=null&&R!=ma){R=ma;O=R-L}},bind:ea,unbind:function(U){if(a.isFunction(U))for(var Y;(Y=a.inArray(U,aa))!=-1;)aa.splice(Y,1)},destroy:function(){a(document).unbind("mouseup",
V).unbind("mousemove",aa);c.unbind("mousedown",fa);ha=l=c=null}});l.src=f.arrow&&f.arrow.image;l.w=f.arrow&&f.arrow.width||l.width();l.h=f.arrow&&f.arrow.height||l.height();c.w=f.map&&f.map.width||c.width();c.h=f.map&&f.map.height||c.height();c.bind("mousedown",fa);da.call(d,function(){var U=0,Y=0,oa=c.w,pa=c.h,la=l.w,ma=l.h;setTimeout(function(){if(p>0)U=K==C?oa:K/p*oa|0;if(O>0)Y=P==R?pa:P/O*pa|0;if(la>=oa)U=(oa>>1)-(la>>1);else U-=la>>1;if(ma>=pa)Y=(pa>>1)-(ma>>1);else Y-=ma>>1;l.css({left:U+"px", W).unbind("mousemove",ca);c.unbind("mousedown",ha);aa=l=c=null}});l.src=f.arrow&&f.arrow.image;l.w=f.arrow&&f.arrow.width||l.width();l.h=f.arrow&&f.arrow.height||l.height();c.w=f.map&&f.map.width||c.width();c.h=f.map&&f.map.height||c.height();c.bind("mousedown",ha);ea.call(d,function(){var U=0,Y=0,na=c.w,oa=c.h,la=l.w,ma=l.h;setTimeout(function(){if(p>0)U=K==C?na:K/p*na|0;if(O>0)Y=P==R?oa:P/O*oa|0;if(la>=na)U=(na>>1)-(la>>1);else U-=la>>1;if(ma>=oa)Y=(oa>>1)-(ma>>1);else Y-=ma>>1;l.css({left:U+"px",
top:Y+"px"})},0)})},h=function(c,f,d,l){var s=this;c=c.find("td.Text input");var C=c.eq(3),p=c.eq(4),L=c.eq(5),R=c.length>7?c.eq(6):null,O=c.eq(0),K=c.eq(1),P=c.eq(2),T=c.eq(c.length>7?7:6),M=c.length>7?c.eq(8):null,ha=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!aa(ia))return ia;switch(ia.target){case C.get(0):switch(ia.keyCode){case 38:C.val(V.call(s,(C.val()<<0)+1,0,255));f.val("r",C.val(),ia.target);return false;case 40:C.val(V.call(s, top:Y+"px"})},0)})},h=function(c,f,d,l){var s=this;c=c.find("td.Text input");var C=c.eq(3),p=c.eq(4),L=c.eq(5),R=c.length>7?c.eq(6):null,O=c.eq(0),K=c.eq(1),P=c.eq(2),T=c.eq(c.length>7?7:6),M=c.length>7?c.eq(8):null,aa=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!ca(ia))return ia;switch(ia.target){case C.get(0):switch(ia.keyCode){case 38:C.val(W.call(s,(C.val()<<0)+1,0,255));f.val("r",C.val(),ia.target);return false;case 40:C.val(W.call(s,
(C.val()<<0)-1,0,255));f.val("r",C.val(),ia.target);return false}break;case p.get(0):switch(ia.keyCode){case 38:p.val(V.call(s,(p.val()<<0)+1,0,255));f.val("g",p.val(),ia.target);return false;case 40:p.val(V.call(s,(p.val()<<0)-1,0,255));f.val("g",p.val(),ia.target);return false}break;case L.get(0):switch(ia.keyCode){case 38:L.val(V.call(s,(L.val()<<0)+1,0,255));f.val("b",L.val(),ia.target);return false;case 40:L.val(V.call(s,(L.val()<<0)-1,0,255));f.val("b",L.val(),ia.target);return false}break; (C.val()<<0)-1,0,255));f.val("r",C.val(),ia.target);return false}break;case p.get(0):switch(ia.keyCode){case 38:p.val(W.call(s,(p.val()<<0)+1,0,255));f.val("g",p.val(),ia.target);return false;case 40:p.val(W.call(s,(p.val()<<0)-1,0,255));f.val("g",p.val(),ia.target);return false}break;case L.get(0):switch(ia.keyCode){case 38:L.val(W.call(s,(L.val()<<0)+1,0,255));f.val("b",L.val(),ia.target);return false;case 40:L.val(W.call(s,(L.val()<<0)-1,0,255));f.val("b",L.val(),ia.target);return false}break;
case R&&R.get(0):switch(ia.keyCode){case 38:R.val(V.call(s,parseFloat(R.val())+1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false;case 40:R.val(V.call(s,parseFloat(R.val())-1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false}break;case O.get(0):switch(ia.keyCode){case 38:O.val(V.call(s,(O.val()<<0)+1,0,360));f.val("h",O.val(),ia.target);return false;case 40:O.val(V.call(s,(O.val()<<0)-1,0,360));f.val("h",O.val(),ia.target);return false}break;case K.get(0):switch(ia.keyCode){case 38:K.val(V.call(s, case R&&R.get(0):switch(ia.keyCode){case 38:R.val(W.call(s,parseFloat(R.val())+1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false;case 40:R.val(W.call(s,parseFloat(R.val())-1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false}break;case O.get(0):switch(ia.keyCode){case 38:O.val(W.call(s,(O.val()<<0)+1,0,360));f.val("h",O.val(),ia.target);return false;case 40:O.val(W.call(s,(O.val()<<0)-1,0,360));f.val("h",O.val(),ia.target);return false}break;case K.get(0):switch(ia.keyCode){case 38:K.val(W.call(s,
(K.val()<<0)+1,0,100));f.val("s",K.val(),ia.target);return false;case 40:K.val(V.call(s,(K.val()<<0)-1,0,100));f.val("s",K.val(),ia.target);return false}break;case P.get(0):switch(ia.keyCode){case 38:P.val(V.call(s,(P.val()<<0)+1,0,100));f.val("v",P.val(),ia.target);return false;case 40:P.val(V.call(s,(P.val()<<0)-1,0,100));f.val("v",P.val(),ia.target);return false}}}},na=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!aa(ia))return ia;switch(ia.target){case C.get(0):C.val(V.call(s, (K.val()<<0)+1,0,100));f.val("s",K.val(),ia.target);return false;case 40:K.val(W.call(s,(K.val()<<0)-1,0,100));f.val("s",K.val(),ia.target);return false}break;case P.get(0):switch(ia.keyCode){case 38:P.val(W.call(s,(P.val()<<0)+1,0,100));f.val("v",P.val(),ia.target);return false;case 40:P.val(W.call(s,(P.val()<<0)-1,0,100));f.val("v",P.val(),ia.target);return false}}}},qa=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!ca(ia))return ia;switch(ia.target){case C.get(0):C.val(W.call(s,
C.val(),0,255));f.val("r",C.val(),ia.target);break;case p.get(0):p.val(V.call(s,p.val(),0,255));f.val("g",p.val(),ia.target);break;case L.get(0):L.val(V.call(s,L.val(),0,255));f.val("b",L.val(),ia.target);break;case R&&R.get(0):R.val(V.call(s,R.val(),0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);break;case O.get(0):O.val(V.call(s,O.val(),0,360));f.val("h",O.val(),ia.target);break;case K.get(0):K.val(V.call(s,K.val(),0,100));f.val("s",K.val(),ia.target);break;case P.get(0):P.val(V.call(s, C.val(),0,255));f.val("r",C.val(),ia.target);break;case p.get(0):p.val(W.call(s,p.val(),0,255));f.val("g",p.val(),ia.target);break;case L.get(0):L.val(W.call(s,L.val(),0,255));f.val("b",L.val(),ia.target);break;case R&&R.get(0):R.val(W.call(s,R.val(),0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);break;case O.get(0):O.val(W.call(s,O.val(),0,360));f.val("h",O.val(),ia.target);break;case K.get(0):K.val(W.call(s,K.val(),0,100));f.val("s",K.val(),ia.target);break;case P.get(0):P.val(W.call(s,
P.val(),0,100));f.val("v",P.val(),ia.target);break;case T.get(0):T.val(T.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));d&&d.val(T.val());f.val("hex",T.val()!=""?T.val():null,ia.target);break;case d&&d.get(0):d.val(d.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));T.val(d.val());f.val("hex",d.val()!=""?d.val():null,ia.target);break;case M&&M.get(0):M.val(M.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));f.val("a",M.val()!=null?parseInt(M.val(),16): P.val(),0,100));f.val("v",P.val(),ia.target);break;case T.get(0):T.val(T.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));d&&d.val(T.val());f.val("hex",T.val()!=""?T.val():null,ia.target);break;case d&&d.get(0):d.val(d.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));T.val(d.val());f.val("hex",d.val()!=""?d.val():null,ia.target);break;case M&&M.get(0):M.val(M.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));f.val("a",M.val()!=null?parseInt(M.val(),16):
null,ia.target)}}},fa=function(ia){if(f.val()!=null)switch(ia.target){case C.get(0):C.val(f.val("r"));break;case p.get(0):p.val(f.val("g"));break;case L.get(0):L.val(f.val("b"));break;case R&&R.get(0):R.val(Math.precision(f.val("a")*100/255,l));break;case O.get(0):O.val(f.val("h"));break;case K.get(0):K.val(f.val("s"));break;case P.get(0):P.val(f.val("v"));break;case T.get(0):case d&&d.get(0):T.val(f.val("hex"));d&&d.val(f.val("hex"));break;case M&&M.get(0):M.val(f.val("ahex").substring(6))}},aa= null,ia.target)}}},ha=function(ia){if(f.val()!=null)switch(ia.target){case C.get(0):C.val(f.val("r"));break;case p.get(0):p.val(f.val("g"));break;case L.get(0):L.val(f.val("b"));break;case R&&R.get(0):R.val(Math.precision(f.val("a")*100/255,l));break;case O.get(0):O.val(f.val("h"));break;case K.get(0):K.val(f.val("s"));break;case P.get(0):P.val(f.val("v"));break;case T.get(0):case d&&d.get(0):T.val(f.val("hex"));d&&d.val(f.val("hex"));break;case M&&M.get(0):M.val(f.val("ahex").substring(6))}},ca=
function(ia){switch(ia.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ia.ctrlKey)return false}return true},V=function(ia,da,U){if(ia==""||isNaN(ia))return da;if(ia>U)return U;if(ia<da)return da;return ia},ra=function(ia,da){var U=ia.val("all");if(da!=C.get(0))C.val(U!=null?U.r:"");if(da!=p.get(0))p.val(U!=null?U.g:"");if(da!=L.get(0))L.val(U!=null?U.b:"");if(R&&da!=R.get(0))R.val(U!=null?Math.precision(U.a*100/255,l):"");if(da!=O.get(0))O.val(U!= function(ia){switch(ia.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ia.ctrlKey)return false}return true},W=function(ia,ea,U){if(ia==""||isNaN(ia))return ea;if(ia>U)return U;if(ia<ea)return ea;return ia},ra=function(ia,ea){var U=ia.val("all");if(ea!=C.get(0))C.val(U!=null?U.r:"");if(ea!=p.get(0))p.val(U!=null?U.g:"");if(ea!=L.get(0))L.val(U!=null?U.b:"");if(R&&ea!=R.get(0))R.val(U!=null?Math.precision(U.a*100/255,l):"");if(ea!=O.get(0))O.val(U!=
null?U.h:"");if(da!=K.get(0))K.val(U!=null?U.s:"");if(da!=P.get(0))P.val(U!=null?U.v:"");if(da!=T.get(0)&&(d&&da!=d.get(0)||!d))T.val(U!=null?U.hex:"");if(d&&da!=d.get(0)&&da!=T.get(0))d.val(U!=null?U.hex:"");if(M&&da!=M.get(0))M.val(U!=null?U.ahex.substring(6):"")};a.extend(true,s,{destroy:function(){C.add(p).add(L).add(R).add(O).add(K).add(P).add(T).add(d).add(M).unbind("keyup",na).unbind("blur",fa);C.add(p).add(L).add(R).add(O).add(K).add(P).unbind("keydown",ha);f.unbind(ra);M=T=P=K=O=R=L=p=C= null?U.h:"");if(ea!=K.get(0))K.val(U!=null?U.s:"");if(ea!=P.get(0))P.val(U!=null?U.v:"");if(ea!=T.get(0)&&(d&&ea!=d.get(0)||!d))T.val(U!=null?U.hex:"");if(d&&ea!=d.get(0)&&ea!=T.get(0))d.val(U!=null?U.hex:"");if(M&&ea!=M.get(0))M.val(U!=null?U.ahex.substring(6):"")};a.extend(true,s,{destroy:function(){C.add(p).add(L).add(R).add(O).add(K).add(P).add(T).add(d).add(M).unbind("keyup",qa).unbind("blur",ha);C.add(p).add(L).add(R).add(O).add(K).add(P).unbind("keydown",aa);f.unbind(ra);M=T=P=K=O=R=L=p=C=
null}});C.add(p).add(L).add(R).add(O).add(K).add(P).add(T).add(d).add(M).bind("keyup",na).bind("blur",fa);C.add(p).add(L).add(R).add(O).add(K).add(P).bind("keydown",ha);f.bind(ra)};a.jPicker={List:[],Color:function(c){var f=this,d,l,s,C,p,L,R,O=[],K=function(T){for(var M=0;M<O.length;M++)O[M].call(f,f,T)},P=function(T,M,ha){if(M===undefined){if(T===undefined||T==null||T=="")T="all";if(d==null)return null;switch(T.toLowerCase()){case "ahex":return u.rgbaToHex({r:d,g:l,b:s,a:C});case "hex":return P("ahex").substring(0, null}});C.add(p).add(L).add(R).add(O).add(K).add(P).add(T).add(d).add(M).bind("keyup",qa).bind("blur",ha);C.add(p).add(L).add(R).add(O).add(K).add(P).bind("keydown",aa);f.bind(ra)};a.jPicker={List:[],Color:function(c){var f=this,d,l,s,C,p,L,R,O=[],K=function(T){for(var M=0;M<O.length;M++)O[M].call(f,f,T)},P=function(T,M,aa){if(M===undefined){if(T===undefined||T==null||T=="")T="all";if(d==null)return null;switch(T.toLowerCase()){case "ahex":return u.rgbaToHex({r:d,g:l,b:s,a:C});case "hex":return P("ahex").substring(0,
6);case "all":return{r:d,g:l,b:s,a:C,h:p,s:L,v:R,hex:P.call(f,"hex"),ahex:P.call(f,"ahex")};default:M={};for(var na=0;na<T.length;na++)switch(T.charAt(na)){case "r":if(T.length==1)M=d;else M.r=d;break;case "g":if(T.length==1)M=l;else M.g=l;break;case "b":if(T.length==1)M=s;else M.b=s;break;case "a":if(T.length==1)M=C;else M.a=C;break;case "h":if(T.length==1)M=p;else M.h=p;break;case "s":if(T.length==1)M=L;else M.s=L;break;case "v":if(T.length==1)M=R;else M.v=R}return M=={}?P.call(f,"all"):M}}if(!(ha!= 6);case "all":return{r:d,g:l,b:s,a:C,h:p,s:L,v:R,hex:P.call(f,"hex"),ahex:P.call(f,"ahex")};default:M={};for(var qa=0;qa<T.length;qa++)switch(T.charAt(qa)){case "r":if(T.length==1)M=d;else M.r=d;break;case "g":if(T.length==1)M=l;else M.g=l;break;case "b":if(T.length==1)M=s;else M.b=s;break;case "a":if(T.length==1)M=C;else M.a=C;break;case "h":if(T.length==1)M=p;else M.h=p;break;case "s":if(T.length==1)M=L;else M.s=L;break;case "v":if(T.length==1)M=R;else M.v=R}return M=={}?P.call(f,"all"):M}}if(!(aa!=
null&&ha==f)){var fa=false;if(T==null)T="";if(M==null){if(d!=null){d=null;fa=true}if(l!=null){l=null;fa=true}if(s!=null){s=null;fa=true}if(C!=null){C=null;fa=true}if(p!=null){p=null;fa=true}if(L!=null){L=null;fa=true}if(R!=null){R=null;fa=true}fa&&K.call(f,ha||f)}else switch(T.toLowerCase()){case "ahex":case "hex":M=u.hexToRgba(M&&(M.ahex||M.hex)||M||"00000000");P.call(f,"rgba",{r:M.r,g:M.g,b:M.b,a:T=="ahex"?M.a:C!=null?C:255},ha);break;default:if(M&&(M.ahex!=null||M.hex!=null)){P.call(f,"ahex",M.ahex|| null&&aa==f)){var ha=false;if(T==null)T="";if(M==null){if(d!=null){d=null;ha=true}if(l!=null){l=null;ha=true}if(s!=null){s=null;ha=true}if(C!=null){C=null;ha=true}if(p!=null){p=null;ha=true}if(L!=null){L=null;ha=true}if(R!=null){R=null;ha=true}ha&&K.call(f,aa||f)}else switch(T.toLowerCase()){case "ahex":case "hex":M=u.hexToRgba(M&&(M.ahex||M.hex)||M||"00000000");P.call(f,"rgba",{r:M.r,g:M.g,b:M.b,a:T=="ahex"?M.a:C!=null?C:255},aa);break;default:if(M&&(M.ahex!=null||M.hex!=null)){P.call(f,"ahex",M.ahex||
M.hex||"00000000",ha);break}var aa={},V=false,ra=false;if(M.r!==undefined&&!T.indexOf("r")==-1)T+="r";if(M.g!==undefined&&!T.indexOf("g")==-1)T+="g";if(M.b!==undefined&&!T.indexOf("b")==-1)T+="b";if(M.a!==undefined&&!T.indexOf("a")==-1)T+="a";if(M.h!==undefined&&!T.indexOf("h")==-1)T+="h";if(M.s!==undefined&&!T.indexOf("s")==-1)T+="s";if(M.v!==undefined&&!T.indexOf("v")==-1)T+="v";for(na=0;na<T.length;na++)switch(T.charAt(na)){case "r":if(ra)continue;V=true;aa.r=M&&M.r&&M.r|0||M&&M|0||0;if(aa.r<0)aa.r= M.hex||"00000000",aa);break}var ca={},W=false,ra=false;if(M.r!==undefined&&!T.indexOf("r")==-1)T+="r";if(M.g!==undefined&&!T.indexOf("g")==-1)T+="g";if(M.b!==undefined&&!T.indexOf("b")==-1)T+="b";if(M.a!==undefined&&!T.indexOf("a")==-1)T+="a";if(M.h!==undefined&&!T.indexOf("h")==-1)T+="h";if(M.s!==undefined&&!T.indexOf("s")==-1)T+="s";if(M.v!==undefined&&!T.indexOf("v")==-1)T+="v";for(qa=0;qa<T.length;qa++)switch(T.charAt(qa)){case "r":if(ra)continue;W=true;ca.r=M&&M.r&&M.r|0||M&&M|0||0;if(ca.r<0)ca.r=
0;else if(aa.r>255)aa.r=255;if(d!=aa.r){d=aa.r;fa=true}break;case "g":if(ra)continue;V=true;aa.g=M&&M.g&&M.g|0||M&&M|0||0;if(aa.g<0)aa.g=0;else if(aa.g>255)aa.g=255;if(l!=aa.g){l=aa.g;fa=true}break;case "b":if(ra)continue;V=true;aa.b=M&&M.b&&M.b|0||M&&M|0||0;if(aa.b<0)aa.b=0;else if(aa.b>255)aa.b=255;if(s!=aa.b){s=aa.b;fa=true}break;case "a":aa.a=M&&M.a!=null?M.a|0:M!=null?M|0:255;if(aa.a<0)aa.a=0;else if(aa.a>255)aa.a=255;if(C!=aa.a){C=aa.a;fa=true}break;case "h":if(V)continue;ra=true;aa.h=M&&M.h&& 0;else if(ca.r>255)ca.r=255;if(d!=ca.r){d=ca.r;ha=true}break;case "g":if(ra)continue;W=true;ca.g=M&&M.g&&M.g|0||M&&M|0||0;if(ca.g<0)ca.g=0;else if(ca.g>255)ca.g=255;if(l!=ca.g){l=ca.g;ha=true}break;case "b":if(ra)continue;W=true;ca.b=M&&M.b&&M.b|0||M&&M|0||0;if(ca.b<0)ca.b=0;else if(ca.b>255)ca.b=255;if(s!=ca.b){s=ca.b;ha=true}break;case "a":ca.a=M&&M.a!=null?M.a|0:M!=null?M|0:255;if(ca.a<0)ca.a=0;else if(ca.a>255)ca.a=255;if(C!=ca.a){C=ca.a;ha=true}break;case "h":if(W)continue;ra=true;ca.h=M&&M.h&&
M.h|0||M&&M|0||0;if(aa.h<0)aa.h=0;else if(aa.h>360)aa.h=360;if(p!=aa.h){p=aa.h;fa=true}break;case "s":if(V)continue;ra=true;aa.s=M&&M.s!=null?M.s|0:M!=null?M|0:100;if(aa.s<0)aa.s=0;else if(aa.s>100)aa.s=100;if(L!=aa.s){L=aa.s;fa=true}break;case "v":if(V)continue;ra=true;aa.v=M&&M.v!=null?M.v|0:M!=null?M|0:100;if(aa.v<0)aa.v=0;else if(aa.v>100)aa.v=100;if(R!=aa.v){R=aa.v;fa=true}}if(fa){if(V){d=d||0;l=l||0;s=s||0;M=u.rgbToHsv({r:d,g:l,b:s});p=M.h;L=M.s;R=M.v}else if(ra){p=p||0;L=L!=null?L:100;R=R!= M.h|0||M&&M|0||0;if(ca.h<0)ca.h=0;else if(ca.h>360)ca.h=360;if(p!=ca.h){p=ca.h;ha=true}break;case "s":if(W)continue;ra=true;ca.s=M&&M.s!=null?M.s|0:M!=null?M|0:100;if(ca.s<0)ca.s=0;else if(ca.s>100)ca.s=100;if(L!=ca.s){L=ca.s;ha=true}break;case "v":if(W)continue;ra=true;ca.v=M&&M.v!=null?M.v|0:M!=null?M|0:100;if(ca.v<0)ca.v=0;else if(ca.v>100)ca.v=100;if(R!=ca.v){R=ca.v;ha=true}}if(ha){if(W){d=d||0;l=l||0;s=s||0;M=u.rgbToHsv({r:d,g:l,b:s});p=M.h;L=M.s;R=M.v}else if(ra){p=p||0;L=L!=null?L:100;R=R!=
null?R:100;M=u.hsvToRgb({h:p,s:L,v:R});d=M.r;l=M.g;s=M.b}C=C!=null?C:255;K.call(f,ha||f)}}}};a.extend(true,f,{val:P,bind:function(T){a.isFunction(T)&&O.push(T)},unbind:function(T){if(a.isFunction(T))for(var M;(M=a.inArray(T,O))!=-1;)O.splice(M,1)},destroy:function(){O=null}});if(c)if(c.ahex!=null)P("ahex",c);else if(c.hex!=null)P((c.a!=null?"a":"")+"hex",c.a!=null?{ahex:c.hex+u.intToHex(c.a)}:c);else if(c.r!=null&&c.g!=null&&c.b!=null)P("rgb"+(c.a!=null?"a":""),c);else if(c.h!=null&&c.s!=null&&c.v!= null?R:100;M=u.hsvToRgb({h:p,s:L,v:R});d=M.r;l=M.g;s=M.b}C=C!=null?C:255;K.call(f,aa||f)}}}};a.extend(true,f,{val:P,bind:function(T){a.isFunction(T)&&O.push(T)},unbind:function(T){if(a.isFunction(T))for(var M;(M=a.inArray(T,O))!=-1;)O.splice(M,1)},destroy:function(){O=null}});if(c)if(c.ahex!=null)P("ahex",c);else if(c.hex!=null)P((c.a!=null?"a":"")+"hex",c.a!=null?{ahex:c.hex+u.intToHex(c.a)}:c);else if(c.r!=null&&c.g!=null&&c.b!=null)P("rgb"+(c.a!=null?"a":""),c);else if(c.h!=null&&c.s!=null&&c.v!=
null)P("hsv"+(c.a!=null?"a":""),c)},ColorMethods:{hexToRgba:function(c){c=this.validateHex(c);if(c=="")return{r:null,g:null,b:null,a:null};var f="00",d="00",l="00",s="255";if(c.length==6)c+="ff";if(c.length>6){f=c.substring(0,2);d=c.substring(2,4);l=c.substring(4,6);s=c.substring(6,c.length)}else{if(c.length>4){f=c.substring(4,c.length);c=c.substring(0,4)}if(c.length>2){d=c.substring(2,c.length);c=c.substring(0,2)}if(c.length>0)l=c.substring(0,c.length)}return{r:this.hexToInt(f),g:this.hexToInt(d), null)P("hsv"+(c.a!=null?"a":""),c)},ColorMethods:{hexToRgba:function(c){c=this.validateHex(c);if(c=="")return{r:null,g:null,b:null,a:null};var f="00",d="00",l="00",s="255";if(c.length==6)c+="ff";if(c.length>6){f=c.substring(0,2);d=c.substring(2,4);l=c.substring(4,6);s=c.substring(6,c.length)}else{if(c.length>4){f=c.substring(4,c.length);c=c.substring(0,4)}if(c.length>2){d=c.substring(2,c.length);c=c.substring(0,2)}if(c.length>0)l=c.substring(0,c.length)}return{r:this.hexToInt(f),g:this.hexToInt(d),
b:this.hexToInt(l),a:this.hexToInt(s)}},validateHex:function(c){if(typeof c=="object")return"";c=c.toLowerCase().replace(/[^a-f0-9]/g,"");if(c.length>8)c=c.substring(0,8);return c},rgbaToHex:function(c){return this.intToHex(c.r)+this.intToHex(c.g)+this.intToHex(c.b)+this.intToHex(c.a)},intToHex:function(c){c=(c|0).toString(16);if(c.length==1)c="0"+c;return c.toLowerCase()},hexToInt:function(c){return parseInt(c,16)},rgbToHsv:function(c){var f=c.r/255,d=c.g/255;c=c.b/255;var l={h:0,s:0,v:0},s=0,C= b:this.hexToInt(l),a:this.hexToInt(s)}},validateHex:function(c){if(typeof c=="object")return"";c=c.toLowerCase().replace(/[^a-f0-9]/g,"");if(c.length>8)c=c.substring(0,8);return c},rgbaToHex:function(c){return this.intToHex(c.r)+this.intToHex(c.g)+this.intToHex(c.b)+this.intToHex(c.a)},intToHex:function(c){c=(c|0).toString(16);if(c.length==1)c="0"+c;return c.toLowerCase()},hexToInt:function(c){return parseInt(c,16)},rgbToHsv:function(c){var f=c.r/255,d=c.g/255;c=c.b/255;var l={h:0,s:0,v:0},s=0,C=
0;if(f>=d&&f>=c){C=f;s=d>c?c:d}else if(d>=c&&d>=f){C=d;s=f>c?c:f}else{C=c;s=d>f?f:d}l.v=C;l.s=C?(C-s)/C:0;if(l.s){s=C-s;l.h=f==C?(d-c)/s:d==C?2+(c-f)/s:4+(f-d)/s;l.h=parseInt(l.h*60);if(l.h<0)l.h+=360}else l.h=0;l.s=l.s*100|0;l.v=l.v*100|0;return l},hsvToRgb:function(c){var f={r:0,g:0,b:0,a:100},d=c.h,l=c.s;c=c.v;if(l==0)f.r=c==0?f.g=f.b=0:f.g=f.b=c*255/100|0;else{if(d==360)d=0;d/=60;l/=100;c/=100;var s=d|0,C=d-s;d=c*(1-l);var p=c*(1-l*C);l=c*(1-l*(1-C));switch(s){case 0:f.r=c;f.g=l;f.b=d;break;case 1:f.r= 0;if(f>=d&&f>=c){C=f;s=d>c?c:d}else if(d>=c&&d>=f){C=d;s=f>c?c:f}else{C=c;s=d>f?f:d}l.v=C;l.s=C?(C-s)/C:0;if(l.s){s=C-s;l.h=f==C?(d-c)/s:d==C?2+(c-f)/s:4+(f-d)/s;l.h=parseInt(l.h*60);if(l.h<0)l.h+=360}else l.h=0;l.s=l.s*100|0;l.v=l.v*100|0;return l},hsvToRgb:function(c){var f={r:0,g:0,b:0,a:100},d=c.h,l=c.s;c=c.v;if(l==0)f.r=c==0?f.g=f.b=0:f.g=f.b=c*255/100|0;else{if(d==360)d=0;d/=60;l/=100;c/=100;var s=d|0,C=d-s;d=c*(1-l);var p=c*(1-l*C);l=c*(1-l*(1-C));switch(s){case 0:f.r=c;f.g=l;f.b=d;break;case 1:f.r=
p;f.g=c;f.b=d;break;case 2:f.r=d;f.g=c;f.b=l;break;case 3:f.r=d;f.g=p;f.b=c;break;case 4:f.r=l;f.g=d;f.b=c;break;case 5:f.r=c;f.g=d;f.b=p}f.r=f.r*255|0;f.g=f.g*255|0;f.b=f.b*255|0}return f}}};var b=a.jPicker.Color,n=a.jPicker.List,u=a.jPicker.ColorMethods;a.fn.jPicker=function(c){var f=arguments;return this.each(function(){var d=this,l=a.extend(true,{},a.fn.jPicker.defaults,c);if(a(d).get(0).nodeName.toLowerCase()=="input"){a.extend(true,l,{window:{bindToInput:true,expandable:true,input:a(d)}});if(a(d).val()== p;f.g=c;f.b=d;break;case 2:f.r=d;f.g=c;f.b=l;break;case 3:f.r=d;f.g=p;f.b=c;break;case 4:f.r=l;f.g=d;f.b=c;break;case 5:f.r=c;f.g=d;f.b=p}f.r=f.r*255|0;f.g=f.g*255|0;f.b=f.b*255|0}return f}}};var b=a.jPicker.Color,n=a.jPicker.List,u=a.jPicker.ColorMethods;a.fn.jPicker=function(c){var f=arguments;return this.each(function(){var d=this,l=a.extend(true,{},a.fn.jPicker.defaults,c);if(a(d).get(0).nodeName.toLowerCase()=="input"){a.extend(true,l,{window:{bindToInput:true,expandable:true,input:a(d)}});if(a(d).val()==
""){l.color.active=new b({hex:null});l.color.current=new b({hex:null})}else if(u.validateHex(a(d).val())){l.color.active=new b({hex:a(d).val(),a:l.color.active.val("a")});l.color.current=new b({hex:a(d).val(),a:l.color.active.val("a")})}}if(l.window.expandable)a(d).after('<span class="jPicker"><span class="Icon"><span class="Color">&nbsp;</span><span class="Alpha">&nbsp;</span><span class="Image" title="Click To Open Color Picker">&nbsp;</span><span class="Container">&nbsp;</span></span></span>'); ""){l.color.active=new b({hex:null});l.color.current=new b({hex:null})}else if(u.validateHex(a(d).val())){l.color.active=new b({hex:a(d).val(),a:l.color.active.val("a")});l.color.current=new b({hex:a(d).val(),a:l.color.active.val("a")})}}if(l.window.expandable)a(d).after('<span class="jPicker"><span class="Icon"><span class="Color">&nbsp;</span><span class="Alpha">&nbsp;</span><span class="Image" title="Click To Open Color Picker">&nbsp;</span><span class="Container">&nbsp;</span></span></span>');
else l.window.liveUpdate=false;var s=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,C=null,p=null,L=null,R=null,O=null,K=null,P=null,T=null,M=null,ha=null,na=null,fa=null,aa=null,V=null,ra=null,ia=null,da=null,U=null,Y=null,oa=null,pa=null,la=null,ma=null,Ba=null,Ea=null,Ia=null,za=null,Ka=null,Na=function(N){var Q=ka.active,ea=Q.val("hex"),Fa,Oa;l.color.mode=N;switch(N){case "h":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,0);wa.call(d,R,100);Ca.call(d, else l.window.liveUpdate=false;var s=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,C=null,p=null,L=null,R=null,O=null,K=null,P=null,T=null,M=null,aa=null,qa=null,ha=null,ca=null,W=null,ra=null,ia=null,ea=null,U=null,Y=null,na=null,oa=null,la=null,ma=null,Ba=null,Ea=null,Ia=null,za=null,Ka=null,Na=function(N){var Q=ka.active,fa=Q.val("hex"),Fa,Oa;l.color.mode=N;switch(N){case "h":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,0);wa.call(d,R,100);Ca.call(d,
O,260);wa.call(d,O,100);Sa.call(d,L,"transparent");Ca.call(d,P,0);wa.call(d,P,100);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,ha,260);wa.call(d,ha,100);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:100,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:360});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("s"),y:100-Q.val("v")},aa);V.val("y",360-Q.val("h"),V);break;case "s":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d, O,260);wa.call(d,O,100);Sa.call(d,L,"transparent");Ca.call(d,P,0);wa.call(d,P,100);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,aa,260);wa.call(d,aa,100);Ca.call(d,ha,260);wa.call(d,ha,100)},0);ca.range("all",{minX:0,maxX:100,minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:360});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("s"),y:100-Q.val("v")},ca);W.val("y",360-Q.val("h"),W);break;case "s":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d,
O,-520);Ca.call(d,P,-260);Ca.call(d,T,-520);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:360,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("v")},aa);V.val("y",100-Q.val("s"),V);break;case "v":setTimeout(function(){Sa.call(d,p,"000000");Ca.call(d,R,-780);Ca.call(d,O,260);Sa.call(d,L,ea);Ca.call(d,P,-520);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:360, O,-520);Ca.call(d,P,-260);Ca.call(d,T,-520);Ca.call(d,ha,260);wa.call(d,ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("h"),y:100-Q.val("v")},ca);W.val("y",100-Q.val("s"),W);break;case "v":setTimeout(function(){Sa.call(d,p,"000000");Ca.call(d,R,-780);Ca.call(d,O,260);Sa.call(d,L,fa);Ca.call(d,P,-520);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,ha,260);wa.call(d,ha,100)},0);ca.range("all",{minX:0,maxX:360,
minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("s")},aa);V.val("y",100-Q.val("v"),V);break;case "r":Fa=-1040;Oa=-780;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("b"),y:255-Q.val("g")},aa);V.val("y",255-Q.val("r"),V);break;case "g":Fa=-1560;Oa=-1820;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255}); minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("h"),y:100-Q.val("s")},ca);W.val("y",100-Q.val("v"),W);break;case "r":Fa=-1040;Oa=-780;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});W.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("b"),y:255-Q.val("g")},ca);W.val("y",255-Q.val("r"),W);break;case "g":Fa=-1560;Oa=-1820;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});W.range("rangeY",{minY:0,maxY:255});
if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("b"),y:255-Q.val("r")},aa);V.val("y",255-Q.val("g"),V);break;case "b":Fa=-2080;Oa=-2860;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("r"),y:255-Q.val("g")},aa);V.val("y",255-Q.val("b"),V);break;case "a":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d,O,-520);Ca.call(d,P,260);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,fa,0);wa.call(d, if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("b"),y:255-Q.val("r")},ca);W.val("y",255-Q.val("g"),W);break;case "b":Fa=-2080;Oa=-2860;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});W.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("r"),y:255-Q.val("g")},ca);W.val("y",255-Q.val("b"),W);break;case "a":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d,O,-520);Ca.call(d,P,260);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,ha,0);wa.call(d,
fa,100)},0);aa.range("all",{minX:0,maxX:360,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("v")},aa);V.val("y",255-Q.val("a"),V);break;default:throw"Invalid Mode";}switch(N){case "s":case "v":case "a":setTimeout(function(){wa.call(d,R,100);wa.call(d,P,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,ha,260);wa.call(d,ha,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Sa.call(d,p,"transparent");Sa.call(d,L,"transparent"); ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("h"),y:100-Q.val("v")},ca);W.val("y",255-Q.val("a"),W);break;default:throw"Invalid Mode";}switch(N){case "s":case "v":case "a":setTimeout(function(){wa.call(d,R,100);wa.call(d,P,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,aa,260);wa.call(d,aa,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Sa.call(d,p,"transparent");Sa.call(d,L,"transparent");
wa.call(d,P,100);wa.call(d,R,100);Ca.call(d,R,Fa);Ca.call(d,O,Fa-260);Ca.call(d,P,Oa-780);Ca.call(d,T,Oa-520);Ca.call(d,M,Oa);Ca.call(d,ha,Oa-260);Ca.call(d,fa,260);wa.call(d,fa,100)},0)}Q.val("ahex")!=null&&Aa.call(d,Q)},Aa=function(N,Q){if(Q==null||Q!=V&&Q!=aa)xa.call(d,N,Q);setTimeout(function(){nb.call(d,N);Ya.call(d,N);fb.call(d,N)},0)},ya=function(N,Q){var ea=ka.active;if(!(Q!=aa&&ea.val()==null)){var Fa=N.val("all");switch(l.color.mode){case "h":ea.val("sv",{s:Fa.x,v:100-Fa.y},Q);break;case "s":case "a":ea.val("hv", wa.call(d,P,100);wa.call(d,R,100);Ca.call(d,R,Fa);Ca.call(d,O,Fa-260);Ca.call(d,P,Oa-780);Ca.call(d,T,Oa-520);Ca.call(d,M,Oa);Ca.call(d,aa,Oa-260);Ca.call(d,ha,260);wa.call(d,ha,100)},0)}Q.val("ahex")!=null&&Aa.call(d,Q)},Aa=function(N,Q){if(Q==null||Q!=W&&Q!=ca)xa.call(d,N,Q);setTimeout(function(){nb.call(d,N);Ya.call(d,N);fb.call(d,N)},0)},ya=function(N,Q){var fa=ka.active;if(!(Q!=ca&&fa.val()==null)){var Fa=N.val("all");switch(l.color.mode){case "h":fa.val("sv",{s:Fa.x,v:100-Fa.y},Q);break;case "s":case "a":fa.val("hv",
{h:Fa.x,v:100-Fa.y},Q);break;case "v":ea.val("hs",{h:Fa.x,s:100-Fa.y},Q);break;case "r":ea.val("gb",{g:255-Fa.y,b:Fa.x},Q);break;case "g":ea.val("rb",{r:255-Fa.y,b:Fa.x},Q);break;case "b":ea.val("rg",{r:Fa.x,g:255-Fa.y},Q)}}},Ga=function(N,Q){var ea=ka.active;if(!(Q!=V&&ea.val()==null))switch(l.color.mode){case "h":ea.val("h",{h:360-N.val("y")},Q);break;case "s":ea.val("s",{s:100-N.val("y")},Q);break;case "v":ea.val("v",{v:100-N.val("y")},Q);break;case "r":ea.val("r",{r:255-N.val("y")},Q);break;case "g":ea.val("g", {h:Fa.x,v:100-Fa.y},Q);break;case "v":fa.val("hs",{h:Fa.x,s:100-Fa.y},Q);break;case "r":fa.val("gb",{g:255-Fa.y,b:Fa.x},Q);break;case "g":fa.val("rb",{r:255-Fa.y,b:Fa.x},Q);break;case "b":fa.val("rg",{r:Fa.x,g:255-Fa.y},Q)}}},Ga=function(N,Q){var fa=ka.active;if(!(Q!=W&&fa.val()==null))switch(l.color.mode){case "h":fa.val("h",{h:360-N.val("y")},Q);break;case "s":fa.val("s",{s:100-N.val("y")},Q);break;case "v":fa.val("v",{v:100-N.val("y")},Q);break;case "r":fa.val("r",{r:255-N.val("y")},Q);break;case "g":fa.val("g",
{g:255-N.val("y")},Q);break;case "b":ea.val("b",{b:255-N.val("y")},Q);break;case "a":ea.val("a",255-N.val("y"),Q)}},xa=function(N,Q){if(Q!=aa)switch(l.color.mode){case "h":var ea=N.val("sv");aa.val("xy",{x:ea!=null?ea.s:100,y:100-(ea!=null?ea.v:100)},Q);break;case "s":case "a":ea=N.val("hv");aa.val("xy",{x:ea&&ea.h||0,y:100-(ea!=null?ea.v:100)},Q);break;case "v":ea=N.val("hs");aa.val("xy",{x:ea&&ea.h||0,y:100-(ea!=null?ea.s:100)},Q);break;case "r":ea=N.val("bg");aa.val("xy",{x:ea&&ea.b||0,y:255-(ea&& {g:255-N.val("y")},Q);break;case "b":fa.val("b",{b:255-N.val("y")},Q);break;case "a":fa.val("a",255-N.val("y"),Q)}},xa=function(N,Q){if(Q!=ca)switch(l.color.mode){case "h":var fa=N.val("sv");ca.val("xy",{x:fa!=null?fa.s:100,y:100-(fa!=null?fa.v:100)},Q);break;case "s":case "a":fa=N.val("hv");ca.val("xy",{x:fa&&fa.h||0,y:100-(fa!=null?fa.v:100)},Q);break;case "v":fa=N.val("hs");ca.val("xy",{x:fa&&fa.h||0,y:100-(fa!=null?fa.s:100)},Q);break;case "r":fa=N.val("bg");ca.val("xy",{x:fa&&fa.b||0,y:255-(fa&&
ea.g||0)},Q);break;case "g":ea=N.val("br");aa.val("xy",{x:ea&&ea.b||0,y:255-(ea&&ea.r||0)},Q);break;case "b":ea=N.val("rg");aa.val("xy",{x:ea&&ea.r||0,y:255-(ea&&ea.g||0)},Q)}if(Q!=V)switch(l.color.mode){case "h":V.val("y",360-(N.val("h")||0),Q);break;case "s":ea=N.val("s");V.val("y",100-(ea!=null?ea:100),Q);break;case "v":ea=N.val("v");V.val("y",100-(ea!=null?ea:100),Q);break;case "r":V.val("y",255-(N.val("r")||0),Q);break;case "g":V.val("y",255-(N.val("g")||0),Q);break;case "b":V.val("y",255-(N.val("b")|| fa.g||0)},Q);break;case "g":fa=N.val("br");ca.val("xy",{x:fa&&fa.b||0,y:255-(fa&&fa.r||0)},Q);break;case "b":fa=N.val("rg");ca.val("xy",{x:fa&&fa.r||0,y:255-(fa&&fa.g||0)},Q)}if(Q!=W)switch(l.color.mode){case "h":W.val("y",360-(N.val("h")||0),Q);break;case "s":fa=N.val("s");W.val("y",100-(fa!=null?fa:100),Q);break;case "v":fa=N.val("v");W.val("y",100-(fa!=null?fa:100),Q);break;case "r":W.val("y",255-(N.val("r")||0),Q);break;case "g":W.val("y",255-(N.val("g")||0),Q);break;case "b":W.val("y",255-(N.val("b")||
0),Q);break;case "a":ea=N.val("a");V.val("y",255-(ea!=null?ea:255),Q)}},nb=function(N){try{var Q=N.val("all");oa.css({backgroundColor:Q&&"#"+Q.hex||"transparent"});wa.call(d,oa,Q&&Math.precision(Q.a*100/255,4)||0)}catch(ea){}},Ya=function(N){switch(l.color.mode){case "h":Sa.call(d,p,(new b({h:N.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var Q=N.val("s");wa.call(d,O,100-(Q!=null?Q:100));break;case "v":Q=N.val("v");wa.call(d,R,Q!=null?Q:100);break;case "r":wa.call(d,O,Math.precision((N.val("r")|| 0),Q);break;case "a":fa=N.val("a");W.val("y",255-(fa!=null?fa:255),Q)}},nb=function(N){try{var Q=N.val("all");na.css({backgroundColor:Q&&"#"+Q.hex||"transparent"});wa.call(d,na,Q&&Math.precision(Q.a*100/255,4)||0)}catch(fa){}},Ya=function(N){switch(l.color.mode){case "h":Sa.call(d,p,(new b({h:N.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var Q=N.val("s");wa.call(d,O,100-(Q!=null?Q:100));break;case "v":Q=N.val("v");wa.call(d,R,Q!=null?Q:100);break;case "r":wa.call(d,O,Math.precision((N.val("r")||
0)/255*100,4));break;case "g":wa.call(d,O,Math.precision((N.val("g")||0)/255*100,4));break;case "b":wa.call(d,O,Math.precision((N.val("b")||0)/255*100))}N=N.val("a");wa.call(d,K,Math.precision((255-(N||0))*100/255,4))},fb=function(N){switch(l.color.mode){case "h":var Q=N.val("a");wa.call(d,na,Math.precision((255-(Q||0))*100/255,4));break;case "s":Q=N.val("hva");var ea=new b({h:Q&&Q.h||0,s:100,v:Q!=null?Q.v:100});Sa.call(d,L,ea.val("hex"));wa.call(d,T,100-(Q!=null?Q.v:100));wa.call(d,na,Math.precision((255- 0)/255*100,4));break;case "g":wa.call(d,O,Math.precision((N.val("g")||0)/255*100,4));break;case "b":wa.call(d,O,Math.precision((N.val("b")||0)/255*100))}N=N.val("a");wa.call(d,K,Math.precision((255-(N||0))*100/255,4))},fb=function(N){switch(l.color.mode){case "h":var Q=N.val("a");wa.call(d,qa,Math.precision((255-(Q||0))*100/255,4));break;case "s":Q=N.val("hva");var fa=new b({h:Q&&Q.h||0,s:100,v:Q!=null?Q.v:100});Sa.call(d,L,fa.val("hex"));wa.call(d,T,100-(Q!=null?Q.v:100));wa.call(d,qa,Math.precision((255-
(Q&&Q.a||0))*100/255,4));break;case "v":Q=N.val("hsa");ea=new b({h:Q&&Q.h||0,s:Q!=null?Q.s:100,v:100});Sa.call(d,L,ea.val("hex"));wa.call(d,na,Math.precision((255-(Q&&Q.a||0))*100/255,4));break;case "r":case "g":case "b":ea=Q=0;N=N.val("rgba");if(l.color.mode=="r"){Q=N&&N.b||0;ea=N&&N.g||0}else if(l.color.mode=="g"){Q=N&&N.b||0;ea=N&&N.r||0}else if(l.color.mode=="b"){Q=N&&N.r||0;ea=N&&N.g||0}var Fa=ea>Q?Q:ea;wa.call(d,T,Q>ea?Math.precision((Q-ea)/(255-ea)*100,4):0);wa.call(d,M,ea>Q?Math.precision((ea- (Q&&Q.a||0))*100/255,4));break;case "v":Q=N.val("hsa");fa=new b({h:Q&&Q.h||0,s:Q!=null?Q.s:100,v:100});Sa.call(d,L,fa.val("hex"));wa.call(d,qa,Math.precision((255-(Q&&Q.a||0))*100/255,4));break;case "r":case "g":case "b":fa=Q=0;N=N.val("rgba");if(l.color.mode=="r"){Q=N&&N.b||0;fa=N&&N.g||0}else if(l.color.mode=="g"){Q=N&&N.b||0;fa=N&&N.r||0}else if(l.color.mode=="b"){Q=N&&N.r||0;fa=N&&N.g||0}var Fa=fa>Q?Q:fa;wa.call(d,T,Q>fa?Math.precision((Q-fa)/(255-fa)*100,4):0);wa.call(d,M,fa>Q?Math.precision((fa-
Q)/(255-Q)*100,4):0);wa.call(d,ha,Math.precision(Fa/255*100,4));wa.call(d,na,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "a":Q=N.val("a");Sa.call(d,L,N.val("hex")||"000000");wa.call(d,na,Q!=null?0:100);wa.call(d,fa,Q!=null?100:0)}},Sa=function(N,Q){N.css({backgroundColor:Q&&Q.length==6&&"#"+Q||"transparent"})},Wa=function(N,Q){if(s&&(Q.indexOf("AlphaBar.png")!=-1||Q.indexOf("Bars.png")!=-1||Q.indexOf("Maps.png")!=-1)){N.attr("pngSrc",Q);N.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ Q)/(255-Q)*100,4):0);wa.call(d,aa,Math.precision(Fa/255*100,4));wa.call(d,qa,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "a":Q=N.val("a");Sa.call(d,L,N.val("hex")||"000000");wa.call(d,qa,Q!=null?0:100);wa.call(d,ha,Q!=null?100:0)}},Sa=function(N,Q){N.css({backgroundColor:Q&&Q.length==6&&"#"+Q||"transparent"})},Wa=function(N,Q){if(s&&(Q.indexOf("AlphaBar.png")!=-1||Q.indexOf("Bars.png")!=-1||Q.indexOf("Maps.png")!=-1)){N.attr("pngSrc",Q);N.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
Q+"', sizingMethod='scale')"})}else N.css({backgroundImage:"url('"+Q+"')"})},Ca=function(N,Q){N.css({top:Q+"px"})},wa=function(N,Q){N.css({visibility:Q>0?"visible":"hidden"});if(Q>0&&Q<100)if(s){var ea=N.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+Q+")"}):N.css({opacity:Math.precision(Q/ Q+"', sizingMethod='scale')"})}else N.css({backgroundImage:"url('"+Q+"')"})},Ca=function(N,Q){N.css({top:Q+"px"})},wa=function(N,Q){N.css({visibility:Q>0?"visible":"hidden"});if(Q>0&&Q<100)if(s){var fa=N.attr("pngSrc");fa!=null&&(fa.indexOf("AlphaBar.png")!=-1||fa.indexOf("Bars.png")!=-1||fa.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+fa+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+Q+")"}):N.css({opacity:Math.precision(Q/
100,4)})}else N.css({opacity:Math.precision(Q/100,4)});else if(Q==0||Q==100)if(s){ea=N.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale')"}):N.css({opacity:""})}else N.css({opacity:""})},db=function(){ka.active.val("ahex",ka.current.val("ahex"))},La=function(){ka.current.val("ahex",ka.active.val("ahex"))},Ra=function(N){a(this).parents("tbody:first").find('input:radio[value!="'+ 100,4)})}else N.css({opacity:Math.precision(Q/100,4)});else if(Q==0||Q==100)if(s){fa=N.attr("pngSrc");fa!=null&&(fa.indexOf("AlphaBar.png")!=-1||fa.indexOf("Bars.png")!=-1||fa.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+fa+"', sizingMethod='scale')"}):N.css({opacity:""})}else N.css({opacity:""})},db=function(){ka.active.val("ahex",ka.current.val("ahex"))},La=function(){ka.current.val("ahex",ka.active.val("ahex"))},Ra=function(N){a(this).parents("tbody:first").find('input:radio[value!="'+
N.target.value+'"]').removeAttr("checked");Na.call(d,N.target.value)},Da=function(){db.call(d)},gb=function(){db.call(d);l.window.expandable&&yb.call(d);a.isFunction(sb)&&sb.call(d,ka.active,ma)},rb=function(){La.call(d);l.window.expandable&&yb.call(d);a.isFunction(lb)&&lb.call(d,ka.active,la)},Xa=function(){ob.call(d)},ab=function(N){var Q=N.val("hex");pa.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,pa,Math.precision((N.val("a")||0)*100/255,4))},xb=function(N){var Q=N.val("hex");N=N.val("va"); N.target.value+'"]').removeAttr("checked");Na.call(d,N.target.value)},Da=function(){db.call(d)},gb=function(){db.call(d);l.window.expandable&&yb.call(d);a.isFunction(sb)&&sb.call(d,ka.active,ma)},rb=function(){La.call(d);l.window.expandable&&yb.call(d);a.isFunction(lb)&&lb.call(d,ka.active,la)},Xa=function(){ob.call(d)},ab=function(N){var Q=N.val("hex");oa.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,oa,Math.precision((N.val("a")||0)*100/255,4))},xb=function(N){var Q=N.val("hex");N=N.val("va");
Ea.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,Ia,Math.precision((255-(N&&N.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:N==null||N.v>75?"#000000":"#ffffff"})},ua=function(N){ia=parseInt(C.css("left"));da=parseInt(C.css("top"));U=N.pageX;Y=N.pageY;a(document).bind("mousemove",jb).bind("mouseup",hb);N.preventDefault()},jb=function(N){C.css({left:ia-(U-N.pageX)+"px",top:da-(Y-N.pageY)+"px"});l.window.expandable&& Ea.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,Ia,Math.precision((255-(N&&N.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:N==null||N.v>75?"#000000":"#ffffff"})},ua=function(N){ia=parseInt(C.css("left"));ea=parseInt(C.css("top"));U=N.pageX;Y=N.pageY;a(document).bind("mousemove",jb).bind("mouseup",hb);N.preventDefault()},jb=function(N){C.css({left:ia-(U-N.pageX)+"px",top:ea-(Y-N.pageY)+"px"});l.window.expandable&&
!a.support.boxModel&&C.prev().css({left:C.css("left"),top:C.css("top")});N.stopPropagation();N.preventDefault();return false},hb=function(N){a(document).unbind("mousemove",jb).unbind("mouseup",hb);N.stopPropagation();N.preventDefault();return false},ub=function(N){N.preventDefault();N.stopPropagation();ka.active.val("ahex",a(this).attr("title")||null,N.target);return false},lb=a.isFunction(f[1])&&f[1]||null,eb=a.isFunction(f[2])&&f[2]||null,sb=a.isFunction(f[3])&&f[3]||null,ob=function(){ka.current.val("ahex", !a.support.boxModel&&C.prev().css({left:C.css("left"),top:C.css("top")});N.stopPropagation();N.preventDefault();return false},hb=function(N){a(document).unbind("mousemove",jb).unbind("mouseup",hb);N.stopPropagation();N.preventDefault();return false},ub=function(N){N.preventDefault();N.stopPropagation();ka.active.val("ahex",a(this).attr("title")||null,N.target);return false},lb=a.isFunction(f[1])&&f[1]||null,eb=a.isFunction(f[2])&&f[2]||null,sb=a.isFunction(f[3])&&f[3]||null,ob=function(){ka.current.val("ahex",
ka.active.val("ahex"));var N=function(){if(!(!l.window.expandable||a.support.boxModel)){var Q=C.find("table:first");C.before("<iframe/>");C.prev().css({width:Q.width(),height:C.height(),opacity:0,position:"absolute",left:C.css("left"),top:C.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});C.css({zIndex:20})}switch(l.window.effects.type){case "fade":C.fadeIn(l.window.effects.speed.show,N);break;case "slide":C.slideDown(l.window.effects.speed.show, ka.active.val("ahex"));var N=function(){if(!(!l.window.expandable||a.support.boxModel)){var Q=C.find("table:first");C.before("<iframe/>");C.prev().css({width:Q.width(),height:C.height(),opacity:0,position:"absolute",left:C.css("left"),top:C.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});C.css({zIndex:20})}switch(l.window.effects.type){case "fade":C.fadeIn(l.window.effects.speed.show,N);break;case "slide":C.slideDown(l.window.effects.speed.show,
N);break;default:C.show(l.window.effects.speed.show,N)}},yb=function(){var N=function(){l.window.expandable&&C.css({zIndex:10});!l.window.expandable||a.support.boxModel||C.prev().remove()};switch(l.window.effects.type){case "fade":C.fadeOut(l.window.effects.speed.hide,N);break;case "slide":C.slideUp(l.window.effects.speed.hide,N);break;default:C.hide(l.window.effects.speed.hide,N)}},zb=function(){var N=l.window,Q=N.expandable?a(d).next().find(".Container:first"):null;C=N.expandable?a("<div/>"):a(d); N);break;default:C.show(l.window.effects.speed.show,N)}},yb=function(){var N=function(){l.window.expandable&&C.css({zIndex:10});!l.window.expandable||a.support.boxModel||C.prev().remove()};switch(l.window.effects.type){case "fade":C.fadeOut(l.window.effects.speed.hide,N);break;case "slide":C.slideUp(l.window.effects.speed.hide,N);break;default:C.hide(l.window.effects.speed.hide,N)}},zb=function(){var N=l.window,Q=N.expandable?a(d).next().find(".Container:first"):null;C=N.expandable?a("<div/>"):a(d);
C.addClass("jPicker Container");N.expandable&&C.hide();C.get(0).onselectstart=function(Pa){if(Pa.target.nodeName.toLowerCase()!=="input")return false};var ea=ka.active.val("all");if(N.alphaPrecision<0)N.alphaPrecision=0;else if(N.alphaPrecision>2)N.alphaPrecision=2;var Fa='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(N.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':"")+'<tr><td rowspan="9"><h2 class="Title">'+(N.title||ba.text.title)+'</h2><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="'+ C.addClass("jPicker Container");N.expandable&&C.hide();C.get(0).onselectstart=function(Pa){if(Pa.target.nodeName.toLowerCase()!=="input")return false};var fa=ka.active.val("all");if(N.alphaPrecision<0)N.alphaPrecision=0;else if(N.alphaPrecision>2)N.alphaPrecision=2;var Fa='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(N.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':"")+'<tr><td rowspan="9"><h2 class="Title">'+(N.title||ba.text.title)+'</h2><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="'+
ja.clientPath+ja.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="'+ja.clientPath+ja.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">'+ba.text.newColor+'<div class="color_preview"><span class="Active" title="'+ba.tooltips.colors.newColor+ ja.clientPath+ja.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="'+ja.clientPath+ja.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">'+ba.text.newColor+'<div class="color_preview"><span class="Active" title="'+ba.tooltips.colors.newColor+
'">&nbsp;</span><span class="Current" title="'+ba.tooltips.colors.currentColor+'">&nbsp;</span></div></div>'+ba.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+ba.text.ok+'" title="'+ba.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+ba.text.cancel+'" title="'+ba.tooltips.buttons.cancel+'"/><div class="Grid">&nbsp;</div></td></tr><tr class="Hue"><td class="Radio"><label title="'+ba.tooltips.hue.radio+'"><input type="radio" value="h"'+ '">&nbsp;</span><span class="Current" title="'+ba.tooltips.colors.currentColor+'">&nbsp;</span></div></div>'+ba.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+ba.text.ok+'" title="'+ba.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+ba.text.cancel+'" title="'+ba.tooltips.buttons.cancel+'"/><div class="Grid">&nbsp;</div></td></tr><tr class="Hue"><td class="Radio"><label title="'+ba.tooltips.hue.radio+'"><input type="radio" value="h"'+
(l.color.mode=="h"?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.h:"")+'" title="'+ba.tooltips.hue.textbox+'"/>&nbsp;\u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="'+ba.tooltips.saturation.radio+'"><input type="radio" value="s"'+(l.color.mode=="s"?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.s:"")+'" title="'+ba.tooltips.saturation.textbox+ (l.color.mode=="h"?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(fa!=null?fa.h:"")+'" title="'+ba.tooltips.hue.textbox+'"/>&nbsp;\u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="'+ba.tooltips.saturation.radio+'"><input type="radio" value="s"'+(l.color.mode=="s"?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(fa!=null?fa.s:"")+'" title="'+ba.tooltips.saturation.textbox+
'"/>&nbsp;%</td></tr><tr class="Value"><td class="Radio"><label title="'+ba.tooltips.value.radio+'"><input type="radio" value="v"'+(l.color.mode=="v"?' checked="checked"':"")+'/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.v:"")+'" title="'+ba.tooltips.value.textbox+'"/>&nbsp;%<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+ba.tooltips.red.radio+'"><input type="radio" value="r"'+(l.color.mode=="r"?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+ '"/>&nbsp;%</td></tr><tr class="Value"><td class="Radio"><label title="'+ba.tooltips.value.radio+'"><input type="radio" value="v"'+(l.color.mode=="v"?' checked="checked"':"")+'/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(fa!=null?fa.v:"")+'" title="'+ba.tooltips.value.textbox+'"/>&nbsp;%<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+ba.tooltips.red.radio+'"><input type="radio" value="r"'+(l.color.mode=="r"?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+
(ea!=null?ea.r:"")+'" title="'+ba.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+ba.tooltips.green.radio+'"><input type="radio" value="g"'+(l.color.mode=="g"?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.g:"")+'" title="'+ba.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+ba.tooltips.blue.radio+'"><input type="radio" value="b"'+(l.color.mode=="b"?' checked="checked"': (fa!=null?fa.r:"")+'" title="'+ba.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+ba.tooltips.green.radio+'"><input type="radio" value="g"'+(l.color.mode=="g"?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(fa!=null?fa.g:"")+'" title="'+ba.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+ba.tooltips.blue.radio+'"><input type="radio" value="b"'+(l.color.mode=="b"?' checked="checked"':
"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.b:"")+'" title="'+ba.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(N.alphaSupport?'<label title="'+ba.tooltips.alpha.radio+'"><input type="radio" value="a"'+(l.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(N.alphaSupport?'<input type="text" maxlength="'+(3+N.alphaPrecision)+'" value="'+(ea!=null?Math.precision(ea.a*100/255,N.alphaPrecision): "")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(fa!=null?fa.b:"")+'" title="'+ba.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(N.alphaSupport?'<label title="'+ba.tooltips.alpha.radio+'"><input type="radio" value="a"'+(l.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(N.alphaSupport?'<input type="text" maxlength="'+(3+N.alphaPrecision)+'" value="'+(fa!=null?Math.precision(fa.a*100/255,N.alphaPrecision):
"")+'" title="'+ba.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+ba.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(ea!=null?ea.hex:"")+'"/></label>'+(N.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(ea!=null?ea.ahex.substring(6):"")+'" title="'+ba.tooltips.hex.alpha+'"/></td>':"&nbsp;")+"</tr></tbody></table>";if(N.expandable){C.html(Fa);a(document.body).children("div.jPicker.Container").length== "")+'" title="'+ba.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+ba.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(fa!=null?fa.hex:"")+'"/></label>'+(N.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(fa!=null?fa.ahex.substring(6):"")+'" title="'+ba.tooltips.hex.alpha+'"/></td>':"&nbsp;")+"</tr></tbody></table>";if(N.expandable){C.html(Fa);a(document.body).children("div.jPicker.Container").length==
0?a(document.body).prepend(C):a(document.body).children("div.jPicker.Container:last").after(C);C.mousedown(function(){a(document.body).children("div.jPicker.Container").css({zIndex:10});C.css({zIndex:20})});C.css({left:N.position.x=="left"?Q.offset().left-530-(N.position.y=="center"?25:0)+"px":N.position.x=="center"?Q.offset().left-260+"px":N.position.x=="right"?Q.offset().left-10+(N.position.y=="center"?25:0)+"px":N.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":Q.offset().left+parseInt(N.position.x)+ 0?a(document.body).prepend(C):a(document.body).children("div.jPicker.Container:last").after(C);C.mousedown(function(){a(document.body).children("div.jPicker.Container").css({zIndex:10});C.css({zIndex:20})});C.css({left:N.position.x=="left"?Q.offset().left-530-(N.position.y=="center"?25:0)+"px":N.position.x=="center"?Q.offset().left-260+"px":N.position.x=="right"?Q.offset().left-10+(N.position.y=="center"?25:0)+"px":N.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":Q.offset().left+parseInt(N.position.x)+
"px",position:"absolute",top:N.position.y=="top"?Q.offset().top-312+"px":N.position.y=="center"?Q.offset().top-156+"px":N.position.y=="bottom"?Q.offset().top+25+"px":Q.offset().top+parseInt(N.position.y)+"px"})}else{C=a(d);C.html(Fa)}Fa=C.find("tbody:first");p=Fa.find("div.Map:first");L=Fa.find("div.Bar:first");var Oa=p.find("span"),Va=L.find("span");R=Oa.filter(".Map1:first");O=Oa.filter(".Map2:first");K=Oa.filter(".Map3:first");P=Va.filter(".Map1:first");T=Va.filter(".Map2:first");M=Va.filter(".Map3:first"); "px",position:"absolute",top:N.position.y=="top"?Q.offset().top-312+"px":N.position.y=="center"?Q.offset().top-156+"px":N.position.y=="bottom"?Q.offset().top+25+"px":Q.offset().top+parseInt(N.position.y)+"px"})}else{C=a(d);C.html(Fa)}Fa=C.find("tbody:first");p=Fa.find("div.Map:first");L=Fa.find("div.Bar:first");var Oa=p.find("span"),Va=L.find("span");R=Oa.filter(".Map1:first");O=Oa.filter(".Map2:first");K=Oa.filter(".Map3:first");P=Va.filter(".Map1:first");T=Va.filter(".Map2:first");M=Va.filter(".Map3:first");
ha=Va.filter(".Map4:first");na=Va.filter(".Map5:first");fa=Va.filter(".Map6:first");aa=new q(p,{map:{width:ja.colorMap.width,height:ja.colorMap.height},arrow:{image:ja.clientPath+ja.colorMap.arrow.file,width:ja.colorMap.arrow.width,height:ja.colorMap.arrow.height}});aa.bind(ya);V=new q(L,{map:{width:ja.colorBar.width,height:ja.colorBar.height},arrow:{image:ja.clientPath+ja.colorBar.arrow.file,width:ja.colorBar.arrow.width,height:ja.colorBar.arrow.height}});V.bind(Ga);ra=new h(Fa,ka.active,N.expandable&& aa=Va.filter(".Map4:first");qa=Va.filter(".Map5:first");ha=Va.filter(".Map6:first");ca=new q(p,{map:{width:ja.colorMap.width,height:ja.colorMap.height},arrow:{image:ja.clientPath+ja.colorMap.arrow.file,width:ja.colorMap.arrow.width,height:ja.colorMap.arrow.height}});ca.bind(ya);W=new q(L,{map:{width:ja.colorBar.width,height:ja.colorBar.height},arrow:{image:ja.clientPath+ja.colorBar.arrow.file,width:ja.colorBar.arrow.width,height:ja.colorBar.arrow.height}});W.bind(Ga);ra=new h(Fa,ka.active,N.expandable&&
N.bindToInput?N.input:null,N.alphaPrecision);Oa=ea!=null?ea.hex:null;var $a=Fa.find(".Preview");Va=Fa.find(".Button");oa=$a.find(".Active:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});pa=$a.find(".Current:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"}).bind("click",Da);wa.call(d,pa,Math.precision(ka.current.val("a")*100)/255,4);la=Va.find(".Ok:first").bind("click touchstart",rb);ma=Va.find(".Cancel:first").bind("click touchstart",gb);Ba=Va.find(".Grid:first");setTimeout(function(){Wa.call(d, N.bindToInput?N.input:null,N.alphaPrecision);Oa=fa!=null?fa.hex:null;var $a=Fa.find(".Preview");Va=Fa.find(".Button");na=$a.find(".Active:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});oa=$a.find(".Current:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"}).bind("click",Da);wa.call(d,oa,Math.precision(ka.current.val("a")*100)/255,4);la=Va.find(".Ok:first").bind("click touchstart",rb);ma=Va.find(".Cancel:first").bind("click touchstart",gb);Ba=Va.find(".Grid:first");setTimeout(function(){Wa.call(d,
R,ja.clientPath+"Maps.png");Wa.call(d,O,ja.clientPath+"Maps.png");Wa.call(d,K,ja.clientPath+"map-opacity.png");Wa.call(d,P,ja.clientPath+"Bars.png");Wa.call(d,T,ja.clientPath+"Bars.png");Wa.call(d,M,ja.clientPath+"Bars.png");Wa.call(d,ha,ja.clientPath+"Bars.png");Wa.call(d,na,ja.clientPath+"bar-opacity.png");Wa.call(d,fa,ja.clientPath+"AlphaBar.png");Wa.call(d,$a.find("div:last"),ja.clientPath+"preview-opacity.png")},0);Fa.find("td.Radio input").bind("click touchstart",Ra);if(ka.quickList&&ka.quickList.length> R,ja.clientPath+"Maps.png");Wa.call(d,O,ja.clientPath+"Maps.png");Wa.call(d,K,ja.clientPath+"map-opacity.png");Wa.call(d,P,ja.clientPath+"Bars.png");Wa.call(d,T,ja.clientPath+"Bars.png");Wa.call(d,M,ja.clientPath+"Bars.png");Wa.call(d,aa,ja.clientPath+"Bars.png");Wa.call(d,qa,ja.clientPath+"bar-opacity.png");Wa.call(d,ha,ja.clientPath+"AlphaBar.png");Wa.call(d,$a.find("div:last"),ja.clientPath+"preview-opacity.png")},0);Fa.find("td.Radio input").bind("click touchstart",Ra);if(ka.quickList&&ka.quickList.length>
0){Va="";for(i=0;i<ka.quickList.length;i++){if((typeof ka.quickList[i]).toString().toLowerCase()=="string")ka.quickList[i]=new b({hex:ka.quickList[i]});var qb=ka.quickList[i].val("a"),Qa=ka.quickList[i].val("ahex");if(!N.alphaSupport&&Qa)Qa=Qa.substring(0,6)+"ff";var pb=ka.quickList[i].val("hex");Va+='<span class="QuickColor"'+(Qa&&' title="#'+Qa+'"'||"")+' style="background-color:'+(pb&&"#"+pb||"")+";"+(pb?"":"background-image:url("+ja.clientPath+"NoColor.png)")+(N.alphaSupport&&qb&&qb<255?";opacity:"+ 0){Va="";for(i=0;i<ka.quickList.length;i++){if((typeof ka.quickList[i]).toString().toLowerCase()=="string")ka.quickList[i]=new b({hex:ka.quickList[i]});var qb=ka.quickList[i].val("a"),Qa=ka.quickList[i].val("ahex");if(!N.alphaSupport&&Qa)Qa=Qa.substring(0,6)+"ff";var pb=ka.quickList[i].val("hex");Va+='<span class="QuickColor"'+(Qa&&' title="#'+Qa+'"'||"")+' style="background-color:'+(pb&&"#"+pb||"")+";"+(pb?"":"background-image:url("+ja.clientPath+"NoColor.png)")+(N.alphaSupport&&qb&&qb<255?";opacity:"+
Math.precision(qb/255,4)+";filter:Alpha(opacity="+Math.precision(qb/2.55,4)+")":"")+'">&nbsp;</span>'}Wa.call(d,Ba,ja.clientPath+"bar-opacity.png");Ba.html(Va);Ba.find(".QuickColor").click(ub)}Na.call(d,l.color.mode);ka.active.bind(Aa);a.isFunction(eb)&&ka.active.bind(eb);ka.current.bind(ab);if(N.expandable){d.icon=Q.parents(".Icon:first");Ea=d.icon.find(".Color:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});Ia=d.icon.find(".Alpha:first");Wa.call(d,Ia,ja.clientPath+"bar-opacity.png");wa.call(d, Math.precision(qb/255,4)+";filter:Alpha(opacity="+Math.precision(qb/2.55,4)+")":"")+'">&nbsp;</span>'}Wa.call(d,Ba,ja.clientPath+"bar-opacity.png");Ba.html(Va);Ba.find(".QuickColor").click(ub)}Na.call(d,l.color.mode);ka.active.bind(Aa);a.isFunction(eb)&&ka.active.bind(eb);ka.current.bind(ab);if(N.expandable){d.icon=Q.parents(".Icon:first");Ea=d.icon.find(".Color:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});Ia=d.icon.find(".Alpha:first");Wa.call(d,Ia,ja.clientPath+"bar-opacity.png");wa.call(d,
Ia,Math.precision((255-(ea!=null?ea.a:0))*100/255,4));za=d.icon.find(".Image:first").css({backgroundImage:"url('"+ja.clientPath+ja.picker.file+"')"}).bind("click",Xa);if(N.bindToInput&&N.updateInputColor)N.input.css({backgroundColor:Oa&&"#"+Oa||"transparent",color:ea==null||ea.v>75?"#000000":"#ffffff"});Ka=Fa.find(".Move:first").bind("mousedown",ua);ka.active.bind(xb)}else ob.call(d)},ja=l.images,ba=l.localization,ka={active:(typeof l.color.active).toString().toLowerCase()=="string"?new b({ahex:!l.window.alphaSupport&& Ia,Math.precision((255-(fa!=null?fa.a:0))*100/255,4));za=d.icon.find(".Image:first").css({backgroundImage:"url('"+ja.clientPath+ja.picker.file+"')"}).bind("click",Xa);if(N.bindToInput&&N.updateInputColor)N.input.css({backgroundColor:Oa&&"#"+Oa||"transparent",color:fa==null||fa.v>75?"#000000":"#ffffff"});Ka=Fa.find(".Move:first").bind("mousedown",ua);ka.active.bind(xb)}else ob.call(d)},ja=l.images,ba=l.localization,ka={active:(typeof l.color.active).toString().toLowerCase()=="string"?new b({ahex:!l.window.alphaSupport&&
l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new b({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),current:(typeof l.color.active).toString().toLowerCase()=="string"?new b({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new b({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}), l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new b({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),current:(typeof l.color.active).toString().toLowerCase()=="string"?new b({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new b({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),
quickList:l.color.quickList};a.extend(true,d,{commitCallback:lb,liveCallback:eb,cancelCallback:sb,color:ka,show:ob,hide:yb,destroy:function(){C.find("td.Radio input touchstart").unbind("click",Ra);pa.unbind("click touchstart",Da);ma.unbind("click touchstart",gb);la.unbind("click touchstart",rb);if(l.window.expandable){za.unbind("click",Xa);Ka.unbind("mousedown",ua);d.icon=null}C.find(".QuickColor").unbind("click",ub);fa=na=ha=M=T=P=K=O=R=L=p=null;aa.destroy();aa=null;V.destroy();V=null;ra.destroy(); quickList:l.color.quickList};a.extend(true,d,{commitCallback:lb,liveCallback:eb,cancelCallback:sb,color:ka,show:ob,hide:yb,destroy:function(){C.find("td.Radio input touchstart").unbind("click",Ra);oa.unbind("click touchstart",Da);ma.unbind("click touchstart",gb);la.unbind("click touchstart",rb);if(l.window.expandable){za.unbind("click",Xa);Ka.unbind("mousedown",ua);d.icon=null}C.find(".QuickColor").unbind("click",ub);ha=qa=aa=M=T=P=K=O=R=L=p=null;ca.destroy();ca=null;W.destroy();W=null;ra.destroy();
eb=sb=lb=Ba=ma=la=pa=oa=ra=null;C.html("");for(i=0;i<n.length;i++)n[i]==d&&n.splice(i,1)}});n.push(d);setTimeout(function(){zb.call(d)},0)})};a.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true,alphaSupport:false,alphaPrecision:0,updateInputColor:true},color:{mode:"h",active:new b({ahex:"#ffcc00ff"}),quickList:[new b({h:360,s:33,v:100}),new b({h:360,s:66,v:100}),new b({h:360,s:100,v:100}), eb=sb=lb=Ba=ma=la=oa=na=ra=null;C.html("");for(i=0;i<n.length;i++)n[i]==d&&n.splice(i,1)}});n.push(d);setTimeout(function(){zb.call(d)},0)})};a.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true,alphaSupport:false,alphaPrecision:0,updateInputColor:true},color:{mode:"h",active:new b({ahex:"#ffcc00ff"}),quickList:[new b({h:360,s:33,v:100}),new b({h:360,s:66,v:100}),new b({h:360,s:100,v:100}),
new b({h:360,s:100,v:75}),new b({h:360,s:100,v:50}),new b({h:180,s:0,v:100}),new b({h:30,s:33,v:100}),new b({h:30,s:66,v:100}),new b({h:30,s:100,v:100}),new b({h:30,s:100,v:75}),new b({h:30,s:100,v:50}),new b({h:180,s:0,v:90}),new b({h:60,s:33,v:100}),new b({h:60,s:66,v:100}),new b({h:60,s:100,v:100}),new b({h:60,s:100,v:75}),new b({h:60,s:100,v:50}),new b({h:180,s:0,v:80}),new b({h:90,s:33,v:100}),new b({h:90,s:66,v:100}),new b({h:90,s:100,v:100}),new b({h:90,s:100,v:75}),new b({h:90,s:100,v:50}), new b({h:360,s:100,v:75}),new b({h:360,s:100,v:50}),new b({h:180,s:0,v:100}),new b({h:30,s:33,v:100}),new b({h:30,s:66,v:100}),new b({h:30,s:100,v:100}),new b({h:30,s:100,v:75}),new b({h:30,s:100,v:50}),new b({h:180,s:0,v:90}),new b({h:60,s:33,v:100}),new b({h:60,s:66,v:100}),new b({h:60,s:100,v:100}),new b({h:60,s:100,v:75}),new b({h:60,s:100,v:50}),new b({h:180,s:0,v:80}),new b({h:90,s:33,v:100}),new b({h:90,s:66,v:100}),new b({h:90,s:100,v:100}),new b({h:90,s:100,v:75}),new b({h:90,s:100,v:50}),
new b({h:180,s:0,v:70}),new b({h:120,s:33,v:100}),new b({h:120,s:66,v:100}),new b({h:120,s:100,v:100}),new b({h:120,s:100,v:75}),new b({h:120,s:100,v:50}),new b({h:180,s:0,v:60}),new b({h:150,s:33,v:100}),new b({h:150,s:66,v:100}),new b({h:150,s:100,v:100}),new b({h:150,s:100,v:75}),new b({h:150,s:100,v:50}),new b({h:180,s:0,v:50}),new b({h:180,s:33,v:100}),new b({h:180,s:66,v:100}),new b({h:180,s:100,v:100}),new b({h:180,s:100,v:75}),new b({h:180,s:100,v:50}),new b({h:180,s:0,v:40}),new b({h:210, new b({h:180,s:0,v:70}),new b({h:120,s:33,v:100}),new b({h:120,s:66,v:100}),new b({h:120,s:100,v:100}),new b({h:120,s:100,v:75}),new b({h:120,s:100,v:50}),new b({h:180,s:0,v:60}),new b({h:150,s:33,v:100}),new b({h:150,s:66,v:100}),new b({h:150,s:100,v:100}),new b({h:150,s:100,v:75}),new b({h:150,s:100,v:50}),new b({h:180,s:0,v:50}),new b({h:180,s:33,v:100}),new b({h:180,s:66,v:100}),new b({h:180,s:100,v:100}),new b({h:180,s:100,v:75}),new b({h:180,s:100,v:50}),new b({h:180,s:0,v:40}),new b({h:210,
s:33,v:100}),new b({h:210,s:66,v:100}),new b({h:210,s:100,v:100}),new b({h:210,s:100,v:75}),new b({h:210,s:100,v:50}),new b({h:180,s:0,v:30}),new b({h:240,s:33,v:100}),new b({h:240,s:66,v:100}),new b({h:240,s:100,v:100}),new b({h:240,s:100,v:75}),new b({h:240,s:100,v:50}),new b({h:180,s:0,v:20}),new b({h:270,s:33,v:100}),new b({h:270,s:66,v:100}),new b({h:270,s:100,v:100}),new b({h:270,s:100,v:75}),new b({h:270,s:100,v:50}),new b({h:180,s:0,v:10}),new b({h:300,s:33,v:100}),new b({h:300,s:66,v:100}), s:33,v:100}),new b({h:210,s:66,v:100}),new b({h:210,s:100,v:100}),new b({h:210,s:100,v:75}),new b({h:210,s:100,v:50}),new b({h:180,s:0,v:30}),new b({h:240,s:33,v:100}),new b({h:240,s:66,v:100}),new b({h:240,s:100,v:100}),new b({h:240,s:100,v:75}),new b({h:240,s:100,v:50}),new b({h:180,s:0,v:20}),new b({h:270,s:33,v:100}),new b({h:270,s:66,v:100}),new b({h:270,s:100,v:100}),new b({h:270,s:100,v:75}),new b({h:270,s:100,v:50}),new b({h:180,s:0,v:10}),new b({h:300,s:33,v:100}),new b({h:300,s:66,v:100}),
@ -663,8 +663,8 @@ l.beginPath();l.globalAlpha=0.5;l.moveTo(0.5,s);l.lineTo(0.5,0);l.moveTo(s,0.5);
"g");a(u,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"});var c=$("#canvas_background");c.after(u);u=h.createElementNS("http://www.w3.org/2000/svg","pattern");a(u,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var f=h.createElementNS("http://www.w3.org/2000/svg","image");a(f,{x:0,y:0,width:100,height:100});u.appendChild(f);$("#svgroot defs").append(u);h=h.createElementNS("http://www.w3.org/2000/svg","rect");a(h,{width:"100%",height:"100%", "g");a(u,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"});var c=$("#canvas_background");c.after(u);u=h.createElementNS("http://www.w3.org/2000/svg","pattern");a(u,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var f=h.createElementNS("http://www.w3.org/2000/svg","image");a(f,{x:0,y:0,width:100,height:100});u.appendChild(f);$("#svgroot defs").append(u);h=h.createElementNS("http://www.w3.org/2000/svg","rect");a(h,{width:"100%",height:"100%",
x:0,y:0,"stroke-width":0,stroke:"none",fill:"url(#gridpattern)",style:"pointer-events: none; display:visible;"});$("#canvasGrid").append(h)}return{name:"view_grid",zoomChanged:function(d){b&&q(d)},buttons:[{id:"view_grid",type:"menu",after:"tool_wireframe",panel:"view_menu",title:"View Grid",events:{click:function(){if($("#view_grid").hasClass("push_button_pressed")){svgEditor.curConfig.showGrid=b=false;$("#view_grid").removeClass("push_button_pressed");$("#canvasGrid").attr("display","none")}else{svgEditor.curConfig.showGrid= x:0,y:0,"stroke-width":0,stroke:"none",fill:"url(#gridpattern)",style:"pointer-events: none; display:visible;"});$("#canvasGrid").append(h)}return{name:"view_grid",zoomChanged:function(d){b&&q(d)},buttons:[{id:"view_grid",type:"menu",after:"tool_wireframe",panel:"view_menu",title:"View Grid",events:{click:function(){if($("#view_grid").hasClass("push_button_pressed")){svgEditor.curConfig.showGrid=b=false;$("#view_grid").removeClass("push_button_pressed");$("#canvasGrid").attr("display","none")}else{svgEditor.curConfig.showGrid=
b=true;$("#view_grid").addClass("push_button_pressed");$("#canvasGrid").attr("display","normal");q(svgCanvas.getZoom())}}}}]}});svgEditor.addExtension("shapes",function(){function a(){$("#shape_buttons").empty();$("#shape_buttons").append(L.buttons)}function q(O){var K=p[O];if(K){L=K;K.buttons.length||h(O,K);a()}else{$("#shape_buttons").html("Loading...");$.getJSON("extensions/shapelib/"+O+".json",function(P){L=p[O]={data:P.data,size:P.size,fill:P.fill};h(O,P);a()})}}function h(O,K){var P=L.size||300,T=L.fill||false,M=P*0.05;M=[-M,-M,P+M*2,P+M*2].join(" ");P=T?0:P/30;P=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+ b=true;$("#view_grid").addClass("push_button_pressed");$("#canvasGrid").attr("display","normal");q(svgCanvas.getZoom())}}}}]}});svgEditor.addExtension("shapes",function(){function a(){$("#shape_buttons").empty();$("#shape_buttons").append(L.buttons)}function q(O){var K=p[O];if(K){L=K;K.buttons.length||h(O,K);a()}else{$("#shape_buttons").html("Loading...");$.getJSON("extensions/shapelib/"+O+".json",function(P){L=p[O]={data:P.data,size:P.size,fill:P.fill};h(O,P);a()})}}function h(O,K){var P=L.size||300,T=L.fill||false,M=P*0.05;M=[-M,-M,P+M*2,P+M*2].join(" ");P=T?0:P/30;P=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+
M+'"><path fill="#333" stroke="transparent" stroke-width="'+P+'" /></svg></svg>',"text/xml");P.documentElement.setAttribute("width",40);P.documentElement.setAttribute("height",40);T=$(document.importNode(P.documentElement,true));var ha=K.data;L.buttons=[];for(var na in ha){var fa=ha[na],aa=T.clone();if(fa.charAt(fa.length-1)=="x"){P=32;M=P*0.05;M=[-M,-M,P+M*2,P+M*2].join(" ");aa.find("svg").attr("viewBox",M);fa.replace("x","")}aa.find("path").attr("d",fa);P=aa.wrap('<div class="tool_button">').parent().attr({id:R+ M+'"><path fill="#333" stroke="transparent" stroke-width="'+P+'" /></svg></svg>',"text/xml");P.documentElement.setAttribute("width",40);P.documentElement.setAttribute("height",40);T=$(document.importNode(P.documentElement,true));var aa=K.data;L.buttons=[];for(var qa in aa){var ha=aa[qa],ca=T.clone();if(ha.charAt(ha.length-1)=="x"){P=32;M=P*0.05;M=[-M,-M,P+M*2,P+M*2].join(" ");ca.find("svg").attr("viewBox",M);ha.replace("x","")}ca.find("path").attr("d",ha);P=ca.wrap('<div class="tool_button">').parent().attr({id:R+
"_"+na,title:na});L.buttons.push(P[0])}}var b,n,u=svgEditor.canvas,c,f,d,l=u.getRootElem(),s={},C={basic:"Basic",object:"Objects",symbol:"Symbols",arrow:"Arrows",flowchart:"Flowchart",nature:"Nature",game:"Cards & Chess",dialog_balloon:"Dialog balloons",music:"Music",weather:"Weather &amp; Time",ui:"User Interface",social:"Social Web"},p={basic:{data:{star_points_5:"m1,116.58409l113.82668,0l35.17332,-108.13487l35.17334,108.13487l113.82666,0l-92.08755,66.83026l35.17514,108.13487l-92.08759,-66.83208l-92.08757,66.83208l35.17515,-108.13487l-92.08758,-66.83026z", "_"+qa,title:qa});L.buttons.push(P[0])}}var b,n,u=svgEditor.canvas,c,f,d,l=u.getRootElem(),s={},C={basic:"Basic",object:"Objects",symbol:"Symbols",arrow:"Arrows",flowchart:"Flowchart",nature:"Nature",game:"Cards & Chess",dialog_balloon:"Dialog balloons",music:"Music",weather:"Weather &amp; Time",ui:"User Interface",social:"Social Web"},p={basic:{data:{star_points_5:"m1,116.58409l113.82668,0l35.17332,-108.13487l35.17334,108.13487l113.82666,0l-92.08755,66.83026l35.17514,108.13487l-92.08759,-66.83208l-92.08757,66.83208l35.17515,-108.13487l-92.08758,-66.83026z",
donut:"m1,150l0,0c0,-82.29042 66.70958,-149 149,-149l0,0c39.51724,0 77.41599,15.69816 105.35889,43.64108c27.94293,27.94293 43.64111,65.84165 43.64111,105.35892l0,0c0,82.29041 -66.70958,149 -149,149l0,0c-82.29041,0 -149,-66.70959 -149,-149zm74.5,0l0,0c0,41.1452 33.35481,74.5 74.5,74.5c41.14522,0 74.5,-33.3548 74.5,-74.5c0,-41.1452 -33.3548,-74.5 -74.5,-74.5l0,0c-41.14519,0 -74.5,33.35481 -74.5,74.5z",triangle:"m1,280.375l149,-260.75l149,260.75z",right_triangle:"m1,299l0,-298l298,298z",diamond:"m1,150l149,-149l149,149l-149,149l-149,-149z", donut:"m1,150l0,0c0,-82.29042 66.70958,-149 149,-149l0,0c39.51724,0 77.41599,15.69816 105.35889,43.64108c27.94293,27.94293 43.64111,65.84165 43.64111,105.35892l0,0c0,82.29041 -66.70958,149 -149,149l0,0c-82.29041,0 -149,-66.70959 -149,-149zm74.5,0l0,0c0,41.1452 33.35481,74.5 74.5,74.5c41.14522,0 74.5,-33.3548 74.5,-74.5c0,-41.1452 -33.3548,-74.5 -74.5,-74.5l0,0c-41.14519,0 -74.5,33.35481 -74.5,74.5z",triangle:"m1,280.375l149,-260.75l149,260.75z",right_triangle:"m1,299l0,-298l298,298z",diamond:"m1,150l149,-149l149,149l-149,149l-149,-149z",
pentagon:"m1.00035,116.97758l148.99963,-108.4053l148.99998,108.4053l-56.91267,175.4042l-184.1741,0l-56.91284,-175.4042z",hexagon:"m1,149.99944l63.85715,-127.71428l170.28572,0l63.85713,127.71428l-63.85713,127.71428l-170.28572,0l-63.85715,-127.71428z",septagon1:"m0.99917,191.06511l29.51249,-127.7108l119.48833,-56.83673l119.48836,56.83673l29.51303,127.7108l-82.69087,102.41679l-132.62103,0l-82.69031,-102.41679z",heptagon:"m1,88.28171l87.28172,-87.28171l123.43653,0l87.28172,87.28171l0,123.43654l-87.28172,87.28172l-123.43653,0l-87.28172,-87.28172l0,-123.43654z", pentagon:"m1.00035,116.97758l148.99963,-108.4053l148.99998,108.4053l-56.91267,175.4042l-184.1741,0l-56.91284,-175.4042z",hexagon:"m1,149.99944l63.85715,-127.71428l170.28572,0l63.85713,127.71428l-63.85713,127.71428l-170.28572,0l-63.85715,-127.71428z",septagon1:"m0.99917,191.06511l29.51249,-127.7108l119.48833,-56.83673l119.48836,56.83673l29.51303,127.7108l-82.69087,102.41679l-132.62103,0l-82.69031,-102.41679z",heptagon:"m1,88.28171l87.28172,-87.28171l123.43653,0l87.28172,87.28171l0,123.43654l-87.28172,87.28172l-123.43653,0l-87.28172,-87.28172l0,-123.43654z",
decagon:"m1,150.00093l28.45646,-88.40318l74.49956,-54.63682l92.08794,0l74.50002,54.63682l28.45599,88.40318l-28.45599,88.40318l-74.50002,54.63681l-92.08794,0l-74.49956,-54.63681l-28.45646,-88.40318z",dodecagon:"m1,110.07421l39.92579,-69.14842l69.14842,-39.92579l79.85159,0l69.14842,39.92579l39.92578,69.14842l0,79.85159l-39.92578,69.14842l-69.14842,39.92578l-79.85159,0l-69.14842,-39.92578l-39.92579,-69.14842l0,-79.85159z",trapezoid:"m1,299l55.875,-298l186.25001,0l55.87498,298z",dialog_balloon_1:"m0.99786,35.96579l0,0c0,-19.31077 15.28761,-34.96524 34.14583,-34.96524l15.52084,0l0,0l74.50001,0l139.68748,0c9.05606,0 17.74118,3.68382 24.14478,10.24108c6.40356,6.55726 10.00107,15.45081 10.00107,24.72416l0,87.41311l0,0l0,52.44785l0,0c0,19.31078 -15.2876,34.96524 -34.14584,34.96524l-139.68748,0l-97.32507,88.90848l22.82506,-88.90848l-15.52084,0c-18.85822,0 -34.14583,-15.65446 -34.14583,-34.96524l0,0l0,-52.44785l0,0z", decagon:"m1,150.00093l28.45646,-88.40318l74.49956,-54.63682l92.08794,0l74.50002,54.63682l28.45599,88.40318l-28.45599,88.40318l-74.50002,54.63681l-92.08794,0l-74.49956,-54.63681l-28.45646,-88.40318z",dodecagon:"m1,110.07421l39.92579,-69.14842l69.14842,-39.92579l79.85159,0l69.14842,39.92579l39.92578,69.14842l0,79.85159l-39.92578,69.14842l-69.14842,39.92578l-79.85159,0l-69.14842,-39.92578l-39.92579,-69.14842l0,-79.85159z",trapezoid:"m1,299l55.875,-298l186.25001,0l55.87498,298z",dialog_balloon_1:"m0.99786,35.96579l0,0c0,-19.31077 15.28761,-34.96524 34.14583,-34.96524l15.52084,0l0,0l74.50001,0l139.68748,0c9.05606,0 17.74118,3.68382 24.14478,10.24108c6.40356,6.55726 10.00107,15.45081 10.00107,24.72416l0,87.41311l0,0l0,52.44785l0,0c0,19.31078 -15.2876,34.96524 -34.14584,34.96524l-139.68748,0l-97.32507,88.90848l22.82506,-88.90848l-15.52084,0c-18.85822,0 -34.14583,-15.65446 -34.14583,-34.96524l0,0l0,-52.44785l0,0z",
@ -676,8 +676,8 @@ times:"m1.00089,73.36786l72.36697,-72.36697l76.87431,76.87368l76.87431,-76.87368
$('<div id="shape_buttons">');$("#tools_shapelib > *").wrapAll(O);var K=$("#tools_shapelib_show");q("basic");$("#shape_buttons").mouseup(function(T){T=$(T.target).closest("div.tool_button");if(T.length){var M=T.children().clone().attr({width:24,height:24});K.children(":not(.flyout_arrow_horiz)").remove();K.append(M).attr("data-curopt","#"+T[0].id).mouseup();u.setMode(R);n=T[0].id.substr((R+"_").length);b=L.data[n];$(".tools_flyout").fadeOut()}});O=$('<div id="shape_cats">');var P="";$.each(C,function(T, $('<div id="shape_buttons">');$("#tools_shapelib > *").wrapAll(O);var K=$("#tools_shapelib_show");q("basic");$("#shape_buttons").mouseup(function(T){T=$(T.target).closest("div.tool_button");if(T.length){var M=T.children().clone().attr({width:24,height:24});K.children(":not(.flyout_arrow_horiz)").remove();K.append(M).attr("data-curopt","#"+T[0].id).mouseup();u.setMode(R);n=T[0].id.substr((R+"_").length);b=L.data[n];$(".tools_flyout").fadeOut()}});O=$('<div id="shape_cats">');var P="";$.each(C,function(T,
M){P+="<div data-cat="+T+">"+M+"</div>"});O.html(P).children().bind("mouseup",function(){var T=$(this);T.siblings().removeClass("current");T.addClass("current");q(T.attr("data-cat"));return false});O.children().eq(0).addClass("current");$("#tools_shapelib").prepend(O);K.mouseup(function(){u.setMode(b?R:"select")});$("#tool_shapelib").remove();O=$("#tools_shapelib").height();$("#tools_shapelib").css({"margin-top":-(O/2),"margin-left":3})},mouseDown:function(O){if(u.getMode()===R){var K=f=O.start_x; M){P+="<div data-cat="+T+">"+M+"</div>"});O.html(P).children().bind("mouseup",function(){var T=$(this);T.siblings().removeClass("current");T.addClass("current");q(T.attr("data-cat"));return false});O.children().eq(0).addClass("current");$("#tools_shapelib").prepend(O);K.mouseup(function(){u.setMode(b?R:"select")});$("#tool_shapelib").remove();O=$("#tools_shapelib").height();$("#tools_shapelib").css({"margin-top":-(O/2),"margin-left":3})},mouseDown:function(O){if(u.getMode()===R){var K=f=O.start_x;
O=d=O.start_y;var P=u.getStyle();c=u.addSvgElementFromJson({element:"path",curStyles:true,attr:{d:b,id:u.getNextId(),opacity:P.opacity/2,style:"pointer-events:none"}});c.setAttribute("d",b);if(/[a-z]/.test(b)){b=L.data[n]=u.pathActions.convertPath(c);c.setAttribute("d",b);u.pathActions.fixEnd(c)}c.setAttribute("transform","translate("+K+","+O+") scale(0.005) translate("+-K+","+-O+")");u.recalculateDimensions(c);u.getTransformList(c);s=c.getBBox();totalScale={sx:1,sy:1};return{started:true}}},mouseMove:function(O){if(u.getMode()=== O=d=O.start_y;var P=u.getStyle();c=u.addSvgElementFromJson({element:"path",curStyles:true,attr:{d:b,id:u.getNextId(),opacity:P.opacity/2,style:"pointer-events:none"}});c.setAttribute("d",b);if(/[a-z]/.test(b)){b=L.data[n]=u.pathActions.convertPath(c);c.setAttribute("d",b);u.pathActions.fixEnd(c)}c.setAttribute("transform","translate("+K+","+O+") scale(0.005) translate("+-K+","+-O+")");u.recalculateDimensions(c);u.getTransformList(c);s=c.getBBox();totalScale={sx:1,sy:1};return{started:true}}},mouseMove:function(O){if(u.getMode()===
R){var K=u.getZoom(),P=O.event,T=O.mouse_x/K,M=O.mouse_y/K;O=u.getTransformList(c);var ha=c.getBBox();K=ha.x;var na=ha.y,fa=ha.width,aa=ha.height,V=T-f,ra=M-d,ia={x:Math.min(f,T),y:Math.min(d,M),width:Math.abs(T-f),height:Math.abs(M-d)},da=ha=0;aa=aa?(aa+ra)/aa:1;fa=fa?(fa+V)/fa:1;fa=ia.width/s.width;aa=ia.height/s.height;fa=fa||1;aa=aa||1;if(T<f)ha=s.width;if(M<d)da=s.height;T=l.createSVGTransform();M=l.createSVGTransform();ia=l.createSVGTransform();T.setTranslate(-(K+ha),-(na+da));if(P.shiftKey){replaced= R){var K=u.getZoom(),P=O.event,T=O.mouse_x/K,M=O.mouse_y/K;O=u.getTransformList(c);var aa=c.getBBox();K=aa.x;var qa=aa.y,ha=aa.width,ca=aa.height,W=T-f,ra=M-d,ia={x:Math.min(f,T),y:Math.min(d,M),width:Math.abs(T-f),height:Math.abs(M-d)},ea=aa=0;ca=ca?(ca+ra)/ca:1;ha=ha?(ha+W)/ha:1;ha=ia.width/s.width;ca=ia.height/s.height;ha=ha||1;ca=ca||1;if(T<f)aa=s.width;if(M<d)ea=s.height;T=l.createSVGTransform();M=l.createSVGTransform();ia=l.createSVGTransform();T.setTranslate(-(K+aa),-(qa+ea));if(P.shiftKey){replaced=
true;P=Math.min(Math.abs(fa),Math.abs(aa));fa=P*(fa<0?-1:1);aa=P*(aa<0?-1:1);if(totalScale.sx!=totalScale.sy){P=totalScale.sx>totalScale.sy?1:totalScale.sx/totalScale.sy;fa*=totalScale.sy>totalScale.sx?1:totalScale.sy/totalScale.sx;aa*=P}}totalScale.sx*=fa;totalScale.sy*=aa;M.setScale(fa,aa);ia.setTranslate(K+ha,na+da);O.appendItem(ia);O.appendItem(M);O.appendItem(T);u.recalculateDimensions(c);s=c.getBBox()}},mouseUp:function(O){if(u.getMode()===R){if(O.mouse_x==f&&O.mouse_y==d)return{keep:false, true;P=Math.min(Math.abs(ha),Math.abs(ca));ha=P*(ha<0?-1:1);ca=P*(ca<0?-1:1);if(totalScale.sx!=totalScale.sy){P=totalScale.sx>totalScale.sy?1:totalScale.sx/totalScale.sy;ha*=totalScale.sy>totalScale.sx?1:totalScale.sy/totalScale.sx;ca*=P}}totalScale.sx*=ha;totalScale.sy*=ca;M.setScale(ha,ca);ia.setTranslate(K+aa,qa+ea);O.appendItem(ia);O.appendItem(M);O.appendItem(T);u.recalculateDimensions(c);s=c.getBBox()}},mouseUp:function(O){if(u.getMode()===R){if(O.mouse_x==f&&O.mouse_y==d)return{keep:false,
element:c,started:false};u.setMode("select");return{keep:true,element:c,started:false}}}}});(function(){for(var a=0,q=["ms","moz","webkit","o"],h=0;h<q.length&&!window.requestAnimationFrame;++h){window.requestAnimationFrame=window[q[h]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[q[h]+"CancelAnimationFrame"]||window[q[h]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var n=(new Date).getTime(),u=Math.max(0,16-(n-a)),c=window.setTimeout(function(){b(n+u)},u);a=n+u;return c};if(!window.cancelAnimationFrame)window.cancelAnimationFrame= element:c,started:false};u.setMode("select");return{keep:true,element:c,started:false}}}}});(function(){for(var a=0,q=["ms","moz","webkit","o"],h=0;h<q.length&&!window.requestAnimationFrame;++h){window.requestAnimationFrame=window[q[h]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[q[h]+"CancelAnimationFrame"]||window[q[h]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var n=(new Date).getTime(),u=Math.max(0,16-(n-a)),c=window.setTimeout(function(){b(n+u)},u);a=n+u;return c};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
function(b){clearTimeout(b)}})();(function(a){function q(p){var L=p.originalEvent;if(!L.touches||L.targetTouches.length===1&&L.touches.length===1){c.call(this,p);p=a(this);p.bind(s,h);p.bind(l,b)}else{clearTimeout(C);u.call(this)}}function h(p){if(C!=null){var L=p.originalEvent;p=L.changedTouches?L.changedTouches[0].pageX:L.pageX;L=L.changedTouches?L.changedTouches[0].pageY:L.pageY;var R=a(this).data("taphold.point");p=p-R.x;L=L-R.y;if(Math.sqrt(p*p+L*L)>d){clearTimeout(C);u.call(this)}}}function b(){clearTimeout(C);u.call(this)} function(b){clearTimeout(b)}})();(function(a){function q(p){var L=p.originalEvent;if(!L.touches||L.targetTouches.length===1&&L.touches.length===1){c.call(this,p);p=a(this);p.bind(s,h);p.bind(l,b)}else{clearTimeout(C);u.call(this)}}function h(p){if(C!=null){var L=p.originalEvent;p=L.changedTouches?L.changedTouches[0].pageX:L.pageX;L=L.changedTouches?L.changedTouches[0].pageY:L.pageY;var R=a(this).data("taphold.point");p=p-R.x;L=L-R.y;if(Math.sqrt(p*p+L*L)>d){clearTimeout(C);u.call(this)}}}function b(){clearTimeout(C);u.call(this)}
function n(p){u.call(this);a(this).data("taphold.handler").call(this,p)}function u(){C=null;a(this).unbind(s,h);a(this).unbind(l,b)}function c(p){if(C==null){var L=this;C=setTimeout(function(){n.call(L,p)},f);var R=p.originalEvent,O={};O.x=R.changedTouches?R.changedTouches[0].pageX:R.pageX;O.y=R.changedTouches?R.changedTouches[0].pageY:R.pageY;a(this).data("taphold.point",O)}}var f=1E3,d=5,l="touchend",s="touchmove",C=null;a.event.special.taphold={setup:function(){},add:function(p){a(this).data("taphold.handler", function n(p){u.call(this);a(this).data("taphold.handler").call(this,p)}function u(){C=null;a(this).unbind(s,h);a(this).unbind(l,b)}function c(p){if(C==null){var L=this;C=setTimeout(function(){n.call(L,p)},f);var R=p.originalEvent,O={};O.x=R.changedTouches?R.changedTouches[0].pageX:R.pageX;O.y=R.changedTouches?R.changedTouches[0].pageY:R.pageY;a(this).data("taphold.point",O)}}var f=1E3,d=5,l="touchend",s="touchmove",C=null;a.event.special.taphold={setup:function(){},add:function(p){a(this).data("taphold.handler",

View File

@ -75,19 +75,19 @@ var supportsPathInsertItemBefore_ = (function() {
// text character positioning (for IE9) // text character positioning (for IE9)
var supportsGoodTextCharPos_ = (function() { var supportsGoodTextCharPos_ = (function() {
var retValue = false; // var retValue = false;
var svgroot = document.createElementNS(svgns, 'svg'); // var svgroot = document.createElementNS(svgns, 'svg');
var svgcontent = document.createElementNS(svgns, 'svg'); // var svgcontent = document.createElementNS(svgns, 'svg');
document.documentElement.appendChild(svgroot); // document.documentElement.appendChild(svgroot);
svgcontent.setAttribute('x', 5); // svgcontent.setAttribute('x', 5);
svgroot.appendChild(svgcontent); // svgroot.appendChild(svgcontent);
var text = document.createElementNS(svgns,'text'); // var text = document.createElementNS(svgns,'text');
text.textContent = 'a'; // text.textContent = 'a';
svgcontent.appendChild(text); // svgcontent.appendChild(text);
var pos = text.getStartPositionOfChar(0) // var pos = text.getStartPositionOfChar(0)
pos = pos.x; //if you put it on one line it fails when compiled // pos = pos.x; //if you put it on one line it fails when compiled
document.documentElement.removeChild(svgroot); // document.documentElement.removeChild(svgroot);
return (pos === 0); // return (pos === 0);
})(); })();
var supportsPathBBox_ = (function() { var supportsPathBBox_ = (function() {

View File

@ -1,31 +1,31 @@
function touchHandler(a){var q=a.changedTouches,h=q[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var n=document.createEvent("MouseEvent");n.initMouseEvent(b,true,true,window,1,h.screenX,h.screenY,h.clientX,h.clientY,false,false,false,false,0,null);if(q.length<2){h.target.dispatchEvent(n);a.preventDefault()}};(function(a){function q(h){if(typeof h.data==="string"){var b=h.handler,n=h.data.toLowerCase().split(" ");h.handler=function(u){if(!(this!==u.target&&(/textarea|select/i.test(u.target.nodeName)||u.target.type==="text"))){var c=u.type!=="keypress"&&a.hotkeys.specialKeys[u.which],f=String.fromCharCode(u.which).toLowerCase(),d="",l={};if(u.altKey&&c!=="alt")d+="alt+";if(u.ctrlKey&&c!=="ctrl")d+="ctrl+";if(u.metaKey&&!u.ctrlKey&&c!=="meta")d+="meta+";if(u.shiftKey&&c!=="shift")d+="shift+";if(c)l[d+c]= function touchHandler(a){var q=a.changedTouches,h=q[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var n=document.createEvent("MouseEvent");n.initMouseEvent(b,true,true,window,1,h.screenX,h.screenY,h.clientX,h.clientY,false,false,false,false,0,null);if(q.length<2){h.target.dispatchEvent(n);a.preventDefault()}};(function(a){function q(h){if(typeof h.data==="string"){var b=h.handler,n=h.data.toLowerCase().split(" ");h.handler=function(u){if(!(this!==u.target&&(/textarea|select/i.test(u.target.nodeName)||u.target.type==="text"))){var c=u.type!=="keypress"&&a.hotkeys.specialKeys[u.which],f=String.fromCharCode(u.which).toLowerCase(),d="",l={};if(u.altKey&&c!=="alt")d+="alt+";if(u.ctrlKey&&c!=="ctrl")d+="ctrl+";if(u.metaKey&&!u.ctrlKey&&c!=="meta")d+="meta+";if(u.shiftKey&&c!=="shift")d+="shift+";if(c)l[d+c]=
true;else{l[d+f]=true;l[d+a.hotkeys.shiftNums[f]]=true;if(d==="shift+")l[a.hotkeys.shiftNums[f]]=true}c=0;for(f=n.length;c<f;c++)if(l[n[c]])return b.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9", true;else{l[d+f]=true;l[d+a.hotkeys.shiftNums[f]]=true;if(d==="shift+")l[a.hotkeys.shiftNums[f]]=true}c=0;for(f=n.length;c<f;c++)if(l[n[c]])return b.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",
106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:q}})})(jQuery);(function(a,q){function h(da){return typeof da==="string"}function b(da){var U=d.call(arguments,1);return function(){return da.apply(this,U.concat(d.call(arguments)))}}function n(da,U,Y,oa,pa){var la;if(oa!==f){U=Y.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Y=U[3]||"";if(pa===2&&h(oa))oa=oa.replace(da?V:aa,"");else{la=p(U[2]);oa=h(oa)?p[da?ha:M](oa):oa;oa=pa===2?oa:pa===1?a.extend({},oa,la):a.extend({},la,oa);oa=s(oa);if(da)oa=oa.replace(ra,l)}da=U[1]+(da?"#":oa||!U[1]?"?":"")+oa+Y}else da= 106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:q}})})(jQuery);(function(a,q){function h(ea){return typeof ea==="string"}function b(ea){var U=d.call(arguments,1);return function(){return ea.apply(this,U.concat(d.call(arguments)))}}function n(ea,U,Y,na,oa){var la;if(na!==f){U=Y.match(ea?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Y=U[3]||"";if(oa===2&&h(na))na=na.replace(ea?W:ca,"");else{la=p(U[2]);na=h(na)?p[ea?aa:M](na):na;na=oa===2?na:oa===1?a.extend({},na,la):a.extend({},la,na);na=s(na);if(ea)na=na.replace(ra,l)}ea=U[1]+(ea?"#":na||!U[1]?"?":"")+na+Y}else ea=
U(Y!==f?Y:q[na][fa]);return da}function u(da,U,Y){if(U===f||typeof U==="boolean"){Y=U;U=s[da?ha:M]()}else U=h(U)?U.replace(da?V:aa,""):U;return p(U,Y)}function c(da,U,Y,oa){if(!h(Y)&&typeof Y!=="object"){oa=Y;Y=U;U=f}return this.each(function(){var pa=a(this),la=U||P()[(this.nodeName||"").toLowerCase()]||"",ma=la&&pa.attr(la)||"";pa.attr(la,s[da](ma,Y,oa))})}var f,d=Array.prototype.slice,l=decodeURIComponent,s=a.param,C,p,L,R=a.bbq=a.bbq||{},O,K,P,T=a.event.special,M="querystring",ha="fragment",na= U(Y!==f?Y:q[qa][ha]);return ea}function u(ea,U,Y){if(U===f||typeof U==="boolean"){Y=U;U=s[ea?aa:M]()}else U=h(U)?U.replace(ea?W:ca,""):U;return p(U,Y)}function c(ea,U,Y,na){if(!h(Y)&&typeof Y!=="object"){na=Y;Y=U;U=f}return this.each(function(){var oa=a(this),la=U||P()[(this.nodeName||"").toLowerCase()]||"",ma=la&&oa.attr(la)||"";oa.attr(la,s[ea](ma,Y,na))})}var f,d=Array.prototype.slice,l=decodeURIComponent,s=a.param,C,p,L,R=a.bbq=a.bbq||{},O,K,P,T=a.event.special,M="querystring",aa="fragment",qa=
"location",fa="href",aa=/^.*\?|#.*$/g,V=/^.*\#/,ra,ia={};s[M]=b(n,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});s[ha]=C=b(n,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);ra=RegExp(da.join("|"),"g")};C.noEscape(",/");a.deparam=p=function(da,U){var Y={},oa={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(pa,la){var ma=la.split("="),Ba=l(ma[0]),Ea=Y,Ia= "location",ha="href",ca=/^.*\?|#.*$/g,W=/^.*\#/,ra,ia={};s[M]=b(n,0,function(ea){return ea.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});s[aa]=C=b(n,1,function(ea){return ea.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(ea){ea=ea||"";ea=a.map(ea.split(""),encodeURIComponent);ra=RegExp(ea.join("|"),"g")};C.noEscape(",/");a.deparam=p=function(ea,U){var Y={},na={"true":true,"false":false,"null":null};a.each(ea.replace(/\+/g," ").split("&"),function(oa,la){var ma=la.split("="),Ba=l(ma[0]),Ea=Y,Ia=
0,za=Ba.split("]["),Ka=za.length-1;if(/\[/.test(za[0])&&/\]$/.test(za[Ka])){za[Ka]=za[Ka].replace(/\]$/,"");za=za.shift().split("[").concat(za);Ka=za.length-1}else Ka=0;if(ma.length===2){ma=l(ma[1]);if(U)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?f:oa[ma]!==f?oa[ma]:ma;if(Ka)for(;Ia<=Ka;Ia++){Ba=za[Ia]===""?Ea.length:za[Ia];Ea=Ea[Ba]=Ia<Ka?Ea[Ba]||(za[Ia+1]&&isNaN(za[Ia+1])?{}:[]):ma}else if(a.isArray(Y[Ba]))Y[Ba].push(ma);else Y[Ba]=Y[Ba]!==f?[Y[Ba],ma]:ma}else if(Ba)Y[Ba]=U?f:""});return Y};p[M]=b(u, 0,za=Ba.split("]["),Ka=za.length-1;if(/\[/.test(za[0])&&/\]$/.test(za[Ka])){za[Ka]=za[Ka].replace(/\]$/,"");za=za.shift().split("[").concat(za);Ka=za.length-1}else Ka=0;if(ma.length===2){ma=l(ma[1]);if(U)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?f:na[ma]!==f?na[ma]:ma;if(Ka)for(;Ia<=Ka;Ia++){Ba=za[Ia]===""?Ea.length:za[Ia];Ea=Ea[Ba]=Ia<Ka?Ea[Ba]||(za[Ia+1]&&isNaN(za[Ia+1])?{}:[]):ma}else if(a.isArray(Y[Ba]))Y[Ba].push(ma);else Y[Ba]=Y[Ba]!==f?[Y[Ba],ma]:ma}else if(Ba)Y[Ba]=U?f:""});return Y};p[M]=b(u,
0);p[ha]=L=b(u,1);a.elemUrlAttr||(a.elemUrlAttr=function(da){return a.extend(ia,da)})({a:fa,base:fa,iframe:"src",img:"src",input:"src",form:"action",link:fa,script:"src"});P=a.elemUrlAttr;a.fn[M]=b(c,M);a.fn[ha]=b(c,ha);R.pushState=O=function(da,U){if(h(da)&&/^#/.test(da)&&U===f)U=2;var Y=da!==f;Y=C(q[na][fa],Y?da:{},Y?U:2);q[na][fa]=Y+(/#/.test(Y)?"":"#")};R.getState=K=function(da,U){return da===f||typeof da==="boolean"?L(da):L(U)[da]};R.removeState=function(da){var U={};if(da!==f){U=K();a.each(a.isArray(da)? 0);p[aa]=L=b(u,1);a.elemUrlAttr||(a.elemUrlAttr=function(ea){return a.extend(ia,ea)})({a:ha,base:ha,iframe:"src",img:"src",input:"src",form:"action",link:ha,script:"src"});P=a.elemUrlAttr;a.fn[M]=b(c,M);a.fn[aa]=b(c,aa);R.pushState=O=function(ea,U){if(h(ea)&&/^#/.test(ea)&&U===f)U=2;var Y=ea!==f;Y=C(q[qa][ha],Y?ea:{},Y?U:2);q[qa][ha]=Y+(/#/.test(Y)?"":"#")};R.getState=K=function(ea,U){return ea===f||typeof ea==="boolean"?L(ea):L(U)[ea]};R.removeState=function(ea){var U={};if(ea!==f){U=K();a.each(a.isArray(ea)?
da:arguments,function(Y,oa){delete U[oa]})}O(U,2)};T.hashchange=a.extend(T.hashchange,{add:function(da){function U(oa){var pa=oa[ha]=C();oa.getState=function(la,ma){return la===f||typeof la==="boolean"?p(pa,la):p(pa,ma)[la]};Y.apply(this,arguments)}var Y;if(a.isFunction(da)){Y=da;return U}else{Y=da.handler;da.handler=U}}})})(jQuery,this); ea:arguments,function(Y,na){delete U[na]})}O(U,2)};T.hashchange=a.extend(T.hashchange,{add:function(ea){function U(na){var oa=na[aa]=C();na.getState=function(la,ma){return la===f||typeof la==="boolean"?p(oa,la):p(oa,ma)[la]};Y.apply(this,arguments)}var Y;if(a.isFunction(ea)){Y=ea;return U}else{Y=ea.handler;ea.handler=U}}})})(jQuery,this);
(function(a,q,h){function b(C){C=C||q[c][f];return C.replace(/^[^#]*#?(.*)$/,"$1")}var n,u=a.event.special,c="location",f="href",d=document.documentMode,l=a.browser.msie&&(d===h||d<8),s="onhashchange"in q&&!l;a.hashchangeDelay=100;u.hashchange=a.extend(u.hashchange,{setup:function(){if(s)return false;a(n.start)},teardown:function(){if(s)return false;a(n.stop)}});n=function(){function C(){O=K=function(P){return P};if(l){R=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow; (function(a,q,h){function b(C){C=C||q[c][f];return C.replace(/^[^#]*#?(.*)$/,"$1")}var n,u=a.event.special,c="location",f="href",d=document.documentMode,l=a.browser.msie&&(d===h||d<8),s="onhashchange"in q&&!l;a.hashchangeDelay=100;u.hashchange=a.extend(u.hashchange,{setup:function(){if(s)return false;a(n.start)},teardown:function(){if(s)return false;a(n.stop)}});n=function(){function C(){O=K=function(P){return P};if(l){R=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;
K=function(){return b(R.document[c][f])};O=function(P,T){if(P!==T){var M=R.document;M.open().close();M[c].hash="#"+P}};O(b())}}var p={},L,R,O,K;p.start=function(){if(!L){var P=b();O||C();(function T(){var M=b(),ha=K(P);if(M!==P){O(P=M,ha);a(q).trigger("hashchange")}else if(ha!==P)q[c][f]=q[c][f].replace(/#.*/,"")+"#"+ha;L=setTimeout(T,a.hashchangeDelay)})()}};p.stop=function(){if(!R){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var q={},h;a.svgIcons=function(b,n){function u(da,U){if(da!=="ajax"){if(P)return;var Y=(R=fa[0].contentDocument)&&R.getElementById("svg_eof");if(!Y&&!(U&&Y)){T++;if(T<50)setTimeout(u,20);else{f();P=true}return}P=true}L=a(R.firstChild).children();if(n.no_img)setTimeout(function(){K||c()},500);else{Y=na+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";O=a(new Image).attr({src:Y,width:0,height:0}).appendTo("body").load(function(){c(true)}).error(function(){c()})}} K=function(){return b(R.document[c][f])};O=function(P,T){if(P!==T){var M=R.document;M.open().close();M[c].hash="#"+P}};O(b())}}var p={},L,R,O,K;p.start=function(){if(!L){var P=b();O||C();(function T(){var M=b(),aa=K(P);if(M!==P){O(P=M,aa);a(q).trigger("hashchange")}else if(aa!==P)q[c][f]=q[c][f].replace(/#.*/,"")+"#"+aa;L=setTimeout(T,a.hashchangeDelay)})()}};p.stop=function(){if(!R){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var q={},h;a.svgIcons=function(b,n){function u(ea,U){if(ea!=="ajax"){if(P)return;var Y=(R=ha[0].contentDocument)&&R.getElementById("svg_eof");if(!Y&&!(U&&Y)){T++;if(T<50)setTimeout(u,20);else{f();P=true}return}P=true}L=a(R.firstChild).children();if(n.no_img)setTimeout(function(){K||c()},500);else{Y=qa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";O=a(new Image).attr({src:Y,width:0,height:0}).appendTo("body").load(function(){c(true)}).error(function(){c()})}}
function c(da,U){if(!K){if(n.no_img)da=false;if(da){var Y=a(document.createElement("div"));Y.hide().appendTo("body")}if(U){var oa=n.fallback_path?n.fallback_path:"";a.each(U,function(Ka,Na){a("#"+Ka);var Aa=a(new Image).attr({"class":"svg_icon",src:oa+Na,width:C,height:p,alt:"icon"});ia(Aa,Ka)})}else for(var pa=L.length,la=0;la<pa;la++){var ma=L[la],Ba=ma.id;if(Ba==="svg_eof")break;a("#"+Ba);ma=ma.getElementsByTagNameNS(l,"svg")[0];var Ea=document.createElementNS(l,"svg");Ea.setAttributeNS(l,"viewBox", function c(ea,U){if(!K){if(n.no_img)ea=false;if(ea){var Y=a(document.createElement("div"));Y.hide().appendTo("body")}if(U){var na=n.fallback_path?n.fallback_path:"";a.each(U,function(Ka,Na){a("#"+Ka);var Aa=a(new Image).attr({"class":"svg_icon",src:na+Na,width:C,height:p,alt:"icon"});ia(Aa,Ka)})}else for(var oa=L.length,la=0;la<oa;la++){var ma=L[la],Ba=ma.id;if(Ba==="svg_eof")break;a("#"+Ba);ma=ma.getElementsByTagNameNS(l,"svg")[0];var Ea=document.createElementNS(l,"svg");Ea.setAttributeNS(l,"viewBox",
[0,0,C,p].join(" "));var Ia=ma.getAttribute("width"),za=ma.getAttribute("height");ma.removeAttribute("width");ma.removeAttribute("height");ma.getAttribute("viewBox")||ma.setAttribute("viewBox",[0,0,Ia,za].join(" "));Ea.setAttribute("xmlns",l);Ea.setAttribute("width",C);Ea.setAttribute("height",p);Ea.setAttribute("xmlns:xlink",s);Ea.setAttribute("class","svg_icon");ha||(ma=ma.cloneNode(true));Ea.appendChild(ma);if(da){ha||Ea.cloneNode(true);Y.empty().append(Ea);ma=na+d(Y.html());ma=a(new Image).attr({"class":"svg_icon", [0,0,C,p].join(" "));var Ia=ma.getAttribute("width"),za=ma.getAttribute("height");ma.removeAttribute("width");ma.removeAttribute("height");ma.getAttribute("viewBox")||ma.setAttribute("viewBox",[0,0,Ia,za].join(" "));Ea.setAttribute("xmlns",l);Ea.setAttribute("width",C);Ea.setAttribute("height",p);Ea.setAttribute("xmlns:xlink",s);Ea.setAttribute("class","svg_icon");aa||(ma=ma.cloneNode(true));Ea.appendChild(ma);if(ea){aa||Ea.cloneNode(true);Y.empty().append(Ea);ma=qa+d(Y.html());ma=a(new Image).attr({"class":"svg_icon",
src:ma})}else ma=h(a(Ea),la);ia(ma,Ba)}n.placement&&a.each(n.placement,function(Ka,Na){q[Na]&&a(Ka).each(function(Aa){var ya=q[Na].clone();if(Aa>0&&!da)ya=h(ya,Aa,true);ra(a(this),ya,Na)})});if(!U){da&&Y.remove();fa&&fa.remove();O&&O.remove()}n.resize&&a.resizeSvgIcons(n.resize);K=true;n.callback&&n.callback(q)}}function f(){if(b.indexOf(".svgz")!=-1){var da=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(da,n)}else n.fallback&&c(false,n.fallback)} src:ma})}else ma=h(a(Ea),la);ia(ma,Ba)}n.placement&&a.each(n.placement,function(Ka,Na){q[Na]&&a(Ka).each(function(Aa){var ya=q[Na].clone();if(Aa>0&&!ea)ya=h(ya,Aa,true);ra(a(this),ya,Na)})});if(!U){ea&&Y.remove();ha&&ha.remove();O&&O.remove()}n.resize&&a.resizeSvgIcons(n.resize);K=true;n.callback&&n.callback(q)}}function f(){if(b.indexOf(".svgz")!=-1){var ea=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ea,n)}else n.fallback&&c(false,n.fallback)}
function d(da){if(window.btoa)return window.btoa(da);var U=Array(Math.floor((da.length+2)/3)*4),Y,oa,pa,la,ma,Ba,Ea=0,Ia=0;do{Y=da.charCodeAt(Ea++);oa=da.charCodeAt(Ea++);pa=da.charCodeAt(Ea++);la=Y>>2;Y=(Y&3)<<4|oa>>4;ma=(oa&15)<<2|pa>>6;Ba=pa&63;if(isNaN(oa))ma=Ba=64;else if(isNaN(pa))Ba=64;U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Y);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma); function d(ea){if(window.btoa)return window.btoa(ea);var U=Array(Math.floor((ea.length+2)/3)*4),Y,na,oa,la,ma,Ba,Ea=0,Ia=0;do{Y=ea.charCodeAt(Ea++);na=ea.charCodeAt(Ea++);oa=ea.charCodeAt(Ea++);la=Y>>2;Y=(Y&3)<<4|na>>4;ma=(na&15)<<2|oa>>6;Ba=oa&63;if(isNaN(na))ma=Ba=64;else if(isNaN(oa))Ba=64;U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Y);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);
U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ba)}while(Ea<da.length);return U.join("")}var l="http://www.w3.org/2000/svg",s="http://www.w3.org/1999/xlink",C=n.w?n.w:24,p=n.h?n.h:24,L,R,O,K=false,P=false,T=0,M=navigator.userAgent,ha=!!window.opera;M.indexOf("Safari/")>-1&&M.indexOf("Chrome/");var na="data:image/svg+xml;charset=utf-8;base64,";if(n.svgz){var fa=a('<object data="'+b+'" type=image/svg+xml>').appendTo("body").hide();try{R=fa[0].contentDocument;fa.load(u); U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ba)}while(Ea<ea.length);return U.join("")}var l="http://www.w3.org/2000/svg",s="http://www.w3.org/1999/xlink",C=n.w?n.w:24,p=n.h?n.h:24,L,R,O,K=false,P=false,T=0,M=navigator.userAgent,aa=!!window.opera;M.indexOf("Safari/")>-1&&M.indexOf("Chrome/");var qa="data:image/svg+xml;charset=utf-8;base64,";if(n.svgz){var ha=a('<object data="'+b+'" type=image/svg+xml>').appendTo("body").hide();try{R=ha[0].contentDocument;ha.load(u);
u(0,true)}catch(aa){f()}}else{var V=new DOMParser;a.ajax({url:b,dataType:"string",success:function(da){if(da){R=V.parseFromString(da,"text/xml");a(function(){u("ajax")})}else a(f)},error:function(da){if(window.opera)a(function(){f()});else if(da.responseText){R=V.parseFromString(da.responseText,"text/xml");R.childNodes.length||a(f);a(function(){u("ajax")})}else a(f)}})}var ra=function(da,U,Y,oa){ha&&U.css("visibility","hidden");if(n.replace){oa&&U.attr("id",Y);(Y=da.attr("class"))&&U.attr("class", u(0,true)}catch(ca){f()}}else{var W=new DOMParser;a.ajax({url:b,dataType:"string",success:function(ea){if(ea){R=W.parseFromString(ea,"text/xml");a(function(){u("ajax")})}else a(f)},error:function(ea){if(window.opera)a(function(){f()});else if(ea.responseText){R=W.parseFromString(ea.responseText,"text/xml");R.childNodes.length||a(f);a(function(){u("ajax")})}else a(f)}})}var ra=function(ea,U,Y,na){aa&&U.css("visibility","hidden");if(n.replace){na&&U.attr("id",Y);(Y=ea.attr("class"))&&U.attr("class",
"svg_icon "+Y);da.replaceWith(U)}else da.append(U);ha&&setTimeout(function(){U.removeAttr("style")},1)},ia=function(da,U){if(n.id_match===undefined||n.id_match!==false)ra(holder,da,U,true);q[U]=da};h=function(da,U){var Y=da.find("defs");if(!Y.length)return da;Y=ha?Y.find("*").filter(function(){return!!this.id}):Y.find("[id]");var oa=da[0].getElementsByTagName("*"),pa=oa.length;Y.each(function(la){var ma=this.id;a(R).find("#"+ma);this.id=la="x"+ma+U+la;ma="url(#"+ma+")";var Ba="url(#"+la+")";for(la= "svg_icon "+Y);ea.replaceWith(U)}else ea.append(U);aa&&setTimeout(function(){U.removeAttr("style")},1)},ia=function(ea,U){if(n.id_match===undefined||n.id_match!==false)ra(holder,ea,U,true);q[U]=ea};h=function(ea,U){var Y=ea.find("defs");if(!Y.length)return ea;Y=aa?Y.find("*").filter(function(){return!!this.id}):Y.find("[id]");var na=ea[0].getElementsByTagName("*"),oa=na.length;Y.each(function(la){var ma=this.id;a(R).find("#"+ma);this.id=la="x"+ma+U+la;ma="url(#"+ma+")";var Ba="url(#"+la+")";for(la=
0;la<pa;la++){var Ea=oa[la];Ea.getAttribute("fill")===ma&&Ea.setAttribute("fill",Ba);Ea.getAttribute("stroke")===ma&&Ea.setAttribute("stroke",Ba);Ea.getAttribute("filter")===ma&&Ea.setAttribute("filter",Ba)}});return da}};a.getSvgIcon=function(b,n){var u=q[b];if(n&&u)u=h(u,0,true).clone(true);return u};a.resizeSvgIcons=function(b){var n=!a(".svg_icon:first").length;a.each(b,function(u,c){var f=a.isArray(c),d=f?c[0]:c,l=f?c[1]:c;if(n)u=u.replace(/\.svg_icon/g,"svg");a(u).each(function(){this.setAttribute("width", 0;la<oa;la++){var Ea=na[la];Ea.getAttribute("fill")===ma&&Ea.setAttribute("fill",Ba);Ea.getAttribute("stroke")===ma&&Ea.setAttribute("stroke",Ba);Ea.getAttribute("filter")===ma&&Ea.setAttribute("filter",Ba)}});return ea}};a.getSvgIcon=function(b,n){var u=q[b];if(n&&u)u=h(u,0,true).clone(true);return u};a.resizeSvgIcons=function(b){var n=!a(".svg_icon:first").length;a.each(b,function(u,c){var f=a.isArray(c),d=f?c[0]:c,l=f?c[1]:c;if(n)u=u.replace(/\.svg_icon/g,"svg");a(u).each(function(){this.setAttribute("width",
d);this.setAttribute("height",l);if(window.opera&&window.widget){this.parentNode.style.width=d+"px";this.parentNode.style.height=l+"px"}})})}})(jQuery);(function(){function a(b,n,u){b=document.createElementNS(q.svg,b);if(h)for(var c in n)b.setAttribute(c,n[c]);else for(c in n){var f=n[c],d=b[c];if(d&&d.constructor==="SVGLength")d.baseVal.value=f;else b.setAttribute(c,f)}u&&u.appendChild(b);return b}var q={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(b){b=b||{};this.alpha=isNaN(b.alpha)?100:b.alpha;if(b.copy){this.type= d);this.setAttribute("height",l);if(window.opera&&window.widget){this.parentNode.style.width=d+"px";this.parentNode.style.height=l+"px"}})})}})(jQuery);(function(){function a(b,n,u){b=document.createElementNS(q.svg,b);if(h)for(var c in n)b.setAttribute(c,n[c]);else for(c in n){var f=n[c],d=b[c];if(d&&d.constructor==="SVGLength")d.baseVal.value=f;else b.setAttribute(c,f)}u&&u.appendChild(b);return b}var q={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(b){b=b||{};this.alpha=isNaN(b.alpha)?100:b.alpha;if(b.copy){this.type=
b.copy.type;this.alpha=b.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=b.copy.solidColor;break;case "linearGradient":this.linearGradient=b.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=b.copy.radialGradient.cloneNode(true)}}else if(b.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=b.linearGradient.cloneNode(true)}else if(b.radialGradient){this.type= b.copy.type;this.alpha=b.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=b.copy.solidColor;break;case "linearGradient":this.linearGradient=b.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=b.copy.radialGradient.cloneNode(true)}}else if(b.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=b.linearGradient.cloneNode(true)}else if(b.radialGradient){this.type=
"radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=b.radialGradient.cloneNode(true)}else if(b.solidColor){this.type="solidColor";this.solidColor=b.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 h=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(b){var n= "radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=b.radialGradient.cloneNode(true)}else if(b.solidColor){this.type="solidColor";this.solidColor=b.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 h=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(b){var n=
arguments;return this.each(function(){function u(ja,ba,ka,N,Q){var ea=Q||a("stop",{"stop-color":ba,"stop-opacity":ka,offset:ja},V);if(Q){ba=Q.getAttribute("stop-color");ka=Q.getAttribute("stop-opacity");ja=Q.getAttribute("offset")}else V.appendChild(ea);if(ka===null)ka=1;Q=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+ja*ha)+", 26)"},nb);var Fa= arguments;return this.each(function(){function u(ja,ba,ka,N,Q){var fa=Q||a("stop",{"stop-color":ba,"stop-opacity":ka,offset:ja},W);if(Q){ba=Q.getAttribute("stop-color");ka=Q.getAttribute("stop-opacity");ja=Q.getAttribute("offset")}else W.appendChild(fa);if(ka===null)ka=1;Q=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+ja*aa)+", 26)"},nb);var Fa=
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":ka,transform:"translate("+(10+ja*ha)+", 26)",stroke:"#000","stroke-width":1.5},nb);$(Fa).mousedown(function(Oa){c(this);Wa=fb;P.mousemove(l).mouseup(f);wa=Ya.offset();Oa.preventDefault();return false}).data("stop",ea).data("bg",Q).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Va=+ea.getAttribute("stop-opacity")|| 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":ka,transform:"translate("+(10+ja*aa)+", 26)",stroke:"#000","stroke-width":1.5},nb);$(Fa).mousedown(function(Oa){c(this);Wa=fb;P.mousemove(l).mouseup(f);wa=Ya.offset();Oa.preventDefault();return false}).data("stop",fa).data("bg",Q).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Va=+fa.getAttribute("stop-opacity")||
1,$a=ea.getAttribute("stop-color")||1,qb=(parseFloat(Va)*255).toString(16);qb.length<2;)qb="0"+qb;ba=$a.substr(1)+qb;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:C.images.clientPath},color:{active:ba,alphaSupport:true}},function(Qa){$a=Qa.val("hex")?"#"+Qa.val("hex"):"none";Va=Qa.val("a")!==null?Qa.val("a")/256:1;Oa.setAttribute("fill",$a);Oa.setAttribute("fill-opacity",Va);ea.setAttribute("stop-color", 1,$a=fa.getAttribute("stop-color")||1,qb=(parseFloat(Va)*255).toString(16);qb.length<2;)qb="0"+qb;ba=$a.substr(1)+qb;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:C.images.clientPath},color:{active:ba,alphaSupport:true}},function(Qa){$a=Qa.val("hex")?"#"+Qa.val("hex"):"none";Va=Qa.val("a")!==null?Qa.val("a")/256:1;Oa.setAttribute("fill",$a);Oa.setAttribute("fill-opacity",Va);fa.setAttribute("stop-color",
$a);ea.setAttribute("stop-opacity",Va);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(V).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ja){if(!ba){var Va=this.getAttribute("stop-color"),$a=this.getAttribute("stop-opacity");ea.setAttribute("stop-color",Va);Fa.setAttribute("fill",Va);ea.setAttribute("stop-opacity",$a===null?1:$a);Fa.setAttribute("fill-opacity", $a);fa.setAttribute("stop-opacity",Va);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(W).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ja){if(!ba){var Va=this.getAttribute("stop-color"),$a=this.getAttribute("stop-opacity");fa.setAttribute("stop-color",Va);Fa.setAttribute("fill",Va);fa.setAttribute("stop-opacity",$a===null?1:$a);Fa.setAttribute("fill-opacity",
$a===null?1:$a)}Oa.before(ea);return false}});N&&c(Fa);return ea}function c(ja){fb&&fb.setAttribute("stroke","#000");ja.setAttribute("stroke","blue");fb=ja;fb.parentNode.appendChild(fb)}function f(){P.unbind("mousemove",l);if(Ca.getAttribute("display")!=="none"){Ca.setAttribute("display","none");var ja=$(fb),ba=ja.data("stop");ja=ja.data("bg");$([fb,ba,ja]).remove()}Wa=null}function d(){var ja=Ra?"rotate("+Ra+","+Da+","+gb+") ":"";db===1&&La===1?V.removeAttribute("gradientTransform"):V.setAttribute("gradientTransform", $a===null?1:$a)}Oa.before(fa);return false}});N&&c(Fa);return fa}function c(ja){fb&&fb.setAttribute("stroke","#000");ja.setAttribute("stroke","blue");fb=ja;fb.parentNode.appendChild(fb)}function f(){P.unbind("mousemove",l);if(Ca.getAttribute("display")!=="none"){Ca.setAttribute("display","none");var ja=$(fb),ba=ja.data("stop");ja=ja.data("bg");$([fb,ba,ja]).remove()}Wa=null}function d(){var ja=Ra?"rotate("+Ra+","+Da+","+gb+") ":"";db===1&&La===1?W.removeAttribute("gradientTransform"):W.setAttribute("gradientTransform",
ja+"translate("+-Da*(db-1)+","+-gb*(La-1)+") scale("+db+","+La+")")}function l(ja){var ba=ja.pageX-wa.left;ja=ja.pageY-wa.top;ba=ba<10?10:ba>ha+10?ha+10:ba;var ka="translate("+ba+", 26)";if(ja<-60||ja>130){Ca.setAttribute("display","block");Ca.setAttribute("transform",ka)}else Ca.setAttribute("display","none");Wa.setAttribute("transform",ka);$.data(Wa,"bg").setAttribute("transform",ka);$.data(Wa,"stop").setAttribute("offset",(ba-10)/ha);var N=0;$(V).find("stop").each(function(){var Q=this.getAttribute("offset"), ja+"translate("+-Da*(db-1)+","+-gb*(La-1)+") scale("+db+","+La+")")}function l(ja){var ba=ja.pageX-wa.left;ja=ja.pageY-wa.top;ba=ba<10?10:ba>aa+10?aa+10:ba;var ka="translate("+ba+", 26)";if(ja<-60||ja>130){Ca.setAttribute("display","block");Ca.setAttribute("transform",ka)}else Ca.setAttribute("display","none");Wa.setAttribute("transform",ka);$.data(Wa,"bg").setAttribute("transform",ka);$.data(Wa,"stop").setAttribute("offset",(ba-10)/aa);var N=0;$(W).find("stop").each(function(){var Q=this.getAttribute("offset"),
ea=$(this);if(Q<N){ea.prev().before(ea);xa=$(V).find("stop")}N=Q})}var s=$(this),C=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),p=s.attr("id"),L="#"+s.attr("id")+" ";if(L){var R=function(){switch(s.paint.type){case "radialGradient":s.paint.linearGradient=null;break;case "linearGradient":s.paint.radialGradient=null;break;case "solidColor":s.paint.radialGradient=s.paint.linearGradient=null}$.isFunction(s.okCallback)&&s.okCallback(s.paint);s.hide()},O=function(){$.isFunction(s.cancelCallback)&&s.cancelCallback(); fa=$(this);if(Q<N){fa.prev().before(fa);xa=$(W).find("stop")}N=Q})}var s=$(this),C=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),p=s.attr("id"),L="#"+s.attr("id")+" ";if(L){var R=function(){switch(s.paint.type){case "radialGradient":s.paint.linearGradient=null;break;case "linearGradient":s.paint.radialGradient=null;break;case "solidColor":s.paint.radialGradient=s.paint.linearGradient=null}$.isFunction(s.okCallback)&&s.okCallback(s.paint);s.hide()},O=function(){$.isFunction(s.cancelCallback)&&s.cancelCallback();
s.hide()};$.extend(true,s,{paint:new $.jGraduate.Paint({copy:C.paint}),okCallback:$.isFunction(n[1])&&n[1]||null,cancelCallback:$.isFunction(n[2])&&n[2]||null});s.position();var K=null,P=$(window);if(s.paint.type=="none")s.paint=$.jGraduate.Paint({solidColor:"ffffff"});s.addClass("jGraduate_Picker");s.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="'+ s.hide()};$.extend(true,s,{paint:new $.jGraduate.Paint({copy:C.paint}),okCallback:$.isFunction(n[1])&&n[1]||null,cancelCallback:$.isFunction(n[2])&&n[2]||null});s.position();var K=null,P=$(window);if(s.paint.type=="none")s.paint=$.jGraduate.Paint({solidColor:"ffffff"});s.addClass("jGraduate_Picker");s.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="'+
p+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var T=$(L+"> .jGraduate_colPick"),M=$(L+"> .jGraduate_gradPick");M.html('<div id="'+p+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+C.window.pickerTitle+'</h2><div id="'+p+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+p+'_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+ p+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var T=$(L+"> .jGraduate_colPick"),M=$(L+"> .jGraduate_gradPick");M.html('<div id="'+p+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+C.window.pickerTitle+'</h2><div id="'+p+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+p+'_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+
p+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+p+'_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+p+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+ p+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+p+'_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+p+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+
@ -34,25 +34,25 @@ p+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'
p+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+p+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+p+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+ p+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+p+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+p+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+
p+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+p+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+p+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+C.images.clientPath+ p+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+p+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+p+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+C.images.clientPath+
'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba&nbsp;</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+p+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+p+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+ 'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba&nbsp;</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+p+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+p+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+
p+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+p+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var ha=256,na=ha-0,fa=ha-0,aa,V,ra,ia={};$(".jGraduate_SliderBar").width(145);var da=$("#"+p+"_jGraduate_GradContainer")[0],U=a("svg",{id:p+"_jgraduate_svg",width:ha,height:ha,xmlns:q.svg},da);aa=aa||s.paint.type;var Y=V=s.paint[aa],oa=s.paint.alpha,pa=aa==="solidColor";switch(aa){case "solidColor":case "linearGradient":if(!pa){V.id=p+"_lg_jgraduate_grad"; p+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+p+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var aa=256,qa=aa-0,ha=aa-0,ca,W,ra,ia={};$(".jGraduate_SliderBar").width(145);var ea=$("#"+p+"_jGraduate_GradContainer")[0],U=a("svg",{id:p+"_jgraduate_svg",width:aa,height:aa,xmlns:q.svg},ea);ca=ca||s.paint.type;var Y=W=s.paint[ca],na=s.paint.alpha,oa=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!oa){W.id=p+"_lg_jgraduate_grad";
Y=V=U.appendChild(V)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},U);if(aa==="linearGradient")break;case "radialGradient":if(!pa){V.id=p+"_rg_jgraduate_grad";Y=V=U.appendChild(V)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},U)}if(pa){Y=V=$("#"+p+"_lg_jgraduate_grad")[0];K=s.paint[aa];u(0,"#"+K,1);var la=typeof C.newstop;if(la==="string")switch(C.newstop){case "same":u(1,"#"+K,1);break;case "inverse":la="";for(var ma=0;ma<6;ma+=2){K.substr(ma,2);var Ba=(255-parseInt(K.substr(ma,2),16)).toString(16); Y=W=U.appendChild(W)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},U);if(ca==="linearGradient")break;case "radialGradient":if(!oa){W.id=p+"_rg_jgraduate_grad";Y=W=U.appendChild(W)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},U)}if(oa){Y=W=$("#"+p+"_lg_jgraduate_grad")[0];K=s.paint[ca];u(0,"#"+K,1);var la=typeof C.newstop;if(la==="string")switch(C.newstop){case "same":u(1,"#"+K,1);break;case "inverse":la="";for(var ma=0;ma<6;ma+=2){K.substr(ma,2);var Ba=(255-parseInt(K.substr(ma,2),16)).toString(16);
if(Ba.length<2)Ba=0+Ba;la+=Ba}u(1,"#"+la,1);break;case "white":u(1,"#ffffff",1);break;case "black":u(1,"#000000",1)}else if(la==="object")u(1,C.newstop.color||"#"+K,"opac"in C.newstop?C.newstop.opac:1)}K=parseFloat(Y.getAttribute("x1")||0);la=parseFloat(Y.getAttribute("y1")||0);ma=parseFloat(Y.getAttribute("x2")||1);Ba=parseFloat(Y.getAttribute("y2")||0);var Ea=parseFloat(Y.getAttribute("cx")||0.5),Ia=parseFloat(Y.getAttribute("cy")||0.5),za=parseFloat(Y.getAttribute("fx")||Ea),Ka=parseFloat(Y.getAttribute("fy")|| if(Ba.length<2)Ba=0+Ba;la+=Ba}u(1,"#"+la,1);break;case "white":u(1,"#ffffff",1);break;case "black":u(1,"#000000",1)}else if(la==="object")u(1,C.newstop.color||"#"+K,"opac"in C.newstop?C.newstop.opac:1)}K=parseFloat(Y.getAttribute("x1")||0);la=parseFloat(Y.getAttribute("y1")||0);ma=parseFloat(Y.getAttribute("x2")||1);Ba=parseFloat(Y.getAttribute("y2")||0);var Ea=parseFloat(Y.getAttribute("cx")||0.5),Ia=parseFloat(Y.getAttribute("cy")||0.5),za=parseFloat(Y.getAttribute("fx")||Ea),Ka=parseFloat(Y.getAttribute("fy")||
Ia);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:na,height:fa,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":oa/100},U);var Na=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:la*ha,left:K*ha}).data("coord","start").appendTo(da),Aa=Na.clone().text(2).css({top:Ba*ha,left:ma*ha}).attr("title","End stop").data("coord","end").appendTo(da),ya=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ia*ha,left:Ea* Ia);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:qa,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":na/100},U);var Na=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:la*aa,left:K*aa}).data("coord","start").appendTo(ea),Aa=Na.clone().text(2).css({top:Ba*aa,left:ma*aa}).attr("title","End stop").data("coord","end").appendTo(ea),ya=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ia*aa,left:Ea*
ha}).data("coord","center").appendTo(da),Ga=ya.clone().text("F").css({top:Ka*ha,left:za*ha,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);Ga[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ja,ba){var ka=V.getAttribute(ba),N=isNaN(ba[1]);ka||(ka=N?"0.5":ba==="x2"?"1.0":"0.0");ia[ba]=$("#"+p+"_jGraduate_"+ba).val(ka).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> aa}).data("coord","center").appendTo(ea),Ga=ya.clone().text("F").css({top:Ka*aa,left:za*aa,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ea);Ga[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ja,ba){var ka=W.getAttribute(ba),N=isNaN(ba[1]);ka||(ka=N?"0.5":ba==="x2"?"1.0":"0.0");ia[ba]=$("#"+p+"_jGraduate_"+ba).val(ka).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"&&!hb))if(N&&aa==="radialGradient"||!N&&aa==="linearGradient")V.setAttribute(ba,this.value);var Q=N?ba[0]==="c"?ya:Ga:ba[1]==="1"?Na:Aa,ea=ba.indexOf("x")>=0?"left":"top";Q.css(ea,this.value*ha)}).change()});var xa,nb,Ya=$("#"+p+"_jGraduate_StopSlider"),fb,Sa,Wa,Ca=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Sa),wa,db=1,La=1,Ra=0,Da=Ea,gb=Ia;Sa=a("svg",{width:"100%",height:45},Ya[0]);da=a("pattern",{width:16, 1)this.value=1;if(!(ba[0]==="f"&&!hb))if(N&&ca==="radialGradient"||!N&&ca==="linearGradient")W.setAttribute(ba,this.value);var Q=N?ba[0]==="c"?ya:Ga:ba[1]==="1"?Na:Aa,fa=ba.indexOf("x")>=0?"left":"top";Q.css(fa,this.value*aa)}).change()});var xa,nb,Ya=$("#"+p+"_jGraduate_StopSlider"),fb,Sa,Wa,Ca=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Sa),wa,db=1,La=1,Ra=0,Da=Ea,gb=Ia;Sa=a("svg",{width:"100%",height:45},Ya[0]);ea=a("pattern",{width:16,
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Sa);a("image",{width:16,height:16},da).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Sa).on("click touchstart",function(ja){wa=Ya.offset();if(ja.target.tagName!=="path"){var ba=ja.pageX-wa.left-8;ba=ba<10?10:ba>ha+10?ha+10:ba;u(ba/ha,0,0,true);ja.stopPropagation()}});$(Sa).mouseover(function(){Sa.appendChild(Ca)});nb=a("g",{},Sa);a("line",{x1:10,y1:15,x2:ha+10,y2:15,"stroke-width":2,stroke:"#000"},Sa);var rb= height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Sa);a("image",{width:16,height:16},ea).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Sa).on("click touchstart",function(ja){wa=Ya.offset();if(ja.target.tagName!=="path"){var ba=ja.pageX-wa.left-8;ba=ba<10?10:ba>aa+10?aa+10:ba;u(ba/aa,0,0,true);ja.stopPropagation()}});$(Sa).mouseover(function(){Sa.appendChild(Ca)});nb=a("g",{},Sa);a("line",{x1:10,y1:15,x2:aa+10,y2:15,"stroke-width":2,stroke:"#000"},Sa);var rb=
M.find(".jGraduate_spreadMethod").change(function(){V.setAttribute("spreadMethod",$(this).val())}),Xa=null,ab=function(ja){var ba=ja.pageX-jb.left,ka=ja.pageY-jb.top;ba=ba<0?0:ba>ha?ha:ba;ka=ka<0?0:ka>ha?ha:ka;Xa.css("left",ba).css("top",ka);ba=ba/na;ka=ka/fa;var N=Xa.data("coord"),Q=V;switch(N){case "start":ia.x1.val(ba);ia.y1.val(ka);Q.setAttribute("x1",ba);Q.setAttribute("y1",ka);break;case "end":ia.x2.val(ba);ia.y2.val(ka);Q.setAttribute("x2",ba);Q.setAttribute("y2",ka);break;case "center":ia.cx.val(ba); M.find(".jGraduate_spreadMethod").change(function(){W.setAttribute("spreadMethod",$(this).val())}),Xa=null,ab=function(ja){var ba=ja.pageX-jb.left,ka=ja.pageY-jb.top;ba=ba<0?0:ba>aa?aa:ba;ka=ka<0?0:ka>aa?aa:ka;Xa.css("left",ba).css("top",ka);ba=ba/qa;ka=ka/ha;var N=Xa.data("coord"),Q=W;switch(N){case "start":ia.x1.val(ba);ia.y1.val(ka);Q.setAttribute("x1",ba);Q.setAttribute("y1",ka);break;case "end":ia.x2.val(ba);ia.y2.val(ka);Q.setAttribute("x2",ba);Q.setAttribute("y2",ka);break;case "center":ia.cx.val(ba);
ia.cy.val(ka);Q.setAttribute("cx",ba);Q.setAttribute("cy",ka);Da=ba;gb=ka;d();break;case "focus":ia.fx.val(ba);ia.fy.val(ka);Q.setAttribute("fx",ba);Q.setAttribute("fy",ka);d()}ja.preventDefault()},xb=function(){Xa=null;P.unbind("mousemove",ab).unbind("mouseup",xb)};xa=V.getElementsByTagNameNS(q.svg,"stop");if(ua<2){for(;ua<2;){V.appendChild(document.createElementNS(q.svg,"stop"));++ua}xa=V.getElementsByTagNameNS(q.svg,"stop")}var ua=xa.length;for(ma=0;ma<ua;ma++)u(0,0,0,0,xa[ma]);rb.val(V.getAttribute("spreadMethod")|| ia.cy.val(ka);Q.setAttribute("cx",ba);Q.setAttribute("cy",ka);Da=ba;gb=ka;d();break;case "focus":ia.fx.val(ba);ia.fy.val(ka);Q.setAttribute("fx",ba);Q.setAttribute("fy",ka);d()}ja.preventDefault()},xb=function(){Xa=null;P.unbind("mousemove",ab).unbind("mouseup",xb)};xa=W.getElementsByTagNameNS(q.svg,"stop");if(ua<2){for(;ua<2;){W.appendChild(document.createElementNS(q.svg,"stop"));++ua}xa=W.getElementsByTagNameNS(q.svg,"stop")}var ua=xa.length;for(ma=0;ma<ua;ma++)u(0,0,0,0,xa[ma]);rb.val(W.getAttribute("spreadMethod")||
"pad");var jb,hb=false;ra.setAttribute("fill-opacity",oa/100);$("#"+p+" div.grad_coord").mousedown(function(ja){ja.preventDefault();Xa=$(this);Xa.offset();jb=Xa.parent().offset();P.mousemove(ab).mouseup(xb)});$("#"+p+"_jGraduate_Ok").bind("click touchstart",function(){s.paint.type=aa;s.paint[aa]=V.cloneNode(true);s.paint.solidColor=null;R()});$("#"+p+"_jGraduate_Cancel").bind("click touchstart",function(){O()});if(aa==="radialGradient")if(hb)Ga.show();else{Ga.hide();ia.fx.val("");ia.fy.val("")}$("#"+ "pad");var jb,hb=false;ra.setAttribute("fill-opacity",na/100);$("#"+p+" div.grad_coord").mousedown(function(ja){ja.preventDefault();Xa=$(this);Xa.offset();jb=Xa.parent().offset();P.mousemove(ab).mouseup(xb)});$("#"+p+"_jGraduate_Ok").bind("click touchstart",function(){s.paint.type=ca;s.paint[ca]=W.cloneNode(true);s.paint.solidColor=null;R()});$("#"+p+"_jGraduate_Cancel").bind("click touchstart",function(){O()});if(ca==="radialGradient")if(hb)Ga.show();else{Ga.hide();ia.fx.val("");ia.fy.val("")}$("#"+
p+"_jGraduate_match_ctr")[0].checked=!hb;var ub,lb;$("#"+p+"_jGraduate_match_ctr").change(function(){hb=!this.checked;Ga.toggle(hb);ia.fx.val("");ia.fy.val("");var ja=V;if(hb){var ba=ub||0.5,ka=lb||0.5;ja.setAttribute("fx",ba);ja.setAttribute("fy",ka);ia.fx.val(ba);ia.fy.val(ka)}else{ub=ja.getAttribute("fx");lb=ja.getAttribute("fy");ja.removeAttribute("fx");ja.removeAttribute("fy")}});xa=V.getElementsByTagNameNS(q.svg,"stop");ua=xa.length;if(ua<2){for(;ua<2;){V.appendChild(document.createElementNS(q.svg, p+"_jGraduate_match_ctr")[0].checked=!hb;var ub,lb;$("#"+p+"_jGraduate_match_ctr").change(function(){hb=!this.checked;Ga.toggle(hb);ia.fx.val("");ia.fy.val("");var ja=W;if(hb){var ba=ub||0.5,ka=lb||0.5;ja.setAttribute("fx",ba);ja.setAttribute("fy",ka);ia.fx.val(ba);ia.fy.val(ka)}else{ub=ja.getAttribute("fx");lb=ja.getAttribute("fy");ja.removeAttribute("fx");ja.removeAttribute("fy")}});xa=W.getElementsByTagNameNS(q.svg,"stop");ua=xa.length;if(ua<2){for(;ua<2;){W.appendChild(document.createElementNS(q.svg,
"stop"));++ua}xa=V.getElementsByTagNameNS(q.svg,"stop")}var eb;oa=M=0;if(aa==="radialGradient"){U=V.gradientTransform.baseVal;if(U.numberOfItems===2){ua=U.getItem(0);U=U.getItem(1);if(ua.type===2&&U.type===3){ua=U.matrix;if(ua.a!==1)M=Math.round(-(1-ua.a)*100);else if(ua.d!==1)M=Math.round((1-ua.d)*100)}}else if(U.numberOfItems===3){da=U.getItem(0);ua=U.getItem(1);U=U.getItem(2);if(da.type===4&&ua.type===2&&U.type===3){oa=Math.round(da.angle);ua=U.matrix;if(ua.a!==1)M=Math.round(-(1-ua.a)*100);else if(ua.d!== "stop"));++ua}xa=W.getElementsByTagNameNS(q.svg,"stop")}var eb;na=M=0;if(ca==="radialGradient"){U=W.gradientTransform.baseVal;if(U.numberOfItems===2){ua=U.getItem(0);U=U.getItem(1);if(ua.type===2&&U.type===3){ua=U.matrix;if(ua.a!==1)M=Math.round(-(1-ua.a)*100);else if(ua.d!==1)M=Math.round((1-ua.d)*100)}}else if(U.numberOfItems===3){ea=U.getItem(0);ua=U.getItem(1);U=U.getItem(2);if(ea.type===4&&ua.type===2&&U.type===3){na=Math.round(ea.angle);ua=U.matrix;if(ua.a!==1)M=Math.round(-(1-ua.a)*100);else if(ua.d!==
1)M=Math.round((1-ua.d)*100)}}}M={radius:{handle:"#"+p+"_jGraduate_RadiusArrows",input:"#"+p+"_jGraduate_RadiusInput",val:(V.getAttribute("r")||0.5)*100},opacity:{handle:"#"+p+"_jGraduate_OpacArrows",input:"#"+p+"_jGraduate_OpacInput",val:s.paint.alpha||100},ellip:{handle:"#"+p+"_jGraduate_EllipArrows",input:"#"+p+"_jGraduate_EllipInput",val:M},angle:{handle:"#"+p+"_jGraduate_AngleArrows",input:"#"+p+"_jGraduate_AngleInput",val:oa}};$.each(M,function(ja,ba){var ka=$(ba.handle);ka.mousedown(function(N){var Q= 1)M=Math.round((1-ua.d)*100)}}}M={radius:{handle:"#"+p+"_jGraduate_RadiusArrows",input:"#"+p+"_jGraduate_RadiusInput",val:(W.getAttribute("r")||0.5)*100},opacity:{handle:"#"+p+"_jGraduate_OpacArrows",input:"#"+p+"_jGraduate_OpacInput",val:s.paint.alpha||100},ellip:{handle:"#"+p+"_jGraduate_EllipArrows",input:"#"+p+"_jGraduate_EllipInput",val:M},angle:{handle:"#"+p+"_jGraduate_AngleArrows",input:"#"+p+"_jGraduate_AngleInput",val:na}};$.each(M,function(ja,ba){var ka=$(ba.handle);ka.mousedown(function(N){var Q=
ka.parent();eb={type:ja,elem:ka,input:$(ba.input),parent:Q,offset:Q.offset()};P.mousemove(sb).mouseup(ob);N.preventDefault()});$(ba.input).val(ba.val).change(function(){var N=+this.value,Q=0,ea=aa==="radialGradient";switch(ja){case "radius":ea&&V.setAttribute("r",N/100);Q=Math.pow(N/100,0.4)/2*145;break;case "opacity":s.paint.alpha=N;ra.setAttribute("fill-opacity",N/100);Q=N*1.45;break;case "ellip":db=La=1;if(N===0){Q=72.5;break}if(N>99.5)N=99.5;if(N>0)La=1-N/100;else db=-(N/100)-1;Q=145*((N+100)/ ka.parent();eb={type:ja,elem:ka,input:$(ba.input),parent:Q,offset:Q.offset()};P.mousemove(sb).mouseup(ob);N.preventDefault()});$(ba.input).val(ba.val).change(function(){var N=+this.value,Q=0,fa=ca==="radialGradient";switch(ja){case "radius":fa&&W.setAttribute("r",N/100);Q=Math.pow(N/100,0.4)/2*145;break;case "opacity":s.paint.alpha=N;ra.setAttribute("fill-opacity",N/100);Q=N*1.45;break;case "ellip":db=La=1;if(N===0){Q=72.5;break}if(N>99.5)N=99.5;if(N>0)La=1-N/100;else db=-(N/100)-1;Q=145*((N+100)/
2)/100;ea&&d();break;case "angle":Ra=N;Q=Ra/180;Q+=0.5;Q*=145;ea&&d()}if(Q>145)Q=145;else if(Q<0)Q=0;ka.css({"margin-left":Q-5})}).change()});var sb=function(ja){var ba=ja.pageX-eb.offset.left-parseInt(eb.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var ka=ba-5;ba/=145;switch(eb.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;V.setAttribute("r",ba);break;case "opacity":s.paint.alpha=parseInt(ba*100);ra.setAttribute("fill-opacity",ba);break; 2)/100;fa&&d();break;case "angle":Ra=N;Q=Ra/180;Q+=0.5;Q*=145;fa&&d()}if(Q>145)Q=145;else if(Q<0)Q=0;ka.css({"margin-left":Q-5})}).change()});var sb=function(ja){var ba=ja.pageX-eb.offset.left-parseInt(eb.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var ka=ba-5;ba/=145;switch(eb.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;W.setAttribute("r",ba);break;case "opacity":s.paint.alpha=parseInt(ba*100);ra.setAttribute("fill-opacity",ba);break;
case "ellip":La=db=1;if(ba<0.5){ba/=0.5;db=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5;ba=2-ba;La=ba<=0?0.01:ba}d();ba-=1;if(La===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Ra=ba*=180;d();ba/=100}eb.elem.css({"margin-left":ka});ba=Math.round(ba*100);eb.input.val(ba);ja.preventDefault()},ob=function(){P.unbind("mousemove",sb).unbind("mouseup",ob);eb=null};for(M=(s.paint.alpha*255/100).toString(16);M.length<2;)M="0"+M;M=M.split(".")[0];K=s.paint.solidColor=="none"?"":s.paint.solidColor+M;pa||(K=xa[0].getAttribute("stop-color")); case "ellip":La=db=1;if(ba<0.5){ba/=0.5;db=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5;ba=2-ba;La=ba<=0?0.01:ba}d();ba-=1;if(La===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Ra=ba*=180;d();ba/=100}eb.elem.css({"margin-left":ka});ba=Math.round(ba*100);eb.input.val(ba);ja.preventDefault()},ob=function(){P.unbind("mousemove",sb).unbind("mouseup",ob);eb=null};for(M=(s.paint.alpha*255/100).toString(16);M.length<2;)M="0"+M;M=M.split(".")[0];K=s.paint.solidColor=="none"?"":s.paint.solidColor+M;oa||(K=xa[0].getAttribute("stop-color"));
$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});T.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:K,alphaSupport:true}},function(ja){s.paint.type="solidColor";s.paint.alpha=ja.val("ahex")?Math.round(ja.val("a")/255*100):100;s.paint.solidColor=ja.val("hex")?ja.val("hex"):"none";s.paint.radialGradient=null;R()},null,function(){O()});var yb=$(L+" .jGraduate_tabs li");yb.on("click touchstart",function(){yb.removeClass("jGraduate_tab_current"); $.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});T.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:K,alphaSupport:true}},function(ja){s.paint.type="solidColor";s.paint.alpha=ja.val("ahex")?Math.round(ja.val("a")/255*100):100;s.paint.solidColor=ja.val("hex")?ja.val("hex"):"none";s.paint.radialGradient=null;R()},null,function(){O()});var yb=$(L+" .jGraduate_tabs li");yb.on("click touchstart",function(){yb.removeClass("jGraduate_tab_current");
$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ja=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ja==="rg"||ja==="lg"){$(".jGraduate_"+ja+"_field").show();$(".jGraduate_"+(ja==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ja+"_jgraduate_grad)");aa=ja==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(s.paint.alpha).change();var ba=$("#"+p+"_"+ja+"_jgraduate_grad")[0];if(V!==ba){var ka= $(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ja=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ja==="rg"||ja==="lg"){$(".jGraduate_"+ja+"_field").show();$(".jGraduate_"+(ja==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ja+"_jgraduate_grad)");ca=ja==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(s.paint.alpha).change();var ba=$("#"+p+"_"+ja+"_jgraduate_grad")[0];if(W!==ba){var ka=
$(V).find("stop");$(ba).empty().append(ka);V=ba;ba=rb.val();V.setAttribute("spreadMethod",ba)}hb=ja==="rg"&&V.getAttribute("fx")!=null&&!(Ea==za&&Ia==Ka);$("#"+p+"_jGraduate_focusCoord").toggle(hb);if(hb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();yb.removeClass("jGraduate_tab_current");var zb;switch(s.paint.type){case "linearGradient":zb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":zb= $(W).find("stop");$(ba).empty().append(ka);W=ba;ba=rb.val();W.setAttribute("spreadMethod",ba)}hb=ja==="rg"&&W.getAttribute("fx")!=null&&!(Ea==za&&Ia==Ka);$("#"+p+"_jGraduate_focusCoord").toggle(hb);if(hb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();yb.removeClass("jGraduate_tab_current");var zb;switch(s.paint.type){case "linearGradient":zb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":zb=
$(L+" .jGraduate_tab_radgrad");break;default:zb=$(L+" .jGraduate_tab_color")}s.show();setTimeout(function(){zb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),q=$(document);$.extend($.fn,{contextMenu:function(h,b){if(h.menu==undefined)return false;if(h.inSpeed==undefined)h.inSpeed=150;if(h.outSpeed==undefined)h.outSpeed=75;if(h.inSpeed==0)h.inSpeed=-1;if(h.outSpeed==0)h.outSpeed=-1;$(this).each(function(){var n=$(this),u=$(n).offset(),c=$("#"+h.menu);c.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(l){var s=$(this);s.unbind("mouseup");$(".contextMenu").hide();if(d.button===2|| $(L+" .jGraduate_tab_radgrad");break;default:zb=$(L+" .jGraduate_tab_color")}s.show();setTimeout(function(){zb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),q=$(document);$.extend($.fn,{contextMenu:function(h,b){if(h.menu==undefined)return false;if(h.inSpeed==undefined)h.inSpeed=150;if(h.outSpeed==undefined)h.outSpeed=75;if(h.inSpeed==0)h.inSpeed=-1;if(h.outSpeed==0)h.outSpeed=-1;$(this).each(function(){var n=$(this),u=$(n).offset(),c=$("#"+h.menu);c.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(l){var s=$(this);s.unbind("mouseup");$(".contextMenu").hide();if(d.button===2||
h.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||f(l,d,s)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var l=$(this);l.unbind("mouseup");f(d,d,l)});var f=function(d,l,s){if(typeof l=="undefined")l=d;d.stopPropagation();if(n.hasClass("disabled")||l.altKey)return false;var C=d.pageX,p=d.pageY;if(svgedit.browser.isTouch()){C=d.originalEvent.touches[0].pageX;p=d.originalEvent.touches[0].pageY}d=a.width()-c.width();l=a.height()-c.height();if(C>d-15)C=d-15; h.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||f(l,d,s)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var l=$(this);l.unbind("mouseup");f(d,d,l)});var f=function(d,l,s){if(typeof l=="undefined")l=d;d.stopPropagation();if(n.hasClass("disabled")||l.altKey)return false;var C=d.pageX,p=d.pageY;if(svgedit.browser.isTouch()){C=d.originalEvent.touches[0].pageX;p=d.originalEvent.touches[0].pageY}d=a.width()-c.width();l=a.height()-c.height();if(C>d-15)C=d-15;
if(p>l-30)p=l-30;if(svgedit.browser.isTouch())p-=c.height()/2;q.unbind("click");c.css({top:p,left:C}).fadeIn(h.inSpeed);c.find("A").mouseover(function(){c.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){c.find("LI.hover").removeClass("hover")});q.keypress(function(L){switch(L.keyCode){case 38:if(c.find("LI.hover").length){c.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:last").addClass("hover")}else c.find("LI:last").addClass("hover"); if(p>l-30)p=l-30;if(svgedit.browser.isTouch())p-=c.height()/2;q.unbind("click");c.css({top:p,left:C}).fadeIn(h.inSpeed);c.find("A").mouseover(function(){c.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){c.find("LI.hover").removeClass("hover")});q.keypress(function(L){switch(L.keyCode){case 38:if(c.find("LI.hover").length){c.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:last").addClass("hover")}else c.find("LI:last").addClass("hover");
@ -61,13 +61,13 @@ $(s),{x:C-u.left,y:p-u.top,docX:C,docY:p});return false});setTimeout(function(){
function(){return false})});return $(this)},disableContextMenuItems:function(h){if(h==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(h!=undefined)for(var b=h.split(","),n=0;n<b.length;n++)$(this).find('A[href="'+b[n]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(h){if(h==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(h!=undefined)for(var b=h.split(","),n= function(){return false})});return $(this)},disableContextMenuItems:function(h){if(h==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(h!=undefined)for(var b=h.split(","),n=0;n<b.length;n++)$(this).find('A[href="'+b[n]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(h){if(h==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(h!=undefined)for(var b=h.split(","),n=
0;n<b.length;n++)$(this).find('A[href="'+b[n]+'"]').parent().removeClass("disabled")});return $(this)},disableContextMenu:function(){$(this).each(function(){$(this).addClass("disabled")});return $(this)},enableContextMenu:function(){$(this).each(function(){$(this).removeClass("disabled")});return $(this)},destroyContextMenu:function(){$(this).each(function(){$(this).unbind("mousedown").unbind("mouseup")});return $(this)}})}(jQuery);var svgedit=svgedit||{}; 0;n<b.length;n++)$(this).find('A[href="'+b[n]+'"]').parent().removeClass("disabled")});return $(this)},disableContextMenu:function(){$(this).each(function(){$(this).addClass("disabled")});return $(this)},enableContextMenu:function(){$(this).each(function(){$(this).removeClass("disabled")});return $(this)},destroyContextMenu:function(){$(this).each(function(){$(this).unbind("mousedown").unbind("mouseup")});return $(this)}})}(jQuery);var svgedit=svgedit||{};
(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 q=navigator.userAgent,h=document.createElementNS("http://www.w3.org/2000/svg","svg"),b=!!window.opera,n=q.indexOf("AppleWebKit")>=0,u=q.indexOf("Gecko/")>=0,c=q.indexOf("MSIE")>=0,f=q.indexOf("Chrome/")>=0,d=q.indexOf("Windows")>=0,l=q.indexOf("Macintosh")>= (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 q=navigator.userAgent,h=document.createElementNS("http://www.w3.org/2000/svg","svg"),b=!!window.opera,n=q.indexOf("AppleWebKit")>=0,u=q.indexOf("Gecko/")>=0,c=q.indexOf("MSIE")>=0,f=q.indexOf("Chrome/")>=0,d=q.indexOf("Windows")>=0,l=q.indexOf("Macintosh")>=
0,s="ontouchstart"in window,C=!!h.querySelector,p=!!document.evaluate,L=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var fa=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{fa.replaceItem(na,0);return true}catch(aa){}return false}(),R=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var fa=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{fa.insertItemBefore(na, 0,s="ontouchstart"in window,C=!!h.querySelector,p=!!document.evaluate,L=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","path");aa.setAttribute("d","M0,0 10,10");var qa=aa.pathSegList;aa=aa.createSVGPathSegLinetoAbs(5,5);try{qa.replaceItem(aa,0);return true}catch(ha){}return false}(),R=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","path");aa.setAttribute("d","M0,0 10,10");var qa=aa.pathSegList;aa=aa.createSVGPathSegLinetoAbs(5,5);try{qa.insertItemBefore(aa,
0);return true}catch(aa){}return false}(),O=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg"),fa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);fa.setAttribute("x",5);na.appendChild(fa);var aa=document.createElementNS("http://www.w3.org/2000/svg","text");aa.textContent="a";fa.appendChild(aa);fa=aa.getStartPositionOfChar(0);fa=fa.x;document.documentElement.removeChild(na);return fa===0}(),K=function(){var na=document.createElementNS("http://www.w3.org/2000/svg", 0);return true}catch(ha){}return false}(),O=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(aa);var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 C0,0 10,10 10,0");aa.appendChild(qa);qa=qa.getBBox();document.documentElement.removeChild(aa);return qa.height>4&&qa.height<5}(),K=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(aa);
"svg");document.documentElement.appendChild(na);var fa=document.createElementNS("http://www.w3.org/2000/svg","path");fa.setAttribute("d","M0,0 C0,0 10,10 10,0");na.appendChild(fa);fa=fa.getBBox();document.documentElement.removeChild(na);return fa.height>4&&fa.height<5}(),P=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);var fa=document.createElementNS("http://www.w3.org/2000/svg","path");fa.setAttribute("d","M0,0 10,0");var aa= var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 10,0");var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M5,0 15,0");var ca=document.createElementNS("http://www.w3.org/2000/svg","g");ca.appendChild(qa);ca.appendChild(ha);aa.appendChild(ca);qa=ca.getBBox();document.documentElement.removeChild(aa);return qa.width==15}(),P=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","rect");aa.setAttribute("x",
document.createElementNS("http://www.w3.org/2000/svg","path");aa.setAttribute("d","M5,0 15,0");var V=document.createElementNS("http://www.w3.org/2000/svg","g");V.appendChild(fa);V.appendChild(aa);na.appendChild(V);fa=V.getBBox();document.documentElement.removeChild(na);return fa.width==15}(),T=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect");na.setAttribute("x",0.1);(na=na.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 <a href='http://opera.com'>latest version</a> in which the problems have been fixed."); 0.1);(aa=aa.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 <a href='http://opera.com'>latest version</a> in which the problems have been fixed.");return aa}(),T=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","rect");aa.setAttribute("style","vector-effect:non-scaling-stroke");return aa.style.vectorEffect==="non-scaling-stroke"}(),M=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg",
return na}(),M=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect");na.setAttribute("style","vector-effect:non-scaling-stroke");return na.style.vectorEffect==="non-scaling-stroke"}(),ha=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,fa=h.createSVGTransform();na.appendItem(fa);return na.getItem(0)==fa}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return n};svgedit.browser.isGecko=function(){return u}; "rect").transform.baseVal,qa=h.createSVGTransform();aa.appendItem(qa);return aa.getItem(0)==qa}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return n};svgedit.browser.isGecko=function(){return u};svgedit.browser.isIE=function(){return c};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return s};svgedit.browser.supportsSelectors=function(){return C};
svgedit.browser.isIE=function(){return c};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return s};svgedit.browser.supportsSelectors=function(){return C};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return R};svgedit.browser.supportsPathBBox=function(){return K}; svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return R};svgedit.browser.supportsPathBBox=function(){return O};svgedit.browser.supportsHVLineContainerBBox=function(){return K};svgedit.browser.supportsGoodTextCharPos=function(){};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return P};svgedit.browser.supportsNonScalingStroke=
svgedit.browser.supportsHVLineContainerBBox=function(){return P};svgedit.browser.supportsGoodTextCharPos=function(){return O};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return T};svgedit.browser.supportsNonScalingStroke=function(){return M};svgedit.browser.supportsNativeTransformLists=function(){return ha}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; function(){return T};svgedit.browser.supportsNativeTransformLists=function(){return M}}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"),q={};svgedit.transformlist.SVGTransformList=function(h){this._elem=h||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var n=0;n<this.numberOfItems;++n){var u=this._list.getItem(n);b=b;u=u;var c=u.matrix,f="";switch(u.type){case 1:f="matrix("+[c.a,c.b,c.c,c.d,c.e,c.f].join(",")+")";break;case 2:f="translate("+c.e+","+c.f+")";break;case 3:f= (function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),q={};svgedit.transformlist.SVGTransformList=function(h){this._elem=h||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var n=0;n<this.numberOfItems;++n){var u=this._list.getItem(n);b=b;u=u;var c=u.matrix,f="";switch(u.type){case 1:f="matrix("+[c.a,c.b,c.c,c.d,c.e,c.f].join(",")+")";break;case 2:f="translate("+c.e+","+c.f+")";break;case 3:f=
c.a==c.d?"scale("+c.a+")":"scale("+c.a+","+c.d+")";break;case 4:var d=0;f=0;if(u.angle!=0){d=1-c.a;f=(d*c.f+c.b*c.e)/(d*d+c.b*c.b);d=(c.e-c.b*f)/d}f="rotate("+u.angle+" "+d+","+f+")"}b=b+(f+" ")}this._elem.setAttribute("transform",b)};this._list=this;this._init=function(){var b=this._elem.getAttribute("transform");if(b)for(var n=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,u=true;u;){u=b.match(n);b=b.replace(n,"");if(u&&u[1]){var c=u[1].split(/\s*\(/),f=c[0];c=c[1].match(/\s*(.*?)\s*\)/); c.a==c.d?"scale("+c.a+")":"scale("+c.a+","+c.d+")";break;case 4:var d=0;f=0;if(u.angle!=0){d=1-c.a;f=(d*c.f+c.b*c.e)/(d*d+c.b*c.b);d=(c.e-c.b*f)/d}f="rotate("+u.angle+" "+d+","+f+")"}b=b+(f+" ")}this._elem.setAttribute("transform",b)};this._list=this;this._init=function(){var b=this._elem.getAttribute("transform");if(b)for(var n=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,u=true;u;){u=b.match(n);b=b.replace(n,"");if(u&&u[1]){var c=u[1].split(/\s*\(/),f=c[0];c=c[1].match(/\s*(.*?)\s*\)/);
c[1]=c[1].replace(/(\d)-/g,"$1 -");var d=c[1].split(/[, ]+/),l="abcdef".split(""),s=a.createSVGMatrix();$.each(d,function(L,R){d[L]=parseFloat(R);if(f=="matrix")s[l[L]]=d[L]});c=a.createSVGTransform();var C="set"+f.charAt(0).toUpperCase()+f.slice(1),p=f=="matrix"?[s]:d;if(f=="scale"&&p.length==1)p.push(p[0]);else if(f=="translate"&&p.length==1)p.push(0);else if(f=="rotate"&&p.length==1){p.push(0);p.push(0)}c[C].apply(c,p);this._list.appendItem(c)}}};this._removeFromOtherLists=function(b){if(b){var n= c[1]=c[1].replace(/(\d)-/g,"$1 -");var d=c[1].split(/[, ]+/),l="abcdef".split(""),s=a.createSVGMatrix();$.each(d,function(L,R){d[L]=parseFloat(R);if(f=="matrix")s[l[L]]=d[L]});c=a.createSVGTransform();var C="set"+f.charAt(0).toUpperCase()+f.slice(1),p=f=="matrix"?[s]:d;if(f=="scale"&&p.length==1)p.push(p[0]);else if(f=="translate"&&p.length==1)p.push(0);else if(f=="rotate"&&p.length==1){p.push(0);p.push(0)}c[C].apply(c,p);this._list.appendItem(c)}}};this._removeFromOtherLists=function(b){if(b){var n=
@ -93,7 +93,7 @@ d=d<<2|l>>4;l=(l&15)<<4|C>>2;s=(C&3)<<6|p;f+=String.fromCharCode(d);if(C!=64)f+=
new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{f=d.loadXML?d.loadXML(c)?d:false:d.parseFromString(c,"text/xml")}catch(s){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(c){return{x:c.x,y:c.y,width:c.width,height:c.height}};svgedit.utilities.walkTree=function(c,f){if(c&&c.nodeType==1){f(c);for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f)}}; new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{f=d.loadXML?d.loadXML(c)?d:false:d.parseFromString(c,"text/xml")}catch(s){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(c){return{x:c.x,y:c.y,width:c.width,height:c.height}};svgedit.utilities.walkTree=function(c,f){if(c&&c.nodeType==1){f(c);for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f)}};
svgedit.utilities.walkTreePost=function(c,f){if(c&&c.nodeType==1){for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f);f(c)}};svgedit.utilities.getUrlFromAttr=function(c){if(c)if(c.indexOf('url("')===0)return c.substring(5,c.indexOf('"',6));else if(c.indexOf("url('")===0)return c.substring(5,c.indexOf("'",6));else if(c.indexOf("url(")===0)return c.substring(4,c.indexOf(")"));return null};svgedit.utilities.getHref=function(c){return c.getAttributeNS("http://www.w3.org/1999/xlink", svgedit.utilities.walkTreePost=function(c,f){if(c&&c.nodeType==1){for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f);f(c)}};svgedit.utilities.getUrlFromAttr=function(c){if(c)if(c.indexOf('url("')===0)return c.substring(5,c.indexOf('"',6));else if(c.indexOf("url('")===0)return c.substring(5,c.indexOf("'",6));else if(c.indexOf("url(")===0)return c.substring(4,c.indexOf(")"));return null};svgedit.utilities.getHref=function(c){return c.getAttributeNS("http://www.w3.org/1999/xlink",
"href")};svgedit.utilities.setHref=function(c,f){c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(c){c=h.getSVGContent().documentElement;var f=c.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:c.insertBefore(c.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),c.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(c){var f=c.pathSegList,d=f.numberOfItems;c=[[],[]];var l=f.getItem(0), "href")};svgedit.utilities.setHref=function(c,f){c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(c){c=h.getSVGContent().documentElement;var f=c.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:c.insertBefore(c.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),c.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(c){var f=c.pathSegList,d=f.numberOfItems;c=[[],[]];var l=f.getItem(0),
s=[l.x,l.y];for(l=0;l<d;l++){var C=f.getItem(l);if(typeof C.x!="undefined"){c[0].push(s[0]);c[1].push(s[1]);if(C.x1){for(var p=[C.x1,C.y1],L=[C.x2,C.y2],R=[C.x,C.y],O=0;O<2;O++){C=function(ha){return Math.pow(1-ha,3)*s[O]+3*Math.pow(1-ha,2)*ha*p[O]+3*(1-ha)*Math.pow(ha,2)*L[O]+Math.pow(ha,3)*R[O]};var K=6*s[O]-12*p[O]+6*L[O],P=-3*s[O]+9*p[O]-9*L[O]+3*R[O],T=3*p[O]-3*s[O];if(P==0){if(K!=0){K=-T/K;0<K&&K<1&&c[O].push(C(K))}}else{T=Math.pow(K,2)-4*T*P;if(!(T<0)){var M=(-K+Math.sqrt(T))/(2*P);0<M&&M< s=[l.x,l.y];for(l=0;l<d;l++){var C=f.getItem(l);if(typeof C.x!="undefined"){c[0].push(s[0]);c[1].push(s[1]);if(C.x1){for(var p=[C.x1,C.y1],L=[C.x2,C.y2],R=[C.x,C.y],O=0;O<2;O++){C=function(aa){return Math.pow(1-aa,3)*s[O]+3*Math.pow(1-aa,2)*aa*p[O]+3*(1-aa)*Math.pow(aa,2)*L[O]+Math.pow(aa,3)*R[O]};var K=6*s[O]-12*p[O]+6*L[O],P=-3*s[O]+9*p[O]-9*L[O]+3*R[O],T=3*p[O]-3*s[O];if(P==0){if(K!=0){K=-T/K;0<K&&K<1&&c[O].push(C(K))}}else{T=Math.pow(K,2)-4*T*P;if(!(T<0)){var M=(-K+Math.sqrt(T))/(2*P);0<M&&M<
1&&c[O].push(C(M));K=(-K-Math.sqrt(T))/(2*P);0<K&&K<1&&c[O].push(C(K))}}}s=R}else{c[0].push(C.x);c[1].push(C.y)}}}f=Math.min.apply(null,c[0]);d=Math.max.apply(null,c[0])-f;l=Math.min.apply(null,c[1]);c=Math.max.apply(null,c[1])-l;return{x:f,y:l,width:d,height:c}};svgedit.utilities.getBBox=function(c){var f=c||h.geSelectedElements()[0];if(c.nodeType!=1)return null;c=null;var d=f.nodeName;switch(d){case "text":if(f.textContent===""){f.textContent="a";c=f.getBBox();f.textContent=""}else try{c=f.getBBox()}catch(l){}break; 1&&c[O].push(C(M));K=(-K-Math.sqrt(T))/(2*P);0<K&&K<1&&c[O].push(C(K))}}}s=R}else{c[0].push(C.x);c[1].push(C.y)}}}f=Math.min.apply(null,c[0]);d=Math.max.apply(null,c[0])-f;l=Math.min.apply(null,c[1]);c=Math.max.apply(null,c[1])-l;return{x:f,y:l,width:d,height:c}};svgedit.utilities.getBBox=function(c){var f=c||h.geSelectedElements()[0];if(c.nodeType!=1)return null;c=null;var d=f.nodeName;switch(d){case "text":if(f.textContent===""){f.textContent="a";c=f.getBBox();f.textContent=""}else try{c=f.getBBox()}catch(l){}break;
case "path":if(svgedit.browser.supportsPathBBox())try{c=f.getBBox()}catch(s){}else c=svgedit.utilities.getPathBBox(f);break;case "g":case "a":c=a(f);break;default:if(d==="use")c=a(f,true);if(d==="use"){c||(c=f.getBBox());if(!svgedit.browser.isWebkit()){d={};d.width=c.width;d.height=c.height;d.x=c.x+parseFloat(f.getAttribute("x")||0);d.y=c.y+parseFloat(f.getAttribute("y")||0);c=d}}else if(~q.indexOf(d))try{c=f.getBBox()}catch(C){f=$(f).closest("foreignObject");if(f.length)try{c=f[0].getBBox()}catch(p){c= case "path":if(svgedit.browser.supportsPathBBox())try{c=f.getBBox()}catch(s){}else c=svgedit.utilities.getPathBBox(f);break;case "g":case "a":c=a(f);break;default:if(d==="use")c=a(f,true);if(d==="use"){c||(c=f.getBBox());if(!svgedit.browser.isWebkit()){d={};d.width=c.width;d.height=c.height;d.x=c.x+parseFloat(f.getAttribute("x")||0);d.y=c.y+parseFloat(f.getAttribute("y")||0);c=d}}else if(~q.indexOf(d))try{c=f.getBBox()}catch(C){f=$(f).closest("foreignObject");if(f.length)try{c=f[0].getBBox()}catch(p){c=
null}else c=null}}if(c)c=svgedit.utilities.bboxToObj(c);return c};svgedit.utilities.getRotationAngle=function(c,f){var d=c||h.getSelectedElements()[0];d=svgedit.transformlist.getTransformList(d);if(!d)return 0;for(var l=d.numberOfItems,s=0;s<l;++s){var C=d.getItem(s);if(C.type==4)return f?C.angle*Math.PI/180:C.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(c){return u.querySelector("#"+c)}:svgedit.browser.supportsXpath()?function(c){return b.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+ null}else c=null}}if(c)c=svgedit.utilities.bboxToObj(c);return c};svgedit.utilities.getRotationAngle=function(c,f){var d=c||h.getSelectedElements()[0];d=svgedit.transformlist.getTransformList(d);if(!d)return 0;for(var l=d.numberOfItems,s=0;s<l;++s){var C=d.getItem(s);if(C.type==4)return f?C.angle*Math.PI/180:C.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(c){return u.querySelector("#"+c)}:svgedit.browser.supportsXpath()?function(c){return b.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+
@ -199,14 +199,14 @@ G=G.cloneNode(true);$(G).attr(E);G.id=ka();kb().appendChild(G);e.setAttribute(z,
true);a.appendChild(d);var l=f.createElementNS(b,"svg");(c.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:u[0],height:u[1],x:u[0],y:u[1],overflow:n.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");l.appendChild(e)})();var s="svg_";c.setIdPrefix= true);a.appendChild(d);var l=f.createElementNS(b,"svg");(c.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:u[0],height:u[1],x:u[0],y:u[1],overflow:n.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");l.appendChild(e)})();var s="svg_";c.setIdPrefix=
function(e){s=e};c.current_drawing_=new svgedit.draw.Drawing(l,s);var C=c.getCurrentDrawing=function(){return c.current_drawing_},p=1,L=null,R={shape:{fill:(n.initFill.color=="none"?"":"#")+n.initFill.color,fill_paint:null,fill_opacity:n.initFill.opacity,stroke:"#"+n.initStroke.color,stroke_paint:null,stroke_opacity:n.initStroke.opacity,stroke_width:n.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:n.initOpacity}};R.text=$.extend(true,{},R.shape);$.extend(R.text, function(e){s=e};c.current_drawing_=new svgedit.draw.Drawing(l,s);var C=c.getCurrentDrawing=function(){return c.current_drawing_},p=1,L=null,R={shape:{fill:(n.initFill.color=="none"?"":"#")+n.initFill.color,fill_paint:null,fill_opacity:n.initFill.opacity,stroke:"#"+n.initStroke.color,stroke_paint:null,stroke_opacity:n.initStroke.opacity,stroke_width:n.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:n.initOpacity}};R.text=$.extend(true,{},R.shape);$.extend(R.text,
{fill:"#000000",stroke_width:0,font_size:24,font_family:"Helvetica, Arial, sans-serif"});var O=R.shape,K=Array(1),P=this.addSvgElementFromJson=function(e){var k=svgedit.utilities.getElem(e.attr.id),m=C().getCurrentLayer();if(k&&e.element!=k.tagName){m.removeChild(k);k=null}if(!k){k=f.createElementNS(b,e.element);if(m)(L||m).appendChild(k)}e.curStyles&&svgedit.utilities.assignAttributes(k,{fill:O.fill,stroke:O.stroke,"stroke-width":O.stroke_width,"stroke-dasharray":O.stroke_dasharray,"stroke-linejoin":O.stroke_linejoin, {fill:"#000000",stroke_width:0,font_size:24,font_family:"Helvetica, Arial, sans-serif"});var O=R.shape,K=Array(1),P=this.addSvgElementFromJson=function(e){var k=svgedit.utilities.getElem(e.attr.id),m=C().getCurrentLayer();if(k&&e.element!=k.tagName){m.removeChild(k);k=null}if(!k){k=f.createElementNS(b,e.element);if(m)(L||m).appendChild(k)}e.curStyles&&svgedit.utilities.assignAttributes(k,{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(k,e.attr,100);svgedit.utilities.cleanupElement(k);return k},T=c.getTransformList=svgedit.transformlist.getTransformList,M=svgedit.math.transformPoint,ha=c.matrixMultiply=svgedit.math.matrixMultiply,na=c.hasMatrixTransform=svgedit.math.hasMatrixTransform,fa=c.transformListToTransform=svgedit.math.transformListToTransform, "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(k,e.attr,100);svgedit.utilities.cleanupElement(k);return k},T=c.getTransformList=svgedit.transformlist.getTransformList,M=svgedit.math.transformPoint,aa=c.matrixMultiply=svgedit.math.matrixMultiply,qa=c.hasMatrixTransform=svgedit.math.hasMatrixTransform,ha=c.transformListToTransform=svgedit.math.transformListToTransform,
aa=svgedit.math.snapToAngle,V=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return n.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/p},getWidth:function(){return l.getAttribute("width")/p},getRoundDigits:function(){return db.round_digits}});var ra=c.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return K}, ca=svgedit.math.snapToAngle,W=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return n.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/p},getWidth:function(){return l.getAttribute("width")/p},getRoundDigits:function(){return db.round_digits}});var ra=c.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return K},
getSVGContent:function(){return l}});var ia=c.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,da=c.getHref=svgedit.utilities.getHref,U=c.setHref=svgedit.utilities.setHref,Y=svgedit.utilities.getPathBBox;c.getBBox=svgedit.utilities.getBBox;var oa=c.getRotationAngle=svgedit.utilities.getRotationAngle,pa=c.getElem=svgedit.utilities.getElem,la=c.assignAttributes=svgedit.utilities.assignAttributes,ma=this.cleanupElement=svgedit.utilities.cleanupElement,Ba=svgedit.sanitize.getNSMap(),Ea=c.sanitizeSvg=svgedit.sanitize.sanitizeSvg, getSVGContent:function(){return l}});var ia=c.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ea=c.getHref=svgedit.utilities.getHref,U=c.setHref=svgedit.utilities.setHref,Y=svgedit.utilities.getPathBBox;c.getBBox=svgedit.utilities.getBBox;var na=c.getRotationAngle=svgedit.utilities.getRotationAngle,oa=c.getElem=svgedit.utilities.getElem,la=c.assignAttributes=svgedit.utilities.assignAttributes,ma=this.cleanupElement=svgedit.utilities.cleanupElement,Ba=svgedit.sanitize.getNSMap(),Ea=c.sanitizeSvg=svgedit.sanitize.sanitizeSvg,
Ia=svgedit.history.MoveElementCommand,za=svgedit.history.InsertElementCommand,Ka=svgedit.history.RemoveElementCommand,Na=svgedit.history.ChangeElementCommand,Aa=svgedit.history.BatchCommand;c.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,k){var m=svgedit.history.HistoryEventTypes;if(e==m.BEFORE_UNAPPLY||e==m.BEFORE_APPLY)c.clearSelection();else if(e==m.AFTER_APPLY||e==m.AFTER_UNAPPLY){var A=k.elements();c.pathActions.clear();N("changed",A);A=k.type();m=e==m.AFTER_APPLY;if(A== Ia=svgedit.history.MoveElementCommand,za=svgedit.history.InsertElementCommand,Ka=svgedit.history.RemoveElementCommand,Na=svgedit.history.ChangeElementCommand,Aa=svgedit.history.BatchCommand;c.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,k){var m=svgedit.history.HistoryEventTypes;if(e==m.BEFORE_UNAPPLY||e==m.BEFORE_APPLY)c.clearSelection();else if(e==m.AFTER_APPLY||e==m.AFTER_UNAPPLY){var A=k.elements();c.pathActions.clear();N("changed",A);A=k.type();m=e==m.AFTER_APPLY;if(A==
Ia.type()){m=m?k.newParent:k.oldParent;m==l&&c.identifyLayers()}else if(A==za.type()||A==Ka.type()){k.parent==l&&c.identifyLayers();if(A==za.type())m&&Sa(k.elem);else m||Sa(k.elem);k.elem.tagName==="use"&&Jb(k.elem)}else if(A==Na.type()){k.elem.tagName=="title"&&k.elem.parentNode.parentNode==l&&c.identifyLayers();m=m?k.newValues:k.oldValues;m.stdDeviation&&c.setBlurOffsets(k.elem.parentNode,m.stdDeviation);if(k.elem.tagName==="use"&&svgedit.browser.isWebkit()){A=k.elem;if(!A.getAttribute("x")&&!A.getAttribute("y")){m= Ia.type()){m=m?k.newParent:k.oldParent;m==l&&c.identifyLayers()}else if(A==za.type()||A==Ka.type()){k.parent==l&&c.identifyLayers();if(A==za.type())m&&Sa(k.elem);else m||Sa(k.elem);k.elem.tagName==="use"&&Jb(k.elem)}else if(A==Na.type()){k.elem.tagName=="title"&&k.elem.parentNode.parentNode==l&&c.identifyLayers();m=m?k.newValues:k.oldValues;m.stdDeviation&&c.setBlurOffsets(k.elem.parentNode,m.stdDeviation);if(k.elem.tagName==="use"&&svgedit.browser.isWebkit()){A=k.elem;if(!A.getAttribute("x")&&!A.getAttribute("y")){m=
A.parentNode;var z=A.nextSibling;m.removeChild(A);m.insertBefore(A,z)}}}}}});var ya=function(e){c.undoMgr.addCommandToHistory(e)};svgedit.select.init(n,{createSVGElement:function(e){return c.addSvgElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(e){return c.getStrokedBBox([e])}});var Ga=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return d}}); A.parentNode;var z=A.nextSibling;m.removeChild(A);m.insertBefore(A,z)}}}}}});var ya=function(e){c.undoMgr.addCommandToHistory(e)};svgedit.select.init(n,{createSVGElement:function(e){return c.addSvgElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(e){return c.getStrokedBBox([e])}});var Ga=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return d}});
svgedit.utilities.snapToGrid=function(e){var k=n.snappingStep,m=n.baseUnit;if(m!=="px")k*=svgedit.units.getTypeMap()[m];return e=Math.round(e/k)*k};var xa=svgedit.utilities.snapToGrid,nb={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"},Ya=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],fb=$.data, svgedit.utilities.snapToGrid=function(e){var k=n.snappingStep,m=n.baseUnit;if(m!=="px")k*=svgedit.units.getTypeMap()[m];return e=Math.round(e/k)*k};var xa=svgedit.utilities.snapToGrid,nb={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"},Ya=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],fb=$.data,
Sa=function(e){var k=$(e).attr(Ya),m;for(m in k){var A=k[m];if(A&&A.indexOf("url(")===0){A=ia(A).substr(1);if(!pa(A)){kb().appendChild(ub[A]);delete ub[A]}}}e=e.getElementsByTagName("*");if(e.length){k=0;for(m=e.length;k<m;k++)Sa(e[k])}},Wa={},Ca=n.imgPath+"logo.png",wa=[],db={round_digits:5},La=false,Ra=null,Da="select",gb="none",rb={},Xa=R.text,ab=O,xb=null,ua=null,jb=[],hb={},ub={};c.clipBoard=[];var lb=this.runExtensions=function(e,k,m){var A=false;if(m)A=[];$.each(hb,function(z,G){if(e in G)if(m)A.push(G[e](k)); Sa=function(e){var k=$(e).attr(Ya),m;for(m in k){var A=k[m];if(A&&A.indexOf("url(")===0){A=ia(A).substr(1);if(!oa(A)){kb().appendChild(ub[A]);delete ub[A]}}}e=e.getElementsByTagName("*");if(e.length){k=0;for(m=e.length;k<m;k++)Sa(e[k])}},Wa={},Ca=n.imgPath+"logo.png",wa=[],db={round_digits:5},La=false,Ra=null,Da="select",gb="none",rb={},Xa=R.text,ab=O,xb=null,ua=null,jb=[],hb={},ub={};c.clipBoard=[];var lb=this.runExtensions=function(e,k,m){var A=false;if(m)A=[];$.each(hb,function(z,G){if(e in G)if(m)A.push(G[e](k));
else A=G[e](k)});return A};this.addExtension=function(e,k){if(e in hb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var m=$.isFunction(k)?k($.extend(c.getPrivateMethods(),{svgroot:d,svgcontent:l,nonce:C().getNonce(),selectorManager:Ga})):k;hb[e]=m;N("extension_added",m)}};var eb=this.round=function(e){return parseInt(e*p)/p},sb=this.getIntersectionList=function(e){if(ua==null)return null;var k=L||C().getCurrentLayer();jb.length||(jb=yb(k));var m=null; else A=G[e](k)});return A};this.addExtension=function(e,k){if(e in hb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var m=$.isFunction(k)?k($.extend(c.getPrivateMethods(),{svgroot:d,svgcontent:l,nonce:C().getNonce(),selectorManager:Ga})):k;hb[e]=m;N("extension_added",m)}};var eb=this.round=function(e){return parseInt(e*p)/p},sb=this.getIntersectionList=function(e){if(ua==null)return null;var k=L||C().getCurrentLayer();jb.length||(jb=yb(k));var m=null;
try{m=k.getIntersectionList(e,null)}catch(A){}if(m==null||typeof m.item!="function"){m=[];if(e)e=e;else{e=ua.getBBox();k={};for(var z in e)k[z]=e[z]/p;e=k}for(z=jb.length;z--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,jb[z].bbox)&&m.push(jb[z].elem)}return m};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=ob());if(!e.length)return false;var k=function(I){try{var F=svgedit.utilities.getBBox(I),g=svgedit.utilities.getRotationAngle(I);if(g&&g%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(I))){g= try{m=k.getIntersectionList(e,null)}catch(A){}if(m==null||typeof m.item!="function"){m=[];if(e)e=e;else{e=ua.getBBox();k={};for(var z in e)k[z]=e[z]/p;e=k}for(z=jb.length;z--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,jb[z].bbox)&&m.push(jb[z].elem)}return m};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=ob());if(!e.length)return false;var k=function(I){try{var F=svgedit.utilities.getBBox(I),g=svgedit.utilities.getRotationAngle(I);if(g&&g%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(I))){g=
false;if(["ellipse","path","line","polyline","polygon"].indexOf(I.tagName)>=0)F=g=c.convertToPath(I,true);else if(I.tagName=="rect"){var o=I.getAttribute("rx"),v=I.getAttribute("ry");if(o||v)F=g=c.convertToPath(I,true)}if(!g){var D=I.cloneNode(true),H=document.createElementNS(b,"g"),J=I.parentNode;J.appendChild(H);H.appendChild(D);F=svgedit.utilities.bboxToObj(H.getBBox());J.removeChild(H)}}return F}catch(X){console.log(I,X);return null}},m;$.each(e,function(){if(!m)if(this.parentNode)m=k(this)}); false;if(["ellipse","path","line","polyline","polygon"].indexOf(I.tagName)>=0)F=g=c.convertToPath(I,true);else if(I.tagName=="rect"){var o=I.getAttribute("rx"),v=I.getAttribute("ry");if(o||v)F=g=c.convertToPath(I,true)}if(!g){var D=I.cloneNode(true),H=document.createElementNS(b,"g"),J=I.parentNode;J.appendChild(H);H.appendChild(D);F=svgedit.utilities.bboxToObj(H.getBBox());J.removeChild(H)}}return F}catch(X){console.log(I,X);return null}},m;$.each(e,function(){if(!m)if(this.parentNode)m=k(this)});
@ -214,81 +214,81 @@ if(m==null)return null;var A=m.x+m.width,z=m.y+m.height,G=m.x,B=m.y,w=function(I
(e=$(l).children());e.find("#canvas_background").length&&e.splice(0,1);var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push(A)}catch(z){}});return k.reverse()},yb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(l).children());var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push({elem:A,bbox:getStrokedBBox([A])})}catch(z){}});return k.reverse()},zb=this.groupSvgElem=function(e){var k=document.createElementNS(b,"g");e.parentNode.replaceChild(k,e);$(k).append(e).data("gsvg", (e=$(l).children());e.find("#canvas_background").length&&e.splice(0,1);var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push(A)}catch(z){}});return k.reverse()},yb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(l).children());var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push({elem:A,bbox:getStrokedBBox([A])})}catch(z){}});return k.reverse()},zb=this.groupSvgElem=function(e){var k=document.createElementNS(b,"g");e.parentNode.replaceChild(k,e);$(k).append(e).data("gsvg",
e)[0].id=ka()},ja=function(e){var k=document.createElementNS(e.namespaceURI,e.nodeName);k.removeAttribute("id");$.each(e.attributes,function(A,z){z.localName!="-moz-math-font-style"&&k.setAttributeNS(z.namespaceURI,z.nodeName,z.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var m=Ja.convertPath(e);k.setAttribute("d",m)}$.each(e.childNodes,function(A,z){switch(z.nodeType){case 1:k.appendChild(ja(z));break;case 3:k.textContent=z.nodeValue}});if($(e).data("gsvg"))$(k).data("gsvg",k.firstChild); e)[0].id=ka()},ja=function(e){var k=document.createElementNS(e.namespaceURI,e.nodeName);k.removeAttribute("id");$.each(e.attributes,function(A,z){z.localName!="-moz-math-font-style"&&k.setAttributeNS(z.namespaceURI,z.nodeName,z.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var m=Ja.convertPath(e);k.setAttribute("d",m)}$.each(e.childNodes,function(A,z){switch(z.nodeType){case 1:k.appendChild(ja(z));break;case 3:k.textContent=z.nodeValue}});if($(e).data("gsvg"))$(k).data("gsvg",k.firstChild);
else if($(e).data("symbol")){e=$(e).data("symbol");$(k).data("ref",e).data("symbol",e)}else k.tagName=="image"&&Gb(k);k.id=ka();return k},ba,ka,N;(function(e){var k={};ba=e.getId=function(){return C().getId()};ka=e.getNextId=function(){return C().getNextId()};N=e.call=function(m,A){if(k[m])return k[m](this,A)};e.bind=function(m,A){var z=k[m];k[m]=A;return z}})(c);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var k=0,m=e.length;k<m;++k){var A= else if($(e).data("symbol")){e=$(e).data("symbol");$(k).data("ref",e).data("symbol",e)}else k.tagName=="image"&&Gb(k);k.id=ka();return k},ba,ka,N;(function(e){var k={};ba=e.getId=function(){return C().getId()};ka=e.getNextId=function(){return C().getNextId()};N=e.call=function(m,A){if(k[m])return k[m](this,A)};e.bind=function(m,A){var z=k[m];k[m]=A;return z}})(c);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var k=0,m=e.length;k<m;++k){var A=
e[k];A.setAttribute("d",Ja.convertPath(A));Ja.fixEnd(A)}};var Q=this.getRefElem=function(e){return pa(ia(e).substr(1))},ea=function(e){if(!svgedit.browser.isGecko())return e;var k=e.cloneNode(true);e.parentNode.insertBefore(k,e);e.parentNode.removeChild(e);Ga.releaseSelector(e);K[0]=k;Ga.requestSelector(k).showGrips(true);return k};this.setRotationAngle=function(e,k){e=parseFloat(e);var m=K[0],A=m.getAttribute("transform"),z=svgedit.utilities.getBBox(m),G=z.x+z.width/2,B=z.y+z.height/2;z=T(m);z.numberOfItems> e[k];A.setAttribute("d",Ja.convertPath(A));Ja.fixEnd(A)}};var Q=this.getRefElem=function(e){return oa(ia(e).substr(1))},fa=function(e){if(!svgedit.browser.isGecko())return e;var k=e.cloneNode(true);e.parentNode.insertBefore(k,e);e.parentNode.removeChild(e);Ga.releaseSelector(e);K[0]=k;Ga.requestSelector(k).showGrips(true);return k};this.setRotationAngle=function(e,k){e=parseFloat(e);var m=K[0],A=m.getAttribute("transform"),z=svgedit.utilities.getBBox(m),G=z.x+z.width/2,B=z.y+z.height/2;z=T(m);z.numberOfItems>
0&&z.getItem(0).type==4&&z.removeItem(0);if(e!=0){G=M(G,B,fa(z).matrix);B=d.createSVGTransform();B.setRotate(e,G.x,G.y);z.numberOfItems?z.insertItemBefore(B,0):z.appendItem(B)}else z.numberOfItems==0&&m.removeAttribute("transform");if(!k){z=m.getAttribute("transform");m.setAttribute("transform",A);ib("transform",z,K);N("changed",K)}pa("pathpointgrip_container");m=Ga.requestSelector(K[0]);m.resize();m.updateGripCursors(e)};var Fa=this.recalculateAllSelectedDimensions=function(){for(var e=new Aa(gb== 0&&z.getItem(0).type==4&&z.removeItem(0);if(e!=0){G=M(G,B,ha(z).matrix);B=d.createSVGTransform();B.setRotate(e,G.x,G.y);z.numberOfItems?z.insertItemBefore(B,0):z.appendItem(B)}else z.numberOfItems==0&&m.removeAttribute("transform");if(!k){z=m.getAttribute("transform");m.setAttribute("transform",A);ib("transform",z,K);N("changed",K)}oa("pathpointgrip_container");m=Ga.requestSelector(K[0]);m.resize();m.updateGripCursors(e)};var Fa=this.recalculateAllSelectedDimensions=function(){for(var e=new Aa(gb==
"none"?"position":"size"),k=K.length;k--;){var m=Qa(K[k]);m&&e.addSubCommand(m)}if(!e.isEmpty()){ya(e);N("changed",K)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Va=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},$a=this.remapElement=function(e,k,m){var A=n.gridSnapping&&e.parentNode.parentNode.localName==="svg",z=function(){if(A)for(var g in k)k[g]=xa(k[g]);la(e,k,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var B=G===0?"fill":"stroke", "none"?"position":"size"),k=K.length;k--;){var m=Qa(K[k]);m&&e.addSubCommand(m)}if(!e.isEmpty()){ya(e);N("changed",K)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Va=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},$a=this.remapElement=function(e,k,m){var A=n.gridSnapping&&e.parentNode.parentNode.localName==="svg",z=function(){if(A)for(var g in k)k[g]=xa(k[g]);la(e,k,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var B=G===0?"fill":"stroke",
w=e.getAttribute(B);if(w&&w.indexOf("url(")===0)if(m.a<0||m.d<0){w=Q(w).cloneNode(true);if(m.a<0){var E=w.getAttribute("x1"),I=w.getAttribute("x2");w.setAttribute("x1",-(E-1));w.setAttribute("x2",-(I-1))}if(m.d<0){E=w.getAttribute("y1");I=w.getAttribute("y2");w.setAttribute("y1",-(E-1));w.setAttribute("y2",-(I-1))}w.id=ka();kb().appendChild(w);e.setAttribute(B,"url(#"+w.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(m.a==1&&m.b==0&&m.c==0&&m.d==1&&(m.e!=0||m.f!=0)){B=fa(e).matrix;B=ha(B.inverse(), w=e.getAttribute(B);if(w&&w.indexOf("url(")===0)if(m.a<0||m.d<0){w=Q(w).cloneNode(true);if(m.a<0){var E=w.getAttribute("x1"),I=w.getAttribute("x2");w.setAttribute("x1",-(E-1));w.setAttribute("x2",-(I-1))}if(m.d<0){E=w.getAttribute("y1");I=w.getAttribute("y2");w.setAttribute("y1",-(E-1));w.setAttribute("y2",-(I-1))}w.id=ka();kb().appendChild(w);e.setAttribute(B,"url(#"+w.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(m.a==1&&m.b==0&&m.c==0&&m.d==1&&(m.e!=0||m.f!=0)){B=ha(e).matrix;B=aa(B.inverse(),
m,B);k.x=parseFloat(k.x)+B.e;k.y=parseFloat(k.y)+B.f}else{B=T(e);w=d.createSVGTransform();w.setMatrix(ha(fa(B).matrix,m));B.clear();B.appendItem(w)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(m.a<0||m.d<0)){B=T(e);w=d.createSVGTransform();w.setMatrix(ha(fa(B).matrix,m));B.clear();B.appendItem(w)}else{B=M(k.x,k.y,m);k.width=m.a*k.width;k.height=m.d*k.height;k.x=B.x+Math.min(0,k.width);k.y=B.y+Math.min(0,k.height);k.width=Math.abs(k.width);k.height=Math.abs(k.height)}z(); m,B);k.x=parseFloat(k.x)+B.e;k.y=parseFloat(k.y)+B.f}else{B=T(e);w=d.createSVGTransform();w.setMatrix(aa(ha(B).matrix,m));B.clear();B.appendItem(w)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(m.a<0||m.d<0)){B=T(e);w=d.createSVGTransform();w.setMatrix(aa(ha(B).matrix,m));B.clear();B.appendItem(w)}else{B=M(k.x,k.y,m);k.width=m.a*k.width;k.height=m.d*k.height;k.x=B.x+Math.min(0,k.width);k.y=B.y+Math.min(0,k.height);k.width=Math.abs(k.width);k.height=Math.abs(k.height)}z();
break;case "ellipse":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;k.rx=m.a*k.rx;k.ry=m.d*k.ry;k.rx=Math.abs(k.rx);k.ry=Math.abs(k.ry);z();break;case "circle":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,m);k.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(k.r)k.r=Math.abs(k.r);z();break;case "line":B=M(k.x1,k.y1,m);E=M(k.x2,k.y2,m);k.x1=B.x;k.y1=B.y;k.x2=E.x;k.y2=E.y;case "text":m=e.querySelectorAll("tspan");for(G=m.length;G--;){B=ra("x",e.getAttribute("x")); break;case "ellipse":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;k.rx=m.a*k.rx;k.ry=m.d*k.ry;k.rx=Math.abs(k.rx);k.ry=Math.abs(k.ry);z();break;case "circle":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,m);k.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(k.r)k.r=Math.abs(k.r);z();break;case "line":B=M(k.x1,k.y1,m);E=M(k.x2,k.y2,m);k.x1=B.x;k.y1=B.y;k.x2=E.x;k.y2=E.y;case "text":m=e.querySelectorAll("tspan");for(G=m.length;G--;){B=ra("x",e.getAttribute("x"));
w=ra("x",m[G].getAttribute("x"));E=ra("y",e.getAttribute("y"));I=ra("y",m[G].getAttribute("y"));var F={};if(!isNaN(B)&&!isNaN(w)&&B!=0&&w!=0&&k.x)F.x=k.x-(B-w);if(!isNaN(E)&&!isNaN(I)&&E!=0&&I!=0&&k.y)F.y=k.y-(E-I);if(F.x||F.y)la(m[G],F,1E3,true)}z();break;case "use":z();break;case "g":(z=$(e).data("gsvg"))&&la(z,k,1E3,true);break;case "polyline":case "polygon":z=k.points.length;for(G=0;G<z;++G){I=k.points[G];I=M(I.x,I.y,m);k.points[G].x=I.x;k.points[G].y=I.y}z=k.points.length;m="";for(G=0;G<z;++G){I= w=ra("x",m[G].getAttribute("x"));E=ra("y",e.getAttribute("y"));I=ra("y",m[G].getAttribute("y"));var F={};if(!isNaN(B)&&!isNaN(w)&&B!=0&&w!=0&&k.x)F.x=k.x-(B-w);if(!isNaN(E)&&!isNaN(I)&&E!=0&&I!=0&&k.y)F.y=k.y-(E-I);if(F.x||F.y)la(m[G],F,1E3,true)}z();break;case "use":z();break;case "g":(z=$(e).data("gsvg"))&&la(z,k,1E3,true);break;case "polyline":case "polygon":z=k.points.length;for(G=0;G<z;++G){I=k.points[G];I=M(I.x,I.y,m);k.points[G].x=I.x;k.points[G].y=I.y}z=k.points.length;m="";for(G=0;G<z;++G){I=
k.points[G];m+=I.x+","+I.y+" "}e.setAttribute("points",m);break;case "path":B=e.pathSegList;z=B.numberOfItems;k.d=Array(z);for(G=0;G<z;++G){w=B.getItem(G);k.d[G]={type:w.pathSegType,x:w.x,y:w.y,x1:w.x1,y1:w.y1,x2:w.x2,y2:w.y2,r1:w.r1,r2:w.r2,angle:w.angle,largeArcFlag:w.largeArcFlag,sweepFlag:w.sweepFlag}}z=k.d.length;G=k.d[0];F=M(G.x,G.y,m);k.d[0].x=F.x;k.d[0].y=F.y;for(G=1;G<z;++G){w=k.d[G];B=w.type;if(B%2==0){I=M(w.x!=undefined?w.x:F.x,w.y!=undefined?w.y:F.y,m);B=M(w.x1,w.y1,m);E=M(w.x2,w.y2,m); k.points[G];m+=I.x+","+I.y+" "}e.setAttribute("points",m);break;case "path":B=e.pathSegList;z=B.numberOfItems;k.d=Array(z);for(G=0;G<z;++G){w=B.getItem(G);k.d[G]={type:w.pathSegType,x:w.x,y:w.y,x1:w.x1,y1:w.y1,x2:w.x2,y2:w.y2,r1:w.r1,r2:w.r2,angle:w.angle,largeArcFlag:w.largeArcFlag,sweepFlag:w.sweepFlag}}z=k.d.length;G=k.d[0];F=M(G.x,G.y,m);k.d[0].x=F.x;k.d[0].y=F.y;for(G=1;G<z;++G){w=k.d[G];B=w.type;if(B%2==0){I=M(w.x!=undefined?w.x:F.x,w.y!=undefined?w.y:F.y,m);B=M(w.x1,w.y1,m);E=M(w.x2,w.y2,m);
w.x=I.x;w.y=I.y;w.x1=B.x;w.y1=B.y;w.x2=E.x;w.y2=E.y}else{w.x=m.a*w.x;w.y=m.d*w.y;w.x1=m.a*w.x1;w.y1=m.d*w.y1;w.x2=m.a*w.x2;w.y2=m.d*w.y2}w.r1=m.a*w.r1;w.r2=m.d*w.r2}m="";z=k.d.length;for(G=0;G<z;++G){w=k.d[G];B=w.type;m+=Oa[B];switch(B){case 13:case 12:m+=w.x+" ";break;case 15:case 14:m+=w.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:m+=w.x+","+w.y+" ";break;case 7:case 6:m+=w.x1+","+w.y1+" "+w.x2+","+w.y2+" "+w.x+","+w.y+" ";break;case 9:case 8:m+=w.x1+","+w.y1+" "+w.x+","+w.y+" ";break; w.x=I.x;w.y=I.y;w.x1=B.x;w.y1=B.y;w.x2=E.x;w.y2=E.y}else{w.x=m.a*w.x;w.y=m.d*w.y;w.x1=m.a*w.x1;w.y1=m.d*w.y1;w.x2=m.a*w.x2;w.y2=m.d*w.y2}w.r1=m.a*w.r1;w.r2=m.d*w.r2}m="";z=k.d.length;for(G=0;G<z;++G){w=k.d[G];B=w.type;m+=Oa[B];switch(B){case 13:case 12:m+=w.x+" ";break;case 15:case 14:m+=w.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:m+=w.x+","+w.y+" ";break;case 7:case 6:m+=w.x1+","+w.y1+" "+w.x2+","+w.y2+" "+w.x+","+w.y+" ";break;case 9:case 8:m+=w.x1+","+w.y1+" "+w.x+","+w.y+" ";break;
case 11:case 10:m+=w.r1+","+w.r2+" "+w.angle+" "+ +w.largeArcFlag+" "+ +w.sweepFlag+" "+w.x+","+w.y+" ";break;case 17:case 16:m+=w.x2+","+w.y2+" "+w.x+","+w.y+" "}}e.setAttribute("d",m)}},qb=function(e,k,m){e=Q(e).firstChild;var A=T(e),z=d.createSVGTransform();z.setTranslate(k,m);A.appendItem(z);Qa(e)},Qa=this.recalculateDimensions=function(e){if(e==null)return null;var k=T(e);if(k&&k.numberOfItems>0){for(var m=k.numberOfItems;m--;){var A=k.getItem(m);if(A.type===0)k.removeItem(m);else if(A.type=== case 11:case 10:m+=w.r1+","+w.r2+" "+w.angle+" "+ +w.largeArcFlag+" "+ +w.sweepFlag+" "+w.x+","+w.y+" ";break;case 17:case 16:m+=w.x2+","+w.y2+" "+w.x+","+w.y+" "}}e.setAttribute("d",m)}},qb=function(e,k,m){e=Q(e).firstChild;var A=T(e),z=d.createSVGTransform();z.setTranslate(k,m);A.appendItem(z);Qa(e)},Qa=this.recalculateDimensions=function(e){if(e==null)return null;var k=T(e);if(k&&k.numberOfItems>0){for(var m=k.numberOfItems;m--;){var A=k.getItem(m);if(A.type===0)k.removeItem(m);else if(A.type===
1)svgedit.math.isIdentity(A.matrix)&&k.removeItem(m);else A.type===4&&A.angle===0&&k.removeItem(m)}if(k.numberOfItems===1&&oa(e))return null}if(!k||k.numberOfItems==0){e.removeAttribute("transform");return null}if(k){m=k.numberOfItems;for(var z=[];m--;){A=k.getItem(m);if(A.type===1)z.push([A.matrix,m]);else if(z.length)z=[]}if(z.length===2){m=d.createSVGTransformFromMatrix(ha(z[1][0],z[0][0]));k.removeItem(z[0][1]);k.removeItem(z[1][1]);k.insertItemBefore(m,z[1][1])}m=k.numberOfItems;if(m>=2&&k.getItem(m- 1)svgedit.math.isIdentity(A.matrix)&&k.removeItem(m);else A.type===4&&A.angle===0&&k.removeItem(m)}if(k.numberOfItems===1&&na(e))return null}if(!k||k.numberOfItems==0){e.removeAttribute("transform");return null}if(k){m=k.numberOfItems;for(var z=[];m--;){A=k.getItem(m);if(A.type===1)z.push([A.matrix,m]);else if(z.length)z=[]}if(z.length===2){m=d.createSVGTransformFromMatrix(aa(z[1][0],z[0][0]));k.removeItem(z[0][1]);k.removeItem(z[1][1]);k.insertItemBefore(m,z[1][1])}m=k.numberOfItems;if(m>=2&&k.getItem(m-
2).type===1&&k.getItem(m-1).type===2){z=d.createSVGTransform();A=ha(k.getItem(m-2).matrix,k.getItem(m-1).matrix);z.setMatrix(A);k.removeItem(m-2);k.removeItem(m-2);k.appendItem(z)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(k.numberOfItems===1&&k.getItem(0).type===1||k.numberOfItems===2&&k.getItem(0).type===1&&k.getItem(0).type===4)return null}var G=$(e).data("gsvg");m=new Aa("Transform");var B={},w=null;A=[];switch(e.tagName){case "line":A=["x1","y1", 2).type===1&&k.getItem(m-1).type===2){z=d.createSVGTransform();A=aa(k.getItem(m-2).matrix,k.getItem(m-1).matrix);z.setMatrix(A);k.removeItem(m-2);k.removeItem(m-2);k.appendItem(z)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(k.numberOfItems===1&&k.getItem(0).type===1||k.numberOfItems===2&&k.getItem(0).type===1&&k.getItem(0).type===4)return null}var G=$(e).data("gsvg");m=new Aa("Transform");var B={},w=null;A=[];switch(e.tagName){case "line":A=["x1","y1",
"x2","y2"];break;case "circle":A=["cx","cy","r"];break;case "ellipse":A=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":A=["width","height","x","y"];break;case "use":case "text":case "tspan":A=["x","y"];break;case "polygon":case "polyline":w={};w.points=e.getAttribute("points");z=e.points;var E=z.numberOfItems;B.points=Array(E);for(var I=0;I<E;++I){var F=z.getItem(I);B.points[I]={x:F.x,y:F.y}}break;case "path":w={};w.d=e.getAttribute("d");B.d=e.getAttribute("d")}if(A.length){B= "x2","y2"];break;case "circle":A=["cx","cy","r"];break;case "ellipse":A=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":A=["width","height","x","y"];break;case "use":case "text":case "tspan":A=["x","y"];break;case "polygon":case "polyline":w={};w.points=e.getAttribute("points");z=e.points;var E=z.numberOfItems;B.points=Array(E);for(var I=0;I<E;++I){var F=z.getItem(I);B.points[I]={x:F.x,y:F.y}}break;case "path":w={};w.d=e.getAttribute("d");B.d=e.getAttribute("d")}if(A.length){B=
$(e).attr(A);$.each(B,function(Ha,sa){B[Ha]=ra(Ha,sa)})}else if(G)B={x:$(G).attr("x")||0,y:$(G).attr("y")||0};if(w==null){w=$.extend(true,{},B);$.each(w,function(Ha,sa){w[Ha]=ra(Ha,sa)})}w.transform=Ra?Ra:"";if(e.tagName=="g"&&!G||e.tagName=="a"){z=svgedit.utilities.getBBox(e);var g={x:z.x+z.width/2,y:z.y+z.height/2},o=M(z.x+z.width/2,z.y+z.height/2,fa(k).matrix);A=d.createSVGMatrix();if(z=oa(e)){I=z*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I<k.numberOfItems;++I){A= $(e).attr(A);$.each(B,function(Ha,sa){B[Ha]=ra(Ha,sa)})}else if(G)B={x:$(G).attr("x")||0,y:$(G).attr("y")||0};if(w==null){w=$.extend(true,{},B);$.each(w,function(Ha,sa){w[Ha]=ra(Ha,sa)})}w.transform=Ra?Ra:"";if(e.tagName=="g"&&!G||e.tagName=="a"){z=svgedit.utilities.getBBox(e);var g={x:z.x+z.width/2,y:z.y+z.height/2},o=M(z.x+z.width/2,z.y+z.height/2,ha(k).matrix);A=d.createSVGMatrix();if(z=na(e)){I=z*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I<k.numberOfItems;++I){A=
k.getItem(I);if(A.type==4){A=A.matrix;g.y=(E*A.e+A.f)/2;g.x=(A.e-E*A.f)/2;k.removeItem(I);break}}}I=A=G=0;var v=k.numberOfItems;if(v)var D=k.getItem(0).matrix;if(v>=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;var H=k.getItem(v-3).matrix,J=k.getItem(v-2).matrix,X=k.getItem(v-1).matrix;E=e.childNodes;for(F=E.length;F--;){var ca=E.item(F);A=G=0;if(ca.nodeType==1){var S=T(ca);if(S){A=fa(S).matrix;G=oa(ca);var W=Ra,Z=[];Ra=ca.getAttribute("transform");if(G||na(S)){var qa= k.getItem(I);if(A.type==4){A=A.matrix;g.y=(E*A.e+A.f)/2;g.x=(A.e-E*A.f)/2;k.removeItem(I);break}}}I=A=G=0;var v=k.numberOfItems;if(v)var D=k.getItem(0).matrix;if(v>=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;var H=k.getItem(v-3).matrix,J=k.getItem(v-2).matrix,X=k.getItem(v-1).matrix;E=e.childNodes;for(F=E.length;F--;){var da=E.item(F);A=G=0;if(da.nodeType==1){var S=T(da);if(S){A=ha(S).matrix;G=na(da);var V=Ra,Z=[];Ra=da.getAttribute("transform");if(G||qa(S)){var pa=
d.createSVGTransform();qa.setMatrix(ha(H,J,X,A));S.clear();S.appendItem(qa);Z.push(qa)}else{G=ha(A.inverse(),X,A);qa=d.createSVGMatrix();qa.e=-G.e;qa.f=-G.f;A=ha(qa.inverse(),A.inverse(),H,J,X,A,G.inverse());var ta=d.createSVGTransform(),ga=d.createSVGTransform(),Ta=d.createSVGTransform();ta.setTranslate(G.e,G.f);ga.setScale(A.a,A.d);Ta.setTranslate(qa.e,qa.f);S.appendItem(Ta);S.appendItem(ga);S.appendItem(ta);Z.push(Ta);Z.push(ga);Z.push(ta)}m.addSubCommand(Qa(ca));Ra=W}}}k.removeItem(v-1);k.removeItem(v- d.createSVGTransform();pa.setMatrix(aa(H,J,X,A));S.clear();S.appendItem(pa);Z.push(pa)}else{G=aa(A.inverse(),X,A);pa=d.createSVGMatrix();pa.e=-G.e;pa.f=-G.f;A=aa(pa.inverse(),A.inverse(),H,J,X,A,G.inverse());var ta=d.createSVGTransform(),ga=d.createSVGTransform(),Ta=d.createSVGTransform();ta.setTranslate(G.e,G.f);ga.setScale(A.a,A.d);Ta.setTranslate(pa.e,pa.f);S.appendItem(Ta);S.appendItem(ga);S.appendItem(ta);Z.push(Ta);Z.push(ga);Z.push(ta)}m.addSubCommand(Qa(da));Ra=V}}}k.removeItem(v-1);k.removeItem(v-
2);k.removeItem(v-3)}else if(v>=3&&k.getItem(v-1).type==1){I=3;A=fa(k).matrix;qa=d.createSVGTransform();qa.setMatrix(A);k.clear();k.appendItem(qa)}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;G=fa(k).matrix;k.removeItem(0);A=fa(k).matrix.inverse();A=ha(A,G);G=A.e;A=A.f;if(G!=0||A!=0){E=e.childNodes;F=E.length;for(v=[];F--;){ca=E.item(F);if(ca.nodeType==1){if(ca.getAttribute("clip-path")){W=ca.getAttribute("clip-path");if(v.indexOf(W)===-1){qb(W,G,A);v.push(W)}}W=Ra;Ra=ca.getAttribute("transform"); 2);k.removeItem(v-3)}else if(v>=3&&k.getItem(v-1).type==1){I=3;A=ha(k).matrix;pa=d.createSVGTransform();pa.setMatrix(A);k.clear();k.appendItem(pa)}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;G=ha(k).matrix;k.removeItem(0);A=ha(k).matrix.inverse();A=aa(A,G);G=A.e;A=A.f;if(G!=0||A!=0){E=e.childNodes;F=E.length;for(v=[];F--;){da=E.item(F);if(da.nodeType==1){if(da.getAttribute("clip-path")){V=da.getAttribute("clip-path");if(v.indexOf(V)===-1){qb(V,G,A);v.push(V)}}V=Ra;Ra=da.getAttribute("transform");
if(S=T(ca)){H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H,0):S.appendItem(H);m.addSubCommand(Qa(ca));S=e.getElementsByTagNameNS(b,"use");ca="#"+ca.id;for(H=S.length;H--;){J=S.item(H);if(ca==da(J)){X=d.createSVGTransform();X.setTranslate(-G,-A);T(J).insertItemBefore(X,0);m.addSubCommand(Qa(J))}}Ra=W}}}v=[];Ra=W}}else if(v==1&&k.getItem(0).type==1&&!z){I=1;A=k.getItem(0).matrix;E=e.childNodes;for(F=E.length;F--;){ca=E.item(F);if(ca.nodeType==1){W=Ra;Ra=ca.getAttribute("transform"); if(S=T(da)){H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H,0):S.appendItem(H);m.addSubCommand(Qa(da));S=e.getElementsByTagNameNS(b,"use");da="#"+da.id;for(H=S.length;H--;){J=S.item(H);if(da==ea(J)){X=d.createSVGTransform();X.setTranslate(-G,-A);T(J).insertItemBefore(X,0);m.addSubCommand(Qa(J))}}Ra=V}}}v=[];Ra=V}}else if(v==1&&k.getItem(0).type==1&&!z){I=1;A=k.getItem(0).matrix;E=e.childNodes;for(F=E.length;F--;){da=E.item(F);if(da.nodeType==1){V=Ra;Ra=da.getAttribute("transform");
if(S=T(ca)){G=ha(A,fa(S).matrix);v=d.createSVGTransform();v.setMatrix(G);S.clear();S.appendItem(v,0);m.addSubCommand(Qa(ca));Ra=W;W=ca.getAttribute("stroke-width");ca.getAttribute("stroke")!=="none"&&!isNaN(W)&&ca.setAttribute("stroke-width",W*((Math.abs(G.a)+Math.abs(G.d))/2))}}}k.clear()}else{if(z){g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==2){if(z){o={x:g.x+D.e,y:g.y+ if(S=T(da)){G=aa(A,ha(S).matrix);v=d.createSVGTransform();v.setMatrix(G);S.clear();S.appendItem(v,0);m.addSubCommand(Qa(da));Ra=V;V=da.getAttribute("stroke-width");da.getAttribute("stroke")!=="none"&&!isNaN(V)&&da.setAttribute("stroke-width",V*((Math.abs(G.a)+Math.abs(G.d))/2))}}}k.clear()}else{if(z){g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==2){if(z){o={x:g.x+D.e,y:g.y+
D.f};g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I==3){A=fa(k).matrix;D=d.createSVGTransform();D.setRotate(z,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(z,o.x,o.y);o=g.matrix.inverse();W=A.inverse();o=ha(W,o,D,A);G=o.e;A=o.f;if(G!=0||A!=0){E=e.childNodes;for(F=E.length;F--;){ca=E.item(F);if(ca.nodeType==1){W=Ra;Ra=ca.getAttribute("transform");S=T(ca);H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H, D.f};g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I==3){A=ha(k).matrix;D=d.createSVGTransform();D.setRotate(z,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(z,o.x,o.y);o=g.matrix.inverse();V=A.inverse();o=aa(V,o,D,A);G=o.e;A=o.f;if(G!=0||A!=0){E=e.childNodes;for(F=E.length;F--;){da=E.item(F);if(da.nodeType==1){V=Ra;Ra=da.getAttribute("transform");S=T(da);H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H,
0):S.appendItem(H);m.addSubCommand(Qa(ca));Ra=W}}}if(z)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else{z=svgedit.utilities.getBBox(e);if(!z&&e.tagName!="path")return null;A=d.createSVGMatrix();if(G=oa(e)){g={x:z.x+z.width/2,y:z.y+z.height/2};o=M(z.x+z.width/2,z.y+z.height/2,fa(k).matrix);I=G*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I<k.numberOfItems;++I){A=k.getItem(I);if(A.type==4){A=A.matrix;g.y=(E*A.e+A.f)/2;g.x=(A.e-E*A.f)/2;k.removeItem(I);break}}}I= 0):S.appendItem(H);m.addSubCommand(Qa(da));Ra=V}}}if(z)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else{z=svgedit.utilities.getBBox(e);if(!z&&e.tagName!="path")return null;A=d.createSVGMatrix();if(G=na(e)){g={x:z.x+z.width/2,y:z.y+z.height/2};o=M(z.x+z.width/2,z.y+z.height/2,ha(k).matrix);I=G*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I<k.numberOfItems;++I){A=k.getItem(I);if(A.type==4){A=A.matrix;g.y=(E*A.e+A.f)/2;g.x=(A.e-E*A.f)/2;k.removeItem(I);break}}}I=
0;v=k.numberOfItems;if(!svgedit.browser.isWebkit())if((D=e.getAttribute("fill"))&&D.indexOf("url(")===0){D=Q(D);W="pattern";if(D.tagName!==W)W="gradient";if(D.getAttribute(W+"Units")==="userSpaceOnUse"){A=fa(k).matrix;z=T(D);z=fa(z).matrix;A=ha(A,z);z="matrix("+[A.a,A.b,A.c,A.d,A.e,A.f].join(",")+")";D.setAttribute(W+"Transform",z)}}if(v>=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;A=fa(k,v-3,v-1).matrix;k.removeItem(v-1);k.removeItem(v-2);k.removeItem(v-3)}else if(v== 0;v=k.numberOfItems;if(!svgedit.browser.isWebkit())if((D=e.getAttribute("fill"))&&D.indexOf("url(")===0){D=Q(D);V="pattern";if(D.tagName!==V)V="gradient";if(D.getAttribute(V+"Units")==="userSpaceOnUse"){A=ha(k).matrix;z=T(D);z=ha(z).matrix;A=aa(A,z);z="matrix("+[A.a,A.b,A.c,A.d,A.e,A.f].join(",")+")";D.setAttribute(V+"Transform",z)}}if(v>=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;A=ha(k,v-3,v-1).matrix;k.removeItem(v-1);k.removeItem(v-2);k.removeItem(v-3)}else if(v==
4&&k.getItem(v-1).type==1){I=3;A=fa(k).matrix;qa=d.createSVGTransform();qa.setMatrix(A);k.clear();k.appendItem(qa);A=d.createSVGMatrix()}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;D=k.getItem(0).matrix;W=fa(k,1).matrix;z=W.inverse();A=ha(z,D,W);k.removeItem(0)}else if(v==1&&k.getItem(0).type==1&&!G){A=fa(k).matrix;switch(e.tagName){case "line":B=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":B.points=e.getAttribute("points");if(B.points){z=e.points;E=z.numberOfItems; 4&&k.getItem(v-1).type==1){I=3;A=ha(k).matrix;pa=d.createSVGTransform();pa.setMatrix(A);k.clear();k.appendItem(pa);A=d.createSVGMatrix()}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;D=k.getItem(0).matrix;V=ha(k,1).matrix;z=V.inverse();A=aa(z,D,V);k.removeItem(0)}else if(v==1&&k.getItem(0).type==1&&!G){A=ha(k).matrix;switch(e.tagName){case "line":B=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":B.points=e.getAttribute("points");if(B.points){z=e.points;E=z.numberOfItems;
B.points=Array(E);for(I=0;I<E;++I){F=z.getItem(I);B.points[I]={x:F.x,y:F.y}}}case "path":B.d=e.getAttribute("d");I=1;k.clear()}}else{I=4;if(G){g=d.createSVGTransform();g.setRotate(G,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==1||I==2||I==3)$a(e,B,A);if(I==2){if(G){na(k)||(o={x:g.x+A.e,y:g.y+A.f});g=d.createSVGTransform();g.setRotate(G,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I== B.points=Array(E);for(I=0;I<E;++I){F=z.getItem(I);B.points[I]={x:F.x,y:F.y}}}case "path":B.d=e.getAttribute("d");I=1;k.clear()}}else{I=4;if(G){g=d.createSVGTransform();g.setRotate(G,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==1||I==2||I==3)$a(e,B,A);if(I==2){if(G){qa(k)||(o={x:g.x+A.e,y:g.y+A.f});g=d.createSVGTransform();g.setRotate(G,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I==
3&&G){A=fa(k).matrix;D=d.createSVGTransform();D.setRotate(G,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(G,o.x,o.y);o=g.matrix.inverse();W=A.inverse();o=ha(W,o,D,A);$a(e,B,o);if(G)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}k.numberOfItems==0&&e.removeAttribute("transform");m.addSubCommand(new Na(e,w));return m},pb=null,Pa=this.clearSelection=function(e){if(K[0]!=null)for(var k=K.length,m=0;m<k;++m){var A=K[m];if(A==null)break;Ga.releaseSelector(A);K[m]=null}e||N("selected", 3&&G){A=ha(k).matrix;D=d.createSVGTransform();D.setRotate(G,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(G,o.x,o.y);o=g.matrix.inverse();V=A.inverse();o=aa(V,o,D,A);$a(e,B,o);if(G)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}k.numberOfItems==0&&e.removeAttribute("transform");m.addSubCommand(new Na(e,w));return m},pb=null,Pa=this.clearSelection=function(e){if(K[0]!=null)for(var k=K.length,m=0;m<k;++m){var A=K[m];if(A==null)break;Ga.releaseSelector(A);K[m]=null}e||N("selected",
K)},tb=this.addToSelection=function(e,k){if(e.length!=0){for(var m=0;m<K.length;){if(K[m]==null)break;++m}for(var A=e.length;A--;){var z=e[A];if(z&&svgedit.utilities.getBBox(z)){if(z.tagName==="a"&&z.childNodes.length===1)z=z.firstChild;if(K.indexOf(z)==-1){K[m]=z;m++;z=Ga.requestSelector(z);K.length>1&&z.showGrips(false)}}}N("selected",K);k||K.length==1?Ga.requestSelector(K[0]).showGrips(true):Ga.requestSelector(K[0]).showGrips(false);for(K.sort(function(G,B){if(G&&B&&G.compareDocumentPosition)return 3- K)},tb=this.addToSelection=function(e,k){if(e.length!=0){for(var m=0;m<K.length;){if(K[m]==null)break;++m}for(var A=e.length;A--;){var z=e[A];if(z&&svgedit.utilities.getBBox(z)){if(z.tagName==="a"&&z.childNodes.length===1)z=z.firstChild;if(K.indexOf(z)==-1){K[m]=z;m++;z=Ga.requestSelector(z);K.length>1&&z.showGrips(false)}}}N("selected",K);k||K.length==1?Ga.requestSelector(K[0]).showGrips(true):Ga.requestSelector(K[0]).showGrips(false);for(K.sort(function(G,B){if(G&&B&&G.compareDocumentPosition)return 3-
(B.compareDocumentPosition(G)&6);else if(G==null)return 1});K[0]==null;)K.shift(0)}},vb=this.selectOnly=function(e,k){Pa(true);tb(e,k)};this.removeFromSelection=function(e){if(K[0]!=null)if(e.length!=0){var k=Array(K.length);j=0;len=K.length;for(var m=0;m<len;++m){var A=K[m];if(A)if(e.indexOf(A)==-1){k[j]=A;j++}else Ga.releaseSelector(A)}K=k}};this.selectAllInCurrentLayer=function(){var e=C().getCurrentLayer();if(e){Da="select";vb($(L||e).children())}};var mb=this.getMouseTarget=function(e){if(e== (B.compareDocumentPosition(G)&6);else if(G==null)return 1});K[0]==null;)K.shift(0)}},vb=this.selectOnly=function(e,k){Pa(true);tb(e,k)};this.removeFromSelection=function(e){if(K[0]!=null)if(e.length!=0){var k=Array(K.length);j=0;len=K.length;for(var m=0;m<len;++m){var A=K[m];if(A)if(e.indexOf(A)==-1){k[j]=A;j++}else Ga.releaseSelector(A)}K=k}};this.selectAllInCurrentLayer=function(){var e=C().getCurrentLayer();if(e){Da="select";vb($(L||e).children())}};var mb=this.getMouseTarget=function(e){if(e==
null)return null;e=e.target;if(e.correspondingUseElement)e=e.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(e.namespaceURI)>=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var k=C().getCurrentLayer();if([d,a,l,k].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ga.selectorParentGroup;for(;e.parentNode!==(L||k);)e=e.parentNode;return e};(function(){var e=null,k=null,m=null,A= null)return null;e=e.target;if(e.correspondingUseElement)e=e.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(e.namespaceURI)>=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var k=C().getCurrentLayer();if([d,a,l,k].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ga.selectorParentGroup;for(;e.parentNode!==(L||k);)e=e.parentNode;return e};(function(){var e=null,k=null,m=null,A=
null,z=null,G={},B={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(w){if(!(w.originalEvent.touches&&w.originalEvent.touches>1)){var E=w.button===2;pb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);w.preventDefault();if(E)Da="select";F=F/p;I=I/p;var g=mb(w);if(g.tagName==="a"&&g.childNodes.length===1)g=g.firstChild;var o=A=k=F,v=z=m=I;if(n.gridSnapping){F=xa(F);I=xa(I);k=xa(k);m=xa(m)}if(g== null,z=null,G={},B={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(w){if(!(w.originalEvent.touches&&w.originalEvent.touches>1)){var E=w.button===2;pb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);w.preventDefault();if(E)Da="select";F=F/p;I=I/p;var g=mb(w);if(g.tagName==="a"&&g.childNodes.length===1)g=g.firstChild;var o=A=k=F,v=z=m=I;if(n.gridSnapping){F=xa(F);I=xa(I);k=xa(k);m=xa(m)}if(g==
Ga.selectorParentGroup&&K[0]!=null){g=w.target;var D=fb(g,"type");if(D=="rotate"){Da="rotate";current_rotate_mode=fb(g,"dir")}else if(D=="resize"){Da="resize";gb=fb(g,"dir")}g=K[0]}Ra=g.getAttribute("transform");D=T(g);switch(Da){case "select":La=true;gb="none";if(E)La=false;if(g!=d){if(K.indexOf(g)==-1){w.shiftKey||Pa(true);tb([g]);xb=g;Ja.clear()}if(!E)for(E=0;E<K.length;++E)if(K[E]!=null){var H=T(K[E]);H.numberOfItems?H.insertItemBefore(d.createSVGTransform(),0):H.appendItem(d.createSVGTransform())}}else if(!E){Pa(); Ga.selectorParentGroup&&K[0]!=null){g=w.target;var D=fb(g,"type");if(D=="rotate"){Da="rotate";current_rotate_mode=fb(g,"dir")}else if(D=="resize"){Da="resize";gb=fb(g,"dir")}g=K[0]}Ra=g.getAttribute("transform");D=T(g);switch(Da){case "select":La=true;gb="none";if(E)La=false;if(g!=d){if(K.indexOf(g)==-1){w.shiftKey||Pa(true);tb([g]);xb=g;Ja.clear()}if(!E)for(E=0;E<K.length;++E)if(K[E]!=null){var H=T(K[E]);H.numberOfItems?H.insertItemBefore(d.createSVGTransform(),0):H.appendItem(d.createSVGTransform())}}else if(!E){Pa();
Da="multiselect";if(ua==null)ua=Ga.getRubberBandBox();A*=p;z*=p;la(ua,{x:A,y:z,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ua==null)ua=Ga.getRubberBandBox();la(ua,{x:o*p,y:o*p,width:0,height:0,display:"inline"},100);break;case "resize":La=true;k=F;m=I;G=svgedit.utilities.getBBox($("#selectedBox0")[0]);var J={};$.each(G,function(X,ca){J[X]=ca/p});G=J;E=oa(g)?1:0;if(na(D)){D.insertItemBefore(d.createSVGTransform(),E);D.insertItemBefore(d.createSVGTransform(),E);D.insertItemBefore(d.createSVGTransform(), Da="multiselect";if(ua==null)ua=Ga.getRubberBandBox();A*=p;z*=p;la(ua,{x:A,y:z,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ua==null)ua=Ga.getRubberBandBox();la(ua,{x:o*p,y:o*p,width:0,height:0,display:"inline"},100);break;case "resize":La=true;k=F;m=I;G=svgedit.utilities.getBBox($("#selectedBox0")[0]);var J={};$.each(G,function(X,da){J[X]=da/p});G=J;E=na(g)?1:0;if(qa(D)){D.insertItemBefore(d.createSVGTransform(),E);D.insertItemBefore(d.createSVGTransform(),E);D.insertItemBefore(d.createSVGTransform(),
E)}else{D.appendItem(d.createSVGTransform());D.appendItem(d.createSVGTransform());D.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(F=svgedit.browser.isChrome())H=function(X){var ca=X.getAttributeNS(null,"stroke");X.removeAttributeNS(null,"stroke");setTimeout(function(){X.setAttributeNS(null,"stroke",ca)},1)};g.style.vectorEffect="non-scaling-stroke";F&&H(g);I=g.getElementsByTagName("*");o=I.length;for(E=0;E<o;E++){I[E].style.vectorEffect="non-scaling-stroke"; E)}else{D.appendItem(d.createSVGTransform());D.appendItem(d.createSVGTransform());D.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(F=svgedit.browser.isChrome())H=function(X){var da=X.getAttributeNS(null,"stroke");X.removeAttributeNS(null,"stroke");setTimeout(function(){X.setAttributeNS(null,"stroke",da)},1)};g.style.vectorEffect="non-scaling-stroke";F&&H(g);I=g.getElementsByTagName("*");o=I.length;for(E=0;E<o;E++){I[E].style.vectorEffect="non-scaling-stroke";
F&&H(I[E])}}}break;case "fhellipse":case "fhrect":case "fhpath":La=true;e=o+","+v+" ";H=O.stroke_width==0?1:O.stroke_width;P({element:"polyline",curStyles:true,attr:{points:e,id:ka(),fill:"none",opacity:O.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});B.minx=o;B.maxx=o;B.miny=v;B.maxy=v;break;case "image":La=true;H=P({element:"image",attr:{x:F,y:I,width:0,height:0,id:ka(),opacity:O.opacity/2,style:"pointer-events:inherit"}});U(H,Ca);Gb(H);break;case "square":case "rect":La=true; F&&H(I[E])}}}break;case "fhellipse":case "fhrect":case "fhpath":La=true;e=o+","+v+" ";H=O.stroke_width==0?1:O.stroke_width;P({element:"polyline",curStyles:true,attr:{points:e,id:ka(),fill:"none",opacity:O.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});B.minx=o;B.maxx=o;B.miny=v;B.maxy=v;break;case "image":La=true;H=P({element:"image",attr:{x:F,y:I,width:0,height:0,id:ka(),opacity:O.opacity/2,style:"pointer-events:inherit"}});U(H,Ca);Gb(H);break;case "square":case "rect":La=true;
k=F;m=I;P({element:"rect",curStyles:true,attr:{x:F,y:I,width:0,height:0,id:ka(),opacity:O.opacity/2}});break;case "line":La=true;H=O.stroke_width==0?1:O.stroke_width;P({element:"line",curStyles:true,attr:{x1:F,y1:I,x2:F,y2:I,id:ka(),stroke:O.stroke,"stroke-width":H,"stroke-dasharray":O.stroke_dasharray,"stroke-linejoin":O.stroke_linejoin,"stroke-linecap":O.stroke_linecap,"stroke-opacity":O.stroke_opacity,fill:"none",opacity:O.opacity/2,style:"pointer-events:none"}});break;case "circle":La=true;P({element:"circle", k=F;m=I;P({element:"rect",curStyles:true,attr:{x:F,y:I,width:0,height:0,id:ka(),opacity:O.opacity/2}});break;case "line":La=true;H=O.stroke_width==0?1:O.stroke_width;P({element:"line",curStyles:true,attr:{x1:F,y1:I,x2:F,y2:I,id:ka(),stroke:O.stroke,"stroke-width":H,"stroke-dasharray":O.stroke_dasharray,"stroke-linejoin":O.stroke_linejoin,"stroke-linecap":O.stroke_linecap,"stroke-opacity":O.stroke_opacity,fill:"none",opacity:O.opacity/2,style:"pointer-events:none"}});break;case "circle":La=true;P({element:"circle",
curStyles:true,attr:{cx:F,cy:I,r:0,id:ka(),opacity:O.opacity/2}});break;case "ellipse":La=true;P({element:"ellipse",curStyles:true,attr:{cx:F,cy:I,rx:0,ry:0,id:ka(),opacity:O.opacity/2}});break;case "text":La=true;P({element:"text",curStyles:true,attr:{x:F,y:I,id:ka(),fill:Xa.fill,"stroke-width":Xa.stroke_width,"font-size":Xa.font_size,"font-family":Xa.font_family,"text-anchor":"left","xml:space":"preserve",opacity:O.opacity}});break;case "path":case "pathedit":k*=p;m*=p;Ja.mouseDown(w,g,k,m);La= curStyles:true,attr:{cx:F,cy:I,r:0,id:ka(),opacity:O.opacity/2}});break;case "ellipse":La=true;P({element:"ellipse",curStyles:true,attr:{cx:F,cy:I,rx:0,ry:0,id:ka(),opacity:O.opacity/2}});break;case "text":La=true;P({element:"text",curStyles:true,attr:{x:F,y:I,id:ka(),fill:Xa.fill,"stroke-width":Xa.stroke_width,"font-size":Xa.font_size,"font-family":Xa.font_family,"text-anchor":"left","xml:space":"preserve",opacity:O.opacity}});break;case "path":case "pathedit":k*=p;m*=p;Ja.mouseDown(w,g,k,m);La=
true;break;case "textedit":k*=p;m*=p;cb.mouseDown(w,g,k,m);La=true;break;case "rotate":La=true;c.undoMgr.beginUndoableChange("transform",K);document.getElementById("workarea").className="rotate"}H=lb("mouseDown",{event:w,start_x:k,start_y:m,selectedElements:K},true);$.each(H,function(X,ca){if(ca&&ca.started)La=true});if(Da)document.getElementById("workarea").className=Da=="resize"?w.target.style.cursor:Da}}).mousemove(function(w){if(!(w.originalEvent.touches&&w.originalEvent.touches.length>1))if(La)if(!(w.button=== true;break;case "textedit":k*=p;m*=p;cb.mouseDown(w,g,k,m);La=true;break;case "rotate":La=true;c.undoMgr.beginUndoableChange("transform",K);document.getElementById("workarea").className="rotate"}H=lb("mouseDown",{event:w,start_x:k,start_y:m,selectedElements:K},true);$.each(H,function(X,da){if(da&&da.started)La=true});if(Da)document.getElementById("workarea").className=Da=="resize"?w.target.style.cursor:Da}}).mousemove(function(w){if(!(w.originalEvent.touches&&w.originalEvent.touches.length>1))if(La)if(!(w.button===
1||c.spaceKey)){var E=K[0],I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);var g=pa(ba()),o=x=F/p,v=y=I/p;if(n.gridSnapping){x=xa(x);y=xa(y)}w.preventDefault();switch(Da){case "select":if(K[0]!==null){o=x-k;var D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D)}if(w.shiftKey){var H=aa(k,m,x,y);x=H.x;y=H.y}if(o!=0||D!=0){H=K.length;for(v=0;v<H;++v){E=K[v];if(E==null)break;var J=d.createSVGTransform();g=T(E);J.setTranslate(o,D);g.numberOfItems?g.replaceItem(J,0):g.appendItem(J);Ga.requestSelector(E).resize()}if(w.altKey)if(!c.addClones){c.addClones= 1||c.spaceKey)){var E=K[0],I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);var g=oa(ba()),o=x=F/p,v=y=I/p;if(n.gridSnapping){x=xa(x);y=xa(y)}w.preventDefault();switch(Da){case "select":if(K[0]!==null){o=x-k;var D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D)}if(w.shiftKey){var H=ca(k,m,x,y);x=H.x;y=H.y}if(o!=0||D!=0){H=K.length;for(v=0;v<H;++v){E=K[v];if(E==null)break;var J=d.createSVGTransform();g=T(E);J.setTranslate(o,D);g.numberOfItems?g.replaceItem(J,0):g.appendItem(J);Ga.requestSelector(E).resize()}if(w.altKey)if(!c.addClones){c.addClones=
c.cloneSelectedElements(0,0,J);c.removeClones=function(){c.addClones&&c.addClones.forEach(function(ga){ga.parentNode&&ga.parentNode.removeChild(ga);c.addClones=false})};window.addEventListener("keyup",c.removeClones)}N("transition",K)}}break;case "multiselect":o*=p;v*=p;la(ua,{x:Math.min(A,o),y:Math.min(z,v),width:Math.abs(o-A),height:Math.abs(v-z)},100);g=[];o=[];J=sb();H=K.length;for(v=0;v<H;++v){D=J.indexOf(K[v]);if(D==-1)g.push(K[v]);else J[D]=null}H=J.length;for(v=0;v<H;++v)J[v]&&o.push(J[v]); c.cloneSelectedElements(0,0,J);c.removeClones=function(){c.addClones&&c.addClones.forEach(function(ga){ga.parentNode&&ga.parentNode.removeChild(ga);c.addClones=false})};window.addEventListener("keyup",c.removeClones)}N("transition",K)}}break;case "multiselect":o*=p;v*=p;la(ua,{x:Math.min(A,o),y:Math.min(z,v),width:Math.abs(o-A),height:Math.abs(v-z)},100);g=[];o=[];J=sb();H=K.length;for(v=0;v<H;++v){D=J.indexOf(K[v]);if(D==-1)g.push(K[v]);else J[D]=null}H=J.length;for(v=0;v<H;++v)J[v]&&o.push(J[v]);
g.length>0&&c.removeFromSelection(g);o.length>0&&tb(o);break;case "resize":g=T(E);o=(J=na(g))?G:svgedit.utilities.getBBox(E);H=o.x;v=o.y;var X=o.width,ca=o.height;o=x-k;D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D);ca=xa(ca);X=xa(X)}var S=oa(E);if(S){var W=Math.sqrt(o*o+D*D);D=Math.atan2(D,o)-S*Math.PI/180;o=W*Math.cos(D);D=W*Math.sin(D)}if(gb.indexOf("n")==-1&&gb.indexOf("s")==-1)D=0;if(gb.indexOf("e")==-1&&gb.indexOf("w")==-1)o=0;var Z=W=0,qa=ca?(ca+D)/ca:1,ta=X?(X+o)/X:1;if(gb.indexOf("n")>=0){qa=ca? g.length>0&&c.removeFromSelection(g);o.length>0&&tb(o);break;case "resize":g=T(E);o=(J=qa(g))?G:svgedit.utilities.getBBox(E);H=o.x;v=o.y;var X=o.width,da=o.height;o=x-k;D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D);da=xa(da);X=xa(X)}var S=na(E);if(S){var V=Math.sqrt(o*o+D*D);D=Math.atan2(D,o)-S*Math.PI/180;o=V*Math.cos(D);D=V*Math.sin(D)}if(gb.indexOf("n")==-1&&gb.indexOf("s")==-1)D=0;if(gb.indexOf("e")==-1&&gb.indexOf("w")==-1)o=0;var Z=V=0,pa=da?(da+D)/da:1,ta=X?(X+o)/X:1;if(gb.indexOf("n")>=0){pa=da?
(ca-D)/ca:1;Z=ca}if(gb.indexOf("w")>=0){ta=X?(X-o)/X:1;W=X}o=d.createSVGTransform();D=d.createSVGTransform();X=d.createSVGTransform();if(n.gridSnapping){H=xa(H);W=xa(W);v=xa(v);Z=xa(Z)}o.setTranslate(-(H+W),-(v+Z));if(w.shiftKey)if(ta==1)ta=qa;else qa=ta;D.setScale(ta,qa);X.setTranslate(H+W,v+Z);if(J){J=S?1:0;g.replaceItem(o,2+J);g.replaceItem(D,1+J);g.replaceItem(X,0+J)}else{J=g.numberOfItems;g.replaceItem(X,J-3);g.replaceItem(D,J-2);g.replaceItem(o,J-1)}Ga.requestSelector(E).resize();N("transition", (da-D)/da:1;Z=da}if(gb.indexOf("w")>=0){ta=X?(X-o)/X:1;V=X}o=d.createSVGTransform();D=d.createSVGTransform();X=d.createSVGTransform();if(n.gridSnapping){H=xa(H);V=xa(V);v=xa(v);Z=xa(Z)}o.setTranslate(-(H+V),-(v+Z));if(w.shiftKey)if(ta==1)ta=pa;else pa=ta;D.setScale(ta,pa);X.setTranslate(H+V,v+Z);if(J){J=S?1:0;g.replaceItem(o,2+J);g.replaceItem(D,1+J);g.replaceItem(X,0+J)}else{J=g.numberOfItems;g.replaceItem(X,J-3);g.replaceItem(D,J-2);g.replaceItem(o,J-1)}Ga.requestSelector(E).resize();N("transition",
K);break;case "zoom":o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100);break;case "text":la(g,{x:x,y:y},1E3);break;case "line":o=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=xa(x);y=xa(y)}J=x;H=y;if(w.shiftKey){H=aa(k,m,J,H);J=H.x;H=H.y}g.setAttributeNS(null,"x2",J);g.setAttributeNS(null,"y2",H);window.opera||d.unsuspendRedraw(o);break;case "foreignObject":case "square":case "rect":case "image":o=Math.abs(x-k);J=Math.abs(y-m);if(Da== K);break;case "zoom":o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100);break;case "text":la(g,{x:x,y:y},1E3);break;case "line":o=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=xa(x);y=xa(y)}J=x;H=y;if(w.shiftKey){H=ca(k,m,J,H);J=H.x;H=H.y}g.setAttributeNS(null,"x2",J);g.setAttributeNS(null,"y2",H);window.opera||d.unsuspendRedraw(o);break;case "foreignObject":case "square":case "rect":case "image":o=Math.abs(x-k);J=Math.abs(y-m);if(Da==
"square"||w.shiftKey){o=J=Math.max(o,J);H=k<x?k:k-o;v=m<y?m:m-J}else{H=Math.min(k,x);v=Math.min(m,y)}if(w.altKey){o*=2;J*=2;H=k-o/2;v=m-J/2}if(n.gridSnapping){o=xa(o);J=xa(J);H=xa(H);v=xa(v)}la(g,{width:o,height:J,x:H,y:v},1E3);break;case "circle":o=$(g).attr(["cx","cy"]);J=o.cx;H=o.cy;o=Math.sqrt((x-J)*(x-J)+(y-H)*(y-H));if(n.gridSnapping)o=xa(o);g.setAttributeNS(null,"r",o);break;case "ellipse":o=$(g).attr(["cx","cy"]);J=Math.abs(k+(x-k)/2);H=Math.abs(m+(y-m)/2);o=null;window.opera||d.suspendRedraw(1E3); "square"||w.shiftKey){o=J=Math.max(o,J);H=k<x?k:k-o;v=m<y?m:m-J}else{H=Math.min(k,x);v=Math.min(m,y)}if(w.altKey){o*=2;J*=2;H=k-o/2;v=m-J/2}if(n.gridSnapping){o=xa(o);J=xa(J);H=xa(H);v=xa(v)}la(g,{width:o,height:J,x:H,y:v},1E3);break;case "circle":o=$(g).attr(["cx","cy"]);J=o.cx;H=o.cy;o=Math.sqrt((x-J)*(x-J)+(y-H)*(y-H));if(n.gridSnapping)o=xa(o);g.setAttributeNS(null,"r",o);break;case "ellipse":o=$(g).attr(["cx","cy"]);J=Math.abs(k+(x-k)/2);H=Math.abs(m+(y-m)/2);o=null;window.opera||d.suspendRedraw(1E3);
if(n.gridSnapping){x=xa(x);J=xa(J);y=xa(y);H=xa(H)}v=Math.abs(k-J);D=Math.abs(m-H);if(w.shiftKey){D=v;H=y>m?m+v:m-v}if(w.altKey){J=k;H=m;v=Math.abs(x-J);D=w.shiftKey?v:Math.abs(y-H)}g.setAttributeNS(null,"rx",v);g.setAttributeNS(null,"ry",D);g.setAttributeNS(null,"cx",J);g.setAttributeNS(null,"cy",H);window.opera||d.unsuspendRedraw(o);break;case "fhellipse":case "fhrect":B.minx=Math.min(o,B.minx);B.maxx=Math.max(o,B.maxx);B.miny=Math.min(v,B.miny);B.maxy=Math.max(v,B.maxy);case "fhpath":e+=+o+","+ if(n.gridSnapping){x=xa(x);J=xa(J);y=xa(y);H=xa(H)}v=Math.abs(k-J);D=Math.abs(m-H);if(w.shiftKey){D=v;H=y>m?m+v:m-v}if(w.altKey){J=k;H=m;v=Math.abs(x-J);D=w.shiftKey?v:Math.abs(y-H)}g.setAttributeNS(null,"rx",v);g.setAttributeNS(null,"ry",D);g.setAttributeNS(null,"cx",J);g.setAttributeNS(null,"cy",H);window.opera||d.unsuspendRedraw(o);break;case "fhellipse":case "fhrect":B.minx=Math.min(o,B.minx);B.maxx=Math.max(o,B.maxx);B.miny=Math.min(v,B.miny);B.maxy=Math.max(v,B.maxy);case "fhpath":e+=+o+","+
v+" ";g.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=p;y*=p;if(n.gridSnapping){x=xa(x);y=xa(y);k=xa(k);m=xa(m)}if(w.shiftKey){if(J=svgedit.path.path){g=J.dragging?J.dragging[0]:k;J=J.dragging?J.dragging[1]:m}else{g=k;J=m}H=aa(g,J,x,y);x=H.x;y=H.y}if(ua&&ua.getAttribute("display")!=="none"){o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100)}Ja.mouseMove(w,x,y);break;case "textedit":x*=p;y*=p;cb.mouseMove(F,I);break;case "rotate":o= v+" ";g.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=p;y*=p;if(n.gridSnapping){x=xa(x);y=xa(y);k=xa(k);m=xa(m)}if(w.shiftKey){if(J=svgedit.path.path){g=J.dragging?J.dragging[0]:k;J=J.dragging?J.dragging[1]:m}else{g=k;J=m}H=ca(g,J,x,y);x=H.x;y=H.y}if(ua&&ua.getAttribute("display")!=="none"){o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100)}Ja.mouseMove(w,x,y);break;case "textedit":x*=p;y*=p;cb.mouseMove(F,I);break;case "rotate":o=
svgedit.utilities.getBBox(E);J=o.x+o.width/2;H=o.y+o.height/2;g=V(E);g=M(J,H,g);J=g.x;H=g.y;g=o.x;v=o.y;if(current_rotate_mode=="nw")g=o.x+o.width;if(current_rotate_mode=="se")v=o.y+o.height;if(current_rotate_mode=="sw"){g=o.x+o.width;v=o.y+o.height}compensation_angle=(Math.atan2(H-v,J-g)*(180/Math.PI)-90)%360;S=(Math.atan2(H-y,J-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=xa(S);if(w.shiftKey)S=Math.round(S/45)*45;c.setRotationAngle(S<-180?360+S:S,true);N("transition",K)}lb("mouseMove", svgedit.utilities.getBBox(E);J=o.x+o.width/2;H=o.y+o.height/2;g=W(E);g=M(J,H,g);J=g.x;H=g.y;g=o.x;v=o.y;if(current_rotate_mode=="nw")g=o.x+o.width;if(current_rotate_mode=="se")v=o.y+o.height;if(current_rotate_mode=="sw"){g=o.x+o.width;v=o.y+o.height}compensation_angle=(Math.atan2(H-v,J-g)*(180/Math.PI)-90)%360;S=(Math.atan2(H-y,J-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=xa(S);if(w.shiftKey)S=Math.round(S/45)*45;c.setRotationAngle(S<-180?360+S:S,true);N("transition",K)}lb("mouseMove",
{event:w,mouse_x:F,mouse_y:I,selected:E})}}).click(function(w){w.preventDefault();return false}).dblclick(function(w){var E=w.target.parentNode;if(E!==L){var I=mb(w),F=I.tagName;if(F==="text"&&Da!=="textedit"){w=M(w.pageX,w.pageY,pb);cb.select(I,w.x,w.y)}if((F==="g"||F==="a")&&oa(I)){Kb(I);I=K[0];Pa(true)}L&&Hb();E.tagName!=="g"&&E.tagName!=="a"||E===C().getCurrentLayer()||I===Ga.selectorParentGroup||Pb(I)}}).mouseup(function(w){c.addClones=false;window.removeEventListener("keyup",c.removeClones); {event:w,mouse_x:F,mouse_y:I,selected:E})}}).click(function(w){w.preventDefault();return false}).dblclick(function(w){var E=w.target.parentNode;if(E!==L){var I=mb(w),F=I.tagName;if(F==="text"&&Da!=="textedit"){w=M(w.pageX,w.pageY,pb);cb.select(I,w.x,w.y)}if((F==="g"||F==="a")&&na(I)){Kb(I);I=K[0];Pa(true)}L&&Hb();E.tagName!=="g"&&E.tagName!=="a"||E===C().getCurrentLayer()||I===Ga.selectorParentGroup||Pb(I)}}).mouseup(function(w){c.addClones=false;window.removeEventListener("keyup",c.removeClones);
K=K.filter(Boolean);if(w.button!==2){var E=xb;xb=null;if(La){var I=M(w.pageX,w.pageY,pb),F=I.x*p;I=I.y*p;var g=F/p,o=I/p,v=pa(ba()),D=false;La=false;switch(Da){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");jb=[]}Da="select";case "select":if(K[0]!=null){if(K.length==1){F=K[0];switch(F.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ab.fill=F.getAttribute("fill");ab.fill_opacity=F.getAttribute("fill-opacity");ab.stroke=F.getAttribute("stroke"); K=K.filter(Boolean);if(w.button!==2){var E=xb;xb=null;if(La){var I=M(w.pageX,w.pageY,pb),F=I.x*p;I=I.y*p;var g=F/p,o=I/p,v=oa(ba()),D=false;La=false;switch(Da){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");jb=[]}Da="select";case "select":if(K[0]!=null){if(K.length==1){F=K[0];switch(F.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ab.fill=F.getAttribute("fill");ab.fill_opacity=F.getAttribute("fill-opacity");ab.stroke=F.getAttribute("stroke");
ab.stroke_opacity=F.getAttribute("stroke-opacity");ab.stroke_width=F.getAttribute("stroke-width");ab.stroke_dasharray=F.getAttribute("stroke-dasharray");ab.stroke_linejoin=F.getAttribute("stroke-linejoin");ab.stroke_linecap=F.getAttribute("stroke-linecap")}if(F.tagName=="text"){Xa.font_size=F.getAttribute("font-size");Xa.font_family=F.getAttribute("font-family")}Ga.requestSelector(F).showGrips(true)}Fa();if(g!=A||o!=z){w=K.length;for(F=0;F<w;++F){if(K[F]==null)break;K[F].firstChild||Ga.requestSelector(K[F]).resize()}}else{F= ab.stroke_opacity=F.getAttribute("stroke-opacity");ab.stroke_width=F.getAttribute("stroke-width");ab.stroke_dasharray=F.getAttribute("stroke-dasharray");ab.stroke_linejoin=F.getAttribute("stroke-linejoin");ab.stroke_linecap=F.getAttribute("stroke-linecap")}if(F.tagName=="text"){Xa.font_size=F.getAttribute("font-size");Xa.font_family=F.getAttribute("font-family")}Ga.requestSelector(F).showGrips(true)}Fa();if(g!=A||o!=z){w=K.length;for(F=0;F<w;++F){if(K[F]==null)break;K[F].firstChild||Ga.requestSelector(K[F]).resize()}}else{F=
w.target;if(K[0].nodeName==="path"&&K[1]==null)Ja.select(K[0]);else w.shiftKey&&E!=F&&c.removeFromSelection([F])}if(svgedit.browser.supportsNonScalingStroke())if(w=K[0]){w.removeAttribute("style");svgedit.utilities.walkTree(w,function(X){X.removeAttribute("style")})}}return;case "zoom":ua!=null&&ua.setAttribute("display","none");N("zoomed",{x:Math.min(A,g),y:Math.min(z,o),width:Math.abs(g-A),height:Math.abs(o-z),factor:w.altKey?0.5:2});return;case "fhpath":E=v.getAttribute("points");g=E.indexOf(","); w.target;if(K[0].nodeName==="path"&&K[1]==null)Ja.select(K[0]);else w.shiftKey&&E!=F&&c.removeFromSelection([F])}if(svgedit.browser.supportsNonScalingStroke())if(w=K[0]){w.removeAttribute("style");svgedit.utilities.walkTree(w,function(X){X.removeAttribute("style")})}}return;case "zoom":ua!=null&&ua.setAttribute("display","none");N("zoomed",{x:Math.min(A,g),y:Math.min(z,o),width:Math.abs(g-A),height:Math.abs(o-z),factor:w.altKey?0.5:2});return;case "fhpath":E=v.getAttribute("points");g=E.indexOf(",");
if(D=g>=0?E.indexOf(",",g+1)>=0:E.indexOf(" ",E.indexOf(" ")+1)>=0)v=Ja.smoothPolylineIntoPath(v);break;case "line":E=$(v).attr(["x1","x2","y1","y2"]);D=E.x1!=E.x2||E.y1!=E.y2;break;case "foreignObject":case "square":case "rect":case "image":E=$(v).attr(["width","height"]);D=E.width!=0||E.height!=0||Da==="image";break;case "circle":D=v.getAttribute("r")!=0;break;case "ellipse":E=$(v).attr(["rx","ry"]);D=E.rx!=null||E.ry!=null;break;case "fhellipse":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"ellipse", if(D=g>=0?E.indexOf(",",g+1)>=0:E.indexOf(" ",E.indexOf(" ")+1)>=0)v=Ja.smoothPolylineIntoPath(v);break;case "line":E=$(v).attr(["x1","x2","y1","y2"]);D=E.x1!=E.x2||E.y1!=E.y2;break;case "foreignObject":case "square":case "rect":case "image":E=$(v).attr(["width","height"]);D=E.width!=0||E.height!=0||Da==="image";break;case "circle":D=v.getAttribute("r")!=0;break;case "ellipse":E=$(v).attr(["rx","ry"]);D=E.rx!=null||E.ry!=null;break;case "fhellipse":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"ellipse",
curStyles:true,attr:{cx:(B.minx+B.maxx)/2,cy:(B.miny+B.maxy)/2,rx:(B.maxx-B.minx)/2,ry:(B.maxy-B.miny)/2,id:ba()}});N("changed",[v]);D=true}break;case "fhrect":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"rect",curStyles:true,attr:{x:B.minx,y:B.miny,width:B.maxx-B.minx,height:B.maxy-B.miny,id:ba()}});N("changed",[v]);D=true}break;case "text":D=true;vb([v]);cb.start(v);break;case "path":v=null;La=true;E=Ja.mouseUp(w,v,F,I);v=E.element;D=E.keep;break;case "pathedit":D=true;v=null;Ja.mouseUp(w); curStyles:true,attr:{cx:(B.minx+B.maxx)/2,cy:(B.miny+B.maxy)/2,rx:(B.maxx-B.minx)/2,ry:(B.maxy-B.miny)/2,id:ba()}});N("changed",[v]);D=true}break;case "fhrect":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"rect",curStyles:true,attr:{x:B.minx,y:B.miny,width:B.maxx-B.minx,height:B.maxy-B.miny,id:ba()}});N("changed",[v]);D=true}break;case "text":D=true;vb([v]);cb.start(v);break;case "path":v=null;La=true;E=Ja.mouseUp(w,v,F,I);v=E.element;D=E.keep;break;case "pathedit":D=true;v=null;Ja.mouseUp(w);
break;case "textedit":D=false;v=null;cb.mouseUp(w,F,I);break;case "rotate":D=true;v=null;Da="select";E=c.undoMgr.finishUndoableChange();E.isEmpty()||ya(E);Fa();N("changed",K)}F=lb("mouseUp",{event:w,mouse_x:F,mouse_y:I},true);$.each(F,function(X,ca){if(ca){D=ca.keep||D;v=ca.element;La=ca.started||La}});if(!D&&v!=null){C().releaseId(ba());v.parentNode.removeChild(v);v=null;for(F=w.target;F.parentNode.parentNode.tagName=="g";)F=F.parentNode;if((Da!="path"||!drawn_path)&&F.parentNode.id!="selectorParentGroup"&& break;case "textedit":D=false;v=null;cb.mouseUp(w,F,I);break;case "rotate":D=true;v=null;Da="select";E=c.undoMgr.finishUndoableChange();E.isEmpty()||ya(E);Fa();N("changed",K)}F=lb("mouseUp",{event:w,mouse_x:F,mouse_y:I},true);$.each(F,function(X,da){if(da){D=da.keep||D;v=da.element;La=da.started||La}});if(!D&&v!=null){C().releaseId(ba());v.parentNode.removeChild(v);v=null;for(F=w.target;F.parentNode.parentNode.tagName=="g";)F=F.parentNode;if((Da!="path"||!drawn_path)&&F.parentNode.id!="selectorParentGroup"&&
F.id!="svgcanvas"&&F.id!="svgroot"){c.setMode("select");vb([F],true)}}else if(v!=null){c.addedNew=true;w=0.2;var H;if(false.beginElement&&v.getAttribute("opacity")!=O.opacity){H=$(false).clone().attr({to:O.opacity,dur:w}).appendTo(v);try{H[0].beginElement()}catch(J){}}else w=0;setTimeout(function(){H&&H.remove();v.setAttribute("opacity",O.opacity);v.setAttribute("style","pointer-events:inherit");ma(v);if(Da==="path")Ja.toEditMode(v);else n.selectNew&&vb([v],true);ya(new za(v));N("changed",[v])},w* F.id!="svgcanvas"&&F.id!="svgroot"){c.setMode("select");vb([F],true)}}else if(v!=null){c.addedNew=true;w=0.2;var H;if(false.beginElement&&v.getAttribute("opacity")!=O.opacity){H=$(false).clone().attr({to:O.opacity,dur:w}).appendTo(v);try{H[0].beginElement()}catch(J){}}else w=0;setTimeout(function(){H&&H.remove();v.setAttribute("opacity",O.opacity);v.setAttribute("style","pointer-events:inherit");ma(v);if(Da==="path")Ja.toEditMode(v);else n.selectNew&&vb([v],true);ya(new za(v));N("changed",[v])},w*
1E3)}Ra=null}}});$(a).bind("mousewheel DOMMouseScroll",function(w){if(w.shiftKey){w.preventDefault();pb=l.getScreenCTM().inverse();var E=M(w.pageX,w.pageY,pb);E={x:E.x,y:E.y,width:0,height:0};if(w.wheelDelta)if(w.wheelDelta>=120)E.factor=2;else{if(w.wheelDelta<=-120)E.factor=0.5}else if(w.detail)if(w.detail>0)E.factor=0.5;else if(w.detail<0)E.factor=2;E.factor&&N("zoomed",E)}})})();var Gb=function(e){$(e).click(function(k){k.preventDefault()})},cb=c.textActions=function(){function e(S){var W=I.value=== 1E3)}Ra=null}}});$(a).bind("mousewheel DOMMouseScroll",function(w){if(w.shiftKey){w.preventDefault();pb=l.getScreenCTM().inverse();var E=M(w.pageX,w.pageY,pb);E={x:E.x,y:E.y,width:0,height:0};if(w.wheelDelta)if(w.wheelDelta>=120)E.factor=2;else{if(w.wheelDelta<=-120)E.factor=0.5}else if(w.detail)if(w.detail>0)E.factor=0.5;else if(w.detail<0)E.factor=2;E.factor&&N("zoomed",E)}})})();var Gb=function(e){$(e).click(function(k){k.preventDefault()})},cb=c.textActions=function(){function e(S){var V=I.value===
"";$(I).focus();if(!arguments.length)if(W)S=0;else{if(I.selectionEnd!==I.selectionStart)return;S=I.selectionEnd}var Z;Z=v[S];W||I.setSelectionRange(S,S);F=pa("text_cursor");if(!F){F=document.createElementNS(b,"line");la(F,{id:"text_cursor",stroke:"#333","stroke-width":1});F=pa("selectorParentGroup").appendChild(F)}o||(o=setInterval(function(){var qa=F.getAttribute("display")==="none";F.setAttribute("display",qa?"inline":"none")},600));W=G(Z.x,D.y);Z=G(Z.x,D.y+D.height);la(F,{x1:W.x,y1:W.y,x2:Z.x, "";$(I).focus();if(!arguments.length)if(V)S=0;else{if(I.selectionEnd!==I.selectionStart)return;S=I.selectionEnd}var Z;Z=v[S];V||I.setSelectionRange(S,S);F=oa("text_cursor");if(!F){F=document.createElementNS(b,"line");la(F,{id:"text_cursor",stroke:"#333","stroke-width":1});F=oa("selectorParentGroup").appendChild(F)}o||(o=setInterval(function(){var pa=F.getAttribute("display")==="none";F.setAttribute("display",pa?"inline":"none")},600));V=G(Z.x,D.y);Z=G(Z.x,D.y+D.height);la(F,{x1:V.x,y1:V.y,x2:Z.x,
y2:Z.y,visibility:"visible",display:"inline"});g&&g.setAttribute("d","")}function k(S,W,Z){if(S===W)e(W);else{Z||I.setSelectionRange(S,W);g=pa("text_selectblock");if(!g){g=document.createElementNS(b,"path");la(g,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(g)}S=v[S];var qa=v[W];F.setAttribute("visibility","hidden");W=G(S.x,D.y);Z=G(S.x+(qa.x-S.x),D.y);var ta=G(S.x,D.y+D.height);S=G(S.x+(qa.x-S.x),D.y+D.height);la(g,{d:"M"+W.x+ y2:Z.y,visibility:"visible",display:"inline"});g&&g.setAttribute("d","")}function k(S,V,Z){if(S===V)e(V);else{Z||I.setSelectionRange(S,V);g=oa("text_selectblock");if(!g){g=document.createElementNS(b,"path");la(g,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});oa("selectorParentGroup").appendChild(g)}S=v[S];var pa=v[V];F.setAttribute("visibility","hidden");V=G(S.x,D.y);Z=G(S.x+(pa.x-S.x),D.y);var ta=G(S.x,D.y+D.height);S=G(S.x+(pa.x-S.x),D.y+D.height);la(g,{d:"M"+V.x+
","+W.y+" L"+Z.x+","+Z.y+" "+S.x+","+S.y+" "+ta.x+","+ta.y+"z",display:"inline"})}}function m(S,W){var Z=d.createSVGPoint();Z.x=S;Z.y=W;if(v.length==1)return 0;Z=E.getCharNumAtPosition(Z);if(Z<0){Z=v.length-2;if(S<=v[0].x)Z=0}else if(Z>=v.length-2)Z=v.length-2;var qa=v[Z];S>qa.x+qa.width/2&&Z++;return Z}function A(S,W,Z){var qa=I.selectionStart;S=m(S,W);k(Math.min(qa,S),Math.max(qa,S),!Z)}function z(S,W){var Z={x:S,y:W};Z.x/=p;Z.y/=p;if(H){var qa=M(Z.x,Z.y,H.inverse());Z.x=qa.x;Z.y=qa.y}return Z} ","+V.y+" L"+Z.x+","+Z.y+" "+S.x+","+S.y+" "+ta.x+","+ta.y+"z",display:"inline"})}}function m(S,V){var Z=d.createSVGPoint();Z.x=S;Z.y=V;if(v.length==1)return 0;Z=E.getCharNumAtPosition(Z);if(Z<0){Z=v.length-2;if(S<=v[0].x)Z=0}else if(Z>=v.length-2)Z=v.length-2;var pa=v[Z];S>pa.x+pa.width/2&&Z++;return Z}function A(S,V,Z){var pa=I.selectionStart;S=m(S,V);k(Math.min(pa,S),Math.max(pa,S),!Z)}function z(S,V){var Z={x:S,y:V};Z.x/=p;Z.y/=p;if(H){var pa=M(Z.x,Z.y,H.inverse());Z.x=pa.x;Z.y=pa.y}return Z}
function G(S,W){var Z={x:S,y:W};if(H){var qa=M(Z.x,Z.y,H);Z.x=qa.x;Z.y=qa.y}Z.x*=p;Z.y*=p;return Z}function B(S){k(0,E.textContent.length);$(this).unbind(S)}function w(S){if(ca&&E){var W=M(S.pageX,S.pageY,pb);W=z(W.x*p,W.y*p);W=m(W.x,W.y);var Z=E.textContent,qa=Z.substr(0,W).replace(/[a-z0-9]+$/i,"").length;Z=Z.substr(W).match(/^[a-z0-9]+/i);k(qa,(Z?Z[0].length:0)+W);$(S.target).click(B);setTimeout(function(){$(S.target).unbind("click",B)},300)}}var E,I,F,g,o,v=[],D,H,J,X,ca;return{select:function(S, function G(S,V){var Z={x:S,y:V};if(H){var pa=M(Z.x,Z.y,H);Z.x=pa.x;Z.y=pa.y}Z.x*=p;Z.y*=p;return Z}function B(S){k(0,E.textContent.length);$(this).unbind(S)}function w(S){if(da&&E){var V=M(S.pageX,S.pageY,pb);V=z(V.x*p,V.y*p);V=m(V.x,V.y);var Z=E.textContent,pa=Z.substr(0,V).replace(/[a-z0-9]+$/i,"").length;Z=Z.substr(V).match(/^[a-z0-9]+/i);k(pa,(Z?Z[0].length:0)+V);$(S.target).click(B);setTimeout(function(){$(S.target).unbind("click",B)},300)}}var E,I,F,g,o,v=[],D,H,J,X,da;return{select:function(S,
W,Z){E=S;cb.toEditMode(W,Z)},start:function(S){E=S;cb.toEditMode()},mouseDown:function(S,W,Z,qa){S=z(Z,qa);I.focus();e(m(S.x,S.y));J=Z;X=qa},mouseMove:function(S,W){var Z=z(S,W);A(Z.x,Z.y)},mouseUp:function(S,W,Z){var qa=z(W,Z);A(qa.x,qa.y,true);S.target!==E&&W<J+2&&W>J-2&&Z<X+2&&Z>X-2&&cb.toSelectMode(true)},setCursor:e,toEditMode:function(S,W){vb([E],false);ca=false;Da="textedit";Ga.requestSelector(E).showGrips(false);Ga.requestSelector(E);cb.init();$(E).css("cursor","text");if(arguments.length){var Z= V,Z){E=S;cb.toEditMode(V,Z)},start:function(S){E=S;cb.toEditMode()},mouseDown:function(S,V,Z,pa){S=z(Z,pa);I.focus();e(m(S.x,S.y));J=Z;X=pa},mouseMove:function(S,V){var Z=z(S,V);A(Z.x,Z.y)},mouseUp:function(S,V,Z){var pa=z(V,Z);A(pa.x,pa.y,true);S.target!==E&&V<J+2&&V>J-2&&Z<X+2&&Z>X-2&&cb.toSelectMode(true)},setCursor:e,toEditMode:function(S,V){vb([E],false);da=false;Da="textedit";Ga.requestSelector(E).showGrips(false);Ga.requestSelector(E);cb.init();$(E).css("cursor","text");if(arguments.length){var Z=
z(S,W);e(m(Z.x,Z.y))}else e();setTimeout(function(){ca=true},300)},toSelectMode:function(S){Da="select";clearInterval(o);o=null;g&&$(g).attr("display","none");F&&$(F).attr("visibility","hidden");$(E).css("cursor","move");if(S){Pa();$(E).css("cursor","move");N("selected",[E]);tb([E],true)}E&&!E.textContent.length&&c.deleteSelectedElements();$(I).blur();E=false},setInputElem:function(S){I=S},clear:function(){Da=="textedit"&&cb.toSelectMode()},init:function(){if(E){if(!E.parentNode){E=K[0];Ga.requestSelector(E).showGrips(false)}var S= z(S,V);e(m(Z.x,Z.y))}else e();setTimeout(function(){da=true},300)},toSelectMode:function(S){Da="select";clearInterval(o);o=null;g&&$(g).attr("display","none");F&&$(F).attr("visibility","hidden");$(E).css("cursor","move");if(S){Pa();$(E).css("cursor","move");N("selected",[E]);tb([E],true)}E&&!E.textContent.length&&c.deleteSelectedElements();$(I).blur();E=false},setInputElem:function(S){I=S},clear:function(){Da=="textedit"&&cb.toSelectMode()},init:function(){if(E){if(!E.parentNode){E=K[0];Ga.requestSelector(E).showGrips(false)}var S=
E.textContent.length,W=E.getAttribute("transform");D=svgedit.utilities.getBBox(E);H=W?V(E):null;v=Array(S);I.focus();$(E).unbind("dblclick",w).dblclick(w);if(!S)var Z={x:D.x+D.width/2,width:0};for(W=0;W<S;W++){var qa=E.getStartPositionOfChar(W);Z=E.getEndPositionOfChar(W);if(!svgedit.browser.supportsGoodTextCharPos()){var ta=c.contentW*p;qa.x-=ta;Z.x-=ta;qa.x/=p;Z.x/=p}v[W]={x:qa.x,y:D.y,width:Z.x-qa.x,height:D.height}}v.push({x:Z.x,width:0});k(I.selectionStart,I.selectionEnd,true)}}}}(),Ja=c.pathActions= E.textContent.length,V=E.getAttribute("transform");D=svgedit.utilities.getBBox(E);H=V?W(E):null;v=Array(S);I.focus();$(E).unbind("dblclick",w).dblclick(w);if(!S)var Z={x:D.x+D.width/2,width:0};for(V=0;V<S;V++){var pa=E.getStartPositionOfChar(V);Z=E.getEndPositionOfChar(V);if(!svgedit.browser.supportsGoodTextCharPos()){var ta=c.contentW*p;pa.x-=ta;Z.x-=ta;pa.x/=p;Z.x/=p}v[V]={x:pa.x,y:D.y,width:Z.x-pa.x,height:D.height}}v.push({x:Z.x,width:0});k(I.selectionStart,I.selectionEnd,true)}}}}(),Ja=c.pathActions=
function(){var e=false,k,m,A;svgedit.path.Path.prototype.endChanges=function(B){if(svgedit.browser.isWebkit()){var w=this.elem;w.setAttribute("d",Ja.convertPath(w))}B=new Na(this.elem,{d:this.last_d},B);ya(B);N("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(B){$.isArray(B)||(B=[B]);for(var w=0;w<B.length;w++){var E=B[w],I=this.segs[E];I.ptgrip&&this.selected_pts.indexOf(E)==-1&&E>=0&&this.selected_pts.push(E)}this.selected_pts.sort();w=this.selected_pts.length;for(B= function(){var e=false,k,m,A;svgedit.path.Path.prototype.endChanges=function(B){if(svgedit.browser.isWebkit()){var w=this.elem;w.setAttribute("d",Ja.convertPath(w))}B=new Na(this.elem,{d:this.last_d},B);ya(B);N("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(B){$.isArray(B)||(B=[B]);for(var w=0;w<B.length;w++){var E=B[w],I=this.segs[E];I.ptgrip&&this.selected_pts.indexOf(E)==-1&&E>=0&&this.selected_pts.push(E)}this.selected_pts.sort();w=this.selected_pts.length;for(B=
Array(w);w--;){I=this.segs[this.selected_pts[w]];I.select(true);B[w]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);N("selected",B)};var z=k=null,G=false;return{mouseDown:function(B,w,E,I){if(Da==="path"){mouse_x=E;mouse_y=I;I=mouse_x/p;w=mouse_y/p;E=pa("path_stretch_line");m=[I,w];if(n.gridSnapping){I=xa(I);w=xa(w);mouse_x=xa(mouse_x);mouse_y=xa(mouse_y)}if(!E){E=document.createElementNS(b,"path");la(E,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5", Array(w);w--;){I=this.segs[this.selected_pts[w]];I.select(true);B[w]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);N("selected",B)};var z=k=null,G=false;return{mouseDown:function(B,w,E,I){if(Da==="path"){mouse_x=E;mouse_y=I;I=mouse_x/p;w=mouse_y/p;E=oa("path_stretch_line");m=[I,w];if(n.gridSnapping){I=xa(I);w=xa(w);mouse_x=xa(mouse_x);mouse_y=xa(mouse_y)}if(!E){E=document.createElementNS(b,"path");la(E,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",
fill:"none"});E=pa("selectorParentGroup").appendChild(E)}E.setAttribute("display","inline");var F=null;if(z){F=z.pathSegList;for(var g=F.numberOfItems,o=6/p,v=false;g;){g--;var D=F.getItem(g),H=D.x;D=D.y;if(I>=H-o&&I<=H+o&&w>=D-o&&w<=D+o){v=true;break}}o=ba();svgedit.path.removePath_(o);o=pa(o);H=F.numberOfItems;if(v){if(g<=1&&H>=2){I=F.getItem(0).x;w=F.getItem(0).y;B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(I,w):z.createSVGPathSegCurvetoCubicAbs(I,w,B.x1/p,B.y1/p, fill:"none"});E=oa("selectorParentGroup").appendChild(E)}E.setAttribute("display","inline");var F=null;if(z){F=z.pathSegList;for(var g=F.numberOfItems,o=6/p,v=false;g;){g--;var D=F.getItem(g),H=D.x;D=D.y;if(I>=H-o&&I<=H+o&&w>=D-o&&w<=D+o){v=true;break}}o=ba();svgedit.path.removePath_(o);o=oa(o);H=F.numberOfItems;if(v){if(g<=1&&H>=2){I=F.getItem(0).x;w=F.getItem(0).y;B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(I,w):z.createSVGPathSegCurvetoCubicAbs(I,w,B.x1/p,B.y1/p,
I,w);I=z.createSVGPathSegClosePath();F.appendItem(B);F.appendItem(I)}else if(H<3)return F=false;$(E).remove();element=o;z=null;La=false;if(e){svgedit.path.path.matrix&&$a(o,{},svgedit.path.path.matrix.inverse());E=o.getAttribute("d");B=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",B+E);$(o).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a, I,w);I=z.createSVGPathSegClosePath();F.appendItem(B);F.appendItem(I)}else if(H<3)return F=false;$(E).remove();element=o;z=null;La=false;if(e){svgedit.path.path.matrix&&$a(o,{},svgedit.path.path.matrix.inverse());E=o.getAttribute("d");B=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",B+E);$(o).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,
mb(B))){console.log("Clicked outside canvas");return false}F=z.pathSegList.numberOfItems;g=z.pathSegList.getItem(F-1);o=g.x;g=g.y;if(B.shiftKey){B=aa(o,g,I,w);I=B.x;w=B.y}B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(eb(I),eb(w)):z.createSVGPathSegCurvetoCubicAbs(eb(I),eb(w),B.x1/p,B.y1/p,B.x2/p,B.y2/p);z.pathSegList.appendItem(B);I*=p;w*=p;E.setAttribute("d",["M",I,w,I,w].join(" "));E=F;if(e)E+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(E,I,w)}}else{d_attr= mb(B))){console.log("Clicked outside canvas");return false}F=z.pathSegList.numberOfItems;g=z.pathSegList.getItem(F-1);o=g.x;g=g.y;if(B.shiftKey){B=ca(o,g,I,w);I=B.x;w=B.y}B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(eb(I),eb(w)):z.createSVGPathSegCurvetoCubicAbs(eb(I),eb(w),B.x1/p,B.y1/p,B.x2/p,B.y2/p);z.pathSegList.appendItem(B);I*=p;w*=p;E.setAttribute("d",["M",I,w,I,w].join(" "));E=F;if(e)E+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(E,I,w)}}else{d_attr=
"M"+I+","+w+" ";z=P({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:O.opacity/2}});E.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));E=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(E,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();o=B.target.id;if(o.substr(0,14)=="pathpointgrip_"){w=svgedit.path.path.cur_pt=parseInt(o.substr(14));svgedit.path.path.dragging=[E,I];F=svgedit.path.path.segs[w];if(B.shiftKey)F.selected?svgedit.path.path.removePtFromSelection(w): "M"+I+","+w+" ";z=P({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:O.opacity/2}});E.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));E=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(E,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();o=B.target.id;if(o.substr(0,14)=="pathpointgrip_"){w=svgedit.path.path.cur_pt=parseInt(o.substr(14));svgedit.path.path.dragging=[E,I];F=svgedit.path.path.segs[w];if(B.shiftKey)F.selected?svgedit.path.path.removePtFromSelection(w):
svgedit.path.path.addPtsToSelection(w);else{if(svgedit.path.path.selected_pts.length<=1||!F.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(w)}}else if(o.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[E,I];B=o.split("_")[1].split("c");w=B[0]-0;svgedit.path.path.selectPt(w,B[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ga.getRubberBandBox();la(ua,{x:E*p,y:I*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(B,w,E){G=true;if(Da==="path"){if(z){var I= svgedit.path.path.addPtsToSelection(w);else{if(svgedit.path.path.selected_pts.length<=1||!F.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(w)}}else if(o.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[E,I];B=o.split("_")[1].split("c");w=B[0]-0;svgedit.path.path.selectPt(w,B[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ga.getRubberBandBox();la(ua,{x:E*p,y:I*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(B,w,E){G=true;if(Da==="path"){if(z){var I=
z.pathSegList;B=I.numberOfItems-1;if(m){var F=svgedit.path.addCtrlGrip("1c1"),g=svgedit.path.addCtrlGrip("0c2");g.getAttribute("cx");g.getAttribute("cy");F.setAttribute("cx",w);F.setAttribute("cy",E);F.setAttribute("display","inline");F=m[0];var o=m[1];I.getItem(B);var v=F+(F-w/p),D=o+(o-E/p);g.setAttribute("cx",v*p);g.setAttribute("cy",D*p);g.setAttribute("display","inline");g=svgedit.path.getCtrlLine(1);var H=svgedit.path.getCtrlLine(2);la(g,{x1:w,y1:E,x2:F*p,y2:o*p,display:"inline"});la(H,{x1:v* z.pathSegList;B=I.numberOfItems-1;if(m){var F=svgedit.path.addCtrlGrip("1c1"),g=svgedit.path.addCtrlGrip("0c2");g.getAttribute("cx");g.getAttribute("cy");F.setAttribute("cx",w);F.setAttribute("cy",E);F.setAttribute("display","inline");F=m[0];var o=m[1];I.getItem(B);var v=F+(F-w/p),D=o+(o-E/p);g.setAttribute("cx",v*p);g.setAttribute("cy",D*p);g.setAttribute("display","inline");g=svgedit.path.getCtrlLine(1);var H=svgedit.path.getCtrlLine(2);la(g,{x1:w,y1:E,x2:F*p,y2:o*p,display:"inline"});la(H,{x1:v*
p,y1:D*p,x2:F*p,y2:o*p,display:"inline"});if(B===0)A=[w,E];else{I=I.getItem(B-1);w=I.x;E=I.y;if(I.pathSegType===6){w+=w-I.x2;E+=E-I.y2}else if(A){w=A[0]/p;E=A[1]/p}svgedit.path.replacePathSeg(6,B,[F,o,w,E,v,D],z)}}else if(F=pa("path_stretch_line")){B=I.getItem(B);if(B.pathSegType===6)svgedit.path.replacePathSeg(6,1,[w,E,(B.x+(B.x-B.x2))*p,(B.y+(B.y-B.y2))*p,w,E],F);else A?svgedit.path.replacePathSeg(6,1,[w,E,A[0],A[1],w,E],F):svgedit.path.replacePathSeg(4,1,[w,E],F)}}}else if(svgedit.path.path.dragging){F= p,y1:D*p,x2:F*p,y2:o*p,display:"inline"});if(B===0)A=[w,E];else{I=I.getItem(B-1);w=I.x;E=I.y;if(I.pathSegType===6){w+=w-I.x2;E+=E-I.y2}else if(A){w=A[0]/p;E=A[1]/p}svgedit.path.replacePathSeg(6,B,[F,o,w,E,v,D],z)}}else if(F=oa("path_stretch_line")){B=I.getItem(B);if(B.pathSegType===6)svgedit.path.replacePathSeg(6,1,[w,E,(B.x+(B.x-B.x2))*p,(B.y+(B.y-B.y2))*p,w,E],F);else A?svgedit.path.replacePathSeg(6,1,[w,E,A[0],A[1],w,E],F):svgedit.path.replacePathSeg(4,1,[w,E],F)}}}else if(svgedit.path.path.dragging){F=
svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);o=svgedit.path.getPointFromGrip({x:w,y:E},svgedit.path.path);B=o.x-F.x;F=o.y-F.y;svgedit.path.path.dragging=[w,E];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(B,F):svgedit.path.path.movePts(B,F)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var J=ua.getBBox(),X=svgedit.path.getGripPt(this);J=svgedit.math.rectsIntersect(J, svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);o=svgedit.path.getPointFromGrip({x:w,y:E},svgedit.path.path);B=o.x-F.x;F=o.y-F.y;svgedit.path.path.dragging=[w,E];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(B,F):svgedit.path.path.movePts(B,F)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var J=ua.getBBox(),X=svgedit.path.getGripPt(this);J=svgedit.math.rectsIntersect(J,
{x:X.x,y:X.y,width:0,height:0});this.select(J);J&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(B,w){if(Da==="path"){m=null;if(!z){w=pa(ba());La=false;A=null}return{keep:true,element:w}}if(svgedit.path.path.dragging){var E=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)");!B.shiftKey&&!G&&svgedit.path.path.selectPt(E)}else if(ua&&ua.getAttribute("display")!= {x:X.x,y:X.y,width:0,height:0});this.select(J);J&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(B,w){if(Da==="path"){m=null;if(!z){w=oa(ba());La=false;A=null}return{keep:true,element:w}}if(svgedit.path.path.dragging){var E=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)");!B.shiftKey&&!G&&svgedit.path.path.selectPt(E)}else if(ua&&ua.getAttribute("display")!=
"none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=2&&Ja.toSelectMode(B.target)}else Ja.toSelectMode(B.target);G=false},toEditMode:function(B){svgedit.path.path=svgedit.path.getPath_(B);Da="pathedit";Pa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(B){var w=B==svgedit.path.path.elem;Da="select";svgedit.path.path.show(false);k=false;Pa();svgedit.path.path.matrix&& "none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=2&&Ja.toSelectMode(B.target)}else Ja.toSelectMode(B.target);G=false},toEditMode:function(B){svgedit.path.path=svgedit.path.getPath_(B);Da="pathedit";Pa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(B){var w=B==svgedit.path.path.elem;Da="select";svgedit.path.path.show(false);k=false;Pa();svgedit.path.path.matrix&&
svgedit.path.recalcRotatedPath();if(w){N("selected",[B]);tb([B],true)}},addSubPath:function(B){if(B){Da="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(B){if(k===B){Ja.toEditMode(B);Da="pathedit"}else k=B},reorient:function(){var B=K[0];if(B)if(oa(B)!=0){var w=new Aa("Reorient path"),E={d:B.getAttribute("d"),transform:B.getAttribute("transform")};w.addSubCommand(new Na(B,E));Pa();this.resetOrientation(B);ya(w);svgedit.path.getPath_(B).show(false).matrix=null; svgedit.path.recalcRotatedPath();if(w){N("selected",[B]);tb([B],true)}},addSubPath:function(B){if(B){Da="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(B){if(k===B){Ja.toEditMode(B);Da="pathedit"}else k=B},reorient:function(){var B=K[0];if(B)if(na(B)!=0){var w=new Aa("Reorient path"),E={d:B.getAttribute("d"),transform:B.getAttribute("transform")};w.addSubCommand(new Na(B,E));Pa();this.resetOrientation(B);ya(w);svgedit.path.getPath_(B).show(false).matrix=null;
this.clear();tb([B],true);N("changed",K)}},clear:function(){k=null;if(z){var B=pa(ba());$(pa("path_stretch_line")).remove();$(B).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");z=A=null;La=false}else Da=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(B){if(B==null||B.nodeName!="path")return false;var w=T(B),E=fa(w).matrix;w.clear();B.removeAttribute("transform");w=B.pathSegList;for(var I=w.numberOfItems, this.clear();tb([B],true);N("changed",K)}},clear:function(){k=null;if(z){var B=oa(ba());$(oa("path_stretch_line")).remove();$(B).remove();$(oa("pathpointgrip_container")).find("*").attr("display","none");z=A=null;La=false}else Da=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(B){if(B==null||B.nodeName!="path")return false;var w=T(B),E=ha(w).matrix;w.clear();B.removeAttribute("transform");w=B.pathSegList;for(var I=w.numberOfItems,
F=0;F<I;++F){var g=w.getItem(F),o=g.pathSegType;if(o!=1){var v=[];$.each(["",1,2],function(D,H){var J=g["x"+H],X=g["y"+H];if(J!==undefined&&X!==undefined){J=M(J,X,E);v.splice(v.length,0,J.x,J.y)}});svgedit.path.replacePathSeg(o,F,v,B)}}h(B,E)},zoomChange:function(){Da=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var B=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:B.item.x,y:B.item.y,type:B.type}},linkControlPoints:function(B){svgedit.path.setLinkControlPoints(B)}, F=0;F<I;++F){var g=w.getItem(F),o=g.pathSegType;if(o!=1){var v=[];$.each(["",1,2],function(D,H){var J=g["x"+H],X=g["y"+H];if(J!==undefined&&X!==undefined){J=M(J,X,E);v.splice(v.length,0,J.x,J.y)}});svgedit.path.replacePathSeg(o,F,v,B)}}h(B,E)},zoomChange:function(){Da=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var B=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:B.item.x,y:B.item.y,type:B.type}},linkControlPoints:function(B){svgedit.path.setLinkControlPoints(B)},
clonePathNode:function(){svgedit.path.path.storeD();for(var B=svgedit.path.path.selected_pts,w=B.length,E=[];w--;){var I=B[w];svgedit.path.path.addSeg(I);E.push(I+w);E.push(I+w+1)}svgedit.path.path.init().addPtsToSelection(E);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var B=svgedit.path.path.selected_pts;if(B.length===1){var w=svgedit.path.path.elem,E=w.pathSegList,I=B[0],F=null,g=null;svgedit.path.path.eachSeg(function(H){if(this.type===2&&H<=I)g=this.item;if(H<= clonePathNode:function(){svgedit.path.path.storeD();for(var B=svgedit.path.path.selected_pts,w=B.length,E=[];w--;){var I=B[w];svgedit.path.path.addSeg(I);E.push(I+w);E.push(I+w+1)}svgedit.path.path.init().addPtsToSelection(E);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var B=svgedit.path.path.selected_pts;if(B.length===1){var w=svgedit.path.path.elem,E=w.pathSegList,I=B[0],F=null,g=null;svgedit.path.path.eachSeg(function(H){if(this.type===2&&H<=I)g=this.item;if(H<=
I)return true;if(this.type===2){F=H;return false}else if(this.type===1)return F=false});if(F==null)F=svgedit.path.path.segs.length-1;if(F!==false){var o=w.createSVGPathSegLinetoAbs(g.x,g.y),v=w.createSVGPathSegClosePath();if(F==svgedit.path.path.segs.length-1){E.appendItem(o);E.appendItem(v)}else{svgedit.path.insertItemBefore(w,v,F);svgedit.path.insertItemBefore(w,o,F)}svgedit.path.path.init().selectPt(F+1)}else if(svgedit.path.path.segs[I].mate){E.removeItem(I);E.removeItem(I);svgedit.path.path.init().selectPt(I- I)return true;if(this.type===2){F=H;return false}else if(this.type===1)return F=false});if(F==null)F=svgedit.path.path.segs.length-1;if(F!==false){var o=w.createSVGPathSegLinetoAbs(g.x,g.y),v=w.createSVGPathSegClosePath();if(F==svgedit.path.path.segs.length-1){E.appendItem(o);E.appendItem(v)}else{svgedit.path.insertItemBefore(w,v,F);svgedit.path.insertItemBefore(w,o,F)}svgedit.path.path.init().selectPt(F+1)}else if(svgedit.path.path.segs[I].mate){E.removeItem(I);E.removeItem(I);svgedit.path.path.init().selectPt(I-
@ -297,10 +297,10 @@ var E=function(){var I=svgedit.path.path.elem.pathSegList,F=I.numberOfItems,g=fu
1){Ja.toSelectMode(svgedit.path.path.elem);c.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){B=$(svgedit.path.path.elem);B.attr("d",B.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(B){var w=B.points,E=w.numberOfItems;if(E>=4){var I=w.getItem(0),F=null;B=[];B.push(["M",I.x,",",I.y," C"].join(""));for(var g=1;g<=E-4;g+=3){var o=w.getItem(g),v=w.getItem(g+1),D=w.getItem(g+2);if(F)if((I=svgedit.path.smoothControlPoints(F, 1){Ja.toSelectMode(svgedit.path.path.elem);c.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){B=$(svgedit.path.path.elem);B.attr("d",B.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(B){var w=B.points,E=w.numberOfItems;if(E>=4){var I=w.getItem(0),F=null;B=[];B.push(["M",I.x,",",I.y," C"].join(""));for(var g=1;g<=E-4;g+=3){var o=w.getItem(g),v=w.getItem(g+1),D=w.getItem(g+2);if(F)if((I=svgedit.path.smoothControlPoints(F,
o,I))&&I.length==2){o=B[B.length-1].split(",");o[2]=I[0].x;o[3]=I[0].y;B[B.length-1]=o.join(",");o=I[1]}B.push([o.x,o.y,v.x,v.y,D.x,D.y].join(","));I=D;F=v}for(B.push("L");g<E;++g){v=w.getItem(g);B.push([v.x,v.y].join(","))}B=B.join(" ");B=P({element:"path",curStyles:true,attr:{id:ba(),d:B,fill:"none"}})}return B},setSegType:function(B){svgedit.path.path.setSegType(B)},moveNode:function(B,w){var E=svgedit.path.path.selected_pts;if(E.length){svgedit.path.path.storeD();E=svgedit.path.path.segs[E[0]]; o,I))&&I.length==2){o=B[B.length-1].split(",");o[2]=I[0].x;o[3]=I[0].y;B[B.length-1]=o.join(",");o=I[1]}B.push([o.x,o.y,v.x,v.y,D.x,D.y].join(","));I=D;F=v}for(B.push("L");g<E;++g){v=w.getItem(g);B.push([v.x,v.y].join(","))}B=B.join(" ");B=P({element:"path",curStyles:true,attr:{id:ba(),d:B,fill:"none"}})}return B},setSegType:function(B){svgedit.path.path.setSegType(B)},moveNode:function(B,w){var E=svgedit.path.path.selected_pts;if(E.length){svgedit.path.path.storeD();E=svgedit.path.path.segs[E[0]];
var I={x:0,y:0};I[B]=w-E.item[B];E.move(I.x,I.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(B){for(var w=B.pathSegList,E=w.numberOfItems,I,F=0;F<E;++F){var g=w.getItem(F);if(g.pathSegType===2)I=g;if(g.pathSegType===1){g=w.getItem(F-1);if(g.x!=I.x||g.y!=I.y){w=B.createSVGPathSegLinetoAbs(I.x,I.y);svgedit.path.insertItemBefore(B,w,F);Ja.fixEnd(B);break}}}svgedit.browser.isWebkit()&&B.setAttribute("d",Ja.convertPath(B))},convertPath:function(B,w){for(var E=B.pathSegList,I=E.numberOfItems, var I={x:0,y:0};I[B]=w-E.item[B];E.move(I.x,I.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(B){for(var w=B.pathSegList,E=w.numberOfItems,I,F=0;F<E;++F){var g=w.getItem(F);if(g.pathSegType===2)I=g;if(g.pathSegType===1){g=w.getItem(F-1);if(g.x!=I.x||g.y!=I.y){w=B.createSVGPathSegLinetoAbs(I.x,I.y);svgedit.path.insertItemBefore(B,w,F);Ja.fixEnd(B);break}}}svgedit.browser.isWebkit()&&B.setAttribute("d",Ja.convertPath(B))},convertPath:function(B,w){for(var E=B.pathSegList,I=E.numberOfItems,
F=0,g=0,o="",v=null,D=0;D<I;++D){var H=E.getItem(D),J=H.x||0,X=H.y||0,ca=H.x1||0,S=H.y1||0,W=H.x2||0,Z=H.y2||0,qa=H.pathSegType,ta=Oa[qa]["to"+(w?"Lower":"Upper")+"Case"](),ga=function(Ta,Ha,sa){Ha=Ha?" "+Ha.join(" "):"";sa=sa?" "+svgedit.units.shortFloat(sa):"";$.each(Ta,function(Ma,va){Ta[Ma]=svgedit.units.shortFloat(va)});o+=ta+Ta.join(" ")+Ha+sa};switch(qa){case 1:o+="z";break;case 12:J-=F;case 13:if(w){F+=J;ta="l"}else{J+=F;F=J;ta="L"}ga([[J,g]]);break;case 14:X-=g;case 15:if(w){g+=X;ta="l"}else{X+= F=0,g=0,o="",v=null,D=0;D<I;++D){var H=E.getItem(D),J=H.x||0,X=H.y||0,da=H.x1||0,S=H.y1||0,V=H.x2||0,Z=H.y2||0,pa=H.pathSegType,ta=Oa[pa]["to"+(w?"Lower":"Upper")+"Case"](),ga=function(Ta,Ha,sa){Ha=Ha?" "+Ha.join(" "):"";sa=sa?" "+svgedit.units.shortFloat(sa):"";$.each(Ta,function(Ma,va){Ta[Ma]=svgedit.units.shortFloat(va)});o+=ta+Ta.join(" ")+Ha+sa};switch(pa){case 1:o+="z";break;case 12:J-=F;case 13:if(w){F+=J;ta="l"}else{J+=F;F=J;ta="L"}ga([[J,g]]);break;case 14:X-=g;case 15:if(w){g+=X;ta="l"}else{X+=
g;g=X;ta="L"}ga([[F,X]]);break;case 2:case 4:case 18:J-=F;X-=g;case 5:case 3:if(v&&E.getItem(D-1).pathSegType===1&&!w){F=v[0];g=v[1]}case 19:if(w){F+=J;g+=X}else{J+=F;X+=g;F=J;g=X}if(qa===3)v=[F,g];ga([[J,X]]);break;case 6:J-=F;ca-=F;W-=F;X-=g;S-=g;Z-=g;case 7:if(w){F+=J;g+=X}else{J+=F;ca+=F;W+=F;X+=g;S+=g;Z+=g;F=J;g=X}ga([[ca,S],[W,Z],[J,X]]);break;case 8:J-=F;ca-=F;X-=g;S-=g;case 9:if(w){F+=J;g+=X}else{J+=F;ca+=F;X+=g;S+=g;F=J;g=X}ga([[ca,S],[J,X]]);break;case 10:J-=F;X-=g;case 11:if(w){F+=J;g+= g;g=X;ta="L"}ga([[F,X]]);break;case 2:case 4:case 18:J-=F;X-=g;case 5:case 3:if(v&&E.getItem(D-1).pathSegType===1&&!w){F=v[0];g=v[1]}case 19:if(w){F+=J;g+=X}else{J+=F;X+=g;F=J;g=X}if(pa===3)v=[F,g];ga([[J,X]]);break;case 6:J-=F;da-=F;V-=F;X-=g;S-=g;Z-=g;case 7:if(w){F+=J;g+=X}else{J+=F;da+=F;V+=F;X+=g;S+=g;Z+=g;F=J;g=X}ga([[da,S],[V,Z],[J,X]]);break;case 8:J-=F;da-=F;X-=g;S-=g;case 9:if(w){F+=J;g+=X}else{J+=F;da+=F;X+=g;S+=g;F=J;g=X}ga([[da,S],[J,X]]);break;case 10:J-=F;X-=g;case 11:if(w){F+=J;g+=
X}else{J+=F;X+=g;F=J;g=X}ga([[H.r1,H.r2]],[H.angle,H.largeArcFlag?1:0,H.sweepFlag?1:0],[J,X]);break;case 16:J-=F;W-=F;X-=g;Z-=g;case 17:if(w){F+=J;g+=X}else{J+=F;W+=F;X+=g;Z+=g;F=J;g=X}ga([[W,Z],[J,X]])}}return o}}}(),Nb=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(b,"defs");if(!e||!e.length)return 0;for(var k=[],m=0,A=["fill","stroke","filter","marker-start","marker-mid","marker-end"],z=A.length,G=l.getElementsByTagNameNS(b,"*"),B=G.length,w=0;w<B;w++){for(var E=G[w],I=0;I< X}else{J+=F;X+=g;F=J;g=X}ga([[H.r1,H.r2]],[H.angle,H.largeArcFlag?1:0,H.sweepFlag?1:0],[J,X]);break;case 16:J-=F;V-=F;X-=g;Z-=g;case 17:if(w){F+=J;g+=X}else{J+=F;V+=F;X+=g;Z+=g;F=J;g=X}ga([[V,Z],[J,X]])}}return o}}}(),Nb=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(b,"defs");if(!e||!e.length)return 0;for(var k=[],m=0,A=["fill","stroke","filter","marker-start","marker-mid","marker-end"],z=A.length,G=l.getElementsByTagNameNS(b,"*"),B=G.length,w=0;w<B;w++){for(var E=G[w],I=0;I<
z;I++){var F=ia(E.getAttribute(A[I]));F&&k.push(F.substr(1))}(E=da(E))&&E.indexOf("#")===0&&k.push(E.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(w=e.length;w--;){A=e[w];z=A.id;if(k.indexOf(z)<0){ub[z]=A;A.parentNode.removeChild(A);m++}}return m};this.svgCanvasToString=function(){for(;Nb()>0;);Ja.clear(true);$.each(l.childNodes,function(m,A){m&&A.nodeType===8&&A.data.indexOf("Created with")>=0&&l.insertBefore(A,l.firstChild)});if(L){Hb(); z;I++){var F=ia(E.getAttribute(A[I]));F&&k.push(F.substr(1))}(E=ea(E))&&E.indexOf("#")===0&&k.push(E.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(w=e.length;w--;){A=e[w];z=A.id;if(k.indexOf(z)<0){ub[z]=A;A.parentNode.removeChild(A);m++}}return m};this.svgCanvasToString=function(){for(;Nb()>0;);Ja.clear(true);$.each(l.childNodes,function(m,A){m&&A.nodeType===8&&A.data.indexOf("Created with")>=0&&l.insertBefore(A,l.firstChild)});if(L){Hb();
vb([L])}var e=[];$(l).find("g:data(gsvg)").each(function(){for(var m=this.attributes,A=m.length,z=0;z<A;z++)if(m[z].nodeName=="id"||m[z].nodeName=="style")A--;if(A<=0){m=this.firstChild;e.push(m);$(this).replaceWith(m)}});var k=this.svgToString(l,0);e.length&&$(e).each(function(){zb(this)});return k};this.svgToString=function(e,k){var m=[],A=svgedit.utilities.toXml,z=n.baseUnit,G=RegExp("^-?[\\d\\.]+"+z+"$");if(e){ma(e);var B=e.attributes,w,E,I=e.childNodes;for(E=0;E<k;E++)m.push(" ");m.push("<"); vb([L])}var e=[];$(l).find("g:data(gsvg)").each(function(){for(var m=this.attributes,A=m.length,z=0;z<A;z++)if(m[z].nodeName=="id"||m[z].nodeName=="style")A--;if(A<=0){m=this.firstChild;e.push(m);$(this).replaceWith(m)}});var k=this.svgToString(l,0);e.length&&$(e).each(function(){zb(this)});return k};this.svgToString=function(e,k){var m=[],A=svgedit.utilities.toXml,z=n.baseUnit,G=RegExp("^-?[\\d\\.]+"+z+"$");if(e){ma(e);var B=e.attributes,w,E,I=e.childNodes;for(E=0;E<k;E++)m.push(" ");m.push("<");
m.push(e.nodeName);if(e.id==="svgcontent"){E=Ab();if(z!=="px"){E.w=svgedit.units.convertUnit(E.w,z)+z;E.h=svgedit.units.convertUnit(E.h,z)+z}m.push(' width="'+E.w+'" height="'+E.h+'" xmlns="'+b+'"');var F={};$(e).find("*").andSelf().each(function(){$.each(this.attributes,function(D,H){var J=H.namespaceURI;if(J&&!F[J]&&Ba[J]!=="xmlns"&&Ba[J]!=="xml"){F[J]=true;m.push(" xmlns:"+Ba[J]+'="'+J+'"')}})});E=B.length;for(z=["width","height","xmlns","x","y","viewBox","id","overflow"];E--;){w=B.item(E);var g= m.push(e.nodeName);if(e.id==="svgcontent"){E=Ab();if(z!=="px"){E.w=svgedit.units.convertUnit(E.w,z)+z;E.h=svgedit.units.convertUnit(E.h,z)+z}m.push(' width="'+E.w+'" height="'+E.h+'" xmlns="'+b+'"');var F={};$(e).find("*").andSelf().each(function(){$.each(this.attributes,function(D,H){var J=H.namespaceURI;if(J&&!F[J]&&Ba[J]!=="xmlns"&&Ba[J]!=="xml"){F[J]=true;m.push(" xmlns:"+Ba[J]+'="'+J+'"')}})});E=B.length;for(z=["width","height","xmlns","x","y","viewBox","id","overflow"];E--;){w=B.item(E);var g=
A(w.nodeValue);if(w.nodeName.indexOf("xmlns:")!==0)if(g!=""&&z.indexOf(w.localName)==-1)if(!w.namespaceURI||Ba[w.namespaceURI]){m.push(" ");m.push(w.nodeName);m.push('="');m.push(g);m.push('"')}}}else{if(e.nodeName==="defs"&&!e.firstChild)return;var o=["-moz-math-font-style","_moz-math-font-style"];for(E=B.length-1;E>=0;E--){w=B.item(E);g=A(w.nodeValue);if(!(o.indexOf(w.localName)>=0))if(g!="")if(g.indexOf("pointer-events")!==0)if(!(w.localName==="class"&&g.indexOf("se_")===0)){m.push(" ");if(w.localName=== A(w.nodeValue);if(w.nodeName.indexOf("xmlns:")!==0)if(g!=""&&z.indexOf(w.localName)==-1)if(!w.namespaceURI||Ba[w.namespaceURI]){m.push(" ");m.push(w.nodeName);m.push('="');m.push(g);m.push('"')}}}else{if(e.nodeName==="defs"&&!e.firstChild)return;var o=["-moz-math-font-style","_moz-math-font-style"];for(E=B.length-1;E>=0;E--){w=B.item(E);g=A(w.nodeValue);if(!(o.indexOf(w.localName)>=0))if(g!="")if(g.indexOf("pointer-events")!==0)if(!(w.localName==="class"&&g.indexOf("se_")===0)){m.push(" ");if(w.localName===
@ -309,13 +309,13 @@ k));break;case 3:z=z.nodeValue.replace(/^\s+|\s+$/g,"");if(z!=""){B=true;m.push(
m.width=this.width;m.height=this.height;m.getContext("2d").drawImage(this,0,0);try{var A=";svgedit_url="+encodeURIComponent(e);A=m.toDataURL().replace(";base64",A+";base64");Wa[e]=A}catch(z){Wa[e]=false}Ca=e;k&&k(Wa[e])}).attr("src",e)};this.setGoodImage=function(e){Ca=e};this.open=function(){};this.save=function(e){Pa();e&&$.extend(db,e);db.apply=true;e=this.svgCanvasToString();N("saved",e)};this.rasterExport=function(){Pa();var e=[],k={feGaussianBlur:nb.exportNoBlur,foreignObject:nb.exportNoforeignObject, m.width=this.width;m.height=this.height;m.getContext("2d").drawImage(this,0,0);try{var A=";svgedit_url="+encodeURIComponent(e);A=m.toDataURL().replace(";base64",A+";base64");Wa[e]=A}catch(z){Wa[e]=false}Ca=e;k&&k(Wa[e])}).attr("src",e)};this.setGoodImage=function(e){Ca=e};this.open=function(){};this.save=function(e){Pa();e&&$.extend(db,e);db.apply=true;e=this.svgCanvasToString();N("saved",e)};this.rasterExport=function(){Pa();var e=[],k={feGaussianBlur:nb.exportNoBlur,foreignObject:nb.exportNoforeignObject,
"[stroke-dasharray]":nb.exportNoDashArray},m=$(l);if(!("font"in $("<canvas>")[0].getContext("2d")))k.text=nb.exportNoText;$.each(k,function(A,z){m.find(A).length&&e.push(z)});k=this.svgCanvasToString();N("exported",{svg:k,issues:e})};this.getSvgString=function(){db.apply=false;return this.svgCanvasToString()};this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,C()):svgedit.draw.randomizeIds(true,C())};var Lb=this.uniquifyElems=function(e){var k={}, "[stroke-dasharray]":nb.exportNoDashArray},m=$(l);if(!("font"in $("<canvas>")[0].getContext("2d")))k.text=nb.exportNoText;$.each(k,function(A,z){m.find(A).length&&e.push(z)});k=this.svgCanvasToString();N("exported",{svg:k,issues:e})};this.getSvgString=function(){db.apply=false;return this.svgCanvasToString()};this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,C()):svgedit.draw.randomizeIds(true,C())};var Lb=this.uniquifyElems=function(e){var k={},
m=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(e,function(w){if(w.nodeType==1){if(w.id){w.id in k||(k[w.id]={elem:null,attrs:[],hrefs:[]});k[w.id].elem=w}$.each(Ya,function(I,F){var g=w.getAttributeNode(F);if(g){var o=svgedit.utilities.getUrlFromAttr(g.value);if(o=o?o.substr(1):null){o in k||(k[o]={elem:null,attrs:[],hrefs:[]});k[o].attrs.push(g)}}});var E=svgedit.utilities.getHref(w);if(E&&m.indexOf(w.nodeName)>=0)if(E=E.substr(1)){E in m=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(e,function(w){if(w.nodeType==1){if(w.id){w.id in k||(k[w.id]={elem:null,attrs:[],hrefs:[]});k[w.id].elem=w}$.each(Ya,function(I,F){var g=w.getAttributeNode(F);if(g){var o=svgedit.utilities.getUrlFromAttr(g.value);if(o=o?o.substr(1):null){o in k||(k[o]={elem:null,attrs:[],hrefs:[]});k[o].attrs.push(g)}}});var E=svgedit.utilities.getHref(w);if(E&&m.indexOf(w.nodeName)>=0)if(E=E.substr(1)){E in
k||(k[E]={elem:null,attrs:[],hrefs:[]});k[E].hrefs.push(w)}}});for(var A in k)if(A){var z=k[A].elem;if(z){e=ka();z.id=e;z=k[A].attrs;for(var G=z.length;G--;){var B=z[G];B.ownerElement.setAttribute(B.name,"url(#"+e+")")}z=k[A].hrefs;for(G=z.length;G--;)svgedit.utilities.setHref(z[G],"#"+e)}}},Jb=this.setUseData=function(e){var k=$(e);if(e.tagName!=="use")k=k.find("use");k.each(function(){var m=da(this).substr(1);if(m=pa(m)){$(this).data("ref",m);if(m.tagName=="symbol"||m.tagName=="svg")$(this).data("symbol", k||(k[E]={elem:null,attrs:[],hrefs:[]});k[E].hrefs.push(w)}}});for(var A in k)if(A){var z=k[A].elem;if(z){e=ka();z.id=e;z=k[A].attrs;for(var G=z.length;G--;){var B=z[G];B.ownerElement.setAttribute(B.name,"url(#"+e+")")}z=k[A].hrefs;for(G=z.length;G--;)svgedit.utilities.setHref(z[G],"#"+e)}}},Jb=this.setUseData=function(e){var k=$(e);if(e.tagName!=="use")k=k.find("use");k.each(function(){var m=ea(this).substr(1);if(m=oa(m)){$(this).data("ref",m);if(m.tagName=="symbol"||m.tagName=="svg")$(this).data("symbol",
m).data("ref",m)}})},Bb=this.convertGradients=function(e){var k=$(e).find("linearGradient, radialGradient");if(!k.length&&svgedit.browser.isWebkit())k=$(e).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});k.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var m=$(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(m.length)if(m=svgedit.utilities.getBBox(m[0]))if(this.tagName==="linearGradient"){var A=$(this).attr(["x1","y1","x2","y2"]), m).data("ref",m)}})},Bb=this.convertGradients=function(e){var k=$(e).find("linearGradient, radialGradient");if(!k.length&&svgedit.browser.isWebkit())k=$(e).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});k.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var m=$(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(m.length)if(m=svgedit.utilities.getBBox(m[0]))if(this.tagName==="linearGradient"){var A=$(this).attr(["x1","y1","x2","y2"]),
z=this.gradientTransform.baseVal;if(z&&z.numberOfItems>0){var G=fa(z).matrix;z=M(A.x1,A.y1,G);G=M(A.x2,A.y2,G);A.x1=z.x;A.y1=z.y;A.x2=G.x;A.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(A.x1-m.x)/m.width,y1:(A.y1-m.y)/m.height,x2:(A.x2-m.x)/m.width,y2:(A.y2-m.y)/m.height});this.removeAttribute("gradientUnits")}}})},Ob=this.convertToGroup=function(e){e||(e=K[0]);var k=$(e),m=new Aa,A;if(k.data("gsvg")){m=$(e.firstChild).attr(["x","y"]);$(e.firstChild.firstChild).unwrap();$(e).removeData("gsvg"); z=this.gradientTransform.baseVal;if(z&&z.numberOfItems>0){var G=ha(z).matrix;z=M(A.x1,A.y1,G);G=M(A.x2,A.y2,G);A.x1=z.x;A.y1=z.y;A.x2=G.x;A.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(A.x1-m.x)/m.width,y1:(A.y1-m.y)/m.height,x2:(A.x2-m.x)/m.width,y2:(A.y2-m.y)/m.height});this.removeAttribute("gradientUnits")}}})},Ob=this.convertToGroup=function(e){e||(e=K[0]);var k=$(e),m=new Aa,A;if(k.data("gsvg")){m=$(e.firstChild).attr(["x","y"]);$(e.firstChild.firstChild).unwrap();$(e).removeData("gsvg");
A=T(e);var z=d.createSVGTransform();z.setTranslate(m.x,m.y);A.appendItem(z);Qa(e);N("selected",[e])}else if(k.data("symbol")){e=k.data("symbol");A=k.attr("transform");z=k.attr(["x","y"]);var G=e.getAttribute("viewBox");if(G){G=G.split(" ");z.x-=+G[0];z.y-=+G[1]}A+=" translate("+(z.x||0)+","+(z.y||0)+")";z=k.prev();m.addSubCommand(new Ka(k[0],k[0].nextSibling,k[0].parentNode));k.remove();G=$(l).find("use:data(symbol)").length;k=f.createElementNS(b,"g");for(var B=e.childNodes,w=0;w<B.length;w++)k.appendChild(B[w].cloneNode(true)); A=T(e);var z=d.createSVGTransform();z.setTranslate(m.x,m.y);A.appendItem(z);Qa(e);N("selected",[e])}else if(k.data("symbol")){e=k.data("symbol");A=k.attr("transform");z=k.attr(["x","y"]);var G=e.getAttribute("viewBox");if(G){G=G.split(" ");z.x-=+G[0];z.y-=+G[1]}A+=" translate("+(z.x||0)+","+(z.y||0)+")";z=k.prev();m.addSubCommand(new Ka(k[0],k[0].nextSibling,k[0].parentNode));k.remove();G=$(l).find("use:data(symbol)").length;k=f.createElementNS(b,"g");for(var B=e.childNodes,w=0;w<B.length;w++)k.appendChild(B[w].cloneNode(true));
if(svgedit.browser.isGecko()){B=$(kb()).children("linearGradient,radialGradient,pattern").clone();$(k).append(B)}A&&k.setAttribute("transform",A);A=e.parentNode;Lb(k);svgedit.browser.isGecko()&&$(kb()).append($(k).find("linearGradient,radialGradient,pattern"));k.id=ka();z.after(k);if(A){if(!G){z=e.nextSibling;A.removeChild(e);m.addSubCommand(new Ka(e,z,A))}m.addSubCommand(new za(k))}Jb(k);svgedit.browser.isGecko()?Bb(kb()):Bb(k);svgedit.utilities.walkTreePost(k,function(E){try{Qa(E)}catch(I){console.log(I)}}); if(svgedit.browser.isGecko()){B=$(kb()).children("linearGradient,radialGradient,pattern").clone();$(k).append(B)}A&&k.setAttribute("transform",A);A=e.parentNode;Lb(k);svgedit.browser.isGecko()&&$(kb()).append($(k).find("linearGradient,radialGradient,pattern"));k.id=ka();z.after(k);if(A){if(!G){z=e.nextSibling;A.removeChild(e);m.addSubCommand(new Ka(e,z,A))}m.addSubCommand(new za(k))}Jb(k);svgedit.browser.isGecko()?Bb(kb()):Bb(k);svgedit.utilities.walkTreePost(k,function(E){try{Qa(E)}catch(I){console.log(I)}});
$(k).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});vb([k]);(e=Kb(k,true))&&m.addSubCommand(e);ya(m)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e){try{var k=svgedit.utilities.text2xml(e);this.prepareSvg(k);var m=new Aa("Change Source"),A=l.nextSibling,z=d.removeChild(l);m.addSubCommand(new Ka(z,A,d));l=f.adoptNode?f.adoptNode(k.documentElement):f.importNode(k.documentElement, $(k).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});vb([k]);(e=Kb(k,true))&&m.addSubCommand(e);ya(m)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e){try{var k=svgedit.utilities.text2xml(e);this.prepareSvg(k);var m=new Aa("Change Source"),A=l.nextSibling,z=d.removeChild(l);m.addSubCommand(new Ka(z,A,d));l=f.adoptNode?f.adoptNode(k.documentElement):f.importNode(k.documentElement,
true);d.appendChild(l);var G=$(l);c.current_drawing_=new svgedit.draw.Drawing(l,s);var B=C().getNonce();B?N("setnonce",B):N("unsetnonce");G.find("image").each(function(){var v=this;Gb(v);var D=da(this);if(D.indexOf("data:")===0){var H=D.match(/svgedit_url=(.*?);/);if(H){var J=decodeURIComponent(H[1]);$(new Image).load(function(){v.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",J)}).attr("src",J)}}c.embedImage(D)});G.find("svg").each(function(){if(!$(this).closest("defs").length){Lb(this); true);d.appendChild(l);var G=$(l);c.current_drawing_=new svgedit.draw.Drawing(l,s);var B=C().getNonce();B?N("setnonce",B):N("unsetnonce");G.find("image").each(function(){var v=this;Gb(v);var D=ea(this);if(D.indexOf("data:")===0){var H=D.match(/svgedit_url=(.*?);/);if(H){var J=decodeURIComponent(H[1]);$(new Image).load(function(){v.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",J)}).attr("src",J)}}c.embedImage(D)});G.find("svg").each(function(){if(!$(this).closest("defs").length){Lb(this);
var v=this.parentNode;if(v.childNodes.length===1&&v.nodeName==="g"){$(v).data("gsvg",this);v.id=v.id||ka()}else zb(this)}});svgedit.browser.isGecko()&&G.find("linearGradient, radialGradient, pattern").appendTo(kb());Jb(G);Bb(G[0]);svgedit.utilities.walkTreePost(l,function(v){try{Qa(v)}catch(D){console.log(D)}});var w={id:"svgcontent",overflow:n.show_outside_canvas?"visible":"hidden"},E=false;if(G.attr("viewBox")){var I=G.attr("viewBox").split(" ");w.width=I[2];w.height=I[3]}else $.each(["width","height"], var v=this.parentNode;if(v.childNodes.length===1&&v.nodeName==="g"){$(v).data("gsvg",this);v.id=v.id||ka()}else zb(this)}});svgedit.browser.isGecko()&&G.find("linearGradient, radialGradient, pattern").appendTo(kb());Jb(G);Bb(G[0]);svgedit.utilities.walkTreePost(l,function(v){try{Qa(v)}catch(D){console.log(D)}});var w={id:"svgcontent",overflow:n.show_outside_canvas?"visible":"hidden"},E=false;if(G.attr("viewBox")){var I=G.attr("viewBox").split(" ");w.width=I[2];w.height=I[3]}else $.each(["width","height"],
function(v,D){var H=G.attr(D);H||(H="100%");if((H+"").substr(-1)==="%")E=true;else w[D]=ra(D,H)});Db();G.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});if(E){var F=getStrokedBBox();w.width=F.width+F.x;w.height=F.height+F.y}if(w.width<=0)w.width=100;if(w.height<=0)w.height=100;G.attr(w);this.contentW=w.width;this.contentH=w.height;m.addSubCommand(new za(l));var g=G.attr(["width","height"]);m.addSubCommand(new Na(d, function(v,D){var H=G.attr(D);H||(H="100%");if((H+"").substr(-1)==="%")E=true;else w[D]=ra(D,H)});Db();G.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});if(E){var F=getStrokedBBox();w.width=F.width+F.x;w.height=F.height+F.y}if(w.width<=0)w.width=100;if(w.height<=0)w.height=100;G.attr(w);this.contentW=w.width;this.contentH=w.height;m.addSubCommand(new za(l));var g=G.attr(["width","height"]);m.addSubCommand(new Na(d,
g));p=1;svgedit.transformlist.resetListMap();Pa();svgedit.path.clearData();d.appendChild(Ga.selectorParentGroup);ya(m);N("changed",[l])}catch(o){console.log(o);return false}return true};this.importSvgString=function(e){try{var k=svgedit.utilities.encode64(e.length+e).substr(0,32),m=false;if(rb[k])if($(rb[k].symbol).parents("#svgroot").length)m=true;var A=new Aa("Import SVG");if(m)var z=rb[k].symbol,G=rb[k].xform;else{var B=svgedit.utilities.text2xml(e);this.prepareSvg(B);var w;w=f.adoptNode?f.adoptNode(B.documentElement): g));p=1;svgedit.transformlist.resetListMap();Pa();svgedit.path.clearData();d.appendChild(Ga.selectorParentGroup);ya(m);N("changed",[l])}catch(o){console.log(o);return false}return true};this.importSvgString=function(e){try{var k=svgedit.utilities.encode64(e.length+e).substr(0,32),m=false;if(rb[k])if($(rb[k].symbol).parents("#svgroot").length)m=true;var A=new Aa("Import SVG");if(m)var z=rb[k].symbol,G=rb[k].xform;else{var B=svgedit.utilities.text2xml(e);this.prepareSvg(B);var w;w=f.adoptNode?f.adoptNode(B.documentElement):
@ -327,7 +327,7 @@ m)break;var G=k.getLayerName(z);k.all_layers[z][0]=svgedit.utilities.toXml(e);va
if(m==k.getNumLayers())return false;if(m!=e){var A=null,z=k.current_layer.nextSibling;if(e>m){if(e<k.getNumLayers()-1)A=k.all_layers[e+1][1]}else A=k.all_layers[e][1];l.insertBefore(k.current_layer,A);ya(new Ia(k.current_layer,z,l));Db();c.setCurrentLayer(k.getLayerName(e));return true}}return false};this.setLayerVisibility=function(e,k){var m=C(),A=m.getLayerVisibility(e),z=m.setLayerVisibility(e,k);if(z)ya(new Na(z,{display:A?"inline":"none"},"Layer Visibility"));else return false;if(z==m.getCurrentLayer()){Pa(); if(m==k.getNumLayers())return false;if(m!=e){var A=null,z=k.current_layer.nextSibling;if(e>m){if(e<k.getNumLayers()-1)A=k.all_layers[e+1][1]}else A=k.all_layers[e][1];l.insertBefore(k.current_layer,A);ya(new Ia(k.current_layer,z,l));Db();c.setCurrentLayer(k.getLayerName(e));return true}}return false};this.setLayerVisibility=function(e,k){var m=C(),A=m.getLayerVisibility(e),z=m.setLayerVisibility(e,k);if(z)ya(new Na(z,{display:A?"inline":"none"},"Layer Visibility"));else return false;if(z==m.getCurrentLayer()){Pa();
Ja.clear()}return true};this.moveSelectedToLayer=function(e){for(var k=null,m=C(),A=0;A<m.getNumLayers();++A)if(m.getLayerName(A)==e){k=m.all_layers[A][1];break}if(!k)return false;e=new Aa("Move Elements to Layer");m=K;for(A=m.length;A--;){var z=m[A];if(z){var G=z.nextSibling,B=z.parentNode;k.appendChild(z);e.addSubCommand(new Ia(z,G,B))}}ya(e);return true};this.mergeLayer=function(e){var k=new Aa("Merge Layer"),m=C(),A=$(m.current_layer).prev()[0];if(A){for(k.addSubCommand(new Ka(m.current_layer, Ja.clear()}return true};this.moveSelectedToLayer=function(e){for(var k=null,m=C(),A=0;A<m.getNumLayers();++A)if(m.getLayerName(A)==e){k=m.all_layers[A][1];break}if(!k)return false;e=new Aa("Move Elements to Layer");m=K;for(A=m.length;A--;){var z=m[A];if(z){var G=z.nextSibling,B=z.parentNode;k.appendChild(z);e.addSubCommand(new Ia(z,G,B))}}ya(e);return true};this.mergeLayer=function(e){var k=new Aa("Merge Layer"),m=C(),A=$(m.current_layer).prev()[0];if(A){for(k.addSubCommand(new Ka(m.current_layer,
m.current_layer.nextSibling,l));m.current_layer.firstChild;){var z=m.current_layer.firstChild;if(z.localName=="title"){k.addSubCommand(new Ka(z,z.nextSibling,m.current_layer));m.current_layer.removeChild(z)}else{var G=z.nextSibling;A.appendChild(z);k.addSubCommand(new Ia(z,G,m.current_layer))}}l.removeChild(m.current_layer);if(!e){Pa();Db();N("changed",[l]);ya(k)}m.current_layer=A;return k}};this.mergeAllLayers=function(){var e=new Aa("Merge all Layers"),k=C();for(k.current_layer=k.all_layers[k.getNumLayers()- m.current_layer.nextSibling,l));m.current_layer.firstChild;){var z=m.current_layer.firstChild;if(z.localName=="title"){k.addSubCommand(new Ka(z,z.nextSibling,m.current_layer));m.current_layer.removeChild(z)}else{var G=z.nextSibling;A.appendChild(z);k.addSubCommand(new Ia(z,G,m.current_layer))}}l.removeChild(m.current_layer);if(!e){Pa();Db();N("changed",[l]);ya(k)}m.current_layer=A;return k}};this.mergeAllLayers=function(){var e=new Aa("Merge all Layers"),k=C();for(k.current_layer=k.all_layers[k.getNumLayers()-
1][1];$(l).children("g").length>1;)e.addSubCommand(c.mergeLayer(true));Pa();Db();N("changed",[l]);ya(e)};var Hb=this.leaveContext=function(){var e=wa.length;if(e){for(var k=0;k<e;k++){var m=wa[k],A=fb(m,"orig_opac");A!==1?m.setAttribute("opacity",A):m.removeAttribute("opacity");m.setAttribute("style","pointer-events: inherit")}wa=[];Pa(true);N("contextset",null)}L=null},Pb=this.setContext=function(e){Hb();if(typeof e==="string")e=pa(e);L=e;$(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var k= 1][1];$(l).children("g").length>1;)e.addSubCommand(c.mergeLayer(true));Pa();Db();N("changed",[l]);ya(e)};var Hb=this.leaveContext=function(){var e=wa.length;if(e){for(var k=0;k<e;k++){var m=wa[k],A=fb(m,"orig_opac");A!==1?m.setAttribute("opacity",A):m.removeAttribute("opacity");m.setAttribute("style","pointer-events: inherit")}wa=[];Pa(true);N("contextset",null)}L=null},Pb=this.setContext=function(e){Hb();if(typeof e==="string")e=oa(e);L=e;$(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var k=
this.getAttribute("opacity")||1;fb(this,"orig_opac",k);this.setAttribute("opacity",k*0.33);this.setAttribute("style","pointer-events: none");wa.push(this)});Pa();N("contextset",L)};this.clear=function(){Ja.clear();Pa();c.clearSvgContentElement();c.current_drawing_=new svgedit.draw.Drawing(l);c.createLayer("Layer 1");c.undoMgr.resetUndoStack();Ga.initGroup();ua=Ga.getRubberBandBox();N("cleared")};this.linkControlPoints=Ja.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem= this.getAttribute("opacity")||1;fb(this,"orig_opac",k);this.setAttribute("opacity",k*0.33);this.setAttribute("style","pointer-events: none");wa.push(this)});Pa();N("contextset",L)};this.clear=function(){Ja.clear();Pa();c.clearSvgContentElement();c.current_drawing_=new svgedit.draw.Drawing(l);c.createLayer("Layer 1");c.undoMgr.resetUndoStack();Ga.initGroup();ua=Ga.getRubberBandBox();N("cleared")};this.linkControlPoints=Ja.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem=
function(){return d};this.getSelectedElems=function(){return K};var Ab=this.getResolution=function(){var e=l.getAttribute("width")/p,k=l.getAttribute("height")/p;return{w:e,h:k,zoom:p}};this.getZoom=function(){return p};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};this.setUiStrings=function(e){$.extend(nb,e.notification)};this.setConfig=function(e){$.extend(n,e)};this.getTitle=function(e){if(e=e||K[0]){e=$(e).data("gsvg")||$(e).data("symbol")||e;e=e.childNodes;for(var k=0;k<e.length;k++)if(e[k].nodeName== function(){return d};this.getSelectedElems=function(){return K};var Ab=this.getResolution=function(){var e=l.getAttribute("width")/p,k=l.getAttribute("height")/p;return{w:e,h:k,zoom:p}};this.getZoom=function(){return p};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};this.setUiStrings=function(e){$.extend(nb,e.notification)};this.setConfig=function(e){$.extend(n,e)};this.getTitle=function(e){if(e=e||K[0]){e=$(e).data("gsvg")||$(e).data("symbol")||e;e=e.childNodes;for(var k=0;k<e.length;k++)if(e[k].nodeName==
"title")return e[k].textContent;return""}};this.setGroupTitle=function(e){var k=K[0];k=$(k).data("gsvg")||k;var m=$(k).children("title"),A=new Aa("Set Label");if(e.length)if(m.length){m=m[0];A.addSubCommand(new Na(m,{"#text":m.textContent}));m.textContent=e}else{m=f.createElementNS(b,"title");m.textContent=e;$(k).prepend(m);A.addSubCommand(new za(m))}else{A.addSubCommand(new Ka(m[0],m.nextSibling,k));m.remove()}ya(A)};this.getDocumentTitle=function(){return c.getTitle(l)};this.setDocumentTitle=function(e){for(var k= "title")return e[k].textContent;return""}};this.setGroupTitle=function(e){var k=K[0];k=$(k).data("gsvg")||k;var m=$(k).children("title"),A=new Aa("Set Label");if(e.length)if(m.length){m=m[0];A.addSubCommand(new Na(m,{"#text":m.textContent}));m.textContent=e}else{m=f.createElementNS(b,"title");m.textContent=e;$(k).prepend(m);A.addSubCommand(new za(m))}else{A.addSubCommand(new Ka(m[0],m.nextSibling,k));m.remove()}ya(A)};this.getDocumentTitle=function(){return c.getTitle(l)};this.setDocumentTitle=function(e){for(var k=
@ -342,27 +342,27 @@ z.getAttribute("y1")||e.getAttribute("x2")!=z.getAttribute("x2")||e.getAttribute
o.getAttribute("stop-color"))break}if(F==-1)return z}}return null};this.setPaint=function(e,k){var m=new $.jGraduate.Paint(k);this.setPaintOpacity(e,m.alpha/100,true);ab[e+"_paint"]=m;switch(m.type){case "solidColor":if(m.solidColor!="none"&&m.solidColor!="#none")this.setColor(e,"#"+m.solidColor);else{this.setColor(e,"none");document.querySelector(e=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","none")}break;case "linearGradient":case "radialGradient":c[e+"Grad"]=m[m.type]; o.getAttribute("stop-color"))break}if(F==-1)return z}}return null};this.setPaint=function(e,k){var m=new $.jGraduate.Paint(k);this.setPaintOpacity(e,m.alpha/100,true);ab[e+"_paint"]=m;switch(m.type){case "solidColor":if(m.solidColor!="none"&&m.solidColor!="#none")this.setColor(e,"#"+m.solidColor);else{this.setColor(e,"none");document.querySelector(e=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","none")}break;case "linearGradient":case "radialGradient":c[e+"Grad"]=m[m.type];
Mb(e)}};this.getStrokeWidth=function(){return ab.stroke_width};this.setStrokeWidth=function(e){if(e==0&&["line","path"].indexOf(Da)>=0)c.setStrokeWidth(1);else{ab.stroke_width=e;for(var k=[],m=K.length;m--;){var A=K[m];if(A)A.tagName=="g"?svgedit.utilities.walkTree(A,function(z){z.nodeName!="g"&&k.push(z)}):k.push(A)}if(k.length>0){ib("stroke-width",e,k);N("changed",K)}}};this.setStrokeAttr=function(e,k){O[e.replace("-","_")]=k;for(var m=[],A=K.length;A--;){var z=K[A];if(z)z.tagName=="g"?svgedit.utilities.walkTree(z, Mb(e)}};this.getStrokeWidth=function(){return ab.stroke_width};this.setStrokeWidth=function(e){if(e==0&&["line","path"].indexOf(Da)>=0)c.setStrokeWidth(1);else{ab.stroke_width=e;for(var k=[],m=K.length;m--;){var A=K[m];if(A)A.tagName=="g"?svgedit.utilities.walkTree(A,function(z){z.nodeName!="g"&&k.push(z)}):k.push(A)}if(k.length>0){ib("stroke-width",e,k);N("changed",K)}}};this.setStrokeAttr=function(e,k){O[e.replace("-","_")]=k;for(var m=[],A=K.length;A--;){var z=K[A];if(z)z.tagName=="g"?svgedit.utilities.walkTree(z,
function(G){G.nodeName!="g"&&m.push(G)}):m.push(z)}if(m.length>0){ib(e,k,m);N("changed",K)}};this.getStyle=function(){return O};this.getOpacity=function(){return O.opacity};this.setOpacity=function(e){O.opacity=e;ib("opacity",e)};this.getFillOpacity=function(){return O.fill_opacity};this.getStrokeOpacity=function(){return O.stroke_opacity};this.setPaintOpacity=function(e,k,m){O[e+"_opacity"]=k;m?Cb(e+"-opacity",k):ib(e+"-opacity",k)};this.getBlur=function(e){var k=0;if(e)if(e.getAttribute("filter"))if(e= function(G){G.nodeName!="g"&&m.push(G)}):m.push(z)}if(m.length>0){ib(e,k,m);N("changed",K)}};this.getStyle=function(){return O};this.getOpacity=function(){return O.opacity};this.setOpacity=function(e){O.opacity=e;ib("opacity",e)};this.getFillOpacity=function(){return O.fill_opacity};this.getStrokeOpacity=function(){return O.stroke_opacity};this.setPaintOpacity=function(e,k,m){O[e+"_opacity"]=k;m?Cb(e+"-opacity",k):ib(e+"-opacity",k)};this.getBlur=function(e){var k=0;if(e)if(e.getAttribute("filter"))if(e=
pa(e.id+"_blur"))k=e.firstChild.getAttribute("stdDeviation");return k};(function(){function e(){var z=c.undoMgr.finishUndoableChange();k.addSubCommand(z);ya(k);m=k=null}var k=null,m=null,A=false;c.setBlurNoUndo=function(z){if(m)if(z===0){Cb("filter","");A=true}else{var G=K[0];A&&Cb("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter");G.setAttribute("filter","url(#"+G.id+"_blur)")}Cb("stdDeviation",z,[m.firstChild]);c.setBlurOffsets(m,z)}else c.setBlur(z)};c.setBlurOffsets= oa(e.id+"_blur"))k=e.firstChild.getAttribute("stdDeviation");return k};(function(){function e(){var z=c.undoMgr.finishUndoableChange();k.addSubCommand(z);ya(k);m=k=null}var k=null,m=null,A=false;c.setBlurNoUndo=function(z){if(m)if(z===0){Cb("filter","");A=true}else{var G=K[0];A&&Cb("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter");G.setAttribute("filter","url(#"+G.id+"_blur)")}Cb("stdDeviation",z,[m.firstChild]);c.setBlurOffsets(m,z)}else c.setBlur(z)};c.setBlurOffsets=
function(z,G){if(G>3)la(z,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){z.removeAttribute("x");z.removeAttribute("y");z.removeAttribute("width");z.removeAttribute("height")}};c.setBlur=function(z,G){if(k)e();else{var B=K[0],w=B.id;m=pa(w+"_blur");z-=0;var E=new Aa;if(m){if(z===0)m=null}else{var I=P({element:"feGaussianBlur",attr:{"in":"SourceGraphic",stdDeviation:z}});m=P({element:"filter",attr:{id:w+"_blur"}});m.appendChild(I);kb().appendChild(m);E.addSubCommand(new za(m))}I= function(z,G){if(G>3)la(z,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){z.removeAttribute("x");z.removeAttribute("y");z.removeAttribute("width");z.removeAttribute("height")}};c.setBlur=function(z,G){if(k)e();else{var B=K[0],w=B.id;m=oa(w+"_blur");z-=0;var E=new Aa;if(m){if(z===0)m=null}else{var I=P({element:"feGaussianBlur",attr:{"in":"SourceGraphic",stdDeviation:z}});m=P({element:"filter",attr:{id:w+"_blur"}});m.appendChild(I);kb().appendChild(m);E.addSubCommand(new za(m))}I=
{filter:B.getAttribute("filter")};if(z===0){B.removeAttribute("filter");E.addSubCommand(new Na(B,I))}else{ib("filter","url(#"+w+"_blur)");E.addSubCommand(new Na(B,I));c.setBlurOffsets(m,z);k=E;c.undoMgr.beginUndoableChange("stdDeviation",[m?m.firstChild:null]);if(G){c.setBlurNoUndo(z);e()}}}}})();this.getBold=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-weight")=="bold";return false};this.setBold=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&& {filter:B.getAttribute("filter")};if(z===0){B.removeAttribute("filter");E.addSubCommand(new Na(B,I))}else{ib("filter","url(#"+w+"_blur)");E.addSubCommand(new Na(B,I));c.setBlurOffsets(m,z);k=E;c.undoMgr.beginUndoableChange("stdDeviation",[m?m.firstChild:null]);if(G){c.setBlurNoUndo(z);e()}}}}})();this.getBold=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-weight")=="bold";return false};this.setBold=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&&
K[1]==null)ib("font-weight",e?"bold":"normal");K[0].textContent||cb.setCursor()};this.getItalic=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-style")=="italic";return false};this.setItalic=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&&K[1]==null)ib("font-style",e?"italic":"normal");K[0].textContent||cb.setCursor()};this.getFontFamily=function(){return Xa.font_family};this.setFontFamily=function(e){Xa.font_family=e;ib("font-family",e);K[0]&&!K[0].textContent&& K[1]==null)ib("font-weight",e?"bold":"normal");K[0].textContent||cb.setCursor()};this.getItalic=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-style")=="italic";return false};this.setItalic=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&&K[1]==null)ib("font-style",e?"italic":"normal");K[0].textContent||cb.setCursor()};this.getFontFamily=function(){return Xa.font_family};this.setFontFamily=function(e){Xa.font_family=e;ib("font-family",e);K[0]&&!K[0].textContent&&
cb.setCursor()};this.setFontColor=function(e){Xa.fill=e;ib("fill",e)};this.getFontSize=function(){return Xa.fill};this.getFontSize=function(){return Xa.font_size};this.setFontSize=function(e){Xa.font_size=e;ib("font-size",e);K[0].textContent||cb.setCursor()};this.getText=function(){var e=K[0];if(e==null)return"";return e.textContent};this.setTextContent=function(e){ib("#text",e);cb.init(e);cb.setCursor()};this.setImageURL=function(e){var k=K[0];if(k){var m=$(k).attr(["width","height"]);m=!m.width|| cb.setCursor()};this.setFontColor=function(e){Xa.fill=e;ib("fill",e)};this.getFontSize=function(){return Xa.fill};this.getFontSize=function(){return Xa.font_size};this.setFontSize=function(e){Xa.font_size=e;ib("font-size",e);K[0].textContent||cb.setCursor()};this.getText=function(){var e=K[0];if(e==null)return"";return e.textContent};this.setTextContent=function(e){ib("#text",e);cb.init(e);cb.setCursor()};this.setImageURL=function(e){var k=K[0];if(k){var m=$(k).attr(["width","height"]);m=!m.width||
!m.height;var A=da(k);if(A!==e)m=true;else if(!m)return;var z=new Aa("Change Image URL");U(k,e);z.addSubCommand(new Na(k,{"#href":A}));m?$(new Image).load(function(){var G=$(k).attr(["width","height"]);$(k).attr({width:this.width,height:this.height});Ga.requestSelector(k).resize();z.addSubCommand(new Na(k,G));ya(z);N("changed",[k])}).attr("src",e):ya(z)}};this.setLinkURL=function(e){var k=K[0];if(k){if(k.tagName!=="a"){k=$(k).parents("a");if(k.length)k=k[0];else return}var m=da(k);if(m!==e){var A= !m.height;var A=ea(k);if(A!==e)m=true;else if(!m)return;var z=new Aa("Change Image URL");U(k,e);z.addSubCommand(new Na(k,{"#href":A}));m?$(new Image).load(function(){var G=$(k).attr(["width","height"]);$(k).attr({width:this.width,height:this.height});Ga.requestSelector(k).resize();z.addSubCommand(new Na(k,G));ya(z);N("changed",[k])}).attr("src",e):ya(z)}};this.setLinkURL=function(e){var k=K[0];if(k){if(k.tagName!=="a"){k=$(k).parents("a");if(k.length)k=k[0];else return}var m=ea(k);if(m!==e){var A=
new Aa("Change Link URL");U(k,e);A.addSubCommand(new Na(k,{"#href":m}));ya(A)}}};this.elementsAreSame=function(e){return!e.length||e[0]==null?null:K.every(function(k){return k&&K[0]?k.nodeName==K[0].nodeName:null})};this.setRectRadius=function(e){c.elementsAreSame(K)&&K[0].tagName=="rect"&&K.forEach(function(k){var m=k.getAttribute("rx");if(m!=e){k.setAttribute("rx",e);k.setAttribute("ry",e);ya(new Na(k,{rx:m,ry:m},"Radius"));N("changed",[k])}})};this.makeHyperlink=function(e){c.groupSelectedElements("a", new Aa("Change Link URL");U(k,e);A.addSubCommand(new Na(k,{"#href":m}));ya(A)}}};this.elementsAreSame=function(e){return!e.length||e[0]==null?null:K.every(function(k){return k&&K[0]?k.nodeName==K[0].nodeName:null})};this.setRectRadius=function(e){c.elementsAreSame(K)&&K[0].tagName=="rect"&&K.forEach(function(k){var m=k.getAttribute("rx");if(m!=e){k.setAttribute("rx",e);k.setAttribute("ry",e);ya(new Na(k,{rx:m,ry:m},"Radius"));N("changed",[k])}})};this.makeHyperlink=function(e){c.groupSelectedElements("a",
e)};this.removeHyperlink=function(){c.ungroupSelectedElement()};this.setSegType=function(e){Ja.setSegType(e)};this.convertToPath=function(e,k){if(e==null)$.each(K,function(ca,S){S&&c.convertToPath(S)});else{if(!k)var m=new Aa("Convert element to Path");var A=k?{}:{fill:O.fill,"fill-opacity":O.fill_opacity,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,opacity:O.opacity, e)};this.removeHyperlink=function(){c.ungroupSelectedElement()};this.setSegType=function(e){Ja.setSegType(e)};this.convertToPath=function(e,k){if(e==null)$.each(K,function(da,S){S&&c.convertToPath(S)});else{if(!k)var m=new Aa("Convert element to Path");var A=k?{}:{fill:O.fill,"fill-opacity":O.fill_opacity,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,opacity:O.opacity,
visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(e.getAttribute(this))A[this]=e.getAttribute(this)});var z=P({element:"path",attr:A}),G=e.getAttribute("transform");G&&z.setAttribute("transform",G);var B=e.id,w=e.parentNode;e.nextSibling?w.insertBefore(z,e):w.appendChild(z);var E="",I=function(ca){$.each(ca,function(S,W){var Z=W[1];E+=W[0];for(var qa=0;qa<Z.length;qa+=2)E+=Z[qa]+","+Z[qa+1]+" "})},F=1.81;switch(e.tagName){case "ellipse":case "circle":var g= visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(e.getAttribute(this))A[this]=e.getAttribute(this)});var z=P({element:"path",attr:A}),G=e.getAttribute("transform");G&&z.setAttribute("transform",G);var B=e.id,w=e.parentNode;e.nextSibling?w.insertBefore(z,e):w.appendChild(z);var E="",I=function(da){$.each(da,function(S,V){var Z=V[1];E+=V[0];for(var pa=0;pa<Z.length;pa+=2)E+=Z[pa]+","+Z[pa+1]+" "})},F=1.81;switch(e.tagName){case "ellipse":case "circle":var g=
$(e).attr(["rx","ry","cx","cy"]),o=g.cx,v=g.cy,D=g.rx;g=g.ry;if(e.tagName=="circle")D=g=$(e).attr("r");I([["M",[o-D,v]],["C",[o-D,v-g/F,o-D/F,v-g,o,v-g]],["C",[o+D/F,v-g,o+D,v-g/F,o+D,v]],["C",[o+D,v+g/F,o+D/F,v+g,o,v+g]],["C",[o-D/F,v+g,o-D,v+g/F,o-D,v]],["Z",[]]]);break;case "path":E=e.getAttribute("d");break;case "line":g=$(e).attr(["x1","y1","x2","y2"]);E="M"+g.x1+","+g.y1+"L"+g.x2+","+g.y2;break;case "polyline":case "polygon":E="M"+e.getAttribute("points");break;case "rect":g=$(e).attr(["rx", $(e).attr(["rx","ry","cx","cy"]),o=g.cx,v=g.cy,D=g.rx;g=g.ry;if(e.tagName=="circle")D=g=$(e).attr("r");I([["M",[o-D,v]],["C",[o-D,v-g/F,o-D/F,v-g,o,v-g]],["C",[o+D/F,v-g,o+D,v-g/F,o+D,v]],["C",[o+D,v+g/F,o+D/F,v+g,o,v+g]],["C",[o-D/F,v+g,o-D,v+g/F,o-D,v]],["Z",[]]]);break;case "path":E=e.getAttribute("d");break;case "line":g=$(e).attr(["x1","y1","x2","y2"]);E="M"+g.x1+","+g.y1+"L"+g.x2+","+g.y2;break;case "polyline":case "polygon":E="M"+e.getAttribute("points");break;case "rect":g=$(e).attr(["rx",
"ry"]);D=g.rx;g=g.ry;var H=e.getBBox();o=H.x;v=H.y;var J=H.width;H=H.height;F=4-F;if(!D&&!g)I([["M",[o,v]],["L",[o+J,v]],["L",[o+J,v+H]],["L",[o,v+H]],["L",[o,v]],["Z",[]]]);else{g||(g=D);I([["M",[o,v+g]],["C",[o,v+g/F,o+D/F,v,o+D,v]],["L",[o+J-D,v]],["C",[o+J-D/F,v,o+J,v+g/F,o+J,v+g]],["L",[o+J,v+H-g]],["C",[o+J,v+H-g/F,o+J-D/F,v+H,o+J-D,v+H]],["L",[o+D,v+H]],["C",[o+D/F,v+H,o,v+H-g/F,o,v+H-g]],["L",[o,v+g]],["Z",[]]])}break;default:z.parentNode.removeChild(z)}E&&z.setAttribute("d",E);if(k){Ja.resetOrientation(z); "ry"]);D=g.rx;g=g.ry;var H=e.getBBox();o=H.x;v=H.y;var J=H.width;H=H.height;F=4-F;if(!D&&!g)I([["M",[o,v]],["L",[o+J,v]],["L",[o+J,v+H]],["L",[o,v+H]],["L",[o,v]],["Z",[]]]);else{g||(g=D);I([["M",[o,v+g]],["C",[o,v+g/F,o+D/F,v,o+D,v]],["L",[o+J-D,v]],["C",[o+J-D/F,v,o+J,v+g/F,o+J,v+g]],["L",[o+J,v+H-g]],["C",[o+J,v+H-g/F,o+J-D/F,v+H,o+J-D,v+H]],["L",[o+D,v+H]],["C",[o+D/F,v+H,o,v+H-g/F,o,v+H-g]],["L",[o,v+g]],["Z",[]]])}break;default:z.parentNode.removeChild(z)}E&&z.setAttribute("d",E);if(k){Ja.resetOrientation(z);
m=false;try{m=z.getBBox()}catch(X){}z.parentNode.removeChild(z);return m}else{if(G){G=T(z);na(G)&&Ja.resetOrientation(z)}m.addSubCommand(new Ka(e,e.nextSibling,w));m.addSubCommand(new za(z));Pa();e.parentNode.removeChild(e);z.setAttribute("id",B);z.removeAttribute("visibility");tb([z],true);ya(m)}}};var Cb=this.changeSelectedAttributeNoUndo=function(e,k,m){var A=d.suspendRedraw(1E3);Da=="pathedit"&&Ja.moveNode(e,k);m=m||K;for(var z=m.length,G=["g","polyline","path"];z--;){var B=m[z];if(B!=null){Da=== m=false;try{m=z.getBBox()}catch(X){}z.parentNode.removeChild(z);return m}else{if(G){G=T(z);qa(G)&&Ja.resetOrientation(z)}m.addSubCommand(new Ka(e,e.nextSibling,w));m.addSubCommand(new za(z));Pa();e.parentNode.removeChild(e);z.setAttribute("id",B);z.removeAttribute("visibility");tb([z],true);ya(m)}}};var Cb=this.changeSelectedAttributeNoUndo=function(e,k,m){var A=d.suspendRedraw(1E3);Da=="pathedit"&&Ja.moveNode(e,k);m=m||K;for(var z=m.length,G=["g","polyline","path"];z--;){var B=m[z];if(B!=null){Da===
"textedit"&&e!=="#text"&&B.textContent.length&&cb.toSelectMode(B);if((e==="x"||e==="y")&&G.indexOf(B.tagName)>=0){var w=getStrokedBBox([B]);c.moveSelectedElements((e==="x"?k-w.x:0)*p,(e==="y"?k-w.y:0)*p,true)}else{w=e==="#text"?B.textContent:B.getAttribute(e);if(w==null)w="";if(w!==String(k)){if(e=="#text"){svgedit.utilities.getBBox(B);B.textContent=k}else e=="#href"?U(B,k):B.setAttribute(e,k);K.indexOf(B)>=0&&setTimeout(function(){B.parentNode&&Ga.requestSelector(B).resize()},0);w=oa(B);if(w!=0&& "textedit"&&e!=="#text"&&B.textContent.length&&cb.toSelectMode(B);if((e==="x"||e==="y")&&G.indexOf(B.tagName)>=0){var w=getStrokedBBox([B]);c.moveSelectedElements((e==="x"?k-w.x:0)*p,(e==="y"?k-w.y:0)*p,true)}else{w=e==="#text"?B.textContent:B.getAttribute(e);if(w==null)w="";if(w!==String(k)){if(e=="#text"){svgedit.utilities.getBBox(B);B.textContent=k}else e=="#href"?U(B,k):B.setAttribute(e,k);K.indexOf(B)>=0&&setTimeout(function(){B.parentNode&&Ga.requestSelector(B).resize()},0);w=na(B);if(w!=0&&
e!="transform")for(var E=T(B),I=E.numberOfItems;I--;)if(E.getItem(I).type==4){E.removeItem(I);var F=svgedit.utilities.getBBox(B),g=M(F.x+F.width/2,F.y+F.height/2,fa(E).matrix);F=g.x;g=g.y;var o=d.createSVGTransform();o.setRotate(w,F,g);E.insertItemBefore(o,I);break}}}}}d.unsuspendRedraw(A)},ib=this.changeSelectedAttribute=function(e,k,m){m=m||K;c.undoMgr.beginUndoableChange(e,m);Cb(e,k,m);e=c.undoMgr.finishUndoableChange();e.isEmpty()||ya(e)};this.deleteSelectedElements=function(){for(var e=new Aa("Delete Elements"), e!="transform")for(var E=T(B),I=E.numberOfItems;I--;)if(E.getItem(I).type==4){E.removeItem(I);var F=svgedit.utilities.getBBox(B),g=M(F.x+F.width/2,F.y+F.height/2,ha(E).matrix);F=g.x;g=g.y;var o=d.createSVGTransform();o.setRotate(w,F,g);E.insertItemBefore(o,I);break}}}}}d.unsuspendRedraw(A)},ib=this.changeSelectedAttribute=function(e,k,m){m=m||K;c.undoMgr.beginUndoableChange(e,m);Cb(e,k,m);e=c.undoMgr.finishUndoableChange();e.isEmpty()||ya(e)};this.deleteSelectedElements=function(){for(var e=new Aa("Delete Elements"),
k=K.length,m=[],A=0;A<k;++A){var z=K[A];if(z==null)break;var G=z.parentNode,B=z;Ga.releaseSelector(B);svgedit.path.removePath_(B.id);if(G.tagName==="a"&&G.childNodes.length===1){B=G;G=G.parentNode}var w=B.nextSibling;B=G.removeChild(B);m.push(z);K[A]=null;e.addSubCommand(new Ka(B,w,G))}e.isEmpty()||ya(e);N("changed",m);Pa()};this.cutSelectedElements=function(){for(var e=new Aa("Cut Elements"),k=K.length,m=[],A=0;A<k;++A){var z=K[A];if(z==null)break;var G=z.parentNode,B=z;Ga.releaseSelector(B);svgedit.path.removePath_(B.id); k=K.length,m=[],A=0;A<k;++A){var z=K[A];if(z==null)break;var G=z.parentNode,B=z;Ga.releaseSelector(B);svgedit.path.removePath_(B.id);if(G.tagName==="a"&&G.childNodes.length===1){B=G;G=G.parentNode}var w=B.nextSibling;B=G.removeChild(B);m.push(z);K[A]=null;e.addSubCommand(new Ka(B,w,G))}e.isEmpty()||ya(e);N("changed",m);Pa()};this.cutSelectedElements=function(){for(var e=new Aa("Cut Elements"),k=K.length,m=[],A=0;A<k;++A){var z=K[A];if(z==null)break;var G=z.parentNode,B=z;Ga.releaseSelector(B);svgedit.path.removePath_(B.id);
var w=B.nextSibling;B=G.removeChild(B);m.push(z);K[A]=null;e.addSubCommand(new Ka(B,w,G))}e.isEmpty()||ya(e);N("changed",m);Pa();c.clipBoard=m};this.copySelectedElements=function(){c.clipBoard=$.merge([],K)};this.pasteElements=function(){var e=c.clipBoard,k=e.length;if(k){for(var m=[],A=new Aa("Paste elements");k--;){var z=e[k];if(z){var G=ja(z);if(!pa(z.id))G.id=z.id;m.push(G);(L||C().getCurrentLayer()).appendChild(G);A.addSubCommand(new za(G))}}svgCanvas.clearSelection();setTimeout(function(){vb(m)}, var w=B.nextSibling;B=G.removeChild(B);m.push(z);K[A]=null;e.addSubCommand(new Ka(B,w,G))}e.isEmpty()||ya(e);N("changed",m);Pa();c.clipBoard=m};this.copySelectedElements=function(){c.clipBoard=$.merge([],K)};this.pasteElements=function(){var e=c.clipBoard,k=e.length;if(k){for(var m=[],A=new Aa("Paste elements");k--;){var z=e[k];if(z){var G=ja(z);if(!oa(z.id))G.id=z.id;m.push(G);(L||C().getCurrentLayer()).appendChild(G);A.addSubCommand(new za(G))}}svgCanvas.clearSelection();setTimeout(function(){vb(m)},
100);ya(A);N("changed",m)}};this.groupSelectedElements=function(e){e||(e="g");var k="";switch(e){case "a":k="Make hyperlink";var m="";if(arguments.length>1)m=arguments[1];break;default:e="g";k="Group Elements"}k=new Aa(k);var A=P({element:e,attr:{id:ka()}});e==="a"&&U(A,m);k.addSubCommand(new za(A));for(m=K.length;m--;){var z=K[m];if(z!=null){if(z.parentNode.tagName==="a"&&z.parentNode.childNodes.length===1)z=z.parentNode;var G=z.nextSibling,B=z.parentNode;A.appendChild(z);k.addSubCommand(new Ia(z, 100);ya(A);N("changed",m)}};this.groupSelectedElements=function(e){e||(e="g");var k="";switch(e){case "a":k="Make hyperlink";var m="";if(arguments.length>1)m=arguments[1];break;default:e="g";k="Group Elements"}k=new Aa(k);var A=P({element:e,attr:{id:ka()}});e==="a"&&U(A,m);k.addSubCommand(new za(A));for(m=K.length;m--;){var z=K[m];if(z!=null){if(z.parentNode.tagName==="a"&&z.parentNode.childNodes.length===1)z=z.parentNode;var G=z.nextSibling,B=z.parentNode;A.appendChild(z);k.addSubCommand(new Ia(z,
G,B))}}k.isEmpty()||ya(k);vb([A],true)};var Kb=this.pushGroupProperties=function(e,k){var m=e.childNodes,A=m.length,z=e.getAttribute("transform"),G=T(e),B=fa(G).matrix,w=new Aa("Push group properties"),E=0,I=oa(e),F=$(e).attr(["filter","opacity"]),g,o;for(E=0;E<A;E++){var v=m[E];if(v.nodeType===1){if(F.opacity!==null&&F.opacity!==1){v.getAttribute("opacity");var D=Math.round((v.getAttribute("opacity")||1)*F.opacity*100)/100;ib("opacity",D,[v])}if(F.filter){var H=D=this.getBlur(v);o||(o=this.getBlur(e)); G,B))}}k.isEmpty()||ya(k);vb([A],true)};var Kb=this.pushGroupProperties=function(e,k){var m=e.childNodes,A=m.length,z=e.getAttribute("transform"),G=T(e),B=ha(G).matrix,w=new Aa("Push group properties"),E=0,I=na(e),F=$(e).attr(["filter","opacity"]),g,o;for(E=0;E<A;E++){var v=m[E];if(v.nodeType===1){if(F.opacity!==null&&F.opacity!==1){v.getAttribute("opacity");var D=Math.round((v.getAttribute("opacity")||1)*F.opacity*100)/100;ib("opacity",D,[v])}if(F.filter){var H=D=this.getBlur(v);o||(o=this.getBlur(e));
if(D)D=o-0+(D-0);else if(D===0)D=o;if(H)g=Q(v.getAttribute("filter"));else if(g){g=ja(g);kb().appendChild(g)}else g=Q(F.filter);g.id=v.id+"_"+(g.firstChild.tagName==="feGaussianBlur"?"blur":"filter");ib("filter","url(#"+g.id+")",[v]);if(D){ib("stdDeviation",D,[g.firstChild]);c.setBlurOffsets(g,D)}}D=T(v);if(~v.tagName.indexOf("Gradient"))D=null;if(D)if(v.tagName!=="defs")if(G.numberOfItems){if(I&&G.numberOfItems==1){var J=G.getItem(0).matrix,X=d.createSVGMatrix();if(H=oa(v))X=D.getItem(0).matrix; if(D)D=o-0+(D-0);else if(D===0)D=o;if(H)g=Q(v.getAttribute("filter"));else if(g){g=ja(g);kb().appendChild(g)}else g=Q(F.filter);g.id=v.id+"_"+(g.firstChild.tagName==="feGaussianBlur"?"blur":"filter");ib("filter","url(#"+g.id+")",[v]);if(D){ib("stdDeviation",D,[g.firstChild]);c.setBlurOffsets(g,D)}}D=T(v);if(~v.tagName.indexOf("Gradient"))D=null;if(D)if(v.tagName!=="defs")if(G.numberOfItems){if(I&&G.numberOfItems==1){var J=G.getItem(0).matrix,X=d.createSVGMatrix();if(H=na(v))X=D.getItem(0).matrix;
var ca=svgedit.utilities.getBBox(v),S=fa(D).matrix,W=M(ca.x+ca.width/2,ca.y+ca.height/2,S);ca=I+H;S=d.createSVGTransform();S.setRotate(ca,W.x,W.y);J=ha(J,X,S.matrix.inverse());H&&D.removeItem(0);if(ca)D.numberOfItems?D.insertItemBefore(S,0):D.appendItem(S);if(J.e||J.f){H=d.createSVGTransform();H.setTranslate(J.e,J.f);D.numberOfItems?D.insertItemBefore(H,0):D.appendItem(H)}}else{H=v.getAttribute("transform");J={};J.transform=H?H:"";H=d.createSVGTransform();J=fa(D).matrix;X=J.inverse();J=ha(X,B,J); var da=svgedit.utilities.getBBox(v),S=ha(D).matrix,V=M(da.x+da.width/2,da.y+da.height/2,S);da=I+H;S=d.createSVGTransform();S.setRotate(da,V.x,V.y);J=aa(J,X,S.matrix.inverse());H&&D.removeItem(0);if(da)D.numberOfItems?D.insertItemBefore(S,0):D.appendItem(S);if(J.e||J.f){H=d.createSVGTransform();H.setTranslate(J.e,J.f);D.numberOfItems?D.insertItemBefore(H,0):D.appendItem(H)}}else{H=v.getAttribute("transform");J={};J.transform=H?H:"";H=d.createSVGTransform();J=ha(D).matrix;X=J.inverse();J=aa(X,B,J);
H.setMatrix(J);D.appendItem(H)}(v=Qa(v))&&w.addSubCommand(v)}}}if(z){J={};J.transform=z;e.setAttribute("transform","");e.removeAttribute("transform");w.addSubCommand(new Na(e,J))}if(k&&!w.isEmpty())return w};this.ungroupSelectedElement=function(){var e=K[0];if($(e).data("gsvg")||$(e).data("symbol"))Ob(e);else if(e.tagName==="use"){var k=pa(da(e).substr(1));$(e).data("symbol",k).data("ref",k);Ob(e)}else{k=$(e).parents("a");if(k.length)e=k[0];if(e.tagName==="g"||e.tagName==="a"){k=new Aa("Ungroup Elements"); H.setMatrix(J);D.appendItem(H)}(v=Qa(v))&&w.addSubCommand(v)}}}if(z){J={};J.transform=z;e.setAttribute("transform","");e.removeAttribute("transform");w.addSubCommand(new Na(e,J))}if(k&&!w.isEmpty())return w};this.ungroupSelectedElement=function(){var e=K[0];if($(e).data("gsvg")||$(e).data("symbol"))Ob(e);else if(e.tagName==="use"){var k=oa(ea(e).substr(1));$(e).data("symbol",k).data("ref",k);Ob(e)}else{k=$(e).parents("a");if(k.length)e=k[0];if(e.tagName==="g"||e.tagName==="a"){k=new Aa("Ungroup Elements");
var m=Kb(e,true);m&&k.addSubCommand(m);m=e.parentNode;for(var A=e.nextSibling,z=Array(e.childNodes.length),G=0;e.firstChild;){var B=e.firstChild,w=B.nextSibling,E=B.parentNode;if(B.tagName==="title"){k.addSubCommand(new Ka(B,B.nextSibling,E));E.removeChild(B)}else{z[G++]=B=m.insertBefore(B,A);k.addSubCommand(new Ia(B,w,E))}}Pa();A=e.nextSibling;e=m.removeChild(e);k.addSubCommand(new Ka(e,A,m));k.isEmpty()||ya(k);tb(z)}}};this.moveToTopSelectedElement=function(){var e=K[0];if(e!=null){e=e;var k=e.parentNode, var m=Kb(e,true);m&&k.addSubCommand(m);m=e.parentNode;for(var A=e.nextSibling,z=Array(e.childNodes.length),G=0;e.firstChild;){var B=e.firstChild,w=B.nextSibling,E=B.parentNode;if(B.tagName==="title"){k.addSubCommand(new Ka(B,B.nextSibling,E));E.removeChild(B)}else{z[G++]=B=m.insertBefore(B,A);k.addSubCommand(new Ia(B,w,E))}}Pa();A=e.nextSibling;e=m.removeChild(e);k.addSubCommand(new Ka(e,A,m));k.isEmpty()||ya(k);tb(z)}}};this.moveToTopSelectedElement=function(){var e=K[0];if(e!=null){e=e;var k=e.parentNode,
m=e.nextSibling;e=e.parentNode.appendChild(e);if(m!=e.nextSibling){ya(new Ia(e,m,k,"top"));N("changed",[e])}}};this.moveToBottomSelectedElement=function(){var e=K[0];if(e!=null){e=e;var k=e.parentNode,m=e.nextSibling,A=e.parentNode.firstChild;if(A.tagName=="title")A=A.nextSibling;if(A.tagName=="defs")A=A.nextSibling;e=e.parentNode.insertBefore(e,A);if(m!=e.nextSibling){ya(new Ia(e,m,k,"bottom"));N("changed",[e])}}};this.moveUpDownSelected=function(e){var k=K[0];if(k){jb=[];var m,A,z=$(sb(getStrokedBBox([k]))).toArray(); m=e.nextSibling;e=e.parentNode.appendChild(e);if(m!=e.nextSibling){ya(new Ia(e,m,k,"top"));N("changed",[e])}}};this.moveToBottomSelectedElement=function(){var e=K[0];if(e!=null){e=e;var k=e.parentNode,m=e.nextSibling,A=e.parentNode.firstChild;if(A.tagName=="title")A=A.nextSibling;if(A.tagName=="defs")A=A.nextSibling;e=e.parentNode.insertBefore(e,A);if(m!=e.nextSibling){ya(new Ia(e,m,k,"bottom"));N("changed",[e])}}};this.moveUpDownSelected=function(e){var k=K[0];if(k){jb=[];var m,A,z=$(sb(getStrokedBBox([k]))).toArray();
e=="Down"&&z.reverse();$.each(z,function(){if(A){m=this;return false}else if(this==k)A=true});if(m){z=k.parentNode;var G=k.nextSibling;$(m)[e=="Down"?"before":"after"](k);if(G!=k.nextSibling){ya(new Ia(k,G,z,"Move "+e));N("changed",[k])}}}};this.moveSelectedElements=function(e,k,m){if(e.constructor!=Array){e/=p;k/=p}m=m||true;for(var A=new Aa("position"),z=K.length;z--;){var G=K[z];if(G!=null){var B=d.createSVGTransform(),w=T(G);e.constructor==Array?B.setTranslate(e[z],k[z]):B.setTranslate(e,k);w.numberOfItems? e=="Down"&&z.reverse();$.each(z,function(){if(A){m=this;return false}else if(this==k)A=true});if(m){z=k.parentNode;var G=k.nextSibling;$(m)[e=="Down"?"before":"after"](k);if(G!=k.nextSibling){ya(new Ia(k,G,z,"Move "+e));N("changed",[k])}}}};this.moveSelectedElements=function(e,k,m){if(e.constructor!=Array){e/=p;k/=p}m=m||true;for(var A=new Aa("position"),z=K.length;z--;){var G=K[z];if(G!=null){var B=d.createSVGTransform(),w=T(G);e.constructor==Array?B.setTranslate(e[z],k[z]):B.setTranslate(e,k);w.numberOfItems?
@ -370,19 +370,19 @@ w.insertItemBefore(B,0):w.appendItem(B);(B=Qa(G))&&A.addSubCommand(B);Ga.request
m||this.moveSelectedElements(e,k,false);ya(A)}return clones};this.alignSelectedElements=function(e,k){var m=[],A=Number.MAX_VALUE,z=Number.MIN_VALUE,G=Number.MAX_VALUE,B=Number.MIN_VALUE,w=Number.MIN_VALUE,E=Number.MIN_VALUE,I=K.length;if(I){for(var F=0;F<I;++F){if(K[F]==null)break;m[F]=getStrokedBBox([K[F]]);switch(k){case "smallest":if((e=="l"||e=="c"||e=="r")&&(w==Number.MIN_VALUE||w>m[F].width)||(e=="t"||e=="m"||e=="b")&&(E==Number.MIN_VALUE||E>m[F].height)){A=m[F].x;G=m[F].y;z=m[F].x+m[F].width; m||this.moveSelectedElements(e,k,false);ya(A)}return clones};this.alignSelectedElements=function(e,k){var m=[],A=Number.MAX_VALUE,z=Number.MIN_VALUE,G=Number.MAX_VALUE,B=Number.MIN_VALUE,w=Number.MIN_VALUE,E=Number.MIN_VALUE,I=K.length;if(I){for(var F=0;F<I;++F){if(K[F]==null)break;m[F]=getStrokedBBox([K[F]]);switch(k){case "smallest":if((e=="l"||e=="c"||e=="r")&&(w==Number.MIN_VALUE||w>m[F].width)||(e=="t"||e=="m"||e=="b")&&(E==Number.MIN_VALUE||E>m[F].height)){A=m[F].x;G=m[F].y;z=m[F].x+m[F].width;
B=m[F].y+m[F].height;w=m[F].width;E=m[F].height}break;case "largest":if((e=="l"||e=="c"||e=="r")&&(w==Number.MIN_VALUE||w<m[F].width)||(e=="t"||e=="m"||e=="b")&&(E==Number.MIN_VALUE||E<m[F].height)){A=m[F].x;G=m[F].y;z=m[F].x+m[F].width;B=m[F].y+m[F].height;w=m[F].width;E=m[F].height}break;default:if(m[F].x<A)A=m[F].x;if(m[F].y<G)G=m[F].y;if(m[F].x+m[F].width>z)z=m[F].x+m[F].width;if(m[F].y+m[F].height>B)B=m[F].y+m[F].height}}if(k=="page"){G=A=0;z=c.contentW;B=c.contentH}w=Array(I);E=Array(I);for(F= B=m[F].y+m[F].height;w=m[F].width;E=m[F].height}break;case "largest":if((e=="l"||e=="c"||e=="r")&&(w==Number.MIN_VALUE||w<m[F].width)||(e=="t"||e=="m"||e=="b")&&(E==Number.MIN_VALUE||E<m[F].height)){A=m[F].x;G=m[F].y;z=m[F].x+m[F].width;B=m[F].y+m[F].height;w=m[F].width;E=m[F].height}break;default:if(m[F].x<A)A=m[F].x;if(m[F].y<G)G=m[F].y;if(m[F].x+m[F].width>z)z=m[F].x+m[F].width;if(m[F].y+m[F].height>B)B=m[F].y+m[F].height}}if(k=="page"){G=A=0;z=c.contentW;B=c.contentH}w=Array(I);E=Array(I);for(F=
0;F<I;++F){if(K[F]==null)break;var g=m[F];w[F]=0;E[F]=0;switch(e){case "l":w[F]=A-g.x;break;case "c":w[F]=(A+z)/2-(g.x+g.width/2);break;case "r":w[F]=z-(g.x+g.width);break;case "t":E[F]=G-g.y;break;case "m":E[F]=(G+B)/2-(g.y+g.height/2);break;case "b":E[F]=B-(g.y+g.height)}}this.moveSelectedElements(w,E)}};this.contentW=Ab().w;this.contentH=Ab().h;this.updateCanvas=function(e,k){d.setAttribute("width",e);d.setAttribute("height",k);var m=$("#canvasBackground")[0],A=l.getAttribute("x"),z=l.getAttribute("y"), 0;F<I;++F){if(K[F]==null)break;var g=m[F];w[F]=0;E[F]=0;switch(e){case "l":w[F]=A-g.x;break;case "c":w[F]=(A+z)/2-(g.x+g.width/2);break;case "r":w[F]=z-(g.x+g.width);break;case "t":E[F]=G-g.y;break;case "m":E[F]=(G+B)/2-(g.y+g.height/2);break;case "b":E[F]=B-(g.y+g.height)}}this.moveSelectedElements(w,E)}};this.contentW=Ab().w;this.contentH=Ab().h;this.updateCanvas=function(e,k){d.setAttribute("width",e);d.setAttribute("height",k);var m=$("#canvasBackground")[0],A=l.getAttribute("x"),z=l.getAttribute("y"),
G=e/2-this.contentW*p/2,B=k/2-this.contentH*p/2;la(l,{width:this.contentW*p,height:this.contentH*p,x:G,y:B,viewBox:"0 0 "+this.contentW+" "+this.contentH});la(m,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:G,y:B});(m=pa("background_image"))&&la(m,{width:"100%",height:"100%"});Ga.selectorParentGroup.setAttribute("transform","translate("+G+","+B+")");return{x:G,y:B,old_x:A,old_y:z,d_x:G-A,d_y:B-z}};this.setBackground=function(e,k){var m=pa("canvasBackground"),A=$(m).find("rect")[0], G=e/2-this.contentW*p/2,B=k/2-this.contentH*p/2;la(l,{width:this.contentW*p,height:this.contentH*p,x:G,y:B,viewBox:"0 0 "+this.contentW+" "+this.contentH});la(m,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:G,y:B});(m=oa("background_image"))&&la(m,{width:"100%",height:"100%"});Ga.selectorParentGroup.setAttribute("transform","translate("+G+","+B+")");return{x:G,y:B,old_x:A,old_y:z,d_x:G-A,d_y:B-z}};this.setBackground=function(e,k){var m=oa("canvasBackground"),A=$(m).find("rect")[0],
z=pa("background_image");A.setAttribute("fill",e);if(k){if(!z){z=f.createElementNS(b,"image");la(z,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}U(z,k);m.appendChild(z)}else z&&z.parentNode.removeChild(z)};this.cycleElement=function(e){var k=K[0],m=false,A=ob(L||C().getCurrentLayer());if(A.length){if(k==null){e=e?A.length-1:0;m=A[e]}else for(var z=A.length;z--;)if(A[z]==k){e=e?z-1:z+1;if(e>=A.length)e=0;else if(e<0)e=A.length-1;m=A[e]; z=oa("background_image");A.setAttribute("fill",e);if(k){if(!z){z=f.createElementNS(b,"image");la(z,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}U(z,k);m.appendChild(z)}else z&&z.parentNode.removeChild(z)};this.cycleElement=function(e){var k=K[0],m=false,A=ob(L||C().getCurrentLayer());if(A.length){if(k==null){e=e?A.length-1:0;m=A[e]}else for(var z=A.length;z--;)if(A[z]==k){e=e?z-1:z+1;if(e>=A.length)e=0;else if(e<0)e=A.length-1;m=A[e];
break}vb([m],true);N("selected",K)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:ya,setGradient:Mb,addSvgElementFromJson:P,assignAttributes:la,BatchCommand:Aa,call:N,ChangeElementCommand:Na,copyElem:ja,ffClone:ea,findDefs:kb,findDuplicateGradient:Ib,getElem:pa,getId:ba,getIntersectionList:sb,getMouseTarget:mb,getNextId:ka,getPathBBox:Y,getUrlFromAttr:ia,hasMatrixTransform:na,identifyLayers:Db,InsertElementCommand:za,isIdentity:svgedit.math.isIdentity,logMatrix:Va,matrixMultiply:ha, break}vb([m],true);N("selected",K)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:ya,setGradient:Mb,addSvgElementFromJson:P,assignAttributes:la,BatchCommand:Aa,call:N,ChangeElementCommand:Na,copyElem:ja,ffClone:fa,findDefs:kb,findDuplicateGradient:Ib,getElem:oa,getId:ba,getIntersectionList:sb,getMouseTarget:mb,getNextId:ka,getPathBBox:Y,getUrlFromAttr:ia,hasMatrixTransform:qa,identifyLayers:Db,InsertElementCommand:za,isIdentity:svgedit.math.isIdentity,logMatrix:Va,matrixMultiply:aa,
MoveElementCommand:Ia,preventClickDefault:Gb,recalculateAllSelectedDimensions:Fa,recalculateDimensions:Qa,remapElement:$a,RemoveElementCommand:Ka,removeUnusedDefElems:Nb,round:eb,runExtensions:lb,sanitizeSvg:Ea,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:fa,transformPoint:M,walkTree:svgedit.utilities.walkTree}}};(function(){document.addEventListener("touchstart",touchHandler,true);document.addEventListener("touchmove",touchHandler,true);document.addEventListener("touchend",touchHandler,true);document.addEventListener("touchcancel",touchHandler,true);if(!window.svgEditor)window.svgEditor=function(a){function q(d,l){var s=h.setSvgString(d)!==false;l=l||a.noop;s?l(true):a.alert(uiStrings.notification.errorLoadingSVG,function(){l(false)})}var h,b={},n=false;curConfig={canvas_expansion:1,dimensions:[580,400], MoveElementCommand:Ia,preventClickDefault:Gb,recalculateAllSelectedDimensions:Fa,recalculateDimensions:Qa,remapElement:$a,RemoveElementCommand:Ka,removeUnusedDefElems:Nb,round:eb,runExtensions:lb,sanitizeSvg:Ea,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:ha,transformPoint:M,walkTree:svgedit.utilities.walkTree}}};(function(){document.addEventListener("touchstart",touchHandler,true);document.addEventListener("touchmove",touchHandler,true);document.addEventListener("touchend",touchHandler,true);document.addEventListener("touchcancel",touchHandler,true);if(!window.svgEditor)window.svgEditor=function(a){function q(d,l){var s=h.setSvgString(d)!==false;l=l||a.noop;s?l(true):a.alert(uiStrings.notification.errorLoadingSVG,function(){l(false)})}var h,b={},n=false;curConfig={canvas_expansion:1,dimensions:[580,400],
initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:[],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:svgedit.browser.isTouch()?false:true,show_outside_canvas:false,no_save_warning:true,initFont:"Helvetica, Arial, sans-serif"};uiStrings=b.uiStrings={common:{ok:"OK",cancel:"Cancel",key_up:"Up", initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:[],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:svgedit.browser.isTouch()?false:true,show_outside_canvas:false,no_save_warning:true,initFont:"Helvetica, Arial, sans-serif"};uiStrings=b.uiStrings={common:{ok:"OK",cancel:"Cancel",key_up:"Up",
key_down:"Down",key_backspace:"Backspace",key_del:"Del"},layers:{layer:"Layer"},notification:{invalidAttrValGiven:"Invalid value given",noContentToFitTo:"No content to fit to",dupeLayerName:"There is already a layer named that!",enterUniqueLayerName:"Please enter a unique layer name",enterNewLayerName:"Please enter the new layer name",layerHasThatName:"Layer already has that name",QmoveElemsToLayer:'Move selected elements to layer "%s"?',QwantToClear:"Do you want to clear the drawing?\nThis will also erase your undo history!", key_down:"Down",key_backspace:"Backspace",key_del:"Del"},layers:{layer:"Layer"},notification:{invalidAttrValGiven:"Invalid value given",noContentToFitTo:"No content to fit to",dupeLayerName:"There is already a layer named that!",enterUniqueLayerName:"Please enter a unique layer name",enterNewLayerName:"Please enter the new layer name",layerHasThatName:"Layer already has that name",QmoveElemsToLayer:'Move selected elements to layer "%s"?',QwantToClear:"Do you want to clear the drawing?\nThis will also erase your undo history!",
QwantToOpen:"Do you want to open a new file?\nThis will also erase your undo history!",QerrorsRevertToSource:"There were parsing errors in your SVG source.\nRevert back to original SVG source?",QignoreSourceChanges:"Ignore changes made to SVG source?",featNotSupported:"Feature not supported",enterNewImgURL:"Enter the new image URL",defsFailOnSave:"NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.",loadingImage:"Loading image, please wait...", QwantToOpen:"Do you want to open a new file?\nThis will also erase your undo history!",QerrorsRevertToSource:"There were parsing errors in your SVG source.\nRevert back to original SVG source?",QignoreSourceChanges:"Ignore changes made to SVG source?",featNotSupported:"Feature not supported",enterNewImgURL:"Enter the new image URL",defsFailOnSave:"NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.",loadingImage:"Loading image, please wait...",
saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};var u={},c={};b.curConfig=curConfig;b.tool_scale=1;b.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions}; saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};var u={},c={};b.curConfig=curConfig;b.tool_scale=1;b.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions};
b.setCustomHandlers=function(d){b.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();h.open=d.open}if(d.save){b.show_save_warning=false;h.bind("saved",d.save)}d.pngsave&&h.bind("exported",d.pngsave);c=d})};b.randomizeIds=function(){h.randomizeIds(arguments)};b.init=function(){function d(g,o){var v=g.id,D=v.split("_"),H=D[0];D=D[1];o&&h.setStrokeAttr("stroke-"+H,D);nb();Ib("#cur_"+H,v,20);a(g).addClass("current").siblings().removeClass("current")}function l(g, b.setCustomHandlers=function(d){b.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();h.open=d.open}if(d.save){b.show_save_warning=false;h.bind("saved",d.save)}d.pngsave&&h.bind("exported",d.pngsave);c=d})};b.randomizeIds=function(){h.randomizeIds(arguments)};b.init=function(){function d(g,o){var v=g.id,D=v.split("_"),H=D[0];D=D[1];o&&h.setStrokeAttr("stroke-"+H,D);nb();Ib("#cur_"+H,v,20);a(g).addClass("current").siblings().removeClass("current")}function l(g,
o){var v=document.getElementById("ruler_x_cursor"),D=document.getElementById("ruler_y_cursor"),H=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()&&a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(Qb){Qb.stopPropagation();v.style.left=Qb.pageX-66+H.scrollLeft+"px";D.style.top=Qb.pageY-48+H.scrollTop+"px"});o||(o=h.getZoom());g||(g=a("#svgcanvas"));for(var J=h.getContentElem(),X=svgedit.units.getTypeMap()[curConfig.baseUnit], o){var v=document.getElementById("ruler_x_cursor"),D=document.getElementById("ruler_y_cursor"),H=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()&&a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(Qb){Qb.stopPropagation();v.style.left=Qb.pageX-66+H.scrollLeft+"px";D.style.top=Qb.pageY-48+H.scrollTop+"px"});o||(o=h.getZoom());g||(g=a("#svgcanvas"));for(var J=h.getContentElem(),X=svgedit.units.getTypeMap()[curConfig.baseUnit],
ca=0;ca<2;ca++){var S=ca===0,W=S?"x":"y",Z=S?"width":"height",qa=J.getAttribute(W)-0;W=a("#ruler_"+W+" canvas:first");$hcanv=W.clone();W.replaceWith($hcanv);var ta=$hcanv[0];var ga=W=g[Z]()*2;ta.parentNode.style[Z]=ga+"px";var Ta=0,Ha,sa=ta.getContext("2d");sa.fillStyle="rgb(200,0,0)";sa.fillRect(0,0,ta.width,ta.height);$hcanv.siblings().remove();if(W>=3E4){var Ma=parseInt(W/3E4)+1;Ha=Array(Ma);Ha[0]=sa;for(var va=1;va<Ma;va++){ta[Z]=3E4;var Za=ta.cloneNode(true);ta.parentNode.appendChild(Za);Ha[va]= da=0;da<2;da++){var S=da===0,V=S?"x":"y",Z=S?"width":"height",pa=J.getAttribute(V)-0;V=a("#ruler_"+V+" canvas:first");$hcanv=V.clone();V.replaceWith($hcanv);var ta=$hcanv[0];var ga=V=g[Z]()*2;ta.parentNode.style[Z]=ga+"px";var Ta=0,Ha,sa=ta.getContext("2d");sa.fillStyle="rgb(200,0,0)";sa.fillRect(0,0,ta.width,ta.height);$hcanv.siblings().remove();if(V>=3E4){var Ma=parseInt(V/3E4)+1;Ha=Array(Ma);Ha[0]=sa;for(var va=1;va<Ma;va++){ta[Z]=3E4;var Za=ta.cloneNode(true);ta.parentNode.appendChild(Za);Ha[va]=
Za.getContext("2d")}Za[Z]=W%3E4;W=3E4}ta[Z]=W;Z=X*o;var Ua=50/Z;ta=1;for(va=0;va<E.length;va++){ta=Ma=E[va];if(Ua<=Ma)break}Ua=ta*Z;sa.font="normal 9px 'Lucida Grande', sans-serif";sa.fillStyle="#777";for(var bb=qa/Z%ta*Z,Fb=bb-Ua;bb<ga;bb+=Ua){Fb+=Ua;va=Math.round(bb)+0.5;if(S){sa.moveTo(va,15);sa.lineTo(va,0)}else{sa.moveTo(15,va);sa.lineTo(0,va)}Ma=(Fb-qa)/Z;if(ta>=1)va=Math.round(Ma);else{va=(ta+"").split(".")[1].length;va=Ma.toFixed(va)-0}if(va!==0&&va!==1E3&&va%1E3===0)va=va/1E3+"K";if(S){sa.fillText(va, Za.getContext("2d")}Za[Z]=V%3E4;V=3E4}ta[Z]=V;Z=X*o;var Ua=50/Z;ta=1;for(va=0;va<E.length;va++){ta=Ma=E[va];if(Ua<=Ma)break}Ua=ta*Z;sa.font="normal 9px 'Lucida Grande', sans-serif";sa.fillStyle="#777";for(var bb=pa/Z%ta*Z,Fb=bb-Ua;bb<ga;bb+=Ua){Fb+=Ua;va=Math.round(bb)+0.5;if(S){sa.moveTo(va,15);sa.lineTo(va,0)}else{sa.moveTo(15,va);sa.lineTo(0,va)}Ma=(Fb-pa)/Z;if(ta>=1)va=Math.round(Ma);else{va=(ta+"").split(".")[1].length;va=Ma.toFixed(va)-0}if(va!==0&&va!==1E3&&va%1E3===0)va=va/1E3+"K";if(S){sa.fillText(va,
bb+2,8);sa.fillStyle="#777"}else{Ma=(va+"").split("");for(va=0;va<Ma.length;va++){sa.fillText(Ma[va],1,bb+9+va*9);sa.fillStyle="#777"}}Ma=Ua/10;for(va=1;va<10;va++){var wb=Math.round(bb+Ma*va)+0.5;if(Ha&&wb>W){Ta++;sa.stroke();if(Ta>=Ha.length){va=10;bb=ga;continue}sa=Ha[Ta];bb-=3E4;wb=Math.round(bb+Ma*va)+0.5}var Eb=va%2?12:10;if(S){sa.moveTo(wb,15);sa.lineTo(wb,Eb)}else{sa.moveTo(15,wb);sa.lineTo(Eb,wb)}}}sa.strokeStyle="#666";sa.stroke()}}(function(){var g=window.opener;if(g)try{var o=g.document.createEvent("Event"); bb+2,8);sa.fillStyle="#777"}else{Ma=(va+"").split("");for(va=0;va<Ma.length;va++){sa.fillText(Ma[va],1,bb+9+va*9);sa.fillStyle="#777"}}Ma=Ua/10;for(va=1;va<10;va++){var wb=Math.round(bb+Ma*va)+0.5;if(Ha&&wb>V){Ta++;sa.stroke();if(Ta>=Ha.length){va=10;bb=ga;continue}sa=Ha[Ta];bb-=3E4;wb=Math.round(bb+Ma*va)+0.5}var Eb=va%2?12:10;if(S){sa.moveTo(wb,15);sa.lineTo(wb,Eb)}else{sa.moveTo(15,wb);sa.lineTo(Eb,wb)}}}sa.strokeStyle="#666";sa.stroke()}}(function(){var g=window.opener;if(g)try{var o=g.document.createEvent("Event");
o.initEvent("svgEditorReady",true,true);g.document.documentElement.dispatchEvent(o)}catch(v){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var g=a.deparam.querystring(true);if(!a.isEmptyObject(g)){if(g.dimensions)g.dimensions=g.dimensions.split(",");if(g.extensions)g.extensions=g.extensions.split(",");if(g.bkgd_color)g.bkgd_color="#"+g.bkgd_color;svgEditor.setConfig(g);var o= o.initEvent("svgEditorReady",true,true);g.document.documentElement.dispatchEvent(o)}catch(v){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var g=a.deparam.querystring(true);if(!a.isEmptyObject(g)){if(g.dimensions)g.dimensions=g.dimensions.split(",");if(g.extensions)g.extensions=g.extensions.split(",");if(g.bkgd_color)g.bkgd_color="#"+g.bkgd_color;svgEditor.setConfig(g);var o=
g.source,v=a.param.querystring();if(!o)if(v.indexOf("source=data:")>=0)o=v.match(/source=(data:[^&]*)/)[1];if(o)if(o.indexOf("data:")===0){o=o.replace(/ /g,"+");b.loadFromDataURI(o)}else b.loadFromString(o);else if(v.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(v.substr(9));else g.url&&svgEditor.loadFromURL(g.url)}})();var s=function(){a.each(curConfig.extensions,function(){var g=this;a.getScript(curConfig.extPath+g,function(o){if(!o){o=document.createElement("script");o.src=curConfig.extPath+ g.source,v=a.param.querystring();if(!o)if(v.indexOf("source=data:")>=0)o=v.match(/source=(data:[^&]*)/)[1];if(o)if(o.indexOf("data:")===0){o=o.replace(/ /g,"+");b.loadFromDataURI(o)}else b.loadFromString(o);else if(v.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(v.substr(9));else g.url&&svgEditor.loadFromURL(g.url)}})();var s=function(){a.each(curConfig.extensions,function(){var g=this;a.getScript(curConfig.extPath+g,function(o){if(!o){o=document.createElement("script");o.src=curConfig.extPath+
g;document.querySelector("head").appendChild(o)}})})};document.location.protocol==="file:"?setTimeout(s,100):s();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png",node_delete:"node_delete.png", g;document.querySelector("head").appendChild(o)}})})};document.location.protocol==="file:"?setTimeout(s,100):s();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png",node_delete:"node_delete.png",
@ -391,45 +391,45 @@ align_left:"align-left.png",align_center:"align-center.png",align_right:"align-r
resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var g=a("#tools_left");if(g.length!=0){g.offset();g.outerHeight()}a(".tools_flyout").each(function(){var o= resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var g=a("#tools_left");if(g.length!=0){g.offset();g.outerHeight()}a(".tools_flyout").each(function(){var o=
a("#"+this.id+"_show"),v=o.attr("data-curopt");if(!o.children("svg, img").length){v=a(v).children().clone();if(v.length){v[0].removeAttribute("style");o.append(v)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(g){a("#base_unit_container").css({top:g.pageY-10,left:g.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter", a("#"+this.id+"_show"),v=o.attr("data-curopt");if(!o.children("svg, img").length){v=a(v).children().clone();if(v.length){v[0].removeAttribute("style");o.append(v)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(g){a("#base_unit_container").css({top:g.pageY-10,left:g.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",
function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=h=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};s=navigator.platform.indexOf("Mac")>=0;var C=navigator.userAgent.indexOf("AppleWebKit")>=0,p=s?"meta+":"ctrl+",L=h.pathActions,R=h.undoMgr,O=svgedit.utilities,K=curConfig.imgPath+ function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=h=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};s=navigator.platform.indexOf("Mac")>=0;var C=navigator.userAgent.indexOf("AppleWebKit")>=0,p=s?"meta+":"ctrl+",L=h.pathActions,R=h.undoMgr,O=svgedit.utilities,K=curConfig.imgPath+
"placeholder.svg",P=a("#workarea"),T=a("#cmenu_canvas"),M=null,ha=1,na="toolbars",fa="";s||a(".shortcut").each(function(){var g=a(this).text();a(this).text(g.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var g=a("#dialog_box"),o=a("#dialog_buttons"),v=function(D,H,J,X){a("#dialog_content").html("<p>"+H.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",D=="prompt");o.empty();var ca=a('<input type="button" value="'+ "placeholder.svg",P=a("#workarea"),T=a("#cmenu_canvas"),M=null,aa=1,qa="toolbars",ha="";s||a(".shortcut").each(function(){var g=a(this).text();a(this).text(g.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var g=a("#dialog_box"),o=a("#dialog_buttons"),v=function(D,H,J,X){a("#dialog_content").html("<p>"+H.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",D=="prompt");o.empty();var da=a('<input type="button" value="'+
uiStrings.common.ok+'">').appendTo(o);D!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(o).on("click, touchstart",function(){g.hide();J(false)});if(D=="prompt"){var S=a('<input type="text">').prependTo(o);S.val(X||"");S.bind("keydown","return",function(){ca.trigger("click touchstart")})}D=="process"&&ca.hide();g.show();ca.on("click touchstart",function(){g.hide();var W=D=="prompt"?S.val():true;J&&J(W)}).focus();D=="prompt"&&S.focus()};a.alert=function(D,H){v("alert", uiStrings.common.ok+'">').appendTo(o);D!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(o).on("click, touchstart",function(){g.hide();J(false)});if(D=="prompt"){var S=a('<input type="text">').prependTo(o);S.val(X||"");S.bind("keydown","return",function(){da.trigger("click touchstart")})}D=="process"&&da.hide();g.show();da.on("click touchstart",function(){g.hide();var V=D=="prompt"?S.val():true;J&&J(V)}).focus();D=="prompt"&&S.focus()};a.alert=function(D,H){v("alert",
D,H)};a.confirm=function(D,H){v("confirm",D,H)};a.process_cancel=function(D,H){v("process",D,H)};a.prompt=function(D,H,J){v("prompt",D,J,H)}})();var aa=function(){var g=a(".tool_button_current");if(g.length&&g[0].id!=="tool_select"){g.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}h.setMode("select")},V=null,ra=false,ia=false,da="",U=function(g,o){var v=h.getResolution();a("#svgcanvas").position();var D=h.setBBoxZoom(o, D,H)};a.confirm=function(D,H){v("confirm",D,H)};a.process_cancel=function(D,H){v("process",D,H)};a.prompt=function(D,H,J){v("prompt",D,J,H)}})();var ca=function(){var g=a(".tool_button_current");if(g.length&&g[0].id!=="tool_select"){g.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}h.setMode("select")},W=null,ra=false,ia=false,ea="",U=function(g,o){var v=h.getResolution();a("#svgcanvas").position();var D=h.setBBoxZoom(o,
P.width()-15,P.height()-15);if(D){var H=D.zoom;D=D.bbox;if(H<0.0010)xa({value:0.1});else{typeof animatedZoom!="undefined"&&g.cancelAnimationFrame(animatedZoom);var J=Date.now(),X=H-v.zoom;a("#zoom");var ca=v.zoom,S=function(W){W=(W-J)/500;W=Math.pow(W-1,3)+1;h.setZoom(ca+X*W);w();if(W<1)g.animatedZoom=requestAnimationFrame(S);else{a("#zoom").val(parseInt(H*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(H*100)+"]","#zoom_select").attr("selected","selected")}};S(Date.now()); P.width()-15,P.height()-15);if(D){var H=D.zoom;D=D.bbox;if(H<0.0010)xa({value:0.1});else{typeof animatedZoom!="undefined"&&g.cancelAnimationFrame(animatedZoom);var J=Date.now(),X=H-v.zoom;a("#zoom");var da=v.zoom,S=function(V){V=(V-J)/500;V=Math.pow(V-1,3)+1;h.setZoom(da+X*V);w();if(V<1)g.animatedZoom=requestAnimationFrame(S);else{a("#zoom").val(parseInt(H*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(H*100)+"]","#zoom_select").attr("selected","selected")}};S(Date.now());
h.getMode()=="zoom"&&D.width&&aa();Ab()}}};a("#cur_context_panel").delegate("a","click",function(){var g=a(this);g.attr("data-root")?h.leaveContext():h.setContext(g.text());return false});var Y=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},oa={},pa=function(g){a.each(g,function(o,v){var D=a(o).children(),H=o+"_show",J=a(H),X=false;D.addClass("tool_button").unbind("click mousedown mouseup").each(function(W){var Z=v[W];oa[Z.sel]=Z.fn;if(Z.isDefault)X=W;W=function(qa){var ta=Z;if(qa.type=== h.getMode()=="zoom"&&D.width&&ca();Ab()}}};a("#cur_context_panel").delegate("a","click",function(){var g=a(this);g.attr("data-root")?h.leaveContext():h.setContext(g.text());return false});var Y=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},na={},oa=function(g){a.each(g,function(o,v){var D=a(o).children(),H=o+"_show",J=a(H),X=false;D.addClass("tool_button").unbind("click mousedown mouseup").each(function(V){var Z=v[V];na[Z.sel]=Z.fn;if(Z.isDefault)X=V;V=function(pa){var ta=Z;if(pa.type===
"keydown"){var ga=a(ta.parent+"_show").hasClass("tool_button_current"),Ta=a(ta.parent+"_show").attr("data-curopt");a.each(g[Z.parent],function(sa,Ma){if(Ma.sel==Ta)ta=!qa.shiftKey||!ga?Ma:g[Z.parent][sa+1]||g[Z.parent][0]})}if(a(this).hasClass("disabled"))return false;Ya(H)&&ta.fn();var Ha=ta.icon?a.getSvgIcon(ta.icon,true):a(ta.sel).children().eq(0).clone();Ha[0].setAttribute("width",J.width());Ha[0].setAttribute("height",J.height());J.children(":not(.flyout_arrow_horiz)").remove();J.append(Ha).attr("data-curopt", "keydown"){var ga=a(ta.parent+"_show").hasClass("tool_button_current"),Ta=a(ta.parent+"_show").attr("data-curopt");a.each(g[Z.parent],function(sa,Ma){if(Ma.sel==Ta)ta=!pa.shiftKey||!ga?Ma:g[Z.parent][sa+1]||g[Z.parent][0]})}if(a(this).hasClass("disabled"))return false;Ya(H)&&ta.fn();var Ha=ta.icon?a.getSvgIcon(ta.icon,true):a(ta.sel).children().eq(0).clone();Ha[0].setAttribute("width",J.width());Ha[0].setAttribute("height",J.height());J.children(":not(.flyout_arrow_horiz)").remove();J.append(Ha).attr("data-curopt",
ta.sel)};a(this).mouseup(W);Z.key&&a(document).bind("keydown",Z.key[0]+" shift+"+Z.key[0],W)});if(X)J.attr("data-curopt",v[X].sel);else J.attr("data-curopt")||J.attr("data-curopt",v[0].sel);var ca,S=a(H).position();a(o).css({left:S.left+34,top:S.top+77});J.mousedown(function(W){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&Ya(H,false);if(J.hasClass("disabled"))return false;var Z=a(o),qa=S.left+34,ta=Z.width()*-1,ga=Z.data("shown_popop")? ta.sel)};a(this).mouseup(V);Z.key&&a(document).bind("keydown",Z.key[0]+" shift+"+Z.key[0],V)});if(X)J.attr("data-curopt",v[X].sel);else J.attr("data-curopt")||J.attr("data-curopt",v[0].sel);var da,S=a(H).position();a(o).css({left:S.left+34,top:S.top+77});J.mousedown(function(V){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&Ya(H,false);if(J.hasClass("disabled"))return false;var Z=a(o),pa=S.left+34,ta=Z.width()*-1,ga=Z.data("shown_popop")?
200:0;ca=setTimeout(function(){J.data("isLibrary")?Z.css("left",qa).show():Z.css("left",ta).show().animate({left:qa},50);Z.data("shown_popop",true)},ga);W.preventDefault()}).mouseup(function(){clearTimeout(ca);var W=a(this).attr("data-curopt");if(J.data("isLibrary")&&a(H.replace("_show","")).is(":visible"))Ya(H,true);else Ya(H)&&W in oa&&oa[W]()})});Ba()},la=function(g,o){return a("<div>",{"class":"tools_flyout",id:g}).appendTo("#svg_editor").append(o)},ma=function(){a(".tools_flyout").each(function(){var g= 200:0;da=setTimeout(function(){J.data("isLibrary")?Z.css("left",pa).show():Z.css("left",ta).show().animate({left:pa},50);Z.data("shown_popop",true)},ga);V.preventDefault()}).mouseup(function(){clearTimeout(da);var V=a(this).attr("data-curopt");if(J.data("isLibrary")&&a(H.replace("_show","")).is(":visible"))Ya(H,true);else Ya(H)&&V in na&&na[V]()})});Ba()},la=function(g,o){return a("<div>",{"class":"tools_flyout",id:g}).appendTo("#svg_editor").append(o)},ma=function(){a(".tools_flyout").each(function(){var g=
a("#"+this.id+"_show"),o=g.offset();g=g.outerWidth();a(this).css({left:(o.left+g)*ha,top:o.top})})},Ba=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show");if(!g.data("isLibrary")){var o=[];a(this).children().each(function(){o.push(this.title)});g[0].title=o.join(" / ")}})},Ea,Ia=function(g,o,v){var D=null;if(g.indexOf("url(#")===0){g=(g=h.getRefElem(g))?g.cloneNode(true):a("#"+v+"_color defs *")[0];D={alpha:o};D[g.tagName]=g}else D=g.indexOf("#")===0?{alpha:o,solidColor:g.substr(1)}: a("#"+this.id+"_show"),o=g.offset();g=g.outerWidth();a(this).css({left:(o.left+g)*aa,top:o.top})})},Ba=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show");if(!g.data("isLibrary")){var o=[];a(this).children().each(function(){o.push(this.title)});g[0].title=o.join(" / ")}})},Ea,Ia=function(g,o,v){var D=null;if(g.indexOf("url(#")===0){g=(g=h.getRefElem(g))?g.cloneNode(true):a("#"+v+"_color defs *")[0];D={alpha:o};D[g.tagName]=g}else D=g.indexOf("#")===0?{alpha:o,solidColor:g.substr(1)}:
{alpha:o,solidColor:"none"};return new a.jGraduate.Paint(D)},za=h.getResolution();if(curConfig.baseUnit!=="px"){za.w=svgedit.units.convertUnit(za.w)+curConfig.baseUnit;za.h=svgedit.units.convertUnit(za.h)+curConfig.baseUnit}var Ka=function(g){h.createLayer("background");cur_shape=h.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:za.w+2,height:za.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:g||"#fff",style:"pointer-events:none"}});h.setCurrentLayer("Layer 1");h.setCurrentLayerPosition("1")}; {alpha:o,solidColor:"none"};return new a.jGraduate.Paint(D)},za=h.getResolution();if(curConfig.baseUnit!=="px"){za.w=svgedit.units.convertUnit(za.w)+curConfig.baseUnit;za.h=svgedit.units.convertUnit(za.h)+curConfig.baseUnit}var Ka=function(g){h.createLayer("background");cur_shape=h.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:za.w+2,height:za.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:g||"#fff",style:"pointer-events:none"}});h.setCurrentLayer("Layer 1");h.setCurrentLayerPosition("1")};
document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");var Na=b.setImageURL=function(g){g||(g=K);h.setImageURL(g);a("#image_url").val(g)},Aa=function(){var g=V;if(g!=null&&!g.parentNode)g=null;if(ra&&ra[0]!=null&&!ra[0].parentNode)ra=false;var o=h.getCurrentDrawing().getCurrentLayerName(),v=h.getMode(),D=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,H=v=="pathedit";if(H){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide(); document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");var Na=b.setImageURL=function(g){g||(g=K);h.setImageURL(g);a("#image_url").val(g)},Aa=function(){var g=W;if(g!=null&&!g.parentNode)g=null;if(ra&&ra[0]!=null&&!ra[0].parentNode)ra=false;var o=h.getCurrentDrawing().getCurrentLayerName(),v=h.getMode(),D=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,H=v=="pathedit";if(H){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();
o=L.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!L.canDeleteNodes);Ib("#tool_openclose_path",L.closed_subpath?"open_path":"close_path");if(o){H=a("#seg_type");if(D){o.x=svgedit.units.convertUnit(o.x);o.y=svgedit.units.convertUnit(o.y)}a("#path_node_x").val(Math.round(o.x));a("#path_node_y").val(Math.round(o.y));o.type?H.val(o.type).removeAttr("disabled"):H.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected"); o=L.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!L.canDeleteNodes);Ib("#tool_openclose_path",L.closed_subpath?"open_path":"close_path");if(o){H=a("#seg_type");if(D){o.x=svgedit.units.convertUnit(o.x);o.y=svgedit.units.convertUnit(o.y)}a("#path_node_x").val(Math.round(o.x));a("#path_node_y").val(Math.round(o.y));o.type?H.val(o.type).removeAttr("disabled"):H.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");
a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var J=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(ra){ra=ra.filter(Boolean);(g=h.elementsAreSame(ra)?ra[0]:null)&&a("#tools_top").addClass("multiselected")}if(!g&&!ra){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(g!=null){a("#stroke_panel").show();var X=g.nodeName,ca=h.getRotationAngle(g); a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var J=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(ra){ra=ra.filter(Boolean);(g=h.elementsAreSame(ra)?ra[0]:null)&&a("#tools_top").addClass("multiselected")}if(!g&&!ra){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(g!=null){a("#stroke_panel").show();var X=g.nodeName,da=h.getRotationAngle(g);
a("#angle").val(Math.round(ca));ca=h.getBlur(g);a("#blur").val(ca);if(!H&&v!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var S,W;if(["g","polyline","path"].indexOf(X)>=0)if(v=h.getStrokedBBox([g])){S=v.x;W=v.y}if(D){S=svgedit.units.convertUnit(S);W=svgedit.units.convertUnit(W)}a("#"+X+"_x").val(Math.round(S));a("#"+X+"_y").val(Math.round(W));if(X==="polyline"){a("#path_x").val(Math.round(S));a("#path_y").val(Math.round(W))}["image","text","path","g","use"].indexOf(X)== a("#angle").val(Math.round(da));da=h.getBlur(g);a("#blur").val(da);if(!H&&v!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var S,V;if(["g","polyline","path"].indexOf(X)>=0)if(v=h.getStrokedBBox([g])){S=v.x;V=v.y}if(D){S=svgedit.units.convertUnit(S);V=svgedit.units.convertUnit(V)}a("#"+X+"_x").val(Math.round(S));a("#"+X+"_y").val(Math.round(V));if(X==="polyline"){a("#path_x").val(Math.round(S));a("#path_y").val(Math.round(V))}["image","text","path","g","use"].indexOf(X)==
-1&&a(".action_path_convert_selected").removeClass("disabled");X==="path"&&a(".action_path_selected").removeClass("disabled")}D=null;if(Z==="a"){D=h.getHref(g);a("#g_panel").show()}if(g.parentNode.tagName==="a")if(!a(g).siblings().length){a("#a_panel").show();D=h.getHref(g.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1", -1&&a(".action_path_convert_selected").removeClass("disabled");X==="path"&&a(".action_path_selected").removeClass("disabled")}D=null;if(Z==="a"){D=h.getHref(g);a("#g_panel").show()}if(g.parentNode.tagName==="a")if(!a(g).siblings().length){a("#a_panel").show();D=h.getHref(g.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1",
"y1","x2","y2"],text:["x","y"],use:[],path:[]};var Z=g.tagName;a(g).data("gsvg")&&a("#g_panel").show();if(Z=="path"||Z=="polyline")a("#path_panel").show();if(D[Z]){D=D[Z];a("#"+Z+"_panel").show();Z=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(D,function(qa,ta){var ga=g.getAttribute(ta);if(curConfig.baseUnit!=="px"&&g[ta])ga=svgedit.units.convertUnit(g[ta].baseVal.value);var Ta=document.getElementById(Z+"_"+ta);Ta.value=Math.round(ga)||0;Ta.getAttribute("data-cursor")=== "y1","x2","y2"],text:["x","y"],use:[],path:[]};var Z=g.tagName;a(g).data("gsvg")&&a("#g_panel").show();if(Z=="path"||Z=="polyline")a("#path_panel").show();if(D[Z]){D=D[Z];a("#"+Z+"_panel").show();Z=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(D,function(pa,ta){var ga=g.getAttribute(ta);if(curConfig.baseUnit!=="px"&&g[ta])ga=svgedit.units.convertUnit(g[ta].baseVal.value);var Ta=document.getElementById(Z+"_"+ta);Ta.value=Math.round(ga)||0;Ta.getAttribute("data-cursor")===
"true"&&a.fn.dragInput.updateCursor(Ta)});if(Z=="text"){D=g.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",h.getItalic());a("#tool_bold").toggleClass("active",h.getBold());a("#font_family").val(D);a("#font_size").val(g.getAttribute("font-size"));a("#text").val(g.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);h.addedNew&&setTimeout(function(){a("#text").focus().select()}, "true"&&a.fn.dragInput.updateCursor(Ta)});if(Z=="text"){D=g.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",h.getItalic());a("#tool_bold").toggleClass("active",h.getBold());a("#font_family").val(D);a("#font_size").val(g.getAttribute("font-size"));a("#text").val(g.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);h.addedNew&&setTimeout(function(){a("#text").focus().select()},
100)}else if(Z=="image")Na(h.getHref(g));else if(Z==="g"||Z==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");h.getTitle()}}J[(Z==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");J[(Z==="g"||!ra?"dis":"en")+"ableContextMenuItems"]("#group")}if(ra){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");J.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}g||J.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back"); 100)}else if(Z=="image")Na(h.getHref(g));else if(Z==="g"||Z==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");h.getTitle()}}J[(Z==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");J[(Z==="g"||!ra?"dis":"en")+"ableContextMenuItems"]("#group")}if(ra){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");J.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}g||J.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
R.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");R.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");h.addedNew=false;if(g&&!H||ra){a("#selLayerNames").removeAttr("disabled").val(o);T.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});h.bind("selected",function(g,o){var v=h.getMode();v==="select"&& R.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");R.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");h.addedNew=false;if(g&&!H||ra){a("#selLayerNames").removeAttr("disabled").val(o);T.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});h.bind("selected",function(g,o){var v=h.getMode();v==="select"&&
aa();if(v==="pathedit")return Aa();V=o.length==1||o[1]==null?o[0]:null;o=o.filter(Boolean);ra=o.length>=2?o:false;if(h.elementsAreSame(ra))V=ra[0];if(V!=null){a("#multiselected_panel").hide();if(V!=null)switch(V.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":v=null;for(var D=V.getElementsByTagName("*"),H=0,J=D.length;H<J;H++){var X=D[H].getAttribute("stroke-width");if(H===0)v=X;else if(v!==X)v=null}a("#stroke_width").val(v===null?"":v);break;default:a("#stroke_width").val(V.getAttribute("stroke-width")|| ca();if(v==="pathedit")return Aa();W=o.length==1||o[1]==null?o[0]:null;o=o.filter(Boolean);ra=o.length>=2?o:false;if(h.elementsAreSame(ra))W=ra[0];if(W!=null){a("#multiselected_panel").hide();if(W!=null)switch(W.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":v=null;for(var D=W.getElementsByTagName("*"),H=0,J=D.length;H<J;H++){var X=D[H].getAttribute("stroke-width");if(H===0)v=X;else if(v!==X)v=null}a("#stroke_width").val(v===null?"":v);break;default:a("#stroke_width").val(W.getAttribute("stroke-width")||
1);v=V.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+v+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);v=V.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+v).length!=0&&d(a("#linejoin_"+v)[0]);v=V.getAttribute("stroke-linecap")||"butt";a("#linecap_"+v).length!=0&&d(a("#linecap_"+v)[0])}if(V!=null){v=(V.getAttribute("opacity")||1)*100;a("#group_opacity").val(v); 1);v=W.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+v+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);v=W.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+v).length!=0&&d(a("#linejoin_"+v)[0]);v=W.getAttribute("stroke-linecap")||"butt";a("#linecap_"+v).length!=0&&d(a("#linecap_"+v)[0])}if(W!=null){v=(W.getAttribute("opacity")||1)*100;a("#group_opacity").val(v);
a.fn.dragInput.updateCursor(a("#group_opacity")[0])}ra.length&&a("#tools_top").addClass("multiselected")}else if(ra.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}h.runExtensions("selectedChanged",{elems:o,selectedElement:V,multiselected:ra})});h.bind("transition",function(g,o){var v=h.getMode(),D=o[0];if(D){ra=o.length>=2&&o[1]!= a.fn.dragInput.updateCursor(a("#group_opacity")[0])}ra.length&&a("#tools_top").addClass("multiselected")}else if(ra.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}h.runExtensions("selectedChanged",{elems:o,selectedElement:W,multiselected:ra})});h.bind("transition",function(g,o){var v=h.getMode(),D=o[0];if(D){ra=o.length>=2&&o[1]!=
null?o:null;if(!ra)switch(v){case "rotate":v=h.getRotationAngle(D);a("#angle").val(Math.round(v));rotateCursor(v);a("#tool_reorient").toggleClass("disabled",v==0)}h.runExtensions("elementTransition",{elems:o})}});h.bind("changed",function(g,o){var v=h.getMode();v==="select"&&aa();for(var D=0;D<o.length;++D){var H=o[D];if(H&&H.tagName==="svg")w();else if(H&&V&&V.parentNode==null)V=H}b.show_save_warning=true;Aa();if(V&&v==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}h.runExtensions("elementChanged", null?o:null;if(!ra)switch(v){case "rotate":v=h.getRotationAngle(D);a("#angle").val(Math.round(v));rotateCursor(v);a("#tool_reorient").toggleClass("disabled",v==0)}h.runExtensions("elementTransition",{elems:o})}});h.bind("changed",function(g,o){var v=h.getMode();v==="select"&&ca();for(var D=0;D<o.length;++D){var H=o[D];if(H&&H.tagName==="svg")w();else if(H&&W&&W.parentNode==null)W=H}b.show_save_warning=true;Aa();if(W&&v==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}h.runExtensions("elementChanged",
{elems:o})});h.bind("saved",function(g,o){b.show_save_warning=false;o='<?xml version="1.0"?>\n'+o;var v=navigator.userAgent;if(~v.indexOf("Chrome")&&a.browser.version>=533||~v.indexOf("MSIE"))kb(0,true);else{var D=g.open("data:image/svg+xml;base64,"+O.encode64(o)),H=a.pref("save_notice_done");if(H!=="all"){var J=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(v.indexOf("Gecko/")!==-1)if(o.indexOf("<defs")!==-1){J+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done", {elems:o})});h.bind("saved",function(g,o){b.show_save_warning=false;o='<?xml version="1.0"?>\n'+o;var v=navigator.userAgent;if(~v.indexOf("Chrome")&&a.browser.version>=533||~v.indexOf("MSIE"))kb(0,true);else{var D=g.open("data:image/svg+xml;base64,"+O.encode64(o)),H=a.pref("save_notice_done");if(H!=="all"){var J=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(v.indexOf("Gecko/")!==-1)if(o.indexOf("<defs")!==-1){J+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done",
"all");H="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");H!=="part"&&D.alert(J)}}});h.bind("exported",function(g,o){var v=o.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=h.contentW;D.height=h.contentH;canvg(D,o.svg,{renderCallback:function(){var H=D.toDataURL("image/png");M.location.href=H;if(a.pref("export_notice_done")!=="all"){H=uiStrings.notification.saveFromBrowser.replace("%s", "all");H="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");H!=="part"&&D.alert(J)}}});h.bind("exported",function(g,o){var v=o.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=h.contentW;D.height=h.contentH;canvg(D,o.svg,{renderCallback:function(){var H=D.toDataURL("image/png");M.location.href=H;if(a.pref("export_notice_done")!=="all"){H=uiStrings.notification.saveFromBrowser.replace("%s",
"PNG");if(v.length)H+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+v.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(H)}}})});h.bind("zoomed",U);h.bind("contextset",function(g,o){var v="";if(o){var D="";v='<a href="#" data-root="y">'+h.getCurrentDrawing().getCurrentLayerName()+"</a>";a(o).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;v+=this!==o?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!o).html(v)}); "PNG");if(v.length)H+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+v.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(H)}}})});h.bind("zoomed",U);h.bind("contextset",function(g,o){var v="";if(o){var D="";v='<a href="#" data-root="y">'+h.getCurrentDrawing().getCurrentLayerName()+"</a>";a(o).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;v+=this!==o?' > <a href="#">'+this.id+"</a>":" > "+this.id}});ea=D}else ea=null;a("#cur_context_panel").toggle(!!o).html(v)});
h.bind("extension_added",function(g,o){function v(){if(Ea){clearTimeout(Ea);Ea=null}H||(Ea=setTimeout(function(){H=true;Kb(u.iconsize)},50))}var D=false,H=false,J=true,X=function(){if(o.callback&&!D&&J){D=true;o.callback()}},ca=[];o.context_tools&&a.each(o.context_tools,function(ta,ga){var Ta=ga.container_id?' id="'+ga.container_id+'"':"",Ha=a("#"+ga.panel);Ha.length||(Ha=a("<div>",{id:ga.panel}).appendTo("#tools_top").hide());switch(ga.type){case "tool_button":var sa='<div class="tool_button">'+ h.bind("extension_added",function(g,o){function v(){if(Ea){clearTimeout(Ea);Ea=null}H||(Ea=setTimeout(function(){H=true;Kb(u.iconsize)},50))}var D=false,H=false,J=true,X=function(){if(o.callback&&!D&&J){D=true;o.callback()}},da=[];o.context_tools&&a.each(o.context_tools,function(ta,ga){var Ta=ga.container_id?' id="'+ga.container_id+'"':"",Ha=a("#"+ga.panel);Ha.length||(Ha=a("<div>",{id:ga.panel}).appendTo("#tools_top").hide());switch(ga.type){case "tool_button":var sa='<div class="tool_button">'+
ga.id+"</div>",Ma=a(sa).appendTo(Ha);ga.events&&a.each(ga.events,function(Ua,bb){a(Ma).bind(Ua,bb)});break;case "select":sa="<label"+Ta+'><select id="'+ga.id+'">';a.each(ga.options,function(Ua,bb){sa+='<option value="'+Ua+'"'+(Ua==ga.defval?" selected":"")+">"+bb+"</option>"});sa+="</select></label>";var va=a(sa).appendTo(Ha).find("select");a.each(ga.events,function(Ua,bb){a(va).bind(Ua,bb)});break;case "button-select":sa='<div id="'+ga.id+'" class="dropdown toolset" title="'+ga.title+'"><div id="cur_'+ ga.id+"</div>",Ma=a(sa).appendTo(Ha);ga.events&&a.each(ga.events,function(Ua,bb){a(Ma).bind(Ua,bb)});break;case "select":sa="<label"+Ta+'><select id="'+ga.id+'">';a.each(ga.options,function(Ua,bb){sa+='<option value="'+Ua+'"'+(Ua==ga.defval?" selected":"")+">"+bb+"</option>"});sa+="</select></label>";var va=a(sa).appendTo(Ha).find("select");a.each(ga.events,function(Ua,bb){a(va).bind(Ua,bb)});break;case "button-select":sa='<div id="'+ga.id+'" class="dropdown toolset" title="'+ga.title+'"><div id="cur_'+
ga.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ga.id+'_opts"></ul>').appendTo("#option_lists");ga.colnum&&Ta.addClass("optcols"+ga.colnum);a(sa).appendTo(Ha).children();ca.push({elem:"#"+ga.id,list:"#"+ga.id+"_opts",title:ga.title,callback:ga.events.change,cur:"#cur_"+ga.id});break;case "input":sa="<label"+Ta+'><span id="'+ga.id+'_label">'+ga.label+':</span><input id="'+ga.id+'" title="'+ga.title+'" size="'+(ga.size||"4")+'" value="'+(ga.defval||"")+'" type="text"/></label>'; ga.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ga.id+'_opts"></ul>').appendTo("#option_lists");ga.colnum&&Ta.addClass("optcols"+ga.colnum);a(sa).appendTo(Ha).children();da.push({elem:"#"+ga.id,list:"#"+ga.id+"_opts",title:ga.title,callback:ga.events.change,cur:"#cur_"+ga.id});break;case "input":sa="<label"+Ta+'><span id="'+ga.id+'_label">'+ga.label+':</span><input id="'+ga.id+'" title="'+ga.title+'" size="'+(ga.size||"4")+'" value="'+(ga.defval||"")+'" type="text"/></label>';
var Za=a(sa).appendTo(Ha).find("input");ga.spindata&&Za.SpinButton(ga.spindata);ga.events&&a.each(ga.events,function(Ua,bb){Za.bind(Ua,bb)})}});if(o.buttons){var S={},W={},Z=o.svgicons,qa={};a.each(o.buttons,function(ta,ga){for(var Ta,Ha=ga.id,sa=ta;a("#"+Ha).length;)Ha=ga.id+"_"+ ++sa;if(Z){S[Ha]=ga.icon;sa=ga.svgicon?ga.svgicon:ga.id;if(ga.type=="app_menu")W["#"+Ha+" > div"]=sa;else W["#"+Ha]=sa}else Ta=ga.type=="menu"?"":a('<img src="'+ga.icon+'">');var Ma,va;switch(ga.type){case "mode_flyout":case "mode":Ma= var Za=a(sa).appendTo(Ha).find("input");ga.spindata&&Za.SpinButton(ga.spindata);ga.events&&a.each(ga.events,function(Ua,bb){Za.bind(Ua,bb)})}});if(o.buttons){var S={},V={},Z=o.svgicons,pa={};a.each(o.buttons,function(ta,ga){for(var Ta,Ha=ga.id,sa=ta;a("#"+Ha).length;)Ha=ga.id+"_"+ ++sa;if(Z){S[Ha]=ga.icon;sa=ga.svgicon?ga.svgicon:ga.id;if(ga.type=="app_menu")V["#"+Ha+" > div"]=sa;else V["#"+Ha]=sa}else Ta=ga.type=="menu"?"":a('<img src="'+ga.icon+'">');var Ma,va;switch(ga.type){case "mode_flyout":case "mode":Ma=
"tool_button";if(ga.cls)Ma+=" "+ga.cls;va="#tools_left";break;case "context":Ma="tool_button";va="#"+ga.panel;a(va).length||a("<div>",{id:ga.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";va="#"+(ga.after||ga.panel);break;case "app_menu":Ma="";va=ga.parent||"#main_menu ul";a(va).length||a("<div>",{id:ga.panel}).appendTo("#tools_top")}var Za=a(ga.list||ga.type=="app_menu"?"<li/>":"<div/>").attr("id",Ha).attr("title",ga.title).addClass(Ma);if(!ga.includeWith&&!ga.list){if("position"in "tool_button";if(ga.cls)Ma+=" "+ga.cls;va="#tools_left";break;case "context":Ma="tool_button";va="#"+ga.panel;a(va).length||a("<div>",{id:ga.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";va="#"+(ga.after||ga.panel);break;case "app_menu":Ma="";va=ga.parent||"#main_menu ul";a(va).length||a("<div>",{id:ga.panel}).appendTo("#tools_top")}var Za=a(ga.list||ga.type=="app_menu"?"<li/>":"<div/>").attr("id",Ha).attr("title",ga.title).addClass(Ma);if(!ga.includeWith&&!ga.list){if("position"in
ga)a(va).children().eq(ga.position).before(Za);else ga.type!="menu"||!ga.after?Za.appendTo(va):a(va).after(Za);if(ga.type=="mode_flyout"){sa=a(Za);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){var Ua=sa[0].id.replace("tool_","tools_"),bb=sa.clone().attr("id",Ua+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));sa.before(bb);Ma=la(Ua,sa);Ma.data("isLibrary",true);bb.data("isLibrary",true)}W["#"+Ua+"_show"]=ga.id;Ha=qa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,isDefault:true}, ga)a(va).children().eq(ga.position).before(Za);else ga.type!="menu"||!ga.after?Za.appendTo(va):a(va).after(Za);if(ga.type=="mode_flyout"){sa=a(Za);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){var Ua=sa[0].id.replace("tool_","tools_"),bb=sa.clone().attr("id",Ua+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));sa.before(bb);Ma=la(Ua,sa);Ma.data("isLibrary",true);bb.data("isLibrary",true)}V["#"+Ua+"_show"]=ga.id;Ha=pa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,isDefault:true},
Fb]}else if(ga.type=="app_menu"||ga.type=="menu")Za.append(ga.title)}else if(ga.list){Za.addClass("push_button");a("#"+ga.list+"_opts").append(Za);if(ga.isDefault){a("#cur_"+ga.list).append(Za.children().clone());sa=ga.svgicon?ga.svgicon:ga.id;W["#cur_"+ga.list]=sa}}else if(ga.includeWith){va=ga.includeWith;sa=a(va.button);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){Ua=sa[0].id.replace("tool_","tools_");bb=sa.clone().attr("id",Ua+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"})); Fb]}else if(ga.type=="app_menu"||ga.type=="menu")Za.append(ga.title)}else if(ga.list){Za.addClass("push_button");a("#"+ga.list+"_opts").append(Za);if(ga.isDefault){a("#cur_"+ga.list).append(Za.children().clone());sa=ga.svgicon?ga.svgicon:ga.id;V["#cur_"+ga.list]=sa}}else if(ga.includeWith){va=ga.includeWith;sa=a(va.button);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){Ua=sa[0].id.replace("tool_","tools_");bb=sa.clone().attr("id",Ua+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));
sa.before(bb);Ma=la(Ua,sa)}var Fb=B.getButtonData(va.button);if(va.isDefault)W["#"+Ua+"_show"]=ga.id;Ha=qa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,key:ga.key,isDefault:ga.includeWith?ga.includeWith.isDefault:0},Fb];Ua="position"in va?va.position:"last";Fb=Ma.children().length;if(!isNaN(Ua)&&Ua>=0&&Ua<Fb)Ma.children().eq(Ua).before(Za);else{Ma.append(Za);Ha.reverse()}}Z||Za.append(Ta);ga.list||a.each(ga.events,function(wb,Eb){if(wb=="click")if(ga.type=="mode"){ga.includeWith?Za.bind(wb, sa.before(bb);Ma=la(Ua,sa)}var Fb=B.getButtonData(va.button);if(va.isDefault)V["#"+Ua+"_show"]=ga.id;Ha=pa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,key:ga.key,isDefault:ga.includeWith?ga.includeWith.isDefault:0},Fb];Ua="position"in va?va.position:"last";Fb=Ma.children().length;if(!isNaN(Ua)&&Ua>=0&&Ua<Fb)Ma.children().eq(Ua).before(Za);else{Ma.append(Za);Ha.reverse()}}Z||Za.append(Ta);ga.list||a.each(ga.events,function(wb,Eb){if(wb=="click")if(ga.type=="mode"){ga.includeWith?Za.bind(wb,
Eb):Za.bind(wb,function(){Ya(Za)&&Eb()});if(ga.key){a(document).bind("keydown",ga.key,Eb);ga.title&&Za.attr("title",ga.title+" ["+ga.key+"]")}}else Za.bind(wb,Eb);else Za.bind(wb,Eb)});pa(qa)});a.each(ca,function(){Wa(this.elem,this.list,this.callback,{seticon:true})});if(Z)J=false;a.svgIcons(Z,{w:27,h:27,id_match:false,no_img:!C,fallback:S,placement:W,callback:function(){u.iconsize&&u.iconsize!="m"&&v();J=true;X()}})}X()});h.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>'; Eb):Za.bind(wb,function(){Ya(Za)&&Eb()});if(ga.key){a(document).bind("keydown",ga.key,Eb);ga.title&&Za.attr("title",ga.title+" ["+ga.key+"]")}}else Za.bind(wb,Eb);else Za.bind(wb,Eb)});oa(pa)});a.each(da,function(){Wa(this.elem,this.list,this.callback,{seticon:true})});if(Z)J=false;a.svgIcons(Z,{w:27,h:27,id_match:false,no_img:!C,fallback:S,placement:V,callback:function(){u.iconsize&&u.iconsize!="m"&&v();J=true;X()}})}X()});h.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';
a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(g,o){ya+='<div class="palette_item" style="background-color: '+o+';" data-rgb="'+o+'"></div>'});a("#palette").append(ya); a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(g,o){ya+='<div class="palette_item" style="background-color: '+o+';" data-rgb="'+o+'"></div>'});a("#palette").append(ya);
var Ga=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(g){g="rotate("+g+"deg)";Ga.css({"-webkit-transform":g,"-moz-transform":g,"-o-transform":g,"-ms-transform":g,transform:g})};var xa=function(g){var o=g.value/100;if(o<0.0010)g.value=0.1;else{g=h.getZoom();U(window,{width:0,height:0,x:(P[0].scrollLeft+P.width()/2)/g,y:(P[0].scrollTop+P.height()/2)/g,zoom:o},true)}},nb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){h.setStrokeAttr("stroke-dasharray", var Ga=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(g){g="rotate("+g+"deg)";Ga.css({"-webkit-transform":g,"-moz-transform":g,"-o-transform":g,"-ms-transform":g,transform:g})};var xa=function(g){var o=g.value/100;if(o<0.0010)g.value=0.1;else{g=h.getZoom();U(window,{width:0,height:0,x:(P[0].scrollLeft+P.width()/2)/g,y:(P[0].scrollTop+P.height()/2)/g,zoom:o},true)}},nb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){h.setStrokeAttr("stroke-dasharray",
a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);nb()});a("#seg_type").change(function(){h.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){h.setFontFamily(this.value)});a("#text").keyup(function(){h.setTextContent(this.value)});changeAttribute=function(g){var o=g.getAttribute("data-attr"),v=g.getAttribute("data-multiplier")||1;v=parseFloat(v); a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);nb()});a("#seg_type").change(function(){h.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){h.setFontFamily(this.value)});a("#text").keyup(function(){h.setTextContent(this.value)});changeAttribute=function(g){var o=g.getAttribute("data-attr"),v=g.getAttribute("data-multiplier")||1;v=parseFloat(v);
v=g.value*v;if(!svgedit.units.isValidUnit(o,v,V)){a.alert(uiStrings.notification.invalidAttrValGiven);g.value=V.getAttribute(o);return false}h.changeSelectedAttributeNoUndo(o,v)};a("#palette").mouseover(function(){var g=a('<input type="hidden">');a(this).append(g);g.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var g=a("#tool_stroke").hasClass("active"),o=g?"stroke":"fill",v=a(this).attr("data-rgb"),D=null;if(v==="transparent"||v==="initial"||v==="#none"){v= v=g.value*v;if(!svgedit.units.isValidUnit(o,v,W)){a.alert(uiStrings.notification.invalidAttrValGiven);g.value=W.getAttribute(o);return false}h.changeSelectedAttributeNoUndo(o,v)};a("#palette").mouseover(function(){var g=a('<input type="hidden">');a(this).append(g);g.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var g=a("#tool_stroke").hasClass("active"),o=g?"stroke":"fill",v=a(this).attr("data-rgb"),D=null;if(v==="transparent"||v==="initial"||v==="#none"){v=
"none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:v.substr(1)});b.paintBox[o].setPaint(D);if(g){h.setColor("stroke",v);v!="none"&&h.getStrokeOpacity()!=1&&h.setPaintOpacity("stroke",1)}else{h.setColor("fill",v);v!="none"&&h.getFillOpacity()!=1&&h.setPaintOpacity("fill",1)}}).bind("contextmenu",function(g){g.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");m()},function(){a(".stroke_tool").css("display", "none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:v.substr(1)});b.paintBox[o].setPaint(D);if(g){h.setColor("stroke",v);v!="none"&&h.getStrokeOpacity()!=1&&h.setPaintOpacity("stroke",1)}else{h.setColor("fill",v);v!="none"&&h.getFillOpacity()!=1&&h.setPaintOpacity("fill",1)}}).bind("contextmenu",function(g){g.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");m()},function(){a(".stroke_tool").css("display",
"none");a(this).removeClass("expanded");m()});var Ya=function(g,o){if(a(g).hasClass("disabled"))return false;if(a(g).parent().hasClass("tools_flyout"))return true;var v=v||"normal";o||a(".tools_flyout").fadeOut(v);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(g).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var g=null,o=null,v=P[0],D=false,H=false;a("#svgcanvas").bind("mousemove mouseup touchend", "none");a(this).removeClass("expanded");m()});var Ya=function(g,o){if(a(g).hasClass("disabled"))return false;if(a(g).parent().hasClass("tools_flyout"))return true;var v=v||"normal";o||a(".tools_flyout").fadeOut(v);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(g).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var g=null,o=null,v=P[0],D=false,H=false;a("#svgcanvas").bind("mousemove mouseup touchend",
function(J){if(D!==false){v.scrollLeft-=J.clientX-g;v.scrollTop-=J.clientY-o;g=J.clientX;o=J.clientY;if(J.type==="mouseup"||J.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(J){if(J.button===1||H===true||J.originalEvent.touches&&J.originalEvent.touches.length>=2){D=true;g=J.clientX;o=J.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(J){J.preventDefault();h.spaceKey=H=true}).bind("keyup", function(J){if(D!==false){v.scrollLeft-=J.clientX-g;v.scrollTop-=J.clientY-o;g=J.clientX;o=J.clientY;if(J.type==="mouseup"||J.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(J){if(J.button===1||H===true||J.originalEvent.touches&&J.originalEvent.touches.length>=2){D=true;g=J.clientX;o=J.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(J){J.preventDefault();h.spaceKey=H=true}).bind("keyup",
@ -437,63 +437,63 @@ function(J){if(D!==false){v.scrollLeft-=J.clientX-g;v.scrollTop-=J.clientY-o;g=J
""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(g){Sa(g)});a("svg, body").on("mousedown touchstart",function(g){if(g.target.nodeName.toLowerCase()!=="input")if(!a(g.target).hasClass("menu_title")&&!a(g.target).parent().hasClass("menu_title"))!a(g.target).hasClass("disabled")&&a(g.target).hasClass("menu_item")?Sa(g):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(g,o,v,D){if(g.altKey){g.preventDefault(); ""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(g){Sa(g)});a("svg, body").on("mousedown touchstart",function(g){if(g.target.nodeName.toLowerCase()!=="input")if(!a(g.target).hasClass("menu_title")&&!a(g.target).parent().hasClass("menu_title"))!a(g.target).hasClass("disabled")&&a(g.target).hasClass("menu_item")?Sa(g):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(g,o,v,D){if(g.altKey){g.preventDefault();
zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+D*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");fb.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){fb.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(g,o,v){if(a(g).length!=0){var D=a(g).find("button"),H=a(g).find("ul").attr("id",a(g)[0].id+"-list");v||a("#option_lists").append(H);var J=false;v&& zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+D*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");fb.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){fb.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(g,o,v){if(a(g).length!=0){var D=a(g).find("button"),H=a(g).find("ul").attr("id",a(g)[0].id+"-list");v||a("#option_lists").append(H);var J=false;v&&
a(g).addClass("dropup");H.find("li").bind("mouseup",o);a(window).mouseup(function(){if(!J){D.removeClass("down");H.hide()}J=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");H.hide()}else{D.addClass("down");if(!v){var X=a(g).offset();H.css({top:X.top,left:X.left-110})}H.show();J=true}}).hover(function(){J=true}).mouseout(function(){J=false})}};var Wa=function(g,o,v,D){var H=a(g);o=a(o);var J=false,X=D.dropUp;X&&a(g).addClass("dropup");o.find("li").bind("mouseup",function(){if(D.seticon){Ib("#cur_"+ a(g).addClass("dropup");H.find("li").bind("mouseup",o);a(window).mouseup(function(){if(!J){D.removeClass("down");H.hide()}J=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");H.hide()}else{D.addClass("down");if(!v){var X=a(g).offset();H.css({top:X.top,left:X.left-110})}H.show();J=true}}).hover(function(){J=true}).mouseout(function(){J=false})}};var Wa=function(g,o,v,D){var H=a(g);o=a(o);var J=false,X=D.dropUp;X&&a(g).addClass("dropup");o.find("li").bind("mouseup",function(){if(D.seticon){Ib("#cur_"+
H[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}v.apply(this,arguments)});a(window).mouseup(function(){if(!J){H.removeClass("down");o.hide();o.css({top:0,left:0})}J=false});o.height();a(g).bind("mousedown",function(){var ca=a(g).offset();if(X){ca.top-=o.height();ca.left+=8}else ca.top+=a(g).height();a(o).offset(ca);if(H.hasClass("down")){H.removeClass("down");o.hide();o.css({top:0,left:0})}else{H.addClass("down");o.show();J=true;return false}}).hover(function(){J= H[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}v.apply(this,arguments)});a(window).mouseup(function(){if(!J){H.removeClass("down");o.hide();o.css({top:0,left:0})}J=false});o.height();a(g).bind("mousedown",function(){var da=a(g).offset();if(X){da.top-=o.height();da.left+=8}else da.top+=a(g).height();a(o).offset(da);if(H.hasClass("down")){H.removeClass("down");o.hide();o.css({top:0,left:0})}else{H.addClass("down");o.show();J=true;return false}}).hover(function(){J=
true}).mouseout(function(){J=false});D.multiclick&&o.mousedown(function(){J=true})};a("#font_family_dropdown").change(function(){var g=this.options[this.selectedIndex].value,o=this.options[this.selectedIndex].text;a("#preview_font").html(o).css("font-family",g);a("#font_family").val(g).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var g=this.id.replace("tool_pos","").charAt(0);h.alignSelectedElements(g,"page")})});(function(){var g,o=function(){a(g).blur()}; true}).mouseout(function(){J=false});D.multiclick&&o.mousedown(function(){J=true})};a("#font_family_dropdown").change(function(){var g=this.options[this.selectedIndex].value,o=this.options[this.selectedIndex].text;a("#preview_font").html(o).css("font-family",g);a("#font_family").val(g).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var g=this.id.replace("tool_pos","").charAt(0);h.alignSelectedElements(g,"page")})});(function(){var g,o=function(){a(g).blur()};
a("#svg_editor").find("button, select, input:not(#text)").focus(function(){g=this;na="toolbars";P.mousedown(o)}).blur(function(){na="canvas";P.unbind("mousedown",o);h.getMode()=="textedit"&&a("#text").focus()})})();var Ca=function(){Ya("#tool_select")&&h.setMode("select")},wa=function(){Ya("#tool_fhpath")&&h.setMode("fhpath")},db=function(){Ya("#tool_line")&&h.setMode("line")},La=function(){Ya("#tool_rect")&&h.setMode("rect")},Ra=function(){Ya("#tool_ellipse")&&h.setMode("ellipse")},Da=function(){Ya("#tool_image")&& a("#svg_editor").find("button, select, input:not(#text)").focus(function(){g=this;qa="toolbars";P.mousedown(o)}).blur(function(){qa="canvas";P.unbind("mousedown",o);h.getMode()=="textedit"&&a("#text").focus()})})();var Ca=function(){Ya("#tool_select")&&h.setMode("select")},wa=function(){Ya("#tool_fhpath")&&h.setMode("fhpath")},db=function(){Ya("#tool_line")&&h.setMode("line")},La=function(){Ya("#tool_rect")&&h.setMode("rect")},Ra=function(){Ya("#tool_ellipse")&&h.setMode("ellipse")},Da=function(){Ya("#tool_image")&&
h.setMode("image")},gb=function(){Ya("#tool_zoom")&&h.setMode("zoom")},rb=function(){if(Ya("#tool_zoom")){Bb();aa()}},Xa=function(){Ya("#tool_text")&&h.setMode("text")},ab=function(){Ya("#tool_path")&&h.setMode("path")},xb=function(){if(V!=null||ra)h.deleteSelectedElements()},ua=function(){if(V!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cutSelectedElements()}},jb=function(){if(V!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.copySelectedElements()}},hb=function(){window.event.type=== h.setMode("image")},gb=function(){Ya("#tool_zoom")&&h.setMode("zoom")},rb=function(){if(Ya("#tool_zoom")){Bb();ca()}},Xa=function(){Ya("#tool_text")&&h.setMode("text")},ab=function(){Ya("#tool_path")&&h.setMode("path")},xb=function(){if(W!=null||ra)h.deleteSelectedElements()},ua=function(){if(W!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cutSelectedElements()}},jb=function(){if(W!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.copySelectedElements()}},hb=function(){window.event.type===
"keydown"&&mb(a("#edit_menu"));var g=h.getZoom(),o=(P[0].scrollLeft+P.width()/2)/g-h.contentW;g=(P[0].scrollTop+P.height()/2)/g-h.contentH;h.pasteElements("point",o,g)},ub=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToTopSelectedElement()}},lb=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToBottomSelectedElement()}},eb=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Up")}},sb= "keydown"&&mb(a("#edit_menu"));var g=h.getZoom(),o=(P[0].scrollLeft+P.width()/2)/g-h.contentW;g=(P[0].scrollTop+P.height()/2)/g-h.contentH;h.pasteElements("point",o,g)},ub=function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToTopSelectedElement()}},lb=function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToBottomSelectedElement()}},eb=function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Up")}},sb=
function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Down")}},ob=function(g){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected(g)}},yb=function(){if(V!=null){h.convertToPath();elems=h.getSelectedElems();h.selectorManager.requestSelector(elems[0]).reset(elems[0]);h.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");h.setMode("pathedit");L.toEditMode(elems[0]);h.clearSelection();Aa()}}, function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Down")}},ob=function(g){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected(g)}},yb=function(){if(W!=null){h.convertToPath();elems=h.getSelectedElems();h.selectorManager.requestSelector(elems[0]).reset(elems[0]);h.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");h.setMode("pathedit");L.toEditMode(elems[0]);h.clearSelection();Aa()}},
zb=function(){V!=null&&L.reorient()},ja=function(){if(V!=null||ra)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(g){g&&h.makeHyperlink(g)})},ba=function(g,o){if(V!=null||ra){if(curConfig.gridSnapping){var v=h.getZoom()*curConfig.snappingStep;g*=v;o*=v}a("input").blur();h.moveSelectedElements(g,o)}},ka=function(){var g=!a("#tool_node_link").hasClass("checked");g?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked", zb=function(){W!=null&&L.reorient()},ja=function(){if(W!=null||ra)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(g){g&&h.makeHyperlink(g)})},ba=function(g,o){if(W!=null||ra){if(curConfig.gridSnapping){var v=h.getZoom()*curConfig.snappingStep;g*=v;o*=v}a("input").blur();h.moveSelectedElements(g,o)}},ka=function(){var g=!a("#tool_node_link").hasClass("checked");g?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
false);L.linkControlPoints(g)},N=function(){L.getNodePoint()&&L.clonePathNode()},Q=function(){L.getNodePoint()&&L.deletePathNode()},ea=function(){var g=a("#tool_add_subpath"),o=!g.hasClass("push_button_pressed");o?g.addClass("push_button_pressed").removeClass("tool_button"):g.removeClass("push_button_pressed").addClass("tool_button");L.addSubPath(o)},Fa=function(){L.opencloseSubPath()},Oa=function(){h.cycleElement(1)},Va=function(){h.cycleElement(0)},$a=function(g,o){if(!(V==null||ra)){g||(o*=-1); false);L.linkControlPoints(g)},N=function(){L.getNodePoint()&&L.clonePathNode()},Q=function(){L.getNodePoint()&&L.deletePathNode()},fa=function(){var g=a("#tool_add_subpath"),o=!g.hasClass("push_button_pressed");o?g.addClass("push_button_pressed").removeClass("tool_button"):g.removeClass("push_button_pressed").addClass("tool_button");L.addSubPath(o)},Fa=function(){L.opencloseSubPath()},Oa=function(){h.cycleElement(1)},Va=function(){h.cycleElement(0)},$a=function(g,o){if(!(W==null||ra)){g||(o*=-1);
var v=a("#angle").val()*1+o;h.setRotationAngle(v);Aa()}},qb=function(){var g=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(o){if(o){aa();h.clear();h.setResolution(g[0],g[1]);w(true);Bb();Aa();Y();h.runExtensions("onNewDocument")}})},Qa=function(){h.setBold(!h.getBold());Aa()},pb=function(){h.setItalic(!h.getItalic());Aa()},Pa=function(){if(!c.pngsave){var g=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+g+"</title><h1>"+g+"</h1>")}window.canvg? var v=a("#angle").val()*1+o;h.setRotationAngle(v);Aa()}},qb=function(){var g=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(o){if(o){ca();h.clear();h.setResolution(g[0],g[1]);w(true);Bb();Aa();Y();h.runExtensions("onNewDocument")}})},Qa=function(){h.setBold(!h.getBold());Aa()},pb=function(){h.setItalic(!h.getItalic());Aa()},Pa=function(){if(!c.pngsave){var g=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+g+"</title><h1>"+g+"</h1>")}window.canvg?
h.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){h.rasterExport()})})},tb=function(){h.open()},vb=function(){},mb=function(g){var o=g.prev();o.css("background","#09f");setTimeout(function(){o.css("background","")},200)},Gb=function(){if(R.getUndoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.undo()}},cb=function(){if(R.getRedoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.redo()}},Ja=function(){if(ra)h.groupSelectedElements(); h.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){h.rasterExport()})})},tb=function(){h.open()},vb=function(){},mb=function(g){var o=g.prev();o.css("background","#09f");setTimeout(function(){o.css("background","")},200)},Gb=function(){if(R.getUndoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.undo()}},cb=function(){if(R.getRedoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.redo()}},Ja=function(){if(ra)h.groupSelectedElements();
else V&&h.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cloneSelectedElements(20,20)},Lb=function(){var g=this.id.replace("tool_align","").charAt(0);h.alignSelectedElements(g,a("#align_relative_to").val())},Jb=function(){var g=document.querySelector("#tool_stroke rect"),o=document.querySelector("#tool_fill rect"),v=o.getAttribute("fill"),D=g.getAttribute("fill");g=parseFloat(g.getAttribute("stroke-opacity"));if(isNaN(g))g=100;o=parseFloat(o.getAttribute("fill-opacity")); else W&&h.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cloneSelectedElements(20,20)},Lb=function(){var g=this.id.replace("tool_align","").charAt(0);h.alignSelectedElements(g,a("#align_relative_to").val())},Jb=function(){var g=document.querySelector("#tool_stroke rect"),o=document.querySelector("#tool_fill rect"),v=o.getAttribute("fill"),D=g.getAttribute("fill");g=parseFloat(g.getAttribute("stroke-opacity"));if(isNaN(g))g=100;o=parseFloat(o.getAttribute("fill-opacity"));
if(isNaN(o))o=100;D=Ia(D,g,"stroke");v=Ia(v,o,"fill");b.paintBox.fill.setPaint(D,true);b.paintBox.stroke.setPaint(v,true)},Bb=function(g){var o=h.getResolution();g=g?o.zoom*g:1;a("#zoom").val(g*100);h.setZoom(g);Ab();w(true)},Ob=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");P.toggleClass("wireframe");if(!z){var g=a("#wireframe_rules");g.length?g.empty():a('<style id="wireframe_rules"></style>').appendTo("head"); if(isNaN(o))o=100;D=Ia(D,g,"stroke");v=Ia(v,o,"fill");b.paintBox.fill.setPaint(D,true);b.paintBox.stroke.setPaint(v,true)},Bb=function(g){var o=h.getResolution();g=g?o.zoom*g:1;a("#zoom").val(g*100);h.setZoom(g);Ab();w(true)},Ob=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");P.toggleClass("wireframe");if(!z){var g=a("#wireframe_rules");g.length?g.empty():a('<style id="wireframe_rules"></style>').appendTo("head");
Ab()}},Db=function(){var g=!a("#tool_snap").hasClass("push_button_pressed");g?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=g},Hb=function(){window.self!=window.top&&top.exit_fullscreen()},Pb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed"); Ab()}},Db=function(){var g=!a("#tool_snap").hasClass("push_button_pressed");g?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=g},Hb=function(){window.self!=window.top&&top.exit_fullscreen()},Pb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");
a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},Ab=function(){if(!z){var g="#workarea.wireframe #svgcontent * { stroke-width: "+1/h.getZoom()+"px; }";a("#wireframe_rules").text(P.hasClass("wireframe")?g:"")}},kb=function(g,o){if(!ia){ia=true;a("#save_output_btns").toggle(!!o);a("#tool_source_back").toggle(!o);var v=fa=h.getSvgString();a("#svg_source_textarea").val(v);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}}, a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},Ab=function(){if(!z){var g="#workarea.wireframe #svgcontent * { stroke-width: "+1/h.getZoom()+"px; }";a("#wireframe_rules").text(P.hasClass("wireframe")?g:"")}},kb=function(g,o){if(!ia){ia=true;a("#save_output_btns").toggle(!!o);a("#tool_source_back").toggle(!o);var v=ha=h.getSvgString();a("#svg_source_textarea").val(v);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},
Mb=function(){if(ia){if(h.setSvgString(a("#svg_source_textarea").val())){h.clearSelection();k();Bb();Y()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(g){if(!g)return false;h.clearSelection();k();Bb();Y()});aa()}},Ib=b.setIcon=function(g,o){var v=typeof o==="string"?a.getSvgIcon(o,true):o.clone();v?a(g).find("img").replaceWith(v):console.log("NOTE: Icon image missing: "+o)},Cb;Cb=function(){var g=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,o=document.getElementsByTagName("script")[0], Mb=function(){if(ia){if(h.setSvgString(a("#svg_source_textarea").val())){h.clearSelection();k();Bb();Y()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(g){if(!g)return false;h.clearSelection();k();Bb();Y()});ca()}},Ib=b.setIcon=function(g,o){var v=typeof o==="string"?a.getSvgIcon(o,true):o.clone();v?a(g).find("img").replaceWith(v):console.log("NOTE: Icon image missing: "+o)},Cb;Cb=function(){var g=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,o=document.getElementsByTagName("script")[0],
v;for(v in o.style)if(g.test(v))return v.match(g)[0];if("WebkitOpacity"in o.style)return"Webkit";if("KhtmlOpacity"in o.style)return"Khtml";return""}();var ib=function(g,o){Cb.toLowerCase();var v=["top","left","bottom","right"];g.each(function(){for(var D=a(this),H=D.outerWidth()*(o-1),J=D.outerHeight()*(o-1),X=0;X<4;X++){var ca=v[X],S=D.data("orig_margin-"+ca);if(S==null){S=parseInt(D.css("margin-"+ca));D.data("orig_margin-"+ca,S)}S=S*o;if(ca==="right")S+=H;else if(ca==="bottom")S+=J;D.css("margin-"+ v;for(v in o.style)if(g.test(v))return v.match(g)[0];if("WebkitOpacity"in o.style)return"Webkit";if("KhtmlOpacity"in o.style)return"Khtml";return""}();var ib=function(g,o){Cb.toLowerCase();var v=["top","left","bottom","right"];g.each(function(){for(var D=a(this),H=D.outerWidth()*(o-1),J=D.outerHeight()*(o-1),X=0;X<4;X++){var da=v[X],S=D.data("orig_margin-"+da);if(S==null){S=parseInt(D.css("margin-"+da));D.data("orig_margin-"+da,S)}S=S*o;if(da==="right")S+=H;else if(da==="bottom")S+=J;D.css("margin-"+
ca,S)}})},Kb=b.setIconSize=function(g,o){if(!(g==u.size&&!o)){var v=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof g=="number"?g:{s:0.75,m:1,l:1.25,xl:1.5}[g];b.tool_scale=ha=D;ma();var H=v.parents(":hidden");H.css("visibility","hidden").show();ib(v,D);H.css("visibility","visible").hide();v=a("#tool_size_rules");if(v.length)v.empty(); da,S)}})},Kb=b.setIconSize=function(g,o){if(!(g==u.size&&!o)){var v=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof g=="number"?g:{s:0.75,m:1,l:1.25,xl:1.5}[g];b.tool_scale=aa=D;ma();var H=v.parents(":hidden");H.css("visibility","hidden").show();ib(v,D);H.css("visibility","visible").hide();v=a("#tool_size_rules");if(v.length)v.empty();
else v=a('<style id="tool_size_rules"></style>').appendTo("head");if(g!="m"){var J="";a.each(cssResizeRules,function(X,ca){X="#svg_editor "+X.replace(/,/g,", #svg_editor");J+=X+"{";a.each(ca,function(S,W){if(typeof W==="number")var Z=W*D+"px";else if(W[g]||W.all)Z=W[g]||W.all;J+=S+":"+Z+";"});J+="}"});H="-"+Cb.toLowerCase()+"-";J+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+ else v=a('<style id="tool_size_rules"></style>').appendTo("head");if(g!="m"){var J="";a.each(cssResizeRules,function(X,da){X="#svg_editor "+X.replace(/,/g,", #svg_editor");J+=X+"{";a.each(da,function(S,V){if(typeof V==="number")var Z=V*D+"px";else if(V[g]||V.all)Z=V[g]||V.all;J+=S+":"+Z+";"});J+="}"});H="-"+Cb.toLowerCase()+"-";J+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
H+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+H+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+H+"transform: scale("+1/D+");}";v.text(J)}ma()}},e=function(){a("#dialog_box").hide();if(ia){if(ia)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(g){g&&k()}):k();m()}else da&&h.leaveContext()},k=function(){a("#svg_source_editor").hide();ia=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height(); H+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+H+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+H+"transform: scale("+1/D+");}";v.text(J)}ma()}},e=function(){a("#dialog_box").hide();if(ia){if(ia)ha!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(g){g&&k()}):k();m()}else ea&&h.leaveContext()},k=function(){a("#svg_source_editor").hide();ia=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
var m=a.noop;a(window).resize(function(){w()});(function(){P.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=P[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=P[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var g=h.getHref(V);g=g.indexOf("data:")===0?"":g;a.prompt(uiStrings.notification.enterNewImgURL,g,function(o){o&&Na(o)})});var A=function(g){var o=g[0].id=="stroke_color"?"stroke": var m=a.noop;a(window).resize(function(){w()});(function(){P.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=P[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=P[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var g=h.getHref(W);g=g.indexOf("data:")===0?"":g;a.prompt(uiStrings.notification.enterNewImgURL,g,function(o){o&&Na(o)})});var A=function(g){var o=g[0].id=="stroke_color"?"stroke":
"fill",v=g[0].id=="canvas_color";if(v)o="canvas";var D=b.paintBox[o].paint;g=o=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";v=v?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(v).jGraduate({paint:D,window:{pickerTitle:g},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(H){D=new a.jGraduate.Paint(H);b.paintBox[o].setPaint(D); "fill",v=g[0].id=="canvas_color";if(v)o="canvas";var D=b.paintBox[o].paint;g=o=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";v=v?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(v).jGraduate({paint:D,window:{pickerTitle:g},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(H){D=new a.jGraduate.Paint(H);b.paintBox[o].setPaint(D);
h.setPaint(o,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};s=function(g,o){var v=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(o=="stroke")D=curConfig.initStroke;if(o=="fill")D=curConfig.initFill;if(o=="canvas"&&v)if(v=v.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(v[1],10).toString(16)).slice(-2)+("0"+parseInt(v[2],10).toString(16)).slice(-2)+("0"+parseInt(v[3],10).toString(16)).slice(-2),opacity:1};v=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+ h.setPaint(o,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};s=function(g,o){var v=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(o=="stroke")D=curConfig.initStroke;if(o=="fill")D=curConfig.initFill;if(o=="canvas"&&v)if(v=v.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(v[1],10).toString(16)).slice(-2)+("0"+parseInt(v[2],10).toString(16)).slice(-2)+("0"+parseInt(v[3],10).toString(16)).slice(-2),opacity:1};v=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;v=a(g)[0].appendChild(document.importNode(v,true));o==="canvas"?v.setAttribute("width",60.5):v.setAttribute("width","100%");this.rect=v.firstChild;this.defs=v.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=o;this.setPaint=function(H,J){this.paint=H;var X="none",ca=H.type,S=H.alpha/100;switch(ca){case "solidColor":X= D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;v=a(g)[0].appendChild(document.importNode(v,true));o==="canvas"?v.setAttribute("width",60.5):v.setAttribute("width","100%");this.rect=v.firstChild;this.defs=v.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=o;this.setPaint=function(H,J){this.paint=H;var X="none",da=H.type,S=H.alpha/100;switch(da){case "solidColor":X=
H[ca]=="none"||H[ca]=="one"?"none":"#"+H[ca];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(H[ca]);X="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",X);this.rect.setAttribute("opacity",S);if(J){h.setColor(this.type,X,true);h.setPaintOpacity(this.type,S,true)}if(this.type=="canvas")if(ca=document.getElementById("canvas_background")){za=h.getResolution();ca.setAttribute("x",-1);ca.setAttribute("y",-1); H[da]=="none"||H[da]=="one"?"none":"#"+H[da];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(H[da]);X="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",X);this.rect.setAttribute("opacity",S);if(J){h.setColor(this.type,X,true);h.setPaintOpacity(this.type,S,true)}if(this.type=="canvas")if(da=document.getElementById("canvas_background")){za=h.getResolution();da.setAttribute("x",-1);da.setAttribute("y",-1);
ca.setAttribute("width",za.w+2);ca.setAttribute("height",za.h+2);ca.setAttribute("fill",X)}else Ka(X)};this.update=function(H){if(V){var J=this.type;switch(V.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var X=null,ca=V.getElementsByTagName("*"),S=0,W=ca.length;S<W;S++){var Z=ca[S].getAttribute(J);if(S===0)X=Z;else if(X!==Z){X=null;break}}if(X===null){ca=null;return}ca=X;X=1;break;default:X=parseFloat(V.getAttribute(J+"-opacity"));if(isNaN(X))X=1;ca=J==="fill"? da.setAttribute("width",za.w+2);da.setAttribute("height",za.h+2);da.setAttribute("fill",X)}else Ka(X)};this.update=function(H){if(W){var J=this.type;switch(W.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var X=null,da=W.getElementsByTagName("*"),S=0,V=da.length;S<V;S++){var Z=da[S].getAttribute(J);if(S===0)X=Z;else if(X!==Z){X=null;break}}if(X===null){da=null;return}da=X;X=1;break;default:X=parseFloat(W.getAttribute(J+"-opacity"));if(isNaN(X))X=1;da=J==="fill"?
"black":"none";ca=V.getAttribute(J)||ca}if(H){h.setColor(J,ca,true);h.setPaintOpacity(J,X,true)}X*=100;this.setPaint(Ia(ca,X,J))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var H=new a.jGraduate.Paint({copy:this.paint});h.setPaint(o,H)}}};b.paintBox.fill=new s("#fill_color","fill");b.paintBox.stroke=new s("#stroke_color","stroke");b.paintBox.canvas=new s("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity* "black":"none";da=W.getAttribute(J)||da}if(H){h.setColor(J,da,true);h.setPaintOpacity(J,X,true)}X*=100;this.setPaint(Ia(da,X,J))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var H=new a.jGraduate.Paint({copy:this.paint});h.setPaint(o,H)}}};b.paintBox.fill=new s("#fill_color","fill");b.paintBox.stroke=new s("#stroke_color","stroke");b.paintBox.canvas=new s("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*
100);s=b.paintBox.fill.rect.cloneNode(false);s.setAttribute("style","vector-effect:non-scaling-stroke");var z=s.style.vectorEffect==="non-scaling-stroke";s.removeAttribute("style");s=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof s.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(s).remove();setTimeout(function(){h.embedImage("images/placeholder.svg",function(g){if(!g){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]); 100);s=b.paintBox.fill.rect.cloneNode(false);s.setAttribute("style","vector-effect:non-scaling-stroke");var z=s.style.vectorEffect==="non-scaling-stroke";s.removeAttribute("style");s=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof s.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(s).remove();setTimeout(function(){h.embedImage("images/placeholder.svg",function(g){if(!g){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);
u.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))A(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))A(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart", u.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))A(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))A(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",
function(){A(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");A(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");A(a("#fill_color"))});a("#zoom_select").on("change",function(){var g=this.options[this.selectedIndex].text;g=g.split("%")[0];a("#zoom").val(g).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")|| function(){A(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");A(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");A(a("#fill_color"))});a("#zoom_select").on("change",function(){var g=this.options[this.selectedIndex].text;g=g.split("%")[0];a("#zoom").val(g).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||
a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){P.css("line-height",P.height()+"px")});var G=function(){var g=a("#canvas_width"),o=a("#canvas_height"),v=g.val(),D=o.val();if(v!="fit"&&!svgedit.units.isValidUnit("width",v)){a.alert(uiStrings.notification.invalidAttrValGiven); a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){P.css("line-height",P.height()+"px")});var G=function(){var g=a("#canvas_width"),o=a("#canvas_height"),v=g.val(),D=o.val();if(v!="fit"&&!svgedit.units.isValidUnit("width",v)){a.alert(uiStrings.notification.invalidAttrValGiven);
g.parent().addClass("error");return false}g.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);o.parent().addClass("error");return false}o.parent().removeClass("error");if(!h.setResolution(v,D)){a.alert(uiStrings.notification.noContentToFitTo);v=h.getResolution();g.val(v.w);o.val(v.h);return false}w()};a("#resolution").change(function(){var g=a("#canvas_width")[0],o=a("#canvas_height")[0];if(this.selectedIndex)if(this.value== g.parent().addClass("error");return false}g.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);o.parent().addClass("error");return false}o.parent().removeClass("error");if(!h.setResolution(v,D)){a.alert(uiStrings.notification.noContentToFitTo);v=h.getResolution();g.val(v.w);o.val(v.h);return false}w()};a("#resolution").change(function(){var g=a("#canvas_width")[0],o=a("#canvas_height")[0];if(this.selectedIndex)if(this.value==
"content"){g.value="fit";o.value="fit";G();var v=h.getResolution();g.value=v.w;o.value=v.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var H=D[0]-g.value,J=D[1]-o.value,X=Date.now(),ca=function(S){S=(S-X)/1E3;S=Math.pow(S-1,3)+1;g.value=(D[0]-H+S*H).toFixed(0);o.value=(D[1]-J+S*J).toFixed(0);G();if(S>=1){S=h.getResolution();a("#canvas_width").val(S.w.toFixed());a("#canvas_height").val(S.h.toFixed());a("#resolution_label").html("<div class='pull'>"+S.w+"<span>\u00d7</span></br>"+ "content"){g.value="fit";o.value="fit";G();var v=h.getResolution();g.value=v.w;o.value=v.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var H=D[0]-g.value,J=D[1]-o.value,X=Date.now(),da=function(S){S=(S-X)/1E3;S=Math.pow(S-1,3)+1;g.value=(D[0]-H+S*H).toFixed(0);o.value=(D[1]-J+S*J).toFixed(0);G();if(S>=1){S=h.getResolution();a("#canvas_width").val(S.w.toFixed());a("#canvas_height").val(S.h.toFixed());a("#resolution_label").html("<div class='pull'>"+S.w+"<span>\u00d7</span></br>"+
S.h+"</div>")}else requestAnimationFrame(ca)};ca(Date.now())}else{a("#resolution_label").html("Custom");g.removeAttribute("readonly");g.focus();g.select();if(g.value=="fit"){g.value=100;o.value=100}}});a("#zoom").change(function(){xa(this)});a("input,select").attr("autocomplete","off");var B=function(){var g=[{sel:"#tool_select",fn:Ca,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:wa,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:db,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:La,evt:"click", S.h+"</div>")}else requestAnimationFrame(da)};da(Date.now())}else{a("#resolution_label").html("Custom");g.removeAttribute("readonly");g.focus();g.select();if(g.value=="fit"){g.value=100;o.value=100}}});a("#zoom").change(function(){xa(this)});a("input,select").attr("autocomplete","off");var B=function(){var g=[{sel:"#tool_select",fn:Ca,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:wa,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:db,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:La,evt:"click",
key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ra,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:ab,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Xa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Da,evt:"mouseup"},{sel:"#tool_zoom",fn:gb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:qb,evt:"mouseup",key:[p+"N",true]},{sel:"#tool_save",fn:function(){ia?Mb():h.save({images:u.img_save,round_digits:6})},evt:"mouseup",key:[p+"S",true]},{sel:"#tool_export",fn:Pa,evt:"mouseup"}, key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ra,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:ab,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Xa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Da,evt:"mouseup"},{sel:"#tool_zoom",fn:gb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:qb,evt:"mouseup",key:[p+"N",true]},{sel:"#tool_save",fn:function(){ia?Mb():h.save({images:u.img_save,round_digits:6})},evt:"mouseup",key:[p+"S",true]},{sel:"#tool_export",fn:Pa,evt:"mouseup"},
{sel:"#tool_open",fn:tb,evt:"mouseup"},{sel:"#tool_import",fn:vb,evt:"mouseup"},{sel:"#tool_source",fn:kb,evt:"click",key:[p+"U",true]},{sel:"#tool_wireframe",fn:Ob,evt:"click"},{sel:"#tool_snap",fn:Db,evt:"click"},{sel:"#tool_rulers",fn:Pb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:e,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Mb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:xb,evt:"click",key:["del/backspace", {sel:"#tool_open",fn:tb,evt:"mouseup"},{sel:"#tool_import",fn:vb,evt:"mouseup"},{sel:"#tool_source",fn:kb,evt:"click",key:[p+"U",true]},{sel:"#tool_wireframe",fn:Ob,evt:"click"},{sel:"#tool_snap",fn:Db,evt:"click"},{sel:"#tool_rulers",fn:Pb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:e,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Mb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:xb,evt:"click",key:["del/backspace",
true]},{sel:"#tool_reorient",fn:zb,evt:"click"},{sel:"#tool_node_link",fn:ka,evt:"click"},{sel:"#tool_node_clone",fn:N,evt:"click"},{sel:"#tool_node_delete",fn:Q,evt:"click"},{sel:"#tool_openclose_path",fn:Fa,evt:"click"},{sel:"#tool_add_subpath",fn:ea,evt:"click"},{sel:"#tool_move_top",fn:ub,evt:"click",key:p+"shift+up"},{sel:"#tool_move_bottom",fn:lb,evt:"click",key:p+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[p+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[p+"down",true]}, true]},{sel:"#tool_reorient",fn:zb,evt:"click"},{sel:"#tool_node_link",fn:ka,evt:"click"},{sel:"#tool_node_clone",fn:N,evt:"click"},{sel:"#tool_node_delete",fn:Q,evt:"click"},{sel:"#tool_openclose_path",fn:Fa,evt:"click"},{sel:"#tool_add_subpath",fn:fa,evt:"click"},{sel:"#tool_move_top",fn:ub,evt:"click",key:p+"shift+up"},{sel:"#tool_move_bottom",fn:lb,evt:"click",key:p+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[p+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[p+"down",true]},
{sel:"#tool_topath",fn:yb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ja,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[p+"D",true]},{sel:"#tool_group",fn:Ja,evt:"click",key:[p+"G",true]},{sel:"#tool_ungroup",fn:Ja,evt:"click",key:p+"shift+G"},{sel:"#tool_unlink_use",fn:Ja,evt:"click"},{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:Gb,evt:"click",key:p+"z"},{sel:"#tool_redo",fn:cb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:ua,evt:"click", {sel:"#tool_topath",fn:yb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ja,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[p+"D",true]},{sel:"#tool_group",fn:Ja,evt:"click",key:[p+"G",true]},{sel:"#tool_ungroup",fn:Ja,evt:"click",key:p+"shift+G"},{sel:"#tool_unlink_use",fn:Ja,evt:"click"},{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:Gb,evt:"click",key:p+"z"},{sel:"#tool_redo",fn:cb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:ua,evt:"click",
key:[p+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:p+"c"},{sel:"#tool_paste",fn:hb,evt:"click",key:p+"v"},{sel:"#tool_switch",fn:Jb,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Qa,evt:"mousedown",key:[p+"B",true]},{sel:"#tool_italic",fn:pb,evt:"mousedown",key:[p+"I",true]},{sel:"#copy_save_done",fn:e,evt:"click"},{key:"ctrl+left",fn:function(){$a(0,1)}},{key:"ctrl+right",fn:function(){$a(1,1)}},{key:"ctrl+shift+left",fn:function(){$a(0,5)}},{key:"ctrl+shift+right",fn:function(){$a(1,5)}}, key:[p+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:p+"c"},{sel:"#tool_paste",fn:hb,evt:"click",key:p+"v"},{sel:"#tool_switch",fn:Jb,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Qa,evt:"mousedown",key:[p+"B",true]},{sel:"#tool_italic",fn:pb,evt:"mousedown",key:[p+"I",true]},{sel:"#copy_save_done",fn:e,evt:"click"},{key:"ctrl+left",fn:function(){$a(0,1)}},{key:"ctrl+right",fn:function(){$a(1,1)}},{key:"ctrl+shift+left",fn:function(){$a(0,5)}},{key:"ctrl+shift+right",fn:function(){$a(1,5)}},
{key:"shift+O",fn:Va},{key:"shift+P",fn:Oa},{key:[p+"+",true],fn:function(){Bb(2)}},{key:[p+"-",true],fn:function(){Bb(0.5)}},{key:["up",true],fn:function(){ba(0,-1)}},{key:["down",true],fn:function(){ba(0,1)}},{key:["left",true],fn:function(){ba(-1,0)}},{key:["right",true],fn:function(){ba(1,0)}},{key:"shift+up",fn:function(){ba(0,-10)}},{key:"shift+down",fn:function(){ba(0,10)}},{key:"shift+left",fn:function(){ba(-10,0)}},{key:"shift+right",fn:function(){ba(10,0)}},{key:["alt+up",true],fn:function(){h.cloneSelectedElements(0, {key:"shift+O",fn:Va},{key:"shift+P",fn:Oa},{key:[p+"+",true],fn:function(){Bb(2)}},{key:[p+"-",true],fn:function(){Bb(0.5)}},{key:["up",true],fn:function(){ba(0,-1)}},{key:["down",true],fn:function(){ba(0,1)}},{key:["left",true],fn:function(){ba(-1,0)}},{key:["right",true],fn:function(){ba(1,0)}},{key:"shift+up",fn:function(){ba(0,-10)}},{key:"shift+down",fn:function(){ba(0,10)}},{key:"shift+left",fn:function(){ba(-10,0)}},{key:"shift+right",fn:function(){ba(10,0)}},{key:["alt+up",true],fn:function(){h.cloneSelectedElements(0,
-1)}},{key:["alt+down",true],fn:function(){h.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){h.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){h.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){h.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){h.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){h.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){h.cloneSelectedElements(10, -1)}},{key:["alt+down",true],fn:function(){h.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){h.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){h.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){h.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){h.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){h.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){h.cloneSelectedElements(10,
0)}},{key:p+"A",fn:function(){h.selectAllInCurrentLayer()}},{key:"I",fn:function(){var v=a(".tool_button_current");if(v.length&&v[0].id!=="tool_eyedropper"){v.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}h.setMode("eyedropper")}},{key:p+"shift+z",fn:cb},{key:"esc",fn:Hb}],o={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var v={};a.each(g,function(D,H){if(H.sel){var J= 0)}},{key:p+"A",fn:function(){h.selectAllInCurrentLayer()}},{key:"I",fn:function(){var v=a(".tool_button_current");if(v.length&&v[0].id!=="tool_eyedropper"){v.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}h.setMode("eyedropper")}},{key:p+"shift+z",fn:cb},{key:"esc",fn:Hb}],o={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var v={};a.each(g,function(D,H){if(H.sel){var J=
a(H.sel);if(J.length==0)return true;if(H.evt){if(svgedit.browser.isTouch()&&H.evt==="click")H.evt="mousedown";J[H.evt](H.fn)}if(H.parent&&a(H.parent+"_show").length!=0){var X=a(H.parent);X.length||(X=la(H.parent.substr(1)));X.append(J);a.isArray(v[H.parent])||(v[H.parent]=[]);v[H.parent].push(H)}}if(H.key){var ca=H.fn,S=false;if(a.isArray(H.key)){X=H.key[0];if(H.key.length>1)S=H.key[1]}else X=H.key;X+="";svgedit.browser.isMac&&X.indexOf("+")!=-1&&X.split("+")[0]=="ctrl"&&X.replace("ctrl","cmd");a.each(X.split("/"), a(H.sel);if(J.length==0)return true;if(H.evt){if(svgedit.browser.isTouch()&&H.evt==="click")H.evt="mousedown";J[H.evt](H.fn)}if(H.parent&&a(H.parent+"_show").length!=0){var X=a(H.parent);X.length||(X=la(H.parent.substr(1)));X.append(J);a.isArray(v[H.parent])||(v[H.parent]=[]);v[H.parent].push(H)}}if(H.key){var da=H.fn,S=false;if(a.isArray(H.key)){X=H.key[0];if(H.key.length>1)S=H.key[1]}else X=H.key;X+="";svgedit.browser.isMac&&X.indexOf("+")!=-1&&X.split("+")[0]=="ctrl"&&X.replace("ctrl","cmd");a.each(X.split("/"),
function(Z,qa){a(document).bind("keydown",qa,function(ta){ca();S&&ta.preventDefault();return false})});if(H.sel&&!H.hidekey&&J.attr("title")){var W=J.attr("title").split("[")[0]+" ("+X+")";o[X]=H.sel;J.parents("#main_menu").length||J.attr("title",W)}}});pa(v);a(window).bind("keydown","tab",function(D){if(na==="canvas"){D.preventDefault();Oa()}}).bind("keydown","shift+tab",function(D){if(na==="canvas"){D.preventDefault();Va()}});a("#tool_zoom").dblclick(rb)},setTitles:function(){a.each(o,function(v, function(Z,pa){a(document).bind("keydown",pa,function(ta){da();S&&ta.preventDefault();return false})});if(H.sel&&!H.hidekey&&J.attr("title")){var V=J.attr("title").split("[")[0]+" ("+X+")";o[X]=H.sel;J.parents("#main_menu").length||J.attr("title",V)}}});oa(v);a(window).bind("keydown","tab",function(D){if(qa==="canvas"){D.preventDefault();Oa()}}).bind("keydown","shift+tab",function(D){if(qa==="canvas"){D.preventDefault();Va()}});a("#tool_zoom").dblclick(rb)},setTitles:function(){a.each(o,function(v,
D){var H=a(D).parents("#main_menu").length;a(D).each(function(){var J=H?a(this).text().split(" [")[0]:this.title.split(" [")[0],X="";a.each(v.split("/"),function(ca,S){var W=S.split("+"),Z="";if(W.length>1){Z=W[0]+"+";S=W[1]}X+=(ca?"/":"")+Z+(uiStrings["key_"+S]||S)});if(H)this.lastChild.textContent=J+" ["+X+"]";else this.title=J+" ["+X+"]"})})},getButtonData:function(v){var D;a.each(g,function(H,J){if(J.sel===v)D=J});return D}}}();B.setAll();b.ready(function(){var g=curConfig.initTool,o=a("#tools_left, #svg_editor .tools_flyout"), D){var H=a(D).parents("#main_menu").length;a(D).each(function(){var J=H?a(this).text().split(" [")[0]:this.title.split(" [")[0],X="";a.each(v.split("/"),function(da,S){var V=S.split("+"),Z="";if(V.length>1){Z=V[0]+"+";S=V[1]}X+=(da?"/":"")+Z+(uiStrings["key_"+S]||S)});if(H)this.lastChild.textContent=J+" ["+X+"]";else this.title=J+" ["+X+"]"})})},getButtonData:function(v){var D;a.each(g,function(H,J){if(J.sel===v)D=J});return D}}}();B.setAll();b.ready(function(){var g=curConfig.initTool,o=a("#tools_left, #svg_editor .tools_flyout"),
v=o.find("#tool_"+g);g=o.find("#"+g);(v.length?v:g.length?g:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false}); v=o.find("#tool_"+g);g=o.find("#"+g);(v.length?v:g.length?g:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});
a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1, a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1,
callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null, callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute, max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,
cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null, cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,
step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null, step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(g){var o=g.value;if(o==0&&V&&["line","polyline"].indexOf(V.nodeName)>=0)o=g.value=1;h.setStrokeWidth(o)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(g){h.setRotationAngle(g.value);rotateCursor(g.value);a("#tool_reorient").toggleClass("disabled", max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(g){var o=g.value;if(o==0&&W&&["line","polyline"].indexOf(W.nodeName)>=0)o=g.value=1;h.setStrokeWidth(o)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(g){h.setRotationAngle(g.value);rotateCursor(g.value);a("#tool_reorient").toggleClass("disabled",
g.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(g){h.setFontSize(g.value)},cursor:true,stepfunc:function(g,o){var v=g.value-0,D=v+o,H=D>=v;if(o===0)return v;return v>=24?H?Math.round(v*1.1):Math.round(v/1.1):v<=1?H?v*2:v/2:D},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(g){val=g.value;a("#blur").val(val); g.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(g){h.setFontSize(g.value)},cursor:true,stepfunc:function(g,o){var v=g.value-0,D=v+o,H=D>=v;if(o===0)return v;return v>=24?H?Math.round(v*1.1):Math.round(v/1.1):v<=1?H?v*2:v/2:D},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(g){val=g.value;a("#blur").val(val);
h.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(h.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(g){switch(g){case "delete":xb();break;case "cut":ua();break;case "copy":jb();break;case "paste":h.pasteElements();break;case "paste_in_place":h.pasteElements("in_place");break;case "group":h.groupSelectedElements();break;case "ungroup":h.ungroupSelectedElement();break;case "move_front":ub();break;case "move_up":ob("Up");break;case "move_down":ob("Down");break; h.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(h.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(g){switch(g){case "delete":xb();break;case "cut":ua();break;case "copy":jb();break;case "paste":h.pasteElements();break;case "paste_in_place":h.pasteElements("in_place");break;case "group":h.groupSelectedElements();break;case "ungroup":h.ungroupSelectedElement();break;case "move_front":ub();break;case "move_up":ob("Up");break;case "move_down":ob("Down");break;
case "move_back":lb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(g)&&svgedit.contextmenu.getCustomHandler(g).call()}});a(".contextMenu li").mousedown(function(g){g.preventDefault()});a("#cmenu_canvas li").disableContextMenu();T.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(R.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(g){a("#main_menu").hide(); case "move_back":lb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(g)&&svgedit.contextmenu.getCustomHandler(g).call()}});a(".contextMenu li").mousedown(function(g){g.preventDefault()});a("#cmenu_canvas li").disableContextMenu();T.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(R.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(g){a("#main_menu").hide();
R.getUndoStackSize()===0?g(true):a.confirm(uiStrings.notification.QwantToOpen,g)};if(window.FileReader){s=a('<input type="file">').change(function(){var g=this;b.openPrep(function(o){if(o){h.clear();if(g.files.length==1){o=new FileReader;o.onloadend=function(v){q(v.target.result);w()};o.readAsText(g.files[0])}}})});a("#tool_open").show().prepend(s);s=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var g=new FileReader;g.onloadend=function(o){h.importSvgString(o.target.result, R.getUndoStackSize()===0?g(true):a.confirm(uiStrings.notification.QwantToOpen,g)};if(window.FileReader){s=a('<input type="file">').change(function(){var g=this;b.openPrep(function(o){if(o){h.clear();if(g.files.length==1){o=new FileReader;o.onloadend=function(v){q(v.target.result);w()};o.readAsText(g.files[0])}}})});a("#tool_open").show().prepend(s);s=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var g=new FileReader;g.onloadend=function(o){h.importSvgString(o.target.result,
true);w()};g.readAsText(this.files[0])}});a("#tool_import").show().prepend(s)}var w=b.updateCanvas=function(g,o){var v=P.width(),D=P.height(),H=v,J=D,X=h.getZoom(),ca=a("#svgcanvas"),S={x:P[0].scrollLeft+H/2,y:P[0].scrollTop+J/2},W=curConfig.canvas_expansion;v=Math.max(H,h.contentW*X*W);D=Math.max(J,h.contentH*X*W);v==H&&D==J?P.css("overflow","hidden"):P.css("overflow","scroll");W=ca.height()/2;var Z=ca.width()/2;ca.width(v).height(D);var qa=D/2,ta=v/2,ga=h.updateCanvas(v,D),Ta=ta/Z;v=v/2-H/2;D=D/ true);w()};g.readAsText(this.files[0])}});a("#tool_import").show().prepend(s)}var w=b.updateCanvas=function(g,o){var v=P.width(),D=P.height(),H=v,J=D,X=h.getZoom(),da=a("#svgcanvas"),S={x:P[0].scrollLeft+H/2,y:P[0].scrollTop+J/2},V=curConfig.canvas_expansion;v=Math.max(H,h.contentW*X*V);D=Math.max(J,h.contentH*X*V);v==H&&D==J?P.css("overflow","hidden"):P.css("overflow","scroll");V=da.height()/2;var Z=da.width()/2;da.width(v).height(D);var pa=D/2,ta=v/2,ga=h.updateCanvas(v,D),Ta=ta/Z;v=v/2-H/2;D=D/
2-J/2;if(o){o.x+=ga.x;o.y+=ga.y}else o={x:ta+(S.x-Z)*Ta,y:qa+(S.y-W)*Ta};if(g)if(h.contentW>P.width()){P[0].scrollLeft=ga.x-10;P[0].scrollTop=ga.y-10}else{P[0].scrollLeft=v;P[0].scrollTop=D}else{P[0].scrollLeft=o.x-H/2;P[0].scrollTop=o.y-J/2}if(curConfig.showRulers){l(ca,X);P.scroll()}},E=[];for(s=0.1;s<1E5;s*=10){E.push(1*s);E.push(2*s);E.push(5*s)}w(true);try{var I=function(g){if(window.JSON&&JSON.stringify)return JSON.stringify(g);var o=arguments.callee;if(typeof g=="boolean"||typeof g=="number")return g+ 2-J/2;if(o){o.x+=ga.x;o.y+=ga.y}else o={x:ta+(S.x-Z)*Ta,y:pa+(S.y-V)*Ta};if(g)if(h.contentW>P.width()){P[0].scrollLeft=ga.x-10;P[0].scrollTop=ga.y-10}else{P[0].scrollLeft=v;P[0].scrollTop=D}else{P[0].scrollLeft=o.x-H/2;P[0].scrollTop=o.y-J/2}if(curConfig.showRulers){l(da,X);P.scroll()}},E=[];for(s=0.1;s<1E5;s*=10){E.push(1*s);E.push(2*s);E.push(5*s)}w(true);try{var I=function(g){if(window.JSON&&JSON.stringify)return JSON.stringify(g);var o=arguments.callee;if(typeof g=="boolean"||typeof g=="number")return g+
"";else if(typeof g=="string")return'"'+g.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(H){return"\\u"+("0000"+H.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(g.length){for(var v=0;v<g.length;v++)g[v]=o(g[v]);return"["+g.join(",")+"]"}else{v=[];for(var D in g)v.push(o(D)+":"+o(g[D]));return"{"+v.join(",")+"}"}};window.addEventListener("message",function(g){var o=parseInt(g.data.substr(0,g.data.indexOf(";"))); "";else if(typeof g=="string")return'"'+g.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(H){return"\\u"+("0000"+H.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(g.length){for(var v=0;v<g.length;v++)g[v]=o(g[v]);return"["+g.join(",")+"]"}else{v=[];for(var D in g)v.push(o(D)+":"+o(g[D]));return"{"+v.join(",")+"}"}};window.addEventListener("message",function(g){var o=parseInt(g.data.substr(0,g.data.indexOf(";")));
try{g.source.postMessage("SVGe"+o+";"+I(eval(g.data)),"*")}catch(v){g.source.postMessage("SVGe"+o+";error:"+v.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=h;h.ready=svgEditor.ready});b.setLang=function(g,o){a.pref("lang",g);a("#lang_select").val(g);if(o){h.runExtensions("langChanged",g);Ba();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"}, try{g.source.postMessage("SVGe"+o+";"+I(eval(g.data)),"*")}catch(v){g.source.postMessage("SVGe"+o+";error:"+v.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=h;h.ready=svgEditor.ready});b.setLang=function(g,o){a.pref("lang",g);a("#lang_select").val(g);if(o){h.runExtensions("langChanged",g);Ba();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},
function(v,D){a(D).attr("title",a(v)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var f=[];b.ready=function(d){n?d():f.push(d)};b.runCallbacks=function(){a.each(f,function(){this()});n=true};b.loadFromString=function(d){b.ready(function(){q(d)})};b.loadFromURL=function(d,l){l||(l={});var s=l.cache,C=l.callback;b.ready(function(){a.ajax({url:d,dataType:"text",cache:!!s,success:function(p){q(p,C)},error:function(p, function(v,D){a(D).attr("title",a(v)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var f=[];b.ready=function(d){n?d():f.push(d)};b.runCallbacks=function(){a.each(f,function(){this()});n=true};b.loadFromString=function(d){b.ready(function(){q(d)})};b.loadFromURL=function(d,l){l||(l={});var s=l.cache,C=l.callback;b.ready(function(){a.ajax({url:d,dataType:"text",cache:!!s,success:function(p){q(p,C)},error:function(p,
@ -501,9 +501,9 @@ L,R){p.status!=404&&p.responseText?q(p.responseText,C):a.alert(uiStrings.notific
a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var q=this.dragCfg.dragAdjust,h=$(this).parent(),b=$(this),n=this.dragCfg.height,u=this.dragCfg.min,c=this.dragCfg.max,f=this.dragCfg.step,d=c-u>0?(c-u)/f:200,l=d/n*f,s=0,C=this.getAttribute("data-attr"),p=svgEditor.canvas,L=p.getSelectedElems(),R=svgedit.browser.isTouch(),O=true,K=d&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(h):false;b.attr("readonly","readonly");K&&!isNaN(this.dragCfg.start)&&K.css("top",this.dragCfg.start* a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var q=this.dragCfg.dragAdjust,h=$(this).parent(),b=$(this),n=this.dragCfg.height,u=this.dragCfg.min,c=this.dragCfg.max,f=this.dragCfg.step,d=c-u>0?(c-u)/f:200,l=d/n*f,s=0,C=this.getAttribute("data-attr"),p=svgEditor.canvas,L=p.getSelectedElems(),R=svgedit.browser.isTouch(),O=true,K=d&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(h):false;b.attr("readonly","readonly");K&&!isNaN(this.dragCfg.start)&&K.css("top",this.dragCfg.start*
-1/l+n);this.adjustValue=function(P,T){var M;P=parseFloat(P);if(isNaN(this.value))M=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){M=this.dragCfg.stepfunc(this,P);console.log(M)}else M=Number((Number(this.value)+Number(P)).toFixed(5));if(c!==null)M=Math.min(M,c);if(u!==null)M=Math.max(M,u);K&&this.updateCursor(M);this.value=M;h.attr("data-value",M);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,T)};h.toggleClass("draginput",h.is("label"));this.move=function(P,T,M){if(R)P= -1/l+n);this.adjustValue=function(P,T){var M;P=parseFloat(P);if(isNaN(this.value))M=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){M=this.dragCfg.stepfunc(this,P);console.log(M)}else M=Number((Number(this.value)+Number(P)).toFixed(5));if(c!==null)M=Math.min(M,c);if(u!==null)M=Math.max(M,u);K&&this.updateCursor(M);this.value=M;h.attr("data-value",M);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,T)};h.toggleClass("draginput",h.is("label"));this.move=function(P,T,M){if(R)P=
P.originalEvent.touches[0];if(s===0)s=T;T=(P.pageY-s)*-1;s=P.pageY;M=T*l*q;this.adjustValue(M.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");h.removeClass("active");O=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");s=0;if(L[0]){var P=p.undoMgr.finishUndoableChange();P.isEmpty()||p.undoMgr.addCommandToHistory(P)}this.adjustValue(0,O)};this.updateCursor=function(){var P=parseFloat(this.value)*-1/l+n;K.css("top",P)};this.start= P.originalEvent.touches[0];if(s===0)s=T;T=(P.pageY-s)*-1;s=P.pageY;M=T*l*q;this.adjustValue(M.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");h.removeClass("active");O=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");s=0;if(L[0]){var P=p.undoMgr.finishUndoableChange();P.isEmpty()||p.undoMgr.addCommandToHistory(P)}this.adjustValue(0,O)};this.updateCursor=function(){var P=parseFloat(this.value)*-1/l+n;K.css("top",P)};this.start=
function(P){if(R)P=P.originalEvent.touches[0];var T=P.pageY,M=this.value,ha=this;p.undoMgr.beginUndoableChange(C,L);$("body").addClass("dragging");h.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(na){ha.move(na,T,parseFloat(M))});$(window).bind("mouseup.draginput touchend.draginput",function(){ha.stop()})};$(this).attr("readonly","readonly").attr("data-scale",l).attr("data-domain",n).attr("data-cursor",K!=false).bind("mousedown touchstart",function(P){this.blur(); function(P){if(R)P=P.originalEvent.touches[0];var T=P.pageY,M=this.value,aa=this;p.undoMgr.beginUndoableChange(C,L);$("body").addClass("dragging");h.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(qa){aa.move(qa,T,parseFloat(M))});$(window).bind("mouseup.draginput touchend.draginput",function(){aa.stop()})};$(this).attr("readonly","readonly").attr("data-scale",l).attr("data-domain",n).attr("data-cursor",K!=false).bind("mousedown touchstart",function(P){this.blur();
this.start(P)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(P){switch(P.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(P,T,M,ha){O&&p.undoMgr.beginUndoableChange(C,L);O=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){na.stop()}, this.start(P)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(P){switch(P.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(P,T,M,aa){O&&p.undoMgr.beginUndoableChange(C,L);O=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){qa.stop()},
1E3);var na=this;if(ha>0)this.adjustValue(this.dragCfg.step);else ha<0&&this.adjustValue(-this.dragCfg.step);P.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),h=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/h+b+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=q};svgedit=svgedit||{}; 1E3);var qa=this;if(aa>0)this.adjustValue(this.dragCfg.step);else aa<0&&this.adjustValue(-this.dragCfg.step);P.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),h=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/h+b+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=q};svgedit=svgedit||{};
(function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var q=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("<li class='separator'>");var h=q.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+q.id+"'>"+q.label+"<span class='shortcut'>"+h+"</span></a></li>")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions= (function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var q=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("<li class='separator'>");var h=q.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+q.id+"'>"+q.label+"<span class='shortcut'>"+h+"</span></a></li>")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions=
{}};svgedit.contextmenu.add=function(q){if(q&&q.id&&q.label&&q.action&&typeof q.action=="function")if(q.id in a.contextMenuExtensions)console.error('Cannot add extension "'+q.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+q.id+", label:"+q.label+"}");a.contextMenuExtensions[q.id]=q}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler= {}};svgedit.contextmenu.add=function(q){if(q&&q.id&&q.label&&q.action&&typeof q.action=="function")if(q.id in a.contextMenuExtensions)console.error('Cannot add extension "'+q.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+q.id+", label:"+q.label+"}");a.contextMenuExtensions[q.id]=q}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler=
function(q){return a.contextMenuExtensions[q]&&true};svgedit.contextmenu.getCustomHandler=function(q){return a.contextMenuExtensions[q].action}})();(function(a,q){function h(n){return!a(n).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function b(n,u){var c=n.nodeName.toLowerCase();if("area"===c){c=n.parentNode;var f=c.name;if(!n.href||!f||c.nodeName.toLowerCase()!=="map")return false;c=a("img[usemap=#"+f+"]")[0];return!!c&&h(c)}return(/input|select|textarea|button|object/.test(c)?!n.disabled:"a"==c?n.href||u:u)&&h(n)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17", function(q){return a.contextMenuExtensions[q]&&true};svgedit.contextmenu.getCustomHandler=function(q){return a.contextMenuExtensions[q].action}})();(function(a,q){function h(n){return!a(n).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function b(n,u){var c=n.nodeName.toLowerCase();if("area"===c){c=n.parentNode;var f=c.name;if(!n.href||!f||c.nodeName.toLowerCase()!=="map")return false;c=a("img[usemap=#"+f+"]")[0];return!!c&&h(c)}return(/input|select|textarea|button|object/.test(c)?!n.disabled:"a"==c?n.href||u:u)&&h(n)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",
@ -580,73 +580,73 @@ this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui
return h=this._trimAlignValue(h)}h=this.options.values.slice();for(b=0;b<h.length;b+=1)h[b]=this._trimAlignValue(h[b]);return h},_trimAlignValue:function(q){if(q<=this._valueMin())return this._valueMin();if(q>=this._valueMax())return this._valueMax();var h=this.options.step>0?this.options.step:1,b=(q-this._valueMin())%h;q=q-b;Math.abs(b)*2>=h&&(q+=b>0?h:-h);return parseFloat(q.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var q= return h=this._trimAlignValue(h)}h=this.options.values.slice();for(b=0;b<h.length;b+=1)h[b]=this._trimAlignValue(h[b]);return h},_trimAlignValue:function(q){if(q<=this._valueMin())return this._valueMin();if(q>=this._valueMax())return this._valueMax();var h=this.options.step>0?this.options.step:1,b=(q-this._valueMin())%h;q=q-b;Math.abs(b)*2>=h&&(q+=b>0?h:-h);return parseFloat(q.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var q=
this.options.range,h=this.options,b=this,n=this._animateOff?false:h.animate,u,c={},f,d,l,s;this.options.values&&this.options.values.length?this.handles.each(function(C){u=(b.values(C)-b._valueMin())/(b._valueMax()-b._valueMin())*100;c[b.orientation==="horizontal"?"left":"bottom"]=u+"%";a(this).stop(1,1)[n?"animate":"css"](c,h.animate);b.options.range===true&&(b.orientation==="horizontal"?(C===0&&b.range.stop(1,1)[n?"animate":"css"]({left:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({width:u- this.options.range,h=this.options,b=this,n=this._animateOff?false:h.animate,u,c={},f,d,l,s;this.options.values&&this.options.values.length?this.handles.each(function(C){u=(b.values(C)-b._valueMin())/(b._valueMax()-b._valueMin())*100;c[b.orientation==="horizontal"?"left":"bottom"]=u+"%";a(this).stop(1,1)[n?"animate":"css"](c,h.animate);b.options.range===true&&(b.orientation==="horizontal"?(C===0&&b.range.stop(1,1)[n?"animate":"css"]({left:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({width:u-
f+"%"},{queue:false,duration:h.animate})):(C===0&&b.range.stop(1,1)[n?"animate":"css"]({bottom:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({height:u-f+"%"},{queue:false,duration:h.animate})));f=u}):(d=this.value(),l=this._valueMin(),s=this._valueMax(),u=s!==l?(d-l)/(s-l)*100:0,c[b.orientation==="horizontal"?"left":"bottom"]=u+"%",this.handle.stop(1,1)[n?"animate":"css"](c,h.animate),q==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[n?"animate":"css"]({width:u+"%"},h.animate), f+"%"},{queue:false,duration:h.animate})):(C===0&&b.range.stop(1,1)[n?"animate":"css"]({bottom:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({height:u-f+"%"},{queue:false,duration:h.animate})));f=u}):(d=this.value(),l=this._valueMin(),s=this._valueMax(),u=s!==l?(d-l)/(s-l)*100:0,c[b.orientation==="horizontal"?"left":"bottom"]=u+"%",this.handle.stop(1,1)[n?"animate":"css"](c,h.animate),q==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[n?"animate":"css"]({width:u+"%"},h.animate),
q==="max"&&this.orientation==="horizontal"&&this.range[n?"animate":"css"]({width:100-u+"%"},{queue:false,duration:h.animate}),q==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[n?"animate":"css"]({height:u+"%"},h.animate),q==="max"&&this.orientation==="vertical"&&this.range[n?"animate":"css"]({height:100-u+"%"},{queue:false,duration:h.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(c,f){if(f===undefined)f=0;return Math.round(c*Math.pow(10,f))/Math.pow(10,f)};var q=function(c,f){var d=this,l=c.find("img:first"),s=0,C=100,p=100,L=0,R=100,O=100,K=0,P=0,T,M,ha=[],na=function(U){for(var Y=0;Y<ha.length;Y++)ha[Y].call(d,d,U)},fa=function(U){var Y=c.offset();T={l:Y.left|0,t:Y.top|0};clearTimeout(M);M=setTimeout(function(){ra.call(d,U)},0);a(document).bind("mousemove",aa).bind("mouseup",V);U.preventDefault()},aa=function(U){clearTimeout(M);M=setTimeout(function(){ra.call(d, q==="max"&&this.orientation==="horizontal"&&this.range[n?"animate":"css"]({width:100-u+"%"},{queue:false,duration:h.animate}),q==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[n?"animate":"css"]({height:u+"%"},h.animate),q==="max"&&this.orientation==="vertical"&&this.range[n?"animate":"css"]({height:100-u+"%"},{queue:false,duration:h.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(c,f){if(f===undefined)f=0;return Math.round(c*Math.pow(10,f))/Math.pow(10,f)};var q=function(c,f){var d=this,l=c.find("img:first"),s=0,C=100,p=100,L=0,R=100,O=100,K=0,P=0,T,M,aa=[],qa=function(U){for(var Y=0;Y<aa.length;Y++)aa[Y].call(d,d,U)},ha=function(U){var Y=c.offset();T={l:Y.left|0,t:Y.top|0};clearTimeout(M);M=setTimeout(function(){ra.call(d,U)},0);a(document).bind("mousemove",ca).bind("mouseup",W);U.preventDefault()},ca=function(U){clearTimeout(M);M=setTimeout(function(){ra.call(d,
U)},0);U.stopPropagation();U.preventDefault();return false},V=function(U){a(document).unbind("mouseup",V).unbind("mousemove",aa);U.stopPropagation();U.preventDefault();return false},ra=function(U){var Y=U.pageX-T.l;U=U.pageY-T.t;var oa=c.w,pa=c.h;if(Y<0)Y=0;else if(Y>oa)Y=oa;if(U<0)U=0;else if(U>pa)U=pa;ia.call(d,"xy",{x:Y/oa*p+s,y:U/pa*O+L})},ia=function(U,Y,oa){if(Y===undefined){if(U===undefined||U==null)U="xy";switch(U.toLowerCase()){case "x":return K;case "y":return P;default:return{x:K,y:P}}}if(!(oa!= U)},0);U.stopPropagation();U.preventDefault();return false},W=function(U){a(document).unbind("mouseup",W).unbind("mousemove",ca);U.stopPropagation();U.preventDefault();return false},ra=function(U){var Y=U.pageX-T.l;U=U.pageY-T.t;var na=c.w,oa=c.h;if(Y<0)Y=0;else if(Y>na)Y=na;if(U<0)U=0;else if(U>oa)U=oa;ia.call(d,"xy",{x:Y/na*p+s,y:U/oa*O+L})},ia=function(U,Y,na){if(Y===undefined){if(U===undefined||U==null)U="xy";switch(U.toLowerCase()){case "x":return K;case "y":return P;default:return{x:K,y:P}}}if(!(na!=
null&&oa==d)){var pa=false,la,ma;if(U==null)U="xy";switch(U.toLowerCase()){case "x":la=Y&&(Y.x&&Y.x|0||Y|0)||0;break;case "y":ma=Y&&(Y.y&&Y.y|0||Y|0)||0;break;default:la=Y&&Y.x&&Y.x|0||0;ma=Y&&Y.y&&Y.y|0||0}if(la!=null){if(la<s)la=s;else if(la>C)la=C;if(K!=la){K=la;pa=true}}if(ma!=null){if(ma<L)ma=L;else if(ma>R)ma=R;if(P!=ma){P=ma;pa=true}}pa&&na.call(d,oa||d)}},da=function(U){a.isFunction(U)&&ha.push(U)};a.extend(true,d,{val:ia,range:function(U,Y){if(Y===undefined){if(U===undefined||U==null)U="all"; null&&na==d)){var oa=false,la,ma;if(U==null)U="xy";switch(U.toLowerCase()){case "x":la=Y&&(Y.x&&Y.x|0||Y|0)||0;break;case "y":ma=Y&&(Y.y&&Y.y|0||Y|0)||0;break;default:la=Y&&Y.x&&Y.x|0||0;ma=Y&&Y.y&&Y.y|0||0}if(la!=null){if(la<s)la=s;else if(la>C)la=C;if(K!=la){K=la;oa=true}}if(ma!=null){if(ma<L)ma=L;else if(ma>R)ma=R;if(P!=ma){P=ma;oa=true}}oa&&qa.call(d,na||d)}},ea=function(U){a.isFunction(U)&&aa.push(U)};a.extend(true,d,{val:ia,range:function(U,Y){if(Y===undefined){if(U===undefined||U==null)U="all";
switch(U.toLowerCase()){case "minx":return s;case "maxx":return C;case "rangex":return{minX:s,maxX:C,rangeX:p};case "miny":return L;case "maxy":return R;case "rangey":return{minY:L,maxY:R,rangeY:O};default:return{minX:s,maxX:C,rangeX:p,minY:L,maxY:R,rangeY:O}}}var oa,pa,la,ma;if(U==null)U="all";switch(U.toLowerCase()){case "minx":oa=Y&&(Y.minX&&Y.minX|0||Y|0)||0;break;case "maxx":pa=Y&&(Y.maxX&&Y.maxX|0||Y|0)||0;break;case "rangex":oa=Y&&Y.minX&&Y.minX|0||0;pa=Y&&Y.maxX&&Y.maxX|0||0;break;case "miny":la= switch(U.toLowerCase()){case "minx":return s;case "maxx":return C;case "rangex":return{minX:s,maxX:C,rangeX:p};case "miny":return L;case "maxy":return R;case "rangey":return{minY:L,maxY:R,rangeY:O};default:return{minX:s,maxX:C,rangeX:p,minY:L,maxY:R,rangeY:O}}}var na,oa,la,ma;if(U==null)U="all";switch(U.toLowerCase()){case "minx":na=Y&&(Y.minX&&Y.minX|0||Y|0)||0;break;case "maxx":oa=Y&&(Y.maxX&&Y.maxX|0||Y|0)||0;break;case "rangex":na=Y&&Y.minX&&Y.minX|0||0;oa=Y&&Y.maxX&&Y.maxX|0||0;break;case "miny":la=
Y&&(Y.minY&&Y.minY|0||Y|0)||0;break;case "maxy":ma=Y&&(Y.maxY&&Y.maxY|0||Y|0)||0;break;case "rangey":la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0;break;default:oa=Y&&Y.minX&&Y.minX|0||0;pa=Y&&Y.maxX&&Y.maxX|0||0;la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0}if(oa!=null&&s!=oa){s=oa;p=C-s}if(pa!=null&&C!=pa){C=pa;p=C-s}if(la!=null&&L!=la){L=la;O=R-L}if(ma!=null&&R!=ma){R=ma;O=R-L}},bind:da,unbind:function(U){if(a.isFunction(U))for(var Y;(Y=a.inArray(U,ha))!=-1;)ha.splice(Y,1)},destroy:function(){a(document).unbind("mouseup", Y&&(Y.minY&&Y.minY|0||Y|0)||0;break;case "maxy":ma=Y&&(Y.maxY&&Y.maxY|0||Y|0)||0;break;case "rangey":la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0;break;default:na=Y&&Y.minX&&Y.minX|0||0;oa=Y&&Y.maxX&&Y.maxX|0||0;la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0}if(na!=null&&s!=na){s=na;p=C-s}if(oa!=null&&C!=oa){C=oa;p=C-s}if(la!=null&&L!=la){L=la;O=R-L}if(ma!=null&&R!=ma){R=ma;O=R-L}},bind:ea,unbind:function(U){if(a.isFunction(U))for(var Y;(Y=a.inArray(U,aa))!=-1;)aa.splice(Y,1)},destroy:function(){a(document).unbind("mouseup",
V).unbind("mousemove",aa);c.unbind("mousedown",fa);ha=l=c=null}});l.src=f.arrow&&f.arrow.image;l.w=f.arrow&&f.arrow.width||l.width();l.h=f.arrow&&f.arrow.height||l.height();c.w=f.map&&f.map.width||c.width();c.h=f.map&&f.map.height||c.height();c.bind("mousedown",fa);da.call(d,function(){var U=0,Y=0,oa=c.w,pa=c.h,la=l.w,ma=l.h;setTimeout(function(){if(p>0)U=K==C?oa:K/p*oa|0;if(O>0)Y=P==R?pa:P/O*pa|0;if(la>=oa)U=(oa>>1)-(la>>1);else U-=la>>1;if(ma>=pa)Y=(pa>>1)-(ma>>1);else Y-=ma>>1;l.css({left:U+"px", W).unbind("mousemove",ca);c.unbind("mousedown",ha);aa=l=c=null}});l.src=f.arrow&&f.arrow.image;l.w=f.arrow&&f.arrow.width||l.width();l.h=f.arrow&&f.arrow.height||l.height();c.w=f.map&&f.map.width||c.width();c.h=f.map&&f.map.height||c.height();c.bind("mousedown",ha);ea.call(d,function(){var U=0,Y=0,na=c.w,oa=c.h,la=l.w,ma=l.h;setTimeout(function(){if(p>0)U=K==C?na:K/p*na|0;if(O>0)Y=P==R?oa:P/O*oa|0;if(la>=na)U=(na>>1)-(la>>1);else U-=la>>1;if(ma>=oa)Y=(oa>>1)-(ma>>1);else Y-=ma>>1;l.css({left:U+"px",
top:Y+"px"})},0)})},h=function(c,f,d,l){var s=this;c=c.find("td.Text input");var C=c.eq(3),p=c.eq(4),L=c.eq(5),R=c.length>7?c.eq(6):null,O=c.eq(0),K=c.eq(1),P=c.eq(2),T=c.eq(c.length>7?7:6),M=c.length>7?c.eq(8):null,ha=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!aa(ia))return ia;switch(ia.target){case C.get(0):switch(ia.keyCode){case 38:C.val(V.call(s,(C.val()<<0)+1,0,255));f.val("r",C.val(),ia.target);return false;case 40:C.val(V.call(s, top:Y+"px"})},0)})},h=function(c,f,d,l){var s=this;c=c.find("td.Text input");var C=c.eq(3),p=c.eq(4),L=c.eq(5),R=c.length>7?c.eq(6):null,O=c.eq(0),K=c.eq(1),P=c.eq(2),T=c.eq(c.length>7?7:6),M=c.length>7?c.eq(8):null,aa=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!ca(ia))return ia;switch(ia.target){case C.get(0):switch(ia.keyCode){case 38:C.val(W.call(s,(C.val()<<0)+1,0,255));f.val("r",C.val(),ia.target);return false;case 40:C.val(W.call(s,
(C.val()<<0)-1,0,255));f.val("r",C.val(),ia.target);return false}break;case p.get(0):switch(ia.keyCode){case 38:p.val(V.call(s,(p.val()<<0)+1,0,255));f.val("g",p.val(),ia.target);return false;case 40:p.val(V.call(s,(p.val()<<0)-1,0,255));f.val("g",p.val(),ia.target);return false}break;case L.get(0):switch(ia.keyCode){case 38:L.val(V.call(s,(L.val()<<0)+1,0,255));f.val("b",L.val(),ia.target);return false;case 40:L.val(V.call(s,(L.val()<<0)-1,0,255));f.val("b",L.val(),ia.target);return false}break; (C.val()<<0)-1,0,255));f.val("r",C.val(),ia.target);return false}break;case p.get(0):switch(ia.keyCode){case 38:p.val(W.call(s,(p.val()<<0)+1,0,255));f.val("g",p.val(),ia.target);return false;case 40:p.val(W.call(s,(p.val()<<0)-1,0,255));f.val("g",p.val(),ia.target);return false}break;case L.get(0):switch(ia.keyCode){case 38:L.val(W.call(s,(L.val()<<0)+1,0,255));f.val("b",L.val(),ia.target);return false;case 40:L.val(W.call(s,(L.val()<<0)-1,0,255));f.val("b",L.val(),ia.target);return false}break;
case R&&R.get(0):switch(ia.keyCode){case 38:R.val(V.call(s,parseFloat(R.val())+1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false;case 40:R.val(V.call(s,parseFloat(R.val())-1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false}break;case O.get(0):switch(ia.keyCode){case 38:O.val(V.call(s,(O.val()<<0)+1,0,360));f.val("h",O.val(),ia.target);return false;case 40:O.val(V.call(s,(O.val()<<0)-1,0,360));f.val("h",O.val(),ia.target);return false}break;case K.get(0):switch(ia.keyCode){case 38:K.val(V.call(s, case R&&R.get(0):switch(ia.keyCode){case 38:R.val(W.call(s,parseFloat(R.val())+1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false;case 40:R.val(W.call(s,parseFloat(R.val())-1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false}break;case O.get(0):switch(ia.keyCode){case 38:O.val(W.call(s,(O.val()<<0)+1,0,360));f.val("h",O.val(),ia.target);return false;case 40:O.val(W.call(s,(O.val()<<0)-1,0,360));f.val("h",O.val(),ia.target);return false}break;case K.get(0):switch(ia.keyCode){case 38:K.val(W.call(s,
(K.val()<<0)+1,0,100));f.val("s",K.val(),ia.target);return false;case 40:K.val(V.call(s,(K.val()<<0)-1,0,100));f.val("s",K.val(),ia.target);return false}break;case P.get(0):switch(ia.keyCode){case 38:P.val(V.call(s,(P.val()<<0)+1,0,100));f.val("v",P.val(),ia.target);return false;case 40:P.val(V.call(s,(P.val()<<0)-1,0,100));f.val("v",P.val(),ia.target);return false}}}},na=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!aa(ia))return ia;switch(ia.target){case C.get(0):C.val(V.call(s, (K.val()<<0)+1,0,100));f.val("s",K.val(),ia.target);return false;case 40:K.val(W.call(s,(K.val()<<0)-1,0,100));f.val("s",K.val(),ia.target);return false}break;case P.get(0):switch(ia.keyCode){case 38:P.val(W.call(s,(P.val()<<0)+1,0,100));f.val("v",P.val(),ia.target);return false;case 40:P.val(W.call(s,(P.val()<<0)-1,0,100));f.val("v",P.val(),ia.target);return false}}}},qa=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!ca(ia))return ia;switch(ia.target){case C.get(0):C.val(W.call(s,
C.val(),0,255));f.val("r",C.val(),ia.target);break;case p.get(0):p.val(V.call(s,p.val(),0,255));f.val("g",p.val(),ia.target);break;case L.get(0):L.val(V.call(s,L.val(),0,255));f.val("b",L.val(),ia.target);break;case R&&R.get(0):R.val(V.call(s,R.val(),0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);break;case O.get(0):O.val(V.call(s,O.val(),0,360));f.val("h",O.val(),ia.target);break;case K.get(0):K.val(V.call(s,K.val(),0,100));f.val("s",K.val(),ia.target);break;case P.get(0):P.val(V.call(s, C.val(),0,255));f.val("r",C.val(),ia.target);break;case p.get(0):p.val(W.call(s,p.val(),0,255));f.val("g",p.val(),ia.target);break;case L.get(0):L.val(W.call(s,L.val(),0,255));f.val("b",L.val(),ia.target);break;case R&&R.get(0):R.val(W.call(s,R.val(),0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);break;case O.get(0):O.val(W.call(s,O.val(),0,360));f.val("h",O.val(),ia.target);break;case K.get(0):K.val(W.call(s,K.val(),0,100));f.val("s",K.val(),ia.target);break;case P.get(0):P.val(W.call(s,
P.val(),0,100));f.val("v",P.val(),ia.target);break;case T.get(0):T.val(T.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));d&&d.val(T.val());f.val("hex",T.val()!=""?T.val():null,ia.target);break;case d&&d.get(0):d.val(d.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));T.val(d.val());f.val("hex",d.val()!=""?d.val():null,ia.target);break;case M&&M.get(0):M.val(M.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));f.val("a",M.val()!=null?parseInt(M.val(),16): P.val(),0,100));f.val("v",P.val(),ia.target);break;case T.get(0):T.val(T.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));d&&d.val(T.val());f.val("hex",T.val()!=""?T.val():null,ia.target);break;case d&&d.get(0):d.val(d.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));T.val(d.val());f.val("hex",d.val()!=""?d.val():null,ia.target);break;case M&&M.get(0):M.val(M.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));f.val("a",M.val()!=null?parseInt(M.val(),16):
null,ia.target)}}},fa=function(ia){if(f.val()!=null)switch(ia.target){case C.get(0):C.val(f.val("r"));break;case p.get(0):p.val(f.val("g"));break;case L.get(0):L.val(f.val("b"));break;case R&&R.get(0):R.val(Math.precision(f.val("a")*100/255,l));break;case O.get(0):O.val(f.val("h"));break;case K.get(0):K.val(f.val("s"));break;case P.get(0):P.val(f.val("v"));break;case T.get(0):case d&&d.get(0):T.val(f.val("hex"));d&&d.val(f.val("hex"));break;case M&&M.get(0):M.val(f.val("ahex").substring(6))}},aa= null,ia.target)}}},ha=function(ia){if(f.val()!=null)switch(ia.target){case C.get(0):C.val(f.val("r"));break;case p.get(0):p.val(f.val("g"));break;case L.get(0):L.val(f.val("b"));break;case R&&R.get(0):R.val(Math.precision(f.val("a")*100/255,l));break;case O.get(0):O.val(f.val("h"));break;case K.get(0):K.val(f.val("s"));break;case P.get(0):P.val(f.val("v"));break;case T.get(0):case d&&d.get(0):T.val(f.val("hex"));d&&d.val(f.val("hex"));break;case M&&M.get(0):M.val(f.val("ahex").substring(6))}},ca=
function(ia){switch(ia.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ia.ctrlKey)return false}return true},V=function(ia,da,U){if(ia==""||isNaN(ia))return da;if(ia>U)return U;if(ia<da)return da;return ia},ra=function(ia,da){var U=ia.val("all");if(da!=C.get(0))C.val(U!=null?U.r:"");if(da!=p.get(0))p.val(U!=null?U.g:"");if(da!=L.get(0))L.val(U!=null?U.b:"");if(R&&da!=R.get(0))R.val(U!=null?Math.precision(U.a*100/255,l):"");if(da!=O.get(0))O.val(U!= function(ia){switch(ia.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ia.ctrlKey)return false}return true},W=function(ia,ea,U){if(ia==""||isNaN(ia))return ea;if(ia>U)return U;if(ia<ea)return ea;return ia},ra=function(ia,ea){var U=ia.val("all");if(ea!=C.get(0))C.val(U!=null?U.r:"");if(ea!=p.get(0))p.val(U!=null?U.g:"");if(ea!=L.get(0))L.val(U!=null?U.b:"");if(R&&ea!=R.get(0))R.val(U!=null?Math.precision(U.a*100/255,l):"");if(ea!=O.get(0))O.val(U!=
null?U.h:"");if(da!=K.get(0))K.val(U!=null?U.s:"");if(da!=P.get(0))P.val(U!=null?U.v:"");if(da!=T.get(0)&&(d&&da!=d.get(0)||!d))T.val(U!=null?U.hex:"");if(d&&da!=d.get(0)&&da!=T.get(0))d.val(U!=null?U.hex:"");if(M&&da!=M.get(0))M.val(U!=null?U.ahex.substring(6):"")};a.extend(true,s,{destroy:function(){C.add(p).add(L).add(R).add(O).add(K).add(P).add(T).add(d).add(M).unbind("keyup",na).unbind("blur",fa);C.add(p).add(L).add(R).add(O).add(K).add(P).unbind("keydown",ha);f.unbind(ra);M=T=P=K=O=R=L=p=C= null?U.h:"");if(ea!=K.get(0))K.val(U!=null?U.s:"");if(ea!=P.get(0))P.val(U!=null?U.v:"");if(ea!=T.get(0)&&(d&&ea!=d.get(0)||!d))T.val(U!=null?U.hex:"");if(d&&ea!=d.get(0)&&ea!=T.get(0))d.val(U!=null?U.hex:"");if(M&&ea!=M.get(0))M.val(U!=null?U.ahex.substring(6):"")};a.extend(true,s,{destroy:function(){C.add(p).add(L).add(R).add(O).add(K).add(P).add(T).add(d).add(M).unbind("keyup",qa).unbind("blur",ha);C.add(p).add(L).add(R).add(O).add(K).add(P).unbind("keydown",aa);f.unbind(ra);M=T=P=K=O=R=L=p=C=
null}});C.add(p).add(L).add(R).add(O).add(K).add(P).add(T).add(d).add(M).bind("keyup",na).bind("blur",fa);C.add(p).add(L).add(R).add(O).add(K).add(P).bind("keydown",ha);f.bind(ra)};a.jPicker={List:[],Color:function(c){var f=this,d,l,s,C,p,L,R,O=[],K=function(T){for(var M=0;M<O.length;M++)O[M].call(f,f,T)},P=function(T,M,ha){if(M===undefined){if(T===undefined||T==null||T=="")T="all";if(d==null)return null;switch(T.toLowerCase()){case "ahex":return u.rgbaToHex({r:d,g:l,b:s,a:C});case "hex":return P("ahex").substring(0, null}});C.add(p).add(L).add(R).add(O).add(K).add(P).add(T).add(d).add(M).bind("keyup",qa).bind("blur",ha);C.add(p).add(L).add(R).add(O).add(K).add(P).bind("keydown",aa);f.bind(ra)};a.jPicker={List:[],Color:function(c){var f=this,d,l,s,C,p,L,R,O=[],K=function(T){for(var M=0;M<O.length;M++)O[M].call(f,f,T)},P=function(T,M,aa){if(M===undefined){if(T===undefined||T==null||T=="")T="all";if(d==null)return null;switch(T.toLowerCase()){case "ahex":return u.rgbaToHex({r:d,g:l,b:s,a:C});case "hex":return P("ahex").substring(0,
6);case "all":return{r:d,g:l,b:s,a:C,h:p,s:L,v:R,hex:P.call(f,"hex"),ahex:P.call(f,"ahex")};default:M={};for(var na=0;na<T.length;na++)switch(T.charAt(na)){case "r":if(T.length==1)M=d;else M.r=d;break;case "g":if(T.length==1)M=l;else M.g=l;break;case "b":if(T.length==1)M=s;else M.b=s;break;case "a":if(T.length==1)M=C;else M.a=C;break;case "h":if(T.length==1)M=p;else M.h=p;break;case "s":if(T.length==1)M=L;else M.s=L;break;case "v":if(T.length==1)M=R;else M.v=R}return M=={}?P.call(f,"all"):M}}if(!(ha!= 6);case "all":return{r:d,g:l,b:s,a:C,h:p,s:L,v:R,hex:P.call(f,"hex"),ahex:P.call(f,"ahex")};default:M={};for(var qa=0;qa<T.length;qa++)switch(T.charAt(qa)){case "r":if(T.length==1)M=d;else M.r=d;break;case "g":if(T.length==1)M=l;else M.g=l;break;case "b":if(T.length==1)M=s;else M.b=s;break;case "a":if(T.length==1)M=C;else M.a=C;break;case "h":if(T.length==1)M=p;else M.h=p;break;case "s":if(T.length==1)M=L;else M.s=L;break;case "v":if(T.length==1)M=R;else M.v=R}return M=={}?P.call(f,"all"):M}}if(!(aa!=
null&&ha==f)){var fa=false;if(T==null)T="";if(M==null){if(d!=null){d=null;fa=true}if(l!=null){l=null;fa=true}if(s!=null){s=null;fa=true}if(C!=null){C=null;fa=true}if(p!=null){p=null;fa=true}if(L!=null){L=null;fa=true}if(R!=null){R=null;fa=true}fa&&K.call(f,ha||f)}else switch(T.toLowerCase()){case "ahex":case "hex":M=u.hexToRgba(M&&(M.ahex||M.hex)||M||"00000000");P.call(f,"rgba",{r:M.r,g:M.g,b:M.b,a:T=="ahex"?M.a:C!=null?C:255},ha);break;default:if(M&&(M.ahex!=null||M.hex!=null)){P.call(f,"ahex",M.ahex|| null&&aa==f)){var ha=false;if(T==null)T="";if(M==null){if(d!=null){d=null;ha=true}if(l!=null){l=null;ha=true}if(s!=null){s=null;ha=true}if(C!=null){C=null;ha=true}if(p!=null){p=null;ha=true}if(L!=null){L=null;ha=true}if(R!=null){R=null;ha=true}ha&&K.call(f,aa||f)}else switch(T.toLowerCase()){case "ahex":case "hex":M=u.hexToRgba(M&&(M.ahex||M.hex)||M||"00000000");P.call(f,"rgba",{r:M.r,g:M.g,b:M.b,a:T=="ahex"?M.a:C!=null?C:255},aa);break;default:if(M&&(M.ahex!=null||M.hex!=null)){P.call(f,"ahex",M.ahex||
M.hex||"00000000",ha);break}var aa={},V=false,ra=false;if(M.r!==undefined&&!T.indexOf("r")==-1)T+="r";if(M.g!==undefined&&!T.indexOf("g")==-1)T+="g";if(M.b!==undefined&&!T.indexOf("b")==-1)T+="b";if(M.a!==undefined&&!T.indexOf("a")==-1)T+="a";if(M.h!==undefined&&!T.indexOf("h")==-1)T+="h";if(M.s!==undefined&&!T.indexOf("s")==-1)T+="s";if(M.v!==undefined&&!T.indexOf("v")==-1)T+="v";for(na=0;na<T.length;na++)switch(T.charAt(na)){case "r":if(ra)continue;V=true;aa.r=M&&M.r&&M.r|0||M&&M|0||0;if(aa.r<0)aa.r= M.hex||"00000000",aa);break}var ca={},W=false,ra=false;if(M.r!==undefined&&!T.indexOf("r")==-1)T+="r";if(M.g!==undefined&&!T.indexOf("g")==-1)T+="g";if(M.b!==undefined&&!T.indexOf("b")==-1)T+="b";if(M.a!==undefined&&!T.indexOf("a")==-1)T+="a";if(M.h!==undefined&&!T.indexOf("h")==-1)T+="h";if(M.s!==undefined&&!T.indexOf("s")==-1)T+="s";if(M.v!==undefined&&!T.indexOf("v")==-1)T+="v";for(qa=0;qa<T.length;qa++)switch(T.charAt(qa)){case "r":if(ra)continue;W=true;ca.r=M&&M.r&&M.r|0||M&&M|0||0;if(ca.r<0)ca.r=
0;else if(aa.r>255)aa.r=255;if(d!=aa.r){d=aa.r;fa=true}break;case "g":if(ra)continue;V=true;aa.g=M&&M.g&&M.g|0||M&&M|0||0;if(aa.g<0)aa.g=0;else if(aa.g>255)aa.g=255;if(l!=aa.g){l=aa.g;fa=true}break;case "b":if(ra)continue;V=true;aa.b=M&&M.b&&M.b|0||M&&M|0||0;if(aa.b<0)aa.b=0;else if(aa.b>255)aa.b=255;if(s!=aa.b){s=aa.b;fa=true}break;case "a":aa.a=M&&M.a!=null?M.a|0:M!=null?M|0:255;if(aa.a<0)aa.a=0;else if(aa.a>255)aa.a=255;if(C!=aa.a){C=aa.a;fa=true}break;case "h":if(V)continue;ra=true;aa.h=M&&M.h&& 0;else if(ca.r>255)ca.r=255;if(d!=ca.r){d=ca.r;ha=true}break;case "g":if(ra)continue;W=true;ca.g=M&&M.g&&M.g|0||M&&M|0||0;if(ca.g<0)ca.g=0;else if(ca.g>255)ca.g=255;if(l!=ca.g){l=ca.g;ha=true}break;case "b":if(ra)continue;W=true;ca.b=M&&M.b&&M.b|0||M&&M|0||0;if(ca.b<0)ca.b=0;else if(ca.b>255)ca.b=255;if(s!=ca.b){s=ca.b;ha=true}break;case "a":ca.a=M&&M.a!=null?M.a|0:M!=null?M|0:255;if(ca.a<0)ca.a=0;else if(ca.a>255)ca.a=255;if(C!=ca.a){C=ca.a;ha=true}break;case "h":if(W)continue;ra=true;ca.h=M&&M.h&&
M.h|0||M&&M|0||0;if(aa.h<0)aa.h=0;else if(aa.h>360)aa.h=360;if(p!=aa.h){p=aa.h;fa=true}break;case "s":if(V)continue;ra=true;aa.s=M&&M.s!=null?M.s|0:M!=null?M|0:100;if(aa.s<0)aa.s=0;else if(aa.s>100)aa.s=100;if(L!=aa.s){L=aa.s;fa=true}break;case "v":if(V)continue;ra=true;aa.v=M&&M.v!=null?M.v|0:M!=null?M|0:100;if(aa.v<0)aa.v=0;else if(aa.v>100)aa.v=100;if(R!=aa.v){R=aa.v;fa=true}}if(fa){if(V){d=d||0;l=l||0;s=s||0;M=u.rgbToHsv({r:d,g:l,b:s});p=M.h;L=M.s;R=M.v}else if(ra){p=p||0;L=L!=null?L:100;R=R!= M.h|0||M&&M|0||0;if(ca.h<0)ca.h=0;else if(ca.h>360)ca.h=360;if(p!=ca.h){p=ca.h;ha=true}break;case "s":if(W)continue;ra=true;ca.s=M&&M.s!=null?M.s|0:M!=null?M|0:100;if(ca.s<0)ca.s=0;else if(ca.s>100)ca.s=100;if(L!=ca.s){L=ca.s;ha=true}break;case "v":if(W)continue;ra=true;ca.v=M&&M.v!=null?M.v|0:M!=null?M|0:100;if(ca.v<0)ca.v=0;else if(ca.v>100)ca.v=100;if(R!=ca.v){R=ca.v;ha=true}}if(ha){if(W){d=d||0;l=l||0;s=s||0;M=u.rgbToHsv({r:d,g:l,b:s});p=M.h;L=M.s;R=M.v}else if(ra){p=p||0;L=L!=null?L:100;R=R!=
null?R:100;M=u.hsvToRgb({h:p,s:L,v:R});d=M.r;l=M.g;s=M.b}C=C!=null?C:255;K.call(f,ha||f)}}}};a.extend(true,f,{val:P,bind:function(T){a.isFunction(T)&&O.push(T)},unbind:function(T){if(a.isFunction(T))for(var M;(M=a.inArray(T,O))!=-1;)O.splice(M,1)},destroy:function(){O=null}});if(c)if(c.ahex!=null)P("ahex",c);else if(c.hex!=null)P((c.a!=null?"a":"")+"hex",c.a!=null?{ahex:c.hex+u.intToHex(c.a)}:c);else if(c.r!=null&&c.g!=null&&c.b!=null)P("rgb"+(c.a!=null?"a":""),c);else if(c.h!=null&&c.s!=null&&c.v!= null?R:100;M=u.hsvToRgb({h:p,s:L,v:R});d=M.r;l=M.g;s=M.b}C=C!=null?C:255;K.call(f,aa||f)}}}};a.extend(true,f,{val:P,bind:function(T){a.isFunction(T)&&O.push(T)},unbind:function(T){if(a.isFunction(T))for(var M;(M=a.inArray(T,O))!=-1;)O.splice(M,1)},destroy:function(){O=null}});if(c)if(c.ahex!=null)P("ahex",c);else if(c.hex!=null)P((c.a!=null?"a":"")+"hex",c.a!=null?{ahex:c.hex+u.intToHex(c.a)}:c);else if(c.r!=null&&c.g!=null&&c.b!=null)P("rgb"+(c.a!=null?"a":""),c);else if(c.h!=null&&c.s!=null&&c.v!=
null)P("hsv"+(c.a!=null?"a":""),c)},ColorMethods:{hexToRgba:function(c){c=this.validateHex(c);if(c=="")return{r:null,g:null,b:null,a:null};var f="00",d="00",l="00",s="255";if(c.length==6)c+="ff";if(c.length>6){f=c.substring(0,2);d=c.substring(2,4);l=c.substring(4,6);s=c.substring(6,c.length)}else{if(c.length>4){f=c.substring(4,c.length);c=c.substring(0,4)}if(c.length>2){d=c.substring(2,c.length);c=c.substring(0,2)}if(c.length>0)l=c.substring(0,c.length)}return{r:this.hexToInt(f),g:this.hexToInt(d), null)P("hsv"+(c.a!=null?"a":""),c)},ColorMethods:{hexToRgba:function(c){c=this.validateHex(c);if(c=="")return{r:null,g:null,b:null,a:null};var f="00",d="00",l="00",s="255";if(c.length==6)c+="ff";if(c.length>6){f=c.substring(0,2);d=c.substring(2,4);l=c.substring(4,6);s=c.substring(6,c.length)}else{if(c.length>4){f=c.substring(4,c.length);c=c.substring(0,4)}if(c.length>2){d=c.substring(2,c.length);c=c.substring(0,2)}if(c.length>0)l=c.substring(0,c.length)}return{r:this.hexToInt(f),g:this.hexToInt(d),
b:this.hexToInt(l),a:this.hexToInt(s)}},validateHex:function(c){if(typeof c=="object")return"";c=c.toLowerCase().replace(/[^a-f0-9]/g,"");if(c.length>8)c=c.substring(0,8);return c},rgbaToHex:function(c){return this.intToHex(c.r)+this.intToHex(c.g)+this.intToHex(c.b)+this.intToHex(c.a)},intToHex:function(c){c=(c|0).toString(16);if(c.length==1)c="0"+c;return c.toLowerCase()},hexToInt:function(c){return parseInt(c,16)},rgbToHsv:function(c){var f=c.r/255,d=c.g/255;c=c.b/255;var l={h:0,s:0,v:0},s=0,C= b:this.hexToInt(l),a:this.hexToInt(s)}},validateHex:function(c){if(typeof c=="object")return"";c=c.toLowerCase().replace(/[^a-f0-9]/g,"");if(c.length>8)c=c.substring(0,8);return c},rgbaToHex:function(c){return this.intToHex(c.r)+this.intToHex(c.g)+this.intToHex(c.b)+this.intToHex(c.a)},intToHex:function(c){c=(c|0).toString(16);if(c.length==1)c="0"+c;return c.toLowerCase()},hexToInt:function(c){return parseInt(c,16)},rgbToHsv:function(c){var f=c.r/255,d=c.g/255;c=c.b/255;var l={h:0,s:0,v:0},s=0,C=
0;if(f>=d&&f>=c){C=f;s=d>c?c:d}else if(d>=c&&d>=f){C=d;s=f>c?c:f}else{C=c;s=d>f?f:d}l.v=C;l.s=C?(C-s)/C:0;if(l.s){s=C-s;l.h=f==C?(d-c)/s:d==C?2+(c-f)/s:4+(f-d)/s;l.h=parseInt(l.h*60);if(l.h<0)l.h+=360}else l.h=0;l.s=l.s*100|0;l.v=l.v*100|0;return l},hsvToRgb:function(c){var f={r:0,g:0,b:0,a:100},d=c.h,l=c.s;c=c.v;if(l==0)f.r=c==0?f.g=f.b=0:f.g=f.b=c*255/100|0;else{if(d==360)d=0;d/=60;l/=100;c/=100;var s=d|0,C=d-s;d=c*(1-l);var p=c*(1-l*C);l=c*(1-l*(1-C));switch(s){case 0:f.r=c;f.g=l;f.b=d;break;case 1:f.r= 0;if(f>=d&&f>=c){C=f;s=d>c?c:d}else if(d>=c&&d>=f){C=d;s=f>c?c:f}else{C=c;s=d>f?f:d}l.v=C;l.s=C?(C-s)/C:0;if(l.s){s=C-s;l.h=f==C?(d-c)/s:d==C?2+(c-f)/s:4+(f-d)/s;l.h=parseInt(l.h*60);if(l.h<0)l.h+=360}else l.h=0;l.s=l.s*100|0;l.v=l.v*100|0;return l},hsvToRgb:function(c){var f={r:0,g:0,b:0,a:100},d=c.h,l=c.s;c=c.v;if(l==0)f.r=c==0?f.g=f.b=0:f.g=f.b=c*255/100|0;else{if(d==360)d=0;d/=60;l/=100;c/=100;var s=d|0,C=d-s;d=c*(1-l);var p=c*(1-l*C);l=c*(1-l*(1-C));switch(s){case 0:f.r=c;f.g=l;f.b=d;break;case 1:f.r=
p;f.g=c;f.b=d;break;case 2:f.r=d;f.g=c;f.b=l;break;case 3:f.r=d;f.g=p;f.b=c;break;case 4:f.r=l;f.g=d;f.b=c;break;case 5:f.r=c;f.g=d;f.b=p}f.r=f.r*255|0;f.g=f.g*255|0;f.b=f.b*255|0}return f}}};var b=a.jPicker.Color,n=a.jPicker.List,u=a.jPicker.ColorMethods;a.fn.jPicker=function(c){var f=arguments;return this.each(function(){var d=this,l=a.extend(true,{},a.fn.jPicker.defaults,c);if(a(d).get(0).nodeName.toLowerCase()=="input"){a.extend(true,l,{window:{bindToInput:true,expandable:true,input:a(d)}});if(a(d).val()== p;f.g=c;f.b=d;break;case 2:f.r=d;f.g=c;f.b=l;break;case 3:f.r=d;f.g=p;f.b=c;break;case 4:f.r=l;f.g=d;f.b=c;break;case 5:f.r=c;f.g=d;f.b=p}f.r=f.r*255|0;f.g=f.g*255|0;f.b=f.b*255|0}return f}}};var b=a.jPicker.Color,n=a.jPicker.List,u=a.jPicker.ColorMethods;a.fn.jPicker=function(c){var f=arguments;return this.each(function(){var d=this,l=a.extend(true,{},a.fn.jPicker.defaults,c);if(a(d).get(0).nodeName.toLowerCase()=="input"){a.extend(true,l,{window:{bindToInput:true,expandable:true,input:a(d)}});if(a(d).val()==
""){l.color.active=new b({hex:null});l.color.current=new b({hex:null})}else if(u.validateHex(a(d).val())){l.color.active=new b({hex:a(d).val(),a:l.color.active.val("a")});l.color.current=new b({hex:a(d).val(),a:l.color.active.val("a")})}}if(l.window.expandable)a(d).after('<span class="jPicker"><span class="Icon"><span class="Color">&nbsp;</span><span class="Alpha">&nbsp;</span><span class="Image" title="Click To Open Color Picker">&nbsp;</span><span class="Container">&nbsp;</span></span></span>'); ""){l.color.active=new b({hex:null});l.color.current=new b({hex:null})}else if(u.validateHex(a(d).val())){l.color.active=new b({hex:a(d).val(),a:l.color.active.val("a")});l.color.current=new b({hex:a(d).val(),a:l.color.active.val("a")})}}if(l.window.expandable)a(d).after('<span class="jPicker"><span class="Icon"><span class="Color">&nbsp;</span><span class="Alpha">&nbsp;</span><span class="Image" title="Click To Open Color Picker">&nbsp;</span><span class="Container">&nbsp;</span></span></span>');
else l.window.liveUpdate=false;var s=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,C=null,p=null,L=null,R=null,O=null,K=null,P=null,T=null,M=null,ha=null,na=null,fa=null,aa=null,V=null,ra=null,ia=null,da=null,U=null,Y=null,oa=null,pa=null,la=null,ma=null,Ba=null,Ea=null,Ia=null,za=null,Ka=null,Na=function(N){var Q=ka.active,ea=Q.val("hex"),Fa,Oa;l.color.mode=N;switch(N){case "h":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,0);wa.call(d,R,100);Ca.call(d, else l.window.liveUpdate=false;var s=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,C=null,p=null,L=null,R=null,O=null,K=null,P=null,T=null,M=null,aa=null,qa=null,ha=null,ca=null,W=null,ra=null,ia=null,ea=null,U=null,Y=null,na=null,oa=null,la=null,ma=null,Ba=null,Ea=null,Ia=null,za=null,Ka=null,Na=function(N){var Q=ka.active,fa=Q.val("hex"),Fa,Oa;l.color.mode=N;switch(N){case "h":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,0);wa.call(d,R,100);Ca.call(d,
O,260);wa.call(d,O,100);Sa.call(d,L,"transparent");Ca.call(d,P,0);wa.call(d,P,100);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,ha,260);wa.call(d,ha,100);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:100,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:360});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("s"),y:100-Q.val("v")},aa);V.val("y",360-Q.val("h"),V);break;case "s":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d, O,260);wa.call(d,O,100);Sa.call(d,L,"transparent");Ca.call(d,P,0);wa.call(d,P,100);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,aa,260);wa.call(d,aa,100);Ca.call(d,ha,260);wa.call(d,ha,100)},0);ca.range("all",{minX:0,maxX:100,minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:360});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("s"),y:100-Q.val("v")},ca);W.val("y",360-Q.val("h"),W);break;case "s":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d,
O,-520);Ca.call(d,P,-260);Ca.call(d,T,-520);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:360,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("v")},aa);V.val("y",100-Q.val("s"),V);break;case "v":setTimeout(function(){Sa.call(d,p,"000000");Ca.call(d,R,-780);Ca.call(d,O,260);Sa.call(d,L,ea);Ca.call(d,P,-520);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:360, O,-520);Ca.call(d,P,-260);Ca.call(d,T,-520);Ca.call(d,ha,260);wa.call(d,ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("h"),y:100-Q.val("v")},ca);W.val("y",100-Q.val("s"),W);break;case "v":setTimeout(function(){Sa.call(d,p,"000000");Ca.call(d,R,-780);Ca.call(d,O,260);Sa.call(d,L,fa);Ca.call(d,P,-520);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,ha,260);wa.call(d,ha,100)},0);ca.range("all",{minX:0,maxX:360,
minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("s")},aa);V.val("y",100-Q.val("v"),V);break;case "r":Fa=-1040;Oa=-780;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("b"),y:255-Q.val("g")},aa);V.val("y",255-Q.val("r"),V);break;case "g":Fa=-1560;Oa=-1820;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255}); minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("h"),y:100-Q.val("s")},ca);W.val("y",100-Q.val("v"),W);break;case "r":Fa=-1040;Oa=-780;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});W.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("b"),y:255-Q.val("g")},ca);W.val("y",255-Q.val("r"),W);break;case "g":Fa=-1560;Oa=-1820;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});W.range("rangeY",{minY:0,maxY:255});
if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("b"),y:255-Q.val("r")},aa);V.val("y",255-Q.val("g"),V);break;case "b":Fa=-2080;Oa=-2860;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("r"),y:255-Q.val("g")},aa);V.val("y",255-Q.val("b"),V);break;case "a":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d,O,-520);Ca.call(d,P,260);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,fa,0);wa.call(d, if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("b"),y:255-Q.val("r")},ca);W.val("y",255-Q.val("g"),W);break;case "b":Fa=-2080;Oa=-2860;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});W.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("r"),y:255-Q.val("g")},ca);W.val("y",255-Q.val("b"),W);break;case "a":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d,O,-520);Ca.call(d,P,260);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,ha,0);wa.call(d,
fa,100)},0);aa.range("all",{minX:0,maxX:360,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("v")},aa);V.val("y",255-Q.val("a"),V);break;default:throw"Invalid Mode";}switch(N){case "s":case "v":case "a":setTimeout(function(){wa.call(d,R,100);wa.call(d,P,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,ha,260);wa.call(d,ha,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Sa.call(d,p,"transparent");Sa.call(d,L,"transparent"); ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("h"),y:100-Q.val("v")},ca);W.val("y",255-Q.val("a"),W);break;default:throw"Invalid Mode";}switch(N){case "s":case "v":case "a":setTimeout(function(){wa.call(d,R,100);wa.call(d,P,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,aa,260);wa.call(d,aa,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Sa.call(d,p,"transparent");Sa.call(d,L,"transparent");
wa.call(d,P,100);wa.call(d,R,100);Ca.call(d,R,Fa);Ca.call(d,O,Fa-260);Ca.call(d,P,Oa-780);Ca.call(d,T,Oa-520);Ca.call(d,M,Oa);Ca.call(d,ha,Oa-260);Ca.call(d,fa,260);wa.call(d,fa,100)},0)}Q.val("ahex")!=null&&Aa.call(d,Q)},Aa=function(N,Q){if(Q==null||Q!=V&&Q!=aa)xa.call(d,N,Q);setTimeout(function(){nb.call(d,N);Ya.call(d,N);fb.call(d,N)},0)},ya=function(N,Q){var ea=ka.active;if(!(Q!=aa&&ea.val()==null)){var Fa=N.val("all");switch(l.color.mode){case "h":ea.val("sv",{s:Fa.x,v:100-Fa.y},Q);break;case "s":case "a":ea.val("hv", wa.call(d,P,100);wa.call(d,R,100);Ca.call(d,R,Fa);Ca.call(d,O,Fa-260);Ca.call(d,P,Oa-780);Ca.call(d,T,Oa-520);Ca.call(d,M,Oa);Ca.call(d,aa,Oa-260);Ca.call(d,ha,260);wa.call(d,ha,100)},0)}Q.val("ahex")!=null&&Aa.call(d,Q)},Aa=function(N,Q){if(Q==null||Q!=W&&Q!=ca)xa.call(d,N,Q);setTimeout(function(){nb.call(d,N);Ya.call(d,N);fb.call(d,N)},0)},ya=function(N,Q){var fa=ka.active;if(!(Q!=ca&&fa.val()==null)){var Fa=N.val("all");switch(l.color.mode){case "h":fa.val("sv",{s:Fa.x,v:100-Fa.y},Q);break;case "s":case "a":fa.val("hv",
{h:Fa.x,v:100-Fa.y},Q);break;case "v":ea.val("hs",{h:Fa.x,s:100-Fa.y},Q);break;case "r":ea.val("gb",{g:255-Fa.y,b:Fa.x},Q);break;case "g":ea.val("rb",{r:255-Fa.y,b:Fa.x},Q);break;case "b":ea.val("rg",{r:Fa.x,g:255-Fa.y},Q)}}},Ga=function(N,Q){var ea=ka.active;if(!(Q!=V&&ea.val()==null))switch(l.color.mode){case "h":ea.val("h",{h:360-N.val("y")},Q);break;case "s":ea.val("s",{s:100-N.val("y")},Q);break;case "v":ea.val("v",{v:100-N.val("y")},Q);break;case "r":ea.val("r",{r:255-N.val("y")},Q);break;case "g":ea.val("g", {h:Fa.x,v:100-Fa.y},Q);break;case "v":fa.val("hs",{h:Fa.x,s:100-Fa.y},Q);break;case "r":fa.val("gb",{g:255-Fa.y,b:Fa.x},Q);break;case "g":fa.val("rb",{r:255-Fa.y,b:Fa.x},Q);break;case "b":fa.val("rg",{r:Fa.x,g:255-Fa.y},Q)}}},Ga=function(N,Q){var fa=ka.active;if(!(Q!=W&&fa.val()==null))switch(l.color.mode){case "h":fa.val("h",{h:360-N.val("y")},Q);break;case "s":fa.val("s",{s:100-N.val("y")},Q);break;case "v":fa.val("v",{v:100-N.val("y")},Q);break;case "r":fa.val("r",{r:255-N.val("y")},Q);break;case "g":fa.val("g",
{g:255-N.val("y")},Q);break;case "b":ea.val("b",{b:255-N.val("y")},Q);break;case "a":ea.val("a",255-N.val("y"),Q)}},xa=function(N,Q){if(Q!=aa)switch(l.color.mode){case "h":var ea=N.val("sv");aa.val("xy",{x:ea!=null?ea.s:100,y:100-(ea!=null?ea.v:100)},Q);break;case "s":case "a":ea=N.val("hv");aa.val("xy",{x:ea&&ea.h||0,y:100-(ea!=null?ea.v:100)},Q);break;case "v":ea=N.val("hs");aa.val("xy",{x:ea&&ea.h||0,y:100-(ea!=null?ea.s:100)},Q);break;case "r":ea=N.val("bg");aa.val("xy",{x:ea&&ea.b||0,y:255-(ea&& {g:255-N.val("y")},Q);break;case "b":fa.val("b",{b:255-N.val("y")},Q);break;case "a":fa.val("a",255-N.val("y"),Q)}},xa=function(N,Q){if(Q!=ca)switch(l.color.mode){case "h":var fa=N.val("sv");ca.val("xy",{x:fa!=null?fa.s:100,y:100-(fa!=null?fa.v:100)},Q);break;case "s":case "a":fa=N.val("hv");ca.val("xy",{x:fa&&fa.h||0,y:100-(fa!=null?fa.v:100)},Q);break;case "v":fa=N.val("hs");ca.val("xy",{x:fa&&fa.h||0,y:100-(fa!=null?fa.s:100)},Q);break;case "r":fa=N.val("bg");ca.val("xy",{x:fa&&fa.b||0,y:255-(fa&&
ea.g||0)},Q);break;case "g":ea=N.val("br");aa.val("xy",{x:ea&&ea.b||0,y:255-(ea&&ea.r||0)},Q);break;case "b":ea=N.val("rg");aa.val("xy",{x:ea&&ea.r||0,y:255-(ea&&ea.g||0)},Q)}if(Q!=V)switch(l.color.mode){case "h":V.val("y",360-(N.val("h")||0),Q);break;case "s":ea=N.val("s");V.val("y",100-(ea!=null?ea:100),Q);break;case "v":ea=N.val("v");V.val("y",100-(ea!=null?ea:100),Q);break;case "r":V.val("y",255-(N.val("r")||0),Q);break;case "g":V.val("y",255-(N.val("g")||0),Q);break;case "b":V.val("y",255-(N.val("b")|| fa.g||0)},Q);break;case "g":fa=N.val("br");ca.val("xy",{x:fa&&fa.b||0,y:255-(fa&&fa.r||0)},Q);break;case "b":fa=N.val("rg");ca.val("xy",{x:fa&&fa.r||0,y:255-(fa&&fa.g||0)},Q)}if(Q!=W)switch(l.color.mode){case "h":W.val("y",360-(N.val("h")||0),Q);break;case "s":fa=N.val("s");W.val("y",100-(fa!=null?fa:100),Q);break;case "v":fa=N.val("v");W.val("y",100-(fa!=null?fa:100),Q);break;case "r":W.val("y",255-(N.val("r")||0),Q);break;case "g":W.val("y",255-(N.val("g")||0),Q);break;case "b":W.val("y",255-(N.val("b")||
0),Q);break;case "a":ea=N.val("a");V.val("y",255-(ea!=null?ea:255),Q)}},nb=function(N){try{var Q=N.val("all");oa.css({backgroundColor:Q&&"#"+Q.hex||"transparent"});wa.call(d,oa,Q&&Math.precision(Q.a*100/255,4)||0)}catch(ea){}},Ya=function(N){switch(l.color.mode){case "h":Sa.call(d,p,(new b({h:N.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var Q=N.val("s");wa.call(d,O,100-(Q!=null?Q:100));break;case "v":Q=N.val("v");wa.call(d,R,Q!=null?Q:100);break;case "r":wa.call(d,O,Math.precision((N.val("r")|| 0),Q);break;case "a":fa=N.val("a");W.val("y",255-(fa!=null?fa:255),Q)}},nb=function(N){try{var Q=N.val("all");na.css({backgroundColor:Q&&"#"+Q.hex||"transparent"});wa.call(d,na,Q&&Math.precision(Q.a*100/255,4)||0)}catch(fa){}},Ya=function(N){switch(l.color.mode){case "h":Sa.call(d,p,(new b({h:N.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var Q=N.val("s");wa.call(d,O,100-(Q!=null?Q:100));break;case "v":Q=N.val("v");wa.call(d,R,Q!=null?Q:100);break;case "r":wa.call(d,O,Math.precision((N.val("r")||
0)/255*100,4));break;case "g":wa.call(d,O,Math.precision((N.val("g")||0)/255*100,4));break;case "b":wa.call(d,O,Math.precision((N.val("b")||0)/255*100))}N=N.val("a");wa.call(d,K,Math.precision((255-(N||0))*100/255,4))},fb=function(N){switch(l.color.mode){case "h":var Q=N.val("a");wa.call(d,na,Math.precision((255-(Q||0))*100/255,4));break;case "s":Q=N.val("hva");var ea=new b({h:Q&&Q.h||0,s:100,v:Q!=null?Q.v:100});Sa.call(d,L,ea.val("hex"));wa.call(d,T,100-(Q!=null?Q.v:100));wa.call(d,na,Math.precision((255- 0)/255*100,4));break;case "g":wa.call(d,O,Math.precision((N.val("g")||0)/255*100,4));break;case "b":wa.call(d,O,Math.precision((N.val("b")||0)/255*100))}N=N.val("a");wa.call(d,K,Math.precision((255-(N||0))*100/255,4))},fb=function(N){switch(l.color.mode){case "h":var Q=N.val("a");wa.call(d,qa,Math.precision((255-(Q||0))*100/255,4));break;case "s":Q=N.val("hva");var fa=new b({h:Q&&Q.h||0,s:100,v:Q!=null?Q.v:100});Sa.call(d,L,fa.val("hex"));wa.call(d,T,100-(Q!=null?Q.v:100));wa.call(d,qa,Math.precision((255-
(Q&&Q.a||0))*100/255,4));break;case "v":Q=N.val("hsa");ea=new b({h:Q&&Q.h||0,s:Q!=null?Q.s:100,v:100});Sa.call(d,L,ea.val("hex"));wa.call(d,na,Math.precision((255-(Q&&Q.a||0))*100/255,4));break;case "r":case "g":case "b":ea=Q=0;N=N.val("rgba");if(l.color.mode=="r"){Q=N&&N.b||0;ea=N&&N.g||0}else if(l.color.mode=="g"){Q=N&&N.b||0;ea=N&&N.r||0}else if(l.color.mode=="b"){Q=N&&N.r||0;ea=N&&N.g||0}var Fa=ea>Q?Q:ea;wa.call(d,T,Q>ea?Math.precision((Q-ea)/(255-ea)*100,4):0);wa.call(d,M,ea>Q?Math.precision((ea- (Q&&Q.a||0))*100/255,4));break;case "v":Q=N.val("hsa");fa=new b({h:Q&&Q.h||0,s:Q!=null?Q.s:100,v:100});Sa.call(d,L,fa.val("hex"));wa.call(d,qa,Math.precision((255-(Q&&Q.a||0))*100/255,4));break;case "r":case "g":case "b":fa=Q=0;N=N.val("rgba");if(l.color.mode=="r"){Q=N&&N.b||0;fa=N&&N.g||0}else if(l.color.mode=="g"){Q=N&&N.b||0;fa=N&&N.r||0}else if(l.color.mode=="b"){Q=N&&N.r||0;fa=N&&N.g||0}var Fa=fa>Q?Q:fa;wa.call(d,T,Q>fa?Math.precision((Q-fa)/(255-fa)*100,4):0);wa.call(d,M,fa>Q?Math.precision((fa-
Q)/(255-Q)*100,4):0);wa.call(d,ha,Math.precision(Fa/255*100,4));wa.call(d,na,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "a":Q=N.val("a");Sa.call(d,L,N.val("hex")||"000000");wa.call(d,na,Q!=null?0:100);wa.call(d,fa,Q!=null?100:0)}},Sa=function(N,Q){N.css({backgroundColor:Q&&Q.length==6&&"#"+Q||"transparent"})},Wa=function(N,Q){if(s&&(Q.indexOf("AlphaBar.png")!=-1||Q.indexOf("Bars.png")!=-1||Q.indexOf("Maps.png")!=-1)){N.attr("pngSrc",Q);N.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ Q)/(255-Q)*100,4):0);wa.call(d,aa,Math.precision(Fa/255*100,4));wa.call(d,qa,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "a":Q=N.val("a");Sa.call(d,L,N.val("hex")||"000000");wa.call(d,qa,Q!=null?0:100);wa.call(d,ha,Q!=null?100:0)}},Sa=function(N,Q){N.css({backgroundColor:Q&&Q.length==6&&"#"+Q||"transparent"})},Wa=function(N,Q){if(s&&(Q.indexOf("AlphaBar.png")!=-1||Q.indexOf("Bars.png")!=-1||Q.indexOf("Maps.png")!=-1)){N.attr("pngSrc",Q);N.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
Q+"', sizingMethod='scale')"})}else N.css({backgroundImage:"url('"+Q+"')"})},Ca=function(N,Q){N.css({top:Q+"px"})},wa=function(N,Q){N.css({visibility:Q>0?"visible":"hidden"});if(Q>0&&Q<100)if(s){var ea=N.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+Q+")"}):N.css({opacity:Math.precision(Q/ Q+"', sizingMethod='scale')"})}else N.css({backgroundImage:"url('"+Q+"')"})},Ca=function(N,Q){N.css({top:Q+"px"})},wa=function(N,Q){N.css({visibility:Q>0?"visible":"hidden"});if(Q>0&&Q<100)if(s){var fa=N.attr("pngSrc");fa!=null&&(fa.indexOf("AlphaBar.png")!=-1||fa.indexOf("Bars.png")!=-1||fa.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+fa+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+Q+")"}):N.css({opacity:Math.precision(Q/
100,4)})}else N.css({opacity:Math.precision(Q/100,4)});else if(Q==0||Q==100)if(s){ea=N.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale')"}):N.css({opacity:""})}else N.css({opacity:""})},db=function(){ka.active.val("ahex",ka.current.val("ahex"))},La=function(){ka.current.val("ahex",ka.active.val("ahex"))},Ra=function(N){a(this).parents("tbody:first").find('input:radio[value!="'+ 100,4)})}else N.css({opacity:Math.precision(Q/100,4)});else if(Q==0||Q==100)if(s){fa=N.attr("pngSrc");fa!=null&&(fa.indexOf("AlphaBar.png")!=-1||fa.indexOf("Bars.png")!=-1||fa.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+fa+"', sizingMethod='scale')"}):N.css({opacity:""})}else N.css({opacity:""})},db=function(){ka.active.val("ahex",ka.current.val("ahex"))},La=function(){ka.current.val("ahex",ka.active.val("ahex"))},Ra=function(N){a(this).parents("tbody:first").find('input:radio[value!="'+
N.target.value+'"]').removeAttr("checked");Na.call(d,N.target.value)},Da=function(){db.call(d)},gb=function(){db.call(d);l.window.expandable&&yb.call(d);a.isFunction(sb)&&sb.call(d,ka.active,ma)},rb=function(){La.call(d);l.window.expandable&&yb.call(d);a.isFunction(lb)&&lb.call(d,ka.active,la)},Xa=function(){ob.call(d)},ab=function(N){var Q=N.val("hex");pa.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,pa,Math.precision((N.val("a")||0)*100/255,4))},xb=function(N){var Q=N.val("hex");N=N.val("va"); N.target.value+'"]').removeAttr("checked");Na.call(d,N.target.value)},Da=function(){db.call(d)},gb=function(){db.call(d);l.window.expandable&&yb.call(d);a.isFunction(sb)&&sb.call(d,ka.active,ma)},rb=function(){La.call(d);l.window.expandable&&yb.call(d);a.isFunction(lb)&&lb.call(d,ka.active,la)},Xa=function(){ob.call(d)},ab=function(N){var Q=N.val("hex");oa.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,oa,Math.precision((N.val("a")||0)*100/255,4))},xb=function(N){var Q=N.val("hex");N=N.val("va");
Ea.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,Ia,Math.precision((255-(N&&N.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:N==null||N.v>75?"#000000":"#ffffff"})},ua=function(N){ia=parseInt(C.css("left"));da=parseInt(C.css("top"));U=N.pageX;Y=N.pageY;a(document).bind("mousemove",jb).bind("mouseup",hb);N.preventDefault()},jb=function(N){C.css({left:ia-(U-N.pageX)+"px",top:da-(Y-N.pageY)+"px"});l.window.expandable&& Ea.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,Ia,Math.precision((255-(N&&N.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:N==null||N.v>75?"#000000":"#ffffff"})},ua=function(N){ia=parseInt(C.css("left"));ea=parseInt(C.css("top"));U=N.pageX;Y=N.pageY;a(document).bind("mousemove",jb).bind("mouseup",hb);N.preventDefault()},jb=function(N){C.css({left:ia-(U-N.pageX)+"px",top:ea-(Y-N.pageY)+"px"});l.window.expandable&&
!a.support.boxModel&&C.prev().css({left:C.css("left"),top:C.css("top")});N.stopPropagation();N.preventDefault();return false},hb=function(N){a(document).unbind("mousemove",jb).unbind("mouseup",hb);N.stopPropagation();N.preventDefault();return false},ub=function(N){N.preventDefault();N.stopPropagation();ka.active.val("ahex",a(this).attr("title")||null,N.target);return false},lb=a.isFunction(f[1])&&f[1]||null,eb=a.isFunction(f[2])&&f[2]||null,sb=a.isFunction(f[3])&&f[3]||null,ob=function(){ka.current.val("ahex", !a.support.boxModel&&C.prev().css({left:C.css("left"),top:C.css("top")});N.stopPropagation();N.preventDefault();return false},hb=function(N){a(document).unbind("mousemove",jb).unbind("mouseup",hb);N.stopPropagation();N.preventDefault();return false},ub=function(N){N.preventDefault();N.stopPropagation();ka.active.val("ahex",a(this).attr("title")||null,N.target);return false},lb=a.isFunction(f[1])&&f[1]||null,eb=a.isFunction(f[2])&&f[2]||null,sb=a.isFunction(f[3])&&f[3]||null,ob=function(){ka.current.val("ahex",
ka.active.val("ahex"));var N=function(){if(!(!l.window.expandable||a.support.boxModel)){var Q=C.find("table:first");C.before("<iframe/>");C.prev().css({width:Q.width(),height:C.height(),opacity:0,position:"absolute",left:C.css("left"),top:C.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});C.css({zIndex:20})}switch(l.window.effects.type){case "fade":C.fadeIn(l.window.effects.speed.show,N);break;case "slide":C.slideDown(l.window.effects.speed.show, ka.active.val("ahex"));var N=function(){if(!(!l.window.expandable||a.support.boxModel)){var Q=C.find("table:first");C.before("<iframe/>");C.prev().css({width:Q.width(),height:C.height(),opacity:0,position:"absolute",left:C.css("left"),top:C.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});C.css({zIndex:20})}switch(l.window.effects.type){case "fade":C.fadeIn(l.window.effects.speed.show,N);break;case "slide":C.slideDown(l.window.effects.speed.show,
N);break;default:C.show(l.window.effects.speed.show,N)}},yb=function(){var N=function(){l.window.expandable&&C.css({zIndex:10});!l.window.expandable||a.support.boxModel||C.prev().remove()};switch(l.window.effects.type){case "fade":C.fadeOut(l.window.effects.speed.hide,N);break;case "slide":C.slideUp(l.window.effects.speed.hide,N);break;default:C.hide(l.window.effects.speed.hide,N)}},zb=function(){var N=l.window,Q=N.expandable?a(d).next().find(".Container:first"):null;C=N.expandable?a("<div/>"):a(d); N);break;default:C.show(l.window.effects.speed.show,N)}},yb=function(){var N=function(){l.window.expandable&&C.css({zIndex:10});!l.window.expandable||a.support.boxModel||C.prev().remove()};switch(l.window.effects.type){case "fade":C.fadeOut(l.window.effects.speed.hide,N);break;case "slide":C.slideUp(l.window.effects.speed.hide,N);break;default:C.hide(l.window.effects.speed.hide,N)}},zb=function(){var N=l.window,Q=N.expandable?a(d).next().find(".Container:first"):null;C=N.expandable?a("<div/>"):a(d);
C.addClass("jPicker Container");N.expandable&&C.hide();C.get(0).onselectstart=function(Pa){if(Pa.target.nodeName.toLowerCase()!=="input")return false};var ea=ka.active.val("all");if(N.alphaPrecision<0)N.alphaPrecision=0;else if(N.alphaPrecision>2)N.alphaPrecision=2;var Fa='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(N.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':"")+'<tr><td rowspan="9"><h2 class="Title">'+(N.title||ba.text.title)+'</h2><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="'+ C.addClass("jPicker Container");N.expandable&&C.hide();C.get(0).onselectstart=function(Pa){if(Pa.target.nodeName.toLowerCase()!=="input")return false};var fa=ka.active.val("all");if(N.alphaPrecision<0)N.alphaPrecision=0;else if(N.alphaPrecision>2)N.alphaPrecision=2;var Fa='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(N.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':"")+'<tr><td rowspan="9"><h2 class="Title">'+(N.title||ba.text.title)+'</h2><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="'+
ja.clientPath+ja.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="'+ja.clientPath+ja.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">'+ba.text.newColor+'<div class="color_preview"><span class="Active" title="'+ba.tooltips.colors.newColor+ ja.clientPath+ja.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="'+ja.clientPath+ja.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">'+ba.text.newColor+'<div class="color_preview"><span class="Active" title="'+ba.tooltips.colors.newColor+
'">&nbsp;</span><span class="Current" title="'+ba.tooltips.colors.currentColor+'">&nbsp;</span></div></div>'+ba.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+ba.text.ok+'" title="'+ba.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+ba.text.cancel+'" title="'+ba.tooltips.buttons.cancel+'"/><div class="Grid">&nbsp;</div></td></tr><tr class="Hue"><td class="Radio"><label title="'+ba.tooltips.hue.radio+'"><input type="radio" value="h"'+ '">&nbsp;</span><span class="Current" title="'+ba.tooltips.colors.currentColor+'">&nbsp;</span></div></div>'+ba.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+ba.text.ok+'" title="'+ba.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+ba.text.cancel+'" title="'+ba.tooltips.buttons.cancel+'"/><div class="Grid">&nbsp;</div></td></tr><tr class="Hue"><td class="Radio"><label title="'+ba.tooltips.hue.radio+'"><input type="radio" value="h"'+
(l.color.mode=="h"?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.h:"")+'" title="'+ba.tooltips.hue.textbox+'"/>&nbsp;\u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="'+ba.tooltips.saturation.radio+'"><input type="radio" value="s"'+(l.color.mode=="s"?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.s:"")+'" title="'+ba.tooltips.saturation.textbox+ (l.color.mode=="h"?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(fa!=null?fa.h:"")+'" title="'+ba.tooltips.hue.textbox+'"/>&nbsp;\u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="'+ba.tooltips.saturation.radio+'"><input type="radio" value="s"'+(l.color.mode=="s"?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(fa!=null?fa.s:"")+'" title="'+ba.tooltips.saturation.textbox+
'"/>&nbsp;%</td></tr><tr class="Value"><td class="Radio"><label title="'+ba.tooltips.value.radio+'"><input type="radio" value="v"'+(l.color.mode=="v"?' checked="checked"':"")+'/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.v:"")+'" title="'+ba.tooltips.value.textbox+'"/>&nbsp;%<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+ba.tooltips.red.radio+'"><input type="radio" value="r"'+(l.color.mode=="r"?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+ '"/>&nbsp;%</td></tr><tr class="Value"><td class="Radio"><label title="'+ba.tooltips.value.radio+'"><input type="radio" value="v"'+(l.color.mode=="v"?' checked="checked"':"")+'/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(fa!=null?fa.v:"")+'" title="'+ba.tooltips.value.textbox+'"/>&nbsp;%<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+ba.tooltips.red.radio+'"><input type="radio" value="r"'+(l.color.mode=="r"?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+
(ea!=null?ea.r:"")+'" title="'+ba.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+ba.tooltips.green.radio+'"><input type="radio" value="g"'+(l.color.mode=="g"?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.g:"")+'" title="'+ba.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+ba.tooltips.blue.radio+'"><input type="radio" value="b"'+(l.color.mode=="b"?' checked="checked"': (fa!=null?fa.r:"")+'" title="'+ba.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+ba.tooltips.green.radio+'"><input type="radio" value="g"'+(l.color.mode=="g"?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(fa!=null?fa.g:"")+'" title="'+ba.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+ba.tooltips.blue.radio+'"><input type="radio" value="b"'+(l.color.mode=="b"?' checked="checked"':
"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.b:"")+'" title="'+ba.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(N.alphaSupport?'<label title="'+ba.tooltips.alpha.radio+'"><input type="radio" value="a"'+(l.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(N.alphaSupport?'<input type="text" maxlength="'+(3+N.alphaPrecision)+'" value="'+(ea!=null?Math.precision(ea.a*100/255,N.alphaPrecision): "")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(fa!=null?fa.b:"")+'" title="'+ba.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(N.alphaSupport?'<label title="'+ba.tooltips.alpha.radio+'"><input type="radio" value="a"'+(l.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(N.alphaSupport?'<input type="text" maxlength="'+(3+N.alphaPrecision)+'" value="'+(fa!=null?Math.precision(fa.a*100/255,N.alphaPrecision):
"")+'" title="'+ba.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+ba.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(ea!=null?ea.hex:"")+'"/></label>'+(N.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(ea!=null?ea.ahex.substring(6):"")+'" title="'+ba.tooltips.hex.alpha+'"/></td>':"&nbsp;")+"</tr></tbody></table>";if(N.expandable){C.html(Fa);a(document.body).children("div.jPicker.Container").length== "")+'" title="'+ba.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+ba.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(fa!=null?fa.hex:"")+'"/></label>'+(N.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(fa!=null?fa.ahex.substring(6):"")+'" title="'+ba.tooltips.hex.alpha+'"/></td>':"&nbsp;")+"</tr></tbody></table>";if(N.expandable){C.html(Fa);a(document.body).children("div.jPicker.Container").length==
0?a(document.body).prepend(C):a(document.body).children("div.jPicker.Container:last").after(C);C.mousedown(function(){a(document.body).children("div.jPicker.Container").css({zIndex:10});C.css({zIndex:20})});C.css({left:N.position.x=="left"?Q.offset().left-530-(N.position.y=="center"?25:0)+"px":N.position.x=="center"?Q.offset().left-260+"px":N.position.x=="right"?Q.offset().left-10+(N.position.y=="center"?25:0)+"px":N.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":Q.offset().left+parseInt(N.position.x)+ 0?a(document.body).prepend(C):a(document.body).children("div.jPicker.Container:last").after(C);C.mousedown(function(){a(document.body).children("div.jPicker.Container").css({zIndex:10});C.css({zIndex:20})});C.css({left:N.position.x=="left"?Q.offset().left-530-(N.position.y=="center"?25:0)+"px":N.position.x=="center"?Q.offset().left-260+"px":N.position.x=="right"?Q.offset().left-10+(N.position.y=="center"?25:0)+"px":N.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":Q.offset().left+parseInt(N.position.x)+
"px",position:"absolute",top:N.position.y=="top"?Q.offset().top-312+"px":N.position.y=="center"?Q.offset().top-156+"px":N.position.y=="bottom"?Q.offset().top+25+"px":Q.offset().top+parseInt(N.position.y)+"px"})}else{C=a(d);C.html(Fa)}Fa=C.find("tbody:first");p=Fa.find("div.Map:first");L=Fa.find("div.Bar:first");var Oa=p.find("span"),Va=L.find("span");R=Oa.filter(".Map1:first");O=Oa.filter(".Map2:first");K=Oa.filter(".Map3:first");P=Va.filter(".Map1:first");T=Va.filter(".Map2:first");M=Va.filter(".Map3:first"); "px",position:"absolute",top:N.position.y=="top"?Q.offset().top-312+"px":N.position.y=="center"?Q.offset().top-156+"px":N.position.y=="bottom"?Q.offset().top+25+"px":Q.offset().top+parseInt(N.position.y)+"px"})}else{C=a(d);C.html(Fa)}Fa=C.find("tbody:first");p=Fa.find("div.Map:first");L=Fa.find("div.Bar:first");var Oa=p.find("span"),Va=L.find("span");R=Oa.filter(".Map1:first");O=Oa.filter(".Map2:first");K=Oa.filter(".Map3:first");P=Va.filter(".Map1:first");T=Va.filter(".Map2:first");M=Va.filter(".Map3:first");
ha=Va.filter(".Map4:first");na=Va.filter(".Map5:first");fa=Va.filter(".Map6:first");aa=new q(p,{map:{width:ja.colorMap.width,height:ja.colorMap.height},arrow:{image:ja.clientPath+ja.colorMap.arrow.file,width:ja.colorMap.arrow.width,height:ja.colorMap.arrow.height}});aa.bind(ya);V=new q(L,{map:{width:ja.colorBar.width,height:ja.colorBar.height},arrow:{image:ja.clientPath+ja.colorBar.arrow.file,width:ja.colorBar.arrow.width,height:ja.colorBar.arrow.height}});V.bind(Ga);ra=new h(Fa,ka.active,N.expandable&& aa=Va.filter(".Map4:first");qa=Va.filter(".Map5:first");ha=Va.filter(".Map6:first");ca=new q(p,{map:{width:ja.colorMap.width,height:ja.colorMap.height},arrow:{image:ja.clientPath+ja.colorMap.arrow.file,width:ja.colorMap.arrow.width,height:ja.colorMap.arrow.height}});ca.bind(ya);W=new q(L,{map:{width:ja.colorBar.width,height:ja.colorBar.height},arrow:{image:ja.clientPath+ja.colorBar.arrow.file,width:ja.colorBar.arrow.width,height:ja.colorBar.arrow.height}});W.bind(Ga);ra=new h(Fa,ka.active,N.expandable&&
N.bindToInput?N.input:null,N.alphaPrecision);Oa=ea!=null?ea.hex:null;var $a=Fa.find(".Preview");Va=Fa.find(".Button");oa=$a.find(".Active:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});pa=$a.find(".Current:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"}).bind("click",Da);wa.call(d,pa,Math.precision(ka.current.val("a")*100)/255,4);la=Va.find(".Ok:first").bind("click touchstart",rb);ma=Va.find(".Cancel:first").bind("click touchstart",gb);Ba=Va.find(".Grid:first");setTimeout(function(){Wa.call(d, N.bindToInput?N.input:null,N.alphaPrecision);Oa=fa!=null?fa.hex:null;var $a=Fa.find(".Preview");Va=Fa.find(".Button");na=$a.find(".Active:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});oa=$a.find(".Current:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"}).bind("click",Da);wa.call(d,oa,Math.precision(ka.current.val("a")*100)/255,4);la=Va.find(".Ok:first").bind("click touchstart",rb);ma=Va.find(".Cancel:first").bind("click touchstart",gb);Ba=Va.find(".Grid:first");setTimeout(function(){Wa.call(d,
R,ja.clientPath+"Maps.png");Wa.call(d,O,ja.clientPath+"Maps.png");Wa.call(d,K,ja.clientPath+"map-opacity.png");Wa.call(d,P,ja.clientPath+"Bars.png");Wa.call(d,T,ja.clientPath+"Bars.png");Wa.call(d,M,ja.clientPath+"Bars.png");Wa.call(d,ha,ja.clientPath+"Bars.png");Wa.call(d,na,ja.clientPath+"bar-opacity.png");Wa.call(d,fa,ja.clientPath+"AlphaBar.png");Wa.call(d,$a.find("div:last"),ja.clientPath+"preview-opacity.png")},0);Fa.find("td.Radio input").bind("click touchstart",Ra);if(ka.quickList&&ka.quickList.length> R,ja.clientPath+"Maps.png");Wa.call(d,O,ja.clientPath+"Maps.png");Wa.call(d,K,ja.clientPath+"map-opacity.png");Wa.call(d,P,ja.clientPath+"Bars.png");Wa.call(d,T,ja.clientPath+"Bars.png");Wa.call(d,M,ja.clientPath+"Bars.png");Wa.call(d,aa,ja.clientPath+"Bars.png");Wa.call(d,qa,ja.clientPath+"bar-opacity.png");Wa.call(d,ha,ja.clientPath+"AlphaBar.png");Wa.call(d,$a.find("div:last"),ja.clientPath+"preview-opacity.png")},0);Fa.find("td.Radio input").bind("click touchstart",Ra);if(ka.quickList&&ka.quickList.length>
0){Va="";for(i=0;i<ka.quickList.length;i++){if((typeof ka.quickList[i]).toString().toLowerCase()=="string")ka.quickList[i]=new b({hex:ka.quickList[i]});var qb=ka.quickList[i].val("a"),Qa=ka.quickList[i].val("ahex");if(!N.alphaSupport&&Qa)Qa=Qa.substring(0,6)+"ff";var pb=ka.quickList[i].val("hex");Va+='<span class="QuickColor"'+(Qa&&' title="#'+Qa+'"'||"")+' style="background-color:'+(pb&&"#"+pb||"")+";"+(pb?"":"background-image:url("+ja.clientPath+"NoColor.png)")+(N.alphaSupport&&qb&&qb<255?";opacity:"+ 0){Va="";for(i=0;i<ka.quickList.length;i++){if((typeof ka.quickList[i]).toString().toLowerCase()=="string")ka.quickList[i]=new b({hex:ka.quickList[i]});var qb=ka.quickList[i].val("a"),Qa=ka.quickList[i].val("ahex");if(!N.alphaSupport&&Qa)Qa=Qa.substring(0,6)+"ff";var pb=ka.quickList[i].val("hex");Va+='<span class="QuickColor"'+(Qa&&' title="#'+Qa+'"'||"")+' style="background-color:'+(pb&&"#"+pb||"")+";"+(pb?"":"background-image:url("+ja.clientPath+"NoColor.png)")+(N.alphaSupport&&qb&&qb<255?";opacity:"+
Math.precision(qb/255,4)+";filter:Alpha(opacity="+Math.precision(qb/2.55,4)+")":"")+'">&nbsp;</span>'}Wa.call(d,Ba,ja.clientPath+"bar-opacity.png");Ba.html(Va);Ba.find(".QuickColor").click(ub)}Na.call(d,l.color.mode);ka.active.bind(Aa);a.isFunction(eb)&&ka.active.bind(eb);ka.current.bind(ab);if(N.expandable){d.icon=Q.parents(".Icon:first");Ea=d.icon.find(".Color:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});Ia=d.icon.find(".Alpha:first");Wa.call(d,Ia,ja.clientPath+"bar-opacity.png");wa.call(d, Math.precision(qb/255,4)+";filter:Alpha(opacity="+Math.precision(qb/2.55,4)+")":"")+'">&nbsp;</span>'}Wa.call(d,Ba,ja.clientPath+"bar-opacity.png");Ba.html(Va);Ba.find(".QuickColor").click(ub)}Na.call(d,l.color.mode);ka.active.bind(Aa);a.isFunction(eb)&&ka.active.bind(eb);ka.current.bind(ab);if(N.expandable){d.icon=Q.parents(".Icon:first");Ea=d.icon.find(".Color:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});Ia=d.icon.find(".Alpha:first");Wa.call(d,Ia,ja.clientPath+"bar-opacity.png");wa.call(d,
Ia,Math.precision((255-(ea!=null?ea.a:0))*100/255,4));za=d.icon.find(".Image:first").css({backgroundImage:"url('"+ja.clientPath+ja.picker.file+"')"}).bind("click",Xa);if(N.bindToInput&&N.updateInputColor)N.input.css({backgroundColor:Oa&&"#"+Oa||"transparent",color:ea==null||ea.v>75?"#000000":"#ffffff"});Ka=Fa.find(".Move:first").bind("mousedown",ua);ka.active.bind(xb)}else ob.call(d)},ja=l.images,ba=l.localization,ka={active:(typeof l.color.active).toString().toLowerCase()=="string"?new b({ahex:!l.window.alphaSupport&& Ia,Math.precision((255-(fa!=null?fa.a:0))*100/255,4));za=d.icon.find(".Image:first").css({backgroundImage:"url('"+ja.clientPath+ja.picker.file+"')"}).bind("click",Xa);if(N.bindToInput&&N.updateInputColor)N.input.css({backgroundColor:Oa&&"#"+Oa||"transparent",color:fa==null||fa.v>75?"#000000":"#ffffff"});Ka=Fa.find(".Move:first").bind("mousedown",ua);ka.active.bind(xb)}else ob.call(d)},ja=l.images,ba=l.localization,ka={active:(typeof l.color.active).toString().toLowerCase()=="string"?new b({ahex:!l.window.alphaSupport&&
l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new b({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),current:(typeof l.color.active).toString().toLowerCase()=="string"?new b({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new b({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}), l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new b({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),current:(typeof l.color.active).toString().toLowerCase()=="string"?new b({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new b({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),
quickList:l.color.quickList};a.extend(true,d,{commitCallback:lb,liveCallback:eb,cancelCallback:sb,color:ka,show:ob,hide:yb,destroy:function(){C.find("td.Radio input touchstart").unbind("click",Ra);pa.unbind("click touchstart",Da);ma.unbind("click touchstart",gb);la.unbind("click touchstart",rb);if(l.window.expandable){za.unbind("click",Xa);Ka.unbind("mousedown",ua);d.icon=null}C.find(".QuickColor").unbind("click",ub);fa=na=ha=M=T=P=K=O=R=L=p=null;aa.destroy();aa=null;V.destroy();V=null;ra.destroy(); quickList:l.color.quickList};a.extend(true,d,{commitCallback:lb,liveCallback:eb,cancelCallback:sb,color:ka,show:ob,hide:yb,destroy:function(){C.find("td.Radio input touchstart").unbind("click",Ra);oa.unbind("click touchstart",Da);ma.unbind("click touchstart",gb);la.unbind("click touchstart",rb);if(l.window.expandable){za.unbind("click",Xa);Ka.unbind("mousedown",ua);d.icon=null}C.find(".QuickColor").unbind("click",ub);ha=qa=aa=M=T=P=K=O=R=L=p=null;ca.destroy();ca=null;W.destroy();W=null;ra.destroy();
eb=sb=lb=Ba=ma=la=pa=oa=ra=null;C.html("");for(i=0;i<n.length;i++)n[i]==d&&n.splice(i,1)}});n.push(d);setTimeout(function(){zb.call(d)},0)})};a.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true,alphaSupport:false,alphaPrecision:0,updateInputColor:true},color:{mode:"h",active:new b({ahex:"#ffcc00ff"}),quickList:[new b({h:360,s:33,v:100}),new b({h:360,s:66,v:100}),new b({h:360,s:100,v:100}), eb=sb=lb=Ba=ma=la=oa=na=ra=null;C.html("");for(i=0;i<n.length;i++)n[i]==d&&n.splice(i,1)}});n.push(d);setTimeout(function(){zb.call(d)},0)})};a.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true,alphaSupport:false,alphaPrecision:0,updateInputColor:true},color:{mode:"h",active:new b({ahex:"#ffcc00ff"}),quickList:[new b({h:360,s:33,v:100}),new b({h:360,s:66,v:100}),new b({h:360,s:100,v:100}),
new b({h:360,s:100,v:75}),new b({h:360,s:100,v:50}),new b({h:180,s:0,v:100}),new b({h:30,s:33,v:100}),new b({h:30,s:66,v:100}),new b({h:30,s:100,v:100}),new b({h:30,s:100,v:75}),new b({h:30,s:100,v:50}),new b({h:180,s:0,v:90}),new b({h:60,s:33,v:100}),new b({h:60,s:66,v:100}),new b({h:60,s:100,v:100}),new b({h:60,s:100,v:75}),new b({h:60,s:100,v:50}),new b({h:180,s:0,v:80}),new b({h:90,s:33,v:100}),new b({h:90,s:66,v:100}),new b({h:90,s:100,v:100}),new b({h:90,s:100,v:75}),new b({h:90,s:100,v:50}), new b({h:360,s:100,v:75}),new b({h:360,s:100,v:50}),new b({h:180,s:0,v:100}),new b({h:30,s:33,v:100}),new b({h:30,s:66,v:100}),new b({h:30,s:100,v:100}),new b({h:30,s:100,v:75}),new b({h:30,s:100,v:50}),new b({h:180,s:0,v:90}),new b({h:60,s:33,v:100}),new b({h:60,s:66,v:100}),new b({h:60,s:100,v:100}),new b({h:60,s:100,v:75}),new b({h:60,s:100,v:50}),new b({h:180,s:0,v:80}),new b({h:90,s:33,v:100}),new b({h:90,s:66,v:100}),new b({h:90,s:100,v:100}),new b({h:90,s:100,v:75}),new b({h:90,s:100,v:50}),
new b({h:180,s:0,v:70}),new b({h:120,s:33,v:100}),new b({h:120,s:66,v:100}),new b({h:120,s:100,v:100}),new b({h:120,s:100,v:75}),new b({h:120,s:100,v:50}),new b({h:180,s:0,v:60}),new b({h:150,s:33,v:100}),new b({h:150,s:66,v:100}),new b({h:150,s:100,v:100}),new b({h:150,s:100,v:75}),new b({h:150,s:100,v:50}),new b({h:180,s:0,v:50}),new b({h:180,s:33,v:100}),new b({h:180,s:66,v:100}),new b({h:180,s:100,v:100}),new b({h:180,s:100,v:75}),new b({h:180,s:100,v:50}),new b({h:180,s:0,v:40}),new b({h:210, new b({h:180,s:0,v:70}),new b({h:120,s:33,v:100}),new b({h:120,s:66,v:100}),new b({h:120,s:100,v:100}),new b({h:120,s:100,v:75}),new b({h:120,s:100,v:50}),new b({h:180,s:0,v:60}),new b({h:150,s:33,v:100}),new b({h:150,s:66,v:100}),new b({h:150,s:100,v:100}),new b({h:150,s:100,v:75}),new b({h:150,s:100,v:50}),new b({h:180,s:0,v:50}),new b({h:180,s:33,v:100}),new b({h:180,s:66,v:100}),new b({h:180,s:100,v:100}),new b({h:180,s:100,v:75}),new b({h:180,s:100,v:50}),new b({h:180,s:0,v:40}),new b({h:210,
s:33,v:100}),new b({h:210,s:66,v:100}),new b({h:210,s:100,v:100}),new b({h:210,s:100,v:75}),new b({h:210,s:100,v:50}),new b({h:180,s:0,v:30}),new b({h:240,s:33,v:100}),new b({h:240,s:66,v:100}),new b({h:240,s:100,v:100}),new b({h:240,s:100,v:75}),new b({h:240,s:100,v:50}),new b({h:180,s:0,v:20}),new b({h:270,s:33,v:100}),new b({h:270,s:66,v:100}),new b({h:270,s:100,v:100}),new b({h:270,s:100,v:75}),new b({h:270,s:100,v:50}),new b({h:180,s:0,v:10}),new b({h:300,s:33,v:100}),new b({h:300,s:66,v:100}), s:33,v:100}),new b({h:210,s:66,v:100}),new b({h:210,s:100,v:100}),new b({h:210,s:100,v:75}),new b({h:210,s:100,v:50}),new b({h:180,s:0,v:30}),new b({h:240,s:33,v:100}),new b({h:240,s:66,v:100}),new b({h:240,s:100,v:100}),new b({h:240,s:100,v:75}),new b({h:240,s:100,v:50}),new b({h:180,s:0,v:20}),new b({h:270,s:33,v:100}),new b({h:270,s:66,v:100}),new b({h:270,s:100,v:100}),new b({h:270,s:100,v:75}),new b({h:270,s:100,v:50}),new b({h:180,s:0,v:10}),new b({h:300,s:33,v:100}),new b({h:300,s:66,v:100}),
@ -663,8 +663,8 @@ l.beginPath();l.globalAlpha=0.5;l.moveTo(0.5,s);l.lineTo(0.5,0);l.moveTo(s,0.5);
"g");a(u,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"});var c=$("#canvas_background");c.after(u);u=h.createElementNS("http://www.w3.org/2000/svg","pattern");a(u,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var f=h.createElementNS("http://www.w3.org/2000/svg","image");a(f,{x:0,y:0,width:100,height:100});u.appendChild(f);$("#svgroot defs").append(u);h=h.createElementNS("http://www.w3.org/2000/svg","rect");a(h,{width:"100%",height:"100%", "g");a(u,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"});var c=$("#canvas_background");c.after(u);u=h.createElementNS("http://www.w3.org/2000/svg","pattern");a(u,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var f=h.createElementNS("http://www.w3.org/2000/svg","image");a(f,{x:0,y:0,width:100,height:100});u.appendChild(f);$("#svgroot defs").append(u);h=h.createElementNS("http://www.w3.org/2000/svg","rect");a(h,{width:"100%",height:"100%",
x:0,y:0,"stroke-width":0,stroke:"none",fill:"url(#gridpattern)",style:"pointer-events: none; display:visible;"});$("#canvasGrid").append(h)}return{name:"view_grid",zoomChanged:function(d){b&&q(d)},buttons:[{id:"view_grid",type:"menu",after:"tool_wireframe",panel:"view_menu",title:"View Grid",events:{click:function(){if($("#view_grid").hasClass("push_button_pressed")){svgEditor.curConfig.showGrid=b=false;$("#view_grid").removeClass("push_button_pressed");$("#canvasGrid").attr("display","none")}else{svgEditor.curConfig.showGrid= x:0,y:0,"stroke-width":0,stroke:"none",fill:"url(#gridpattern)",style:"pointer-events: none; display:visible;"});$("#canvasGrid").append(h)}return{name:"view_grid",zoomChanged:function(d){b&&q(d)},buttons:[{id:"view_grid",type:"menu",after:"tool_wireframe",panel:"view_menu",title:"View Grid",events:{click:function(){if($("#view_grid").hasClass("push_button_pressed")){svgEditor.curConfig.showGrid=b=false;$("#view_grid").removeClass("push_button_pressed");$("#canvasGrid").attr("display","none")}else{svgEditor.curConfig.showGrid=
b=true;$("#view_grid").addClass("push_button_pressed");$("#canvasGrid").attr("display","normal");q(svgCanvas.getZoom())}}}}]}});svgEditor.addExtension("shapes",function(){function a(){$("#shape_buttons").empty();$("#shape_buttons").append(L.buttons)}function q(O){var K=p[O];if(K){L=K;K.buttons.length||h(O,K);a()}else{$("#shape_buttons").html("Loading...");$.getJSON("extensions/shapelib/"+O+".json",function(P){L=p[O]={data:P.data,size:P.size,fill:P.fill};h(O,P);a()})}}function h(O,K){var P=L.size||300,T=L.fill||false,M=P*0.05;M=[-M,-M,P+M*2,P+M*2].join(" ");P=T?0:P/30;P=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+ b=true;$("#view_grid").addClass("push_button_pressed");$("#canvasGrid").attr("display","normal");q(svgCanvas.getZoom())}}}}]}});svgEditor.addExtension("shapes",function(){function a(){$("#shape_buttons").empty();$("#shape_buttons").append(L.buttons)}function q(O){var K=p[O];if(K){L=K;K.buttons.length||h(O,K);a()}else{$("#shape_buttons").html("Loading...");$.getJSON("extensions/shapelib/"+O+".json",function(P){L=p[O]={data:P.data,size:P.size,fill:P.fill};h(O,P);a()})}}function h(O,K){var P=L.size||300,T=L.fill||false,M=P*0.05;M=[-M,-M,P+M*2,P+M*2].join(" ");P=T?0:P/30;P=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+
M+'"><path fill="#333" stroke="transparent" stroke-width="'+P+'" /></svg></svg>',"text/xml");P.documentElement.setAttribute("width",40);P.documentElement.setAttribute("height",40);T=$(document.importNode(P.documentElement,true));var ha=K.data;L.buttons=[];for(var na in ha){var fa=ha[na],aa=T.clone();if(fa.charAt(fa.length-1)=="x"){P=32;M=P*0.05;M=[-M,-M,P+M*2,P+M*2].join(" ");aa.find("svg").attr("viewBox",M);fa.replace("x","")}aa.find("path").attr("d",fa);P=aa.wrap('<div class="tool_button">').parent().attr({id:R+ M+'"><path fill="#333" stroke="transparent" stroke-width="'+P+'" /></svg></svg>',"text/xml");P.documentElement.setAttribute("width",40);P.documentElement.setAttribute("height",40);T=$(document.importNode(P.documentElement,true));var aa=K.data;L.buttons=[];for(var qa in aa){var ha=aa[qa],ca=T.clone();if(ha.charAt(ha.length-1)=="x"){P=32;M=P*0.05;M=[-M,-M,P+M*2,P+M*2].join(" ");ca.find("svg").attr("viewBox",M);ha.replace("x","")}ca.find("path").attr("d",ha);P=ca.wrap('<div class="tool_button">').parent().attr({id:R+
"_"+na,title:na});L.buttons.push(P[0])}}var b,n,u=svgEditor.canvas,c,f,d,l=u.getRootElem(),s={},C={basic:"Basic",object:"Objects",symbol:"Symbols",arrow:"Arrows",flowchart:"Flowchart",nature:"Nature",game:"Cards & Chess",dialog_balloon:"Dialog balloons",music:"Music",weather:"Weather &amp; Time",ui:"User Interface",social:"Social Web"},p={basic:{data:{star_points_5:"m1,116.58409l113.82668,0l35.17332,-108.13487l35.17334,108.13487l113.82666,0l-92.08755,66.83026l35.17514,108.13487l-92.08759,-66.83208l-92.08757,66.83208l35.17515,-108.13487l-92.08758,-66.83026z", "_"+qa,title:qa});L.buttons.push(P[0])}}var b,n,u=svgEditor.canvas,c,f,d,l=u.getRootElem(),s={},C={basic:"Basic",object:"Objects",symbol:"Symbols",arrow:"Arrows",flowchart:"Flowchart",nature:"Nature",game:"Cards & Chess",dialog_balloon:"Dialog balloons",music:"Music",weather:"Weather &amp; Time",ui:"User Interface",social:"Social Web"},p={basic:{data:{star_points_5:"m1,116.58409l113.82668,0l35.17332,-108.13487l35.17334,108.13487l113.82666,0l-92.08755,66.83026l35.17514,108.13487l-92.08759,-66.83208l-92.08757,66.83208l35.17515,-108.13487l-92.08758,-66.83026z",
donut:"m1,150l0,0c0,-82.29042 66.70958,-149 149,-149l0,0c39.51724,0 77.41599,15.69816 105.35889,43.64108c27.94293,27.94293 43.64111,65.84165 43.64111,105.35892l0,0c0,82.29041 -66.70958,149 -149,149l0,0c-82.29041,0 -149,-66.70959 -149,-149zm74.5,0l0,0c0,41.1452 33.35481,74.5 74.5,74.5c41.14522,0 74.5,-33.3548 74.5,-74.5c0,-41.1452 -33.3548,-74.5 -74.5,-74.5l0,0c-41.14519,0 -74.5,33.35481 -74.5,74.5z",triangle:"m1,280.375l149,-260.75l149,260.75z",right_triangle:"m1,299l0,-298l298,298z",diamond:"m1,150l149,-149l149,149l-149,149l-149,-149z", donut:"m1,150l0,0c0,-82.29042 66.70958,-149 149,-149l0,0c39.51724,0 77.41599,15.69816 105.35889,43.64108c27.94293,27.94293 43.64111,65.84165 43.64111,105.35892l0,0c0,82.29041 -66.70958,149 -149,149l0,0c-82.29041,0 -149,-66.70959 -149,-149zm74.5,0l0,0c0,41.1452 33.35481,74.5 74.5,74.5c41.14522,0 74.5,-33.3548 74.5,-74.5c0,-41.1452 -33.3548,-74.5 -74.5,-74.5l0,0c-41.14519,0 -74.5,33.35481 -74.5,74.5z",triangle:"m1,280.375l149,-260.75l149,260.75z",right_triangle:"m1,299l0,-298l298,298z",diamond:"m1,150l149,-149l149,149l-149,149l-149,-149z",
pentagon:"m1.00035,116.97758l148.99963,-108.4053l148.99998,108.4053l-56.91267,175.4042l-184.1741,0l-56.91284,-175.4042z",hexagon:"m1,149.99944l63.85715,-127.71428l170.28572,0l63.85713,127.71428l-63.85713,127.71428l-170.28572,0l-63.85715,-127.71428z",septagon1:"m0.99917,191.06511l29.51249,-127.7108l119.48833,-56.83673l119.48836,56.83673l29.51303,127.7108l-82.69087,102.41679l-132.62103,0l-82.69031,-102.41679z",heptagon:"m1,88.28171l87.28172,-87.28171l123.43653,0l87.28172,87.28171l0,123.43654l-87.28172,87.28172l-123.43653,0l-87.28172,-87.28172l0,-123.43654z", pentagon:"m1.00035,116.97758l148.99963,-108.4053l148.99998,108.4053l-56.91267,175.4042l-184.1741,0l-56.91284,-175.4042z",hexagon:"m1,149.99944l63.85715,-127.71428l170.28572,0l63.85713,127.71428l-63.85713,127.71428l-170.28572,0l-63.85715,-127.71428z",septagon1:"m0.99917,191.06511l29.51249,-127.7108l119.48833,-56.83673l119.48836,56.83673l29.51303,127.7108l-82.69087,102.41679l-132.62103,0l-82.69031,-102.41679z",heptagon:"m1,88.28171l87.28172,-87.28171l123.43653,0l87.28172,87.28171l0,123.43654l-87.28172,87.28172l-123.43653,0l-87.28172,-87.28172l0,-123.43654z",
decagon:"m1,150.00093l28.45646,-88.40318l74.49956,-54.63682l92.08794,0l74.50002,54.63682l28.45599,88.40318l-28.45599,88.40318l-74.50002,54.63681l-92.08794,0l-74.49956,-54.63681l-28.45646,-88.40318z",dodecagon:"m1,110.07421l39.92579,-69.14842l69.14842,-39.92579l79.85159,0l69.14842,39.92579l39.92578,69.14842l0,79.85159l-39.92578,69.14842l-69.14842,39.92578l-79.85159,0l-69.14842,-39.92578l-39.92579,-69.14842l0,-79.85159z",trapezoid:"m1,299l55.875,-298l186.25001,0l55.87498,298z",dialog_balloon_1:"m0.99786,35.96579l0,0c0,-19.31077 15.28761,-34.96524 34.14583,-34.96524l15.52084,0l0,0l74.50001,0l139.68748,0c9.05606,0 17.74118,3.68382 24.14478,10.24108c6.40356,6.55726 10.00107,15.45081 10.00107,24.72416l0,87.41311l0,0l0,52.44785l0,0c0,19.31078 -15.2876,34.96524 -34.14584,34.96524l-139.68748,0l-97.32507,88.90848l22.82506,-88.90848l-15.52084,0c-18.85822,0 -34.14583,-15.65446 -34.14583,-34.96524l0,0l0,-52.44785l0,0z", decagon:"m1,150.00093l28.45646,-88.40318l74.49956,-54.63682l92.08794,0l74.50002,54.63682l28.45599,88.40318l-28.45599,88.40318l-74.50002,54.63681l-92.08794,0l-74.49956,-54.63681l-28.45646,-88.40318z",dodecagon:"m1,110.07421l39.92579,-69.14842l69.14842,-39.92579l79.85159,0l69.14842,39.92579l39.92578,69.14842l0,79.85159l-39.92578,69.14842l-69.14842,39.92578l-79.85159,0l-69.14842,-39.92578l-39.92579,-69.14842l0,-79.85159z",trapezoid:"m1,299l55.875,-298l186.25001,0l55.87498,298z",dialog_balloon_1:"m0.99786,35.96579l0,0c0,-19.31077 15.28761,-34.96524 34.14583,-34.96524l15.52084,0l0,0l74.50001,0l139.68748,0c9.05606,0 17.74118,3.68382 24.14478,10.24108c6.40356,6.55726 10.00107,15.45081 10.00107,24.72416l0,87.41311l0,0l0,52.44785l0,0c0,19.31078 -15.2876,34.96524 -34.14584,34.96524l-139.68748,0l-97.32507,88.90848l22.82506,-88.90848l-15.52084,0c-18.85822,0 -34.14583,-15.65446 -34.14583,-34.96524l0,0l0,-52.44785l0,0z",
@ -676,8 +676,8 @@ times:"m1.00089,73.36786l72.36697,-72.36697l76.87431,76.87368l76.87431,-76.87368
$('<div id="shape_buttons">');$("#tools_shapelib > *").wrapAll(O);var K=$("#tools_shapelib_show");q("basic");$("#shape_buttons").mouseup(function(T){T=$(T.target).closest("div.tool_button");if(T.length){var M=T.children().clone().attr({width:24,height:24});K.children(":not(.flyout_arrow_horiz)").remove();K.append(M).attr("data-curopt","#"+T[0].id).mouseup();u.setMode(R);n=T[0].id.substr((R+"_").length);b=L.data[n];$(".tools_flyout").fadeOut()}});O=$('<div id="shape_cats">');var P="";$.each(C,function(T, $('<div id="shape_buttons">');$("#tools_shapelib > *").wrapAll(O);var K=$("#tools_shapelib_show");q("basic");$("#shape_buttons").mouseup(function(T){T=$(T.target).closest("div.tool_button");if(T.length){var M=T.children().clone().attr({width:24,height:24});K.children(":not(.flyout_arrow_horiz)").remove();K.append(M).attr("data-curopt","#"+T[0].id).mouseup();u.setMode(R);n=T[0].id.substr((R+"_").length);b=L.data[n];$(".tools_flyout").fadeOut()}});O=$('<div id="shape_cats">');var P="";$.each(C,function(T,
M){P+="<div data-cat="+T+">"+M+"</div>"});O.html(P).children().bind("mouseup",function(){var T=$(this);T.siblings().removeClass("current");T.addClass("current");q(T.attr("data-cat"));return false});O.children().eq(0).addClass("current");$("#tools_shapelib").prepend(O);K.mouseup(function(){u.setMode(b?R:"select")});$("#tool_shapelib").remove();O=$("#tools_shapelib").height();$("#tools_shapelib").css({"margin-top":-(O/2),"margin-left":3})},mouseDown:function(O){if(u.getMode()===R){var K=f=O.start_x; M){P+="<div data-cat="+T+">"+M+"</div>"});O.html(P).children().bind("mouseup",function(){var T=$(this);T.siblings().removeClass("current");T.addClass("current");q(T.attr("data-cat"));return false});O.children().eq(0).addClass("current");$("#tools_shapelib").prepend(O);K.mouseup(function(){u.setMode(b?R:"select")});$("#tool_shapelib").remove();O=$("#tools_shapelib").height();$("#tools_shapelib").css({"margin-top":-(O/2),"margin-left":3})},mouseDown:function(O){if(u.getMode()===R){var K=f=O.start_x;
O=d=O.start_y;var P=u.getStyle();c=u.addSvgElementFromJson({element:"path",curStyles:true,attr:{d:b,id:u.getNextId(),opacity:P.opacity/2,style:"pointer-events:none"}});c.setAttribute("d",b);if(/[a-z]/.test(b)){b=L.data[n]=u.pathActions.convertPath(c);c.setAttribute("d",b);u.pathActions.fixEnd(c)}c.setAttribute("transform","translate("+K+","+O+") scale(0.005) translate("+-K+","+-O+")");u.recalculateDimensions(c);u.getTransformList(c);s=c.getBBox();totalScale={sx:1,sy:1};return{started:true}}},mouseMove:function(O){if(u.getMode()=== O=d=O.start_y;var P=u.getStyle();c=u.addSvgElementFromJson({element:"path",curStyles:true,attr:{d:b,id:u.getNextId(),opacity:P.opacity/2,style:"pointer-events:none"}});c.setAttribute("d",b);if(/[a-z]/.test(b)){b=L.data[n]=u.pathActions.convertPath(c);c.setAttribute("d",b);u.pathActions.fixEnd(c)}c.setAttribute("transform","translate("+K+","+O+") scale(0.005) translate("+-K+","+-O+")");u.recalculateDimensions(c);u.getTransformList(c);s=c.getBBox();totalScale={sx:1,sy:1};return{started:true}}},mouseMove:function(O){if(u.getMode()===
R){var K=u.getZoom(),P=O.event,T=O.mouse_x/K,M=O.mouse_y/K;O=u.getTransformList(c);var ha=c.getBBox();K=ha.x;var na=ha.y,fa=ha.width,aa=ha.height,V=T-f,ra=M-d,ia={x:Math.min(f,T),y:Math.min(d,M),width:Math.abs(T-f),height:Math.abs(M-d)},da=ha=0;aa=aa?(aa+ra)/aa:1;fa=fa?(fa+V)/fa:1;fa=ia.width/s.width;aa=ia.height/s.height;fa=fa||1;aa=aa||1;if(T<f)ha=s.width;if(M<d)da=s.height;T=l.createSVGTransform();M=l.createSVGTransform();ia=l.createSVGTransform();T.setTranslate(-(K+ha),-(na+da));if(P.shiftKey){replaced= R){var K=u.getZoom(),P=O.event,T=O.mouse_x/K,M=O.mouse_y/K;O=u.getTransformList(c);var aa=c.getBBox();K=aa.x;var qa=aa.y,ha=aa.width,ca=aa.height,W=T-f,ra=M-d,ia={x:Math.min(f,T),y:Math.min(d,M),width:Math.abs(T-f),height:Math.abs(M-d)},ea=aa=0;ca=ca?(ca+ra)/ca:1;ha=ha?(ha+W)/ha:1;ha=ia.width/s.width;ca=ia.height/s.height;ha=ha||1;ca=ca||1;if(T<f)aa=s.width;if(M<d)ea=s.height;T=l.createSVGTransform();M=l.createSVGTransform();ia=l.createSVGTransform();T.setTranslate(-(K+aa),-(qa+ea));if(P.shiftKey){replaced=
true;P=Math.min(Math.abs(fa),Math.abs(aa));fa=P*(fa<0?-1:1);aa=P*(aa<0?-1:1);if(totalScale.sx!=totalScale.sy){P=totalScale.sx>totalScale.sy?1:totalScale.sx/totalScale.sy;fa*=totalScale.sy>totalScale.sx?1:totalScale.sy/totalScale.sx;aa*=P}}totalScale.sx*=fa;totalScale.sy*=aa;M.setScale(fa,aa);ia.setTranslate(K+ha,na+da);O.appendItem(ia);O.appendItem(M);O.appendItem(T);u.recalculateDimensions(c);s=c.getBBox()}},mouseUp:function(O){if(u.getMode()===R){if(O.mouse_x==f&&O.mouse_y==d)return{keep:false, true;P=Math.min(Math.abs(ha),Math.abs(ca));ha=P*(ha<0?-1:1);ca=P*(ca<0?-1:1);if(totalScale.sx!=totalScale.sy){P=totalScale.sx>totalScale.sy?1:totalScale.sx/totalScale.sy;ha*=totalScale.sy>totalScale.sx?1:totalScale.sy/totalScale.sx;ca*=P}}totalScale.sx*=ha;totalScale.sy*=ca;M.setScale(ha,ca);ia.setTranslate(K+aa,qa+ea);O.appendItem(ia);O.appendItem(M);O.appendItem(T);u.recalculateDimensions(c);s=c.getBBox()}},mouseUp:function(O){if(u.getMode()===R){if(O.mouse_x==f&&O.mouse_y==d)return{keep:false,
element:c,started:false};u.setMode("select");return{keep:true,element:c,started:false}}}}});(function(){for(var a=0,q=["ms","moz","webkit","o"],h=0;h<q.length&&!window.requestAnimationFrame;++h){window.requestAnimationFrame=window[q[h]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[q[h]+"CancelAnimationFrame"]||window[q[h]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var n=(new Date).getTime(),u=Math.max(0,16-(n-a)),c=window.setTimeout(function(){b(n+u)},u);a=n+u;return c};if(!window.cancelAnimationFrame)window.cancelAnimationFrame= element:c,started:false};u.setMode("select");return{keep:true,element:c,started:false}}}}});(function(){for(var a=0,q=["ms","moz","webkit","o"],h=0;h<q.length&&!window.requestAnimationFrame;++h){window.requestAnimationFrame=window[q[h]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[q[h]+"CancelAnimationFrame"]||window[q[h]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var n=(new Date).getTime(),u=Math.max(0,16-(n-a)),c=window.setTimeout(function(){b(n+u)},u);a=n+u;return c};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
function(b){clearTimeout(b)}})();(function(a){function q(p){var L=p.originalEvent;if(!L.touches||L.targetTouches.length===1&&L.touches.length===1){c.call(this,p);p=a(this);p.bind(s,h);p.bind(l,b)}else{clearTimeout(C);u.call(this)}}function h(p){if(C!=null){var L=p.originalEvent;p=L.changedTouches?L.changedTouches[0].pageX:L.pageX;L=L.changedTouches?L.changedTouches[0].pageY:L.pageY;var R=a(this).data("taphold.point");p=p-R.x;L=L-R.y;if(Math.sqrt(p*p+L*L)>d){clearTimeout(C);u.call(this)}}}function b(){clearTimeout(C);u.call(this)} function(b){clearTimeout(b)}})();(function(a){function q(p){var L=p.originalEvent;if(!L.touches||L.targetTouches.length===1&&L.touches.length===1){c.call(this,p);p=a(this);p.bind(s,h);p.bind(l,b)}else{clearTimeout(C);u.call(this)}}function h(p){if(C!=null){var L=p.originalEvent;p=L.changedTouches?L.changedTouches[0].pageX:L.pageX;L=L.changedTouches?L.changedTouches[0].pageY:L.pageY;var R=a(this).data("taphold.point");p=p-R.x;L=L-R.y;if(Math.sqrt(p*p+L*L)>d){clearTimeout(C);u.call(this)}}}function b(){clearTimeout(C);u.call(this)}
function n(p){u.call(this);a(this).data("taphold.handler").call(this,p)}function u(){C=null;a(this).unbind(s,h);a(this).unbind(l,b)}function c(p){if(C==null){var L=this;C=setTimeout(function(){n.call(L,p)},f);var R=p.originalEvent,O={};O.x=R.changedTouches?R.changedTouches[0].pageX:R.pageX;O.y=R.changedTouches?R.changedTouches[0].pageY:R.pageY;a(this).data("taphold.point",O)}}var f=1E3,d=5,l="touchend",s="touchmove",C=null;a.event.special.taphold={setup:function(){},add:function(p){a(this).data("taphold.handler", function n(p){u.call(this);a(this).data("taphold.handler").call(this,p)}function u(){C=null;a(this).unbind(s,h);a(this).unbind(l,b)}function c(p){if(C==null){var L=this;C=setTimeout(function(){n.call(L,p)},f);var R=p.originalEvent,O={};O.x=R.changedTouches?R.changedTouches[0].pageX:R.pageX;O.y=R.changedTouches?R.changedTouches[0].pageY:R.pageY;a(this).data("taphold.point",O)}}var f=1E3,d=5,l="touchend",s="touchmove",C=null;a.event.special.taphold={setup:function(){},add:function(p){a(this).data("taphold.handler",