fixing draginput undo

master
Mark MacKay 2012-08-23 04:52:35 -05:00
parent 34ab5538af
commit 4d2f536a73
8 changed files with 562 additions and 558 deletions

View File

@ -36,7 +36,6 @@ $.fn.dragInput = function(cfg){
var lastY = 0; var lastY = 0;
var attr = this.getAttribute("data-attr"); var attr = this.getAttribute("data-attr");
var canvas = svgEditor.canvas var canvas = svgEditor.canvas
var selectedElems = canvas.getSelectedElems();
var isTouch = svgedit.browser.isTouch(); var isTouch = svgedit.browser.isTouch();
var completed = true //for mousewheel var completed = true //for mousewheel
var $cursor = (area && this.dragCfg.cursor) var $cursor = (area && this.dragCfg.cursor)
@ -53,7 +52,6 @@ $.fn.dragInput = function(cfg){
v = this.dragCfg.reset; v = this.dragCfg.reset;
} else if($.isFunction(this.dragCfg.stepfunc)) { } else if($.isFunction(this.dragCfg.stepfunc)) {
v = this.dragCfg.stepfunc(this, i); v = this.dragCfg.stepfunc(this, i);
console.log(v);
} else { } else {
v = Number((Number(this.value) + Number(i)).toFixed(5)); v = Number((Number(this.value) + Number(i)).toFixed(5));
} }
@ -85,6 +83,7 @@ $.fn.dragInput = function(cfg){
//when the mouse is released //when the mouse is released
this.stop = function() { this.stop = function() {
var selectedElems = canvas.getSelectedElems();
$('body').removeClass('dragging'); $('body').removeClass('dragging');
$label.removeClass("active"); $label.removeClass("active");
completed = true; completed = true;
@ -104,6 +103,7 @@ $.fn.dragInput = function(cfg){
} }
this.start = function(e) { this.start = function(e) {
var selectedElems = canvas.getSelectedElems();
if (isTouch) e = e.originalEvent.touches[0] if (isTouch) e = e.originalEvent.touches[0]
var oy = e.pageY; var oy = e.pageY;
var val = this.value; var val = this.value;
@ -148,12 +148,13 @@ $.fn.dragInput = function(cfg){
}) })
.bind("mousewheel", function(e, delta, deltaX, deltaY){ .bind("mousewheel", function(e, delta, deltaX, deltaY){
var selectedElems = canvas.getSelectedElems();
if (completed) canvas.undoMgr.beginUndoableChange(attr, selectedElems) if (completed) canvas.undoMgr.beginUndoableChange(attr, selectedElems)
completed = false completed = false
clearTimeout(window.undoTimeout) clearTimeout(window.undoTimeout)
window.undoTimeout = setTimeout(function(){ window.undoTimeout = setTimeout(function(){
wheel_input.stop() wheel_input.stop()
},1000) },500)
var wheel_input = this; var wheel_input = this;
if (deltaY > 0) if (deltaY > 0)

View File

@ -409,7 +409,7 @@
<div id="selected_panel" class="context_panel"> <div id="selected_panel" class="context_panel">
<label id="tool_angle" data-title="Change rotation angle" class="draginput"> <label id="tool_angle" data-title="Change rotation angle" class="draginput">
<input id="angle" class="attr_changer" size="2" value="0" data-min="-180" data-max="180" type="text"/> <input id="angle" class="attr_changer" size="2" value="0" data-attr="transform" data-min="-180" data-max="180" type="text"/>
<span class="icon_label">Rotation</span> <span class="icon_label">Rotation</span>
<div id="tool_angle_indicator"> <div id="tool_angle_indicator">
<div id="tool_angle_indicator_cursor"></div> <div id="tool_angle_indicator_cursor"></div>

View File

@ -1676,7 +1676,8 @@
} }
var changeRotationAngle = function(ctl) { var changeRotationAngle = function(ctl) {
svgCanvas.setRotationAngle(ctl.value); var preventUndo = true;
svgCanvas.setRotationAngle(ctl.value, preventUndo);
rotateCursor(ctl.value) rotateCursor(ctl.value)
$('#tool_reorient').toggleClass('disabled', ctl.value == 0); $('#tool_reorient').toggleClass('disabled', ctl.value == 0);
} }

View File

@ -1,56 +1,56 @@
function touchHandler(a){var q=a.changedTouches,g=q[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var p=document.createEvent("MouseEvent");p.initMouseEvent(b,true,true,window,1,g.screenX,g.screenY,g.clientX,g.clientY,false,false,false,false,0,null);if(q.length<2){g.target.dispatchEvent(p);a.preventDefault()}};(function(a){function q(g){if(typeof g.data==="string"){var b=g.handler,p=g.data.toLowerCase().split(" ");g.handler=function(v){if(!(this!==v.target&&(/textarea|select/i.test(v.target.nodeName)||v.target.type==="text"))){var d=v.type!=="keypress"&&a.hotkeys.specialKeys[v.which],f=String.fromCharCode(v.which).toLowerCase(),c="",m={};if(v.altKey&&d!=="alt")c+="alt+";if(v.ctrlKey&&d!=="ctrl")c+="ctrl+";if(v.metaKey&&!v.ctrlKey&&d!=="meta")c+="meta+";if(v.shiftKey&&d!=="shift")c+="shift+";if(d)m[c+d]= function touchHandler(a){var q=a.changedTouches,g=q[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var p=document.createEvent("MouseEvent");p.initMouseEvent(b,true,true,window,1,g.screenX,g.screenY,g.clientX,g.clientY,false,false,false,false,0,null);if(q.length<2){g.target.dispatchEvent(p);a.preventDefault()}};(function(a){function q(g){if(typeof g.data==="string"){var b=g.handler,p=g.data.toLowerCase().split(" ");g.handler=function(v){if(!(this!==v.target&&(/textarea|select/i.test(v.target.nodeName)||v.target.type==="text"))){var d=v.type!=="keypress"&&a.hotkeys.specialKeys[v.which],f=String.fromCharCode(v.which).toLowerCase(),c="",m={};if(v.altKey&&d!=="alt")c+="alt+";if(v.ctrlKey&&d!=="ctrl")c+="ctrl+";if(v.metaKey&&!v.ctrlKey&&d!=="meta")c+="meta+";if(v.shiftKey&&d!=="shift")c+="shift+";if(d)m[c+d]=
true;else{m[c+f]=true;m[c+a.hotkeys.shiftNums[f]]=true;if(c==="shift+")m[a.hotkeys.shiftNums[f]]=true}d=0;for(f=p.length;d<f;d++)if(m[p[d]])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{m[c+f]=true;m[c+a.hotkeys.shiftNums[f]]=true;if(c==="shift+")m[a.hotkeys.shiftNums[f]]=true}d=0;for(f=p.length;d<f;d++)if(m[p[d]])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 g(ba){return typeof ba==="string"}function b(ba){var T=c.call(arguments,1);return function(){return ba.apply(this,T.concat(c.call(arguments)))}}function p(ba,T,Z,oa,pa){var ma;if(oa!==f){T=Z.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Z=T[3]||"";if(pa===2&&g(oa))oa=oa.replace(ba?ea:U,"");else{ma=s(T[2]);oa=g(oa)?s[ba?ga:N](oa):oa;oa=pa===2?oa:pa===1?a.extend({},oa,ma):a.extend({},ma,oa);oa=u(oa);if(ba)oa=oa.replace(Aa,m)}ba=T[1]+(ba?"#":oa||!T[1]?"?":"")+oa+Z}else ba= 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 g(ba){return typeof ba==="string"}function b(ba){var T=c.call(arguments,1);return function(){return ba.apply(this,T.concat(c.call(arguments)))}}function p(ba,T,Z,na,pa){var ma;if(na!==f){T=Z.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Z=T[3]||"";if(pa===2&&g(na))na=na.replace(ba?ea:U,"");else{ma=s(T[2]);na=g(na)?s[ba?ga:N](na):na;na=pa===2?na:pa===1?a.extend({},na,ma):a.extend({},ma,na);na=u(na);if(ba)na=na.replace(Aa,m)}ba=T[1]+(ba?"#":na||!T[1]?"?":"")+na+Z}else ba=
T(Z!==f?Z:q[na][X]);return ba}function v(ba,T,Z){if(T===f||typeof T==="boolean"){Z=T;T=u[ba?ga:N]()}else T=g(T)?T.replace(ba?ea:U,""):T;return s(T,Z)}function d(ba,T,Z,oa){if(!g(Z)&&typeof Z!=="object"){oa=Z;Z=T;T=f}return this.each(function(){var pa=a(this),ma=T||Q()[(this.nodeName||"").toLowerCase()]||"",la=ma&&pa.attr(ma)||"";pa.attr(ma,u[ba](la,Z,oa))})}var f,c=Array.prototype.slice,m=decodeURIComponent,u=a.param,C,s,L,R=a.bbq=a.bbq||{},K,I,Q,S=a.event.special,N="querystring",ga="fragment",na= T(Z!==f?Z:q[oa][X]);return ba}function v(ba,T,Z){if(T===f||typeof T==="boolean"){Z=T;T=u[ba?ga:N]()}else T=g(T)?T.replace(ba?ea:U,""):T;return s(T,Z)}function d(ba,T,Z,na){if(!g(Z)&&typeof Z!=="object"){na=Z;Z=T;T=f}return this.each(function(){var pa=a(this),ma=T||S()[(this.nodeName||"").toLowerCase()]||"",la=ma&&pa.attr(ma)||"";pa.attr(ma,u[ba](la,Z,na))})}var f,c=Array.prototype.slice,m=decodeURIComponent,u=a.param,C,s,L,Q=a.bbq=a.bbq||{},K,H,S,R=a.event.special,N="querystring",ga="fragment",oa=
"location",X="href",U=/^.*\?|#.*$/g,ea=/^.*\#/,Aa,ja={};u[N]=b(p,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ga]=C=b(p,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);Aa=RegExp(ba.join("|"),"g")};C.noEscape(",/");a.deparam=s=function(ba,T){var Z={},oa={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(pa,ma){var la=ma.split("="),xa=m(la[0]),ya=Z,Ja= "location",X="href",U=/^.*\?|#.*$/g,ea=/^.*\#/,Aa,ja={};u[N]=b(p,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ga]=C=b(p,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);Aa=RegExp(ba.join("|"),"g")};C.noEscape(",/");a.deparam=s=function(ba,T){var Z={},na={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(pa,ma){var la=ma.split("="),xa=m(la[0]),ya=Z,Ja=
0,Ha=xa.split("]["),Ga=Ha.length-1;if(/\[/.test(Ha[0])&&/\]$/.test(Ha[Ga])){Ha[Ga]=Ha[Ga].replace(/\]$/,"");Ha=Ha.shift().split("[").concat(Ha);Ga=Ha.length-1}else Ga=0;if(la.length===2){la=m(la[1]);if(T)la=la&&!isNaN(la)?+la:la==="undefined"?f:oa[la]!==f?oa[la]:la;if(Ga)for(;Ja<=Ga;Ja++){xa=Ha[Ja]===""?ya.length:Ha[Ja];ya=ya[xa]=Ja<Ga?ya[xa]||(Ha[Ja+1]&&isNaN(Ha[Ja+1])?{}:[]):la}else if(a.isArray(Z[xa]))Z[xa].push(la);else Z[xa]=Z[xa]!==f?[Z[xa],la]:la}else if(xa)Z[xa]=T?f:""});return Z};s[N]=b(v, 0,Ha=xa.split("]["),Ga=Ha.length-1;if(/\[/.test(Ha[0])&&/\]$/.test(Ha[Ga])){Ha[Ga]=Ha[Ga].replace(/\]$/,"");Ha=Ha.shift().split("[").concat(Ha);Ga=Ha.length-1}else Ga=0;if(la.length===2){la=m(la[1]);if(T)la=la&&!isNaN(la)?+la:la==="undefined"?f:na[la]!==f?na[la]:la;if(Ga)for(;Ja<=Ga;Ja++){xa=Ha[Ja]===""?ya.length:Ha[Ja];ya=ya[xa]=Ja<Ga?ya[xa]||(Ha[Ja+1]&&isNaN(Ha[Ja+1])?{}:[]):la}else if(a.isArray(Z[xa]))Z[xa].push(la);else Z[xa]=Z[xa]!==f?[Z[xa],la]:la}else if(xa)Z[xa]=T?f:""});return Z};s[N]=b(v,
0);s[ga]=L=b(v,1);a.elemUrlAttr||(a.elemUrlAttr=function(ba){return a.extend(ja,ba)})({a:X,base:X,iframe:"src",img:"src",input:"src",form:"action",link:X,script:"src"});Q=a.elemUrlAttr;a.fn[N]=b(d,N);a.fn[ga]=b(d,ga);R.pushState=K=function(ba,T){if(g(ba)&&/^#/.test(ba)&&T===f)T=2;var Z=ba!==f;Z=C(q[na][X],Z?ba:{},Z?T:2);q[na][X]=Z+(/#/.test(Z)?"":"#")};R.getState=I=function(ba,T){return ba===f||typeof ba==="boolean"?L(ba):L(T)[ba]};R.removeState=function(ba){var T={};if(ba!==f){T=I();a.each(a.isArray(ba)? 0);s[ga]=L=b(v,1);a.elemUrlAttr||(a.elemUrlAttr=function(ba){return a.extend(ja,ba)})({a:X,base:X,iframe:"src",img:"src",input:"src",form:"action",link:X,script:"src"});S=a.elemUrlAttr;a.fn[N]=b(d,N);a.fn[ga]=b(d,ga);Q.pushState=K=function(ba,T){if(g(ba)&&/^#/.test(ba)&&T===f)T=2;var Z=ba!==f;Z=C(q[oa][X],Z?ba:{},Z?T:2);q[oa][X]=Z+(/#/.test(Z)?"":"#")};Q.getState=H=function(ba,T){return ba===f||typeof ba==="boolean"?L(ba):L(T)[ba]};Q.removeState=function(ba){var T={};if(ba!==f){T=H();a.each(a.isArray(ba)?
ba:arguments,function(Z,oa){delete T[oa]})}K(T,2)};S.hashchange=a.extend(S.hashchange,{add:function(ba){function T(oa){var pa=oa[ga]=C();oa.getState=function(ma,la){return ma===f||typeof ma==="boolean"?s(pa,ma):s(pa,la)[ma]};Z.apply(this,arguments)}var Z;if(a.isFunction(ba)){Z=ba;return T}else{Z=ba.handler;ba.handler=T}}})})(jQuery,this); ba:arguments,function(Z,na){delete T[na]})}K(T,2)};R.hashchange=a.extend(R.hashchange,{add:function(ba){function T(na){var pa=na[ga]=C();na.getState=function(ma,la){return ma===f||typeof ma==="boolean"?s(pa,ma):s(pa,la)[ma]};Z.apply(this,arguments)}var Z;if(a.isFunction(ba)){Z=ba;return T}else{Z=ba.handler;ba.handler=T}}})})(jQuery,this);
(function(a,q,g){function b(C){C=C||q[d][f];return C.replace(/^[^#]*#?(.*)$/,"$1")}var p,v=a.event.special,d="location",f="href",c=document.documentMode,m=a.browser.msie&&(c===g||c<8),u="onhashchange"in q&&!m;a.hashchangeDelay=100;v.hashchange=a.extend(v.hashchange,{setup:function(){if(u)return false;a(p.start)},teardown:function(){if(u)return false;a(p.stop)}});p=function(){function C(){K=I=function(Q){return Q};if(m){R=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow; (function(a,q,g){function b(C){C=C||q[d][f];return C.replace(/^[^#]*#?(.*)$/,"$1")}var p,v=a.event.special,d="location",f="href",c=document.documentMode,m=a.browser.msie&&(c===g||c<8),u="onhashchange"in q&&!m;a.hashchangeDelay=100;v.hashchange=a.extend(v.hashchange,{setup:function(){if(u)return false;a(p.start)},teardown:function(){if(u)return false;a(p.stop)}});p=function(){function C(){K=H=function(S){return S};if(m){Q=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;
I=function(){return b(R.document[d][f])};K=function(Q,S){if(Q!==S){var N=R.document;N.open().close();N[d].hash="#"+Q}};K(b())}}var s={},L,R,K,I;s.start=function(){if(!L){var Q=b();K||C();(function S(){var N=b(),ga=I(Q);if(N!==Q){K(Q=N,ga);a(q).trigger("hashchange")}else if(ga!==Q)q[d][f]=q[d][f].replace(/#.*/,"")+"#"+ga;L=setTimeout(S,a.hashchangeDelay)})()}};s.stop=function(){if(!R){L&&clearTimeout(L);L=0}};return s}()})(jQuery,this);(function(a){var q={},g;a.svgIcons=function(b,p){function v(ba,T){if(ba!=="ajax"){if(Q)return;var Z=(R=X[0].contentDocument)&&R.getElementById("svg_eof");if(!Z&&!(T&&Z)){S++;if(S<50)setTimeout(v,20);else{f();Q=true}return}Q=true}L=a(R.firstChild).children();if(p.no_img)setTimeout(function(){I||d()},500);else{Z=na+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";K=a(new Image).attr({src:Z,width:0,height:0}).appendTo("body").load(function(){d(true)}).error(function(){d()})}} H=function(){return b(Q.document[d][f])};K=function(S,R){if(S!==R){var N=Q.document;N.open().close();N[d].hash="#"+S}};K(b())}}var s={},L,Q,K,H;s.start=function(){if(!L){var S=b();K||C();(function R(){var N=b(),ga=H(S);if(N!==S){K(S=N,ga);a(q).trigger("hashchange")}else if(ga!==S)q[d][f]=q[d][f].replace(/#.*/,"")+"#"+ga;L=setTimeout(R,a.hashchangeDelay)})()}};s.stop=function(){if(!Q){L&&clearTimeout(L);L=0}};return s}()})(jQuery,this);(function(a){var q={},g;a.svgIcons=function(b,p){function v(ba,T){if(ba!=="ajax"){if(S)return;var Z=(Q=X[0].contentDocument)&&Q.getElementById("svg_eof");if(!Z&&!(T&&Z)){R++;if(R<50)setTimeout(v,20);else{f();S=true}return}S=true}L=a(Q.firstChild).children();if(p.no_img)setTimeout(function(){H||d()},500);else{Z=oa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";K=a(new Image).attr({src:Z,width:0,height:0}).appendTo("body").load(function(){d(true)}).error(function(){d()})}}
function d(ba,T){if(!I){if(p.no_img)ba=false;if(ba){var Z=a(document.createElement("div"));Z.hide().appendTo("body")}if(T){var oa=p.fallback_path?p.fallback_path:"";a.each(T,function(Ga,Ma){a("#"+Ga);var Ca=a(new Image).attr({"class":"svg_icon",src:oa+Ma,width:C,height:s,alt:"icon"});ja(Ca,Ga)})}else for(var pa=L.length,ma=0;ma<pa;ma++){var la=L[ma],xa=la.id;if(xa==="svg_eof")break;a("#"+xa);la=la.getElementsByTagNameNS(m,"svg")[0];var ya=document.createElementNS(m,"svg");ya.setAttributeNS(m,"viewBox", function d(ba,T){if(!H){if(p.no_img)ba=false;if(ba){var Z=a(document.createElement("div"));Z.hide().appendTo("body")}if(T){var na=p.fallback_path?p.fallback_path:"";a.each(T,function(Ga,Ma){a("#"+Ga);var Ca=a(new Image).attr({"class":"svg_icon",src:na+Ma,width:C,height:s,alt:"icon"});ja(Ca,Ga)})}else for(var pa=L.length,ma=0;ma<pa;ma++){var la=L[ma],xa=la.id;if(xa==="svg_eof")break;a("#"+xa);la=la.getElementsByTagNameNS(m,"svg")[0];var ya=document.createElementNS(m,"svg");ya.setAttributeNS(m,"viewBox",
[0,0,C,s].join(" "));var Ja=la.getAttribute("width"),Ha=la.getAttribute("height");la.removeAttribute("width");la.removeAttribute("height");la.getAttribute("viewBox")||la.setAttribute("viewBox",[0,0,Ja,Ha].join(" "));ya.setAttribute("xmlns",m);ya.setAttribute("width",C);ya.setAttribute("height",s);ya.setAttribute("xmlns:xlink",u);ya.setAttribute("class","svg_icon");ga||(la=la.cloneNode(true));ya.appendChild(la);if(ba){ga||ya.cloneNode(true);Z.empty().append(ya);la=na+c(Z.html());la=a(new Image).attr({"class":"svg_icon", [0,0,C,s].join(" "));var Ja=la.getAttribute("width"),Ha=la.getAttribute("height");la.removeAttribute("width");la.removeAttribute("height");la.getAttribute("viewBox")||la.setAttribute("viewBox",[0,0,Ja,Ha].join(" "));ya.setAttribute("xmlns",m);ya.setAttribute("width",C);ya.setAttribute("height",s);ya.setAttribute("xmlns:xlink",u);ya.setAttribute("class","svg_icon");ga||(la=la.cloneNode(true));ya.appendChild(la);if(ba){ga||ya.cloneNode(true);Z.empty().append(ya);la=oa+c(Z.html());la=a(new Image).attr({"class":"svg_icon",
src:la})}else la=g(a(ya),ma);ja(la,xa)}p.placement&&a.each(p.placement,function(Ga,Ma){q[Ma]&&a(Ga).each(function(Ca){var wa=q[Ma].clone();if(Ca>0&&!ba)wa=g(wa,Ca,true);Aa(a(this),wa,Ma)})});if(!T){ba&&Z.remove();X&&X.remove();K&&K.remove()}p.resize&&a.resizeSvgIcons(p.resize);I=true;p.callback&&p.callback(q)}}function f(){if(b.indexOf(".svgz")!=-1){var ba=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,p)}else p.fallback&&d(false,p.fallback)} src:la})}else la=g(a(ya),ma);ja(la,xa)}p.placement&&a.each(p.placement,function(Ga,Ma){q[Ma]&&a(Ga).each(function(Ca){var wa=q[Ma].clone();if(Ca>0&&!ba)wa=g(wa,Ca,true);Aa(a(this),wa,Ma)})});if(!T){ba&&Z.remove();X&&X.remove();K&&K.remove()}p.resize&&a.resizeSvgIcons(p.resize);H=true;p.callback&&p.callback(q)}}function f(){if(b.indexOf(".svgz")!=-1){var ba=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,p)}else p.fallback&&d(false,p.fallback)}
function c(ba){if(window.btoa)return window.btoa(ba);var T=Array(Math.floor((ba.length+2)/3)*4),Z,oa,pa,ma,la,xa,ya=0,Ja=0;do{Z=ba.charCodeAt(ya++);oa=ba.charCodeAt(ya++);pa=ba.charCodeAt(ya++);ma=Z>>2;Z=(Z&3)<<4|oa>>4;la=(oa&15)<<2|pa>>6;xa=pa&63;if(isNaN(oa))la=xa=64;else if(isNaN(pa))xa=64;T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la); function c(ba){if(window.btoa)return window.btoa(ba);var T=Array(Math.floor((ba.length+2)/3)*4),Z,na,pa,ma,la,xa,ya=0,Ja=0;do{Z=ba.charCodeAt(ya++);na=ba.charCodeAt(ya++);pa=ba.charCodeAt(ya++);ma=Z>>2;Z=(Z&3)<<4|na>>4;la=(na&15)<<2|pa>>6;xa=pa&63;if(isNaN(na))la=xa=64;else if(isNaN(pa))xa=64;T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la);
T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(xa)}while(ya<ba.length);return T.join("")}var m="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",C=p.w?p.w:24,s=p.h?p.h:24,L,R,K,I=false,Q=false,S=0,N=navigator.userAgent,ga=!!window.opera;N.indexOf("Safari/")>-1&&N.indexOf("Chrome/");var na="data:image/svg+xml;charset=utf-8;base64,";if(p.svgz){var X=a('<object data="'+b+'" type=image/svg+xml>').appendTo("body").hide();try{R=X[0].contentDocument;X.load(v); T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(xa)}while(ya<ba.length);return T.join("")}var m="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",C=p.w?p.w:24,s=p.h?p.h:24,L,Q,K,H=false,S=false,R=0,N=navigator.userAgent,ga=!!window.opera;N.indexOf("Safari/")>-1&&N.indexOf("Chrome/");var oa="data:image/svg+xml;charset=utf-8;base64,";if(p.svgz){var X=a('<object data="'+b+'" type=image/svg+xml>').appendTo("body").hide();try{Q=X[0].contentDocument;X.load(v);
v(0,true)}catch(U){f()}}else{var ea=new DOMParser;a.ajax({url:b,dataType:"string",success:function(ba){if(ba){R=ea.parseFromString(ba,"text/xml");a(function(){v("ajax")})}else a(f)},error:function(ba){if(window.opera)a(function(){f()});else if(ba.responseText){R=ea.parseFromString(ba.responseText,"text/xml");R.childNodes.length||a(f);a(function(){v("ajax")})}else a(f)}})}var Aa=function(ba,T,Z,oa){ga&&T.css("visibility","hidden");if(p.replace){oa&&T.attr("id",Z);(Z=ba.attr("class"))&&T.attr("class", v(0,true)}catch(U){f()}}else{var ea=new DOMParser;a.ajax({url:b,dataType:"string",success:function(ba){if(ba){Q=ea.parseFromString(ba,"text/xml");a(function(){v("ajax")})}else a(f)},error:function(ba){if(window.opera)a(function(){f()});else if(ba.responseText){Q=ea.parseFromString(ba.responseText,"text/xml");Q.childNodes.length||a(f);a(function(){v("ajax")})}else a(f)}})}var Aa=function(ba,T,Z,na){ga&&T.css("visibility","hidden");if(p.replace){na&&T.attr("id",Z);(Z=ba.attr("class"))&&T.attr("class",
"svg_icon "+Z);ba.replaceWith(T)}else ba.append(T);ga&&setTimeout(function(){T.removeAttr("style")},1)},ja=function(ba,T){if(p.id_match===undefined||p.id_match!==false)Aa(holder,ba,T,true);q[T]=ba};g=function(ba,T){var Z=ba.find("defs");if(!Z.length)return ba;Z=ga?Z.find("*").filter(function(){return!!this.id}):Z.find("[id]");var oa=ba[0].getElementsByTagName("*"),pa=oa.length;Z.each(function(ma){var la=this.id;a(R).find("#"+la);this.id=ma="x"+la+T+ma;la="url(#"+la+")";var xa="url(#"+ma+")";for(ma= "svg_icon "+Z);ba.replaceWith(T)}else ba.append(T);ga&&setTimeout(function(){T.removeAttr("style")},1)},ja=function(ba,T){if(p.id_match===undefined||p.id_match!==false)Aa(holder,ba,T,true);q[T]=ba};g=function(ba,T){var Z=ba.find("defs");if(!Z.length)return ba;Z=ga?Z.find("*").filter(function(){return!!this.id}):Z.find("[id]");var na=ba[0].getElementsByTagName("*"),pa=na.length;Z.each(function(ma){var la=this.id;a(Q).find("#"+la);this.id=ma="x"+la+T+ma;la="url(#"+la+")";var xa="url(#"+ma+")";for(ma=
0;ma<pa;ma++){var ya=oa[ma];ya.getAttribute("fill")===la&&ya.setAttribute("fill",xa);ya.getAttribute("stroke")===la&&ya.setAttribute("stroke",xa);ya.getAttribute("filter")===la&&ya.setAttribute("filter",xa)}});return ba}};a.getSvgIcon=function(b,p){var v=q[b];if(p&&v)v=g(v,0,true).clone(true);return v};a.resizeSvgIcons=function(b){var p=!a(".svg_icon:first").length;a.each(b,function(v,d){var f=a.isArray(d),c=f?d[0]:d,m=f?d[1]:d;if(p)v=v.replace(/\.svg_icon/g,"svg");a(v).each(function(){this.setAttribute("width", 0;ma<pa;ma++){var ya=na[ma];ya.getAttribute("fill")===la&&ya.setAttribute("fill",xa);ya.getAttribute("stroke")===la&&ya.setAttribute("stroke",xa);ya.getAttribute("filter")===la&&ya.setAttribute("filter",xa)}});return ba}};a.getSvgIcon=function(b,p){var v=q[b];if(p&&v)v=g(v,0,true).clone(true);return v};a.resizeSvgIcons=function(b){var p=!a(".svg_icon:first").length;a.each(b,function(v,d){var f=a.isArray(d),c=f?d[0]:d,m=f?d[1]:d;if(p)v=v.replace(/\.svg_icon/g,"svg");a(v).each(function(){this.setAttribute("width",
c);this.setAttribute("height",m);if(window.opera&&window.widget){this.parentNode.style.width=c+"px";this.parentNode.style.height=m+"px"}})})}})(jQuery);(function(){function a(b,p,v){b=document.createElementNS(q.svg,b);if(g)for(var d in p)b.setAttribute(d,p[d]);else for(d in p){var f=p[d],c=b[d];if(c&&c.constructor==="SVGLength")c.baseVal.value=f;else b.setAttribute(d,f)}v&&v.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= c);this.setAttribute("height",m);if(window.opera&&window.widget){this.parentNode.style.width=c+"px";this.parentNode.style.height=m+"px"}})})}})(jQuery);(function(){function a(b,p,v){b=document.createElementNS(q.svg,b);if(g)for(var d in p)b.setAttribute(d,p[d]);else for(d in p){var f=p[d],c=b[d];if(c&&c.constructor==="SVGLength")c.baseVal.value=f;else b.setAttribute(d,f)}v&&v.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 g=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(b){var p= "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 g=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(b){var p=
arguments;return this.each(function(){function v(ia,aa,ka,M,P){var ca=P||a("stop",{"stop-color":aa,"stop-opacity":ka,offset:ia},ea);if(P){aa=P.getAttribute("stop-color");ka=P.getAttribute("stop-opacity");ia=P.getAttribute("offset")}else ea.appendChild(ca);if(ka===null)ka=1;P=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+ia*ga)+", 26)"},kb);var Da= arguments;return this.each(function(){function v(ia,aa,ka,M,P){var ca=P||a("stop",{"stop-color":aa,"stop-opacity":ka,offset:ia},ea);if(P){aa=P.getAttribute("stop-color");ka=P.getAttribute("stop-opacity");ia=P.getAttribute("offset")}else ea.appendChild(ca);if(ka===null)ka=1;P=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+ia*ga)+", 26)"},kb);var Da=
a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:aa,"fill-opacity":ka,transform:"translate("+(10+ia*ga)+", 26)",stroke:"#000","stroke-width":1.5},kb);$(Da).mousedown(function(Oa){d(this);Va=cb;Q.mousemove(m).mouseup(f);ta=vb.offset();Oa.preventDefault();return false}).data("stop",ca).data("bg",P).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Wa=+ca.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:aa,"fill-opacity":ka,transform:"translate("+(10+ia*ga)+", 26)",stroke:"#000","stroke-width":1.5},kb);$(Da).mousedown(function(Oa){d(this);Va=cb;S.mousemove(m).mouseup(f);ta=vb.offset();Oa.preventDefault();return false}).data("stop",ca).data("bg",P).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Wa=+ca.getAttribute("stop-opacity")||
1,Za=ca.getAttribute("stop-color")||1,nb=(parseFloat(Wa)*255).toString(16);nb.length<2;)nb="0"+nb;aa=Za.substr(1)+nb;$("#"+s+"_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:aa,alphaSupport:true}},function(Ra){Za=Ra.val("hex")?"#"+Ra.val("hex"):"none";Wa=Ra.val("a")!==null?Ra.val("a")/256:1;Oa.setAttribute("fill",Za);Oa.setAttribute("fill-opacity",Wa);ca.setAttribute("stop-color", 1,Za=ca.getAttribute("stop-color")||1,nb=(parseFloat(Wa)*255).toString(16);nb.length<2;)nb="0"+nb;aa=Za.substr(1)+nb;$("#"+s+"_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:aa,alphaSupport:true}},function(Ra){Za=Ra.val("hex")?"#"+Ra.val("hex"):"none";Wa=Ra.val("a")!==null?Ra.val("a")/256:1;Oa.setAttribute("fill",Za);Oa.setAttribute("fill-opacity",Wa);ca.setAttribute("stop-color",
Za);ca.setAttribute("stop-opacity",Wa);$("div.jGraduate_LightBox").hide();$("#"+s+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+s+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ia){if(!aa){var Wa=this.getAttribute("stop-color"),Za=this.getAttribute("stop-opacity");ca.setAttribute("stop-color",Wa);Da.setAttribute("fill",Wa);ca.setAttribute("stop-opacity",Za===null?1:Za);Da.setAttribute("fill-opacity", Za);ca.setAttribute("stop-opacity",Wa);$("div.jGraduate_LightBox").hide();$("#"+s+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+s+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ia){if(!aa){var Wa=this.getAttribute("stop-color"),Za=this.getAttribute("stop-opacity");ca.setAttribute("stop-color",Wa);Da.setAttribute("fill",Wa);ca.setAttribute("stop-opacity",Za===null?1:Za);Da.setAttribute("fill-opacity",
Za===null?1:Za)}Oa.before(ca);return false}});M&&d(Da);return ca}function d(ia){cb&&cb.setAttribute("stroke","#000");ia.setAttribute("stroke","blue");cb=ia;cb.parentNode.appendChild(cb)}function f(){Q.unbind("mousemove",m);if(Ea.getAttribute("display")!=="none"){Ea.setAttribute("display","none");var ia=$(cb),aa=ia.data("stop");ia=ia.data("bg");$([cb,aa,ia]).remove()}Va=null}function c(){var ia=Sa?"rotate("+Sa+","+Fa+","+db+") ":"";$a===1&&Ka===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform", Za===null?1:Za)}Oa.before(ca);return false}});M&&d(Da);return ca}function d(ia){cb&&cb.setAttribute("stroke","#000");ia.setAttribute("stroke","blue");cb=ia;cb.parentNode.appendChild(cb)}function f(){S.unbind("mousemove",m);if(Ea.getAttribute("display")!=="none"){Ea.setAttribute("display","none");var ia=$(cb),aa=ia.data("stop");ia=ia.data("bg");$([cb,aa,ia]).remove()}Va=null}function c(){var ia=Sa?"rotate("+Sa+","+Fa+","+db+") ":"";$a===1&&Ka===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform",
ia+"translate("+-Fa*($a-1)+","+-db*(Ka-1)+") scale("+$a+","+Ka+")")}function m(ia){var aa=ia.pageX-ta.left;ia=ia.pageY-ta.top;aa=aa<10?10:aa>ga+10?ga+10:aa;var ka="translate("+aa+", 26)";if(ia<-60||ia>130){Ea.setAttribute("display","block");Ea.setAttribute("transform",ka)}else Ea.setAttribute("display","none");Va.setAttribute("transform",ka);$.data(Va,"bg").setAttribute("transform",ka);$.data(Va,"stop").setAttribute("offset",(aa-10)/ga);var M=0;$(ea).find("stop").each(function(){var P=this.getAttribute("offset"), ia+"translate("+-Fa*($a-1)+","+-db*(Ka-1)+") scale("+$a+","+Ka+")")}function m(ia){var aa=ia.pageX-ta.left;ia=ia.pageY-ta.top;aa=aa<10?10:aa>ga+10?ga+10:aa;var ka="translate("+aa+", 26)";if(ia<-60||ia>130){Ea.setAttribute("display","block");Ea.setAttribute("transform",ka)}else Ea.setAttribute("display","none");Va.setAttribute("transform",ka);$.data(Va,"bg").setAttribute("transform",ka);$.data(Va,"stop").setAttribute("offset",(aa-10)/ga);var M=0;$(ea).find("stop").each(function(){var P=this.getAttribute("offset"),
ca=$(this);if(P<M){ca.prev().before(ca);va=$(ea).find("stop")}M=P})}var u=$(this),C=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),s=u.attr("id"),L="#"+u.attr("id")+" ";if(L){var R=function(){switch(u.paint.type){case "radialGradient":u.paint.linearGradient=null;break;case "linearGradient":u.paint.radialGradient=null;break;case "solidColor":u.paint.radialGradient=u.paint.linearGradient=null}$.isFunction(u.okCallback)&&u.okCallback(u.paint);u.hide()},K=function(){$.isFunction(u.cancelCallback)&&u.cancelCallback(); ca=$(this);if(P<M){ca.prev().before(ca);va=$(ea).find("stop")}M=P})}var u=$(this),C=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),s=u.attr("id"),L="#"+u.attr("id")+" ";if(L){var Q=function(){switch(u.paint.type){case "radialGradient":u.paint.linearGradient=null;break;case "linearGradient":u.paint.radialGradient=null;break;case "solidColor":u.paint.radialGradient=u.paint.linearGradient=null}$.isFunction(u.okCallback)&&u.okCallback(u.paint);u.hide()},K=function(){$.isFunction(u.cancelCallback)&&u.cancelCallback();
u.hide()};$.extend(true,u,{paint:new $.jGraduate.Paint({copy:C.paint}),okCallback:$.isFunction(p[1])&&p[1]||null,cancelCallback:$.isFunction(p[2])&&p[2]||null});u.position();var I=null,Q=$(window);if(u.paint.type=="none")u.paint=$.jGraduate.Paint({solidColor:"ffffff"});u.addClass("jGraduate_Picker");u.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="'+ u.hide()};$.extend(true,u,{paint:new $.jGraduate.Paint({copy:C.paint}),okCallback:$.isFunction(p[1])&&p[1]||null,cancelCallback:$.isFunction(p[2])&&p[2]||null});u.position();var H=null,S=$(window);if(u.paint.type=="none")u.paint=$.jGraduate.Paint({solidColor:"ffffff"});u.addClass("jGraduate_Picker");u.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+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var S=$(L+"> .jGraduate_colPick"),N=$(L+"> .jGraduate_gradPick");N.html('<div id="'+s+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+C.window.pickerTitle+'</h2><div id="'+s+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+s+'_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="'+ s+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var R=$(L+"> .jGraduate_colPick"),N=$(L+"> .jGraduate_gradPick");N.html('<div id="'+s+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+C.window.pickerTitle+'</h2><div id="'+s+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+s+'_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="'+
s+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_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="'+s+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+ s+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_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="'+s+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+
s+'_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+s+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="'+ s+'_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+s+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="'+
s+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'+s+'_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_jGraduate_fy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_StopSection jGraduate_SpreadMethod"><label class="jGraduate_Form_Heading">Spread method</label><div class="jGraduate_Form_Section"><select class="jGraduate_spreadMethod"><option value=pad selected>Pad</option><option value=reflect>Reflect</option><option value=repeat>Repeat</option></select></div></div><div class="jGraduate_Form"><div class="jGraduate_Slider jGraduate_RadiusField jGraduate_rg_field"><label class="prelabel">Radius:</label><div id="'+ s+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'+s+'_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_jGraduate_fy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_StopSection jGraduate_SpreadMethod"><label class="jGraduate_Form_Heading">Spread method</label><div class="jGraduate_Form_Section"><select class="jGraduate_spreadMethod"><option value=pad selected>Pad</option><option value=reflect>Reflect</option><option value=repeat>Repeat</option></select></div></div><div class="jGraduate_Form"><div class="jGraduate_Slider jGraduate_RadiusField jGraduate_rg_field"><label class="prelabel">Radius:</label><div id="'+
s+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+s+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+s+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+ s+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+s+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+s+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+
s+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+s+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+s+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+C.images.clientPath+ s+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+s+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+s+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+C.images.clientPath+
'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba&nbsp;</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+s+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+s+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_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="'+s+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba&nbsp;</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+s+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+s+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+
s+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+s+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var ga=256,na=ga-0,X=ga-0,U,ea,Aa,ja={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+s+"_jGraduate_GradContainer")[0],T=a("svg",{id:s+"_jgraduate_svg",width:ga,height:ga,xmlns:q.svg},ba);U=U||u.paint.type;var Z=ea=u.paint[U],oa=u.paint.alpha,pa=U==="solidColor";switch(U){case "solidColor":case "linearGradient":if(!pa){ea.id=s+"_lg_jgraduate_grad"; s+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+s+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var ga=256,oa=ga-0,X=ga-0,U,ea,Aa,ja={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+s+"_jGraduate_GradContainer")[0],T=a("svg",{id:s+"_jgraduate_svg",width:ga,height:ga,xmlns:q.svg},ba);U=U||u.paint.type;var Z=ea=u.paint[U],na=u.paint.alpha,pa=U==="solidColor";switch(U){case "solidColor":case "linearGradient":if(!pa){ea.id=s+"_lg_jgraduate_grad";
Z=ea=T.appendChild(ea)}a("radialGradient",{id:s+"_rg_jgraduate_grad"},T);if(U==="linearGradient")break;case "radialGradient":if(!pa){ea.id=s+"_rg_jgraduate_grad";Z=ea=T.appendChild(ea)}a("linearGradient",{id:s+"_lg_jgraduate_grad"},T)}if(pa){Z=ea=$("#"+s+"_lg_jgraduate_grad")[0];I=u.paint[U];v(0,"#"+I,1);var ma=typeof C.newstop;if(ma==="string")switch(C.newstop){case "same":v(1,"#"+I,1);break;case "inverse":ma="";for(var la=0;la<6;la+=2){I.substr(la,2);var xa=(255-parseInt(I.substr(la,2),16)).toString(16); Z=ea=T.appendChild(ea)}a("radialGradient",{id:s+"_rg_jgraduate_grad"},T);if(U==="linearGradient")break;case "radialGradient":if(!pa){ea.id=s+"_rg_jgraduate_grad";Z=ea=T.appendChild(ea)}a("linearGradient",{id:s+"_lg_jgraduate_grad"},T)}if(pa){Z=ea=$("#"+s+"_lg_jgraduate_grad")[0];H=u.paint[U];v(0,"#"+H,1);var ma=typeof C.newstop;if(ma==="string")switch(C.newstop){case "same":v(1,"#"+H,1);break;case "inverse":ma="";for(var la=0;la<6;la+=2){H.substr(la,2);var xa=(255-parseInt(H.substr(la,2),16)).toString(16);
if(xa.length<2)xa=0+xa;ma+=xa}v(1,"#"+ma,1);break;case "white":v(1,"#ffffff",1);break;case "black":v(1,"#000000",1)}else if(ma==="object")v(1,C.newstop.color||"#"+I,"opac"in C.newstop?C.newstop.opac:1)}I=parseFloat(Z.getAttribute("x1")||0);ma=parseFloat(Z.getAttribute("y1")||0);la=parseFloat(Z.getAttribute("x2")||1);xa=parseFloat(Z.getAttribute("y2")||0);var ya=parseFloat(Z.getAttribute("cx")||0.5),Ja=parseFloat(Z.getAttribute("cy")||0.5),Ha=parseFloat(Z.getAttribute("fx")||ya),Ga=parseFloat(Z.getAttribute("fy")|| if(xa.length<2)xa=0+xa;ma+=xa}v(1,"#"+ma,1);break;case "white":v(1,"#ffffff",1);break;case "black":v(1,"#000000",1)}else if(ma==="object")v(1,C.newstop.color||"#"+H,"opac"in C.newstop?C.newstop.opac:1)}H=parseFloat(Z.getAttribute("x1")||0);ma=parseFloat(Z.getAttribute("y1")||0);la=parseFloat(Z.getAttribute("x2")||1);xa=parseFloat(Z.getAttribute("y2")||0);var ya=parseFloat(Z.getAttribute("cx")||0.5),Ja=parseFloat(Z.getAttribute("cy")||0.5),Ha=parseFloat(Z.getAttribute("fx")||ya),Ga=parseFloat(Z.getAttribute("fy")||
Ja);Aa=a("rect",{id:s+"_jgraduate_rect",x:0,y:0,width:na,height:X,fill:"url(#"+s+"_jgraduate_grad)","fill-opacity":oa/100},T);var Ma=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*ga,left:I*ga}).data("coord","start").appendTo(ba),Ca=Ma.clone().text(2).css({top:xa*ga,left:la*ga}).attr("title","End stop").data("coord","end").appendTo(ba),wa=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ja*ga,left:ya* Ja);Aa=a("rect",{id:s+"_jgraduate_rect",x:0,y:0,width:oa,height:X,fill:"url(#"+s+"_jgraduate_grad)","fill-opacity":na/100},T);var Ma=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*ga,left:H*ga}).data("coord","start").appendTo(ba),Ca=Ma.clone().text(2).css({top:xa*ga,left:la*ga}).attr("title","End stop").data("coord","end").appendTo(ba),wa=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ja*ga,left:ya*
ga}).data("coord","center").appendTo(ba),ra=wa.clone().text("F").css({top:Ga*ga,left:Ha*ga,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);ra[0].id=s+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ia,aa){var ka=ea.getAttribute(aa),M=isNaN(aa[1]);ka||(ka=M?"0.5":aa==="x2"?"1.0":"0.0");ja[aa]=$("#"+s+"_jGraduate_"+aa).val(ka).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> ga}).data("coord","center").appendTo(ba),ra=wa.clone().text("F").css({top:Ga*ga,left:Ha*ga,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);ra[0].id=s+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ia,aa){var ka=ea.getAttribute(aa),M=isNaN(aa[1]);ka||(ka=M?"0.5":aa==="x2"?"1.0":"0.0");ja[aa]=$("#"+s+"_jGraduate_"+aa).val(ka).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>
1)this.value=1;if(!(aa[0]==="f"&&!eb))if(M&&U==="radialGradient"||!M&&U==="linearGradient")ea.setAttribute(aa,this.value);var P=M?aa[0]==="c"?wa:ra:aa[1]==="1"?Ma:Ca,ca=aa.indexOf("x")>=0?"left":"top";P.css(ca,this.value*ga)}).change()});var va,kb,vb=$("#"+s+"_jGraduate_StopSlider"),cb,Ta,Va,Ea=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Ta),ta,$a=1,Ka=1,Sa=0,Fa=ya,db=Ja;Ta=a("svg",{width:"100%",height:45},vb[0]);ba=a("pattern",{width:16, 1)this.value=1;if(!(aa[0]==="f"&&!eb))if(M&&U==="radialGradient"||!M&&U==="linearGradient")ea.setAttribute(aa,this.value);var P=M?aa[0]==="c"?wa:ra:aa[1]==="1"?Ma:Ca,ca=aa.indexOf("x")>=0?"left":"top";P.css(ca,this.value*ga)}).change()});var va,kb,vb=$("#"+s+"_jGraduate_StopSlider"),cb,Ta,Va,Ea=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Ta),ta,$a=1,Ka=1,Sa=0,Fa=ya,db=Ja;Ta=a("svg",{width:"100%",height:45},vb[0]);ba=a("pattern",{width:16,
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Ta);a("image",{width:16,height:16},ba).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Ta).on("click touchstart",function(ia){ta=vb.offset();if(ia.target.tagName!=="path"){var aa=ia.pageX-ta.left-8;aa=aa<10?10:aa>ga+10?ga+10:aa;v(aa/ga,0,0,true);ia.stopPropagation()}});$(Ta).mouseover(function(){Ta.appendChild(Ea)});kb=a("g",{},Ta);a("line",{x1:10,y1:15,x2:ga+10,y2:15,"stroke-width":2,stroke:"#000"},Ta);var lb= height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Ta);a("image",{width:16,height:16},ba).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Ta).on("click touchstart",function(ia){ta=vb.offset();if(ia.target.tagName!=="path"){var aa=ia.pageX-ta.left-8;aa=aa<10?10:aa>ga+10?ga+10:aa;v(aa/ga,0,0,true);ia.stopPropagation()}});$(Ta).mouseover(function(){Ta.appendChild(Ea)});kb=a("g",{},Ta);a("line",{x1:10,y1:15,x2:ga+10,y2:15,"stroke-width":2,stroke:"#000"},Ta);var lb=
N.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod",$(this).val())}),Ua=null,Xa=function(ia){var aa=ia.pageX-hb.left,ka=ia.pageY-hb.top;aa=aa<0?0:aa>ga?ga:aa;ka=ka<0?0:ka>ga?ga:ka;Ua.css("left",aa).css("top",ka);aa=aa/na;ka=ka/X;var M=Ua.data("coord"),P=ea;switch(M){case "start":ja.x1.val(aa);ja.y1.val(ka);P.setAttribute("x1",aa);P.setAttribute("y1",ka);break;case "end":ja.x2.val(aa);ja.y2.val(ka);P.setAttribute("x2",aa);P.setAttribute("y2",ka);break;case "center":ja.cx.val(aa); N.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod",$(this).val())}),Ua=null,Xa=function(ia){var aa=ia.pageX-hb.left,ka=ia.pageY-hb.top;aa=aa<0?0:aa>ga?ga:aa;ka=ka<0?0:ka>ga?ga:ka;Ua.css("left",aa).css("top",ka);aa=aa/oa;ka=ka/X;var M=Ua.data("coord"),P=ea;switch(M){case "start":ja.x1.val(aa);ja.y1.val(ka);P.setAttribute("x1",aa);P.setAttribute("y1",ka);break;case "end":ja.x2.val(aa);ja.y2.val(ka);P.setAttribute("x2",aa);P.setAttribute("y2",ka);break;case "center":ja.cx.val(aa);
ja.cy.val(ka);P.setAttribute("cx",aa);P.setAttribute("cy",ka);Fa=aa;db=ka;c();break;case "focus":ja.fx.val(aa);ja.fy.val(ka);P.setAttribute("fx",aa);P.setAttribute("fy",ka);c()}ia.preventDefault()},wb=function(){Ua=null;Q.unbind("mousemove",Xa).unbind("mouseup",wb)};va=ea.getElementsByTagNameNS(q.svg,"stop");if(sa<2){for(;sa<2;){ea.appendChild(document.createElementNS(q.svg,"stop"));++sa}va=ea.getElementsByTagNameNS(q.svg,"stop")}var sa=va.length;for(la=0;la<sa;la++)v(0,0,0,0,va[la]);lb.val(ea.getAttribute("spreadMethod")|| ja.cy.val(ka);P.setAttribute("cx",aa);P.setAttribute("cy",ka);Fa=aa;db=ka;c();break;case "focus":ja.fx.val(aa);ja.fy.val(ka);P.setAttribute("fx",aa);P.setAttribute("fy",ka);c()}ia.preventDefault()},wb=function(){Ua=null;S.unbind("mousemove",Xa).unbind("mouseup",wb)};va=ea.getElementsByTagNameNS(q.svg,"stop");if(sa<2){for(;sa<2;){ea.appendChild(document.createElementNS(q.svg,"stop"));++sa}va=ea.getElementsByTagNameNS(q.svg,"stop")}var sa=va.length;for(la=0;la<sa;la++)v(0,0,0,0,va[la]);lb.val(ea.getAttribute("spreadMethod")||
"pad");var hb,eb=false;Aa.setAttribute("fill-opacity",oa/100);$("#"+s+" div.grad_coord").mousedown(function(ia){ia.preventDefault();Ua=$(this);Ua.offset();hb=Ua.parent().offset();Q.mousemove(Xa).mouseup(wb)});$("#"+s+"_jGraduate_Ok").bind("click touchstart",function(){u.paint.type=U;u.paint[U]=ea.cloneNode(true);u.paint.solidColor=null;R()});$("#"+s+"_jGraduate_Cancel").bind("click touchstart",function(){K()});if(U==="radialGradient")if(eb)ra.show();else{ra.hide();ja.fx.val("");ja.fy.val("")}$("#"+ "pad");var hb,eb=false;Aa.setAttribute("fill-opacity",na/100);$("#"+s+" div.grad_coord").mousedown(function(ia){ia.preventDefault();Ua=$(this);Ua.offset();hb=Ua.parent().offset();S.mousemove(Xa).mouseup(wb)});$("#"+s+"_jGraduate_Ok").bind("click touchstart",function(){u.paint.type=U;u.paint[U]=ea.cloneNode(true);u.paint.solidColor=null;Q()});$("#"+s+"_jGraduate_Cancel").bind("click touchstart",function(){K()});if(U==="radialGradient")if(eb)ra.show();else{ra.hide();ja.fx.val("");ja.fy.val("")}$("#"+
s+"_jGraduate_match_ctr")[0].checked=!eb;var sb,ib;$("#"+s+"_jGraduate_match_ctr").change(function(){eb=!this.checked;ra.toggle(eb);ja.fx.val("");ja.fy.val("");var ia=ea;if(eb){var aa=sb||0.5,ka=ib||0.5;ia.setAttribute("fx",aa);ia.setAttribute("fy",ka);ja.fx.val(aa);ja.fy.val(ka)}else{sb=ia.getAttribute("fx");ib=ia.getAttribute("fy");ia.removeAttribute("fx");ia.removeAttribute("fy")}});va=ea.getElementsByTagNameNS(q.svg,"stop");sa=va.length;if(sa<2){for(;sa<2;){ea.appendChild(document.createElementNS(q.svg, s+"_jGraduate_match_ctr")[0].checked=!eb;var sb,ib;$("#"+s+"_jGraduate_match_ctr").change(function(){eb=!this.checked;ra.toggle(eb);ja.fx.val("");ja.fy.val("");var ia=ea;if(eb){var aa=sb||0.5,ka=ib||0.5;ia.setAttribute("fx",aa);ia.setAttribute("fy",ka);ja.fx.val(aa);ja.fy.val(ka)}else{sb=ia.getAttribute("fx");ib=ia.getAttribute("fy");ia.removeAttribute("fx");ia.removeAttribute("fy")}});va=ea.getElementsByTagNameNS(q.svg,"stop");sa=va.length;if(sa<2){for(;sa<2;){ea.appendChild(document.createElementNS(q.svg,
"stop"));++sa}va=ea.getElementsByTagNameNS(q.svg,"stop")}var ab;oa=N=0;if(U==="radialGradient"){T=ea.gradientTransform.baseVal;if(T.numberOfItems===2){sa=T.getItem(0);T=T.getItem(1);if(sa.type===2&&T.type===3){sa=T.matrix;if(sa.a!==1)N=Math.round(-(1-sa.a)*100);else if(sa.d!==1)N=Math.round((1-sa.d)*100)}}else if(T.numberOfItems===3){ba=T.getItem(0);sa=T.getItem(1);T=T.getItem(2);if(ba.type===4&&sa.type===2&&T.type===3){oa=Math.round(ba.angle);sa=T.matrix;if(sa.a!==1)N=Math.round(-(1-sa.a)*100);else if(sa.d!== "stop"));++sa}va=ea.getElementsByTagNameNS(q.svg,"stop")}var ab;na=N=0;if(U==="radialGradient"){T=ea.gradientTransform.baseVal;if(T.numberOfItems===2){sa=T.getItem(0);T=T.getItem(1);if(sa.type===2&&T.type===3){sa=T.matrix;if(sa.a!==1)N=Math.round(-(1-sa.a)*100);else if(sa.d!==1)N=Math.round((1-sa.d)*100)}}else if(T.numberOfItems===3){ba=T.getItem(0);sa=T.getItem(1);T=T.getItem(2);if(ba.type===4&&sa.type===2&&T.type===3){na=Math.round(ba.angle);sa=T.matrix;if(sa.a!==1)N=Math.round(-(1-sa.a)*100);else if(sa.d!==
1)N=Math.round((1-sa.d)*100)}}}N={radius:{handle:"#"+s+"_jGraduate_RadiusArrows",input:"#"+s+"_jGraduate_RadiusInput",val:(ea.getAttribute("r")||0.5)*100},opacity:{handle:"#"+s+"_jGraduate_OpacArrows",input:"#"+s+"_jGraduate_OpacInput",val:u.paint.alpha||100},ellip:{handle:"#"+s+"_jGraduate_EllipArrows",input:"#"+s+"_jGraduate_EllipInput",val:N},angle:{handle:"#"+s+"_jGraduate_AngleArrows",input:"#"+s+"_jGraduate_AngleInput",val:oa}};$.each(N,function(ia,aa){var ka=$(aa.handle);ka.mousedown(function(M){var P= 1)N=Math.round((1-sa.d)*100)}}}N={radius:{handle:"#"+s+"_jGraduate_RadiusArrows",input:"#"+s+"_jGraduate_RadiusInput",val:(ea.getAttribute("r")||0.5)*100},opacity:{handle:"#"+s+"_jGraduate_OpacArrows",input:"#"+s+"_jGraduate_OpacInput",val:u.paint.alpha||100},ellip:{handle:"#"+s+"_jGraduate_EllipArrows",input:"#"+s+"_jGraduate_EllipInput",val:N},angle:{handle:"#"+s+"_jGraduate_AngleArrows",input:"#"+s+"_jGraduate_AngleInput",val:na}};$.each(N,function(ia,aa){var ka=$(aa.handle);ka.mousedown(function(M){var P=
ka.parent();ab={type:ia,elem:ka,input:$(aa.input),parent:P,offset:P.offset()};Q.mousemove(ob).mouseup(pb);M.preventDefault()});$(aa.input).val(aa.val).change(function(){var M=+this.value,P=0,ca=U==="radialGradient";switch(ia){case "radius":ca&&ea.setAttribute("r",M/100);P=Math.pow(M/100,0.4)/2*145;break;case "opacity":u.paint.alpha=M;Aa.setAttribute("fill-opacity",M/100);P=M*1.45;break;case "ellip":$a=Ka=1;if(M===0){P=72.5;break}if(M>99.5)M=99.5;if(M>0)Ka=1-M/100;else $a=-(M/100)-1;P=145*((M+100)/ ka.parent();ab={type:ia,elem:ka,input:$(aa.input),parent:P,offset:P.offset()};S.mousemove(ob).mouseup(pb);M.preventDefault()});$(aa.input).val(aa.val).change(function(){var M=+this.value,P=0,ca=U==="radialGradient";switch(ia){case "radius":ca&&ea.setAttribute("r",M/100);P=Math.pow(M/100,0.4)/2*145;break;case "opacity":u.paint.alpha=M;Aa.setAttribute("fill-opacity",M/100);P=M*1.45;break;case "ellip":$a=Ka=1;if(M===0){P=72.5;break}if(M>99.5)M=99.5;if(M>0)Ka=1-M/100;else $a=-(M/100)-1;P=145*((M+100)/
2)/100;ca&&c();break;case "angle":Sa=M;P=Sa/180;P+=0.5;P*=145;ca&&c()}if(P>145)P=145;else if(P<0)P=0;ka.css({"margin-left":P-5})}).change()});var ob=function(ia){var aa=ia.pageX-ab.offset.left-parseInt(ab.parent.css("border-left-width"));if(aa>145)aa=145;if(aa<=0)aa=0;var ka=aa-5;aa/=145;switch(ab.type){case "radius":aa=Math.pow(aa*2,2.5);if(aa>0.98&&aa<1.02)aa=1;if(aa<=0.01)aa=0.01;ea.setAttribute("r",aa);break;case "opacity":u.paint.alpha=parseInt(aa*100);Aa.setAttribute("fill-opacity",aa);break; 2)/100;ca&&c();break;case "angle":Sa=M;P=Sa/180;P+=0.5;P*=145;ca&&c()}if(P>145)P=145;else if(P<0)P=0;ka.css({"margin-left":P-5})}).change()});var ob=function(ia){var aa=ia.pageX-ab.offset.left-parseInt(ab.parent.css("border-left-width"));if(aa>145)aa=145;if(aa<=0)aa=0;var ka=aa-5;aa/=145;switch(ab.type){case "radius":aa=Math.pow(aa*2,2.5);if(aa>0.98&&aa<1.02)aa=1;if(aa<=0.01)aa=0.01;ea.setAttribute("r",aa);break;case "opacity":u.paint.alpha=parseInt(aa*100);Aa.setAttribute("fill-opacity",aa);break;
case "ellip":Ka=$a=1;if(aa<0.5){aa/=0.5;$a=aa<=0?0.01:aa}else if(aa>0.5){aa/=0.5;aa=2-aa;Ka=aa<=0?0.01:aa}c();aa-=1;if(Ka===aa+1)aa=Math.abs(aa);break;case "angle":aa-=0.5;Sa=aa*=180;c();aa/=100}ab.elem.css({"margin-left":ka});aa=Math.round(aa*100);ab.input.val(aa);ia.preventDefault()},pb=function(){Q.unbind("mousemove",ob).unbind("mouseup",pb);ab=null};for(N=(u.paint.alpha*255/100).toString(16);N.length<2;)N="0"+N;N=N.split(".")[0];I=u.paint.solidColor=="none"?"":u.paint.solidColor+N;pa||(I=va[0].getAttribute("stop-color")); case "ellip":Ka=$a=1;if(aa<0.5){aa/=0.5;$a=aa<=0?0.01:aa}else if(aa>0.5){aa/=0.5;aa=2-aa;Ka=aa<=0?0.01:aa}c();aa-=1;if(Ka===aa+1)aa=Math.abs(aa);break;case "angle":aa-=0.5;Sa=aa*=180;c();aa/=100}ab.elem.css({"margin-left":ka});aa=Math.round(aa*100);ab.input.val(aa);ia.preventDefault()},pb=function(){S.unbind("mousemove",ob).unbind("mouseup",pb);ab=null};for(N=(u.paint.alpha*255/100).toString(16);N.length<2;)N="0"+N;N=N.split(".")[0];H=u.paint.solidColor=="none"?"":u.paint.solidColor+N;pa||(H=va[0].getAttribute("stop-color"));
$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});S.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:I,alphaSupport:true}},function(ia){u.paint.type="solidColor";u.paint.alpha=ia.val("ahex")?Math.round(ia.val("a")/255*100):100;u.paint.solidColor=ia.val("hex")?ia.val("hex"):"none";u.paint.radialGradient=null;R()},null,function(){K()});var fb=$(L+" .jGraduate_tabs li");fb.on("click touchstart",function(){fb.removeClass("jGraduate_tab_current"); $.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});R.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:H,alphaSupport:true}},function(ia){u.paint.type="solidColor";u.paint.alpha=ia.val("ahex")?Math.round(ia.val("a")/255*100):100;u.paint.solidColor=ia.val("hex")?ia.val("hex"):"none";u.paint.radialGradient=null;Q()},null,function(){K()});var fb=$(L+" .jGraduate_tabs li");fb.on("click touchstart",function(){fb.removeClass("jGraduate_tab_current");
$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ia=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ia==="rg"||ia==="lg"){$(".jGraduate_"+ia+"_field").show();$(".jGraduate_"+(ia==="lg"?"rg":"lg")+"_field").hide();$("#"+s+"_jgraduate_rect")[0].setAttribute("fill","url(#"+s+"_"+ia+"_jgraduate_grad)");U=ia==="lg"?"linearGradient":"radialGradient";$("#"+s+"_jGraduate_OpacInput").val(u.paint.alpha).change();var aa=$("#"+s+"_"+ia+"_jgraduate_grad")[0];if(ea!==aa){var ka= $(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ia=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ia==="rg"||ia==="lg"){$(".jGraduate_"+ia+"_field").show();$(".jGraduate_"+(ia==="lg"?"rg":"lg")+"_field").hide();$("#"+s+"_jgraduate_rect")[0].setAttribute("fill","url(#"+s+"_"+ia+"_jgraduate_grad)");U=ia==="lg"?"linearGradient":"radialGradient";$("#"+s+"_jGraduate_OpacInput").val(u.paint.alpha).change();var aa=$("#"+s+"_"+ia+"_jgraduate_grad")[0];if(ea!==aa){var ka=
$(ea).find("stop");$(aa).empty().append(ka);ea=aa;aa=lb.val();ea.setAttribute("spreadMethod",aa)}eb=ia==="rg"&&ea.getAttribute("fx")!=null&&!(ya==Ha&&Ja==Ga);$("#"+s+"_jGraduate_focusCoord").toggle(eb);if(eb)$("#"+s+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();fb.removeClass("jGraduate_tab_current");var tb;switch(u.paint.type){case "linearGradient":tb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":tb= $(ea).find("stop");$(aa).empty().append(ka);ea=aa;aa=lb.val();ea.setAttribute("spreadMethod",aa)}eb=ia==="rg"&&ea.getAttribute("fx")!=null&&!(ya==Ha&&Ja==Ga);$("#"+s+"_jGraduate_focusCoord").toggle(eb);if(eb)$("#"+s+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();fb.removeClass("jGraduate_tab_current");var tb;switch(u.paint.type){case "linearGradient":tb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":tb=
$(L+" .jGraduate_tab_radgrad");break;default:tb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){tb.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(g,b){if(g.menu==undefined)return false;if(g.inSpeed==undefined)g.inSpeed=150;if(g.outSpeed==undefined)g.outSpeed=75;if(g.inSpeed==0)g.inSpeed=-1;if(g.outSpeed==0)g.outSpeed=-1;$(this).each(function(){var p=$(this),v=$(p).offset(),d=$("#"+g.menu);d.addClass("contextMenu");$(this).bind("mousedown",function(c){$(this).on("mouseup",function(m){var u=$(this);u.unbind("mouseup");$(".contextMenu").hide();if(c.button===2|| $(L+" .jGraduate_tab_radgrad");break;default:tb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){tb.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(g,b){if(g.menu==undefined)return false;if(g.inSpeed==undefined)g.inSpeed=150;if(g.outSpeed==undefined)g.outSpeed=75;if(g.inSpeed==0)g.inSpeed=-1;if(g.outSpeed==0)g.outSpeed=-1;$(this).each(function(){var p=$(this),v=$(p).offset(),d=$("#"+g.menu);d.addClass("contextMenu");$(this).bind("mousedown",function(c){$(this).on("mouseup",function(m){var u=$(this);u.unbind("mouseup");$(".contextMenu").hide();if(c.button===2||
@ -61,16 +61,16 @@ $(u),{x:C-v.left,y:s-v.top,docX:C,docY:s});return false});setTimeout(function(){
function(){return false})});return $(this)},disableContextMenuItems:function(g){if(g==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var b=g.split(","),p=0;p<b.length;p++)$(this).find('A[href="'+b[p]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(g){if(g==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var b=g.split(","),p= function(){return false})});return $(this)},disableContextMenuItems:function(g){if(g==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var b=g.split(","),p=0;p<b.length;p++)$(this).find('A[href="'+b[p]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(g){if(g==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var b=g.split(","),p=
0;p<b.length;p++)$(this).find('A[href="'+b[p]+'"]').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;p<b.length;p++)$(this).find('A[href="'+b[p]+'"]').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,g=document.createElementNS("http://www.w3.org/2000/svg","svg"),b=!!window.opera,p=q.indexOf("AppleWebKit")>=0,v=q.indexOf("Gecko/")>=0,d=q.indexOf("MSIE")>=0,f=q.indexOf("Chrome/")>=0,c=q.indexOf("Windows")>=0,m=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,g=document.createElementNS("http://www.w3.org/2000/svg","svg"),b=!!window.opera,p=q.indexOf("AppleWebKit")>=0,v=q.indexOf("Gecko/")>=0,d=q.indexOf("MSIE")>=0,f=q.indexOf("Chrome/")>=0,c=q.indexOf("Windows")>=0,m=q.indexOf("Macintosh")>=
0,u="ontouchstart"in window,C=!!g.querySelector,s=!!document.evaluate,L=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var X=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{X.replaceItem(na,0);return true}catch(U){}return false}(),R=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var X=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{X.insertItemBefore(na, 0,u="ontouchstart"in window,C=!!g.querySelector,s=!!document.evaluate,L=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","path");oa.setAttribute("d","M0,0 10,10");var X=oa.pathSegList;oa=oa.createSVGPathSegLinetoAbs(5,5);try{X.replaceItem(oa,0);return true}catch(U){}return false}(),Q=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","path");oa.setAttribute("d","M0,0 10,10");var X=oa.pathSegList;oa=oa.createSVGPathSegLinetoAbs(5,5);try{X.insertItemBefore(oa,
0);return true}catch(U){}return false}(),K=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg"),X=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);X.setAttribute("x",5);na.appendChild(X);var U=document.createElementNS("http://www.w3.org/2000/svg","text");U.textContent="a";X.appendChild(U);X=U.getStartPositionOfChar(0);X=X.x;document.documentElement.removeChild(na);return X===0}(),I=function(){var na=document.createElementNS("http://www.w3.org/2000/svg", 0);return true}catch(U){}return false}(),K=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","svg"),X=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(oa);X.setAttribute("x",5);oa.appendChild(X);var U=document.createElementNS("http://www.w3.org/2000/svg","text");U.textContent="a";X.appendChild(U);X=U.getStartPositionOfChar(0);X=X.x;document.documentElement.removeChild(oa);return X===0}(),H=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg",
"svg");document.documentElement.appendChild(na);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 C0,0 10,10 10,0");na.appendChild(X);X=X.getBBox();document.documentElement.removeChild(na);return X.height>4&&X.height<5}(),Q=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 10,0");var U=document.createElementNS("http://www.w3.org/2000/svg", "svg");document.documentElement.appendChild(oa);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 C0,0 10,10 10,0");oa.appendChild(X);X=X.getBBox();document.documentElement.removeChild(oa);return X.height>4&&X.height<5}(),S=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(oa);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 10,0");var U=document.createElementNS("http://www.w3.org/2000/svg",
"path");U.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(X);ea.appendChild(U);na.appendChild(ea);X=ea.getBBox();document.documentElement.removeChild(na);return X.width==15}(),S=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."); "path");U.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(X);ea.appendChild(U);oa.appendChild(ea);X=ea.getBBox();document.documentElement.removeChild(oa);return X.width==15}(),R=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect");oa.setAttribute("x",0.1);(oa=oa.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 na}(),N=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"}(),ga=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,X=g.createSVGTransform();na.appendItem(X);return na.getItem(0)==X}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return p};svgedit.browser.isGecko=function(){return v}; return oa}(),N=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect");oa.setAttribute("style","vector-effect:non-scaling-stroke");return oa.style.vectorEffect==="non-scaling-stroke"}(),ga=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,X=g.createSVGTransform();oa.appendItem(X);return oa.getItem(0)==X}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return p};svgedit.browser.isGecko=function(){return v};
svgedit.browser.isIE=function(){return d};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return c};svgedit.browser.isMac=function(){return m};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return C};svgedit.browser.supportsXpath=function(){return s};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return R};svgedit.browser.supportsPathBBox=function(){return I}; svgedit.browser.isIE=function(){return d};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return c};svgedit.browser.isMac=function(){return m};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return C};svgedit.browser.supportsXpath=function(){return s};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return Q};svgedit.browser.supportsPathBBox=function(){return H};
svgedit.browser.supportsHVLineContainerBBox=function(){return Q};svgedit.browser.supportsGoodTextCharPos=function(){return K};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return S};svgedit.browser.supportsNonScalingStroke=function(){return N};svgedit.browser.supportsNativeTransformLists=function(){return ga}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; svgedit.browser.supportsHVLineContainerBBox=function(){return S};svgedit.browser.supportsGoodTextCharPos=function(){return K};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return R};svgedit.browser.supportsNonScalingStroke=function(){return N};svgedit.browser.supportsNativeTransformLists=function(){return ga}}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(g){this._elem=g||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var p=0;p<this.numberOfItems;++p){var v=this._list.getItem(p);b=b;v=v;var d=v.matrix,f="";switch(v.type){case 1:f="matrix("+[d.a,d.b,d.c,d.d,d.e,d.f].join(",")+")";break;case 2:f="translate("+d.e+","+d.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(g){this._elem=g||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var p=0;p<this.numberOfItems;++p){var v=this._list.getItem(p);b=b;v=v;var d=v.matrix,f="";switch(v.type){case 1:f="matrix("+[d.a,d.b,d.c,d.d,d.e,d.f].join(",")+")";break;case 2:f="translate("+d.e+","+d.f+")";break;case 3:f=
d.a==d.d?"scale("+d.a+")":"scale("+d.a+","+d.d+")";break;case 4:var c=0;f=0;if(v.angle!=0){c=1-d.a;f=(c*d.f+d.b*d.e)/(c*c+d.b*d.b);c=(d.e-d.b*f)/c}f="rotate("+v.angle+" "+c+","+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 p=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,v=true;v;){v=b.match(p);b=b.replace(p,"");if(v&&v[1]){var d=v[1].split(/\s*\(/),f=d[0];d=d[1].match(/\s*(.*?)\s*\)/); d.a==d.d?"scale("+d.a+")":"scale("+d.a+","+d.d+")";break;case 4:var c=0;f=0;if(v.angle!=0){c=1-d.a;f=(c*d.f+d.b*d.e)/(c*c+d.b*d.b);c=(d.e-d.b*f)/c}f="rotate("+v.angle+" "+c+","+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 p=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,v=true;v;){v=b.match(p);b=b.replace(p,"");if(v&&v[1]){var d=v[1].split(/\s*\(/),f=d[0];d=d[1].match(/\s*(.*?)\s*\)/);
d[1]=d[1].replace(/(\d)-/g,"$1 -");var c=d[1].split(/[, ]+/),m="abcdef".split(""),u=a.createSVGMatrix();$.each(c,function(L,R){c[L]=parseFloat(R);if(f=="matrix")u[m[L]]=c[L]});d=a.createSVGTransform();var C="set"+f.charAt(0).toUpperCase()+f.slice(1),s=f=="matrix"?[u]:c;if(f=="scale"&&s.length==1)s.push(s[0]);else if(f=="translate"&&s.length==1)s.push(0);else if(f=="rotate"&&s.length==1){s.push(0);s.push(0)}d[C].apply(d,s);this._list.appendItem(d)}}};this._removeFromOtherLists=function(b){if(b){var p= d[1]=d[1].replace(/(\d)-/g,"$1 -");var c=d[1].split(/[, ]+/),m="abcdef".split(""),u=a.createSVGMatrix();$.each(c,function(L,Q){c[L]=parseFloat(Q);if(f=="matrix")u[m[L]]=c[L]});d=a.createSVGTransform();var C="set"+f.charAt(0).toUpperCase()+f.slice(1),s=f=="matrix"?[u]:c;if(f=="scale"&&s.length==1)s.push(s[0]);else if(f=="translate"&&s.length==1)s.push(0);else if(f=="rotate"&&s.length==1){s.push(0);s.push(0)}d[C].apply(d,s);this._list.appendItem(d)}}};this._removeFromOtherLists=function(b){if(b){var p=
false,v;for(v in q){for(var d=q[v],f=0,c=d._xforms.length;f<c;++f)if(d._xforms[f]==b){p=true;d.removeItem(f);break}if(p)break}}};this.numberOfItems=0;this.clear=function(){this.numberOfItems=0;this._xforms=[]};this.initialize=function(b){this.numberOfItems=1;this._removeFromOtherLists(b);this._xforms=[b]};this.getItem=function(b){if(b<this.numberOfItems&&b>=0)return this._xforms[b];throw{code:1};};this.insertItemBefore=function(b,p){var v=null;if(p>=0)if(p<this.numberOfItems){this._removeFromOtherLists(b); false,v;for(v in q){for(var d=q[v],f=0,c=d._xforms.length;f<c;++f)if(d._xforms[f]==b){p=true;d.removeItem(f);break}if(p)break}}};this.numberOfItems=0;this.clear=function(){this.numberOfItems=0;this._xforms=[]};this.initialize=function(b){this.numberOfItems=1;this._removeFromOtherLists(b);this._xforms=[b]};this.getItem=function(b){if(b<this.numberOfItems&&b>=0)return this._xforms[b];throw{code:1};};this.insertItemBefore=function(b,p){var v=null;if(p>=0)if(p<this.numberOfItems){this._removeFromOtherLists(b);
v=Array(this.numberOfItems+1);for(var d=0;d<p;++d)v[d]=this._xforms[d];v[d]=b;for(var f=d+1;d<this.numberOfItems;++f,++d)v[f]=this._xforms[d];this.numberOfItems++;this._xforms=v;v=b;this._list._update()}else v=this._list.appendItem(b);return v};this.replaceItem=function(b,p){var v=null;if(p<this.numberOfItems&&p>=0){this._removeFromOtherLists(b);v=this._xforms[p]=b;this._list._update()}return v};this.removeItem=function(b){if(b<this.numberOfItems&&b>=0){for(var p=this._xforms[b],v=Array(this.numberOfItems- v=Array(this.numberOfItems+1);for(var d=0;d<p;++d)v[d]=this._xforms[d];v[d]=b;for(var f=d+1;d<this.numberOfItems;++f,++d)v[f]=this._xforms[d];this.numberOfItems++;this._xforms=v;v=b;this._list._update()}else v=this._list.appendItem(b);return v};this.replaceItem=function(b,p){var v=null;if(p<this.numberOfItems&&p>=0){this._removeFromOtherLists(b);v=this._xforms[p]=b;this._list._update()}return v};this.removeItem=function(b){if(b<this.numberOfItems&&b>=0){for(var p=this._xforms[b],v=Array(this.numberOfItems-
1),d=0;d<b;++d)v[d]=this._xforms[d];for(b=d;b<this.numberOfItems-1;++b,++d)v[b]=this._xforms[d+1];this.numberOfItems--;this._xforms=v;this._list._update();return p}else throw{code:1};};this.appendItem=function(b){this._removeFromOtherLists(b);this._xforms.push(b);this.numberOfItems++;this._list._update();return b}};svgedit.transformlist.resetListMap=function(){q={}};svgedit.transformlist.removeElementFromListMap=function(g){g.id&&q[g.id]&&delete q[g.id]};svgedit.transformlist.getTransformList=function(g){if(svgedit.browser.supportsNativeTransformLists())if(g.transform)return g.transform.baseVal; 1),d=0;d<b;++d)v[d]=this._xforms[d];for(b=d;b<this.numberOfItems-1;++b,++d)v[b]=this._xforms[d+1];this.numberOfItems--;this._xforms=v;this._list._update();return p}else throw{code:1};};this.appendItem=function(b){this._removeFromOtherLists(b);this._xforms.push(b);this.numberOfItems++;this._list._update();return b}};svgedit.transformlist.resetListMap=function(){q={}};svgedit.transformlist.removeElementFromListMap=function(g){g.id&&q[g.id]&&delete q[g.id]};svgedit.transformlist.getTransformList=function(g){if(svgedit.browser.supportsNativeTransformLists())if(g.transform)return g.transform.baseVal;
@ -87,14 +87,14 @@ function(d,f){if(!isNaN(f))return f-0;if(f.substr(-1)==="%"){var c=f.substr(0,f.
d=u==null||u===c}catch(C){}return d}else m=true;return m}})();svgedit=svgedit||{}; d=u==null||u===c}catch(C){}return d}else m=true;return m}})();svgedit=svgedit||{};
(function(){function a(d){if(svgedit.browser.supportsHVLineContainerBBox())try{return d.getBBox()}catch(f){}var c=$.data(d,"ref"),m=null;if(c){var u=$(c).children().clone().attr("visibility","hidden");$(v).append(u);m=u.filter("line, path")}else m=$(d).find("line, path");var C=false;if(m.length){m.each(function(){var s=this.getBBox();if(!s.width||!s.height)C=true});if(C){d=c?u:$(d).children();ret=getStrokedBBox(d)}else ret=d.getBBox()}else ret=d.getBBox();c&&u.remove();return ret}if(!svgedit.utilities)svgedit.utilities= (function(){function a(d){if(svgedit.browser.supportsHVLineContainerBBox())try{return d.getBBox()}catch(f){}var c=$.data(d,"ref"),m=null;if(c){var u=$(c).children().clone().attr("visibility","hidden");$(v).append(u);m=u.filter("line, path")}else m=$(d).find("line, path");var C=false;if(m.length){m.each(function(){var s=this.getBBox();if(!s.width||!s.height)C=true});if(C){d=c?u:$(d).children();ret=getStrokedBBox(d)}else ret=d.getBBox()}else ret=d.getBBox();c&&u.remove();return ret}if(!svgedit.utilities)svgedit.utilities=
{};var q="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),g=null,b=null,p=null,v=null;svgedit.utilities.init=function(d){g=d;b=d.getDOMDocument();p=d.getDOMContainer();v=d.getSVGRoot()};svgedit.utilities.toXml=function(d){return $("<p/>").text(d).html()};svgedit.utilities.fromXml=function(d){return $("<p/>").html(d).text()};svgedit.utilities.encode64=function(d){d=svgedit.utilities.convertToXMLReferences(d);if(window.btoa)return window.btoa(d); {};var q="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),g=null,b=null,p=null,v=null;svgedit.utilities.init=function(d){g=d;b=d.getDOMDocument();p=d.getDOMContainer();v=d.getSVGRoot()};svgedit.utilities.toXml=function(d){return $("<p/>").text(d).html()};svgedit.utilities.fromXml=function(d){return $("<p/>").html(d).text()};svgedit.utilities.encode64=function(d){d=svgedit.utilities.convertToXMLReferences(d);if(window.btoa)return window.btoa(d);
var f=Array(Math.floor((d.length+2)/3)*4),c,m,u,C,s,L,R=0,K=0;do{c=d.charCodeAt(R++);m=d.charCodeAt(R++);u=d.charCodeAt(R++);C=c>>2;c=(c&3)<<4|m>>4;s=(m&15)<<2|u>>6;L=u&63;if(isNaN(m))s=L=64;else if(isNaN(u))L=64;f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(C);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(s);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(R< var f=Array(Math.floor((d.length+2)/3)*4),c,m,u,C,s,L,Q=0,K=0;do{c=d.charCodeAt(Q++);m=d.charCodeAt(Q++);u=d.charCodeAt(Q++);C=c>>2;c=(c&3)<<4|m>>4;s=(m&15)<<2|u>>6;L=u&63;if(isNaN(m))s=L=64;else if(isNaN(u))L=64;f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(C);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(s);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(Q<
d.length);return f.join("")};svgedit.utilities.decode64=function(d){if(window.atob)return window.atob(d);var f="",c,m,u="",C,s="",L=0;d=d.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++)); d.length);return f.join("")};svgedit.utilities.decode64=function(d){if(window.atob)return window.atob(d);var f="",c,m,u="",C,s="",L=0;d=d.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));
c=c<<2|m>>4;m=(m&15)<<4|C>>2;u=(C&3)<<6|s;f+=String.fromCharCode(c);if(C!=64)f+=String.fromCharCode(m);if(s!=64)f+=String.fromCharCode(u)}while(L<d.length);return unescape(f)};svgedit.utilities.convertToXMLReferences=function(d){for(var f="",c=0;c<d.length;c++){var m=d.charCodeAt(c);if(m<128)f+=d[c];else if(m>127)f+="&#"+m+";"}return f};svgedit.utilities.text2xml=function(d){if(d.indexOf("<svg:svg")>=0)d=d.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var f;try{var c=window.DOMParser? c=c<<2|m>>4;m=(m&15)<<4|C>>2;u=(C&3)<<6|s;f+=String.fromCharCode(c);if(C!=64)f+=String.fromCharCode(m);if(s!=64)f+=String.fromCharCode(u)}while(L<d.length);return unescape(f)};svgedit.utilities.convertToXMLReferences=function(d){for(var f="",c=0;c<d.length;c++){var m=d.charCodeAt(c);if(m<128)f+=d[c];else if(m>127)f+="&#"+m+";"}return f};svgedit.utilities.text2xml=function(d){if(d.indexOf("<svg:svg")>=0)d=d.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var f;try{var c=window.DOMParser?
new DOMParser:new ActiveXObject("Microsoft.XMLDOM");c.async=false}catch(m){throw Error("XML Parser could not be instantiated");}try{f=c.loadXML?c.loadXML(d)?c:false:c.parseFromString(d,"text/xml")}catch(u){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(d){return{x:d.x,y:d.y,width:d.width,height:d.height}};svgedit.utilities.walkTree=function(d,f){if(d&&d.nodeType==1){f(d);for(var c=d.childNodes.length;c--;)svgedit.utilities.walkTree(d.childNodes.item(c),f)}}; new DOMParser:new ActiveXObject("Microsoft.XMLDOM");c.async=false}catch(m){throw Error("XML Parser could not be instantiated");}try{f=c.loadXML?c.loadXML(d)?c:false:c.parseFromString(d,"text/xml")}catch(u){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(d){return{x:d.x,y:d.y,width:d.width,height:d.height}};svgedit.utilities.walkTree=function(d,f){if(d&&d.nodeType==1){f(d);for(var c=d.childNodes.length;c--;)svgedit.utilities.walkTree(d.childNodes.item(c),f)}};
svgedit.utilities.walkTreePost=function(d,f){if(d&&d.nodeType==1){for(var c=d.childNodes.length;c--;)svgedit.utilities.walkTree(d.childNodes.item(c),f);f(d)}};svgedit.utilities.getUrlFromAttr=function(d){if(d)if(d.indexOf('url("')===0)return d.substring(5,d.indexOf('"',6));else if(d.indexOf("url('")===0)return d.substring(5,d.indexOf("'",6));else if(d.indexOf("url(")===0)return d.substring(4,d.indexOf(")"));return null};svgedit.utilities.getHref=function(d){return d.getAttributeNS("http://www.w3.org/1999/xlink", svgedit.utilities.walkTreePost=function(d,f){if(d&&d.nodeType==1){for(var c=d.childNodes.length;c--;)svgedit.utilities.walkTree(d.childNodes.item(c),f);f(d)}};svgedit.utilities.getUrlFromAttr=function(d){if(d)if(d.indexOf('url("')===0)return d.substring(5,d.indexOf('"',6));else if(d.indexOf("url('")===0)return d.substring(5,d.indexOf("'",6));else if(d.indexOf("url(")===0)return d.substring(4,d.indexOf(")"));return null};svgedit.utilities.getHref=function(d){return d.getAttributeNS("http://www.w3.org/1999/xlink",
"href")};svgedit.utilities.setHref=function(d,f){d.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(d){d=g.getSVGContent().documentElement;var f=d.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:d.insertBefore(d.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),d.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(d){var f=d.pathSegList,c=f.numberOfItems;d=[[],[]];var m=f.getItem(0), "href")};svgedit.utilities.setHref=function(d,f){d.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(d){d=g.getSVGContent().documentElement;var f=d.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:d.insertBefore(d.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),d.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(d){var f=d.pathSegList,c=f.numberOfItems;d=[[],[]];var m=f.getItem(0),
u=[m.x,m.y];for(m=0;m<c;m++){var C=f.getItem(m);if(typeof C.x!="undefined"){d[0].push(u[0]);d[1].push(u[1]);if(C.x1){for(var s=[C.x1,C.y1],L=[C.x2,C.y2],R=[C.x,C.y],K=0;K<2;K++){C=function(ga){return Math.pow(1-ga,3)*u[K]+3*Math.pow(1-ga,2)*ga*s[K]+3*(1-ga)*Math.pow(ga,2)*L[K]+Math.pow(ga,3)*R[K]};var I=6*u[K]-12*s[K]+6*L[K],Q=-3*u[K]+9*s[K]-9*L[K]+3*R[K],S=3*s[K]-3*u[K];if(Q==0){if(I!=0){I=-S/I;0<I&&I<1&&d[K].push(C(I))}}else{S=Math.pow(I,2)-4*S*Q;if(!(S<0)){var N=(-I+Math.sqrt(S))/(2*Q);0<N&&N< u=[m.x,m.y];for(m=0;m<c;m++){var C=f.getItem(m);if(typeof C.x!="undefined"){d[0].push(u[0]);d[1].push(u[1]);if(C.x1){for(var s=[C.x1,C.y1],L=[C.x2,C.y2],Q=[C.x,C.y],K=0;K<2;K++){C=function(ga){return Math.pow(1-ga,3)*u[K]+3*Math.pow(1-ga,2)*ga*s[K]+3*(1-ga)*Math.pow(ga,2)*L[K]+Math.pow(ga,3)*Q[K]};var H=6*u[K]-12*s[K]+6*L[K],S=-3*u[K]+9*s[K]-9*L[K]+3*Q[K],R=3*s[K]-3*u[K];if(S==0){if(H!=0){H=-R/H;0<H&&H<1&&d[K].push(C(H))}}else{R=Math.pow(H,2)-4*R*S;if(!(R<0)){var N=(-H+Math.sqrt(R))/(2*S);0<N&&N<
1&&d[K].push(C(N));I=(-I-Math.sqrt(S))/(2*Q);0<I&&I<1&&d[K].push(C(I))}}}u=R}else{d[0].push(C.x);d[1].push(C.y)}}}f=Math.min.apply(null,d[0]);c=Math.max.apply(null,d[0])-f;m=Math.min.apply(null,d[1]);d=Math.max.apply(null,d[1])-m;return{x:f,y:m,width:c,height:d}};svgedit.utilities.getBBox=function(d){var f=d||g.getSelectedElements()[0];if(d.nodeType!=1)return null;d=null;var c=f.nodeName;switch(c){case "text":if(f.textContent===""){f.textContent="a";d=f.getBBox();f.textContent=""}else try{d=f.getBBox()}catch(m){}break; 1&&d[K].push(C(N));H=(-H-Math.sqrt(R))/(2*S);0<H&&H<1&&d[K].push(C(H))}}}u=Q}else{d[0].push(C.x);d[1].push(C.y)}}}f=Math.min.apply(null,d[0]);c=Math.max.apply(null,d[0])-f;m=Math.min.apply(null,d[1]);d=Math.max.apply(null,d[1])-m;return{x:f,y:m,width:c,height:d}};svgedit.utilities.getBBox=function(d){var f=d||g.getSelectedElements()[0];if(d.nodeType!=1)return null;d=null;var c=f.nodeName;switch(c){case "text":if(f.textContent===""){f.textContent="a";d=f.getBBox();f.textContent=""}else try{d=f.getBBox()}catch(m){}break;
case "path":if(svgedit.browser.supportsPathBBox())try{d=f.getBBox()}catch(u){}else d=svgedit.utilities.getPathBBox(f);break;case "g":case "a":d=a(f);break;default:if(c==="use")d=a(f,true);if(c==="use"){d||(d=f.getBBox());if(!svgedit.browser.isWebkit()){c={};c.width=d.width;c.height=d.height;c.x=d.x+parseFloat(f.getAttribute("x")||0);c.y=d.y+parseFloat(f.getAttribute("y")||0);d=c}}else if(~q.indexOf(c))try{d=f.getBBox()}catch(C){f=$(f).closest("foreignObject");if(f.length)try{d=f[0].getBBox()}catch(s){d= case "path":if(svgedit.browser.supportsPathBBox())try{d=f.getBBox()}catch(u){}else d=svgedit.utilities.getPathBBox(f);break;case "g":case "a":d=a(f);break;default:if(c==="use")d=a(f,true);if(c==="use"){d||(d=f.getBBox());if(!svgedit.browser.isWebkit()){c={};c.width=d.width;c.height=d.height;c.x=d.x+parseFloat(f.getAttribute("x")||0);c.y=d.y+parseFloat(f.getAttribute("y")||0);d=c}}else if(~q.indexOf(c))try{d=f.getBBox()}catch(C){f=$(f).closest("foreignObject");if(f.length)try{d=f[0].getBBox()}catch(s){d=
null}else d=null}}if(d)d=svgedit.utilities.bboxToObj(d);return d};svgedit.utilities.getRotationAngle=function(d,f){var c=d||g.getSelectedElements()[0];c=svgedit.transformlist.getTransformList(c);if(!c)return 0;for(var m=c.numberOfItems,u=0;u<m;++u){var C=c.getItem(u);if(C.type==4)return f?C.angle*Math.PI/180:C.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(d){return v.querySelector("#"+d)}:svgedit.browser.supportsXpath()?function(d){return b.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+ null}else d=null}}if(d)d=svgedit.utilities.bboxToObj(d);return d};svgedit.utilities.getRotationAngle=function(d,f){var c=d||g.getSelectedElements()[0];c=svgedit.transformlist.getTransformList(c);if(!c)return 0;for(var m=c.numberOfItems,u=0;u<m;++u){var C=c.getItem(u);if(C.type==4)return f?C.angle*Math.PI/180:C.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(d){return v.querySelector("#"+d)}:svgedit.browser.supportsXpath()?function(d){return b.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+
d+'"]',p,function(){return"http://www.w3.org/2000/svg"},9,null).singleNodeValue}:function(d){return $(v).find("[id="+d+"]")[0]};svgedit.utilities.assignAttributes=function(d,f,c,m){c||(c=0);svgedit.browser.isOpera()||v.suspendRedraw(c);for(var u in f)if(c=u.substr(0,4)==="xml:"?"http://www.w3.org/XML/1998/namespace":u.substr(0,6)==="xlink:"?"http://www.w3.org/1999/xlink":null)d.setAttributeNS(c,u,f[u]);else m?svgedit.units.setUnitAttr(d,u,f[u]):d.setAttribute(u,f[u]);svgedit.browser.isOpera()||v.unsuspendRedraw(null)}; d+'"]',p,function(){return"http://www.w3.org/2000/svg"},9,null).singleNodeValue}:function(d){return $(v).find("[id="+d+"]")[0]};svgedit.utilities.assignAttributes=function(d,f,c,m){c||(c=0);svgedit.browser.isOpera()||v.suspendRedraw(c);for(var u in f)if(c=u.substr(0,4)==="xml:"?"http://www.w3.org/XML/1998/namespace":u.substr(0,6)==="xlink:"?"http://www.w3.org/1999/xlink":null)d.setAttributeNS(c,u,f[u]);else m?svgedit.units.setUnitAttr(d,u,f[u]):d.setAttribute(u,f[u]);svgedit.browser.isOpera()||v.unsuspendRedraw(null)};
@ -116,8 +116,8 @@ svgedit.utilities.cleanupElement=function(d){var f=v.suspendRedraw(60),c={"fill-
mprescripts:[],mroot:[],mrow:["xlink:href","xlink:type","xmlns:xlink"],mspace:["depth","height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[], mprescripts:[],mroot:[],mrow:["xlink:href","xlink:type","xmlns:xlink"],mspace:["depth","height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[],
semantics:[]},b={};$.each(g,function(p,v){var d={};$.each(v,function(f,c){if(c.indexOf(":")>=0){var m=c.split(":");d[m[1]]=q[m[0]]}else d[c]=c=="xmlns"?"http://www.w3.org/2000/xmlns/":null});b[p]=d});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(p){if(p.nodeType==3){p.nodeValue=p.nodeValue.replace(/^\s+|\s+$/g,"");p.nodeValue.length||p.parentNode.removeChild(p)}if(p.nodeType==1){var v=p.parentNode;if(p.ownerDocument&&v){var d=g[p.nodeName],f=b[p.nodeName];if(d!= semantics:[]},b={};$.each(g,function(p,v){var d={};$.each(v,function(f,c){if(c.indexOf(":")>=0){var m=c.split(":");d[m[1]]=q[m[0]]}else d[c]=c=="xmlns"?"http://www.w3.org/2000/xmlns/":null});b[p]=d});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(p){if(p.nodeType==3){p.nodeValue=p.nodeValue.replace(/^\s+|\s+$/g,"");p.nodeValue.length||p.parentNode.removeChild(p)}if(p.nodeType==1){var v=p.parentNode;if(p.ownerDocument&&v){var d=g[p.nodeName],f=b[p.nodeName];if(d!=
undefined){for(var c=[],m=p.attributes.length;m--;){var u=p.attributes.item(m),C=u.nodeName,s=u.localName,L=u.namespaceURI;if(!(f.hasOwnProperty(s)&&L==f[s]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){C.indexOf("se:")==0&&c.push([C,u.nodeValue]);p.removeAttributeNS(L,s)}if(svgedit.browser.isGecko())switch(C){case "transform":case "gradientTransform":case "patternTransform":s=u.nodeValue.replace(/(\d)-/g,"$1 -");p.setAttribute(C,s)}if(C=="style"){u= undefined){for(var c=[],m=p.attributes.length;m--;){var u=p.attributes.item(m),C=u.nodeName,s=u.localName,L=u.namespaceURI;if(!(f.hasOwnProperty(s)&&L==f[s]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){C.indexOf("se:")==0&&c.push([C,u.nodeValue]);p.removeAttributeNS(L,s)}if(svgedit.browser.isGecko())switch(C){case "transform":case "gradientTransform":case "patternTransform":s=u.nodeValue.replace(/(\d)-/g,"$1 -");p.setAttribute(C,s)}if(C=="style"){u=
u.nodeValue.split(";");for(C=u.length;C--;){s=u[C].split(":");d.indexOf(s[0])>=0&&p.setAttribute(s[0],s[1])}p.removeAttribute("style")}}$.each(c,function(R,K){p.setAttributeNS("http://svg-edit.googlecode.com",K[0],K[1])});if((m=svgedit.utilities.getHref(p))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(p.nodeName)>=0)if(m[0]!="#"){svgedit.utilities.setHref(p,"");p.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(p.nodeName=="use"&&!svgedit.utilities.getHref(p))v.removeChild(p); u.nodeValue.split(";");for(C=u.length;C--;){s=u[C].split(":");d.indexOf(s[0])>=0&&p.setAttribute(s[0],s[1])}p.removeAttribute("style")}}$.each(c,function(Q,K){p.setAttributeNS("http://svg-edit.googlecode.com",K[0],K[1])});if((m=svgedit.utilities.getHref(p))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(p.nodeName)>=0)if(m[0]!="#"){svgedit.utilities.setHref(p,"");p.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(p.nodeName=="use"&&!svgedit.utilities.getHref(p))v.removeChild(p);
else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(R,K){var I=p.getAttribute(K);if(I)if((I=svgedit.utilities.getUrlFromAttr(I))&&I[0]!=="#"){p.setAttribute(K,"");p.removeAttribute(K)}});for(m=p.childNodes.length;m--;)svgedit.sanitize.sanitizeSvg(p.childNodes.item(m))}}else{for(d=[];p.hasChildNodes();)d.push(v.insertBefore(p.firstChild,p));v.removeChild(p);for(m=d.length;m--;)svgedit.sanitize.sanitizeSvg(d[m])}}}}})();svgedit=svgedit||{}; else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(Q,K){var H=p.getAttribute(K);if(H)if((H=svgedit.utilities.getUrlFromAttr(H))&&H[0]!=="#"){p.setAttribute(K,"");p.removeAttribute(K)}});for(m=p.childNodes.length;m--;)svgedit.sanitize.sanitizeSvg(p.childNodes.item(m))}}else{for(d=[];p.hasChildNodes();)d.push(v.insertBefore(p.firstChild,p));v.removeChild(p);for(m=d.length;m--;)svgedit.sanitize.sanitizeSvg(d[m])}}}}})();svgedit=svgedit||{};
(function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,q,g,b){this.elem=a;this.text=b?"Move "+a.tagName+" to "+b:"Move "+a.tagName;this.oldNextSibling=q;this.oldParent=g;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type= (function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,q,g,b){this.elem=a;this.text=b?"Move "+a.tagName+" to "+b:"Move "+a.tagName;this.oldNextSibling=q;this.oldParent=g;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type=
svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,
this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,q){this.elem=a;this.text=q||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type= this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,q){this.elem=a;this.text=q||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type=
@ -139,10 +139,10 @@ svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.un
(function(){if(!svgedit.select)svgedit.select={};var a,q,g;svgedit.select.Selector=function(b,p){this.id=b;this.selectedElement=p;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity", (function(){if(!svgedit.select)svgedit.select={};var a,q,g;svgedit.select.Selector=function(b,p){this.id=b;this.selectedElement=p;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity",
0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(b){this.locked=true;this.selectedElement=b;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(b){var p=[];b=Math.round(b/45);if(b<0)b+=8;for(var v in g.selectorGrips)p.push(v);for(;b>0;){p.push(p.shift());b--}b=0;for(v in g.selectorGrips){g.selectorGrips[v].setAttribute("style", 0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(b){this.locked=true;this.selectedElement=b;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(b){var p=[];b=Math.round(b/45);if(b<0)b+=8;for(var v in g.selectorGrips)p.push(v);for(;b>0;){p.push(p.shift());b--}b=0;for(v in g.selectorGrips){g.selectorGrips[v].setAttribute("style",
"cursor:"+p[b]+"-resize");b++}};svgedit.select.Selector.prototype.showGrips=function(b){g.selectorGripsGroup.setAttribute("display",b?"inline":"none");var p=this.selectedElement;this.hasGrips=b;if(p&&b){this.selectorGroup.appendChild(g.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(p))}};svgedit.select.Selector.prototype.resize=function(){var b=this.selectorRect,p=g,v=p.selectorGrips,d=this.selectedElement,f=d.getAttribute("stroke-width"),c=a.currentZoom(),m=1/c;if(d.getAttribute("stroke")!== "cursor:"+p[b]+"-resize");b++}};svgedit.select.Selector.prototype.showGrips=function(b){g.selectorGripsGroup.setAttribute("display",b?"inline":"none");var p=this.selectedElement;this.hasGrips=b;if(p&&b){this.selectorGroup.appendChild(g.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(p))}};svgedit.select.Selector.prototype.resize=function(){var b=this.selectorRect,p=g,v=p.selectorGrips,d=this.selectedElement,f=d.getAttribute("stroke-width"),c=a.currentZoom(),m=1/c;if(d.getAttribute("stroke")!==
"none"&&!isNaN(f))m+=f/2;var u=d.tagName;if(u==="text")m+=2/c;f=svgedit.transformlist.getTransformList(d);f=svgedit.math.transformListToTransform(f).matrix;f.e*=c;f.f*=c;var C=svgedit.utilities.getBBox(d);if(u==="g"&&!$.data(d,"gsvg"))if(u=a.getStrokedBBox(d.childNodes))C=u;u=C.x;var s=C.y,L=C.width;C=C.height;m*=c;c=svgedit.math.transformBox(u*c,s*c,L*c,C*c,f);f=c.aabox;u=f.x-m;s=f.y-m;L=f.width+m*2;var R=f.height+m*2;f=u+L/2;C=s+R/2;if(d=svgedit.utilities.getRotationAngle(d)){u=a.svgRoot().createSVGTransform(); "none"&&!isNaN(f))m+=f/2;var u=d.tagName;if(u==="text")m+=2/c;f=svgedit.transformlist.getTransformList(d);f=svgedit.math.transformListToTransform(f).matrix;f.e*=c;f.f*=c;var C=svgedit.utilities.getBBox(d);if(u==="g"&&!$.data(d,"gsvg"))if(u=a.getStrokedBBox(d.childNodes))C=u;u=C.x;var s=C.y,L=C.width;C=C.height;m*=c;c=svgedit.math.transformBox(u*c,s*c,L*c,C*c,f);f=c.aabox;u=f.x-m;s=f.y-m;L=f.width+m*2;var Q=f.height+m*2;f=u+L/2;C=s+Q/2;if(d=svgedit.utilities.getRotationAngle(d)){u=a.svgRoot().createSVGTransform();
u.setRotate(-d,f,C);u=u.matrix;c.tl=svgedit.math.transformPoint(c.tl.x,c.tl.y,u);c.tr=svgedit.math.transformPoint(c.tr.x,c.tr.y,u);c.bl=svgedit.math.transformPoint(c.bl.x,c.bl.y,u);c.br=svgedit.math.transformPoint(c.br.x,c.br.y,u);u=c.tl;L=u.x;R=u.y;var K=u.x,I=u.y;u=Math.min;s=Math.max;L=u(L,u(c.tr.x,u(c.bl.x,c.br.x)))-m;R=u(R,u(c.tr.y,u(c.bl.y,c.br.y)))-m;K=s(K,s(c.tr.x,s(c.bl.x,c.br.x)))+m;I=s(I,s(c.tr.y,s(c.bl.y,c.br.y)))+m;u=L;s=R;L=K-L;R=I-R}m=a.svgRoot().suspendRedraw(100);b.setAttribute("d", u.setRotate(-d,f,C);u=u.matrix;c.tl=svgedit.math.transformPoint(c.tl.x,c.tl.y,u);c.tr=svgedit.math.transformPoint(c.tr.x,c.tr.y,u);c.bl=svgedit.math.transformPoint(c.bl.x,c.bl.y,u);c.br=svgedit.math.transformPoint(c.br.x,c.br.y,u);u=c.tl;L=u.x;Q=u.y;var K=u.x,H=u.y;u=Math.min;s=Math.max;L=u(L,u(c.tr.x,u(c.bl.x,c.br.x)))-m;Q=u(Q,u(c.tr.y,u(c.bl.y,c.br.y)))-m;K=s(K,s(c.tr.x,s(c.bl.x,c.br.x)))+m;H=s(H,s(c.tr.y,s(c.bl.y,c.br.y)))+m;u=L;s=Q;L=K-L;Q=H-Q}m=a.svgRoot().suspendRedraw(100);b.setAttribute("d",
"M"+u+","+s+" L"+(u+L)+","+s+" "+(u+L)+","+(s+R)+" "+u+","+(s+R)+"z");this.selectorGroup.setAttribute("transform",d?"rotate("+[d,f,C].join(",")+")":"");if(svgedit.browser.isTouch()){u-=15.75;s-=15.75}else{u-=4;s-=4}this.gripCoords={nw:[u,s].map(Math.round),ne:[u+L,s].map(Math.round),sw:[u,s+R].map(Math.round),se:[u+L,s+R].map(Math.round),n:[u+L/2,s].map(Math.round),w:[u,s+R/2].map(Math.round),e:[u+L,s+R/2].map(Math.round),s:[u+L/2,s+R].map(Math.round)};for(var Q in this.gripCoords){b=this.gripCoords[Q]; "M"+u+","+s+" L"+(u+L)+","+s+" "+(u+L)+","+(s+Q)+" "+u+","+(s+Q)+"z");this.selectorGroup.setAttribute("transform",d?"rotate("+[d,f,C].join(",")+")":"");if(svgedit.browser.isTouch()){u-=15.75;s-=15.75}else{u-=4;s-=4}this.gripCoords={nw:[u,s].map(Math.round),ne:[u+L,s].map(Math.round),sw:[u,s+Q].map(Math.round),se:[u+L,s+Q].map(Math.round),n:[u+L/2,s].map(Math.round),w:[u,s+Q/2].map(Math.round),e:[u+L,s+Q/2].map(Math.round),s:[u+L/2,s+Q].map(Math.round)};for(var S in this.gripCoords){b=this.gripCoords[S];
v[Q].setAttribute("x",b[0]);v[Q].setAttribute("y",b[1])}this.rotateCoords={nw:[u,s],ne:[u+L+8,s],sw:[u,s+R+8],se:[u+L+8,s+R+8]};for(Q in this.rotateCoords){b=this.rotateCoords[Q];p.rotateGrips[Q].setAttribute("cx",b[0]);p.rotateGrips[Q].setAttribute("cy",b[1])}a.svgRoot().unsuspendRedraw(m)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null}; v[S].setAttribute("x",b[0]);v[S].setAttribute("y",b[1])}this.rotateCoords={nw:[u,s],ne:[u+L+8,s],sw:[u,s+Q+8],se:[u+L+8,s+Q+8]};for(S in this.rotateCoords){b=this.rotateCoords[S];p.rotateGrips[S].setAttribute("cx",b[0]);p.rotateGrips[S].setAttribute("cy",b[1])}a.svgRoot().unsuspendRedraw(m)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};
this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup); this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup);
a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var b in this.rotateGrips){var p=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+b,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+q.imgPath+"rotate.png) 12 12, auto;"}});$.data(p,"dir",b);$.data(p,"type","rotate");this.rotateGrips[b]=this.selectorGripsGroup.appendChild(p)}for(b in this.selectorGrips){p=a.createSVGElement({element:"rect", a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var b in this.rotateGrips){var p=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+b,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+q.imgPath+"rotate.png) 12 12, auto;"}});$.data(p,"dir",b);$.data(p,"type","rotate");this.rotateGrips[b]=this.selectorGripsGroup.appendChild(p)}for(b in this.selectorGrips){p=a.createSVGElement({element:"rect",
attr:{id:"selectorGrip_resize_"+b,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+b+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){p.setAttribute("width",30.5);p.setAttribute("height",30.5);p.setAttribute("fill-opacity",0.3)}$.data(p,"dir",b);$.data(p,"type","resize");this.selectorGrips[b]=this.selectorGripsGroup.appendChild(p)}if(!$("#canvasBackground").length){b=q.dimensions;b=a.createSVGElement({element:"svg",attr:{id:"canvasBackground", attr:{id:"selectorGrip_resize_"+b,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+b+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){p.setAttribute("width",30.5);p.setAttribute("height",30.5);p.setAttribute("fill-opacity",0.3)}$.data(p,"dir",b);$.data(p,"type","resize");this.selectorGrips[b]=this.selectorGripsGroup.appendChild(p)}if(!$("#canvasBackground").length){b=q.dimensions;b=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",
@ -171,11 +171,11 @@ return m};svgedit.path.addPointGrip=function(f,c,m){var u=svgedit.path.getGripCo
C=u.appendChild(C);$("#pathpointgrip_"+f).dblclick(function(){svgedit.path.path&&svgedit.path.path.setSegType()})}if(c&&m)svgedit.utilities.assignAttributes(C,{x:c-(svgedit.browser.isTouch()?15:2.5),y:m-(svgedit.browser.isTouch()?15:2.5),display:"inline"});return C};svgedit.path.getGripContainer=function(){var f=svgedit.utilities.getElem("pathpointgrip_container");if(!f){f=svgedit.utilities.getElem("selectorParentGroup").appendChild(document.createElementNS("http://www.w3.org/2000/svg","g"));f.id= C=u.appendChild(C);$("#pathpointgrip_"+f).dblclick(function(){svgedit.path.path&&svgedit.path.path.setSegType()})}if(c&&m)svgedit.utilities.assignAttributes(C,{x:c-(svgedit.browser.isTouch()?15:2.5),y:m-(svgedit.browser.isTouch()?15:2.5),display:"inline"});return C};svgedit.path.getGripContainer=function(){var f=svgedit.utilities.getElem("pathpointgrip_container");if(!f){f=svgedit.utilities.getElem("selectorParentGroup").appendChild(document.createElementNS("http://www.w3.org/2000/svg","g"));f.id=
"pathpointgrip_container"}return f};svgedit.path.addCtrlGrip=function(f){var c=svgedit.utilities.getElem("ctrlpointgrip_"+f);if(c)return c;c=document.createElementNS("http://www.w3.org/2000/svg","circle");svgedit.utilities.assignAttributes(c,{id:"ctrlpointgrip_"+f,display:"none",r:svgedit.browser.isTouch()?15:3,fill:"#4F80FF",cursor:"move",style:"pointer-events:all","xlink:title":a.pathCtrlPtTooltip});svgedit.path.getGripContainer().appendChild(c);return c};svgedit.path.getCtrlLine=function(f){var c= "pathpointgrip_container"}return f};svgedit.path.addCtrlGrip=function(f){var c=svgedit.utilities.getElem("ctrlpointgrip_"+f);if(c)return c;c=document.createElementNS("http://www.w3.org/2000/svg","circle");svgedit.utilities.assignAttributes(c,{id:"ctrlpointgrip_"+f,display:"none",r:svgedit.browser.isTouch()?15:3,fill:"#4F80FF",cursor:"move",style:"pointer-events:all","xlink:title":a.pathCtrlPtTooltip});svgedit.path.getGripContainer().appendChild(c);return c};svgedit.path.getCtrlLine=function(f){var c=
svgedit.utilities.getElem("ctrlLine_"+f);if(c)return c;c=document.createElementNS("http://www.w3.org/2000/svg","line");svgedit.utilities.assignAttributes(c,{id:"ctrlLine_"+f,stroke:"#4F80FF","stroke-width":1,style:"pointer-events:none"});svgedit.path.getGripContainer().appendChild(c);return c};svgedit.path.getPointGrip=function(f,c){var m=svgedit.path.addPointGrip(f.index);if(c){var u=svgedit.path.getGripPt(f);svgedit.utilities.assignAttributes(m,{x:u.x-(svgedit.browser.isTouch()?15:2.5),y:u.y-(svgedit.browser.isTouch()? svgedit.utilities.getElem("ctrlLine_"+f);if(c)return c;c=document.createElementNS("http://www.w3.org/2000/svg","line");svgedit.utilities.assignAttributes(c,{id:"ctrlLine_"+f,stroke:"#4F80FF","stroke-width":1,style:"pointer-events:none"});svgedit.path.getGripContainer().appendChild(c);return c};svgedit.path.getPointGrip=function(f,c){var m=svgedit.path.addPointGrip(f.index);if(c){var u=svgedit.path.getGripPt(f);svgedit.utilities.assignAttributes(m,{x:u.x-(svgedit.browser.isTouch()?15:2.5),y:u.y-(svgedit.browser.isTouch()?
15:2.5),display:"inline"})}return m};svgedit.path.getControlPoints=function(f){var c=f.item,m=f.index;if(!("x1"in c)||!("x2"in c))return null;var u={};svgedit.path.getGripContainer();for(var C=[svgedit.path.path.segs[m-1].item,c],s=1;s<3;s++){var L=m+"c"+s,R=u["c"+s+"_line"]=svgedit.path.getCtrlLine(L),K=svgedit.path.getGripPt(f,{x:c["x"+s],y:c["y"+s]}),I=svgedit.path.getGripPt(f,{x:C[s-1].x,y:C[s-1].y});svgedit.utilities.assignAttributes(R,{x1:K.x,y1:K.y,x2:I.x,y2:I.y,display:"inline"});u["c"+s+ 15:2.5),display:"inline"})}return m};svgedit.path.getControlPoints=function(f){var c=f.item,m=f.index;if(!("x1"in c)||!("x2"in c))return null;var u={};svgedit.path.getGripContainer();for(var C=[svgedit.path.path.segs[m-1].item,c],s=1;s<3;s++){var L=m+"c"+s,Q=u["c"+s+"_line"]=svgedit.path.getCtrlLine(L),K=svgedit.path.getGripPt(f,{x:c["x"+s],y:c["y"+s]}),H=svgedit.path.getGripPt(f,{x:C[s-1].x,y:C[s-1].y});svgedit.utilities.assignAttributes(Q,{x1:K.x,y1:K.y,x2:H.x,y2:H.y,display:"inline"});u["c"+s+
"_line"]=R;pointGrip=u["c"+s]=svgedit.path.addCtrlGrip(L);svgedit.utilities.assignAttributes(pointGrip,{cx:K.x,cy:K.y,display:"inline"});u["c"+s]=pointGrip}return u};svgedit.path.replacePathSeg=function(f,c,m,u){u=u||svgedit.path.path.elem;f=u["createSVGPathSeg"+g[f]].apply(u,m);if(svgedit.browser.supportsPathReplaceItem())u.pathSegList.replaceItem(f,c);else{m=u.pathSegList;u=m.numberOfItems;for(var C=[],s=0;s<u;s++){var L=m.getItem(s);C.push(L)}m.clear();for(s=0;s<u;s++)s==c?m.appendItem(f):m.appendItem(C[s])}}; "_line"]=Q;pointGrip=u["c"+s]=svgedit.path.addCtrlGrip(L);svgedit.utilities.assignAttributes(pointGrip,{cx:K.x,cy:K.y,display:"inline"});u["c"+s]=pointGrip}return u};svgedit.path.replacePathSeg=function(f,c,m,u){u=u||svgedit.path.path.elem;f=u["createSVGPathSeg"+g[f]].apply(u,m);if(svgedit.browser.supportsPathReplaceItem())u.pathSegList.replaceItem(f,c);else{m=u.pathSegList;u=m.numberOfItems;for(var C=[],s=0;s<u;s++){var L=m.getItem(s);C.push(L)}m.clear();for(s=0;s<u;s++)s==c?m.appendItem(f):m.appendItem(C[s])}};
svgedit.path.getSegSelector=function(f,c){var m=f.index,u=svgedit.utilities.getElem("segline_"+m);if(!u){var C=svgedit.path.getGripContainer();u=document.createElementNS("http://www.w3.org/2000/svg","path");svgedit.utilities.assignAttributes(u,{id:"segline_"+m,display:"none",fill:"none",stroke:"#0ff","shape-rendering":"crispEdges","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"});C.appendChild(u)}if(c){m=f.prev;if(!m){u.setAttribute("display","none");return u}m=svgedit.path.getGripPt(m); svgedit.path.getSegSelector=function(f,c){var m=f.index,u=svgedit.utilities.getElem("segline_"+m);if(!u){var C=svgedit.path.getGripContainer();u=document.createElementNS("http://www.w3.org/2000/svg","path");svgedit.utilities.assignAttributes(u,{id:"segline_"+m,display:"none",fill:"none",stroke:"#0ff","shape-rendering":"crispEdges","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"});C.appendChild(u)}if(c){m=f.prev;if(!m){u.setAttribute("display","none");return u}m=svgedit.path.getGripPt(m);
svgedit.path.replacePathSeg(2,0,[m.x,m.y],u);C=svgedit.path.ptObjToArr(f.type,f.item,true);for(var s=0;s<C.length;s+=2){m=svgedit.path.getGripPt(f,{x:C[s],y:C[s+1]});C[s]=m.x;C[s+1]=m.y}svgedit.path.replacePathSeg(f.type,1,C,u)}return u};svgedit.path.smoothControlPoints=this.smoothControlPoints=function(f,c,m){var u=f.x-m.x,C=f.y-m.y,s=c.x-m.x,L=c.y-m.y;if((u!=0||C!=0)&&(s!=0||L!=0)){f=Math.atan2(C,u);c=Math.atan2(L,s);u=Math.sqrt(u*u+C*C);s=Math.sqrt(s*s+L*L);C=v.getSVGRoot().createSVGPoint();L= svgedit.path.replacePathSeg(2,0,[m.x,m.y],u);C=svgedit.path.ptObjToArr(f.type,f.item,true);for(var s=0;s<C.length;s+=2){m=svgedit.path.getGripPt(f,{x:C[s],y:C[s+1]});C[s]=m.x;C[s+1]=m.y}svgedit.path.replacePathSeg(f.type,1,C,u)}return u};svgedit.path.smoothControlPoints=this.smoothControlPoints=function(f,c,m){var u=f.x-m.x,C=f.y-m.y,s=c.x-m.x,L=c.y-m.y;if((u!=0||C!=0)&&(s!=0||L!=0)){f=Math.atan2(C,u);c=Math.atan2(L,s);u=Math.sqrt(u*u+C*C);s=Math.sqrt(s*s+L*L);C=v.getSVGRoot().createSVGPoint();L=
v.getSVGRoot().createSVGPoint();if(f<0)f+=2*Math.PI;if(c<0)c+=2*Math.PI;var R=Math.abs(f-c),K=Math.abs(Math.PI-R)/2;if(f-c>0){f=R<Math.PI?f+K:f-K;c=R<Math.PI?c-K:c+K}else{f=R<Math.PI?f-K:f+K;c=R<Math.PI?c+K:c-K}C.x=u*Math.cos(f)+m.x;C.y=u*Math.sin(f)+m.y;L.x=s*Math.cos(c)+m.x;L.y=s*Math.sin(c)+m.y;return[C,L]}};svgedit.path.Segment=function(f,c){this.selected=false;this.index=f;this.item=c;this.type=c.pathSegType;this.ctrlpts=[];this.segsel=this.ptgrip=null};svgedit.path.Segment.prototype.showCtrlPts= v.getSVGRoot().createSVGPoint();if(f<0)f+=2*Math.PI;if(c<0)c+=2*Math.PI;var Q=Math.abs(f-c),K=Math.abs(Math.PI-Q)/2;if(f-c>0){f=Q<Math.PI?f+K:f-K;c=Q<Math.PI?c-K:c+K}else{f=Q<Math.PI?f-K:f+K;c=Q<Math.PI?c+K:c-K}C.x=u*Math.cos(f)+m.x;C.y=u*Math.sin(f)+m.y;L.x=s*Math.cos(c)+m.x;L.y=s*Math.sin(c)+m.y;return[C,L]}};svgedit.path.Segment=function(f,c){this.selected=false;this.index=f;this.item=c;this.type=c.pathSegType;this.ctrlpts=[];this.segsel=this.ptgrip=null};svgedit.path.Segment.prototype.showCtrlPts=
function(f){for(var c in this.ctrlpts)this.ctrlpts[c].setAttribute("display",f?"inline":"none")};svgedit.path.Segment.prototype.selectCtrls=function(){$("#ctrlpointgrip_"+this.index+"c1, #ctrlpointgrip_"+this.index+"c2").attr("fill","#4F80FF")};svgedit.path.Segment.prototype.show=function(f){if(this.ptgrip){this.ptgrip.setAttribute("display",f?"inline":"none");this.segsel.setAttribute("display",f?"inline":"none");this.showCtrlPts(f)}};svgedit.path.Segment.prototype.select=function(f){if(this.ptgrip){this.ptgrip.setAttribute("stroke", function(f){for(var c in this.ctrlpts)this.ctrlpts[c].setAttribute("display",f?"inline":"none")};svgedit.path.Segment.prototype.selectCtrls=function(){$("#ctrlpointgrip_"+this.index+"c1, #ctrlpointgrip_"+this.index+"c2").attr("fill","#4F80FF")};svgedit.path.Segment.prototype.show=function(f){if(this.ptgrip){this.ptgrip.setAttribute("display",f?"inline":"none");this.segsel.setAttribute("display",f?"inline":"none");this.showCtrlPts(f)}};svgedit.path.Segment.prototype.select=function(f){if(this.ptgrip){this.ptgrip.setAttribute("stroke",
f?"#0FF":"#00F");this.segsel.setAttribute("display",f?"inline":"none");this.ctrlpts&&this.selectCtrls(f);this.selected=f}};svgedit.path.Segment.prototype.addGrip=function(){this.ptgrip=svgedit.path.getPointGrip(this,true);this.ctrlpts=svgedit.path.getControlPoints(this,true);this.segsel=svgedit.path.getSegSelector(this,true)};svgedit.path.Segment.prototype.update=function(f){if(this.ptgrip){var c=svgedit.path.getGripPt(this),m=svgedit.browser.isTouch()?15:2.5;svgedit.utilities.assignAttributes(this.ptgrip, f?"#0FF":"#00F");this.segsel.setAttribute("display",f?"inline":"none");this.ctrlpts&&this.selectCtrls(f);this.selected=f}};svgedit.path.Segment.prototype.addGrip=function(){this.ptgrip=svgedit.path.getPointGrip(this,true);this.ctrlpts=svgedit.path.getControlPoints(this,true);this.segsel=svgedit.path.getSegSelector(this,true)};svgedit.path.Segment.prototype.update=function(f){if(this.ptgrip){var c=svgedit.path.getGripPt(this),m=svgedit.browser.isTouch()?15:2.5;svgedit.utilities.assignAttributes(this.ptgrip,
this.ptgrip.nodeName=="rect"?{x:c.x-m,y:c.y-m}:{cx:c.x,cy:c.y});svgedit.path.getSegSelector(this,true);if(this.ctrlpts){if(f){this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.type=this.item.pathSegType}svgedit.path.getControlPoints(this)}}};svgedit.path.Segment.prototype.move=function(f,c){var m=this.item;m=this.ctrlpts?[m.x+=f,m.y+=c,m.x1,m.y1,m.x2+=f,m.y2+=c]:[m.x+=f,m.y+=c];svgedit.path.replacePathSeg(this.type,this.index,m);if(this.next&&this.next.ctrlpts){m=this.next.item; this.ptgrip.nodeName=="rect"?{x:c.x-m,y:c.y-m}:{cx:c.x,cy:c.y});svgedit.path.getSegSelector(this,true);if(this.ctrlpts){if(f){this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.type=this.item.pathSegType}svgedit.path.getControlPoints(this)}}};svgedit.path.Segment.prototype.move=function(f,c){var m=this.item;m=this.ctrlpts?[m.x+=f,m.y+=c,m.x1,m.y1,m.x2+=f,m.y2+=c]:[m.x+=f,m.y+=c];svgedit.path.replacePathSeg(this.type,this.index,m);if(this.next&&this.next.ctrlpts){m=this.next.item;
@ -183,126 +183,126 @@ m=[m.x,m.y,m.x1+=f,m.y1+=c,m.x2,m.y2];svgedit.path.replacePathSeg(this.next.type
f]);svgedit.path.replacePathSeg(c.type,c.index,[C.x,C.y,C.x1,C.y1,C.x2,C.y2]);c.update(true)};svgedit.path.Segment.prototype.moveCtrl=function(f,c,m){var u=this.item;u["x"+f]+=c;u["y"+f]+=m;svgedit.path.replacePathSeg(this.type,this.index,[u.x,u.y,u.x1,u.y1,u.x2,u.y2]);this.update(true)};svgedit.path.Segment.prototype.setType=function(f,c){svgedit.path.replacePathSeg(f,this.index,c);this.type=f;this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.showCtrlPts(f===6);this.ctrlpts=svgedit.path.getControlPoints(this); f]);svgedit.path.replacePathSeg(c.type,c.index,[C.x,C.y,C.x1,C.y1,C.x2,C.y2]);c.update(true)};svgedit.path.Segment.prototype.moveCtrl=function(f,c,m){var u=this.item;u["x"+f]+=c;u["y"+f]+=m;svgedit.path.replacePathSeg(this.type,this.index,[u.x,u.y,u.x1,u.y1,u.x2,u.y2]);this.update(true)};svgedit.path.Segment.prototype.setType=function(f,c){svgedit.path.replacePathSeg(f,this.index,c);this.type=f;this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.showCtrlPts(f===6);this.ctrlpts=svgedit.path.getControlPoints(this);
this.update(true)};svgedit.path.Path=function(f){if(!f||f.tagName!=="path")throw"svgedit.path.Path constructed without a <path> element";this.elem=f;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var f=this.elem.pathSegList,c=f.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var m=0;m<c;m++){var u=f.getItem(m);u=new svgedit.path.Segment(m,u); this.update(true)};svgedit.path.Path=function(f){if(!f||f.tagName!=="path")throw"svgedit.path.Path constructed without a <path> element";this.elem=f;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var f=this.elem.pathSegList,c=f.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var m=0;m<c;m++){var u=f.getItem(m);u=new svgedit.path.Segment(m,u);
u.path=this;this.segs.push(u)}f=this.segs;u=null;for(m=0;m<c;m++){var C=f[m],s=m+1>=c?null:f[m+1],L=m-1<0?null:f[m-1];if(C.type===2){if(L&&L.type!==1){s=f[u];s.next=f[u+1];s.next.prev=s;s.addGrip()}u=m}else if(s&&s.type===1){C.next=f[u+1];C.next.prev=C;C.mate=f[u];C.addGrip();if(this.first_seg==null)this.first_seg=C}else if(s){if(C.type!==1){C.addGrip();if(s&&s.type!==2){C.next=s;C.next.prev=C}}}else if(C.type!==1){s=f[u];s.next=f[u+1];s.next.prev=s;s.addGrip();C.addGrip();if(!this.first_seg)this.first_seg= u.path=this;this.segs.push(u)}f=this.segs;u=null;for(m=0;m<c;m++){var C=f[m],s=m+1>=c?null:f[m+1],L=m-1<0?null:f[m-1];if(C.type===2){if(L&&L.type!==1){s=f[u];s.next=f[u+1];s.next.prev=s;s.addGrip()}u=m}else if(s&&s.type===1){C.next=f[u+1];C.next.prev=C;C.mate=f[u];C.addGrip();if(this.first_seg==null)this.first_seg=C}else if(s){if(C.type!==1){C.addGrip();if(s&&s.type!==2){C.next=s;C.next.prev=C}}}else if(C.type!==1){s=f[u];s.next=f[u+1];s.next.prev=s;s.addGrip();C.addGrip();if(!this.first_seg)this.first_seg=
f[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var c=this.segs.length,m=0;m<c;m++)if(f.call(this.segs[m],m)===false)break};svgedit.path.Path.prototype.addSeg=function(f){var c=this.segs[f];if(c.prev){var m=c.prev,u;switch(c.item.pathSegType){case 4:var C=(c.item.x+m.item.x)/2,s=(c.item.y+m.item.y)/2;u=this.elem.createSVGPathSegLinetoAbs(C,s);break;case 6:u=(m.item.x+c.item.x1)/2;var L=(c.item.x1+c.item.x2)/2,R=(c.item.x2+c.item.x)/2,K=(u+L)/2;L=(L+R)/2;C=(K+L)/2;var I=(m.item.y+ f[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var c=this.segs.length,m=0;m<c;m++)if(f.call(this.segs[m],m)===false)break};svgedit.path.Path.prototype.addSeg=function(f){var c=this.segs[f];if(c.prev){var m=c.prev,u;switch(c.item.pathSegType){case 4:var C=(c.item.x+m.item.x)/2,s=(c.item.y+m.item.y)/2;u=this.elem.createSVGPathSegLinetoAbs(C,s);break;case 6:u=(m.item.x+c.item.x1)/2;var L=(c.item.x1+c.item.x2)/2,Q=(c.item.x2+c.item.x)/2,K=(u+L)/2;L=(L+Q)/2;C=(K+L)/2;var H=(m.item.y+
c.item.y1)/2,Q=(c.item.y1+c.item.y2)/2;m=(c.item.y2+c.item.y)/2;var S=(I+Q)/2;Q=(Q+m)/2;s=(S+Q)/2;u=this.elem.createSVGPathSegCurvetoCubicAbs(C,s,u,I,K,S);svgedit.path.replacePathSeg(c.type,f,[c.item.x,c.item.y,L,Q,R,m])}svgedit.path.insertItemBefore(this.elem,u,f)}};svgedit.path.Path.prototype.deleteSeg=function(f){var c=this.segs[f],m=this.elem.pathSegList;c.show(false);var u=c.next;if(c.mate){var C=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,u.index,C);svgedit.path.replacePathSeg(4,c.index, c.item.y1)/2,S=(c.item.y1+c.item.y2)/2;m=(c.item.y2+c.item.y)/2;var R=(H+S)/2;S=(S+m)/2;s=(R+S)/2;u=this.elem.createSVGPathSegCurvetoCubicAbs(C,s,u,H,K,R);svgedit.path.replacePathSeg(c.type,f,[c.item.x,c.item.y,L,S,Q,m])}svgedit.path.insertItemBefore(this.elem,u,f)}};svgedit.path.Path.prototype.deleteSeg=function(f){var c=this.segs[f],m=this.elem.pathSegList;c.show(false);var u=c.next;if(c.mate){var C=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,u.index,C);svgedit.path.replacePathSeg(4,c.index,
C);m.removeItem(c.mate.index)}else{if(!c.prev){C=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,c.next.index,C)}m.removeItem(f)}};svgedit.path.Path.prototype.subpathIsClosed=function(f){var c=false;svgedit.path.path.eachSeg(function(m){if(m<=f)return true;if(this.type===2)return false;else if(this.type===1){c=true;return false}});return c};svgedit.path.Path.prototype.removePtFromSelection=function(f){var c=this.selected_pts.indexOf(f);if(c!=-1){this.segs[f].select(false);this.selected_pts.splice(c, C);m.removeItem(c.mate.index)}else{if(!c.prev){C=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,c.next.index,C)}m.removeItem(f)}};svgedit.path.Path.prototype.subpathIsClosed=function(f){var c=false;svgedit.path.path.eachSeg(function(m){if(m<=f)return true;if(this.type===2)return false;else if(this.type===1){c=true;return false}});return c};svgedit.path.Path.prototype.removePtFromSelection=function(f){var c=this.selected_pts.indexOf(f);if(c!=-1){this.segs[f].select(false);this.selected_pts.splice(c,
1)}};svgedit.path.Path.prototype.clearSelection=function(){this.eachSeg(function(){this.select(false)});this.selected_pts=[]};svgedit.path.Path.prototype.storeD=function(){this.last_d=this.elem.getAttribute("d")};svgedit.path.Path.prototype.show=function(f){this.eachSeg(function(){this.show(f)});f&&this.selectPt(this.first_seg.index);return this};svgedit.path.Path.prototype.movePts=function(f,c){for(var m=this.selected_pts.length;m--;)this.segs[this.selected_pts[m]].move(f,c)};svgedit.path.Path.prototype.moveCtrl= 1)}};svgedit.path.Path.prototype.clearSelection=function(){this.eachSeg(function(){this.select(false)});this.selected_pts=[]};svgedit.path.Path.prototype.storeD=function(){this.last_d=this.elem.getAttribute("d")};svgedit.path.Path.prototype.show=function(f){this.eachSeg(function(){this.show(f)});f&&this.selectPt(this.first_seg.index);return this};svgedit.path.Path.prototype.movePts=function(f,c){for(var m=this.selected_pts.length;m--;)this.segs[this.selected_pts[m]].move(f,c)};svgedit.path.Path.prototype.moveCtrl=
function(f,c){var m=this.segs[this.selected_pts[0]];m.moveCtrl(this.dragctrl,f,c);b&&m.setLinked(this.dragctrl)};svgedit.path.Path.prototype.setSegType=function(f){this.storeD();for(var c=this.selected_pts.length,m;c--;){var u=this.segs[this.selected_pts[c]],C=u.prev;if(C){if(!f){m="Toggle Path Segment Type";f=u.type==6?4:6}f-=0;var s=u.item.x,L=u.item.y,R=C.item.x;C=C.item.y;var K;switch(f){case 6:if(u.olditem){R=u.olditem;K=[s,L,R.x1,R.y1,R.x2,R.y2]}else{K=s-R;var I=L-C;K=[s,L,R+K/3,C+I/3,s-K/3, function(f,c){var m=this.segs[this.selected_pts[0]];m.moveCtrl(this.dragctrl,f,c);b&&m.setLinked(this.dragctrl)};svgedit.path.Path.prototype.setSegType=function(f){this.storeD();for(var c=this.selected_pts.length,m;c--;){var u=this.segs[this.selected_pts[c]],C=u.prev;if(C){if(!f){m="Toggle Path Segment Type";f=u.type==6?4:6}f-=0;var s=u.item.x,L=u.item.y,Q=C.item.x;C=C.item.y;var K;switch(f){case 6:if(u.olditem){Q=u.olditem;K=[s,L,Q.x1,Q.y1,Q.x2,Q.y2]}else{K=s-Q;var H=L-C;K=[s,L,Q+K/3,C+H/3,s-K/3,
L-I/3]}break;case 4:K=[s,L];u.olditem=u.item}u.setType(f,K)}}svgedit.path.path.endChanges(m)};svgedit.path.Path.prototype.selectPt=function(f,c){this.clearSelection();f==null&&this.eachSeg(function(m){if(this.prev)f=m});this.addPtsToSelection(f);if(c){this.dragctrl=c;b&&this.segs[f].setLinked(c)}};svgedit.path.Path.prototype.update=function(){var f=this.elem;if(svgedit.utilities.getRotationAngle(f)){this.matrix=svgedit.math.getMatrix(f);this.imatrix=this.matrix.inverse()}else this.imatrix=this.matrix= L-H/3]}break;case 4:K=[s,L];u.olditem=u.item}u.setType(f,K)}}svgedit.path.path.endChanges(m)};svgedit.path.Path.prototype.selectPt=function(f,c){this.clearSelection();f==null&&this.eachSeg(function(m){if(this.prev)f=m});this.addPtsToSelection(f);if(c){this.dragctrl=c;b&&this.segs[f].setLinked(c)}};svgedit.path.Path.prototype.update=function(){var f=this.elem;if(svgedit.utilities.getRotationAngle(f)){this.matrix=svgedit.math.getMatrix(f);this.imatrix=this.matrix.inverse()}else this.imatrix=this.matrix=
null;this.eachSeg(function(c){this.item=f.pathSegList.getItem(c);this.update()});return this};svgedit.path.getPath_=function(f){var c=p[f.id];c||(c=p[f.id]=new svgedit.path.Path(f));return c};svgedit.path.removePath_=function(f){f in p&&delete p[f]};var d=function(f,c,m,u,C,s,L){dx=f-m;dy=c-u;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)+L;dx=r*Math.cos(theta)+m;dy=r*Math.sin(theta)+u;dx-=C;dy-=s;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)-L;return{x:(r*Math.cos(theta)+C)/1,y:(r*Math.sin(theta)+ null;this.eachSeg(function(c){this.item=f.pathSegList.getItem(c);this.update()});return this};svgedit.path.getPath_=function(f){var c=p[f.id];c||(c=p[f.id]=new svgedit.path.Path(f));return c};svgedit.path.removePath_=function(f){f in p&&delete p[f]};var d=function(f,c,m,u,C,s,L){dx=f-m;dy=c-u;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)+L;dx=r*Math.cos(theta)+m;dy=r*Math.sin(theta)+u;dx-=C;dy-=s;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)-L;return{x:(r*Math.cos(theta)+C)/1,y:(r*Math.sin(theta)+
s)/1}};svgedit.path.recalcRotatedPath=function(){var f=svgedit.path.path.elem,c=svgedit.utilities.getRotationAngle(f,true);if(c){var m=svgedit.utilities.getBBox(f),u=svgedit.path.path.oldbbox,C=u.x+u.width/2;u=u.y+u.height/2;var s=m.x+m.width/2;m=m.y+m.height/2;s=s-C;var L=m-u;m=Math.sqrt(s*s+L*L);L=Math.atan2(L,s)+c;s=m*Math.cos(L)+C;m=m*Math.sin(L)+u;L=f.pathSegList;for(var R=L.numberOfItems;R;){R-=1;var K=L.getItem(R),I=K.pathSegType;if(I!=1){var Q=d(K.x,K.y,C,u,s,m,c);Q=[Q.x,Q.y];if(K.x1!=null&& s)/1}};svgedit.path.recalcRotatedPath=function(){var f=svgedit.path.path.elem,c=svgedit.utilities.getRotationAngle(f,true);if(c){var m=svgedit.utilities.getBBox(f),u=svgedit.path.path.oldbbox,C=u.x+u.width/2;u=u.y+u.height/2;var s=m.x+m.width/2;m=m.y+m.height/2;s=s-C;var L=m-u;m=Math.sqrt(s*s+L*L);L=Math.atan2(L,s)+c;s=m*Math.cos(L)+C;m=m*Math.sin(L)+u;L=f.pathSegList;for(var Q=L.numberOfItems;Q;){Q-=1;var K=L.getItem(Q),H=K.pathSegType;if(H!=1){var S=d(K.x,K.y,C,u,s,m,c);S=[S.x,S.y];if(K.x1!=null&&
K.x2!=null){c_vals1=d(K.x1,K.y1,C,u,s,m,c);c_vals2=d(K.x2,K.y2,C,u,s,m,c);Q.splice(Q.length,0,c_vals1.x,c_vals1.y,c_vals2.x,c_vals2.y)}svgedit.path.replacePathSeg(I,R,Q)}}svgedit.utilities.getBBox(f);C=svgroot.createSVGTransform();f=svgedit.transformlist.getTransformList(f);C.setRotate(c*180/Math.PI,s,m);f.replaceItem(C,0)}};svgedit.path.clearData=function(){p={}}})();if(!window.console){window.console={};window.console.log=function(){};window.console.dir=function(){}}if(window.opera){window.console.log=function(a){opera.postError(a)};window.console.dir=function(){}} K.x2!=null){c_vals1=d(K.x1,K.y1,C,u,s,m,c);c_vals2=d(K.x2,K.y2,C,u,s,m,c);S.splice(S.length,0,c_vals1.x,c_vals1.y,c_vals2.x,c_vals2.y)}svgedit.path.replacePathSeg(H,Q,S)}}svgedit.utilities.getBBox(f);C=svgroot.createSVGTransform();f=svgedit.transformlist.getTransformList(f);C.setRotate(c*180/Math.PI,s,m);f.replaceItem(C,0)}};svgedit.path.clearData=function(){p={}}})();if(!window.console){window.console={};window.console.log=function(){};window.console.dir=function(){}}if(window.opera){window.console.log=function(a){opera.postError(a)};window.console.dir=function(){}}
(function(){var a=jQuery.fn.attr;jQuery.fn.attr=function(q,g){var b=this.length;if(!b)return a.apply(this,arguments);for(var p=0;p<b;p++){var v=this[p];if(v.namespaceURI==="http://www.w3.org/2000/svg")if(g!==undefined)v.setAttribute(q,g);else if($.isArray(q)){b=q.length;for(p={};b--;){var d=q[b],f=v.getAttribute(d);if(f||f==="0")f=isNaN(f)?f:f-0;p[d]=f}return p}else if(typeof q==="object")for(d in q)v.setAttribute(d,q[d]);else{if((f=v.getAttribute(q))||f==="0")f=isNaN(f)?f:f-0;return f}else return a.apply(this, (function(){var a=jQuery.fn.attr;jQuery.fn.attr=function(q,g){var b=this.length;if(!b)return a.apply(this,arguments);for(var p=0;p<b;p++){var v=this[p];if(v.namespaceURI==="http://www.w3.org/2000/svg")if(g!==undefined)v.setAttribute(q,g);else if($.isArray(q)){b=q.length;for(p={};b--;){var d=q[b],f=v.getAttribute(d);if(f||f==="0")f=isNaN(f)?f:f-0;p[d]=f}return p}else if(typeof q==="object")for(d in q)v.setAttribute(d,q[d]);else{if((f=v.getAttribute(q))||f==="0")f=isNaN(f)?f:f-0;return f}else return a.apply(this,
arguments)}return this}})(); arguments)}return this}})();
$.SvgCanvas=function(a,q){function g(e,h){for(var l=svgedit.utilities.getBBox(e),B=0;B<2;B++){var A=B===0?"fill":"stroke",G=e.getAttribute(A);if(G&&G.indexOf("url(")===0){G=P(G);if(G.tagName==="linearGradient"){var D=G.getAttribute("x1")||0,z=G.getAttribute("y1")||0,F=G.getAttribute("x2")||1,k=G.getAttribute("y2")||0;D=l.width*D+l.x;z=l.height*z+l.y;F=l.width*F+l.x;k=l.height*k+l.y;D=N(D,z,h);k=N(F,k,h);F={};F.x1=(D.x-l.x)/l.width;F.y1=(D.y-l.y)/l.height;F.x2=(k.x-l.x)/l.width;F.y2=(k.y-l.y)/l.height; $.SvgCanvas=function(a,q){function g(e,h){for(var l=svgedit.utilities.getBBox(e),B=0;B<2;B++){var A=B===0?"fill":"stroke",G=e.getAttribute(A);if(G&&G.indexOf("url(")===0){G=P(G);if(G.tagName==="linearGradient"){var D=G.getAttribute("x1")||0,z=G.getAttribute("y1")||0,F=G.getAttribute("x2")||1,k=G.getAttribute("y2")||0;D=l.width*D+l.x;z=l.height*z+l.y;F=l.width*F+l.x;k=l.height*k+l.y;D=N(D,z,h);k=N(F,k,h);F={};F.x1=(D.x-l.x)/l.width;F.y1=(D.y-l.y)/l.height;F.x2=(k.x-l.x)/l.width;F.y2=(k.y-l.y)/l.height;
G=G.cloneNode(true);$(G).attr(F);G.id=ka();gb().appendChild(G);e.setAttribute(A,"url(#"+G.id+")")}}}}var b="http://www.w3.org/2000/svg",p={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};q&&$.extend(p,q);var v=p.dimensions,d=this,f=a.ownerDocument,c=f.importNode(svgedit.utilities.text2xml('<svg id="svgroot" xmlns="'+b+'" xlinkns="http://www.w3.org/1999/xlink" width="'+v[0]+'" height="'+v[1]+'" x="'+v[0]+'" y="'+v[1]+'" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>').documentElement, G=G.cloneNode(true);$(G).attr(F);G.id=ka();gb().appendChild(G);e.setAttribute(A,"url(#"+G.id+")")}}}}var b="http://www.w3.org/2000/svg",p={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};q&&$.extend(p,q);var v=p.dimensions,d=this,f=a.ownerDocument,c=f.importNode(svgedit.utilities.text2xml('<svg id="svgroot" xmlns="'+b+'" xlinkns="http://www.w3.org/1999/xlink" width="'+v[0]+'" height="'+v[1]+'" x="'+v[0]+'" y="'+v[1]+'" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>').documentElement,
true);a.appendChild(c);var m=f.createElementNS(b,"svg");(d.clearSvgContentElement=function(){for(;m.firstChild;)m.removeChild(m.firstChild);$(m).attr({id:"svgcontent",width:v[0],height:v[1],x:v[0],y:v[1],overflow:p.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(c);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");m.appendChild(e)})();var u="svg_";d.setIdPrefix= true);a.appendChild(c);var m=f.createElementNS(b,"svg");(d.clearSvgContentElement=function(){for(;m.firstChild;)m.removeChild(m.firstChild);$(m).attr({id:"svgcontent",width:v[0],height:v[1],x:v[0],y:v[1],overflow:p.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(c);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");m.appendChild(e)})();var u="svg_";d.setIdPrefix=
function(e){u=e};d.current_drawing_=new svgedit.draw.Drawing(m,u);var C=d.getCurrentDrawing=function(){return d.current_drawing_},s=1,L=null,R={shape:{fill:(p.initFill.color=="none"?"":"#")+p.initFill.color,fill_paint:null,fill_opacity:p.initFill.opacity,stroke:"#"+p.initStroke.color,stroke_paint:null,stroke_opacity:p.initStroke.opacity,stroke_width:p.initStroke.width,stroke_dasharray:"none",opacity:p.initOpacity}};R.text=$.extend(true,{},R.shape);$.extend(R.text,{fill:"#000000",stroke_width:0,font_size:24, function(e){u=e};d.current_drawing_=new svgedit.draw.Drawing(m,u);var C=d.getCurrentDrawing=function(){return d.current_drawing_},s=1,L=null,Q={shape:{fill:(p.initFill.color=="none"?"":"#")+p.initFill.color,fill_paint:null,fill_opacity:p.initFill.opacity,stroke:"#"+p.initStroke.color,stroke_paint:null,stroke_opacity:p.initStroke.opacity,stroke_width:p.initStroke.width,stroke_dasharray:"none",opacity:p.initOpacity}};Q.text=$.extend(true,{},Q.shape);$.extend(Q.text,{fill:"#000000",stroke_width:0,font_size:24,
font_family:"Helvetica, Arial, sans-serif"});var K=R.shape,I=Array(1),Q=this.addSvgElementFromJson=function(e){var h=svgedit.utilities.getElem(e.attr.id),l=C().getCurrentLayer();if(h&&e.element!=h.tagName){l.removeChild(h);h=null}if(!h){h=f.createElementNS(b,e.element);if(l)(L||l).appendChild(h)}e.curStyles&&svgedit.utilities.assignAttributes(h,{fill:K.fill,stroke:K.stroke,"stroke-width":K.stroke_width,"stroke-dasharray":K.stroke_dasharray,"stroke-opacity":K.stroke_opacity,"fill-opacity":K.fill_opacity, font_family:"Helvetica, Arial, sans-serif"});var K=Q.shape,H=Array(1),S=this.addSvgElementFromJson=function(e){var h=svgedit.utilities.getElem(e.attr.id),l=C().getCurrentLayer();if(h&&e.element!=h.tagName){l.removeChild(h);h=null}if(!h){h=f.createElementNS(b,e.element);if(l)(L||l).appendChild(h)}e.curStyles&&svgedit.utilities.assignAttributes(h,{fill:K.fill,stroke:K.stroke,"stroke-width":K.stroke_width,"stroke-dasharray":K.stroke_dasharray,"stroke-opacity":K.stroke_opacity,"fill-opacity":K.fill_opacity,
opacity:K.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,e.attr,100);svgedit.utilities.cleanupElement(h);return h},S=d.getTransformList=svgedit.transformlist.getTransformList,N=svgedit.math.transformPoint,ga=d.matrixMultiply=svgedit.math.matrixMultiply,na=d.hasMatrixTransform=svgedit.math.hasMatrixTransform,X=d.transformListToTransform=svgedit.math.transformListToTransform,U=svgedit.math.snapToAngle,ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return p.baseUnit}, opacity:K.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,e.attr,100);svgedit.utilities.cleanupElement(h);return h},R=d.getTransformList=svgedit.transformlist.getTransformList,N=svgedit.math.transformPoint,ga=d.matrixMultiply=svgedit.math.matrixMultiply,oa=d.hasMatrixTransform=svgedit.math.hasMatrixTransform,X=d.transformListToTransform=svgedit.math.transformListToTransform,U=svgedit.math.snapToAngle,ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return p.baseUnit},
getElement:svgedit.utilities.getElem,getHeight:function(){return m.getAttribute("height")/s},getWidth:function(){return m.getAttribute("width")/s},getRoundDigits:function(){return $a.round_digits}});var Aa=d.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return c},getSelectedElements:function(){return I},getSVGContent:function(){return m}});var ja=d.getUrlFromAttr=svgedit.utilities.getUrlFromAttr, getElement:svgedit.utilities.getElem,getHeight:function(){return m.getAttribute("height")/s},getWidth:function(){return m.getAttribute("width")/s},getRoundDigits:function(){return $a.round_digits}});var Aa=d.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return c},getSelectedElements:function(){return H},getSVGContent:function(){return m}});var ja=d.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,
ba=d.getHref=svgedit.utilities.getHref,T=d.setHref=svgedit.utilities.setHref,Z=svgedit.utilities.getPathBBox;d.getBBox=svgedit.utilities.getBBox;var oa=d.getRotationAngle=svgedit.utilities.getRotationAngle,pa=d.getElem=svgedit.utilities.getElem,ma=d.assignAttributes=svgedit.utilities.assignAttributes,la=this.cleanupElement=svgedit.utilities.cleanupElement,xa=svgedit.sanitize.getNSMap(),ya=d.sanitizeSvg=svgedit.sanitize.sanitizeSvg,Ja=svgedit.history.MoveElementCommand,Ha=svgedit.history.InsertElementCommand, ba=d.getHref=svgedit.utilities.getHref,T=d.setHref=svgedit.utilities.setHref,Z=svgedit.utilities.getPathBBox;d.getBBox=svgedit.utilities.getBBox;var na=d.getRotationAngle=svgedit.utilities.getRotationAngle,pa=d.getElem=svgedit.utilities.getElem,ma=d.assignAttributes=svgedit.utilities.assignAttributes,la=this.cleanupElement=svgedit.utilities.cleanupElement,xa=svgedit.sanitize.getNSMap(),ya=d.sanitizeSvg=svgedit.sanitize.sanitizeSvg,Ja=svgedit.history.MoveElementCommand,Ha=svgedit.history.InsertElementCommand,
Ga=svgedit.history.RemoveElementCommand,Ma=svgedit.history.ChangeElementCommand,Ca=svgedit.history.BatchCommand;d.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,h){var l=svgedit.history.HistoryEventTypes;if(e==l.BEFORE_UNAPPLY||e==l.BEFORE_APPLY)d.clearSelection();else if(e==l.AFTER_APPLY||e==l.AFTER_UNAPPLY){var B=h.elements();d.pathActions.clear();M("changed",B);B=h.type();l=e==l.AFTER_APPLY;if(B==Ja.type()){l=l?h.newParent:h.oldParent;l==m&&d.identifyLayers()}else if(B== Ga=svgedit.history.RemoveElementCommand,Ma=svgedit.history.ChangeElementCommand,Ca=svgedit.history.BatchCommand;d.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,h){var l=svgedit.history.HistoryEventTypes;if(e==l.BEFORE_UNAPPLY||e==l.BEFORE_APPLY)d.clearSelection();else if(e==l.AFTER_APPLY||e==l.AFTER_UNAPPLY){var B=h.elements();d.pathActions.clear();M("changed",B);B=h.type();l=e==l.AFTER_APPLY;if(B==Ja.type()){l=l?h.newParent:h.oldParent;l==m&&d.identifyLayers()}else if(B==
Ha.type()||B==Ga.type()){h.parent==m&&d.identifyLayers();if(B==Ha.type())l&&Ta(h.elem);else l||Ta(h.elem);h.elem.tagName==="use"&&Gb(h.elem)}else if(B==Ma.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==m&&d.identifyLayers();l=l?h.newValues:h.oldValues;l.stdDeviation&&d.setBlurOffsets(h.elem.parentNode,l.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){B=h.elem;if(!B.getAttribute("x")&&!B.getAttribute("y")){l=B.parentNode;var A=B.nextSibling;l.removeChild(B);l.insertBefore(B, Ha.type()||B==Ga.type()){h.parent==m&&d.identifyLayers();if(B==Ha.type())l&&Ta(h.elem);else l||Ta(h.elem);h.elem.tagName==="use"&&Gb(h.elem)}else if(B==Ma.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==m&&d.identifyLayers();l=l?h.newValues:h.oldValues;l.stdDeviation&&d.setBlurOffsets(h.elem.parentNode,l.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){B=h.elem;if(!B.getAttribute("x")&&!B.getAttribute("y")){l=B.parentNode;var A=B.nextSibling;l.removeChild(B);l.insertBefore(B,
A)}}}}}});var wa=function(e){d.undoMgr.addCommandToHistory(e)};svgedit.select.init(p,{createSVGElement:function(e){return d.addSvgElementFromJson(e)},svgRoot:function(){return c},svgContent:function(){return m},currentZoom:function(){return s},getStrokedBBox:function(e){return d.getStrokedBBox([e])}});var ra=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return s},getSVGRoot:function(){return c}});svgedit.utilities.snapToGrid=function(e){var h= A)}}}}}});var wa=function(e){d.undoMgr.addCommandToHistory(e)};svgedit.select.init(p,{createSVGElement:function(e){return d.addSvgElementFromJson(e)},svgRoot:function(){return c},svgContent:function(){return m},currentZoom:function(){return s},getStrokedBBox:function(e){return d.getStrokedBBox([e])}});var ra=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return s},getSVGRoot:function(){return c}});svgedit.utilities.snapToGrid=function(e){var h=
p.snappingStep,l=p.baseUnit;if(l!=="px")h*=svgedit.units.getTypeMap()[l];return e=Math.round(e/h)*h};var va=svgedit.utilities.snapToGrid,kb={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"},vb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],cb=$.data,Ta=function(e){var h=$(e).attr(vb),l;for(l in h){var B= p.snappingStep,l=p.baseUnit;if(l!=="px")h*=svgedit.units.getTypeMap()[l];return e=Math.round(e/h)*h};var va=svgedit.utilities.snapToGrid,kb={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"},vb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],cb=$.data,Ta=function(e){var h=$(e).attr(vb),l;for(l in h){var B=
h[l];if(B&&B.indexOf("url(")===0){B=ja(B).substr(1);if(!pa(B)){gb().appendChild(sb[B]);delete sb[B]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(l=e.length;h<l;h++)Ta(e[h])}},Va={},Ea=p.imgPath+"logo.png",ta=[],$a={round_digits:5},Ka=false,Sa=null,Fa="select",db="none",lb={},Ua=R.text,Xa=K,wb=null,sa=null,hb=[],eb={},sb={};d.clipBoard=[];var ib=this.runExtensions=function(e,h,l){var B=false;if(l)B=[];$.each(eb,function(A,G){if(e in G)if(l)B.push(G[e](h));else B=G[e](h)});return B};this.addExtension= h[l];if(B&&B.indexOf("url(")===0){B=ja(B).substr(1);if(!pa(B)){gb().appendChild(sb[B]);delete sb[B]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(l=e.length;h<l;h++)Ta(e[h])}},Va={},Ea=p.imgPath+"logo.png",ta=[],$a={round_digits:5},Ka=false,Sa=null,Fa="select",db="none",lb={},Ua=Q.text,Xa=K,wb=null,sa=null,hb=[],eb={},sb={};d.clipBoard=[];var ib=this.runExtensions=function(e,h,l){var B=false;if(l)B=[];$.each(eb,function(A,G){if(e in G)if(l)B.push(G[e](h));else B=G[e](h)});return B};this.addExtension=
function(e,h){if(e in eb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var l=$.isFunction(h)?h($.extend(d.getPrivateMethods(),{svgroot:c,svgcontent:m,nonce:C().getNonce(),selectorManager:ra})):h;eb[e]=l;M("extension_added",l)}};var ab=this.round=function(e){return parseInt(e*s)/s},ob=this.getIntersectionList=function(e){if(sa==null)return null;var h=L||C().getCurrentLayer();hb.length||(hb=fb(h));var l=null;try{l=h.getIntersectionList(e,null)}catch(B){}if(l== function(e,h){if(e in eb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var l=$.isFunction(h)?h($.extend(d.getPrivateMethods(),{svgroot:c,svgcontent:m,nonce:C().getNonce(),selectorManager:ra})):h;eb[e]=l;M("extension_added",l)}};var ab=this.round=function(e){return parseInt(e*s)/s},ob=this.getIntersectionList=function(e){if(sa==null)return null;var h=L||C().getCurrentLayer();hb.length||(hb=fb(h));var l=null;try{l=h.getIntersectionList(e,null)}catch(B){}if(l==
null||typeof l.item!="function"){l=[];if(e)e=e;else{e=sa.getBBox();h={};for(var A in e)h[A]=e[A]/s;e=h}for(A=hb.length;A--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,hb[A].bbox)&&l.push(hb[A].elem)}return l};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=pb());if(!e.length)return false;var h=function(k){try{var n=svgedit.utilities.getBBox(k),o=svgedit.utilities.getRotationAngle(k);if(o&&o%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(k))){o=false;if(["ellipse", null||typeof l.item!="function"){l=[];if(e)e=e;else{e=sa.getBBox();h={};for(var A in e)h[A]=e[A]/s;e=h}for(A=hb.length;A--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,hb[A].bbox)&&l.push(hb[A].elem)}return l};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=pb());if(!e.length)return false;var h=function(k){try{var n=svgedit.utilities.getBBox(k),o=svgedit.utilities.getRotationAngle(k);if(o&&o%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(k))){o=false;if(["ellipse",
"path","line","polyline","polygon"].indexOf(k.tagName)>=0)n=o=d.convertToPath(k,true);else if(k.tagName=="rect"){var w=k.getAttribute("rx"),E=k.getAttribute("ry");if(w||E)n=o=d.convertToPath(k,true)}if(!o){var H=k.cloneNode(true),J=document.createElementNS(b,"g"),O=k.parentNode;O.appendChild(J);J.appendChild(H);n=svgedit.utilities.bboxToObj(J.getBBox());O.removeChild(J)}}return n}catch(Y){console.log(k,Y);return null}},l;$.each(e,function(){if(!l)if(this.parentNode)l=h(this)});if(l==null)return null; "path","line","polyline","polygon"].indexOf(k.tagName)>=0)n=o=d.convertToPath(k,true);else if(k.tagName=="rect"){var w=k.getAttribute("rx"),E=k.getAttribute("ry");if(w||E)n=o=d.convertToPath(k,true)}if(!o){var I=k.cloneNode(true),J=document.createElementNS(b,"g"),O=k.parentNode;O.appendChild(J);J.appendChild(I);n=svgedit.utilities.bboxToObj(J.getBBox());O.removeChild(J)}}return n}catch(Y){console.log(k,Y);return null}},l;$.each(e,function(){if(!l)if(this.parentNode)l=h(this)});if(l==null)return null;
var B=l.x+l.width,A=l.y+l.height,G=l.x,D=l.y,z=function(k){var n=k.getAttribute("stroke-width"),o=0;if(k.getAttribute("stroke")!="none"&&!isNaN(n))o+=n/2;return o},F=[];$.each(e,function(k,n){var o=h(n);if(o){var w=z(n);G=Math.min(G,o.x-w);D=Math.min(D,o.y-w);F.push(o)}});l.x=G;l.y=D;$.each(e,function(k,n){var o=F[k];if(o&&n.nodeType==1){var w=z(n);B=Math.max(B,o.x+o.width+w);A=Math.max(A,o.y+o.height+w)}});l.width=B-G;l.height=A-D;return l};var pb=this.getVisibleElements=function(e){e||(e=$(m).children()); var B=l.x+l.width,A=l.y+l.height,G=l.x,D=l.y,z=function(k){var n=k.getAttribute("stroke-width"),o=0;if(k.getAttribute("stroke")!="none"&&!isNaN(n))o+=n/2;return o},F=[];$.each(e,function(k,n){var o=h(n);if(o){var w=z(n);G=Math.min(G,o.x-w);D=Math.min(D,o.y-w);F.push(o)}});l.x=G;l.y=D;$.each(e,function(k,n){var o=F[k];if(o&&n.nodeType==1){var w=z(n);B=Math.max(B,o.x+o.width+w);A=Math.max(A,o.y+o.height+w)}});l.width=B-G;l.height=A-D;return l};var pb=this.getVisibleElements=function(e){e||(e=$(m).children());
e.find("#canvas_background").length&&e.splice(0,1);var h=[];$(e).children().each(function(l,B){try{B.getBBox()&&h.push(B)}catch(A){}});return h.reverse()},fb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(m).children());var h=[];$(e).children().each(function(l,B){try{B.getBBox()&&h.push({elem:B,bbox:getStrokedBBox([B])})}catch(A){}});return h.reverse()},tb=this.groupSvgElem=function(e){var h=document.createElementNS(b,"g");e.parentNode.replaceChild(h,e);$(h).append(e).data("gsvg",e)[0].id=ka()}, e.find("#canvas_background").length&&e.splice(0,1);var h=[];$(e).children().each(function(l,B){try{B.getBBox()&&h.push(B)}catch(A){}});return h.reverse()},fb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(m).children());var h=[];$(e).children().each(function(l,B){try{B.getBBox()&&h.push({elem:B,bbox:getStrokedBBox([B])})}catch(A){}});return h.reverse()},tb=this.groupSvgElem=function(e){var h=document.createElementNS(b,"g");e.parentNode.replaceChild(h,e);$(h).append(e).data("gsvg",e)[0].id=ka()},
ia=function(e){var h=document.createElementNS(e.namespaceURI,e.nodeName);h.removeAttribute("id");$.each(e.attributes,function(B,A){A.localName!="-moz-math-font-style"&&h.setAttributeNS(A.namespaceURI,A.nodeName,A.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var l=La.convertPath(e);h.setAttribute("d",l)}$.each(e.childNodes,function(B,A){switch(A.nodeType){case 1:h.appendChild(ia(A));break;case 3:h.textContent=A.nodeValue}});if($(e).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(e).data("symbol")){e= ia=function(e){var h=document.createElementNS(e.namespaceURI,e.nodeName);h.removeAttribute("id");$.each(e.attributes,function(B,A){A.localName!="-moz-math-font-style"&&h.setAttributeNS(A.namespaceURI,A.nodeName,A.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var l=La.convertPath(e);h.setAttribute("d",l)}$.each(e.childNodes,function(B,A){switch(A.nodeType){case 1:h.appendChild(ia(A));break;case 3:h.textContent=A.nodeValue}});if($(e).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(e).data("symbol")){e=
$(e).data("symbol");$(h).data("ref",e).data("symbol",e)}else h.tagName=="image"&&Fb(h);h.id=ka();return h},aa,ka,M;(function(e){var h={};aa=e.getId=function(){return C().getId()};ka=e.getNextId=function(){return C().getNextId()};M=e.call=function(l,B){if(h[l])return h[l](this,B)};e.bind=function(l,B){var A=h[l];h[l]=B;return A}})(d);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var h=0,l=e.length;h<l;++h){var B=e[h];B.setAttribute("d",La.convertPath(B)); $(e).data("symbol");$(h).data("ref",e).data("symbol",e)}else h.tagName=="image"&&Fb(h);h.id=ka();return h},aa,ka,M;(function(e){var h={};aa=e.getId=function(){return C().getId()};ka=e.getNextId=function(){return C().getNextId()};M=e.call=function(l,B){if(h[l])return h[l](this,B)};e.bind=function(l,B){var A=h[l];h[l]=B;return A}})(d);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var h=0,l=e.length;h<l;++h){var B=e[h];B.setAttribute("d",La.convertPath(B));
La.fixEnd(B)}};var P=this.getRefElem=function(e){return pa(ja(e).substr(1))},ca=function(e){if(!svgedit.browser.isGecko())return e;var h=e.cloneNode(true);e.parentNode.insertBefore(h,e);e.parentNode.removeChild(e);ra.releaseSelector(e);I[0]=h;ra.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(e,h){e=parseFloat(e);var l=I[0];if(l){var B=l.getAttribute("transform"),A=svgedit.utilities.getBBox(l),G=A.x+A.width/2,D=A.y+A.height/2;A=S(l);A.numberOfItems>0&&A.getItem(0).type== La.fixEnd(B)}};var P=this.getRefElem=function(e){return pa(ja(e).substr(1))},ca=function(e){if(!svgedit.browser.isGecko())return e;var h=e.cloneNode(true);e.parentNode.insertBefore(h,e);e.parentNode.removeChild(e);ra.releaseSelector(e);H[0]=h;ra.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(e,h){e=parseFloat(e);var l=H[0];if(l){var B=l.getAttribute("transform"),A=svgedit.utilities.getBBox(l),G=A.x+A.width/2,D=A.y+A.height/2;A=R(l);A.numberOfItems>0&&A.getItem(0).type==
4&&A.removeItem(0);if(e!=0){G=N(G,D,X(A).matrix);D=c.createSVGTransform();D.setRotate(e,G.x,G.y);A.numberOfItems?A.insertItemBefore(D,0):A.appendItem(D)}else A.numberOfItems==0&&l.removeAttribute("transform");if(!h){A=l.getAttribute("transform");l.setAttribute("transform",B);Ya("transform",A,I);M("changed",I)}pa("pathpointgrip_container");l=ra.requestSelector(I[0]);l.resize();l.updateGripCursors(e)}};var Da=this.recalculateAllSelectedDimensions=function(){for(var e=new Ca(db=="none"?"position":"size"), 4&&A.removeItem(0);if(e!=0){G=N(G,D,X(A).matrix);D=c.createSVGTransform();D.setRotate(e,G.x,G.y);A.numberOfItems?A.insertItemBefore(D,0):A.appendItem(D)}else A.numberOfItems==0&&l.removeAttribute("transform");if(!h){A=l.getAttribute("transform");l.setAttribute("transform",B);Ya("transform",A,H);M("changed",H)}pa("pathpointgrip_container");l=ra.requestSelector(H[0]);l.resize();l.updateGripCursors(e)}};var Da=this.recalculateAllSelectedDimensions=function(){for(var e=new Ca(db=="none"?"position":"size"),
h=I.length;h--;){var l=Ra(I[h]);l&&e.addSubCommand(l)}if(!e.isEmpty()){wa(e);M("changed",I)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Wa=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},Za=this.remapElement=function(e,h,l){var B=p.gridSnapping&&e.parentNode.parentNode.localName==="svg",A=function(){if(B)for(var o in h)h[o]=va(h[o]);ma(e,h,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var D=G===0?"fill":"stroke",z=e.getAttribute(D);if(z&& h=H.length;h--;){var l=Ra(H[h]);l&&e.addSubCommand(l)}if(!e.isEmpty()){wa(e);M("changed",H)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Wa=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},Za=this.remapElement=function(e,h,l){var B=p.gridSnapping&&e.parentNode.parentNode.localName==="svg",A=function(){if(B)for(var o in h)h[o]=va(h[o]);ma(e,h,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var D=G===0?"fill":"stroke",z=e.getAttribute(D);if(z&&
z.indexOf("url(")===0)if(l.a<0||l.d<0){z=P(z).cloneNode(true);if(l.a<0){var F=z.getAttribute("x1"),k=z.getAttribute("x2");z.setAttribute("x1",-(F-1));z.setAttribute("x2",-(k-1))}if(l.d<0){F=z.getAttribute("y1");k=z.getAttribute("y2");z.setAttribute("y1",-(F-1));z.setAttribute("y2",-(k-1))}z.id=ka();gb().appendChild(z);e.setAttribute(D,"url(#"+z.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(l.a==1&&l.b==0&&l.c==0&&l.d==1&&(l.e!=0||l.f!=0)){D=X(e).matrix;D=ga(D.inverse(),l,D);h.x=parseFloat(h.x)+ z.indexOf("url(")===0)if(l.a<0||l.d<0){z=P(z).cloneNode(true);if(l.a<0){var F=z.getAttribute("x1"),k=z.getAttribute("x2");z.setAttribute("x1",-(F-1));z.setAttribute("x2",-(k-1))}if(l.d<0){F=z.getAttribute("y1");k=z.getAttribute("y2");z.setAttribute("y1",-(F-1));z.setAttribute("y2",-(k-1))}z.id=ka();gb().appendChild(z);e.setAttribute(D,"url(#"+z.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(l.a==1&&l.b==0&&l.c==0&&l.d==1&&(l.e!=0||l.f!=0)){D=X(e).matrix;D=ga(D.inverse(),l,D);h.x=parseFloat(h.x)+
D.e;h.y=parseFloat(h.y)+D.f}else{D=S(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(l.a<0||l.d<0)){D=S(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}else{D=N(h.x,h.y,l);h.width=l.a*h.width;h.height=l.d*h.height;h.x=D.x+Math.min(0,h.width);h.y=D.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}A();break;case "ellipse":G=N(h.cx, D.e;h.y=parseFloat(h.y)+D.f}else{D=R(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(l.a<0||l.d<0)){D=R(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}else{D=N(h.x,h.y,l);h.width=l.a*h.width;h.height=l.d*h.height;h.x=D.x+Math.min(0,h.width);h.y=D.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}A();break;case "ellipse":G=N(h.cx,
h.cy,l);h.cx=G.x;h.cy=G.y;h.rx=l.a*h.rx;h.ry=l.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);A();break;case "circle":G=N(h.cx,h.cy,l);h.cx=G.x;h.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,l);h.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(h.r)h.r=Math.abs(h.r);A();break;case "line":D=N(h.x1,h.y1,l);F=N(h.x2,h.y2,l);h.x1=D.x;h.y1=D.y;h.x2=F.x;h.y2=F.y;case "text":l=e.querySelectorAll("tspan");for(G=l.length;G--;){D=Aa("x",e.getAttribute("x"));z=Aa("x",l[G].getAttribute("x")); h.cy,l);h.cx=G.x;h.cy=G.y;h.rx=l.a*h.rx;h.ry=l.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);A();break;case "circle":G=N(h.cx,h.cy,l);h.cx=G.x;h.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,l);h.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(h.r)h.r=Math.abs(h.r);A();break;case "line":D=N(h.x1,h.y1,l);F=N(h.x2,h.y2,l);h.x1=D.x;h.y1=D.y;h.x2=F.x;h.y2=F.y;case "text":l=e.querySelectorAll("tspan");for(G=l.length;G--;){D=Aa("x",e.getAttribute("x"));z=Aa("x",l[G].getAttribute("x"));
F=Aa("y",e.getAttribute("y"));k=Aa("y",l[G].getAttribute("y"));var n={};if(!isNaN(D)&&!isNaN(z)&&D!=0&&z!=0&&h.x)n.x=h.x-(D-z);if(!isNaN(F)&&!isNaN(k)&&F!=0&&k!=0&&h.y)n.y=h.y-(F-k);if(n.x||n.y)ma(l[G],n,1E3,true)}A();break;case "use":A();break;case "g":(A=$(e).data("gsvg"))&&ma(A,h,1E3,true);break;case "polyline":case "polygon":A=h.points.length;for(G=0;G<A;++G){k=h.points[G];k=N(k.x,k.y,l);h.points[G].x=k.x;h.points[G].y=k.y}A=h.points.length;l="";for(G=0;G<A;++G){k=h.points[G];l+=k.x+","+k.y+" "}e.setAttribute("points", F=Aa("y",e.getAttribute("y"));k=Aa("y",l[G].getAttribute("y"));var n={};if(!isNaN(D)&&!isNaN(z)&&D!=0&&z!=0&&h.x)n.x=h.x-(D-z);if(!isNaN(F)&&!isNaN(k)&&F!=0&&k!=0&&h.y)n.y=h.y-(F-k);if(n.x||n.y)ma(l[G],n,1E3,true)}A();break;case "use":A();break;case "g":(A=$(e).data("gsvg"))&&ma(A,h,1E3,true);break;case "polyline":case "polygon":A=h.points.length;for(G=0;G<A;++G){k=h.points[G];k=N(k.x,k.y,l);h.points[G].x=k.x;h.points[G].y=k.y}A=h.points.length;l="";for(G=0;G<A;++G){k=h.points[G];l+=k.x+","+k.y+" "}e.setAttribute("points",
l);break;case "path":D=e.pathSegList;A=D.numberOfItems;h.d=Array(A);for(G=0;G<A;++G){z=D.getItem(G);h.d[G]={type:z.pathSegType,x:z.x,y:z.y,x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,r1:z.r1,r2:z.r2,angle:z.angle,largeArcFlag:z.largeArcFlag,sweepFlag:z.sweepFlag}}A=h.d.length;G=h.d[0];n=N(G.x,G.y,l);h.d[0].x=n.x;h.d[0].y=n.y;for(G=1;G<A;++G){z=h.d[G];D=z.type;if(D%2==0){k=N(z.x!=undefined?z.x:n.x,z.y!=undefined?z.y:n.y,l);D=N(z.x1,z.y1,l);F=N(z.x2,z.y2,l);z.x=k.x;z.y=k.y;z.x1=D.x;z.y1=D.y;z.x2=F.x;z.y2=F.y}else{z.x= l);break;case "path":D=e.pathSegList;A=D.numberOfItems;h.d=Array(A);for(G=0;G<A;++G){z=D.getItem(G);h.d[G]={type:z.pathSegType,x:z.x,y:z.y,x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,r1:z.r1,r2:z.r2,angle:z.angle,largeArcFlag:z.largeArcFlag,sweepFlag:z.sweepFlag}}A=h.d.length;G=h.d[0];n=N(G.x,G.y,l);h.d[0].x=n.x;h.d[0].y=n.y;for(G=1;G<A;++G){z=h.d[G];D=z.type;if(D%2==0){k=N(z.x!=undefined?z.x:n.x,z.y!=undefined?z.y:n.y,l);D=N(z.x1,z.y1,l);F=N(z.x2,z.y2,l);z.x=k.x;z.y=k.y;z.x1=D.x;z.y1=D.y;z.x2=F.x;z.y2=F.y}else{z.x=
l.a*z.x;z.y=l.d*z.y;z.x1=l.a*z.x1;z.y1=l.d*z.y1;z.x2=l.a*z.x2;z.y2=l.d*z.y2}z.r1=l.a*z.r1;z.r2=l.d*z.r2}l="";A=h.d.length;for(G=0;G<A;++G){z=h.d[G];D=z.type;l+=Oa[D];switch(D){case 13:case 12:l+=z.x+" ";break;case 15:case 14:l+=z.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:l+=z.x+","+z.y+" ";break;case 7:case 6:l+=z.x1+","+z.y1+" "+z.x2+","+z.y2+" "+z.x+","+z.y+" ";break;case 9:case 8:l+=z.x1+","+z.y1+" "+z.x+","+z.y+" ";break;case 11:case 10:l+=z.r1+","+z.r2+" "+z.angle+" "+ +z.largeArcFlag+ l.a*z.x;z.y=l.d*z.y;z.x1=l.a*z.x1;z.y1=l.d*z.y1;z.x2=l.a*z.x2;z.y2=l.d*z.y2}z.r1=l.a*z.r1;z.r2=l.d*z.r2}l="";A=h.d.length;for(G=0;G<A;++G){z=h.d[G];D=z.type;l+=Oa[D];switch(D){case 13:case 12:l+=z.x+" ";break;case 15:case 14:l+=z.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:l+=z.x+","+z.y+" ";break;case 7:case 6:l+=z.x1+","+z.y1+" "+z.x2+","+z.y2+" "+z.x+","+z.y+" ";break;case 9:case 8:l+=z.x1+","+z.y1+" "+z.x+","+z.y+" ";break;case 11:case 10:l+=z.r1+","+z.r2+" "+z.angle+" "+ +z.largeArcFlag+
" "+ +z.sweepFlag+" "+z.x+","+z.y+" ";break;case 17:case 16:l+=z.x2+","+z.y2+" "+z.x+","+z.y+" "}}e.setAttribute("d",l)}},nb=function(e,h,l){e=P(e).firstChild;var B=S(e),A=c.createSVGTransform();A.setTranslate(h,l);B.appendItem(A);Ra(e)},Ra=this.recalculateDimensions=function(e){if(e==null)return null;var h=S(e);if(h&&h.numberOfItems>0){for(var l=h.numberOfItems;l--;){var B=h.getItem(l);if(B.type===0)h.removeItem(l);else if(B.type===1)svgedit.math.isIdentity(B.matrix)&&h.removeItem(l);else B.type=== " "+ +z.sweepFlag+" "+z.x+","+z.y+" ";break;case 17:case 16:l+=z.x2+","+z.y2+" "+z.x+","+z.y+" "}}e.setAttribute("d",l)}},nb=function(e,h,l){e=P(e).firstChild;var B=R(e),A=c.createSVGTransform();A.setTranslate(h,l);B.appendItem(A);Ra(e)},Ra=this.recalculateDimensions=function(e){if(e==null)return null;var h=R(e);if(h&&h.numberOfItems>0){for(var l=h.numberOfItems;l--;){var B=h.getItem(l);if(B.type===0)h.removeItem(l);else if(B.type===1)svgedit.math.isIdentity(B.matrix)&&h.removeItem(l);else B.type===
4&&B.angle===0&&h.removeItem(l)}if(h.numberOfItems===1&&oa(e))return null}if(!h||h.numberOfItems==0){e.removeAttribute("transform");return null}if(h){l=h.numberOfItems;for(var A=[];l--;){B=h.getItem(l);if(B.type===1)A.push([B.matrix,l]);else if(A.length)A=[]}if(A.length===2){l=c.createSVGTransformFromMatrix(ga(A[1][0],A[0][0]));h.removeItem(A[0][1]);h.removeItem(A[1][1]);h.insertItemBefore(l,A[1][1])}l=h.numberOfItems;if(l>=2&&h.getItem(l-2).type===1&&h.getItem(l-1).type===2){A=c.createSVGTransform(); 4&&B.angle===0&&h.removeItem(l)}if(h.numberOfItems===1&&na(e))return null}if(!h||h.numberOfItems==0){e.removeAttribute("transform");return null}if(h){l=h.numberOfItems;for(var A=[];l--;){B=h.getItem(l);if(B.type===1)A.push([B.matrix,l]);else if(A.length)A=[]}if(A.length===2){l=c.createSVGTransformFromMatrix(ga(A[1][0],A[0][0]));h.removeItem(A[0][1]);h.removeItem(A[1][1]);h.insertItemBefore(l,A[1][1])}l=h.numberOfItems;if(l>=2&&h.getItem(l-2).type===1&&h.getItem(l-1).type===2){A=c.createSVGTransform();
B=ga(h.getItem(l-2).matrix,h.getItem(l-1).matrix);A.setMatrix(B);h.removeItem(l-2);h.removeItem(l-2);h.appendItem(A)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var G=$(e).data("gsvg");l=new Ca("Transform");var D={},z=null;B=[];switch(e.tagName){case "line":B=["x1","y1","x2","y2"];break;case "circle":B=["cx","cy","r"];break;case "ellipse":B= B=ga(h.getItem(l-2).matrix,h.getItem(l-1).matrix);A.setMatrix(B);h.removeItem(l-2);h.removeItem(l-2);h.appendItem(A)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var G=$(e).data("gsvg");l=new Ca("Transform");var D={},z=null;B=[];switch(e.tagName){case "line":B=["x1","y1","x2","y2"];break;case "circle":B=["cx","cy","r"];break;case "ellipse":B=
["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":B=["width","height","x","y"];break;case "use":case "text":case "tspan":B=["x","y"];break;case "polygon":case "polyline":z={};z.points=e.getAttribute("points");A=e.points;var F=A.numberOfItems;D.points=Array(F);for(var k=0;k<F;++k){var n=A.getItem(k);D.points[k]={x:n.x,y:n.y}}break;case "path":z={};z.d=e.getAttribute("d");D.d=e.getAttribute("d")}if(B.length){D=$(e).attr(B);$.each(D,function(Ba,Pa){D[Ba]=Aa(Ba,Pa)})}else if(G)D= ["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":B=["width","height","x","y"];break;case "use":case "text":case "tspan":B=["x","y"];break;case "polygon":case "polyline":z={};z.points=e.getAttribute("points");A=e.points;var F=A.numberOfItems;D.points=Array(F);for(var k=0;k<F;++k){var n=A.getItem(k);D.points[k]={x:n.x,y:n.y}}break;case "path":z={};z.d=e.getAttribute("d");D.d=e.getAttribute("d")}if(B.length){D=$(e).attr(B);$.each(D,function(Ba,Pa){D[Ba]=Aa(Ba,Pa)})}else if(G)D=
{x:$(G).attr("x")||0,y:$(G).attr("y")||0};if(z==null){z=$.extend(true,{},D);$.each(z,function(Ba,Pa){z[Ba]=Aa(Ba,Pa)})}z.transform=Sa?Sa:"";if(e.tagName=="g"&&!G||e.tagName=="a"){A=svgedit.utilities.getBBox(e);var o={x:A.x+A.width/2,y:A.y+A.height/2},w=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);B=c.createSVGMatrix();if(A=oa(e)){k=A*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k<h.numberOfItems;++k){B=h.getItem(k);if(B.type==4){B=B.matrix;o.y=(F*B.e+B.f)/2;o.x=(B.e-F* {x:$(G).attr("x")||0,y:$(G).attr("y")||0};if(z==null){z=$.extend(true,{},D);$.each(z,function(Ba,Pa){z[Ba]=Aa(Ba,Pa)})}z.transform=Sa?Sa:"";if(e.tagName=="g"&&!G||e.tagName=="a"){A=svgedit.utilities.getBBox(e);var o={x:A.x+A.width/2,y:A.y+A.height/2},w=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);B=c.createSVGMatrix();if(A=na(e)){k=A*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k<h.numberOfItems;++k){B=h.getItem(k);if(B.type==4){B=B.matrix;o.y=(F*B.e+B.f)/2;o.x=(B.e-F*
B.f)/2;h.removeItem(k);break}}}k=B=G=0;var E=h.numberOfItems;if(E)var H=h.getItem(0).matrix;if(E>=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;var J=h.getItem(E-3).matrix,O=h.getItem(E-2).matrix,Y=h.getItem(E-1).matrix;F=e.childNodes;for(n=F.length;n--;){var da=F.item(n);B=G=0;if(da.nodeType==1){var V=S(da);if(V){B=X(V).matrix;G=oa(da);var fa=Sa,ha=[];Sa=da.getAttribute("transform");if(G||na(V)){var W=c.createSVGTransform();W.setMatrix(ga(J,O,Y,B));V.clear();V.appendItem(W); B.f)/2;h.removeItem(k);break}}}k=B=G=0;var E=h.numberOfItems;if(E)var I=h.getItem(0).matrix;if(E>=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;var J=h.getItem(E-3).matrix,O=h.getItem(E-2).matrix,Y=h.getItem(E-1).matrix;F=e.childNodes;for(n=F.length;n--;){var da=F.item(n);B=G=0;if(da.nodeType==1){var V=R(da);if(V){B=X(V).matrix;G=na(da);var fa=Sa,ha=[];Sa=da.getAttribute("transform");if(G||oa(V)){var W=c.createSVGTransform();W.setMatrix(ga(J,O,Y,B));V.clear();V.appendItem(W);
ha.push(W)}else{G=ga(B.inverse(),Y,B);W=c.createSVGMatrix();W.e=-G.e;W.f=-G.f;B=ga(W.inverse(),B.inverse(),J,O,Y,B,G.inverse());var qa=c.createSVGTransform(),ua=c.createSVGTransform(),za=c.createSVGTransform();qa.setTranslate(G.e,G.f);ua.setScale(B.a,B.d);za.setTranslate(W.e,W.f);V.appendItem(za);V.appendItem(ua);V.appendItem(qa);ha.push(za);ha.push(ua);ha.push(qa)}l.addSubCommand(Ra(da));Sa=fa}}}h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E>=3&&h.getItem(E-1).type==1){k=3;B=X(h).matrix; ha.push(W)}else{G=ga(B.inverse(),Y,B);W=c.createSVGMatrix();W.e=-G.e;W.f=-G.f;B=ga(W.inverse(),B.inverse(),J,O,Y,B,G.inverse());var qa=c.createSVGTransform(),ua=c.createSVGTransform(),za=c.createSVGTransform();qa.setTranslate(G.e,G.f);ua.setScale(B.a,B.d);za.setTranslate(W.e,W.f);V.appendItem(za);V.appendItem(ua);V.appendItem(qa);ha.push(za);ha.push(ua);ha.push(qa)}l.addSubCommand(Ra(da));Sa=fa}}}h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E>=3&&h.getItem(E-1).type==1){k=3;B=X(h).matrix;
W=c.createSVGTransform();W.setMatrix(B);h.clear();h.appendItem(W)}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;G=X(h).matrix;h.removeItem(0);B=X(h).matrix.inverse();B=ga(B,G);G=B.e;B=B.f;if(G!=0||B!=0){F=e.childNodes;n=F.length;for(E=[];n--;){da=F.item(n);if(da.nodeType==1){if(da.getAttribute("clip-path")){fa=da.getAttribute("clip-path");if(E.indexOf(fa)===-1){nb(fa,G,B);E.push(fa)}}fa=Sa;Sa=da.getAttribute("transform");if(V=S(da)){J=c.createSVGTransform();J.setTranslate(G, W=c.createSVGTransform();W.setMatrix(B);h.clear();h.appendItem(W)}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;G=X(h).matrix;h.removeItem(0);B=X(h).matrix.inverse();B=ga(B,G);G=B.e;B=B.f;if(G!=0||B!=0){F=e.childNodes;n=F.length;for(E=[];n--;){da=F.item(n);if(da.nodeType==1){if(da.getAttribute("clip-path")){fa=da.getAttribute("clip-path");if(E.indexOf(fa)===-1){nb(fa,G,B);E.push(fa)}}fa=Sa;Sa=da.getAttribute("transform");if(V=R(da)){J=c.createSVGTransform();J.setTranslate(G,
B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J);l.addSubCommand(Ra(da));V=e.getElementsByTagNameNS(b,"use");da="#"+da.id;for(J=V.length;J--;){O=V.item(J);if(da==ba(O)){Y=c.createSVGTransform();Y.setTranslate(-G,-B);S(O).insertItemBefore(Y,0);l.addSubCommand(Ra(O))}}Sa=fa}}}E=[];Sa=fa}}else if(E==1&&h.getItem(0).type==1&&!A){k=1;B=h.getItem(0).matrix;F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");if(V=S(da)){G=ga(B,X(V).matrix); B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J);l.addSubCommand(Ra(da));V=e.getElementsByTagNameNS(b,"use");da="#"+da.id;for(J=V.length;J--;){O=V.item(J);if(da==ba(O)){Y=c.createSVGTransform();Y.setTranslate(-G,-B);R(O).insertItemBefore(Y,0);l.addSubCommand(Ra(O))}}Sa=fa}}}E=[];Sa=fa}}else if(E==1&&h.getItem(0).type==1&&!A){k=1;B=h.getItem(0).matrix;F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");if(V=R(da)){G=ga(B,X(V).matrix);
E=c.createSVGTransform();E.setMatrix(G);V.clear();V.appendItem(E,0);l.addSubCommand(Ra(da));Sa=fa;fa=da.getAttribute("stroke-width");da.getAttribute("stroke")!=="none"&&!isNaN(fa)&&da.setAttribute("stroke-width",fa*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(A){o=c.createSVGTransform();o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(k==2){if(A){w={x:o.x+H.e,y:o.y+H.f};o=c.createSVGTransform(); E=c.createSVGTransform();E.setMatrix(G);V.clear();V.appendItem(E,0);l.addSubCommand(Ra(da));Sa=fa;fa=da.getAttribute("stroke-width");da.getAttribute("stroke")!=="none"&&!isNaN(fa)&&da.setAttribute("stroke-width",fa*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(A){o=c.createSVGTransform();o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(k==2){if(A){w={x:o.x+I.e,y:o.y+I.f};o=c.createSVGTransform();
o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else if(k==3){B=X(h).matrix;H=c.createSVGTransform();H.setRotate(A,o.x,o.y);H=H.matrix;o=c.createSVGTransform();o.setRotate(A,w.x,w.y);w=o.matrix.inverse();fa=B.inverse();w=ga(fa,w,H,B);G=w.e;B=w.f;if(G!=0||B!=0){F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");V=S(da);J=c.createSVGTransform();J.setTranslate(G,B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J); o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else if(k==3){B=X(h).matrix;I=c.createSVGTransform();I.setRotate(A,o.x,o.y);I=I.matrix;o=c.createSVGTransform();o.setRotate(A,w.x,w.y);w=o.matrix.inverse();fa=B.inverse();w=ga(fa,w,I,B);G=w.e;B=w.f;if(G!=0||B!=0){F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");V=R(da);J=c.createSVGTransform();J.setTranslate(G,B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J);
l.addSubCommand(Ra(da));Sa=fa}}}if(A)h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else{A=svgedit.utilities.getBBox(e);if(!A&&e.tagName!="path")return null;B=c.createSVGMatrix();if(G=oa(e)){o={x:A.x+A.width/2,y:A.y+A.height/2};w=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);k=G*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k<h.numberOfItems;++k){B=h.getItem(k);if(B.type==4){B=B.matrix;o.y=(F*B.e+B.f)/2;o.x=(B.e-F*B.f)/2;h.removeItem(k);break}}}k=0;E=h.numberOfItems; l.addSubCommand(Ra(da));Sa=fa}}}if(A)h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else{A=svgedit.utilities.getBBox(e);if(!A&&e.tagName!="path")return null;B=c.createSVGMatrix();if(G=na(e)){o={x:A.x+A.width/2,y:A.y+A.height/2};w=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);k=G*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k<h.numberOfItems;++k){B=h.getItem(k);if(B.type==4){B=B.matrix;o.y=(F*B.e+B.f)/2;o.x=(B.e-F*B.f)/2;h.removeItem(k);break}}}k=0;E=h.numberOfItems;
if(!svgedit.browser.isWebkit())if((H=e.getAttribute("fill"))&&H.indexOf("url(")===0){H=P(H);fa="pattern";if(H.tagName!==fa)fa="gradient";if(H.getAttribute(fa+"Units")==="userSpaceOnUse"){B=X(h).matrix;A=S(H);A=X(A).matrix;B=ga(B,A);A="matrix("+[B.a,B.b,B.c,B.d,B.e,B.f].join(",")+")";H.setAttribute(fa+"Transform",A)}}if(E>=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;B=X(h,E-3,E-1).matrix;h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E==4&&h.getItem(E- if(!svgedit.browser.isWebkit())if((I=e.getAttribute("fill"))&&I.indexOf("url(")===0){I=P(I);fa="pattern";if(I.tagName!==fa)fa="gradient";if(I.getAttribute(fa+"Units")==="userSpaceOnUse"){B=X(h).matrix;A=R(I);A=X(A).matrix;B=ga(B,A);A="matrix("+[B.a,B.b,B.c,B.d,B.e,B.f].join(",")+")";I.setAttribute(fa+"Transform",A)}}if(E>=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;B=X(h,E-3,E-1).matrix;h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E==4&&h.getItem(E-
1).type==1){k=3;B=X(h).matrix;W=c.createSVGTransform();W.setMatrix(B);h.clear();h.appendItem(W);B=c.createSVGMatrix()}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;H=h.getItem(0).matrix;fa=X(h,1).matrix;A=fa.inverse();B=ga(A,H,fa);h.removeItem(0)}else if(E==1&&h.getItem(0).type==1&&!G){B=X(h).matrix;switch(e.tagName){case "line":D=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":D.points=e.getAttribute("points");if(D.points){A=e.points;F=A.numberOfItems;D.points= 1).type==1){k=3;B=X(h).matrix;W=c.createSVGTransform();W.setMatrix(B);h.clear();h.appendItem(W);B=c.createSVGMatrix()}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;I=h.getItem(0).matrix;fa=X(h,1).matrix;A=fa.inverse();B=ga(A,I,fa);h.removeItem(0)}else if(E==1&&h.getItem(0).type==1&&!G){B=X(h).matrix;switch(e.tagName){case "line":D=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":D.points=e.getAttribute("points");if(D.points){A=e.points;F=A.numberOfItems;D.points=
Array(F);for(k=0;k<F;++k){n=A.getItem(k);D.points[k]={x:n.x,y:n.y}}}case "path":D.d=e.getAttribute("d");k=1;h.clear()}}else{k=4;if(G){o=c.createSVGTransform();o.setRotate(G,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(k==1||k==2||k==3)Za(e,D,B);if(k==2){if(G){na(h)||(w={x:o.x+B.e,y:o.y+B.f});o=c.createSVGTransform();o.setRotate(G,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else if(k==3&&G){B= Array(F);for(k=0;k<F;++k){n=A.getItem(k);D.points[k]={x:n.x,y:n.y}}}case "path":D.d=e.getAttribute("d");k=1;h.clear()}}else{k=4;if(G){o=c.createSVGTransform();o.setRotate(G,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(k==1||k==2||k==3)Za(e,D,B);if(k==2){if(G){oa(h)||(w={x:o.x+B.e,y:o.y+B.f});o=c.createSVGTransform();o.setRotate(G,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else if(k==3&&G){B=
X(h).matrix;H=c.createSVGTransform();H.setRotate(G,o.x,o.y);H=H.matrix;o=c.createSVGTransform();o.setRotate(G,w.x,w.y);w=o.matrix.inverse();fa=B.inverse();w=ga(fa,w,H,B);Za(e,D,w);if(G)h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}h.numberOfItems==0&&e.removeAttribute("transform");l.addSubCommand(new Ma(e,z));return l},mb=null,Ia=this.clearSelection=function(e){if(I[0]!=null)for(var h=I.length,l=0;l<h;++l){var B=I[l];if(B==null)break;ra.releaseSelector(B);I[l]=null}e||M("selected",I)}, X(h).matrix;I=c.createSVGTransform();I.setRotate(G,o.x,o.y);I=I.matrix;o=c.createSVGTransform();o.setRotate(G,w.x,w.y);w=o.matrix.inverse();fa=B.inverse();w=ga(fa,w,I,B);Za(e,D,w);if(G)h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}h.numberOfItems==0&&e.removeAttribute("transform");l.addSubCommand(new Ma(e,z));return l},mb=null,Ia=this.clearSelection=function(e){if(H[0]!=null)for(var h=H.length,l=0;l<h;++l){var B=H[l];if(B==null)break;ra.releaseSelector(B);H[l]=null}e||M("selected",H)},
qb=this.addToSelection=function(e,h){if(e.length!=0){for(var l=0;l<I.length;){if(I[l]==null)break;++l}for(var B=e.length;B--;){var A=e[B];if(A&&svgedit.utilities.getBBox(A)){if(A.tagName==="a"&&A.childNodes.length===1)A=A.firstChild;if(I.indexOf(A)==-1){I[l]=A;l++;A=ra.requestSelector(A);I.length>1&&A.showGrips(false)}}}M("selected",I);h||I.length==1?ra.requestSelector(I[0]).showGrips(true):ra.requestSelector(I[0]).showGrips(false);for(I.sort(function(G,D){if(G&&D&&G.compareDocumentPosition)return 3- qb=this.addToSelection=function(e,h){if(e.length!=0){for(var l=0;l<H.length;){if(H[l]==null)break;++l}for(var B=e.length;B--;){var A=e[B];if(A&&svgedit.utilities.getBBox(A)){if(A.tagName==="a"&&A.childNodes.length===1)A=A.firstChild;if(H.indexOf(A)==-1){H[l]=A;l++;A=ra.requestSelector(A);H.length>1&&A.showGrips(false)}}}M("selected",H);h||H.length==1?ra.requestSelector(H[0]).showGrips(true):ra.requestSelector(H[0]).showGrips(false);for(H.sort(function(G,D){if(G&&D&&G.compareDocumentPosition)return 3-
(D.compareDocumentPosition(G)&6);else if(G==null)return 1});I[0]==null;)I.shift(0)}},rb=this.selectOnly=function(e,h){Ia(true);qb(e,h)};this.removeFromSelection=function(e){if(I[0]!=null)if(e.length!=0){var h=Array(I.length);j=0;len=I.length;for(var l=0;l<len;++l){var B=I[l];if(B)if(e.indexOf(B)==-1){h[j]=B;j++}else ra.releaseSelector(B)}I=h}};this.selectAllInCurrentLayer=function(){var e=C().getCurrentLayer();if(e){Fa="select";rb($(L||e).children())}};var Bb=this.getMouseTarget=function(e){if(e== (D.compareDocumentPosition(G)&6);else if(G==null)return 1});H[0]==null;)H.shift(0)}},rb=this.selectOnly=function(e,h){Ia(true);qb(e,h)};this.removeFromSelection=function(e){if(H[0]!=null)if(e.length!=0){var h=Array(H.length);j=0;len=H.length;for(var l=0;l<len;++l){var B=H[l];if(B)if(e.indexOf(B)==-1){h[j]=B;j++}else ra.releaseSelector(B)}H=h}};this.selectAllInCurrentLayer=function(){var e=C().getCurrentLayer();if(e){Fa="select";rb($(L||e).children())}};var Bb=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 c}var h=C().getCurrentLayer();if([c,a,m,h].indexOf(e)>=0)return c;if($(e).closest("#selectorParentGroup").length)return ra.selectorParentGroup;for(;e.parentNode!==(L||h);)e=e.parentNode;return e};(function(){var e=null,h=null,l=null,B= 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 c}var h=C().getCurrentLayer();if([c,a,m,h].indexOf(e)>=0)return c;if($(e).closest("#selectorParentGroup").length)return ra.selectorParentGroup;for(;e.parentNode!==(L||h);)e=e.parentNode;return e};(function(){var e=null,h=null,l=null,B=
null,A=null,G={},D={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(z){if(!d.spaceKey){var F=z.button===2;mb=m.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);z.preventDefault();if(F)Fa="select";n=n/s;k=k/s;var o=Bb(z);if(o.tagName==="a"&&o.childNodes.length===1)o=o.firstChild;var w=B=h=n,E=A=l=k;if(p.gridSnapping){n=va(n);k=va(k);h=va(h);l=va(l)}if(o==ra.selectorParentGroup&&I[0]!=null){o= null,A=null,G={},D={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(z){if(!d.spaceKey){var F=z.button===2;mb=m.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);z.preventDefault();if(F)Fa="select";n=n/s;k=k/s;var o=Bb(z);if(o.tagName==="a"&&o.childNodes.length===1)o=o.firstChild;var w=B=h=n,E=A=l=k;if(p.gridSnapping){n=va(n);k=va(k);h=va(h);l=va(l)}if(o==ra.selectorParentGroup&&H[0]!=null){o=
z.target;var H=cb(o,"type");if(H=="rotate"){Fa="rotate";current_rotate_mode=cb(o,"dir")}else if(H=="resize"){Fa="resize";db=cb(o,"dir")}o=I[0]}Sa=o.getAttribute("transform");H=S(o);switch(Fa){case "select":Ka=true;db="none";if(F)Ka=false;if(o!=c){if(I.indexOf(o)==-1){z.shiftKey||Ia(true);qb([o]);wb=o;La.clear()}if(!F)for(F=0;F<I.length;++F)if(I[F]!=null){var J=S(I[F]);J.numberOfItems?J.insertItemBefore(c.createSVGTransform(),0):J.appendItem(c.createSVGTransform())}}else if(!F){Ia();Fa="multiselect"; z.target;var I=cb(o,"type");if(I=="rotate"){Fa="rotate";current_rotate_mode=cb(o,"dir")}else if(I=="resize"){Fa="resize";db=cb(o,"dir")}o=H[0]}Sa=o.getAttribute("transform");I=R(o);switch(Fa){case "select":Ka=true;db="none";if(F)Ka=false;if(o!=c){if(H.indexOf(o)==-1){z.shiftKey||Ia(true);qb([o]);wb=o;La.clear()}if(!F)for(F=0;F<H.length;++F)if(H[F]!=null){var J=R(H[F]);J.numberOfItems?J.insertItemBefore(c.createSVGTransform(),0):J.appendItem(c.createSVGTransform())}}else if(!F){Ia();Fa="multiselect";
if(sa==null)sa=ra.getRubberBandBox();B*=s;A*=s;ma(sa,{x:B,y:A,width:0,height:0,display:"inline"},100)}break;case "zoom":Ka=true;if(sa==null)sa=ra.getRubberBandBox();ma(sa,{x:w*s,y:w*s,width:0,height:0,display:"inline"},100);break;case "resize":Ka=true;h=n;l=k;G=svgedit.utilities.getBBox($("#selectedBox0")[0]);var O={};$.each(G,function(Y,da){O[Y]=da/s});G=O;F=oa(o)?1:0;if(na(H)){H.insertItemBefore(c.createSVGTransform(),F);H.insertItemBefore(c.createSVGTransform(),F);H.insertItemBefore(c.createSVGTransform(), if(sa==null)sa=ra.getRubberBandBox();B*=s;A*=s;ma(sa,{x:B,y:A,width:0,height:0,display:"inline"},100)}break;case "zoom":Ka=true;if(sa==null)sa=ra.getRubberBandBox();ma(sa,{x:w*s,y:w*s,width:0,height:0,display:"inline"},100);break;case "resize":Ka=true;h=n;l=k;G=svgedit.utilities.getBBox($("#selectedBox0")[0]);var O={};$.each(G,function(Y,da){O[Y]=da/s});G=O;F=na(o)?1:0;if(oa(I)){I.insertItemBefore(c.createSVGTransform(),F);I.insertItemBefore(c.createSVGTransform(),F);I.insertItemBefore(c.createSVGTransform(),
F)}else{H.appendItem(c.createSVGTransform());H.appendItem(c.createSVGTransform());H.appendItem(c.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(n=svgedit.browser.isChrome())J=function(Y){var da=Y.getAttributeNS(null,"stroke");Y.removeAttributeNS(null,"stroke");setTimeout(function(){Y.setAttributeNS(null,"stroke",da)},1)};o.style.vectorEffect="non-scaling-stroke";n&&J(o);k=o.getElementsByTagName("*");w=k.length;for(F=0;F<w;F++){k[F].style.vectorEffect="non-scaling-stroke"; F)}else{I.appendItem(c.createSVGTransform());I.appendItem(c.createSVGTransform());I.appendItem(c.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(n=svgedit.browser.isChrome())J=function(Y){var da=Y.getAttributeNS(null,"stroke");Y.removeAttributeNS(null,"stroke");setTimeout(function(){Y.setAttributeNS(null,"stroke",da)},1)};o.style.vectorEffect="non-scaling-stroke";n&&J(o);k=o.getElementsByTagName("*");w=k.length;for(F=0;F<w;F++){k[F].style.vectorEffect="non-scaling-stroke";
n&&J(k[F])}}}break;case "fhellipse":case "fhrect":case "fhpath":Ka=true;e=w+","+E+" ";J=K.stroke_width==0?1:K.stroke_width;Q({element:"polyline",curStyles:true,attr:{points:e,id:ka(),fill:"none",opacity:K.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});D.minx=w;D.maxx=w;D.miny=E;D.maxy=E;break;case "image":Ka=true;J=Q({element:"image",attr:{x:n,y:k,width:0,height:0,id:ka(),opacity:K.opacity/2,style:"pointer-events:inherit"}});T(J,Ea);Fb(J);break;case "square":case "rect":Ka=true; n&&J(k[F])}}}break;case "fhellipse":case "fhrect":case "fhpath":Ka=true;e=w+","+E+" ";J=K.stroke_width==0?1:K.stroke_width;S({element:"polyline",curStyles:true,attr:{points:e,id:ka(),fill:"none",opacity:K.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});D.minx=w;D.maxx=w;D.miny=E;D.maxy=E;break;case "image":Ka=true;J=S({element:"image",attr:{x:n,y:k,width:0,height:0,id:ka(),opacity:K.opacity/2,style:"pointer-events:inherit"}});T(J,Ea);Fb(J);break;case "square":case "rect":Ka=true;
h=n;l=k;Q({element:"rect",curStyles:true,attr:{x:n,y:k,width:0,height:0,id:ka(),opacity:K.opacity/2}});break;case "line":Ka=true;J=K.stroke_width==0?1:K.stroke_width;Q({element:"line",curStyles:true,attr:{x1:n,y1:k,x2:n,y2:k,id:ka(),stroke:K.stroke,"stroke-width":J,"stroke-dasharray":K.stroke_dasharray,"stroke-linejoin":K.stroke_linejoin,"stroke-linecap":K.stroke_linecap,"stroke-opacity":K.stroke_opacity,fill:"none",opacity:K.opacity/2,style:"pointer-events:none"}});break;case "circle":Ka=true;Q({element:"circle", h=n;l=k;S({element:"rect",curStyles:true,attr:{x:n,y:k,width:0,height:0,id:ka(),opacity:K.opacity/2}});break;case "line":Ka=true;J=K.stroke_width==0?1:K.stroke_width;S({element:"line",curStyles:true,attr:{x1:n,y1:k,x2:n,y2:k,id:ka(),stroke:K.stroke,"stroke-width":J,"stroke-dasharray":K.stroke_dasharray,"stroke-linejoin":K.stroke_linejoin,"stroke-linecap":K.stroke_linecap,"stroke-opacity":K.stroke_opacity,fill:"none",opacity:K.opacity/2,style:"pointer-events:none"}});break;case "circle":Ka=true;S({element:"circle",
curStyles:true,attr:{cx:n,cy:k,r:0,id:ka(),opacity:K.opacity/2}});break;case "ellipse":Ka=true;Q({element:"ellipse",curStyles:true,attr:{cx:n,cy:k,rx:0,ry:0,id:ka(),opacity:K.opacity/2}});break;case "text":Ka=true;Q({element:"text",curStyles:true,attr:{x:n,y:k,id:ka(),fill:Ua.fill,"stroke-width":Ua.stroke_width,"font-size":Ua.font_size,"font-family":Ua.font_family,"text-anchor":"left","xml:space":"preserve",opacity:K.opacity}});break;case "path":case "pathedit":h*=s;l*=s;La.mouseDown(z,o,h,l);Ka= curStyles:true,attr:{cx:n,cy:k,r:0,id:ka(),opacity:K.opacity/2}});break;case "ellipse":Ka=true;S({element:"ellipse",curStyles:true,attr:{cx:n,cy:k,rx:0,ry:0,id:ka(),opacity:K.opacity/2}});break;case "text":Ka=true;S({element:"text",curStyles:true,attr:{x:n,y:k,id:ka(),fill:Ua.fill,"stroke-width":Ua.stroke_width,"font-size":Ua.font_size,"font-family":Ua.font_family,"text-anchor":"left","xml:space":"preserve",opacity:K.opacity}});break;case "path":case "pathedit":h*=s;l*=s;La.mouseDown(z,o,h,l);Ka=
true;break;case "textedit":h*=s;l*=s;bb.mouseDown(z,o,h,l);Ka=true;break;case "rotate":Ka=true;d.undoMgr.beginUndoableChange("transform",I);document.getElementById("workarea").className="rotate"}J=ib("mouseDown",{event:z,start_x:h,start_y:l,selectedElements:I},true);$.each(J,function(Y,da){if(da&&da.started)Ka=true});if(Fa)document.getElementById("workarea").className=Fa=="resize"?z.target.style.cursor:Fa}}).mousemove(function(z){if(!(z.originalEvent.touches&&z.originalEvent.touches.length>1))if(Ka)if(!(z.button=== true;break;case "textedit":h*=s;l*=s;bb.mouseDown(z,o,h,l);Ka=true;break;case "rotate":Ka=true;d.undoMgr.beginUndoableChange("transform",H);document.getElementById("workarea").className="rotate"}J=ib("mouseDown",{event:z,start_x:h,start_y:l,selectedElements:H},true);$.each(J,function(Y,da){if(da&&da.started)Ka=true});if(Fa)document.getElementById("workarea").className=Fa=="resize"?z.target.style.cursor:Fa}}).mousemove(function(z){if(!(z.originalEvent.touches&&z.originalEvent.touches.length>1))if(Ka)if(!(z.button===
1||d.spaceKey)){var F=I[0],k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);var o=pa(aa()),w=x=n/s,E=y=k/s;if(p.gridSnapping){x=va(x);y=va(y)}z.preventDefault();switch(Fa){case "select":if(I[0]!==null){w=x-h;var H=y-l;if(p.gridSnapping){w=va(w);H=va(H)}if(z.shiftKey){var J=U(h,l,x,y);x=J.x;y=J.y}if(w!=0||H!=0){E=I.length;for(var O=0;O<E;++O){F=I[O];if(F==null)break;var Y=c.createSVGTransform();o=S(F);if(J){w=J.x-h;H=J.y-l}Y.setTranslate(w,H);o.numberOfItems?o.replaceItem(Y, 1||d.spaceKey)){var F=H[0],k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);var o=pa(aa()),w=x=n/s,E=y=k/s;if(p.gridSnapping){x=va(x);y=va(y)}z.preventDefault();switch(Fa){case "select":if(H[0]!==null){w=x-h;var I=y-l;if(p.gridSnapping){w=va(w);I=va(I)}if(z.shiftKey){var J=U(h,l,x,y);x=J.x;y=J.y}if(w!=0||I!=0){E=H.length;for(var O=0;O<E;++O){F=H[O];if(F==null)break;var Y=c.createSVGTransform();o=R(F);if(J){w=J.x-h;I=J.y-l}Y.setTranslate(w,I);o.numberOfItems?o.replaceItem(Y,
0):o.appendItem(Y);ra.requestSelector(F).resize()}if(z.altKey)if(!d.addClones){d.addClones=d.cloneSelectedElements(0,0,Y);d.removeClones=function(){d.addClones&&d.addClones.forEach(function(ua){ua.parentNode&&ua.parentNode.removeChild(ua);d.addClones=false})};window.addEventListener("keyup",d.removeClones)}M("transition",I)}}break;case "multiselect":w*=s;E*=s;ma(sa,{x:Math.min(B,w),y:Math.min(A,E),width:Math.abs(w-B),height:Math.abs(E-A)},100);o=[];w=[];J=ob();E=I.length;for(O=0;O<E;++O){H=J.indexOf(I[O]); 0):o.appendItem(Y);ra.requestSelector(F).resize()}if(z.altKey)if(!d.addClones){d.addClones=d.cloneSelectedElements(0,0,Y);d.removeClones=function(){d.addClones&&d.addClones.forEach(function(ua){ua.parentNode&&ua.parentNode.removeChild(ua);d.addClones=false})};window.addEventListener("keyup",d.removeClones)}M("transition",H)}}break;case "multiselect":w*=s;E*=s;ma(sa,{x:Math.min(B,w),y:Math.min(A,E),width:Math.abs(w-B),height:Math.abs(E-A)},100);o=[];w=[];J=ob();E=H.length;for(O=0;O<E;++O){I=J.indexOf(H[O]);
if(H==-1)o.push(I[O]);else J[H]=null}E=J.length;for(O=0;O<E;++O)J[O]&&w.push(J[O]);o.length>0&&d.removeFromSelection(o);w.length>0&&qb(w);break;case "resize":o=S(F);w=(J=na(o))?G:svgedit.utilities.getBBox(F);E=w.x;O=w.y;var da=w.width,V=w.height;w=x-h;H=y-l;if(p.gridSnapping){w=va(w);H=va(H);V=va(V);da=va(da)}if(Y=oa(F)){var fa=Math.sqrt(w*w+H*H);H=Math.atan2(H,w)-Y*Math.PI/180;w=fa*Math.cos(H);H=fa*Math.sin(H)}if(db.indexOf("n")==-1&&db.indexOf("s")==-1)H=0;if(db.indexOf("e")==-1&&db.indexOf("w")== if(I==-1)o.push(H[O]);else J[I]=null}E=J.length;for(O=0;O<E;++O)J[O]&&w.push(J[O]);o.length>0&&d.removeFromSelection(o);w.length>0&&qb(w);break;case "resize":o=R(F);w=(J=oa(o))?G:svgedit.utilities.getBBox(F);E=w.x;O=w.y;var da=w.width,V=w.height;w=x-h;I=y-l;if(p.gridSnapping){w=va(w);I=va(I);V=va(V);da=va(da)}if(Y=na(F)){var fa=Math.sqrt(w*w+I*I);I=Math.atan2(I,w)-Y*Math.PI/180;w=fa*Math.cos(I);I=fa*Math.sin(I)}if(db.indexOf("n")==-1&&db.indexOf("s")==-1)I=0;if(db.indexOf("e")==-1&&db.indexOf("w")==
-1)w=0;var ha=fa=0,W=V?(V+H)/V:1,qa=da?(da+w)/da:1;if(db.indexOf("n")>=0){W=V?(V-H)/V:1;ha=V}if(db.indexOf("w")>=0){qa=da?(da-w)/da:1;fa=da}w=c.createSVGTransform();H=c.createSVGTransform();da=c.createSVGTransform();if(p.gridSnapping){E=va(E);fa=va(fa);O=va(O);ha=va(ha)}w.setTranslate(-(E+fa),-(O+ha));if(z.shiftKey)if(qa==1)qa=W;else W=qa;H.setScale(qa,W);da.setTranslate(E+fa,O+ha);if(J){J=Y?1:0;o.replaceItem(w,2+J);o.replaceItem(H,1+J);o.replaceItem(da,0+J)}else{J=o.numberOfItems;o.replaceItem(da, -1)w=0;var ha=fa=0,W=V?(V+I)/V:1,qa=da?(da+w)/da:1;if(db.indexOf("n")>=0){W=V?(V-I)/V:1;ha=V}if(db.indexOf("w")>=0){qa=da?(da-w)/da:1;fa=da}w=c.createSVGTransform();I=c.createSVGTransform();da=c.createSVGTransform();if(p.gridSnapping){E=va(E);fa=va(fa);O=va(O);ha=va(ha)}w.setTranslate(-(E+fa),-(O+ha));if(z.shiftKey)if(qa==1)qa=W;else W=qa;I.setScale(qa,W);da.setTranslate(E+fa,O+ha);if(J){J=Y?1:0;o.replaceItem(w,2+J);o.replaceItem(I,1+J);o.replaceItem(da,0+J)}else{J=o.numberOfItems;o.replaceItem(da,
J-3);o.replaceItem(H,J-2);o.replaceItem(w,J-1)}ra.requestSelector(F).resize();M("transition",I);break;case "zoom":w*=s;E*=s;ma(sa,{x:Math.min(B*s,w),y:Math.min(A*s,E),width:Math.abs(w-B*s),height:Math.abs(E-A*s)},100);break;case "text":ma(o,{x:x,y:y},1E3);break;case "line":w=null;window.opera||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);y=va(y)}E=x;J=y;if(z.shiftKey){J=U(h,l,E,J);E=J.x;J=J.y}o.setAttributeNS(null,"x2",E);o.setAttributeNS(null,"y2",J);window.opera||c.unsuspendRedraw(w);break;case "foreignObject":case "square":case "rect":case "image":w= J-3);o.replaceItem(I,J-2);o.replaceItem(w,J-1)}ra.requestSelector(F).resize();M("transition",H);break;case "zoom":w*=s;E*=s;ma(sa,{x:Math.min(B*s,w),y:Math.min(A*s,E),width:Math.abs(w-B*s),height:Math.abs(E-A*s)},100);break;case "text":ma(o,{x:x,y:y},1E3);break;case "line":w=null;window.opera||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);y=va(y)}E=x;J=y;if(z.shiftKey){J=U(h,l,E,J);E=J.x;J=J.y}o.setAttributeNS(null,"x2",E);o.setAttributeNS(null,"y2",J);window.opera||c.unsuspendRedraw(w);break;case "foreignObject":case "square":case "rect":case "image":w=
Math.abs(x-h);J=Math.abs(y-l);if(Fa=="square"||z.shiftKey){w=J=Math.max(w,J);E=h<x?h:h-w;O=l<y?l:l-J}else{E=Math.min(h,x);O=Math.min(l,y)}if(z.altKey){w*=2;J*=2;E=h-w/2;O=l-J/2}if(p.gridSnapping){w=va(w);J=va(J);E=va(E);O=va(O)}ma(o,{width:w,height:J,x:E,y:O},1E3);break;case "circle":w=$(o).attr(["cx","cy"]);J=w.cx;E=w.cy;w=Math.sqrt((x-J)*(x-J)+(y-E)*(y-E));if(p.gridSnapping)w=va(w);o.setAttributeNS(null,"r",w);break;case "ellipse":w=$(o).attr(["cx","cy"]);J=Math.abs(h+(x-h)/2);E=Math.abs(l+(y-l)/ Math.abs(x-h);J=Math.abs(y-l);if(Fa=="square"||z.shiftKey){w=J=Math.max(w,J);E=h<x?h:h-w;O=l<y?l:l-J}else{E=Math.min(h,x);O=Math.min(l,y)}if(z.altKey){w*=2;J*=2;E=h-w/2;O=l-J/2}if(p.gridSnapping){w=va(w);J=va(J);E=va(E);O=va(O)}ma(o,{width:w,height:J,x:E,y:O},1E3);break;case "circle":w=$(o).attr(["cx","cy"]);J=w.cx;E=w.cy;w=Math.sqrt((x-J)*(x-J)+(y-E)*(y-E));if(p.gridSnapping)w=va(w);o.setAttributeNS(null,"r",w);break;case "ellipse":w=$(o).attr(["cx","cy"]);J=Math.abs(h+(x-h)/2);E=Math.abs(l+(y-l)/
2);w=null;window.opera||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);J=va(J);y=va(y);E=va(E)}O=Math.abs(h-J);H=Math.abs(l-E);if(z.shiftKey){H=O;E=y>l?l+O:l-O}if(z.altKey){J=h;E=l;O=Math.abs(x-J);H=z.shiftKey?O:Math.abs(y-E)}o.setAttributeNS(null,"rx",O);o.setAttributeNS(null,"ry",H);o.setAttributeNS(null,"cx",J);o.setAttributeNS(null,"cy",E);window.opera||c.unsuspendRedraw(w);break;case "fhellipse":case "fhrect":D.minx=Math.min(w,D.minx);D.maxx=Math.max(w,D.maxx);D.miny=Math.min(E,D.miny);D.maxy= 2);w=null;window.opera||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);J=va(J);y=va(y);E=va(E)}O=Math.abs(h-J);I=Math.abs(l-E);if(z.shiftKey){I=O;E=y>l?l+O:l-O}if(z.altKey){J=h;E=l;O=Math.abs(x-J);I=z.shiftKey?O:Math.abs(y-E)}o.setAttributeNS(null,"rx",O);o.setAttributeNS(null,"ry",I);o.setAttributeNS(null,"cx",J);o.setAttributeNS(null,"cy",E);window.opera||c.unsuspendRedraw(w);break;case "fhellipse":case "fhrect":D.minx=Math.min(w,D.minx);D.maxx=Math.max(w,D.maxx);D.miny=Math.min(E,D.miny);D.maxy=
Math.max(E,D.maxy);case "fhpath":e+=+w+","+E+" ";o.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=s;y*=s;if(p.gridSnapping){x=va(x);y=va(y);h=va(h);l=va(l)}if(z.shiftKey){if(J=svgedit.path.path){o=J.dragging?J.dragging[0]:h;J=J.dragging?J.dragging[1]:l}else{o=h;J=l}J=U(o,J,x,y);x=J.x;y=J.y}if(sa&&sa.getAttribute("display")!=="none"){w*=s;E*=s;ma(sa,{x:Math.min(B*s,w),y:Math.min(A*s,E),width:Math.abs(w-B*s),height:Math.abs(E-A*s)},100)}La.mouseMove(z,x,y);break;case "textedit":x*= Math.max(E,D.maxy);case "fhpath":e+=+w+","+E+" ";o.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=s;y*=s;if(p.gridSnapping){x=va(x);y=va(y);h=va(h);l=va(l)}if(z.shiftKey){if(J=svgedit.path.path){o=J.dragging?J.dragging[0]:h;J=J.dragging?J.dragging[1]:l}else{o=h;J=l}J=U(o,J,x,y);x=J.x;y=J.y}if(sa&&sa.getAttribute("display")!=="none"){w*=s;E*=s;ma(sa,{x:Math.min(B*s,w),y:Math.min(A*s,E),width:Math.abs(w-B*s),height:Math.abs(E-A*s)},100)}La.mouseMove(z,x,y);break;case "textedit":x*=
s;y*=s;bb.mouseMove(n,k);break;case "rotate":w=svgedit.utilities.getBBox(F);J=w.x+w.width/2;E=w.y+w.height/2;o=ea(F);o=N(J,E,o);J=o.x;E=o.y;o=w.x;O=w.y;if(current_rotate_mode=="nw")o=w.x+w.width;if(current_rotate_mode=="se")O=w.y+w.height;if(current_rotate_mode=="sw"){o=w.x+w.width;O=w.y+w.height}compensation_angle=(Math.atan2(E-O,J-o)*(180/Math.PI)-90)%360;Y=(Math.atan2(E-y,J-x)*(180/Math.PI)-90)%360;Y+=compensation_angle;if(p.gridSnapping)Y=va(Y);if(z.shiftKey)Y=Math.round(Y/45)*45;d.setRotationAngle(Y< s;y*=s;bb.mouseMove(n,k);break;case "rotate":w=svgedit.utilities.getBBox(F);J=w.x+w.width/2;E=w.y+w.height/2;o=ea(F);o=N(J,E,o);J=o.x;E=o.y;o=w.x;O=w.y;if(current_rotate_mode=="nw")o=w.x+w.width;if(current_rotate_mode=="se")O=w.y+w.height;if(current_rotate_mode=="sw"){o=w.x+w.width;O=w.y+w.height}compensation_angle=(Math.atan2(E-O,J-o)*(180/Math.PI)-90)%360;Y=(Math.atan2(E-y,J-x)*(180/Math.PI)-90)%360;Y+=compensation_angle;if(p.gridSnapping)Y=va(Y);if(z.shiftKey)Y=Math.round(Y/45)*45;d.setRotationAngle(Y<
-180?360+Y:Y,true);M("transition",I)}ib("mouseMove",{event:z,mouse_x:n,mouse_y:k,selected:F})}}).click(function(z){z.preventDefault();return false}).dblclick(function(z){var F=z.target.parentNode;if(F!==L){var k=Bb(z),n=k.tagName;if(n==="text"&&Fa!=="textedit"){z=N(z.pageX,z.pageY,mb);bb.select(k,z.x,z.y)}if((n==="g"||n==="a")&&oa(k)){Db(k);k=I[0];Ia(true)}L&&Eb();F.tagName!=="g"&&F.tagName!=="a"||F===C().getCurrentLayer()||k===ra.selectorParentGroup||Kb(k)}}).mouseup(function(z){d.addClones=false; -180?360+Y:Y,true);M("transition",H)}ib("mouseMove",{event:z,mouse_x:n,mouse_y:k,selected:F})}}).click(function(z){z.preventDefault();return false}).dblclick(function(z){var F=z.target.parentNode;if(F!==L){var k=Bb(z),n=k.tagName;if(n==="text"&&Fa!=="textedit"){z=N(z.pageX,z.pageY,mb);bb.select(k,z.x,z.y)}if((n==="g"||n==="a")&&na(k)){Db(k);k=H[0];Ia(true)}L&&Eb();F.tagName!=="g"&&F.tagName!=="a"||F===C().getCurrentLayer()||k===ra.selectorParentGroup||Kb(k)}}).mouseup(function(z){d.addClones=false;
window.removeEventListener("keyup",d.removeClones);I=I.filter(Boolean);if(z.button!==2){var F=wb;wb=null;if(Ka){var k=N(z.pageX,z.pageY,mb),n=k.x*s;k=k.y*s;var o=n/s,w=k/s,E=pa(aa()),H=false;Ka=false;switch(Fa){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");hb=[]}Fa="select";case "select":if(I[0]!=null){if(I.length==1){n=I[0];switch(n.tagName){case "g":case "use":case "image":case "foreignObject":break;default:Xa.fill=n.getAttribute("fill");Xa.fill_opacity=n.getAttribute("fill-opacity"); window.removeEventListener("keyup",d.removeClones);H=H.filter(Boolean);if(z.button!==2){var F=wb;wb=null;if(Ka){var k=N(z.pageX,z.pageY,mb),n=k.x*s;k=k.y*s;var o=n/s,w=k/s,E=pa(aa()),I=false;Ka=false;switch(Fa){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");hb=[]}Fa="select";case "select":if(H[0]!=null){if(H.length==1){n=H[0];switch(n.tagName){case "g":case "use":case "image":case "foreignObject":break;default:Xa.fill=n.getAttribute("fill");Xa.fill_opacity=n.getAttribute("fill-opacity");
Xa.stroke=n.getAttribute("stroke");Xa.stroke_opacity=n.getAttribute("stroke-opacity");Xa.stroke_width=n.getAttribute("stroke-width");Xa.stroke_dasharray=n.getAttribute("stroke-dasharray");Xa.stroke_linejoin=n.getAttribute("stroke-linejoin");Xa.stroke_linecap=n.getAttribute("stroke-linecap")}if(n.tagName=="text"){Ua.font_size=n.getAttribute("font-size");Ua.font_family=n.getAttribute("font-family")}ra.requestSelector(n).showGrips(true)}Da();if(o!=B||w!=A){z=I.length;for(n=0;n<z;++n){if(I[n]==null)break; Xa.stroke=n.getAttribute("stroke");Xa.stroke_opacity=n.getAttribute("stroke-opacity");Xa.stroke_width=n.getAttribute("stroke-width");Xa.stroke_dasharray=n.getAttribute("stroke-dasharray");Xa.stroke_linejoin=n.getAttribute("stroke-linejoin");Xa.stroke_linecap=n.getAttribute("stroke-linecap")}if(n.tagName=="text"){Ua.font_size=n.getAttribute("font-size");Ua.font_family=n.getAttribute("font-family")}ra.requestSelector(n).showGrips(true)}Da();if(o!=B||w!=A){z=H.length;for(n=0;n<z;++n){if(H[n]==null)break;
I[n].firstChild||ra.requestSelector(I[n]).resize()}}else{n=z.target;if(I[0].nodeName==="path"&&I[1]==null)La.select(I[0]);else z.shiftKey&&F!=n&&d.removeFromSelection([n])}if(svgedit.browser.supportsNonScalingStroke())if(z=I[0]){z.removeAttribute("style");svgedit.utilities.walkTree(z,function(Y){Y.removeAttribute("style")})}}return;case "zoom":sa!=null&&sa.setAttribute("display","none");M("zoomed",{x:Math.min(B,o),y:Math.min(A,w),width:Math.abs(o-B),height:Math.abs(w-A),factor:z.altKey?0.5:2});return; H[n].firstChild||ra.requestSelector(H[n]).resize()}}else{n=z.target;if(H[0].nodeName==="path"&&H[1]==null)La.select(H[0]);else z.shiftKey&&F!=n&&d.removeFromSelection([n])}if(svgedit.browser.supportsNonScalingStroke())if(z=H[0]){z.removeAttribute("style");svgedit.utilities.walkTree(z,function(Y){Y.removeAttribute("style")})}}return;case "zoom":sa!=null&&sa.setAttribute("display","none");M("zoomed",{x:Math.min(B,o),y:Math.min(A,w),width:Math.abs(o-B),height:Math.abs(w-A),factor:z.altKey?0.5:2});return;
case "fhpath":F=E.getAttribute("points");o=F.indexOf(",");if(H=o>=0?F.indexOf(",",o+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)E=La.smoothPolylineIntoPath(E);break;case "line":F=$(E).attr(["x1","x2","y1","y2"]);H=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(E).attr(["width","height"]);H=F.width!=0||F.height!=0||Fa==="image";break;case "circle":H=E.getAttribute("r")!=0;break;case "ellipse":F=$(E).attr(["rx","ry"]);H=F.rx!=null||F.ry!=null;break;case "fhellipse":if(D.maxx- case "fhpath":F=E.getAttribute("points");o=F.indexOf(",");if(I=o>=0?F.indexOf(",",o+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)E=La.smoothPolylineIntoPath(E);break;case "line":F=$(E).attr(["x1","x2","y1","y2"]);I=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(E).attr(["width","height"]);I=F.width!=0||F.height!=0||Fa==="image";break;case "circle":I=E.getAttribute("r")!=0;break;case "ellipse":F=$(E).attr(["rx","ry"]);I=F.rx!=null||F.ry!=null;break;case "fhellipse":if(D.maxx-
D.minx>0&&D.maxy-D.miny>0){E=Q({element:"ellipse",curStyles:true,attr:{cx:(D.minx+D.maxx)/2,cy:(D.miny+D.maxy)/2,rx:(D.maxx-D.minx)/2,ry:(D.maxy-D.miny)/2,id:aa()}});M("changed",[E]);H=true}break;case "fhrect":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=Q({element:"rect",curStyles:true,attr:{x:D.minx,y:D.miny,width:D.maxx-D.minx,height:D.maxy-D.miny,id:aa()}});M("changed",[E]);H=true}break;case "text":H=true;rb([E]);bb.start(E);break;case "path":E=null;Ka=true;F=La.mouseUp(z,E,n,k);E=F.element;H=F.keep; D.minx>0&&D.maxy-D.miny>0){E=S({element:"ellipse",curStyles:true,attr:{cx:(D.minx+D.maxx)/2,cy:(D.miny+D.maxy)/2,rx:(D.maxx-D.minx)/2,ry:(D.maxy-D.miny)/2,id:aa()}});M("changed",[E]);I=true}break;case "fhrect":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=S({element:"rect",curStyles:true,attr:{x:D.minx,y:D.miny,width:D.maxx-D.minx,height:D.maxy-D.miny,id:aa()}});M("changed",[E]);I=true}break;case "text":I=true;rb([E]);bb.start(E);break;case "path":E=null;Ka=true;F=La.mouseUp(z,E,n,k);E=F.element;I=F.keep;
break;case "pathedit":H=true;E=null;La.mouseUp(z);break;case "textedit":H=false;E=null;bb.mouseUp(z,n,k);break;case "rotate":H=true;E=null;Fa="select";F=d.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Da();M("changed",I)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(Y,da){if(da){H=da.keep||H;E=da.element;Ka=da.started||Ka}});if(!H&&E!=null){C().releaseId(aa());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName=="g";)n=n.parentNode;if((Fa!= break;case "pathedit":I=true;E=null;La.mouseUp(z);break;case "textedit":I=false;E=null;bb.mouseUp(z,n,k);break;case "rotate":I=true;E=null;Fa="select";F=d.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Da();M("changed",H)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(Y,da){if(da){I=da.keep||I;E=da.element;Ka=da.started||Ka}});if(!I&&E!=null){C().releaseId(aa());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName=="g";)n=n.parentNode;if((Fa!=
"path"||!drawn_path)&&n.parentNode.id!="selectorParentGroup"&&n.id!="svgcanvas"&&n.id!="svgroot"){d.setMode("select");rb([n],true)}}else if(E!=null){d.addedNew=true;z=0.2;var J;if(false.beginElement&&E.getAttribute("opacity")!=K.opacity){J=$(false).clone().attr({to:K.opacity,dur:z}).appendTo(E);try{J[0].beginElement()}catch(O){}}else z=0;setTimeout(function(){J&&J.remove();E.setAttribute("opacity",K.opacity);E.setAttribute("style","pointer-events:inherit");la(E);if(Fa==="path")La.toEditMode(E);else p.selectNew&& "path"||!drawn_path)&&n.parentNode.id!="selectorParentGroup"&&n.id!="svgcanvas"&&n.id!="svgroot"){d.setMode("select");rb([n],true)}}else if(E!=null){d.addedNew=true;z=0.2;var J;if(false.beginElement&&E.getAttribute("opacity")!=K.opacity){J=$(false).clone().attr({to:K.opacity,dur:z}).appendTo(E);try{J[0].beginElement()}catch(O){}}else z=0;setTimeout(function(){J&&J.remove();E.setAttribute("opacity",K.opacity);E.setAttribute("style","pointer-events:inherit");la(E);if(Fa==="path")La.toEditMode(E);else p.selectNew&&
rb([E],true);wa(new Ha(E));M("changed",[E])},z*1E3)}Sa=null}}});$(a).bind("mousewheel DOMMouseScroll",function(z){if(z.shiftKey){z.preventDefault();mb=m.getScreenCTM().inverse();var F=N(z.pageX,z.pageY,mb);F={x:F.x,y:F.y,width:0,height:0};if(z.wheelDelta)if(z.wheelDelta>=120)F.factor=2;else{if(z.wheelDelta<=-120)F.factor=0.5}else if(z.detail)if(z.detail>0)F.factor=0.5;else if(z.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var Fb=function(e){$(e).click(function(h){h.preventDefault()})},bb=d.textActions= rb([E],true);wa(new Ha(E));M("changed",[E])},z*1E3)}Sa=null}}});$(a).bind("mousewheel DOMMouseScroll",function(z){if(z.shiftKey){z.preventDefault();mb=m.getScreenCTM().inverse();var F=N(z.pageX,z.pageY,mb);F={x:F.x,y:F.y,width:0,height:0};if(z.wheelDelta)if(z.wheelDelta>=120)F.factor=2;else{if(z.wheelDelta<=-120)F.factor=0.5}else if(z.detail)if(z.detail>0)F.factor=0.5;else if(z.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var Fb=function(e){$(e).click(function(h){h.preventDefault()})},bb=d.textActions=
function(){function e(V){var fa=k.value==="";$(k).focus();if(!arguments.length)if(fa)V=0;else{if(k.selectionEnd!==k.selectionStart)return;V=k.selectionEnd}var ha;ha=E[V];fa||k.setSelectionRange(V,V);n=pa("text_cursor");if(!n){n=document.createElementNS(b,"line");ma(n,{id:"text_cursor",stroke:"#333","stroke-width":1});n=pa("selectorParentGroup").appendChild(n)}w||(w=setInterval(function(){var W=n.getAttribute("display")==="none";n.setAttribute("display",W?"inline":"none")},600));fa=G(ha.x,H.y);ha= function(){function e(V){var fa=k.value==="";$(k).focus();if(!arguments.length)if(fa)V=0;else{if(k.selectionEnd!==k.selectionStart)return;V=k.selectionEnd}var ha;ha=E[V];fa||k.setSelectionRange(V,V);n=pa("text_cursor");if(!n){n=document.createElementNS(b,"line");ma(n,{id:"text_cursor",stroke:"#333","stroke-width":1});n=pa("selectorParentGroup").appendChild(n)}w||(w=setInterval(function(){var W=n.getAttribute("display")==="none";n.setAttribute("display",W?"inline":"none")},600));fa=G(ha.x,I.y);ha=
G(ha.x,H.y+H.height);ma(n,{x1:fa.x,y1:fa.y,x2:ha.x,y2:ha.y,visibility:"visible",display:"inline"});o&&o.setAttribute("d","M 0 0")}function h(V,fa,ha){if(V===fa)e(fa);else{ha||k.setSelectionRange(V,fa);o=pa("text_selectblock");if(!o){o=document.createElementNS(b,"path");ma(o,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(o)}V=E[V];var W=E[fa];n.setAttribute("visibility","hidden");fa=G(V.x,H.y);ha=G(V.x+(W.x-V.x),H.y);var qa=G(V.x, G(ha.x,I.y+I.height);ma(n,{x1:fa.x,y1:fa.y,x2:ha.x,y2:ha.y,visibility:"visible",display:"inline"});o&&o.setAttribute("d","M 0 0")}function h(V,fa,ha){if(V===fa)e(fa);else{ha||k.setSelectionRange(V,fa);o=pa("text_selectblock");if(!o){o=document.createElementNS(b,"path");ma(o,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(o)}V=E[V];var W=E[fa];n.setAttribute("visibility","hidden");fa=G(V.x,I.y);ha=G(V.x+(W.x-V.x),I.y);var qa=G(V.x,
H.y+H.height);V=G(V.x+(W.x-V.x),H.y+H.height);ma(o,{d:"M"+fa.x+","+fa.y+" L"+ha.x+","+ha.y+" "+V.x+","+V.y+" "+qa.x+","+qa.y+"z",display:"inline"})}}function l(V,fa){var ha=c.createSVGPoint();ha.x=V;ha.y=fa;if(E.length==1)return 0;ha=F.getCharNumAtPosition(ha);if(ha<0){ha=E.length-2;if(V<=E[0].x)ha=0}else if(ha>=E.length-2)ha=E.length-2;var W=E[ha];V>W.x+W.width/2&&ha++;return ha}function B(V,fa,ha){var W=k.selectionStart;V=l(V,fa);h(Math.min(W,V),Math.max(W,V),!ha)}function A(V,fa){var ha={x:V,y:fa}; I.y+I.height);V=G(V.x+(W.x-V.x),I.y+I.height);ma(o,{d:"M"+fa.x+","+fa.y+" L"+ha.x+","+ha.y+" "+V.x+","+V.y+" "+qa.x+","+qa.y+"z",display:"inline"})}}function l(V,fa){var ha=c.createSVGPoint();ha.x=V;ha.y=fa;if(E.length==1)return 0;ha=F.getCharNumAtPosition(ha);if(ha<0){ha=E.length-2;if(V<=E[0].x)ha=0}else if(ha>=E.length-2)ha=E.length-2;var W=E[ha];V>W.x+W.width/2&&ha++;return ha}function B(V,fa,ha){var W=k.selectionStart;V=l(V,fa);h(Math.min(W,V),Math.max(W,V),!ha)}function A(V,fa){var ha={x:V,y:fa};
ha.x/=s;ha.y/=s;if(J){var W=N(ha.x,ha.y,J.inverse());ha.x=W.x;ha.y=W.y}return ha}function G(V,fa){var ha={x:V,y:fa};if(J){var W=N(ha.x,ha.y,J);ha.x=W.x;ha.y=W.y}ha.x*=s;ha.y*=s;return ha}function D(V){h(0,F.textContent.length);$(this).unbind(V)}function z(V){if(da&&F){var fa=N(V.pageX,V.pageY,mb);fa=A(fa.x*s,fa.y*s);fa=l(fa.x,fa.y);var ha=F.textContent,W=ha.substr(0,fa).replace(/[a-z0-9]+$/i,"").length;ha=ha.substr(fa).match(/^[a-z0-9]+/i);h(W,(ha?ha[0].length:0)+fa);$(V.target).click(D);setTimeout(function(){$(V.target).unbind("click", ha.x/=s;ha.y/=s;if(J){var W=N(ha.x,ha.y,J.inverse());ha.x=W.x;ha.y=W.y}return ha}function G(V,fa){var ha={x:V,y:fa};if(J){var W=N(ha.x,ha.y,J);ha.x=W.x;ha.y=W.y}ha.x*=s;ha.y*=s;return ha}function D(V){h(0,F.textContent.length);$(this).unbind(V)}function z(V){if(da&&F){var fa=N(V.pageX,V.pageY,mb);fa=A(fa.x*s,fa.y*s);fa=l(fa.x,fa.y);var ha=F.textContent,W=ha.substr(0,fa).replace(/[a-z0-9]+$/i,"").length;ha=ha.substr(fa).match(/^[a-z0-9]+/i);h(W,(ha?ha[0].length:0)+fa);$(V.target).click(D);setTimeout(function(){$(V.target).unbind("click",
D)},300)}}var F,k,n,o,w,E=[],H,J,O,Y,da;return{select:function(V,fa,ha){F=V;bb.toEditMode(fa,ha)},start:function(V){F=V;bb.toEditMode()},mouseDown:function(V,fa,ha,W){V=A(ha,W);k.focus();e(l(V.x,V.y));O=ha;Y=W},mouseMove:function(V,fa){var ha=A(V,fa);B(ha.x,ha.y)},mouseUp:function(V,fa,ha){var W=A(fa,ha);B(W.x,W.y,true);V.target!==F&&fa<O+2&&fa>O-2&&ha<Y+2&&ha>Y-2&&bb.toSelectMode(true)},setCursor:e,toEditMode:function(V,fa){rb([F],false);da=false;Fa="textedit";ra.requestSelector(F).showGrips(false); D)},300)}}var F,k,n,o,w,E=[],I,J,O,Y,da;return{select:function(V,fa,ha){F=V;bb.toEditMode(fa,ha)},start:function(V){F=V;bb.toEditMode()},mouseDown:function(V,fa,ha,W){V=A(ha,W);k.focus();e(l(V.x,V.y));O=ha;Y=W},mouseMove:function(V,fa){var ha=A(V,fa);B(ha.x,ha.y)},mouseUp:function(V,fa,ha){var W=A(fa,ha);B(W.x,W.y,true);V.target!==F&&fa<O+2&&fa>O-2&&ha<Y+2&&ha>Y-2&&bb.toSelectMode(true)},setCursor:e,toEditMode:function(V,fa){rb([F],false);da=false;Fa="textedit";ra.requestSelector(F).showGrips(false);
ra.requestSelector(F);bb.init();$(F).css("cursor","text");if(arguments.length){var ha=A(V,fa);e(l(ha.x,ha.y))}else e();setTimeout(function(){da=true},300)},toSelectMode:function(V){Fa="select";clearInterval(w);w=null;o&&$(o).attr("display","none");n&&$(n).attr("visibility","hidden");$(F).css("cursor","move");if(V){Ia();$(F).css("cursor","move");M("selected",[F]);qb([F],true)}F&&!F.textContent.length&&d.deleteSelectedElements();$(k).blur();F=false},setInputElem:function(V){k=V},clear:function(){Fa== ra.requestSelector(F);bb.init();$(F).css("cursor","text");if(arguments.length){var ha=A(V,fa);e(l(ha.x,ha.y))}else e();setTimeout(function(){da=true},300)},toSelectMode:function(V){Fa="select";clearInterval(w);w=null;o&&$(o).attr("display","none");n&&$(n).attr("visibility","hidden");$(F).css("cursor","move");if(V){Ia();$(F).css("cursor","move");M("selected",[F]);qb([F],true)}F&&!F.textContent.length&&d.deleteSelectedElements();$(k).blur();F=false},setInputElem:function(V){k=V},clear:function(){Fa==
"textedit"&&bb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=I[0];ra.requestSelector(F).showGrips(false)}var V=F.textContent.length,fa=F.getAttribute("transform");H=svgedit.utilities.getBBox(F);J=fa?ea(F):null;E=Array(V);k.focus();$(F).unbind("dblclick",z).dblclick(z);if(!V)var ha={x:H.x+H.width/2,width:0};for(fa=0;fa<V;fa++){var W=F.getStartPositionOfChar(fa);ha=F.getEndPositionOfChar(fa);if(!svgedit.browser.supportsGoodTextCharPos()){var qa=d.contentW*s;W.x-=qa;ha.x-=qa;W.x/=s;ha.x/= "textedit"&&bb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=H[0];ra.requestSelector(F).showGrips(false)}var V=F.textContent.length,fa=F.getAttribute("transform");I=svgedit.utilities.getBBox(F);J=fa?ea(F):null;E=Array(V);k.focus();$(F).unbind("dblclick",z).dblclick(z);if(!V)var ha={x:I.x+I.width/2,width:0};for(fa=0;fa<V;fa++){var W=F.getStartPositionOfChar(fa);ha=F.getEndPositionOfChar(fa);if(!svgedit.browser.supportsGoodTextCharPos()){var qa=d.contentW*s;W.x-=qa;ha.x-=qa;W.x/=s;ha.x/=
s}E[fa]={x:W.x,y:H.y,width:ha.x-W.x,height:H.height}}E.push({x:ha.x,width:0});h(k.selectionStart,k.selectionEnd,true)}}}}(),La=d.pathActions=function(){var e=false,h,l,B;svgedit.path.Path.prototype.endChanges=function(D){if(svgedit.browser.isWebkit()){var z=this.elem;z.setAttribute("d",La.convertPath(z))}D=new Ma(this.elem,{d:this.last_d},D);wa(D);M("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(D){$.isArray(D)||(D=[D]);for(var z=0;z<D.length;z++){var F=D[z],k=this.segs[F]; s}E[fa]={x:W.x,y:I.y,width:ha.x-W.x,height:I.height}}E.push({x:ha.x,width:0});h(k.selectionStart,k.selectionEnd,true)}}}}(),La=d.pathActions=function(){var e=false,h,l,B;svgedit.path.Path.prototype.endChanges=function(D){if(svgedit.browser.isWebkit()){var z=this.elem;z.setAttribute("d",La.convertPath(z))}D=new Ma(this.elem,{d:this.last_d},D);wa(D);M("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(D){$.isArray(D)||(D=[D]);for(var z=0;z<D.length;z++){var F=D[z],k=this.segs[F];
k.ptgrip&&this.selected_pts.indexOf(F)==-1&&F>=0&&this.selected_pts.push(F)}this.selected_pts.sort();z=this.selected_pts.length;for(D=Array(z);z--;){k=this.segs[this.selected_pts[z]];k.select(true);D[z]=k.ptgrip}La.canDeleteNodes=true;La.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",D)};var A=h=null,G=false;return{mouseDown:function(D,z,F,k){if(Fa==="path"){mouse_x=F;mouse_y=k;k=mouse_x/s;z=mouse_y/s;F=pa("path_stretch_line");l=[k,z];if(p.gridSnapping){k=va(k);z=va(z);mouse_x= k.ptgrip&&this.selected_pts.indexOf(F)==-1&&F>=0&&this.selected_pts.push(F)}this.selected_pts.sort();z=this.selected_pts.length;for(D=Array(z);z--;){k=this.segs[this.selected_pts[z]];k.select(true);D[z]=k.ptgrip}La.canDeleteNodes=true;La.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",D)};var A=h=null,G=false;return{mouseDown:function(D,z,F,k){if(Fa==="path"){mouse_x=F;mouse_y=k;k=mouse_x/s;z=mouse_y/s;F=pa("path_stretch_line");l=[k,z];if(p.gridSnapping){k=va(k);z=va(z);mouse_x=
va(mouse_x);mouse_y=va(mouse_y)}if(!F){F=document.createElementNS(b,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});F=pa("selectorParentGroup").appendChild(F)}F.setAttribute("display","inline");var n=null;if(A){n=A.pathSegList;for(var o=n.numberOfItems,w=6/s,E=false;o;){o--;var H=n.getItem(o),J=H.x;H=H.y;if(k>=J-w&&k<=J+w&&z>=H-w&&z<=H+w){E=true;break}}w=aa();svgedit.path.removePath_(w);w=pa(w);J=n.numberOfItems;if(E){if(o<=1&&J>=2){k=n.getItem(0).x;z=n.getItem(0).y; va(mouse_x);mouse_y=va(mouse_y)}if(!F){F=document.createElementNS(b,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});F=pa("selectorParentGroup").appendChild(F)}F.setAttribute("display","inline");var n=null;if(A){n=A.pathSegList;for(var o=n.numberOfItems,w=6/s,E=false;o;){o--;var I=n.getItem(o),J=I.x;I=I.y;if(k>=J-w&&k<=J+w&&z>=I-w&&z<=I+w){E=true;break}}w=aa();svgedit.path.removePath_(w);w=pa(w);J=n.numberOfItems;if(E){if(o<=1&&J>=2){k=n.getItem(0).x;z=n.getItem(0).y;
D=F.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(k,z):A.createSVGPathSegCurvetoCubicAbs(k,z,D.x1/s,D.y1/s,k,z);k=A.createSVGPathSegClosePath();n.appendItem(D);n.appendItem(k)}else if(J<3)return n=false;$(F).remove();element=w;A=null;Ka=false;if(e){svgedit.path.path.matrix&&Za(w,{},svgedit.path.path.matrix.inverse());F=w.getAttribute("d");D=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",D+F);$(w).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath(); D=F.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(k,z):A.createSVGPathSegCurvetoCubicAbs(k,z,D.x1/s,D.y1/s,k,z);k=A.createSVGPathSegClosePath();n.appendItem(D);n.appendItem(k)}else if(J<3)return n=false;$(F).remove();element=w;A=null;Ka=false;if(e){svgedit.path.path.matrix&&Za(w,{},svgedit.path.path.matrix.inverse());F=w.getAttribute("d");D=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",D+F);$(w).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();
svgedit.path.path.init();La.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,Bb(D))){console.log("Clicked outside canvas");return false}n=A.pathSegList.numberOfItems;o=A.pathSegList.getItem(n-1);w=o.x;o=o.y;if(D.shiftKey){D=U(w,o,k,z);k=D.x;z=D.y}D=F.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(ab(k),ab(z)):A.createSVGPathSegCurvetoCubicAbs(ab(k),ab(z),D.x1/s,D.y1/s,D.x2/s,D.y2/s);A.pathSegList.appendItem(D);k*=s;z*=s;F.setAttribute("d", svgedit.path.path.init();La.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,Bb(D))){console.log("Clicked outside canvas");return false}n=A.pathSegList.numberOfItems;o=A.pathSegList.getItem(n-1);w=o.x;o=o.y;if(D.shiftKey){D=U(w,o,k,z);k=D.x;z=D.y}D=F.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(ab(k),ab(z)):A.createSVGPathSegCurvetoCubicAbs(ab(k),ab(z),D.x1/s,D.y1/s,D.x2/s,D.y2/s);A.pathSegList.appendItem(D);k*=s;z*=s;F.setAttribute("d",
["M",k,z,k,z].join(" "));F=n;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,k,z)}}else{d_attr="M"+k+","+z+" ";A=Q({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:K.opacity/2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();w=D.target.id;if(w.substr(0,14)=="pathpointgrip_"){z=svgedit.path.path.cur_pt=parseInt(w.substr(14)); ["M",k,z,k,z].join(" "));F=n;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,k,z)}}else{d_attr="M"+k+","+z+" ";A=S({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:K.opacity/2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();w=D.target.id;if(w.substr(0,14)=="pathpointgrip_"){z=svgedit.path.path.cur_pt=parseInt(w.substr(14));
svgedit.path.path.dragging=[F,k];n=svgedit.path.path.segs[z];if(D.shiftKey)n.selected?svgedit.path.path.removePtFromSelection(z):svgedit.path.path.addPtsToSelection(z);else{if(svgedit.path.path.selected_pts.length<=1||!n.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(z)}}else if(w.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,k];D=w.split("_")[1].split("c");z=D[0]-0;svgedit.path.path.selectPt(z,D[1]-0)}if(!svgedit.path.path.dragging){if(sa==null)sa=ra.getRubberBandBox(); svgedit.path.path.dragging=[F,k];n=svgedit.path.path.segs[z];if(D.shiftKey)n.selected?svgedit.path.path.removePtFromSelection(z):svgedit.path.path.addPtsToSelection(z);else{if(svgedit.path.path.selected_pts.length<=1||!n.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(z)}}else if(w.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,k];D=w.split("_")[1].split("c");z=D[0]-0;svgedit.path.path.selectPt(z,D[1]-0)}if(!svgedit.path.path.dragging){if(sa==null)sa=ra.getRubberBandBox();
ma(sa,{x:F*s,y:k*s,width:0,height:0,display:"inline"},100)}}},mouseMove:function(D,z,F){G=true;if(Fa==="path"){if(A){var k=A.pathSegList;D=k.numberOfItems-1;if(l){var n=svgedit.path.addCtrlGrip("1c1"),o=svgedit.path.addCtrlGrip("0c2");o.getAttribute("cx");o.getAttribute("cy");n.setAttribute("cx",z);n.setAttribute("cy",F);n.setAttribute("display","inline");n=l[0];var w=l[1];k.getItem(D);var E=n+(n-z/s),H=w+(w-F/s);o.setAttribute("cx",E*s);o.setAttribute("cy",H*s);o.setAttribute("display","inline"); ma(sa,{x:F*s,y:k*s,width:0,height:0,display:"inline"},100)}}},mouseMove:function(D,z,F){G=true;if(Fa==="path"){if(A){var k=A.pathSegList;D=k.numberOfItems-1;if(l){var n=svgedit.path.addCtrlGrip("1c1"),o=svgedit.path.addCtrlGrip("0c2");o.getAttribute("cx");o.getAttribute("cy");n.setAttribute("cx",z);n.setAttribute("cy",F);n.setAttribute("display","inline");n=l[0];var w=l[1];k.getItem(D);var E=n+(n-z/s),I=w+(w-F/s);o.setAttribute("cx",E*s);o.setAttribute("cy",I*s);o.setAttribute("display","inline");
o=svgedit.path.getCtrlLine(1);var J=svgedit.path.getCtrlLine(2);ma(o,{x1:z,y1:F,x2:n*s,y2:w*s,display:"inline"});ma(J,{x1:E*s,y1:H*s,x2:n*s,y2:w*s,display:"inline"});if(D===0)B=[z,F];else{k=k.getItem(D-1);z=k.x;F=k.y;if(k.pathSegType===6){z+=z-k.x2;F+=F-k.y2}else if(B){z=B[0]/s;F=B[1]/s}svgedit.path.replacePathSeg(6,D,[n,w,z,F,E,H],A)}}else if(n=pa("path_stretch_line")){D=k.getItem(D);if(D.pathSegType===6)svgedit.path.replacePathSeg(6,1,[z,F,(D.x+(D.x-D.x2))*s,(D.y+(D.y-D.y2))*s,z,F],n);else B?svgedit.path.replacePathSeg(6, o=svgedit.path.getCtrlLine(1);var J=svgedit.path.getCtrlLine(2);ma(o,{x1:z,y1:F,x2:n*s,y2:w*s,display:"inline"});ma(J,{x1:E*s,y1:I*s,x2:n*s,y2:w*s,display:"inline"});if(D===0)B=[z,F];else{k=k.getItem(D-1);z=k.x;F=k.y;if(k.pathSegType===6){z+=z-k.x2;F+=F-k.y2}else if(B){z=B[0]/s;F=B[1]/s}svgedit.path.replacePathSeg(6,D,[n,w,z,F,E,I],A)}}else if(n=pa("path_stretch_line")){D=k.getItem(D);if(D.pathSegType===6)svgedit.path.replacePathSeg(6,1,[z,F,(D.x+(D.x-D.x2))*s,(D.y+(D.y-D.y2))*s,z,F],n);else B?svgedit.path.replacePathSeg(6,
1,[z,F,B[0],B[1],z,F],n):svgedit.path.replacePathSeg(4,1,[z,F],n)}}}else if(svgedit.path.path.dragging){n=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);w=svgedit.path.getPointFromGrip({x:z,y:F},svgedit.path.path);D=w.x-n.x;n=w.y-n.y;svgedit.path.path.dragging=[z,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(D,n):svgedit.path.path.movePts(D,n)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next|| 1,[z,F,B[0],B[1],z,F],n):svgedit.path.replacePathSeg(4,1,[z,F],n)}}}else if(svgedit.path.path.dragging){n=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);w=svgedit.path.getPointFromGrip({x:z,y:F},svgedit.path.path);D=w.x-n.x;n=w.y-n.y;svgedit.path.path.dragging=[z,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(D,n):svgedit.path.path.movePts(D,n)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||
this.prev){var O=sa.getBBox(),Y=svgedit.path.getGripPt(this);O=svgedit.math.rectsIntersect(O,{x:Y.x,y:Y.y,width:0,height:0});this.select(O);O&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(D,z){if(Fa==="path"){l=null;if(!A){z=pa(aa());Ka=false;B=null}return{keep:true,element:z}}if(svgedit.path.path.dragging){var F=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)"); this.prev){var O=sa.getBBox(),Y=svgedit.path.getGripPt(this);O=svgedit.math.rectsIntersect(O,{x:Y.x,y:Y.y,width:0,height:0});this.select(O);O&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(D,z){if(Fa==="path"){l=null;if(!A){z=pa(aa());Ka=false;B=null}return{keep:true,element:z}}if(svgedit.path.path.dragging){var F=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)");
!D.shiftKey&&!G&&svgedit.path.path.selectPt(F)}else if(sa&&sa.getAttribute("display")!="none"){sa.setAttribute("display","none");sa.getAttribute("width")<=2&&sa.getAttribute("height")<=2&&La.toSelectMode(D.target)}else La.toSelectMode(D.target);G=false},toEditMode:function(D){svgedit.path.path=svgedit.path.getPath_(D);Fa="pathedit";Ia();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(D){var z=D==svgedit.path.path.elem; !D.shiftKey&&!G&&svgedit.path.path.selectPt(F)}else if(sa&&sa.getAttribute("display")!="none"){sa.setAttribute("display","none");sa.getAttribute("width")<=2&&sa.getAttribute("height")<=2&&La.toSelectMode(D.target)}else La.toSelectMode(D.target);G=false},toEditMode:function(D){svgedit.path.path=svgedit.path.getPath_(D);Fa="pathedit";Ia();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(D){var z=D==svgedit.path.path.elem;
Fa="select";svgedit.path.path.show(false);h=false;Ia();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(z){M("selected",[D]);qb([D],true)}},addSubPath:function(D){if(D){Fa="path";e=true}else{La.clear(true);La.toEditMode(svgedit.path.path.elem)}},select:function(D){if(h===D){La.toEditMode(D);Fa="pathedit"}else h=D},reorient:function(){var D=I[0];if(D)if(oa(D)!=0){var z=new Ca("Reorient path"),F={d:D.getAttribute("d"),transform:D.getAttribute("transform")};z.addSubCommand(new Ma(D,F)); Fa="select";svgedit.path.path.show(false);h=false;Ia();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(z){M("selected",[D]);qb([D],true)}},addSubPath:function(D){if(D){Fa="path";e=true}else{La.clear(true);La.toEditMode(svgedit.path.path.elem)}},select:function(D){if(h===D){La.toEditMode(D);Fa="pathedit"}else h=D},reorient:function(){var D=H[0];if(D)if(na(D)!=0){var z=new Ca("Reorient path"),F={d:D.getAttribute("d"),transform:D.getAttribute("transform")};z.addSubCommand(new Ma(D,F));
Ia();this.resetOrientation(D);wa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed",I)}},clear:function(){h=null;if(A){var D=pa(aa());$(pa("path_stretch_line")).remove();$(D).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");A=B=null;Ka=false}else Fa=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(D){if(D==null||D.nodeName!="path")return false;var z=S(D),F=X(z).matrix; Ia();this.resetOrientation(D);wa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed",H)}},clear:function(){h=null;if(A){var D=pa(aa());$(pa("path_stretch_line")).remove();$(D).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");A=B=null;Ka=false}else Fa=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(D){if(D==null||D.nodeName!="path")return false;var z=R(D),F=X(z).matrix;
z.clear();D.removeAttribute("transform");z=D.pathSegList;for(var k=z.numberOfItems,n=0;n<k;++n){var o=z.getItem(n),w=o.pathSegType;if(w!=1){var E=[];$.each(["",1,2],function(H,J){var O=o["x"+J],Y=o["y"+J];if(O!==undefined&&Y!==undefined){O=N(O,Y,F);E.splice(E.length,0,O.x,O.y)}});svgedit.path.replacePathSeg(w,n,E,D)}}g(D,F)},zoomChange:function(){Fa=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var D=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]: z.clear();D.removeAttribute("transform");z=D.pathSegList;for(var k=z.numberOfItems,n=0;n<k;++n){var o=z.getItem(n),w=o.pathSegType;if(w!=1){var E=[];$.each(["",1,2],function(I,J){var O=o["x"+J],Y=o["y"+J];if(O!==undefined&&Y!==undefined){O=N(O,Y,F);E.splice(E.length,0,O.x,O.y)}});svgedit.path.replacePathSeg(w,n,E,D)}}g(D,F)},zoomChange:function(){Fa=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var D=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:
1];return{x:D.item.x,y:D.item.y,type:D.type}},linkControlPoints:function(D){svgedit.path.setLinkControlPoints(D)},clonePathNode:function(){svgedit.path.path.storeD();for(var D=svgedit.path.path.selected_pts,z=D.length,F=[];z--;){var k=D[z];svgedit.path.path.addSeg(k);F.push(k+z);F.push(k+z+1)}svgedit.path.path.init().addPtsToSelection(F);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var D=svgedit.path.path.selected_pts;if(D.length===1){var z=svgedit.path.path.elem, 1];return{x:D.item.x,y:D.item.y,type:D.type}},linkControlPoints:function(D){svgedit.path.setLinkControlPoints(D)},clonePathNode:function(){svgedit.path.path.storeD();for(var D=svgedit.path.path.selected_pts,z=D.length,F=[];z--;){var k=D[z];svgedit.path.path.addSeg(k);F.push(k+z);F.push(k+z+1)}svgedit.path.path.init().addPtsToSelection(F);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var D=svgedit.path.path.selected_pts;if(D.length===1){var z=svgedit.path.path.elem,
F=z.pathSegList,k=D[0],n=null,o=null;svgedit.path.path.eachSeg(function(J){if(this.type===2&&J<=k)o=this.item;if(J<=k)return true;if(this.type===2){n=J;return false}else if(this.type===1)return n=false});if(n==null)n=svgedit.path.path.segs.length-1;if(n!==false){var w=z.createSVGPathSegLinetoAbs(o.x,o.y),E=z.createSVGPathSegClosePath();if(n==svgedit.path.path.segs.length){F.appendItem(w);F.appendItem(E)}else{svgedit.path.insertItemBefore(z,E,n);svgedit.path.insertItemBefore(z,w,n)}svgedit.path.path.init().selectPt(n+ F=z.pathSegList,k=D[0],n=null,o=null;svgedit.path.path.eachSeg(function(J){if(this.type===2&&J<=k)o=this.item;if(J<=k)return true;if(this.type===2){n=J;return false}else if(this.type===1)return n=false});if(n==null)n=svgedit.path.path.segs.length-1;if(n!==false){var w=z.createSVGPathSegLinetoAbs(o.x,o.y),E=z.createSVGPathSegClosePath();if(n==svgedit.path.path.segs.length){F.appendItem(w);F.appendItem(E)}else{svgedit.path.insertItemBefore(z,E,n);svgedit.path.insertItemBefore(z,w,n)}svgedit.path.path.init().selectPt(n+
1)}else if(svgedit.path.path.segs[k].mate){F.removeItem(k);F.removeItem(k);svgedit.path.path.init().selectPt(k-1)}else{for(D=0;D<F.numberOfItems;D++){var H=F.getItem(D);if(H.pathSegType===2)w=D;else if(D===k)F.removeItem(w);else if(H.pathSegType===1&&k<D){E=D-1;F.removeItem(D);break}}for(D=k-w-1;D--;)svgedit.path.insertItemBefore(z,F.getItem(w),E);z=F.getItem(w);svgedit.path.replacePathSeg(2,w,[z.x,z.y]);D=k;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(La.canDeleteNodes){svgedit.path.path.storeD(); 1)}else if(svgedit.path.path.segs[k].mate){F.removeItem(k);F.removeItem(k);svgedit.path.path.init().selectPt(k-1)}else{for(D=0;D<F.numberOfItems;D++){var I=F.getItem(D);if(I.pathSegType===2)w=D;else if(D===k)F.removeItem(w);else if(I.pathSegType===1&&k<D){E=D-1;F.removeItem(D);break}}for(D=k-w-1;D--;)svgedit.path.insertItemBefore(z,F.getItem(w),E);z=F.getItem(w);svgedit.path.replacePathSeg(2,w,[z.x,z.y]);D=k;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(La.canDeleteNodes){svgedit.path.path.storeD();
for(var D=svgedit.path.path.selected_pts,z=D.length;z--;)svgedit.path.path.deleteSeg(D[z]);var F=function(){var k=svgedit.path.path.elem.pathSegList,n=k.numberOfItems,o=function(H,J){for(;J--;)k.removeItem(H)};if(n<=1)return true;for(;n--;){var w=k.getItem(n);if(w.pathSegType===1){w=k.getItem(n-1);var E=k.getItem(n-2);if(w.pathSegType===2){o(n-1,2);F();break}else if(E.pathSegType===2){o(n-2,3);F();break}}else if(w.pathSegType===2)if(n>0){w=k.getItem(n-1).pathSegType;if(w===2){o(n-1,1);F();break}else if(w=== for(var D=svgedit.path.path.selected_pts,z=D.length;z--;)svgedit.path.path.deleteSeg(D[z]);var F=function(){var k=svgedit.path.path.elem.pathSegList,n=k.numberOfItems,o=function(I,J){for(;J--;)k.removeItem(I)};if(n<=1)return true;for(;n--;){var w=k.getItem(n);if(w.pathSegType===1){w=k.getItem(n-1);var E=k.getItem(n-2);if(w.pathSegType===2){o(n-1,2);F();break}else if(E.pathSegType===2){o(n-2,3);F();break}}else if(w.pathSegType===2)if(n>0){w=k.getItem(n-1).pathSegType;if(w===2){o(n-1,1);F();break}else if(w===
1&&k.numberOfItems-1===n){o(n,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){La.toSelectMode(svgedit.path.path.elem);d.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){D=$(svgedit.path.path.elem);D.attr("d",D.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(D){var z=D.points,F=z.numberOfItems;if(F>=4){var k=z.getItem(0),n=null;D=[];D.push(["M",k.x,",", 1&&k.numberOfItems-1===n){o(n,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){La.toSelectMode(svgedit.path.path.elem);d.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){D=$(svgedit.path.path.elem);D.attr("d",D.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(D){var z=D.points,F=z.numberOfItems;if(F>=4){var k=z.getItem(0),n=null;D=[];D.push(["M",k.x,",",
k.y," C"].join(""));for(var o=1;o<=F-4;o+=3){var w=z.getItem(o),E=z.getItem(o+1),H=z.getItem(o+2);if(n)if((k=svgedit.path.smoothControlPoints(n,w,k))&&k.length==2){w=D[D.length-1].split(",");w[2]=k[0].x;w[3]=k[0].y;D[D.length-1]=w.join(",");w=k[1]}D.push([w.x,w.y,E.x,E.y,H.x,H.y].join(","));k=H;n=E}for(D.push("L");o<F;++o){E=z.getItem(o);D.push([E.x,E.y].join(","))}D=D.join(" ");D=Q({element:"path",curStyles:true,attr:{id:aa(),d:D,fill:"none"}})}return D},setSegType:function(D){svgedit.path.path.setSegType(D)}, k.y," C"].join(""));for(var o=1;o<=F-4;o+=3){var w=z.getItem(o),E=z.getItem(o+1),I=z.getItem(o+2);if(n)if((k=svgedit.path.smoothControlPoints(n,w,k))&&k.length==2){w=D[D.length-1].split(",");w[2]=k[0].x;w[3]=k[0].y;D[D.length-1]=w.join(",");w=k[1]}D.push([w.x,w.y,E.x,E.y,I.x,I.y].join(","));k=I;n=E}for(D.push("L");o<F;++o){E=z.getItem(o);D.push([E.x,E.y].join(","))}D=D.join(" ");D=S({element:"path",curStyles:true,attr:{id:aa(),d:D,fill:"none"}})}return D},setSegType:function(D){svgedit.path.path.setSegType(D)},
moveNode:function(D,z){var F=svgedit.path.path.selected_pts;if(F.length){svgedit.path.path.storeD();F=svgedit.path.path.segs[F[0]];var k={x:0,y:0};k[D]=z-F.item[D];F.move(k.x,k.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(D){for(var z=D.pathSegList,F=z.numberOfItems,k,n=0;n<F;++n){var o=z.getItem(n);if(o.pathSegType===2)k=o;if(o.pathSegType===1){o=z.getItem(n-1);if(o.x!=k.x||o.y!=k.y){z=D.createSVGPathSegLinetoAbs(k.x,k.y);svgedit.path.insertItemBefore(D,z,n);La.fixEnd(D); moveNode:function(D,z){var F=svgedit.path.path.selected_pts;if(F.length){svgedit.path.path.storeD();F=svgedit.path.path.segs[F[0]];var k={x:0,y:0};k[D]=z-F.item[D];F.move(k.x,k.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(D){for(var z=D.pathSegList,F=z.numberOfItems,k,n=0;n<F;++n){var o=z.getItem(n);if(o.pathSegType===2)k=o;if(o.pathSegType===1){o=z.getItem(n-1);if(o.x!=k.x||o.y!=k.y){z=D.createSVGPathSegLinetoAbs(k.x,k.y);svgedit.path.insertItemBefore(D,z,n);La.fixEnd(D);
break}}}svgedit.browser.isWebkit()&&D.setAttribute("d",La.convertPath(D))},convertPath:function(D,z){for(var F=D.pathSegList,k=F.numberOfItems,n=0,o=0,w="",E=null,H=0;H<k;++H){var J=F.getItem(H),O=J.x||0,Y=J.y||0,da=J.x1||0,V=J.y1||0,fa=J.x2||0,ha=J.y2||0,W=J.pathSegType,qa=Oa[W]["to"+(z?"Lower":"Upper")+"Case"](),ua=function(za,Ba,Pa){Ba=Ba?" "+Ba.join(" "):"";Pa=Pa?" "+svgedit.units.shortFloat(Pa):"";$.each(za,function(Qa,Na){za[Qa]=svgedit.units.shortFloat(Na)});w+=qa+za.join(" ")+Ba+Pa};switch(W){case 1:w+= break}}}svgedit.browser.isWebkit()&&D.setAttribute("d",La.convertPath(D))},convertPath:function(D,z){for(var F=D.pathSegList,k=F.numberOfItems,n=0,o=0,w="",E=null,I=0;I<k;++I){var J=F.getItem(I),O=J.x||0,Y=J.y||0,da=J.x1||0,V=J.y1||0,fa=J.x2||0,ha=J.y2||0,W=J.pathSegType,qa=Oa[W]["to"+(z?"Lower":"Upper")+"Case"](),ua=function(za,Ba,Pa){Ba=Ba?" "+Ba.join(" "):"";Pa=Pa?" "+svgedit.units.shortFloat(Pa):"";$.each(za,function(Qa,Na){za[Qa]=svgedit.units.shortFloat(Na)});w+=qa+za.join(" ")+Ba+Pa};switch(W){case 1:w+=
"z";break;case 12:O-=n;case 13:if(z){n+=O;qa="l"}else{O+=n;n=O;qa="L"}ua([[O,o]]);break;case 14:Y-=o;case 15:if(z){o+=Y;qa="l"}else{Y+=o;o=Y;qa="L"}ua([[n,Y]]);break;case 2:case 4:case 18:O-=n;Y-=o;case 5:case 3:if(E&&F.getItem(H-1).pathSegType===1&&!z){n=E[0];o=E[1]}case 19:if(z){n+=O;o+=Y}else{O+=n;Y+=o;n=O;o=Y}if(W===3)E=[n,o];ua([[O,Y]]);break;case 6:O-=n;da-=n;fa-=n;Y-=o;V-=o;ha-=o;case 7:if(z){n+=O;o+=Y}else{O+=n;da+=n;fa+=n;Y+=o;V+=o;ha+=o;n=O;o=Y}ua([[da,V],[fa,ha],[O,Y]]);break;case 8:O-= "z";break;case 12:O-=n;case 13:if(z){n+=O;qa="l"}else{O+=n;n=O;qa="L"}ua([[O,o]]);break;case 14:Y-=o;case 15:if(z){o+=Y;qa="l"}else{Y+=o;o=Y;qa="L"}ua([[n,Y]]);break;case 2:case 4:case 18:O-=n;Y-=o;case 5:case 3:if(E&&F.getItem(I-1).pathSegType===1&&!z){n=E[0];o=E[1]}case 19:if(z){n+=O;o+=Y}else{O+=n;Y+=o;n=O;o=Y}if(W===3)E=[n,o];ua([[O,Y]]);break;case 6:O-=n;da-=n;fa-=n;Y-=o;V-=o;ha-=o;case 7:if(z){n+=O;o+=Y}else{O+=n;da+=n;fa+=n;Y+=o;V+=o;ha+=o;n=O;o=Y}ua([[da,V],[fa,ha],[O,Y]]);break;case 8:O-=
n;da-=n;Y-=o;V-=o;case 9:if(z){n+=O;o+=Y}else{O+=n;da+=n;Y+=o;V+=o;n=O;o=Y}ua([[da,V],[O,Y]]);break;case 10:O-=n;Y-=o;case 11:if(z){n+=O;o+=Y}else{O+=n;Y+=o;n=O;o=Y}ua([[J.r1,J.r2]],[J.angle,J.largeArcFlag?1:0,J.sweepFlag?1:0],[O,Y]);break;case 16:O-=n;fa-=n;Y-=o;ha-=o;case 17:if(z){n+=O;o+=Y}else{O+=n;fa+=n;Y+=o;ha+=o;n=O;o=Y}ua([[fa,ha],[O,Y]])}}return w}}}(),yb=this.removeUnusedDefElems=function(){var e=m.getElementsByTagNameNS(b,"defs");if(!e||!e.length)return 0;for(var h=[],l=0,B=["fill","stroke", n;da-=n;Y-=o;V-=o;case 9:if(z){n+=O;o+=Y}else{O+=n;da+=n;Y+=o;V+=o;n=O;o=Y}ua([[da,V],[O,Y]]);break;case 10:O-=n;Y-=o;case 11:if(z){n+=O;o+=Y}else{O+=n;Y+=o;n=O;o=Y}ua([[J.r1,J.r2]],[J.angle,J.largeArcFlag?1:0,J.sweepFlag?1:0],[O,Y]);break;case 16:O-=n;fa-=n;Y-=o;ha-=o;case 17:if(z){n+=O;o+=Y}else{O+=n;fa+=n;Y+=o;ha+=o;n=O;o=Y}ua([[fa,ha],[O,Y]])}}return w}}}(),yb=this.removeUnusedDefElems=function(){var e=m.getElementsByTagNameNS(b,"defs");if(!e||!e.length)return 0;for(var h=[],l=0,B=["fill","stroke",
"filter","marker-start","marker-mid","marker-end"],A=B.length,G=m.getElementsByTagNameNS(b,"*"),D=G.length,z=0;z<D;z++){for(var F=G[z],k=0;k<A;k++){var n=ja(F.getAttribute(B[k]));n&&h.push(n.substr(1))}(F=ba(F))&&F.indexOf("#")===0&&h.push(F.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(z=e.length;z--;){B=e[z];A=B.id;if(h.indexOf(A)<0){sb[A]=B;B.parentNode.removeChild(B);l++}}return l};this.svgCanvasToString=function(){for(;yb()>0;);La.clear(true); "filter","marker-start","marker-mid","marker-end"],A=B.length,G=m.getElementsByTagNameNS(b,"*"),D=G.length,z=0;z<D;z++){for(var F=G[z],k=0;k<A;k++){var n=ja(F.getAttribute(B[k]));n&&h.push(n.substr(1))}(F=ba(F))&&F.indexOf("#")===0&&h.push(F.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(z=e.length;z--;){B=e[z];A=B.id;if(h.indexOf(A)<0){sb[A]=B;B.parentNode.removeChild(B);l++}}return l};this.svgCanvasToString=function(){for(;yb()>0;);La.clear(true);
$.each(m.childNodes,function(l,B){l&&B.nodeType===8&&B.data.indexOf("Created with")>=0&&m.insertBefore(B,m.firstChild)});if(L){Eb();rb([L])}$("#canvasGrid").attr("display","none");var e=[];$(m).find("g:data(gsvg)").each(function(){for(var l=this.attributes,B=l.length,A=0;A<B;A++)if(l[A].nodeName=="id"||l[A].nodeName=="style")B--;if(B<=0){l=this.firstChild;e.push(l);$(this).replaceWith(l)}});var h=this.svgToString(m,0);e.length&&$(e).each(function(){tb(this)});return h};this.svgToString=function(e, $.each(m.childNodes,function(l,B){l&&B.nodeType===8&&B.data.indexOf("Created with")>=0&&m.insertBefore(B,m.firstChild)});if(L){Eb();rb([L])}$("#canvasGrid").attr("display","none");var e=[];$(m).find("g:data(gsvg)").each(function(){for(var l=this.attributes,B=l.length,A=0;A<B;A++)if(l[A].nodeName=="id"||l[A].nodeName=="style")B--;if(B<=0){l=this.firstChild;e.push(l);$(this).replaceWith(l)}});var h=this.svgToString(m,0);e.length&&$(e).each(function(){tb(this)});return h};this.svgToString=function(e,
h){var l=[],B=svgedit.utilities.toXml,A=p.baseUnit,G=RegExp("^-?[\\d\\.]+"+A+"$");if(e){la(e);var D=e.attributes,z,F,k=e.childNodes;for(F=0;F<h;F++)l.push(" ");l.push("<");l.push(e.nodeName);if(e.id==="svgcontent"){F=zb();if(A!=="px"){F.w=svgedit.units.convertUnit(F.w,A)+A;F.h=svgedit.units.convertUnit(F.h,A)+A}l.push(' width="'+F.w+'" height="'+F.h+'" xmlns="'+b+'"');var n={};$(e).find("*").andSelf().each(function(){$.each(this.attributes,function(H,J){var O=J.namespaceURI;if(O&&!n[O]&&xa[O]!=="xmlns"&& h){var l=[],B=svgedit.utilities.toXml,A=p.baseUnit,G=RegExp("^-?[\\d\\.]+"+A+"$");if(e){la(e);var D=e.attributes,z,F,k=e.childNodes;for(F=0;F<h;F++)l.push(" ");l.push("<");l.push(e.nodeName);if(e.id==="svgcontent"){F=zb();if(A!=="px"){F.w=svgedit.units.convertUnit(F.w,A)+A;F.h=svgedit.units.convertUnit(F.h,A)+A}l.push(' width="'+F.w+'" height="'+F.h+'" xmlns="'+b+'"');var n={};$(e).find("*").andSelf().each(function(){$.each(this.attributes,function(I,J){var O=J.namespaceURI;if(O&&!n[O]&&xa[O]!=="xmlns"&&
xa[O]!=="xml"){n[O]=true;l.push(" xmlns:"+xa[O]+'="'+O+'"')}})});F=D.length;for(A=["width","height","xmlns","x","y","viewBox","id","overflow"];F--;){z=D.item(F);var o=B(z.nodeValue);if(z.nodeName.indexOf("xmlns:")!==0)if(o!=""&&A.indexOf(z.localName)==-1)if(!z.namespaceURI||xa[z.namespaceURI]){l.push(" ");l.push(z.nodeName);l.push('="');l.push(o);l.push('"')}}}else{if(e.nodeName==="defs"&&!e.firstChild)return;var w=["-moz-math-font-style","_moz-math-font-style"];for(F=D.length-1;F>=0;F--){z=D.item(F); xa[O]!=="xml"){n[O]=true;l.push(" xmlns:"+xa[O]+'="'+O+'"')}})});F=D.length;for(A=["width","height","xmlns","x","y","viewBox","id","overflow"];F--;){z=D.item(F);var o=B(z.nodeValue);if(z.nodeName.indexOf("xmlns:")!==0)if(o!=""&&A.indexOf(z.localName)==-1)if(!z.namespaceURI||xa[z.namespaceURI]){l.push(" ");l.push(z.nodeName);l.push('="');l.push(o);l.push('"')}}}else{if(e.nodeName==="defs"&&!e.firstChild)return;var w=["-moz-math-font-style","_moz-math-font-style"];for(F=D.length-1;F>=0;F--){z=D.item(F);
o=B(z.nodeValue);if(!(w.indexOf(z.localName)>=0))if(o!="")if(o.indexOf("pointer-events")!==0)if(!(z.localName==="class"&&o.indexOf("se_")===0)){l.push(" ");if(z.localName==="d")o=La.convertPath(e,true);if(isNaN(o)){if(G.test(o))o=svgedit.units.shortFloat(o)+A}else o=svgedit.units.shortFloat(o);if($a.apply&&e.nodeName==="image"&&z.localName==="href"&&$a.images&&$a.images==="embed"){var E=Va[o];if(E)o=E}if(!z.namespaceURI||z.namespaceURI==b||xa[z.namespaceURI]){l.push(z.nodeName);l.push('="');l.push(o); o=B(z.nodeValue);if(!(w.indexOf(z.localName)>=0))if(o!="")if(o.indexOf("pointer-events")!==0)if(!(z.localName==="class"&&o.indexOf("se_")===0)){l.push(" ");if(z.localName==="d")o=La.convertPath(e,true);if(isNaN(o)){if(G.test(o))o=svgedit.units.shortFloat(o)+A}else o=svgedit.units.shortFloat(o);if($a.apply&&e.nodeName==="image"&&z.localName==="href"&&$a.images&&$a.images==="embed"){var E=Va[o];if(E)o=E}if(!z.namespaceURI||z.namespaceURI==b||xa[z.namespaceURI]){l.push(z.nodeName);l.push('="');l.push(o);
l.push('"')}}}}if(e.hasChildNodes()){l.push(">");h++;D=false;for(F=0;F<k.length;F++){A=k.item(F);switch(A.nodeType){case 1:l.push("\n");l.push(this.svgToString(k.item(F),h));break;case 3:A=A.nodeValue.replace(/^\s+|\s+$/g,"");if(A!=""){D=true;l.push(B(A)+"")}break;case 4:l.push("\n");l.push(Array(h+1).join(" "));l.push("<![CDATA[");l.push(A.nodeValue);l.push("]]\>");break;case 8:l.push("\n");l.push(Array(h+1).join(" "));l.push("<!--");l.push(A.data);l.push("--\>")}}h--;if(!D){l.push("\n");for(F=0;F< l.push('"')}}}}if(e.hasChildNodes()){l.push(">");h++;D=false;for(F=0;F<k.length;F++){A=k.item(F);switch(A.nodeType){case 1:l.push("\n");l.push(this.svgToString(k.item(F),h));break;case 3:A=A.nodeValue.replace(/^\s+|\s+$/g,"");if(A!=""){D=true;l.push(B(A)+"")}break;case 4:l.push("\n");l.push(Array(h+1).join(" "));l.push("<![CDATA[");l.push(A.nodeValue);l.push("]]\>");break;case 8:l.push("\n");l.push(Array(h+1).join(" "));l.push("<!--");l.push(A.data);l.push("--\>")}}h--;if(!D){l.push("\n");for(F=0;F<
@ -312,69 +312,69 @@ this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.dra
if(w=w?w.substr(1):null){w in h||(h[w]={elem:null,attrs:[],hrefs:[]});h[w].attrs.push(o)}}});var F=svgedit.utilities.getHref(z);if(F&&l.indexOf(z.nodeName)>=0)if(F=F.substr(1)){F in h||(h[F]={elem:null,attrs:[],hrefs:[]});h[F].hrefs.push(z)}}});for(var B in h)if(B){var A=h[B].elem;if(A){e=ka();A.id=e;A=h[B].attrs;for(var G=A.length;G--;){var D=A[G];D.ownerElement.setAttribute(D.name,"url(#"+e+")")}A=h[B].hrefs;for(G=A.length;G--;)svgedit.utilities.setHref(A[G],"#"+e)}}},Gb=this.setUseData=function(e){var h= if(w=w?w.substr(1):null){w in h||(h[w]={elem:null,attrs:[],hrefs:[]});h[w].attrs.push(o)}}});var F=svgedit.utilities.getHref(z);if(F&&l.indexOf(z.nodeName)>=0)if(F=F.substr(1)){F in h||(h[F]={elem:null,attrs:[],hrefs:[]});h[F].hrefs.push(z)}}});for(var B in h)if(B){var A=h[B].elem;if(A){e=ka();A.id=e;A=h[B].attrs;for(var G=A.length;G--;){var D=A[G];D.ownerElement.setAttribute(D.name,"url(#"+e+")")}A=h[B].hrefs;for(G=A.length;G--;)svgedit.utilities.setHref(A[G],"#"+e)}}},Gb=this.setUseData=function(e){var h=
$(e);if(e.tagName!=="use")h=h.find("use");h.each(function(){var l=ba(this).substr(1);if(l=pa(l)){$(this).data("ref",l);if(l.tagName=="symbol"||l.tagName=="svg")$(this).data("symbol",l).data("ref",l)}})},Ib=this.convertGradients=function(e){var h=$(e).find("linearGradient, radialGradient");if(!h.length&&svgedit.browser.isWebkit())h=$(e).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});h.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var l=$(m).find('[fill="url(#'+ $(e);if(e.tagName!=="use")h=h.find("use");h.each(function(){var l=ba(this).substr(1);if(l=pa(l)){$(this).data("ref",l);if(l.tagName=="symbol"||l.tagName=="svg")$(this).data("symbol",l).data("ref",l)}})},Ib=this.convertGradients=function(e){var h=$(e).find("linearGradient, radialGradient");if(!h.length&&svgedit.browser.isWebkit())h=$(e).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});h.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var l=$(m).find('[fill="url(#'+
this.id+')"],[stroke="url(#'+this.id+')"]');if(l.length)if(l=svgedit.utilities.getBBox(l[0]))if(this.tagName==="linearGradient"){var B=$(this).attr(["x1","y1","x2","y2"]),A=this.gradientTransform.baseVal;if(A&&A.numberOfItems>0){var G=X(A).matrix;A=N(B.x1,B.y1,G);G=N(B.x2,B.y2,G);B.x1=A.x;B.y1=A.y;B.x2=G.x;B.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(B.x1-l.x)/l.width,y1:(B.y1-l.y)/l.height,x2:(B.x2-l.x)/l.width,y2:(B.y2-l.y)/l.height});this.removeAttribute("gradientUnits")}}})}, this.id+')"],[stroke="url(#'+this.id+')"]');if(l.length)if(l=svgedit.utilities.getBBox(l[0]))if(this.tagName==="linearGradient"){var B=$(this).attr(["x1","y1","x2","y2"]),A=this.gradientTransform.baseVal;if(A&&A.numberOfItems>0){var G=X(A).matrix;A=N(B.x1,B.y1,G);G=N(B.x2,B.y2,G);B.x1=A.x;B.y1=A.y;B.x2=G.x;B.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(B.x1-l.x)/l.width,y1:(B.y1-l.y)/l.height,x2:(B.x2-l.x)/l.width,y2:(B.y2-l.y)/l.height});this.removeAttribute("gradientUnits")}}})},
Lb=this.convertToGroup=function(e){e||(e=I[0]);var h=$(e),l=new Ca,B;if(h.data("gsvg")){l=$(e.firstChild).attr(["x","y"]);$(e.firstChild.firstChild).unwrap();$(e).removeData("gsvg");B=S(e);var A=c.createSVGTransform();A.setTranslate(l.x,l.y);B.appendItem(A);Ra(e);M("selected",[e])}else if(h.data("symbol")){e=h.data("symbol");B=h.attr("transform");A=h.attr(["x","y"]);var G=e.getAttribute("viewBox");if(G){G=G.split(" ");A.x-=+G[0];A.y-=+G[1]}B+=" translate("+(A.x||0)+","+(A.y||0)+")";A=h.prev();l.addSubCommand(new Ga(h[0], Lb=this.convertToGroup=function(e){e||(e=H[0]);var h=$(e),l=new Ca,B;if(h.data("gsvg")){l=$(e.firstChild).attr(["x","y"]);$(e.firstChild.firstChild).unwrap();$(e).removeData("gsvg");B=R(e);var A=c.createSVGTransform();A.setTranslate(l.x,l.y);B.appendItem(A);Ra(e);M("selected",[e])}else if(h.data("symbol")){e=h.data("symbol");B=h.attr("transform");A=h.attr(["x","y"]);var G=e.getAttribute("viewBox");if(G){G=G.split(" ");A.x-=+G[0];A.y-=+G[1]}B+=" translate("+(A.x||0)+","+(A.y||0)+")";A=h.prev();l.addSubCommand(new Ga(h[0],
h[0].nextSibling,h[0].parentNode));h.remove();G=$(m).find("use:data(symbol)").length;h=f.createElementNS(b,"g");for(var D=e.childNodes,z=0;z<D.length;z++)h.appendChild(D[z].cloneNode(true));if(svgedit.browser.isGecko()){D=$(gb()).children("linearGradient,radialGradient,pattern").clone();$(h).append(D)}B&&h.setAttribute("transform",B);B=e.parentNode;Hb(h);svgedit.browser.isGecko()&&$(gb()).append($(h).find("linearGradient,radialGradient,pattern"));h.id=ka();A.after(h);if(B){if(!G){A=e.nextSibling; h[0].nextSibling,h[0].parentNode));h.remove();G=$(m).find("use:data(symbol)").length;h=f.createElementNS(b,"g");for(var D=e.childNodes,z=0;z<D.length;z++)h.appendChild(D[z].cloneNode(true));if(svgedit.browser.isGecko()){D=$(gb()).children("linearGradient,radialGradient,pattern").clone();$(h).append(D)}B&&h.setAttribute("transform",B);B=e.parentNode;Hb(h);svgedit.browser.isGecko()&&$(gb()).append($(h).find("linearGradient,radialGradient,pattern"));h.id=ka();A.after(h);if(B){if(!G){A=e.nextSibling;
B.removeChild(e);l.addSubCommand(new Ga(e,A,B))}l.addSubCommand(new Ha(h))}Gb(h);svgedit.browser.isGecko()?Ib(gb()):Ib(h);svgedit.utilities.walkTreePost(h,function(F){try{Ra(F)}catch(k){console.log(k)}});$(h).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});rb([h]);(e=Db(h,true))&&l.addSubCommand(e);wa(l)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e){try{var h=svgedit.utilities.text2xml(e); B.removeChild(e);l.addSubCommand(new Ga(e,A,B))}l.addSubCommand(new Ha(h))}Gb(h);svgedit.browser.isGecko()?Ib(gb()):Ib(h);svgedit.utilities.walkTreePost(h,function(F){try{Ra(F)}catch(k){console.log(k)}});$(h).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});rb([h]);(e=Db(h,true))&&l.addSubCommand(e);wa(l)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e){try{var h=svgedit.utilities.text2xml(e);
this.prepareSvg(h);var l=new Ca("Change Source"),B=m.nextSibling,A=c.removeChild(m);l.addSubCommand(new Ga(A,B,c));m=f.adoptNode?f.adoptNode(h.documentElement):f.importNode(h.documentElement,true);c.appendChild(m);var G=$(m);d.current_drawing_=new svgedit.draw.Drawing(m,u);var D=C().getNonce();D?M("setnonce",D):M("unsetnonce");G.find("image").each(function(){var J=this;Fb(J);var O=ba(this);if(O.indexOf("data:")===0){var Y=O.match(/svgedit_url=(.*?);/);if(Y){var da=decodeURIComponent(Y[1]);$(new Image).load(function(){J.setAttributeNS("http://www.w3.org/1999/xlink", this.prepareSvg(h);var l=new Ca("Change Source"),B=m.nextSibling,A=c.removeChild(m);l.addSubCommand(new Ga(A,B,c));m=f.adoptNode?f.adoptNode(h.documentElement):f.importNode(h.documentElement,true);c.appendChild(m);var G=$(m);d.current_drawing_=new svgedit.draw.Drawing(m,u);var D=C().getNonce();D?M("setnonce",D):M("unsetnonce");G.find("image").each(function(){var J=this;Fb(J);var O=ba(this);if(O.indexOf("data:")===0){var Y=O.match(/svgedit_url=(.*?);/);if(Y){var da=decodeURIComponent(Y[1]);$(new Image).load(function(){J.setAttributeNS("http://www.w3.org/1999/xlink",
"xlink:href",da)}).attr("src",da)}}d.embedImage(O)});G.find("svg").each(function(){if(!$(this).closest("defs").length){Hb(this);var J=this.parentNode;if(J.childNodes.length===1&&J.nodeName==="g"){$(J).data("gsvg",this);J.id=J.id||ka()}else tb(this)}});G.find("linearGradient, radialGradient, pattern").appendTo(gb());Gb(G);Ib(G[0]);svgedit.utilities.walkTreePost(m,function(J){try{Ra(J)}catch(O){console.log(O)}});var z={id:"svgcontent",overflow:p.show_outside_canvas?"visible":"hidden"},F=false;if(G.attr("viewBox")){var k= "xlink:href",da)}).attr("src",da)}}d.embedImage(O)});G.find("svg").each(function(){if(!$(this).closest("defs").length){Hb(this);var J=this.parentNode;if(J.childNodes.length===1&&J.nodeName==="g"){$(J).data("gsvg",this);J.id=J.id||ka()}else tb(this)}});G.find("linearGradient, radialGradient, pattern").appendTo(gb());Gb(G);Ib(G[0]);svgedit.utilities.walkTreePost(m,function(J){try{Ra(J)}catch(O){console.log(O)}});var z={id:"svgcontent",overflow:p.show_outside_canvas?"visible":"hidden"},F=false;if(G.attr("viewBox")){var k=
G.attr("viewBox").split(" ");z.width=k[2];z.height=k[3]}else $.each(["width","height"],function(J,O){var Y=G.attr(O);Y||(Y="100%");if((Y+"").substr(-1)==="%")F=true;else z[O]=Aa(O,Y)});xb();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(F){var n=getStrokedBBox();z.width=n.width+n.x;z.height=n.height+n.y}if(z.width<=0)z.width=200;if(z.height<=0)z.height=200;G.attr(z);this.contentW=z.width; G.attr("viewBox").split(" ");z.width=k[2];z.height=k[3]}else $.each(["width","height"],function(J,O){var Y=G.attr(O);Y||(Y="100%");if((Y+"").substr(-1)==="%")F=true;else z[O]=Aa(O,Y)});xb();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(F){var n=getStrokedBBox();z.width=n.width+n.x;z.height=n.height+n.y}if(z.width<=0)z.width=200;if(z.height<=0)z.height=200;G.attr(z);this.contentW=z.width;
this.contentH=z.height;$("#canvas_width").val(this.contentW);$("#canvas_height").val(this.contentH);var o=$("#canvas_background");if(o.length){var w=o.attr("fill-opacity");w=w?parseInt(w)*100:100;fill=this.getPaint(o.attr("fill"),w,"canvas")}else fill=this.getPaint("none",100,"canvas");svgEditor.paintBox.canvas.setPaint(fill);l.addSubCommand(new Ha(m));var E=G.attr(["width","height"]);l.addSubCommand(new Ma(c,E));s=1;svgedit.transformlist.resetListMap();Ia();svgedit.path.clearData();c.appendChild(ra.selectorParentGroup); this.contentH=z.height;$("#canvas_width").val(this.contentW);$("#canvas_height").val(this.contentH);var o=$("#canvas_background");if(o.length){var w=o.attr("fill-opacity");w=w?parseInt(w)*100:100;fill=this.getPaint(o.attr("fill"),w,"canvas")}else fill=this.getPaint("none",100,"canvas");svgEditor.paintBox.canvas.setPaint(fill);l.addSubCommand(new Ha(m));var E=G.attr(["width","height"]);l.addSubCommand(new Ma(c,E));s=1;svgedit.transformlist.resetListMap();Ia();svgedit.path.clearData();c.appendChild(ra.selectorParentGroup);
wa(l);M("changed",[m])}catch(H){console.log(H);return false}return true};this.getPaint=function(e,h,l){var B=null;if(e.indexOf("url(#")===0){e=(e=svgCanvas.getRefElem(e))?e.cloneNode(true):$("#"+l+"_color defs *")[0];B={alpha:h};B[e.tagName]=e}else B=e.indexOf("#")===0?{alpha:h,solidColor:e.substr(1)}:{alpha:h,solidColor:"none"};return new $.jGraduate.Paint(B)};this.importSvgString=function(e){try{var h=svgedit.utilities.encode64(e.length+e).substr(0,32),l=false;if(lb[h])if($(lb[h].symbol).parents("#svgroot").length)l= wa(l);M("changed",[m])}catch(I){console.log(I);return false}return true};this.getPaint=function(e,h,l){var B=null;if(e.indexOf("url(#")===0){e=(e=svgCanvas.getRefElem(e))?e.cloneNode(true):$("#"+l+"_color defs *")[0];B={alpha:h};B[e.tagName]=e}else B=e.indexOf("#")===0?{alpha:h,solidColor:e.substr(1)}:{alpha:h,solidColor:"none"};return new $.jGraduate.Paint(B)};this.importSvgString=function(e){try{var h=svgedit.utilities.encode64(e.length+e).substr(0,32),l=false;if(lb[h])if($(lb[h].symbol).parents("#svgroot").length)l=
true;var B=new Ca("Import SVG");if(l)var A=lb[h].symbol,G=lb[h].xform;else{var D=svgedit.utilities.text2xml(e);this.prepareSvg(D);var z;z=f.adoptNode?f.adoptNode(D.documentElement):f.importNode(D.documentElement,true);Hb(z);var F=Aa("width",z.getAttribute("width")),k=Aa("height",z.getAttribute("height")),n=z.getAttribute("viewBox"),o=n?n.split(" "):[0,0,F,k];for(e=0;e<4;++e)o[e]=+o[e];m.getAttribute("width");var w=+m.getAttribute("height");G=k>F?"scale("+w/3/o[3]+")":"scale("+w/3/o[2]+")";G="translate(0) "+ true;var B=new Ca("Import SVG");if(l)var A=lb[h].symbol,G=lb[h].xform;else{var D=svgedit.utilities.text2xml(e);this.prepareSvg(D);var z;z=f.adoptNode?f.adoptNode(D.documentElement):f.importNode(D.documentElement,true);Hb(z);var F=Aa("width",z.getAttribute("width")),k=Aa("height",z.getAttribute("height")),n=z.getAttribute("viewBox"),o=n?n.split(" "):[0,0,F,k];for(e=0;e<4;++e)o[e]=+o[e];m.getAttribute("width");var w=+m.getAttribute("height");G=k>F?"scale("+w/3/o[3]+")":"scale("+w/3/o[2]+")";G="translate(0) "+
G+" translate(0)";A=f.createElementNS(b,"symbol");var E=gb();for(svgedit.browser.isGecko()&&$(z).find("linearGradient, radialGradient, pattern").appendTo(E);z.firstChild;)A.appendChild(z.firstChild);var H=z.attributes;for(z=0;z<H.length;z++){var J=H[z];A.setAttribute(J.nodeName,J.nodeValue)}A.id=ka();lb[h]={symbol:A,xform:G};gb().appendChild(A);B.addSubCommand(new Ha(A))}var O=f.createElementNS(b,"use");O.id=ka();T(O,"#"+A.id);(L||C().getCurrentLayer()).appendChild(O);B.addSubCommand(new Ha(O));Ia(); G+" translate(0)";A=f.createElementNS(b,"symbol");var E=gb();for(svgedit.browser.isGecko()&&$(z).find("linearGradient, radialGradient, pattern").appendTo(E);z.firstChild;)A.appendChild(z.firstChild);var I=z.attributes;for(z=0;z<I.length;z++){var J=I[z];A.setAttribute(J.nodeName,J.nodeValue)}A.id=ka();lb[h]={symbol:A,xform:G};gb().appendChild(A);B.addSubCommand(new Ha(A))}var O=f.createElementNS(b,"use");O.id=ka();T(O,"#"+A.id);(L||C().getCurrentLayer()).appendChild(O);B.addSubCommand(new Ha(O));Ia();
O.setAttribute("transform",G);Ra(O);$(O).data("symbol",A).data("ref",A);qb([O]);wa(B);M("changed",[m])}catch(Y){console.log(Y);return false}return true};var xb=d.identifyLayers=function(){Eb();C().identifyLayers()};this.createLayer=function(e){var h=new Ca("Create Layer");e=C().createLayer(e);h.addSubCommand(new Ha(e));wa(h);Ia();M("changed",[e])};this.cloneLayer=function(e){var h=new Ca("Duplicate Layer"),l=f.createElementNS(b,"g"),B=f.createElementNS(b,"title");B.textContent=e;l.appendChild(B); O.setAttribute("transform",G);Ra(O);$(O).data("symbol",A).data("ref",A);qb([O]);wa(B);M("changed",[m])}catch(Y){console.log(Y);return false}return true};var xb=d.identifyLayers=function(){Eb();C().identifyLayers()};this.createLayer=function(e){var h=new Ca("Create Layer");e=C().createLayer(e);h.addSubCommand(new Ha(e));wa(h);Ia();M("changed",[e])};this.cloneLayer=function(e){var h=new Ca("Duplicate Layer"),l=f.createElementNS(b,"g"),B=f.createElementNS(b,"title");B.textContent=e;l.appendChild(B);
B=C().getCurrentLayer();$(B).after(l);B=B.childNodes;for(var A=0;A<B.length;A++){var G=B[A];G.localName!="title"&&l.appendChild(ia(G))}Ia();xb();h.addSubCommand(new Ha(l));wa(h);d.setCurrentLayer(e);M("changed",[l])};this.deleteCurrentLayer=function(){var e=C().getCurrentLayer(),h=e.nextSibling,l=e.parentNode;if(e=C().deleteCurrentLayer()){var B=new Ca("Delete Layer");B.addSubCommand(new Ga(e,h,l));wa(B);Ia();M("changed",[l]);return true}return false};this.setCurrentLayer=function(e){(e=C().setCurrentLayer(svgedit.utilities.toXml(e)))&& B=C().getCurrentLayer();$(B).after(l);B=B.childNodes;for(var A=0;A<B.length;A++){var G=B[A];G.localName!="title"&&l.appendChild(ia(G))}Ia();xb();h.addSubCommand(new Ha(l));wa(h);d.setCurrentLayer(e);M("changed",[l])};this.deleteCurrentLayer=function(){var e=C().getCurrentLayer(),h=e.nextSibling,l=e.parentNode;if(e=C().deleteCurrentLayer()){var B=new Ca("Delete Layer");B.addSubCommand(new Ga(e,h,l));wa(B);Ia();M("changed",[l]);return true}return false};this.setCurrentLayer=function(e){(e=C().setCurrentLayer(svgedit.utilities.toXml(e)))&&
Ia();return e};this.renameCurrentLayer=function(e){var h=C();if(h.current_layer){var l=h.current_layer;if(!d.setCurrentLayer(e)){for(var B=new Ca("Rename Layer"),A=0;A<h.getNumLayers();++A)if(h.all_layers[A][1]==l)break;var G=h.getLayerName(A);h.all_layers[A][0]=svgedit.utilities.toXml(e);var D=l.childNodes.length;for(A=0;A<D;++A){var z=l.childNodes.item(A);if(z&&z.tagName=="title"){for(;z.firstChild;)z.removeChild(z.firstChild);z.textContent=e;B.addSubCommand(new Ma(z,{"#text":G}));wa(B);M("changed", Ia();return e};this.renameCurrentLayer=function(e){var h=C();if(h.current_layer){var l=h.current_layer;if(!d.setCurrentLayer(e)){for(var B=new Ca("Rename Layer"),A=0;A<h.getNumLayers();++A)if(h.all_layers[A][1]==l)break;var G=h.getLayerName(A);h.all_layers[A][0]=svgedit.utilities.toXml(e);var D=l.childNodes.length;for(A=0;A<D;++A){var z=l.childNodes.item(A);if(z&&z.tagName=="title"){for(;z.firstChild;)z.removeChild(z.firstChild);z.textContent=e;B.addSubCommand(new Ma(z,{"#text":G}));wa(B);M("changed",
[l]);return true}}}h.current_layer=l}return false};this.setCurrentLayerPosition=function(e){var h=C();if(h.current_layer&&e>=0&&e<h.getNumLayers()){for(var l=0;l<h.getNumLayers();++l)if(h.all_layers[l][1]==h.current_layer)break;if(l==h.getNumLayers())return false;if(l!=e){var B=null,A=h.current_layer.nextSibling;if(e>l){if(e<h.getNumLayers()-1)B=h.all_layers[e+1][1]}else B=h.all_layers[e][1];m.insertBefore(h.current_layer,B);wa(new Ja(h.current_layer,A,m));xb();d.setCurrentLayer(h.getLayerName(e)); [l]);return true}}}h.current_layer=l}return false};this.setCurrentLayerPosition=function(e){var h=C();if(h.current_layer&&e>=0&&e<h.getNumLayers()){for(var l=0;l<h.getNumLayers();++l)if(h.all_layers[l][1]==h.current_layer)break;if(l==h.getNumLayers())return false;if(l!=e){var B=null,A=h.current_layer.nextSibling;if(e>l){if(e<h.getNumLayers()-1)B=h.all_layers[e+1][1]}else B=h.all_layers[e][1];m.insertBefore(h.current_layer,B);wa(new Ja(h.current_layer,A,m));xb();d.setCurrentLayer(h.getLayerName(e));
return true}}return false};this.setLayerVisibility=function(e,h){var l=C(),B=l.getLayerVisibility(e),A=l.setLayerVisibility(e,h);if(A)wa(new Ma(A,{display:B?"inline":"none"},"Layer Visibility"));else return false;if(A==l.getCurrentLayer()){Ia();La.clear()}return true};this.moveSelectedToLayer=function(e){for(var h=null,l=C(),B=0;B<l.getNumLayers();++B)if(l.getLayerName(B)==e){h=l.all_layers[B][1];break}if(!h)return false;e=new Ca("Move Elements to Layer");l=I;for(B=l.length;B--;){var A=l[B];if(A){var G= return true}}return false};this.setLayerVisibility=function(e,h){var l=C(),B=l.getLayerVisibility(e),A=l.setLayerVisibility(e,h);if(A)wa(new Ma(A,{display:B?"inline":"none"},"Layer Visibility"));else return false;if(A==l.getCurrentLayer()){Ia();La.clear()}return true};this.moveSelectedToLayer=function(e){for(var h=null,l=C(),B=0;B<l.getNumLayers();++B)if(l.getLayerName(B)==e){h=l.all_layers[B][1];break}if(!h)return false;e=new Ca("Move Elements to Layer");l=H;for(B=l.length;B--;){var A=l[B];if(A){var G=
A.nextSibling,D=A.parentNode;h.appendChild(A);e.addSubCommand(new Ja(A,G,D))}}wa(e);return true};this.mergeLayer=function(e){var h=new Ca("Merge Layer"),l=C(),B=$(l.current_layer).prev()[0];if(B){for(h.addSubCommand(new Ga(l.current_layer,l.current_layer.nextSibling,m));l.current_layer.firstChild;){var A=l.current_layer.firstChild;if(A.localName=="title"){h.addSubCommand(new Ga(A,A.nextSibling,l.current_layer));l.current_layer.removeChild(A)}else{var G=A.nextSibling;B.appendChild(A);h.addSubCommand(new Ja(A, A.nextSibling,D=A.parentNode;h.appendChild(A);e.addSubCommand(new Ja(A,G,D))}}wa(e);return true};this.mergeLayer=function(e){var h=new Ca("Merge Layer"),l=C(),B=$(l.current_layer).prev()[0];if(B){for(h.addSubCommand(new Ga(l.current_layer,l.current_layer.nextSibling,m));l.current_layer.firstChild;){var A=l.current_layer.firstChild;if(A.localName=="title"){h.addSubCommand(new Ga(A,A.nextSibling,l.current_layer));l.current_layer.removeChild(A)}else{var G=A.nextSibling;B.appendChild(A);h.addSubCommand(new Ja(A,
G,l.current_layer))}}m.removeChild(l.current_layer);if(!e){Ia();xb();M("changed",[m]);wa(h)}l.current_layer=B;return h}};this.mergeAllLayers=function(){var e=new Ca("Merge all Layers"),h=C();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(m).children("g").length>1;)e.addSubCommand(d.mergeLayer(true));Ia();xb();M("changed",[m]);wa(e)};var Eb=this.leaveContext=function(){var e=ta.length;if(e){for(var h=0;h<e;h++){var l=ta[h],B=cb(l,"orig_opac");B!==1?l.setAttribute("opacity",B):l.removeAttribute("opacity"); G,l.current_layer))}}m.removeChild(l.current_layer);if(!e){Ia();xb();M("changed",[m]);wa(h)}l.current_layer=B;return h}};this.mergeAllLayers=function(){var e=new Ca("Merge all Layers"),h=C();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(m).children("g").length>1;)e.addSubCommand(d.mergeLayer(true));Ia();xb();M("changed",[m]);wa(e)};var Eb=this.leaveContext=function(){var e=ta.length;if(e){for(var h=0;h<e;h++){var l=ta[h],B=cb(l,"orig_opac");B!==1?l.setAttribute("opacity",B):l.removeAttribute("opacity");
l.setAttribute("style","pointer-events: inherit")}ta=[];Ia(true);M("contextset",null)}L=null},Kb=this.setContext=function(e){Eb();if(typeof e==="string")e=pa(e);L=e;$(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||1;cb(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style","pointer-events: none");ta.push(this)});Ia();M("contextset",L)};this.clear=function(){La.clear();Ia();d.clearSvgContentElement();d.current_drawing_= l.setAttribute("style","pointer-events: inherit")}ta=[];Ia(true);M("contextset",null)}L=null},Kb=this.setContext=function(e){Eb();if(typeof e==="string")e=pa(e);L=e;$(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||1;cb(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style","pointer-events: none");ta.push(this)});Ia();M("contextset",L)};this.clear=function(){La.clear();Ia();d.clearSvgContentElement();d.current_drawing_=
new svgedit.draw.Drawing(m);d.createLayer("Layer 1");d.undoMgr.resetUndoStack();ra.initGroup();sa=ra.getRubberBandBox();M("cleared")};this.linkControlPoints=La.linkControlPoints;this.getContentElem=function(){return m};this.getRootElem=function(){return c};this.getSelectedElems=function(){return I};var zb=this.getResolution=function(){var e=m.getAttribute("width")/s,h=m.getAttribute("height")/s;return{w:e,h:h,zoom:s}};this.getZoom=function(){return s};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"}; new svgedit.draw.Drawing(m);d.createLayer("Layer 1");d.undoMgr.resetUndoStack();ra.initGroup();sa=ra.getRubberBandBox();M("cleared")};this.linkControlPoints=La.linkControlPoints;this.getContentElem=function(){return m};this.getRootElem=function(){return c};this.getSelectedElems=function(){return H};var zb=this.getResolution=function(){var e=m.getAttribute("width")/s,h=m.getAttribute("height")/s;return{w:e,h:h,zoom:s}};this.getZoom=function(){return s};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};
this.setUiStrings=function(e){$.extend(kb,e.notification)};this.setConfig=function(e){$.extend(p,e)};this.getTitle=function(e){if(e=e||I[0]){e=$(e).data("gsvg")||$(e).data("symbol")||e;e=e.childNodes;for(var h=0;h<e.length;h++)if(e[h].nodeName=="title")return e[h].textContent;return""}};this.setGroupTitle=function(e){var h=I[0];h=$(h).data("gsvg")||h;var l=$(h).children("title"),B=new Ca("Set Label");if(e.length)if(l.length){l=l[0];B.addSubCommand(new Ma(l,{"#text":l.textContent}));l.textContent= this.setUiStrings=function(e){$.extend(kb,e.notification)};this.setConfig=function(e){$.extend(p,e)};this.getTitle=function(e){if(e=e||H[0]){e=$(e).data("gsvg")||$(e).data("symbol")||e;e=e.childNodes;for(var h=0;h<e.length;h++)if(e[h].nodeName=="title")return e[h].textContent;return""}};this.setGroupTitle=function(e){var h=H[0];h=$(h).data("gsvg")||h;var l=$(h).children("title"),B=new Ca("Set Label");if(e.length)if(l.length){l=l[0];B.addSubCommand(new Ma(l,{"#text":l.textContent}));l.textContent=
e}else{l=f.createElementNS(b,"title");l.textContent=e;$(h).prepend(l);B.addSubCommand(new Ha(l))}else{B.addSubCommand(new Ga(l[0],l.nextSibling,h));l.remove()}wa(B)};this.getDocumentTitle=function(){return d.getTitle(m)};this.setDocumentTitle=function(e){for(var h=m.childNodes,l=false,B="",A=new Ca("Change Image Title"),G=0;G<h.length;G++)if(h[G].nodeName=="title"){l=h[G];B=l.textContent;break}if(!l){l=f.createElementNS(b,"title");m.insertBefore(l,m.firstChild)}if(e.length)l.textContent=e;else l.parentNode.removeChild(l); e}else{l=f.createElementNS(b,"title");l.textContent=e;$(h).prepend(l);B.addSubCommand(new Ha(l))}else{B.addSubCommand(new Ga(l[0],l.nextSibling,h));l.remove()}wa(B)};this.getDocumentTitle=function(){return d.getTitle(m)};this.setDocumentTitle=function(e){for(var h=m.childNodes,l=false,B="",A=new Ca("Change Image Title"),G=0;G<h.length;G++)if(h[G].nodeName=="title"){l=h[G];B=l.textContent;break}if(!l){l=f.createElementNS(b,"title");m.insertBefore(l,m.firstChild)}if(e.length)l.textContent=e;else l.parentNode.removeChild(l);
A.addSubCommand(new Ma(l,{"#text":B}));wa(A)};this.getEditorNS=function(e){e&&m.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(e,h){var l=zb(),B=l.w;l=l.h;var A;if(e=="fit"){var G=getStrokedBBox();if(G){A=new Ca("Fit Canvas to Content");var D=pb();qb(D);var z=[],F=[];$.each(D,function(){z.push(G.x*-1);F.push(G.y*-1)});D=d.moveSelectedElements(z,F,true);A.addSubCommand(D);Ia();e=Math.round(G.width);h=Math.round(G.height)}else return false}if(e!= A.addSubCommand(new Ma(l,{"#text":B}));wa(A)};this.getEditorNS=function(e){e&&m.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(e,h){var l=zb(),B=l.w;l=l.h;var A;if(e=="fit"){var G=getStrokedBBox();if(G){A=new Ca("Fit Canvas to Content");var D=pb();qb(D);var z=[],F=[];$.each(D,function(){z.push(G.x*-1);F.push(G.y*-1)});D=d.moveSelectedElements(z,F,true);A.addSubCommand(D);Ia();e=Math.round(G.width);h=Math.round(G.height)}else return false}if(e!=
B||h!=l){D=c.suspendRedraw(1E3);A||(A=new Ca("Change Image Dimensions"));e=Aa("width",e);h=Aa("height",h);m.setAttribute("width",e);m.setAttribute("height",h);this.contentW=e;this.contentH=h;A.addSubCommand(new Ma(m,{width:B,height:l}));m.setAttribute("viewBox",[0,0,e/s,h/s].join(" "));A.addSubCommand(new Ma(m,{viewBox:["0 0",B,l].join(" ")}));wa(A);c.unsuspendRedraw(D);if(background=document.getElementById("canvas_background")){background.setAttribute("x",-1);background.setAttribute("y",-1);background.setAttribute("width", B||h!=l){D=c.suspendRedraw(1E3);A||(A=new Ca("Change Image Dimensions"));e=Aa("width",e);h=Aa("height",h);m.setAttribute("width",e);m.setAttribute("height",h);this.contentW=e;this.contentH=h;A.addSubCommand(new Ma(m,{width:B,height:l}));m.setAttribute("viewBox",[0,0,e/s,h/s].join(" "));A.addSubCommand(new Ma(m,{viewBox:["0 0",B,l].join(" ")}));wa(A);c.unsuspendRedraw(D);if(background=document.getElementById("canvas_background")){background.setAttribute("x",-1);background.setAttribute("y",-1);background.setAttribute("width",
e+2);background.setAttribute("height",h+2)}M("changed",[m])}return[e,h]};this.getOffset=function(){return $(m).attr(["x","y"])};this.setBBoxZoom=function(e,h,l){var B=0.85,A=function(G){if(!G)return false;var D=Math.min(Math.round(h/G.width*100*B)/100,Math.round(l/G.height*100*B)/100);d.setZoom(D);return{zoom:D,bbox:G}};if(typeof e=="object"){e=e;if(e.width==0||e.height==0){d.setZoom(e.zoom?e.zoom:s*e.factor);return{zoom:s,bbox:e}}return A(e)}switch(e){case "selection":if(!I[0])return;e=$.map(I,function(G){if(G)return G}); e+2);background.setAttribute("height",h+2)}M("changed",[m])}return[e,h]};this.getOffset=function(){return $(m).attr(["x","y"])};this.setBBoxZoom=function(e,h,l){var B=0.85,A=function(G){if(!G)return false;var D=Math.min(Math.round(h/G.width*100*B)/100,Math.round(l/G.height*100*B)/100);d.setZoom(D);return{zoom:D,bbox:G}};if(typeof e=="object"){e=e;if(e.width==0||e.height==0){d.setZoom(e.zoom?e.zoom:s*e.factor);return{zoom:s,bbox:e}}return A(e)}switch(e){case "selection":if(!H[0])return;e=$.map(H,function(G){if(G)return G});
e=getStrokedBBox(e);break;case "canvas":e=zb();B=0.95;e={width:e.w,height:e.h,x:0,y:0};break;case "content":e=getStrokedBBox();break;case "layer":e=getStrokedBBox(pb(C().getCurrentLayer()));break;default:return}return A(e)};this.setZoom=function(e){var h=zb();m.setAttribute("viewBox","0 0 "+h.w/e+" "+h.h/e);s=e;$.each(I,function(l,B){B&&ra.requestSelector(B).resize()});La.zoomChange();ib("zoomChanged",e)};this.getMode=function(){return Fa};this.setMode=function(e){La.clear(true);bb.clear();$("#workarea").attr("class", e=getStrokedBBox(e);break;case "canvas":e=zb();B=0.95;e={width:e.w,height:e.h,x:0,y:0};break;case "content":e=getStrokedBBox();break;case "layer":e=getStrokedBBox(pb(C().getCurrentLayer()));break;default:return}return A(e)};this.setZoom=function(e){var h=zb();m.setAttribute("viewBox","0 0 "+h.w/e+" "+h.h/e);s=e;$.each(H,function(l,B){B&&ra.requestSelector(B).resize()});La.zoomChange();ib("zoomChanged",e)};this.getMode=function(){return Fa};this.setMode=function(e){La.clear(true);bb.clear();$("#workarea").attr("class",
e);Xa=I[0]&&I[0].nodeName=="text"?Ua:K;Fa=e};this.getColor=function(e){return Xa[e]};this.setColor=function(e,h,l){K[e]=h;Xa[e+"_paint"]={type:"solidColor"};for(var B=[],A=I.length;A--;){var G=I[A];if(G)if(G.tagName=="g")svgedit.utilities.walkTree(G,function(D){D.nodeName!="g"&&B.push(D)});else if(e=="fill")G.tagName!="polyline"&&G.tagName!="line"&&B.push(G);else B.push(G)}if(B.length>0)if(l)Ab(e,h,B);else{Ya(e,h,B);M("changed",B)}};var gb=function(){var e=m.getElementsByTagNameNS(b,"defs");if(e.length> e);Xa=H[0]&&H[0].nodeName=="text"?Ua:K;Fa=e};this.getColor=function(e){return Xa[e]};this.setColor=function(e,h,l){K[e]=h;Xa[e+"_paint"]={type:"solidColor"};for(var B=[],A=H.length;A--;){var G=H[A];if(G)if(G.tagName=="g")svgedit.utilities.walkTree(G,function(D){D.nodeName!="g"&&B.push(D)});else if(e=="fill")G.tagName!="polyline"&&G.tagName!="line"&&B.push(G);else B.push(G)}if(B.length>0)if(l)Ab(e,h,B);else{Ya(e,h,B);M("changed",B)}};var gb=function(){var e=m.getElementsByTagNameNS(b,"defs");if(e.length>
0)e=e[0];else{e=f.createElementNS(b,"defs");m.firstChild?m.insertBefore(e,m.firstChild.nextSibling):m.appendChild(e)}return e},Nb=this.setGradient=function(e){if(!(!Xa[e+"_paint"]||Xa[e+"_paint"].type=="solidColor")){var h=d[e+"Grad"],l=Mb(h),B=gb();if(l)h=l;else{h=B.appendChild(f.importNode(h,true));h.id=ka()}d.setColor(e,"url(#"+h.id+")");if(e=="canvas")(e=document.getElementById("canvas_background"))&&e.setAttribute("fill","url(#"+h.id+")")}},Mb=function(e){var h=gb();h=$(h).find("linearGradient, radialGradient"); 0)e=e[0];else{e=f.createElementNS(b,"defs");m.firstChild?m.insertBefore(e,m.firstChild.nextSibling):m.appendChild(e)}return e},Nb=this.setGradient=function(e){if(!(!Xa[e+"_paint"]||Xa[e+"_paint"].type=="solidColor")){var h=d[e+"Grad"],l=Mb(h),B=gb();if(l)h=l;else{h=B.appendChild(f.importNode(h,true));h.id=ka()}d.setColor(e,"url(#"+h.id+")");if(e=="canvas")(e=document.getElementById("canvas_background"))&&e.setAttribute("fill","url(#"+h.id+")")}},Mb=function(e){var h=gb();h=$(h).find("linearGradient, radialGradient");
for(var l=h.length,B=["r","cx","cy","fx","fy"];l--;){var A=h[l];if(e.tagName=="linearGradient"){if(e.getAttribute("x1")!=A.getAttribute("x1")||e.getAttribute("y1")!=A.getAttribute("y1")||e.getAttribute("x2")!=A.getAttribute("x2")||e.getAttribute("y2")!=A.getAttribute("y2"))continue}else{var G=$(e).attr(B),D=$(A).attr(B),z=false;$.each(B,function(E,H){if(G[H]!=D[H])z=true});if(z)continue}var F=e.getElementsByTagNameNS(b,"stop"),k=A.getElementsByTagNameNS(b,"stop");if(F.length==k.length){for(var n= for(var l=h.length,B=["r","cx","cy","fx","fy"];l--;){var A=h[l];if(e.tagName=="linearGradient"){if(e.getAttribute("x1")!=A.getAttribute("x1")||e.getAttribute("y1")!=A.getAttribute("y1")||e.getAttribute("x2")!=A.getAttribute("x2")||e.getAttribute("y2")!=A.getAttribute("y2"))continue}else{var G=$(e).attr(B),D=$(A).attr(B),z=false;$.each(B,function(E,I){if(G[I]!=D[I])z=true});if(z)continue}var F=e.getElementsByTagNameNS(b,"stop"),k=A.getElementsByTagNameNS(b,"stop");if(F.length==k.length){for(var n=
F.length;n--;){var o=F[n],w=k[n];if(o.getAttribute("offset")!=w.getAttribute("offset")||o.getAttribute("stop-opacity")!=w.getAttribute("stop-opacity")||o.getAttribute("stop-color")!=w.getAttribute("stop-color"))break}if(n==-1)return A}}return null};this.setPaint=function(e,h){var l=new $.jGraduate.Paint(h);this.setPaintOpacity(e,l.alpha/100,true);Xa[e+"_paint"]=l;switch(l.type){case "solidColor":if(l.solidColor!="none"&&l.solidColor!="#none")this.setColor(e,"#"+l.solidColor);else{this.setColor(e, F.length;n--;){var o=F[n],w=k[n];if(o.getAttribute("offset")!=w.getAttribute("offset")||o.getAttribute("stop-opacity")!=w.getAttribute("stop-opacity")||o.getAttribute("stop-color")!=w.getAttribute("stop-color"))break}if(n==-1)return A}}return null};this.setPaint=function(e,h){var l=new $.jGraduate.Paint(h);this.setPaintOpacity(e,l.alpha/100,true);Xa[e+"_paint"]=l;switch(l.type){case "solidColor":if(l.solidColor!="none"&&l.solidColor!="#none")this.setColor(e,"#"+l.solidColor);else{this.setColor(e,
"none");document.querySelector(e=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","none")}break;case "linearGradient":case "radialGradient":d[e+"Grad"]=l[l.type];Nb(e)}};this.getStrokeWidth=function(){return Xa.stroke_width};this.setStrokeWidth=function(e){if(e==0&&["line","path"].indexOf(Fa)>=0)d.setStrokeWidth(1);else{Xa.stroke_width=e;for(var h=[],l=I.length;l--;){var B=I[l];if(B)B.tagName=="g"?svgedit.utilities.walkTree(B,function(A){A.nodeName!="g"&&h.push(A)}):h.push(B)}if(h.length> "none");document.querySelector(e=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","none")}break;case "linearGradient":case "radialGradient":d[e+"Grad"]=l[l.type];Nb(e)}};this.getStrokeWidth=function(){return Xa.stroke_width};this.setStrokeWidth=function(e){if(e==0&&["line","path"].indexOf(Fa)>=0)d.setStrokeWidth(1);else{Xa.stroke_width=e;for(var h=[],l=H.length;l--;){var B=H[l];if(B)B.tagName=="g"?svgedit.utilities.walkTree(B,function(A){A.nodeName!="g"&&h.push(A)}):h.push(B)}if(h.length>
0){Ya("stroke-width",e,h);M("changed",I)}}};this.setStrokeAttr=function(e,h){K[e.replace("-","_")]=h;for(var l=[],B=I.length;B--;){var A=I[B];if(A)A.tagName=="g"?svgedit.utilities.walkTree(A,function(G){G.nodeName!="g"&&l.push(G)}):l.push(A)}if(l.length>0){Ya(e,h,l);M("changed",I)}};this.getStyle=function(){return K};this.getOpacity=function(){return K.opacity};this.setOpacity=function(e){K.opacity=e;Ya("opacity",e)};this.getFillOpacity=function(){return K.fill_opacity};this.getStrokeOpacity=function(){return K.stroke_opacity}; 0){Ya("stroke-width",e,h);M("changed",H)}}};this.setStrokeAttr=function(e,h){K[e.replace("-","_")]=h;for(var l=[],B=H.length;B--;){var A=H[B];if(A)A.tagName=="g"?svgedit.utilities.walkTree(A,function(G){G.nodeName!="g"&&l.push(G)}):l.push(A)}if(l.length>0){Ya(e,h,l);M("changed",H)}};this.getStyle=function(){return K};this.getOpacity=function(){return K.opacity};this.setOpacity=function(e){K.opacity=e;Ya("opacity",e)};this.getFillOpacity=function(){return K.fill_opacity};this.getStrokeOpacity=function(){return K.stroke_opacity};
this.setPaintOpacity=function(e,h,l){K[e+"_opacity"]=h;l?Ab(e+"-opacity",h):Ya(e+"-opacity",h)};this.getBlur=function(e){var h=0;if(e)if(e.getAttribute("filter"))if(e=pa(e.id+"_blur"))h=e.firstChild.getAttribute("stdDeviation");return h};(function(){function e(){var A=d.undoMgr.finishUndoableChange();h.addSubCommand(A);wa(h);l=h=null}var h=null,l=null,B=false;d.setBlurNoUndo=function(A){if(l)if(A===0){Ab("filter","");B=true}else{var G=I[0];B&&Ab("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter"); this.setPaintOpacity=function(e,h,l){K[e+"_opacity"]=h;l?Ab(e+"-opacity",h):Ya(e+"-opacity",h)};this.getBlur=function(e){var h=0;if(e)if(e.getAttribute("filter"))if(e=pa(e.id+"_blur"))h=e.firstChild.getAttribute("stdDeviation");return h};(function(){function e(){var A=d.undoMgr.finishUndoableChange();h.addSubCommand(A);wa(h);l=h=null}var h=null,l=null,B=false;d.setBlurNoUndo=function(A){if(l)if(A===0){Ab("filter","");B=true}else{var G=H[0];B&&Ab("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter");
G.setAttribute("filter","url(#"+G.id+"_blur)")}Ab("stdDeviation",A,[l.firstChild]);d.setBlurOffsets(l,A)}else d.setBlur(A)};d.setBlurOffsets=function(A,G){if(G>3)ma(A,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){A.removeAttribute("x");A.removeAttribute("y");A.removeAttribute("width");A.removeAttribute("height")}};d.setBlur=function(A,G){if(h)e();else{var D=I[0],z=D.id;l=pa(z+"_blur");A-=0;var F=new Ca;if(l){if(A===0)l=null}else{var k=Q({element:"feGaussianBlur", G.setAttribute("filter","url(#"+G.id+"_blur)")}Ab("stdDeviation",A,[l.firstChild]);d.setBlurOffsets(l,A)}else d.setBlur(A)};d.setBlurOffsets=function(A,G){if(G>3)ma(A,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){A.removeAttribute("x");A.removeAttribute("y");A.removeAttribute("width");A.removeAttribute("height")}};d.setBlur=function(A,G){if(h)e();else{var D=H[0],z=D.id;l=pa(z+"_blur");A-=0;var F=new Ca;if(l){if(A===0)l=null}else{var k=S({element:"feGaussianBlur",
attr:{"in":"SourceGraphic",stdDeviation:A}});l=Q({element:"filter",attr:{id:z+"_blur"}});l.appendChild(k);gb().appendChild(l);F.addSubCommand(new Ha(l))}k={filter:D.getAttribute("filter")};if(A===0){D.removeAttribute("filter");F.addSubCommand(new Ma(D,k))}else{Ya("filter","url(#"+z+"_blur)");F.addSubCommand(new Ma(D,k));d.setBlurOffsets(l,A);h=F;d.undoMgr.beginUndoableChange("stdDeviation",[l?l.firstChild:null]);if(G){d.setBlurNoUndo(A);e()}}}}})();this.getBold=function(){var e=I[0];if(e!=null&&e.tagName== attr:{"in":"SourceGraphic",stdDeviation:A}});l=S({element:"filter",attr:{id:z+"_blur"}});l.appendChild(k);gb().appendChild(l);F.addSubCommand(new Ha(l))}k={filter:D.getAttribute("filter")};if(A===0){D.removeAttribute("filter");F.addSubCommand(new Ma(D,k))}else{Ya("filter","url(#"+z+"_blur)");F.addSubCommand(new Ma(D,k));d.setBlurOffsets(l,A);h=F;d.undoMgr.beginUndoableChange("stdDeviation",[l?l.firstChild:null]);if(G){d.setBlurNoUndo(A);e()}}}}})();this.getBold=function(){var e=H[0];if(e!=null&&e.tagName==
"text"&&I[1]==null)return e.getAttribute("font-weight")=="bold";return false};this.setBold=function(e){var h=I[0];if(h!=null&&h.tagName=="text"&&I[1]==null)Ya("font-weight",e?"bold":"normal");I[0].textContent||bb.setCursor()};this.getItalic=function(){var e=I[0];if(e!=null&&e.tagName=="text"&&I[1]==null)return e.getAttribute("font-style")=="italic";return false};this.setItalic=function(e){var h=I[0];if(h!=null&&h.tagName=="text"&&I[1]==null)Ya("font-style",e?"italic":"normal");I[0].textContent||bb.setCursor()}; "text"&&H[1]==null)return e.getAttribute("font-weight")=="bold";return false};this.setBold=function(e){var h=H[0];if(h!=null&&h.tagName=="text"&&H[1]==null)Ya("font-weight",e?"bold":"normal");H[0].textContent||bb.setCursor()};this.getItalic=function(){var e=H[0];if(e!=null&&e.tagName=="text"&&H[1]==null)return e.getAttribute("font-style")=="italic";return false};this.setItalic=function(e){var h=H[0];if(h!=null&&h.tagName=="text"&&H[1]==null)Ya("font-style",e?"italic":"normal");H[0].textContent||bb.setCursor()};
this.getFontFamily=function(){return Ua.font_family};this.setFontFamily=function(e){Ua.font_family=e;Ya("font-family",e);I[0]&&!I[0].textContent&&bb.setCursor()};this.setFontColor=function(e){Ua.fill=e;Ya("fill",e)};this.getFontSize=function(){return Ua.fill};this.getFontSize=function(){return Ua.font_size};this.setFontSize=function(e){Ua.font_size=e;Ya("font-size",e);I[0].textContent||bb.setCursor()};this.getText=function(){var e=I[0];if(e==null)return"";return e.textContent};this.setTextContent= this.getFontFamily=function(){return Ua.font_family};this.setFontFamily=function(e){Ua.font_family=e;Ya("font-family",e);H[0]&&!H[0].textContent&&bb.setCursor()};this.setFontColor=function(e){Ua.fill=e;Ya("fill",e)};this.getFontSize=function(){return Ua.fill};this.getFontSize=function(){return Ua.font_size};this.setFontSize=function(e){Ua.font_size=e;Ya("font-size",e);H[0].textContent||bb.setCursor()};this.getText=function(){var e=H[0];if(e==null)return"";return e.textContent};this.setTextContent=
function(e){Ya("#text",e);bb.init(e);bb.setCursor()};this.setImageURL=function(e){var h=I[0];if(h){var l=$(h).attr(["width","height"]);l=!l.width||!l.height;var B=ba(h);if(B!==e)l=true;else if(!l)return;var A=new Ca("Change Image URL");T(h,e);A.addSubCommand(new Ma(h,{"#href":B}));l?$(new Image).load(function(){var G=$(h).attr(["width","height"]);$(h).attr({width:this.width,height:this.height});ra.requestSelector(h).resize();A.addSubCommand(new Ma(h,G));wa(A);M("changed",[h])}).attr("src",e):wa(A)}}; function(e){Ya("#text",e);bb.init(e);bb.setCursor()};this.setImageURL=function(e){var h=H[0];if(h){var l=$(h).attr(["width","height"]);l=!l.width||!l.height;var B=ba(h);if(B!==e)l=true;else if(!l)return;var A=new Ca("Change Image URL");T(h,e);A.addSubCommand(new Ma(h,{"#href":B}));l?$(new Image).load(function(){var G=$(h).attr(["width","height"]);$(h).attr({width:this.width,height:this.height});ra.requestSelector(h).resize();A.addSubCommand(new Ma(h,G));wa(A);M("changed",[h])}).attr("src",e):wa(A)}};
this.setLinkURL=function(e){var h=I[0];if(h){if(h.tagName!=="a"){h=$(h).parents("a");if(h.length)h=h[0];else return}var l=ba(h);if(l!==e){var B=new Ca("Change Link URL");T(h,e);B.addSubCommand(new Ma(h,{"#href":l}));wa(B)}}};this.elementsAreSame=function(e){return!e.length||e[0]==null?null:I.every(function(h){return h&&I[0]?h.nodeName==I[0].nodeName:null})};this.setRectRadius=function(e){d.elementsAreSame(I)&&I[0].tagName=="rect"&&I.forEach(function(h){var l=h.getAttribute("rx");if(l!=e){h.setAttribute("rx", this.setLinkURL=function(e){var h=H[0];if(h){if(h.tagName!=="a"){h=$(h).parents("a");if(h.length)h=h[0];else return}var l=ba(h);if(l!==e){var B=new Ca("Change Link URL");T(h,e);B.addSubCommand(new Ma(h,{"#href":l}));wa(B)}}};this.elementsAreSame=function(e){return!e.length||e[0]==null?null:H.every(function(h){return h&&H[0]?h.nodeName==H[0].nodeName:null})};this.setRectRadius=function(e){d.elementsAreSame(H)&&H[0].tagName=="rect"&&H.forEach(function(h){var l=h.getAttribute("rx");if(l!=e){h.setAttribute("rx",
e);h.setAttribute("ry",e);wa(new Ma(h,{rx:l,ry:l},"Radius"));M("changed",[h])}})};this.makeHyperlink=function(e){d.groupSelectedElements("a",e)};this.removeHyperlink=function(){d.ungroupSelectedElement()};this.setSegType=function(e){La.setSegType(e)};this.convertToPath=function(e,h){if(e==null)$.each(I,function(da,V){V&&d.convertToPath(V)});else{if(!h)var l=new Ca("Convert element to Path");var B=h?{}:{fill:K.fill,"fill-opacity":K.fill_opacity,stroke:K.stroke,"stroke-width":K.stroke_width,"stroke-dasharray":K.stroke_dasharray, e);h.setAttribute("ry",e);wa(new Ma(h,{rx:l,ry:l},"Radius"));M("changed",[h])}})};this.makeHyperlink=function(e){d.groupSelectedElements("a",e)};this.removeHyperlink=function(){d.ungroupSelectedElement()};this.setSegType=function(e){La.setSegType(e)};this.convertToPath=function(e,h){if(e==null)$.each(H,function(da,V){V&&d.convertToPath(V)});else{if(!h)var l=new Ca("Convert element to Path");var B=h?{}:{fill:K.fill,"fill-opacity":K.fill_opacity,stroke:K.stroke,"stroke-width":K.stroke_width,"stroke-dasharray":K.stroke_dasharray,
"stroke-linejoin":K.stroke_linejoin,"stroke-linecap":K.stroke_linecap,"stroke-opacity":K.stroke_opacity,opacity:K.opacity,visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(e.getAttribute(this))B[this]=e.getAttribute(this)});var A=Q({element:"path",attr:B}),G=e.getAttribute("transform");G&&A.setAttribute("transform",G);var D=e.id,z=e.parentNode;e.nextSibling?z.insertBefore(A,e):z.appendChild(A);var F="",k=function(da){$.each(da,function(V,fa){var ha= "stroke-linejoin":K.stroke_linejoin,"stroke-linecap":K.stroke_linecap,"stroke-opacity":K.stroke_opacity,opacity:K.opacity,visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(e.getAttribute(this))B[this]=e.getAttribute(this)});var A=S({element:"path",attr:B}),G=e.getAttribute("transform");G&&A.setAttribute("transform",G);var D=e.id,z=e.parentNode;e.nextSibling?z.insertBefore(A,e):z.appendChild(A);var F="",k=function(da){$.each(da,function(V,fa){var ha=
fa[1];F+=fa[0];for(var W=0;W<ha.length;W+=2)F+=ha[W]+","+ha[W+1]+" "})},n=1.81;switch(e.tagName){case "ellipse":case "circle":var o=$(e).attr(["rx","ry","cx","cy"]),w=o.cx,E=o.cy,H=o.rx;o=o.ry;if(e.tagName=="circle")H=o=$(e).attr("r");k([["M",[w-H,E]],["C",[w-H,E-o/n,w-H/n,E-o,w,E-o]],["C",[w+H/n,E-o,w+H,E-o/n,w+H,E]],["C",[w+H,E+o/n,w+H/n,E+o,w,E+o]],["C",[w-H/n,E+o,w-H,E+o/n,w-H,E]],["Z",[]]]);break;case "path":F=e.getAttribute("d");break;case "line":o=$(e).attr(["x1","y1","x2","y2"]);F="M"+o.x1+ fa[1];F+=fa[0];for(var W=0;W<ha.length;W+=2)F+=ha[W]+","+ha[W+1]+" "})},n=1.81;switch(e.tagName){case "ellipse":case "circle":var o=$(e).attr(["rx","ry","cx","cy"]),w=o.cx,E=o.cy,I=o.rx;o=o.ry;if(e.tagName=="circle")I=o=$(e).attr("r");k([["M",[w-I,E]],["C",[w-I,E-o/n,w-I/n,E-o,w,E-o]],["C",[w+I/n,E-o,w+I,E-o/n,w+I,E]],["C",[w+I,E+o/n,w+I/n,E+o,w,E+o]],["C",[w-I/n,E+o,w-I,E+o/n,w-I,E]],["Z",[]]]);break;case "path":F=e.getAttribute("d");break;case "line":o=$(e).attr(["x1","y1","x2","y2"]);F="M"+o.x1+
","+o.y1+"L"+o.x2+","+o.y2;break;case "polyline":case "polygon":F="M"+e.getAttribute("points");break;case "rect":o=$(e).attr(["rx","ry"]);H=o.rx;o=o.ry;var J=e.getBBox();w=J.x;E=J.y;var O=J.width;J=J.height;n=4-n;if(!H&&!o)k([["M",[w,E]],["L",[w+O,E]],["L",[w+O,E+J]],["L",[w,E+J]],["L",[w,E]],["Z",[]]]);else{o||(o=H);k([["M",[w,E+o]],["C",[w,E+o/n,w+H/n,E,w+H,E]],["L",[w+O-H,E]],["C",[w+O-H/n,E,w+O,E+o/n,w+O,E+o]],["L",[w+O,E+J-o]],["C",[w+O,E+J-o/n,w+O-H/n,E+J,w+O-H,E+J]],["L",[w+H,E+J]],["C",[w+ ","+o.y1+"L"+o.x2+","+o.y2;break;case "polyline":case "polygon":F="M"+e.getAttribute("points");break;case "rect":o=$(e).attr(["rx","ry"]);I=o.rx;o=o.ry;var J=e.getBBox();w=J.x;E=J.y;var O=J.width;J=J.height;n=4-n;if(!I&&!o)k([["M",[w,E]],["L",[w+O,E]],["L",[w+O,E+J]],["L",[w,E+J]],["L",[w,E]],["Z",[]]]);else{o||(o=I);k([["M",[w,E+o]],["C",[w,E+o/n,w+I/n,E,w+I,E]],["L",[w+O-I,E]],["C",[w+O-I/n,E,w+O,E+o/n,w+O,E+o]],["L",[w+O,E+J-o]],["C",[w+O,E+J-o/n,w+O-I/n,E+J,w+O-I,E+J]],["L",[w+I,E+J]],["C",[w+
H/n,E+J,w,E+J-o/n,w,E+J-o]],["L",[w,E+o]],["Z",[]]])}break;default:A.parentNode.removeChild(A)}F&&A.setAttribute("d",F);if(h){La.resetOrientation(A);l=false;try{l=A.getBBox()}catch(Y){}A.parentNode.removeChild(A);return l}else{if(G){G=S(A);na(G)&&La.resetOrientation(A)}l.addSubCommand(new Ga(e,e.nextSibling,z));l.addSubCommand(new Ha(A));Ia();e.parentNode.removeChild(e);A.setAttribute("id",D);A.removeAttribute("visibility");qb([A],true);wa(l)}}};var Ab=this.changeSelectedAttributeNoUndo=function(e, I/n,E+J,w,E+J-o/n,w,E+J-o]],["L",[w,E+o]],["Z",[]]])}break;default:A.parentNode.removeChild(A)}F&&A.setAttribute("d",F);if(h){La.resetOrientation(A);l=false;try{l=A.getBBox()}catch(Y){}A.parentNode.removeChild(A);return l}else{if(G){G=R(A);oa(G)&&La.resetOrientation(A)}l.addSubCommand(new Ga(e,e.nextSibling,z));l.addSubCommand(new Ha(A));Ia();e.parentNode.removeChild(e);A.setAttribute("id",D);A.removeAttribute("visibility");qb([A],true);wa(l)}}};var Ab=this.changeSelectedAttributeNoUndo=function(e,
h,l){var B=c.suspendRedraw(1E3);Fa=="pathedit"&&La.moveNode(e,h);l=l||I;for(var A=l.length,G=["g","polyline","path"];A--;){var D=l[A];if(D!=null){Fa==="textedit"&&e!=="#text"&&D.textContent.length&&bb.toSelectMode(D);if((e==="x"||e==="y")&&G.indexOf(D.tagName)>=0){var z=getStrokedBBox([D]);d.moveSelectedElements((e==="x"?h-z.x:0)*s,(e==="y"?h-z.y:0)*s,true)}else{z=e==="#text"?D.textContent:D.getAttribute(e);if(z==null)z="";if(z!==String(h)){if(e=="#text"){svgedit.utilities.getBBox(D);D.textContent= h,l){var B=c.suspendRedraw(1E3);Fa=="pathedit"&&La.moveNode(e,h);l=l||H;for(var A=l.length,G=["g","polyline","path"];A--;){var D=l[A];if(D!=null){Fa==="textedit"&&e!=="#text"&&D.textContent.length&&bb.toSelectMode(D);if((e==="x"||e==="y")&&G.indexOf(D.tagName)>=0){var z=getStrokedBBox([D]);d.moveSelectedElements((e==="x"?h-z.x:0)*s,(e==="y"?h-z.y:0)*s,true)}else{z=e==="#text"?D.textContent:D.getAttribute(e);if(z==null)z="";if(z!==String(h)){if(e=="#text"){svgedit.utilities.getBBox(D);D.textContent=
h}else e=="#href"?T(D,h):D.setAttribute(e,h);I.indexOf(D)>=0&&setTimeout(function(){D.parentNode&&ra.requestSelector(D).resize()},0);z=oa(D);if(z!=0&&e!="transform")for(var F=S(D),k=F.numberOfItems;k--;)if(F.getItem(k).type==4){F.removeItem(k);var n=svgedit.utilities.getBBox(D),o=N(n.x+n.width/2,n.y+n.height/2,X(F).matrix);n=o.x;o=o.y;var w=c.createSVGTransform();w.setRotate(z,n,o);F.insertItemBefore(w,k);break}}}}}c.unsuspendRedraw(B)},Ya=this.changeSelectedAttribute=function(e,h,l){l=l||I;d.undoMgr.beginUndoableChange(e, h}else e=="#href"?T(D,h):D.setAttribute(e,h);H.indexOf(D)>=0&&setTimeout(function(){D.parentNode&&ra.requestSelector(D).resize()},0);z=na(D);if(z!=0&&e!="transform")for(var F=R(D),k=F.numberOfItems;k--;)if(F.getItem(k).type==4){F.removeItem(k);var n=svgedit.utilities.getBBox(D),o=N(n.x+n.width/2,n.y+n.height/2,X(F).matrix);n=o.x;o=o.y;var w=c.createSVGTransform();w.setRotate(z,n,o);F.insertItemBefore(w,k);break}}}}}c.unsuspendRedraw(B)},Ya=this.changeSelectedAttribute=function(e,h,l){l=l||H;d.undoMgr.beginUndoableChange(e,
l);Ab(e,h,l);e=d.undoMgr.finishUndoableChange();e.isEmpty()||wa(e)};this.deleteSelectedElements=function(){for(var e=new Ca("Delete Elements"),h=I.length,l=[],B=0;B<h;++B){var A=I[B];if(A==null)break;var G=A.parentNode,D=A;ra.releaseSelector(D);svgedit.path.removePath_(D.id);if(G.tagName==="a"&&G.childNodes.length===1){D=G;G=G.parentNode}var z=D.nextSibling;D=G.removeChild(D);l.push(A);I[B]=null;e.addSubCommand(new Ga(D,z,G))}e.isEmpty()||wa(e);M("changed",l);Ia()};this.cutSelectedElements=function(){for(var e= l);Ab(e,h,l);e=d.undoMgr.finishUndoableChange();e.isEmpty()||wa(e)};this.deleteSelectedElements=function(){for(var e=new Ca("Delete Elements"),h=H.length,l=[],B=0;B<h;++B){var A=H[B];if(A==null)break;var G=A.parentNode,D=A;ra.releaseSelector(D);svgedit.path.removePath_(D.id);if(G.tagName==="a"&&G.childNodes.length===1){D=G;G=G.parentNode}var z=D.nextSibling;D=G.removeChild(D);l.push(A);H[B]=null;e.addSubCommand(new Ga(D,z,G))}e.isEmpty()||wa(e);M("changed",l);Ia()};this.cutSelectedElements=function(){for(var e=
new Ca("Cut Elements"),h=I.length,l=[],B=0;B<h;++B){var A=I[B];if(A==null)break;var G=A.parentNode,D=A;ra.releaseSelector(D);svgedit.path.removePath_(D.id);var z=D.nextSibling;D=G.removeChild(D);l.push(A);I[B]=null;e.addSubCommand(new Ga(D,z,G))}e.isEmpty()||wa(e);M("changed",l);Ia();d.clipBoard=l};this.copySelectedElements=function(){d.clipBoard=$.merge([],I)};this.pasteElements=function(){var e=d.clipBoard,h=e.length;if(h){for(var l=[],B=new Ca("Paste elements");h--;){var A=e[h];if(A){var G=ia(A); new Ca("Cut Elements"),h=H.length,l=[],B=0;B<h;++B){var A=H[B];if(A==null)break;var G=A.parentNode,D=A;ra.releaseSelector(D);svgedit.path.removePath_(D.id);var z=D.nextSibling;D=G.removeChild(D);l.push(A);H[B]=null;e.addSubCommand(new Ga(D,z,G))}e.isEmpty()||wa(e);M("changed",l);Ia();d.clipBoard=l};this.copySelectedElements=function(){d.clipBoard=$.merge([],H)};this.pasteElements=function(){var e=d.clipBoard,h=e.length;if(h){for(var l=[],B=new Ca("Paste elements");h--;){var A=e[h];if(A){var G=ia(A);
if(!pa(A.id))G.id=A.id;l.push(G);(L||C().getCurrentLayer()).appendChild(G);B.addSubCommand(new Ha(G))}}svgCanvas.clearSelection();setTimeout(function(){rb(l)},100);wa(B);M("changed",l)}};this.groupSelectedElements=function(e){e||(e="g");var h="";switch(e){case "a":h="Make hyperlink";var l="";if(arguments.length>1)l=arguments[1];break;default:e="g";h="Group Elements"}h=new Ca(h);var B=Q({element:e,attr:{id:ka()}});e==="a"&&T(B,l);h.addSubCommand(new Ha(B));for(l=I.length;l--;){var A=I[l];if(A!=null){if(A.parentNode.tagName=== if(!pa(A.id))G.id=A.id;l.push(G);(L||C().getCurrentLayer()).appendChild(G);B.addSubCommand(new Ha(G))}}svgCanvas.clearSelection();setTimeout(function(){rb(l)},100);wa(B);M("changed",l)}};this.groupSelectedElements=function(e){e||(e="g");var h="";switch(e){case "a":h="Make hyperlink";var l="";if(arguments.length>1)l=arguments[1];break;default:e="g";h="Group Elements"}h=new Ca(h);var B=S({element:e,attr:{id:ka()}});e==="a"&&T(B,l);h.addSubCommand(new Ha(B));for(l=H.length;l--;){var A=H[l];if(A!=null){if(A.parentNode.tagName===
"a"&&A.parentNode.childNodes.length===1)A=A.parentNode;var G=A.nextSibling,D=A.parentNode;B.appendChild(A);h.addSubCommand(new Ja(A,G,D))}}h.isEmpty()||wa(h);rb([B],true)};var Db=this.pushGroupProperties=function(e,h){var l=e.childNodes,B=l.length,A=e.getAttribute("transform"),G=S(e),D=X(G).matrix,z=new Ca("Push group properties"),F=0,k=oa(e),n=$(e).attr(["filter","opacity"]),o,w;for(F=0;F<B;F++){var E=l[F];if(E.nodeType===1){if(n.opacity!==null&&n.opacity!==1){E.getAttribute("opacity");var H=Math.round((E.getAttribute("opacity")|| "a"&&A.parentNode.childNodes.length===1)A=A.parentNode;var G=A.nextSibling,D=A.parentNode;B.appendChild(A);h.addSubCommand(new Ja(A,G,D))}}h.isEmpty()||wa(h);rb([B],true)};var Db=this.pushGroupProperties=function(e,h){var l=e.childNodes,B=l.length,A=e.getAttribute("transform"),G=R(e),D=X(G).matrix,z=new Ca("Push group properties"),F=0,k=na(e),n=$(e).attr(["filter","opacity"]),o,w;for(F=0;F<B;F++){var E=l[F];if(E.nodeType===1){if(n.opacity!==null&&n.opacity!==1){E.getAttribute("opacity");var I=Math.round((E.getAttribute("opacity")||
1)*n.opacity*100)/100;Ya("opacity",H,[E])}if(n.filter){var J=H=this.getBlur(E);w||(w=this.getBlur(e));if(H)H=w-0+(H-0);else if(H===0)H=w;if(J)o=P(E.getAttribute("filter"));else if(o){o=ia(o);gb().appendChild(o)}else o=P(n.filter);o.id=E.id+"_"+(o.firstChild.tagName==="feGaussianBlur"?"blur":"filter");Ya("filter","url(#"+o.id+")",[E]);if(H){Ya("stdDeviation",H,[o.firstChild]);d.setBlurOffsets(o,H)}}H=S(E);if(~E.tagName.indexOf("Gradient"))H=null;if(H)if(E.tagName!=="defs")if(G.numberOfItems){if(k&& 1)*n.opacity*100)/100;Ya("opacity",I,[E])}if(n.filter){var J=I=this.getBlur(E);w||(w=this.getBlur(e));if(I)I=w-0+(I-0);else if(I===0)I=w;if(J)o=P(E.getAttribute("filter"));else if(o){o=ia(o);gb().appendChild(o)}else o=P(n.filter);o.id=E.id+"_"+(o.firstChild.tagName==="feGaussianBlur"?"blur":"filter");Ya("filter","url(#"+o.id+")",[E]);if(I){Ya("stdDeviation",I,[o.firstChild]);d.setBlurOffsets(o,I)}}I=R(E);if(~E.tagName.indexOf("Gradient"))I=null;if(I)if(E.tagName!=="defs")if(G.numberOfItems){if(k&&
G.numberOfItems==1){var O=G.getItem(0).matrix,Y=c.createSVGMatrix();if(J=oa(E))Y=H.getItem(0).matrix;var da=svgedit.utilities.getBBox(E),V=X(H).matrix,fa=N(da.x+da.width/2,da.y+da.height/2,V);da=k+J;V=c.createSVGTransform();V.setRotate(da,fa.x,fa.y);O=ga(O,Y,V.matrix.inverse());J&&H.removeItem(0);if(da)H.numberOfItems?H.insertItemBefore(V,0):H.appendItem(V);if(O.e||O.f){J=c.createSVGTransform();J.setTranslate(O.e,O.f);H.numberOfItems?H.insertItemBefore(J,0):H.appendItem(J)}}else{J=E.getAttribute("transform"); G.numberOfItems==1){var O=G.getItem(0).matrix,Y=c.createSVGMatrix();if(J=na(E))Y=I.getItem(0).matrix;var da=svgedit.utilities.getBBox(E),V=X(I).matrix,fa=N(da.x+da.width/2,da.y+da.height/2,V);da=k+J;V=c.createSVGTransform();V.setRotate(da,fa.x,fa.y);O=ga(O,Y,V.matrix.inverse());J&&I.removeItem(0);if(da)I.numberOfItems?I.insertItemBefore(V,0):I.appendItem(V);if(O.e||O.f){J=c.createSVGTransform();J.setTranslate(O.e,O.f);I.numberOfItems?I.insertItemBefore(J,0):I.appendItem(J)}}else{J=E.getAttribute("transform");
O={};O.transform=J?J:"";J=c.createSVGTransform();O=X(H).matrix;Y=O.inverse();O=ga(Y,D,O);J.setMatrix(O);H.appendItem(J)}(E=Ra(E))&&z.addSubCommand(E)}}}if(A){O={};O.transform=A;e.setAttribute("transform","");e.removeAttribute("transform");z.addSubCommand(new Ma(e,O))}if(h&&!z.isEmpty())return z};this.ungroupSelectedElement=function(){var e=I[0];if($(e).data("gsvg")||$(e).data("symbol"))Lb(e);else if(e.tagName==="use"){var h=pa(ba(e).substr(1));$(e).data("symbol",h).data("ref",h);Lb(e)}else{h=$(e).parents("a"); O={};O.transform=J?J:"";J=c.createSVGTransform();O=X(I).matrix;Y=O.inverse();O=ga(Y,D,O);J.setMatrix(O);I.appendItem(J)}(E=Ra(E))&&z.addSubCommand(E)}}}if(A){O={};O.transform=A;e.setAttribute("transform","");e.removeAttribute("transform");z.addSubCommand(new Ma(e,O))}if(h&&!z.isEmpty())return z};this.ungroupSelectedElement=function(){var e=H[0];if($(e).data("gsvg")||$(e).data("symbol"))Lb(e);else if(e.tagName==="use"){var h=pa(ba(e).substr(1));$(e).data("symbol",h).data("ref",h);Lb(e)}else{h=$(e).parents("a");
if(h.length)e=h[0];if(e.tagName==="g"||e.tagName==="a"){h=new Ca("Ungroup Elements");var l=Db(e,true);l&&h.addSubCommand(l);l=e.parentNode;for(var B=e.nextSibling,A=Array(e.childNodes.length),G=0;e.firstChild;){var D=e.firstChild,z=D.nextSibling,F=D.parentNode;if(D.tagName==="title"){h.addSubCommand(new Ga(D,D.nextSibling,F));F.removeChild(D)}else{A[G++]=D=l.insertBefore(D,B);h.addSubCommand(new Ja(D,z,F))}}Ia();B=e.nextSibling;e=l.removeChild(e);h.addSubCommand(new Ga(e,B,l));h.isEmpty()||wa(h); if(h.length)e=h[0];if(e.tagName==="g"||e.tagName==="a"){h=new Ca("Ungroup Elements");var l=Db(e,true);l&&h.addSubCommand(l);l=e.parentNode;for(var B=e.nextSibling,A=Array(e.childNodes.length),G=0;e.firstChild;){var D=e.firstChild,z=D.nextSibling,F=D.parentNode;if(D.tagName==="title"){h.addSubCommand(new Ga(D,D.nextSibling,F));F.removeChild(D)}else{A[G++]=D=l.insertBefore(D,B);h.addSubCommand(new Ja(D,z,F))}}Ia();B=e.nextSibling;e=l.removeChild(e);h.addSubCommand(new Ga(e,B,l));h.isEmpty()||wa(h);
qb(A)}}};this.moveToTopSelectedElement=function(){var e=I.filter(Boolean).reverse(),h=new Ca("Move to top");e.forEach(function(l){l=l;var B=l.parentNode,A=l.nextSibling;l=l.parentNode.appendChild(l);if(A!=l.nextSibling){h.addSubCommand(new Ja(l,A,B,"top"));M("changed",[l])}h.isEmpty()||wa(h)})};this.moveToBottomSelectedElement=function(){var e=I.filter(Boolean).reverse(),h=new Ca("Move to top");e.forEach(function(l){l=l;var B=l.parentNode,A=l.nextSibling,G=l.parentNode.firstChild;if(G.tagName=="title")G= qb(A)}}};this.moveToTopSelectedElement=function(){var e=H.filter(Boolean).reverse(),h=new Ca("Move to top");e.forEach(function(l){l=l;var B=l.parentNode,A=l.nextSibling;l=l.parentNode.appendChild(l);if(A!=l.nextSibling){h.addSubCommand(new Ja(l,A,B,"top"));M("changed",[l])}h.isEmpty()||wa(h)})};this.moveToBottomSelectedElement=function(){var e=H.filter(Boolean).reverse(),h=new Ca("Move to top");e.forEach(function(l){l=l;var B=l.parentNode,A=l.nextSibling,G=l.parentNode.firstChild;if(G.tagName=="title")G=
G.nextSibling;if(G.tagName=="defs")G=G.nextSibling;l=l.parentNode.insertBefore(l,G);if(A!=l.nextSibling){h.addSubCommand(new Ja(l,A,B,"bottom"));M("changed",[l])}});h.isEmpty()||wa(h)};this.moveUpDownSelected=function(e){var h=I.filter(Boolean);e=="Down"&&h.reverse();var l=new Ca("Move "+e);h.forEach(function(B){hb=[];var A,G,D=$(ob(getStrokedBBox([B]))).toArray();e=="Down"&&D.reverse();$.each(D,function(){if(G){A=this;return false}else if(this==B)G=true});if(A){D=B.parentNode;var z=B.nextSibling; G.nextSibling;if(G.tagName=="defs")G=G.nextSibling;l=l.parentNode.insertBefore(l,G);if(A!=l.nextSibling){h.addSubCommand(new Ja(l,A,B,"bottom"));M("changed",[l])}});h.isEmpty()||wa(h)};this.moveUpDownSelected=function(e){var h=H.filter(Boolean);e=="Down"&&h.reverse();var l=new Ca("Move "+e);h.forEach(function(B){hb=[];var A,G,D=$(ob(getStrokedBBox([B]))).toArray();e=="Down"&&D.reverse();$.each(D,function(){if(G){A=this;return false}else if(this==B)G=true});if(A){D=B.parentNode;var z=B.nextSibling;
$(A)[e=="Down"?"before":"after"](B);if(z!=B.nextSibling){l.addSubCommand(new Ja(B,z,D,"Move "+e));M("changed",[B])}}});l.isEmpty()||wa(l)};this.moveSelectedElements=function(e,h,l){if(e.constructor!=Array){e/=s;h/=s}l=l||true;for(var B=new Ca("position"),A=I.length;A--;){var G=I[A];if(G!=null){var D=c.createSVGTransform(),z=S(G);e.constructor==Array?D.setTranslate(e[A],h[A]):D.setTranslate(e,h);z.numberOfItems?z.insertItemBefore(D,0):z.appendItem(D);(D=Ra(G))&&B.addSubCommand(D);ra.requestSelector(G).resize()}}if(!B.isEmpty()){l&& $(A)[e=="Down"?"before":"after"](B);if(z!=B.nextSibling){l.addSubCommand(new Ja(B,z,D,"Move "+e));M("changed",[B])}}});l.isEmpty()||wa(l)};this.moveSelectedElements=function(e,h,l){if(e.constructor!=Array){e/=s;h/=s}l=l||true;for(var B=new Ca("position"),A=H.length;A--;){var G=H[A];if(G!=null){var D=c.createSVGTransform(),z=R(G);e.constructor==Array?D.setTranslate(e[A],h[A]):D.setTranslate(e,h);z.numberOfItems?z.insertItemBefore(D,0):z.appendItem(D);(D=Ra(G))&&B.addSubCommand(D);ra.requestSelector(G).resize()}}if(!B.isEmpty()){l&&
wa(B);M("changed",I);return B}};this.cloneSelectedElements=function(e,h,l){for(var B=new Ca("Clone Elements"),A=I.length,G=0;G<A;++G){var D=I[G];if(D==null)break}A=I.slice(0,G);this.clearSelection(true);G=A.length;for(clones=[];G--;){D=A[G];var z=ia(A[G]),F=L||C().getCurrentLayer();if(l){tlist=S(z);tlist.removeItem(l);Ra(z);F.insertBefore(z,D)}else F.appendChild(z);clones.push(z);B.addSubCommand(new Ha(z))}if(!B.isEmpty()){qb(A.reverse());l||this.moveSelectedElements(e,h,false);wa(B)}return clones}; wa(B);M("changed",H);return B}};this.cloneSelectedElements=function(e,h,l){for(var B=new Ca("Clone Elements"),A=H.length,G=0;G<A;++G){var D=H[G];if(D==null)break}A=H.slice(0,G);this.clearSelection(true);G=A.length;for(clones=[];G--;){D=A[G];var z=ia(A[G]),F=L||C().getCurrentLayer();if(l){tlist=R(z);tlist.removeItem(l);Ra(z);F.insertBefore(z,D)}else F.appendChild(z);clones.push(z);B.addSubCommand(new Ha(z))}if(!B.isEmpty()){qb(A.reverse());l||this.moveSelectedElements(e,h,false);wa(B)}return clones};
this.alignSelectedElements=function(e,h){var l=[],B=Number.MAX_VALUE,A=Number.MIN_VALUE,G=Number.MAX_VALUE,D=Number.MIN_VALUE,z=Number.MIN_VALUE,F=Number.MIN_VALUE,k=I.length;if(k){for(var n=0;n<k;++n){if(I[n]==null)break;l[n]=getStrokedBBox([I[n]]);switch(h){case "smallest":if((e=="l"||e=="c"||e=="r")&&(z==Number.MIN_VALUE||z>l[n].width)||(e=="t"||e=="m"||e=="b")&&(F==Number.MIN_VALUE||F>l[n].height)){B=l[n].x;G=l[n].y;A=l[n].x+l[n].width;D=l[n].y+l[n].height;z=l[n].width;F=l[n].height}break;case "largest":if((e== this.alignSelectedElements=function(e,h){var l=[],B=Number.MAX_VALUE,A=Number.MIN_VALUE,G=Number.MAX_VALUE,D=Number.MIN_VALUE,z=Number.MIN_VALUE,F=Number.MIN_VALUE,k=H.length;if(k){for(var n=0;n<k;++n){if(H[n]==null)break;l[n]=getStrokedBBox([H[n]]);switch(h){case "smallest":if((e=="l"||e=="c"||e=="r")&&(z==Number.MIN_VALUE||z>l[n].width)||(e=="t"||e=="m"||e=="b")&&(F==Number.MIN_VALUE||F>l[n].height)){B=l[n].x;G=l[n].y;A=l[n].x+l[n].width;D=l[n].y+l[n].height;z=l[n].width;F=l[n].height}break;case "largest":if((e==
"l"||e=="c"||e=="r")&&(z==Number.MIN_VALUE||z<l[n].width)||(e=="t"||e=="m"||e=="b")&&(F==Number.MIN_VALUE||F<l[n].height)){B=l[n].x;G=l[n].y;A=l[n].x+l[n].width;D=l[n].y+l[n].height;z=l[n].width;F=l[n].height}break;default:if(l[n].x<B)B=l[n].x;if(l[n].y<G)G=l[n].y;if(l[n].x+l[n].width>A)A=l[n].x+l[n].width;if(l[n].y+l[n].height>D)D=l[n].y+l[n].height}}if(h=="page"){G=B=0;A=d.contentW;D=d.contentH}z=Array(k);F=Array(k);for(n=0;n<k;++n){if(I[n]==null)break;var o=l[n];z[n]=0;F[n]=0;switch(e){case "l":z[n]= "l"||e=="c"||e=="r")&&(z==Number.MIN_VALUE||z<l[n].width)||(e=="t"||e=="m"||e=="b")&&(F==Number.MIN_VALUE||F<l[n].height)){B=l[n].x;G=l[n].y;A=l[n].x+l[n].width;D=l[n].y+l[n].height;z=l[n].width;F=l[n].height}break;default:if(l[n].x<B)B=l[n].x;if(l[n].y<G)G=l[n].y;if(l[n].x+l[n].width>A)A=l[n].x+l[n].width;if(l[n].y+l[n].height>D)D=l[n].y+l[n].height}}if(h=="page"){G=B=0;A=d.contentW;D=d.contentH}z=Array(k);F=Array(k);for(n=0;n<k;++n){if(H[n]==null)break;var o=l[n];z[n]=0;F[n]=0;switch(e){case "l":z[n]=
B-o.x;break;case "c":z[n]=(B+A)/2-(o.x+o.width/2);break;case "r":z[n]=A-(o.x+o.width);break;case "t":F[n]=G-o.y;break;case "m":F[n]=(G+D)/2-(o.y+o.height/2);break;case "b":F[n]=D-(o.y+o.height)}}this.moveSelectedElements(z,F)}};this.contentW=zb().w;this.contentH=zb().h;this.updateCanvas=function(e,h){c.setAttribute("width",e);c.setAttribute("height",h);var l=$("#canvasBackground")[0],B=m.getAttribute("x"),A=m.getAttribute("y"),G=e/2-this.contentW*s/2,D=h/2-this.contentH*s/2;ma(m,{width:this.contentW* B-o.x;break;case "c":z[n]=(B+A)/2-(o.x+o.width/2);break;case "r":z[n]=A-(o.x+o.width);break;case "t":F[n]=G-o.y;break;case "m":F[n]=(G+D)/2-(o.y+o.height/2);break;case "b":F[n]=D-(o.y+o.height)}}this.moveSelectedElements(z,F)}};this.contentW=zb().w;this.contentH=zb().h;this.updateCanvas=function(e,h){c.setAttribute("width",e);c.setAttribute("height",h);var l=$("#canvasBackground")[0],B=m.getAttribute("x"),A=m.getAttribute("y"),G=e/2-this.contentW*s/2,D=h/2-this.contentH*s/2;ma(m,{width:this.contentW*
s,height:this.contentH*s,x:G,y:D,viewBox:"0 0 "+this.contentW+" "+this.contentH});ma(l,{width:m.getAttribute("width"),height:m.getAttribute("height"),x:G,y:D});(l=pa("background_image"))&&ma(l,{width:"100%",height:"100%"});ra.selectorParentGroup.setAttribute("transform","translate("+G+","+D+")");return{x:G,y:D,old_x:B,old_y:A,d_x:G-B,d_y:D-A}};this.setBackground=function(e,h){var l=pa("canvasBackground"),B=$(l).find("rect")[0],A=pa("background_image");B.setAttribute("fill",e);if(h){if(!A){A=f.createElementNS(b, s,height:this.contentH*s,x:G,y:D,viewBox:"0 0 "+this.contentW+" "+this.contentH});ma(l,{width:m.getAttribute("width"),height:m.getAttribute("height"),x:G,y:D});(l=pa("background_image"))&&ma(l,{width:"100%",height:"100%"});ra.selectorParentGroup.setAttribute("transform","translate("+G+","+D+")");return{x:G,y:D,old_x:B,old_y:A,d_x:G-B,d_y:D-A}};this.setBackground=function(e,h){var l=pa("canvasBackground"),B=$(l).find("rect")[0],A=pa("background_image");B.setAttribute("fill",e);if(h){if(!A){A=f.createElementNS(b,
"image");ma(A,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}T(A,h);l.appendChild(A)}else A&&A.parentNode.removeChild(A)};this.cycleElement=function(e){var h=I[0],l=false,B=pb(L||C().getCurrentLayer());if(B.length){if(h==null){e=e?B.length-1:0;l=B[e]}else for(var A=B.length;A--;)if(B[A]==h){e=e?A-1:A+1;if(e>=B.length)e=0;else if(e<0)e=B.length-1;l=B[e];break}rb([l],true);M("selected",I)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:wa, "image");ma(A,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}T(A,h);l.appendChild(A)}else A&&A.parentNode.removeChild(A)};this.cycleElement=function(e){var h=H[0],l=false,B=pb(L||C().getCurrentLayer());if(B.length){if(h==null){e=e?B.length-1:0;l=B[e]}else for(var A=B.length;A--;)if(B[A]==h){e=e?A-1:A+1;if(e>=B.length)e=0;else if(e<0)e=B.length-1;l=B[e];break}rb([l],true);M("selected",H)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:wa,
setGradient:Nb,addSvgElementFromJson:Q,assignAttributes:ma,BatchCommand:Ca,call:M,ChangeElementCommand:Ma,copyElem:ia,ffClone:ca,findDefs:gb,findDuplicateGradient:Mb,getElem:pa,getId:aa,getIntersectionList:ob,getMouseTarget:Bb,getNextId:ka,getPathBBox:Z,getUrlFromAttr:ja,hasMatrixTransform:na,identifyLayers:xb,InsertElementCommand:Ha,isIdentity:svgedit.math.isIdentity,logMatrix:Wa,matrixMultiply:ga,MoveElementCommand:Ja,preventClickDefault:Fb,recalculateAllSelectedDimensions:Da,recalculateDimensions:Ra, setGradient:Nb,addSvgElementFromJson:S,assignAttributes:ma,BatchCommand:Ca,call:M,ChangeElementCommand:Ma,copyElem:ia,ffClone:ca,findDefs:gb,findDuplicateGradient:Mb,getElem:pa,getId:aa,getIntersectionList:ob,getMouseTarget:Bb,getNextId:ka,getPathBBox:Z,getUrlFromAttr:ja,hasMatrixTransform:oa,identifyLayers:xb,InsertElementCommand:Ha,isIdentity:svgedit.math.isIdentity,logMatrix:Wa,matrixMultiply:ga,MoveElementCommand:Ja,preventClickDefault:Fb,recalculateAllSelectedDimensions:Da,recalculateDimensions:Ra,
remapElement:Za,RemoveElementCommand:Ga,removeUnusedDefElems:yb,round:ab,runExtensions:ib,sanitizeSvg:ya,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:X,transformPoint:N,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(c,m){var u=g.setSvgString(c)!==false;m=m||a.noop;u?m(true):a.alert(uiStrings.notification.errorLoadingSVG,function(){m(false)})}var g,b={},p=false;curConfig={canvas_expansion:1,dimensions:[580,400], remapElement:Za,RemoveElementCommand:Ga,removeUnusedDefElems:yb,round:ab,runExtensions:ib,sanitizeSvg:ya,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:X,transformPoint:N,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(c,m){var u=g.setSvgString(c)!==false;m=m||a.noop;u?m(true):a.alert(uiStrings.notification.errorLoadingSVG,function(){m(false)})}var g,b={},p=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:"<strong>Do you want to clear the drawing?</strong>\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:"<strong>Do you want to clear the drawing?</strong>\nThis will also erase your undo history",
@ -388,86 +388,86 @@ align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bo
"#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()? "#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom"},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 k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var n=a("#"+this.id+"_show"),o=n.attr("data-curopt");if(!n.children("svg, img").length){o= 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 k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var n=a("#"+this.id+"_show"),o=n.attr("data-curopt");if(!n.children("svg, img").length){o=
a(o).children().clone();if(o.length){o[0].removeAttribute("style");n.append(o)}}});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(k){a("#base_unit_container").css({top:k.pageY-10,left:k.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200); a(o).children().clone();if(o.length){o[0].removeAttribute("style");n.append(o)}}});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(k){a("#base_unit_container").css({top:k.pageY-10,left:k.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=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};c=navigator.platform.indexOf("Mac")>=0;var m=navigator.userAgent.indexOf("AppleWebKit")>=0,u=c?"meta+":"ctrl+",C=g.pathActions,s=g.undoMgr,L=svgedit.utilities,R=curConfig.imgPath+"placeholder.svg",K=a("#workarea"),I=a("#cmenu_canvas"),Q=null,S=1,N="toolbars", event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};c=navigator.platform.indexOf("Mac")>=0;var m=navigator.userAgent.indexOf("AppleWebKit")>=0,u=c?"meta+":"ctrl+",C=g.pathActions,s=g.undoMgr,L=svgedit.utilities,Q=curConfig.imgPath+"placeholder.svg",K=a("#workarea"),H=a("#cmenu_canvas"),S=null,R=1,N="toolbars",
ga="";c||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),n=a("#dialog_buttons"),o=function(w,E,H,J){a("#dialog_content").html("<p>"+E.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",w=="prompt");n.empty();var O=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(n);w!="alert"&&a('<input type="button" value="'+ ga="";c||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),n=a("#dialog_buttons"),o=function(w,E,I,J){a("#dialog_content").html("<p>"+E.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",w=="prompt");n.empty();var O=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(n);w!="alert"&&a('<input type="button" value="'+
uiStrings.common.cancel+'">').appendTo(n).on("click touchstart",function(){k.hide();H(false)});if(w=="prompt"){var Y=a('<input type="text">').prependTo(n);Y.val(J||"");Y.bind("keydown","return",function(){O.trigger("click touchstart")})}w=="process"&&O.hide();k.show();O.on("click touchstart",function(){k.hide();var da=w=="prompt"?Y.val():true;H&&H(da)}).focus();w=="prompt"&&Y.focus()};a.alert=function(w,E){o("alert",w,E)};a.confirm=function(w,E){o("confirm",w,E)};a.process_cancel=function(w,E){o("process", uiStrings.common.cancel+'">').appendTo(n).on("click touchstart",function(){k.hide();I(false)});if(w=="prompt"){var Y=a('<input type="text">').prependTo(n);Y.val(J||"");Y.bind("keydown","return",function(){O.trigger("click touchstart")})}w=="process"&&O.hide();k.show();O.on("click touchstart",function(){k.hide();var da=w=="prompt"?Y.val():true;I&&I(da)}).focus();w=="prompt"&&Y.focus()};a.alert=function(w,E){o("alert",w,E)};a.confirm=function(w,E){o("confirm",w,E)};a.process_cancel=function(w,E){o("process",
w,E)};a.prompt=function(w,E,H){o("prompt",w,H,E)}})();var na=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,U=false,ea=false,Aa="",ja=function(k,n){var o=g.getResolution(),w=K;a("#svgcanvas").position();if(w=g.setBBoxZoom(n,w.width()-15,w.height()-15)){var E=w.zoom;w=w.bbox;if(E<0.0010)wa({value:0.1}); w,E)};a.prompt=function(w,E,I){o("prompt",w,I,E)}})();var oa=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,U=false,ea=false,Aa="",ja=function(k,n){var o=g.getResolution(),w=K;a("#svgcanvas").position();if(w=g.setBBoxZoom(n,w.width()-15,w.height()-15)){var E=w.zoom;w=w.bbox;if(E<0.0010)wa({value:0.1});
else{typeof animatedZoom!="undefined"&&k.cancelAnimationFrame(animatedZoom);var H=Date.now(),J=E-o.zoom;a("#zoom");var O=o.zoom,Y=function(da){da=(da-H)/500;da=Math.pow(da-1,3)+1;g.setZoom(O+J*da);G();if(da<1)k.animatedZoom=requestAnimationFrame(Y);else{a("#zoom").val(parseInt(E*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(E*100)+"]","#zoom_select").attr("selected","selected")}};Y(Date.now());g.getMode()=="zoom"&&w.width&&na();xb()}}};a("#cur_context_panel").delegate("a", else{typeof animatedZoom!="undefined"&&k.cancelAnimationFrame(animatedZoom);var I=Date.now(),J=E-o.zoom;a("#zoom");var O=o.zoom,Y=function(da){da=(da-I)/500;da=Math.pow(da-1,3)+1;g.setZoom(O+J*da);G();if(da<1)k.animatedZoom=requestAnimationFrame(Y);else{a("#zoom").val(parseInt(E*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(E*100)+"]","#zoom_select").attr("selected","selected")}};Y(Date.now());g.getMode()=="zoom"&&w.width&&oa();xb()}}};a("#cur_context_panel").delegate("a",
"click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var ba=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},T={},Z=function(k){a.each(k,function(n,o){var w=a(n).children(),E=n+"_show",H=a(E),J=false;w.addClass("tool_button").unbind("click mousedown mouseup").each(function(da){var V=o[da];T[V.sel]=V.fn;if(V.isDefault)J=da;da=function(fa){var ha=V;if(fa.type==="keydown"){var W=a(ha.parent+"_show").hasClass("tool_button_current"),qa= "click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var ba=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},T={},Z=function(k){a.each(k,function(n,o){var w=a(n).children(),E=n+"_show",I=a(E),J=false;w.addClass("tool_button").unbind("click mousedown mouseup").each(function(da){var V=o[da];T[V.sel]=V.fn;if(V.isDefault)J=da;da=function(fa){var ha=V;if(fa.type==="keydown"){var W=a(ha.parent+"_show").hasClass("tool_button_current"),qa=
a(ha.parent+"_show").attr("data-curopt");a.each(k[V.parent],function(za,Ba){if(Ba.sel==qa)ha=!fa.shiftKey||!W?Ba:k[V.parent][za+1]||k[V.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",H.width());ua[0].setAttribute("height",H.height());H.children(":not(.flyout_arrow_horiz)").remove();H.append(ua).attr("data-curopt",ha.sel)};a(this).mouseup(da);V.key&&a(document).bind("keydown", a(ha.parent+"_show").attr("data-curopt");a.each(k[V.parent],function(za,Ba){if(Ba.sel==qa)ha=!fa.shiftKey||!W?Ba:k[V.parent][za+1]||k[V.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",I.width());ua[0].setAttribute("height",I.height());I.children(":not(.flyout_arrow_horiz)").remove();I.append(ua).attr("data-curopt",ha.sel)};a(this).mouseup(da);V.key&&a(document).bind("keydown",
V.key[0]+" shift+"+V.key[0],da)});if(J)H.attr("data-curopt",o[J].sel);else H.attr("data-curopt")||H.attr("data-curopt",o[0].sel);var O,Y=a(E).position();a(n).css({left:Y.left+34,top:Y.top+77});H.mousedown(function(da){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&ra(E,false);if(H.hasClass("disabled"))return false;var V=a(n),fa=Y.left+34,ha=V.width()*-1,W=V.data("shown_popop")?200:0;O=setTimeout(function(){H.data("isLibrary")?V.css("left", V.key[0]+" shift+"+V.key[0],da)});if(J)I.attr("data-curopt",o[J].sel);else I.attr("data-curopt")||I.attr("data-curopt",o[0].sel);var O,Y=a(E).position();a(n).css({left:Y.left+34,top:Y.top+77});I.mousedown(function(da){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&ra(E,false);if(I.hasClass("disabled"))return false;var V=a(n),fa=Y.left+34,ha=V.width()*-1,W=V.data("shown_popop")?200:0;O=setTimeout(function(){I.data("isLibrary")?V.css("left",
fa).show():V.css("left",ha).show().animate({left:fa},50);V.data("shown_popop",true)},W);da.preventDefault()}).mouseup(function(){clearTimeout(O);var da=a(this).attr("data-curopt");if(H.data("isLibrary")&&a(E.replace("_show","")).is(":visible"))ra(E,true);else ra(E)&&da in T&&T[da]()})});ma()},oa=function(k,n){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(n)},pa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),n=k.offset();k=k.outerWidth(); fa).show():V.css("left",ha).show().animate({left:fa},50);V.data("shown_popop",true)},W);da.preventDefault()}).mouseup(function(){clearTimeout(O);var da=a(this).attr("data-curopt");if(I.data("isLibrary")&&a(E.replace("_show","")).is(":visible"))ra(E,true);else ra(E)&&da in T&&T[da]()})});ma()},na=function(k,n){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(n)},pa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),n=k.offset();k=k.outerWidth();
a(this).css({left:(n.left+k)*S,top:n.top})})},ma=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});k[0].title=n.join(" / ")}})},la,xa=function(k,n,o){var w=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+o+"_color defs *")[0];w={alpha:n};w[k.tagName]=k}else w=k.indexOf("#")===0?{alpha:n,solidColor:k.substr(1)}:{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(w)}, a(this).css({left:(n.left+k)*R,top:n.top})})},ma=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});k[0].title=n.join(" / ")}})},la,xa=function(k,n,o){var w=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+o+"_color defs *")[0];w={alpha:n};w[k.tagName]=k}else w=k.indexOf("#")===0?{alpha:n,solidColor:k.substr(1)}:{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(w)},
ya=g.getResolution();if(curConfig.baseUnit!=="px"){ya.w=svgedit.units.convertUnit(ya.w)+curConfig.baseUnit;ya.h=svgedit.units.convertUnit(ya.h)+curConfig.baseUnit}var Ja=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:ya.w+2,height:ya.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")|| ya=g.getResolution();if(curConfig.baseUnit!=="px"){ya.w=svgedit.units.convertUnit(ya.w)+curConfig.baseUnit;ya.h=svgedit.units.convertUnit(ya.h)+curConfig.baseUnit}var Ja=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:ya.w+2,height:ya.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||
Ja();document.getElementById("canvas_background").getAttribute("fill");var Ha=b.setImageURL=function(k){k||(k=R);g.setImageURL(k);a("#image_url").val(k)},Ga=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(U&&U[0]!=null&&!U[0].parentNode)U=false;var n=g.getCurrentDrawing().getCurrentLayerName(),o=g.getMode(),w=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,E=o=="pathedit";if(E){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();n=C.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button"); Ja();document.getElementById("canvas_background").getAttribute("fill");var Ha=b.setImageURL=function(k){k||(k=Q);g.setImageURL(k);a("#image_url").val(k)},Ga=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(U&&U[0]!=null&&!U[0].parentNode)U=false;var n=g.getCurrentDrawing().getCurrentLayerName(),o=g.getMode(),w=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,E=o=="pathedit";if(E){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();n=C.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");
a("#tool_node_delete").toggleClass("disabled",!C.canDeleteNodes);zb("#tool_openclose_path",C.closed_subpath?"open_path":"close_path");if(n){E=a("#seg_type");if(w){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));if(n.type){E.val(n.type).removeAttr("disabled");a("#seg_type_label").html(n.type==4?"Straight":"Curve")}else E.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected"); a("#tool_node_delete").toggleClass("disabled",!C.canDeleteNodes);zb("#tool_openclose_path",C.closed_subpath?"open_path":"close_path");if(n){E=a("#seg_type");if(w){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));if(n.type){E.val(n.type).removeAttr("disabled");a("#seg_type_label").html(n.type==4?"Straight":"Curve")}else E.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");
a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var H=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(U){U=U.filter(Boolean);(k=g.elementsAreSame(U)?U[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!U){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=null){a("#stroke_panel").show();var J=k.nodeName,O=g.getRotationAngle(k); a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var I=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(U){U=U.filter(Boolean);(k=g.elementsAreSame(U)?U[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!U){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=null){a("#stroke_panel").show();var J=k.nodeName,O=g.getRotationAngle(k);
a("#angle").val(Math.round(O));O=g.getBlur(k);a("#blur").val(O);if(!E&&o!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Y,da;if(["g","polyline","path"].indexOf(J)>=0)if(o=g.getStrokedBBox([k])){Y=o.x;da=o.y}if(w){Y=svgedit.units.convertUnit(Y);da=svgedit.units.convertUnit(da)}a("#"+J+"_x").val(Math.round(Y));a("#"+J+"_y").val(Math.round(da));if(J==="polyline"){a("#path_x").val(Math.round(Y));a("#path_y").val(Math.round(da))}["image","text","path","g","use"].indexOf(J)== a("#angle").val(Math.round(O));O=g.getBlur(k);a("#blur").val(O);if(!E&&o!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Y,da;if(["g","polyline","path"].indexOf(J)>=0)if(o=g.getStrokedBBox([k])){Y=o.x;da=o.y}if(w){Y=svgedit.units.convertUnit(Y);da=svgedit.units.convertUnit(da)}a("#"+J+"_x").val(Math.round(Y));a("#"+J+"_y").val(Math.round(da));if(J==="polyline"){a("#path_x").val(Math.round(Y));a("#path_y").val(Math.round(da))}["image","text","path","g","use"].indexOf(J)==
-1&&a(".action_path_convert_selected").removeClass("disabled");J==="path"&&a(".action_path_selected").removeClass("disabled")}w=null;if(V==="a"){w=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();w=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!w);w&&a("#link_url").val(w);w={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");J==="path"&&a(".action_path_selected").removeClass("disabled")}w=null;if(V==="a"){w=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();w=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!w);w&&a("#link_url").val(w);w={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 V=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(V=="path"||V=="polyline")a("#path_panel").show();if(w[V]){w=w[V];a("#"+V+"_panel").show();V=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(w,function(fa,ha){var W=k.getAttribute(ha);if(curConfig.baseUnit!=="px"&&k[ha])W=svgedit.units.convertUnit(k[ha].baseVal.value);var qa=document.getElementById(V+"_"+ha);qa.value=Math.round(W)||0;qa.getAttribute("data-cursor")=== "y1","x2","y2"],text:["x","y"],use:[],path:[]};var V=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(V=="path"||V=="polyline")a("#path_panel").show();if(w[V]){w=w[V];a("#"+V+"_panel").show();V=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(w,function(fa,ha){var W=k.getAttribute(ha);if(curConfig.baseUnit!=="px"&&k[ha])W=svgedit.units.convertUnit(k[ha].baseVal.value);var qa=document.getElementById(V+"_"+ha);qa.value=Math.round(W)||0;qa.getAttribute("data-cursor")===
"true"&&a.fn.dragInput.updateCursor(qa)});if(V=="text"){w=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(w);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(w.split(",")[0].replace(/'/g,"")).css("font-family",w);g.addedNew&&setTimeout(function(){a("#text").focus().select()}, "true"&&a.fn.dragInput.updateCursor(qa)});if(V=="text"){w=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(w);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(w.split(",")[0].replace(/'/g,"")).css("font-family",w);g.addedNew&&setTimeout(function(){a("#text").focus().select()},
100)}else if(V=="image")Ha(g.getHref(k));else if(V==="g"||V==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}H[(V==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");H[(V==="g"||!U?"dis":"en")+"ableContextMenuItems"]("#group")}if(U){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");H.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||H.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back"); 100)}else if(V=="image")Ha(g.getHref(k));else if(V==="g"||V==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}I[(V==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");I[(V==="g"||!U?"dis":"en")+"ableContextMenuItems"]("#group")}if(U){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");I.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||I.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
s.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");s.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!E||U){a("#selLayerNames").removeAttr("disabled").val(n);I.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,n){var o=g.getMode();o==="select"&& s.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");s.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!E||U){a("#selLayerNames").removeAttr("disabled").val(n);H.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,n){var o=g.getMode();o==="select"&&
na();if(o==="pathedit")return Ga();X=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);U=n.length>=2?n:false;if(g.elementsAreSame(U))X=U[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":a(".context_panel").hide();a("#use_panel").show();break;case "image":a(".context_panel").hide();a("#image_panel").show();break;case "foreignObject":a(".context_panel").hide();break;case "g":case "a":o=null;for(var w=X.getElementsByTagName("*"),E=0,H=w.length;E<H;E++){var J= oa();if(o==="pathedit")return Ga();X=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);U=n.length>=2?n:false;if(g.elementsAreSame(U))X=U[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":a(".context_panel").hide();a("#use_panel").show();break;case "image":a(".context_panel").hide();a("#image_panel").show();break;case "foreignObject":a(".context_panel").hide();break;case "g":case "a":o=null;for(var w=X.getElementsByTagName("*"),E=0,I=w.length;E<I;E++){var J=
w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Ga();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0])}if(X!=null){o=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(o); w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Ga();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0])}if(X!=null){o=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(o);
a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.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")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",function(k,n){var o=g.getMode(),w=n[0];if(w){U=n.length>=2&&n[1]!=null? a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.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")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",function(k,n){var o=g.getMode(),w=n[0];if(w){U=n.length>=2&&n[1]!=null?
n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&na();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Ga();if(X&&o==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged", n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&oa();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Ga();if(X&&o==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",
{elems:n})});g.bind("saved",function(k,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var o=navigator.userAgent;if(~o.indexOf("MSIE"))Eb(0,true);else{var w=k.open("data:image/svg+xml;base64,"+L.encode64(n)),E=a.pref("save_notice_done");if(E!=="all"){var H=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(o.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){H+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");E="all"}else a.pref("save_notice_done", {elems:n})});g.bind("saved",function(k,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var o=navigator.userAgent;if(~o.indexOf("MSIE"))Eb(0,true);else{var w=k.open("data:image/svg+xml;base64,"+L.encode64(n)),E=a.pref("save_notice_done");if(E!=="all"){var I=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(o.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){I+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");E="all"}else a.pref("save_notice_done",
"part");else a.pref("save_notice_done","all");E!=="part"&&w.alert(H)}}});g.bind("exported",function(k,n){var o=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var w=a("#export_canvas")[0];w.width=g.contentW;w.height=g.contentH;canvg(w,n.svg,{renderCallback:function(){var E=w.toDataURL("image/png");Q.location.href=E;if(a.pref("export_notice_done")!=="all"){E=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(o.length)E+="\n\n"+uiStrings.notification.noteTheseIssues+ "part");else a.pref("save_notice_done","all");E!=="part"&&w.alert(I)}}});g.bind("exported",function(k,n){var o=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var w=a("#export_canvas")[0];w.width=g.contentW;w.height=g.contentH;canvg(w,n.svg,{renderCallback:function(){var E=w.toDataURL("image/png");S.location.href=E;if(a.pref("export_notice_done")!=="all"){E=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(o.length)E+="\n\n"+uiStrings.notification.noteTheseIssues+
"\n \u2022 "+o.join("\n \u2022 ");a.pref("export_notice_done","all");Q.alert(E)}}})});g.bind("zoomed",ja);g.bind("contextset",function(k,n){var o="";if(n){var w="";o='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){w+=" > "+this.id;o+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Aa=w}else Aa=null;a("#cur_context_panel").toggle(!!n).html(o)});g.bind("extension_added",function(k,n){function o(){if(la){clearTimeout(la); "\n \u2022 "+o.join("\n \u2022 ");a.pref("export_notice_done","all");S.alert(E)}}})});g.bind("zoomed",ja);g.bind("contextset",function(k,n){var o="";if(n){var w="";o='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){w+=" > "+this.id;o+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Aa=w}else Aa=null;a("#cur_context_panel").toggle(!!n).html(o)});g.bind("extension_added",function(k,n){function o(){if(la){clearTimeout(la);
la=null}E||(la=setTimeout(function(){E=true;Mb(v.iconsize)},50))}var w=false,E=false,H=true,J=function(){if(n.callback&&!w&&H){w=true;n.callback()}},O=[];n.context_tools&&a.each(n.context_tools,function(ha,W){var qa=W.container_id?' id="'+W.container_id+'"':"",ua=a("#"+W.panel);ua.length||(ua=a("<div>",{id:W.panel}).appendTo("#tools_top").hide());switch(W.type){case "tool_button":var za='<div class="tool_button">'+W.id+"</div>",Ba=a(za).appendTo(ua);W.events&&a.each(W.events,function(Na,jb){a(Ba).bind(Na, la=null}E||(la=setTimeout(function(){E=true;Mb(v.iconsize)},50))}var w=false,E=false,I=true,J=function(){if(n.callback&&!w&&I){w=true;n.callback()}},O=[];n.context_tools&&a.each(n.context_tools,function(ha,W){var qa=W.container_id?' id="'+W.container_id+'"':"",ua=a("#"+W.panel);ua.length||(ua=a("<div>",{id:W.panel}).appendTo("#tools_top").hide());switch(W.type){case "tool_button":var za='<div class="tool_button">'+W.id+"</div>",Ba=a(za).appendTo(ua);W.events&&a.each(W.events,function(Na,jb){a(Ba).bind(Na,
jb)});break;case "select":za="<label"+qa+'><select id="'+W.id+'">';a.each(W.options,function(Na,jb){za+='<option value="'+Na+'"'+(Na==W.defval?" selected":"")+">"+jb+"</option>"});za+="</select></label>";var Pa=a(za).appendTo(ua).find("select");a.each(W.events,function(Na,jb){a(Pa).bind(Na,jb)});break;case "button-select":za='<div id="'+W.id+'" class="dropdown toolset" title="'+W.title+'"><div id="cur_'+W.id+'" class="icon_label"></div><button></button></div>';qa=a('<ul id="'+W.id+'_opts"></ul>').appendTo("#option_lists"); jb)});break;case "select":za="<label"+qa+'><select id="'+W.id+'">';a.each(W.options,function(Na,jb){za+='<option value="'+Na+'"'+(Na==W.defval?" selected":"")+">"+jb+"</option>"});za+="</select></label>";var Pa=a(za).appendTo(ua).find("select");a.each(W.events,function(Na,jb){a(Pa).bind(Na,jb)});break;case "button-select":za='<div id="'+W.id+'" class="dropdown toolset" title="'+W.title+'"><div id="cur_'+W.id+'" class="icon_label"></div><button></button></div>';qa=a('<ul id="'+W.id+'_opts"></ul>').appendTo("#option_lists");
W.colnum&&qa.addClass("optcols"+W.colnum);a(za).appendTo(ua).children();O.push({elem:"#"+W.id,list:"#"+W.id+"_opts",title:W.title,callback:W.events.change,cur:"#cur_"+W.id});break;case "input":za="<label"+qa+'><span id="'+W.id+'_label">'+W.label+':</span><input id="'+W.id+'" title="'+W.title+'" size="'+(W.size||"4")+'" value="'+(W.defval||"")+'" type="text"/></label>';var Qa=a(za).appendTo(ua).find("input");W.spindata&&Qa.SpinButton(W.spindata);W.events&&a.each(W.events,function(Na,jb){Qa.bind(Na, W.colnum&&qa.addClass("optcols"+W.colnum);a(za).appendTo(ua).children();O.push({elem:"#"+W.id,list:"#"+W.id+"_opts",title:W.title,callback:W.events.change,cur:"#cur_"+W.id});break;case "input":za="<label"+qa+'><span id="'+W.id+'_label">'+W.label+':</span><input id="'+W.id+'" title="'+W.title+'" size="'+(W.size||"4")+'" value="'+(W.defval||"")+'" type="text"/></label>';var Qa=a(za).appendTo(ua).find("input");W.spindata&&Qa.SpinButton(W.spindata);W.events&&a.each(W.events,function(Na,jb){Qa.bind(Na,
jb)})}});if(n.buttons){var Y={},da={},V=n.svgicons,fa={};a.each(n.buttons,function(ha,W){for(var qa,ua=W.id,za=ha;a("#"+ua).length;)ua=W.id+"_"+ ++za;if(V){Y[ua]=W.icon;za=W.svgicon?W.svgicon:W.id;if(W.type=="app_menu")da["#"+ua+" > div"]=za;else da["#"+ua]=za}else qa=W.type=="menu"?"":a('<img src="'+W.icon+'">');var Ba,Pa;switch(W.type){case "mode_flyout":case "mode":Ba="tool_button";if(W.cls)Ba+=" "+W.cls;Pa="#tools_left";break;case "context":Ba="tool_button";Pa="#"+W.panel;a(Pa).length||a("<div>", jb)})}});if(n.buttons){var Y={},da={},V=n.svgicons,fa={};a.each(n.buttons,function(ha,W){for(var qa,ua=W.id,za=ha;a("#"+ua).length;)ua=W.id+"_"+ ++za;if(V){Y[ua]=W.icon;za=W.svgicon?W.svgicon:W.id;if(W.type=="app_menu")da["#"+ua+" > div"]=za;else da["#"+ua]=za}else qa=W.type=="menu"?"":a('<img src="'+W.icon+'">');var Ba,Pa;switch(W.type){case "mode_flyout":case "mode":Ba="tool_button";if(W.cls)Ba+=" "+W.cls;Pa="#tools_left";break;case "context":Ba="tool_button";Pa="#"+W.panel;a(Pa).length||a("<div>",
{id:W.panel}).appendTo("#tools_top");break;case "menu":Ba="menu_item tool_button";Pa="#"+(W.after||W.panel);break;case "app_menu":Ba="";Pa=W.parent||"#main_menu ul";a(Pa).length||a("<div>",{id:W.panel}).appendTo("#tools_top")}var Qa=a(W.list||W.type=="app_menu"?"<li/>":"<div/>").attr("id",ua).attr("title",W.title).addClass(Ba);if(!W.includeWith&&!W.list){if("position"in W)a(Pa).children().eq(W.position).before(Qa);else W.type!="menu"||!W.after?Qa.appendTo(Pa):a(Pa).after(Qa);if(W.type=="mode_flyout"){za= {id:W.panel}).appendTo("#tools_top");break;case "menu":Ba="menu_item tool_button";Pa="#"+(W.after||W.panel);break;case "app_menu":Ba="";Pa=W.parent||"#main_menu ul";a(Pa).length||a("<div>",{id:W.panel}).appendTo("#tools_top")}var Qa=a(W.list||W.type=="app_menu"?"<li/>":"<div/>").attr("id",ua).attr("title",W.title).addClass(Ba);if(!W.includeWith&&!W.list){if("position"in W)a(Pa).children().eq(W.position).before(Qa);else W.type!="menu"||!W.after?Qa.appendTo(Pa):a(Pa).after(Qa);if(W.type=="mode_flyout"){za=
a(Qa);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){var Na=za[0].id.replace("tool_","tools_"),jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za);Ba.data("isLibrary",true);jb.data("isLibrary",true)}da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,icon:W.id,isDefault:true},ub]}else if(W.type=="app_menu"||W.type=="menu")Qa.append(W.title)}else if(W.list){Qa.addClass("push_button");a("#"+W.list+"_opts").append(Qa); a(Qa);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){var Na=za[0].id.replace("tool_","tools_"),jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=na(Na,za);Ba.data("isLibrary",true);jb.data("isLibrary",true)}da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,icon:W.id,isDefault:true},ub]}else if(W.type=="app_menu"||W.type=="menu")Qa.append(W.title)}else if(W.list){Qa.addClass("push_button");a("#"+W.list+"_opts").append(Qa);
if(W.isDefault){a("#cur_"+W.list).append(Qa.children().clone());za=W.svgicon?W.svgicon:W.id;da["#cur_"+W.list]=za}}else if(W.includeWith){Pa=W.includeWith;za=a(Pa.button);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){Na=za[0].id.replace("tool_","tools_");jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za)}var ub=B.getButtonData(Pa.button);if(Pa.isDefault)da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click, if(W.isDefault){a("#cur_"+W.list).append(Qa.children().clone());za=W.svgicon?W.svgicon:W.id;da["#cur_"+W.list]=za}}else if(W.includeWith){Pa=W.includeWith;za=a(Pa.button);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){Na=za[0].id.replace("tool_","tools_");jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=na(Na,za)}var ub=B.getButtonData(Pa.button);if(Pa.isDefault)da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,
icon:W.id,key:W.key,isDefault:W.includeWith?W.includeWith.isDefault:0},ub];Na="position"in Pa?Pa.position:"last";ub=Ba.children().length;if(!isNaN(Na)&&Na>=0&&Na<ub)Ba.children().eq(Na).before(Qa);else{Ba.append(Qa);ua.reverse()}}V||Qa.append(qa);W.list||a.each(W.events,function(Cb,Jb){if(Cb=="click")if(W.type=="mode"){W.includeWith?Qa.bind(Cb,Jb):Qa.bind(Cb,function(){ra(Qa)&&Jb()});if(W.key){a(document).bind("keydown",W.key,Jb);W.title&&Qa.attr("title",W.title+" ["+W.key+"]")}}else Qa.bind(Cb,Jb); icon:W.id,key:W.key,isDefault:W.includeWith?W.includeWith.isDefault:0},ub];Na="position"in Pa?Pa.position:"last";ub=Ba.children().length;if(!isNaN(Na)&&Na>=0&&Na<ub)Ba.children().eq(Na).before(Qa);else{Ba.append(Qa);ua.reverse()}}V||Qa.append(qa);W.list||a.each(W.events,function(Cb,Jb){if(Cb=="click")if(W.type=="mode"){W.includeWith?Qa.bind(Cb,Jb):Qa.bind(Cb,function(){ra(Qa)&&Jb()});if(W.key){a(document).bind("keydown",W.key,Jb);W.title&&Qa.attr("title",W.title+" ["+W.key+"]")}}else Qa.bind(Cb,Jb);
else Qa.bind(Cb,Jb)});Z(fa)});a.each(O,function(){vb(this.elem,this.list,this.callback,{seticon:true})});if(V)H=false;a.svgIcons(V,{w:27,h:27,id_match:false,no_img:!m,fallback:Y,placement:da,callback:function(){v.iconsize&&v.iconsize!="m"&&o();H=true;J()}})}J()});g.textActions.setInputElem(a("#text")[0]);var Ma='<div class="palette_item transparent" data-rgb="none"></div>\t\t\t\t\t\t\t\t<div class="palette_item black" data-rgb="#000000"></div>\t\t\t\t\t\t\t\t<div class="palette_item white" data-rgb="#ffffff"></div>'; else Qa.bind(Cb,Jb)});Z(fa)});a.each(O,function(){vb(this.elem,this.list,this.callback,{seticon:true})});if(V)I=false;a.svgIcons(V,{w:27,h:27,id_match:false,no_img:!m,fallback:Y,placement:da,callback:function(){v.iconsize&&v.iconsize!="m"&&o();I=true;J()}})}J()});g.textActions.setInputElem(a("#text")[0]);var Ma='<div class="palette_item transparent" data-rgb="none"></div>\t\t\t\t\t\t\t\t<div class="palette_item black" data-rgb="#000000"></div>\t\t\t\t\t\t\t\t<div class="palette_item white" data-rgb="#ffffff"></div>';
["#482816","#422C10","#3B2F0E","#32320F","#293414","#1F361B","#153723","#0C372C","#083734","#0E353B","#1A333F","#273141","#332D40","#3E2A3C","#462735","#4B252D","#4D2425","#4C261D","#845335","#7B572D","#6F5C2A","#62612C","#546433","#46673D","#396849","#306856","#2D6862","#33666C","#426373","#535F75","#645A73","#74556D","#805064","#884D58","#8B4D4B","#894F3F","#C48157","#B8874D","#A98E49","#97944B","#849854","#729C62","#619E73","#559E84","#529D94","#5B9BA2","#6D97AB","#8391AE","#9A8AAB","#AF84A3", ["#482816","#422C10","#3B2F0E","#32320F","#293414","#1F361B","#153723","#0C372C","#083734","#0E353B","#1A333F","#273141","#332D40","#3E2A3C","#462735","#4B252D","#4D2425","#4C261D","#845335","#7B572D","#6F5C2A","#62612C","#546433","#46673D","#396849","#306856","#2D6862","#33666C","#426373","#535F75","#645A73","#74556D","#805064","#884D58","#8B4D4B","#894F3F","#C48157","#B8874D","#A98E49","#97944B","#849854","#729C62","#619E73","#559E84","#529D94","#5B9BA2","#6D97AB","#8391AE","#9A8AAB","#AF84A3",
"#BF7E96","#C97A86","#CE7975","#CC7C65","#FFB27C","#FABA6F","#E6C36A","#CFCA6D","#B8D078","#A0D58A","#8CD79F","#7DD8B5","#7AD6CA","#84D3DB","#9ACEE6","#B6C7EA","#D3BEE7","#EDB6DC","#FFAFCC","#FFAAB8","#FFA9A2","#FFAC8D","#FFE7A2","#FFF093","#FFFA8D","#FFFF91","#EEFF9F","#D1FFB4","#B9FFCE","#A8FFE9","#A4FFFF","#B1FFFF","#CBFFFF","#EDFFFF","#FFF5FF","#FFEBFF","#FFE2FF","#FFDCEC","#FFDBD2","#FFDFB8"].forEach(function(k){Ma+='<div class="palette_item" style="background-color: '+k+';" data-rgb="'+k+'"></div>'}); "#BF7E96","#C97A86","#CE7975","#CC7C65","#FFB27C","#FABA6F","#E6C36A","#CFCA6D","#B8D078","#A0D58A","#8CD79F","#7DD8B5","#7AD6CA","#84D3DB","#9ACEE6","#B6C7EA","#D3BEE7","#EDB6DC","#FFAFCC","#FFAAB8","#FFA9A2","#FFAC8D","#FFE7A2","#FFF093","#FFFA8D","#FFFF91","#EEFF9F","#D1FFB4","#B9FFCE","#A8FFE9","#A4FFFF","#B1FFFF","#CBFFFF","#EDFFFF","#FFF5FF","#FFEBFF","#FFE2FF","#FFDCEC","#FFDBD2","#FFDFB8"].forEach(function(k){Ma+='<div class="palette_item" style="background-color: '+k+';" data-rgb="'+k+'"></div>'});
a("#palette").append(Ma);var Ca=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ca.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var n=k.value/100;if(n<0.0010)k.value=0.1;else{k=g.getZoom();var o=K;ja(window,{width:0,height:0,x:(o[0].scrollLeft+o.width()/2)/k,y:(o[0].scrollTop+o.height()/2)/k,zoom:n},true)}};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val()); a("#palette").append(Ma);var Ca=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ca.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var n=k.value/100;if(n<0.0010)k.value=0.1;else{k=g.getZoom();var o=K;ja(window,{width:0,height:0,x:(o[0].scrollLeft+o.width()/2)/k,y:(o[0].scrollTop+o.height()/2)/k,zoom:n},true)}};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());
a("#stroke_style_label").html(this.options[this.selectedIndex].text);window.opera&&a("<p/>").hide().appendTo("body").remove()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var n=k.getAttribute("data-attr"),o=k.getAttribute("data-multiplier")|| a("#stroke_style_label").html(this.options[this.selectedIndex].text);window.opera&&a("<p/>").hide().appendTo("body").remove()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var n=k.getAttribute("data-attr"),o=k.getAttribute("data-multiplier")||
1;o=parseFloat(o);o=k.value*o;if(!svgedit.units.isValidUnit(n,o,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(n);return false}g.changeSelectedAttributeNoUndo(n,o)};picking=false;a(document).on("mouseup",function(){picking=false});a("#palette").on("mousemove mousedown touchstart touchmove",".palette_item",function(k){k.preventDefault();if(k.type=="mousedown")picking=true;if(picking){var n=a("#tool_stroke").hasClass("active"),o=n?"stroke":"fill",w=a(this).attr("data-rgb"), 1;o=parseFloat(o);o=k.value*o;if(!svgedit.units.isValidUnit(n,o,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(n);return false}g.changeSelectedAttributeNoUndo(n,o)};picking=false;a(document).on("mouseup",function(){picking=false});a("#palette").on("mousemove mousedown touchstart touchmove",".palette_item",function(k){k.preventDefault();if(k.type=="mousedown")picking=true;if(picking){var n=a("#tool_stroke").hasClass("active"),o=n?"stroke":"fill",w=a(this).attr("data-rgb"),
E=null,H=true;if(k.type=="mousedown")H=false;if(w==="transparent"||w==="initial"||w==="#none"){w="none";E=new a.jGraduate.Paint}else E=new a.jGraduate.Paint({alpha:100,solidColor:w.substr(1)});b.paintBox[o].setPaint(E);if(n){g.setColor("stroke",w,H);w!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",w,H);w!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display", E=null,I=true;if(k.type=="mousedown")I=false;if(w==="transparent"||w==="initial"||w==="#none"){w="none";E=new a.jGraduate.Paint}else E=new a.jGraduate.Paint({alpha:100,solidColor:w.substr(1)});b.paintBox[o].setPaint(E);if(n){g.setColor("stroke",w,I);w!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",w,I);w!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display",
"table-cell");a(this).addClass("expanded");Db()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");Db()});var ra=function(k,n){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var o=o||"normal";n||a(".tools_flyout").fadeOut(o);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k= "table-cell");a(this).addClass("expanded");Db()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");Db()});var ra=function(k,n){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var o=o||"normal";n||a(".tools_flyout").fadeOut(o);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=
null,n=null,o=K[0],w=false,E=false;a("#svgcanvas").on("mousemove mouseup touchend",function(H){if(w!==false){o.scrollLeft-=H.clientX-k;o.scrollTop-=H.clientY-n;k=H.clientX;n=H.clientY;if(H.type==="mouseup"||H.type==="touchend")w=false;return false}}).on("mousedown touchmove",function(H){if(H.button===1||E===true||H.originalEvent.touches&&H.originalEvent.touches.length>=2){w=true;k=H.clientX;n=H.clientY;return false}});a(window).mouseup(function(){w=false});a(document).bind("keydown","space",function(H){H.preventDefault(); null,n=null,o=K[0],w=false,E=false;a("#svgcanvas").on("mousemove mouseup touchend",function(I){if(w!==false){o.scrollLeft-=I.clientX-k;o.scrollTop-=I.clientY-n;k=I.clientX;n=I.clientY;if(I.type==="mouseup"||I.type==="touchend")w=false;return false}}).on("mousedown touchmove",function(I){if(I.button===1||E===true||I.originalEvent.touches&&I.originalEvent.touches.length>=2){w=true;k=I.clientX;n=I.clientY;return false}});a(window).mouseup(function(){w=false});a(document).bind("keydown","space",function(I){I.preventDefault();
g.spaceKey=E=true}).bind("keyup","space",function(H){H.preventDefault();g.spaceKey=E=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&K.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&K.removeClass("out")})})();var va=a(".menu"),kb=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background= g.spaceKey=E=true}).bind("keyup","space",function(I){I.preventDefault();g.spaceKey=E=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&K.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&K.removeClass("out")})})();var va=a(".menu"),kb=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=
""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){kb(k)});a("svg, body").on("mousedown touchstart",function(k){if(!(k.target.nodeName&&k.target.nodeName.toLowerCase()==="input"))if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?kb(k):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel", ""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){kb(k)});a("svg, body").on("mousedown touchstart",function(k){if(!(k.target.nodeName&&k.target.nodeName.toLowerCase()==="input"))if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?kb(k):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",
function(k,n,o,w){if(k.altKey){k.preventDefault();zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+w*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");va.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){va.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,n,o){if(a(k).length!=0){var w=a(k).find("button"),E=a(k).find("ul").attr("id",a(k)[0].id+"-list"); function(k,n,o,w){if(k.altKey){k.preventDefault();zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+w*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");va.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){va.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,n,o){if(a(k).length!=0){var w=a(k).find("button"),E=a(k).find("ul").attr("id",a(k)[0].id+"-list");
o||a("#option_lists").append(E);var H=false;o&&a(k).addClass("dropup");E.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!H){w.removeClass("down");E.hide()}H=false});w.bind("mousedown",function(){if(w.hasClass("down")){w.removeClass("down");E.hide()}else{w.addClass("down");if(!o){var J=a(k).offset();E.css({top:J.top,left:J.left-110})}E.show();H=true}}).hover(function(){H=true}).mouseout(function(){H=false})}};var vb=function(k,n,o,w){var E=a(k);n=a(n);var H=false,J=w.dropUp;J&&a(k).addClass("dropup"); o||a("#option_lists").append(E);var I=false;o&&a(k).addClass("dropup");E.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!I){w.removeClass("down");E.hide()}I=false});w.bind("mousedown",function(){if(w.hasClass("down")){w.removeClass("down");E.hide()}else{w.addClass("down");if(!o){var J=a(k).offset();E.css({top:J.top,left:J.left-110})}E.show();I=true}}).hover(function(){I=true}).mouseout(function(){I=false})}};var vb=function(k,n,o,w){var E=a(k);n=a(n);var I=false,J=w.dropUp;J&&a(k).addClass("dropup");
n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,arguments)});a(window).mouseup(function(){if(!H){E.removeClass("down");n.hide();n.css({top:0,left:0})}H=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");n.hide();n.css({top:0,left:0})}else{E.addClass("down"); n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,arguments)});a(window).mouseup(function(){if(!I){E.removeClass("down");n.hide();n.css({top:0,left:0})}I=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");n.hide();n.css({top:0,left:0})}else{E.addClass("down");
n.show();H=true;return false}}).hover(function(){H=true}).mouseout(function(){H=false});w.multiclick&&n.mousedown(function(){H=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k, n.show();I=true;return false}}).hover(function(){I=true}).mouseout(function(){I=false});w.multiclick&&n.mousedown(function(){I=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,
"page")})});(function(){var k,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N="canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Ea=function(){ra("#tool_rect")&&g.setMode("rect")},ta=function(){ra("#tool_ellipse")&& "page")})});(function(){var k,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N="canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Ea=function(){ra("#tool_rect")&&g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&
g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();na()}},Fa=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){window.event&&window.event.type=== g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();oa()}},Fa=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){window.event&&window.event.type===
"keydown"&&Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToBottomSelectedElement()}}, "keydown"&&Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToBottomSelectedElement()}},
eb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display", eb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display",
"none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ga()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked", "none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ga()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",
true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)}, true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},
ca=function(){g.cycleElement(0)},Da=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ga()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){na();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Ga();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Ga()},Za=function(){g.setItalic(!g.getItalic());Ga()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage; ca=function(){g.cycleElement(0)},Da=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ga()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){oa();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Ga();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Ga()},Za=function(){g.setItalic(!g.getItalic());Ga()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;
Q=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},Ia=function(k){var n=k.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()> S=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},Ia=function(k){var n=k.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>
0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o= 0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o=
n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"): n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):
a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed"); a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=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)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o= 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)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=
ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});na()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+ ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});oa()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+
n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),H=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+ n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),I=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+
O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=H;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=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"),w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=S=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show(); O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=I;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=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"),w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=R=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();
Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var H="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");H+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=da[k]||da.all;H+=Y+":"+V+";"});H+="}"});E="-"+gb.toLowerCase()+"-";H+="#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{"+ Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var I="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");I+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=da[k]||da.all;I+=Y+":"+V+";"});I+="}"});E="-"+gb.toLowerCase()+"-";I+="#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{"+
E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(H)}pa()}},Ab=function(){a("#dialog_box").hide();if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Aa&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height(); E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(I)}pa()}},Ab=function(){a("#dialog_box").hide();if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Aa&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(n){n&&Ha(n)})});var e=function(k){var n=k[0].id=="stroke_color"?"stroke": var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(n){n&&Ha(n)})});var e=function(k){var n=k[0].id=="stroke_color"?"stroke":
"fill",o=k[0].id=="canvas_color";if(o)n="canvas";var w=b.paintBox[n].paint;k=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";o=o?{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(o).jGraduate({paint:w,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(E){w=new a.jGraduate.Paint(E);b.paintBox[n].setPaint(w); "fill",o=k[0].id=="canvas_color";if(o)n="canvas";var w=b.paintBox[n].paint;k=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";o=o?{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(o).jGraduate({paint:w,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(E){w=new a.jGraduate.Paint(E);b.paintBox[n].setPaint(w);
g.setPaint(n,w);a("#color_picker").hide()},function(){a("#color_picker").hide()})};c=function(k,n){var o=document.getElementById("canvas_background"),w={color:"fff",opacity:1};if(n=="stroke")w=curConfig.initStroke;if(n=="fill")w=curConfig.initFill;if(n=="canvas"&&o)if(o=o.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))w={color:("0"+parseInt(o[1],10).toString(16)).slice(-2)+("0"+parseInt(o[2],10).toString(16)).slice(-2)+("0"+parseInt(o[3],10).toString(16)).slice(-2),opacity:1};o=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+ g.setPaint(n,w);a("#color_picker").hide()},function(){a("#color_picker").hide()})};c=function(k,n){var o=document.getElementById("canvas_background"),w={color:"fff",opacity:1};if(n=="stroke")w=curConfig.initStroke;if(n=="fill")w=curConfig.initFill;if(n=="canvas"&&o)if(o=o.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))w={color:("0"+parseInt(o[1],10).toString(16)).slice(-2)+("0"+parseInt(o[2],10).toString(16)).slice(-2)+("0"+parseInt(o[3],10).toString(16)).slice(-2),opacity:1};o=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
w.color+'" opacity="'+w.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;o=a(k)[0].appendChild(document.importNode(o,true));n==="canvas"?o.setAttribute("width",60.5):o.setAttribute("width","100%");this.rect=o.firstChild;this.defs=o.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:w.color});this.type=n;this.setPaint=function(E,H){this.paint=E;var J="none",O=E.type,Y=E.alpha/100;switch(O){case "solidColor":J= w.color+'" opacity="'+w.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;o=a(k)[0].appendChild(document.importNode(o,true));n==="canvas"?o.setAttribute("width",60.5):o.setAttribute("width","100%");this.rect=o.firstChild;this.defs=o.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:w.color});this.type=n;this.setPaint=function(E,I){this.paint=E;var J="none",O=E.type,Y=E.alpha/100;switch(O){case "solidColor":J=
E[O]=="none"||E[O]=="one"?"none":"#"+E[O];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(E[O]);J="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",J);this.rect.setAttribute("opacity",Y);if(this.type=="canvas")if(O=document.getElementById("canvas_background")){ya=g.getResolution();O.setAttribute("x",-1);O.setAttribute("y",-1);O.setAttribute("width",ya.w+2);O.setAttribute("height",ya.h+2);J.indexOf("url")== E[O]=="none"||E[O]=="one"?"none":"#"+E[O];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(E[O]);J="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",J);this.rect.setAttribute("opacity",Y);if(this.type=="canvas")if(O=document.getElementById("canvas_background")){ya=g.getResolution();O.setAttribute("x",-1);O.setAttribute("y",-1);O.setAttribute("width",ya.w+2);O.setAttribute("height",ya.h+2);J.indexOf("url")==
-1&&O.setAttribute("fill",J)}else Ja(J);if(H){g.setColor(this.type,J,true);g.setPaintOpacity(this.type,Y,true)}};this.update=function(E){if(X){var H=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var J=null,O=X.getElementsByTagName("*"),Y=0,da=O.length;Y<da;Y++){var V=O[Y].getAttribute(H);if(Y===0)J=V;else if(J!==V){J=null;break}}if(J===null){O=null;return}O=J;J=1;break;default:J=parseFloat(X.getAttribute(H+"-opacity"));if(isNaN(J))J=1;O=H=== -1&&O.setAttribute("fill",J)}else Ja(J);if(I){g.setColor(this.type,J,true);g.setPaintOpacity(this.type,Y,true)}};this.update=function(E){if(X){var I=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var J=null,O=X.getElementsByTagName("*"),Y=0,da=O.length;Y<da;Y++){var V=O[Y].getAttribute(I);if(Y===0)J=V;else if(J!==V){J=null;break}}if(J===null){O=null;return}O=J;J=1;break;default:J=parseFloat(X.getAttribute(I+"-opacity"));if(isNaN(J))J=1;O=I===
"fill"?"black":"none";O=X.getAttribute(H)||O}if(E){g.setColor(H,O,true);g.setPaintOpacity(H,J,true)}J*=100;this.setPaint(xa(O,J,H))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var E=new a.jGraduate.Paint({copy:this.paint});g.setPaint(n,E)}}};b.paintBox.fill=new c("#fill_color","fill");b.paintBox.stroke=new c("#stroke_color","stroke");b.paintBox.canvas=new c("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity* "fill"?"black":"none";O=X.getAttribute(I)||O}if(E){g.setColor(I,O,true);g.setPaintOpacity(I,J,true)}J*=100;this.setPaint(xa(O,J,I))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var E=new a.jGraduate.Paint({copy:this.paint});g.setPaint(n,E)}}};b.paintBox.fill=new c("#fill_color","fill");b.paintBox.stroke=new c("#stroke_color","stroke");b.paintBox.canvas=new c("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*
100);c=b.paintBox.fill.rect.cloneNode(false);c.setAttribute("style","vector-effect:non-scaling-stroke");var h=c.style.vectorEffect==="non-scaling-stroke";c.removeAttribute("style");c=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof c.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(c).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]); 100);c=b.paintBox.fill.rect.cloneNode(false);c.setAttribute("style","vector-effect:non-scaling-stroke");var h=c.style.vectorEffect==="non-scaling-stroke";c.removeAttribute("style");c=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof c.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(c).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);
v.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"))e(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"))e(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart", v.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"))e(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"))e(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",
function(){e(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");e(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");e(a("#fill_color"))});a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")|| function(){e(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");e(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");e(a("#fill_color"))});a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||
a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){K.css("line-height",K.height()+"px")});var l=function(){var k=a("#canvas_width"),n=a("#canvas_height"),o=k.val(),w=n.val();if(o!="fit"&&!svgedit.units.isValidUnit("width",o)){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(){K.css("line-height",K.height()+"px")});var l=function(){var k=a("#canvas_width"),n=a("#canvas_height"),o=k.val(),w=n.val();if(o!="fit"&&!svgedit.units.isValidUnit("width",o)){a.alert(uiStrings.notification.invalidAttrValGiven);
k.parent().addClass("error");return false}k.parent().removeClass("error");if(w!="fit"&&!svgedit.units.isValidUnit("height",w)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error");if(!g.setResolution(o,w)){a.alert(uiStrings.notification.noContentToFitTo);o=g.getResolution();k.val(o.w);n.val(o.h);return false}G()};a("#resolution").change(function(){var k=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value== k.parent().addClass("error");return false}k.parent().removeClass("error");if(w!="fit"&&!svgedit.units.isValidUnit("height",w)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error");if(!g.setResolution(o,w)){a.alert(uiStrings.notification.noContentToFitTo);o=g.getResolution();k.val(o.w);n.val(o.h);return false}G()};a("#resolution").change(function(){var k=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value==
"content"){k.value="fit";n.value="fit";l();var o=g.getResolution();k.value=o.w;n.value=o.h}else{var w=this.value.split("x");w[0]=parseInt(w[0]);w[1]=parseInt(w[1]);var E=w[0]-k.value,H=w[1]-n.value,J=Date.now(),O=function(Y){Y=(Y-J)/1E3;Y=Math.pow(Y-1,3)+1;k.value=(w[0]-E+Y*E).toFixed(0);n.value=(w[1]-H+Y*H).toFixed(0);l();if(Y>=1){Y=g.getResolution();a("#canvas_width").val(Y.w.toFixed());a("#canvas_height").val(Y.h.toFixed());a("#resolution_label").html("<div class='pull'>"+Y.w+"<span>\u00d7</span></br>"+ "content"){k.value="fit";n.value="fit";l();var o=g.getResolution();k.value=o.w;n.value=o.h}else{var w=this.value.split("x");w[0]=parseInt(w[0]);w[1]=parseInt(w[1]);var E=w[0]-k.value,I=w[1]-n.value,J=Date.now(),O=function(Y){Y=(Y-J)/1E3;Y=Math.pow(Y-1,3)+1;k.value=(w[0]-E+Y*E).toFixed(0);n.value=(w[1]-I+Y*I).toFixed(0);l();if(Y>=1){Y=g.getResolution();a("#canvas_width").val(Y.w.toFixed());a("#canvas_height").val(Y.h.toFixed());a("#resolution_label").html("<div class='pull'>"+Y.w+"<span>\u00d7</span></br>"+
Y.h+"</div>")}else requestAnimationFrame(O)};O(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;n.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var B=function(){var k=[{sel:"#tool_select",fn:cb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ta,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Ea,evt:"click", Y.h+"</div>")}else requestAnimationFrame(O)};O(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;n.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var B=function(){var k=[{sel:"#tool_select",fn:cb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ta,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Ea,evt:"click",
key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ta,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:db,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Fa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:$a,evt:"mouseup"},{sel:"#tool_zoom",fn:Ka,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Oa,evt:"mouseup",key:[u+"N",true]},{sel:"#tool_save",fn:function(){ea?Kb():g.save({images:v.img_save,round_digits:6})},evt:"mouseup",key:[u+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"}, key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ta,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:db,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Fa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:$a,evt:"mouseup"},{sel:"#tool_zoom",fn:Ka,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Oa,evt:"mouseup",key:[u+"N",true]},{sel:"#tool_save",fn:function(){ea?Kb():g.save({images:v.img_save,round_digits:6})},evt:"mouseup",key:[u+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},
{sel:"#tool_open",fn:Ra,evt:"mouseup"},{sel:"#tool_import",fn:mb,evt:"mouseup"},{sel:"#tool_source",fn:Eb,evt:"click",key:[u+"U",true]},{sel:"#tool_wireframe",fn:Hb,evt:"click"},{sel:"#tool_snap",fn:Gb,evt:"click"},{sel:"#tool_rulers",fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace", {sel:"#tool_open",fn:Ra,evt:"mouseup"},{sel:"#tool_import",fn:mb,evt:"mouseup"},{sel:"#tool_source",fn:Eb,evt:"click",key:[u+"U",true]},{sel:"#tool_wireframe",fn:Hb,evt:"click"},{sel:"#tool_snap",fn:Gb,evt:"click"},{sel:"#tool_rulers",fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace",
@ -476,38 +476,38 @@ true]},{sel:"#tool_topath",fn:ab,evt:"click"},{sel:"#tool_make_link,#tool_make_l
evt:"click",key:[u+"x",true]},{sel:"#tool_copy",fn:Xa,evt:"click",key:u+"c"},{sel:"#tool_paste",fn:wb,evt:"click",key:u+"v"},{sel:"#tool_switch",fn:La,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Wa,evt:"mousedown",key:[u+"B",true]},{sel:"#tool_italic",fn:Za,evt:"mousedown",key:[u+"I",true]},{sel:"#copy_save_done",fn:Ab,evt:"click"},{key:"ctrl+left",fn:function(){Da(0,1)}},{key:"ctrl+right",fn:function(){Da(1,1)}},{key:"ctrl+shift+left",fn:function(){Da(0,5)}},{key:"ctrl+shift+right",fn:function(){Da(1, evt:"click",key:[u+"x",true]},{sel:"#tool_copy",fn:Xa,evt:"click",key:u+"c"},{sel:"#tool_paste",fn:wb,evt:"click",key:u+"v"},{sel:"#tool_switch",fn:La,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Wa,evt:"mousedown",key:[u+"B",true]},{sel:"#tool_italic",fn:Za,evt:"mousedown",key:[u+"I",true]},{sel:"#copy_save_done",fn:Ab,evt:"click"},{key:"ctrl+left",fn:function(){Da(0,1)}},{key:"ctrl+right",fn:function(){Da(1,1)}},{key:"ctrl+shift+left",fn:function(){Da(0,5)}},{key:"ctrl+shift+right",fn:function(){Da(1,
5)}},{key:"shift+O",fn:ca},{key:"shift+P",fn:P},{key:[u+"+",true],fn:function(){yb(2)}},{key:[u+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){fb(0,-1)}},{key:["down",true],fn:function(){fb(0,1)}},{key:["left",true],fn:function(){fb(-1,0)}},{key:["right",true],fn:function(){fb(1,0)}},{key:"shift+up",fn:function(){fb(0,-10)}},{key:"shift+down",fn:function(){fb(0,10)}},{key:"shift+left",fn:function(){fb(-10,0)}},{key:"shift+right",fn:function(){fb(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0, 5)}},{key:"shift+O",fn:ca},{key:"shift+P",fn:P},{key:[u+"+",true],fn:function(){yb(2)}},{key:[u+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){fb(0,-1)}},{key:["down",true],fn:function(){fb(0,1)}},{key:["left",true],fn:function(){fb(-1,0)}},{key:["right",true],fn:function(){fb(1,0)}},{key:"shift+up",fn:function(){fb(0,-10)}},{key:"shift+down",fn:function(){fb(0,10)}},{key:"shift+left",fn:function(){fb(-10,0)}},{key:"shift+right",fn:function(){fb(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,
-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10, -1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,
0)}},{key:u+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:"I",fn:function(){var o=a(".tool_button_current");if(o.length&&o[0].id!=="tool_eyedropper"){o.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}g.setMode("eyedropper")}},{key:u+"shift+z",fn:rb},{key:"esc",fn:Ib}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var o={};a.each(k,function(w,E){if(E.sel){var H= 0)}},{key:u+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:"I",fn:function(){var o=a(".tool_button_current");if(o.length&&o[0].id!=="tool_eyedropper"){o.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}g.setMode("eyedropper")}},{key:u+"shift+z",fn:rb},{key:"esc",fn:Ib}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var o={};a.each(k,function(w,E){if(E.sel){var I=
a(E.sel);if(H.length==0)return true;if(E.evt){if(svgedit.browser.isTouch()&&E.evt==="click")E.evt="mousedown";H[E.evt](E.fn)}if(E.parent&&a(E.parent+"_show").length!=0){var J=a(E.parent);J.length||(J=oa(E.parent.substr(1)));J.append(H);a.isArray(o[E.parent])||(o[E.parent]=[]);o[E.parent].push(E)}}if(E.key){var O=E.fn,Y=false;if(a.isArray(E.key)){J=E.key[0];if(E.key.length>1)Y=E.key[1]}else J=E.key;J+="";svgedit.browser.isMac&&J.indexOf("+")!=-1&&J.split("+")[0]=="ctrl"&&J.replace("ctrl","cmd");a.each(J.split("/"), a(E.sel);if(I.length==0)return true;if(E.evt){if(svgedit.browser.isTouch()&&E.evt==="click")E.evt="mousedown";I[E.evt](E.fn)}if(E.parent&&a(E.parent+"_show").length!=0){var J=a(E.parent);J.length||(J=na(E.parent.substr(1)));J.append(I);a.isArray(o[E.parent])||(o[E.parent]=[]);o[E.parent].push(E)}}if(E.key){var O=E.fn,Y=false;if(a.isArray(E.key)){J=E.key[0];if(E.key.length>1)Y=E.key[1]}else J=E.key;J+="";svgedit.browser.isMac&&J.indexOf("+")!=-1&&J.split("+")[0]=="ctrl"&&J.replace("ctrl","cmd");a.each(J.split("/"),
function(V,fa){a(document).bind("keydown",fa,function(ha){O();Y&&ha.preventDefault();return false})});if(E.sel&&!E.hidekey&&H.attr("title")){var da=H.attr("title").split("[")[0]+" ("+J+")";n[J]=E.sel;H.parents("#main_menu").length||H.attr("title",da)}}});Z(o);a(window).bind("keydown","tab",function(w){if(N==="canvas"){w.preventDefault();P()}}).bind("keydown","shift+tab",function(w){if(N==="canvas"){w.preventDefault();ca()}});a("#tool_zoom").dblclick(Sa)},setTitles:function(){a.each(n,function(o,w){var E= function(V,fa){a(document).bind("keydown",fa,function(ha){O();Y&&ha.preventDefault();return false})});if(E.sel&&!E.hidekey&&I.attr("title")){var da=I.attr("title").split("[")[0]+" ("+J+")";n[J]=E.sel;I.parents("#main_menu").length||I.attr("title",da)}}});Z(o);a(window).bind("keydown","tab",function(w){if(N==="canvas"){w.preventDefault();P()}}).bind("keydown","shift+tab",function(w){if(N==="canvas"){w.preventDefault();ca()}});a("#tool_zoom").dblclick(Sa)},setTitles:function(){a.each(n,function(o,w){var E=
a(w).parents("#main_menu").length;a(w).each(function(){var H=E?a(this).text().split(" [")[0]:this.title.split(" [")[0],J="";a.each(o.split("/"),function(O,Y){var da=Y.split("+"),V="";if(da.length>1){V=da[0]+"+";Y=da[1]}J+=(O?"/":"")+V+(uiStrings["key_"+Y]||Y)});if(E)this.lastChild.textContent=H+" ["+J+"]";else this.title=H+" ["+J+"]"})})},getButtonData:function(o){var w;a.each(k,function(E,H){if(H.sel===o)w=H});return w}}}();B.setAll();b.ready(function(){var k=curConfig.initTool,n=a("#tools_left, #svg_editor .tools_flyout"), a(w).parents("#main_menu").length;a(w).each(function(){var I=E?a(this).text().split(" [")[0]:this.title.split(" [")[0],J="";a.each(o.split("/"),function(O,Y){var da=Y.split("+"),V="";if(da.length>1){V=da[0]+"+";Y=da[1]}J+=(O?"/":"")+V+(uiStrings["key_"+Y]||Y)});if(E)this.lastChild.textContent=I+" ["+J+"]";else this.title=I+" ["+J+"]"})})},getButtonData:function(o){var w;a.each(k,function(E,I){if(I.sel===o)w=I});return w}}}();B.setAll();b.ready(function(){var k=curConfig.initTool,n=a("#tools_left, #svg_editor .tools_flyout"),
o=n.find("#tool_"+k);k=n.find("#"+k);(o.length?o:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false}); o=n.find("#tool_"+k);k=n.find("#"+k);(o.length?o:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:l,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(k){var n=k.value;if(n==0&&X&&["line","polyline"].indexOf(X.nodeName)>=0)n=k.value=1;g.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled", 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(k){var n=k.value;if(n==0&&X&&["line","polyline"].indexOf(X.nodeName)>=0)n=k.value=1;g.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value,true);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",
k.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,n){var o=k.value-0,w=o+n,E=w>=o;if(n===0)return o;return o>=24?E?Math.round(o*1.1):Math.round(o/1.1):o<=1?E?o*2:o/2:w},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(k){val=k.value;a("#blur").val(val); k.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,n){var o=k.value-0,w=o+n,E=w>=o;if(n===0)return o;return o>=24?E?Math.round(o*1.1):Math.round(o/1.1):o<=1?E?o*2:o/2:w},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(k){val=k.value;a("#blur").val(val);
g.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(k){switch(k){case "delete":lb();break;case "cut":Ua();break;case "copy":Xa();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":sa();break;case "move_up":ib("Up");break;case "move_down":ib("Down");break; g.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(k){switch(k){case "delete":lb();break;case "cut":Ua();break;case "copy":Xa();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":sa();break;case "move_up":ib("Up");break;case "move_down":ib("Down");break;
case "move_back":hb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});a(".contextMenu li").mousedown(function(k){k.preventDefault()});a("#cmenu_canvas li").disableContextMenu();I.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(s.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(k){a("#main_menu").hide(); case "move_back":hb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});a(".contextMenu li").mousedown(function(k){k.preventDefault()});a("#cmenu_canvas li").disableContextMenu();H.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(s.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(k){a("#main_menu").hide();
s.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){c=function(k){k.stopPropagation();k.preventDefault();a("#workarea").removeAttr("style");a("#main_menu").hide();var n=null;if(n=k.type=="drop"?k.dataTransfer.files[0]:this.files[0])if(n.type.indexOf("image")!=-1)if(n.type.indexOf("svg")!=-1){k=new FileReader;k.onloadend=function(o){g.importSvgString(o.target.result,true);g.ungroupSelectedElement();g.ungroupSelectedElement();g.groupSelectedElements(); s.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){c=function(k){k.stopPropagation();k.preventDefault();a("#workarea").removeAttr("style");a("#main_menu").hide();var n=null;if(n=k.type=="drop"?k.dataTransfer.files[0]:this.files[0])if(n.type.indexOf("image")!=-1)if(n.type.indexOf("svg")!=-1){k=new FileReader;k.onloadend=function(o){g.importSvgString(o.target.result,true);g.ungroupSelectedElement();g.ungroupSelectedElement();g.groupSelectedElements();
g.alignSelectedElements("m","page");g.alignSelectedElements("c","page")};k.readAsText(n)}else alert("sorry, bitmap import is temporalily disabled")};K=a("#workarea");K[0].addEventListener("dragenter",function(k){k.stopPropagation();k.preventDefault();K.css({"-webkit-transform":"scale3d(1.1,1.1,1)","-moz-transform":"scale3d(1.1,1.1,1)","-o-transform":"scale(1.1)","-ms-transform":"scale3d(1.1,1.1,1)",transform:"scale3d(1.1,1.1,1)"})},false);K[0].addEventListener("dragover",function(k){k.stopPropagation(); g.alignSelectedElements("m","page");g.alignSelectedElements("c","page")};k.readAsText(n)}else alert("sorry, bitmap import is temporalily disabled")};K=a("#workarea");K[0].addEventListener("dragenter",function(k){k.stopPropagation();k.preventDefault();K.css({"-webkit-transform":"scale3d(1.1,1.1,1)","-moz-transform":"scale3d(1.1,1.1,1)","-o-transform":"scale(1.1)","-ms-transform":"scale3d(1.1,1.1,1)",transform:"scale3d(1.1,1.1,1)"})},false);K[0].addEventListener("dragover",function(k){k.stopPropagation();
k.preventDefault()},false);K[0].addEventListener("dragleave",function(k){K.removeAttr("style");k.stopPropagation();k.preventDefault()},false);K[0].addEventListener("drop",c,false);var A=a('<input type="file">').change(function(){var k=this;b.openPrep(function(n){if(n){g.clear();if(k.files.length==1){n=new FileReader;n.onloadend=function(o){q(o.target.result);G()};n.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(A);c=a('<input type="file">').change(c);a("#tool_import").show().prepend(c)}var G= k.preventDefault()},false);K[0].addEventListener("dragleave",function(k){K.removeAttr("style");k.stopPropagation();k.preventDefault()},false);K[0].addEventListener("drop",c,false);var A=a('<input type="file">').change(function(){var k=this;b.openPrep(function(n){if(n){g.clear();if(k.files.length==1){n=new FileReader;n.onloadend=function(o){q(o.target.result);G()};n.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(A);c=a('<input type="file">').change(c);a("#tool_import").show().prepend(c)}var G=
b.updateCanvas=function(k,n){var o=K.width(),w=K.height(),E=o,H=w,J=g.getZoom(),O=K,Y=a("#svgcanvas"),da={x:O[0].scrollLeft+E/2,y:O[0].scrollTop+H/2},V=curConfig.canvas_expansion;o=Math.max(E,g.contentW*J*V);w=Math.max(H,g.contentH*J*V);o==E&&w==H?K.css("overflow","hidden"):K.css("overflow","scroll");V=Y.height()/2;var fa=Y.width()/2;Y.width(o).height(w);var ha=w/2,W=o/2,qa=g.updateCanvas(o,w),ua=W/fa;o=o/2-E/2;w=w/2-H/2;if(n){n.x+=qa.x;n.y+=qa.y}else n={x:W+(da.x-fa)*ua,y:ha+(da.y-V)*ua};if(k)if(g.contentW> b.updateCanvas=function(k,n){var o=K.width(),w=K.height(),E=o,I=w,J=g.getZoom(),O=K,Y=a("#svgcanvas"),da={x:O[0].scrollLeft+E/2,y:O[0].scrollTop+I/2},V=curConfig.canvas_expansion;o=Math.max(E,g.contentW*J*V);w=Math.max(I,g.contentH*J*V);o==E&&w==I?K.css("overflow","hidden"):K.css("overflow","scroll");V=Y.height()/2;var fa=Y.width()/2;Y.width(o).height(w);var ha=w/2,W=o/2,qa=g.updateCanvas(o,w),ua=W/fa;o=o/2-E/2;w=w/2-I/2;if(n){n.x+=qa.x;n.y+=qa.y}else n={x:W+(da.x-fa)*ua,y:ha+(da.y-V)*ua};if(k)if(g.contentW>
O.width()){K[0].scrollLeft=qa.x-10;K[0].scrollTop=qa.y-10}else{O[0].scrollLeft=o;O[0].scrollTop=w}else{O[0].scrollLeft=n.x-E/2;O[0].scrollTop=n.y-H/2}if(curConfig.showRulers){E=Y;J=J;document.getElementById("workarea");document.getElementById("title_show");J||(J=g.getZoom());E||(E=a("#svgcanvas"));H=g.getContentElem();O=svgedit.units.getTypeMap()[curConfig.baseUnit];for(Y=0;Y<2;Y++){fa=(da=Y===0)?"x":"y";ua=da?"width":"height";V=H.getAttribute(fa)-0;fa=a("#ruler_"+fa+" canvas:first");$hcanv=fa.clone(); O.width()){K[0].scrollLeft=qa.x-10;K[0].scrollTop=qa.y-10}else{O[0].scrollLeft=o;O[0].scrollTop=w}else{O[0].scrollLeft=n.x-E/2;O[0].scrollTop=n.y-I/2}if(curConfig.showRulers){E=Y;J=J;document.getElementById("workarea");document.getElementById("title_show");J||(J=g.getZoom());E||(E=a("#svgcanvas"));I=g.getContentElem();O=svgedit.units.getTypeMap()[curConfig.baseUnit];for(Y=0;Y<2;Y++){fa=(da=Y===0)?"x":"y";ua=da?"width":"height";V=I.getAttribute(fa)-0;fa=a("#ruler_"+fa+" canvas:first");$hcanv=fa.clone();
fa.replaceWith($hcanv);o=$hcanv[0];ha=fa=E[ua]()*2;o.parentNode.style[ua]=ha+"px";W=0;var za;qa=o.getContext("2d");qa.fillStyle="rgb(200,0,0)";qa.fillRect(0,0,o.width,o.height);$hcanv.siblings().remove();if(fa>=3E4){var Ba=parseInt(fa/3E4)+1;za=Array(Ba);za[0]=qa;for(w=1;w<Ba;w++){o[ua]=3E4;var Pa=o.cloneNode(true);o.parentNode.appendChild(Pa);za[w]=Pa.getContext("2d")}Pa[ua]=fa%3E4;fa=3E4}o[ua]=fa;ua=O*J;var Qa=50/ua;o=1;for(w=0;w<D.length;w++){o=Ba=D[w];if(Qa<=Ba)break}Qa=o*ua;qa.font="normal 9px 'Lucida Grande', sans-serif"; fa.replaceWith($hcanv);o=$hcanv[0];ha=fa=E[ua]()*2;o.parentNode.style[ua]=ha+"px";W=0;var za;qa=o.getContext("2d");qa.fillStyle="rgb(200,0,0)";qa.fillRect(0,0,o.width,o.height);$hcanv.siblings().remove();if(fa>=3E4){var Ba=parseInt(fa/3E4)+1;za=Array(Ba);za[0]=qa;for(w=1;w<Ba;w++){o[ua]=3E4;var Pa=o.cloneNode(true);o.parentNode.appendChild(Pa);za[w]=Pa.getContext("2d")}Pa[ua]=fa%3E4;fa=3E4}o[ua]=fa;ua=O*J;var Qa=50/ua;o=1;for(w=0;w<D.length;w++){o=Ba=D[w];if(Qa<=Ba)break}Qa=o*ua;qa.font="normal 9px 'Lucida Grande', sans-serif";
qa.fillStyle="#777";for(var Na=V/ua%o*ua,jb=Na-Qa;Na<ha;Na+=Qa){jb+=Qa;w=Math.round(Na)+0.5;if(da){qa.moveTo(w,15);qa.lineTo(w,0)}else{qa.moveTo(15,w);qa.lineTo(0,w)}Ba=(jb-V)/ua;if(o>=1)w=Math.round(Ba);else{w=(o+"").split(".")[1].length;w=Ba.toFixed(w)-0}if(w!==0&&w!==1E3&&w%1E3===0)w=w/1E3+"K";if(da){qa.fillText(w,Na+2,8);qa.fillStyle="#777"}else{Ba=(w+"").split("");for(w=0;w<Ba.length;w++){qa.fillText(Ba[w],1,Na+9+w*9);qa.fillStyle="#777"}}Ba=Qa/10;for(w=1;w<10;w++){var ub=Math.round(Na+Ba*w)+ qa.fillStyle="#777";for(var Na=V/ua%o*ua,jb=Na-Qa;Na<ha;Na+=Qa){jb+=Qa;w=Math.round(Na)+0.5;if(da){qa.moveTo(w,15);qa.lineTo(w,0)}else{qa.moveTo(15,w);qa.lineTo(0,w)}Ba=(jb-V)/ua;if(o>=1)w=Math.round(Ba);else{w=(o+"").split(".")[1].length;w=Ba.toFixed(w)-0}if(w!==0&&w!==1E3&&w%1E3===0)w=w/1E3+"K";if(da){qa.fillText(w,Na+2,8);qa.fillStyle="#777"}else{Ba=(w+"").split("");for(w=0;w<Ba.length;w++){qa.fillText(Ba[w],1,Na+9+w*9);qa.fillStyle="#777"}}Ba=Qa/10;for(w=1;w<10;w++){var ub=Math.round(Na+Ba*w)+
0.5;if(za&&ub>fa){W++;qa.stroke();if(W>=za.length){w=10;Na=ha;continue}qa=za[W];Na-=3E4;ub=Math.round(Na+Ba*w)+0.5}var Cb=w%2?12:10;if(da){qa.moveTo(ub,15);qa.lineTo(ub,Cb)}else{qa.moveTo(15,ub);qa.lineTo(Cb,ub)}}}qa.strokeStyle="#666";qa.stroke()}K.scroll()}},D=[];for(c=0.1;c<1E5;c*=10){D.push(1*c);D.push(2*c);D.push(5*c)}G(true);try{var z=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var n=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k== 0.5;if(za&&ub>fa){W++;qa.stroke();if(W>=za.length){w=10;Na=ha;continue}qa=za[W];Na-=3E4;ub=Math.round(Na+Ba*w)+0.5}var Cb=w%2?12:10;if(da){qa.moveTo(ub,15);qa.lineTo(ub,Cb)}else{qa.moveTo(15,ub);qa.lineTo(Cb,ub)}}}qa.strokeStyle="#666";qa.stroke()}K.scroll()}},D=[];for(c=0.1;c<1E5;c*=10){D.push(1*c);D.push(2*c);D.push(5*c)}G(true);try{var z=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var n=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k==
"string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(E){return"\\u"+("0000"+E.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var o=0;o<k.length;o++)k[o]=n(k[o]);return"["+k.join(",")+"]"}else{o=[];for(var w in k)o.push(n(w)+":"+n(k[w]));return"{"+o.join(",")+"}"}};window.addEventListener("message",function(k){var n=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+ "string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(E){return"\\u"+("0000"+E.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var o=0;o<k.length;o++)k[o]=n(k[o]);return"["+k.join(",")+"]"}else{o=[];for(var w in k)o.push(n(w)+":"+n(k[w]));return"{"+o.join(",")+"}"}};window.addEventListener("message",function(k){var n=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+
n+";"+z(eval(k.data)),"*")}catch(o){k.source.postMessage("SVGe"+n+";error:"+o.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=g;g.ready=svgEditor.ready});b.setLang=function(k,n){a.pref("lang",k);a("#lang_select").val(k);if(n){g.runExtensions("langChanged",k);ma();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(o, n+";"+z(eval(k.data)),"*")}catch(o){k.source.postMessage("SVGe"+n+";error:"+o.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=g;g.ready=svgEditor.ready});b.setLang=function(k,n){a.pref("lang",k);a("#lang_select").val(k);if(n){g.runExtensions("langChanged",k);ma();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(o,
w){a(w).attr("title",a(o)[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(c){p?c():f.push(c)};b.runCallbacks=function(){a.each(f,function(){this()});p=true};b.loadFromString=function(c){b.ready(function(){q(c)})};b.loadFromURL=function(c,m){m||(m={});var u=m.cache,C=m.callback;b.ready(function(){a.ajax({url:c,dataType:"text",cache:!!u,success:function(s){q(s,C)},error:function(s,L,R){s.status!= w){a(w).attr("title",a(o)[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(c){p?c():f.push(c)};b.runCallbacks=function(){a.each(f,function(){this()});p=true};b.loadFromString=function(c){b.ready(function(){q(c)})};b.loadFromURL=function(c,m){m||(m={});var u=m.cache,C=m.callback;b.ready(function(){a.ajax({url:c,dataType:"text",cache:!!u,success:function(s){q(s,C)},error:function(s,L,Q){s.status!=
404&&s.responseText?q(s.responseText,C):a.alert(uiStrings.notification.URLloadFail+": \n"+R+"",C)}})})};b.loadFromDataURI=function(c){b.ready(function(){var m=c.substring(26);q(svgedit.utilities.decode64(m))})};b.addExtension=function(){var c=arguments;a(function(){g&&g.addExtension.apply(this,c)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep= 404&&s.responseText?q(s.responseText,C):a.alert(uiStrings.notification.URLloadFail+": \n"+Q+"",C)}})})};b.loadFromDataURI=function(c){b.ready(function(){var m=c.substring(26);q(svgedit.utilities.decode64(m))})};b.addExtension=function(){var c=arguments;a(function(){g&&g.addExtension.apply(this,c)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var q=this.dragCfg.dragAdjust,g=$(this).parent(),b=$(this),p=this.dragCfg.height,v=this.dragCfg.min,d=this.dragCfg.max,f=this.dragCfg.step,c=d-v>0?(d-v)/f:200,m=c/p*f,u=0,C=this.getAttribute("data-attr"),s=svgEditor.canvas,L=s.getSelectedElems(),R=svgedit.browser.isTouch(),K=true,I=c&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(g):false;b.attr("readonly","readonly");I&&!isNaN(this.dragCfg.start)&&I.css("top",this.dragCfg.start* a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var q=this.dragCfg.dragAdjust,g=$(this).parent(),b=$(this),p=this.dragCfg.height,v=this.dragCfg.min,d=this.dragCfg.max,f=this.dragCfg.step,c=d-v>0?(d-v)/f:200,m=c/p*f,u=0,C=this.getAttribute("data-attr"),s=svgEditor.canvas,L=svgedit.browser.isTouch(),Q=true,K=c&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(g):false;b.attr("readonly","readonly");K&&!isNaN(this.dragCfg.start)&&K.css("top",this.dragCfg.start*-1/m+p);this.adjustValue=
-1/m+p);this.adjustValue=function(Q,S){var N;Q=parseFloat(Q);if(isNaN(this.value))N=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){N=this.dragCfg.stepfunc(this,Q);console.log(N)}else N=Number((Number(this.value)+Number(Q)).toFixed(5));if(d!==null)N=Math.min(N,d);if(v!==null)N=Math.max(N,v);I&&this.updateCursor(N);this.value=N;g.attr("data-value",N);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,S)};g.toggleClass("draginput",g.is("label"));this.move=function(Q,S,N){if(R)Q= function(H,S){var R;H=parseFloat(H);R=isNaN(this.value)?this.dragCfg.reset:$.isFunction(this.dragCfg.stepfunc)?this.dragCfg.stepfunc(this,H):Number((Number(this.value)+Number(H)).toFixed(5));if(d!==null)R=Math.min(R,d);if(v!==null)R=Math.max(R,v);K&&this.updateCursor(R);this.value=R;g.attr("data-value",R);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,S)};g.toggleClass("draginput",g.is("label"));this.move=function(H,S,R){if(L)H=H.originalEvent.touches[0];if(u===0)u=S;S=(H.pageY-u)*
Q.originalEvent.touches[0];if(u===0)u=S;S=(Q.pageY-u)*-1;u=Q.pageY;N=S*m*q;this.adjustValue(N.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");g.removeClass("active");K=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");u=0;if(L[0]){var Q=s.undoMgr.finishUndoableChange();Q.isEmpty()||s.undoMgr.addCommandToHistory(Q)}this.adjustValue(0,K)};this.updateCursor=function(){var Q=parseFloat(this.value)*-1/m+p;I.css("top",Q)};this.start= -1;u=H.pageY;R=S*m*q;this.adjustValue(R.toFixed(f<1?1:0))};this.stop=function(){var H=s.getSelectedElems();$("body").removeClass("dragging");g.removeClass("active");Q=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");u=0;if(H[0]){H=s.undoMgr.finishUndoableChange();H.isEmpty()||s.undoMgr.addCommandToHistory(H)}this.adjustValue(0,Q)};this.updateCursor=function(){var H=parseFloat(this.value)*-1/m+p;K.css("top",H)};this.start=function(H){var S=s.getSelectedElems();
function(Q){if(R)Q=Q.originalEvent.touches[0];var S=Q.pageY,N=this.value,ga=this;s.undoMgr.beginUndoableChange(C,L);$("body").addClass("dragging");g.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(na){ga.move(na,S,parseFloat(N))});$(window).bind("mouseup.draginput touchend.draginput",function(){ga.stop()})};$(this).attr("readonly","readonly").attr("data-scale",m).attr("data-domain",p).attr("data-cursor",I!=false).bind("mousedown touchstart",function(Q){this.blur(); if(L)H=H.originalEvent.touches[0];var R=H.pageY,N=this.value,ga=this;s.undoMgr.beginUndoableChange(C,S);$("body").addClass("dragging");g.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(oa){ga.move(oa,R,parseFloat(N))});$(window).bind("mouseup.draginput touchend.draginput",function(){ga.stop()})};$(this).attr("readonly","readonly").attr("data-scale",m).attr("data-domain",p).attr("data-cursor",K!=false).bind("mousedown touchstart",function(H){this.blur();this.start(H)}).bind("dblclick taphold",
this.start(Q)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(Q){switch(Q.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(Q,S,N,ga){K&&s.undoMgr.beginUndoableChange(C,L);K=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){na.stop()}, function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(H){switch(H.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(H,S,R,N){S=s.getSelectedElems();Q&&s.undoMgr.beginUndoableChange(C,S);Q=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){ga.stop()},500);var ga=
1E3);var na=this;if(ga>0)this.adjustValue(this.dragCfg.step);else ga<0&&this.adjustValue(-this.dragCfg.step);Q.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),g=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/g+b+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=q};svgedit=svgedit||{}; this;if(N>0)this.adjustValue(this.dragCfg.step);else N<0&&this.adjustValue(-this.dragCfg.step);H.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),g=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/g+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 g=q.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+q.id+"'>"+q.label+"<span class='shortcut'>"+g+"</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 g=q.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+q.id+"'>"+q.label+"<span class='shortcut'>"+g+"</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 g(p){return!a(p).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function b(p,v){var d=p.nodeName.toLowerCase();if("area"===d){d=p.parentNode;var f=d.name;if(!p.href||!f||d.nodeName.toLowerCase()!=="map")return false;d=a("img[usemap=#"+f+"]")[0];return!!d&&g(d)}return(/input|select|textarea|button|object/.test(d)?!p.disabled:"a"==d?p.href||v:v)&&g(p)}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 g(p){return!a(p).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function b(p,v){var d=p.nodeName.toLowerCase();if("area"===d){d=p.parentNode;var f=d.name;if(!p.href||!f||d.nodeName.toLowerCase()!=="map")return false;d=a("img[usemap=#"+f+"]")[0];return!!d&&g(d)}return(/input|select|textarea|button|object/.test(d)?!p.disabled:"a"==d?p.href||v:v)&&g(p)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",
@ -561,10 +561,10 @@ b.css("opacity"));b.css("opacity",p.opacity)},stop:function(q,g){var b=a(this).d
b.axis!="x")g.overflowOffset.top+g.scrollParent[0].offsetHeight-q.pageY<b.scrollSensitivity?g.scrollParent[0].scrollTop=p=g.scrollParent[0].scrollTop+b.scrollSpeed:q.pageY-g.overflowOffset.top<b.scrollSensitivity&&(g.scrollParent[0].scrollTop=p=g.scrollParent[0].scrollTop-b.scrollSpeed);if(!b.axis||b.axis!="y")g.overflowOffset.left+g.scrollParent[0].offsetWidth-q.pageX<b.scrollSensitivity?g.scrollParent[0].scrollLeft=p=g.scrollParent[0].scrollLeft+b.scrollSpeed:q.pageX-g.overflowOffset.left<b.scrollSensitivity&& b.axis!="x")g.overflowOffset.top+g.scrollParent[0].offsetHeight-q.pageY<b.scrollSensitivity?g.scrollParent[0].scrollTop=p=g.scrollParent[0].scrollTop+b.scrollSpeed:q.pageY-g.overflowOffset.top<b.scrollSensitivity&&(g.scrollParent[0].scrollTop=p=g.scrollParent[0].scrollTop-b.scrollSpeed);if(!b.axis||b.axis!="y")g.overflowOffset.left+g.scrollParent[0].offsetWidth-q.pageX<b.scrollSensitivity?g.scrollParent[0].scrollLeft=p=g.scrollParent[0].scrollLeft+b.scrollSpeed:q.pageX-g.overflowOffset.left<b.scrollSensitivity&&
(g.scrollParent[0].scrollLeft=p=g.scrollParent[0].scrollLeft-b.scrollSpeed)}else{if(!b.axis||b.axis!="x")q.pageY-a(document).scrollTop()<b.scrollSensitivity?p=a(document).scrollTop(a(document).scrollTop()-b.scrollSpeed):a(window).height()-(q.pageY-a(document).scrollTop())<b.scrollSensitivity&&(p=a(document).scrollTop(a(document).scrollTop()+b.scrollSpeed));if(!b.axis||b.axis!="y")q.pageX-a(document).scrollLeft()<b.scrollSensitivity?p=a(document).scrollLeft(a(document).scrollLeft()-b.scrollSpeed): (g.scrollParent[0].scrollLeft=p=g.scrollParent[0].scrollLeft-b.scrollSpeed)}else{if(!b.axis||b.axis!="x")q.pageY-a(document).scrollTop()<b.scrollSensitivity?p=a(document).scrollTop(a(document).scrollTop()-b.scrollSpeed):a(window).height()-(q.pageY-a(document).scrollTop())<b.scrollSensitivity&&(p=a(document).scrollTop(a(document).scrollTop()+b.scrollSpeed));if(!b.axis||b.axis!="y")q.pageX-a(document).scrollLeft()<b.scrollSensitivity?p=a(document).scrollLeft(a(document).scrollLeft()-b.scrollSpeed):
a(window).width()-(q.pageX-a(document).scrollLeft())<b.scrollSensitivity&&(p=a(document).scrollLeft(a(document).scrollLeft()+b.scrollSpeed))}p!==false&&a.ui.ddmanager&&!b.dropBehaviour&&a.ui.ddmanager.prepareOffsets(g,q)}});a.ui.plugin.add("draggable","snap",{start:function(){var q=a(this).data("draggable"),g=q.options;q.snapElements=[];a(g.snap.constructor!=String?g.snap.items||":data(draggable)":g.snap).each(function(){var b=a(this),p=b.offset();this!=q.element[0]&&q.snapElements.push({item:this, a(window).width()-(q.pageX-a(document).scrollLeft())<b.scrollSensitivity&&(p=a(document).scrollLeft(a(document).scrollLeft()+b.scrollSpeed))}p!==false&&a.ui.ddmanager&&!b.dropBehaviour&&a.ui.ddmanager.prepareOffsets(g,q)}});a.ui.plugin.add("draggable","snap",{start:function(){var q=a(this).data("draggable"),g=q.options;q.snapElements=[];a(g.snap.constructor!=String?g.snap.items||":data(draggable)":g.snap).each(function(){var b=a(this),p=b.offset();this!=q.element[0]&&q.snapElements.push({item:this,
width:b.outerWidth(),height:b.outerHeight(),top:p.top,left:p.left})})},drag:function(q,g){for(var b=a(this).data("draggable"),p=b.options,v=p.snapTolerance,d=g.offset.left,f=d+b.helperProportions.width,c=g.offset.top,m=c+b.helperProportions.height,u=b.snapElements.length-1;u>=0;u--){var C=b.snapElements[u].left,s=C+b.snapElements[u].width,L=b.snapElements[u].top,R=L+b.snapElements[u].height;if(C-v<d&&d<s+v&&L-v<c&&c<R+v||C-v<d&&d<s+v&&L-v<m&&m<R+v||C-v<f&&f<s+v&&L-v<c&&c<R+v||C-v<f&&f<s+v&&L-v<m&& width:b.outerWidth(),height:b.outerHeight(),top:p.top,left:p.left})})},drag:function(q,g){for(var b=a(this).data("draggable"),p=b.options,v=p.snapTolerance,d=g.offset.left,f=d+b.helperProportions.width,c=g.offset.top,m=c+b.helperProportions.height,u=b.snapElements.length-1;u>=0;u--){var C=b.snapElements[u].left,s=C+b.snapElements[u].width,L=b.snapElements[u].top,Q=L+b.snapElements[u].height;if(C-v<d&&d<s+v&&L-v<c&&c<Q+v||C-v<d&&d<s+v&&L-v<m&&m<Q+v||C-v<f&&f<s+v&&L-v<c&&c<Q+v||C-v<f&&f<s+v&&L-v<m&&
m<R+v){if(p.snapMode!="inner"){var K=Math.abs(L-m)<=v,I=Math.abs(R-c)<=v,Q=Math.abs(C-f)<=v,S=Math.abs(s-d)<=v;K&&(g.position.top=b._convertPositionTo("relative",{top:L-b.helperProportions.height,left:0}).top-b.margins.top);I&&(g.position.top=b._convertPositionTo("relative",{top:R,left:0}).top-b.margins.top);Q&&(g.position.left=b._convertPositionTo("relative",{top:0,left:C-b.helperProportions.width}).left-b.margins.left);S&&(g.position.left=b._convertPositionTo("relative",{top:0,left:s}).left-b.margins.left)}var N= m<Q+v){if(p.snapMode!="inner"){var K=Math.abs(L-m)<=v,H=Math.abs(Q-c)<=v,S=Math.abs(C-f)<=v,R=Math.abs(s-d)<=v;K&&(g.position.top=b._convertPositionTo("relative",{top:L-b.helperProportions.height,left:0}).top-b.margins.top);H&&(g.position.top=b._convertPositionTo("relative",{top:Q,left:0}).top-b.margins.top);S&&(g.position.left=b._convertPositionTo("relative",{top:0,left:C-b.helperProportions.width}).left-b.margins.left);R&&(g.position.left=b._convertPositionTo("relative",{top:0,left:s}).left-b.margins.left)}var N=
K||I||Q||S;if(p.snapMode!="outer"){K=Math.abs(L-c)<=v;I=Math.abs(R-m)<=v;Q=Math.abs(C-d)<=v;S=Math.abs(s-f)<=v;K&&(g.position.top=b._convertPositionTo("relative",{top:L,left:0}).top-b.margins.top);I&&(g.position.top=b._convertPositionTo("relative",{top:R-b.helperProportions.height,left:0}).top-b.margins.top);Q&&(g.position.left=b._convertPositionTo("relative",{top:0,left:C}).left-b.margins.left);S&&(g.position.left=b._convertPositionTo("relative",{top:0,left:s-b.helperProportions.width}).left-b.margins.left)}!b.snapElements[u].snapping&& K||H||S||R;if(p.snapMode!="outer"){K=Math.abs(L-c)<=v;H=Math.abs(Q-m)<=v;S=Math.abs(C-d)<=v;R=Math.abs(s-f)<=v;K&&(g.position.top=b._convertPositionTo("relative",{top:L,left:0}).top-b.margins.top);H&&(g.position.top=b._convertPositionTo("relative",{top:Q-b.helperProportions.height,left:0}).top-b.margins.top);S&&(g.position.left=b._convertPositionTo("relative",{top:0,left:C}).left-b.margins.left);R&&(g.position.left=b._convertPositionTo("relative",{top:0,left:s-b.helperProportions.width}).left-b.margins.left)}!b.snapElements[u].snapping&&
(K||I||Q||S||N)&&b.options.snap.snap&&b.options.snap.snap.call(b.element,q,a.extend(b._uiHash(),{snapItem:b.snapElements[u].item}));b.snapElements[u].snapping=K||I||Q||S||N}else{b.snapElements[u].snapping&&b.options.snap.release&&b.options.snap.release.call(b.element,q,a.extend(b._uiHash(),{snapItem:b.snapElements[u].item}));b.snapElements[u].snapping=false}}}});a.ui.plugin.add("draggable","stack",{start:function(){var q=a(this).data("draggable").options;q=a.makeArray(a(q.stack)).sort(function(b, (K||H||S||R||N)&&b.options.snap.snap&&b.options.snap.snap.call(b.element,q,a.extend(b._uiHash(),{snapItem:b.snapElements[u].item}));b.snapElements[u].snapping=K||H||S||R||N}else{b.snapElements[u].snapping&&b.options.snap.release&&b.options.snap.release.call(b.element,q,a.extend(b._uiHash(),{snapItem:b.snapElements[u].item}));b.snapElements[u].snapping=false}}}});a.ui.plugin.add("draggable","stack",{start:function(){var q=a(this).data("draggable").options;q=a.makeArray(a(q.stack)).sort(function(b,
p){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(p).css("zIndex"),10)||0)});if(q.length){var g=parseInt(q[0].style.zIndex)||0;a(q).each(function(b){this.style.zIndex=g+b});this[0].style.zIndex=g+q.length}}});a.ui.plugin.add("draggable","zIndex",{start:function(q,g){var b=a(g.helper),p=a(this).data("draggable").options;b.css("zIndex")&&(p._zIndex=b.css("zIndex"));b.css("zIndex",p.zIndex)},stop:function(q,g){var b=a(this).data("draggable").options;b._zIndex&&a(g.helper).css("zIndex",b._zIndex)}})})(jQuery); p){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(p).css("zIndex"),10)||0)});if(q.length){var g=parseInt(q[0].style.zIndex)||0;a(q).each(function(b){this.style.zIndex=g+b});this[0].style.zIndex=g+q.length}}});a.ui.plugin.add("draggable","zIndex",{start:function(q,g){var b=a(g.helper),p=a(this).data("draggable").options;b.css("zIndex")&&(p._zIndex=b.css("zIndex"));b.css("zIndex",p.zIndex)},stop:function(q,g){var b=a(this).data("draggable").options;b._zIndex&&a(g.helper).css("zIndex",b._zIndex)}})})(jQuery);
(function(a){a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var q=this,g=this.options,b=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),p=g.values&&g.values.length||1,v=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+ (function(a){a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var q=this,g=this.options,b=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),p=g.values&&g.values.length||1,v=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
this.orientation+" ui-widget ui-widget-content ui-corner-all"+(g.disabled?" ui-slider-disabled ui-disabled":""));this.range=a([]);g.range&&(g.range===true&&(g.values||(g.values=[this._valueMin(),this._valueMin()]),g.values.length&&g.values.length!==2&&(g.values=[g.values[0],g.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(g.range==="min"||g.range==="max"?" ui-slider-range-"+g.range:"")));for(var d=b.length;d<p;d+=1)v.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>"); this.orientation+" ui-widget ui-widget-content ui-corner-all"+(g.disabled?" ui-slider-disabled ui-disabled":""));this.range=a([]);g.range&&(g.range===true&&(g.values||(g.values=[this._valueMin(),this._valueMin()]),g.values.length&&g.values.length!==2&&(g.values=[g.values[0],g.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(g.range==="min"||g.range==="max"?" ui-slider-range-"+g.range:"")));for(var d=b.length;d<p;d+=1)v.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
@ -584,47 +584,47 @@ this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui
return g=this._trimAlignValue(g)}g=this.options.values.slice();for(b=0;b<g.length;b+=1)g[b]=this._trimAlignValue(g[b]);return g},_trimAlignValue:function(q){if(q<=this._valueMin())return this._valueMin();if(q>=this._valueMax())return this._valueMax();var g=this.options.step>0?this.options.step:1,b=(q-this._valueMin())%g;q=q-b;Math.abs(b)*2>=g&&(q+=b>0?g:-g);return parseFloat(q.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var q= return g=this._trimAlignValue(g)}g=this.options.values.slice();for(b=0;b<g.length;b+=1)g[b]=this._trimAlignValue(g[b]);return g},_trimAlignValue:function(q){if(q<=this._valueMin())return this._valueMin();if(q>=this._valueMax())return this._valueMax();var g=this.options.step>0?this.options.step:1,b=(q-this._valueMin())%g;q=q-b;Math.abs(b)*2>=g&&(q+=b>0?g:-g);return parseFloat(q.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var q=
this.options.range,g=this.options,b=this,p=this._animateOff?false:g.animate,v,d={},f,c,m,u;this.options.values&&this.options.values.length?this.handles.each(function(C){v=(b.values(C)-b._valueMin())/(b._valueMax()-b._valueMin())*100;d[b.orientation==="horizontal"?"left":"bottom"]=v+"%";a(this).stop(1,1)[p?"animate":"css"](d,g.animate);b.options.range===true&&(b.orientation==="horizontal"?(C===0&&b.range.stop(1,1)[p?"animate":"css"]({left:v+"%"},g.animate),C===1&&b.range[p?"animate":"css"]({width:v- this.options.range,g=this.options,b=this,p=this._animateOff?false:g.animate,v,d={},f,c,m,u;this.options.values&&this.options.values.length?this.handles.each(function(C){v=(b.values(C)-b._valueMin())/(b._valueMax()-b._valueMin())*100;d[b.orientation==="horizontal"?"left":"bottom"]=v+"%";a(this).stop(1,1)[p?"animate":"css"](d,g.animate);b.options.range===true&&(b.orientation==="horizontal"?(C===0&&b.range.stop(1,1)[p?"animate":"css"]({left:v+"%"},g.animate),C===1&&b.range[p?"animate":"css"]({width:v-
f+"%"},{queue:false,duration:g.animate})):(C===0&&b.range.stop(1,1)[p?"animate":"css"]({bottom:v+"%"},g.animate),C===1&&b.range[p?"animate":"css"]({height:v-f+"%"},{queue:false,duration:g.animate})));f=v}):(c=this.value(),m=this._valueMin(),u=this._valueMax(),v=u!==m?(c-m)/(u-m)*100:0,d[b.orientation==="horizontal"?"left":"bottom"]=v+"%",this.handle.stop(1,1)[p?"animate":"css"](d,g.animate),q==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[p?"animate":"css"]({width:v+"%"},g.animate), f+"%"},{queue:false,duration:g.animate})):(C===0&&b.range.stop(1,1)[p?"animate":"css"]({bottom:v+"%"},g.animate),C===1&&b.range[p?"animate":"css"]({height:v-f+"%"},{queue:false,duration:g.animate})));f=v}):(c=this.value(),m=this._valueMin(),u=this._valueMax(),v=u!==m?(c-m)/(u-m)*100:0,d[b.orientation==="horizontal"?"left":"bottom"]=v+"%",this.handle.stop(1,1)[p?"animate":"css"](d,g.animate),q==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[p?"animate":"css"]({width:v+"%"},g.animate),
q==="max"&&this.orientation==="horizontal"&&this.range[p?"animate":"css"]({width:100-v+"%"},{queue:false,duration:g.animate}),q==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[p?"animate":"css"]({height:v+"%"},g.animate),q==="max"&&this.orientation==="vertical"&&this.range[p?"animate":"css"]({height:100-v+"%"},{queue:false,duration:g.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(d,f){if(f===undefined)f=0;return Math.round(d*Math.pow(10,f))/Math.pow(10,f)};var q=function(d,f){var c=this,m=d.find("img:first"),u=0,C=100,s=100,L=0,R=100,K=100,I=0,Q=0,S,N,ga=[],na=function(T){for(var Z=0;Z<ga.length;Z++)ga[Z].call(c,c,T)},X=function(T){var Z=d.offset();S={l:Z.left|0,t:Z.top|0};clearTimeout(N);N=setTimeout(function(){Aa.call(c,T)},0);a(document).bind("mousemove",U).bind("mouseup",ea);T.preventDefault()},U=function(T){clearTimeout(N);N=setTimeout(function(){Aa.call(c, q==="max"&&this.orientation==="horizontal"&&this.range[p?"animate":"css"]({width:100-v+"%"},{queue:false,duration:g.animate}),q==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[p?"animate":"css"]({height:v+"%"},g.animate),q==="max"&&this.orientation==="vertical"&&this.range[p?"animate":"css"]({height:100-v+"%"},{queue:false,duration:g.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(d,f){if(f===undefined)f=0;return Math.round(d*Math.pow(10,f))/Math.pow(10,f)};var q=function(d,f){var c=this,m=d.find("img:first"),u=0,C=100,s=100,L=0,Q=100,K=100,H=0,S=0,R,N,ga=[],oa=function(T){for(var Z=0;Z<ga.length;Z++)ga[Z].call(c,c,T)},X=function(T){var Z=d.offset();R={l:Z.left|0,t:Z.top|0};clearTimeout(N);N=setTimeout(function(){Aa.call(c,T)},0);a(document).bind("mousemove",U).bind("mouseup",ea);T.preventDefault()},U=function(T){clearTimeout(N);N=setTimeout(function(){Aa.call(c,
T)},0);T.stopPropagation();T.preventDefault();return false},ea=function(T){a(document).unbind("mouseup",ea).unbind("mousemove",U);T.stopPropagation();T.preventDefault();return false},Aa=function(T){var Z=T.pageX-S.l;T=T.pageY-S.t;var oa=d.w,pa=d.h;if(Z<0)Z=0;else if(Z>oa)Z=oa;if(T<0)T=0;else if(T>pa)T=pa;ja.call(c,"xy",{x:Z/oa*s+u,y:T/pa*K+L})},ja=function(T,Z,oa){if(Z===undefined){if(T===undefined||T==null)T="xy";switch(T.toLowerCase()){case "x":return I;case "y":return Q;default:return{x:I,y:Q}}}if(!(oa!= T)},0);T.stopPropagation();T.preventDefault();return false},ea=function(T){a(document).unbind("mouseup",ea).unbind("mousemove",U);T.stopPropagation();T.preventDefault();return false},Aa=function(T){var Z=T.pageX-R.l;T=T.pageY-R.t;var na=d.w,pa=d.h;if(Z<0)Z=0;else if(Z>na)Z=na;if(T<0)T=0;else if(T>pa)T=pa;ja.call(c,"xy",{x:Z/na*s+u,y:T/pa*K+L})},ja=function(T,Z,na){if(Z===undefined){if(T===undefined||T==null)T="xy";switch(T.toLowerCase()){case "x":return H;case "y":return S;default:return{x:H,y:S}}}if(!(na!=
null&&oa==c)){var pa=false,ma,la;if(T==null)T="xy";switch(T.toLowerCase()){case "x":ma=Z&&(Z.x&&Z.x|0||Z|0)||0;break;case "y":la=Z&&(Z.y&&Z.y|0||Z|0)||0;break;default:ma=Z&&Z.x&&Z.x|0||0;la=Z&&Z.y&&Z.y|0||0}if(ma!=null){if(ma<u)ma=u;else if(ma>C)ma=C;if(I!=ma){I=ma;pa=true}}if(la!=null){if(la<L)la=L;else if(la>R)la=R;if(Q!=la){Q=la;pa=true}}pa&&na.call(c,oa||c)}},ba=function(T){a.isFunction(T)&&ga.push(T)};a.extend(true,c,{val:ja,range:function(T,Z){if(Z===undefined){if(T===undefined||T==null)T="all"; null&&na==c)){var pa=false,ma,la;if(T==null)T="xy";switch(T.toLowerCase()){case "x":ma=Z&&(Z.x&&Z.x|0||Z|0)||0;break;case "y":la=Z&&(Z.y&&Z.y|0||Z|0)||0;break;default:ma=Z&&Z.x&&Z.x|0||0;la=Z&&Z.y&&Z.y|0||0}if(ma!=null){if(ma<u)ma=u;else if(ma>C)ma=C;if(H!=ma){H=ma;pa=true}}if(la!=null){if(la<L)la=L;else if(la>Q)la=Q;if(S!=la){S=la;pa=true}}pa&&oa.call(c,na||c)}},ba=function(T){a.isFunction(T)&&ga.push(T)};a.extend(true,c,{val:ja,range:function(T,Z){if(Z===undefined){if(T===undefined||T==null)T="all";
switch(T.toLowerCase()){case "minx":return u;case "maxx":return C;case "rangex":return{minX:u,maxX:C,rangeX:s};case "miny":return L;case "maxy":return R;case "rangey":return{minY:L,maxY:R,rangeY:K};default:return{minX:u,maxX:C,rangeX:s,minY:L,maxY:R,rangeY:K}}}var oa,pa,ma,la;if(T==null)T="all";switch(T.toLowerCase()){case "minx":oa=Z&&(Z.minX&&Z.minX|0||Z|0)||0;break;case "maxx":pa=Z&&(Z.maxX&&Z.maxX|0||Z|0)||0;break;case "rangex":oa=Z&&Z.minX&&Z.minX|0||0;pa=Z&&Z.maxX&&Z.maxX|0||0;break;case "miny":ma= switch(T.toLowerCase()){case "minx":return u;case "maxx":return C;case "rangex":return{minX:u,maxX:C,rangeX:s};case "miny":return L;case "maxy":return Q;case "rangey":return{minY:L,maxY:Q,rangeY:K};default:return{minX:u,maxX:C,rangeX:s,minY:L,maxY:Q,rangeY:K}}}var na,pa,ma,la;if(T==null)T="all";switch(T.toLowerCase()){case "minx":na=Z&&(Z.minX&&Z.minX|0||Z|0)||0;break;case "maxx":pa=Z&&(Z.maxX&&Z.maxX|0||Z|0)||0;break;case "rangex":na=Z&&Z.minX&&Z.minX|0||0;pa=Z&&Z.maxX&&Z.maxX|0||0;break;case "miny":ma=
Z&&(Z.minY&&Z.minY|0||Z|0)||0;break;case "maxy":la=Z&&(Z.maxY&&Z.maxY|0||Z|0)||0;break;case "rangey":ma=Z&&Z.minY&&Z.minY|0||0;la=Z&&Z.maxY&&Z.maxY|0||0;break;default:oa=Z&&Z.minX&&Z.minX|0||0;pa=Z&&Z.maxX&&Z.maxX|0||0;ma=Z&&Z.minY&&Z.minY|0||0;la=Z&&Z.maxY&&Z.maxY|0||0}if(oa!=null&&u!=oa){u=oa;s=C-u}if(pa!=null&&C!=pa){C=pa;s=C-u}if(ma!=null&&L!=ma){L=ma;K=R-L}if(la!=null&&R!=la){R=la;K=R-L}},bind:ba,unbind:function(T){if(a.isFunction(T))for(var Z;(Z=a.inArray(T,ga))!=-1;)ga.splice(Z,1)},destroy:function(){a(document).unbind("mouseup", Z&&(Z.minY&&Z.minY|0||Z|0)||0;break;case "maxy":la=Z&&(Z.maxY&&Z.maxY|0||Z|0)||0;break;case "rangey":ma=Z&&Z.minY&&Z.minY|0||0;la=Z&&Z.maxY&&Z.maxY|0||0;break;default:na=Z&&Z.minX&&Z.minX|0||0;pa=Z&&Z.maxX&&Z.maxX|0||0;ma=Z&&Z.minY&&Z.minY|0||0;la=Z&&Z.maxY&&Z.maxY|0||0}if(na!=null&&u!=na){u=na;s=C-u}if(pa!=null&&C!=pa){C=pa;s=C-u}if(ma!=null&&L!=ma){L=ma;K=Q-L}if(la!=null&&Q!=la){Q=la;K=Q-L}},bind:ba,unbind:function(T){if(a.isFunction(T))for(var Z;(Z=a.inArray(T,ga))!=-1;)ga.splice(Z,1)},destroy:function(){a(document).unbind("mouseup",
ea).unbind("mousemove",U);d.unbind("mousedown",X);ga=m=d=null}});m.src=f.arrow&&f.arrow.image;m.w=f.arrow&&f.arrow.width||m.width();m.h=f.arrow&&f.arrow.height||m.height();d.w=f.map&&f.map.width||d.width();d.h=f.map&&f.map.height||d.height();d.bind("mousedown",X);ba.call(c,function(){var T=0,Z=0,oa=d.w,pa=d.h,ma=m.w,la=m.h;setTimeout(function(){if(s>0)T=I==C?oa:I/s*oa|0;if(K>0)Z=Q==R?pa:Q/K*pa|0;if(ma>=oa)T=(oa>>1)-(ma>>1);else T-=ma>>1;if(la>=pa)Z=(pa>>1)-(la>>1);else Z-=la>>1;m.css({left:T+"px", ea).unbind("mousemove",U);d.unbind("mousedown",X);ga=m=d=null}});m.src=f.arrow&&f.arrow.image;m.w=f.arrow&&f.arrow.width||m.width();m.h=f.arrow&&f.arrow.height||m.height();d.w=f.map&&f.map.width||d.width();d.h=f.map&&f.map.height||d.height();d.bind("mousedown",X);ba.call(c,function(){var T=0,Z=0,na=d.w,pa=d.h,ma=m.w,la=m.h;setTimeout(function(){if(s>0)T=H==C?na:H/s*na|0;if(K>0)Z=S==Q?pa:S/K*pa|0;if(ma>=na)T=(na>>1)-(ma>>1);else T-=ma>>1;if(la>=pa)Z=(pa>>1)-(la>>1);else Z-=la>>1;m.css({left:T+"px",
top:Z+"px"})},0)})},g=function(d,f,c,m){var u=this;d=d.find("td.Text input");var C=d.eq(3),s=d.eq(4),L=d.eq(5),R=d.length>7?d.eq(6):null,K=d.eq(0),I=d.eq(1),Q=d.eq(2),S=d.eq(d.length>7?7:6),N=d.length>7?d.eq(8):null,ga=function(ja){if(!(ja.target.value==""&&ja.target!=S.get(0)&&(c!=null&&ja.target!=c.get(0)||c==null))){if(!U(ja))return ja;switch(ja.target){case C.get(0):switch(ja.keyCode){case 38:C.val(ea.call(u,(C.val()<<0)+1,0,255));f.val("r",C.val(),ja.target);return false;case 40:C.val(ea.call(u, top:Z+"px"})},0)})},g=function(d,f,c,m){var u=this;d=d.find("td.Text input");var C=d.eq(3),s=d.eq(4),L=d.eq(5),Q=d.length>7?d.eq(6):null,K=d.eq(0),H=d.eq(1),S=d.eq(2),R=d.eq(d.length>7?7:6),N=d.length>7?d.eq(8):null,ga=function(ja){if(!(ja.target.value==""&&ja.target!=R.get(0)&&(c!=null&&ja.target!=c.get(0)||c==null))){if(!U(ja))return ja;switch(ja.target){case C.get(0):switch(ja.keyCode){case 38:C.val(ea.call(u,(C.val()<<0)+1,0,255));f.val("r",C.val(),ja.target);return false;case 40:C.val(ea.call(u,
(C.val()<<0)-1,0,255));f.val("r",C.val(),ja.target);return false}break;case s.get(0):switch(ja.keyCode){case 38:s.val(ea.call(u,(s.val()<<0)+1,0,255));f.val("g",s.val(),ja.target);return false;case 40:s.val(ea.call(u,(s.val()<<0)-1,0,255));f.val("g",s.val(),ja.target);return false}break;case L.get(0):switch(ja.keyCode){case 38:L.val(ea.call(u,(L.val()<<0)+1,0,255));f.val("b",L.val(),ja.target);return false;case 40:L.val(ea.call(u,(L.val()<<0)-1,0,255));f.val("b",L.val(),ja.target);return false}break; (C.val()<<0)-1,0,255));f.val("r",C.val(),ja.target);return false}break;case s.get(0):switch(ja.keyCode){case 38:s.val(ea.call(u,(s.val()<<0)+1,0,255));f.val("g",s.val(),ja.target);return false;case 40:s.val(ea.call(u,(s.val()<<0)-1,0,255));f.val("g",s.val(),ja.target);return false}break;case L.get(0):switch(ja.keyCode){case 38:L.val(ea.call(u,(L.val()<<0)+1,0,255));f.val("b",L.val(),ja.target);return false;case 40:L.val(ea.call(u,(L.val()<<0)-1,0,255));f.val("b",L.val(),ja.target);return false}break;
case R&&R.get(0):switch(ja.keyCode){case 38:R.val(ea.call(u,parseFloat(R.val())+1,0,100));f.val("a",Math.precision(R.val()*255/100,m),ja.target);return false;case 40:R.val(ea.call(u,parseFloat(R.val())-1,0,100));f.val("a",Math.precision(R.val()*255/100,m),ja.target);return false}break;case K.get(0):switch(ja.keyCode){case 38:K.val(ea.call(u,(K.val()<<0)+1,0,360));f.val("h",K.val(),ja.target);return false;case 40:K.val(ea.call(u,(K.val()<<0)-1,0,360));f.val("h",K.val(),ja.target);return false}break; case Q&&Q.get(0):switch(ja.keyCode){case 38:Q.val(ea.call(u,parseFloat(Q.val())+1,0,100));f.val("a",Math.precision(Q.val()*255/100,m),ja.target);return false;case 40:Q.val(ea.call(u,parseFloat(Q.val())-1,0,100));f.val("a",Math.precision(Q.val()*255/100,m),ja.target);return false}break;case K.get(0):switch(ja.keyCode){case 38:K.val(ea.call(u,(K.val()<<0)+1,0,360));f.val("h",K.val(),ja.target);return false;case 40:K.val(ea.call(u,(K.val()<<0)-1,0,360));f.val("h",K.val(),ja.target);return false}break;
case I.get(0):switch(ja.keyCode){case 38:I.val(ea.call(u,(I.val()<<0)+1,0,100));f.val("s",I.val(),ja.target);return false;case 40:I.val(ea.call(u,(I.val()<<0)-1,0,100));f.val("s",I.val(),ja.target);return false}break;case Q.get(0):switch(ja.keyCode){case 38:Q.val(ea.call(u,(Q.val()<<0)+1,0,100));f.val("v",Q.val(),ja.target);return false;case 40:Q.val(ea.call(u,(Q.val()<<0)-1,0,100));f.val("v",Q.val(),ja.target);return false}}}},na=function(ja){if(!(ja.target.value==""&&ja.target!=S.get(0)&&(c!=null&& case H.get(0):switch(ja.keyCode){case 38:H.val(ea.call(u,(H.val()<<0)+1,0,100));f.val("s",H.val(),ja.target);return false;case 40:H.val(ea.call(u,(H.val()<<0)-1,0,100));f.val("s",H.val(),ja.target);return false}break;case S.get(0):switch(ja.keyCode){case 38:S.val(ea.call(u,(S.val()<<0)+1,0,100));f.val("v",S.val(),ja.target);return false;case 40:S.val(ea.call(u,(S.val()<<0)-1,0,100));f.val("v",S.val(),ja.target);return false}}}},oa=function(ja){if(!(ja.target.value==""&&ja.target!=R.get(0)&&(c!=null&&
ja.target!=c.get(0)||c==null))){if(!U(ja))return ja;switch(ja.target){case C.get(0):C.val(ea.call(u,C.val(),0,255));f.val("r",C.val(),ja.target);break;case s.get(0):s.val(ea.call(u,s.val(),0,255));f.val("g",s.val(),ja.target);break;case L.get(0):L.val(ea.call(u,L.val(),0,255));f.val("b",L.val(),ja.target);break;case R&&R.get(0):R.val(ea.call(u,R.val(),0,100));f.val("a",Math.precision(R.val()*255/100,m),ja.target);break;case K.get(0):K.val(ea.call(u,K.val(),0,360));f.val("h",K.val(),ja.target);break; ja.target!=c.get(0)||c==null))){if(!U(ja))return ja;switch(ja.target){case C.get(0):C.val(ea.call(u,C.val(),0,255));f.val("r",C.val(),ja.target);break;case s.get(0):s.val(ea.call(u,s.val(),0,255));f.val("g",s.val(),ja.target);break;case L.get(0):L.val(ea.call(u,L.val(),0,255));f.val("b",L.val(),ja.target);break;case Q&&Q.get(0):Q.val(ea.call(u,Q.val(),0,100));f.val("a",Math.precision(Q.val()*255/100,m),ja.target);break;case K.get(0):K.val(ea.call(u,K.val(),0,360));f.val("h",K.val(),ja.target);break;
case I.get(0):I.val(ea.call(u,I.val(),0,100));f.val("s",I.val(),ja.target);break;case Q.get(0):Q.val(ea.call(u,Q.val(),0,100));f.val("v",Q.val(),ja.target);break;case S.get(0):S.val(S.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));c&&c.val(S.val());f.val("hex",S.val()!=""?S.val():null,ja.target);break;case c&&c.get(0):c.val(c.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));S.val(c.val());f.val("hex",c.val()!=""?c.val():null,ja.target);break;case N&&N.get(0):N.val(N.val().replace(/[^a-fA-F0-9]/g, case H.get(0):H.val(ea.call(u,H.val(),0,100));f.val("s",H.val(),ja.target);break;case S.get(0):S.val(ea.call(u,S.val(),0,100));f.val("v",S.val(),ja.target);break;case R.get(0):R.val(R.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));c&&c.val(R.val());f.val("hex",R.val()!=""?R.val():null,ja.target);break;case c&&c.get(0):c.val(c.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));R.val(c.val());f.val("hex",c.val()!=""?c.val():null,ja.target);break;case N&&N.get(0):N.val(N.val().replace(/[^a-fA-F0-9]/g,
"").toLowerCase().substring(0,2));f.val("a",N.val()!=null?parseInt(N.val(),16):null,ja.target)}}},X=function(ja){if(f.val()!=null)switch(ja.target){case C.get(0):C.val(f.val("r"));break;case s.get(0):s.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,m));break;case K.get(0):K.val(f.val("h"));break;case I.get(0):I.val(f.val("s"));break;case Q.get(0):Q.val(f.val("v"));break;case S.get(0):case c&&c.get(0):S.val(f.val("hex"));c&&c.val(f.val("hex")); "").toLowerCase().substring(0,2));f.val("a",N.val()!=null?parseInt(N.val(),16):null,ja.target)}}},X=function(ja){if(f.val()!=null)switch(ja.target){case C.get(0):C.val(f.val("r"));break;case s.get(0):s.val(f.val("g"));break;case L.get(0):L.val(f.val("b"));break;case Q&&Q.get(0):Q.val(Math.precision(f.val("a")*100/255,m));break;case K.get(0):K.val(f.val("h"));break;case H.get(0):H.val(f.val("s"));break;case S.get(0):S.val(f.val("v"));break;case R.get(0):case c&&c.get(0):R.val(f.val("hex"));c&&c.val(f.val("hex"));
break;case N&&N.get(0):N.val(f.val("ahex").substring(6))}},U=function(ja){switch(ja.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ja.ctrlKey)return false}return true},ea=function(ja,ba,T){if(ja==""||isNaN(ja))return ba;if(ja>T)return T;if(ja<ba)return ba;return ja},Aa=function(ja,ba){var T=ja.val("all");if(ba!=C.get(0))C.val(T!=null?T.r:"");if(ba!=s.get(0))s.val(T!=null?T.g:"");if(ba!=L.get(0))L.val(T!=null?T.b:"");if(R&&ba!=R.get(0))R.val(T!= break;case N&&N.get(0):N.val(f.val("ahex").substring(6))}},U=function(ja){switch(ja.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ja.ctrlKey)return false}return true},ea=function(ja,ba,T){if(ja==""||isNaN(ja))return ba;if(ja>T)return T;if(ja<ba)return ba;return ja},Aa=function(ja,ba){var T=ja.val("all");if(ba!=C.get(0))C.val(T!=null?T.r:"");if(ba!=s.get(0))s.val(T!=null?T.g:"");if(ba!=L.get(0))L.val(T!=null?T.b:"");if(Q&&ba!=Q.get(0))Q.val(T!=
null?Math.precision(T.a*100/255,m):"");if(ba!=K.get(0))K.val(T!=null?T.h:"");if(ba!=I.get(0))I.val(T!=null?T.s:"");if(ba!=Q.get(0))Q.val(T!=null?T.v:"");if(ba!=S.get(0)&&(c&&ba!=c.get(0)||!c))S.val(T!=null?T.hex:"");if(c&&ba!=c.get(0)&&ba!=S.get(0))c.val(T!=null?T.hex:"");if(N&&ba!=N.get(0))N.val(T!=null?T.ahex.substring(6):"")};a.extend(true,u,{destroy:function(){C.add(s).add(L).add(R).add(K).add(I).add(Q).add(S).add(c).add(N).unbind("keyup",na).unbind("blur",X);C.add(s).add(L).add(R).add(K).add(I).add(Q).unbind("keydown", null?Math.precision(T.a*100/255,m):"");if(ba!=K.get(0))K.val(T!=null?T.h:"");if(ba!=H.get(0))H.val(T!=null?T.s:"");if(ba!=S.get(0))S.val(T!=null?T.v:"");if(ba!=R.get(0)&&(c&&ba!=c.get(0)||!c))R.val(T!=null?T.hex:"");if(c&&ba!=c.get(0)&&ba!=R.get(0))c.val(T!=null?T.hex:"");if(N&&ba!=N.get(0))N.val(T!=null?T.ahex.substring(6):"")};a.extend(true,u,{destroy:function(){C.add(s).add(L).add(Q).add(K).add(H).add(S).add(R).add(c).add(N).unbind("keyup",oa).unbind("blur",X);C.add(s).add(L).add(Q).add(K).add(H).add(S).unbind("keydown",
ga);f.unbind(Aa);N=S=Q=I=K=R=L=s=C=null}});C.add(s).add(L).add(R).add(K).add(I).add(Q).add(S).add(c).add(N).bind("keyup",na).bind("blur",X);C.add(s).add(L).add(R).add(K).add(I).add(Q).bind("keydown",ga);f.bind(Aa)};a.jPicker={List:[],Color:function(d){var f=this,c,m,u,C,s,L,R,K=[],I=function(S){for(var N=0;N<K.length;N++)K[N].call(f,f,S)},Q=function(S,N,ga){if(N===undefined){if(S===undefined||S==null||S=="")S="all";if(c==null)return null;switch(S.toLowerCase()){case "ahex":return v.rgbaToHex({r:c, ga);f.unbind(Aa);N=R=S=H=K=Q=L=s=C=null}});C.add(s).add(L).add(Q).add(K).add(H).add(S).add(R).add(c).add(N).bind("keyup",oa).bind("blur",X);C.add(s).add(L).add(Q).add(K).add(H).add(S).bind("keydown",ga);f.bind(Aa)};a.jPicker={List:[],Color:function(d){var f=this,c,m,u,C,s,L,Q,K=[],H=function(R){for(var N=0;N<K.length;N++)K[N].call(f,f,R)},S=function(R,N,ga){if(N===undefined){if(R===undefined||R==null||R=="")R="all";if(c==null)return null;switch(R.toLowerCase()){case "ahex":return v.rgbaToHex({r:c,
g:m,b:u,a:C});case "hex":return Q("ahex").substring(0,6);case "all":return{r:c,g:m,b:u,a:C,h:s,s:L,v:R,hex:Q.call(f,"hex"),ahex:Q.call(f,"ahex")};default:N={};for(var na=0;na<S.length;na++)switch(S.charAt(na)){case "r":if(S.length==1)N=c;else N.r=c;break;case "g":if(S.length==1)N=m;else N.g=m;break;case "b":if(S.length==1)N=u;else N.b=u;break;case "a":if(S.length==1)N=C;else N.a=C;break;case "h":if(S.length==1)N=s;else N.h=s;break;case "s":if(S.length==1)N=L;else N.s=L;break;case "v":if(S.length== g:m,b:u,a:C});case "hex":return S("ahex").substring(0,6);case "all":return{r:c,g:m,b:u,a:C,h:s,s:L,v:Q,hex:S.call(f,"hex"),ahex:S.call(f,"ahex")};default:N={};for(var oa=0;oa<R.length;oa++)switch(R.charAt(oa)){case "r":if(R.length==1)N=c;else N.r=c;break;case "g":if(R.length==1)N=m;else N.g=m;break;case "b":if(R.length==1)N=u;else N.b=u;break;case "a":if(R.length==1)N=C;else N.a=C;break;case "h":if(R.length==1)N=s;else N.h=s;break;case "s":if(R.length==1)N=L;else N.s=L;break;case "v":if(R.length==
1)N=R;else N.v=R}return N=={}?Q.call(f,"all"):N}}if(!(ga!=null&&ga==f)){var X=false;if(S==null)S="";if(N==null){if(c!=null){c=null;X=true}if(m!=null){m=null;X=true}if(u!=null){u=null;X=true}if(C!=null){C=null;X=true}if(s!=null){s=null;X=true}if(L!=null){L=null;X=true}if(R!=null){R=null;X=true}X&&I.call(f,ga||f)}else switch(S.toLowerCase()){case "ahex":case "hex":N=v.hexToRgba(N&&(N.ahex||N.hex)||N||"00000000");Q.call(f,"rgba",{r:N.r,g:N.g,b:N.b,a:S=="ahex"?N.a:C!=null?C:255},ga);break;default:if(N&& 1)N=Q;else N.v=Q}return N=={}?S.call(f,"all"):N}}if(!(ga!=null&&ga==f)){var X=false;if(R==null)R="";if(N==null){if(c!=null){c=null;X=true}if(m!=null){m=null;X=true}if(u!=null){u=null;X=true}if(C!=null){C=null;X=true}if(s!=null){s=null;X=true}if(L!=null){L=null;X=true}if(Q!=null){Q=null;X=true}X&&H.call(f,ga||f)}else switch(R.toLowerCase()){case "ahex":case "hex":N=v.hexToRgba(N&&(N.ahex||N.hex)||N||"00000000");S.call(f,"rgba",{r:N.r,g:N.g,b:N.b,a:R=="ahex"?N.a:C!=null?C:255},ga);break;default:if(N&&
(N.ahex!=null||N.hex!=null)){Q.call(f,"ahex",N.ahex||N.hex||"00000000",ga);break}var U={},ea=false,Aa=false;if(N.r!==undefined&&!S.indexOf("r")==-1)S+="r";if(N.g!==undefined&&!S.indexOf("g")==-1)S+="g";if(N.b!==undefined&&!S.indexOf("b")==-1)S+="b";if(N.a!==undefined&&!S.indexOf("a")==-1)S+="a";if(N.h!==undefined&&!S.indexOf("h")==-1)S+="h";if(N.s!==undefined&&!S.indexOf("s")==-1)S+="s";if(N.v!==undefined&&!S.indexOf("v")==-1)S+="v";for(na=0;na<S.length;na++)switch(S.charAt(na)){case "r":if(Aa)continue; (N.ahex!=null||N.hex!=null)){S.call(f,"ahex",N.ahex||N.hex||"00000000",ga);break}var U={},ea=false,Aa=false;if(N.r!==undefined&&!R.indexOf("r")==-1)R+="r";if(N.g!==undefined&&!R.indexOf("g")==-1)R+="g";if(N.b!==undefined&&!R.indexOf("b")==-1)R+="b";if(N.a!==undefined&&!R.indexOf("a")==-1)R+="a";if(N.h!==undefined&&!R.indexOf("h")==-1)R+="h";if(N.s!==undefined&&!R.indexOf("s")==-1)R+="s";if(N.v!==undefined&&!R.indexOf("v")==-1)R+="v";for(oa=0;oa<R.length;oa++)switch(R.charAt(oa)){case "r":if(Aa)continue;
ea=true;U.r=N&&N.r&&N.r|0||N&&N|0||0;if(U.r<0)U.r=0;else if(U.r>255)U.r=255;if(c!=U.r){c=U.r;X=true}break;case "g":if(Aa)continue;ea=true;U.g=N&&N.g&&N.g|0||N&&N|0||0;if(U.g<0)U.g=0;else if(U.g>255)U.g=255;if(m!=U.g){m=U.g;X=true}break;case "b":if(Aa)continue;ea=true;U.b=N&&N.b&&N.b|0||N&&N|0||0;if(U.b<0)U.b=0;else if(U.b>255)U.b=255;if(u!=U.b){u=U.b;X=true}break;case "a":U.a=N&&N.a!=null?N.a|0:N!=null?N|0:255;if(U.a<0)U.a=0;else if(U.a>255)U.a=255;if(C!=U.a){C=U.a;X=true}break;case "h":if(ea)continue; ea=true;U.r=N&&N.r&&N.r|0||N&&N|0||0;if(U.r<0)U.r=0;else if(U.r>255)U.r=255;if(c!=U.r){c=U.r;X=true}break;case "g":if(Aa)continue;ea=true;U.g=N&&N.g&&N.g|0||N&&N|0||0;if(U.g<0)U.g=0;else if(U.g>255)U.g=255;if(m!=U.g){m=U.g;X=true}break;case "b":if(Aa)continue;ea=true;U.b=N&&N.b&&N.b|0||N&&N|0||0;if(U.b<0)U.b=0;else if(U.b>255)U.b=255;if(u!=U.b){u=U.b;X=true}break;case "a":U.a=N&&N.a!=null?N.a|0:N!=null?N|0:255;if(U.a<0)U.a=0;else if(U.a>255)U.a=255;if(C!=U.a){C=U.a;X=true}break;case "h":if(ea)continue;
Aa=true;U.h=N&&N.h&&N.h|0||N&&N|0||0;if(U.h<0)U.h=0;else if(U.h>360)U.h=360;if(s!=U.h){s=U.h;X=true}break;case "s":if(ea)continue;Aa=true;U.s=N&&N.s!=null?N.s|0:N!=null?N|0:100;if(U.s<0)U.s=0;else if(U.s>100)U.s=100;if(L!=U.s){L=U.s;X=true}break;case "v":if(ea)continue;Aa=true;U.v=N&&N.v!=null?N.v|0:N!=null?N|0:100;if(U.v<0)U.v=0;else if(U.v>100)U.v=100;if(R!=U.v){R=U.v;X=true}}if(X){if(ea){c=c||0;m=m||0;u=u||0;N=v.rgbToHsv({r:c,g:m,b:u});s=N.h;L=N.s;R=N.v}else if(Aa){s=s||0;L=L!=null?L:100;R=R!= Aa=true;U.h=N&&N.h&&N.h|0||N&&N|0||0;if(U.h<0)U.h=0;else if(U.h>360)U.h=360;if(s!=U.h){s=U.h;X=true}break;case "s":if(ea)continue;Aa=true;U.s=N&&N.s!=null?N.s|0:N!=null?N|0:100;if(U.s<0)U.s=0;else if(U.s>100)U.s=100;if(L!=U.s){L=U.s;X=true}break;case "v":if(ea)continue;Aa=true;U.v=N&&N.v!=null?N.v|0:N!=null?N|0:100;if(U.v<0)U.v=0;else if(U.v>100)U.v=100;if(Q!=U.v){Q=U.v;X=true}}if(X){if(ea){c=c||0;m=m||0;u=u||0;N=v.rgbToHsv({r:c,g:m,b:u});s=N.h;L=N.s;Q=N.v}else if(Aa){s=s||0;L=L!=null?L:100;Q=Q!=
null?R:100;N=v.hsvToRgb({h:s,s:L,v:R});c=N.r;m=N.g;u=N.b}C=C!=null?C:255;I.call(f,ga||f)}}}};a.extend(true,f,{val:Q,bind:function(S){a.isFunction(S)&&K.push(S)},unbind:function(S){if(a.isFunction(S))for(var N;(N=a.inArray(S,K))!=-1;)K.splice(N,1)},destroy:function(){K=null}});if(d)if(d.ahex!=null)Q("ahex",d);else if(d.hex!=null)Q((d.a!=null?"a":"")+"hex",d.a!=null?{ahex:d.hex+v.intToHex(d.a)}:d);else if(d.r!=null&&d.g!=null&&d.b!=null)Q("rgb"+(d.a!=null?"a":""),d);else if(d.h!=null&&d.s!=null&&d.v!= null?Q:100;N=v.hsvToRgb({h:s,s:L,v:Q});c=N.r;m=N.g;u=N.b}C=C!=null?C:255;H.call(f,ga||f)}}}};a.extend(true,f,{val:S,bind:function(R){a.isFunction(R)&&K.push(R)},unbind:function(R){if(a.isFunction(R))for(var N;(N=a.inArray(R,K))!=-1;)K.splice(N,1)},destroy:function(){K=null}});if(d)if(d.ahex!=null)S("ahex",d);else if(d.hex!=null)S((d.a!=null?"a":"")+"hex",d.a!=null?{ahex:d.hex+v.intToHex(d.a)}:d);else if(d.r!=null&&d.g!=null&&d.b!=null)S("rgb"+(d.a!=null?"a":""),d);else if(d.h!=null&&d.s!=null&&d.v!=
null)Q("hsv"+(d.a!=null?"a":""),d)},ColorMethods:{hexToRgba:function(d){d=this.validateHex(d);if(d=="")return{r:null,g:null,b:null,a:null};var f="00",c="00",m="00",u="255";if(d.length==6)d+="ff";if(d.length>6){f=d.substring(0,2);c=d.substring(2,4);m=d.substring(4,6);u=d.substring(6,d.length)}else{if(d.length>4){f=d.substring(4,d.length);d=d.substring(0,4)}if(d.length>2){c=d.substring(2,d.length);d=d.substring(0,2)}if(d.length>0)m=d.substring(0,d.length)}return{r:this.hexToInt(f),g:this.hexToInt(c), null)S("hsv"+(d.a!=null?"a":""),d)},ColorMethods:{hexToRgba:function(d){d=this.validateHex(d);if(d=="")return{r:null,g:null,b:null,a:null};var f="00",c="00",m="00",u="255";if(d.length==6)d+="ff";if(d.length>6){f=d.substring(0,2);c=d.substring(2,4);m=d.substring(4,6);u=d.substring(6,d.length)}else{if(d.length>4){f=d.substring(4,d.length);d=d.substring(0,4)}if(d.length>2){c=d.substring(2,d.length);d=d.substring(0,2)}if(d.length>0)m=d.substring(0,d.length)}return{r:this.hexToInt(f),g:this.hexToInt(c),
b:this.hexToInt(m),a:this.hexToInt(u)}},validateHex:function(d){if(typeof d=="object")return"";d=d.toLowerCase().replace(/[^a-f0-9]/g,"");if(d.length>8)d=d.substring(0,8);return d},rgbaToHex:function(d){return this.intToHex(d.r)+this.intToHex(d.g)+this.intToHex(d.b)+this.intToHex(d.a)},intToHex:function(d){d=(d|0).toString(16);if(d.length==1)d="0"+d;return d.toLowerCase()},hexToInt:function(d){return parseInt(d,16)},rgbToHsv:function(d){var f=d.r/255,c=d.g/255;d=d.b/255;var m={h:0,s:0,v:0},u=0,C= b:this.hexToInt(m),a:this.hexToInt(u)}},validateHex:function(d){if(typeof d=="object")return"";d=d.toLowerCase().replace(/[^a-f0-9]/g,"");if(d.length>8)d=d.substring(0,8);return d},rgbaToHex:function(d){return this.intToHex(d.r)+this.intToHex(d.g)+this.intToHex(d.b)+this.intToHex(d.a)},intToHex:function(d){d=(d|0).toString(16);if(d.length==1)d="0"+d;return d.toLowerCase()},hexToInt:function(d){return parseInt(d,16)},rgbToHsv:function(d){var f=d.r/255,c=d.g/255;d=d.b/255;var m={h:0,s:0,v:0},u=0,C=
0;if(f>=c&&f>=d){C=f;u=c>d?d:c}else if(c>=d&&c>=f){C=c;u=f>d?d:f}else{C=d;u=c>f?f:c}m.v=C;m.s=C?(C-u)/C:0;if(m.s){u=C-u;m.h=f==C?(c-d)/u:c==C?2+(d-f)/u:4+(f-c)/u;m.h=parseInt(m.h*60);if(m.h<0)m.h+=360}else m.h=0;m.s=m.s*100|0;m.v=m.v*100|0;return m},hsvToRgb:function(d){var f={r:0,g:0,b:0,a:100},c=d.h,m=d.s;d=d.v;if(m==0)f.r=d==0?f.g=f.b=0:f.g=f.b=d*255/100|0;else{if(c==360)c=0;c/=60;m/=100;d/=100;var u=c|0,C=c-u;c=d*(1-m);var s=d*(1-m*C);m=d*(1-m*(1-C));switch(u){case 0:f.r=d;f.g=m;f.b=c;break;case 1:f.r= 0;if(f>=c&&f>=d){C=f;u=c>d?d:c}else if(c>=d&&c>=f){C=c;u=f>d?d:f}else{C=d;u=c>f?f:c}m.v=C;m.s=C?(C-u)/C:0;if(m.s){u=C-u;m.h=f==C?(c-d)/u:c==C?2+(d-f)/u:4+(f-c)/u;m.h=parseInt(m.h*60);if(m.h<0)m.h+=360}else m.h=0;m.s=m.s*100|0;m.v=m.v*100|0;return m},hsvToRgb:function(d){var f={r:0,g:0,b:0,a:100},c=d.h,m=d.s;d=d.v;if(m==0)f.r=d==0?f.g=f.b=0:f.g=f.b=d*255/100|0;else{if(c==360)c=0;c/=60;m/=100;d/=100;var u=c|0,C=c-u;c=d*(1-m);var s=d*(1-m*C);m=d*(1-m*(1-C));switch(u){case 0:f.r=d;f.g=m;f.b=c;break;case 1:f.r=
s;f.g=d;f.b=c;break;case 2:f.r=c;f.g=d;f.b=m;break;case 3:f.r=c;f.g=s;f.b=d;break;case 4:f.r=m;f.g=c;f.b=d;break;case 5:f.r=d;f.g=c;f.b=s}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,p=a.jPicker.List,v=a.jPicker.ColorMethods;a.fn.jPicker=function(d){var f=arguments;return this.each(function(){var c=this,m=a.extend(true,{},a.fn.jPicker.defaults,d);if(a(c).get(0).nodeName.toLowerCase()=="input"){a.extend(true,m,{window:{bindToInput:true,expandable:true,input:a(c)}});if(a(c).val()== s;f.g=d;f.b=c;break;case 2:f.r=c;f.g=d;f.b=m;break;case 3:f.r=c;f.g=s;f.b=d;break;case 4:f.r=m;f.g=c;f.b=d;break;case 5:f.r=d;f.g=c;f.b=s}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,p=a.jPicker.List,v=a.jPicker.ColorMethods;a.fn.jPicker=function(d){var f=arguments;return this.each(function(){var c=this,m=a.extend(true,{},a.fn.jPicker.defaults,d);if(a(c).get(0).nodeName.toLowerCase()=="input"){a.extend(true,m,{window:{bindToInput:true,expandable:true,input:a(c)}});if(a(c).val()==
""){m.color.active=new b({hex:null});m.color.current=new b({hex:null})}else if(v.validateHex(a(c).val())){m.color.active=new b({hex:a(c).val(),a:m.color.active.val("a")});m.color.current=new b({hex:a(c).val(),a:m.color.active.val("a")})}}if(m.window.expandable)a(c).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>'); ""){m.color.active=new b({hex:null});m.color.current=new b({hex:null})}else if(v.validateHex(a(c).val())){m.color.active=new b({hex:a(c).val(),a:m.color.active.val("a")});m.color.current=new b({hex:a(c).val(),a:m.color.active.val("a")})}}if(m.window.expandable)a(c).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 m.window.liveUpdate=false;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,C=null,s=null,L=null,R=null,K=null,I=null,Q=null,S=null,N=null,ga=null,na=null,X=null,U=null,ea=null,Aa=null,ja=null,ba=null,T=null,Z=null,oa=null,pa=null,ma=null,la=null,xa=null,ya=null,Ja=null,Ha=null,Ga=null,Ma=function(M){var P=ka.active,ca=P.val("hex"),Da,Oa;m.color.mode=M;switch(M){case "h":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,R,0);ta.call(c,R,100);Ea.call(c, else m.window.liveUpdate=false;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,C=null,s=null,L=null,Q=null,K=null,H=null,S=null,R=null,N=null,ga=null,oa=null,X=null,U=null,ea=null,Aa=null,ja=null,ba=null,T=null,Z=null,na=null,pa=null,ma=null,la=null,xa=null,ya=null,Ja=null,Ha=null,Ga=null,Ma=function(M){var P=ka.active,ca=P.val("hex"),Da,Oa;m.color.mode=M;switch(M){case "h":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,Q,0);ta.call(c,Q,100);Ea.call(c,
K,260);ta.call(c,K,100);Ta.call(c,L,"transparent");Ea.call(c,Q,0);ta.call(c,Q,100);Ea.call(c,S,260);ta.call(c,S,100);Ea.call(c,N,260);ta.call(c,N,100);Ea.call(c,ga,260);ta.call(c,ga,100);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:100,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:360});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("s"),y:100-P.val("v")},U);ea.val("y",360-P.val("h"),ea);break;case "s":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,R,-260);Ea.call(c, K,260);ta.call(c,K,100);Ta.call(c,L,"transparent");Ea.call(c,S,0);ta.call(c,S,100);Ea.call(c,R,260);ta.call(c,R,100);Ea.call(c,N,260);ta.call(c,N,100);Ea.call(c,ga,260);ta.call(c,ga,100);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:100,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:360});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("s"),y:100-P.val("v")},U);ea.val("y",360-P.val("h"),ea);break;case "s":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,Q,-260);Ea.call(c,
K,-520);Ea.call(c,Q,-260);Ea.call(c,S,-520);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("v")},U);ea.val("y",100-P.val("s"),ea);break;case "v":setTimeout(function(){Ta.call(c,s,"000000");Ea.call(c,R,-780);Ea.call(c,K,260);Ta.call(c,L,ca);Ea.call(c,Q,-520);Ea.call(c,S,260);ta.call(c,S,100);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:360, K,-520);Ea.call(c,S,-260);Ea.call(c,R,-520);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("v")},U);ea.val("y",100-P.val("s"),ea);break;case "v":setTimeout(function(){Ta.call(c,s,"000000");Ea.call(c,Q,-780);Ea.call(c,K,260);Ta.call(c,L,ca);Ea.call(c,S,-520);Ea.call(c,R,260);ta.call(c,R,100);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:360,
minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("s")},U);ea.val("y",100-P.val("v"),ea);break;case "r":Da=-1040;Oa=-780;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("b"),y:255-P.val("g")},U);ea.val("y",255-P.val("r"),ea);break;case "g":Da=-1560;Oa=-1820;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255}); minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("s")},U);ea.val("y",100-P.val("v"),ea);break;case "r":Da=-1040;Oa=-780;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("b"),y:255-P.val("g")},U);ea.val("y",255-P.val("r"),ea);break;case "g":Da=-1560;Oa=-1820;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});
if(P.val("ahex")==null)break;U.val("xy",{x:P.val("b"),y:255-P.val("r")},U);ea.val("y",255-P.val("g"),ea);break;case "b":Da=-2080;Oa=-2860;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("r"),y:255-P.val("g")},U);ea.val("y",255-P.val("b"),ea);break;case "a":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,R,-260);Ea.call(c,K,-520);Ea.call(c,Q,260);Ea.call(c,S,260);ta.call(c,S,100);Ea.call(c,X,0);ta.call(c, if(P.val("ahex")==null)break;U.val("xy",{x:P.val("b"),y:255-P.val("r")},U);ea.val("y",255-P.val("g"),ea);break;case "b":Da=-2080;Oa=-2860;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("r"),y:255-P.val("g")},U);ea.val("y",255-P.val("b"),ea);break;case "a":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,Q,-260);Ea.call(c,K,-520);Ea.call(c,S,260);Ea.call(c,R,260);ta.call(c,R,100);Ea.call(c,X,0);ta.call(c,
X,100)},0);U.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("v")},U);ea.val("y",255-P.val("a"),ea);break;default:throw"Invalid Mode";}switch(M){case "s":case "v":case "a":setTimeout(function(){ta.call(c,R,100);ta.call(c,Q,100);Ea.call(c,N,260);ta.call(c,N,100);Ea.call(c,ga,260);ta.call(c,ga,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Ta.call(c,s,"transparent");Ta.call(c,L,"transparent"); X,100)},0);U.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("v")},U);ea.val("y",255-P.val("a"),ea);break;default:throw"Invalid Mode";}switch(M){case "s":case "v":case "a":setTimeout(function(){ta.call(c,Q,100);ta.call(c,S,100);Ea.call(c,N,260);ta.call(c,N,100);Ea.call(c,ga,260);ta.call(c,ga,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Ta.call(c,s,"transparent");Ta.call(c,L,"transparent");
ta.call(c,Q,100);ta.call(c,R,100);Ea.call(c,R,Da);Ea.call(c,K,Da-260);Ea.call(c,Q,Oa-780);Ea.call(c,S,Oa-520);Ea.call(c,N,Oa);Ea.call(c,ga,Oa-260);Ea.call(c,X,260);ta.call(c,X,100)},0)}P.val("ahex")!=null&&Ca.call(c,P)},Ca=function(M,P){if(P==null||P!=ea&&P!=U)va.call(c,M,P);setTimeout(function(){kb.call(c,M);vb.call(c,M);cb.call(c,M)},0)},wa=function(M,P){var ca=ka.active;if(!(P!=U&&ca.val()==null)){var Da=M.val("all");switch(m.color.mode){case "h":ca.val("sv",{s:Da.x,v:100-Da.y},P);break;case "s":case "a":ca.val("hv", ta.call(c,S,100);ta.call(c,Q,100);Ea.call(c,Q,Da);Ea.call(c,K,Da-260);Ea.call(c,S,Oa-780);Ea.call(c,R,Oa-520);Ea.call(c,N,Oa);Ea.call(c,ga,Oa-260);Ea.call(c,X,260);ta.call(c,X,100)},0)}P.val("ahex")!=null&&Ca.call(c,P)},Ca=function(M,P){if(P==null||P!=ea&&P!=U)va.call(c,M,P);setTimeout(function(){kb.call(c,M);vb.call(c,M);cb.call(c,M)},0)},wa=function(M,P){var ca=ka.active;if(!(P!=U&&ca.val()==null)){var Da=M.val("all");switch(m.color.mode){case "h":ca.val("sv",{s:Da.x,v:100-Da.y},P);break;case "s":case "a":ca.val("hv",
{h:Da.x,v:100-Da.y},P);break;case "v":ca.val("hs",{h:Da.x,s:100-Da.y},P);break;case "r":ca.val("gb",{g:255-Da.y,b:Da.x},P);break;case "g":ca.val("rb",{r:255-Da.y,b:Da.x},P);break;case "b":ca.val("rg",{r:Da.x,g:255-Da.y},P)}}},ra=function(M,P){var ca=ka.active;if(!(P!=ea&&ca.val()==null))switch(m.color.mode){case "h":ca.val("h",{h:360-M.val("y")},P);break;case "s":ca.val("s",{s:100-M.val("y")},P);break;case "v":ca.val("v",{v:100-M.val("y")},P);break;case "r":ca.val("r",{r:255-M.val("y")},P);break; {h:Da.x,v:100-Da.y},P);break;case "v":ca.val("hs",{h:Da.x,s:100-Da.y},P);break;case "r":ca.val("gb",{g:255-Da.y,b:Da.x},P);break;case "g":ca.val("rb",{r:255-Da.y,b:Da.x},P);break;case "b":ca.val("rg",{r:Da.x,g:255-Da.y},P)}}},ra=function(M,P){var ca=ka.active;if(!(P!=ea&&ca.val()==null))switch(m.color.mode){case "h":ca.val("h",{h:360-M.val("y")},P);break;case "s":ca.val("s",{s:100-M.val("y")},P);break;case "v":ca.val("v",{v:100-M.val("y")},P);break;case "r":ca.val("r",{r:255-M.val("y")},P);break;
case "g":ca.val("g",{g:255-M.val("y")},P);break;case "b":ca.val("b",{b:255-M.val("y")},P);break;case "a":ca.val("a",255-M.val("y"),P)}},va=function(M,P){if(P!=U)switch(m.color.mode){case "h":var ca=M.val("sv");U.val("xy",{x:ca!=null?ca.s:100,y:100-(ca!=null?ca.v:100)},P);break;case "s":case "a":ca=M.val("hv");U.val("xy",{x:ca&&ca.h||0,y:100-(ca!=null?ca.v:100)},P);break;case "v":ca=M.val("hs");U.val("xy",{x:ca&&ca.h||0,y:100-(ca!=null?ca.s:100)},P);break;case "r":ca=M.val("bg");U.val("xy",{x:ca&& case "g":ca.val("g",{g:255-M.val("y")},P);break;case "b":ca.val("b",{b:255-M.val("y")},P);break;case "a":ca.val("a",255-M.val("y"),P)}},va=function(M,P){if(P!=U)switch(m.color.mode){case "h":var ca=M.val("sv");U.val("xy",{x:ca!=null?ca.s:100,y:100-(ca!=null?ca.v:100)},P);break;case "s":case "a":ca=M.val("hv");U.val("xy",{x:ca&&ca.h||0,y:100-(ca!=null?ca.v:100)},P);break;case "v":ca=M.val("hs");U.val("xy",{x:ca&&ca.h||0,y:100-(ca!=null?ca.s:100)},P);break;case "r":ca=M.val("bg");U.val("xy",{x:ca&&
ca.b||0,y:255-(ca&&ca.g||0)},P);break;case "g":ca=M.val("br");U.val("xy",{x:ca&&ca.b||0,y:255-(ca&&ca.r||0)},P);break;case "b":ca=M.val("rg");U.val("xy",{x:ca&&ca.r||0,y:255-(ca&&ca.g||0)},P)}if(P!=ea)switch(m.color.mode){case "h":ea.val("y",360-(M.val("h")||0),P);break;case "s":ca=M.val("s");ea.val("y",100-(ca!=null?ca:100),P);break;case "v":ca=M.val("v");ea.val("y",100-(ca!=null?ca:100),P);break;case "r":ea.val("y",255-(M.val("r")||0),P);break;case "g":ea.val("y",255-(M.val("g")||0),P);break;case "b":ea.val("y", ca.b||0,y:255-(ca&&ca.g||0)},P);break;case "g":ca=M.val("br");U.val("xy",{x:ca&&ca.b||0,y:255-(ca&&ca.r||0)},P);break;case "b":ca=M.val("rg");U.val("xy",{x:ca&&ca.r||0,y:255-(ca&&ca.g||0)},P)}if(P!=ea)switch(m.color.mode){case "h":ea.val("y",360-(M.val("h")||0),P);break;case "s":ca=M.val("s");ea.val("y",100-(ca!=null?ca:100),P);break;case "v":ca=M.val("v");ea.val("y",100-(ca!=null?ca:100),P);break;case "r":ea.val("y",255-(M.val("r")||0),P);break;case "g":ea.val("y",255-(M.val("g")||0),P);break;case "b":ea.val("y",
255-(M.val("b")||0),P);break;case "a":ca=M.val("a");ea.val("y",255-(ca!=null?ca:255),P)}},kb=function(M){try{var P=M.val("all");oa.css({backgroundColor:P&&"#"+P.hex||"transparent"});ta.call(c,oa,P&&Math.precision(P.a*100/255,4)||0)}catch(ca){}},vb=function(M){switch(m.color.mode){case "h":Ta.call(c,s,(new b({h:M.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var P=M.val("s");ta.call(c,K,100-(P!=null?P:100));break;case "v":P=M.val("v");ta.call(c,R,P!=null?P:100);break;case "r":ta.call(c, 255-(M.val("b")||0),P);break;case "a":ca=M.val("a");ea.val("y",255-(ca!=null?ca:255),P)}},kb=function(M){try{var P=M.val("all");na.css({backgroundColor:P&&"#"+P.hex||"transparent"});ta.call(c,na,P&&Math.precision(P.a*100/255,4)||0)}catch(ca){}},vb=function(M){switch(m.color.mode){case "h":Ta.call(c,s,(new b({h:M.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var P=M.val("s");ta.call(c,K,100-(P!=null?P:100));break;case "v":P=M.val("v");ta.call(c,Q,P!=null?P:100);break;case "r":ta.call(c,
K,Math.precision((M.val("r")||0)/255*100,4));break;case "g":ta.call(c,K,Math.precision((M.val("g")||0)/255*100,4));break;case "b":ta.call(c,K,Math.precision((M.val("b")||0)/255*100))}M=M.val("a");ta.call(c,I,Math.precision((255-(M||0))*100/255,4))},cb=function(M){switch(m.color.mode){case "h":var P=M.val("a");ta.call(c,na,Math.precision((255-(P||0))*100/255,4));break;case "s":P=M.val("hva");var ca=new b({h:P&&P.h||0,s:100,v:P!=null?P.v:100});Ta.call(c,L,ca.val("hex"));ta.call(c,S,100-(P!=null?P.v: K,Math.precision((M.val("r")||0)/255*100,4));break;case "g":ta.call(c,K,Math.precision((M.val("g")||0)/255*100,4));break;case "b":ta.call(c,K,Math.precision((M.val("b")||0)/255*100))}M=M.val("a");ta.call(c,H,Math.precision((255-(M||0))*100/255,4))},cb=function(M){switch(m.color.mode){case "h":var P=M.val("a");ta.call(c,oa,Math.precision((255-(P||0))*100/255,4));break;case "s":P=M.val("hva");var ca=new b({h:P&&P.h||0,s:100,v:P!=null?P.v:100});Ta.call(c,L,ca.val("hex"));ta.call(c,R,100-(P!=null?P.v:
100));ta.call(c,na,Math.precision((255-(P&&P.a||0))*100/255,4));break;case "v":P=M.val("hsa");ca=new b({h:P&&P.h||0,s:P!=null?P.s:100,v:100});Ta.call(c,L,ca.val("hex"));ta.call(c,na,Math.precision((255-(P&&P.a||0))*100/255,4));break;case "r":case "g":case "b":ca=P=0;M=M.val("rgba");if(m.color.mode=="r"){P=M&&M.b||0;ca=M&&M.g||0}else if(m.color.mode=="g"){P=M&&M.b||0;ca=M&&M.r||0}else if(m.color.mode=="b"){P=M&&M.r||0;ca=M&&M.g||0}var Da=ca>P?P:ca;ta.call(c,S,P>ca?Math.precision((P-ca)/(255-ca)*100, 100));ta.call(c,oa,Math.precision((255-(P&&P.a||0))*100/255,4));break;case "v":P=M.val("hsa");ca=new b({h:P&&P.h||0,s:P!=null?P.s:100,v:100});Ta.call(c,L,ca.val("hex"));ta.call(c,oa,Math.precision((255-(P&&P.a||0))*100/255,4));break;case "r":case "g":case "b":ca=P=0;M=M.val("rgba");if(m.color.mode=="r"){P=M&&M.b||0;ca=M&&M.g||0}else if(m.color.mode=="g"){P=M&&M.b||0;ca=M&&M.r||0}else if(m.color.mode=="b"){P=M&&M.r||0;ca=M&&M.g||0}var Da=ca>P?P:ca;ta.call(c,R,P>ca?Math.precision((P-ca)/(255-ca)*100,
4):0);ta.call(c,N,ca>P?Math.precision((ca-P)/(255-P)*100,4):0);ta.call(c,ga,Math.precision(Da/255*100,4));ta.call(c,na,Math.precision((255-(M&&M.a||0))*100/255,4));break;case "a":P=M.val("a");Ta.call(c,L,M.val("hex")||"000000");ta.call(c,na,P!=null?0:100);ta.call(c,X,P!=null?100:0)}},Ta=function(M,P){M.css({backgroundColor:P&&P.length==6&&"#"+P||"transparent"})},Va=function(M,P){if(u&&(P.indexOf("AlphaBar.png")!=-1||P.indexOf("Bars.png")!=-1||P.indexOf("Maps.png")!=-1)){M.attr("pngSrc",P);M.css({backgroundImage:"none", 4):0);ta.call(c,N,ca>P?Math.precision((ca-P)/(255-P)*100,4):0);ta.call(c,ga,Math.precision(Da/255*100,4));ta.call(c,oa,Math.precision((255-(M&&M.a||0))*100/255,4));break;case "a":P=M.val("a");Ta.call(c,L,M.val("hex")||"000000");ta.call(c,oa,P!=null?0:100);ta.call(c,X,P!=null?100:0)}},Ta=function(M,P){M.css({backgroundColor:P&&P.length==6&&"#"+P||"transparent"})},Va=function(M,P){if(u&&(P.indexOf("AlphaBar.png")!=-1||P.indexOf("Bars.png")!=-1||P.indexOf("Maps.png")!=-1)){M.attr("pngSrc",P);M.css({backgroundImage:"none",
filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+P+"', sizingMethod='scale')"})}else M.css({backgroundImage:"url('"+P+"')"})},Ea=function(M,P){M.css({top:P+"px"})},ta=function(M,P){M.css({visibility:P>0?"visible":"hidden"});if(P>0&&P<100)if(u){var ca=M.attr("pngSrc");ca!=null&&(ca.indexOf("AlphaBar.png")!=-1||ca.indexOf("Bars.png")!=-1||ca.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ca+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+ filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+P+"', sizingMethod='scale')"})}else M.css({backgroundImage:"url('"+P+"')"})},Ea=function(M,P){M.css({top:P+"px"})},ta=function(M,P){M.css({visibility:P>0?"visible":"hidden"});if(P>0&&P<100)if(u){var ca=M.attr("pngSrc");ca!=null&&(ca.indexOf("AlphaBar.png")!=-1||ca.indexOf("Bars.png")!=-1||ca.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ca+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+
P+")"}):M.css({opacity:Math.precision(P/100,4)})}else M.css({opacity:Math.precision(P/100,4)});else if(P==0||P==100)if(u){ca=M.attr("pngSrc");ca!=null&&(ca.indexOf("AlphaBar.png")!=-1||ca.indexOf("Bars.png")!=-1||ca.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ca+"', sizingMethod='scale')"}):M.css({opacity:""})}else M.css({opacity:""})},$a=function(){ka.active.val("ahex",ka.current.val("ahex"))},Ka=function(){ka.current.val("ahex",ka.active.val("ahex"))}, P+")"}):M.css({opacity:Math.precision(P/100,4)})}else M.css({opacity:Math.precision(P/100,4)});else if(P==0||P==100)if(u){ca=M.attr("pngSrc");ca!=null&&(ca.indexOf("AlphaBar.png")!=-1||ca.indexOf("Bars.png")!=-1||ca.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ca+"', sizingMethod='scale')"}):M.css({opacity:""})}else M.css({opacity:""})},$a=function(){ka.active.val("ahex",ka.current.val("ahex"))},Ka=function(){ka.current.val("ahex",ka.active.val("ahex"))},
Sa=function(M){a(this).parents("tbody:first").find('input:radio[value!="'+M.target.value+'"]').removeAttr("checked");Ma.call(c,M.target.value)},Fa=function(){$a.call(c)},db=function(){$a.call(c);m.window.expandable&&fb.call(c);a.isFunction(ob)&&ob.call(c,ka.active,la)},lb=function(){Ka.call(c);m.window.expandable&&fb.call(c);a.isFunction(ib)&&ib.call(c,ka.active,ma)},Ua=function(){pb.call(c)},Xa=function(M){var P=M.val("hex");pa.css({backgroundColor:P&&"#"+P||"transparent"});ta.call(c,pa,Math.precision((M.val("a")|| Sa=function(M){a(this).parents("tbody:first").find('input:radio[value!="'+M.target.value+'"]').removeAttr("checked");Ma.call(c,M.target.value)},Fa=function(){$a.call(c)},db=function(){$a.call(c);m.window.expandable&&fb.call(c);a.isFunction(ob)&&ob.call(c,ka.active,la)},lb=function(){Ka.call(c);m.window.expandable&&fb.call(c);a.isFunction(ib)&&ib.call(c,ka.active,ma)},Ua=function(){pb.call(c)},Xa=function(M){var P=M.val("hex");pa.css({backgroundColor:P&&"#"+P||"transparent"});ta.call(c,pa,Math.precision((M.val("a")||
@ -641,16 +641,16 @@ null?ca.s:"")+'" title="'+aa.tooltips.saturation.textbox+'"/>&nbsp;%</td></tr><t
aa.tooltips.blue.radio+'"><input type="radio" value="b"'+(m.color.mode=="b"?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ca!=null?ca.b:"")+'" title="'+aa.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(M.alphaSupport?'<label title="'+aa.tooltips.alpha.radio+'"><input type="radio" value="a"'+(m.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(M.alphaSupport?'<input type="text" maxlength="'+ aa.tooltips.blue.radio+'"><input type="radio" value="b"'+(m.color.mode=="b"?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ca!=null?ca.b:"")+'" title="'+aa.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(M.alphaSupport?'<label title="'+aa.tooltips.alpha.radio+'"><input type="radio" value="a"'+(m.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(M.alphaSupport?'<input type="text" maxlength="'+
(3+M.alphaPrecision)+'" value="'+(ca!=null?Math.precision(ca.a*100/255,M.alphaPrecision):"")+'" title="'+aa.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+aa.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(ca!=null?ca.hex:"")+'"/></label>'+(M.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(ca!=null?ca.ahex.substring(6):"")+'" title="'+aa.tooltips.hex.alpha+'"/></td>':"&nbsp;")+ (3+M.alphaPrecision)+'" value="'+(ca!=null?Math.precision(ca.a*100/255,M.alphaPrecision):"")+'" title="'+aa.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+aa.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(ca!=null?ca.hex:"")+'"/></label>'+(M.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(ca!=null?ca.ahex.substring(6):"")+'" title="'+aa.tooltips.hex.alpha+'"/></td>':"&nbsp;")+
"</tr></tbody></table>";if(M.expandable){C.html(Da);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:M.position.x=="left"?P.offset().left-530-(M.position.y=="center"?25:0)+"px":M.position.x=="center"?P.offset().left-260+"px":M.position.x=="right"?P.offset().left-10+(M.position.y== "</tr></tbody></table>";if(M.expandable){C.html(Da);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:M.position.x=="left"?P.offset().left-530-(M.position.y=="center"?25:0)+"px":M.position.x=="center"?P.offset().left-260+"px":M.position.x=="right"?P.offset().left-10+(M.position.y==
"center"?25:0)+"px":M.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":P.offset().left+parseInt(M.position.x)+"px",position:"absolute",top:M.position.y=="top"?P.offset().top-312+"px":M.position.y=="center"?P.offset().top-156+"px":M.position.y=="bottom"?P.offset().top+25+"px":P.offset().top+parseInt(M.position.y)+"px"})}else{C=a(c);C.html(Da)}Da=C.find("tbody:first");s=Da.find("div.Map:first");L=Da.find("div.Bar:first");var Oa=s.find("span"),Wa=L.find("span");R=Oa.filter(".Map1:first"); "center"?25:0)+"px":M.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":P.offset().left+parseInt(M.position.x)+"px",position:"absolute",top:M.position.y=="top"?P.offset().top-312+"px":M.position.y=="center"?P.offset().top-156+"px":M.position.y=="bottom"?P.offset().top+25+"px":P.offset().top+parseInt(M.position.y)+"px"})}else{C=a(c);C.html(Da)}Da=C.find("tbody:first");s=Da.find("div.Map:first");L=Da.find("div.Bar:first");var Oa=s.find("span"),Wa=L.find("span");Q=Oa.filter(".Map1:first");
K=Oa.filter(".Map2:first");I=Oa.filter(".Map3:first");Q=Wa.filter(".Map1:first");S=Wa.filter(".Map2:first");N=Wa.filter(".Map3:first");ga=Wa.filter(".Map4:first");na=Wa.filter(".Map5:first");X=Wa.filter(".Map6:first");U=new q(s,{map:{width:ia.colorMap.width,height:ia.colorMap.height},arrow:{image:ia.clientPath+ia.colorMap.arrow.file,width:ia.colorMap.arrow.width,height:ia.colorMap.arrow.height}});U.bind(wa);ea=new q(L,{map:{width:ia.colorBar.width,height:ia.colorBar.height},arrow:{image:ia.clientPath+ K=Oa.filter(".Map2:first");H=Oa.filter(".Map3:first");S=Wa.filter(".Map1:first");R=Wa.filter(".Map2:first");N=Wa.filter(".Map3:first");ga=Wa.filter(".Map4:first");oa=Wa.filter(".Map5:first");X=Wa.filter(".Map6:first");U=new q(s,{map:{width:ia.colorMap.width,height:ia.colorMap.height},arrow:{image:ia.clientPath+ia.colorMap.arrow.file,width:ia.colorMap.arrow.width,height:ia.colorMap.arrow.height}});U.bind(wa);ea=new q(L,{map:{width:ia.colorBar.width,height:ia.colorBar.height},arrow:{image:ia.clientPath+
ia.colorBar.arrow.file,width:ia.colorBar.arrow.width,height:ia.colorBar.arrow.height}});ea.bind(ra);Aa=new g(Da,ka.active,M.expandable&&M.bindToInput?M.input:null,M.alphaPrecision);Oa=ca!=null?ca.hex:null;var Za=Da.find(".Preview");Wa=Da.find(".Button");oa=Za.find(".Active:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});pa=Za.find(".Current:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"}).bind("click",Fa);ta.call(c,pa,Math.precision(ka.current.val("a")*100)/255,4);ma=Wa.find(".Ok:first").bind("click touchstart", ia.colorBar.arrow.file,width:ia.colorBar.arrow.width,height:ia.colorBar.arrow.height}});ea.bind(ra);Aa=new g(Da,ka.active,M.expandable&&M.bindToInput?M.input:null,M.alphaPrecision);Oa=ca!=null?ca.hex:null;var Za=Da.find(".Preview");Wa=Da.find(".Button");na=Za.find(".Active:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});pa=Za.find(".Current:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"}).bind("click",Fa);ta.call(c,pa,Math.precision(ka.current.val("a")*100)/255,4);ma=Wa.find(".Ok:first").bind("click touchstart",
lb);la=Wa.find(".Cancel:first").bind("click touchstart",db);xa=Wa.find(".Grid:first");setTimeout(function(){Va.call(c,R,ia.clientPath+"Maps.png");Va.call(c,K,ia.clientPath+"Maps.png");Va.call(c,I,ia.clientPath+"map-opacity.png");Va.call(c,Q,ia.clientPath+"Bars.png");Va.call(c,S,ia.clientPath+"Bars.png");Va.call(c,N,ia.clientPath+"Bars.png");Va.call(c,ga,ia.clientPath+"Bars.png");Va.call(c,na,ia.clientPath+"bar-opacity.png");Va.call(c,X,ia.clientPath+"AlphaBar.png");Va.call(c,Za.find("div:last"),ia.clientPath+ lb);la=Wa.find(".Cancel:first").bind("click touchstart",db);xa=Wa.find(".Grid:first");setTimeout(function(){Va.call(c,Q,ia.clientPath+"Maps.png");Va.call(c,K,ia.clientPath+"Maps.png");Va.call(c,H,ia.clientPath+"map-opacity.png");Va.call(c,S,ia.clientPath+"Bars.png");Va.call(c,R,ia.clientPath+"Bars.png");Va.call(c,N,ia.clientPath+"Bars.png");Va.call(c,ga,ia.clientPath+"Bars.png");Va.call(c,oa,ia.clientPath+"bar-opacity.png");Va.call(c,X,ia.clientPath+"AlphaBar.png");Va.call(c,Za.find("div:last"),ia.clientPath+
"preview-opacity.png")},0);Da.find("td.Radio input").bind("click touchstart",Sa);if(ka.quickList&&ka.quickList.length>0){Wa="";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 nb=ka.quickList[i].val("a"),Ra=ka.quickList[i].val("ahex");if(!M.alphaSupport&&Ra)Ra=Ra.substring(0,6)+"ff";var mb=ka.quickList[i].val("hex");Wa+='<span class="QuickColor"'+(Ra&&' title="#'+Ra+'"'||"")+' style="background-color:'+ "preview-opacity.png")},0);Da.find("td.Radio input").bind("click touchstart",Sa);if(ka.quickList&&ka.quickList.length>0){Wa="";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 nb=ka.quickList[i].val("a"),Ra=ka.quickList[i].val("ahex");if(!M.alphaSupport&&Ra)Ra=Ra.substring(0,6)+"ff";var mb=ka.quickList[i].val("hex");Wa+='<span class="QuickColor"'+(Ra&&' title="#'+Ra+'"'||"")+' style="background-color:'+
(mb&&"#"+mb||"")+";"+(mb?"":"background-image:url("+ia.clientPath+"NoColor.png)")+(M.alphaSupport&&nb&&nb<255?";opacity:"+Math.precision(nb/255,4)+";filter:Alpha(opacity="+Math.precision(nb/2.55,4)+")":"")+'">&nbsp;</span>'}Va.call(c,xa,ia.clientPath+"bar-opacity.png");xa.html(Wa);xa.find(".QuickColor").click(sb)}Ma.call(c,m.color.mode);ka.active.bind(Ca);a.isFunction(ab)&&ka.active.bind(ab);ka.current.bind(Xa);if(M.expandable){c.icon=P.parents(".Icon:first");ya=c.icon.find(".Color:first").css({backgroundColor:Oa&& (mb&&"#"+mb||"")+";"+(mb?"":"background-image:url("+ia.clientPath+"NoColor.png)")+(M.alphaSupport&&nb&&nb<255?";opacity:"+Math.precision(nb/255,4)+";filter:Alpha(opacity="+Math.precision(nb/2.55,4)+")":"")+'">&nbsp;</span>'}Va.call(c,xa,ia.clientPath+"bar-opacity.png");xa.html(Wa);xa.find(".QuickColor").click(sb)}Ma.call(c,m.color.mode);ka.active.bind(Ca);a.isFunction(ab)&&ka.active.bind(ab);ka.current.bind(Xa);if(M.expandable){c.icon=P.parents(".Icon:first");ya=c.icon.find(".Color:first").css({backgroundColor:Oa&&
"#"+Oa||"transparent"});Ja=c.icon.find(".Alpha:first");Va.call(c,Ja,ia.clientPath+"bar-opacity.png");ta.call(c,Ja,Math.precision((255-(ca!=null?ca.a:0))*100/255,4));Ha=c.icon.find(".Image:first").css({backgroundImage:"url('"+ia.clientPath+ia.picker.file+"')"}).bind("click",Ua);if(M.bindToInput&&M.updateInputColor)M.input.css({backgroundColor:Oa&&"#"+Oa||"transparent",color:ca==null||ca.v>75?"#000000":"#ffffff"});Ga=Da.find(".Move:first").bind("mousedown",sa);ka.active.bind(wb)}else pb.call(c)},ia= "#"+Oa||"transparent"});Ja=c.icon.find(".Alpha:first");Va.call(c,Ja,ia.clientPath+"bar-opacity.png");ta.call(c,Ja,Math.precision((255-(ca!=null?ca.a:0))*100/255,4));Ha=c.icon.find(".Image:first").css({backgroundImage:"url('"+ia.clientPath+ia.picker.file+"')"}).bind("click",Ua);if(M.bindToInput&&M.updateInputColor)M.input.css({backgroundColor:Oa&&"#"+Oa||"transparent",color:ca==null||ca.v>75?"#000000":"#ffffff"});Ga=Da.find(".Move:first").bind("mousedown",sa);ka.active.bind(wb)}else pb.call(c)},ia=
m.images,aa=m.localization,ka={active:(typeof m.color.active).toString().toLowerCase()=="string"?new b({ahex:!m.window.alphaSupport&&m.color.active?m.color.active.substring(0,6)+"ff":m.color.active}):new b({ahex:!m.window.alphaSupport&&m.color.active.val("ahex")?m.color.active.val("ahex").substring(0,6)+"ff":m.color.active.val("ahex")}),current:(typeof m.color.active).toString().toLowerCase()=="string"?new b({ahex:!m.window.alphaSupport&&m.color.active?m.color.active.substring(0,6)+"ff":m.color.active}): m.images,aa=m.localization,ka={active:(typeof m.color.active).toString().toLowerCase()=="string"?new b({ahex:!m.window.alphaSupport&&m.color.active?m.color.active.substring(0,6)+"ff":m.color.active}):new b({ahex:!m.window.alphaSupport&&m.color.active.val("ahex")?m.color.active.val("ahex").substring(0,6)+"ff":m.color.active.val("ahex")}),current:(typeof m.color.active).toString().toLowerCase()=="string"?new b({ahex:!m.window.alphaSupport&&m.color.active?m.color.active.substring(0,6)+"ff":m.color.active}):
new b({ahex:!m.window.alphaSupport&&m.color.active.val("ahex")?m.color.active.val("ahex").substring(0,6)+"ff":m.color.active.val("ahex")}),quickList:m.color.quickList};a.extend(true,c,{commitCallback:ib,liveCallback:ab,cancelCallback:ob,color:ka,show:pb,hide:fb,destroy:function(){C.find("td.Radio input touchstart").unbind("click",Sa);pa.unbind("click touchstart",Fa);la.unbind("click touchstart",db);ma.unbind("click touchstart",lb);if(m.window.expandable){Ha.unbind("click",Ua);Ga.unbind("mousedown", new b({ahex:!m.window.alphaSupport&&m.color.active.val("ahex")?m.color.active.val("ahex").substring(0,6)+"ff":m.color.active.val("ahex")}),quickList:m.color.quickList};a.extend(true,c,{commitCallback:ib,liveCallback:ab,cancelCallback:ob,color:ka,show:pb,hide:fb,destroy:function(){C.find("td.Radio input touchstart").unbind("click",Sa);pa.unbind("click touchstart",Fa);la.unbind("click touchstart",db);ma.unbind("click touchstart",lb);if(m.window.expandable){Ha.unbind("click",Ua);Ga.unbind("mousedown",
sa);c.icon=null}C.find(".QuickColor").unbind("click",sb);X=na=ga=N=S=Q=I=K=R=L=s=null;U.destroy();U=null;ea.destroy();ea=null;Aa.destroy();ab=ob=ib=xa=la=ma=pa=oa=Aa=null;C.html("");for(i=0;i<p.length;i++)p[i]==c&&p.splice(i,1)}});p.push(c);setTimeout(function(){tb.call(c)},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}, sa);c.icon=null}C.find(".QuickColor").unbind("click",sb);X=oa=ga=N=R=S=H=K=Q=L=s=null;U.destroy();U=null;ea.destroy();ea=null;Aa.destroy();ab=ob=ib=xa=la=ma=pa=na=Aa=null;C.html("");for(i=0;i<p.length;i++)p[i]==c&&p.splice(i,1)}});p.push(c);setTimeout(function(){tb.call(c)},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, 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: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: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,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}), 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}),
@ -662,12 +662,12 @@ a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEvent
return new $.jGraduate.Paint(c)};return{name:"eyedropper",svgicons:"extensions/eyedropper-icon.xml",buttons:[{id:"tool_eyedropper",type:"mode",title:"Eye Dropper Tool",position:8,key:"I",icon:"extensions/eyedropper.png",events:{click:function(){q.setMode("eyedropper")}}}],mouseDown:function(v){var d=q.getMode(),f=v.event;f=f.target.id==="svgroot"?document.getElementById("canvas_background"):f.target;if(d=="eyedropper"&&f){b.fillPaint=f.getAttribute("fill")||"white";b.fillOpacity=f.getAttribute("fill-opacity")|| return new $.jGraduate.Paint(c)};return{name:"eyedropper",svgicons:"extensions/eyedropper-icon.xml",buttons:[{id:"tool_eyedropper",type:"mode",title:"Eye Dropper Tool",position:8,key:"I",icon:"extensions/eyedropper.png",events:{click:function(){q.setMode("eyedropper")}}}],mouseDown:function(v){var d=q.getMode(),f=v.event;f=f.target.id==="svgroot"?document.getElementById("canvas_background"):f.target;if(d=="eyedropper"&&f){b.fillPaint=f.getAttribute("fill")||"white";b.fillOpacity=f.getAttribute("fill-opacity")||
1;b.strokePaint=f.getAttribute("stroke")||"none";b.strokeOpacity=f.getAttribute("stroke-opacity")||1;b.strokeWidth=f.getAttribute("stroke-width");b.strokeDashArray=f.getAttribute("stroke-dasharray");b.strokeLinecap=f.getAttribute("stroke-linecap");b.strokeLinejoin=f.getAttribute("stroke-linejoin");b.opacity=f.getAttribute("opacity")||1;v.selectedElements=v.selectedElements.filter(Boolean);if(v.selectedElements.length){if($.inArray(v.selectedElements.nodeName,["g","use"])==-1){var c={},m=function(C, 1;b.strokePaint=f.getAttribute("stroke")||"none";b.strokeOpacity=f.getAttribute("stroke-opacity")||1;b.strokeWidth=f.getAttribute("stroke-width");b.strokeDashArray=f.getAttribute("stroke-dasharray");b.strokeLinecap=f.getAttribute("stroke-linecap");b.strokeLinejoin=f.getAttribute("stroke-linejoin");b.opacity=f.getAttribute("opacity")||1;v.selectedElements=v.selectedElements.filter(Boolean);if(v.selectedElements.length){if($.inArray(v.selectedElements.nodeName,["g","use"])==-1){var c={},m=function(C,
s,L){c[s]=C.getAttribute(s);C.setAttribute(s,L)},u=new a.BatchCommand;v.selectedElements.forEach(function(C){b.fillPaint&&m(C,"fill",b.fillPaint);b.fillOpacity&&m(C,"fill-opacity",b.fillOpacity);b.strokePaint&&m(C,"stroke",b.strokePaint);b.strokeOpacity&&m(C,"stroke-opacity",b.strokeOpacity);b.strokeWidth&&m(C,"stroke-width",b.strokeWidth);b.strokeDashArray&&m(C,"stroke-dasharray",b.strokeDashArray);b.opacity&&m(C,"opacity",b.opacity);b.strokeLinecap&&m(C,"stroke-linecap",b.strokeLinecap);b.strokeLinejoin&& s,L){c[s]=C.getAttribute(s);C.setAttribute(s,L)},u=new a.BatchCommand;v.selectedElements.forEach(function(C){b.fillPaint&&m(C,"fill",b.fillPaint);b.fillOpacity&&m(C,"fill-opacity",b.fillOpacity);b.strokePaint&&m(C,"stroke",b.strokePaint);b.strokeOpacity&&m(C,"stroke-opacity",b.strokeOpacity);b.strokeWidth&&m(C,"stroke-width",b.strokeWidth);b.strokeDashArray&&m(C,"stroke-dasharray",b.strokeDashArray);b.opacity&&m(C,"opacity",b.opacity);b.strokeLinecap&&m(C,"stroke-linecap",b.strokeLinecap);b.strokeLinejoin&&
m(C,"stroke-linejoin",b.strokeLinejoin);u.addSubCommand(new g(C,c));c={}});v=p(b.fillPaint,b.fillOpacity*100,"fill");d=p(b.strokePaint,b.strokeOpacity*100,"stroke");svgEditor.paintBox.fill.update(true);svgEditor.paintBox.stroke.update(true);q.undoMgr.addCommandToHistory(u)}}else{v=p(b.fillPaint,b.fillOpacity*100,"fill");d=p(b.strokePaint,b.strokeOpacity*100,"stroke");svgEditor.paintBox.fill.setPaint(v);svgEditor.paintBox.stroke.setPaint(d)}}}}});svgEditor.addExtension("view_grid",function(a){function q(c){d.attr("width");d.attr("height");var m=svgedit.units.getTypeMap()[svgEditor.curConfig.baseUnit],u=[0.01,0.1,1,10,100,1E3];svgCanvas.getContentElem().getAttribute("x");var C=p;m=m*c;var s=100/m,L=1;for(c=0;c<u.length;c++){var R=u[c];L=R;if(s<=R)break}u=L*m;C.width=u;C.height=u;m=C.getContext("2d");s=u/10;m.globalAlpha=0.2;m.strokeStyle="#000";for(c=1;c<10;c++){L=Math.round(s*c)+0.5;m.moveTo(L,u);m.lineTo(L,0);m.moveTo(u,L);m.lineTo(0,L)}m.stroke(); m(C,"stroke-linejoin",b.strokeLinejoin);u.addSubCommand(new g(C,c));c={}});v=p(b.fillPaint,b.fillOpacity*100,"fill");d=p(b.strokePaint,b.strokeOpacity*100,"stroke");svgEditor.paintBox.fill.update(true);svgEditor.paintBox.stroke.update(true);q.undoMgr.addCommandToHistory(u)}}else{v=p(b.fillPaint,b.fillOpacity*100,"fill");d=p(b.strokePaint,b.strokeOpacity*100,"stroke");svgEditor.paintBox.fill.setPaint(v);svgEditor.paintBox.stroke.setPaint(d)}}}}});svgEditor.addExtension("view_grid",function(a){function q(c){d.attr("width");d.attr("height");var m=svgedit.units.getTypeMap()[svgEditor.curConfig.baseUnit],u=[0.01,0.1,1,10,100,1E3];svgCanvas.getContentElem().getAttribute("x");var C=p;m=m*c;var s=100/m,L=1;for(c=0;c<u.length;c++){var Q=u[c];L=Q;if(s<=Q)break}u=L*m;C.width=u;C.height=u;m=C.getContext("2d");s=u/10;m.globalAlpha=0.2;m.strokeStyle="#000";for(c=1;c<10;c++){L=Math.round(s*c)+0.5;m.moveTo(L,u);m.lineTo(L,0);m.moveTo(u,L);m.lineTo(0,L)}m.stroke();
m.beginPath();m.globalAlpha=0.5;m.moveTo(0.5,u);m.lineTo(0.5,0);m.moveTo(u,0.5);m.lineTo(0,0.5);m.stroke();C=C.toDataURL("image/png");f.setAttribute("width",u);f.setAttribute("height",u);f.parentNode.setAttribute("width",u);f.parentNode.setAttribute("height",u);svgCanvas.setHref(f,C)}if(!document.getElementById("canvasGrid")){var g=document.getElementById("svgcanvas").ownerDocument,b=false;a=a.assignAttributes;var p=document.createElement("canvas");$(p).hide().appendTo("body");var v=g.createElementNS("http://www.w3.org/2000/svg", m.beginPath();m.globalAlpha=0.5;m.moveTo(0.5,u);m.lineTo(0.5,0);m.moveTo(u,0.5);m.lineTo(0,0.5);m.stroke();C=C.toDataURL("image/png");f.setAttribute("width",u);f.setAttribute("height",u);f.parentNode.setAttribute("width",u);f.parentNode.setAttribute("height",u);svgCanvas.setHref(f,C)}if(!document.getElementById("canvasGrid")){var g=document.getElementById("svgcanvas").ownerDocument,b=false;a=a.assignAttributes;var p=document.createElement("canvas");$(p).hide().appendTo("body");var v=g.createElementNS("http://www.w3.org/2000/svg",
"g");a(v,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"});var d=$("#canvas_background");d.after(v);v=g.createElementNS("http://www.w3.org/2000/svg","pattern");a(v,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var f=g.createElementNS("http://www.w3.org/2000/svg","image");a(f,{x:0,y:0,width:100,height:100});v.appendChild(f);$("#svgroot defs").append(v);g=g.createElementNS("http://www.w3.org/2000/svg","rect");a(g,{width:"100%",height:"100%", "g");a(v,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"});var d=$("#canvas_background");d.after(v);v=g.createElementNS("http://www.w3.org/2000/svg","pattern");a(v,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var f=g.createElementNS("http://www.w3.org/2000/svg","image");a(f,{x:0,y:0,width:100,height:100});v.appendChild(f);$("#svgroot defs").append(v);g=g.createElementNS("http://www.w3.org/2000/svg","rect");a(g,{width:"100%",height:"100%",
x:0,y:0,"stroke-width":0,stroke:"none",fill:"url(#gridpattern)",style:"pointer-events: none; display:visible;"});$("#canvasGrid").append(g)}return{name:"view_grid",zoomChanged:function(c){b&&q(c)},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(g)}return{name:"view_grid",zoomChanged:function(c){b&&q(c)},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","inline");q(svgCanvas.getZoom())}}}}]}});svgEditor.addExtension("shapes",function(){function a(){$("#shape_buttons").empty();$("#shape_buttons").append(L.buttons)}function q(K){var I=s[K];if(I){L=I;I.buttons.length||g(K,I);a()}else{$("#shape_buttons").html("Loading...");$.getJSON("extensions/shapelib/"+K+".json",function(Q){L=s[K]={data:Q.data,size:Q.size,fill:Q.fill};g(K,Q);a()})}}function g(K,I){var Q=L.size||300,S=L.fill||false,N=Q*0.05;N=[-N,-N,Q+N*2,Q+N*2].join(" ");Q=S?0:Q/30;Q=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+ b=true;$("#view_grid").addClass("push_button_pressed");$("#canvasGrid").attr("display","inline");q(svgCanvas.getZoom())}}}}]}});svgEditor.addExtension("shapes",function(){function a(){$("#shape_buttons").empty();$("#shape_buttons").append(L.buttons)}function q(K){var H=s[K];if(H){L=H;H.buttons.length||g(K,H);a()}else{$("#shape_buttons").html("Loading...");$.getJSON("extensions/shapelib/"+K+".json",function(S){L=s[K]={data:S.data,size:S.size,fill:S.fill};g(K,S);a()})}}function g(K,H){var S=L.size||300,R=L.fill||false,N=S*0.05;N=[-N,-N,S+N*2,S+N*2].join(" ");S=R?0:S/30;S=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+
N+'"><path fill="#333" stroke="transparent" stroke-width="'+Q+'" /></svg></svg>',"text/xml");Q.documentElement.setAttribute("width",40);Q.documentElement.setAttribute("height",40);Q=$(document.importNode(Q.documentElement,true));S=I.data;L.buttons=[];for(var ga in S){N=S[ga];var na=Q.clone();na.find("path").attr("d",N);N=na.wrap('<div class="tool_button">').parent().attr({id:R+"_"+ga,title:ga});L.buttons.push(N[0])}}var b,p,v=svgEditor.canvas,d,f,c,m=v.getRootElem(),u={},C={basic:"Basic",object:"Objects", N+'"><path fill="#333" stroke="transparent" stroke-width="'+S+'" /></svg></svg>',"text/xml");S.documentElement.setAttribute("width",40);S.documentElement.setAttribute("height",40);S=$(document.importNode(S.documentElement,true));R=H.data;L.buttons=[];for(var ga in R){N=R[ga];var oa=S.clone();oa.find("path").attr("d",N);N=oa.wrap('<div class="tool_button">').parent().attr({id:Q+"_"+ga,title:ga});L.buttons.push(N[0])}}var b,p,v=svgEditor.canvas,d,f,c,m=v.getRootElem(),u={},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"},s={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", 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"},s={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",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", 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",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", 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",
@ -676,13 +676,13 @@ cylinder:"m299.0007,83.77844c0,18.28676 -66.70958,33.11111 -149.00002,33.11111m1
arrow_u_turn:"m1.00059,299.00055l0,-167.62497l0,0c0,-72.00411 58.37087,-130.37499 130.375,-130.37499l0,0l0,0c34.57759,0 67.73898,13.7359 92.18906,38.18595c24.45006,24.45005 38.18593,57.61144 38.18593,92.18904l0,18.625l37.24997,0l-74.49995,74.50002l-74.50002,-74.50002l37.25,0l0,-18.625c0,-30.8589 -25.0161,-55.87498 -55.87498,-55.87498l0,0l0,0c-30.85892,0 -55.875,25.01608 -55.875,55.87498l0,167.62497z",arrow_left_up:"m0.99865,224.5l74.50004,-74.5l0,37.25l111.74991,0l0,-111.75l-37.25,0l74.5,-74.5l74.5,74.5l-37.25,0l0,186.25l-186.24989,0l0,37.25l-74.50005,-74.5z", arrow_u_turn:"m1.00059,299.00055l0,-167.62497l0,0c0,-72.00411 58.37087,-130.37499 130.375,-130.37499l0,0l0,0c34.57759,0 67.73898,13.7359 92.18906,38.18595c24.45006,24.45005 38.18593,57.61144 38.18593,92.18904l0,18.625l37.24997,0l-74.49995,74.50002l-74.50002,-74.50002l37.25,0l0,-18.625c0,-30.8589 -25.0161,-55.87498 -55.87498,-55.87498l0,0l0,0c-30.85892,0 -55.875,25.01608 -55.875,55.87498l0,167.62497z",arrow_left_up:"m0.99865,224.5l74.50004,-74.5l0,37.25l111.74991,0l0,-111.75l-37.25,0l74.5,-74.5l74.5,74.5l-37.25,0l0,186.25l-186.24989,0l0,37.25l-74.50005,-74.5z",
plaque:"m-0.00197,49.94376l0,0c27.5829,0 49.94327,-22.36036 49.94327,-49.94327l199.76709,0l0,0c0,27.5829 22.36037,49.94327 49.94325,49.94327l0,199.7671l0,0c-27.58289,0 -49.94325,22.36034 -49.94325,49.94325l-199.76709,0c0,-27.58292 -22.36037,-49.94325 -49.94327,-49.94325z",page:"m249.3298,298.99744l9.9335,-39.73413l39.73413,-9.93355l-49.66763,49.66768l-248.33237,0l0,-298.00001l298.00001,0l0,248.33234",cross:"m0.99844,99.71339l98.71494,0l0,-98.71495l101.26279,0l0,98.71495l98.71495,0l0,101.2628l-98.71495,0l0,98.71494l-101.26279,0l0,-98.71494l-98.71494,0z", plaque:"m-0.00197,49.94376l0,0c27.5829,0 49.94327,-22.36036 49.94327,-49.94327l199.76709,0l0,0c0,27.5829 22.36037,49.94327 49.94325,49.94327l0,199.7671l0,0c-27.58289,0 -49.94325,22.36034 -49.94325,49.94325l-199.76709,0c0,-27.58292 -22.36037,-49.94325 -49.94327,-49.94325z",page:"m249.3298,298.99744l9.9335,-39.73413l39.73413,-9.93355l-49.66763,49.66768l-248.33237,0l0,-298.00001l298.00001,0l0,248.33234",cross:"m0.99844,99.71339l98.71494,0l0,-98.71495l101.26279,0l0,98.71495l98.71495,0l0,101.2628l-98.71495,0l0,98.71494l-101.26279,0l0,-98.71494l-98.71494,0z",
divide:"m150,0.99785l0,0c25.17819,0 45.58916,20.41097 45.58916,45.58916c0,25.17821 -20.41096,45.58916 -45.58916,45.58916c-25.17822,0 -45.58916,-20.41093 -45.58916,-45.58916c0,-25.1782 20.41093,-45.58916 45.58916,-45.58916zm0,296.25203c-25.17822,0 -45.58916,-20.41095 -45.58916,-45.58917c0,-25.17819 20.41093,-45.58916 45.58916,-45.58916c25.17819,0 45.58916,20.41096 45.58916,45.58916c0,25.17822 -20.41096,45.58917 -45.58916,45.58917zm-134.06754,-193.71518l268.13507,0l0,91.17833l-268.13507,0z",minus:"m0.99887,102.39503l297.49445,0l0,95.2112l-297.49445,0z", divide:"m150,0.99785l0,0c25.17819,0 45.58916,20.41097 45.58916,45.58916c0,25.17821 -20.41096,45.58916 -45.58916,45.58916c-25.17822,0 -45.58916,-20.41093 -45.58916,-45.58916c0,-25.1782 20.41093,-45.58916 45.58916,-45.58916zm0,296.25203c-25.17822,0 -45.58916,-20.41095 -45.58916,-45.58917c0,-25.17819 20.41093,-45.58916 45.58916,-45.58916c25.17819,0 45.58916,20.41096 45.58916,45.58916c0,25.17822 -20.41096,45.58917 -45.58916,45.58917zm-134.06754,-193.71518l268.13507,0l0,91.17833l-268.13507,0z",minus:"m0.99887,102.39503l297.49445,0l0,95.2112l-297.49445,0z",
times:"m1.00089,73.36786l72.36697,-72.36697l76.87431,76.87368l76.87431,-76.87368l72.36765,72.36697l-76.87433,76.87431l76.87433,76.87431l-72.36765,72.36765l-76.87431,-76.87433l-76.87431,76.87433l-72.36697,-72.36765l76.87368,-76.87431l-76.87368,-76.87431z"},buttons:[]}},L=s.basic,R="shapelib";return{svgicons:"extensions/ext-shapes.xml",buttons:[{id:"tool_shapelib",type:"mode_flyout",position:6,title:"Shape library",icon:"extensions/ext-shapes.png",events:{click:function(){v.setMode(R)}}}],callback:function(){var K= times:"m1.00089,73.36786l72.36697,-72.36697l76.87431,76.87368l76.87431,-76.87368l72.36765,72.36697l-76.87433,76.87431l76.87433,76.87431l-72.36765,72.36765l-76.87431,-76.87433l-76.87431,76.87433l-72.36697,-72.36765l76.87368,-76.87431l-76.87368,-76.87431z"},buttons:[]}},L=s.basic,Q="shapelib";return{svgicons:"extensions/ext-shapes.xml",buttons:[{id:"tool_shapelib",type:"mode_flyout",position:6,title:"Shape library",icon:"extensions/ext-shapes.png",events:{click:function(){v.setMode(Q)}}}],callback:function(){var K=
$('<div id="shape_buttons">');$("#tools_shapelib > *").wrapAll(K);var I=$("#tools_shapelib_show");q("basic");$("#shape_buttons").mouseup(function(S){S=$(S.target).closest("div.tool_button");if(S.length){var N=S.children().clone().attr({width:24,height:24});I.children(":not(.flyout_arrow_horiz)").remove();I.append(N).attr("data-curopt","#"+S[0].id).mouseup();v.setMode(R);p=S[0].id.substr((R+"_").length);b=L.data[p];$(".tools_flyout").fadeOut()}});K=$('<div id="shape_cats">');var Q="";$.each(C,function(S, $('<div id="shape_buttons">');$("#tools_shapelib > *").wrapAll(K);var H=$("#tools_shapelib_show");q("basic");$("#shape_buttons").mouseup(function(R){R=$(R.target).closest("div.tool_button");if(R.length){var N=R.children().clone().attr({width:24,height:24});H.children(":not(.flyout_arrow_horiz)").remove();H.append(N).attr("data-curopt","#"+R[0].id).mouseup();v.setMode(Q);p=R[0].id.substr((Q+"_").length);b=L.data[p];$(".tools_flyout").fadeOut()}});K=$('<div id="shape_cats">');var S="";$.each(C,function(R,
N){Q+="<div data-cat="+S+">"+N+"</div>"});K.html(Q).children().bind("mouseup",function(){var S=$(this);S.siblings().removeClass("current");S.addClass("current");q(S.attr("data-cat"));return false});K.children().eq(0).addClass("current");$("#tools_shapelib").prepend(K);I.mouseup(function(){v.setMode(b?R:"select")});$("#tool_shapelib").remove();K=$("#tools_shapelib").height();$("#tools_shapelib").css({"margin-top":-(K/2),"margin-left":3})},mouseDown:function(K){if(v.getMode()===R){var I=f=K.start_x; N){S+="<div data-cat="+R+">"+N+"</div>"});K.html(S).children().bind("mouseup",function(){var R=$(this);R.siblings().removeClass("current");R.addClass("current");q(R.attr("data-cat"));return false});K.children().eq(0).addClass("current");$("#tools_shapelib").prepend(K);H.mouseup(function(){v.setMode(b?Q:"select")});$("#tool_shapelib").remove();K=$("#tools_shapelib").height();$("#tools_shapelib").css({"margin-top":-(K/2),"margin-left":3})},mouseDown:function(K){if(v.getMode()===Q){var H=f=K.start_x;
K=c=K.start_y;var Q=v.getStyle();d=v.addSvgElementFromJson({element:"path",curStyles:true,attr:{d:b,id:v.getNextId(),opacity:Q.opacity/2,style:"pointer-events:none"}});d.setAttribute("d",b);if(/[a-z]/.test(b)){b=L.data[p]=v.pathActions.convertPath(d);d.setAttribute("d",b);v.pathActions.fixEnd(d)}d.setAttribute("transform","translate("+I+","+K+") scale(0.005) translate("+-I+","+-K+")");v.recalculateDimensions(d);v.getTransformList(d);u=d.getBBox();totalScale={sx:1,sy:1};return{started:true}}},mouseMove:function(K){if(v.getMode()=== K=c=K.start_y;var S=v.getStyle();d=v.addSvgElementFromJson({element:"path",curStyles:true,attr:{d:b,id:v.getNextId(),opacity:S.opacity/2,style:"pointer-events:none"}});d.setAttribute("d",b);if(/[a-z]/.test(b)){b=L.data[p]=v.pathActions.convertPath(d);d.setAttribute("d",b);v.pathActions.fixEnd(d)}d.setAttribute("transform","translate("+H+","+K+") scale(0.005) translate("+-H+","+-K+")");v.recalculateDimensions(d);v.getTransformList(d);u=d.getBBox();totalScale={sx:1,sy:1};return{started:true}}},mouseMove:function(K){if(v.getMode()===
R){var I=v.getZoom(),Q=K.event,S=K.mouse_x/I,N=K.mouse_y/I;K=v.getTransformList(d);var ga=d.getBBox();I=ga.x;var na=ga.y,X=ga.width,U=ga.height,ea=S-f,Aa=N-c,ja={x:Math.min(f,S),y:Math.min(c,N),width:Math.abs(S-f),height:Math.abs(N-c)},ba=ga=0;U=U?(U+Aa)/U:1;X=X?(X+ea)/X:1;X=ja.width/u.width;U=ja.height/u.height;X=X||1;U=U||1;if(S<f)ga=u.width;if(N<c)ba=u.height;S=m.createSVGTransform();N=m.createSVGTransform();ja=m.createSVGTransform();S.setTranslate(-(I+ga),-(na+ba));if(Q.shiftKey){replaced=true; Q){var H=v.getZoom(),S=K.event,R=K.mouse_x/H,N=K.mouse_y/H;K=v.getTransformList(d);var ga=d.getBBox();H=ga.x;var oa=ga.y,X=ga.width,U=ga.height,ea=R-f,Aa=N-c,ja={x:Math.min(f,R),y:Math.min(c,N),width:Math.abs(R-f),height:Math.abs(N-c)},ba=ga=0;U=U?(U+Aa)/U:1;X=X?(X+ea)/X:1;X=ja.width/u.width;U=ja.height/u.height;X=X||1;U=U||1;if(R<f)ga=u.width;if(N<c)ba=u.height;R=m.createSVGTransform();N=m.createSVGTransform();ja=m.createSVGTransform();R.setTranslate(-(H+ga),-(oa+ba));if(S.shiftKey){replaced=true;
Q=Math.min(Math.abs(X),Math.abs(U));X=Q*(X<0?-1:1);U=Q*(U<0?-1:1);if(totalScale.sx!=totalScale.sy){Q=totalScale.sx>totalScale.sy?1:totalScale.sx/totalScale.sy;X*=totalScale.sy>totalScale.sx?1:totalScale.sy/totalScale.sx;U*=Q}}totalScale.sx*=X;totalScale.sy*=U;N.setScale(X,U);ja.setTranslate(I+ga,na+ba);K.appendItem(ja);K.appendItem(N);K.appendItem(S);v.recalculateDimensions(d);u=d.getBBox()}},mouseUp:function(K){if(v.getMode()===R){if(K.mouse_x==f&&K.mouse_y==c)return{keep:false,element:d,started:false}; S=Math.min(Math.abs(X),Math.abs(U));X=S*(X<0?-1:1);U=S*(U<0?-1:1);if(totalScale.sx!=totalScale.sy){S=totalScale.sx>totalScale.sy?1:totalScale.sx/totalScale.sy;X*=totalScale.sy>totalScale.sx?1:totalScale.sy/totalScale.sx;U*=S}}totalScale.sx*=X;totalScale.sy*=U;N.setScale(X,U);ja.setTranslate(H+ga,oa+ba);K.appendItem(ja);K.appendItem(N);K.appendItem(R);v.recalculateDimensions(d);u=d.getBBox()}},mouseUp:function(K){if(v.getMode()===Q){if(K.mouse_x==f&&K.mouse_y==c)return{keep:false,element:d,started:false};
v.setMode("select");return{keep:true,element:d,started:false}}}}});(function(){for(var a=0,q=["ms","moz","webkit","o"],g=0;g<q.length&&!window.requestAnimationFrame;++g){window.requestAnimationFrame=window[q[g]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[q[g]+"CancelAnimationFrame"]||window[q[g]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var p=(new Date).getTime(),v=Math.max(0,16-(p-a)),d=window.setTimeout(function(){b(p+v)},v);a=p+v;return d};if(!window.cancelAnimationFrame)window.cancelAnimationFrame= v.setMode("select");return{keep:true,element:d,started:false}}}}});(function(){for(var a=0,q=["ms","moz","webkit","o"],g=0;g<q.length&&!window.requestAnimationFrame;++g){window.requestAnimationFrame=window[q[g]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[q[g]+"CancelAnimationFrame"]||window[q[g]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var p=(new Date).getTime(),v=Math.max(0,16-(p-a)),d=window.setTimeout(function(){b(p+v)},v);a=p+v;return d};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
function(b){clearTimeout(b)}})();(function(a){function q(s){var L=s.originalEvent;if(!L.touches||L.targetTouches.length===1&&L.touches.length===1){d.call(this,s);s=a(this);s.bind(u,g);s.bind(m,b)}else{clearTimeout(C);v.call(this)}}function g(s){if(C!=null){var L=s.originalEvent;s=L.changedTouches?L.changedTouches[0].pageX:L.pageX;L=L.changedTouches?L.changedTouches[0].pageY:L.pageY;var R=a(this).data("taphold.point");s=s-R.x;L=L-R.y;if(Math.sqrt(s*s+L*L)>c){clearTimeout(C);v.call(this)}}}function b(){clearTimeout(C);v.call(this)} function(b){clearTimeout(b)}})();(function(a){function q(s){var L=s.originalEvent;if(!L.touches||L.targetTouches.length===1&&L.touches.length===1){d.call(this,s);s=a(this);s.bind(u,g);s.bind(m,b)}else{clearTimeout(C);v.call(this)}}function g(s){if(C!=null){var L=s.originalEvent;s=L.changedTouches?L.changedTouches[0].pageX:L.pageX;L=L.changedTouches?L.changedTouches[0].pageY:L.pageY;var Q=a(this).data("taphold.point");s=s-Q.x;L=L-Q.y;if(Math.sqrt(s*s+L*L)>c){clearTimeout(C);v.call(this)}}}function b(){clearTimeout(C);v.call(this)}
function p(s){v.call(this);a(this).data("taphold.handler").call(this,s)}function v(){C=null;a(this).unbind(u,g);a(this).unbind(m,b)}function d(s){if(C==null){var L=this;C=setTimeout(function(){p.call(L,s)},f);var R=s.originalEvent,K={};K.x=R.changedTouches?R.changedTouches[0].pageX:R.pageX;K.y=R.changedTouches?R.changedTouches[0].pageY:R.pageY;a(this).data("taphold.point",K)}}var f=1E3,c=5,m="touchend",u="touchmove",C=null;a.event.special.taphold={setup:function(){},add:function(s){a(this).data("taphold.handler", function p(s){v.call(this);a(this).data("taphold.handler").call(this,s)}function v(){C=null;a(this).unbind(u,g);a(this).unbind(m,b)}function d(s){if(C==null){var L=this;C=setTimeout(function(){p.call(L,s)},f);var Q=s.originalEvent,K={};K.x=Q.changedTouches?Q.changedTouches[0].pageX:Q.pageX;K.y=Q.changedTouches?Q.changedTouches[0].pageY:Q.pageY;a(this).data("taphold.point",K)}}var f=1E3,c=5,m="touchend",u="touchmove",C=null;a.event.special.taphold={setup:function(){},add:function(s){a(this).data("taphold.handler",
s.handler);s.data?a(this).bind("touchstart",s.data,q):a(this).bind("touchstart",q)},remove:function(s){clearTimeout(C);v.call(this);s.data?a(this).unbind("touchstart",s.data,q):a(this).unbind("touchstart",q)},teardown:function(){}}})(jQuery); s.handler);s.data?a(this).bind("touchstart",s.data,q):a(this).bind("touchstart",q)},remove:function(s){clearTimeout(C);v.call(this);s.data?a(this).unbind("touchstart",s.data,q):a(this).unbind("touchstart",q)},teardown:function(){}}})(jQuery);

View File

@ -36,7 +36,6 @@ $.fn.dragInput = function(cfg){
var lastY = 0; var lastY = 0;
var attr = this.getAttribute("data-attr"); var attr = this.getAttribute("data-attr");
var canvas = svgEditor.canvas var canvas = svgEditor.canvas
var selectedElems = canvas.getSelectedElems();
var isTouch = svgedit.browser.isTouch(); var isTouch = svgedit.browser.isTouch();
var completed = true //for mousewheel var completed = true //for mousewheel
var $cursor = (area && this.dragCfg.cursor) var $cursor = (area && this.dragCfg.cursor)
@ -53,7 +52,6 @@ $.fn.dragInput = function(cfg){
v = this.dragCfg.reset; v = this.dragCfg.reset;
} else if($.isFunction(this.dragCfg.stepfunc)) { } else if($.isFunction(this.dragCfg.stepfunc)) {
v = this.dragCfg.stepfunc(this, i); v = this.dragCfg.stepfunc(this, i);
console.log(v);
} else { } else {
v = Number((Number(this.value) + Number(i)).toFixed(5)); v = Number((Number(this.value) + Number(i)).toFixed(5));
} }
@ -85,6 +83,7 @@ $.fn.dragInput = function(cfg){
//when the mouse is released //when the mouse is released
this.stop = function() { this.stop = function() {
var selectedElems = canvas.getSelectedElems();
$('body').removeClass('dragging'); $('body').removeClass('dragging');
$label.removeClass("active"); $label.removeClass("active");
completed = true; completed = true;
@ -104,6 +103,7 @@ $.fn.dragInput = function(cfg){
} }
this.start = function(e) { this.start = function(e) {
var selectedElems = canvas.getSelectedElems();
if (isTouch) e = e.originalEvent.touches[0] if (isTouch) e = e.originalEvent.touches[0]
var oy = e.pageY; var oy = e.pageY;
var val = this.value; var val = this.value;
@ -148,12 +148,13 @@ $.fn.dragInput = function(cfg){
}) })
.bind("mousewheel", function(e, delta, deltaX, deltaY){ .bind("mousewheel", function(e, delta, deltaX, deltaY){
var selectedElems = canvas.getSelectedElems();
if (completed) canvas.undoMgr.beginUndoableChange(attr, selectedElems) if (completed) canvas.undoMgr.beginUndoableChange(attr, selectedElems)
completed = false completed = false
clearTimeout(window.undoTimeout) clearTimeout(window.undoTimeout)
window.undoTimeout = setTimeout(function(){ window.undoTimeout = setTimeout(function(){
wheel_input.stop() wheel_input.stop()
},1000) },500)
var wheel_input = this; var wheel_input = this;
if (deltaY > 0) if (deltaY > 0)

View File

@ -409,7 +409,7 @@
<div id="selected_panel" class="context_panel"> <div id="selected_panel" class="context_panel">
<label id="tool_angle" data-title="Change rotation angle" class="draginput"> <label id="tool_angle" data-title="Change rotation angle" class="draginput">
<input id="angle" class="attr_changer" size="2" value="0" data-min="-180" data-max="180" type="text"/> <input id="angle" class="attr_changer" size="2" value="0" data-attr="transform" data-min="-180" data-max="180" type="text"/>
<span class="icon_label">Rotation</span> <span class="icon_label">Rotation</span>
<div id="tool_angle_indicator"> <div id="tool_angle_indicator">
<div id="tool_angle_indicator_cursor"></div> <div id="tool_angle_indicator_cursor"></div>

View File

@ -1676,7 +1676,8 @@
} }
var changeRotationAngle = function(ctl) { var changeRotationAngle = function(ctl) {
svgCanvas.setRotationAngle(ctl.value); var preventUndo = true;
svgCanvas.setRotationAngle(ctl.value, preventUndo);
rotateCursor(ctl.value) rotateCursor(ctl.value)
$('#tool_reorient').toggleClass('disabled', ctl.value == 0); $('#tool_reorient').toggleClass('disabled', ctl.value == 0);
} }

View File

@ -1,56 +1,56 @@
function touchHandler(a){var q=a.changedTouches,g=q[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var p=document.createEvent("MouseEvent");p.initMouseEvent(b,true,true,window,1,g.screenX,g.screenY,g.clientX,g.clientY,false,false,false,false,0,null);if(q.length<2){g.target.dispatchEvent(p);a.preventDefault()}};(function(a){function q(g){if(typeof g.data==="string"){var b=g.handler,p=g.data.toLowerCase().split(" ");g.handler=function(v){if(!(this!==v.target&&(/textarea|select/i.test(v.target.nodeName)||v.target.type==="text"))){var d=v.type!=="keypress"&&a.hotkeys.specialKeys[v.which],f=String.fromCharCode(v.which).toLowerCase(),c="",m={};if(v.altKey&&d!=="alt")c+="alt+";if(v.ctrlKey&&d!=="ctrl")c+="ctrl+";if(v.metaKey&&!v.ctrlKey&&d!=="meta")c+="meta+";if(v.shiftKey&&d!=="shift")c+="shift+";if(d)m[c+d]= function touchHandler(a){var q=a.changedTouches,g=q[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var p=document.createEvent("MouseEvent");p.initMouseEvent(b,true,true,window,1,g.screenX,g.screenY,g.clientX,g.clientY,false,false,false,false,0,null);if(q.length<2){g.target.dispatchEvent(p);a.preventDefault()}};(function(a){function q(g){if(typeof g.data==="string"){var b=g.handler,p=g.data.toLowerCase().split(" ");g.handler=function(v){if(!(this!==v.target&&(/textarea|select/i.test(v.target.nodeName)||v.target.type==="text"))){var d=v.type!=="keypress"&&a.hotkeys.specialKeys[v.which],f=String.fromCharCode(v.which).toLowerCase(),c="",m={};if(v.altKey&&d!=="alt")c+="alt+";if(v.ctrlKey&&d!=="ctrl")c+="ctrl+";if(v.metaKey&&!v.ctrlKey&&d!=="meta")c+="meta+";if(v.shiftKey&&d!=="shift")c+="shift+";if(d)m[c+d]=
true;else{m[c+f]=true;m[c+a.hotkeys.shiftNums[f]]=true;if(c==="shift+")m[a.hotkeys.shiftNums[f]]=true}d=0;for(f=p.length;d<f;d++)if(m[p[d]])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{m[c+f]=true;m[c+a.hotkeys.shiftNums[f]]=true;if(c==="shift+")m[a.hotkeys.shiftNums[f]]=true}d=0;for(f=p.length;d<f;d++)if(m[p[d]])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 g(ba){return typeof ba==="string"}function b(ba){var T=c.call(arguments,1);return function(){return ba.apply(this,T.concat(c.call(arguments)))}}function p(ba,T,Z,oa,pa){var ma;if(oa!==f){T=Z.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Z=T[3]||"";if(pa===2&&g(oa))oa=oa.replace(ba?ea:U,"");else{ma=s(T[2]);oa=g(oa)?s[ba?ga:N](oa):oa;oa=pa===2?oa:pa===1?a.extend({},oa,ma):a.extend({},ma,oa);oa=u(oa);if(ba)oa=oa.replace(Aa,m)}ba=T[1]+(ba?"#":oa||!T[1]?"?":"")+oa+Z}else ba= 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 g(ba){return typeof ba==="string"}function b(ba){var T=c.call(arguments,1);return function(){return ba.apply(this,T.concat(c.call(arguments)))}}function p(ba,T,Z,na,pa){var ma;if(na!==f){T=Z.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Z=T[3]||"";if(pa===2&&g(na))na=na.replace(ba?ea:U,"");else{ma=s(T[2]);na=g(na)?s[ba?ga:N](na):na;na=pa===2?na:pa===1?a.extend({},na,ma):a.extend({},ma,na);na=u(na);if(ba)na=na.replace(Aa,m)}ba=T[1]+(ba?"#":na||!T[1]?"?":"")+na+Z}else ba=
T(Z!==f?Z:q[na][X]);return ba}function v(ba,T,Z){if(T===f||typeof T==="boolean"){Z=T;T=u[ba?ga:N]()}else T=g(T)?T.replace(ba?ea:U,""):T;return s(T,Z)}function d(ba,T,Z,oa){if(!g(Z)&&typeof Z!=="object"){oa=Z;Z=T;T=f}return this.each(function(){var pa=a(this),ma=T||Q()[(this.nodeName||"").toLowerCase()]||"",la=ma&&pa.attr(ma)||"";pa.attr(ma,u[ba](la,Z,oa))})}var f,c=Array.prototype.slice,m=decodeURIComponent,u=a.param,C,s,L,R=a.bbq=a.bbq||{},K,I,Q,S=a.event.special,N="querystring",ga="fragment",na= T(Z!==f?Z:q[oa][X]);return ba}function v(ba,T,Z){if(T===f||typeof T==="boolean"){Z=T;T=u[ba?ga:N]()}else T=g(T)?T.replace(ba?ea:U,""):T;return s(T,Z)}function d(ba,T,Z,na){if(!g(Z)&&typeof Z!=="object"){na=Z;Z=T;T=f}return this.each(function(){var pa=a(this),ma=T||S()[(this.nodeName||"").toLowerCase()]||"",la=ma&&pa.attr(ma)||"";pa.attr(ma,u[ba](la,Z,na))})}var f,c=Array.prototype.slice,m=decodeURIComponent,u=a.param,C,s,L,Q=a.bbq=a.bbq||{},K,H,S,R=a.event.special,N="querystring",ga="fragment",oa=
"location",X="href",U=/^.*\?|#.*$/g,ea=/^.*\#/,Aa,ja={};u[N]=b(p,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ga]=C=b(p,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);Aa=RegExp(ba.join("|"),"g")};C.noEscape(",/");a.deparam=s=function(ba,T){var Z={},oa={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(pa,ma){var la=ma.split("="),xa=m(la[0]),ya=Z,Ja= "location",X="href",U=/^.*\?|#.*$/g,ea=/^.*\#/,Aa,ja={};u[N]=b(p,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ga]=C=b(p,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);Aa=RegExp(ba.join("|"),"g")};C.noEscape(",/");a.deparam=s=function(ba,T){var Z={},na={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(pa,ma){var la=ma.split("="),xa=m(la[0]),ya=Z,Ja=
0,Ha=xa.split("]["),Ga=Ha.length-1;if(/\[/.test(Ha[0])&&/\]$/.test(Ha[Ga])){Ha[Ga]=Ha[Ga].replace(/\]$/,"");Ha=Ha.shift().split("[").concat(Ha);Ga=Ha.length-1}else Ga=0;if(la.length===2){la=m(la[1]);if(T)la=la&&!isNaN(la)?+la:la==="undefined"?f:oa[la]!==f?oa[la]:la;if(Ga)for(;Ja<=Ga;Ja++){xa=Ha[Ja]===""?ya.length:Ha[Ja];ya=ya[xa]=Ja<Ga?ya[xa]||(Ha[Ja+1]&&isNaN(Ha[Ja+1])?{}:[]):la}else if(a.isArray(Z[xa]))Z[xa].push(la);else Z[xa]=Z[xa]!==f?[Z[xa],la]:la}else if(xa)Z[xa]=T?f:""});return Z};s[N]=b(v, 0,Ha=xa.split("]["),Ga=Ha.length-1;if(/\[/.test(Ha[0])&&/\]$/.test(Ha[Ga])){Ha[Ga]=Ha[Ga].replace(/\]$/,"");Ha=Ha.shift().split("[").concat(Ha);Ga=Ha.length-1}else Ga=0;if(la.length===2){la=m(la[1]);if(T)la=la&&!isNaN(la)?+la:la==="undefined"?f:na[la]!==f?na[la]:la;if(Ga)for(;Ja<=Ga;Ja++){xa=Ha[Ja]===""?ya.length:Ha[Ja];ya=ya[xa]=Ja<Ga?ya[xa]||(Ha[Ja+1]&&isNaN(Ha[Ja+1])?{}:[]):la}else if(a.isArray(Z[xa]))Z[xa].push(la);else Z[xa]=Z[xa]!==f?[Z[xa],la]:la}else if(xa)Z[xa]=T?f:""});return Z};s[N]=b(v,
0);s[ga]=L=b(v,1);a.elemUrlAttr||(a.elemUrlAttr=function(ba){return a.extend(ja,ba)})({a:X,base:X,iframe:"src",img:"src",input:"src",form:"action",link:X,script:"src"});Q=a.elemUrlAttr;a.fn[N]=b(d,N);a.fn[ga]=b(d,ga);R.pushState=K=function(ba,T){if(g(ba)&&/^#/.test(ba)&&T===f)T=2;var Z=ba!==f;Z=C(q[na][X],Z?ba:{},Z?T:2);q[na][X]=Z+(/#/.test(Z)?"":"#")};R.getState=I=function(ba,T){return ba===f||typeof ba==="boolean"?L(ba):L(T)[ba]};R.removeState=function(ba){var T={};if(ba!==f){T=I();a.each(a.isArray(ba)? 0);s[ga]=L=b(v,1);a.elemUrlAttr||(a.elemUrlAttr=function(ba){return a.extend(ja,ba)})({a:X,base:X,iframe:"src",img:"src",input:"src",form:"action",link:X,script:"src"});S=a.elemUrlAttr;a.fn[N]=b(d,N);a.fn[ga]=b(d,ga);Q.pushState=K=function(ba,T){if(g(ba)&&/^#/.test(ba)&&T===f)T=2;var Z=ba!==f;Z=C(q[oa][X],Z?ba:{},Z?T:2);q[oa][X]=Z+(/#/.test(Z)?"":"#")};Q.getState=H=function(ba,T){return ba===f||typeof ba==="boolean"?L(ba):L(T)[ba]};Q.removeState=function(ba){var T={};if(ba!==f){T=H();a.each(a.isArray(ba)?
ba:arguments,function(Z,oa){delete T[oa]})}K(T,2)};S.hashchange=a.extend(S.hashchange,{add:function(ba){function T(oa){var pa=oa[ga]=C();oa.getState=function(ma,la){return ma===f||typeof ma==="boolean"?s(pa,ma):s(pa,la)[ma]};Z.apply(this,arguments)}var Z;if(a.isFunction(ba)){Z=ba;return T}else{Z=ba.handler;ba.handler=T}}})})(jQuery,this); ba:arguments,function(Z,na){delete T[na]})}K(T,2)};R.hashchange=a.extend(R.hashchange,{add:function(ba){function T(na){var pa=na[ga]=C();na.getState=function(ma,la){return ma===f||typeof ma==="boolean"?s(pa,ma):s(pa,la)[ma]};Z.apply(this,arguments)}var Z;if(a.isFunction(ba)){Z=ba;return T}else{Z=ba.handler;ba.handler=T}}})})(jQuery,this);
(function(a,q,g){function b(C){C=C||q[d][f];return C.replace(/^[^#]*#?(.*)$/,"$1")}var p,v=a.event.special,d="location",f="href",c=document.documentMode,m=a.browser.msie&&(c===g||c<8),u="onhashchange"in q&&!m;a.hashchangeDelay=100;v.hashchange=a.extend(v.hashchange,{setup:function(){if(u)return false;a(p.start)},teardown:function(){if(u)return false;a(p.stop)}});p=function(){function C(){K=I=function(Q){return Q};if(m){R=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow; (function(a,q,g){function b(C){C=C||q[d][f];return C.replace(/^[^#]*#?(.*)$/,"$1")}var p,v=a.event.special,d="location",f="href",c=document.documentMode,m=a.browser.msie&&(c===g||c<8),u="onhashchange"in q&&!m;a.hashchangeDelay=100;v.hashchange=a.extend(v.hashchange,{setup:function(){if(u)return false;a(p.start)},teardown:function(){if(u)return false;a(p.stop)}});p=function(){function C(){K=H=function(S){return S};if(m){Q=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;
I=function(){return b(R.document[d][f])};K=function(Q,S){if(Q!==S){var N=R.document;N.open().close();N[d].hash="#"+Q}};K(b())}}var s={},L,R,K,I;s.start=function(){if(!L){var Q=b();K||C();(function S(){var N=b(),ga=I(Q);if(N!==Q){K(Q=N,ga);a(q).trigger("hashchange")}else if(ga!==Q)q[d][f]=q[d][f].replace(/#.*/,"")+"#"+ga;L=setTimeout(S,a.hashchangeDelay)})()}};s.stop=function(){if(!R){L&&clearTimeout(L);L=0}};return s}()})(jQuery,this);(function(a){var q={},g;a.svgIcons=function(b,p){function v(ba,T){if(ba!=="ajax"){if(Q)return;var Z=(R=X[0].contentDocument)&&R.getElementById("svg_eof");if(!Z&&!(T&&Z)){S++;if(S<50)setTimeout(v,20);else{f();Q=true}return}Q=true}L=a(R.firstChild).children();if(p.no_img)setTimeout(function(){I||d()},500);else{Z=na+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";K=a(new Image).attr({src:Z,width:0,height:0}).appendTo("body").load(function(){d(true)}).error(function(){d()})}} H=function(){return b(Q.document[d][f])};K=function(S,R){if(S!==R){var N=Q.document;N.open().close();N[d].hash="#"+S}};K(b())}}var s={},L,Q,K,H;s.start=function(){if(!L){var S=b();K||C();(function R(){var N=b(),ga=H(S);if(N!==S){K(S=N,ga);a(q).trigger("hashchange")}else if(ga!==S)q[d][f]=q[d][f].replace(/#.*/,"")+"#"+ga;L=setTimeout(R,a.hashchangeDelay)})()}};s.stop=function(){if(!Q){L&&clearTimeout(L);L=0}};return s}()})(jQuery,this);(function(a){var q={},g;a.svgIcons=function(b,p){function v(ba,T){if(ba!=="ajax"){if(S)return;var Z=(Q=X[0].contentDocument)&&Q.getElementById("svg_eof");if(!Z&&!(T&&Z)){R++;if(R<50)setTimeout(v,20);else{f();S=true}return}S=true}L=a(Q.firstChild).children();if(p.no_img)setTimeout(function(){H||d()},500);else{Z=oa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";K=a(new Image).attr({src:Z,width:0,height:0}).appendTo("body").load(function(){d(true)}).error(function(){d()})}}
function d(ba,T){if(!I){if(p.no_img)ba=false;if(ba){var Z=a(document.createElement("div"));Z.hide().appendTo("body")}if(T){var oa=p.fallback_path?p.fallback_path:"";a.each(T,function(Ga,Ma){a("#"+Ga);var Ca=a(new Image).attr({"class":"svg_icon",src:oa+Ma,width:C,height:s,alt:"icon"});ja(Ca,Ga)})}else for(var pa=L.length,ma=0;ma<pa;ma++){var la=L[ma],xa=la.id;if(xa==="svg_eof")break;a("#"+xa);la=la.getElementsByTagNameNS(m,"svg")[0];var ya=document.createElementNS(m,"svg");ya.setAttributeNS(m,"viewBox", function d(ba,T){if(!H){if(p.no_img)ba=false;if(ba){var Z=a(document.createElement("div"));Z.hide().appendTo("body")}if(T){var na=p.fallback_path?p.fallback_path:"";a.each(T,function(Ga,Ma){a("#"+Ga);var Ca=a(new Image).attr({"class":"svg_icon",src:na+Ma,width:C,height:s,alt:"icon"});ja(Ca,Ga)})}else for(var pa=L.length,ma=0;ma<pa;ma++){var la=L[ma],xa=la.id;if(xa==="svg_eof")break;a("#"+xa);la=la.getElementsByTagNameNS(m,"svg")[0];var ya=document.createElementNS(m,"svg");ya.setAttributeNS(m,"viewBox",
[0,0,C,s].join(" "));var Ja=la.getAttribute("width"),Ha=la.getAttribute("height");la.removeAttribute("width");la.removeAttribute("height");la.getAttribute("viewBox")||la.setAttribute("viewBox",[0,0,Ja,Ha].join(" "));ya.setAttribute("xmlns",m);ya.setAttribute("width",C);ya.setAttribute("height",s);ya.setAttribute("xmlns:xlink",u);ya.setAttribute("class","svg_icon");ga||(la=la.cloneNode(true));ya.appendChild(la);if(ba){ga||ya.cloneNode(true);Z.empty().append(ya);la=na+c(Z.html());la=a(new Image).attr({"class":"svg_icon", [0,0,C,s].join(" "));var Ja=la.getAttribute("width"),Ha=la.getAttribute("height");la.removeAttribute("width");la.removeAttribute("height");la.getAttribute("viewBox")||la.setAttribute("viewBox",[0,0,Ja,Ha].join(" "));ya.setAttribute("xmlns",m);ya.setAttribute("width",C);ya.setAttribute("height",s);ya.setAttribute("xmlns:xlink",u);ya.setAttribute("class","svg_icon");ga||(la=la.cloneNode(true));ya.appendChild(la);if(ba){ga||ya.cloneNode(true);Z.empty().append(ya);la=oa+c(Z.html());la=a(new Image).attr({"class":"svg_icon",
src:la})}else la=g(a(ya),ma);ja(la,xa)}p.placement&&a.each(p.placement,function(Ga,Ma){q[Ma]&&a(Ga).each(function(Ca){var wa=q[Ma].clone();if(Ca>0&&!ba)wa=g(wa,Ca,true);Aa(a(this),wa,Ma)})});if(!T){ba&&Z.remove();X&&X.remove();K&&K.remove()}p.resize&&a.resizeSvgIcons(p.resize);I=true;p.callback&&p.callback(q)}}function f(){if(b.indexOf(".svgz")!=-1){var ba=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,p)}else p.fallback&&d(false,p.fallback)} src:la})}else la=g(a(ya),ma);ja(la,xa)}p.placement&&a.each(p.placement,function(Ga,Ma){q[Ma]&&a(Ga).each(function(Ca){var wa=q[Ma].clone();if(Ca>0&&!ba)wa=g(wa,Ca,true);Aa(a(this),wa,Ma)})});if(!T){ba&&Z.remove();X&&X.remove();K&&K.remove()}p.resize&&a.resizeSvgIcons(p.resize);H=true;p.callback&&p.callback(q)}}function f(){if(b.indexOf(".svgz")!=-1){var ba=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,p)}else p.fallback&&d(false,p.fallback)}
function c(ba){if(window.btoa)return window.btoa(ba);var T=Array(Math.floor((ba.length+2)/3)*4),Z,oa,pa,ma,la,xa,ya=0,Ja=0;do{Z=ba.charCodeAt(ya++);oa=ba.charCodeAt(ya++);pa=ba.charCodeAt(ya++);ma=Z>>2;Z=(Z&3)<<4|oa>>4;la=(oa&15)<<2|pa>>6;xa=pa&63;if(isNaN(oa))la=xa=64;else if(isNaN(pa))xa=64;T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la); function c(ba){if(window.btoa)return window.btoa(ba);var T=Array(Math.floor((ba.length+2)/3)*4),Z,na,pa,ma,la,xa,ya=0,Ja=0;do{Z=ba.charCodeAt(ya++);na=ba.charCodeAt(ya++);pa=ba.charCodeAt(ya++);ma=Z>>2;Z=(Z&3)<<4|na>>4;la=(na&15)<<2|pa>>6;xa=pa&63;if(isNaN(na))la=xa=64;else if(isNaN(pa))xa=64;T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la);
T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(xa)}while(ya<ba.length);return T.join("")}var m="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",C=p.w?p.w:24,s=p.h?p.h:24,L,R,K,I=false,Q=false,S=0,N=navigator.userAgent,ga=!!window.opera;N.indexOf("Safari/")>-1&&N.indexOf("Chrome/");var na="data:image/svg+xml;charset=utf-8;base64,";if(p.svgz){var X=a('<object data="'+b+'" type=image/svg+xml>').appendTo("body").hide();try{R=X[0].contentDocument;X.load(v); T[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(xa)}while(ya<ba.length);return T.join("")}var m="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",C=p.w?p.w:24,s=p.h?p.h:24,L,Q,K,H=false,S=false,R=0,N=navigator.userAgent,ga=!!window.opera;N.indexOf("Safari/")>-1&&N.indexOf("Chrome/");var oa="data:image/svg+xml;charset=utf-8;base64,";if(p.svgz){var X=a('<object data="'+b+'" type=image/svg+xml>').appendTo("body").hide();try{Q=X[0].contentDocument;X.load(v);
v(0,true)}catch(U){f()}}else{var ea=new DOMParser;a.ajax({url:b,dataType:"string",success:function(ba){if(ba){R=ea.parseFromString(ba,"text/xml");a(function(){v("ajax")})}else a(f)},error:function(ba){if(window.opera)a(function(){f()});else if(ba.responseText){R=ea.parseFromString(ba.responseText,"text/xml");R.childNodes.length||a(f);a(function(){v("ajax")})}else a(f)}})}var Aa=function(ba,T,Z,oa){ga&&T.css("visibility","hidden");if(p.replace){oa&&T.attr("id",Z);(Z=ba.attr("class"))&&T.attr("class", v(0,true)}catch(U){f()}}else{var ea=new DOMParser;a.ajax({url:b,dataType:"string",success:function(ba){if(ba){Q=ea.parseFromString(ba,"text/xml");a(function(){v("ajax")})}else a(f)},error:function(ba){if(window.opera)a(function(){f()});else if(ba.responseText){Q=ea.parseFromString(ba.responseText,"text/xml");Q.childNodes.length||a(f);a(function(){v("ajax")})}else a(f)}})}var Aa=function(ba,T,Z,na){ga&&T.css("visibility","hidden");if(p.replace){na&&T.attr("id",Z);(Z=ba.attr("class"))&&T.attr("class",
"svg_icon "+Z);ba.replaceWith(T)}else ba.append(T);ga&&setTimeout(function(){T.removeAttr("style")},1)},ja=function(ba,T){if(p.id_match===undefined||p.id_match!==false)Aa(holder,ba,T,true);q[T]=ba};g=function(ba,T){var Z=ba.find("defs");if(!Z.length)return ba;Z=ga?Z.find("*").filter(function(){return!!this.id}):Z.find("[id]");var oa=ba[0].getElementsByTagName("*"),pa=oa.length;Z.each(function(ma){var la=this.id;a(R).find("#"+la);this.id=ma="x"+la+T+ma;la="url(#"+la+")";var xa="url(#"+ma+")";for(ma= "svg_icon "+Z);ba.replaceWith(T)}else ba.append(T);ga&&setTimeout(function(){T.removeAttr("style")},1)},ja=function(ba,T){if(p.id_match===undefined||p.id_match!==false)Aa(holder,ba,T,true);q[T]=ba};g=function(ba,T){var Z=ba.find("defs");if(!Z.length)return ba;Z=ga?Z.find("*").filter(function(){return!!this.id}):Z.find("[id]");var na=ba[0].getElementsByTagName("*"),pa=na.length;Z.each(function(ma){var la=this.id;a(Q).find("#"+la);this.id=ma="x"+la+T+ma;la="url(#"+la+")";var xa="url(#"+ma+")";for(ma=
0;ma<pa;ma++){var ya=oa[ma];ya.getAttribute("fill")===la&&ya.setAttribute("fill",xa);ya.getAttribute("stroke")===la&&ya.setAttribute("stroke",xa);ya.getAttribute("filter")===la&&ya.setAttribute("filter",xa)}});return ba}};a.getSvgIcon=function(b,p){var v=q[b];if(p&&v)v=g(v,0,true).clone(true);return v};a.resizeSvgIcons=function(b){var p=!a(".svg_icon:first").length;a.each(b,function(v,d){var f=a.isArray(d),c=f?d[0]:d,m=f?d[1]:d;if(p)v=v.replace(/\.svg_icon/g,"svg");a(v).each(function(){this.setAttribute("width", 0;ma<pa;ma++){var ya=na[ma];ya.getAttribute("fill")===la&&ya.setAttribute("fill",xa);ya.getAttribute("stroke")===la&&ya.setAttribute("stroke",xa);ya.getAttribute("filter")===la&&ya.setAttribute("filter",xa)}});return ba}};a.getSvgIcon=function(b,p){var v=q[b];if(p&&v)v=g(v,0,true).clone(true);return v};a.resizeSvgIcons=function(b){var p=!a(".svg_icon:first").length;a.each(b,function(v,d){var f=a.isArray(d),c=f?d[0]:d,m=f?d[1]:d;if(p)v=v.replace(/\.svg_icon/g,"svg");a(v).each(function(){this.setAttribute("width",
c);this.setAttribute("height",m);if(window.opera&&window.widget){this.parentNode.style.width=c+"px";this.parentNode.style.height=m+"px"}})})}})(jQuery);(function(){function a(b,p,v){b=document.createElementNS(q.svg,b);if(g)for(var d in p)b.setAttribute(d,p[d]);else for(d in p){var f=p[d],c=b[d];if(c&&c.constructor==="SVGLength")c.baseVal.value=f;else b.setAttribute(d,f)}v&&v.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= c);this.setAttribute("height",m);if(window.opera&&window.widget){this.parentNode.style.width=c+"px";this.parentNode.style.height=m+"px"}})})}})(jQuery);(function(){function a(b,p,v){b=document.createElementNS(q.svg,b);if(g)for(var d in p)b.setAttribute(d,p[d]);else for(d in p){var f=p[d],c=b[d];if(c&&c.constructor==="SVGLength")c.baseVal.value=f;else b.setAttribute(d,f)}v&&v.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 g=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(b){var p= "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 g=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(b){var p=
arguments;return this.each(function(){function v(ia,aa,ka,M,P){var ca=P||a("stop",{"stop-color":aa,"stop-opacity":ka,offset:ia},ea);if(P){aa=P.getAttribute("stop-color");ka=P.getAttribute("stop-opacity");ia=P.getAttribute("offset")}else ea.appendChild(ca);if(ka===null)ka=1;P=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+ia*ga)+", 26)"},kb);var Da= arguments;return this.each(function(){function v(ia,aa,ka,M,P){var ca=P||a("stop",{"stop-color":aa,"stop-opacity":ka,offset:ia},ea);if(P){aa=P.getAttribute("stop-color");ka=P.getAttribute("stop-opacity");ia=P.getAttribute("offset")}else ea.appendChild(ca);if(ka===null)ka=1;P=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+ia*ga)+", 26)"},kb);var Da=
a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:aa,"fill-opacity":ka,transform:"translate("+(10+ia*ga)+", 26)",stroke:"#000","stroke-width":1.5},kb);$(Da).mousedown(function(Oa){d(this);Va=cb;Q.mousemove(m).mouseup(f);ta=vb.offset();Oa.preventDefault();return false}).data("stop",ca).data("bg",P).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Wa=+ca.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:aa,"fill-opacity":ka,transform:"translate("+(10+ia*ga)+", 26)",stroke:"#000","stroke-width":1.5},kb);$(Da).mousedown(function(Oa){d(this);Va=cb;S.mousemove(m).mouseup(f);ta=vb.offset();Oa.preventDefault();return false}).data("stop",ca).data("bg",P).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Wa=+ca.getAttribute("stop-opacity")||
1,Za=ca.getAttribute("stop-color")||1,nb=(parseFloat(Wa)*255).toString(16);nb.length<2;)nb="0"+nb;aa=Za.substr(1)+nb;$("#"+s+"_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:aa,alphaSupport:true}},function(Ra){Za=Ra.val("hex")?"#"+Ra.val("hex"):"none";Wa=Ra.val("a")!==null?Ra.val("a")/256:1;Oa.setAttribute("fill",Za);Oa.setAttribute("fill-opacity",Wa);ca.setAttribute("stop-color", 1,Za=ca.getAttribute("stop-color")||1,nb=(parseFloat(Wa)*255).toString(16);nb.length<2;)nb="0"+nb;aa=Za.substr(1)+nb;$("#"+s+"_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:aa,alphaSupport:true}},function(Ra){Za=Ra.val("hex")?"#"+Ra.val("hex"):"none";Wa=Ra.val("a")!==null?Ra.val("a")/256:1;Oa.setAttribute("fill",Za);Oa.setAttribute("fill-opacity",Wa);ca.setAttribute("stop-color",
Za);ca.setAttribute("stop-opacity",Wa);$("div.jGraduate_LightBox").hide();$("#"+s+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+s+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ia){if(!aa){var Wa=this.getAttribute("stop-color"),Za=this.getAttribute("stop-opacity");ca.setAttribute("stop-color",Wa);Da.setAttribute("fill",Wa);ca.setAttribute("stop-opacity",Za===null?1:Za);Da.setAttribute("fill-opacity", Za);ca.setAttribute("stop-opacity",Wa);$("div.jGraduate_LightBox").hide();$("#"+s+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+s+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ia){if(!aa){var Wa=this.getAttribute("stop-color"),Za=this.getAttribute("stop-opacity");ca.setAttribute("stop-color",Wa);Da.setAttribute("fill",Wa);ca.setAttribute("stop-opacity",Za===null?1:Za);Da.setAttribute("fill-opacity",
Za===null?1:Za)}Oa.before(ca);return false}});M&&d(Da);return ca}function d(ia){cb&&cb.setAttribute("stroke","#000");ia.setAttribute("stroke","blue");cb=ia;cb.parentNode.appendChild(cb)}function f(){Q.unbind("mousemove",m);if(Ea.getAttribute("display")!=="none"){Ea.setAttribute("display","none");var ia=$(cb),aa=ia.data("stop");ia=ia.data("bg");$([cb,aa,ia]).remove()}Va=null}function c(){var ia=Sa?"rotate("+Sa+","+Fa+","+db+") ":"";$a===1&&Ka===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform", Za===null?1:Za)}Oa.before(ca);return false}});M&&d(Da);return ca}function d(ia){cb&&cb.setAttribute("stroke","#000");ia.setAttribute("stroke","blue");cb=ia;cb.parentNode.appendChild(cb)}function f(){S.unbind("mousemove",m);if(Ea.getAttribute("display")!=="none"){Ea.setAttribute("display","none");var ia=$(cb),aa=ia.data("stop");ia=ia.data("bg");$([cb,aa,ia]).remove()}Va=null}function c(){var ia=Sa?"rotate("+Sa+","+Fa+","+db+") ":"";$a===1&&Ka===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform",
ia+"translate("+-Fa*($a-1)+","+-db*(Ka-1)+") scale("+$a+","+Ka+")")}function m(ia){var aa=ia.pageX-ta.left;ia=ia.pageY-ta.top;aa=aa<10?10:aa>ga+10?ga+10:aa;var ka="translate("+aa+", 26)";if(ia<-60||ia>130){Ea.setAttribute("display","block");Ea.setAttribute("transform",ka)}else Ea.setAttribute("display","none");Va.setAttribute("transform",ka);$.data(Va,"bg").setAttribute("transform",ka);$.data(Va,"stop").setAttribute("offset",(aa-10)/ga);var M=0;$(ea).find("stop").each(function(){var P=this.getAttribute("offset"), ia+"translate("+-Fa*($a-1)+","+-db*(Ka-1)+") scale("+$a+","+Ka+")")}function m(ia){var aa=ia.pageX-ta.left;ia=ia.pageY-ta.top;aa=aa<10?10:aa>ga+10?ga+10:aa;var ka="translate("+aa+", 26)";if(ia<-60||ia>130){Ea.setAttribute("display","block");Ea.setAttribute("transform",ka)}else Ea.setAttribute("display","none");Va.setAttribute("transform",ka);$.data(Va,"bg").setAttribute("transform",ka);$.data(Va,"stop").setAttribute("offset",(aa-10)/ga);var M=0;$(ea).find("stop").each(function(){var P=this.getAttribute("offset"),
ca=$(this);if(P<M){ca.prev().before(ca);va=$(ea).find("stop")}M=P})}var u=$(this),C=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),s=u.attr("id"),L="#"+u.attr("id")+" ";if(L){var R=function(){switch(u.paint.type){case "radialGradient":u.paint.linearGradient=null;break;case "linearGradient":u.paint.radialGradient=null;break;case "solidColor":u.paint.radialGradient=u.paint.linearGradient=null}$.isFunction(u.okCallback)&&u.okCallback(u.paint);u.hide()},K=function(){$.isFunction(u.cancelCallback)&&u.cancelCallback(); ca=$(this);if(P<M){ca.prev().before(ca);va=$(ea).find("stop")}M=P})}var u=$(this),C=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),s=u.attr("id"),L="#"+u.attr("id")+" ";if(L){var Q=function(){switch(u.paint.type){case "radialGradient":u.paint.linearGradient=null;break;case "linearGradient":u.paint.radialGradient=null;break;case "solidColor":u.paint.radialGradient=u.paint.linearGradient=null}$.isFunction(u.okCallback)&&u.okCallback(u.paint);u.hide()},K=function(){$.isFunction(u.cancelCallback)&&u.cancelCallback();
u.hide()};$.extend(true,u,{paint:new $.jGraduate.Paint({copy:C.paint}),okCallback:$.isFunction(p[1])&&p[1]||null,cancelCallback:$.isFunction(p[2])&&p[2]||null});u.position();var I=null,Q=$(window);if(u.paint.type=="none")u.paint=$.jGraduate.Paint({solidColor:"ffffff"});u.addClass("jGraduate_Picker");u.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="'+ u.hide()};$.extend(true,u,{paint:new $.jGraduate.Paint({copy:C.paint}),okCallback:$.isFunction(p[1])&&p[1]||null,cancelCallback:$.isFunction(p[2])&&p[2]||null});u.position();var H=null,S=$(window);if(u.paint.type=="none")u.paint=$.jGraduate.Paint({solidColor:"ffffff"});u.addClass("jGraduate_Picker");u.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+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var S=$(L+"> .jGraduate_colPick"),N=$(L+"> .jGraduate_gradPick");N.html('<div id="'+s+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+C.window.pickerTitle+'</h2><div id="'+s+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+s+'_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="'+ s+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var R=$(L+"> .jGraduate_colPick"),N=$(L+"> .jGraduate_gradPick");N.html('<div id="'+s+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+C.window.pickerTitle+'</h2><div id="'+s+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+s+'_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="'+
s+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_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="'+s+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+ s+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_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="'+s+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+
s+'_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+s+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="'+ s+'_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+s+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="'+
s+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'+s+'_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_jGraduate_fy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_StopSection jGraduate_SpreadMethod"><label class="jGraduate_Form_Heading">Spread method</label><div class="jGraduate_Form_Section"><select class="jGraduate_spreadMethod"><option value=pad selected>Pad</option><option value=reflect>Reflect</option><option value=repeat>Repeat</option></select></div></div><div class="jGraduate_Form"><div class="jGraduate_Slider jGraduate_RadiusField jGraduate_rg_field"><label class="prelabel">Radius:</label><div id="'+ s+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'+s+'_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+s+'_jGraduate_fy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_StopSection jGraduate_SpreadMethod"><label class="jGraduate_Form_Heading">Spread method</label><div class="jGraduate_Form_Section"><select class="jGraduate_spreadMethod"><option value=pad selected>Pad</option><option value=reflect>Reflect</option><option value=repeat>Repeat</option></select></div></div><div class="jGraduate_Form"><div class="jGraduate_Slider jGraduate_RadiusField jGraduate_rg_field"><label class="prelabel">Radius:</label><div id="'+
s+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+s+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+s+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+ s+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+s+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+s+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+
s+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+s+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+s+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+C.images.clientPath+ s+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+s+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+s+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+C.images.clientPath+
'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba&nbsp;</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+s+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+s+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_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="'+s+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba&nbsp;</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+s+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+s+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+
s+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+s+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var ga=256,na=ga-0,X=ga-0,U,ea,Aa,ja={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+s+"_jGraduate_GradContainer")[0],T=a("svg",{id:s+"_jgraduate_svg",width:ga,height:ga,xmlns:q.svg},ba);U=U||u.paint.type;var Z=ea=u.paint[U],oa=u.paint.alpha,pa=U==="solidColor";switch(U){case "solidColor":case "linearGradient":if(!pa){ea.id=s+"_lg_jgraduate_grad"; s+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+s+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var ga=256,oa=ga-0,X=ga-0,U,ea,Aa,ja={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+s+"_jGraduate_GradContainer")[0],T=a("svg",{id:s+"_jgraduate_svg",width:ga,height:ga,xmlns:q.svg},ba);U=U||u.paint.type;var Z=ea=u.paint[U],na=u.paint.alpha,pa=U==="solidColor";switch(U){case "solidColor":case "linearGradient":if(!pa){ea.id=s+"_lg_jgraduate_grad";
Z=ea=T.appendChild(ea)}a("radialGradient",{id:s+"_rg_jgraduate_grad"},T);if(U==="linearGradient")break;case "radialGradient":if(!pa){ea.id=s+"_rg_jgraduate_grad";Z=ea=T.appendChild(ea)}a("linearGradient",{id:s+"_lg_jgraduate_grad"},T)}if(pa){Z=ea=$("#"+s+"_lg_jgraduate_grad")[0];I=u.paint[U];v(0,"#"+I,1);var ma=typeof C.newstop;if(ma==="string")switch(C.newstop){case "same":v(1,"#"+I,1);break;case "inverse":ma="";for(var la=0;la<6;la+=2){I.substr(la,2);var xa=(255-parseInt(I.substr(la,2),16)).toString(16); Z=ea=T.appendChild(ea)}a("radialGradient",{id:s+"_rg_jgraduate_grad"},T);if(U==="linearGradient")break;case "radialGradient":if(!pa){ea.id=s+"_rg_jgraduate_grad";Z=ea=T.appendChild(ea)}a("linearGradient",{id:s+"_lg_jgraduate_grad"},T)}if(pa){Z=ea=$("#"+s+"_lg_jgraduate_grad")[0];H=u.paint[U];v(0,"#"+H,1);var ma=typeof C.newstop;if(ma==="string")switch(C.newstop){case "same":v(1,"#"+H,1);break;case "inverse":ma="";for(var la=0;la<6;la+=2){H.substr(la,2);var xa=(255-parseInt(H.substr(la,2),16)).toString(16);
if(xa.length<2)xa=0+xa;ma+=xa}v(1,"#"+ma,1);break;case "white":v(1,"#ffffff",1);break;case "black":v(1,"#000000",1)}else if(ma==="object")v(1,C.newstop.color||"#"+I,"opac"in C.newstop?C.newstop.opac:1)}I=parseFloat(Z.getAttribute("x1")||0);ma=parseFloat(Z.getAttribute("y1")||0);la=parseFloat(Z.getAttribute("x2")||1);xa=parseFloat(Z.getAttribute("y2")||0);var ya=parseFloat(Z.getAttribute("cx")||0.5),Ja=parseFloat(Z.getAttribute("cy")||0.5),Ha=parseFloat(Z.getAttribute("fx")||ya),Ga=parseFloat(Z.getAttribute("fy")|| if(xa.length<2)xa=0+xa;ma+=xa}v(1,"#"+ma,1);break;case "white":v(1,"#ffffff",1);break;case "black":v(1,"#000000",1)}else if(ma==="object")v(1,C.newstop.color||"#"+H,"opac"in C.newstop?C.newstop.opac:1)}H=parseFloat(Z.getAttribute("x1")||0);ma=parseFloat(Z.getAttribute("y1")||0);la=parseFloat(Z.getAttribute("x2")||1);xa=parseFloat(Z.getAttribute("y2")||0);var ya=parseFloat(Z.getAttribute("cx")||0.5),Ja=parseFloat(Z.getAttribute("cy")||0.5),Ha=parseFloat(Z.getAttribute("fx")||ya),Ga=parseFloat(Z.getAttribute("fy")||
Ja);Aa=a("rect",{id:s+"_jgraduate_rect",x:0,y:0,width:na,height:X,fill:"url(#"+s+"_jgraduate_grad)","fill-opacity":oa/100},T);var Ma=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*ga,left:I*ga}).data("coord","start").appendTo(ba),Ca=Ma.clone().text(2).css({top:xa*ga,left:la*ga}).attr("title","End stop").data("coord","end").appendTo(ba),wa=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ja*ga,left:ya* Ja);Aa=a("rect",{id:s+"_jgraduate_rect",x:0,y:0,width:oa,height:X,fill:"url(#"+s+"_jgraduate_grad)","fill-opacity":na/100},T);var Ma=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*ga,left:H*ga}).data("coord","start").appendTo(ba),Ca=Ma.clone().text(2).css({top:xa*ga,left:la*ga}).attr("title","End stop").data("coord","end").appendTo(ba),wa=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ja*ga,left:ya*
ga}).data("coord","center").appendTo(ba),ra=wa.clone().text("F").css({top:Ga*ga,left:Ha*ga,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);ra[0].id=s+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ia,aa){var ka=ea.getAttribute(aa),M=isNaN(aa[1]);ka||(ka=M?"0.5":aa==="x2"?"1.0":"0.0");ja[aa]=$("#"+s+"_jGraduate_"+aa).val(ka).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> ga}).data("coord","center").appendTo(ba),ra=wa.clone().text("F").css({top:Ga*ga,left:Ha*ga,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);ra[0].id=s+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ia,aa){var ka=ea.getAttribute(aa),M=isNaN(aa[1]);ka||(ka=M?"0.5":aa==="x2"?"1.0":"0.0");ja[aa]=$("#"+s+"_jGraduate_"+aa).val(ka).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>
1)this.value=1;if(!(aa[0]==="f"&&!eb))if(M&&U==="radialGradient"||!M&&U==="linearGradient")ea.setAttribute(aa,this.value);var P=M?aa[0]==="c"?wa:ra:aa[1]==="1"?Ma:Ca,ca=aa.indexOf("x")>=0?"left":"top";P.css(ca,this.value*ga)}).change()});var va,kb,vb=$("#"+s+"_jGraduate_StopSlider"),cb,Ta,Va,Ea=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Ta),ta,$a=1,Ka=1,Sa=0,Fa=ya,db=Ja;Ta=a("svg",{width:"100%",height:45},vb[0]);ba=a("pattern",{width:16, 1)this.value=1;if(!(aa[0]==="f"&&!eb))if(M&&U==="radialGradient"||!M&&U==="linearGradient")ea.setAttribute(aa,this.value);var P=M?aa[0]==="c"?wa:ra:aa[1]==="1"?Ma:Ca,ca=aa.indexOf("x")>=0?"left":"top";P.css(ca,this.value*ga)}).change()});var va,kb,vb=$("#"+s+"_jGraduate_StopSlider"),cb,Ta,Va,Ea=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Ta),ta,$a=1,Ka=1,Sa=0,Fa=ya,db=Ja;Ta=a("svg",{width:"100%",height:45},vb[0]);ba=a("pattern",{width:16,
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Ta);a("image",{width:16,height:16},ba).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Ta).on("click touchstart",function(ia){ta=vb.offset();if(ia.target.tagName!=="path"){var aa=ia.pageX-ta.left-8;aa=aa<10?10:aa>ga+10?ga+10:aa;v(aa/ga,0,0,true);ia.stopPropagation()}});$(Ta).mouseover(function(){Ta.appendChild(Ea)});kb=a("g",{},Ta);a("line",{x1:10,y1:15,x2:ga+10,y2:15,"stroke-width":2,stroke:"#000"},Ta);var lb= height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Ta);a("image",{width:16,height:16},ba).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Ta).on("click touchstart",function(ia){ta=vb.offset();if(ia.target.tagName!=="path"){var aa=ia.pageX-ta.left-8;aa=aa<10?10:aa>ga+10?ga+10:aa;v(aa/ga,0,0,true);ia.stopPropagation()}});$(Ta).mouseover(function(){Ta.appendChild(Ea)});kb=a("g",{},Ta);a("line",{x1:10,y1:15,x2:ga+10,y2:15,"stroke-width":2,stroke:"#000"},Ta);var lb=
N.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod",$(this).val())}),Ua=null,Xa=function(ia){var aa=ia.pageX-hb.left,ka=ia.pageY-hb.top;aa=aa<0?0:aa>ga?ga:aa;ka=ka<0?0:ka>ga?ga:ka;Ua.css("left",aa).css("top",ka);aa=aa/na;ka=ka/X;var M=Ua.data("coord"),P=ea;switch(M){case "start":ja.x1.val(aa);ja.y1.val(ka);P.setAttribute("x1",aa);P.setAttribute("y1",ka);break;case "end":ja.x2.val(aa);ja.y2.val(ka);P.setAttribute("x2",aa);P.setAttribute("y2",ka);break;case "center":ja.cx.val(aa); N.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod",$(this).val())}),Ua=null,Xa=function(ia){var aa=ia.pageX-hb.left,ka=ia.pageY-hb.top;aa=aa<0?0:aa>ga?ga:aa;ka=ka<0?0:ka>ga?ga:ka;Ua.css("left",aa).css("top",ka);aa=aa/oa;ka=ka/X;var M=Ua.data("coord"),P=ea;switch(M){case "start":ja.x1.val(aa);ja.y1.val(ka);P.setAttribute("x1",aa);P.setAttribute("y1",ka);break;case "end":ja.x2.val(aa);ja.y2.val(ka);P.setAttribute("x2",aa);P.setAttribute("y2",ka);break;case "center":ja.cx.val(aa);
ja.cy.val(ka);P.setAttribute("cx",aa);P.setAttribute("cy",ka);Fa=aa;db=ka;c();break;case "focus":ja.fx.val(aa);ja.fy.val(ka);P.setAttribute("fx",aa);P.setAttribute("fy",ka);c()}ia.preventDefault()},wb=function(){Ua=null;Q.unbind("mousemove",Xa).unbind("mouseup",wb)};va=ea.getElementsByTagNameNS(q.svg,"stop");if(sa<2){for(;sa<2;){ea.appendChild(document.createElementNS(q.svg,"stop"));++sa}va=ea.getElementsByTagNameNS(q.svg,"stop")}var sa=va.length;for(la=0;la<sa;la++)v(0,0,0,0,va[la]);lb.val(ea.getAttribute("spreadMethod")|| ja.cy.val(ka);P.setAttribute("cx",aa);P.setAttribute("cy",ka);Fa=aa;db=ka;c();break;case "focus":ja.fx.val(aa);ja.fy.val(ka);P.setAttribute("fx",aa);P.setAttribute("fy",ka);c()}ia.preventDefault()},wb=function(){Ua=null;S.unbind("mousemove",Xa).unbind("mouseup",wb)};va=ea.getElementsByTagNameNS(q.svg,"stop");if(sa<2){for(;sa<2;){ea.appendChild(document.createElementNS(q.svg,"stop"));++sa}va=ea.getElementsByTagNameNS(q.svg,"stop")}var sa=va.length;for(la=0;la<sa;la++)v(0,0,0,0,va[la]);lb.val(ea.getAttribute("spreadMethod")||
"pad");var hb,eb=false;Aa.setAttribute("fill-opacity",oa/100);$("#"+s+" div.grad_coord").mousedown(function(ia){ia.preventDefault();Ua=$(this);Ua.offset();hb=Ua.parent().offset();Q.mousemove(Xa).mouseup(wb)});$("#"+s+"_jGraduate_Ok").bind("click touchstart",function(){u.paint.type=U;u.paint[U]=ea.cloneNode(true);u.paint.solidColor=null;R()});$("#"+s+"_jGraduate_Cancel").bind("click touchstart",function(){K()});if(U==="radialGradient")if(eb)ra.show();else{ra.hide();ja.fx.val("");ja.fy.val("")}$("#"+ "pad");var hb,eb=false;Aa.setAttribute("fill-opacity",na/100);$("#"+s+" div.grad_coord").mousedown(function(ia){ia.preventDefault();Ua=$(this);Ua.offset();hb=Ua.parent().offset();S.mousemove(Xa).mouseup(wb)});$("#"+s+"_jGraduate_Ok").bind("click touchstart",function(){u.paint.type=U;u.paint[U]=ea.cloneNode(true);u.paint.solidColor=null;Q()});$("#"+s+"_jGraduate_Cancel").bind("click touchstart",function(){K()});if(U==="radialGradient")if(eb)ra.show();else{ra.hide();ja.fx.val("");ja.fy.val("")}$("#"+
s+"_jGraduate_match_ctr")[0].checked=!eb;var sb,ib;$("#"+s+"_jGraduate_match_ctr").change(function(){eb=!this.checked;ra.toggle(eb);ja.fx.val("");ja.fy.val("");var ia=ea;if(eb){var aa=sb||0.5,ka=ib||0.5;ia.setAttribute("fx",aa);ia.setAttribute("fy",ka);ja.fx.val(aa);ja.fy.val(ka)}else{sb=ia.getAttribute("fx");ib=ia.getAttribute("fy");ia.removeAttribute("fx");ia.removeAttribute("fy")}});va=ea.getElementsByTagNameNS(q.svg,"stop");sa=va.length;if(sa<2){for(;sa<2;){ea.appendChild(document.createElementNS(q.svg, s+"_jGraduate_match_ctr")[0].checked=!eb;var sb,ib;$("#"+s+"_jGraduate_match_ctr").change(function(){eb=!this.checked;ra.toggle(eb);ja.fx.val("");ja.fy.val("");var ia=ea;if(eb){var aa=sb||0.5,ka=ib||0.5;ia.setAttribute("fx",aa);ia.setAttribute("fy",ka);ja.fx.val(aa);ja.fy.val(ka)}else{sb=ia.getAttribute("fx");ib=ia.getAttribute("fy");ia.removeAttribute("fx");ia.removeAttribute("fy")}});va=ea.getElementsByTagNameNS(q.svg,"stop");sa=va.length;if(sa<2){for(;sa<2;){ea.appendChild(document.createElementNS(q.svg,
"stop"));++sa}va=ea.getElementsByTagNameNS(q.svg,"stop")}var ab;oa=N=0;if(U==="radialGradient"){T=ea.gradientTransform.baseVal;if(T.numberOfItems===2){sa=T.getItem(0);T=T.getItem(1);if(sa.type===2&&T.type===3){sa=T.matrix;if(sa.a!==1)N=Math.round(-(1-sa.a)*100);else if(sa.d!==1)N=Math.round((1-sa.d)*100)}}else if(T.numberOfItems===3){ba=T.getItem(0);sa=T.getItem(1);T=T.getItem(2);if(ba.type===4&&sa.type===2&&T.type===3){oa=Math.round(ba.angle);sa=T.matrix;if(sa.a!==1)N=Math.round(-(1-sa.a)*100);else if(sa.d!== "stop"));++sa}va=ea.getElementsByTagNameNS(q.svg,"stop")}var ab;na=N=0;if(U==="radialGradient"){T=ea.gradientTransform.baseVal;if(T.numberOfItems===2){sa=T.getItem(0);T=T.getItem(1);if(sa.type===2&&T.type===3){sa=T.matrix;if(sa.a!==1)N=Math.round(-(1-sa.a)*100);else if(sa.d!==1)N=Math.round((1-sa.d)*100)}}else if(T.numberOfItems===3){ba=T.getItem(0);sa=T.getItem(1);T=T.getItem(2);if(ba.type===4&&sa.type===2&&T.type===3){na=Math.round(ba.angle);sa=T.matrix;if(sa.a!==1)N=Math.round(-(1-sa.a)*100);else if(sa.d!==
1)N=Math.round((1-sa.d)*100)}}}N={radius:{handle:"#"+s+"_jGraduate_RadiusArrows",input:"#"+s+"_jGraduate_RadiusInput",val:(ea.getAttribute("r")||0.5)*100},opacity:{handle:"#"+s+"_jGraduate_OpacArrows",input:"#"+s+"_jGraduate_OpacInput",val:u.paint.alpha||100},ellip:{handle:"#"+s+"_jGraduate_EllipArrows",input:"#"+s+"_jGraduate_EllipInput",val:N},angle:{handle:"#"+s+"_jGraduate_AngleArrows",input:"#"+s+"_jGraduate_AngleInput",val:oa}};$.each(N,function(ia,aa){var ka=$(aa.handle);ka.mousedown(function(M){var P= 1)N=Math.round((1-sa.d)*100)}}}N={radius:{handle:"#"+s+"_jGraduate_RadiusArrows",input:"#"+s+"_jGraduate_RadiusInput",val:(ea.getAttribute("r")||0.5)*100},opacity:{handle:"#"+s+"_jGraduate_OpacArrows",input:"#"+s+"_jGraduate_OpacInput",val:u.paint.alpha||100},ellip:{handle:"#"+s+"_jGraduate_EllipArrows",input:"#"+s+"_jGraduate_EllipInput",val:N},angle:{handle:"#"+s+"_jGraduate_AngleArrows",input:"#"+s+"_jGraduate_AngleInput",val:na}};$.each(N,function(ia,aa){var ka=$(aa.handle);ka.mousedown(function(M){var P=
ka.parent();ab={type:ia,elem:ka,input:$(aa.input),parent:P,offset:P.offset()};Q.mousemove(ob).mouseup(pb);M.preventDefault()});$(aa.input).val(aa.val).change(function(){var M=+this.value,P=0,ca=U==="radialGradient";switch(ia){case "radius":ca&&ea.setAttribute("r",M/100);P=Math.pow(M/100,0.4)/2*145;break;case "opacity":u.paint.alpha=M;Aa.setAttribute("fill-opacity",M/100);P=M*1.45;break;case "ellip":$a=Ka=1;if(M===0){P=72.5;break}if(M>99.5)M=99.5;if(M>0)Ka=1-M/100;else $a=-(M/100)-1;P=145*((M+100)/ ka.parent();ab={type:ia,elem:ka,input:$(aa.input),parent:P,offset:P.offset()};S.mousemove(ob).mouseup(pb);M.preventDefault()});$(aa.input).val(aa.val).change(function(){var M=+this.value,P=0,ca=U==="radialGradient";switch(ia){case "radius":ca&&ea.setAttribute("r",M/100);P=Math.pow(M/100,0.4)/2*145;break;case "opacity":u.paint.alpha=M;Aa.setAttribute("fill-opacity",M/100);P=M*1.45;break;case "ellip":$a=Ka=1;if(M===0){P=72.5;break}if(M>99.5)M=99.5;if(M>0)Ka=1-M/100;else $a=-(M/100)-1;P=145*((M+100)/
2)/100;ca&&c();break;case "angle":Sa=M;P=Sa/180;P+=0.5;P*=145;ca&&c()}if(P>145)P=145;else if(P<0)P=0;ka.css({"margin-left":P-5})}).change()});var ob=function(ia){var aa=ia.pageX-ab.offset.left-parseInt(ab.parent.css("border-left-width"));if(aa>145)aa=145;if(aa<=0)aa=0;var ka=aa-5;aa/=145;switch(ab.type){case "radius":aa=Math.pow(aa*2,2.5);if(aa>0.98&&aa<1.02)aa=1;if(aa<=0.01)aa=0.01;ea.setAttribute("r",aa);break;case "opacity":u.paint.alpha=parseInt(aa*100);Aa.setAttribute("fill-opacity",aa);break; 2)/100;ca&&c();break;case "angle":Sa=M;P=Sa/180;P+=0.5;P*=145;ca&&c()}if(P>145)P=145;else if(P<0)P=0;ka.css({"margin-left":P-5})}).change()});var ob=function(ia){var aa=ia.pageX-ab.offset.left-parseInt(ab.parent.css("border-left-width"));if(aa>145)aa=145;if(aa<=0)aa=0;var ka=aa-5;aa/=145;switch(ab.type){case "radius":aa=Math.pow(aa*2,2.5);if(aa>0.98&&aa<1.02)aa=1;if(aa<=0.01)aa=0.01;ea.setAttribute("r",aa);break;case "opacity":u.paint.alpha=parseInt(aa*100);Aa.setAttribute("fill-opacity",aa);break;
case "ellip":Ka=$a=1;if(aa<0.5){aa/=0.5;$a=aa<=0?0.01:aa}else if(aa>0.5){aa/=0.5;aa=2-aa;Ka=aa<=0?0.01:aa}c();aa-=1;if(Ka===aa+1)aa=Math.abs(aa);break;case "angle":aa-=0.5;Sa=aa*=180;c();aa/=100}ab.elem.css({"margin-left":ka});aa=Math.round(aa*100);ab.input.val(aa);ia.preventDefault()},pb=function(){Q.unbind("mousemove",ob).unbind("mouseup",pb);ab=null};for(N=(u.paint.alpha*255/100).toString(16);N.length<2;)N="0"+N;N=N.split(".")[0];I=u.paint.solidColor=="none"?"":u.paint.solidColor+N;pa||(I=va[0].getAttribute("stop-color")); case "ellip":Ka=$a=1;if(aa<0.5){aa/=0.5;$a=aa<=0?0.01:aa}else if(aa>0.5){aa/=0.5;aa=2-aa;Ka=aa<=0?0.01:aa}c();aa-=1;if(Ka===aa+1)aa=Math.abs(aa);break;case "angle":aa-=0.5;Sa=aa*=180;c();aa/=100}ab.elem.css({"margin-left":ka});aa=Math.round(aa*100);ab.input.val(aa);ia.preventDefault()},pb=function(){S.unbind("mousemove",ob).unbind("mouseup",pb);ab=null};for(N=(u.paint.alpha*255/100).toString(16);N.length<2;)N="0"+N;N=N.split(".")[0];H=u.paint.solidColor=="none"?"":u.paint.solidColor+N;pa||(H=va[0].getAttribute("stop-color"));
$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});S.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:I,alphaSupport:true}},function(ia){u.paint.type="solidColor";u.paint.alpha=ia.val("ahex")?Math.round(ia.val("a")/255*100):100;u.paint.solidColor=ia.val("hex")?ia.val("hex"):"none";u.paint.radialGradient=null;R()},null,function(){K()});var fb=$(L+" .jGraduate_tabs li");fb.on("click touchstart",function(){fb.removeClass("jGraduate_tab_current"); $.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});R.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:H,alphaSupport:true}},function(ia){u.paint.type="solidColor";u.paint.alpha=ia.val("ahex")?Math.round(ia.val("a")/255*100):100;u.paint.solidColor=ia.val("hex")?ia.val("hex"):"none";u.paint.radialGradient=null;Q()},null,function(){K()});var fb=$(L+" .jGraduate_tabs li");fb.on("click touchstart",function(){fb.removeClass("jGraduate_tab_current");
$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ia=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ia==="rg"||ia==="lg"){$(".jGraduate_"+ia+"_field").show();$(".jGraduate_"+(ia==="lg"?"rg":"lg")+"_field").hide();$("#"+s+"_jgraduate_rect")[0].setAttribute("fill","url(#"+s+"_"+ia+"_jgraduate_grad)");U=ia==="lg"?"linearGradient":"radialGradient";$("#"+s+"_jGraduate_OpacInput").val(u.paint.alpha).change();var aa=$("#"+s+"_"+ia+"_jgraduate_grad")[0];if(ea!==aa){var ka= $(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ia=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ia==="rg"||ia==="lg"){$(".jGraduate_"+ia+"_field").show();$(".jGraduate_"+(ia==="lg"?"rg":"lg")+"_field").hide();$("#"+s+"_jgraduate_rect")[0].setAttribute("fill","url(#"+s+"_"+ia+"_jgraduate_grad)");U=ia==="lg"?"linearGradient":"radialGradient";$("#"+s+"_jGraduate_OpacInput").val(u.paint.alpha).change();var aa=$("#"+s+"_"+ia+"_jgraduate_grad")[0];if(ea!==aa){var ka=
$(ea).find("stop");$(aa).empty().append(ka);ea=aa;aa=lb.val();ea.setAttribute("spreadMethod",aa)}eb=ia==="rg"&&ea.getAttribute("fx")!=null&&!(ya==Ha&&Ja==Ga);$("#"+s+"_jGraduate_focusCoord").toggle(eb);if(eb)$("#"+s+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();fb.removeClass("jGraduate_tab_current");var tb;switch(u.paint.type){case "linearGradient":tb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":tb= $(ea).find("stop");$(aa).empty().append(ka);ea=aa;aa=lb.val();ea.setAttribute("spreadMethod",aa)}eb=ia==="rg"&&ea.getAttribute("fx")!=null&&!(ya==Ha&&Ja==Ga);$("#"+s+"_jGraduate_focusCoord").toggle(eb);if(eb)$("#"+s+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();fb.removeClass("jGraduate_tab_current");var tb;switch(u.paint.type){case "linearGradient":tb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":tb=
$(L+" .jGraduate_tab_radgrad");break;default:tb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){tb.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(g,b){if(g.menu==undefined)return false;if(g.inSpeed==undefined)g.inSpeed=150;if(g.outSpeed==undefined)g.outSpeed=75;if(g.inSpeed==0)g.inSpeed=-1;if(g.outSpeed==0)g.outSpeed=-1;$(this).each(function(){var p=$(this),v=$(p).offset(),d=$("#"+g.menu);d.addClass("contextMenu");$(this).bind("mousedown",function(c){$(this).on("mouseup",function(m){var u=$(this);u.unbind("mouseup");$(".contextMenu").hide();if(c.button===2|| $(L+" .jGraduate_tab_radgrad");break;default:tb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){tb.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(g,b){if(g.menu==undefined)return false;if(g.inSpeed==undefined)g.inSpeed=150;if(g.outSpeed==undefined)g.outSpeed=75;if(g.inSpeed==0)g.inSpeed=-1;if(g.outSpeed==0)g.outSpeed=-1;$(this).each(function(){var p=$(this),v=$(p).offset(),d=$("#"+g.menu);d.addClass("contextMenu");$(this).bind("mousedown",function(c){$(this).on("mouseup",function(m){var u=$(this);u.unbind("mouseup");$(".contextMenu").hide();if(c.button===2||
@ -61,16 +61,16 @@ $(u),{x:C-v.left,y:s-v.top,docX:C,docY:s});return false});setTimeout(function(){
function(){return false})});return $(this)},disableContextMenuItems:function(g){if(g==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var b=g.split(","),p=0;p<b.length;p++)$(this).find('A[href="'+b[p]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(g){if(g==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var b=g.split(","),p= function(){return false})});return $(this)},disableContextMenuItems:function(g){if(g==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var b=g.split(","),p=0;p<b.length;p++)$(this).find('A[href="'+b[p]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(g){if(g==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var b=g.split(","),p=
0;p<b.length;p++)$(this).find('A[href="'+b[p]+'"]').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;p<b.length;p++)$(this).find('A[href="'+b[p]+'"]').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,g=document.createElementNS("http://www.w3.org/2000/svg","svg"),b=!!window.opera,p=q.indexOf("AppleWebKit")>=0,v=q.indexOf("Gecko/")>=0,d=q.indexOf("MSIE")>=0,f=q.indexOf("Chrome/")>=0,c=q.indexOf("Windows")>=0,m=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,g=document.createElementNS("http://www.w3.org/2000/svg","svg"),b=!!window.opera,p=q.indexOf("AppleWebKit")>=0,v=q.indexOf("Gecko/")>=0,d=q.indexOf("MSIE")>=0,f=q.indexOf("Chrome/")>=0,c=q.indexOf("Windows")>=0,m=q.indexOf("Macintosh")>=
0,u="ontouchstart"in window,C=!!g.querySelector,s=!!document.evaluate,L=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var X=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{X.replaceItem(na,0);return true}catch(U){}return false}(),R=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var X=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{X.insertItemBefore(na, 0,u="ontouchstart"in window,C=!!g.querySelector,s=!!document.evaluate,L=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","path");oa.setAttribute("d","M0,0 10,10");var X=oa.pathSegList;oa=oa.createSVGPathSegLinetoAbs(5,5);try{X.replaceItem(oa,0);return true}catch(U){}return false}(),Q=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","path");oa.setAttribute("d","M0,0 10,10");var X=oa.pathSegList;oa=oa.createSVGPathSegLinetoAbs(5,5);try{X.insertItemBefore(oa,
0);return true}catch(U){}return false}(),K=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg"),X=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);X.setAttribute("x",5);na.appendChild(X);var U=document.createElementNS("http://www.w3.org/2000/svg","text");U.textContent="a";X.appendChild(U);X=U.getStartPositionOfChar(0);X=X.x;document.documentElement.removeChild(na);return X===0}(),I=function(){var na=document.createElementNS("http://www.w3.org/2000/svg", 0);return true}catch(U){}return false}(),K=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","svg"),X=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(oa);X.setAttribute("x",5);oa.appendChild(X);var U=document.createElementNS("http://www.w3.org/2000/svg","text");U.textContent="a";X.appendChild(U);X=U.getStartPositionOfChar(0);X=X.x;document.documentElement.removeChild(oa);return X===0}(),H=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg",
"svg");document.documentElement.appendChild(na);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 C0,0 10,10 10,0");na.appendChild(X);X=X.getBBox();document.documentElement.removeChild(na);return X.height>4&&X.height<5}(),Q=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 10,0");var U=document.createElementNS("http://www.w3.org/2000/svg", "svg");document.documentElement.appendChild(oa);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 C0,0 10,10 10,0");oa.appendChild(X);X=X.getBBox();document.documentElement.removeChild(oa);return X.height>4&&X.height<5}(),S=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(oa);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 10,0");var U=document.createElementNS("http://www.w3.org/2000/svg",
"path");U.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(X);ea.appendChild(U);na.appendChild(ea);X=ea.getBBox();document.documentElement.removeChild(na);return X.width==15}(),S=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."); "path");U.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(X);ea.appendChild(U);oa.appendChild(ea);X=ea.getBBox();document.documentElement.removeChild(oa);return X.width==15}(),R=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect");oa.setAttribute("x",0.1);(oa=oa.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 na}(),N=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"}(),ga=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,X=g.createSVGTransform();na.appendItem(X);return na.getItem(0)==X}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return p};svgedit.browser.isGecko=function(){return v}; return oa}(),N=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect");oa.setAttribute("style","vector-effect:non-scaling-stroke");return oa.style.vectorEffect==="non-scaling-stroke"}(),ga=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,X=g.createSVGTransform();oa.appendItem(X);return oa.getItem(0)==X}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return p};svgedit.browser.isGecko=function(){return v};
svgedit.browser.isIE=function(){return d};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return c};svgedit.browser.isMac=function(){return m};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return C};svgedit.browser.supportsXpath=function(){return s};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return R};svgedit.browser.supportsPathBBox=function(){return I}; svgedit.browser.isIE=function(){return d};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return c};svgedit.browser.isMac=function(){return m};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return C};svgedit.browser.supportsXpath=function(){return s};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return Q};svgedit.browser.supportsPathBBox=function(){return H};
svgedit.browser.supportsHVLineContainerBBox=function(){return Q};svgedit.browser.supportsGoodTextCharPos=function(){return K};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return S};svgedit.browser.supportsNonScalingStroke=function(){return N};svgedit.browser.supportsNativeTransformLists=function(){return ga}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; svgedit.browser.supportsHVLineContainerBBox=function(){return S};svgedit.browser.supportsGoodTextCharPos=function(){return K};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return R};svgedit.browser.supportsNonScalingStroke=function(){return N};svgedit.browser.supportsNativeTransformLists=function(){return ga}}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(g){this._elem=g||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var p=0;p<this.numberOfItems;++p){var v=this._list.getItem(p);b=b;v=v;var d=v.matrix,f="";switch(v.type){case 1:f="matrix("+[d.a,d.b,d.c,d.d,d.e,d.f].join(",")+")";break;case 2:f="translate("+d.e+","+d.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(g){this._elem=g||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var p=0;p<this.numberOfItems;++p){var v=this._list.getItem(p);b=b;v=v;var d=v.matrix,f="";switch(v.type){case 1:f="matrix("+[d.a,d.b,d.c,d.d,d.e,d.f].join(",")+")";break;case 2:f="translate("+d.e+","+d.f+")";break;case 3:f=
d.a==d.d?"scale("+d.a+")":"scale("+d.a+","+d.d+")";break;case 4:var c=0;f=0;if(v.angle!=0){c=1-d.a;f=(c*d.f+d.b*d.e)/(c*c+d.b*d.b);c=(d.e-d.b*f)/c}f="rotate("+v.angle+" "+c+","+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 p=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,v=true;v;){v=b.match(p);b=b.replace(p,"");if(v&&v[1]){var d=v[1].split(/\s*\(/),f=d[0];d=d[1].match(/\s*(.*?)\s*\)/); d.a==d.d?"scale("+d.a+")":"scale("+d.a+","+d.d+")";break;case 4:var c=0;f=0;if(v.angle!=0){c=1-d.a;f=(c*d.f+d.b*d.e)/(c*c+d.b*d.b);c=(d.e-d.b*f)/c}f="rotate("+v.angle+" "+c+","+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 p=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,v=true;v;){v=b.match(p);b=b.replace(p,"");if(v&&v[1]){var d=v[1].split(/\s*\(/),f=d[0];d=d[1].match(/\s*(.*?)\s*\)/);
d[1]=d[1].replace(/(\d)-/g,"$1 -");var c=d[1].split(/[, ]+/),m="abcdef".split(""),u=a.createSVGMatrix();$.each(c,function(L,R){c[L]=parseFloat(R);if(f=="matrix")u[m[L]]=c[L]});d=a.createSVGTransform();var C="set"+f.charAt(0).toUpperCase()+f.slice(1),s=f=="matrix"?[u]:c;if(f=="scale"&&s.length==1)s.push(s[0]);else if(f=="translate"&&s.length==1)s.push(0);else if(f=="rotate"&&s.length==1){s.push(0);s.push(0)}d[C].apply(d,s);this._list.appendItem(d)}}};this._removeFromOtherLists=function(b){if(b){var p= d[1]=d[1].replace(/(\d)-/g,"$1 -");var c=d[1].split(/[, ]+/),m="abcdef".split(""),u=a.createSVGMatrix();$.each(c,function(L,Q){c[L]=parseFloat(Q);if(f=="matrix")u[m[L]]=c[L]});d=a.createSVGTransform();var C="set"+f.charAt(0).toUpperCase()+f.slice(1),s=f=="matrix"?[u]:c;if(f=="scale"&&s.length==1)s.push(s[0]);else if(f=="translate"&&s.length==1)s.push(0);else if(f=="rotate"&&s.length==1){s.push(0);s.push(0)}d[C].apply(d,s);this._list.appendItem(d)}}};this._removeFromOtherLists=function(b){if(b){var p=
false,v;for(v in q){for(var d=q[v],f=0,c=d._xforms.length;f<c;++f)if(d._xforms[f]==b){p=true;d.removeItem(f);break}if(p)break}}};this.numberOfItems=0;this.clear=function(){this.numberOfItems=0;this._xforms=[]};this.initialize=function(b){this.numberOfItems=1;this._removeFromOtherLists(b);this._xforms=[b]};this.getItem=function(b){if(b<this.numberOfItems&&b>=0)return this._xforms[b];throw{code:1};};this.insertItemBefore=function(b,p){var v=null;if(p>=0)if(p<this.numberOfItems){this._removeFromOtherLists(b); false,v;for(v in q){for(var d=q[v],f=0,c=d._xforms.length;f<c;++f)if(d._xforms[f]==b){p=true;d.removeItem(f);break}if(p)break}}};this.numberOfItems=0;this.clear=function(){this.numberOfItems=0;this._xforms=[]};this.initialize=function(b){this.numberOfItems=1;this._removeFromOtherLists(b);this._xforms=[b]};this.getItem=function(b){if(b<this.numberOfItems&&b>=0)return this._xforms[b];throw{code:1};};this.insertItemBefore=function(b,p){var v=null;if(p>=0)if(p<this.numberOfItems){this._removeFromOtherLists(b);
v=Array(this.numberOfItems+1);for(var d=0;d<p;++d)v[d]=this._xforms[d];v[d]=b;for(var f=d+1;d<this.numberOfItems;++f,++d)v[f]=this._xforms[d];this.numberOfItems++;this._xforms=v;v=b;this._list._update()}else v=this._list.appendItem(b);return v};this.replaceItem=function(b,p){var v=null;if(p<this.numberOfItems&&p>=0){this._removeFromOtherLists(b);v=this._xforms[p]=b;this._list._update()}return v};this.removeItem=function(b){if(b<this.numberOfItems&&b>=0){for(var p=this._xforms[b],v=Array(this.numberOfItems- v=Array(this.numberOfItems+1);for(var d=0;d<p;++d)v[d]=this._xforms[d];v[d]=b;for(var f=d+1;d<this.numberOfItems;++f,++d)v[f]=this._xforms[d];this.numberOfItems++;this._xforms=v;v=b;this._list._update()}else v=this._list.appendItem(b);return v};this.replaceItem=function(b,p){var v=null;if(p<this.numberOfItems&&p>=0){this._removeFromOtherLists(b);v=this._xforms[p]=b;this._list._update()}return v};this.removeItem=function(b){if(b<this.numberOfItems&&b>=0){for(var p=this._xforms[b],v=Array(this.numberOfItems-
1),d=0;d<b;++d)v[d]=this._xforms[d];for(b=d;b<this.numberOfItems-1;++b,++d)v[b]=this._xforms[d+1];this.numberOfItems--;this._xforms=v;this._list._update();return p}else throw{code:1};};this.appendItem=function(b){this._removeFromOtherLists(b);this._xforms.push(b);this.numberOfItems++;this._list._update();return b}};svgedit.transformlist.resetListMap=function(){q={}};svgedit.transformlist.removeElementFromListMap=function(g){g.id&&q[g.id]&&delete q[g.id]};svgedit.transformlist.getTransformList=function(g){if(svgedit.browser.supportsNativeTransformLists())if(g.transform)return g.transform.baseVal; 1),d=0;d<b;++d)v[d]=this._xforms[d];for(b=d;b<this.numberOfItems-1;++b,++d)v[b]=this._xforms[d+1];this.numberOfItems--;this._xforms=v;this._list._update();return p}else throw{code:1};};this.appendItem=function(b){this._removeFromOtherLists(b);this._xforms.push(b);this.numberOfItems++;this._list._update();return b}};svgedit.transformlist.resetListMap=function(){q={}};svgedit.transformlist.removeElementFromListMap=function(g){g.id&&q[g.id]&&delete q[g.id]};svgedit.transformlist.getTransformList=function(g){if(svgedit.browser.supportsNativeTransformLists())if(g.transform)return g.transform.baseVal;
@ -87,14 +87,14 @@ function(d,f){if(!isNaN(f))return f-0;if(f.substr(-1)==="%"){var c=f.substr(0,f.
d=u==null||u===c}catch(C){}return d}else m=true;return m}})();svgedit=svgedit||{}; d=u==null||u===c}catch(C){}return d}else m=true;return m}})();svgedit=svgedit||{};
(function(){function a(d){if(svgedit.browser.supportsHVLineContainerBBox())try{return d.getBBox()}catch(f){}var c=$.data(d,"ref"),m=null;if(c){var u=$(c).children().clone().attr("visibility","hidden");$(v).append(u);m=u.filter("line, path")}else m=$(d).find("line, path");var C=false;if(m.length){m.each(function(){var s=this.getBBox();if(!s.width||!s.height)C=true});if(C){d=c?u:$(d).children();ret=getStrokedBBox(d)}else ret=d.getBBox()}else ret=d.getBBox();c&&u.remove();return ret}if(!svgedit.utilities)svgedit.utilities= (function(){function a(d){if(svgedit.browser.supportsHVLineContainerBBox())try{return d.getBBox()}catch(f){}var c=$.data(d,"ref"),m=null;if(c){var u=$(c).children().clone().attr("visibility","hidden");$(v).append(u);m=u.filter("line, path")}else m=$(d).find("line, path");var C=false;if(m.length){m.each(function(){var s=this.getBBox();if(!s.width||!s.height)C=true});if(C){d=c?u:$(d).children();ret=getStrokedBBox(d)}else ret=d.getBBox()}else ret=d.getBBox();c&&u.remove();return ret}if(!svgedit.utilities)svgedit.utilities=
{};var q="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),g=null,b=null,p=null,v=null;svgedit.utilities.init=function(d){g=d;b=d.getDOMDocument();p=d.getDOMContainer();v=d.getSVGRoot()};svgedit.utilities.toXml=function(d){return $("<p/>").text(d).html()};svgedit.utilities.fromXml=function(d){return $("<p/>").html(d).text()};svgedit.utilities.encode64=function(d){d=svgedit.utilities.convertToXMLReferences(d);if(window.btoa)return window.btoa(d); {};var q="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),g=null,b=null,p=null,v=null;svgedit.utilities.init=function(d){g=d;b=d.getDOMDocument();p=d.getDOMContainer();v=d.getSVGRoot()};svgedit.utilities.toXml=function(d){return $("<p/>").text(d).html()};svgedit.utilities.fromXml=function(d){return $("<p/>").html(d).text()};svgedit.utilities.encode64=function(d){d=svgedit.utilities.convertToXMLReferences(d);if(window.btoa)return window.btoa(d);
var f=Array(Math.floor((d.length+2)/3)*4),c,m,u,C,s,L,R=0,K=0;do{c=d.charCodeAt(R++);m=d.charCodeAt(R++);u=d.charCodeAt(R++);C=c>>2;c=(c&3)<<4|m>>4;s=(m&15)<<2|u>>6;L=u&63;if(isNaN(m))s=L=64;else if(isNaN(u))L=64;f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(C);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(s);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(R< var f=Array(Math.floor((d.length+2)/3)*4),c,m,u,C,s,L,Q=0,K=0;do{c=d.charCodeAt(Q++);m=d.charCodeAt(Q++);u=d.charCodeAt(Q++);C=c>>2;c=(c&3)<<4|m>>4;s=(m&15)<<2|u>>6;L=u&63;if(isNaN(m))s=L=64;else if(isNaN(u))L=64;f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(C);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(s);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(Q<
d.length);return f.join("")};svgedit.utilities.decode64=function(d){if(window.atob)return window.atob(d);var f="",c,m,u="",C,s="",L=0;d=d.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++)); d.length);return f.join("")};svgedit.utilities.decode64=function(d){if(window.atob)return window.atob(d);var f="",c,m,u="",C,s="",L=0;d=d.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));
c=c<<2|m>>4;m=(m&15)<<4|C>>2;u=(C&3)<<6|s;f+=String.fromCharCode(c);if(C!=64)f+=String.fromCharCode(m);if(s!=64)f+=String.fromCharCode(u)}while(L<d.length);return unescape(f)};svgedit.utilities.convertToXMLReferences=function(d){for(var f="",c=0;c<d.length;c++){var m=d.charCodeAt(c);if(m<128)f+=d[c];else if(m>127)f+="&#"+m+";"}return f};svgedit.utilities.text2xml=function(d){if(d.indexOf("<svg:svg")>=0)d=d.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var f;try{var c=window.DOMParser? c=c<<2|m>>4;m=(m&15)<<4|C>>2;u=(C&3)<<6|s;f+=String.fromCharCode(c);if(C!=64)f+=String.fromCharCode(m);if(s!=64)f+=String.fromCharCode(u)}while(L<d.length);return unescape(f)};svgedit.utilities.convertToXMLReferences=function(d){for(var f="",c=0;c<d.length;c++){var m=d.charCodeAt(c);if(m<128)f+=d[c];else if(m>127)f+="&#"+m+";"}return f};svgedit.utilities.text2xml=function(d){if(d.indexOf("<svg:svg")>=0)d=d.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var f;try{var c=window.DOMParser?
new DOMParser:new ActiveXObject("Microsoft.XMLDOM");c.async=false}catch(m){throw Error("XML Parser could not be instantiated");}try{f=c.loadXML?c.loadXML(d)?c:false:c.parseFromString(d,"text/xml")}catch(u){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(d){return{x:d.x,y:d.y,width:d.width,height:d.height}};svgedit.utilities.walkTree=function(d,f){if(d&&d.nodeType==1){f(d);for(var c=d.childNodes.length;c--;)svgedit.utilities.walkTree(d.childNodes.item(c),f)}}; new DOMParser:new ActiveXObject("Microsoft.XMLDOM");c.async=false}catch(m){throw Error("XML Parser could not be instantiated");}try{f=c.loadXML?c.loadXML(d)?c:false:c.parseFromString(d,"text/xml")}catch(u){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(d){return{x:d.x,y:d.y,width:d.width,height:d.height}};svgedit.utilities.walkTree=function(d,f){if(d&&d.nodeType==1){f(d);for(var c=d.childNodes.length;c--;)svgedit.utilities.walkTree(d.childNodes.item(c),f)}};
svgedit.utilities.walkTreePost=function(d,f){if(d&&d.nodeType==1){for(var c=d.childNodes.length;c--;)svgedit.utilities.walkTree(d.childNodes.item(c),f);f(d)}};svgedit.utilities.getUrlFromAttr=function(d){if(d)if(d.indexOf('url("')===0)return d.substring(5,d.indexOf('"',6));else if(d.indexOf("url('")===0)return d.substring(5,d.indexOf("'",6));else if(d.indexOf("url(")===0)return d.substring(4,d.indexOf(")"));return null};svgedit.utilities.getHref=function(d){return d.getAttributeNS("http://www.w3.org/1999/xlink", svgedit.utilities.walkTreePost=function(d,f){if(d&&d.nodeType==1){for(var c=d.childNodes.length;c--;)svgedit.utilities.walkTree(d.childNodes.item(c),f);f(d)}};svgedit.utilities.getUrlFromAttr=function(d){if(d)if(d.indexOf('url("')===0)return d.substring(5,d.indexOf('"',6));else if(d.indexOf("url('")===0)return d.substring(5,d.indexOf("'",6));else if(d.indexOf("url(")===0)return d.substring(4,d.indexOf(")"));return null};svgedit.utilities.getHref=function(d){return d.getAttributeNS("http://www.w3.org/1999/xlink",
"href")};svgedit.utilities.setHref=function(d,f){d.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(d){d=g.getSVGContent().documentElement;var f=d.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:d.insertBefore(d.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),d.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(d){var f=d.pathSegList,c=f.numberOfItems;d=[[],[]];var m=f.getItem(0), "href")};svgedit.utilities.setHref=function(d,f){d.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(d){d=g.getSVGContent().documentElement;var f=d.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:d.insertBefore(d.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),d.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(d){var f=d.pathSegList,c=f.numberOfItems;d=[[],[]];var m=f.getItem(0),
u=[m.x,m.y];for(m=0;m<c;m++){var C=f.getItem(m);if(typeof C.x!="undefined"){d[0].push(u[0]);d[1].push(u[1]);if(C.x1){for(var s=[C.x1,C.y1],L=[C.x2,C.y2],R=[C.x,C.y],K=0;K<2;K++){C=function(ga){return Math.pow(1-ga,3)*u[K]+3*Math.pow(1-ga,2)*ga*s[K]+3*(1-ga)*Math.pow(ga,2)*L[K]+Math.pow(ga,3)*R[K]};var I=6*u[K]-12*s[K]+6*L[K],Q=-3*u[K]+9*s[K]-9*L[K]+3*R[K],S=3*s[K]-3*u[K];if(Q==0){if(I!=0){I=-S/I;0<I&&I<1&&d[K].push(C(I))}}else{S=Math.pow(I,2)-4*S*Q;if(!(S<0)){var N=(-I+Math.sqrt(S))/(2*Q);0<N&&N< u=[m.x,m.y];for(m=0;m<c;m++){var C=f.getItem(m);if(typeof C.x!="undefined"){d[0].push(u[0]);d[1].push(u[1]);if(C.x1){for(var s=[C.x1,C.y1],L=[C.x2,C.y2],Q=[C.x,C.y],K=0;K<2;K++){C=function(ga){return Math.pow(1-ga,3)*u[K]+3*Math.pow(1-ga,2)*ga*s[K]+3*(1-ga)*Math.pow(ga,2)*L[K]+Math.pow(ga,3)*Q[K]};var H=6*u[K]-12*s[K]+6*L[K],S=-3*u[K]+9*s[K]-9*L[K]+3*Q[K],R=3*s[K]-3*u[K];if(S==0){if(H!=0){H=-R/H;0<H&&H<1&&d[K].push(C(H))}}else{R=Math.pow(H,2)-4*R*S;if(!(R<0)){var N=(-H+Math.sqrt(R))/(2*S);0<N&&N<
1&&d[K].push(C(N));I=(-I-Math.sqrt(S))/(2*Q);0<I&&I<1&&d[K].push(C(I))}}}u=R}else{d[0].push(C.x);d[1].push(C.y)}}}f=Math.min.apply(null,d[0]);c=Math.max.apply(null,d[0])-f;m=Math.min.apply(null,d[1]);d=Math.max.apply(null,d[1])-m;return{x:f,y:m,width:c,height:d}};svgedit.utilities.getBBox=function(d){var f=d||g.getSelectedElements()[0];if(d.nodeType!=1)return null;d=null;var c=f.nodeName;switch(c){case "text":if(f.textContent===""){f.textContent="a";d=f.getBBox();f.textContent=""}else try{d=f.getBBox()}catch(m){}break; 1&&d[K].push(C(N));H=(-H-Math.sqrt(R))/(2*S);0<H&&H<1&&d[K].push(C(H))}}}u=Q}else{d[0].push(C.x);d[1].push(C.y)}}}f=Math.min.apply(null,d[0]);c=Math.max.apply(null,d[0])-f;m=Math.min.apply(null,d[1]);d=Math.max.apply(null,d[1])-m;return{x:f,y:m,width:c,height:d}};svgedit.utilities.getBBox=function(d){var f=d||g.getSelectedElements()[0];if(d.nodeType!=1)return null;d=null;var c=f.nodeName;switch(c){case "text":if(f.textContent===""){f.textContent="a";d=f.getBBox();f.textContent=""}else try{d=f.getBBox()}catch(m){}break;
case "path":if(svgedit.browser.supportsPathBBox())try{d=f.getBBox()}catch(u){}else d=svgedit.utilities.getPathBBox(f);break;case "g":case "a":d=a(f);break;default:if(c==="use")d=a(f,true);if(c==="use"){d||(d=f.getBBox());if(!svgedit.browser.isWebkit()){c={};c.width=d.width;c.height=d.height;c.x=d.x+parseFloat(f.getAttribute("x")||0);c.y=d.y+parseFloat(f.getAttribute("y")||0);d=c}}else if(~q.indexOf(c))try{d=f.getBBox()}catch(C){f=$(f).closest("foreignObject");if(f.length)try{d=f[0].getBBox()}catch(s){d= case "path":if(svgedit.browser.supportsPathBBox())try{d=f.getBBox()}catch(u){}else d=svgedit.utilities.getPathBBox(f);break;case "g":case "a":d=a(f);break;default:if(c==="use")d=a(f,true);if(c==="use"){d||(d=f.getBBox());if(!svgedit.browser.isWebkit()){c={};c.width=d.width;c.height=d.height;c.x=d.x+parseFloat(f.getAttribute("x")||0);c.y=d.y+parseFloat(f.getAttribute("y")||0);d=c}}else if(~q.indexOf(c))try{d=f.getBBox()}catch(C){f=$(f).closest("foreignObject");if(f.length)try{d=f[0].getBBox()}catch(s){d=
null}else d=null}}if(d)d=svgedit.utilities.bboxToObj(d);return d};svgedit.utilities.getRotationAngle=function(d,f){var c=d||g.getSelectedElements()[0];c=svgedit.transformlist.getTransformList(c);if(!c)return 0;for(var m=c.numberOfItems,u=0;u<m;++u){var C=c.getItem(u);if(C.type==4)return f?C.angle*Math.PI/180:C.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(d){return v.querySelector("#"+d)}:svgedit.browser.supportsXpath()?function(d){return b.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+ null}else d=null}}if(d)d=svgedit.utilities.bboxToObj(d);return d};svgedit.utilities.getRotationAngle=function(d,f){var c=d||g.getSelectedElements()[0];c=svgedit.transformlist.getTransformList(c);if(!c)return 0;for(var m=c.numberOfItems,u=0;u<m;++u){var C=c.getItem(u);if(C.type==4)return f?C.angle*Math.PI/180:C.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(d){return v.querySelector("#"+d)}:svgedit.browser.supportsXpath()?function(d){return b.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+
d+'"]',p,function(){return"http://www.w3.org/2000/svg"},9,null).singleNodeValue}:function(d){return $(v).find("[id="+d+"]")[0]};svgedit.utilities.assignAttributes=function(d,f,c,m){c||(c=0);svgedit.browser.isOpera()||v.suspendRedraw(c);for(var u in f)if(c=u.substr(0,4)==="xml:"?"http://www.w3.org/XML/1998/namespace":u.substr(0,6)==="xlink:"?"http://www.w3.org/1999/xlink":null)d.setAttributeNS(c,u,f[u]);else m?svgedit.units.setUnitAttr(d,u,f[u]):d.setAttribute(u,f[u]);svgedit.browser.isOpera()||v.unsuspendRedraw(null)}; d+'"]',p,function(){return"http://www.w3.org/2000/svg"},9,null).singleNodeValue}:function(d){return $(v).find("[id="+d+"]")[0]};svgedit.utilities.assignAttributes=function(d,f,c,m){c||(c=0);svgedit.browser.isOpera()||v.suspendRedraw(c);for(var u in f)if(c=u.substr(0,4)==="xml:"?"http://www.w3.org/XML/1998/namespace":u.substr(0,6)==="xlink:"?"http://www.w3.org/1999/xlink":null)d.setAttributeNS(c,u,f[u]);else m?svgedit.units.setUnitAttr(d,u,f[u]):d.setAttribute(u,f[u]);svgedit.browser.isOpera()||v.unsuspendRedraw(null)};
@ -116,8 +116,8 @@ svgedit.utilities.cleanupElement=function(d){var f=v.suspendRedraw(60),c={"fill-
mprescripts:[],mroot:[],mrow:["xlink:href","xlink:type","xmlns:xlink"],mspace:["depth","height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[], mprescripts:[],mroot:[],mrow:["xlink:href","xlink:type","xmlns:xlink"],mspace:["depth","height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[],
semantics:[]},b={};$.each(g,function(p,v){var d={};$.each(v,function(f,c){if(c.indexOf(":")>=0){var m=c.split(":");d[m[1]]=q[m[0]]}else d[c]=c=="xmlns"?"http://www.w3.org/2000/xmlns/":null});b[p]=d});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(p){if(p.nodeType==3){p.nodeValue=p.nodeValue.replace(/^\s+|\s+$/g,"");p.nodeValue.length||p.parentNode.removeChild(p)}if(p.nodeType==1){var v=p.parentNode;if(p.ownerDocument&&v){var d=g[p.nodeName],f=b[p.nodeName];if(d!= semantics:[]},b={};$.each(g,function(p,v){var d={};$.each(v,function(f,c){if(c.indexOf(":")>=0){var m=c.split(":");d[m[1]]=q[m[0]]}else d[c]=c=="xmlns"?"http://www.w3.org/2000/xmlns/":null});b[p]=d});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(p){if(p.nodeType==3){p.nodeValue=p.nodeValue.replace(/^\s+|\s+$/g,"");p.nodeValue.length||p.parentNode.removeChild(p)}if(p.nodeType==1){var v=p.parentNode;if(p.ownerDocument&&v){var d=g[p.nodeName],f=b[p.nodeName];if(d!=
undefined){for(var c=[],m=p.attributes.length;m--;){var u=p.attributes.item(m),C=u.nodeName,s=u.localName,L=u.namespaceURI;if(!(f.hasOwnProperty(s)&&L==f[s]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){C.indexOf("se:")==0&&c.push([C,u.nodeValue]);p.removeAttributeNS(L,s)}if(svgedit.browser.isGecko())switch(C){case "transform":case "gradientTransform":case "patternTransform":s=u.nodeValue.replace(/(\d)-/g,"$1 -");p.setAttribute(C,s)}if(C=="style"){u= undefined){for(var c=[],m=p.attributes.length;m--;){var u=p.attributes.item(m),C=u.nodeName,s=u.localName,L=u.namespaceURI;if(!(f.hasOwnProperty(s)&&L==f[s]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){C.indexOf("se:")==0&&c.push([C,u.nodeValue]);p.removeAttributeNS(L,s)}if(svgedit.browser.isGecko())switch(C){case "transform":case "gradientTransform":case "patternTransform":s=u.nodeValue.replace(/(\d)-/g,"$1 -");p.setAttribute(C,s)}if(C=="style"){u=
u.nodeValue.split(";");for(C=u.length;C--;){s=u[C].split(":");d.indexOf(s[0])>=0&&p.setAttribute(s[0],s[1])}p.removeAttribute("style")}}$.each(c,function(R,K){p.setAttributeNS("http://svg-edit.googlecode.com",K[0],K[1])});if((m=svgedit.utilities.getHref(p))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(p.nodeName)>=0)if(m[0]!="#"){svgedit.utilities.setHref(p,"");p.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(p.nodeName=="use"&&!svgedit.utilities.getHref(p))v.removeChild(p); u.nodeValue.split(";");for(C=u.length;C--;){s=u[C].split(":");d.indexOf(s[0])>=0&&p.setAttribute(s[0],s[1])}p.removeAttribute("style")}}$.each(c,function(Q,K){p.setAttributeNS("http://svg-edit.googlecode.com",K[0],K[1])});if((m=svgedit.utilities.getHref(p))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(p.nodeName)>=0)if(m[0]!="#"){svgedit.utilities.setHref(p,"");p.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(p.nodeName=="use"&&!svgedit.utilities.getHref(p))v.removeChild(p);
else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(R,K){var I=p.getAttribute(K);if(I)if((I=svgedit.utilities.getUrlFromAttr(I))&&I[0]!=="#"){p.setAttribute(K,"");p.removeAttribute(K)}});for(m=p.childNodes.length;m--;)svgedit.sanitize.sanitizeSvg(p.childNodes.item(m))}}else{for(d=[];p.hasChildNodes();)d.push(v.insertBefore(p.firstChild,p));v.removeChild(p);for(m=d.length;m--;)svgedit.sanitize.sanitizeSvg(d[m])}}}}})();svgedit=svgedit||{}; else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(Q,K){var H=p.getAttribute(K);if(H)if((H=svgedit.utilities.getUrlFromAttr(H))&&H[0]!=="#"){p.setAttribute(K,"");p.removeAttribute(K)}});for(m=p.childNodes.length;m--;)svgedit.sanitize.sanitizeSvg(p.childNodes.item(m))}}else{for(d=[];p.hasChildNodes();)d.push(v.insertBefore(p.firstChild,p));v.removeChild(p);for(m=d.length;m--;)svgedit.sanitize.sanitizeSvg(d[m])}}}}})();svgedit=svgedit||{};
(function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,q,g,b){this.elem=a;this.text=b?"Move "+a.tagName+" to "+b:"Move "+a.tagName;this.oldNextSibling=q;this.oldParent=g;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type= (function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,q,g,b){this.elem=a;this.text=b?"Move "+a.tagName+" to "+b:"Move "+a.tagName;this.oldNextSibling=q;this.oldParent=g;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type=
svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,
this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,q){this.elem=a;this.text=q||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type= this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,q){this.elem=a;this.text=q||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type=
@ -139,10 +139,10 @@ svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.un
(function(){if(!svgedit.select)svgedit.select={};var a,q,g;svgedit.select.Selector=function(b,p){this.id=b;this.selectedElement=p;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity", (function(){if(!svgedit.select)svgedit.select={};var a,q,g;svgedit.select.Selector=function(b,p){this.id=b;this.selectedElement=p;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity",
0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(b){this.locked=true;this.selectedElement=b;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(b){var p=[];b=Math.round(b/45);if(b<0)b+=8;for(var v in g.selectorGrips)p.push(v);for(;b>0;){p.push(p.shift());b--}b=0;for(v in g.selectorGrips){g.selectorGrips[v].setAttribute("style", 0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(b){this.locked=true;this.selectedElement=b;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(b){var p=[];b=Math.round(b/45);if(b<0)b+=8;for(var v in g.selectorGrips)p.push(v);for(;b>0;){p.push(p.shift());b--}b=0;for(v in g.selectorGrips){g.selectorGrips[v].setAttribute("style",
"cursor:"+p[b]+"-resize");b++}};svgedit.select.Selector.prototype.showGrips=function(b){g.selectorGripsGroup.setAttribute("display",b?"inline":"none");var p=this.selectedElement;this.hasGrips=b;if(p&&b){this.selectorGroup.appendChild(g.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(p))}};svgedit.select.Selector.prototype.resize=function(){var b=this.selectorRect,p=g,v=p.selectorGrips,d=this.selectedElement,f=d.getAttribute("stroke-width"),c=a.currentZoom(),m=1/c;if(d.getAttribute("stroke")!== "cursor:"+p[b]+"-resize");b++}};svgedit.select.Selector.prototype.showGrips=function(b){g.selectorGripsGroup.setAttribute("display",b?"inline":"none");var p=this.selectedElement;this.hasGrips=b;if(p&&b){this.selectorGroup.appendChild(g.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(p))}};svgedit.select.Selector.prototype.resize=function(){var b=this.selectorRect,p=g,v=p.selectorGrips,d=this.selectedElement,f=d.getAttribute("stroke-width"),c=a.currentZoom(),m=1/c;if(d.getAttribute("stroke")!==
"none"&&!isNaN(f))m+=f/2;var u=d.tagName;if(u==="text")m+=2/c;f=svgedit.transformlist.getTransformList(d);f=svgedit.math.transformListToTransform(f).matrix;f.e*=c;f.f*=c;var C=svgedit.utilities.getBBox(d);if(u==="g"&&!$.data(d,"gsvg"))if(u=a.getStrokedBBox(d.childNodes))C=u;u=C.x;var s=C.y,L=C.width;C=C.height;m*=c;c=svgedit.math.transformBox(u*c,s*c,L*c,C*c,f);f=c.aabox;u=f.x-m;s=f.y-m;L=f.width+m*2;var R=f.height+m*2;f=u+L/2;C=s+R/2;if(d=svgedit.utilities.getRotationAngle(d)){u=a.svgRoot().createSVGTransform(); "none"&&!isNaN(f))m+=f/2;var u=d.tagName;if(u==="text")m+=2/c;f=svgedit.transformlist.getTransformList(d);f=svgedit.math.transformListToTransform(f).matrix;f.e*=c;f.f*=c;var C=svgedit.utilities.getBBox(d);if(u==="g"&&!$.data(d,"gsvg"))if(u=a.getStrokedBBox(d.childNodes))C=u;u=C.x;var s=C.y,L=C.width;C=C.height;m*=c;c=svgedit.math.transformBox(u*c,s*c,L*c,C*c,f);f=c.aabox;u=f.x-m;s=f.y-m;L=f.width+m*2;var Q=f.height+m*2;f=u+L/2;C=s+Q/2;if(d=svgedit.utilities.getRotationAngle(d)){u=a.svgRoot().createSVGTransform();
u.setRotate(-d,f,C);u=u.matrix;c.tl=svgedit.math.transformPoint(c.tl.x,c.tl.y,u);c.tr=svgedit.math.transformPoint(c.tr.x,c.tr.y,u);c.bl=svgedit.math.transformPoint(c.bl.x,c.bl.y,u);c.br=svgedit.math.transformPoint(c.br.x,c.br.y,u);u=c.tl;L=u.x;R=u.y;var K=u.x,I=u.y;u=Math.min;s=Math.max;L=u(L,u(c.tr.x,u(c.bl.x,c.br.x)))-m;R=u(R,u(c.tr.y,u(c.bl.y,c.br.y)))-m;K=s(K,s(c.tr.x,s(c.bl.x,c.br.x)))+m;I=s(I,s(c.tr.y,s(c.bl.y,c.br.y)))+m;u=L;s=R;L=K-L;R=I-R}m=a.svgRoot().suspendRedraw(100);b.setAttribute("d", u.setRotate(-d,f,C);u=u.matrix;c.tl=svgedit.math.transformPoint(c.tl.x,c.tl.y,u);c.tr=svgedit.math.transformPoint(c.tr.x,c.tr.y,u);c.bl=svgedit.math.transformPoint(c.bl.x,c.bl.y,u);c.br=svgedit.math.transformPoint(c.br.x,c.br.y,u);u=c.tl;L=u.x;Q=u.y;var K=u.x,H=u.y;u=Math.min;s=Math.max;L=u(L,u(c.tr.x,u(c.bl.x,c.br.x)))-m;Q=u(Q,u(c.tr.y,u(c.bl.y,c.br.y)))-m;K=s(K,s(c.tr.x,s(c.bl.x,c.br.x)))+m;H=s(H,s(c.tr.y,s(c.bl.y,c.br.y)))+m;u=L;s=Q;L=K-L;Q=H-Q}m=a.svgRoot().suspendRedraw(100);b.setAttribute("d",
"M"+u+","+s+" L"+(u+L)+","+s+" "+(u+L)+","+(s+R)+" "+u+","+(s+R)+"z");this.selectorGroup.setAttribute("transform",d?"rotate("+[d,f,C].join(",")+")":"");if(svgedit.browser.isTouch()){u-=15.75;s-=15.75}else{u-=4;s-=4}this.gripCoords={nw:[u,s].map(Math.round),ne:[u+L,s].map(Math.round),sw:[u,s+R].map(Math.round),se:[u+L,s+R].map(Math.round),n:[u+L/2,s].map(Math.round),w:[u,s+R/2].map(Math.round),e:[u+L,s+R/2].map(Math.round),s:[u+L/2,s+R].map(Math.round)};for(var Q in this.gripCoords){b=this.gripCoords[Q]; "M"+u+","+s+" L"+(u+L)+","+s+" "+(u+L)+","+(s+Q)+" "+u+","+(s+Q)+"z");this.selectorGroup.setAttribute("transform",d?"rotate("+[d,f,C].join(",")+")":"");if(svgedit.browser.isTouch()){u-=15.75;s-=15.75}else{u-=4;s-=4}this.gripCoords={nw:[u,s].map(Math.round),ne:[u+L,s].map(Math.round),sw:[u,s+Q].map(Math.round),se:[u+L,s+Q].map(Math.round),n:[u+L/2,s].map(Math.round),w:[u,s+Q/2].map(Math.round),e:[u+L,s+Q/2].map(Math.round),s:[u+L/2,s+Q].map(Math.round)};for(var S in this.gripCoords){b=this.gripCoords[S];
v[Q].setAttribute("x",b[0]);v[Q].setAttribute("y",b[1])}this.rotateCoords={nw:[u,s],ne:[u+L+8,s],sw:[u,s+R+8],se:[u+L+8,s+R+8]};for(Q in this.rotateCoords){b=this.rotateCoords[Q];p.rotateGrips[Q].setAttribute("cx",b[0]);p.rotateGrips[Q].setAttribute("cy",b[1])}a.svgRoot().unsuspendRedraw(m)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null}; v[S].setAttribute("x",b[0]);v[S].setAttribute("y",b[1])}this.rotateCoords={nw:[u,s],ne:[u+L+8,s],sw:[u,s+Q+8],se:[u+L+8,s+Q+8]};for(S in this.rotateCoords){b=this.rotateCoords[S];p.rotateGrips[S].setAttribute("cx",b[0]);p.rotateGrips[S].setAttribute("cy",b[1])}a.svgRoot().unsuspendRedraw(m)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};
this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup); this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup);
a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var b in this.rotateGrips){var p=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+b,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+q.imgPath+"rotate.png) 12 12, auto;"}});$.data(p,"dir",b);$.data(p,"type","rotate");this.rotateGrips[b]=this.selectorGripsGroup.appendChild(p)}for(b in this.selectorGrips){p=a.createSVGElement({element:"rect", a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var b in this.rotateGrips){var p=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+b,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+q.imgPath+"rotate.png) 12 12, auto;"}});$.data(p,"dir",b);$.data(p,"type","rotate");this.rotateGrips[b]=this.selectorGripsGroup.appendChild(p)}for(b in this.selectorGrips){p=a.createSVGElement({element:"rect",
attr:{id:"selectorGrip_resize_"+b,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+b+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){p.setAttribute("width",30.5);p.setAttribute("height",30.5);p.setAttribute("fill-opacity",0.3)}$.data(p,"dir",b);$.data(p,"type","resize");this.selectorGrips[b]=this.selectorGripsGroup.appendChild(p)}if(!$("#canvasBackground").length){b=q.dimensions;b=a.createSVGElement({element:"svg",attr:{id:"canvasBackground", attr:{id:"selectorGrip_resize_"+b,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+b+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){p.setAttribute("width",30.5);p.setAttribute("height",30.5);p.setAttribute("fill-opacity",0.3)}$.data(p,"dir",b);$.data(p,"type","resize");this.selectorGrips[b]=this.selectorGripsGroup.appendChild(p)}if(!$("#canvasBackground").length){b=q.dimensions;b=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",
@ -171,11 +171,11 @@ return m};svgedit.path.addPointGrip=function(f,c,m){var u=svgedit.path.getGripCo
C=u.appendChild(C);$("#pathpointgrip_"+f).dblclick(function(){svgedit.path.path&&svgedit.path.path.setSegType()})}if(c&&m)svgedit.utilities.assignAttributes(C,{x:c-(svgedit.browser.isTouch()?15:2.5),y:m-(svgedit.browser.isTouch()?15:2.5),display:"inline"});return C};svgedit.path.getGripContainer=function(){var f=svgedit.utilities.getElem("pathpointgrip_container");if(!f){f=svgedit.utilities.getElem("selectorParentGroup").appendChild(document.createElementNS("http://www.w3.org/2000/svg","g"));f.id= C=u.appendChild(C);$("#pathpointgrip_"+f).dblclick(function(){svgedit.path.path&&svgedit.path.path.setSegType()})}if(c&&m)svgedit.utilities.assignAttributes(C,{x:c-(svgedit.browser.isTouch()?15:2.5),y:m-(svgedit.browser.isTouch()?15:2.5),display:"inline"});return C};svgedit.path.getGripContainer=function(){var f=svgedit.utilities.getElem("pathpointgrip_container");if(!f){f=svgedit.utilities.getElem("selectorParentGroup").appendChild(document.createElementNS("http://www.w3.org/2000/svg","g"));f.id=
"pathpointgrip_container"}return f};svgedit.path.addCtrlGrip=function(f){var c=svgedit.utilities.getElem("ctrlpointgrip_"+f);if(c)return c;c=document.createElementNS("http://www.w3.org/2000/svg","circle");svgedit.utilities.assignAttributes(c,{id:"ctrlpointgrip_"+f,display:"none",r:svgedit.browser.isTouch()?15:3,fill:"#4F80FF",cursor:"move",style:"pointer-events:all","xlink:title":a.pathCtrlPtTooltip});svgedit.path.getGripContainer().appendChild(c);return c};svgedit.path.getCtrlLine=function(f){var c= "pathpointgrip_container"}return f};svgedit.path.addCtrlGrip=function(f){var c=svgedit.utilities.getElem("ctrlpointgrip_"+f);if(c)return c;c=document.createElementNS("http://www.w3.org/2000/svg","circle");svgedit.utilities.assignAttributes(c,{id:"ctrlpointgrip_"+f,display:"none",r:svgedit.browser.isTouch()?15:3,fill:"#4F80FF",cursor:"move",style:"pointer-events:all","xlink:title":a.pathCtrlPtTooltip});svgedit.path.getGripContainer().appendChild(c);return c};svgedit.path.getCtrlLine=function(f){var c=
svgedit.utilities.getElem("ctrlLine_"+f);if(c)return c;c=document.createElementNS("http://www.w3.org/2000/svg","line");svgedit.utilities.assignAttributes(c,{id:"ctrlLine_"+f,stroke:"#4F80FF","stroke-width":1,style:"pointer-events:none"});svgedit.path.getGripContainer().appendChild(c);return c};svgedit.path.getPointGrip=function(f,c){var m=svgedit.path.addPointGrip(f.index);if(c){var u=svgedit.path.getGripPt(f);svgedit.utilities.assignAttributes(m,{x:u.x-(svgedit.browser.isTouch()?15:2.5),y:u.y-(svgedit.browser.isTouch()? svgedit.utilities.getElem("ctrlLine_"+f);if(c)return c;c=document.createElementNS("http://www.w3.org/2000/svg","line");svgedit.utilities.assignAttributes(c,{id:"ctrlLine_"+f,stroke:"#4F80FF","stroke-width":1,style:"pointer-events:none"});svgedit.path.getGripContainer().appendChild(c);return c};svgedit.path.getPointGrip=function(f,c){var m=svgedit.path.addPointGrip(f.index);if(c){var u=svgedit.path.getGripPt(f);svgedit.utilities.assignAttributes(m,{x:u.x-(svgedit.browser.isTouch()?15:2.5),y:u.y-(svgedit.browser.isTouch()?
15:2.5),display:"inline"})}return m};svgedit.path.getControlPoints=function(f){var c=f.item,m=f.index;if(!("x1"in c)||!("x2"in c))return null;var u={};svgedit.path.getGripContainer();for(var C=[svgedit.path.path.segs[m-1].item,c],s=1;s<3;s++){var L=m+"c"+s,R=u["c"+s+"_line"]=svgedit.path.getCtrlLine(L),K=svgedit.path.getGripPt(f,{x:c["x"+s],y:c["y"+s]}),I=svgedit.path.getGripPt(f,{x:C[s-1].x,y:C[s-1].y});svgedit.utilities.assignAttributes(R,{x1:K.x,y1:K.y,x2:I.x,y2:I.y,display:"inline"});u["c"+s+ 15:2.5),display:"inline"})}return m};svgedit.path.getControlPoints=function(f){var c=f.item,m=f.index;if(!("x1"in c)||!("x2"in c))return null;var u={};svgedit.path.getGripContainer();for(var C=[svgedit.path.path.segs[m-1].item,c],s=1;s<3;s++){var L=m+"c"+s,Q=u["c"+s+"_line"]=svgedit.path.getCtrlLine(L),K=svgedit.path.getGripPt(f,{x:c["x"+s],y:c["y"+s]}),H=svgedit.path.getGripPt(f,{x:C[s-1].x,y:C[s-1].y});svgedit.utilities.assignAttributes(Q,{x1:K.x,y1:K.y,x2:H.x,y2:H.y,display:"inline"});u["c"+s+
"_line"]=R;pointGrip=u["c"+s]=svgedit.path.addCtrlGrip(L);svgedit.utilities.assignAttributes(pointGrip,{cx:K.x,cy:K.y,display:"inline"});u["c"+s]=pointGrip}return u};svgedit.path.replacePathSeg=function(f,c,m,u){u=u||svgedit.path.path.elem;f=u["createSVGPathSeg"+g[f]].apply(u,m);if(svgedit.browser.supportsPathReplaceItem())u.pathSegList.replaceItem(f,c);else{m=u.pathSegList;u=m.numberOfItems;for(var C=[],s=0;s<u;s++){var L=m.getItem(s);C.push(L)}m.clear();for(s=0;s<u;s++)s==c?m.appendItem(f):m.appendItem(C[s])}}; "_line"]=Q;pointGrip=u["c"+s]=svgedit.path.addCtrlGrip(L);svgedit.utilities.assignAttributes(pointGrip,{cx:K.x,cy:K.y,display:"inline"});u["c"+s]=pointGrip}return u};svgedit.path.replacePathSeg=function(f,c,m,u){u=u||svgedit.path.path.elem;f=u["createSVGPathSeg"+g[f]].apply(u,m);if(svgedit.browser.supportsPathReplaceItem())u.pathSegList.replaceItem(f,c);else{m=u.pathSegList;u=m.numberOfItems;for(var C=[],s=0;s<u;s++){var L=m.getItem(s);C.push(L)}m.clear();for(s=0;s<u;s++)s==c?m.appendItem(f):m.appendItem(C[s])}};
svgedit.path.getSegSelector=function(f,c){var m=f.index,u=svgedit.utilities.getElem("segline_"+m);if(!u){var C=svgedit.path.getGripContainer();u=document.createElementNS("http://www.w3.org/2000/svg","path");svgedit.utilities.assignAttributes(u,{id:"segline_"+m,display:"none",fill:"none",stroke:"#0ff","shape-rendering":"crispEdges","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"});C.appendChild(u)}if(c){m=f.prev;if(!m){u.setAttribute("display","none");return u}m=svgedit.path.getGripPt(m); svgedit.path.getSegSelector=function(f,c){var m=f.index,u=svgedit.utilities.getElem("segline_"+m);if(!u){var C=svgedit.path.getGripContainer();u=document.createElementNS("http://www.w3.org/2000/svg","path");svgedit.utilities.assignAttributes(u,{id:"segline_"+m,display:"none",fill:"none",stroke:"#0ff","shape-rendering":"crispEdges","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"});C.appendChild(u)}if(c){m=f.prev;if(!m){u.setAttribute("display","none");return u}m=svgedit.path.getGripPt(m);
svgedit.path.replacePathSeg(2,0,[m.x,m.y],u);C=svgedit.path.ptObjToArr(f.type,f.item,true);for(var s=0;s<C.length;s+=2){m=svgedit.path.getGripPt(f,{x:C[s],y:C[s+1]});C[s]=m.x;C[s+1]=m.y}svgedit.path.replacePathSeg(f.type,1,C,u)}return u};svgedit.path.smoothControlPoints=this.smoothControlPoints=function(f,c,m){var u=f.x-m.x,C=f.y-m.y,s=c.x-m.x,L=c.y-m.y;if((u!=0||C!=0)&&(s!=0||L!=0)){f=Math.atan2(C,u);c=Math.atan2(L,s);u=Math.sqrt(u*u+C*C);s=Math.sqrt(s*s+L*L);C=v.getSVGRoot().createSVGPoint();L= svgedit.path.replacePathSeg(2,0,[m.x,m.y],u);C=svgedit.path.ptObjToArr(f.type,f.item,true);for(var s=0;s<C.length;s+=2){m=svgedit.path.getGripPt(f,{x:C[s],y:C[s+1]});C[s]=m.x;C[s+1]=m.y}svgedit.path.replacePathSeg(f.type,1,C,u)}return u};svgedit.path.smoothControlPoints=this.smoothControlPoints=function(f,c,m){var u=f.x-m.x,C=f.y-m.y,s=c.x-m.x,L=c.y-m.y;if((u!=0||C!=0)&&(s!=0||L!=0)){f=Math.atan2(C,u);c=Math.atan2(L,s);u=Math.sqrt(u*u+C*C);s=Math.sqrt(s*s+L*L);C=v.getSVGRoot().createSVGPoint();L=
v.getSVGRoot().createSVGPoint();if(f<0)f+=2*Math.PI;if(c<0)c+=2*Math.PI;var R=Math.abs(f-c),K=Math.abs(Math.PI-R)/2;if(f-c>0){f=R<Math.PI?f+K:f-K;c=R<Math.PI?c-K:c+K}else{f=R<Math.PI?f-K:f+K;c=R<Math.PI?c+K:c-K}C.x=u*Math.cos(f)+m.x;C.y=u*Math.sin(f)+m.y;L.x=s*Math.cos(c)+m.x;L.y=s*Math.sin(c)+m.y;return[C,L]}};svgedit.path.Segment=function(f,c){this.selected=false;this.index=f;this.item=c;this.type=c.pathSegType;this.ctrlpts=[];this.segsel=this.ptgrip=null};svgedit.path.Segment.prototype.showCtrlPts= v.getSVGRoot().createSVGPoint();if(f<0)f+=2*Math.PI;if(c<0)c+=2*Math.PI;var Q=Math.abs(f-c),K=Math.abs(Math.PI-Q)/2;if(f-c>0){f=Q<Math.PI?f+K:f-K;c=Q<Math.PI?c-K:c+K}else{f=Q<Math.PI?f-K:f+K;c=Q<Math.PI?c+K:c-K}C.x=u*Math.cos(f)+m.x;C.y=u*Math.sin(f)+m.y;L.x=s*Math.cos(c)+m.x;L.y=s*Math.sin(c)+m.y;return[C,L]}};svgedit.path.Segment=function(f,c){this.selected=false;this.index=f;this.item=c;this.type=c.pathSegType;this.ctrlpts=[];this.segsel=this.ptgrip=null};svgedit.path.Segment.prototype.showCtrlPts=
function(f){for(var c in this.ctrlpts)this.ctrlpts[c].setAttribute("display",f?"inline":"none")};svgedit.path.Segment.prototype.selectCtrls=function(){$("#ctrlpointgrip_"+this.index+"c1, #ctrlpointgrip_"+this.index+"c2").attr("fill","#4F80FF")};svgedit.path.Segment.prototype.show=function(f){if(this.ptgrip){this.ptgrip.setAttribute("display",f?"inline":"none");this.segsel.setAttribute("display",f?"inline":"none");this.showCtrlPts(f)}};svgedit.path.Segment.prototype.select=function(f){if(this.ptgrip){this.ptgrip.setAttribute("stroke", function(f){for(var c in this.ctrlpts)this.ctrlpts[c].setAttribute("display",f?"inline":"none")};svgedit.path.Segment.prototype.selectCtrls=function(){$("#ctrlpointgrip_"+this.index+"c1, #ctrlpointgrip_"+this.index+"c2").attr("fill","#4F80FF")};svgedit.path.Segment.prototype.show=function(f){if(this.ptgrip){this.ptgrip.setAttribute("display",f?"inline":"none");this.segsel.setAttribute("display",f?"inline":"none");this.showCtrlPts(f)}};svgedit.path.Segment.prototype.select=function(f){if(this.ptgrip){this.ptgrip.setAttribute("stroke",
f?"#0FF":"#00F");this.segsel.setAttribute("display",f?"inline":"none");this.ctrlpts&&this.selectCtrls(f);this.selected=f}};svgedit.path.Segment.prototype.addGrip=function(){this.ptgrip=svgedit.path.getPointGrip(this,true);this.ctrlpts=svgedit.path.getControlPoints(this,true);this.segsel=svgedit.path.getSegSelector(this,true)};svgedit.path.Segment.prototype.update=function(f){if(this.ptgrip){var c=svgedit.path.getGripPt(this),m=svgedit.browser.isTouch()?15:2.5;svgedit.utilities.assignAttributes(this.ptgrip, f?"#0FF":"#00F");this.segsel.setAttribute("display",f?"inline":"none");this.ctrlpts&&this.selectCtrls(f);this.selected=f}};svgedit.path.Segment.prototype.addGrip=function(){this.ptgrip=svgedit.path.getPointGrip(this,true);this.ctrlpts=svgedit.path.getControlPoints(this,true);this.segsel=svgedit.path.getSegSelector(this,true)};svgedit.path.Segment.prototype.update=function(f){if(this.ptgrip){var c=svgedit.path.getGripPt(this),m=svgedit.browser.isTouch()?15:2.5;svgedit.utilities.assignAttributes(this.ptgrip,
this.ptgrip.nodeName=="rect"?{x:c.x-m,y:c.y-m}:{cx:c.x,cy:c.y});svgedit.path.getSegSelector(this,true);if(this.ctrlpts){if(f){this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.type=this.item.pathSegType}svgedit.path.getControlPoints(this)}}};svgedit.path.Segment.prototype.move=function(f,c){var m=this.item;m=this.ctrlpts?[m.x+=f,m.y+=c,m.x1,m.y1,m.x2+=f,m.y2+=c]:[m.x+=f,m.y+=c];svgedit.path.replacePathSeg(this.type,this.index,m);if(this.next&&this.next.ctrlpts){m=this.next.item; this.ptgrip.nodeName=="rect"?{x:c.x-m,y:c.y-m}:{cx:c.x,cy:c.y});svgedit.path.getSegSelector(this,true);if(this.ctrlpts){if(f){this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.type=this.item.pathSegType}svgedit.path.getControlPoints(this)}}};svgedit.path.Segment.prototype.move=function(f,c){var m=this.item;m=this.ctrlpts?[m.x+=f,m.y+=c,m.x1,m.y1,m.x2+=f,m.y2+=c]:[m.x+=f,m.y+=c];svgedit.path.replacePathSeg(this.type,this.index,m);if(this.next&&this.next.ctrlpts){m=this.next.item;
@ -183,126 +183,126 @@ m=[m.x,m.y,m.x1+=f,m.y1+=c,m.x2,m.y2];svgedit.path.replacePathSeg(this.next.type
f]);svgedit.path.replacePathSeg(c.type,c.index,[C.x,C.y,C.x1,C.y1,C.x2,C.y2]);c.update(true)};svgedit.path.Segment.prototype.moveCtrl=function(f,c,m){var u=this.item;u["x"+f]+=c;u["y"+f]+=m;svgedit.path.replacePathSeg(this.type,this.index,[u.x,u.y,u.x1,u.y1,u.x2,u.y2]);this.update(true)};svgedit.path.Segment.prototype.setType=function(f,c){svgedit.path.replacePathSeg(f,this.index,c);this.type=f;this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.showCtrlPts(f===6);this.ctrlpts=svgedit.path.getControlPoints(this); f]);svgedit.path.replacePathSeg(c.type,c.index,[C.x,C.y,C.x1,C.y1,C.x2,C.y2]);c.update(true)};svgedit.path.Segment.prototype.moveCtrl=function(f,c,m){var u=this.item;u["x"+f]+=c;u["y"+f]+=m;svgedit.path.replacePathSeg(this.type,this.index,[u.x,u.y,u.x1,u.y1,u.x2,u.y2]);this.update(true)};svgedit.path.Segment.prototype.setType=function(f,c){svgedit.path.replacePathSeg(f,this.index,c);this.type=f;this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.showCtrlPts(f===6);this.ctrlpts=svgedit.path.getControlPoints(this);
this.update(true)};svgedit.path.Path=function(f){if(!f||f.tagName!=="path")throw"svgedit.path.Path constructed without a <path> element";this.elem=f;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var f=this.elem.pathSegList,c=f.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var m=0;m<c;m++){var u=f.getItem(m);u=new svgedit.path.Segment(m,u); this.update(true)};svgedit.path.Path=function(f){if(!f||f.tagName!=="path")throw"svgedit.path.Path constructed without a <path> element";this.elem=f;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var f=this.elem.pathSegList,c=f.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var m=0;m<c;m++){var u=f.getItem(m);u=new svgedit.path.Segment(m,u);
u.path=this;this.segs.push(u)}f=this.segs;u=null;for(m=0;m<c;m++){var C=f[m],s=m+1>=c?null:f[m+1],L=m-1<0?null:f[m-1];if(C.type===2){if(L&&L.type!==1){s=f[u];s.next=f[u+1];s.next.prev=s;s.addGrip()}u=m}else if(s&&s.type===1){C.next=f[u+1];C.next.prev=C;C.mate=f[u];C.addGrip();if(this.first_seg==null)this.first_seg=C}else if(s){if(C.type!==1){C.addGrip();if(s&&s.type!==2){C.next=s;C.next.prev=C}}}else if(C.type!==1){s=f[u];s.next=f[u+1];s.next.prev=s;s.addGrip();C.addGrip();if(!this.first_seg)this.first_seg= u.path=this;this.segs.push(u)}f=this.segs;u=null;for(m=0;m<c;m++){var C=f[m],s=m+1>=c?null:f[m+1],L=m-1<0?null:f[m-1];if(C.type===2){if(L&&L.type!==1){s=f[u];s.next=f[u+1];s.next.prev=s;s.addGrip()}u=m}else if(s&&s.type===1){C.next=f[u+1];C.next.prev=C;C.mate=f[u];C.addGrip();if(this.first_seg==null)this.first_seg=C}else if(s){if(C.type!==1){C.addGrip();if(s&&s.type!==2){C.next=s;C.next.prev=C}}}else if(C.type!==1){s=f[u];s.next=f[u+1];s.next.prev=s;s.addGrip();C.addGrip();if(!this.first_seg)this.first_seg=
f[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var c=this.segs.length,m=0;m<c;m++)if(f.call(this.segs[m],m)===false)break};svgedit.path.Path.prototype.addSeg=function(f){var c=this.segs[f];if(c.prev){var m=c.prev,u;switch(c.item.pathSegType){case 4:var C=(c.item.x+m.item.x)/2,s=(c.item.y+m.item.y)/2;u=this.elem.createSVGPathSegLinetoAbs(C,s);break;case 6:u=(m.item.x+c.item.x1)/2;var L=(c.item.x1+c.item.x2)/2,R=(c.item.x2+c.item.x)/2,K=(u+L)/2;L=(L+R)/2;C=(K+L)/2;var I=(m.item.y+ f[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var c=this.segs.length,m=0;m<c;m++)if(f.call(this.segs[m],m)===false)break};svgedit.path.Path.prototype.addSeg=function(f){var c=this.segs[f];if(c.prev){var m=c.prev,u;switch(c.item.pathSegType){case 4:var C=(c.item.x+m.item.x)/2,s=(c.item.y+m.item.y)/2;u=this.elem.createSVGPathSegLinetoAbs(C,s);break;case 6:u=(m.item.x+c.item.x1)/2;var L=(c.item.x1+c.item.x2)/2,Q=(c.item.x2+c.item.x)/2,K=(u+L)/2;L=(L+Q)/2;C=(K+L)/2;var H=(m.item.y+
c.item.y1)/2,Q=(c.item.y1+c.item.y2)/2;m=(c.item.y2+c.item.y)/2;var S=(I+Q)/2;Q=(Q+m)/2;s=(S+Q)/2;u=this.elem.createSVGPathSegCurvetoCubicAbs(C,s,u,I,K,S);svgedit.path.replacePathSeg(c.type,f,[c.item.x,c.item.y,L,Q,R,m])}svgedit.path.insertItemBefore(this.elem,u,f)}};svgedit.path.Path.prototype.deleteSeg=function(f){var c=this.segs[f],m=this.elem.pathSegList;c.show(false);var u=c.next;if(c.mate){var C=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,u.index,C);svgedit.path.replacePathSeg(4,c.index, c.item.y1)/2,S=(c.item.y1+c.item.y2)/2;m=(c.item.y2+c.item.y)/2;var R=(H+S)/2;S=(S+m)/2;s=(R+S)/2;u=this.elem.createSVGPathSegCurvetoCubicAbs(C,s,u,H,K,R);svgedit.path.replacePathSeg(c.type,f,[c.item.x,c.item.y,L,S,Q,m])}svgedit.path.insertItemBefore(this.elem,u,f)}};svgedit.path.Path.prototype.deleteSeg=function(f){var c=this.segs[f],m=this.elem.pathSegList;c.show(false);var u=c.next;if(c.mate){var C=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,u.index,C);svgedit.path.replacePathSeg(4,c.index,
C);m.removeItem(c.mate.index)}else{if(!c.prev){C=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,c.next.index,C)}m.removeItem(f)}};svgedit.path.Path.prototype.subpathIsClosed=function(f){var c=false;svgedit.path.path.eachSeg(function(m){if(m<=f)return true;if(this.type===2)return false;else if(this.type===1){c=true;return false}});return c};svgedit.path.Path.prototype.removePtFromSelection=function(f){var c=this.selected_pts.indexOf(f);if(c!=-1){this.segs[f].select(false);this.selected_pts.splice(c, C);m.removeItem(c.mate.index)}else{if(!c.prev){C=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,c.next.index,C)}m.removeItem(f)}};svgedit.path.Path.prototype.subpathIsClosed=function(f){var c=false;svgedit.path.path.eachSeg(function(m){if(m<=f)return true;if(this.type===2)return false;else if(this.type===1){c=true;return false}});return c};svgedit.path.Path.prototype.removePtFromSelection=function(f){var c=this.selected_pts.indexOf(f);if(c!=-1){this.segs[f].select(false);this.selected_pts.splice(c,
1)}};svgedit.path.Path.prototype.clearSelection=function(){this.eachSeg(function(){this.select(false)});this.selected_pts=[]};svgedit.path.Path.prototype.storeD=function(){this.last_d=this.elem.getAttribute("d")};svgedit.path.Path.prototype.show=function(f){this.eachSeg(function(){this.show(f)});f&&this.selectPt(this.first_seg.index);return this};svgedit.path.Path.prototype.movePts=function(f,c){for(var m=this.selected_pts.length;m--;)this.segs[this.selected_pts[m]].move(f,c)};svgedit.path.Path.prototype.moveCtrl= 1)}};svgedit.path.Path.prototype.clearSelection=function(){this.eachSeg(function(){this.select(false)});this.selected_pts=[]};svgedit.path.Path.prototype.storeD=function(){this.last_d=this.elem.getAttribute("d")};svgedit.path.Path.prototype.show=function(f){this.eachSeg(function(){this.show(f)});f&&this.selectPt(this.first_seg.index);return this};svgedit.path.Path.prototype.movePts=function(f,c){for(var m=this.selected_pts.length;m--;)this.segs[this.selected_pts[m]].move(f,c)};svgedit.path.Path.prototype.moveCtrl=
function(f,c){var m=this.segs[this.selected_pts[0]];m.moveCtrl(this.dragctrl,f,c);b&&m.setLinked(this.dragctrl)};svgedit.path.Path.prototype.setSegType=function(f){this.storeD();for(var c=this.selected_pts.length,m;c--;){var u=this.segs[this.selected_pts[c]],C=u.prev;if(C){if(!f){m="Toggle Path Segment Type";f=u.type==6?4:6}f-=0;var s=u.item.x,L=u.item.y,R=C.item.x;C=C.item.y;var K;switch(f){case 6:if(u.olditem){R=u.olditem;K=[s,L,R.x1,R.y1,R.x2,R.y2]}else{K=s-R;var I=L-C;K=[s,L,R+K/3,C+I/3,s-K/3, function(f,c){var m=this.segs[this.selected_pts[0]];m.moveCtrl(this.dragctrl,f,c);b&&m.setLinked(this.dragctrl)};svgedit.path.Path.prototype.setSegType=function(f){this.storeD();for(var c=this.selected_pts.length,m;c--;){var u=this.segs[this.selected_pts[c]],C=u.prev;if(C){if(!f){m="Toggle Path Segment Type";f=u.type==6?4:6}f-=0;var s=u.item.x,L=u.item.y,Q=C.item.x;C=C.item.y;var K;switch(f){case 6:if(u.olditem){Q=u.olditem;K=[s,L,Q.x1,Q.y1,Q.x2,Q.y2]}else{K=s-Q;var H=L-C;K=[s,L,Q+K/3,C+H/3,s-K/3,
L-I/3]}break;case 4:K=[s,L];u.olditem=u.item}u.setType(f,K)}}svgedit.path.path.endChanges(m)};svgedit.path.Path.prototype.selectPt=function(f,c){this.clearSelection();f==null&&this.eachSeg(function(m){if(this.prev)f=m});this.addPtsToSelection(f);if(c){this.dragctrl=c;b&&this.segs[f].setLinked(c)}};svgedit.path.Path.prototype.update=function(){var f=this.elem;if(svgedit.utilities.getRotationAngle(f)){this.matrix=svgedit.math.getMatrix(f);this.imatrix=this.matrix.inverse()}else this.imatrix=this.matrix= L-H/3]}break;case 4:K=[s,L];u.olditem=u.item}u.setType(f,K)}}svgedit.path.path.endChanges(m)};svgedit.path.Path.prototype.selectPt=function(f,c){this.clearSelection();f==null&&this.eachSeg(function(m){if(this.prev)f=m});this.addPtsToSelection(f);if(c){this.dragctrl=c;b&&this.segs[f].setLinked(c)}};svgedit.path.Path.prototype.update=function(){var f=this.elem;if(svgedit.utilities.getRotationAngle(f)){this.matrix=svgedit.math.getMatrix(f);this.imatrix=this.matrix.inverse()}else this.imatrix=this.matrix=
null;this.eachSeg(function(c){this.item=f.pathSegList.getItem(c);this.update()});return this};svgedit.path.getPath_=function(f){var c=p[f.id];c||(c=p[f.id]=new svgedit.path.Path(f));return c};svgedit.path.removePath_=function(f){f in p&&delete p[f]};var d=function(f,c,m,u,C,s,L){dx=f-m;dy=c-u;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)+L;dx=r*Math.cos(theta)+m;dy=r*Math.sin(theta)+u;dx-=C;dy-=s;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)-L;return{x:(r*Math.cos(theta)+C)/1,y:(r*Math.sin(theta)+ null;this.eachSeg(function(c){this.item=f.pathSegList.getItem(c);this.update()});return this};svgedit.path.getPath_=function(f){var c=p[f.id];c||(c=p[f.id]=new svgedit.path.Path(f));return c};svgedit.path.removePath_=function(f){f in p&&delete p[f]};var d=function(f,c,m,u,C,s,L){dx=f-m;dy=c-u;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)+L;dx=r*Math.cos(theta)+m;dy=r*Math.sin(theta)+u;dx-=C;dy-=s;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)-L;return{x:(r*Math.cos(theta)+C)/1,y:(r*Math.sin(theta)+
s)/1}};svgedit.path.recalcRotatedPath=function(){var f=svgedit.path.path.elem,c=svgedit.utilities.getRotationAngle(f,true);if(c){var m=svgedit.utilities.getBBox(f),u=svgedit.path.path.oldbbox,C=u.x+u.width/2;u=u.y+u.height/2;var s=m.x+m.width/2;m=m.y+m.height/2;s=s-C;var L=m-u;m=Math.sqrt(s*s+L*L);L=Math.atan2(L,s)+c;s=m*Math.cos(L)+C;m=m*Math.sin(L)+u;L=f.pathSegList;for(var R=L.numberOfItems;R;){R-=1;var K=L.getItem(R),I=K.pathSegType;if(I!=1){var Q=d(K.x,K.y,C,u,s,m,c);Q=[Q.x,Q.y];if(K.x1!=null&& s)/1}};svgedit.path.recalcRotatedPath=function(){var f=svgedit.path.path.elem,c=svgedit.utilities.getRotationAngle(f,true);if(c){var m=svgedit.utilities.getBBox(f),u=svgedit.path.path.oldbbox,C=u.x+u.width/2;u=u.y+u.height/2;var s=m.x+m.width/2;m=m.y+m.height/2;s=s-C;var L=m-u;m=Math.sqrt(s*s+L*L);L=Math.atan2(L,s)+c;s=m*Math.cos(L)+C;m=m*Math.sin(L)+u;L=f.pathSegList;for(var Q=L.numberOfItems;Q;){Q-=1;var K=L.getItem(Q),H=K.pathSegType;if(H!=1){var S=d(K.x,K.y,C,u,s,m,c);S=[S.x,S.y];if(K.x1!=null&&
K.x2!=null){c_vals1=d(K.x1,K.y1,C,u,s,m,c);c_vals2=d(K.x2,K.y2,C,u,s,m,c);Q.splice(Q.length,0,c_vals1.x,c_vals1.y,c_vals2.x,c_vals2.y)}svgedit.path.replacePathSeg(I,R,Q)}}svgedit.utilities.getBBox(f);C=svgroot.createSVGTransform();f=svgedit.transformlist.getTransformList(f);C.setRotate(c*180/Math.PI,s,m);f.replaceItem(C,0)}};svgedit.path.clearData=function(){p={}}})();if(!window.console){window.console={};window.console.log=function(){};window.console.dir=function(){}}if(window.opera){window.console.log=function(a){opera.postError(a)};window.console.dir=function(){}} K.x2!=null){c_vals1=d(K.x1,K.y1,C,u,s,m,c);c_vals2=d(K.x2,K.y2,C,u,s,m,c);S.splice(S.length,0,c_vals1.x,c_vals1.y,c_vals2.x,c_vals2.y)}svgedit.path.replacePathSeg(H,Q,S)}}svgedit.utilities.getBBox(f);C=svgroot.createSVGTransform();f=svgedit.transformlist.getTransformList(f);C.setRotate(c*180/Math.PI,s,m);f.replaceItem(C,0)}};svgedit.path.clearData=function(){p={}}})();if(!window.console){window.console={};window.console.log=function(){};window.console.dir=function(){}}if(window.opera){window.console.log=function(a){opera.postError(a)};window.console.dir=function(){}}
(function(){var a=jQuery.fn.attr;jQuery.fn.attr=function(q,g){var b=this.length;if(!b)return a.apply(this,arguments);for(var p=0;p<b;p++){var v=this[p];if(v.namespaceURI==="http://www.w3.org/2000/svg")if(g!==undefined)v.setAttribute(q,g);else if($.isArray(q)){b=q.length;for(p={};b--;){var d=q[b],f=v.getAttribute(d);if(f||f==="0")f=isNaN(f)?f:f-0;p[d]=f}return p}else if(typeof q==="object")for(d in q)v.setAttribute(d,q[d]);else{if((f=v.getAttribute(q))||f==="0")f=isNaN(f)?f:f-0;return f}else return a.apply(this, (function(){var a=jQuery.fn.attr;jQuery.fn.attr=function(q,g){var b=this.length;if(!b)return a.apply(this,arguments);for(var p=0;p<b;p++){var v=this[p];if(v.namespaceURI==="http://www.w3.org/2000/svg")if(g!==undefined)v.setAttribute(q,g);else if($.isArray(q)){b=q.length;for(p={};b--;){var d=q[b],f=v.getAttribute(d);if(f||f==="0")f=isNaN(f)?f:f-0;p[d]=f}return p}else if(typeof q==="object")for(d in q)v.setAttribute(d,q[d]);else{if((f=v.getAttribute(q))||f==="0")f=isNaN(f)?f:f-0;return f}else return a.apply(this,
arguments)}return this}})(); arguments)}return this}})();
$.SvgCanvas=function(a,q){function g(e,h){for(var l=svgedit.utilities.getBBox(e),B=0;B<2;B++){var A=B===0?"fill":"stroke",G=e.getAttribute(A);if(G&&G.indexOf("url(")===0){G=P(G);if(G.tagName==="linearGradient"){var D=G.getAttribute("x1")||0,z=G.getAttribute("y1")||0,F=G.getAttribute("x2")||1,k=G.getAttribute("y2")||0;D=l.width*D+l.x;z=l.height*z+l.y;F=l.width*F+l.x;k=l.height*k+l.y;D=N(D,z,h);k=N(F,k,h);F={};F.x1=(D.x-l.x)/l.width;F.y1=(D.y-l.y)/l.height;F.x2=(k.x-l.x)/l.width;F.y2=(k.y-l.y)/l.height; $.SvgCanvas=function(a,q){function g(e,h){for(var l=svgedit.utilities.getBBox(e),B=0;B<2;B++){var A=B===0?"fill":"stroke",G=e.getAttribute(A);if(G&&G.indexOf("url(")===0){G=P(G);if(G.tagName==="linearGradient"){var D=G.getAttribute("x1")||0,z=G.getAttribute("y1")||0,F=G.getAttribute("x2")||1,k=G.getAttribute("y2")||0;D=l.width*D+l.x;z=l.height*z+l.y;F=l.width*F+l.x;k=l.height*k+l.y;D=N(D,z,h);k=N(F,k,h);F={};F.x1=(D.x-l.x)/l.width;F.y1=(D.y-l.y)/l.height;F.x2=(k.x-l.x)/l.width;F.y2=(k.y-l.y)/l.height;
G=G.cloneNode(true);$(G).attr(F);G.id=ka();gb().appendChild(G);e.setAttribute(A,"url(#"+G.id+")")}}}}var b="http://www.w3.org/2000/svg",p={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};q&&$.extend(p,q);var v=p.dimensions,d=this,f=a.ownerDocument,c=f.importNode(svgedit.utilities.text2xml('<svg id="svgroot" xmlns="'+b+'" xlinkns="http://www.w3.org/1999/xlink" width="'+v[0]+'" height="'+v[1]+'" x="'+v[0]+'" y="'+v[1]+'" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>').documentElement, G=G.cloneNode(true);$(G).attr(F);G.id=ka();gb().appendChild(G);e.setAttribute(A,"url(#"+G.id+")")}}}}var b="http://www.w3.org/2000/svg",p={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};q&&$.extend(p,q);var v=p.dimensions,d=this,f=a.ownerDocument,c=f.importNode(svgedit.utilities.text2xml('<svg id="svgroot" xmlns="'+b+'" xlinkns="http://www.w3.org/1999/xlink" width="'+v[0]+'" height="'+v[1]+'" x="'+v[0]+'" y="'+v[1]+'" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>').documentElement,
true);a.appendChild(c);var m=f.createElementNS(b,"svg");(d.clearSvgContentElement=function(){for(;m.firstChild;)m.removeChild(m.firstChild);$(m).attr({id:"svgcontent",width:v[0],height:v[1],x:v[0],y:v[1],overflow:p.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(c);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");m.appendChild(e)})();var u="svg_";d.setIdPrefix= true);a.appendChild(c);var m=f.createElementNS(b,"svg");(d.clearSvgContentElement=function(){for(;m.firstChild;)m.removeChild(m.firstChild);$(m).attr({id:"svgcontent",width:v[0],height:v[1],x:v[0],y:v[1],overflow:p.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(c);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");m.appendChild(e)})();var u="svg_";d.setIdPrefix=
function(e){u=e};d.current_drawing_=new svgedit.draw.Drawing(m,u);var C=d.getCurrentDrawing=function(){return d.current_drawing_},s=1,L=null,R={shape:{fill:(p.initFill.color=="none"?"":"#")+p.initFill.color,fill_paint:null,fill_opacity:p.initFill.opacity,stroke:"#"+p.initStroke.color,stroke_paint:null,stroke_opacity:p.initStroke.opacity,stroke_width:p.initStroke.width,stroke_dasharray:"none",opacity:p.initOpacity}};R.text=$.extend(true,{},R.shape);$.extend(R.text,{fill:"#000000",stroke_width:0,font_size:24, function(e){u=e};d.current_drawing_=new svgedit.draw.Drawing(m,u);var C=d.getCurrentDrawing=function(){return d.current_drawing_},s=1,L=null,Q={shape:{fill:(p.initFill.color=="none"?"":"#")+p.initFill.color,fill_paint:null,fill_opacity:p.initFill.opacity,stroke:"#"+p.initStroke.color,stroke_paint:null,stroke_opacity:p.initStroke.opacity,stroke_width:p.initStroke.width,stroke_dasharray:"none",opacity:p.initOpacity}};Q.text=$.extend(true,{},Q.shape);$.extend(Q.text,{fill:"#000000",stroke_width:0,font_size:24,
font_family:"Helvetica, Arial, sans-serif"});var K=R.shape,I=Array(1),Q=this.addSvgElementFromJson=function(e){var h=svgedit.utilities.getElem(e.attr.id),l=C().getCurrentLayer();if(h&&e.element!=h.tagName){l.removeChild(h);h=null}if(!h){h=f.createElementNS(b,e.element);if(l)(L||l).appendChild(h)}e.curStyles&&svgedit.utilities.assignAttributes(h,{fill:K.fill,stroke:K.stroke,"stroke-width":K.stroke_width,"stroke-dasharray":K.stroke_dasharray,"stroke-opacity":K.stroke_opacity,"fill-opacity":K.fill_opacity, font_family:"Helvetica, Arial, sans-serif"});var K=Q.shape,H=Array(1),S=this.addSvgElementFromJson=function(e){var h=svgedit.utilities.getElem(e.attr.id),l=C().getCurrentLayer();if(h&&e.element!=h.tagName){l.removeChild(h);h=null}if(!h){h=f.createElementNS(b,e.element);if(l)(L||l).appendChild(h)}e.curStyles&&svgedit.utilities.assignAttributes(h,{fill:K.fill,stroke:K.stroke,"stroke-width":K.stroke_width,"stroke-dasharray":K.stroke_dasharray,"stroke-opacity":K.stroke_opacity,"fill-opacity":K.fill_opacity,
opacity:K.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,e.attr,100);svgedit.utilities.cleanupElement(h);return h},S=d.getTransformList=svgedit.transformlist.getTransformList,N=svgedit.math.transformPoint,ga=d.matrixMultiply=svgedit.math.matrixMultiply,na=d.hasMatrixTransform=svgedit.math.hasMatrixTransform,X=d.transformListToTransform=svgedit.math.transformListToTransform,U=svgedit.math.snapToAngle,ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return p.baseUnit}, opacity:K.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,e.attr,100);svgedit.utilities.cleanupElement(h);return h},R=d.getTransformList=svgedit.transformlist.getTransformList,N=svgedit.math.transformPoint,ga=d.matrixMultiply=svgedit.math.matrixMultiply,oa=d.hasMatrixTransform=svgedit.math.hasMatrixTransform,X=d.transformListToTransform=svgedit.math.transformListToTransform,U=svgedit.math.snapToAngle,ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return p.baseUnit},
getElement:svgedit.utilities.getElem,getHeight:function(){return m.getAttribute("height")/s},getWidth:function(){return m.getAttribute("width")/s},getRoundDigits:function(){return $a.round_digits}});var Aa=d.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return c},getSelectedElements:function(){return I},getSVGContent:function(){return m}});var ja=d.getUrlFromAttr=svgedit.utilities.getUrlFromAttr, getElement:svgedit.utilities.getElem,getHeight:function(){return m.getAttribute("height")/s},getWidth:function(){return m.getAttribute("width")/s},getRoundDigits:function(){return $a.round_digits}});var Aa=d.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return c},getSelectedElements:function(){return H},getSVGContent:function(){return m}});var ja=d.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,
ba=d.getHref=svgedit.utilities.getHref,T=d.setHref=svgedit.utilities.setHref,Z=svgedit.utilities.getPathBBox;d.getBBox=svgedit.utilities.getBBox;var oa=d.getRotationAngle=svgedit.utilities.getRotationAngle,pa=d.getElem=svgedit.utilities.getElem,ma=d.assignAttributes=svgedit.utilities.assignAttributes,la=this.cleanupElement=svgedit.utilities.cleanupElement,xa=svgedit.sanitize.getNSMap(),ya=d.sanitizeSvg=svgedit.sanitize.sanitizeSvg,Ja=svgedit.history.MoveElementCommand,Ha=svgedit.history.InsertElementCommand, ba=d.getHref=svgedit.utilities.getHref,T=d.setHref=svgedit.utilities.setHref,Z=svgedit.utilities.getPathBBox;d.getBBox=svgedit.utilities.getBBox;var na=d.getRotationAngle=svgedit.utilities.getRotationAngle,pa=d.getElem=svgedit.utilities.getElem,ma=d.assignAttributes=svgedit.utilities.assignAttributes,la=this.cleanupElement=svgedit.utilities.cleanupElement,xa=svgedit.sanitize.getNSMap(),ya=d.sanitizeSvg=svgedit.sanitize.sanitizeSvg,Ja=svgedit.history.MoveElementCommand,Ha=svgedit.history.InsertElementCommand,
Ga=svgedit.history.RemoveElementCommand,Ma=svgedit.history.ChangeElementCommand,Ca=svgedit.history.BatchCommand;d.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,h){var l=svgedit.history.HistoryEventTypes;if(e==l.BEFORE_UNAPPLY||e==l.BEFORE_APPLY)d.clearSelection();else if(e==l.AFTER_APPLY||e==l.AFTER_UNAPPLY){var B=h.elements();d.pathActions.clear();M("changed",B);B=h.type();l=e==l.AFTER_APPLY;if(B==Ja.type()){l=l?h.newParent:h.oldParent;l==m&&d.identifyLayers()}else if(B== Ga=svgedit.history.RemoveElementCommand,Ma=svgedit.history.ChangeElementCommand,Ca=svgedit.history.BatchCommand;d.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,h){var l=svgedit.history.HistoryEventTypes;if(e==l.BEFORE_UNAPPLY||e==l.BEFORE_APPLY)d.clearSelection();else if(e==l.AFTER_APPLY||e==l.AFTER_UNAPPLY){var B=h.elements();d.pathActions.clear();M("changed",B);B=h.type();l=e==l.AFTER_APPLY;if(B==Ja.type()){l=l?h.newParent:h.oldParent;l==m&&d.identifyLayers()}else if(B==
Ha.type()||B==Ga.type()){h.parent==m&&d.identifyLayers();if(B==Ha.type())l&&Ta(h.elem);else l||Ta(h.elem);h.elem.tagName==="use"&&Gb(h.elem)}else if(B==Ma.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==m&&d.identifyLayers();l=l?h.newValues:h.oldValues;l.stdDeviation&&d.setBlurOffsets(h.elem.parentNode,l.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){B=h.elem;if(!B.getAttribute("x")&&!B.getAttribute("y")){l=B.parentNode;var A=B.nextSibling;l.removeChild(B);l.insertBefore(B, Ha.type()||B==Ga.type()){h.parent==m&&d.identifyLayers();if(B==Ha.type())l&&Ta(h.elem);else l||Ta(h.elem);h.elem.tagName==="use"&&Gb(h.elem)}else if(B==Ma.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==m&&d.identifyLayers();l=l?h.newValues:h.oldValues;l.stdDeviation&&d.setBlurOffsets(h.elem.parentNode,l.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){B=h.elem;if(!B.getAttribute("x")&&!B.getAttribute("y")){l=B.parentNode;var A=B.nextSibling;l.removeChild(B);l.insertBefore(B,
A)}}}}}});var wa=function(e){d.undoMgr.addCommandToHistory(e)};svgedit.select.init(p,{createSVGElement:function(e){return d.addSvgElementFromJson(e)},svgRoot:function(){return c},svgContent:function(){return m},currentZoom:function(){return s},getStrokedBBox:function(e){return d.getStrokedBBox([e])}});var ra=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return s},getSVGRoot:function(){return c}});svgedit.utilities.snapToGrid=function(e){var h= A)}}}}}});var wa=function(e){d.undoMgr.addCommandToHistory(e)};svgedit.select.init(p,{createSVGElement:function(e){return d.addSvgElementFromJson(e)},svgRoot:function(){return c},svgContent:function(){return m},currentZoom:function(){return s},getStrokedBBox:function(e){return d.getStrokedBBox([e])}});var ra=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return s},getSVGRoot:function(){return c}});svgedit.utilities.snapToGrid=function(e){var h=
p.snappingStep,l=p.baseUnit;if(l!=="px")h*=svgedit.units.getTypeMap()[l];return e=Math.round(e/h)*h};var va=svgedit.utilities.snapToGrid,kb={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"},vb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],cb=$.data,Ta=function(e){var h=$(e).attr(vb),l;for(l in h){var B= p.snappingStep,l=p.baseUnit;if(l!=="px")h*=svgedit.units.getTypeMap()[l];return e=Math.round(e/h)*h};var va=svgedit.utilities.snapToGrid,kb={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"},vb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],cb=$.data,Ta=function(e){var h=$(e).attr(vb),l;for(l in h){var B=
h[l];if(B&&B.indexOf("url(")===0){B=ja(B).substr(1);if(!pa(B)){gb().appendChild(sb[B]);delete sb[B]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(l=e.length;h<l;h++)Ta(e[h])}},Va={},Ea=p.imgPath+"logo.png",ta=[],$a={round_digits:5},Ka=false,Sa=null,Fa="select",db="none",lb={},Ua=R.text,Xa=K,wb=null,sa=null,hb=[],eb={},sb={};d.clipBoard=[];var ib=this.runExtensions=function(e,h,l){var B=false;if(l)B=[];$.each(eb,function(A,G){if(e in G)if(l)B.push(G[e](h));else B=G[e](h)});return B};this.addExtension= h[l];if(B&&B.indexOf("url(")===0){B=ja(B).substr(1);if(!pa(B)){gb().appendChild(sb[B]);delete sb[B]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(l=e.length;h<l;h++)Ta(e[h])}},Va={},Ea=p.imgPath+"logo.png",ta=[],$a={round_digits:5},Ka=false,Sa=null,Fa="select",db="none",lb={},Ua=Q.text,Xa=K,wb=null,sa=null,hb=[],eb={},sb={};d.clipBoard=[];var ib=this.runExtensions=function(e,h,l){var B=false;if(l)B=[];$.each(eb,function(A,G){if(e in G)if(l)B.push(G[e](h));else B=G[e](h)});return B};this.addExtension=
function(e,h){if(e in eb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var l=$.isFunction(h)?h($.extend(d.getPrivateMethods(),{svgroot:c,svgcontent:m,nonce:C().getNonce(),selectorManager:ra})):h;eb[e]=l;M("extension_added",l)}};var ab=this.round=function(e){return parseInt(e*s)/s},ob=this.getIntersectionList=function(e){if(sa==null)return null;var h=L||C().getCurrentLayer();hb.length||(hb=fb(h));var l=null;try{l=h.getIntersectionList(e,null)}catch(B){}if(l== function(e,h){if(e in eb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var l=$.isFunction(h)?h($.extend(d.getPrivateMethods(),{svgroot:c,svgcontent:m,nonce:C().getNonce(),selectorManager:ra})):h;eb[e]=l;M("extension_added",l)}};var ab=this.round=function(e){return parseInt(e*s)/s},ob=this.getIntersectionList=function(e){if(sa==null)return null;var h=L||C().getCurrentLayer();hb.length||(hb=fb(h));var l=null;try{l=h.getIntersectionList(e,null)}catch(B){}if(l==
null||typeof l.item!="function"){l=[];if(e)e=e;else{e=sa.getBBox();h={};for(var A in e)h[A]=e[A]/s;e=h}for(A=hb.length;A--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,hb[A].bbox)&&l.push(hb[A].elem)}return l};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=pb());if(!e.length)return false;var h=function(k){try{var n=svgedit.utilities.getBBox(k),o=svgedit.utilities.getRotationAngle(k);if(o&&o%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(k))){o=false;if(["ellipse", null||typeof l.item!="function"){l=[];if(e)e=e;else{e=sa.getBBox();h={};for(var A in e)h[A]=e[A]/s;e=h}for(A=hb.length;A--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,hb[A].bbox)&&l.push(hb[A].elem)}return l};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=pb());if(!e.length)return false;var h=function(k){try{var n=svgedit.utilities.getBBox(k),o=svgedit.utilities.getRotationAngle(k);if(o&&o%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(k))){o=false;if(["ellipse",
"path","line","polyline","polygon"].indexOf(k.tagName)>=0)n=o=d.convertToPath(k,true);else if(k.tagName=="rect"){var w=k.getAttribute("rx"),E=k.getAttribute("ry");if(w||E)n=o=d.convertToPath(k,true)}if(!o){var H=k.cloneNode(true),J=document.createElementNS(b,"g"),O=k.parentNode;O.appendChild(J);J.appendChild(H);n=svgedit.utilities.bboxToObj(J.getBBox());O.removeChild(J)}}return n}catch(Y){console.log(k,Y);return null}},l;$.each(e,function(){if(!l)if(this.parentNode)l=h(this)});if(l==null)return null; "path","line","polyline","polygon"].indexOf(k.tagName)>=0)n=o=d.convertToPath(k,true);else if(k.tagName=="rect"){var w=k.getAttribute("rx"),E=k.getAttribute("ry");if(w||E)n=o=d.convertToPath(k,true)}if(!o){var I=k.cloneNode(true),J=document.createElementNS(b,"g"),O=k.parentNode;O.appendChild(J);J.appendChild(I);n=svgedit.utilities.bboxToObj(J.getBBox());O.removeChild(J)}}return n}catch(Y){console.log(k,Y);return null}},l;$.each(e,function(){if(!l)if(this.parentNode)l=h(this)});if(l==null)return null;
var B=l.x+l.width,A=l.y+l.height,G=l.x,D=l.y,z=function(k){var n=k.getAttribute("stroke-width"),o=0;if(k.getAttribute("stroke")!="none"&&!isNaN(n))o+=n/2;return o},F=[];$.each(e,function(k,n){var o=h(n);if(o){var w=z(n);G=Math.min(G,o.x-w);D=Math.min(D,o.y-w);F.push(o)}});l.x=G;l.y=D;$.each(e,function(k,n){var o=F[k];if(o&&n.nodeType==1){var w=z(n);B=Math.max(B,o.x+o.width+w);A=Math.max(A,o.y+o.height+w)}});l.width=B-G;l.height=A-D;return l};var pb=this.getVisibleElements=function(e){e||(e=$(m).children()); var B=l.x+l.width,A=l.y+l.height,G=l.x,D=l.y,z=function(k){var n=k.getAttribute("stroke-width"),o=0;if(k.getAttribute("stroke")!="none"&&!isNaN(n))o+=n/2;return o},F=[];$.each(e,function(k,n){var o=h(n);if(o){var w=z(n);G=Math.min(G,o.x-w);D=Math.min(D,o.y-w);F.push(o)}});l.x=G;l.y=D;$.each(e,function(k,n){var o=F[k];if(o&&n.nodeType==1){var w=z(n);B=Math.max(B,o.x+o.width+w);A=Math.max(A,o.y+o.height+w)}});l.width=B-G;l.height=A-D;return l};var pb=this.getVisibleElements=function(e){e||(e=$(m).children());
e.find("#canvas_background").length&&e.splice(0,1);var h=[];$(e).children().each(function(l,B){try{B.getBBox()&&h.push(B)}catch(A){}});return h.reverse()},fb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(m).children());var h=[];$(e).children().each(function(l,B){try{B.getBBox()&&h.push({elem:B,bbox:getStrokedBBox([B])})}catch(A){}});return h.reverse()},tb=this.groupSvgElem=function(e){var h=document.createElementNS(b,"g");e.parentNode.replaceChild(h,e);$(h).append(e).data("gsvg",e)[0].id=ka()}, e.find("#canvas_background").length&&e.splice(0,1);var h=[];$(e).children().each(function(l,B){try{B.getBBox()&&h.push(B)}catch(A){}});return h.reverse()},fb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(m).children());var h=[];$(e).children().each(function(l,B){try{B.getBBox()&&h.push({elem:B,bbox:getStrokedBBox([B])})}catch(A){}});return h.reverse()},tb=this.groupSvgElem=function(e){var h=document.createElementNS(b,"g");e.parentNode.replaceChild(h,e);$(h).append(e).data("gsvg",e)[0].id=ka()},
ia=function(e){var h=document.createElementNS(e.namespaceURI,e.nodeName);h.removeAttribute("id");$.each(e.attributes,function(B,A){A.localName!="-moz-math-font-style"&&h.setAttributeNS(A.namespaceURI,A.nodeName,A.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var l=La.convertPath(e);h.setAttribute("d",l)}$.each(e.childNodes,function(B,A){switch(A.nodeType){case 1:h.appendChild(ia(A));break;case 3:h.textContent=A.nodeValue}});if($(e).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(e).data("symbol")){e= ia=function(e){var h=document.createElementNS(e.namespaceURI,e.nodeName);h.removeAttribute("id");$.each(e.attributes,function(B,A){A.localName!="-moz-math-font-style"&&h.setAttributeNS(A.namespaceURI,A.nodeName,A.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var l=La.convertPath(e);h.setAttribute("d",l)}$.each(e.childNodes,function(B,A){switch(A.nodeType){case 1:h.appendChild(ia(A));break;case 3:h.textContent=A.nodeValue}});if($(e).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(e).data("symbol")){e=
$(e).data("symbol");$(h).data("ref",e).data("symbol",e)}else h.tagName=="image"&&Fb(h);h.id=ka();return h},aa,ka,M;(function(e){var h={};aa=e.getId=function(){return C().getId()};ka=e.getNextId=function(){return C().getNextId()};M=e.call=function(l,B){if(h[l])return h[l](this,B)};e.bind=function(l,B){var A=h[l];h[l]=B;return A}})(d);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var h=0,l=e.length;h<l;++h){var B=e[h];B.setAttribute("d",La.convertPath(B)); $(e).data("symbol");$(h).data("ref",e).data("symbol",e)}else h.tagName=="image"&&Fb(h);h.id=ka();return h},aa,ka,M;(function(e){var h={};aa=e.getId=function(){return C().getId()};ka=e.getNextId=function(){return C().getNextId()};M=e.call=function(l,B){if(h[l])return h[l](this,B)};e.bind=function(l,B){var A=h[l];h[l]=B;return A}})(d);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var h=0,l=e.length;h<l;++h){var B=e[h];B.setAttribute("d",La.convertPath(B));
La.fixEnd(B)}};var P=this.getRefElem=function(e){return pa(ja(e).substr(1))},ca=function(e){if(!svgedit.browser.isGecko())return e;var h=e.cloneNode(true);e.parentNode.insertBefore(h,e);e.parentNode.removeChild(e);ra.releaseSelector(e);I[0]=h;ra.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(e,h){e=parseFloat(e);var l=I[0];if(l){var B=l.getAttribute("transform"),A=svgedit.utilities.getBBox(l),G=A.x+A.width/2,D=A.y+A.height/2;A=S(l);A.numberOfItems>0&&A.getItem(0).type== La.fixEnd(B)}};var P=this.getRefElem=function(e){return pa(ja(e).substr(1))},ca=function(e){if(!svgedit.browser.isGecko())return e;var h=e.cloneNode(true);e.parentNode.insertBefore(h,e);e.parentNode.removeChild(e);ra.releaseSelector(e);H[0]=h;ra.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(e,h){e=parseFloat(e);var l=H[0];if(l){var B=l.getAttribute("transform"),A=svgedit.utilities.getBBox(l),G=A.x+A.width/2,D=A.y+A.height/2;A=R(l);A.numberOfItems>0&&A.getItem(0).type==
4&&A.removeItem(0);if(e!=0){G=N(G,D,X(A).matrix);D=c.createSVGTransform();D.setRotate(e,G.x,G.y);A.numberOfItems?A.insertItemBefore(D,0):A.appendItem(D)}else A.numberOfItems==0&&l.removeAttribute("transform");if(!h){A=l.getAttribute("transform");l.setAttribute("transform",B);Ya("transform",A,I);M("changed",I)}pa("pathpointgrip_container");l=ra.requestSelector(I[0]);l.resize();l.updateGripCursors(e)}};var Da=this.recalculateAllSelectedDimensions=function(){for(var e=new Ca(db=="none"?"position":"size"), 4&&A.removeItem(0);if(e!=0){G=N(G,D,X(A).matrix);D=c.createSVGTransform();D.setRotate(e,G.x,G.y);A.numberOfItems?A.insertItemBefore(D,0):A.appendItem(D)}else A.numberOfItems==0&&l.removeAttribute("transform");if(!h){A=l.getAttribute("transform");l.setAttribute("transform",B);Ya("transform",A,H);M("changed",H)}pa("pathpointgrip_container");l=ra.requestSelector(H[0]);l.resize();l.updateGripCursors(e)}};var Da=this.recalculateAllSelectedDimensions=function(){for(var e=new Ca(db=="none"?"position":"size"),
h=I.length;h--;){var l=Ra(I[h]);l&&e.addSubCommand(l)}if(!e.isEmpty()){wa(e);M("changed",I)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Wa=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},Za=this.remapElement=function(e,h,l){var B=p.gridSnapping&&e.parentNode.parentNode.localName==="svg",A=function(){if(B)for(var o in h)h[o]=va(h[o]);ma(e,h,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var D=G===0?"fill":"stroke",z=e.getAttribute(D);if(z&& h=H.length;h--;){var l=Ra(H[h]);l&&e.addSubCommand(l)}if(!e.isEmpty()){wa(e);M("changed",H)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Wa=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},Za=this.remapElement=function(e,h,l){var B=p.gridSnapping&&e.parentNode.parentNode.localName==="svg",A=function(){if(B)for(var o in h)h[o]=va(h[o]);ma(e,h,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var D=G===0?"fill":"stroke",z=e.getAttribute(D);if(z&&
z.indexOf("url(")===0)if(l.a<0||l.d<0){z=P(z).cloneNode(true);if(l.a<0){var F=z.getAttribute("x1"),k=z.getAttribute("x2");z.setAttribute("x1",-(F-1));z.setAttribute("x2",-(k-1))}if(l.d<0){F=z.getAttribute("y1");k=z.getAttribute("y2");z.setAttribute("y1",-(F-1));z.setAttribute("y2",-(k-1))}z.id=ka();gb().appendChild(z);e.setAttribute(D,"url(#"+z.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(l.a==1&&l.b==0&&l.c==0&&l.d==1&&(l.e!=0||l.f!=0)){D=X(e).matrix;D=ga(D.inverse(),l,D);h.x=parseFloat(h.x)+ z.indexOf("url(")===0)if(l.a<0||l.d<0){z=P(z).cloneNode(true);if(l.a<0){var F=z.getAttribute("x1"),k=z.getAttribute("x2");z.setAttribute("x1",-(F-1));z.setAttribute("x2",-(k-1))}if(l.d<0){F=z.getAttribute("y1");k=z.getAttribute("y2");z.setAttribute("y1",-(F-1));z.setAttribute("y2",-(k-1))}z.id=ka();gb().appendChild(z);e.setAttribute(D,"url(#"+z.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(l.a==1&&l.b==0&&l.c==0&&l.d==1&&(l.e!=0||l.f!=0)){D=X(e).matrix;D=ga(D.inverse(),l,D);h.x=parseFloat(h.x)+
D.e;h.y=parseFloat(h.y)+D.f}else{D=S(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(l.a<0||l.d<0)){D=S(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}else{D=N(h.x,h.y,l);h.width=l.a*h.width;h.height=l.d*h.height;h.x=D.x+Math.min(0,h.width);h.y=D.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}A();break;case "ellipse":G=N(h.cx, D.e;h.y=parseFloat(h.y)+D.f}else{D=R(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(l.a<0||l.d<0)){D=R(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}else{D=N(h.x,h.y,l);h.width=l.a*h.width;h.height=l.d*h.height;h.x=D.x+Math.min(0,h.width);h.y=D.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}A();break;case "ellipse":G=N(h.cx,
h.cy,l);h.cx=G.x;h.cy=G.y;h.rx=l.a*h.rx;h.ry=l.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);A();break;case "circle":G=N(h.cx,h.cy,l);h.cx=G.x;h.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,l);h.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(h.r)h.r=Math.abs(h.r);A();break;case "line":D=N(h.x1,h.y1,l);F=N(h.x2,h.y2,l);h.x1=D.x;h.y1=D.y;h.x2=F.x;h.y2=F.y;case "text":l=e.querySelectorAll("tspan");for(G=l.length;G--;){D=Aa("x",e.getAttribute("x"));z=Aa("x",l[G].getAttribute("x")); h.cy,l);h.cx=G.x;h.cy=G.y;h.rx=l.a*h.rx;h.ry=l.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);A();break;case "circle":G=N(h.cx,h.cy,l);h.cx=G.x;h.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,l);h.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(h.r)h.r=Math.abs(h.r);A();break;case "line":D=N(h.x1,h.y1,l);F=N(h.x2,h.y2,l);h.x1=D.x;h.y1=D.y;h.x2=F.x;h.y2=F.y;case "text":l=e.querySelectorAll("tspan");for(G=l.length;G--;){D=Aa("x",e.getAttribute("x"));z=Aa("x",l[G].getAttribute("x"));
F=Aa("y",e.getAttribute("y"));k=Aa("y",l[G].getAttribute("y"));var n={};if(!isNaN(D)&&!isNaN(z)&&D!=0&&z!=0&&h.x)n.x=h.x-(D-z);if(!isNaN(F)&&!isNaN(k)&&F!=0&&k!=0&&h.y)n.y=h.y-(F-k);if(n.x||n.y)ma(l[G],n,1E3,true)}A();break;case "use":A();break;case "g":(A=$(e).data("gsvg"))&&ma(A,h,1E3,true);break;case "polyline":case "polygon":A=h.points.length;for(G=0;G<A;++G){k=h.points[G];k=N(k.x,k.y,l);h.points[G].x=k.x;h.points[G].y=k.y}A=h.points.length;l="";for(G=0;G<A;++G){k=h.points[G];l+=k.x+","+k.y+" "}e.setAttribute("points", F=Aa("y",e.getAttribute("y"));k=Aa("y",l[G].getAttribute("y"));var n={};if(!isNaN(D)&&!isNaN(z)&&D!=0&&z!=0&&h.x)n.x=h.x-(D-z);if(!isNaN(F)&&!isNaN(k)&&F!=0&&k!=0&&h.y)n.y=h.y-(F-k);if(n.x||n.y)ma(l[G],n,1E3,true)}A();break;case "use":A();break;case "g":(A=$(e).data("gsvg"))&&ma(A,h,1E3,true);break;case "polyline":case "polygon":A=h.points.length;for(G=0;G<A;++G){k=h.points[G];k=N(k.x,k.y,l);h.points[G].x=k.x;h.points[G].y=k.y}A=h.points.length;l="";for(G=0;G<A;++G){k=h.points[G];l+=k.x+","+k.y+" "}e.setAttribute("points",
l);break;case "path":D=e.pathSegList;A=D.numberOfItems;h.d=Array(A);for(G=0;G<A;++G){z=D.getItem(G);h.d[G]={type:z.pathSegType,x:z.x,y:z.y,x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,r1:z.r1,r2:z.r2,angle:z.angle,largeArcFlag:z.largeArcFlag,sweepFlag:z.sweepFlag}}A=h.d.length;G=h.d[0];n=N(G.x,G.y,l);h.d[0].x=n.x;h.d[0].y=n.y;for(G=1;G<A;++G){z=h.d[G];D=z.type;if(D%2==0){k=N(z.x!=undefined?z.x:n.x,z.y!=undefined?z.y:n.y,l);D=N(z.x1,z.y1,l);F=N(z.x2,z.y2,l);z.x=k.x;z.y=k.y;z.x1=D.x;z.y1=D.y;z.x2=F.x;z.y2=F.y}else{z.x= l);break;case "path":D=e.pathSegList;A=D.numberOfItems;h.d=Array(A);for(G=0;G<A;++G){z=D.getItem(G);h.d[G]={type:z.pathSegType,x:z.x,y:z.y,x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,r1:z.r1,r2:z.r2,angle:z.angle,largeArcFlag:z.largeArcFlag,sweepFlag:z.sweepFlag}}A=h.d.length;G=h.d[0];n=N(G.x,G.y,l);h.d[0].x=n.x;h.d[0].y=n.y;for(G=1;G<A;++G){z=h.d[G];D=z.type;if(D%2==0){k=N(z.x!=undefined?z.x:n.x,z.y!=undefined?z.y:n.y,l);D=N(z.x1,z.y1,l);F=N(z.x2,z.y2,l);z.x=k.x;z.y=k.y;z.x1=D.x;z.y1=D.y;z.x2=F.x;z.y2=F.y}else{z.x=
l.a*z.x;z.y=l.d*z.y;z.x1=l.a*z.x1;z.y1=l.d*z.y1;z.x2=l.a*z.x2;z.y2=l.d*z.y2}z.r1=l.a*z.r1;z.r2=l.d*z.r2}l="";A=h.d.length;for(G=0;G<A;++G){z=h.d[G];D=z.type;l+=Oa[D];switch(D){case 13:case 12:l+=z.x+" ";break;case 15:case 14:l+=z.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:l+=z.x+","+z.y+" ";break;case 7:case 6:l+=z.x1+","+z.y1+" "+z.x2+","+z.y2+" "+z.x+","+z.y+" ";break;case 9:case 8:l+=z.x1+","+z.y1+" "+z.x+","+z.y+" ";break;case 11:case 10:l+=z.r1+","+z.r2+" "+z.angle+" "+ +z.largeArcFlag+ l.a*z.x;z.y=l.d*z.y;z.x1=l.a*z.x1;z.y1=l.d*z.y1;z.x2=l.a*z.x2;z.y2=l.d*z.y2}z.r1=l.a*z.r1;z.r2=l.d*z.r2}l="";A=h.d.length;for(G=0;G<A;++G){z=h.d[G];D=z.type;l+=Oa[D];switch(D){case 13:case 12:l+=z.x+" ";break;case 15:case 14:l+=z.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:l+=z.x+","+z.y+" ";break;case 7:case 6:l+=z.x1+","+z.y1+" "+z.x2+","+z.y2+" "+z.x+","+z.y+" ";break;case 9:case 8:l+=z.x1+","+z.y1+" "+z.x+","+z.y+" ";break;case 11:case 10:l+=z.r1+","+z.r2+" "+z.angle+" "+ +z.largeArcFlag+
" "+ +z.sweepFlag+" "+z.x+","+z.y+" ";break;case 17:case 16:l+=z.x2+","+z.y2+" "+z.x+","+z.y+" "}}e.setAttribute("d",l)}},nb=function(e,h,l){e=P(e).firstChild;var B=S(e),A=c.createSVGTransform();A.setTranslate(h,l);B.appendItem(A);Ra(e)},Ra=this.recalculateDimensions=function(e){if(e==null)return null;var h=S(e);if(h&&h.numberOfItems>0){for(var l=h.numberOfItems;l--;){var B=h.getItem(l);if(B.type===0)h.removeItem(l);else if(B.type===1)svgedit.math.isIdentity(B.matrix)&&h.removeItem(l);else B.type=== " "+ +z.sweepFlag+" "+z.x+","+z.y+" ";break;case 17:case 16:l+=z.x2+","+z.y2+" "+z.x+","+z.y+" "}}e.setAttribute("d",l)}},nb=function(e,h,l){e=P(e).firstChild;var B=R(e),A=c.createSVGTransform();A.setTranslate(h,l);B.appendItem(A);Ra(e)},Ra=this.recalculateDimensions=function(e){if(e==null)return null;var h=R(e);if(h&&h.numberOfItems>0){for(var l=h.numberOfItems;l--;){var B=h.getItem(l);if(B.type===0)h.removeItem(l);else if(B.type===1)svgedit.math.isIdentity(B.matrix)&&h.removeItem(l);else B.type===
4&&B.angle===0&&h.removeItem(l)}if(h.numberOfItems===1&&oa(e))return null}if(!h||h.numberOfItems==0){e.removeAttribute("transform");return null}if(h){l=h.numberOfItems;for(var A=[];l--;){B=h.getItem(l);if(B.type===1)A.push([B.matrix,l]);else if(A.length)A=[]}if(A.length===2){l=c.createSVGTransformFromMatrix(ga(A[1][0],A[0][0]));h.removeItem(A[0][1]);h.removeItem(A[1][1]);h.insertItemBefore(l,A[1][1])}l=h.numberOfItems;if(l>=2&&h.getItem(l-2).type===1&&h.getItem(l-1).type===2){A=c.createSVGTransform(); 4&&B.angle===0&&h.removeItem(l)}if(h.numberOfItems===1&&na(e))return null}if(!h||h.numberOfItems==0){e.removeAttribute("transform");return null}if(h){l=h.numberOfItems;for(var A=[];l--;){B=h.getItem(l);if(B.type===1)A.push([B.matrix,l]);else if(A.length)A=[]}if(A.length===2){l=c.createSVGTransformFromMatrix(ga(A[1][0],A[0][0]));h.removeItem(A[0][1]);h.removeItem(A[1][1]);h.insertItemBefore(l,A[1][1])}l=h.numberOfItems;if(l>=2&&h.getItem(l-2).type===1&&h.getItem(l-1).type===2){A=c.createSVGTransform();
B=ga(h.getItem(l-2).matrix,h.getItem(l-1).matrix);A.setMatrix(B);h.removeItem(l-2);h.removeItem(l-2);h.appendItem(A)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var G=$(e).data("gsvg");l=new Ca("Transform");var D={},z=null;B=[];switch(e.tagName){case "line":B=["x1","y1","x2","y2"];break;case "circle":B=["cx","cy","r"];break;case "ellipse":B= B=ga(h.getItem(l-2).matrix,h.getItem(l-1).matrix);A.setMatrix(B);h.removeItem(l-2);h.removeItem(l-2);h.appendItem(A)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var G=$(e).data("gsvg");l=new Ca("Transform");var D={},z=null;B=[];switch(e.tagName){case "line":B=["x1","y1","x2","y2"];break;case "circle":B=["cx","cy","r"];break;case "ellipse":B=
["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":B=["width","height","x","y"];break;case "use":case "text":case "tspan":B=["x","y"];break;case "polygon":case "polyline":z={};z.points=e.getAttribute("points");A=e.points;var F=A.numberOfItems;D.points=Array(F);for(var k=0;k<F;++k){var n=A.getItem(k);D.points[k]={x:n.x,y:n.y}}break;case "path":z={};z.d=e.getAttribute("d");D.d=e.getAttribute("d")}if(B.length){D=$(e).attr(B);$.each(D,function(Ba,Pa){D[Ba]=Aa(Ba,Pa)})}else if(G)D= ["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":B=["width","height","x","y"];break;case "use":case "text":case "tspan":B=["x","y"];break;case "polygon":case "polyline":z={};z.points=e.getAttribute("points");A=e.points;var F=A.numberOfItems;D.points=Array(F);for(var k=0;k<F;++k){var n=A.getItem(k);D.points[k]={x:n.x,y:n.y}}break;case "path":z={};z.d=e.getAttribute("d");D.d=e.getAttribute("d")}if(B.length){D=$(e).attr(B);$.each(D,function(Ba,Pa){D[Ba]=Aa(Ba,Pa)})}else if(G)D=
{x:$(G).attr("x")||0,y:$(G).attr("y")||0};if(z==null){z=$.extend(true,{},D);$.each(z,function(Ba,Pa){z[Ba]=Aa(Ba,Pa)})}z.transform=Sa?Sa:"";if(e.tagName=="g"&&!G||e.tagName=="a"){A=svgedit.utilities.getBBox(e);var o={x:A.x+A.width/2,y:A.y+A.height/2},w=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);B=c.createSVGMatrix();if(A=oa(e)){k=A*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k<h.numberOfItems;++k){B=h.getItem(k);if(B.type==4){B=B.matrix;o.y=(F*B.e+B.f)/2;o.x=(B.e-F* {x:$(G).attr("x")||0,y:$(G).attr("y")||0};if(z==null){z=$.extend(true,{},D);$.each(z,function(Ba,Pa){z[Ba]=Aa(Ba,Pa)})}z.transform=Sa?Sa:"";if(e.tagName=="g"&&!G||e.tagName=="a"){A=svgedit.utilities.getBBox(e);var o={x:A.x+A.width/2,y:A.y+A.height/2},w=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);B=c.createSVGMatrix();if(A=na(e)){k=A*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k<h.numberOfItems;++k){B=h.getItem(k);if(B.type==4){B=B.matrix;o.y=(F*B.e+B.f)/2;o.x=(B.e-F*
B.f)/2;h.removeItem(k);break}}}k=B=G=0;var E=h.numberOfItems;if(E)var H=h.getItem(0).matrix;if(E>=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;var J=h.getItem(E-3).matrix,O=h.getItem(E-2).matrix,Y=h.getItem(E-1).matrix;F=e.childNodes;for(n=F.length;n--;){var da=F.item(n);B=G=0;if(da.nodeType==1){var V=S(da);if(V){B=X(V).matrix;G=oa(da);var fa=Sa,ha=[];Sa=da.getAttribute("transform");if(G||na(V)){var W=c.createSVGTransform();W.setMatrix(ga(J,O,Y,B));V.clear();V.appendItem(W); B.f)/2;h.removeItem(k);break}}}k=B=G=0;var E=h.numberOfItems;if(E)var I=h.getItem(0).matrix;if(E>=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;var J=h.getItem(E-3).matrix,O=h.getItem(E-2).matrix,Y=h.getItem(E-1).matrix;F=e.childNodes;for(n=F.length;n--;){var da=F.item(n);B=G=0;if(da.nodeType==1){var V=R(da);if(V){B=X(V).matrix;G=na(da);var fa=Sa,ha=[];Sa=da.getAttribute("transform");if(G||oa(V)){var W=c.createSVGTransform();W.setMatrix(ga(J,O,Y,B));V.clear();V.appendItem(W);
ha.push(W)}else{G=ga(B.inverse(),Y,B);W=c.createSVGMatrix();W.e=-G.e;W.f=-G.f;B=ga(W.inverse(),B.inverse(),J,O,Y,B,G.inverse());var qa=c.createSVGTransform(),ua=c.createSVGTransform(),za=c.createSVGTransform();qa.setTranslate(G.e,G.f);ua.setScale(B.a,B.d);za.setTranslate(W.e,W.f);V.appendItem(za);V.appendItem(ua);V.appendItem(qa);ha.push(za);ha.push(ua);ha.push(qa)}l.addSubCommand(Ra(da));Sa=fa}}}h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E>=3&&h.getItem(E-1).type==1){k=3;B=X(h).matrix; ha.push(W)}else{G=ga(B.inverse(),Y,B);W=c.createSVGMatrix();W.e=-G.e;W.f=-G.f;B=ga(W.inverse(),B.inverse(),J,O,Y,B,G.inverse());var qa=c.createSVGTransform(),ua=c.createSVGTransform(),za=c.createSVGTransform();qa.setTranslate(G.e,G.f);ua.setScale(B.a,B.d);za.setTranslate(W.e,W.f);V.appendItem(za);V.appendItem(ua);V.appendItem(qa);ha.push(za);ha.push(ua);ha.push(qa)}l.addSubCommand(Ra(da));Sa=fa}}}h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E>=3&&h.getItem(E-1).type==1){k=3;B=X(h).matrix;
W=c.createSVGTransform();W.setMatrix(B);h.clear();h.appendItem(W)}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;G=X(h).matrix;h.removeItem(0);B=X(h).matrix.inverse();B=ga(B,G);G=B.e;B=B.f;if(G!=0||B!=0){F=e.childNodes;n=F.length;for(E=[];n--;){da=F.item(n);if(da.nodeType==1){if(da.getAttribute("clip-path")){fa=da.getAttribute("clip-path");if(E.indexOf(fa)===-1){nb(fa,G,B);E.push(fa)}}fa=Sa;Sa=da.getAttribute("transform");if(V=S(da)){J=c.createSVGTransform();J.setTranslate(G, W=c.createSVGTransform();W.setMatrix(B);h.clear();h.appendItem(W)}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;G=X(h).matrix;h.removeItem(0);B=X(h).matrix.inverse();B=ga(B,G);G=B.e;B=B.f;if(G!=0||B!=0){F=e.childNodes;n=F.length;for(E=[];n--;){da=F.item(n);if(da.nodeType==1){if(da.getAttribute("clip-path")){fa=da.getAttribute("clip-path");if(E.indexOf(fa)===-1){nb(fa,G,B);E.push(fa)}}fa=Sa;Sa=da.getAttribute("transform");if(V=R(da)){J=c.createSVGTransform();J.setTranslate(G,
B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J);l.addSubCommand(Ra(da));V=e.getElementsByTagNameNS(b,"use");da="#"+da.id;for(J=V.length;J--;){O=V.item(J);if(da==ba(O)){Y=c.createSVGTransform();Y.setTranslate(-G,-B);S(O).insertItemBefore(Y,0);l.addSubCommand(Ra(O))}}Sa=fa}}}E=[];Sa=fa}}else if(E==1&&h.getItem(0).type==1&&!A){k=1;B=h.getItem(0).matrix;F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");if(V=S(da)){G=ga(B,X(V).matrix); B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J);l.addSubCommand(Ra(da));V=e.getElementsByTagNameNS(b,"use");da="#"+da.id;for(J=V.length;J--;){O=V.item(J);if(da==ba(O)){Y=c.createSVGTransform();Y.setTranslate(-G,-B);R(O).insertItemBefore(Y,0);l.addSubCommand(Ra(O))}}Sa=fa}}}E=[];Sa=fa}}else if(E==1&&h.getItem(0).type==1&&!A){k=1;B=h.getItem(0).matrix;F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");if(V=R(da)){G=ga(B,X(V).matrix);
E=c.createSVGTransform();E.setMatrix(G);V.clear();V.appendItem(E,0);l.addSubCommand(Ra(da));Sa=fa;fa=da.getAttribute("stroke-width");da.getAttribute("stroke")!=="none"&&!isNaN(fa)&&da.setAttribute("stroke-width",fa*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(A){o=c.createSVGTransform();o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(k==2){if(A){w={x:o.x+H.e,y:o.y+H.f};o=c.createSVGTransform(); E=c.createSVGTransform();E.setMatrix(G);V.clear();V.appendItem(E,0);l.addSubCommand(Ra(da));Sa=fa;fa=da.getAttribute("stroke-width");da.getAttribute("stroke")!=="none"&&!isNaN(fa)&&da.setAttribute("stroke-width",fa*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(A){o=c.createSVGTransform();o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(k==2){if(A){w={x:o.x+I.e,y:o.y+I.f};o=c.createSVGTransform();
o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else if(k==3){B=X(h).matrix;H=c.createSVGTransform();H.setRotate(A,o.x,o.y);H=H.matrix;o=c.createSVGTransform();o.setRotate(A,w.x,w.y);w=o.matrix.inverse();fa=B.inverse();w=ga(fa,w,H,B);G=w.e;B=w.f;if(G!=0||B!=0){F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");V=S(da);J=c.createSVGTransform();J.setTranslate(G,B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J); o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else if(k==3){B=X(h).matrix;I=c.createSVGTransform();I.setRotate(A,o.x,o.y);I=I.matrix;o=c.createSVGTransform();o.setRotate(A,w.x,w.y);w=o.matrix.inverse();fa=B.inverse();w=ga(fa,w,I,B);G=w.e;B=w.f;if(G!=0||B!=0){F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");V=R(da);J=c.createSVGTransform();J.setTranslate(G,B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J);
l.addSubCommand(Ra(da));Sa=fa}}}if(A)h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else{A=svgedit.utilities.getBBox(e);if(!A&&e.tagName!="path")return null;B=c.createSVGMatrix();if(G=oa(e)){o={x:A.x+A.width/2,y:A.y+A.height/2};w=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);k=G*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k<h.numberOfItems;++k){B=h.getItem(k);if(B.type==4){B=B.matrix;o.y=(F*B.e+B.f)/2;o.x=(B.e-F*B.f)/2;h.removeItem(k);break}}}k=0;E=h.numberOfItems; l.addSubCommand(Ra(da));Sa=fa}}}if(A)h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else{A=svgedit.utilities.getBBox(e);if(!A&&e.tagName!="path")return null;B=c.createSVGMatrix();if(G=na(e)){o={x:A.x+A.width/2,y:A.y+A.height/2};w=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);k=G*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k<h.numberOfItems;++k){B=h.getItem(k);if(B.type==4){B=B.matrix;o.y=(F*B.e+B.f)/2;o.x=(B.e-F*B.f)/2;h.removeItem(k);break}}}k=0;E=h.numberOfItems;
if(!svgedit.browser.isWebkit())if((H=e.getAttribute("fill"))&&H.indexOf("url(")===0){H=P(H);fa="pattern";if(H.tagName!==fa)fa="gradient";if(H.getAttribute(fa+"Units")==="userSpaceOnUse"){B=X(h).matrix;A=S(H);A=X(A).matrix;B=ga(B,A);A="matrix("+[B.a,B.b,B.c,B.d,B.e,B.f].join(",")+")";H.setAttribute(fa+"Transform",A)}}if(E>=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;B=X(h,E-3,E-1).matrix;h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E==4&&h.getItem(E- if(!svgedit.browser.isWebkit())if((I=e.getAttribute("fill"))&&I.indexOf("url(")===0){I=P(I);fa="pattern";if(I.tagName!==fa)fa="gradient";if(I.getAttribute(fa+"Units")==="userSpaceOnUse"){B=X(h).matrix;A=R(I);A=X(A).matrix;B=ga(B,A);A="matrix("+[B.a,B.b,B.c,B.d,B.e,B.f].join(",")+")";I.setAttribute(fa+"Transform",A)}}if(E>=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;B=X(h,E-3,E-1).matrix;h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E==4&&h.getItem(E-
1).type==1){k=3;B=X(h).matrix;W=c.createSVGTransform();W.setMatrix(B);h.clear();h.appendItem(W);B=c.createSVGMatrix()}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;H=h.getItem(0).matrix;fa=X(h,1).matrix;A=fa.inverse();B=ga(A,H,fa);h.removeItem(0)}else if(E==1&&h.getItem(0).type==1&&!G){B=X(h).matrix;switch(e.tagName){case "line":D=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":D.points=e.getAttribute("points");if(D.points){A=e.points;F=A.numberOfItems;D.points= 1).type==1){k=3;B=X(h).matrix;W=c.createSVGTransform();W.setMatrix(B);h.clear();h.appendItem(W);B=c.createSVGMatrix()}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;I=h.getItem(0).matrix;fa=X(h,1).matrix;A=fa.inverse();B=ga(A,I,fa);h.removeItem(0)}else if(E==1&&h.getItem(0).type==1&&!G){B=X(h).matrix;switch(e.tagName){case "line":D=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":D.points=e.getAttribute("points");if(D.points){A=e.points;F=A.numberOfItems;D.points=
Array(F);for(k=0;k<F;++k){n=A.getItem(k);D.points[k]={x:n.x,y:n.y}}}case "path":D.d=e.getAttribute("d");k=1;h.clear()}}else{k=4;if(G){o=c.createSVGTransform();o.setRotate(G,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(k==1||k==2||k==3)Za(e,D,B);if(k==2){if(G){na(h)||(w={x:o.x+B.e,y:o.y+B.f});o=c.createSVGTransform();o.setRotate(G,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else if(k==3&&G){B= Array(F);for(k=0;k<F;++k){n=A.getItem(k);D.points[k]={x:n.x,y:n.y}}}case "path":D.d=e.getAttribute("d");k=1;h.clear()}}else{k=4;if(G){o=c.createSVGTransform();o.setRotate(G,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(k==1||k==2||k==3)Za(e,D,B);if(k==2){if(G){oa(h)||(w={x:o.x+B.e,y:o.y+B.f});o=c.createSVGTransform();o.setRotate(G,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else if(k==3&&G){B=
X(h).matrix;H=c.createSVGTransform();H.setRotate(G,o.x,o.y);H=H.matrix;o=c.createSVGTransform();o.setRotate(G,w.x,w.y);w=o.matrix.inverse();fa=B.inverse();w=ga(fa,w,H,B);Za(e,D,w);if(G)h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}h.numberOfItems==0&&e.removeAttribute("transform");l.addSubCommand(new Ma(e,z));return l},mb=null,Ia=this.clearSelection=function(e){if(I[0]!=null)for(var h=I.length,l=0;l<h;++l){var B=I[l];if(B==null)break;ra.releaseSelector(B);I[l]=null}e||M("selected",I)}, X(h).matrix;I=c.createSVGTransform();I.setRotate(G,o.x,o.y);I=I.matrix;o=c.createSVGTransform();o.setRotate(G,w.x,w.y);w=o.matrix.inverse();fa=B.inverse();w=ga(fa,w,I,B);Za(e,D,w);if(G)h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}h.numberOfItems==0&&e.removeAttribute("transform");l.addSubCommand(new Ma(e,z));return l},mb=null,Ia=this.clearSelection=function(e){if(H[0]!=null)for(var h=H.length,l=0;l<h;++l){var B=H[l];if(B==null)break;ra.releaseSelector(B);H[l]=null}e||M("selected",H)},
qb=this.addToSelection=function(e,h){if(e.length!=0){for(var l=0;l<I.length;){if(I[l]==null)break;++l}for(var B=e.length;B--;){var A=e[B];if(A&&svgedit.utilities.getBBox(A)){if(A.tagName==="a"&&A.childNodes.length===1)A=A.firstChild;if(I.indexOf(A)==-1){I[l]=A;l++;A=ra.requestSelector(A);I.length>1&&A.showGrips(false)}}}M("selected",I);h||I.length==1?ra.requestSelector(I[0]).showGrips(true):ra.requestSelector(I[0]).showGrips(false);for(I.sort(function(G,D){if(G&&D&&G.compareDocumentPosition)return 3- qb=this.addToSelection=function(e,h){if(e.length!=0){for(var l=0;l<H.length;){if(H[l]==null)break;++l}for(var B=e.length;B--;){var A=e[B];if(A&&svgedit.utilities.getBBox(A)){if(A.tagName==="a"&&A.childNodes.length===1)A=A.firstChild;if(H.indexOf(A)==-1){H[l]=A;l++;A=ra.requestSelector(A);H.length>1&&A.showGrips(false)}}}M("selected",H);h||H.length==1?ra.requestSelector(H[0]).showGrips(true):ra.requestSelector(H[0]).showGrips(false);for(H.sort(function(G,D){if(G&&D&&G.compareDocumentPosition)return 3-
(D.compareDocumentPosition(G)&6);else if(G==null)return 1});I[0]==null;)I.shift(0)}},rb=this.selectOnly=function(e,h){Ia(true);qb(e,h)};this.removeFromSelection=function(e){if(I[0]!=null)if(e.length!=0){var h=Array(I.length);j=0;len=I.length;for(var l=0;l<len;++l){var B=I[l];if(B)if(e.indexOf(B)==-1){h[j]=B;j++}else ra.releaseSelector(B)}I=h}};this.selectAllInCurrentLayer=function(){var e=C().getCurrentLayer();if(e){Fa="select";rb($(L||e).children())}};var Bb=this.getMouseTarget=function(e){if(e== (D.compareDocumentPosition(G)&6);else if(G==null)return 1});H[0]==null;)H.shift(0)}},rb=this.selectOnly=function(e,h){Ia(true);qb(e,h)};this.removeFromSelection=function(e){if(H[0]!=null)if(e.length!=0){var h=Array(H.length);j=0;len=H.length;for(var l=0;l<len;++l){var B=H[l];if(B)if(e.indexOf(B)==-1){h[j]=B;j++}else ra.releaseSelector(B)}H=h}};this.selectAllInCurrentLayer=function(){var e=C().getCurrentLayer();if(e){Fa="select";rb($(L||e).children())}};var Bb=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 c}var h=C().getCurrentLayer();if([c,a,m,h].indexOf(e)>=0)return c;if($(e).closest("#selectorParentGroup").length)return ra.selectorParentGroup;for(;e.parentNode!==(L||h);)e=e.parentNode;return e};(function(){var e=null,h=null,l=null,B= 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 c}var h=C().getCurrentLayer();if([c,a,m,h].indexOf(e)>=0)return c;if($(e).closest("#selectorParentGroup").length)return ra.selectorParentGroup;for(;e.parentNode!==(L||h);)e=e.parentNode;return e};(function(){var e=null,h=null,l=null,B=
null,A=null,G={},D={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(z){if(!d.spaceKey){var F=z.button===2;mb=m.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);z.preventDefault();if(F)Fa="select";n=n/s;k=k/s;var o=Bb(z);if(o.tagName==="a"&&o.childNodes.length===1)o=o.firstChild;var w=B=h=n,E=A=l=k;if(p.gridSnapping){n=va(n);k=va(k);h=va(h);l=va(l)}if(o==ra.selectorParentGroup&&I[0]!=null){o= null,A=null,G={},D={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(z){if(!d.spaceKey){var F=z.button===2;mb=m.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);z.preventDefault();if(F)Fa="select";n=n/s;k=k/s;var o=Bb(z);if(o.tagName==="a"&&o.childNodes.length===1)o=o.firstChild;var w=B=h=n,E=A=l=k;if(p.gridSnapping){n=va(n);k=va(k);h=va(h);l=va(l)}if(o==ra.selectorParentGroup&&H[0]!=null){o=
z.target;var H=cb(o,"type");if(H=="rotate"){Fa="rotate";current_rotate_mode=cb(o,"dir")}else if(H=="resize"){Fa="resize";db=cb(o,"dir")}o=I[0]}Sa=o.getAttribute("transform");H=S(o);switch(Fa){case "select":Ka=true;db="none";if(F)Ka=false;if(o!=c){if(I.indexOf(o)==-1){z.shiftKey||Ia(true);qb([o]);wb=o;La.clear()}if(!F)for(F=0;F<I.length;++F)if(I[F]!=null){var J=S(I[F]);J.numberOfItems?J.insertItemBefore(c.createSVGTransform(),0):J.appendItem(c.createSVGTransform())}}else if(!F){Ia();Fa="multiselect"; z.target;var I=cb(o,"type");if(I=="rotate"){Fa="rotate";current_rotate_mode=cb(o,"dir")}else if(I=="resize"){Fa="resize";db=cb(o,"dir")}o=H[0]}Sa=o.getAttribute("transform");I=R(o);switch(Fa){case "select":Ka=true;db="none";if(F)Ka=false;if(o!=c){if(H.indexOf(o)==-1){z.shiftKey||Ia(true);qb([o]);wb=o;La.clear()}if(!F)for(F=0;F<H.length;++F)if(H[F]!=null){var J=R(H[F]);J.numberOfItems?J.insertItemBefore(c.createSVGTransform(),0):J.appendItem(c.createSVGTransform())}}else if(!F){Ia();Fa="multiselect";
if(sa==null)sa=ra.getRubberBandBox();B*=s;A*=s;ma(sa,{x:B,y:A,width:0,height:0,display:"inline"},100)}break;case "zoom":Ka=true;if(sa==null)sa=ra.getRubberBandBox();ma(sa,{x:w*s,y:w*s,width:0,height:0,display:"inline"},100);break;case "resize":Ka=true;h=n;l=k;G=svgedit.utilities.getBBox($("#selectedBox0")[0]);var O={};$.each(G,function(Y,da){O[Y]=da/s});G=O;F=oa(o)?1:0;if(na(H)){H.insertItemBefore(c.createSVGTransform(),F);H.insertItemBefore(c.createSVGTransform(),F);H.insertItemBefore(c.createSVGTransform(), if(sa==null)sa=ra.getRubberBandBox();B*=s;A*=s;ma(sa,{x:B,y:A,width:0,height:0,display:"inline"},100)}break;case "zoom":Ka=true;if(sa==null)sa=ra.getRubberBandBox();ma(sa,{x:w*s,y:w*s,width:0,height:0,display:"inline"},100);break;case "resize":Ka=true;h=n;l=k;G=svgedit.utilities.getBBox($("#selectedBox0")[0]);var O={};$.each(G,function(Y,da){O[Y]=da/s});G=O;F=na(o)?1:0;if(oa(I)){I.insertItemBefore(c.createSVGTransform(),F);I.insertItemBefore(c.createSVGTransform(),F);I.insertItemBefore(c.createSVGTransform(),
F)}else{H.appendItem(c.createSVGTransform());H.appendItem(c.createSVGTransform());H.appendItem(c.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(n=svgedit.browser.isChrome())J=function(Y){var da=Y.getAttributeNS(null,"stroke");Y.removeAttributeNS(null,"stroke");setTimeout(function(){Y.setAttributeNS(null,"stroke",da)},1)};o.style.vectorEffect="non-scaling-stroke";n&&J(o);k=o.getElementsByTagName("*");w=k.length;for(F=0;F<w;F++){k[F].style.vectorEffect="non-scaling-stroke"; F)}else{I.appendItem(c.createSVGTransform());I.appendItem(c.createSVGTransform());I.appendItem(c.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(n=svgedit.browser.isChrome())J=function(Y){var da=Y.getAttributeNS(null,"stroke");Y.removeAttributeNS(null,"stroke");setTimeout(function(){Y.setAttributeNS(null,"stroke",da)},1)};o.style.vectorEffect="non-scaling-stroke";n&&J(o);k=o.getElementsByTagName("*");w=k.length;for(F=0;F<w;F++){k[F].style.vectorEffect="non-scaling-stroke";
n&&J(k[F])}}}break;case "fhellipse":case "fhrect":case "fhpath":Ka=true;e=w+","+E+" ";J=K.stroke_width==0?1:K.stroke_width;Q({element:"polyline",curStyles:true,attr:{points:e,id:ka(),fill:"none",opacity:K.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});D.minx=w;D.maxx=w;D.miny=E;D.maxy=E;break;case "image":Ka=true;J=Q({element:"image",attr:{x:n,y:k,width:0,height:0,id:ka(),opacity:K.opacity/2,style:"pointer-events:inherit"}});T(J,Ea);Fb(J);break;case "square":case "rect":Ka=true; n&&J(k[F])}}}break;case "fhellipse":case "fhrect":case "fhpath":Ka=true;e=w+","+E+" ";J=K.stroke_width==0?1:K.stroke_width;S({element:"polyline",curStyles:true,attr:{points:e,id:ka(),fill:"none",opacity:K.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});D.minx=w;D.maxx=w;D.miny=E;D.maxy=E;break;case "image":Ka=true;J=S({element:"image",attr:{x:n,y:k,width:0,height:0,id:ka(),opacity:K.opacity/2,style:"pointer-events:inherit"}});T(J,Ea);Fb(J);break;case "square":case "rect":Ka=true;
h=n;l=k;Q({element:"rect",curStyles:true,attr:{x:n,y:k,width:0,height:0,id:ka(),opacity:K.opacity/2}});break;case "line":Ka=true;J=K.stroke_width==0?1:K.stroke_width;Q({element:"line",curStyles:true,attr:{x1:n,y1:k,x2:n,y2:k,id:ka(),stroke:K.stroke,"stroke-width":J,"stroke-dasharray":K.stroke_dasharray,"stroke-linejoin":K.stroke_linejoin,"stroke-linecap":K.stroke_linecap,"stroke-opacity":K.stroke_opacity,fill:"none",opacity:K.opacity/2,style:"pointer-events:none"}});break;case "circle":Ka=true;Q({element:"circle", h=n;l=k;S({element:"rect",curStyles:true,attr:{x:n,y:k,width:0,height:0,id:ka(),opacity:K.opacity/2}});break;case "line":Ka=true;J=K.stroke_width==0?1:K.stroke_width;S({element:"line",curStyles:true,attr:{x1:n,y1:k,x2:n,y2:k,id:ka(),stroke:K.stroke,"stroke-width":J,"stroke-dasharray":K.stroke_dasharray,"stroke-linejoin":K.stroke_linejoin,"stroke-linecap":K.stroke_linecap,"stroke-opacity":K.stroke_opacity,fill:"none",opacity:K.opacity/2,style:"pointer-events:none"}});break;case "circle":Ka=true;S({element:"circle",
curStyles:true,attr:{cx:n,cy:k,r:0,id:ka(),opacity:K.opacity/2}});break;case "ellipse":Ka=true;Q({element:"ellipse",curStyles:true,attr:{cx:n,cy:k,rx:0,ry:0,id:ka(),opacity:K.opacity/2}});break;case "text":Ka=true;Q({element:"text",curStyles:true,attr:{x:n,y:k,id:ka(),fill:Ua.fill,"stroke-width":Ua.stroke_width,"font-size":Ua.font_size,"font-family":Ua.font_family,"text-anchor":"left","xml:space":"preserve",opacity:K.opacity}});break;case "path":case "pathedit":h*=s;l*=s;La.mouseDown(z,o,h,l);Ka= curStyles:true,attr:{cx:n,cy:k,r:0,id:ka(),opacity:K.opacity/2}});break;case "ellipse":Ka=true;S({element:"ellipse",curStyles:true,attr:{cx:n,cy:k,rx:0,ry:0,id:ka(),opacity:K.opacity/2}});break;case "text":Ka=true;S({element:"text",curStyles:true,attr:{x:n,y:k,id:ka(),fill:Ua.fill,"stroke-width":Ua.stroke_width,"font-size":Ua.font_size,"font-family":Ua.font_family,"text-anchor":"left","xml:space":"preserve",opacity:K.opacity}});break;case "path":case "pathedit":h*=s;l*=s;La.mouseDown(z,o,h,l);Ka=
true;break;case "textedit":h*=s;l*=s;bb.mouseDown(z,o,h,l);Ka=true;break;case "rotate":Ka=true;d.undoMgr.beginUndoableChange("transform",I);document.getElementById("workarea").className="rotate"}J=ib("mouseDown",{event:z,start_x:h,start_y:l,selectedElements:I},true);$.each(J,function(Y,da){if(da&&da.started)Ka=true});if(Fa)document.getElementById("workarea").className=Fa=="resize"?z.target.style.cursor:Fa}}).mousemove(function(z){if(!(z.originalEvent.touches&&z.originalEvent.touches.length>1))if(Ka)if(!(z.button=== true;break;case "textedit":h*=s;l*=s;bb.mouseDown(z,o,h,l);Ka=true;break;case "rotate":Ka=true;d.undoMgr.beginUndoableChange("transform",H);document.getElementById("workarea").className="rotate"}J=ib("mouseDown",{event:z,start_x:h,start_y:l,selectedElements:H},true);$.each(J,function(Y,da){if(da&&da.started)Ka=true});if(Fa)document.getElementById("workarea").className=Fa=="resize"?z.target.style.cursor:Fa}}).mousemove(function(z){if(!(z.originalEvent.touches&&z.originalEvent.touches.length>1))if(Ka)if(!(z.button===
1||d.spaceKey)){var F=I[0],k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);var o=pa(aa()),w=x=n/s,E=y=k/s;if(p.gridSnapping){x=va(x);y=va(y)}z.preventDefault();switch(Fa){case "select":if(I[0]!==null){w=x-h;var H=y-l;if(p.gridSnapping){w=va(w);H=va(H)}if(z.shiftKey){var J=U(h,l,x,y);x=J.x;y=J.y}if(w!=0||H!=0){E=I.length;for(var O=0;O<E;++O){F=I[O];if(F==null)break;var Y=c.createSVGTransform();o=S(F);if(J){w=J.x-h;H=J.y-l}Y.setTranslate(w,H);o.numberOfItems?o.replaceItem(Y, 1||d.spaceKey)){var F=H[0],k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);var o=pa(aa()),w=x=n/s,E=y=k/s;if(p.gridSnapping){x=va(x);y=va(y)}z.preventDefault();switch(Fa){case "select":if(H[0]!==null){w=x-h;var I=y-l;if(p.gridSnapping){w=va(w);I=va(I)}if(z.shiftKey){var J=U(h,l,x,y);x=J.x;y=J.y}if(w!=0||I!=0){E=H.length;for(var O=0;O<E;++O){F=H[O];if(F==null)break;var Y=c.createSVGTransform();o=R(F);if(J){w=J.x-h;I=J.y-l}Y.setTranslate(w,I);o.numberOfItems?o.replaceItem(Y,
0):o.appendItem(Y);ra.requestSelector(F).resize()}if(z.altKey)if(!d.addClones){d.addClones=d.cloneSelectedElements(0,0,Y);d.removeClones=function(){d.addClones&&d.addClones.forEach(function(ua){ua.parentNode&&ua.parentNode.removeChild(ua);d.addClones=false})};window.addEventListener("keyup",d.removeClones)}M("transition",I)}}break;case "multiselect":w*=s;E*=s;ma(sa,{x:Math.min(B,w),y:Math.min(A,E),width:Math.abs(w-B),height:Math.abs(E-A)},100);o=[];w=[];J=ob();E=I.length;for(O=0;O<E;++O){H=J.indexOf(I[O]); 0):o.appendItem(Y);ra.requestSelector(F).resize()}if(z.altKey)if(!d.addClones){d.addClones=d.cloneSelectedElements(0,0,Y);d.removeClones=function(){d.addClones&&d.addClones.forEach(function(ua){ua.parentNode&&ua.parentNode.removeChild(ua);d.addClones=false})};window.addEventListener("keyup",d.removeClones)}M("transition",H)}}break;case "multiselect":w*=s;E*=s;ma(sa,{x:Math.min(B,w),y:Math.min(A,E),width:Math.abs(w-B),height:Math.abs(E-A)},100);o=[];w=[];J=ob();E=H.length;for(O=0;O<E;++O){I=J.indexOf(H[O]);
if(H==-1)o.push(I[O]);else J[H]=null}E=J.length;for(O=0;O<E;++O)J[O]&&w.push(J[O]);o.length>0&&d.removeFromSelection(o);w.length>0&&qb(w);break;case "resize":o=S(F);w=(J=na(o))?G:svgedit.utilities.getBBox(F);E=w.x;O=w.y;var da=w.width,V=w.height;w=x-h;H=y-l;if(p.gridSnapping){w=va(w);H=va(H);V=va(V);da=va(da)}if(Y=oa(F)){var fa=Math.sqrt(w*w+H*H);H=Math.atan2(H,w)-Y*Math.PI/180;w=fa*Math.cos(H);H=fa*Math.sin(H)}if(db.indexOf("n")==-1&&db.indexOf("s")==-1)H=0;if(db.indexOf("e")==-1&&db.indexOf("w")== if(I==-1)o.push(H[O]);else J[I]=null}E=J.length;for(O=0;O<E;++O)J[O]&&w.push(J[O]);o.length>0&&d.removeFromSelection(o);w.length>0&&qb(w);break;case "resize":o=R(F);w=(J=oa(o))?G:svgedit.utilities.getBBox(F);E=w.x;O=w.y;var da=w.width,V=w.height;w=x-h;I=y-l;if(p.gridSnapping){w=va(w);I=va(I);V=va(V);da=va(da)}if(Y=na(F)){var fa=Math.sqrt(w*w+I*I);I=Math.atan2(I,w)-Y*Math.PI/180;w=fa*Math.cos(I);I=fa*Math.sin(I)}if(db.indexOf("n")==-1&&db.indexOf("s")==-1)I=0;if(db.indexOf("e")==-1&&db.indexOf("w")==
-1)w=0;var ha=fa=0,W=V?(V+H)/V:1,qa=da?(da+w)/da:1;if(db.indexOf("n")>=0){W=V?(V-H)/V:1;ha=V}if(db.indexOf("w")>=0){qa=da?(da-w)/da:1;fa=da}w=c.createSVGTransform();H=c.createSVGTransform();da=c.createSVGTransform();if(p.gridSnapping){E=va(E);fa=va(fa);O=va(O);ha=va(ha)}w.setTranslate(-(E+fa),-(O+ha));if(z.shiftKey)if(qa==1)qa=W;else W=qa;H.setScale(qa,W);da.setTranslate(E+fa,O+ha);if(J){J=Y?1:0;o.replaceItem(w,2+J);o.replaceItem(H,1+J);o.replaceItem(da,0+J)}else{J=o.numberOfItems;o.replaceItem(da, -1)w=0;var ha=fa=0,W=V?(V+I)/V:1,qa=da?(da+w)/da:1;if(db.indexOf("n")>=0){W=V?(V-I)/V:1;ha=V}if(db.indexOf("w")>=0){qa=da?(da-w)/da:1;fa=da}w=c.createSVGTransform();I=c.createSVGTransform();da=c.createSVGTransform();if(p.gridSnapping){E=va(E);fa=va(fa);O=va(O);ha=va(ha)}w.setTranslate(-(E+fa),-(O+ha));if(z.shiftKey)if(qa==1)qa=W;else W=qa;I.setScale(qa,W);da.setTranslate(E+fa,O+ha);if(J){J=Y?1:0;o.replaceItem(w,2+J);o.replaceItem(I,1+J);o.replaceItem(da,0+J)}else{J=o.numberOfItems;o.replaceItem(da,
J-3);o.replaceItem(H,J-2);o.replaceItem(w,J-1)}ra.requestSelector(F).resize();M("transition",I);break;case "zoom":w*=s;E*=s;ma(sa,{x:Math.min(B*s,w),y:Math.min(A*s,E),width:Math.abs(w-B*s),height:Math.abs(E-A*s)},100);break;case "text":ma(o,{x:x,y:y},1E3);break;case "line":w=null;window.opera||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);y=va(y)}E=x;J=y;if(z.shiftKey){J=U(h,l,E,J);E=J.x;J=J.y}o.setAttributeNS(null,"x2",E);o.setAttributeNS(null,"y2",J);window.opera||c.unsuspendRedraw(w);break;case "foreignObject":case "square":case "rect":case "image":w= J-3);o.replaceItem(I,J-2);o.replaceItem(w,J-1)}ra.requestSelector(F).resize();M("transition",H);break;case "zoom":w*=s;E*=s;ma(sa,{x:Math.min(B*s,w),y:Math.min(A*s,E),width:Math.abs(w-B*s),height:Math.abs(E-A*s)},100);break;case "text":ma(o,{x:x,y:y},1E3);break;case "line":w=null;window.opera||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);y=va(y)}E=x;J=y;if(z.shiftKey){J=U(h,l,E,J);E=J.x;J=J.y}o.setAttributeNS(null,"x2",E);o.setAttributeNS(null,"y2",J);window.opera||c.unsuspendRedraw(w);break;case "foreignObject":case "square":case "rect":case "image":w=
Math.abs(x-h);J=Math.abs(y-l);if(Fa=="square"||z.shiftKey){w=J=Math.max(w,J);E=h<x?h:h-w;O=l<y?l:l-J}else{E=Math.min(h,x);O=Math.min(l,y)}if(z.altKey){w*=2;J*=2;E=h-w/2;O=l-J/2}if(p.gridSnapping){w=va(w);J=va(J);E=va(E);O=va(O)}ma(o,{width:w,height:J,x:E,y:O},1E3);break;case "circle":w=$(o).attr(["cx","cy"]);J=w.cx;E=w.cy;w=Math.sqrt((x-J)*(x-J)+(y-E)*(y-E));if(p.gridSnapping)w=va(w);o.setAttributeNS(null,"r",w);break;case "ellipse":w=$(o).attr(["cx","cy"]);J=Math.abs(h+(x-h)/2);E=Math.abs(l+(y-l)/ Math.abs(x-h);J=Math.abs(y-l);if(Fa=="square"||z.shiftKey){w=J=Math.max(w,J);E=h<x?h:h-w;O=l<y?l:l-J}else{E=Math.min(h,x);O=Math.min(l,y)}if(z.altKey){w*=2;J*=2;E=h-w/2;O=l-J/2}if(p.gridSnapping){w=va(w);J=va(J);E=va(E);O=va(O)}ma(o,{width:w,height:J,x:E,y:O},1E3);break;case "circle":w=$(o).attr(["cx","cy"]);J=w.cx;E=w.cy;w=Math.sqrt((x-J)*(x-J)+(y-E)*(y-E));if(p.gridSnapping)w=va(w);o.setAttributeNS(null,"r",w);break;case "ellipse":w=$(o).attr(["cx","cy"]);J=Math.abs(h+(x-h)/2);E=Math.abs(l+(y-l)/
2);w=null;window.opera||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);J=va(J);y=va(y);E=va(E)}O=Math.abs(h-J);H=Math.abs(l-E);if(z.shiftKey){H=O;E=y>l?l+O:l-O}if(z.altKey){J=h;E=l;O=Math.abs(x-J);H=z.shiftKey?O:Math.abs(y-E)}o.setAttributeNS(null,"rx",O);o.setAttributeNS(null,"ry",H);o.setAttributeNS(null,"cx",J);o.setAttributeNS(null,"cy",E);window.opera||c.unsuspendRedraw(w);break;case "fhellipse":case "fhrect":D.minx=Math.min(w,D.minx);D.maxx=Math.max(w,D.maxx);D.miny=Math.min(E,D.miny);D.maxy= 2);w=null;window.opera||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);J=va(J);y=va(y);E=va(E)}O=Math.abs(h-J);I=Math.abs(l-E);if(z.shiftKey){I=O;E=y>l?l+O:l-O}if(z.altKey){J=h;E=l;O=Math.abs(x-J);I=z.shiftKey?O:Math.abs(y-E)}o.setAttributeNS(null,"rx",O);o.setAttributeNS(null,"ry",I);o.setAttributeNS(null,"cx",J);o.setAttributeNS(null,"cy",E);window.opera||c.unsuspendRedraw(w);break;case "fhellipse":case "fhrect":D.minx=Math.min(w,D.minx);D.maxx=Math.max(w,D.maxx);D.miny=Math.min(E,D.miny);D.maxy=
Math.max(E,D.maxy);case "fhpath":e+=+w+","+E+" ";o.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=s;y*=s;if(p.gridSnapping){x=va(x);y=va(y);h=va(h);l=va(l)}if(z.shiftKey){if(J=svgedit.path.path){o=J.dragging?J.dragging[0]:h;J=J.dragging?J.dragging[1]:l}else{o=h;J=l}J=U(o,J,x,y);x=J.x;y=J.y}if(sa&&sa.getAttribute("display")!=="none"){w*=s;E*=s;ma(sa,{x:Math.min(B*s,w),y:Math.min(A*s,E),width:Math.abs(w-B*s),height:Math.abs(E-A*s)},100)}La.mouseMove(z,x,y);break;case "textedit":x*= Math.max(E,D.maxy);case "fhpath":e+=+w+","+E+" ";o.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=s;y*=s;if(p.gridSnapping){x=va(x);y=va(y);h=va(h);l=va(l)}if(z.shiftKey){if(J=svgedit.path.path){o=J.dragging?J.dragging[0]:h;J=J.dragging?J.dragging[1]:l}else{o=h;J=l}J=U(o,J,x,y);x=J.x;y=J.y}if(sa&&sa.getAttribute("display")!=="none"){w*=s;E*=s;ma(sa,{x:Math.min(B*s,w),y:Math.min(A*s,E),width:Math.abs(w-B*s),height:Math.abs(E-A*s)},100)}La.mouseMove(z,x,y);break;case "textedit":x*=
s;y*=s;bb.mouseMove(n,k);break;case "rotate":w=svgedit.utilities.getBBox(F);J=w.x+w.width/2;E=w.y+w.height/2;o=ea(F);o=N(J,E,o);J=o.x;E=o.y;o=w.x;O=w.y;if(current_rotate_mode=="nw")o=w.x+w.width;if(current_rotate_mode=="se")O=w.y+w.height;if(current_rotate_mode=="sw"){o=w.x+w.width;O=w.y+w.height}compensation_angle=(Math.atan2(E-O,J-o)*(180/Math.PI)-90)%360;Y=(Math.atan2(E-y,J-x)*(180/Math.PI)-90)%360;Y+=compensation_angle;if(p.gridSnapping)Y=va(Y);if(z.shiftKey)Y=Math.round(Y/45)*45;d.setRotationAngle(Y< s;y*=s;bb.mouseMove(n,k);break;case "rotate":w=svgedit.utilities.getBBox(F);J=w.x+w.width/2;E=w.y+w.height/2;o=ea(F);o=N(J,E,o);J=o.x;E=o.y;o=w.x;O=w.y;if(current_rotate_mode=="nw")o=w.x+w.width;if(current_rotate_mode=="se")O=w.y+w.height;if(current_rotate_mode=="sw"){o=w.x+w.width;O=w.y+w.height}compensation_angle=(Math.atan2(E-O,J-o)*(180/Math.PI)-90)%360;Y=(Math.atan2(E-y,J-x)*(180/Math.PI)-90)%360;Y+=compensation_angle;if(p.gridSnapping)Y=va(Y);if(z.shiftKey)Y=Math.round(Y/45)*45;d.setRotationAngle(Y<
-180?360+Y:Y,true);M("transition",I)}ib("mouseMove",{event:z,mouse_x:n,mouse_y:k,selected:F})}}).click(function(z){z.preventDefault();return false}).dblclick(function(z){var F=z.target.parentNode;if(F!==L){var k=Bb(z),n=k.tagName;if(n==="text"&&Fa!=="textedit"){z=N(z.pageX,z.pageY,mb);bb.select(k,z.x,z.y)}if((n==="g"||n==="a")&&oa(k)){Db(k);k=I[0];Ia(true)}L&&Eb();F.tagName!=="g"&&F.tagName!=="a"||F===C().getCurrentLayer()||k===ra.selectorParentGroup||Kb(k)}}).mouseup(function(z){d.addClones=false; -180?360+Y:Y,true);M("transition",H)}ib("mouseMove",{event:z,mouse_x:n,mouse_y:k,selected:F})}}).click(function(z){z.preventDefault();return false}).dblclick(function(z){var F=z.target.parentNode;if(F!==L){var k=Bb(z),n=k.tagName;if(n==="text"&&Fa!=="textedit"){z=N(z.pageX,z.pageY,mb);bb.select(k,z.x,z.y)}if((n==="g"||n==="a")&&na(k)){Db(k);k=H[0];Ia(true)}L&&Eb();F.tagName!=="g"&&F.tagName!=="a"||F===C().getCurrentLayer()||k===ra.selectorParentGroup||Kb(k)}}).mouseup(function(z){d.addClones=false;
window.removeEventListener("keyup",d.removeClones);I=I.filter(Boolean);if(z.button!==2){var F=wb;wb=null;if(Ka){var k=N(z.pageX,z.pageY,mb),n=k.x*s;k=k.y*s;var o=n/s,w=k/s,E=pa(aa()),H=false;Ka=false;switch(Fa){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");hb=[]}Fa="select";case "select":if(I[0]!=null){if(I.length==1){n=I[0];switch(n.tagName){case "g":case "use":case "image":case "foreignObject":break;default:Xa.fill=n.getAttribute("fill");Xa.fill_opacity=n.getAttribute("fill-opacity"); window.removeEventListener("keyup",d.removeClones);H=H.filter(Boolean);if(z.button!==2){var F=wb;wb=null;if(Ka){var k=N(z.pageX,z.pageY,mb),n=k.x*s;k=k.y*s;var o=n/s,w=k/s,E=pa(aa()),I=false;Ka=false;switch(Fa){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");hb=[]}Fa="select";case "select":if(H[0]!=null){if(H.length==1){n=H[0];switch(n.tagName){case "g":case "use":case "image":case "foreignObject":break;default:Xa.fill=n.getAttribute("fill");Xa.fill_opacity=n.getAttribute("fill-opacity");
Xa.stroke=n.getAttribute("stroke");Xa.stroke_opacity=n.getAttribute("stroke-opacity");Xa.stroke_width=n.getAttribute("stroke-width");Xa.stroke_dasharray=n.getAttribute("stroke-dasharray");Xa.stroke_linejoin=n.getAttribute("stroke-linejoin");Xa.stroke_linecap=n.getAttribute("stroke-linecap")}if(n.tagName=="text"){Ua.font_size=n.getAttribute("font-size");Ua.font_family=n.getAttribute("font-family")}ra.requestSelector(n).showGrips(true)}Da();if(o!=B||w!=A){z=I.length;for(n=0;n<z;++n){if(I[n]==null)break; Xa.stroke=n.getAttribute("stroke");Xa.stroke_opacity=n.getAttribute("stroke-opacity");Xa.stroke_width=n.getAttribute("stroke-width");Xa.stroke_dasharray=n.getAttribute("stroke-dasharray");Xa.stroke_linejoin=n.getAttribute("stroke-linejoin");Xa.stroke_linecap=n.getAttribute("stroke-linecap")}if(n.tagName=="text"){Ua.font_size=n.getAttribute("font-size");Ua.font_family=n.getAttribute("font-family")}ra.requestSelector(n).showGrips(true)}Da();if(o!=B||w!=A){z=H.length;for(n=0;n<z;++n){if(H[n]==null)break;
I[n].firstChild||ra.requestSelector(I[n]).resize()}}else{n=z.target;if(I[0].nodeName==="path"&&I[1]==null)La.select(I[0]);else z.shiftKey&&F!=n&&d.removeFromSelection([n])}if(svgedit.browser.supportsNonScalingStroke())if(z=I[0]){z.removeAttribute("style");svgedit.utilities.walkTree(z,function(Y){Y.removeAttribute("style")})}}return;case "zoom":sa!=null&&sa.setAttribute("display","none");M("zoomed",{x:Math.min(B,o),y:Math.min(A,w),width:Math.abs(o-B),height:Math.abs(w-A),factor:z.altKey?0.5:2});return; H[n].firstChild||ra.requestSelector(H[n]).resize()}}else{n=z.target;if(H[0].nodeName==="path"&&H[1]==null)La.select(H[0]);else z.shiftKey&&F!=n&&d.removeFromSelection([n])}if(svgedit.browser.supportsNonScalingStroke())if(z=H[0]){z.removeAttribute("style");svgedit.utilities.walkTree(z,function(Y){Y.removeAttribute("style")})}}return;case "zoom":sa!=null&&sa.setAttribute("display","none");M("zoomed",{x:Math.min(B,o),y:Math.min(A,w),width:Math.abs(o-B),height:Math.abs(w-A),factor:z.altKey?0.5:2});return;
case "fhpath":F=E.getAttribute("points");o=F.indexOf(",");if(H=o>=0?F.indexOf(",",o+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)E=La.smoothPolylineIntoPath(E);break;case "line":F=$(E).attr(["x1","x2","y1","y2"]);H=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(E).attr(["width","height"]);H=F.width!=0||F.height!=0||Fa==="image";break;case "circle":H=E.getAttribute("r")!=0;break;case "ellipse":F=$(E).attr(["rx","ry"]);H=F.rx!=null||F.ry!=null;break;case "fhellipse":if(D.maxx- case "fhpath":F=E.getAttribute("points");o=F.indexOf(",");if(I=o>=0?F.indexOf(",",o+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)E=La.smoothPolylineIntoPath(E);break;case "line":F=$(E).attr(["x1","x2","y1","y2"]);I=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(E).attr(["width","height"]);I=F.width!=0||F.height!=0||Fa==="image";break;case "circle":I=E.getAttribute("r")!=0;break;case "ellipse":F=$(E).attr(["rx","ry"]);I=F.rx!=null||F.ry!=null;break;case "fhellipse":if(D.maxx-
D.minx>0&&D.maxy-D.miny>0){E=Q({element:"ellipse",curStyles:true,attr:{cx:(D.minx+D.maxx)/2,cy:(D.miny+D.maxy)/2,rx:(D.maxx-D.minx)/2,ry:(D.maxy-D.miny)/2,id:aa()}});M("changed",[E]);H=true}break;case "fhrect":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=Q({element:"rect",curStyles:true,attr:{x:D.minx,y:D.miny,width:D.maxx-D.minx,height:D.maxy-D.miny,id:aa()}});M("changed",[E]);H=true}break;case "text":H=true;rb([E]);bb.start(E);break;case "path":E=null;Ka=true;F=La.mouseUp(z,E,n,k);E=F.element;H=F.keep; D.minx>0&&D.maxy-D.miny>0){E=S({element:"ellipse",curStyles:true,attr:{cx:(D.minx+D.maxx)/2,cy:(D.miny+D.maxy)/2,rx:(D.maxx-D.minx)/2,ry:(D.maxy-D.miny)/2,id:aa()}});M("changed",[E]);I=true}break;case "fhrect":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=S({element:"rect",curStyles:true,attr:{x:D.minx,y:D.miny,width:D.maxx-D.minx,height:D.maxy-D.miny,id:aa()}});M("changed",[E]);I=true}break;case "text":I=true;rb([E]);bb.start(E);break;case "path":E=null;Ka=true;F=La.mouseUp(z,E,n,k);E=F.element;I=F.keep;
break;case "pathedit":H=true;E=null;La.mouseUp(z);break;case "textedit":H=false;E=null;bb.mouseUp(z,n,k);break;case "rotate":H=true;E=null;Fa="select";F=d.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Da();M("changed",I)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(Y,da){if(da){H=da.keep||H;E=da.element;Ka=da.started||Ka}});if(!H&&E!=null){C().releaseId(aa());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName=="g";)n=n.parentNode;if((Fa!= break;case "pathedit":I=true;E=null;La.mouseUp(z);break;case "textedit":I=false;E=null;bb.mouseUp(z,n,k);break;case "rotate":I=true;E=null;Fa="select";F=d.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Da();M("changed",H)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(Y,da){if(da){I=da.keep||I;E=da.element;Ka=da.started||Ka}});if(!I&&E!=null){C().releaseId(aa());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName=="g";)n=n.parentNode;if((Fa!=
"path"||!drawn_path)&&n.parentNode.id!="selectorParentGroup"&&n.id!="svgcanvas"&&n.id!="svgroot"){d.setMode("select");rb([n],true)}}else if(E!=null){d.addedNew=true;z=0.2;var J;if(false.beginElement&&E.getAttribute("opacity")!=K.opacity){J=$(false).clone().attr({to:K.opacity,dur:z}).appendTo(E);try{J[0].beginElement()}catch(O){}}else z=0;setTimeout(function(){J&&J.remove();E.setAttribute("opacity",K.opacity);E.setAttribute("style","pointer-events:inherit");la(E);if(Fa==="path")La.toEditMode(E);else p.selectNew&& "path"||!drawn_path)&&n.parentNode.id!="selectorParentGroup"&&n.id!="svgcanvas"&&n.id!="svgroot"){d.setMode("select");rb([n],true)}}else if(E!=null){d.addedNew=true;z=0.2;var J;if(false.beginElement&&E.getAttribute("opacity")!=K.opacity){J=$(false).clone().attr({to:K.opacity,dur:z}).appendTo(E);try{J[0].beginElement()}catch(O){}}else z=0;setTimeout(function(){J&&J.remove();E.setAttribute("opacity",K.opacity);E.setAttribute("style","pointer-events:inherit");la(E);if(Fa==="path")La.toEditMode(E);else p.selectNew&&
rb([E],true);wa(new Ha(E));M("changed",[E])},z*1E3)}Sa=null}}});$(a).bind("mousewheel DOMMouseScroll",function(z){if(z.shiftKey){z.preventDefault();mb=m.getScreenCTM().inverse();var F=N(z.pageX,z.pageY,mb);F={x:F.x,y:F.y,width:0,height:0};if(z.wheelDelta)if(z.wheelDelta>=120)F.factor=2;else{if(z.wheelDelta<=-120)F.factor=0.5}else if(z.detail)if(z.detail>0)F.factor=0.5;else if(z.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var Fb=function(e){$(e).click(function(h){h.preventDefault()})},bb=d.textActions= rb([E],true);wa(new Ha(E));M("changed",[E])},z*1E3)}Sa=null}}});$(a).bind("mousewheel DOMMouseScroll",function(z){if(z.shiftKey){z.preventDefault();mb=m.getScreenCTM().inverse();var F=N(z.pageX,z.pageY,mb);F={x:F.x,y:F.y,width:0,height:0};if(z.wheelDelta)if(z.wheelDelta>=120)F.factor=2;else{if(z.wheelDelta<=-120)F.factor=0.5}else if(z.detail)if(z.detail>0)F.factor=0.5;else if(z.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var Fb=function(e){$(e).click(function(h){h.preventDefault()})},bb=d.textActions=
function(){function e(V){var fa=k.value==="";$(k).focus();if(!arguments.length)if(fa)V=0;else{if(k.selectionEnd!==k.selectionStart)return;V=k.selectionEnd}var ha;ha=E[V];fa||k.setSelectionRange(V,V);n=pa("text_cursor");if(!n){n=document.createElementNS(b,"line");ma(n,{id:"text_cursor",stroke:"#333","stroke-width":1});n=pa("selectorParentGroup").appendChild(n)}w||(w=setInterval(function(){var W=n.getAttribute("display")==="none";n.setAttribute("display",W?"inline":"none")},600));fa=G(ha.x,H.y);ha= function(){function e(V){var fa=k.value==="";$(k).focus();if(!arguments.length)if(fa)V=0;else{if(k.selectionEnd!==k.selectionStart)return;V=k.selectionEnd}var ha;ha=E[V];fa||k.setSelectionRange(V,V);n=pa("text_cursor");if(!n){n=document.createElementNS(b,"line");ma(n,{id:"text_cursor",stroke:"#333","stroke-width":1});n=pa("selectorParentGroup").appendChild(n)}w||(w=setInterval(function(){var W=n.getAttribute("display")==="none";n.setAttribute("display",W?"inline":"none")},600));fa=G(ha.x,I.y);ha=
G(ha.x,H.y+H.height);ma(n,{x1:fa.x,y1:fa.y,x2:ha.x,y2:ha.y,visibility:"visible",display:"inline"});o&&o.setAttribute("d","M 0 0")}function h(V,fa,ha){if(V===fa)e(fa);else{ha||k.setSelectionRange(V,fa);o=pa("text_selectblock");if(!o){o=document.createElementNS(b,"path");ma(o,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(o)}V=E[V];var W=E[fa];n.setAttribute("visibility","hidden");fa=G(V.x,H.y);ha=G(V.x+(W.x-V.x),H.y);var qa=G(V.x, G(ha.x,I.y+I.height);ma(n,{x1:fa.x,y1:fa.y,x2:ha.x,y2:ha.y,visibility:"visible",display:"inline"});o&&o.setAttribute("d","M 0 0")}function h(V,fa,ha){if(V===fa)e(fa);else{ha||k.setSelectionRange(V,fa);o=pa("text_selectblock");if(!o){o=document.createElementNS(b,"path");ma(o,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(o)}V=E[V];var W=E[fa];n.setAttribute("visibility","hidden");fa=G(V.x,I.y);ha=G(V.x+(W.x-V.x),I.y);var qa=G(V.x,
H.y+H.height);V=G(V.x+(W.x-V.x),H.y+H.height);ma(o,{d:"M"+fa.x+","+fa.y+" L"+ha.x+","+ha.y+" "+V.x+","+V.y+" "+qa.x+","+qa.y+"z",display:"inline"})}}function l(V,fa){var ha=c.createSVGPoint();ha.x=V;ha.y=fa;if(E.length==1)return 0;ha=F.getCharNumAtPosition(ha);if(ha<0){ha=E.length-2;if(V<=E[0].x)ha=0}else if(ha>=E.length-2)ha=E.length-2;var W=E[ha];V>W.x+W.width/2&&ha++;return ha}function B(V,fa,ha){var W=k.selectionStart;V=l(V,fa);h(Math.min(W,V),Math.max(W,V),!ha)}function A(V,fa){var ha={x:V,y:fa}; I.y+I.height);V=G(V.x+(W.x-V.x),I.y+I.height);ma(o,{d:"M"+fa.x+","+fa.y+" L"+ha.x+","+ha.y+" "+V.x+","+V.y+" "+qa.x+","+qa.y+"z",display:"inline"})}}function l(V,fa){var ha=c.createSVGPoint();ha.x=V;ha.y=fa;if(E.length==1)return 0;ha=F.getCharNumAtPosition(ha);if(ha<0){ha=E.length-2;if(V<=E[0].x)ha=0}else if(ha>=E.length-2)ha=E.length-2;var W=E[ha];V>W.x+W.width/2&&ha++;return ha}function B(V,fa,ha){var W=k.selectionStart;V=l(V,fa);h(Math.min(W,V),Math.max(W,V),!ha)}function A(V,fa){var ha={x:V,y:fa};
ha.x/=s;ha.y/=s;if(J){var W=N(ha.x,ha.y,J.inverse());ha.x=W.x;ha.y=W.y}return ha}function G(V,fa){var ha={x:V,y:fa};if(J){var W=N(ha.x,ha.y,J);ha.x=W.x;ha.y=W.y}ha.x*=s;ha.y*=s;return ha}function D(V){h(0,F.textContent.length);$(this).unbind(V)}function z(V){if(da&&F){var fa=N(V.pageX,V.pageY,mb);fa=A(fa.x*s,fa.y*s);fa=l(fa.x,fa.y);var ha=F.textContent,W=ha.substr(0,fa).replace(/[a-z0-9]+$/i,"").length;ha=ha.substr(fa).match(/^[a-z0-9]+/i);h(W,(ha?ha[0].length:0)+fa);$(V.target).click(D);setTimeout(function(){$(V.target).unbind("click", ha.x/=s;ha.y/=s;if(J){var W=N(ha.x,ha.y,J.inverse());ha.x=W.x;ha.y=W.y}return ha}function G(V,fa){var ha={x:V,y:fa};if(J){var W=N(ha.x,ha.y,J);ha.x=W.x;ha.y=W.y}ha.x*=s;ha.y*=s;return ha}function D(V){h(0,F.textContent.length);$(this).unbind(V)}function z(V){if(da&&F){var fa=N(V.pageX,V.pageY,mb);fa=A(fa.x*s,fa.y*s);fa=l(fa.x,fa.y);var ha=F.textContent,W=ha.substr(0,fa).replace(/[a-z0-9]+$/i,"").length;ha=ha.substr(fa).match(/^[a-z0-9]+/i);h(W,(ha?ha[0].length:0)+fa);$(V.target).click(D);setTimeout(function(){$(V.target).unbind("click",
D)},300)}}var F,k,n,o,w,E=[],H,J,O,Y,da;return{select:function(V,fa,ha){F=V;bb.toEditMode(fa,ha)},start:function(V){F=V;bb.toEditMode()},mouseDown:function(V,fa,ha,W){V=A(ha,W);k.focus();e(l(V.x,V.y));O=ha;Y=W},mouseMove:function(V,fa){var ha=A(V,fa);B(ha.x,ha.y)},mouseUp:function(V,fa,ha){var W=A(fa,ha);B(W.x,W.y,true);V.target!==F&&fa<O+2&&fa>O-2&&ha<Y+2&&ha>Y-2&&bb.toSelectMode(true)},setCursor:e,toEditMode:function(V,fa){rb([F],false);da=false;Fa="textedit";ra.requestSelector(F).showGrips(false); D)},300)}}var F,k,n,o,w,E=[],I,J,O,Y,da;return{select:function(V,fa,ha){F=V;bb.toEditMode(fa,ha)},start:function(V){F=V;bb.toEditMode()},mouseDown:function(V,fa,ha,W){V=A(ha,W);k.focus();e(l(V.x,V.y));O=ha;Y=W},mouseMove:function(V,fa){var ha=A(V,fa);B(ha.x,ha.y)},mouseUp:function(V,fa,ha){var W=A(fa,ha);B(W.x,W.y,true);V.target!==F&&fa<O+2&&fa>O-2&&ha<Y+2&&ha>Y-2&&bb.toSelectMode(true)},setCursor:e,toEditMode:function(V,fa){rb([F],false);da=false;Fa="textedit";ra.requestSelector(F).showGrips(false);
ra.requestSelector(F);bb.init();$(F).css("cursor","text");if(arguments.length){var ha=A(V,fa);e(l(ha.x,ha.y))}else e();setTimeout(function(){da=true},300)},toSelectMode:function(V){Fa="select";clearInterval(w);w=null;o&&$(o).attr("display","none");n&&$(n).attr("visibility","hidden");$(F).css("cursor","move");if(V){Ia();$(F).css("cursor","move");M("selected",[F]);qb([F],true)}F&&!F.textContent.length&&d.deleteSelectedElements();$(k).blur();F=false},setInputElem:function(V){k=V},clear:function(){Fa== ra.requestSelector(F);bb.init();$(F).css("cursor","text");if(arguments.length){var ha=A(V,fa);e(l(ha.x,ha.y))}else e();setTimeout(function(){da=true},300)},toSelectMode:function(V){Fa="select";clearInterval(w);w=null;o&&$(o).attr("display","none");n&&$(n).attr("visibility","hidden");$(F).css("cursor","move");if(V){Ia();$(F).css("cursor","move");M("selected",[F]);qb([F],true)}F&&!F.textContent.length&&d.deleteSelectedElements();$(k).blur();F=false},setInputElem:function(V){k=V},clear:function(){Fa==
"textedit"&&bb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=I[0];ra.requestSelector(F).showGrips(false)}var V=F.textContent.length,fa=F.getAttribute("transform");H=svgedit.utilities.getBBox(F);J=fa?ea(F):null;E=Array(V);k.focus();$(F).unbind("dblclick",z).dblclick(z);if(!V)var ha={x:H.x+H.width/2,width:0};for(fa=0;fa<V;fa++){var W=F.getStartPositionOfChar(fa);ha=F.getEndPositionOfChar(fa);if(!svgedit.browser.supportsGoodTextCharPos()){var qa=d.contentW*s;W.x-=qa;ha.x-=qa;W.x/=s;ha.x/= "textedit"&&bb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=H[0];ra.requestSelector(F).showGrips(false)}var V=F.textContent.length,fa=F.getAttribute("transform");I=svgedit.utilities.getBBox(F);J=fa?ea(F):null;E=Array(V);k.focus();$(F).unbind("dblclick",z).dblclick(z);if(!V)var ha={x:I.x+I.width/2,width:0};for(fa=0;fa<V;fa++){var W=F.getStartPositionOfChar(fa);ha=F.getEndPositionOfChar(fa);if(!svgedit.browser.supportsGoodTextCharPos()){var qa=d.contentW*s;W.x-=qa;ha.x-=qa;W.x/=s;ha.x/=
s}E[fa]={x:W.x,y:H.y,width:ha.x-W.x,height:H.height}}E.push({x:ha.x,width:0});h(k.selectionStart,k.selectionEnd,true)}}}}(),La=d.pathActions=function(){var e=false,h,l,B;svgedit.path.Path.prototype.endChanges=function(D){if(svgedit.browser.isWebkit()){var z=this.elem;z.setAttribute("d",La.convertPath(z))}D=new Ma(this.elem,{d:this.last_d},D);wa(D);M("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(D){$.isArray(D)||(D=[D]);for(var z=0;z<D.length;z++){var F=D[z],k=this.segs[F]; s}E[fa]={x:W.x,y:I.y,width:ha.x-W.x,height:I.height}}E.push({x:ha.x,width:0});h(k.selectionStart,k.selectionEnd,true)}}}}(),La=d.pathActions=function(){var e=false,h,l,B;svgedit.path.Path.prototype.endChanges=function(D){if(svgedit.browser.isWebkit()){var z=this.elem;z.setAttribute("d",La.convertPath(z))}D=new Ma(this.elem,{d:this.last_d},D);wa(D);M("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(D){$.isArray(D)||(D=[D]);for(var z=0;z<D.length;z++){var F=D[z],k=this.segs[F];
k.ptgrip&&this.selected_pts.indexOf(F)==-1&&F>=0&&this.selected_pts.push(F)}this.selected_pts.sort();z=this.selected_pts.length;for(D=Array(z);z--;){k=this.segs[this.selected_pts[z]];k.select(true);D[z]=k.ptgrip}La.canDeleteNodes=true;La.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",D)};var A=h=null,G=false;return{mouseDown:function(D,z,F,k){if(Fa==="path"){mouse_x=F;mouse_y=k;k=mouse_x/s;z=mouse_y/s;F=pa("path_stretch_line");l=[k,z];if(p.gridSnapping){k=va(k);z=va(z);mouse_x= k.ptgrip&&this.selected_pts.indexOf(F)==-1&&F>=0&&this.selected_pts.push(F)}this.selected_pts.sort();z=this.selected_pts.length;for(D=Array(z);z--;){k=this.segs[this.selected_pts[z]];k.select(true);D[z]=k.ptgrip}La.canDeleteNodes=true;La.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",D)};var A=h=null,G=false;return{mouseDown:function(D,z,F,k){if(Fa==="path"){mouse_x=F;mouse_y=k;k=mouse_x/s;z=mouse_y/s;F=pa("path_stretch_line");l=[k,z];if(p.gridSnapping){k=va(k);z=va(z);mouse_x=
va(mouse_x);mouse_y=va(mouse_y)}if(!F){F=document.createElementNS(b,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});F=pa("selectorParentGroup").appendChild(F)}F.setAttribute("display","inline");var n=null;if(A){n=A.pathSegList;for(var o=n.numberOfItems,w=6/s,E=false;o;){o--;var H=n.getItem(o),J=H.x;H=H.y;if(k>=J-w&&k<=J+w&&z>=H-w&&z<=H+w){E=true;break}}w=aa();svgedit.path.removePath_(w);w=pa(w);J=n.numberOfItems;if(E){if(o<=1&&J>=2){k=n.getItem(0).x;z=n.getItem(0).y; va(mouse_x);mouse_y=va(mouse_y)}if(!F){F=document.createElementNS(b,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});F=pa("selectorParentGroup").appendChild(F)}F.setAttribute("display","inline");var n=null;if(A){n=A.pathSegList;for(var o=n.numberOfItems,w=6/s,E=false;o;){o--;var I=n.getItem(o),J=I.x;I=I.y;if(k>=J-w&&k<=J+w&&z>=I-w&&z<=I+w){E=true;break}}w=aa();svgedit.path.removePath_(w);w=pa(w);J=n.numberOfItems;if(E){if(o<=1&&J>=2){k=n.getItem(0).x;z=n.getItem(0).y;
D=F.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(k,z):A.createSVGPathSegCurvetoCubicAbs(k,z,D.x1/s,D.y1/s,k,z);k=A.createSVGPathSegClosePath();n.appendItem(D);n.appendItem(k)}else if(J<3)return n=false;$(F).remove();element=w;A=null;Ka=false;if(e){svgedit.path.path.matrix&&Za(w,{},svgedit.path.path.matrix.inverse());F=w.getAttribute("d");D=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",D+F);$(w).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath(); D=F.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(k,z):A.createSVGPathSegCurvetoCubicAbs(k,z,D.x1/s,D.y1/s,k,z);k=A.createSVGPathSegClosePath();n.appendItem(D);n.appendItem(k)}else if(J<3)return n=false;$(F).remove();element=w;A=null;Ka=false;if(e){svgedit.path.path.matrix&&Za(w,{},svgedit.path.path.matrix.inverse());F=w.getAttribute("d");D=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",D+F);$(w).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();
svgedit.path.path.init();La.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,Bb(D))){console.log("Clicked outside canvas");return false}n=A.pathSegList.numberOfItems;o=A.pathSegList.getItem(n-1);w=o.x;o=o.y;if(D.shiftKey){D=U(w,o,k,z);k=D.x;z=D.y}D=F.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(ab(k),ab(z)):A.createSVGPathSegCurvetoCubicAbs(ab(k),ab(z),D.x1/s,D.y1/s,D.x2/s,D.y2/s);A.pathSegList.appendItem(D);k*=s;z*=s;F.setAttribute("d", svgedit.path.path.init();La.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,Bb(D))){console.log("Clicked outside canvas");return false}n=A.pathSegList.numberOfItems;o=A.pathSegList.getItem(n-1);w=o.x;o=o.y;if(D.shiftKey){D=U(w,o,k,z);k=D.x;z=D.y}D=F.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(ab(k),ab(z)):A.createSVGPathSegCurvetoCubicAbs(ab(k),ab(z),D.x1/s,D.y1/s,D.x2/s,D.y2/s);A.pathSegList.appendItem(D);k*=s;z*=s;F.setAttribute("d",
["M",k,z,k,z].join(" "));F=n;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,k,z)}}else{d_attr="M"+k+","+z+" ";A=Q({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:K.opacity/2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();w=D.target.id;if(w.substr(0,14)=="pathpointgrip_"){z=svgedit.path.path.cur_pt=parseInt(w.substr(14)); ["M",k,z,k,z].join(" "));F=n;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,k,z)}}else{d_attr="M"+k+","+z+" ";A=S({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:K.opacity/2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();w=D.target.id;if(w.substr(0,14)=="pathpointgrip_"){z=svgedit.path.path.cur_pt=parseInt(w.substr(14));
svgedit.path.path.dragging=[F,k];n=svgedit.path.path.segs[z];if(D.shiftKey)n.selected?svgedit.path.path.removePtFromSelection(z):svgedit.path.path.addPtsToSelection(z);else{if(svgedit.path.path.selected_pts.length<=1||!n.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(z)}}else if(w.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,k];D=w.split("_")[1].split("c");z=D[0]-0;svgedit.path.path.selectPt(z,D[1]-0)}if(!svgedit.path.path.dragging){if(sa==null)sa=ra.getRubberBandBox(); svgedit.path.path.dragging=[F,k];n=svgedit.path.path.segs[z];if(D.shiftKey)n.selected?svgedit.path.path.removePtFromSelection(z):svgedit.path.path.addPtsToSelection(z);else{if(svgedit.path.path.selected_pts.length<=1||!n.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(z)}}else if(w.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,k];D=w.split("_")[1].split("c");z=D[0]-0;svgedit.path.path.selectPt(z,D[1]-0)}if(!svgedit.path.path.dragging){if(sa==null)sa=ra.getRubberBandBox();
ma(sa,{x:F*s,y:k*s,width:0,height:0,display:"inline"},100)}}},mouseMove:function(D,z,F){G=true;if(Fa==="path"){if(A){var k=A.pathSegList;D=k.numberOfItems-1;if(l){var n=svgedit.path.addCtrlGrip("1c1"),o=svgedit.path.addCtrlGrip("0c2");o.getAttribute("cx");o.getAttribute("cy");n.setAttribute("cx",z);n.setAttribute("cy",F);n.setAttribute("display","inline");n=l[0];var w=l[1];k.getItem(D);var E=n+(n-z/s),H=w+(w-F/s);o.setAttribute("cx",E*s);o.setAttribute("cy",H*s);o.setAttribute("display","inline"); ma(sa,{x:F*s,y:k*s,width:0,height:0,display:"inline"},100)}}},mouseMove:function(D,z,F){G=true;if(Fa==="path"){if(A){var k=A.pathSegList;D=k.numberOfItems-1;if(l){var n=svgedit.path.addCtrlGrip("1c1"),o=svgedit.path.addCtrlGrip("0c2");o.getAttribute("cx");o.getAttribute("cy");n.setAttribute("cx",z);n.setAttribute("cy",F);n.setAttribute("display","inline");n=l[0];var w=l[1];k.getItem(D);var E=n+(n-z/s),I=w+(w-F/s);o.setAttribute("cx",E*s);o.setAttribute("cy",I*s);o.setAttribute("display","inline");
o=svgedit.path.getCtrlLine(1);var J=svgedit.path.getCtrlLine(2);ma(o,{x1:z,y1:F,x2:n*s,y2:w*s,display:"inline"});ma(J,{x1:E*s,y1:H*s,x2:n*s,y2:w*s,display:"inline"});if(D===0)B=[z,F];else{k=k.getItem(D-1);z=k.x;F=k.y;if(k.pathSegType===6){z+=z-k.x2;F+=F-k.y2}else if(B){z=B[0]/s;F=B[1]/s}svgedit.path.replacePathSeg(6,D,[n,w,z,F,E,H],A)}}else if(n=pa("path_stretch_line")){D=k.getItem(D);if(D.pathSegType===6)svgedit.path.replacePathSeg(6,1,[z,F,(D.x+(D.x-D.x2))*s,(D.y+(D.y-D.y2))*s,z,F],n);else B?svgedit.path.replacePathSeg(6, o=svgedit.path.getCtrlLine(1);var J=svgedit.path.getCtrlLine(2);ma(o,{x1:z,y1:F,x2:n*s,y2:w*s,display:"inline"});ma(J,{x1:E*s,y1:I*s,x2:n*s,y2:w*s,display:"inline"});if(D===0)B=[z,F];else{k=k.getItem(D-1);z=k.x;F=k.y;if(k.pathSegType===6){z+=z-k.x2;F+=F-k.y2}else if(B){z=B[0]/s;F=B[1]/s}svgedit.path.replacePathSeg(6,D,[n,w,z,F,E,I],A)}}else if(n=pa("path_stretch_line")){D=k.getItem(D);if(D.pathSegType===6)svgedit.path.replacePathSeg(6,1,[z,F,(D.x+(D.x-D.x2))*s,(D.y+(D.y-D.y2))*s,z,F],n);else B?svgedit.path.replacePathSeg(6,
1,[z,F,B[0],B[1],z,F],n):svgedit.path.replacePathSeg(4,1,[z,F],n)}}}else if(svgedit.path.path.dragging){n=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);w=svgedit.path.getPointFromGrip({x:z,y:F},svgedit.path.path);D=w.x-n.x;n=w.y-n.y;svgedit.path.path.dragging=[z,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(D,n):svgedit.path.path.movePts(D,n)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next|| 1,[z,F,B[0],B[1],z,F],n):svgedit.path.replacePathSeg(4,1,[z,F],n)}}}else if(svgedit.path.path.dragging){n=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);w=svgedit.path.getPointFromGrip({x:z,y:F},svgedit.path.path);D=w.x-n.x;n=w.y-n.y;svgedit.path.path.dragging=[z,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(D,n):svgedit.path.path.movePts(D,n)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||
this.prev){var O=sa.getBBox(),Y=svgedit.path.getGripPt(this);O=svgedit.math.rectsIntersect(O,{x:Y.x,y:Y.y,width:0,height:0});this.select(O);O&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(D,z){if(Fa==="path"){l=null;if(!A){z=pa(aa());Ka=false;B=null}return{keep:true,element:z}}if(svgedit.path.path.dragging){var F=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)"); this.prev){var O=sa.getBBox(),Y=svgedit.path.getGripPt(this);O=svgedit.math.rectsIntersect(O,{x:Y.x,y:Y.y,width:0,height:0});this.select(O);O&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(D,z){if(Fa==="path"){l=null;if(!A){z=pa(aa());Ka=false;B=null}return{keep:true,element:z}}if(svgedit.path.path.dragging){var F=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)");
!D.shiftKey&&!G&&svgedit.path.path.selectPt(F)}else if(sa&&sa.getAttribute("display")!="none"){sa.setAttribute("display","none");sa.getAttribute("width")<=2&&sa.getAttribute("height")<=2&&La.toSelectMode(D.target)}else La.toSelectMode(D.target);G=false},toEditMode:function(D){svgedit.path.path=svgedit.path.getPath_(D);Fa="pathedit";Ia();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(D){var z=D==svgedit.path.path.elem; !D.shiftKey&&!G&&svgedit.path.path.selectPt(F)}else if(sa&&sa.getAttribute("display")!="none"){sa.setAttribute("display","none");sa.getAttribute("width")<=2&&sa.getAttribute("height")<=2&&La.toSelectMode(D.target)}else La.toSelectMode(D.target);G=false},toEditMode:function(D){svgedit.path.path=svgedit.path.getPath_(D);Fa="pathedit";Ia();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(D){var z=D==svgedit.path.path.elem;
Fa="select";svgedit.path.path.show(false);h=false;Ia();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(z){M("selected",[D]);qb([D],true)}},addSubPath:function(D){if(D){Fa="path";e=true}else{La.clear(true);La.toEditMode(svgedit.path.path.elem)}},select:function(D){if(h===D){La.toEditMode(D);Fa="pathedit"}else h=D},reorient:function(){var D=I[0];if(D)if(oa(D)!=0){var z=new Ca("Reorient path"),F={d:D.getAttribute("d"),transform:D.getAttribute("transform")};z.addSubCommand(new Ma(D,F)); Fa="select";svgedit.path.path.show(false);h=false;Ia();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(z){M("selected",[D]);qb([D],true)}},addSubPath:function(D){if(D){Fa="path";e=true}else{La.clear(true);La.toEditMode(svgedit.path.path.elem)}},select:function(D){if(h===D){La.toEditMode(D);Fa="pathedit"}else h=D},reorient:function(){var D=H[0];if(D)if(na(D)!=0){var z=new Ca("Reorient path"),F={d:D.getAttribute("d"),transform:D.getAttribute("transform")};z.addSubCommand(new Ma(D,F));
Ia();this.resetOrientation(D);wa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed",I)}},clear:function(){h=null;if(A){var D=pa(aa());$(pa("path_stretch_line")).remove();$(D).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");A=B=null;Ka=false}else Fa=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(D){if(D==null||D.nodeName!="path")return false;var z=S(D),F=X(z).matrix; Ia();this.resetOrientation(D);wa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed",H)}},clear:function(){h=null;if(A){var D=pa(aa());$(pa("path_stretch_line")).remove();$(D).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");A=B=null;Ka=false}else Fa=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(D){if(D==null||D.nodeName!="path")return false;var z=R(D),F=X(z).matrix;
z.clear();D.removeAttribute("transform");z=D.pathSegList;for(var k=z.numberOfItems,n=0;n<k;++n){var o=z.getItem(n),w=o.pathSegType;if(w!=1){var E=[];$.each(["",1,2],function(H,J){var O=o["x"+J],Y=o["y"+J];if(O!==undefined&&Y!==undefined){O=N(O,Y,F);E.splice(E.length,0,O.x,O.y)}});svgedit.path.replacePathSeg(w,n,E,D)}}g(D,F)},zoomChange:function(){Fa=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var D=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]: z.clear();D.removeAttribute("transform");z=D.pathSegList;for(var k=z.numberOfItems,n=0;n<k;++n){var o=z.getItem(n),w=o.pathSegType;if(w!=1){var E=[];$.each(["",1,2],function(I,J){var O=o["x"+J],Y=o["y"+J];if(O!==undefined&&Y!==undefined){O=N(O,Y,F);E.splice(E.length,0,O.x,O.y)}});svgedit.path.replacePathSeg(w,n,E,D)}}g(D,F)},zoomChange:function(){Fa=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var D=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:
1];return{x:D.item.x,y:D.item.y,type:D.type}},linkControlPoints:function(D){svgedit.path.setLinkControlPoints(D)},clonePathNode:function(){svgedit.path.path.storeD();for(var D=svgedit.path.path.selected_pts,z=D.length,F=[];z--;){var k=D[z];svgedit.path.path.addSeg(k);F.push(k+z);F.push(k+z+1)}svgedit.path.path.init().addPtsToSelection(F);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var D=svgedit.path.path.selected_pts;if(D.length===1){var z=svgedit.path.path.elem, 1];return{x:D.item.x,y:D.item.y,type:D.type}},linkControlPoints:function(D){svgedit.path.setLinkControlPoints(D)},clonePathNode:function(){svgedit.path.path.storeD();for(var D=svgedit.path.path.selected_pts,z=D.length,F=[];z--;){var k=D[z];svgedit.path.path.addSeg(k);F.push(k+z);F.push(k+z+1)}svgedit.path.path.init().addPtsToSelection(F);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var D=svgedit.path.path.selected_pts;if(D.length===1){var z=svgedit.path.path.elem,
F=z.pathSegList,k=D[0],n=null,o=null;svgedit.path.path.eachSeg(function(J){if(this.type===2&&J<=k)o=this.item;if(J<=k)return true;if(this.type===2){n=J;return false}else if(this.type===1)return n=false});if(n==null)n=svgedit.path.path.segs.length-1;if(n!==false){var w=z.createSVGPathSegLinetoAbs(o.x,o.y),E=z.createSVGPathSegClosePath();if(n==svgedit.path.path.segs.length){F.appendItem(w);F.appendItem(E)}else{svgedit.path.insertItemBefore(z,E,n);svgedit.path.insertItemBefore(z,w,n)}svgedit.path.path.init().selectPt(n+ F=z.pathSegList,k=D[0],n=null,o=null;svgedit.path.path.eachSeg(function(J){if(this.type===2&&J<=k)o=this.item;if(J<=k)return true;if(this.type===2){n=J;return false}else if(this.type===1)return n=false});if(n==null)n=svgedit.path.path.segs.length-1;if(n!==false){var w=z.createSVGPathSegLinetoAbs(o.x,o.y),E=z.createSVGPathSegClosePath();if(n==svgedit.path.path.segs.length){F.appendItem(w);F.appendItem(E)}else{svgedit.path.insertItemBefore(z,E,n);svgedit.path.insertItemBefore(z,w,n)}svgedit.path.path.init().selectPt(n+
1)}else if(svgedit.path.path.segs[k].mate){F.removeItem(k);F.removeItem(k);svgedit.path.path.init().selectPt(k-1)}else{for(D=0;D<F.numberOfItems;D++){var H=F.getItem(D);if(H.pathSegType===2)w=D;else if(D===k)F.removeItem(w);else if(H.pathSegType===1&&k<D){E=D-1;F.removeItem(D);break}}for(D=k-w-1;D--;)svgedit.path.insertItemBefore(z,F.getItem(w),E);z=F.getItem(w);svgedit.path.replacePathSeg(2,w,[z.x,z.y]);D=k;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(La.canDeleteNodes){svgedit.path.path.storeD(); 1)}else if(svgedit.path.path.segs[k].mate){F.removeItem(k);F.removeItem(k);svgedit.path.path.init().selectPt(k-1)}else{for(D=0;D<F.numberOfItems;D++){var I=F.getItem(D);if(I.pathSegType===2)w=D;else if(D===k)F.removeItem(w);else if(I.pathSegType===1&&k<D){E=D-1;F.removeItem(D);break}}for(D=k-w-1;D--;)svgedit.path.insertItemBefore(z,F.getItem(w),E);z=F.getItem(w);svgedit.path.replacePathSeg(2,w,[z.x,z.y]);D=k;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(La.canDeleteNodes){svgedit.path.path.storeD();
for(var D=svgedit.path.path.selected_pts,z=D.length;z--;)svgedit.path.path.deleteSeg(D[z]);var F=function(){var k=svgedit.path.path.elem.pathSegList,n=k.numberOfItems,o=function(H,J){for(;J--;)k.removeItem(H)};if(n<=1)return true;for(;n--;){var w=k.getItem(n);if(w.pathSegType===1){w=k.getItem(n-1);var E=k.getItem(n-2);if(w.pathSegType===2){o(n-1,2);F();break}else if(E.pathSegType===2){o(n-2,3);F();break}}else if(w.pathSegType===2)if(n>0){w=k.getItem(n-1).pathSegType;if(w===2){o(n-1,1);F();break}else if(w=== for(var D=svgedit.path.path.selected_pts,z=D.length;z--;)svgedit.path.path.deleteSeg(D[z]);var F=function(){var k=svgedit.path.path.elem.pathSegList,n=k.numberOfItems,o=function(I,J){for(;J--;)k.removeItem(I)};if(n<=1)return true;for(;n--;){var w=k.getItem(n);if(w.pathSegType===1){w=k.getItem(n-1);var E=k.getItem(n-2);if(w.pathSegType===2){o(n-1,2);F();break}else if(E.pathSegType===2){o(n-2,3);F();break}}else if(w.pathSegType===2)if(n>0){w=k.getItem(n-1).pathSegType;if(w===2){o(n-1,1);F();break}else if(w===
1&&k.numberOfItems-1===n){o(n,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){La.toSelectMode(svgedit.path.path.elem);d.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){D=$(svgedit.path.path.elem);D.attr("d",D.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(D){var z=D.points,F=z.numberOfItems;if(F>=4){var k=z.getItem(0),n=null;D=[];D.push(["M",k.x,",", 1&&k.numberOfItems-1===n){o(n,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){La.toSelectMode(svgedit.path.path.elem);d.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){D=$(svgedit.path.path.elem);D.attr("d",D.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(D){var z=D.points,F=z.numberOfItems;if(F>=4){var k=z.getItem(0),n=null;D=[];D.push(["M",k.x,",",
k.y," C"].join(""));for(var o=1;o<=F-4;o+=3){var w=z.getItem(o),E=z.getItem(o+1),H=z.getItem(o+2);if(n)if((k=svgedit.path.smoothControlPoints(n,w,k))&&k.length==2){w=D[D.length-1].split(",");w[2]=k[0].x;w[3]=k[0].y;D[D.length-1]=w.join(",");w=k[1]}D.push([w.x,w.y,E.x,E.y,H.x,H.y].join(","));k=H;n=E}for(D.push("L");o<F;++o){E=z.getItem(o);D.push([E.x,E.y].join(","))}D=D.join(" ");D=Q({element:"path",curStyles:true,attr:{id:aa(),d:D,fill:"none"}})}return D},setSegType:function(D){svgedit.path.path.setSegType(D)}, k.y," C"].join(""));for(var o=1;o<=F-4;o+=3){var w=z.getItem(o),E=z.getItem(o+1),I=z.getItem(o+2);if(n)if((k=svgedit.path.smoothControlPoints(n,w,k))&&k.length==2){w=D[D.length-1].split(",");w[2]=k[0].x;w[3]=k[0].y;D[D.length-1]=w.join(",");w=k[1]}D.push([w.x,w.y,E.x,E.y,I.x,I.y].join(","));k=I;n=E}for(D.push("L");o<F;++o){E=z.getItem(o);D.push([E.x,E.y].join(","))}D=D.join(" ");D=S({element:"path",curStyles:true,attr:{id:aa(),d:D,fill:"none"}})}return D},setSegType:function(D){svgedit.path.path.setSegType(D)},
moveNode:function(D,z){var F=svgedit.path.path.selected_pts;if(F.length){svgedit.path.path.storeD();F=svgedit.path.path.segs[F[0]];var k={x:0,y:0};k[D]=z-F.item[D];F.move(k.x,k.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(D){for(var z=D.pathSegList,F=z.numberOfItems,k,n=0;n<F;++n){var o=z.getItem(n);if(o.pathSegType===2)k=o;if(o.pathSegType===1){o=z.getItem(n-1);if(o.x!=k.x||o.y!=k.y){z=D.createSVGPathSegLinetoAbs(k.x,k.y);svgedit.path.insertItemBefore(D,z,n);La.fixEnd(D); moveNode:function(D,z){var F=svgedit.path.path.selected_pts;if(F.length){svgedit.path.path.storeD();F=svgedit.path.path.segs[F[0]];var k={x:0,y:0};k[D]=z-F.item[D];F.move(k.x,k.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(D){for(var z=D.pathSegList,F=z.numberOfItems,k,n=0;n<F;++n){var o=z.getItem(n);if(o.pathSegType===2)k=o;if(o.pathSegType===1){o=z.getItem(n-1);if(o.x!=k.x||o.y!=k.y){z=D.createSVGPathSegLinetoAbs(k.x,k.y);svgedit.path.insertItemBefore(D,z,n);La.fixEnd(D);
break}}}svgedit.browser.isWebkit()&&D.setAttribute("d",La.convertPath(D))},convertPath:function(D,z){for(var F=D.pathSegList,k=F.numberOfItems,n=0,o=0,w="",E=null,H=0;H<k;++H){var J=F.getItem(H),O=J.x||0,Y=J.y||0,da=J.x1||0,V=J.y1||0,fa=J.x2||0,ha=J.y2||0,W=J.pathSegType,qa=Oa[W]["to"+(z?"Lower":"Upper")+"Case"](),ua=function(za,Ba,Pa){Ba=Ba?" "+Ba.join(" "):"";Pa=Pa?" "+svgedit.units.shortFloat(Pa):"";$.each(za,function(Qa,Na){za[Qa]=svgedit.units.shortFloat(Na)});w+=qa+za.join(" ")+Ba+Pa};switch(W){case 1:w+= break}}}svgedit.browser.isWebkit()&&D.setAttribute("d",La.convertPath(D))},convertPath:function(D,z){for(var F=D.pathSegList,k=F.numberOfItems,n=0,o=0,w="",E=null,I=0;I<k;++I){var J=F.getItem(I),O=J.x||0,Y=J.y||0,da=J.x1||0,V=J.y1||0,fa=J.x2||0,ha=J.y2||0,W=J.pathSegType,qa=Oa[W]["to"+(z?"Lower":"Upper")+"Case"](),ua=function(za,Ba,Pa){Ba=Ba?" "+Ba.join(" "):"";Pa=Pa?" "+svgedit.units.shortFloat(Pa):"";$.each(za,function(Qa,Na){za[Qa]=svgedit.units.shortFloat(Na)});w+=qa+za.join(" ")+Ba+Pa};switch(W){case 1:w+=
"z";break;case 12:O-=n;case 13:if(z){n+=O;qa="l"}else{O+=n;n=O;qa="L"}ua([[O,o]]);break;case 14:Y-=o;case 15:if(z){o+=Y;qa="l"}else{Y+=o;o=Y;qa="L"}ua([[n,Y]]);break;case 2:case 4:case 18:O-=n;Y-=o;case 5:case 3:if(E&&F.getItem(H-1).pathSegType===1&&!z){n=E[0];o=E[1]}case 19:if(z){n+=O;o+=Y}else{O+=n;Y+=o;n=O;o=Y}if(W===3)E=[n,o];ua([[O,Y]]);break;case 6:O-=n;da-=n;fa-=n;Y-=o;V-=o;ha-=o;case 7:if(z){n+=O;o+=Y}else{O+=n;da+=n;fa+=n;Y+=o;V+=o;ha+=o;n=O;o=Y}ua([[da,V],[fa,ha],[O,Y]]);break;case 8:O-= "z";break;case 12:O-=n;case 13:if(z){n+=O;qa="l"}else{O+=n;n=O;qa="L"}ua([[O,o]]);break;case 14:Y-=o;case 15:if(z){o+=Y;qa="l"}else{Y+=o;o=Y;qa="L"}ua([[n,Y]]);break;case 2:case 4:case 18:O-=n;Y-=o;case 5:case 3:if(E&&F.getItem(I-1).pathSegType===1&&!z){n=E[0];o=E[1]}case 19:if(z){n+=O;o+=Y}else{O+=n;Y+=o;n=O;o=Y}if(W===3)E=[n,o];ua([[O,Y]]);break;case 6:O-=n;da-=n;fa-=n;Y-=o;V-=o;ha-=o;case 7:if(z){n+=O;o+=Y}else{O+=n;da+=n;fa+=n;Y+=o;V+=o;ha+=o;n=O;o=Y}ua([[da,V],[fa,ha],[O,Y]]);break;case 8:O-=
n;da-=n;Y-=o;V-=o;case 9:if(z){n+=O;o+=Y}else{O+=n;da+=n;Y+=o;V+=o;n=O;o=Y}ua([[da,V],[O,Y]]);break;case 10:O-=n;Y-=o;case 11:if(z){n+=O;o+=Y}else{O+=n;Y+=o;n=O;o=Y}ua([[J.r1,J.r2]],[J.angle,J.largeArcFlag?1:0,J.sweepFlag?1:0],[O,Y]);break;case 16:O-=n;fa-=n;Y-=o;ha-=o;case 17:if(z){n+=O;o+=Y}else{O+=n;fa+=n;Y+=o;ha+=o;n=O;o=Y}ua([[fa,ha],[O,Y]])}}return w}}}(),yb=this.removeUnusedDefElems=function(){var e=m.getElementsByTagNameNS(b,"defs");if(!e||!e.length)return 0;for(var h=[],l=0,B=["fill","stroke", n;da-=n;Y-=o;V-=o;case 9:if(z){n+=O;o+=Y}else{O+=n;da+=n;Y+=o;V+=o;n=O;o=Y}ua([[da,V],[O,Y]]);break;case 10:O-=n;Y-=o;case 11:if(z){n+=O;o+=Y}else{O+=n;Y+=o;n=O;o=Y}ua([[J.r1,J.r2]],[J.angle,J.largeArcFlag?1:0,J.sweepFlag?1:0],[O,Y]);break;case 16:O-=n;fa-=n;Y-=o;ha-=o;case 17:if(z){n+=O;o+=Y}else{O+=n;fa+=n;Y+=o;ha+=o;n=O;o=Y}ua([[fa,ha],[O,Y]])}}return w}}}(),yb=this.removeUnusedDefElems=function(){var e=m.getElementsByTagNameNS(b,"defs");if(!e||!e.length)return 0;for(var h=[],l=0,B=["fill","stroke",
"filter","marker-start","marker-mid","marker-end"],A=B.length,G=m.getElementsByTagNameNS(b,"*"),D=G.length,z=0;z<D;z++){for(var F=G[z],k=0;k<A;k++){var n=ja(F.getAttribute(B[k]));n&&h.push(n.substr(1))}(F=ba(F))&&F.indexOf("#")===0&&h.push(F.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(z=e.length;z--;){B=e[z];A=B.id;if(h.indexOf(A)<0){sb[A]=B;B.parentNode.removeChild(B);l++}}return l};this.svgCanvasToString=function(){for(;yb()>0;);La.clear(true); "filter","marker-start","marker-mid","marker-end"],A=B.length,G=m.getElementsByTagNameNS(b,"*"),D=G.length,z=0;z<D;z++){for(var F=G[z],k=0;k<A;k++){var n=ja(F.getAttribute(B[k]));n&&h.push(n.substr(1))}(F=ba(F))&&F.indexOf("#")===0&&h.push(F.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(z=e.length;z--;){B=e[z];A=B.id;if(h.indexOf(A)<0){sb[A]=B;B.parentNode.removeChild(B);l++}}return l};this.svgCanvasToString=function(){for(;yb()>0;);La.clear(true);
$.each(m.childNodes,function(l,B){l&&B.nodeType===8&&B.data.indexOf("Created with")>=0&&m.insertBefore(B,m.firstChild)});if(L){Eb();rb([L])}$("#canvasGrid").attr("display","none");var e=[];$(m).find("g:data(gsvg)").each(function(){for(var l=this.attributes,B=l.length,A=0;A<B;A++)if(l[A].nodeName=="id"||l[A].nodeName=="style")B--;if(B<=0){l=this.firstChild;e.push(l);$(this).replaceWith(l)}});var h=this.svgToString(m,0);e.length&&$(e).each(function(){tb(this)});return h};this.svgToString=function(e, $.each(m.childNodes,function(l,B){l&&B.nodeType===8&&B.data.indexOf("Created with")>=0&&m.insertBefore(B,m.firstChild)});if(L){Eb();rb([L])}$("#canvasGrid").attr("display","none");var e=[];$(m).find("g:data(gsvg)").each(function(){for(var l=this.attributes,B=l.length,A=0;A<B;A++)if(l[A].nodeName=="id"||l[A].nodeName=="style")B--;if(B<=0){l=this.firstChild;e.push(l);$(this).replaceWith(l)}});var h=this.svgToString(m,0);e.length&&$(e).each(function(){tb(this)});return h};this.svgToString=function(e,
h){var l=[],B=svgedit.utilities.toXml,A=p.baseUnit,G=RegExp("^-?[\\d\\.]+"+A+"$");if(e){la(e);var D=e.attributes,z,F,k=e.childNodes;for(F=0;F<h;F++)l.push(" ");l.push("<");l.push(e.nodeName);if(e.id==="svgcontent"){F=zb();if(A!=="px"){F.w=svgedit.units.convertUnit(F.w,A)+A;F.h=svgedit.units.convertUnit(F.h,A)+A}l.push(' width="'+F.w+'" height="'+F.h+'" xmlns="'+b+'"');var n={};$(e).find("*").andSelf().each(function(){$.each(this.attributes,function(H,J){var O=J.namespaceURI;if(O&&!n[O]&&xa[O]!=="xmlns"&& h){var l=[],B=svgedit.utilities.toXml,A=p.baseUnit,G=RegExp("^-?[\\d\\.]+"+A+"$");if(e){la(e);var D=e.attributes,z,F,k=e.childNodes;for(F=0;F<h;F++)l.push(" ");l.push("<");l.push(e.nodeName);if(e.id==="svgcontent"){F=zb();if(A!=="px"){F.w=svgedit.units.convertUnit(F.w,A)+A;F.h=svgedit.units.convertUnit(F.h,A)+A}l.push(' width="'+F.w+'" height="'+F.h+'" xmlns="'+b+'"');var n={};$(e).find("*").andSelf().each(function(){$.each(this.attributes,function(I,J){var O=J.namespaceURI;if(O&&!n[O]&&xa[O]!=="xmlns"&&
xa[O]!=="xml"){n[O]=true;l.push(" xmlns:"+xa[O]+'="'+O+'"')}})});F=D.length;for(A=["width","height","xmlns","x","y","viewBox","id","overflow"];F--;){z=D.item(F);var o=B(z.nodeValue);if(z.nodeName.indexOf("xmlns:")!==0)if(o!=""&&A.indexOf(z.localName)==-1)if(!z.namespaceURI||xa[z.namespaceURI]){l.push(" ");l.push(z.nodeName);l.push('="');l.push(o);l.push('"')}}}else{if(e.nodeName==="defs"&&!e.firstChild)return;var w=["-moz-math-font-style","_moz-math-font-style"];for(F=D.length-1;F>=0;F--){z=D.item(F); xa[O]!=="xml"){n[O]=true;l.push(" xmlns:"+xa[O]+'="'+O+'"')}})});F=D.length;for(A=["width","height","xmlns","x","y","viewBox","id","overflow"];F--;){z=D.item(F);var o=B(z.nodeValue);if(z.nodeName.indexOf("xmlns:")!==0)if(o!=""&&A.indexOf(z.localName)==-1)if(!z.namespaceURI||xa[z.namespaceURI]){l.push(" ");l.push(z.nodeName);l.push('="');l.push(o);l.push('"')}}}else{if(e.nodeName==="defs"&&!e.firstChild)return;var w=["-moz-math-font-style","_moz-math-font-style"];for(F=D.length-1;F>=0;F--){z=D.item(F);
o=B(z.nodeValue);if(!(w.indexOf(z.localName)>=0))if(o!="")if(o.indexOf("pointer-events")!==0)if(!(z.localName==="class"&&o.indexOf("se_")===0)){l.push(" ");if(z.localName==="d")o=La.convertPath(e,true);if(isNaN(o)){if(G.test(o))o=svgedit.units.shortFloat(o)+A}else o=svgedit.units.shortFloat(o);if($a.apply&&e.nodeName==="image"&&z.localName==="href"&&$a.images&&$a.images==="embed"){var E=Va[o];if(E)o=E}if(!z.namespaceURI||z.namespaceURI==b||xa[z.namespaceURI]){l.push(z.nodeName);l.push('="');l.push(o); o=B(z.nodeValue);if(!(w.indexOf(z.localName)>=0))if(o!="")if(o.indexOf("pointer-events")!==0)if(!(z.localName==="class"&&o.indexOf("se_")===0)){l.push(" ");if(z.localName==="d")o=La.convertPath(e,true);if(isNaN(o)){if(G.test(o))o=svgedit.units.shortFloat(o)+A}else o=svgedit.units.shortFloat(o);if($a.apply&&e.nodeName==="image"&&z.localName==="href"&&$a.images&&$a.images==="embed"){var E=Va[o];if(E)o=E}if(!z.namespaceURI||z.namespaceURI==b||xa[z.namespaceURI]){l.push(z.nodeName);l.push('="');l.push(o);
l.push('"')}}}}if(e.hasChildNodes()){l.push(">");h++;D=false;for(F=0;F<k.length;F++){A=k.item(F);switch(A.nodeType){case 1:l.push("\n");l.push(this.svgToString(k.item(F),h));break;case 3:A=A.nodeValue.replace(/^\s+|\s+$/g,"");if(A!=""){D=true;l.push(B(A)+"")}break;case 4:l.push("\n");l.push(Array(h+1).join(" "));l.push("<![CDATA[");l.push(A.nodeValue);l.push("]]\>");break;case 8:l.push("\n");l.push(Array(h+1).join(" "));l.push("<!--");l.push(A.data);l.push("--\>")}}h--;if(!D){l.push("\n");for(F=0;F< l.push('"')}}}}if(e.hasChildNodes()){l.push(">");h++;D=false;for(F=0;F<k.length;F++){A=k.item(F);switch(A.nodeType){case 1:l.push("\n");l.push(this.svgToString(k.item(F),h));break;case 3:A=A.nodeValue.replace(/^\s+|\s+$/g,"");if(A!=""){D=true;l.push(B(A)+"")}break;case 4:l.push("\n");l.push(Array(h+1).join(" "));l.push("<![CDATA[");l.push(A.nodeValue);l.push("]]\>");break;case 8:l.push("\n");l.push(Array(h+1).join(" "));l.push("<!--");l.push(A.data);l.push("--\>")}}h--;if(!D){l.push("\n");for(F=0;F<
@ -312,69 +312,69 @@ this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.dra
if(w=w?w.substr(1):null){w in h||(h[w]={elem:null,attrs:[],hrefs:[]});h[w].attrs.push(o)}}});var F=svgedit.utilities.getHref(z);if(F&&l.indexOf(z.nodeName)>=0)if(F=F.substr(1)){F in h||(h[F]={elem:null,attrs:[],hrefs:[]});h[F].hrefs.push(z)}}});for(var B in h)if(B){var A=h[B].elem;if(A){e=ka();A.id=e;A=h[B].attrs;for(var G=A.length;G--;){var D=A[G];D.ownerElement.setAttribute(D.name,"url(#"+e+")")}A=h[B].hrefs;for(G=A.length;G--;)svgedit.utilities.setHref(A[G],"#"+e)}}},Gb=this.setUseData=function(e){var h= if(w=w?w.substr(1):null){w in h||(h[w]={elem:null,attrs:[],hrefs:[]});h[w].attrs.push(o)}}});var F=svgedit.utilities.getHref(z);if(F&&l.indexOf(z.nodeName)>=0)if(F=F.substr(1)){F in h||(h[F]={elem:null,attrs:[],hrefs:[]});h[F].hrefs.push(z)}}});for(var B in h)if(B){var A=h[B].elem;if(A){e=ka();A.id=e;A=h[B].attrs;for(var G=A.length;G--;){var D=A[G];D.ownerElement.setAttribute(D.name,"url(#"+e+")")}A=h[B].hrefs;for(G=A.length;G--;)svgedit.utilities.setHref(A[G],"#"+e)}}},Gb=this.setUseData=function(e){var h=
$(e);if(e.tagName!=="use")h=h.find("use");h.each(function(){var l=ba(this).substr(1);if(l=pa(l)){$(this).data("ref",l);if(l.tagName=="symbol"||l.tagName=="svg")$(this).data("symbol",l).data("ref",l)}})},Ib=this.convertGradients=function(e){var h=$(e).find("linearGradient, radialGradient");if(!h.length&&svgedit.browser.isWebkit())h=$(e).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});h.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var l=$(m).find('[fill="url(#'+ $(e);if(e.tagName!=="use")h=h.find("use");h.each(function(){var l=ba(this).substr(1);if(l=pa(l)){$(this).data("ref",l);if(l.tagName=="symbol"||l.tagName=="svg")$(this).data("symbol",l).data("ref",l)}})},Ib=this.convertGradients=function(e){var h=$(e).find("linearGradient, radialGradient");if(!h.length&&svgedit.browser.isWebkit())h=$(e).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});h.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var l=$(m).find('[fill="url(#'+
this.id+')"],[stroke="url(#'+this.id+')"]');if(l.length)if(l=svgedit.utilities.getBBox(l[0]))if(this.tagName==="linearGradient"){var B=$(this).attr(["x1","y1","x2","y2"]),A=this.gradientTransform.baseVal;if(A&&A.numberOfItems>0){var G=X(A).matrix;A=N(B.x1,B.y1,G);G=N(B.x2,B.y2,G);B.x1=A.x;B.y1=A.y;B.x2=G.x;B.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(B.x1-l.x)/l.width,y1:(B.y1-l.y)/l.height,x2:(B.x2-l.x)/l.width,y2:(B.y2-l.y)/l.height});this.removeAttribute("gradientUnits")}}})}, this.id+')"],[stroke="url(#'+this.id+')"]');if(l.length)if(l=svgedit.utilities.getBBox(l[0]))if(this.tagName==="linearGradient"){var B=$(this).attr(["x1","y1","x2","y2"]),A=this.gradientTransform.baseVal;if(A&&A.numberOfItems>0){var G=X(A).matrix;A=N(B.x1,B.y1,G);G=N(B.x2,B.y2,G);B.x1=A.x;B.y1=A.y;B.x2=G.x;B.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(B.x1-l.x)/l.width,y1:(B.y1-l.y)/l.height,x2:(B.x2-l.x)/l.width,y2:(B.y2-l.y)/l.height});this.removeAttribute("gradientUnits")}}})},
Lb=this.convertToGroup=function(e){e||(e=I[0]);var h=$(e),l=new Ca,B;if(h.data("gsvg")){l=$(e.firstChild).attr(["x","y"]);$(e.firstChild.firstChild).unwrap();$(e).removeData("gsvg");B=S(e);var A=c.createSVGTransform();A.setTranslate(l.x,l.y);B.appendItem(A);Ra(e);M("selected",[e])}else if(h.data("symbol")){e=h.data("symbol");B=h.attr("transform");A=h.attr(["x","y"]);var G=e.getAttribute("viewBox");if(G){G=G.split(" ");A.x-=+G[0];A.y-=+G[1]}B+=" translate("+(A.x||0)+","+(A.y||0)+")";A=h.prev();l.addSubCommand(new Ga(h[0], Lb=this.convertToGroup=function(e){e||(e=H[0]);var h=$(e),l=new Ca,B;if(h.data("gsvg")){l=$(e.firstChild).attr(["x","y"]);$(e.firstChild.firstChild).unwrap();$(e).removeData("gsvg");B=R(e);var A=c.createSVGTransform();A.setTranslate(l.x,l.y);B.appendItem(A);Ra(e);M("selected",[e])}else if(h.data("symbol")){e=h.data("symbol");B=h.attr("transform");A=h.attr(["x","y"]);var G=e.getAttribute("viewBox");if(G){G=G.split(" ");A.x-=+G[0];A.y-=+G[1]}B+=" translate("+(A.x||0)+","+(A.y||0)+")";A=h.prev();l.addSubCommand(new Ga(h[0],
h[0].nextSibling,h[0].parentNode));h.remove();G=$(m).find("use:data(symbol)").length;h=f.createElementNS(b,"g");for(var D=e.childNodes,z=0;z<D.length;z++)h.appendChild(D[z].cloneNode(true));if(svgedit.browser.isGecko()){D=$(gb()).children("linearGradient,radialGradient,pattern").clone();$(h).append(D)}B&&h.setAttribute("transform",B);B=e.parentNode;Hb(h);svgedit.browser.isGecko()&&$(gb()).append($(h).find("linearGradient,radialGradient,pattern"));h.id=ka();A.after(h);if(B){if(!G){A=e.nextSibling; h[0].nextSibling,h[0].parentNode));h.remove();G=$(m).find("use:data(symbol)").length;h=f.createElementNS(b,"g");for(var D=e.childNodes,z=0;z<D.length;z++)h.appendChild(D[z].cloneNode(true));if(svgedit.browser.isGecko()){D=$(gb()).children("linearGradient,radialGradient,pattern").clone();$(h).append(D)}B&&h.setAttribute("transform",B);B=e.parentNode;Hb(h);svgedit.browser.isGecko()&&$(gb()).append($(h).find("linearGradient,radialGradient,pattern"));h.id=ka();A.after(h);if(B){if(!G){A=e.nextSibling;
B.removeChild(e);l.addSubCommand(new Ga(e,A,B))}l.addSubCommand(new Ha(h))}Gb(h);svgedit.browser.isGecko()?Ib(gb()):Ib(h);svgedit.utilities.walkTreePost(h,function(F){try{Ra(F)}catch(k){console.log(k)}});$(h).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});rb([h]);(e=Db(h,true))&&l.addSubCommand(e);wa(l)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e){try{var h=svgedit.utilities.text2xml(e); B.removeChild(e);l.addSubCommand(new Ga(e,A,B))}l.addSubCommand(new Ha(h))}Gb(h);svgedit.browser.isGecko()?Ib(gb()):Ib(h);svgedit.utilities.walkTreePost(h,function(F){try{Ra(F)}catch(k){console.log(k)}});$(h).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});rb([h]);(e=Db(h,true))&&l.addSubCommand(e);wa(l)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e){try{var h=svgedit.utilities.text2xml(e);
this.prepareSvg(h);var l=new Ca("Change Source"),B=m.nextSibling,A=c.removeChild(m);l.addSubCommand(new Ga(A,B,c));m=f.adoptNode?f.adoptNode(h.documentElement):f.importNode(h.documentElement,true);c.appendChild(m);var G=$(m);d.current_drawing_=new svgedit.draw.Drawing(m,u);var D=C().getNonce();D?M("setnonce",D):M("unsetnonce");G.find("image").each(function(){var J=this;Fb(J);var O=ba(this);if(O.indexOf("data:")===0){var Y=O.match(/svgedit_url=(.*?);/);if(Y){var da=decodeURIComponent(Y[1]);$(new Image).load(function(){J.setAttributeNS("http://www.w3.org/1999/xlink", this.prepareSvg(h);var l=new Ca("Change Source"),B=m.nextSibling,A=c.removeChild(m);l.addSubCommand(new Ga(A,B,c));m=f.adoptNode?f.adoptNode(h.documentElement):f.importNode(h.documentElement,true);c.appendChild(m);var G=$(m);d.current_drawing_=new svgedit.draw.Drawing(m,u);var D=C().getNonce();D?M("setnonce",D):M("unsetnonce");G.find("image").each(function(){var J=this;Fb(J);var O=ba(this);if(O.indexOf("data:")===0){var Y=O.match(/svgedit_url=(.*?);/);if(Y){var da=decodeURIComponent(Y[1]);$(new Image).load(function(){J.setAttributeNS("http://www.w3.org/1999/xlink",
"xlink:href",da)}).attr("src",da)}}d.embedImage(O)});G.find("svg").each(function(){if(!$(this).closest("defs").length){Hb(this);var J=this.parentNode;if(J.childNodes.length===1&&J.nodeName==="g"){$(J).data("gsvg",this);J.id=J.id||ka()}else tb(this)}});G.find("linearGradient, radialGradient, pattern").appendTo(gb());Gb(G);Ib(G[0]);svgedit.utilities.walkTreePost(m,function(J){try{Ra(J)}catch(O){console.log(O)}});var z={id:"svgcontent",overflow:p.show_outside_canvas?"visible":"hidden"},F=false;if(G.attr("viewBox")){var k= "xlink:href",da)}).attr("src",da)}}d.embedImage(O)});G.find("svg").each(function(){if(!$(this).closest("defs").length){Hb(this);var J=this.parentNode;if(J.childNodes.length===1&&J.nodeName==="g"){$(J).data("gsvg",this);J.id=J.id||ka()}else tb(this)}});G.find("linearGradient, radialGradient, pattern").appendTo(gb());Gb(G);Ib(G[0]);svgedit.utilities.walkTreePost(m,function(J){try{Ra(J)}catch(O){console.log(O)}});var z={id:"svgcontent",overflow:p.show_outside_canvas?"visible":"hidden"},F=false;if(G.attr("viewBox")){var k=
G.attr("viewBox").split(" ");z.width=k[2];z.height=k[3]}else $.each(["width","height"],function(J,O){var Y=G.attr(O);Y||(Y="100%");if((Y+"").substr(-1)==="%")F=true;else z[O]=Aa(O,Y)});xb();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(F){var n=getStrokedBBox();z.width=n.width+n.x;z.height=n.height+n.y}if(z.width<=0)z.width=200;if(z.height<=0)z.height=200;G.attr(z);this.contentW=z.width; G.attr("viewBox").split(" ");z.width=k[2];z.height=k[3]}else $.each(["width","height"],function(J,O){var Y=G.attr(O);Y||(Y="100%");if((Y+"").substr(-1)==="%")F=true;else z[O]=Aa(O,Y)});xb();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(F){var n=getStrokedBBox();z.width=n.width+n.x;z.height=n.height+n.y}if(z.width<=0)z.width=200;if(z.height<=0)z.height=200;G.attr(z);this.contentW=z.width;
this.contentH=z.height;$("#canvas_width").val(this.contentW);$("#canvas_height").val(this.contentH);var o=$("#canvas_background");if(o.length){var w=o.attr("fill-opacity");w=w?parseInt(w)*100:100;fill=this.getPaint(o.attr("fill"),w,"canvas")}else fill=this.getPaint("none",100,"canvas");svgEditor.paintBox.canvas.setPaint(fill);l.addSubCommand(new Ha(m));var E=G.attr(["width","height"]);l.addSubCommand(new Ma(c,E));s=1;svgedit.transformlist.resetListMap();Ia();svgedit.path.clearData();c.appendChild(ra.selectorParentGroup); this.contentH=z.height;$("#canvas_width").val(this.contentW);$("#canvas_height").val(this.contentH);var o=$("#canvas_background");if(o.length){var w=o.attr("fill-opacity");w=w?parseInt(w)*100:100;fill=this.getPaint(o.attr("fill"),w,"canvas")}else fill=this.getPaint("none",100,"canvas");svgEditor.paintBox.canvas.setPaint(fill);l.addSubCommand(new Ha(m));var E=G.attr(["width","height"]);l.addSubCommand(new Ma(c,E));s=1;svgedit.transformlist.resetListMap();Ia();svgedit.path.clearData();c.appendChild(ra.selectorParentGroup);
wa(l);M("changed",[m])}catch(H){console.log(H);return false}return true};this.getPaint=function(e,h,l){var B=null;if(e.indexOf("url(#")===0){e=(e=svgCanvas.getRefElem(e))?e.cloneNode(true):$("#"+l+"_color defs *")[0];B={alpha:h};B[e.tagName]=e}else B=e.indexOf("#")===0?{alpha:h,solidColor:e.substr(1)}:{alpha:h,solidColor:"none"};return new $.jGraduate.Paint(B)};this.importSvgString=function(e){try{var h=svgedit.utilities.encode64(e.length+e).substr(0,32),l=false;if(lb[h])if($(lb[h].symbol).parents("#svgroot").length)l= wa(l);M("changed",[m])}catch(I){console.log(I);return false}return true};this.getPaint=function(e,h,l){var B=null;if(e.indexOf("url(#")===0){e=(e=svgCanvas.getRefElem(e))?e.cloneNode(true):$("#"+l+"_color defs *")[0];B={alpha:h};B[e.tagName]=e}else B=e.indexOf("#")===0?{alpha:h,solidColor:e.substr(1)}:{alpha:h,solidColor:"none"};return new $.jGraduate.Paint(B)};this.importSvgString=function(e){try{var h=svgedit.utilities.encode64(e.length+e).substr(0,32),l=false;if(lb[h])if($(lb[h].symbol).parents("#svgroot").length)l=
true;var B=new Ca("Import SVG");if(l)var A=lb[h].symbol,G=lb[h].xform;else{var D=svgedit.utilities.text2xml(e);this.prepareSvg(D);var z;z=f.adoptNode?f.adoptNode(D.documentElement):f.importNode(D.documentElement,true);Hb(z);var F=Aa("width",z.getAttribute("width")),k=Aa("height",z.getAttribute("height")),n=z.getAttribute("viewBox"),o=n?n.split(" "):[0,0,F,k];for(e=0;e<4;++e)o[e]=+o[e];m.getAttribute("width");var w=+m.getAttribute("height");G=k>F?"scale("+w/3/o[3]+")":"scale("+w/3/o[2]+")";G="translate(0) "+ true;var B=new Ca("Import SVG");if(l)var A=lb[h].symbol,G=lb[h].xform;else{var D=svgedit.utilities.text2xml(e);this.prepareSvg(D);var z;z=f.adoptNode?f.adoptNode(D.documentElement):f.importNode(D.documentElement,true);Hb(z);var F=Aa("width",z.getAttribute("width")),k=Aa("height",z.getAttribute("height")),n=z.getAttribute("viewBox"),o=n?n.split(" "):[0,0,F,k];for(e=0;e<4;++e)o[e]=+o[e];m.getAttribute("width");var w=+m.getAttribute("height");G=k>F?"scale("+w/3/o[3]+")":"scale("+w/3/o[2]+")";G="translate(0) "+
G+" translate(0)";A=f.createElementNS(b,"symbol");var E=gb();for(svgedit.browser.isGecko()&&$(z).find("linearGradient, radialGradient, pattern").appendTo(E);z.firstChild;)A.appendChild(z.firstChild);var H=z.attributes;for(z=0;z<H.length;z++){var J=H[z];A.setAttribute(J.nodeName,J.nodeValue)}A.id=ka();lb[h]={symbol:A,xform:G};gb().appendChild(A);B.addSubCommand(new Ha(A))}var O=f.createElementNS(b,"use");O.id=ka();T(O,"#"+A.id);(L||C().getCurrentLayer()).appendChild(O);B.addSubCommand(new Ha(O));Ia(); G+" translate(0)";A=f.createElementNS(b,"symbol");var E=gb();for(svgedit.browser.isGecko()&&$(z).find("linearGradient, radialGradient, pattern").appendTo(E);z.firstChild;)A.appendChild(z.firstChild);var I=z.attributes;for(z=0;z<I.length;z++){var J=I[z];A.setAttribute(J.nodeName,J.nodeValue)}A.id=ka();lb[h]={symbol:A,xform:G};gb().appendChild(A);B.addSubCommand(new Ha(A))}var O=f.createElementNS(b,"use");O.id=ka();T(O,"#"+A.id);(L||C().getCurrentLayer()).appendChild(O);B.addSubCommand(new Ha(O));Ia();
O.setAttribute("transform",G);Ra(O);$(O).data("symbol",A).data("ref",A);qb([O]);wa(B);M("changed",[m])}catch(Y){console.log(Y);return false}return true};var xb=d.identifyLayers=function(){Eb();C().identifyLayers()};this.createLayer=function(e){var h=new Ca("Create Layer");e=C().createLayer(e);h.addSubCommand(new Ha(e));wa(h);Ia();M("changed",[e])};this.cloneLayer=function(e){var h=new Ca("Duplicate Layer"),l=f.createElementNS(b,"g"),B=f.createElementNS(b,"title");B.textContent=e;l.appendChild(B); O.setAttribute("transform",G);Ra(O);$(O).data("symbol",A).data("ref",A);qb([O]);wa(B);M("changed",[m])}catch(Y){console.log(Y);return false}return true};var xb=d.identifyLayers=function(){Eb();C().identifyLayers()};this.createLayer=function(e){var h=new Ca("Create Layer");e=C().createLayer(e);h.addSubCommand(new Ha(e));wa(h);Ia();M("changed",[e])};this.cloneLayer=function(e){var h=new Ca("Duplicate Layer"),l=f.createElementNS(b,"g"),B=f.createElementNS(b,"title");B.textContent=e;l.appendChild(B);
B=C().getCurrentLayer();$(B).after(l);B=B.childNodes;for(var A=0;A<B.length;A++){var G=B[A];G.localName!="title"&&l.appendChild(ia(G))}Ia();xb();h.addSubCommand(new Ha(l));wa(h);d.setCurrentLayer(e);M("changed",[l])};this.deleteCurrentLayer=function(){var e=C().getCurrentLayer(),h=e.nextSibling,l=e.parentNode;if(e=C().deleteCurrentLayer()){var B=new Ca("Delete Layer");B.addSubCommand(new Ga(e,h,l));wa(B);Ia();M("changed",[l]);return true}return false};this.setCurrentLayer=function(e){(e=C().setCurrentLayer(svgedit.utilities.toXml(e)))&& B=C().getCurrentLayer();$(B).after(l);B=B.childNodes;for(var A=0;A<B.length;A++){var G=B[A];G.localName!="title"&&l.appendChild(ia(G))}Ia();xb();h.addSubCommand(new Ha(l));wa(h);d.setCurrentLayer(e);M("changed",[l])};this.deleteCurrentLayer=function(){var e=C().getCurrentLayer(),h=e.nextSibling,l=e.parentNode;if(e=C().deleteCurrentLayer()){var B=new Ca("Delete Layer");B.addSubCommand(new Ga(e,h,l));wa(B);Ia();M("changed",[l]);return true}return false};this.setCurrentLayer=function(e){(e=C().setCurrentLayer(svgedit.utilities.toXml(e)))&&
Ia();return e};this.renameCurrentLayer=function(e){var h=C();if(h.current_layer){var l=h.current_layer;if(!d.setCurrentLayer(e)){for(var B=new Ca("Rename Layer"),A=0;A<h.getNumLayers();++A)if(h.all_layers[A][1]==l)break;var G=h.getLayerName(A);h.all_layers[A][0]=svgedit.utilities.toXml(e);var D=l.childNodes.length;for(A=0;A<D;++A){var z=l.childNodes.item(A);if(z&&z.tagName=="title"){for(;z.firstChild;)z.removeChild(z.firstChild);z.textContent=e;B.addSubCommand(new Ma(z,{"#text":G}));wa(B);M("changed", Ia();return e};this.renameCurrentLayer=function(e){var h=C();if(h.current_layer){var l=h.current_layer;if(!d.setCurrentLayer(e)){for(var B=new Ca("Rename Layer"),A=0;A<h.getNumLayers();++A)if(h.all_layers[A][1]==l)break;var G=h.getLayerName(A);h.all_layers[A][0]=svgedit.utilities.toXml(e);var D=l.childNodes.length;for(A=0;A<D;++A){var z=l.childNodes.item(A);if(z&&z.tagName=="title"){for(;z.firstChild;)z.removeChild(z.firstChild);z.textContent=e;B.addSubCommand(new Ma(z,{"#text":G}));wa(B);M("changed",
[l]);return true}}}h.current_layer=l}return false};this.setCurrentLayerPosition=function(e){var h=C();if(h.current_layer&&e>=0&&e<h.getNumLayers()){for(var l=0;l<h.getNumLayers();++l)if(h.all_layers[l][1]==h.current_layer)break;if(l==h.getNumLayers())return false;if(l!=e){var B=null,A=h.current_layer.nextSibling;if(e>l){if(e<h.getNumLayers()-1)B=h.all_layers[e+1][1]}else B=h.all_layers[e][1];m.insertBefore(h.current_layer,B);wa(new Ja(h.current_layer,A,m));xb();d.setCurrentLayer(h.getLayerName(e)); [l]);return true}}}h.current_layer=l}return false};this.setCurrentLayerPosition=function(e){var h=C();if(h.current_layer&&e>=0&&e<h.getNumLayers()){for(var l=0;l<h.getNumLayers();++l)if(h.all_layers[l][1]==h.current_layer)break;if(l==h.getNumLayers())return false;if(l!=e){var B=null,A=h.current_layer.nextSibling;if(e>l){if(e<h.getNumLayers()-1)B=h.all_layers[e+1][1]}else B=h.all_layers[e][1];m.insertBefore(h.current_layer,B);wa(new Ja(h.current_layer,A,m));xb();d.setCurrentLayer(h.getLayerName(e));
return true}}return false};this.setLayerVisibility=function(e,h){var l=C(),B=l.getLayerVisibility(e),A=l.setLayerVisibility(e,h);if(A)wa(new Ma(A,{display:B?"inline":"none"},"Layer Visibility"));else return false;if(A==l.getCurrentLayer()){Ia();La.clear()}return true};this.moveSelectedToLayer=function(e){for(var h=null,l=C(),B=0;B<l.getNumLayers();++B)if(l.getLayerName(B)==e){h=l.all_layers[B][1];break}if(!h)return false;e=new Ca("Move Elements to Layer");l=I;for(B=l.length;B--;){var A=l[B];if(A){var G= return true}}return false};this.setLayerVisibility=function(e,h){var l=C(),B=l.getLayerVisibility(e),A=l.setLayerVisibility(e,h);if(A)wa(new Ma(A,{display:B?"inline":"none"},"Layer Visibility"));else return false;if(A==l.getCurrentLayer()){Ia();La.clear()}return true};this.moveSelectedToLayer=function(e){for(var h=null,l=C(),B=0;B<l.getNumLayers();++B)if(l.getLayerName(B)==e){h=l.all_layers[B][1];break}if(!h)return false;e=new Ca("Move Elements to Layer");l=H;for(B=l.length;B--;){var A=l[B];if(A){var G=
A.nextSibling,D=A.parentNode;h.appendChild(A);e.addSubCommand(new Ja(A,G,D))}}wa(e);return true};this.mergeLayer=function(e){var h=new Ca("Merge Layer"),l=C(),B=$(l.current_layer).prev()[0];if(B){for(h.addSubCommand(new Ga(l.current_layer,l.current_layer.nextSibling,m));l.current_layer.firstChild;){var A=l.current_layer.firstChild;if(A.localName=="title"){h.addSubCommand(new Ga(A,A.nextSibling,l.current_layer));l.current_layer.removeChild(A)}else{var G=A.nextSibling;B.appendChild(A);h.addSubCommand(new Ja(A, A.nextSibling,D=A.parentNode;h.appendChild(A);e.addSubCommand(new Ja(A,G,D))}}wa(e);return true};this.mergeLayer=function(e){var h=new Ca("Merge Layer"),l=C(),B=$(l.current_layer).prev()[0];if(B){for(h.addSubCommand(new Ga(l.current_layer,l.current_layer.nextSibling,m));l.current_layer.firstChild;){var A=l.current_layer.firstChild;if(A.localName=="title"){h.addSubCommand(new Ga(A,A.nextSibling,l.current_layer));l.current_layer.removeChild(A)}else{var G=A.nextSibling;B.appendChild(A);h.addSubCommand(new Ja(A,
G,l.current_layer))}}m.removeChild(l.current_layer);if(!e){Ia();xb();M("changed",[m]);wa(h)}l.current_layer=B;return h}};this.mergeAllLayers=function(){var e=new Ca("Merge all Layers"),h=C();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(m).children("g").length>1;)e.addSubCommand(d.mergeLayer(true));Ia();xb();M("changed",[m]);wa(e)};var Eb=this.leaveContext=function(){var e=ta.length;if(e){for(var h=0;h<e;h++){var l=ta[h],B=cb(l,"orig_opac");B!==1?l.setAttribute("opacity",B):l.removeAttribute("opacity"); G,l.current_layer))}}m.removeChild(l.current_layer);if(!e){Ia();xb();M("changed",[m]);wa(h)}l.current_layer=B;return h}};this.mergeAllLayers=function(){var e=new Ca("Merge all Layers"),h=C();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(m).children("g").length>1;)e.addSubCommand(d.mergeLayer(true));Ia();xb();M("changed",[m]);wa(e)};var Eb=this.leaveContext=function(){var e=ta.length;if(e){for(var h=0;h<e;h++){var l=ta[h],B=cb(l,"orig_opac");B!==1?l.setAttribute("opacity",B):l.removeAttribute("opacity");
l.setAttribute("style","pointer-events: inherit")}ta=[];Ia(true);M("contextset",null)}L=null},Kb=this.setContext=function(e){Eb();if(typeof e==="string")e=pa(e);L=e;$(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||1;cb(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style","pointer-events: none");ta.push(this)});Ia();M("contextset",L)};this.clear=function(){La.clear();Ia();d.clearSvgContentElement();d.current_drawing_= l.setAttribute("style","pointer-events: inherit")}ta=[];Ia(true);M("contextset",null)}L=null},Kb=this.setContext=function(e){Eb();if(typeof e==="string")e=pa(e);L=e;$(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||1;cb(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style","pointer-events: none");ta.push(this)});Ia();M("contextset",L)};this.clear=function(){La.clear();Ia();d.clearSvgContentElement();d.current_drawing_=
new svgedit.draw.Drawing(m);d.createLayer("Layer 1");d.undoMgr.resetUndoStack();ra.initGroup();sa=ra.getRubberBandBox();M("cleared")};this.linkControlPoints=La.linkControlPoints;this.getContentElem=function(){return m};this.getRootElem=function(){return c};this.getSelectedElems=function(){return I};var zb=this.getResolution=function(){var e=m.getAttribute("width")/s,h=m.getAttribute("height")/s;return{w:e,h:h,zoom:s}};this.getZoom=function(){return s};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"}; new svgedit.draw.Drawing(m);d.createLayer("Layer 1");d.undoMgr.resetUndoStack();ra.initGroup();sa=ra.getRubberBandBox();M("cleared")};this.linkControlPoints=La.linkControlPoints;this.getContentElem=function(){return m};this.getRootElem=function(){return c};this.getSelectedElems=function(){return H};var zb=this.getResolution=function(){var e=m.getAttribute("width")/s,h=m.getAttribute("height")/s;return{w:e,h:h,zoom:s}};this.getZoom=function(){return s};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};
this.setUiStrings=function(e){$.extend(kb,e.notification)};this.setConfig=function(e){$.extend(p,e)};this.getTitle=function(e){if(e=e||I[0]){e=$(e).data("gsvg")||$(e).data("symbol")||e;e=e.childNodes;for(var h=0;h<e.length;h++)if(e[h].nodeName=="title")return e[h].textContent;return""}};this.setGroupTitle=function(e){var h=I[0];h=$(h).data("gsvg")||h;var l=$(h).children("title"),B=new Ca("Set Label");if(e.length)if(l.length){l=l[0];B.addSubCommand(new Ma(l,{"#text":l.textContent}));l.textContent= this.setUiStrings=function(e){$.extend(kb,e.notification)};this.setConfig=function(e){$.extend(p,e)};this.getTitle=function(e){if(e=e||H[0]){e=$(e).data("gsvg")||$(e).data("symbol")||e;e=e.childNodes;for(var h=0;h<e.length;h++)if(e[h].nodeName=="title")return e[h].textContent;return""}};this.setGroupTitle=function(e){var h=H[0];h=$(h).data("gsvg")||h;var l=$(h).children("title"),B=new Ca("Set Label");if(e.length)if(l.length){l=l[0];B.addSubCommand(new Ma(l,{"#text":l.textContent}));l.textContent=
e}else{l=f.createElementNS(b,"title");l.textContent=e;$(h).prepend(l);B.addSubCommand(new Ha(l))}else{B.addSubCommand(new Ga(l[0],l.nextSibling,h));l.remove()}wa(B)};this.getDocumentTitle=function(){return d.getTitle(m)};this.setDocumentTitle=function(e){for(var h=m.childNodes,l=false,B="",A=new Ca("Change Image Title"),G=0;G<h.length;G++)if(h[G].nodeName=="title"){l=h[G];B=l.textContent;break}if(!l){l=f.createElementNS(b,"title");m.insertBefore(l,m.firstChild)}if(e.length)l.textContent=e;else l.parentNode.removeChild(l); e}else{l=f.createElementNS(b,"title");l.textContent=e;$(h).prepend(l);B.addSubCommand(new Ha(l))}else{B.addSubCommand(new Ga(l[0],l.nextSibling,h));l.remove()}wa(B)};this.getDocumentTitle=function(){return d.getTitle(m)};this.setDocumentTitle=function(e){for(var h=m.childNodes,l=false,B="",A=new Ca("Change Image Title"),G=0;G<h.length;G++)if(h[G].nodeName=="title"){l=h[G];B=l.textContent;break}if(!l){l=f.createElementNS(b,"title");m.insertBefore(l,m.firstChild)}if(e.length)l.textContent=e;else l.parentNode.removeChild(l);
A.addSubCommand(new Ma(l,{"#text":B}));wa(A)};this.getEditorNS=function(e){e&&m.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(e,h){var l=zb(),B=l.w;l=l.h;var A;if(e=="fit"){var G=getStrokedBBox();if(G){A=new Ca("Fit Canvas to Content");var D=pb();qb(D);var z=[],F=[];$.each(D,function(){z.push(G.x*-1);F.push(G.y*-1)});D=d.moveSelectedElements(z,F,true);A.addSubCommand(D);Ia();e=Math.round(G.width);h=Math.round(G.height)}else return false}if(e!= A.addSubCommand(new Ma(l,{"#text":B}));wa(A)};this.getEditorNS=function(e){e&&m.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(e,h){var l=zb(),B=l.w;l=l.h;var A;if(e=="fit"){var G=getStrokedBBox();if(G){A=new Ca("Fit Canvas to Content");var D=pb();qb(D);var z=[],F=[];$.each(D,function(){z.push(G.x*-1);F.push(G.y*-1)});D=d.moveSelectedElements(z,F,true);A.addSubCommand(D);Ia();e=Math.round(G.width);h=Math.round(G.height)}else return false}if(e!=
B||h!=l){D=c.suspendRedraw(1E3);A||(A=new Ca("Change Image Dimensions"));e=Aa("width",e);h=Aa("height",h);m.setAttribute("width",e);m.setAttribute("height",h);this.contentW=e;this.contentH=h;A.addSubCommand(new Ma(m,{width:B,height:l}));m.setAttribute("viewBox",[0,0,e/s,h/s].join(" "));A.addSubCommand(new Ma(m,{viewBox:["0 0",B,l].join(" ")}));wa(A);c.unsuspendRedraw(D);if(background=document.getElementById("canvas_background")){background.setAttribute("x",-1);background.setAttribute("y",-1);background.setAttribute("width", B||h!=l){D=c.suspendRedraw(1E3);A||(A=new Ca("Change Image Dimensions"));e=Aa("width",e);h=Aa("height",h);m.setAttribute("width",e);m.setAttribute("height",h);this.contentW=e;this.contentH=h;A.addSubCommand(new Ma(m,{width:B,height:l}));m.setAttribute("viewBox",[0,0,e/s,h/s].join(" "));A.addSubCommand(new Ma(m,{viewBox:["0 0",B,l].join(" ")}));wa(A);c.unsuspendRedraw(D);if(background=document.getElementById("canvas_background")){background.setAttribute("x",-1);background.setAttribute("y",-1);background.setAttribute("width",
e+2);background.setAttribute("height",h+2)}M("changed",[m])}return[e,h]};this.getOffset=function(){return $(m).attr(["x","y"])};this.setBBoxZoom=function(e,h,l){var B=0.85,A=function(G){if(!G)return false;var D=Math.min(Math.round(h/G.width*100*B)/100,Math.round(l/G.height*100*B)/100);d.setZoom(D);return{zoom:D,bbox:G}};if(typeof e=="object"){e=e;if(e.width==0||e.height==0){d.setZoom(e.zoom?e.zoom:s*e.factor);return{zoom:s,bbox:e}}return A(e)}switch(e){case "selection":if(!I[0])return;e=$.map(I,function(G){if(G)return G}); e+2);background.setAttribute("height",h+2)}M("changed",[m])}return[e,h]};this.getOffset=function(){return $(m).attr(["x","y"])};this.setBBoxZoom=function(e,h,l){var B=0.85,A=function(G){if(!G)return false;var D=Math.min(Math.round(h/G.width*100*B)/100,Math.round(l/G.height*100*B)/100);d.setZoom(D);return{zoom:D,bbox:G}};if(typeof e=="object"){e=e;if(e.width==0||e.height==0){d.setZoom(e.zoom?e.zoom:s*e.factor);return{zoom:s,bbox:e}}return A(e)}switch(e){case "selection":if(!H[0])return;e=$.map(H,function(G){if(G)return G});
e=getStrokedBBox(e);break;case "canvas":e=zb();B=0.95;e={width:e.w,height:e.h,x:0,y:0};break;case "content":e=getStrokedBBox();break;case "layer":e=getStrokedBBox(pb(C().getCurrentLayer()));break;default:return}return A(e)};this.setZoom=function(e){var h=zb();m.setAttribute("viewBox","0 0 "+h.w/e+" "+h.h/e);s=e;$.each(I,function(l,B){B&&ra.requestSelector(B).resize()});La.zoomChange();ib("zoomChanged",e)};this.getMode=function(){return Fa};this.setMode=function(e){La.clear(true);bb.clear();$("#workarea").attr("class", e=getStrokedBBox(e);break;case "canvas":e=zb();B=0.95;e={width:e.w,height:e.h,x:0,y:0};break;case "content":e=getStrokedBBox();break;case "layer":e=getStrokedBBox(pb(C().getCurrentLayer()));break;default:return}return A(e)};this.setZoom=function(e){var h=zb();m.setAttribute("viewBox","0 0 "+h.w/e+" "+h.h/e);s=e;$.each(H,function(l,B){B&&ra.requestSelector(B).resize()});La.zoomChange();ib("zoomChanged",e)};this.getMode=function(){return Fa};this.setMode=function(e){La.clear(true);bb.clear();$("#workarea").attr("class",
e);Xa=I[0]&&I[0].nodeName=="text"?Ua:K;Fa=e};this.getColor=function(e){return Xa[e]};this.setColor=function(e,h,l){K[e]=h;Xa[e+"_paint"]={type:"solidColor"};for(var B=[],A=I.length;A--;){var G=I[A];if(G)if(G.tagName=="g")svgedit.utilities.walkTree(G,function(D){D.nodeName!="g"&&B.push(D)});else if(e=="fill")G.tagName!="polyline"&&G.tagName!="line"&&B.push(G);else B.push(G)}if(B.length>0)if(l)Ab(e,h,B);else{Ya(e,h,B);M("changed",B)}};var gb=function(){var e=m.getElementsByTagNameNS(b,"defs");if(e.length> e);Xa=H[0]&&H[0].nodeName=="text"?Ua:K;Fa=e};this.getColor=function(e){return Xa[e]};this.setColor=function(e,h,l){K[e]=h;Xa[e+"_paint"]={type:"solidColor"};for(var B=[],A=H.length;A--;){var G=H[A];if(G)if(G.tagName=="g")svgedit.utilities.walkTree(G,function(D){D.nodeName!="g"&&B.push(D)});else if(e=="fill")G.tagName!="polyline"&&G.tagName!="line"&&B.push(G);else B.push(G)}if(B.length>0)if(l)Ab(e,h,B);else{Ya(e,h,B);M("changed",B)}};var gb=function(){var e=m.getElementsByTagNameNS(b,"defs");if(e.length>
0)e=e[0];else{e=f.createElementNS(b,"defs");m.firstChild?m.insertBefore(e,m.firstChild.nextSibling):m.appendChild(e)}return e},Nb=this.setGradient=function(e){if(!(!Xa[e+"_paint"]||Xa[e+"_paint"].type=="solidColor")){var h=d[e+"Grad"],l=Mb(h),B=gb();if(l)h=l;else{h=B.appendChild(f.importNode(h,true));h.id=ka()}d.setColor(e,"url(#"+h.id+")");if(e=="canvas")(e=document.getElementById("canvas_background"))&&e.setAttribute("fill","url(#"+h.id+")")}},Mb=function(e){var h=gb();h=$(h).find("linearGradient, radialGradient"); 0)e=e[0];else{e=f.createElementNS(b,"defs");m.firstChild?m.insertBefore(e,m.firstChild.nextSibling):m.appendChild(e)}return e},Nb=this.setGradient=function(e){if(!(!Xa[e+"_paint"]||Xa[e+"_paint"].type=="solidColor")){var h=d[e+"Grad"],l=Mb(h),B=gb();if(l)h=l;else{h=B.appendChild(f.importNode(h,true));h.id=ka()}d.setColor(e,"url(#"+h.id+")");if(e=="canvas")(e=document.getElementById("canvas_background"))&&e.setAttribute("fill","url(#"+h.id+")")}},Mb=function(e){var h=gb();h=$(h).find("linearGradient, radialGradient");
for(var l=h.length,B=["r","cx","cy","fx","fy"];l--;){var A=h[l];if(e.tagName=="linearGradient"){if(e.getAttribute("x1")!=A.getAttribute("x1")||e.getAttribute("y1")!=A.getAttribute("y1")||e.getAttribute("x2")!=A.getAttribute("x2")||e.getAttribute("y2")!=A.getAttribute("y2"))continue}else{var G=$(e).attr(B),D=$(A).attr(B),z=false;$.each(B,function(E,H){if(G[H]!=D[H])z=true});if(z)continue}var F=e.getElementsByTagNameNS(b,"stop"),k=A.getElementsByTagNameNS(b,"stop");if(F.length==k.length){for(var n= for(var l=h.length,B=["r","cx","cy","fx","fy"];l--;){var A=h[l];if(e.tagName=="linearGradient"){if(e.getAttribute("x1")!=A.getAttribute("x1")||e.getAttribute("y1")!=A.getAttribute("y1")||e.getAttribute("x2")!=A.getAttribute("x2")||e.getAttribute("y2")!=A.getAttribute("y2"))continue}else{var G=$(e).attr(B),D=$(A).attr(B),z=false;$.each(B,function(E,I){if(G[I]!=D[I])z=true});if(z)continue}var F=e.getElementsByTagNameNS(b,"stop"),k=A.getElementsByTagNameNS(b,"stop");if(F.length==k.length){for(var n=
F.length;n--;){var o=F[n],w=k[n];if(o.getAttribute("offset")!=w.getAttribute("offset")||o.getAttribute("stop-opacity")!=w.getAttribute("stop-opacity")||o.getAttribute("stop-color")!=w.getAttribute("stop-color"))break}if(n==-1)return A}}return null};this.setPaint=function(e,h){var l=new $.jGraduate.Paint(h);this.setPaintOpacity(e,l.alpha/100,true);Xa[e+"_paint"]=l;switch(l.type){case "solidColor":if(l.solidColor!="none"&&l.solidColor!="#none")this.setColor(e,"#"+l.solidColor);else{this.setColor(e, F.length;n--;){var o=F[n],w=k[n];if(o.getAttribute("offset")!=w.getAttribute("offset")||o.getAttribute("stop-opacity")!=w.getAttribute("stop-opacity")||o.getAttribute("stop-color")!=w.getAttribute("stop-color"))break}if(n==-1)return A}}return null};this.setPaint=function(e,h){var l=new $.jGraduate.Paint(h);this.setPaintOpacity(e,l.alpha/100,true);Xa[e+"_paint"]=l;switch(l.type){case "solidColor":if(l.solidColor!="none"&&l.solidColor!="#none")this.setColor(e,"#"+l.solidColor);else{this.setColor(e,
"none");document.querySelector(e=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","none")}break;case "linearGradient":case "radialGradient":d[e+"Grad"]=l[l.type];Nb(e)}};this.getStrokeWidth=function(){return Xa.stroke_width};this.setStrokeWidth=function(e){if(e==0&&["line","path"].indexOf(Fa)>=0)d.setStrokeWidth(1);else{Xa.stroke_width=e;for(var h=[],l=I.length;l--;){var B=I[l];if(B)B.tagName=="g"?svgedit.utilities.walkTree(B,function(A){A.nodeName!="g"&&h.push(A)}):h.push(B)}if(h.length> "none");document.querySelector(e=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","none")}break;case "linearGradient":case "radialGradient":d[e+"Grad"]=l[l.type];Nb(e)}};this.getStrokeWidth=function(){return Xa.stroke_width};this.setStrokeWidth=function(e){if(e==0&&["line","path"].indexOf(Fa)>=0)d.setStrokeWidth(1);else{Xa.stroke_width=e;for(var h=[],l=H.length;l--;){var B=H[l];if(B)B.tagName=="g"?svgedit.utilities.walkTree(B,function(A){A.nodeName!="g"&&h.push(A)}):h.push(B)}if(h.length>
0){Ya("stroke-width",e,h);M("changed",I)}}};this.setStrokeAttr=function(e,h){K[e.replace("-","_")]=h;for(var l=[],B=I.length;B--;){var A=I[B];if(A)A.tagName=="g"?svgedit.utilities.walkTree(A,function(G){G.nodeName!="g"&&l.push(G)}):l.push(A)}if(l.length>0){Ya(e,h,l);M("changed",I)}};this.getStyle=function(){return K};this.getOpacity=function(){return K.opacity};this.setOpacity=function(e){K.opacity=e;Ya("opacity",e)};this.getFillOpacity=function(){return K.fill_opacity};this.getStrokeOpacity=function(){return K.stroke_opacity}; 0){Ya("stroke-width",e,h);M("changed",H)}}};this.setStrokeAttr=function(e,h){K[e.replace("-","_")]=h;for(var l=[],B=H.length;B--;){var A=H[B];if(A)A.tagName=="g"?svgedit.utilities.walkTree(A,function(G){G.nodeName!="g"&&l.push(G)}):l.push(A)}if(l.length>0){Ya(e,h,l);M("changed",H)}};this.getStyle=function(){return K};this.getOpacity=function(){return K.opacity};this.setOpacity=function(e){K.opacity=e;Ya("opacity",e)};this.getFillOpacity=function(){return K.fill_opacity};this.getStrokeOpacity=function(){return K.stroke_opacity};
this.setPaintOpacity=function(e,h,l){K[e+"_opacity"]=h;l?Ab(e+"-opacity",h):Ya(e+"-opacity",h)};this.getBlur=function(e){var h=0;if(e)if(e.getAttribute("filter"))if(e=pa(e.id+"_blur"))h=e.firstChild.getAttribute("stdDeviation");return h};(function(){function e(){var A=d.undoMgr.finishUndoableChange();h.addSubCommand(A);wa(h);l=h=null}var h=null,l=null,B=false;d.setBlurNoUndo=function(A){if(l)if(A===0){Ab("filter","");B=true}else{var G=I[0];B&&Ab("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter"); this.setPaintOpacity=function(e,h,l){K[e+"_opacity"]=h;l?Ab(e+"-opacity",h):Ya(e+"-opacity",h)};this.getBlur=function(e){var h=0;if(e)if(e.getAttribute("filter"))if(e=pa(e.id+"_blur"))h=e.firstChild.getAttribute("stdDeviation");return h};(function(){function e(){var A=d.undoMgr.finishUndoableChange();h.addSubCommand(A);wa(h);l=h=null}var h=null,l=null,B=false;d.setBlurNoUndo=function(A){if(l)if(A===0){Ab("filter","");B=true}else{var G=H[0];B&&Ab("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter");
G.setAttribute("filter","url(#"+G.id+"_blur)")}Ab("stdDeviation",A,[l.firstChild]);d.setBlurOffsets(l,A)}else d.setBlur(A)};d.setBlurOffsets=function(A,G){if(G>3)ma(A,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){A.removeAttribute("x");A.removeAttribute("y");A.removeAttribute("width");A.removeAttribute("height")}};d.setBlur=function(A,G){if(h)e();else{var D=I[0],z=D.id;l=pa(z+"_blur");A-=0;var F=new Ca;if(l){if(A===0)l=null}else{var k=Q({element:"feGaussianBlur", G.setAttribute("filter","url(#"+G.id+"_blur)")}Ab("stdDeviation",A,[l.firstChild]);d.setBlurOffsets(l,A)}else d.setBlur(A)};d.setBlurOffsets=function(A,G){if(G>3)ma(A,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){A.removeAttribute("x");A.removeAttribute("y");A.removeAttribute("width");A.removeAttribute("height")}};d.setBlur=function(A,G){if(h)e();else{var D=H[0],z=D.id;l=pa(z+"_blur");A-=0;var F=new Ca;if(l){if(A===0)l=null}else{var k=S({element:"feGaussianBlur",
attr:{"in":"SourceGraphic",stdDeviation:A}});l=Q({element:"filter",attr:{id:z+"_blur"}});l.appendChild(k);gb().appendChild(l);F.addSubCommand(new Ha(l))}k={filter:D.getAttribute("filter")};if(A===0){D.removeAttribute("filter");F.addSubCommand(new Ma(D,k))}else{Ya("filter","url(#"+z+"_blur)");F.addSubCommand(new Ma(D,k));d.setBlurOffsets(l,A);h=F;d.undoMgr.beginUndoableChange("stdDeviation",[l?l.firstChild:null]);if(G){d.setBlurNoUndo(A);e()}}}}})();this.getBold=function(){var e=I[0];if(e!=null&&e.tagName== attr:{"in":"SourceGraphic",stdDeviation:A}});l=S({element:"filter",attr:{id:z+"_blur"}});l.appendChild(k);gb().appendChild(l);F.addSubCommand(new Ha(l))}k={filter:D.getAttribute("filter")};if(A===0){D.removeAttribute("filter");F.addSubCommand(new Ma(D,k))}else{Ya("filter","url(#"+z+"_blur)");F.addSubCommand(new Ma(D,k));d.setBlurOffsets(l,A);h=F;d.undoMgr.beginUndoableChange("stdDeviation",[l?l.firstChild:null]);if(G){d.setBlurNoUndo(A);e()}}}}})();this.getBold=function(){var e=H[0];if(e!=null&&e.tagName==
"text"&&I[1]==null)return e.getAttribute("font-weight")=="bold";return false};this.setBold=function(e){var h=I[0];if(h!=null&&h.tagName=="text"&&I[1]==null)Ya("font-weight",e?"bold":"normal");I[0].textContent||bb.setCursor()};this.getItalic=function(){var e=I[0];if(e!=null&&e.tagName=="text"&&I[1]==null)return e.getAttribute("font-style")=="italic";return false};this.setItalic=function(e){var h=I[0];if(h!=null&&h.tagName=="text"&&I[1]==null)Ya("font-style",e?"italic":"normal");I[0].textContent||bb.setCursor()}; "text"&&H[1]==null)return e.getAttribute("font-weight")=="bold";return false};this.setBold=function(e){var h=H[0];if(h!=null&&h.tagName=="text"&&H[1]==null)Ya("font-weight",e?"bold":"normal");H[0].textContent||bb.setCursor()};this.getItalic=function(){var e=H[0];if(e!=null&&e.tagName=="text"&&H[1]==null)return e.getAttribute("font-style")=="italic";return false};this.setItalic=function(e){var h=H[0];if(h!=null&&h.tagName=="text"&&H[1]==null)Ya("font-style",e?"italic":"normal");H[0].textContent||bb.setCursor()};
this.getFontFamily=function(){return Ua.font_family};this.setFontFamily=function(e){Ua.font_family=e;Ya("font-family",e);I[0]&&!I[0].textContent&&bb.setCursor()};this.setFontColor=function(e){Ua.fill=e;Ya("fill",e)};this.getFontSize=function(){return Ua.fill};this.getFontSize=function(){return Ua.font_size};this.setFontSize=function(e){Ua.font_size=e;Ya("font-size",e);I[0].textContent||bb.setCursor()};this.getText=function(){var e=I[0];if(e==null)return"";return e.textContent};this.setTextContent= this.getFontFamily=function(){return Ua.font_family};this.setFontFamily=function(e){Ua.font_family=e;Ya("font-family",e);H[0]&&!H[0].textContent&&bb.setCursor()};this.setFontColor=function(e){Ua.fill=e;Ya("fill",e)};this.getFontSize=function(){return Ua.fill};this.getFontSize=function(){return Ua.font_size};this.setFontSize=function(e){Ua.font_size=e;Ya("font-size",e);H[0].textContent||bb.setCursor()};this.getText=function(){var e=H[0];if(e==null)return"";return e.textContent};this.setTextContent=
function(e){Ya("#text",e);bb.init(e);bb.setCursor()};this.setImageURL=function(e){var h=I[0];if(h){var l=$(h).attr(["width","height"]);l=!l.width||!l.height;var B=ba(h);if(B!==e)l=true;else if(!l)return;var A=new Ca("Change Image URL");T(h,e);A.addSubCommand(new Ma(h,{"#href":B}));l?$(new Image).load(function(){var G=$(h).attr(["width","height"]);$(h).attr({width:this.width,height:this.height});ra.requestSelector(h).resize();A.addSubCommand(new Ma(h,G));wa(A);M("changed",[h])}).attr("src",e):wa(A)}}; function(e){Ya("#text",e);bb.init(e);bb.setCursor()};this.setImageURL=function(e){var h=H[0];if(h){var l=$(h).attr(["width","height"]);l=!l.width||!l.height;var B=ba(h);if(B!==e)l=true;else if(!l)return;var A=new Ca("Change Image URL");T(h,e);A.addSubCommand(new Ma(h,{"#href":B}));l?$(new Image).load(function(){var G=$(h).attr(["width","height"]);$(h).attr({width:this.width,height:this.height});ra.requestSelector(h).resize();A.addSubCommand(new Ma(h,G));wa(A);M("changed",[h])}).attr("src",e):wa(A)}};
this.setLinkURL=function(e){var h=I[0];if(h){if(h.tagName!=="a"){h=$(h).parents("a");if(h.length)h=h[0];else return}var l=ba(h);if(l!==e){var B=new Ca("Change Link URL");T(h,e);B.addSubCommand(new Ma(h,{"#href":l}));wa(B)}}};this.elementsAreSame=function(e){return!e.length||e[0]==null?null:I.every(function(h){return h&&I[0]?h.nodeName==I[0].nodeName:null})};this.setRectRadius=function(e){d.elementsAreSame(I)&&I[0].tagName=="rect"&&I.forEach(function(h){var l=h.getAttribute("rx");if(l!=e){h.setAttribute("rx", this.setLinkURL=function(e){var h=H[0];if(h){if(h.tagName!=="a"){h=$(h).parents("a");if(h.length)h=h[0];else return}var l=ba(h);if(l!==e){var B=new Ca("Change Link URL");T(h,e);B.addSubCommand(new Ma(h,{"#href":l}));wa(B)}}};this.elementsAreSame=function(e){return!e.length||e[0]==null?null:H.every(function(h){return h&&H[0]?h.nodeName==H[0].nodeName:null})};this.setRectRadius=function(e){d.elementsAreSame(H)&&H[0].tagName=="rect"&&H.forEach(function(h){var l=h.getAttribute("rx");if(l!=e){h.setAttribute("rx",
e);h.setAttribute("ry",e);wa(new Ma(h,{rx:l,ry:l},"Radius"));M("changed",[h])}})};this.makeHyperlink=function(e){d.groupSelectedElements("a",e)};this.removeHyperlink=function(){d.ungroupSelectedElement()};this.setSegType=function(e){La.setSegType(e)};this.convertToPath=function(e,h){if(e==null)$.each(I,function(da,V){V&&d.convertToPath(V)});else{if(!h)var l=new Ca("Convert element to Path");var B=h?{}:{fill:K.fill,"fill-opacity":K.fill_opacity,stroke:K.stroke,"stroke-width":K.stroke_width,"stroke-dasharray":K.stroke_dasharray, e);h.setAttribute("ry",e);wa(new Ma(h,{rx:l,ry:l},"Radius"));M("changed",[h])}})};this.makeHyperlink=function(e){d.groupSelectedElements("a",e)};this.removeHyperlink=function(){d.ungroupSelectedElement()};this.setSegType=function(e){La.setSegType(e)};this.convertToPath=function(e,h){if(e==null)$.each(H,function(da,V){V&&d.convertToPath(V)});else{if(!h)var l=new Ca("Convert element to Path");var B=h?{}:{fill:K.fill,"fill-opacity":K.fill_opacity,stroke:K.stroke,"stroke-width":K.stroke_width,"stroke-dasharray":K.stroke_dasharray,
"stroke-linejoin":K.stroke_linejoin,"stroke-linecap":K.stroke_linecap,"stroke-opacity":K.stroke_opacity,opacity:K.opacity,visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(e.getAttribute(this))B[this]=e.getAttribute(this)});var A=Q({element:"path",attr:B}),G=e.getAttribute("transform");G&&A.setAttribute("transform",G);var D=e.id,z=e.parentNode;e.nextSibling?z.insertBefore(A,e):z.appendChild(A);var F="",k=function(da){$.each(da,function(V,fa){var ha= "stroke-linejoin":K.stroke_linejoin,"stroke-linecap":K.stroke_linecap,"stroke-opacity":K.stroke_opacity,opacity:K.opacity,visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(e.getAttribute(this))B[this]=e.getAttribute(this)});var A=S({element:"path",attr:B}),G=e.getAttribute("transform");G&&A.setAttribute("transform",G);var D=e.id,z=e.parentNode;e.nextSibling?z.insertBefore(A,e):z.appendChild(A);var F="",k=function(da){$.each(da,function(V,fa){var ha=
fa[1];F+=fa[0];for(var W=0;W<ha.length;W+=2)F+=ha[W]+","+ha[W+1]+" "})},n=1.81;switch(e.tagName){case "ellipse":case "circle":var o=$(e).attr(["rx","ry","cx","cy"]),w=o.cx,E=o.cy,H=o.rx;o=o.ry;if(e.tagName=="circle")H=o=$(e).attr("r");k([["M",[w-H,E]],["C",[w-H,E-o/n,w-H/n,E-o,w,E-o]],["C",[w+H/n,E-o,w+H,E-o/n,w+H,E]],["C",[w+H,E+o/n,w+H/n,E+o,w,E+o]],["C",[w-H/n,E+o,w-H,E+o/n,w-H,E]],["Z",[]]]);break;case "path":F=e.getAttribute("d");break;case "line":o=$(e).attr(["x1","y1","x2","y2"]);F="M"+o.x1+ fa[1];F+=fa[0];for(var W=0;W<ha.length;W+=2)F+=ha[W]+","+ha[W+1]+" "})},n=1.81;switch(e.tagName){case "ellipse":case "circle":var o=$(e).attr(["rx","ry","cx","cy"]),w=o.cx,E=o.cy,I=o.rx;o=o.ry;if(e.tagName=="circle")I=o=$(e).attr("r");k([["M",[w-I,E]],["C",[w-I,E-o/n,w-I/n,E-o,w,E-o]],["C",[w+I/n,E-o,w+I,E-o/n,w+I,E]],["C",[w+I,E+o/n,w+I/n,E+o,w,E+o]],["C",[w-I/n,E+o,w-I,E+o/n,w-I,E]],["Z",[]]]);break;case "path":F=e.getAttribute("d");break;case "line":o=$(e).attr(["x1","y1","x2","y2"]);F="M"+o.x1+
","+o.y1+"L"+o.x2+","+o.y2;break;case "polyline":case "polygon":F="M"+e.getAttribute("points");break;case "rect":o=$(e).attr(["rx","ry"]);H=o.rx;o=o.ry;var J=e.getBBox();w=J.x;E=J.y;var O=J.width;J=J.height;n=4-n;if(!H&&!o)k([["M",[w,E]],["L",[w+O,E]],["L",[w+O,E+J]],["L",[w,E+J]],["L",[w,E]],["Z",[]]]);else{o||(o=H);k([["M",[w,E+o]],["C",[w,E+o/n,w+H/n,E,w+H,E]],["L",[w+O-H,E]],["C",[w+O-H/n,E,w+O,E+o/n,w+O,E+o]],["L",[w+O,E+J-o]],["C",[w+O,E+J-o/n,w+O-H/n,E+J,w+O-H,E+J]],["L",[w+H,E+J]],["C",[w+ ","+o.y1+"L"+o.x2+","+o.y2;break;case "polyline":case "polygon":F="M"+e.getAttribute("points");break;case "rect":o=$(e).attr(["rx","ry"]);I=o.rx;o=o.ry;var J=e.getBBox();w=J.x;E=J.y;var O=J.width;J=J.height;n=4-n;if(!I&&!o)k([["M",[w,E]],["L",[w+O,E]],["L",[w+O,E+J]],["L",[w,E+J]],["L",[w,E]],["Z",[]]]);else{o||(o=I);k([["M",[w,E+o]],["C",[w,E+o/n,w+I/n,E,w+I,E]],["L",[w+O-I,E]],["C",[w+O-I/n,E,w+O,E+o/n,w+O,E+o]],["L",[w+O,E+J-o]],["C",[w+O,E+J-o/n,w+O-I/n,E+J,w+O-I,E+J]],["L",[w+I,E+J]],["C",[w+
H/n,E+J,w,E+J-o/n,w,E+J-o]],["L",[w,E+o]],["Z",[]]])}break;default:A.parentNode.removeChild(A)}F&&A.setAttribute("d",F);if(h){La.resetOrientation(A);l=false;try{l=A.getBBox()}catch(Y){}A.parentNode.removeChild(A);return l}else{if(G){G=S(A);na(G)&&La.resetOrientation(A)}l.addSubCommand(new Ga(e,e.nextSibling,z));l.addSubCommand(new Ha(A));Ia();e.parentNode.removeChild(e);A.setAttribute("id",D);A.removeAttribute("visibility");qb([A],true);wa(l)}}};var Ab=this.changeSelectedAttributeNoUndo=function(e, I/n,E+J,w,E+J-o/n,w,E+J-o]],["L",[w,E+o]],["Z",[]]])}break;default:A.parentNode.removeChild(A)}F&&A.setAttribute("d",F);if(h){La.resetOrientation(A);l=false;try{l=A.getBBox()}catch(Y){}A.parentNode.removeChild(A);return l}else{if(G){G=R(A);oa(G)&&La.resetOrientation(A)}l.addSubCommand(new Ga(e,e.nextSibling,z));l.addSubCommand(new Ha(A));Ia();e.parentNode.removeChild(e);A.setAttribute("id",D);A.removeAttribute("visibility");qb([A],true);wa(l)}}};var Ab=this.changeSelectedAttributeNoUndo=function(e,
h,l){var B=c.suspendRedraw(1E3);Fa=="pathedit"&&La.moveNode(e,h);l=l||I;for(var A=l.length,G=["g","polyline","path"];A--;){var D=l[A];if(D!=null){Fa==="textedit"&&e!=="#text"&&D.textContent.length&&bb.toSelectMode(D);if((e==="x"||e==="y")&&G.indexOf(D.tagName)>=0){var z=getStrokedBBox([D]);d.moveSelectedElements((e==="x"?h-z.x:0)*s,(e==="y"?h-z.y:0)*s,true)}else{z=e==="#text"?D.textContent:D.getAttribute(e);if(z==null)z="";if(z!==String(h)){if(e=="#text"){svgedit.utilities.getBBox(D);D.textContent= h,l){var B=c.suspendRedraw(1E3);Fa=="pathedit"&&La.moveNode(e,h);l=l||H;for(var A=l.length,G=["g","polyline","path"];A--;){var D=l[A];if(D!=null){Fa==="textedit"&&e!=="#text"&&D.textContent.length&&bb.toSelectMode(D);if((e==="x"||e==="y")&&G.indexOf(D.tagName)>=0){var z=getStrokedBBox([D]);d.moveSelectedElements((e==="x"?h-z.x:0)*s,(e==="y"?h-z.y:0)*s,true)}else{z=e==="#text"?D.textContent:D.getAttribute(e);if(z==null)z="";if(z!==String(h)){if(e=="#text"){svgedit.utilities.getBBox(D);D.textContent=
h}else e=="#href"?T(D,h):D.setAttribute(e,h);I.indexOf(D)>=0&&setTimeout(function(){D.parentNode&&ra.requestSelector(D).resize()},0);z=oa(D);if(z!=0&&e!="transform")for(var F=S(D),k=F.numberOfItems;k--;)if(F.getItem(k).type==4){F.removeItem(k);var n=svgedit.utilities.getBBox(D),o=N(n.x+n.width/2,n.y+n.height/2,X(F).matrix);n=o.x;o=o.y;var w=c.createSVGTransform();w.setRotate(z,n,o);F.insertItemBefore(w,k);break}}}}}c.unsuspendRedraw(B)},Ya=this.changeSelectedAttribute=function(e,h,l){l=l||I;d.undoMgr.beginUndoableChange(e, h}else e=="#href"?T(D,h):D.setAttribute(e,h);H.indexOf(D)>=0&&setTimeout(function(){D.parentNode&&ra.requestSelector(D).resize()},0);z=na(D);if(z!=0&&e!="transform")for(var F=R(D),k=F.numberOfItems;k--;)if(F.getItem(k).type==4){F.removeItem(k);var n=svgedit.utilities.getBBox(D),o=N(n.x+n.width/2,n.y+n.height/2,X(F).matrix);n=o.x;o=o.y;var w=c.createSVGTransform();w.setRotate(z,n,o);F.insertItemBefore(w,k);break}}}}}c.unsuspendRedraw(B)},Ya=this.changeSelectedAttribute=function(e,h,l){l=l||H;d.undoMgr.beginUndoableChange(e,
l);Ab(e,h,l);e=d.undoMgr.finishUndoableChange();e.isEmpty()||wa(e)};this.deleteSelectedElements=function(){for(var e=new Ca("Delete Elements"),h=I.length,l=[],B=0;B<h;++B){var A=I[B];if(A==null)break;var G=A.parentNode,D=A;ra.releaseSelector(D);svgedit.path.removePath_(D.id);if(G.tagName==="a"&&G.childNodes.length===1){D=G;G=G.parentNode}var z=D.nextSibling;D=G.removeChild(D);l.push(A);I[B]=null;e.addSubCommand(new Ga(D,z,G))}e.isEmpty()||wa(e);M("changed",l);Ia()};this.cutSelectedElements=function(){for(var e= l);Ab(e,h,l);e=d.undoMgr.finishUndoableChange();e.isEmpty()||wa(e)};this.deleteSelectedElements=function(){for(var e=new Ca("Delete Elements"),h=H.length,l=[],B=0;B<h;++B){var A=H[B];if(A==null)break;var G=A.parentNode,D=A;ra.releaseSelector(D);svgedit.path.removePath_(D.id);if(G.tagName==="a"&&G.childNodes.length===1){D=G;G=G.parentNode}var z=D.nextSibling;D=G.removeChild(D);l.push(A);H[B]=null;e.addSubCommand(new Ga(D,z,G))}e.isEmpty()||wa(e);M("changed",l);Ia()};this.cutSelectedElements=function(){for(var e=
new Ca("Cut Elements"),h=I.length,l=[],B=0;B<h;++B){var A=I[B];if(A==null)break;var G=A.parentNode,D=A;ra.releaseSelector(D);svgedit.path.removePath_(D.id);var z=D.nextSibling;D=G.removeChild(D);l.push(A);I[B]=null;e.addSubCommand(new Ga(D,z,G))}e.isEmpty()||wa(e);M("changed",l);Ia();d.clipBoard=l};this.copySelectedElements=function(){d.clipBoard=$.merge([],I)};this.pasteElements=function(){var e=d.clipBoard,h=e.length;if(h){for(var l=[],B=new Ca("Paste elements");h--;){var A=e[h];if(A){var G=ia(A); new Ca("Cut Elements"),h=H.length,l=[],B=0;B<h;++B){var A=H[B];if(A==null)break;var G=A.parentNode,D=A;ra.releaseSelector(D);svgedit.path.removePath_(D.id);var z=D.nextSibling;D=G.removeChild(D);l.push(A);H[B]=null;e.addSubCommand(new Ga(D,z,G))}e.isEmpty()||wa(e);M("changed",l);Ia();d.clipBoard=l};this.copySelectedElements=function(){d.clipBoard=$.merge([],H)};this.pasteElements=function(){var e=d.clipBoard,h=e.length;if(h){for(var l=[],B=new Ca("Paste elements");h--;){var A=e[h];if(A){var G=ia(A);
if(!pa(A.id))G.id=A.id;l.push(G);(L||C().getCurrentLayer()).appendChild(G);B.addSubCommand(new Ha(G))}}svgCanvas.clearSelection();setTimeout(function(){rb(l)},100);wa(B);M("changed",l)}};this.groupSelectedElements=function(e){e||(e="g");var h="";switch(e){case "a":h="Make hyperlink";var l="";if(arguments.length>1)l=arguments[1];break;default:e="g";h="Group Elements"}h=new Ca(h);var B=Q({element:e,attr:{id:ka()}});e==="a"&&T(B,l);h.addSubCommand(new Ha(B));for(l=I.length;l--;){var A=I[l];if(A!=null){if(A.parentNode.tagName=== if(!pa(A.id))G.id=A.id;l.push(G);(L||C().getCurrentLayer()).appendChild(G);B.addSubCommand(new Ha(G))}}svgCanvas.clearSelection();setTimeout(function(){rb(l)},100);wa(B);M("changed",l)}};this.groupSelectedElements=function(e){e||(e="g");var h="";switch(e){case "a":h="Make hyperlink";var l="";if(arguments.length>1)l=arguments[1];break;default:e="g";h="Group Elements"}h=new Ca(h);var B=S({element:e,attr:{id:ka()}});e==="a"&&T(B,l);h.addSubCommand(new Ha(B));for(l=H.length;l--;){var A=H[l];if(A!=null){if(A.parentNode.tagName===
"a"&&A.parentNode.childNodes.length===1)A=A.parentNode;var G=A.nextSibling,D=A.parentNode;B.appendChild(A);h.addSubCommand(new Ja(A,G,D))}}h.isEmpty()||wa(h);rb([B],true)};var Db=this.pushGroupProperties=function(e,h){var l=e.childNodes,B=l.length,A=e.getAttribute("transform"),G=S(e),D=X(G).matrix,z=new Ca("Push group properties"),F=0,k=oa(e),n=$(e).attr(["filter","opacity"]),o,w;for(F=0;F<B;F++){var E=l[F];if(E.nodeType===1){if(n.opacity!==null&&n.opacity!==1){E.getAttribute("opacity");var H=Math.round((E.getAttribute("opacity")|| "a"&&A.parentNode.childNodes.length===1)A=A.parentNode;var G=A.nextSibling,D=A.parentNode;B.appendChild(A);h.addSubCommand(new Ja(A,G,D))}}h.isEmpty()||wa(h);rb([B],true)};var Db=this.pushGroupProperties=function(e,h){var l=e.childNodes,B=l.length,A=e.getAttribute("transform"),G=R(e),D=X(G).matrix,z=new Ca("Push group properties"),F=0,k=na(e),n=$(e).attr(["filter","opacity"]),o,w;for(F=0;F<B;F++){var E=l[F];if(E.nodeType===1){if(n.opacity!==null&&n.opacity!==1){E.getAttribute("opacity");var I=Math.round((E.getAttribute("opacity")||
1)*n.opacity*100)/100;Ya("opacity",H,[E])}if(n.filter){var J=H=this.getBlur(E);w||(w=this.getBlur(e));if(H)H=w-0+(H-0);else if(H===0)H=w;if(J)o=P(E.getAttribute("filter"));else if(o){o=ia(o);gb().appendChild(o)}else o=P(n.filter);o.id=E.id+"_"+(o.firstChild.tagName==="feGaussianBlur"?"blur":"filter");Ya("filter","url(#"+o.id+")",[E]);if(H){Ya("stdDeviation",H,[o.firstChild]);d.setBlurOffsets(o,H)}}H=S(E);if(~E.tagName.indexOf("Gradient"))H=null;if(H)if(E.tagName!=="defs")if(G.numberOfItems){if(k&& 1)*n.opacity*100)/100;Ya("opacity",I,[E])}if(n.filter){var J=I=this.getBlur(E);w||(w=this.getBlur(e));if(I)I=w-0+(I-0);else if(I===0)I=w;if(J)o=P(E.getAttribute("filter"));else if(o){o=ia(o);gb().appendChild(o)}else o=P(n.filter);o.id=E.id+"_"+(o.firstChild.tagName==="feGaussianBlur"?"blur":"filter");Ya("filter","url(#"+o.id+")",[E]);if(I){Ya("stdDeviation",I,[o.firstChild]);d.setBlurOffsets(o,I)}}I=R(E);if(~E.tagName.indexOf("Gradient"))I=null;if(I)if(E.tagName!=="defs")if(G.numberOfItems){if(k&&
G.numberOfItems==1){var O=G.getItem(0).matrix,Y=c.createSVGMatrix();if(J=oa(E))Y=H.getItem(0).matrix;var da=svgedit.utilities.getBBox(E),V=X(H).matrix,fa=N(da.x+da.width/2,da.y+da.height/2,V);da=k+J;V=c.createSVGTransform();V.setRotate(da,fa.x,fa.y);O=ga(O,Y,V.matrix.inverse());J&&H.removeItem(0);if(da)H.numberOfItems?H.insertItemBefore(V,0):H.appendItem(V);if(O.e||O.f){J=c.createSVGTransform();J.setTranslate(O.e,O.f);H.numberOfItems?H.insertItemBefore(J,0):H.appendItem(J)}}else{J=E.getAttribute("transform"); G.numberOfItems==1){var O=G.getItem(0).matrix,Y=c.createSVGMatrix();if(J=na(E))Y=I.getItem(0).matrix;var da=svgedit.utilities.getBBox(E),V=X(I).matrix,fa=N(da.x+da.width/2,da.y+da.height/2,V);da=k+J;V=c.createSVGTransform();V.setRotate(da,fa.x,fa.y);O=ga(O,Y,V.matrix.inverse());J&&I.removeItem(0);if(da)I.numberOfItems?I.insertItemBefore(V,0):I.appendItem(V);if(O.e||O.f){J=c.createSVGTransform();J.setTranslate(O.e,O.f);I.numberOfItems?I.insertItemBefore(J,0):I.appendItem(J)}}else{J=E.getAttribute("transform");
O={};O.transform=J?J:"";J=c.createSVGTransform();O=X(H).matrix;Y=O.inverse();O=ga(Y,D,O);J.setMatrix(O);H.appendItem(J)}(E=Ra(E))&&z.addSubCommand(E)}}}if(A){O={};O.transform=A;e.setAttribute("transform","");e.removeAttribute("transform");z.addSubCommand(new Ma(e,O))}if(h&&!z.isEmpty())return z};this.ungroupSelectedElement=function(){var e=I[0];if($(e).data("gsvg")||$(e).data("symbol"))Lb(e);else if(e.tagName==="use"){var h=pa(ba(e).substr(1));$(e).data("symbol",h).data("ref",h);Lb(e)}else{h=$(e).parents("a"); O={};O.transform=J?J:"";J=c.createSVGTransform();O=X(I).matrix;Y=O.inverse();O=ga(Y,D,O);J.setMatrix(O);I.appendItem(J)}(E=Ra(E))&&z.addSubCommand(E)}}}if(A){O={};O.transform=A;e.setAttribute("transform","");e.removeAttribute("transform");z.addSubCommand(new Ma(e,O))}if(h&&!z.isEmpty())return z};this.ungroupSelectedElement=function(){var e=H[0];if($(e).data("gsvg")||$(e).data("symbol"))Lb(e);else if(e.tagName==="use"){var h=pa(ba(e).substr(1));$(e).data("symbol",h).data("ref",h);Lb(e)}else{h=$(e).parents("a");
if(h.length)e=h[0];if(e.tagName==="g"||e.tagName==="a"){h=new Ca("Ungroup Elements");var l=Db(e,true);l&&h.addSubCommand(l);l=e.parentNode;for(var B=e.nextSibling,A=Array(e.childNodes.length),G=0;e.firstChild;){var D=e.firstChild,z=D.nextSibling,F=D.parentNode;if(D.tagName==="title"){h.addSubCommand(new Ga(D,D.nextSibling,F));F.removeChild(D)}else{A[G++]=D=l.insertBefore(D,B);h.addSubCommand(new Ja(D,z,F))}}Ia();B=e.nextSibling;e=l.removeChild(e);h.addSubCommand(new Ga(e,B,l));h.isEmpty()||wa(h); if(h.length)e=h[0];if(e.tagName==="g"||e.tagName==="a"){h=new Ca("Ungroup Elements");var l=Db(e,true);l&&h.addSubCommand(l);l=e.parentNode;for(var B=e.nextSibling,A=Array(e.childNodes.length),G=0;e.firstChild;){var D=e.firstChild,z=D.nextSibling,F=D.parentNode;if(D.tagName==="title"){h.addSubCommand(new Ga(D,D.nextSibling,F));F.removeChild(D)}else{A[G++]=D=l.insertBefore(D,B);h.addSubCommand(new Ja(D,z,F))}}Ia();B=e.nextSibling;e=l.removeChild(e);h.addSubCommand(new Ga(e,B,l));h.isEmpty()||wa(h);
qb(A)}}};this.moveToTopSelectedElement=function(){var e=I.filter(Boolean).reverse(),h=new Ca("Move to top");e.forEach(function(l){l=l;var B=l.parentNode,A=l.nextSibling;l=l.parentNode.appendChild(l);if(A!=l.nextSibling){h.addSubCommand(new Ja(l,A,B,"top"));M("changed",[l])}h.isEmpty()||wa(h)})};this.moveToBottomSelectedElement=function(){var e=I.filter(Boolean).reverse(),h=new Ca("Move to top");e.forEach(function(l){l=l;var B=l.parentNode,A=l.nextSibling,G=l.parentNode.firstChild;if(G.tagName=="title")G= qb(A)}}};this.moveToTopSelectedElement=function(){var e=H.filter(Boolean).reverse(),h=new Ca("Move to top");e.forEach(function(l){l=l;var B=l.parentNode,A=l.nextSibling;l=l.parentNode.appendChild(l);if(A!=l.nextSibling){h.addSubCommand(new Ja(l,A,B,"top"));M("changed",[l])}h.isEmpty()||wa(h)})};this.moveToBottomSelectedElement=function(){var e=H.filter(Boolean).reverse(),h=new Ca("Move to top");e.forEach(function(l){l=l;var B=l.parentNode,A=l.nextSibling,G=l.parentNode.firstChild;if(G.tagName=="title")G=
G.nextSibling;if(G.tagName=="defs")G=G.nextSibling;l=l.parentNode.insertBefore(l,G);if(A!=l.nextSibling){h.addSubCommand(new Ja(l,A,B,"bottom"));M("changed",[l])}});h.isEmpty()||wa(h)};this.moveUpDownSelected=function(e){var h=I.filter(Boolean);e=="Down"&&h.reverse();var l=new Ca("Move "+e);h.forEach(function(B){hb=[];var A,G,D=$(ob(getStrokedBBox([B]))).toArray();e=="Down"&&D.reverse();$.each(D,function(){if(G){A=this;return false}else if(this==B)G=true});if(A){D=B.parentNode;var z=B.nextSibling; G.nextSibling;if(G.tagName=="defs")G=G.nextSibling;l=l.parentNode.insertBefore(l,G);if(A!=l.nextSibling){h.addSubCommand(new Ja(l,A,B,"bottom"));M("changed",[l])}});h.isEmpty()||wa(h)};this.moveUpDownSelected=function(e){var h=H.filter(Boolean);e=="Down"&&h.reverse();var l=new Ca("Move "+e);h.forEach(function(B){hb=[];var A,G,D=$(ob(getStrokedBBox([B]))).toArray();e=="Down"&&D.reverse();$.each(D,function(){if(G){A=this;return false}else if(this==B)G=true});if(A){D=B.parentNode;var z=B.nextSibling;
$(A)[e=="Down"?"before":"after"](B);if(z!=B.nextSibling){l.addSubCommand(new Ja(B,z,D,"Move "+e));M("changed",[B])}}});l.isEmpty()||wa(l)};this.moveSelectedElements=function(e,h,l){if(e.constructor!=Array){e/=s;h/=s}l=l||true;for(var B=new Ca("position"),A=I.length;A--;){var G=I[A];if(G!=null){var D=c.createSVGTransform(),z=S(G);e.constructor==Array?D.setTranslate(e[A],h[A]):D.setTranslate(e,h);z.numberOfItems?z.insertItemBefore(D,0):z.appendItem(D);(D=Ra(G))&&B.addSubCommand(D);ra.requestSelector(G).resize()}}if(!B.isEmpty()){l&& $(A)[e=="Down"?"before":"after"](B);if(z!=B.nextSibling){l.addSubCommand(new Ja(B,z,D,"Move "+e));M("changed",[B])}}});l.isEmpty()||wa(l)};this.moveSelectedElements=function(e,h,l){if(e.constructor!=Array){e/=s;h/=s}l=l||true;for(var B=new Ca("position"),A=H.length;A--;){var G=H[A];if(G!=null){var D=c.createSVGTransform(),z=R(G);e.constructor==Array?D.setTranslate(e[A],h[A]):D.setTranslate(e,h);z.numberOfItems?z.insertItemBefore(D,0):z.appendItem(D);(D=Ra(G))&&B.addSubCommand(D);ra.requestSelector(G).resize()}}if(!B.isEmpty()){l&&
wa(B);M("changed",I);return B}};this.cloneSelectedElements=function(e,h,l){for(var B=new Ca("Clone Elements"),A=I.length,G=0;G<A;++G){var D=I[G];if(D==null)break}A=I.slice(0,G);this.clearSelection(true);G=A.length;for(clones=[];G--;){D=A[G];var z=ia(A[G]),F=L||C().getCurrentLayer();if(l){tlist=S(z);tlist.removeItem(l);Ra(z);F.insertBefore(z,D)}else F.appendChild(z);clones.push(z);B.addSubCommand(new Ha(z))}if(!B.isEmpty()){qb(A.reverse());l||this.moveSelectedElements(e,h,false);wa(B)}return clones}; wa(B);M("changed",H);return B}};this.cloneSelectedElements=function(e,h,l){for(var B=new Ca("Clone Elements"),A=H.length,G=0;G<A;++G){var D=H[G];if(D==null)break}A=H.slice(0,G);this.clearSelection(true);G=A.length;for(clones=[];G--;){D=A[G];var z=ia(A[G]),F=L||C().getCurrentLayer();if(l){tlist=R(z);tlist.removeItem(l);Ra(z);F.insertBefore(z,D)}else F.appendChild(z);clones.push(z);B.addSubCommand(new Ha(z))}if(!B.isEmpty()){qb(A.reverse());l||this.moveSelectedElements(e,h,false);wa(B)}return clones};
this.alignSelectedElements=function(e,h){var l=[],B=Number.MAX_VALUE,A=Number.MIN_VALUE,G=Number.MAX_VALUE,D=Number.MIN_VALUE,z=Number.MIN_VALUE,F=Number.MIN_VALUE,k=I.length;if(k){for(var n=0;n<k;++n){if(I[n]==null)break;l[n]=getStrokedBBox([I[n]]);switch(h){case "smallest":if((e=="l"||e=="c"||e=="r")&&(z==Number.MIN_VALUE||z>l[n].width)||(e=="t"||e=="m"||e=="b")&&(F==Number.MIN_VALUE||F>l[n].height)){B=l[n].x;G=l[n].y;A=l[n].x+l[n].width;D=l[n].y+l[n].height;z=l[n].width;F=l[n].height}break;case "largest":if((e== this.alignSelectedElements=function(e,h){var l=[],B=Number.MAX_VALUE,A=Number.MIN_VALUE,G=Number.MAX_VALUE,D=Number.MIN_VALUE,z=Number.MIN_VALUE,F=Number.MIN_VALUE,k=H.length;if(k){for(var n=0;n<k;++n){if(H[n]==null)break;l[n]=getStrokedBBox([H[n]]);switch(h){case "smallest":if((e=="l"||e=="c"||e=="r")&&(z==Number.MIN_VALUE||z>l[n].width)||(e=="t"||e=="m"||e=="b")&&(F==Number.MIN_VALUE||F>l[n].height)){B=l[n].x;G=l[n].y;A=l[n].x+l[n].width;D=l[n].y+l[n].height;z=l[n].width;F=l[n].height}break;case "largest":if((e==
"l"||e=="c"||e=="r")&&(z==Number.MIN_VALUE||z<l[n].width)||(e=="t"||e=="m"||e=="b")&&(F==Number.MIN_VALUE||F<l[n].height)){B=l[n].x;G=l[n].y;A=l[n].x+l[n].width;D=l[n].y+l[n].height;z=l[n].width;F=l[n].height}break;default:if(l[n].x<B)B=l[n].x;if(l[n].y<G)G=l[n].y;if(l[n].x+l[n].width>A)A=l[n].x+l[n].width;if(l[n].y+l[n].height>D)D=l[n].y+l[n].height}}if(h=="page"){G=B=0;A=d.contentW;D=d.contentH}z=Array(k);F=Array(k);for(n=0;n<k;++n){if(I[n]==null)break;var o=l[n];z[n]=0;F[n]=0;switch(e){case "l":z[n]= "l"||e=="c"||e=="r")&&(z==Number.MIN_VALUE||z<l[n].width)||(e=="t"||e=="m"||e=="b")&&(F==Number.MIN_VALUE||F<l[n].height)){B=l[n].x;G=l[n].y;A=l[n].x+l[n].width;D=l[n].y+l[n].height;z=l[n].width;F=l[n].height}break;default:if(l[n].x<B)B=l[n].x;if(l[n].y<G)G=l[n].y;if(l[n].x+l[n].width>A)A=l[n].x+l[n].width;if(l[n].y+l[n].height>D)D=l[n].y+l[n].height}}if(h=="page"){G=B=0;A=d.contentW;D=d.contentH}z=Array(k);F=Array(k);for(n=0;n<k;++n){if(H[n]==null)break;var o=l[n];z[n]=0;F[n]=0;switch(e){case "l":z[n]=
B-o.x;break;case "c":z[n]=(B+A)/2-(o.x+o.width/2);break;case "r":z[n]=A-(o.x+o.width);break;case "t":F[n]=G-o.y;break;case "m":F[n]=(G+D)/2-(o.y+o.height/2);break;case "b":F[n]=D-(o.y+o.height)}}this.moveSelectedElements(z,F)}};this.contentW=zb().w;this.contentH=zb().h;this.updateCanvas=function(e,h){c.setAttribute("width",e);c.setAttribute("height",h);var l=$("#canvasBackground")[0],B=m.getAttribute("x"),A=m.getAttribute("y"),G=e/2-this.contentW*s/2,D=h/2-this.contentH*s/2;ma(m,{width:this.contentW* B-o.x;break;case "c":z[n]=(B+A)/2-(o.x+o.width/2);break;case "r":z[n]=A-(o.x+o.width);break;case "t":F[n]=G-o.y;break;case "m":F[n]=(G+D)/2-(o.y+o.height/2);break;case "b":F[n]=D-(o.y+o.height)}}this.moveSelectedElements(z,F)}};this.contentW=zb().w;this.contentH=zb().h;this.updateCanvas=function(e,h){c.setAttribute("width",e);c.setAttribute("height",h);var l=$("#canvasBackground")[0],B=m.getAttribute("x"),A=m.getAttribute("y"),G=e/2-this.contentW*s/2,D=h/2-this.contentH*s/2;ma(m,{width:this.contentW*
s,height:this.contentH*s,x:G,y:D,viewBox:"0 0 "+this.contentW+" "+this.contentH});ma(l,{width:m.getAttribute("width"),height:m.getAttribute("height"),x:G,y:D});(l=pa("background_image"))&&ma(l,{width:"100%",height:"100%"});ra.selectorParentGroup.setAttribute("transform","translate("+G+","+D+")");return{x:G,y:D,old_x:B,old_y:A,d_x:G-B,d_y:D-A}};this.setBackground=function(e,h){var l=pa("canvasBackground"),B=$(l).find("rect")[0],A=pa("background_image");B.setAttribute("fill",e);if(h){if(!A){A=f.createElementNS(b, s,height:this.contentH*s,x:G,y:D,viewBox:"0 0 "+this.contentW+" "+this.contentH});ma(l,{width:m.getAttribute("width"),height:m.getAttribute("height"),x:G,y:D});(l=pa("background_image"))&&ma(l,{width:"100%",height:"100%"});ra.selectorParentGroup.setAttribute("transform","translate("+G+","+D+")");return{x:G,y:D,old_x:B,old_y:A,d_x:G-B,d_y:D-A}};this.setBackground=function(e,h){var l=pa("canvasBackground"),B=$(l).find("rect")[0],A=pa("background_image");B.setAttribute("fill",e);if(h){if(!A){A=f.createElementNS(b,
"image");ma(A,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}T(A,h);l.appendChild(A)}else A&&A.parentNode.removeChild(A)};this.cycleElement=function(e){var h=I[0],l=false,B=pb(L||C().getCurrentLayer());if(B.length){if(h==null){e=e?B.length-1:0;l=B[e]}else for(var A=B.length;A--;)if(B[A]==h){e=e?A-1:A+1;if(e>=B.length)e=0;else if(e<0)e=B.length-1;l=B[e];break}rb([l],true);M("selected",I)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:wa, "image");ma(A,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}T(A,h);l.appendChild(A)}else A&&A.parentNode.removeChild(A)};this.cycleElement=function(e){var h=H[0],l=false,B=pb(L||C().getCurrentLayer());if(B.length){if(h==null){e=e?B.length-1:0;l=B[e]}else for(var A=B.length;A--;)if(B[A]==h){e=e?A-1:A+1;if(e>=B.length)e=0;else if(e<0)e=B.length-1;l=B[e];break}rb([l],true);M("selected",H)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:wa,
setGradient:Nb,addSvgElementFromJson:Q,assignAttributes:ma,BatchCommand:Ca,call:M,ChangeElementCommand:Ma,copyElem:ia,ffClone:ca,findDefs:gb,findDuplicateGradient:Mb,getElem:pa,getId:aa,getIntersectionList:ob,getMouseTarget:Bb,getNextId:ka,getPathBBox:Z,getUrlFromAttr:ja,hasMatrixTransform:na,identifyLayers:xb,InsertElementCommand:Ha,isIdentity:svgedit.math.isIdentity,logMatrix:Wa,matrixMultiply:ga,MoveElementCommand:Ja,preventClickDefault:Fb,recalculateAllSelectedDimensions:Da,recalculateDimensions:Ra, setGradient:Nb,addSvgElementFromJson:S,assignAttributes:ma,BatchCommand:Ca,call:M,ChangeElementCommand:Ma,copyElem:ia,ffClone:ca,findDefs:gb,findDuplicateGradient:Mb,getElem:pa,getId:aa,getIntersectionList:ob,getMouseTarget:Bb,getNextId:ka,getPathBBox:Z,getUrlFromAttr:ja,hasMatrixTransform:oa,identifyLayers:xb,InsertElementCommand:Ha,isIdentity:svgedit.math.isIdentity,logMatrix:Wa,matrixMultiply:ga,MoveElementCommand:Ja,preventClickDefault:Fb,recalculateAllSelectedDimensions:Da,recalculateDimensions:Ra,
remapElement:Za,RemoveElementCommand:Ga,removeUnusedDefElems:yb,round:ab,runExtensions:ib,sanitizeSvg:ya,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:X,transformPoint:N,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(c,m){var u=g.setSvgString(c)!==false;m=m||a.noop;u?m(true):a.alert(uiStrings.notification.errorLoadingSVG,function(){m(false)})}var g,b={},p=false;curConfig={canvas_expansion:1,dimensions:[580,400], remapElement:Za,RemoveElementCommand:Ga,removeUnusedDefElems:yb,round:ab,runExtensions:ib,sanitizeSvg:ya,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:X,transformPoint:N,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(c,m){var u=g.setSvgString(c)!==false;m=m||a.noop;u?m(true):a.alert(uiStrings.notification.errorLoadingSVG,function(){m(false)})}var g,b={},p=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:"<strong>Do you want to clear the drawing?</strong>\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:"<strong>Do you want to clear the drawing?</strong>\nThis will also erase your undo history",
@ -388,86 +388,86 @@ align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bo
"#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()? "#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom"},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 k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var n=a("#"+this.id+"_show"),o=n.attr("data-curopt");if(!n.children("svg, img").length){o= 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 k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var n=a("#"+this.id+"_show"),o=n.attr("data-curopt");if(!n.children("svg, img").length){o=
a(o).children().clone();if(o.length){o[0].removeAttribute("style");n.append(o)}}});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(k){a("#base_unit_container").css({top:k.pageY-10,left:k.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200); a(o).children().clone();if(o.length){o[0].removeAttribute("style");n.append(o)}}});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(k){a("#base_unit_container").css({top:k.pageY-10,left:k.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=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};c=navigator.platform.indexOf("Mac")>=0;var m=navigator.userAgent.indexOf("AppleWebKit")>=0,u=c?"meta+":"ctrl+",C=g.pathActions,s=g.undoMgr,L=svgedit.utilities,R=curConfig.imgPath+"placeholder.svg",K=a("#workarea"),I=a("#cmenu_canvas"),Q=null,S=1,N="toolbars", event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};c=navigator.platform.indexOf("Mac")>=0;var m=navigator.userAgent.indexOf("AppleWebKit")>=0,u=c?"meta+":"ctrl+",C=g.pathActions,s=g.undoMgr,L=svgedit.utilities,Q=curConfig.imgPath+"placeholder.svg",K=a("#workarea"),H=a("#cmenu_canvas"),S=null,R=1,N="toolbars",
ga="";c||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),n=a("#dialog_buttons"),o=function(w,E,H,J){a("#dialog_content").html("<p>"+E.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",w=="prompt");n.empty();var O=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(n);w!="alert"&&a('<input type="button" value="'+ ga="";c||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),n=a("#dialog_buttons"),o=function(w,E,I,J){a("#dialog_content").html("<p>"+E.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",w=="prompt");n.empty();var O=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(n);w!="alert"&&a('<input type="button" value="'+
uiStrings.common.cancel+'">').appendTo(n).on("click touchstart",function(){k.hide();H(false)});if(w=="prompt"){var Y=a('<input type="text">').prependTo(n);Y.val(J||"");Y.bind("keydown","return",function(){O.trigger("click touchstart")})}w=="process"&&O.hide();k.show();O.on("click touchstart",function(){k.hide();var da=w=="prompt"?Y.val():true;H&&H(da)}).focus();w=="prompt"&&Y.focus()};a.alert=function(w,E){o("alert",w,E)};a.confirm=function(w,E){o("confirm",w,E)};a.process_cancel=function(w,E){o("process", uiStrings.common.cancel+'">').appendTo(n).on("click touchstart",function(){k.hide();I(false)});if(w=="prompt"){var Y=a('<input type="text">').prependTo(n);Y.val(J||"");Y.bind("keydown","return",function(){O.trigger("click touchstart")})}w=="process"&&O.hide();k.show();O.on("click touchstart",function(){k.hide();var da=w=="prompt"?Y.val():true;I&&I(da)}).focus();w=="prompt"&&Y.focus()};a.alert=function(w,E){o("alert",w,E)};a.confirm=function(w,E){o("confirm",w,E)};a.process_cancel=function(w,E){o("process",
w,E)};a.prompt=function(w,E,H){o("prompt",w,H,E)}})();var na=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,U=false,ea=false,Aa="",ja=function(k,n){var o=g.getResolution(),w=K;a("#svgcanvas").position();if(w=g.setBBoxZoom(n,w.width()-15,w.height()-15)){var E=w.zoom;w=w.bbox;if(E<0.0010)wa({value:0.1}); w,E)};a.prompt=function(w,E,I){o("prompt",w,I,E)}})();var oa=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,U=false,ea=false,Aa="",ja=function(k,n){var o=g.getResolution(),w=K;a("#svgcanvas").position();if(w=g.setBBoxZoom(n,w.width()-15,w.height()-15)){var E=w.zoom;w=w.bbox;if(E<0.0010)wa({value:0.1});
else{typeof animatedZoom!="undefined"&&k.cancelAnimationFrame(animatedZoom);var H=Date.now(),J=E-o.zoom;a("#zoom");var O=o.zoom,Y=function(da){da=(da-H)/500;da=Math.pow(da-1,3)+1;g.setZoom(O+J*da);G();if(da<1)k.animatedZoom=requestAnimationFrame(Y);else{a("#zoom").val(parseInt(E*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(E*100)+"]","#zoom_select").attr("selected","selected")}};Y(Date.now());g.getMode()=="zoom"&&w.width&&na();xb()}}};a("#cur_context_panel").delegate("a", else{typeof animatedZoom!="undefined"&&k.cancelAnimationFrame(animatedZoom);var I=Date.now(),J=E-o.zoom;a("#zoom");var O=o.zoom,Y=function(da){da=(da-I)/500;da=Math.pow(da-1,3)+1;g.setZoom(O+J*da);G();if(da<1)k.animatedZoom=requestAnimationFrame(Y);else{a("#zoom").val(parseInt(E*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(E*100)+"]","#zoom_select").attr("selected","selected")}};Y(Date.now());g.getMode()=="zoom"&&w.width&&oa();xb()}}};a("#cur_context_panel").delegate("a",
"click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var ba=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},T={},Z=function(k){a.each(k,function(n,o){var w=a(n).children(),E=n+"_show",H=a(E),J=false;w.addClass("tool_button").unbind("click mousedown mouseup").each(function(da){var V=o[da];T[V.sel]=V.fn;if(V.isDefault)J=da;da=function(fa){var ha=V;if(fa.type==="keydown"){var W=a(ha.parent+"_show").hasClass("tool_button_current"),qa= "click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var ba=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},T={},Z=function(k){a.each(k,function(n,o){var w=a(n).children(),E=n+"_show",I=a(E),J=false;w.addClass("tool_button").unbind("click mousedown mouseup").each(function(da){var V=o[da];T[V.sel]=V.fn;if(V.isDefault)J=da;da=function(fa){var ha=V;if(fa.type==="keydown"){var W=a(ha.parent+"_show").hasClass("tool_button_current"),qa=
a(ha.parent+"_show").attr("data-curopt");a.each(k[V.parent],function(za,Ba){if(Ba.sel==qa)ha=!fa.shiftKey||!W?Ba:k[V.parent][za+1]||k[V.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",H.width());ua[0].setAttribute("height",H.height());H.children(":not(.flyout_arrow_horiz)").remove();H.append(ua).attr("data-curopt",ha.sel)};a(this).mouseup(da);V.key&&a(document).bind("keydown", a(ha.parent+"_show").attr("data-curopt");a.each(k[V.parent],function(za,Ba){if(Ba.sel==qa)ha=!fa.shiftKey||!W?Ba:k[V.parent][za+1]||k[V.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",I.width());ua[0].setAttribute("height",I.height());I.children(":not(.flyout_arrow_horiz)").remove();I.append(ua).attr("data-curopt",ha.sel)};a(this).mouseup(da);V.key&&a(document).bind("keydown",
V.key[0]+" shift+"+V.key[0],da)});if(J)H.attr("data-curopt",o[J].sel);else H.attr("data-curopt")||H.attr("data-curopt",o[0].sel);var O,Y=a(E).position();a(n).css({left:Y.left+34,top:Y.top+77});H.mousedown(function(da){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&ra(E,false);if(H.hasClass("disabled"))return false;var V=a(n),fa=Y.left+34,ha=V.width()*-1,W=V.data("shown_popop")?200:0;O=setTimeout(function(){H.data("isLibrary")?V.css("left", V.key[0]+" shift+"+V.key[0],da)});if(J)I.attr("data-curopt",o[J].sel);else I.attr("data-curopt")||I.attr("data-curopt",o[0].sel);var O,Y=a(E).position();a(n).css({left:Y.left+34,top:Y.top+77});I.mousedown(function(da){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&ra(E,false);if(I.hasClass("disabled"))return false;var V=a(n),fa=Y.left+34,ha=V.width()*-1,W=V.data("shown_popop")?200:0;O=setTimeout(function(){I.data("isLibrary")?V.css("left",
fa).show():V.css("left",ha).show().animate({left:fa},50);V.data("shown_popop",true)},W);da.preventDefault()}).mouseup(function(){clearTimeout(O);var da=a(this).attr("data-curopt");if(H.data("isLibrary")&&a(E.replace("_show","")).is(":visible"))ra(E,true);else ra(E)&&da in T&&T[da]()})});ma()},oa=function(k,n){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(n)},pa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),n=k.offset();k=k.outerWidth(); fa).show():V.css("left",ha).show().animate({left:fa},50);V.data("shown_popop",true)},W);da.preventDefault()}).mouseup(function(){clearTimeout(O);var da=a(this).attr("data-curopt");if(I.data("isLibrary")&&a(E.replace("_show","")).is(":visible"))ra(E,true);else ra(E)&&da in T&&T[da]()})});ma()},na=function(k,n){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(n)},pa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),n=k.offset();k=k.outerWidth();
a(this).css({left:(n.left+k)*S,top:n.top})})},ma=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});k[0].title=n.join(" / ")}})},la,xa=function(k,n,o){var w=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+o+"_color defs *")[0];w={alpha:n};w[k.tagName]=k}else w=k.indexOf("#")===0?{alpha:n,solidColor:k.substr(1)}:{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(w)}, a(this).css({left:(n.left+k)*R,top:n.top})})},ma=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});k[0].title=n.join(" / ")}})},la,xa=function(k,n,o){var w=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+o+"_color defs *")[0];w={alpha:n};w[k.tagName]=k}else w=k.indexOf("#")===0?{alpha:n,solidColor:k.substr(1)}:{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(w)},
ya=g.getResolution();if(curConfig.baseUnit!=="px"){ya.w=svgedit.units.convertUnit(ya.w)+curConfig.baseUnit;ya.h=svgedit.units.convertUnit(ya.h)+curConfig.baseUnit}var Ja=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:ya.w+2,height:ya.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")|| ya=g.getResolution();if(curConfig.baseUnit!=="px"){ya.w=svgedit.units.convertUnit(ya.w)+curConfig.baseUnit;ya.h=svgedit.units.convertUnit(ya.h)+curConfig.baseUnit}var Ja=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:ya.w+2,height:ya.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||
Ja();document.getElementById("canvas_background").getAttribute("fill");var Ha=b.setImageURL=function(k){k||(k=R);g.setImageURL(k);a("#image_url").val(k)},Ga=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(U&&U[0]!=null&&!U[0].parentNode)U=false;var n=g.getCurrentDrawing().getCurrentLayerName(),o=g.getMode(),w=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,E=o=="pathedit";if(E){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();n=C.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button"); Ja();document.getElementById("canvas_background").getAttribute("fill");var Ha=b.setImageURL=function(k){k||(k=Q);g.setImageURL(k);a("#image_url").val(k)},Ga=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(U&&U[0]!=null&&!U[0].parentNode)U=false;var n=g.getCurrentDrawing().getCurrentLayerName(),o=g.getMode(),w=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,E=o=="pathedit";if(E){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();n=C.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");
a("#tool_node_delete").toggleClass("disabled",!C.canDeleteNodes);zb("#tool_openclose_path",C.closed_subpath?"open_path":"close_path");if(n){E=a("#seg_type");if(w){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));if(n.type){E.val(n.type).removeAttr("disabled");a("#seg_type_label").html(n.type==4?"Straight":"Curve")}else E.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected"); a("#tool_node_delete").toggleClass("disabled",!C.canDeleteNodes);zb("#tool_openclose_path",C.closed_subpath?"open_path":"close_path");if(n){E=a("#seg_type");if(w){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));if(n.type){E.val(n.type).removeAttr("disabled");a("#seg_type_label").html(n.type==4?"Straight":"Curve")}else E.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");
a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var H=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(U){U=U.filter(Boolean);(k=g.elementsAreSame(U)?U[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!U){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=null){a("#stroke_panel").show();var J=k.nodeName,O=g.getRotationAngle(k); a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var I=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(U){U=U.filter(Boolean);(k=g.elementsAreSame(U)?U[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!U){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=null){a("#stroke_panel").show();var J=k.nodeName,O=g.getRotationAngle(k);
a("#angle").val(Math.round(O));O=g.getBlur(k);a("#blur").val(O);if(!E&&o!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Y,da;if(["g","polyline","path"].indexOf(J)>=0)if(o=g.getStrokedBBox([k])){Y=o.x;da=o.y}if(w){Y=svgedit.units.convertUnit(Y);da=svgedit.units.convertUnit(da)}a("#"+J+"_x").val(Math.round(Y));a("#"+J+"_y").val(Math.round(da));if(J==="polyline"){a("#path_x").val(Math.round(Y));a("#path_y").val(Math.round(da))}["image","text","path","g","use"].indexOf(J)== a("#angle").val(Math.round(O));O=g.getBlur(k);a("#blur").val(O);if(!E&&o!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Y,da;if(["g","polyline","path"].indexOf(J)>=0)if(o=g.getStrokedBBox([k])){Y=o.x;da=o.y}if(w){Y=svgedit.units.convertUnit(Y);da=svgedit.units.convertUnit(da)}a("#"+J+"_x").val(Math.round(Y));a("#"+J+"_y").val(Math.round(da));if(J==="polyline"){a("#path_x").val(Math.round(Y));a("#path_y").val(Math.round(da))}["image","text","path","g","use"].indexOf(J)==
-1&&a(".action_path_convert_selected").removeClass("disabled");J==="path"&&a(".action_path_selected").removeClass("disabled")}w=null;if(V==="a"){w=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();w=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!w);w&&a("#link_url").val(w);w={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");J==="path"&&a(".action_path_selected").removeClass("disabled")}w=null;if(V==="a"){w=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();w=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!w);w&&a("#link_url").val(w);w={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 V=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(V=="path"||V=="polyline")a("#path_panel").show();if(w[V]){w=w[V];a("#"+V+"_panel").show();V=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(w,function(fa,ha){var W=k.getAttribute(ha);if(curConfig.baseUnit!=="px"&&k[ha])W=svgedit.units.convertUnit(k[ha].baseVal.value);var qa=document.getElementById(V+"_"+ha);qa.value=Math.round(W)||0;qa.getAttribute("data-cursor")=== "y1","x2","y2"],text:["x","y"],use:[],path:[]};var V=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(V=="path"||V=="polyline")a("#path_panel").show();if(w[V]){w=w[V];a("#"+V+"_panel").show();V=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(w,function(fa,ha){var W=k.getAttribute(ha);if(curConfig.baseUnit!=="px"&&k[ha])W=svgedit.units.convertUnit(k[ha].baseVal.value);var qa=document.getElementById(V+"_"+ha);qa.value=Math.round(W)||0;qa.getAttribute("data-cursor")===
"true"&&a.fn.dragInput.updateCursor(qa)});if(V=="text"){w=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(w);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(w.split(",")[0].replace(/'/g,"")).css("font-family",w);g.addedNew&&setTimeout(function(){a("#text").focus().select()}, "true"&&a.fn.dragInput.updateCursor(qa)});if(V=="text"){w=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(w);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(w.split(",")[0].replace(/'/g,"")).css("font-family",w);g.addedNew&&setTimeout(function(){a("#text").focus().select()},
100)}else if(V=="image")Ha(g.getHref(k));else if(V==="g"||V==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}H[(V==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");H[(V==="g"||!U?"dis":"en")+"ableContextMenuItems"]("#group")}if(U){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");H.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||H.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back"); 100)}else if(V=="image")Ha(g.getHref(k));else if(V==="g"||V==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}I[(V==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");I[(V==="g"||!U?"dis":"en")+"ableContextMenuItems"]("#group")}if(U){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");I.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||I.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
s.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");s.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!E||U){a("#selLayerNames").removeAttr("disabled").val(n);I.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,n){var o=g.getMode();o==="select"&& s.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");s.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!E||U){a("#selLayerNames").removeAttr("disabled").val(n);H.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,n){var o=g.getMode();o==="select"&&
na();if(o==="pathedit")return Ga();X=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);U=n.length>=2?n:false;if(g.elementsAreSame(U))X=U[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":a(".context_panel").hide();a("#use_panel").show();break;case "image":a(".context_panel").hide();a("#image_panel").show();break;case "foreignObject":a(".context_panel").hide();break;case "g":case "a":o=null;for(var w=X.getElementsByTagName("*"),E=0,H=w.length;E<H;E++){var J= oa();if(o==="pathedit")return Ga();X=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);U=n.length>=2?n:false;if(g.elementsAreSame(U))X=U[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":a(".context_panel").hide();a("#use_panel").show();break;case "image":a(".context_panel").hide();a("#image_panel").show();break;case "foreignObject":a(".context_panel").hide();break;case "g":case "a":o=null;for(var w=X.getElementsByTagName("*"),E=0,I=w.length;E<I;E++){var J=
w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Ga();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0])}if(X!=null){o=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(o); w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Ga();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0])}if(X!=null){o=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(o);
a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.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")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",function(k,n){var o=g.getMode(),w=n[0];if(w){U=n.length>=2&&n[1]!=null? a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.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")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",function(k,n){var o=g.getMode(),w=n[0];if(w){U=n.length>=2&&n[1]!=null?
n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&na();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Ga();if(X&&o==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged", n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&oa();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Ga();if(X&&o==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",
{elems:n})});g.bind("saved",function(k,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var o=navigator.userAgent;if(~o.indexOf("MSIE"))Eb(0,true);else{var w=k.open("data:image/svg+xml;base64,"+L.encode64(n)),E=a.pref("save_notice_done");if(E!=="all"){var H=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(o.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){H+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");E="all"}else a.pref("save_notice_done", {elems:n})});g.bind("saved",function(k,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var o=navigator.userAgent;if(~o.indexOf("MSIE"))Eb(0,true);else{var w=k.open("data:image/svg+xml;base64,"+L.encode64(n)),E=a.pref("save_notice_done");if(E!=="all"){var I=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(o.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){I+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");E="all"}else a.pref("save_notice_done",
"part");else a.pref("save_notice_done","all");E!=="part"&&w.alert(H)}}});g.bind("exported",function(k,n){var o=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var w=a("#export_canvas")[0];w.width=g.contentW;w.height=g.contentH;canvg(w,n.svg,{renderCallback:function(){var E=w.toDataURL("image/png");Q.location.href=E;if(a.pref("export_notice_done")!=="all"){E=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(o.length)E+="\n\n"+uiStrings.notification.noteTheseIssues+ "part");else a.pref("save_notice_done","all");E!=="part"&&w.alert(I)}}});g.bind("exported",function(k,n){var o=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var w=a("#export_canvas")[0];w.width=g.contentW;w.height=g.contentH;canvg(w,n.svg,{renderCallback:function(){var E=w.toDataURL("image/png");S.location.href=E;if(a.pref("export_notice_done")!=="all"){E=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(o.length)E+="\n\n"+uiStrings.notification.noteTheseIssues+
"\n \u2022 "+o.join("\n \u2022 ");a.pref("export_notice_done","all");Q.alert(E)}}})});g.bind("zoomed",ja);g.bind("contextset",function(k,n){var o="";if(n){var w="";o='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){w+=" > "+this.id;o+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Aa=w}else Aa=null;a("#cur_context_panel").toggle(!!n).html(o)});g.bind("extension_added",function(k,n){function o(){if(la){clearTimeout(la); "\n \u2022 "+o.join("\n \u2022 ");a.pref("export_notice_done","all");S.alert(E)}}})});g.bind("zoomed",ja);g.bind("contextset",function(k,n){var o="";if(n){var w="";o='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){w+=" > "+this.id;o+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Aa=w}else Aa=null;a("#cur_context_panel").toggle(!!n).html(o)});g.bind("extension_added",function(k,n){function o(){if(la){clearTimeout(la);
la=null}E||(la=setTimeout(function(){E=true;Mb(v.iconsize)},50))}var w=false,E=false,H=true,J=function(){if(n.callback&&!w&&H){w=true;n.callback()}},O=[];n.context_tools&&a.each(n.context_tools,function(ha,W){var qa=W.container_id?' id="'+W.container_id+'"':"",ua=a("#"+W.panel);ua.length||(ua=a("<div>",{id:W.panel}).appendTo("#tools_top").hide());switch(W.type){case "tool_button":var za='<div class="tool_button">'+W.id+"</div>",Ba=a(za).appendTo(ua);W.events&&a.each(W.events,function(Na,jb){a(Ba).bind(Na, la=null}E||(la=setTimeout(function(){E=true;Mb(v.iconsize)},50))}var w=false,E=false,I=true,J=function(){if(n.callback&&!w&&I){w=true;n.callback()}},O=[];n.context_tools&&a.each(n.context_tools,function(ha,W){var qa=W.container_id?' id="'+W.container_id+'"':"",ua=a("#"+W.panel);ua.length||(ua=a("<div>",{id:W.panel}).appendTo("#tools_top").hide());switch(W.type){case "tool_button":var za='<div class="tool_button">'+W.id+"</div>",Ba=a(za).appendTo(ua);W.events&&a.each(W.events,function(Na,jb){a(Ba).bind(Na,
jb)});break;case "select":za="<label"+qa+'><select id="'+W.id+'">';a.each(W.options,function(Na,jb){za+='<option value="'+Na+'"'+(Na==W.defval?" selected":"")+">"+jb+"</option>"});za+="</select></label>";var Pa=a(za).appendTo(ua).find("select");a.each(W.events,function(Na,jb){a(Pa).bind(Na,jb)});break;case "button-select":za='<div id="'+W.id+'" class="dropdown toolset" title="'+W.title+'"><div id="cur_'+W.id+'" class="icon_label"></div><button></button></div>';qa=a('<ul id="'+W.id+'_opts"></ul>').appendTo("#option_lists"); jb)});break;case "select":za="<label"+qa+'><select id="'+W.id+'">';a.each(W.options,function(Na,jb){za+='<option value="'+Na+'"'+(Na==W.defval?" selected":"")+">"+jb+"</option>"});za+="</select></label>";var Pa=a(za).appendTo(ua).find("select");a.each(W.events,function(Na,jb){a(Pa).bind(Na,jb)});break;case "button-select":za='<div id="'+W.id+'" class="dropdown toolset" title="'+W.title+'"><div id="cur_'+W.id+'" class="icon_label"></div><button></button></div>';qa=a('<ul id="'+W.id+'_opts"></ul>').appendTo("#option_lists");
W.colnum&&qa.addClass("optcols"+W.colnum);a(za).appendTo(ua).children();O.push({elem:"#"+W.id,list:"#"+W.id+"_opts",title:W.title,callback:W.events.change,cur:"#cur_"+W.id});break;case "input":za="<label"+qa+'><span id="'+W.id+'_label">'+W.label+':</span><input id="'+W.id+'" title="'+W.title+'" size="'+(W.size||"4")+'" value="'+(W.defval||"")+'" type="text"/></label>';var Qa=a(za).appendTo(ua).find("input");W.spindata&&Qa.SpinButton(W.spindata);W.events&&a.each(W.events,function(Na,jb){Qa.bind(Na, W.colnum&&qa.addClass("optcols"+W.colnum);a(za).appendTo(ua).children();O.push({elem:"#"+W.id,list:"#"+W.id+"_opts",title:W.title,callback:W.events.change,cur:"#cur_"+W.id});break;case "input":za="<label"+qa+'><span id="'+W.id+'_label">'+W.label+':</span><input id="'+W.id+'" title="'+W.title+'" size="'+(W.size||"4")+'" value="'+(W.defval||"")+'" type="text"/></label>';var Qa=a(za).appendTo(ua).find("input");W.spindata&&Qa.SpinButton(W.spindata);W.events&&a.each(W.events,function(Na,jb){Qa.bind(Na,
jb)})}});if(n.buttons){var Y={},da={},V=n.svgicons,fa={};a.each(n.buttons,function(ha,W){for(var qa,ua=W.id,za=ha;a("#"+ua).length;)ua=W.id+"_"+ ++za;if(V){Y[ua]=W.icon;za=W.svgicon?W.svgicon:W.id;if(W.type=="app_menu")da["#"+ua+" > div"]=za;else da["#"+ua]=za}else qa=W.type=="menu"?"":a('<img src="'+W.icon+'">');var Ba,Pa;switch(W.type){case "mode_flyout":case "mode":Ba="tool_button";if(W.cls)Ba+=" "+W.cls;Pa="#tools_left";break;case "context":Ba="tool_button";Pa="#"+W.panel;a(Pa).length||a("<div>", jb)})}});if(n.buttons){var Y={},da={},V=n.svgicons,fa={};a.each(n.buttons,function(ha,W){for(var qa,ua=W.id,za=ha;a("#"+ua).length;)ua=W.id+"_"+ ++za;if(V){Y[ua]=W.icon;za=W.svgicon?W.svgicon:W.id;if(W.type=="app_menu")da["#"+ua+" > div"]=za;else da["#"+ua]=za}else qa=W.type=="menu"?"":a('<img src="'+W.icon+'">');var Ba,Pa;switch(W.type){case "mode_flyout":case "mode":Ba="tool_button";if(W.cls)Ba+=" "+W.cls;Pa="#tools_left";break;case "context":Ba="tool_button";Pa="#"+W.panel;a(Pa).length||a("<div>",
{id:W.panel}).appendTo("#tools_top");break;case "menu":Ba="menu_item tool_button";Pa="#"+(W.after||W.panel);break;case "app_menu":Ba="";Pa=W.parent||"#main_menu ul";a(Pa).length||a("<div>",{id:W.panel}).appendTo("#tools_top")}var Qa=a(W.list||W.type=="app_menu"?"<li/>":"<div/>").attr("id",ua).attr("title",W.title).addClass(Ba);if(!W.includeWith&&!W.list){if("position"in W)a(Pa).children().eq(W.position).before(Qa);else W.type!="menu"||!W.after?Qa.appendTo(Pa):a(Pa).after(Qa);if(W.type=="mode_flyout"){za= {id:W.panel}).appendTo("#tools_top");break;case "menu":Ba="menu_item tool_button";Pa="#"+(W.after||W.panel);break;case "app_menu":Ba="";Pa=W.parent||"#main_menu ul";a(Pa).length||a("<div>",{id:W.panel}).appendTo("#tools_top")}var Qa=a(W.list||W.type=="app_menu"?"<li/>":"<div/>").attr("id",ua).attr("title",W.title).addClass(Ba);if(!W.includeWith&&!W.list){if("position"in W)a(Pa).children().eq(W.position).before(Qa);else W.type!="menu"||!W.after?Qa.appendTo(Pa):a(Pa).after(Qa);if(W.type=="mode_flyout"){za=
a(Qa);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){var Na=za[0].id.replace("tool_","tools_"),jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za);Ba.data("isLibrary",true);jb.data("isLibrary",true)}da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,icon:W.id,isDefault:true},ub]}else if(W.type=="app_menu"||W.type=="menu")Qa.append(W.title)}else if(W.list){Qa.addClass("push_button");a("#"+W.list+"_opts").append(Qa); a(Qa);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){var Na=za[0].id.replace("tool_","tools_"),jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=na(Na,za);Ba.data("isLibrary",true);jb.data("isLibrary",true)}da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,icon:W.id,isDefault:true},ub]}else if(W.type=="app_menu"||W.type=="menu")Qa.append(W.title)}else if(W.list){Qa.addClass("push_button");a("#"+W.list+"_opts").append(Qa);
if(W.isDefault){a("#cur_"+W.list).append(Qa.children().clone());za=W.svgicon?W.svgicon:W.id;da["#cur_"+W.list]=za}}else if(W.includeWith){Pa=W.includeWith;za=a(Pa.button);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){Na=za[0].id.replace("tool_","tools_");jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za)}var ub=B.getButtonData(Pa.button);if(Pa.isDefault)da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click, if(W.isDefault){a("#cur_"+W.list).append(Qa.children().clone());za=W.svgicon?W.svgicon:W.id;da["#cur_"+W.list]=za}}else if(W.includeWith){Pa=W.includeWith;za=a(Pa.button);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){Na=za[0].id.replace("tool_","tools_");jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=na(Na,za)}var ub=B.getButtonData(Pa.button);if(Pa.isDefault)da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,
icon:W.id,key:W.key,isDefault:W.includeWith?W.includeWith.isDefault:0},ub];Na="position"in Pa?Pa.position:"last";ub=Ba.children().length;if(!isNaN(Na)&&Na>=0&&Na<ub)Ba.children().eq(Na).before(Qa);else{Ba.append(Qa);ua.reverse()}}V||Qa.append(qa);W.list||a.each(W.events,function(Cb,Jb){if(Cb=="click")if(W.type=="mode"){W.includeWith?Qa.bind(Cb,Jb):Qa.bind(Cb,function(){ra(Qa)&&Jb()});if(W.key){a(document).bind("keydown",W.key,Jb);W.title&&Qa.attr("title",W.title+" ["+W.key+"]")}}else Qa.bind(Cb,Jb); icon:W.id,key:W.key,isDefault:W.includeWith?W.includeWith.isDefault:0},ub];Na="position"in Pa?Pa.position:"last";ub=Ba.children().length;if(!isNaN(Na)&&Na>=0&&Na<ub)Ba.children().eq(Na).before(Qa);else{Ba.append(Qa);ua.reverse()}}V||Qa.append(qa);W.list||a.each(W.events,function(Cb,Jb){if(Cb=="click")if(W.type=="mode"){W.includeWith?Qa.bind(Cb,Jb):Qa.bind(Cb,function(){ra(Qa)&&Jb()});if(W.key){a(document).bind("keydown",W.key,Jb);W.title&&Qa.attr("title",W.title+" ["+W.key+"]")}}else Qa.bind(Cb,Jb);
else Qa.bind(Cb,Jb)});Z(fa)});a.each(O,function(){vb(this.elem,this.list,this.callback,{seticon:true})});if(V)H=false;a.svgIcons(V,{w:27,h:27,id_match:false,no_img:!m,fallback:Y,placement:da,callback:function(){v.iconsize&&v.iconsize!="m"&&o();H=true;J()}})}J()});g.textActions.setInputElem(a("#text")[0]);var Ma='<div class="palette_item transparent" data-rgb="none"></div>\t\t\t\t\t\t\t\t<div class="palette_item black" data-rgb="#000000"></div>\t\t\t\t\t\t\t\t<div class="palette_item white" data-rgb="#ffffff"></div>'; else Qa.bind(Cb,Jb)});Z(fa)});a.each(O,function(){vb(this.elem,this.list,this.callback,{seticon:true})});if(V)I=false;a.svgIcons(V,{w:27,h:27,id_match:false,no_img:!m,fallback:Y,placement:da,callback:function(){v.iconsize&&v.iconsize!="m"&&o();I=true;J()}})}J()});g.textActions.setInputElem(a("#text")[0]);var Ma='<div class="palette_item transparent" data-rgb="none"></div>\t\t\t\t\t\t\t\t<div class="palette_item black" data-rgb="#000000"></div>\t\t\t\t\t\t\t\t<div class="palette_item white" data-rgb="#ffffff"></div>';
["#482816","#422C10","#3B2F0E","#32320F","#293414","#1F361B","#153723","#0C372C","#083734","#0E353B","#1A333F","#273141","#332D40","#3E2A3C","#462735","#4B252D","#4D2425","#4C261D","#845335","#7B572D","#6F5C2A","#62612C","#546433","#46673D","#396849","#306856","#2D6862","#33666C","#426373","#535F75","#645A73","#74556D","#805064","#884D58","#8B4D4B","#894F3F","#C48157","#B8874D","#A98E49","#97944B","#849854","#729C62","#619E73","#559E84","#529D94","#5B9BA2","#6D97AB","#8391AE","#9A8AAB","#AF84A3", ["#482816","#422C10","#3B2F0E","#32320F","#293414","#1F361B","#153723","#0C372C","#083734","#0E353B","#1A333F","#273141","#332D40","#3E2A3C","#462735","#4B252D","#4D2425","#4C261D","#845335","#7B572D","#6F5C2A","#62612C","#546433","#46673D","#396849","#306856","#2D6862","#33666C","#426373","#535F75","#645A73","#74556D","#805064","#884D58","#8B4D4B","#894F3F","#C48157","#B8874D","#A98E49","#97944B","#849854","#729C62","#619E73","#559E84","#529D94","#5B9BA2","#6D97AB","#8391AE","#9A8AAB","#AF84A3",
"#BF7E96","#C97A86","#CE7975","#CC7C65","#FFB27C","#FABA6F","#E6C36A","#CFCA6D","#B8D078","#A0D58A","#8CD79F","#7DD8B5","#7AD6CA","#84D3DB","#9ACEE6","#B6C7EA","#D3BEE7","#EDB6DC","#FFAFCC","#FFAAB8","#FFA9A2","#FFAC8D","#FFE7A2","#FFF093","#FFFA8D","#FFFF91","#EEFF9F","#D1FFB4","#B9FFCE","#A8FFE9","#A4FFFF","#B1FFFF","#CBFFFF","#EDFFFF","#FFF5FF","#FFEBFF","#FFE2FF","#FFDCEC","#FFDBD2","#FFDFB8"].forEach(function(k){Ma+='<div class="palette_item" style="background-color: '+k+';" data-rgb="'+k+'"></div>'}); "#BF7E96","#C97A86","#CE7975","#CC7C65","#FFB27C","#FABA6F","#E6C36A","#CFCA6D","#B8D078","#A0D58A","#8CD79F","#7DD8B5","#7AD6CA","#84D3DB","#9ACEE6","#B6C7EA","#D3BEE7","#EDB6DC","#FFAFCC","#FFAAB8","#FFA9A2","#FFAC8D","#FFE7A2","#FFF093","#FFFA8D","#FFFF91","#EEFF9F","#D1FFB4","#B9FFCE","#A8FFE9","#A4FFFF","#B1FFFF","#CBFFFF","#EDFFFF","#FFF5FF","#FFEBFF","#FFE2FF","#FFDCEC","#FFDBD2","#FFDFB8"].forEach(function(k){Ma+='<div class="palette_item" style="background-color: '+k+';" data-rgb="'+k+'"></div>'});
a("#palette").append(Ma);var Ca=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ca.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var n=k.value/100;if(n<0.0010)k.value=0.1;else{k=g.getZoom();var o=K;ja(window,{width:0,height:0,x:(o[0].scrollLeft+o.width()/2)/k,y:(o[0].scrollTop+o.height()/2)/k,zoom:n},true)}};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val()); a("#palette").append(Ma);var Ca=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ca.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var n=k.value/100;if(n<0.0010)k.value=0.1;else{k=g.getZoom();var o=K;ja(window,{width:0,height:0,x:(o[0].scrollLeft+o.width()/2)/k,y:(o[0].scrollTop+o.height()/2)/k,zoom:n},true)}};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());
a("#stroke_style_label").html(this.options[this.selectedIndex].text);window.opera&&a("<p/>").hide().appendTo("body").remove()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var n=k.getAttribute("data-attr"),o=k.getAttribute("data-multiplier")|| a("#stroke_style_label").html(this.options[this.selectedIndex].text);window.opera&&a("<p/>").hide().appendTo("body").remove()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var n=k.getAttribute("data-attr"),o=k.getAttribute("data-multiplier")||
1;o=parseFloat(o);o=k.value*o;if(!svgedit.units.isValidUnit(n,o,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(n);return false}g.changeSelectedAttributeNoUndo(n,o)};picking=false;a(document).on("mouseup",function(){picking=false});a("#palette").on("mousemove mousedown touchstart touchmove",".palette_item",function(k){k.preventDefault();if(k.type=="mousedown")picking=true;if(picking){var n=a("#tool_stroke").hasClass("active"),o=n?"stroke":"fill",w=a(this).attr("data-rgb"), 1;o=parseFloat(o);o=k.value*o;if(!svgedit.units.isValidUnit(n,o,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(n);return false}g.changeSelectedAttributeNoUndo(n,o)};picking=false;a(document).on("mouseup",function(){picking=false});a("#palette").on("mousemove mousedown touchstart touchmove",".palette_item",function(k){k.preventDefault();if(k.type=="mousedown")picking=true;if(picking){var n=a("#tool_stroke").hasClass("active"),o=n?"stroke":"fill",w=a(this).attr("data-rgb"),
E=null,H=true;if(k.type=="mousedown")H=false;if(w==="transparent"||w==="initial"||w==="#none"){w="none";E=new a.jGraduate.Paint}else E=new a.jGraduate.Paint({alpha:100,solidColor:w.substr(1)});b.paintBox[o].setPaint(E);if(n){g.setColor("stroke",w,H);w!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",w,H);w!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display", E=null,I=true;if(k.type=="mousedown")I=false;if(w==="transparent"||w==="initial"||w==="#none"){w="none";E=new a.jGraduate.Paint}else E=new a.jGraduate.Paint({alpha:100,solidColor:w.substr(1)});b.paintBox[o].setPaint(E);if(n){g.setColor("stroke",w,I);w!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",w,I);w!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display",
"table-cell");a(this).addClass("expanded");Db()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");Db()});var ra=function(k,n){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var o=o||"normal";n||a(".tools_flyout").fadeOut(o);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k= "table-cell");a(this).addClass("expanded");Db()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");Db()});var ra=function(k,n){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var o=o||"normal";n||a(".tools_flyout").fadeOut(o);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=
null,n=null,o=K[0],w=false,E=false;a("#svgcanvas").on("mousemove mouseup touchend",function(H){if(w!==false){o.scrollLeft-=H.clientX-k;o.scrollTop-=H.clientY-n;k=H.clientX;n=H.clientY;if(H.type==="mouseup"||H.type==="touchend")w=false;return false}}).on("mousedown touchmove",function(H){if(H.button===1||E===true||H.originalEvent.touches&&H.originalEvent.touches.length>=2){w=true;k=H.clientX;n=H.clientY;return false}});a(window).mouseup(function(){w=false});a(document).bind("keydown","space",function(H){H.preventDefault(); null,n=null,o=K[0],w=false,E=false;a("#svgcanvas").on("mousemove mouseup touchend",function(I){if(w!==false){o.scrollLeft-=I.clientX-k;o.scrollTop-=I.clientY-n;k=I.clientX;n=I.clientY;if(I.type==="mouseup"||I.type==="touchend")w=false;return false}}).on("mousedown touchmove",function(I){if(I.button===1||E===true||I.originalEvent.touches&&I.originalEvent.touches.length>=2){w=true;k=I.clientX;n=I.clientY;return false}});a(window).mouseup(function(){w=false});a(document).bind("keydown","space",function(I){I.preventDefault();
g.spaceKey=E=true}).bind("keyup","space",function(H){H.preventDefault();g.spaceKey=E=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&K.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&K.removeClass("out")})})();var va=a(".menu"),kb=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background= g.spaceKey=E=true}).bind("keyup","space",function(I){I.preventDefault();g.spaceKey=E=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&K.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&K.removeClass("out")})})();var va=a(".menu"),kb=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=
""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){kb(k)});a("svg, body").on("mousedown touchstart",function(k){if(!(k.target.nodeName&&k.target.nodeName.toLowerCase()==="input"))if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?kb(k):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel", ""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){kb(k)});a("svg, body").on("mousedown touchstart",function(k){if(!(k.target.nodeName&&k.target.nodeName.toLowerCase()==="input"))if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?kb(k):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",
function(k,n,o,w){if(k.altKey){k.preventDefault();zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+w*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");va.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){va.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,n,o){if(a(k).length!=0){var w=a(k).find("button"),E=a(k).find("ul").attr("id",a(k)[0].id+"-list"); function(k,n,o,w){if(k.altKey){k.preventDefault();zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+w*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");va.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){va.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,n,o){if(a(k).length!=0){var w=a(k).find("button"),E=a(k).find("ul").attr("id",a(k)[0].id+"-list");
o||a("#option_lists").append(E);var H=false;o&&a(k).addClass("dropup");E.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!H){w.removeClass("down");E.hide()}H=false});w.bind("mousedown",function(){if(w.hasClass("down")){w.removeClass("down");E.hide()}else{w.addClass("down");if(!o){var J=a(k).offset();E.css({top:J.top,left:J.left-110})}E.show();H=true}}).hover(function(){H=true}).mouseout(function(){H=false})}};var vb=function(k,n,o,w){var E=a(k);n=a(n);var H=false,J=w.dropUp;J&&a(k).addClass("dropup"); o||a("#option_lists").append(E);var I=false;o&&a(k).addClass("dropup");E.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!I){w.removeClass("down");E.hide()}I=false});w.bind("mousedown",function(){if(w.hasClass("down")){w.removeClass("down");E.hide()}else{w.addClass("down");if(!o){var J=a(k).offset();E.css({top:J.top,left:J.left-110})}E.show();I=true}}).hover(function(){I=true}).mouseout(function(){I=false})}};var vb=function(k,n,o,w){var E=a(k);n=a(n);var I=false,J=w.dropUp;J&&a(k).addClass("dropup");
n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,arguments)});a(window).mouseup(function(){if(!H){E.removeClass("down");n.hide();n.css({top:0,left:0})}H=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");n.hide();n.css({top:0,left:0})}else{E.addClass("down"); n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,arguments)});a(window).mouseup(function(){if(!I){E.removeClass("down");n.hide();n.css({top:0,left:0})}I=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");n.hide();n.css({top:0,left:0})}else{E.addClass("down");
n.show();H=true;return false}}).hover(function(){H=true}).mouseout(function(){H=false});w.multiclick&&n.mousedown(function(){H=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k, n.show();I=true;return false}}).hover(function(){I=true}).mouseout(function(){I=false});w.multiclick&&n.mousedown(function(){I=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,
"page")})});(function(){var k,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N="canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Ea=function(){ra("#tool_rect")&&g.setMode("rect")},ta=function(){ra("#tool_ellipse")&& "page")})});(function(){var k,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N="canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Ea=function(){ra("#tool_rect")&&g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&
g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();na()}},Fa=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){window.event&&window.event.type=== g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();oa()}},Fa=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){window.event&&window.event.type===
"keydown"&&Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToBottomSelectedElement()}}, "keydown"&&Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToBottomSelectedElement()}},
eb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display", eb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display",
"none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ga()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked", "none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ga()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",
true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)}, true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},
ca=function(){g.cycleElement(0)},Da=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ga()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){na();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Ga();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Ga()},Za=function(){g.setItalic(!g.getItalic());Ga()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage; ca=function(){g.cycleElement(0)},Da=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ga()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){oa();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Ga();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Ga()},Za=function(){g.setItalic(!g.getItalic());Ga()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;
Q=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},Ia=function(k){var n=k.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()> S=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},Ia=function(k){var n=k.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>
0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o= 0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o=
n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"): n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):
a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed"); a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=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)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o= 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)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=
ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});na()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+ ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});oa()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+
n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),H=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+ n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),I=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+
O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=H;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=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"),w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=S=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show(); O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=I;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=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"),w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=R=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();
Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var H="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");H+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=da[k]||da.all;H+=Y+":"+V+";"});H+="}"});E="-"+gb.toLowerCase()+"-";H+="#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{"+ Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var I="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");I+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=da[k]||da.all;I+=Y+":"+V+";"});I+="}"});E="-"+gb.toLowerCase()+"-";I+="#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{"+
E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(H)}pa()}},Ab=function(){a("#dialog_box").hide();if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Aa&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height(); E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(I)}pa()}},Ab=function(){a("#dialog_box").hide();if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Aa&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(n){n&&Ha(n)})});var e=function(k){var n=k[0].id=="stroke_color"?"stroke": var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(n){n&&Ha(n)})});var e=function(k){var n=k[0].id=="stroke_color"?"stroke":
"fill",o=k[0].id=="canvas_color";if(o)n="canvas";var w=b.paintBox[n].paint;k=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";o=o?{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(o).jGraduate({paint:w,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(E){w=new a.jGraduate.Paint(E);b.paintBox[n].setPaint(w); "fill",o=k[0].id=="canvas_color";if(o)n="canvas";var w=b.paintBox[n].paint;k=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";o=o?{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(o).jGraduate({paint:w,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(E){w=new a.jGraduate.Paint(E);b.paintBox[n].setPaint(w);
g.setPaint(n,w);a("#color_picker").hide()},function(){a("#color_picker").hide()})};c=function(k,n){var o=document.getElementById("canvas_background"),w={color:"fff",opacity:1};if(n=="stroke")w=curConfig.initStroke;if(n=="fill")w=curConfig.initFill;if(n=="canvas"&&o)if(o=o.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))w={color:("0"+parseInt(o[1],10).toString(16)).slice(-2)+("0"+parseInt(o[2],10).toString(16)).slice(-2)+("0"+parseInt(o[3],10).toString(16)).slice(-2),opacity:1};o=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+ g.setPaint(n,w);a("#color_picker").hide()},function(){a("#color_picker").hide()})};c=function(k,n){var o=document.getElementById("canvas_background"),w={color:"fff",opacity:1};if(n=="stroke")w=curConfig.initStroke;if(n=="fill")w=curConfig.initFill;if(n=="canvas"&&o)if(o=o.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))w={color:("0"+parseInt(o[1],10).toString(16)).slice(-2)+("0"+parseInt(o[2],10).toString(16)).slice(-2)+("0"+parseInt(o[3],10).toString(16)).slice(-2),opacity:1};o=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
w.color+'" opacity="'+w.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;o=a(k)[0].appendChild(document.importNode(o,true));n==="canvas"?o.setAttribute("width",60.5):o.setAttribute("width","100%");this.rect=o.firstChild;this.defs=o.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:w.color});this.type=n;this.setPaint=function(E,H){this.paint=E;var J="none",O=E.type,Y=E.alpha/100;switch(O){case "solidColor":J= w.color+'" opacity="'+w.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;o=a(k)[0].appendChild(document.importNode(o,true));n==="canvas"?o.setAttribute("width",60.5):o.setAttribute("width","100%");this.rect=o.firstChild;this.defs=o.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:w.color});this.type=n;this.setPaint=function(E,I){this.paint=E;var J="none",O=E.type,Y=E.alpha/100;switch(O){case "solidColor":J=
E[O]=="none"||E[O]=="one"?"none":"#"+E[O];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(E[O]);J="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",J);this.rect.setAttribute("opacity",Y);if(this.type=="canvas")if(O=document.getElementById("canvas_background")){ya=g.getResolution();O.setAttribute("x",-1);O.setAttribute("y",-1);O.setAttribute("width",ya.w+2);O.setAttribute("height",ya.h+2);J.indexOf("url")== E[O]=="none"||E[O]=="one"?"none":"#"+E[O];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(E[O]);J="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",J);this.rect.setAttribute("opacity",Y);if(this.type=="canvas")if(O=document.getElementById("canvas_background")){ya=g.getResolution();O.setAttribute("x",-1);O.setAttribute("y",-1);O.setAttribute("width",ya.w+2);O.setAttribute("height",ya.h+2);J.indexOf("url")==
-1&&O.setAttribute("fill",J)}else Ja(J);if(H){g.setColor(this.type,J,true);g.setPaintOpacity(this.type,Y,true)}};this.update=function(E){if(X){var H=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var J=null,O=X.getElementsByTagName("*"),Y=0,da=O.length;Y<da;Y++){var V=O[Y].getAttribute(H);if(Y===0)J=V;else if(J!==V){J=null;break}}if(J===null){O=null;return}O=J;J=1;break;default:J=parseFloat(X.getAttribute(H+"-opacity"));if(isNaN(J))J=1;O=H=== -1&&O.setAttribute("fill",J)}else Ja(J);if(I){g.setColor(this.type,J,true);g.setPaintOpacity(this.type,Y,true)}};this.update=function(E){if(X){var I=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var J=null,O=X.getElementsByTagName("*"),Y=0,da=O.length;Y<da;Y++){var V=O[Y].getAttribute(I);if(Y===0)J=V;else if(J!==V){J=null;break}}if(J===null){O=null;return}O=J;J=1;break;default:J=parseFloat(X.getAttribute(I+"-opacity"));if(isNaN(J))J=1;O=I===
"fill"?"black":"none";O=X.getAttribute(H)||O}if(E){g.setColor(H,O,true);g.setPaintOpacity(H,J,true)}J*=100;this.setPaint(xa(O,J,H))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var E=new a.jGraduate.Paint({copy:this.paint});g.setPaint(n,E)}}};b.paintBox.fill=new c("#fill_color","fill");b.paintBox.stroke=new c("#stroke_color","stroke");b.paintBox.canvas=new c("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity* "fill"?"black":"none";O=X.getAttribute(I)||O}if(E){g.setColor(I,O,true);g.setPaintOpacity(I,J,true)}J*=100;this.setPaint(xa(O,J,I))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var E=new a.jGraduate.Paint({copy:this.paint});g.setPaint(n,E)}}};b.paintBox.fill=new c("#fill_color","fill");b.paintBox.stroke=new c("#stroke_color","stroke");b.paintBox.canvas=new c("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*
100);c=b.paintBox.fill.rect.cloneNode(false);c.setAttribute("style","vector-effect:non-scaling-stroke");var h=c.style.vectorEffect==="non-scaling-stroke";c.removeAttribute("style");c=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof c.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(c).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]); 100);c=b.paintBox.fill.rect.cloneNode(false);c.setAttribute("style","vector-effect:non-scaling-stroke");var h=c.style.vectorEffect==="non-scaling-stroke";c.removeAttribute("style");c=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof c.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(c).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);
v.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"))e(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"))e(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart", v.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"))e(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"))e(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",
function(){e(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");e(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");e(a("#fill_color"))});a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")|| function(){e(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");e(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");e(a("#fill_color"))});a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||
a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){K.css("line-height",K.height()+"px")});var l=function(){var k=a("#canvas_width"),n=a("#canvas_height"),o=k.val(),w=n.val();if(o!="fit"&&!svgedit.units.isValidUnit("width",o)){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(){K.css("line-height",K.height()+"px")});var l=function(){var k=a("#canvas_width"),n=a("#canvas_height"),o=k.val(),w=n.val();if(o!="fit"&&!svgedit.units.isValidUnit("width",o)){a.alert(uiStrings.notification.invalidAttrValGiven);
k.parent().addClass("error");return false}k.parent().removeClass("error");if(w!="fit"&&!svgedit.units.isValidUnit("height",w)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error");if(!g.setResolution(o,w)){a.alert(uiStrings.notification.noContentToFitTo);o=g.getResolution();k.val(o.w);n.val(o.h);return false}G()};a("#resolution").change(function(){var k=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value== k.parent().addClass("error");return false}k.parent().removeClass("error");if(w!="fit"&&!svgedit.units.isValidUnit("height",w)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error");if(!g.setResolution(o,w)){a.alert(uiStrings.notification.noContentToFitTo);o=g.getResolution();k.val(o.w);n.val(o.h);return false}G()};a("#resolution").change(function(){var k=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value==
"content"){k.value="fit";n.value="fit";l();var o=g.getResolution();k.value=o.w;n.value=o.h}else{var w=this.value.split("x");w[0]=parseInt(w[0]);w[1]=parseInt(w[1]);var E=w[0]-k.value,H=w[1]-n.value,J=Date.now(),O=function(Y){Y=(Y-J)/1E3;Y=Math.pow(Y-1,3)+1;k.value=(w[0]-E+Y*E).toFixed(0);n.value=(w[1]-H+Y*H).toFixed(0);l();if(Y>=1){Y=g.getResolution();a("#canvas_width").val(Y.w.toFixed());a("#canvas_height").val(Y.h.toFixed());a("#resolution_label").html("<div class='pull'>"+Y.w+"<span>\u00d7</span></br>"+ "content"){k.value="fit";n.value="fit";l();var o=g.getResolution();k.value=o.w;n.value=o.h}else{var w=this.value.split("x");w[0]=parseInt(w[0]);w[1]=parseInt(w[1]);var E=w[0]-k.value,I=w[1]-n.value,J=Date.now(),O=function(Y){Y=(Y-J)/1E3;Y=Math.pow(Y-1,3)+1;k.value=(w[0]-E+Y*E).toFixed(0);n.value=(w[1]-I+Y*I).toFixed(0);l();if(Y>=1){Y=g.getResolution();a("#canvas_width").val(Y.w.toFixed());a("#canvas_height").val(Y.h.toFixed());a("#resolution_label").html("<div class='pull'>"+Y.w+"<span>\u00d7</span></br>"+
Y.h+"</div>")}else requestAnimationFrame(O)};O(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;n.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var B=function(){var k=[{sel:"#tool_select",fn:cb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ta,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Ea,evt:"click", Y.h+"</div>")}else requestAnimationFrame(O)};O(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;n.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var B=function(){var k=[{sel:"#tool_select",fn:cb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ta,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Ea,evt:"click",
key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ta,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:db,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Fa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:$a,evt:"mouseup"},{sel:"#tool_zoom",fn:Ka,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Oa,evt:"mouseup",key:[u+"N",true]},{sel:"#tool_save",fn:function(){ea?Kb():g.save({images:v.img_save,round_digits:6})},evt:"mouseup",key:[u+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"}, key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ta,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:db,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Fa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:$a,evt:"mouseup"},{sel:"#tool_zoom",fn:Ka,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Oa,evt:"mouseup",key:[u+"N",true]},{sel:"#tool_save",fn:function(){ea?Kb():g.save({images:v.img_save,round_digits:6})},evt:"mouseup",key:[u+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},
{sel:"#tool_open",fn:Ra,evt:"mouseup"},{sel:"#tool_import",fn:mb,evt:"mouseup"},{sel:"#tool_source",fn:Eb,evt:"click",key:[u+"U",true]},{sel:"#tool_wireframe",fn:Hb,evt:"click"},{sel:"#tool_snap",fn:Gb,evt:"click"},{sel:"#tool_rulers",fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace", {sel:"#tool_open",fn:Ra,evt:"mouseup"},{sel:"#tool_import",fn:mb,evt:"mouseup"},{sel:"#tool_source",fn:Eb,evt:"click",key:[u+"U",true]},{sel:"#tool_wireframe",fn:Hb,evt:"click"},{sel:"#tool_snap",fn:Gb,evt:"click"},{sel:"#tool_rulers",fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace",
@ -476,38 +476,38 @@ true]},{sel:"#tool_topath",fn:ab,evt:"click"},{sel:"#tool_make_link,#tool_make_l
evt:"click",key:[u+"x",true]},{sel:"#tool_copy",fn:Xa,evt:"click",key:u+"c"},{sel:"#tool_paste",fn:wb,evt:"click",key:u+"v"},{sel:"#tool_switch",fn:La,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Wa,evt:"mousedown",key:[u+"B",true]},{sel:"#tool_italic",fn:Za,evt:"mousedown",key:[u+"I",true]},{sel:"#copy_save_done",fn:Ab,evt:"click"},{key:"ctrl+left",fn:function(){Da(0,1)}},{key:"ctrl+right",fn:function(){Da(1,1)}},{key:"ctrl+shift+left",fn:function(){Da(0,5)}},{key:"ctrl+shift+right",fn:function(){Da(1, evt:"click",key:[u+"x",true]},{sel:"#tool_copy",fn:Xa,evt:"click",key:u+"c"},{sel:"#tool_paste",fn:wb,evt:"click",key:u+"v"},{sel:"#tool_switch",fn:La,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Wa,evt:"mousedown",key:[u+"B",true]},{sel:"#tool_italic",fn:Za,evt:"mousedown",key:[u+"I",true]},{sel:"#copy_save_done",fn:Ab,evt:"click"},{key:"ctrl+left",fn:function(){Da(0,1)}},{key:"ctrl+right",fn:function(){Da(1,1)}},{key:"ctrl+shift+left",fn:function(){Da(0,5)}},{key:"ctrl+shift+right",fn:function(){Da(1,
5)}},{key:"shift+O",fn:ca},{key:"shift+P",fn:P},{key:[u+"+",true],fn:function(){yb(2)}},{key:[u+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){fb(0,-1)}},{key:["down",true],fn:function(){fb(0,1)}},{key:["left",true],fn:function(){fb(-1,0)}},{key:["right",true],fn:function(){fb(1,0)}},{key:"shift+up",fn:function(){fb(0,-10)}},{key:"shift+down",fn:function(){fb(0,10)}},{key:"shift+left",fn:function(){fb(-10,0)}},{key:"shift+right",fn:function(){fb(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0, 5)}},{key:"shift+O",fn:ca},{key:"shift+P",fn:P},{key:[u+"+",true],fn:function(){yb(2)}},{key:[u+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){fb(0,-1)}},{key:["down",true],fn:function(){fb(0,1)}},{key:["left",true],fn:function(){fb(-1,0)}},{key:["right",true],fn:function(){fb(1,0)}},{key:"shift+up",fn:function(){fb(0,-10)}},{key:"shift+down",fn:function(){fb(0,10)}},{key:"shift+left",fn:function(){fb(-10,0)}},{key:"shift+right",fn:function(){fb(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,
-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10, -1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,
0)}},{key:u+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:"I",fn:function(){var o=a(".tool_button_current");if(o.length&&o[0].id!=="tool_eyedropper"){o.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}g.setMode("eyedropper")}},{key:u+"shift+z",fn:rb},{key:"esc",fn:Ib}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var o={};a.each(k,function(w,E){if(E.sel){var H= 0)}},{key:u+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:"I",fn:function(){var o=a(".tool_button_current");if(o.length&&o[0].id!=="tool_eyedropper"){o.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}g.setMode("eyedropper")}},{key:u+"shift+z",fn:rb},{key:"esc",fn:Ib}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var o={};a.each(k,function(w,E){if(E.sel){var I=
a(E.sel);if(H.length==0)return true;if(E.evt){if(svgedit.browser.isTouch()&&E.evt==="click")E.evt="mousedown";H[E.evt](E.fn)}if(E.parent&&a(E.parent+"_show").length!=0){var J=a(E.parent);J.length||(J=oa(E.parent.substr(1)));J.append(H);a.isArray(o[E.parent])||(o[E.parent]=[]);o[E.parent].push(E)}}if(E.key){var O=E.fn,Y=false;if(a.isArray(E.key)){J=E.key[0];if(E.key.length>1)Y=E.key[1]}else J=E.key;J+="";svgedit.browser.isMac&&J.indexOf("+")!=-1&&J.split("+")[0]=="ctrl"&&J.replace("ctrl","cmd");a.each(J.split("/"), a(E.sel);if(I.length==0)return true;if(E.evt){if(svgedit.browser.isTouch()&&E.evt==="click")E.evt="mousedown";I[E.evt](E.fn)}if(E.parent&&a(E.parent+"_show").length!=0){var J=a(E.parent);J.length||(J=na(E.parent.substr(1)));J.append(I);a.isArray(o[E.parent])||(o[E.parent]=[]);o[E.parent].push(E)}}if(E.key){var O=E.fn,Y=false;if(a.isArray(E.key)){J=E.key[0];if(E.key.length>1)Y=E.key[1]}else J=E.key;J+="";svgedit.browser.isMac&&J.indexOf("+")!=-1&&J.split("+")[0]=="ctrl"&&J.replace("ctrl","cmd");a.each(J.split("/"),
function(V,fa){a(document).bind("keydown",fa,function(ha){O();Y&&ha.preventDefault();return false})});if(E.sel&&!E.hidekey&&H.attr("title")){var da=H.attr("title").split("[")[0]+" ("+J+")";n[J]=E.sel;H.parents("#main_menu").length||H.attr("title",da)}}});Z(o);a(window).bind("keydown","tab",function(w){if(N==="canvas"){w.preventDefault();P()}}).bind("keydown","shift+tab",function(w){if(N==="canvas"){w.preventDefault();ca()}});a("#tool_zoom").dblclick(Sa)},setTitles:function(){a.each(n,function(o,w){var E= function(V,fa){a(document).bind("keydown",fa,function(ha){O();Y&&ha.preventDefault();return false})});if(E.sel&&!E.hidekey&&I.attr("title")){var da=I.attr("title").split("[")[0]+" ("+J+")";n[J]=E.sel;I.parents("#main_menu").length||I.attr("title",da)}}});Z(o);a(window).bind("keydown","tab",function(w){if(N==="canvas"){w.preventDefault();P()}}).bind("keydown","shift+tab",function(w){if(N==="canvas"){w.preventDefault();ca()}});a("#tool_zoom").dblclick(Sa)},setTitles:function(){a.each(n,function(o,w){var E=
a(w).parents("#main_menu").length;a(w).each(function(){var H=E?a(this).text().split(" [")[0]:this.title.split(" [")[0],J="";a.each(o.split("/"),function(O,Y){var da=Y.split("+"),V="";if(da.length>1){V=da[0]+"+";Y=da[1]}J+=(O?"/":"")+V+(uiStrings["key_"+Y]||Y)});if(E)this.lastChild.textContent=H+" ["+J+"]";else this.title=H+" ["+J+"]"})})},getButtonData:function(o){var w;a.each(k,function(E,H){if(H.sel===o)w=H});return w}}}();B.setAll();b.ready(function(){var k=curConfig.initTool,n=a("#tools_left, #svg_editor .tools_flyout"), a(w).parents("#main_menu").length;a(w).each(function(){var I=E?a(this).text().split(" [")[0]:this.title.split(" [")[0],J="";a.each(o.split("/"),function(O,Y){var da=Y.split("+"),V="";if(da.length>1){V=da[0]+"+";Y=da[1]}J+=(O?"/":"")+V+(uiStrings["key_"+Y]||Y)});if(E)this.lastChild.textContent=I+" ["+J+"]";else this.title=I+" ["+J+"]"})})},getButtonData:function(o){var w;a.each(k,function(E,I){if(I.sel===o)w=I});return w}}}();B.setAll();b.ready(function(){var k=curConfig.initTool,n=a("#tools_left, #svg_editor .tools_flyout"),
o=n.find("#tool_"+k);k=n.find("#"+k);(o.length?o:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false}); o=n.find("#tool_"+k);k=n.find("#"+k);(o.length?o:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:l,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(k){var n=k.value;if(n==0&&X&&["line","polyline"].indexOf(X.nodeName)>=0)n=k.value=1;g.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled", 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(k){var n=k.value;if(n==0&&X&&["line","polyline"].indexOf(X.nodeName)>=0)n=k.value=1;g.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value,true);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",
k.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,n){var o=k.value-0,w=o+n,E=w>=o;if(n===0)return o;return o>=24?E?Math.round(o*1.1):Math.round(o/1.1):o<=1?E?o*2:o/2:w},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(k){val=k.value;a("#blur").val(val); k.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,n){var o=k.value-0,w=o+n,E=w>=o;if(n===0)return o;return o>=24?E?Math.round(o*1.1):Math.round(o/1.1):o<=1?E?o*2:o/2:w},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(k){val=k.value;a("#blur").val(val);
g.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(k){switch(k){case "delete":lb();break;case "cut":Ua();break;case "copy":Xa();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":sa();break;case "move_up":ib("Up");break;case "move_down":ib("Down");break; g.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(k){switch(k){case "delete":lb();break;case "cut":Ua();break;case "copy":Xa();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":sa();break;case "move_up":ib("Up");break;case "move_down":ib("Down");break;
case "move_back":hb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});a(".contextMenu li").mousedown(function(k){k.preventDefault()});a("#cmenu_canvas li").disableContextMenu();I.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(s.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(k){a("#main_menu").hide(); case "move_back":hb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});a(".contextMenu li").mousedown(function(k){k.preventDefault()});a("#cmenu_canvas li").disableContextMenu();H.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(s.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(k){a("#main_menu").hide();
s.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){c=function(k){k.stopPropagation();k.preventDefault();a("#workarea").removeAttr("style");a("#main_menu").hide();var n=null;if(n=k.type=="drop"?k.dataTransfer.files[0]:this.files[0])if(n.type.indexOf("image")!=-1)if(n.type.indexOf("svg")!=-1){k=new FileReader;k.onloadend=function(o){g.importSvgString(o.target.result,true);g.ungroupSelectedElement();g.ungroupSelectedElement();g.groupSelectedElements(); s.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){c=function(k){k.stopPropagation();k.preventDefault();a("#workarea").removeAttr("style");a("#main_menu").hide();var n=null;if(n=k.type=="drop"?k.dataTransfer.files[0]:this.files[0])if(n.type.indexOf("image")!=-1)if(n.type.indexOf("svg")!=-1){k=new FileReader;k.onloadend=function(o){g.importSvgString(o.target.result,true);g.ungroupSelectedElement();g.ungroupSelectedElement();g.groupSelectedElements();
g.alignSelectedElements("m","page");g.alignSelectedElements("c","page")};k.readAsText(n)}else alert("sorry, bitmap import is temporalily disabled")};K=a("#workarea");K[0].addEventListener("dragenter",function(k){k.stopPropagation();k.preventDefault();K.css({"-webkit-transform":"scale3d(1.1,1.1,1)","-moz-transform":"scale3d(1.1,1.1,1)","-o-transform":"scale(1.1)","-ms-transform":"scale3d(1.1,1.1,1)",transform:"scale3d(1.1,1.1,1)"})},false);K[0].addEventListener("dragover",function(k){k.stopPropagation(); g.alignSelectedElements("m","page");g.alignSelectedElements("c","page")};k.readAsText(n)}else alert("sorry, bitmap import is temporalily disabled")};K=a("#workarea");K[0].addEventListener("dragenter",function(k){k.stopPropagation();k.preventDefault();K.css({"-webkit-transform":"scale3d(1.1,1.1,1)","-moz-transform":"scale3d(1.1,1.1,1)","-o-transform":"scale(1.1)","-ms-transform":"scale3d(1.1,1.1,1)",transform:"scale3d(1.1,1.1,1)"})},false);K[0].addEventListener("dragover",function(k){k.stopPropagation();
k.preventDefault()},false);K[0].addEventListener("dragleave",function(k){K.removeAttr("style");k.stopPropagation();k.preventDefault()},false);K[0].addEventListener("drop",c,false);var A=a('<input type="file">').change(function(){var k=this;b.openPrep(function(n){if(n){g.clear();if(k.files.length==1){n=new FileReader;n.onloadend=function(o){q(o.target.result);G()};n.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(A);c=a('<input type="file">').change(c);a("#tool_import").show().prepend(c)}var G= k.preventDefault()},false);K[0].addEventListener("dragleave",function(k){K.removeAttr("style");k.stopPropagation();k.preventDefault()},false);K[0].addEventListener("drop",c,false);var A=a('<input type="file">').change(function(){var k=this;b.openPrep(function(n){if(n){g.clear();if(k.files.length==1){n=new FileReader;n.onloadend=function(o){q(o.target.result);G()};n.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(A);c=a('<input type="file">').change(c);a("#tool_import").show().prepend(c)}var G=
b.updateCanvas=function(k,n){var o=K.width(),w=K.height(),E=o,H=w,J=g.getZoom(),O=K,Y=a("#svgcanvas"),da={x:O[0].scrollLeft+E/2,y:O[0].scrollTop+H/2},V=curConfig.canvas_expansion;o=Math.max(E,g.contentW*J*V);w=Math.max(H,g.contentH*J*V);o==E&&w==H?K.css("overflow","hidden"):K.css("overflow","scroll");V=Y.height()/2;var fa=Y.width()/2;Y.width(o).height(w);var ha=w/2,W=o/2,qa=g.updateCanvas(o,w),ua=W/fa;o=o/2-E/2;w=w/2-H/2;if(n){n.x+=qa.x;n.y+=qa.y}else n={x:W+(da.x-fa)*ua,y:ha+(da.y-V)*ua};if(k)if(g.contentW> b.updateCanvas=function(k,n){var o=K.width(),w=K.height(),E=o,I=w,J=g.getZoom(),O=K,Y=a("#svgcanvas"),da={x:O[0].scrollLeft+E/2,y:O[0].scrollTop+I/2},V=curConfig.canvas_expansion;o=Math.max(E,g.contentW*J*V);w=Math.max(I,g.contentH*J*V);o==E&&w==I?K.css("overflow","hidden"):K.css("overflow","scroll");V=Y.height()/2;var fa=Y.width()/2;Y.width(o).height(w);var ha=w/2,W=o/2,qa=g.updateCanvas(o,w),ua=W/fa;o=o/2-E/2;w=w/2-I/2;if(n){n.x+=qa.x;n.y+=qa.y}else n={x:W+(da.x-fa)*ua,y:ha+(da.y-V)*ua};if(k)if(g.contentW>
O.width()){K[0].scrollLeft=qa.x-10;K[0].scrollTop=qa.y-10}else{O[0].scrollLeft=o;O[0].scrollTop=w}else{O[0].scrollLeft=n.x-E/2;O[0].scrollTop=n.y-H/2}if(curConfig.showRulers){E=Y;J=J;document.getElementById("workarea");document.getElementById("title_show");J||(J=g.getZoom());E||(E=a("#svgcanvas"));H=g.getContentElem();O=svgedit.units.getTypeMap()[curConfig.baseUnit];for(Y=0;Y<2;Y++){fa=(da=Y===0)?"x":"y";ua=da?"width":"height";V=H.getAttribute(fa)-0;fa=a("#ruler_"+fa+" canvas:first");$hcanv=fa.clone(); O.width()){K[0].scrollLeft=qa.x-10;K[0].scrollTop=qa.y-10}else{O[0].scrollLeft=o;O[0].scrollTop=w}else{O[0].scrollLeft=n.x-E/2;O[0].scrollTop=n.y-I/2}if(curConfig.showRulers){E=Y;J=J;document.getElementById("workarea");document.getElementById("title_show");J||(J=g.getZoom());E||(E=a("#svgcanvas"));I=g.getContentElem();O=svgedit.units.getTypeMap()[curConfig.baseUnit];for(Y=0;Y<2;Y++){fa=(da=Y===0)?"x":"y";ua=da?"width":"height";V=I.getAttribute(fa)-0;fa=a("#ruler_"+fa+" canvas:first");$hcanv=fa.clone();
fa.replaceWith($hcanv);o=$hcanv[0];ha=fa=E[ua]()*2;o.parentNode.style[ua]=ha+"px";W=0;var za;qa=o.getContext("2d");qa.fillStyle="rgb(200,0,0)";qa.fillRect(0,0,o.width,o.height);$hcanv.siblings().remove();if(fa>=3E4){var Ba=parseInt(fa/3E4)+1;za=Array(Ba);za[0]=qa;for(w=1;w<Ba;w++){o[ua]=3E4;var Pa=o.cloneNode(true);o.parentNode.appendChild(Pa);za[w]=Pa.getContext("2d")}Pa[ua]=fa%3E4;fa=3E4}o[ua]=fa;ua=O*J;var Qa=50/ua;o=1;for(w=0;w<D.length;w++){o=Ba=D[w];if(Qa<=Ba)break}Qa=o*ua;qa.font="normal 9px 'Lucida Grande', sans-serif"; fa.replaceWith($hcanv);o=$hcanv[0];ha=fa=E[ua]()*2;o.parentNode.style[ua]=ha+"px";W=0;var za;qa=o.getContext("2d");qa.fillStyle="rgb(200,0,0)";qa.fillRect(0,0,o.width,o.height);$hcanv.siblings().remove();if(fa>=3E4){var Ba=parseInt(fa/3E4)+1;za=Array(Ba);za[0]=qa;for(w=1;w<Ba;w++){o[ua]=3E4;var Pa=o.cloneNode(true);o.parentNode.appendChild(Pa);za[w]=Pa.getContext("2d")}Pa[ua]=fa%3E4;fa=3E4}o[ua]=fa;ua=O*J;var Qa=50/ua;o=1;for(w=0;w<D.length;w++){o=Ba=D[w];if(Qa<=Ba)break}Qa=o*ua;qa.font="normal 9px 'Lucida Grande', sans-serif";
qa.fillStyle="#777";for(var Na=V/ua%o*ua,jb=Na-Qa;Na<ha;Na+=Qa){jb+=Qa;w=Math.round(Na)+0.5;if(da){qa.moveTo(w,15);qa.lineTo(w,0)}else{qa.moveTo(15,w);qa.lineTo(0,w)}Ba=(jb-V)/ua;if(o>=1)w=Math.round(Ba);else{w=(o+"").split(".")[1].length;w=Ba.toFixed(w)-0}if(w!==0&&w!==1E3&&w%1E3===0)w=w/1E3+"K";if(da){qa.fillText(w,Na+2,8);qa.fillStyle="#777"}else{Ba=(w+"").split("");for(w=0;w<Ba.length;w++){qa.fillText(Ba[w],1,Na+9+w*9);qa.fillStyle="#777"}}Ba=Qa/10;for(w=1;w<10;w++){var ub=Math.round(Na+Ba*w)+ qa.fillStyle="#777";for(var Na=V/ua%o*ua,jb=Na-Qa;Na<ha;Na+=Qa){jb+=Qa;w=Math.round(Na)+0.5;if(da){qa.moveTo(w,15);qa.lineTo(w,0)}else{qa.moveTo(15,w);qa.lineTo(0,w)}Ba=(jb-V)/ua;if(o>=1)w=Math.round(Ba);else{w=(o+"").split(".")[1].length;w=Ba.toFixed(w)-0}if(w!==0&&w!==1E3&&w%1E3===0)w=w/1E3+"K";if(da){qa.fillText(w,Na+2,8);qa.fillStyle="#777"}else{Ba=(w+"").split("");for(w=0;w<Ba.length;w++){qa.fillText(Ba[w],1,Na+9+w*9);qa.fillStyle="#777"}}Ba=Qa/10;for(w=1;w<10;w++){var ub=Math.round(Na+Ba*w)+
0.5;if(za&&ub>fa){W++;qa.stroke();if(W>=za.length){w=10;Na=ha;continue}qa=za[W];Na-=3E4;ub=Math.round(Na+Ba*w)+0.5}var Cb=w%2?12:10;if(da){qa.moveTo(ub,15);qa.lineTo(ub,Cb)}else{qa.moveTo(15,ub);qa.lineTo(Cb,ub)}}}qa.strokeStyle="#666";qa.stroke()}K.scroll()}},D=[];for(c=0.1;c<1E5;c*=10){D.push(1*c);D.push(2*c);D.push(5*c)}G(true);try{var z=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var n=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k== 0.5;if(za&&ub>fa){W++;qa.stroke();if(W>=za.length){w=10;Na=ha;continue}qa=za[W];Na-=3E4;ub=Math.round(Na+Ba*w)+0.5}var Cb=w%2?12:10;if(da){qa.moveTo(ub,15);qa.lineTo(ub,Cb)}else{qa.moveTo(15,ub);qa.lineTo(Cb,ub)}}}qa.strokeStyle="#666";qa.stroke()}K.scroll()}},D=[];for(c=0.1;c<1E5;c*=10){D.push(1*c);D.push(2*c);D.push(5*c)}G(true);try{var z=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var n=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k==
"string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(E){return"\\u"+("0000"+E.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var o=0;o<k.length;o++)k[o]=n(k[o]);return"["+k.join(",")+"]"}else{o=[];for(var w in k)o.push(n(w)+":"+n(k[w]));return"{"+o.join(",")+"}"}};window.addEventListener("message",function(k){var n=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+ "string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(E){return"\\u"+("0000"+E.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var o=0;o<k.length;o++)k[o]=n(k[o]);return"["+k.join(",")+"]"}else{o=[];for(var w in k)o.push(n(w)+":"+n(k[w]));return"{"+o.join(",")+"}"}};window.addEventListener("message",function(k){var n=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+
n+";"+z(eval(k.data)),"*")}catch(o){k.source.postMessage("SVGe"+n+";error:"+o.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=g;g.ready=svgEditor.ready});b.setLang=function(k,n){a.pref("lang",k);a("#lang_select").val(k);if(n){g.runExtensions("langChanged",k);ma();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(o, n+";"+z(eval(k.data)),"*")}catch(o){k.source.postMessage("SVGe"+n+";error:"+o.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=g;g.ready=svgEditor.ready});b.setLang=function(k,n){a.pref("lang",k);a("#lang_select").val(k);if(n){g.runExtensions("langChanged",k);ma();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(o,
w){a(w).attr("title",a(o)[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(c){p?c():f.push(c)};b.runCallbacks=function(){a.each(f,function(){this()});p=true};b.loadFromString=function(c){b.ready(function(){q(c)})};b.loadFromURL=function(c,m){m||(m={});var u=m.cache,C=m.callback;b.ready(function(){a.ajax({url:c,dataType:"text",cache:!!u,success:function(s){q(s,C)},error:function(s,L,R){s.status!= w){a(w).attr("title",a(o)[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(c){p?c():f.push(c)};b.runCallbacks=function(){a.each(f,function(){this()});p=true};b.loadFromString=function(c){b.ready(function(){q(c)})};b.loadFromURL=function(c,m){m||(m={});var u=m.cache,C=m.callback;b.ready(function(){a.ajax({url:c,dataType:"text",cache:!!u,success:function(s){q(s,C)},error:function(s,L,Q){s.status!=
404&&s.responseText?q(s.responseText,C):a.alert(uiStrings.notification.URLloadFail+": \n"+R+"",C)}})})};b.loadFromDataURI=function(c){b.ready(function(){var m=c.substring(26);q(svgedit.utilities.decode64(m))})};b.addExtension=function(){var c=arguments;a(function(){g&&g.addExtension.apply(this,c)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep= 404&&s.responseText?q(s.responseText,C):a.alert(uiStrings.notification.URLloadFail+": \n"+Q+"",C)}})})};b.loadFromDataURI=function(c){b.ready(function(){var m=c.substring(26);q(svgedit.utilities.decode64(m))})};b.addExtension=function(){var c=arguments;a(function(){g&&g.addExtension.apply(this,c)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var q=this.dragCfg.dragAdjust,g=$(this).parent(),b=$(this),p=this.dragCfg.height,v=this.dragCfg.min,d=this.dragCfg.max,f=this.dragCfg.step,c=d-v>0?(d-v)/f:200,m=c/p*f,u=0,C=this.getAttribute("data-attr"),s=svgEditor.canvas,L=s.getSelectedElems(),R=svgedit.browser.isTouch(),K=true,I=c&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(g):false;b.attr("readonly","readonly");I&&!isNaN(this.dragCfg.start)&&I.css("top",this.dragCfg.start* a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var q=this.dragCfg.dragAdjust,g=$(this).parent(),b=$(this),p=this.dragCfg.height,v=this.dragCfg.min,d=this.dragCfg.max,f=this.dragCfg.step,c=d-v>0?(d-v)/f:200,m=c/p*f,u=0,C=this.getAttribute("data-attr"),s=svgEditor.canvas,L=svgedit.browser.isTouch(),Q=true,K=c&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(g):false;b.attr("readonly","readonly");K&&!isNaN(this.dragCfg.start)&&K.css("top",this.dragCfg.start*-1/m+p);this.adjustValue=
-1/m+p);this.adjustValue=function(Q,S){var N;Q=parseFloat(Q);if(isNaN(this.value))N=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){N=this.dragCfg.stepfunc(this,Q);console.log(N)}else N=Number((Number(this.value)+Number(Q)).toFixed(5));if(d!==null)N=Math.min(N,d);if(v!==null)N=Math.max(N,v);I&&this.updateCursor(N);this.value=N;g.attr("data-value",N);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,S)};g.toggleClass("draginput",g.is("label"));this.move=function(Q,S,N){if(R)Q= function(H,S){var R;H=parseFloat(H);R=isNaN(this.value)?this.dragCfg.reset:$.isFunction(this.dragCfg.stepfunc)?this.dragCfg.stepfunc(this,H):Number((Number(this.value)+Number(H)).toFixed(5));if(d!==null)R=Math.min(R,d);if(v!==null)R=Math.max(R,v);K&&this.updateCursor(R);this.value=R;g.attr("data-value",R);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,S)};g.toggleClass("draginput",g.is("label"));this.move=function(H,S,R){if(L)H=H.originalEvent.touches[0];if(u===0)u=S;S=(H.pageY-u)*
Q.originalEvent.touches[0];if(u===0)u=S;S=(Q.pageY-u)*-1;u=Q.pageY;N=S*m*q;this.adjustValue(N.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");g.removeClass("active");K=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");u=0;if(L[0]){var Q=s.undoMgr.finishUndoableChange();Q.isEmpty()||s.undoMgr.addCommandToHistory(Q)}this.adjustValue(0,K)};this.updateCursor=function(){var Q=parseFloat(this.value)*-1/m+p;I.css("top",Q)};this.start= -1;u=H.pageY;R=S*m*q;this.adjustValue(R.toFixed(f<1?1:0))};this.stop=function(){var H=s.getSelectedElems();$("body").removeClass("dragging");g.removeClass("active");Q=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");u=0;if(H[0]){H=s.undoMgr.finishUndoableChange();H.isEmpty()||s.undoMgr.addCommandToHistory(H)}this.adjustValue(0,Q)};this.updateCursor=function(){var H=parseFloat(this.value)*-1/m+p;K.css("top",H)};this.start=function(H){var S=s.getSelectedElems();
function(Q){if(R)Q=Q.originalEvent.touches[0];var S=Q.pageY,N=this.value,ga=this;s.undoMgr.beginUndoableChange(C,L);$("body").addClass("dragging");g.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(na){ga.move(na,S,parseFloat(N))});$(window).bind("mouseup.draginput touchend.draginput",function(){ga.stop()})};$(this).attr("readonly","readonly").attr("data-scale",m).attr("data-domain",p).attr("data-cursor",I!=false).bind("mousedown touchstart",function(Q){this.blur(); if(L)H=H.originalEvent.touches[0];var R=H.pageY,N=this.value,ga=this;s.undoMgr.beginUndoableChange(C,S);$("body").addClass("dragging");g.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(oa){ga.move(oa,R,parseFloat(N))});$(window).bind("mouseup.draginput touchend.draginput",function(){ga.stop()})};$(this).attr("readonly","readonly").attr("data-scale",m).attr("data-domain",p).attr("data-cursor",K!=false).bind("mousedown touchstart",function(H){this.blur();this.start(H)}).bind("dblclick taphold",
this.start(Q)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(Q){switch(Q.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(Q,S,N,ga){K&&s.undoMgr.beginUndoableChange(C,L);K=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){na.stop()}, function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(H){switch(H.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(H,S,R,N){S=s.getSelectedElems();Q&&s.undoMgr.beginUndoableChange(C,S);Q=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){ga.stop()},500);var ga=
1E3);var na=this;if(ga>0)this.adjustValue(this.dragCfg.step);else ga<0&&this.adjustValue(-this.dragCfg.step);Q.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),g=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/g+b+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=q};svgedit=svgedit||{}; this;if(N>0)this.adjustValue(this.dragCfg.step);else N<0&&this.adjustValue(-this.dragCfg.step);H.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),g=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/g+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 g=q.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+q.id+"'>"+q.label+"<span class='shortcut'>"+g+"</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 g=q.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+q.id+"'>"+q.label+"<span class='shortcut'>"+g+"</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 g(p){return!a(p).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function b(p,v){var d=p.nodeName.toLowerCase();if("area"===d){d=p.parentNode;var f=d.name;if(!p.href||!f||d.nodeName.toLowerCase()!=="map")return false;d=a("img[usemap=#"+f+"]")[0];return!!d&&g(d)}return(/input|select|textarea|button|object/.test(d)?!p.disabled:"a"==d?p.href||v:v)&&g(p)}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 g(p){return!a(p).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function b(p,v){var d=p.nodeName.toLowerCase();if("area"===d){d=p.parentNode;var f=d.name;if(!p.href||!f||d.nodeName.toLowerCase()!=="map")return false;d=a("img[usemap=#"+f+"]")[0];return!!d&&g(d)}return(/input|select|textarea|button|object/.test(d)?!p.disabled:"a"==d?p.href||v:v)&&g(p)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",
@ -561,10 +561,10 @@ b.css("opacity"));b.css("opacity",p.opacity)},stop:function(q,g){var b=a(this).d
b.axis!="x")g.overflowOffset.top+g.scrollParent[0].offsetHeight-q.pageY<b.scrollSensitivity?g.scrollParent[0].scrollTop=p=g.scrollParent[0].scrollTop+b.scrollSpeed:q.pageY-g.overflowOffset.top<b.scrollSensitivity&&(g.scrollParent[0].scrollTop=p=g.scrollParent[0].scrollTop-b.scrollSpeed);if(!b.axis||b.axis!="y")g.overflowOffset.left+g.scrollParent[0].offsetWidth-q.pageX<b.scrollSensitivity?g.scrollParent[0].scrollLeft=p=g.scrollParent[0].scrollLeft+b.scrollSpeed:q.pageX-g.overflowOffset.left<b.scrollSensitivity&& b.axis!="x")g.overflowOffset.top+g.scrollParent[0].offsetHeight-q.pageY<b.scrollSensitivity?g.scrollParent[0].scrollTop=p=g.scrollParent[0].scrollTop+b.scrollSpeed:q.pageY-g.overflowOffset.top<b.scrollSensitivity&&(g.scrollParent[0].scrollTop=p=g.scrollParent[0].scrollTop-b.scrollSpeed);if(!b.axis||b.axis!="y")g.overflowOffset.left+g.scrollParent[0].offsetWidth-q.pageX<b.scrollSensitivity?g.scrollParent[0].scrollLeft=p=g.scrollParent[0].scrollLeft+b.scrollSpeed:q.pageX-g.overflowOffset.left<b.scrollSensitivity&&
(g.scrollParent[0].scrollLeft=p=g.scrollParent[0].scrollLeft-b.scrollSpeed)}else{if(!b.axis||b.axis!="x")q.pageY-a(document).scrollTop()<b.scrollSensitivity?p=a(document).scrollTop(a(document).scrollTop()-b.scrollSpeed):a(window).height()-(q.pageY-a(document).scrollTop())<b.scrollSensitivity&&(p=a(document).scrollTop(a(document).scrollTop()+b.scrollSpeed));if(!b.axis||b.axis!="y")q.pageX-a(document).scrollLeft()<b.scrollSensitivity?p=a(document).scrollLeft(a(document).scrollLeft()-b.scrollSpeed): (g.scrollParent[0].scrollLeft=p=g.scrollParent[0].scrollLeft-b.scrollSpeed)}else{if(!b.axis||b.axis!="x")q.pageY-a(document).scrollTop()<b.scrollSensitivity?p=a(document).scrollTop(a(document).scrollTop()-b.scrollSpeed):a(window).height()-(q.pageY-a(document).scrollTop())<b.scrollSensitivity&&(p=a(document).scrollTop(a(document).scrollTop()+b.scrollSpeed));if(!b.axis||b.axis!="y")q.pageX-a(document).scrollLeft()<b.scrollSensitivity?p=a(document).scrollLeft(a(document).scrollLeft()-b.scrollSpeed):
a(window).width()-(q.pageX-a(document).scrollLeft())<b.scrollSensitivity&&(p=a(document).scrollLeft(a(document).scrollLeft()+b.scrollSpeed))}p!==false&&a.ui.ddmanager&&!b.dropBehaviour&&a.ui.ddmanager.prepareOffsets(g,q)}});a.ui.plugin.add("draggable","snap",{start:function(){var q=a(this).data("draggable"),g=q.options;q.snapElements=[];a(g.snap.constructor!=String?g.snap.items||":data(draggable)":g.snap).each(function(){var b=a(this),p=b.offset();this!=q.element[0]&&q.snapElements.push({item:this, a(window).width()-(q.pageX-a(document).scrollLeft())<b.scrollSensitivity&&(p=a(document).scrollLeft(a(document).scrollLeft()+b.scrollSpeed))}p!==false&&a.ui.ddmanager&&!b.dropBehaviour&&a.ui.ddmanager.prepareOffsets(g,q)}});a.ui.plugin.add("draggable","snap",{start:function(){var q=a(this).data("draggable"),g=q.options;q.snapElements=[];a(g.snap.constructor!=String?g.snap.items||":data(draggable)":g.snap).each(function(){var b=a(this),p=b.offset();this!=q.element[0]&&q.snapElements.push({item:this,
width:b.outerWidth(),height:b.outerHeight(),top:p.top,left:p.left})})},drag:function(q,g){for(var b=a(this).data("draggable"),p=b.options,v=p.snapTolerance,d=g.offset.left,f=d+b.helperProportions.width,c=g.offset.top,m=c+b.helperProportions.height,u=b.snapElements.length-1;u>=0;u--){var C=b.snapElements[u].left,s=C+b.snapElements[u].width,L=b.snapElements[u].top,R=L+b.snapElements[u].height;if(C-v<d&&d<s+v&&L-v<c&&c<R+v||C-v<d&&d<s+v&&L-v<m&&m<R+v||C-v<f&&f<s+v&&L-v<c&&c<R+v||C-v<f&&f<s+v&&L-v<m&& width:b.outerWidth(),height:b.outerHeight(),top:p.top,left:p.left})})},drag:function(q,g){for(var b=a(this).data("draggable"),p=b.options,v=p.snapTolerance,d=g.offset.left,f=d+b.helperProportions.width,c=g.offset.top,m=c+b.helperProportions.height,u=b.snapElements.length-1;u>=0;u--){var C=b.snapElements[u].left,s=C+b.snapElements[u].width,L=b.snapElements[u].top,Q=L+b.snapElements[u].height;if(C-v<d&&d<s+v&&L-v<c&&c<Q+v||C-v<d&&d<s+v&&L-v<m&&m<Q+v||C-v<f&&f<s+v&&L-v<c&&c<Q+v||C-v<f&&f<s+v&&L-v<m&&
m<R+v){if(p.snapMode!="inner"){var K=Math.abs(L-m)<=v,I=Math.abs(R-c)<=v,Q=Math.abs(C-f)<=v,S=Math.abs(s-d)<=v;K&&(g.position.top=b._convertPositionTo("relative",{top:L-b.helperProportions.height,left:0}).top-b.margins.top);I&&(g.position.top=b._convertPositionTo("relative",{top:R,left:0}).top-b.margins.top);Q&&(g.position.left=b._convertPositionTo("relative",{top:0,left:C-b.helperProportions.width}).left-b.margins.left);S&&(g.position.left=b._convertPositionTo("relative",{top:0,left:s}).left-b.margins.left)}var N= m<Q+v){if(p.snapMode!="inner"){var K=Math.abs(L-m)<=v,H=Math.abs(Q-c)<=v,S=Math.abs(C-f)<=v,R=Math.abs(s-d)<=v;K&&(g.position.top=b._convertPositionTo("relative",{top:L-b.helperProportions.height,left:0}).top-b.margins.top);H&&(g.position.top=b._convertPositionTo("relative",{top:Q,left:0}).top-b.margins.top);S&&(g.position.left=b._convertPositionTo("relative",{top:0,left:C-b.helperProportions.width}).left-b.margins.left);R&&(g.position.left=b._convertPositionTo("relative",{top:0,left:s}).left-b.margins.left)}var N=
K||I||Q||S;if(p.snapMode!="outer"){K=Math.abs(L-c)<=v;I=Math.abs(R-m)<=v;Q=Math.abs(C-d)<=v;S=Math.abs(s-f)<=v;K&&(g.position.top=b._convertPositionTo("relative",{top:L,left:0}).top-b.margins.top);I&&(g.position.top=b._convertPositionTo("relative",{top:R-b.helperProportions.height,left:0}).top-b.margins.top);Q&&(g.position.left=b._convertPositionTo("relative",{top:0,left:C}).left-b.margins.left);S&&(g.position.left=b._convertPositionTo("relative",{top:0,left:s-b.helperProportions.width}).left-b.margins.left)}!b.snapElements[u].snapping&& K||H||S||R;if(p.snapMode!="outer"){K=Math.abs(L-c)<=v;H=Math.abs(Q-m)<=v;S=Math.abs(C-d)<=v;R=Math.abs(s-f)<=v;K&&(g.position.top=b._convertPositionTo("relative",{top:L,left:0}).top-b.margins.top);H&&(g.position.top=b._convertPositionTo("relative",{top:Q-b.helperProportions.height,left:0}).top-b.margins.top);S&&(g.position.left=b._convertPositionTo("relative",{top:0,left:C}).left-b.margins.left);R&&(g.position.left=b._convertPositionTo("relative",{top:0,left:s-b.helperProportions.width}).left-b.margins.left)}!b.snapElements[u].snapping&&
(K||I||Q||S||N)&&b.options.snap.snap&&b.options.snap.snap.call(b.element,q,a.extend(b._uiHash(),{snapItem:b.snapElements[u].item}));b.snapElements[u].snapping=K||I||Q||S||N}else{b.snapElements[u].snapping&&b.options.snap.release&&b.options.snap.release.call(b.element,q,a.extend(b._uiHash(),{snapItem:b.snapElements[u].item}));b.snapElements[u].snapping=false}}}});a.ui.plugin.add("draggable","stack",{start:function(){var q=a(this).data("draggable").options;q=a.makeArray(a(q.stack)).sort(function(b, (K||H||S||R||N)&&b.options.snap.snap&&b.options.snap.snap.call(b.element,q,a.extend(b._uiHash(),{snapItem:b.snapElements[u].item}));b.snapElements[u].snapping=K||H||S||R||N}else{b.snapElements[u].snapping&&b.options.snap.release&&b.options.snap.release.call(b.element,q,a.extend(b._uiHash(),{snapItem:b.snapElements[u].item}));b.snapElements[u].snapping=false}}}});a.ui.plugin.add("draggable","stack",{start:function(){var q=a(this).data("draggable").options;q=a.makeArray(a(q.stack)).sort(function(b,
p){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(p).css("zIndex"),10)||0)});if(q.length){var g=parseInt(q[0].style.zIndex)||0;a(q).each(function(b){this.style.zIndex=g+b});this[0].style.zIndex=g+q.length}}});a.ui.plugin.add("draggable","zIndex",{start:function(q,g){var b=a(g.helper),p=a(this).data("draggable").options;b.css("zIndex")&&(p._zIndex=b.css("zIndex"));b.css("zIndex",p.zIndex)},stop:function(q,g){var b=a(this).data("draggable").options;b._zIndex&&a(g.helper).css("zIndex",b._zIndex)}})})(jQuery); p){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(p).css("zIndex"),10)||0)});if(q.length){var g=parseInt(q[0].style.zIndex)||0;a(q).each(function(b){this.style.zIndex=g+b});this[0].style.zIndex=g+q.length}}});a.ui.plugin.add("draggable","zIndex",{start:function(q,g){var b=a(g.helper),p=a(this).data("draggable").options;b.css("zIndex")&&(p._zIndex=b.css("zIndex"));b.css("zIndex",p.zIndex)},stop:function(q,g){var b=a(this).data("draggable").options;b._zIndex&&a(g.helper).css("zIndex",b._zIndex)}})})(jQuery);
(function(a){a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var q=this,g=this.options,b=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),p=g.values&&g.values.length||1,v=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+ (function(a){a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var q=this,g=this.options,b=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),p=g.values&&g.values.length||1,v=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
this.orientation+" ui-widget ui-widget-content ui-corner-all"+(g.disabled?" ui-slider-disabled ui-disabled":""));this.range=a([]);g.range&&(g.range===true&&(g.values||(g.values=[this._valueMin(),this._valueMin()]),g.values.length&&g.values.length!==2&&(g.values=[g.values[0],g.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(g.range==="min"||g.range==="max"?" ui-slider-range-"+g.range:"")));for(var d=b.length;d<p;d+=1)v.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>"); this.orientation+" ui-widget ui-widget-content ui-corner-all"+(g.disabled?" ui-slider-disabled ui-disabled":""));this.range=a([]);g.range&&(g.range===true&&(g.values||(g.values=[this._valueMin(),this._valueMin()]),g.values.length&&g.values.length!==2&&(g.values=[g.values[0],g.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(g.range==="min"||g.range==="max"?" ui-slider-range-"+g.range:"")));for(var d=b.length;d<p;d+=1)v.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
@ -584,47 +584,47 @@ this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui
return g=this._trimAlignValue(g)}g=this.options.values.slice();for(b=0;b<g.length;b+=1)g[b]=this._trimAlignValue(g[b]);return g},_trimAlignValue:function(q){if(q<=this._valueMin())return this._valueMin();if(q>=this._valueMax())return this._valueMax();var g=this.options.step>0?this.options.step:1,b=(q-this._valueMin())%g;q=q-b;Math.abs(b)*2>=g&&(q+=b>0?g:-g);return parseFloat(q.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var q= return g=this._trimAlignValue(g)}g=this.options.values.slice();for(b=0;b<g.length;b+=1)g[b]=this._trimAlignValue(g[b]);return g},_trimAlignValue:function(q){if(q<=this._valueMin())return this._valueMin();if(q>=this._valueMax())return this._valueMax();var g=this.options.step>0?this.options.step:1,b=(q-this._valueMin())%g;q=q-b;Math.abs(b)*2>=g&&(q+=b>0?g:-g);return parseFloat(q.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var q=
this.options.range,g=this.options,b=this,p=this._animateOff?false:g.animate,v,d={},f,c,m,u;this.options.values&&this.options.values.length?this.handles.each(function(C){v=(b.values(C)-b._valueMin())/(b._valueMax()-b._valueMin())*100;d[b.orientation==="horizontal"?"left":"bottom"]=v+"%";a(this).stop(1,1)[p?"animate":"css"](d,g.animate);b.options.range===true&&(b.orientation==="horizontal"?(C===0&&b.range.stop(1,1)[p?"animate":"css"]({left:v+"%"},g.animate),C===1&&b.range[p?"animate":"css"]({width:v- this.options.range,g=this.options,b=this,p=this._animateOff?false:g.animate,v,d={},f,c,m,u;this.options.values&&this.options.values.length?this.handles.each(function(C){v=(b.values(C)-b._valueMin())/(b._valueMax()-b._valueMin())*100;d[b.orientation==="horizontal"?"left":"bottom"]=v+"%";a(this).stop(1,1)[p?"animate":"css"](d,g.animate);b.options.range===true&&(b.orientation==="horizontal"?(C===0&&b.range.stop(1,1)[p?"animate":"css"]({left:v+"%"},g.animate),C===1&&b.range[p?"animate":"css"]({width:v-
f+"%"},{queue:false,duration:g.animate})):(C===0&&b.range.stop(1,1)[p?"animate":"css"]({bottom:v+"%"},g.animate),C===1&&b.range[p?"animate":"css"]({height:v-f+"%"},{queue:false,duration:g.animate})));f=v}):(c=this.value(),m=this._valueMin(),u=this._valueMax(),v=u!==m?(c-m)/(u-m)*100:0,d[b.orientation==="horizontal"?"left":"bottom"]=v+"%",this.handle.stop(1,1)[p?"animate":"css"](d,g.animate),q==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[p?"animate":"css"]({width:v+"%"},g.animate), f+"%"},{queue:false,duration:g.animate})):(C===0&&b.range.stop(1,1)[p?"animate":"css"]({bottom:v+"%"},g.animate),C===1&&b.range[p?"animate":"css"]({height:v-f+"%"},{queue:false,duration:g.animate})));f=v}):(c=this.value(),m=this._valueMin(),u=this._valueMax(),v=u!==m?(c-m)/(u-m)*100:0,d[b.orientation==="horizontal"?"left":"bottom"]=v+"%",this.handle.stop(1,1)[p?"animate":"css"](d,g.animate),q==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[p?"animate":"css"]({width:v+"%"},g.animate),
q==="max"&&this.orientation==="horizontal"&&this.range[p?"animate":"css"]({width:100-v+"%"},{queue:false,duration:g.animate}),q==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[p?"animate":"css"]({height:v+"%"},g.animate),q==="max"&&this.orientation==="vertical"&&this.range[p?"animate":"css"]({height:100-v+"%"},{queue:false,duration:g.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(d,f){if(f===undefined)f=0;return Math.round(d*Math.pow(10,f))/Math.pow(10,f)};var q=function(d,f){var c=this,m=d.find("img:first"),u=0,C=100,s=100,L=0,R=100,K=100,I=0,Q=0,S,N,ga=[],na=function(T){for(var Z=0;Z<ga.length;Z++)ga[Z].call(c,c,T)},X=function(T){var Z=d.offset();S={l:Z.left|0,t:Z.top|0};clearTimeout(N);N=setTimeout(function(){Aa.call(c,T)},0);a(document).bind("mousemove",U).bind("mouseup",ea);T.preventDefault()},U=function(T){clearTimeout(N);N=setTimeout(function(){Aa.call(c, q==="max"&&this.orientation==="horizontal"&&this.range[p?"animate":"css"]({width:100-v+"%"},{queue:false,duration:g.animate}),q==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[p?"animate":"css"]({height:v+"%"},g.animate),q==="max"&&this.orientation==="vertical"&&this.range[p?"animate":"css"]({height:100-v+"%"},{queue:false,duration:g.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(d,f){if(f===undefined)f=0;return Math.round(d*Math.pow(10,f))/Math.pow(10,f)};var q=function(d,f){var c=this,m=d.find("img:first"),u=0,C=100,s=100,L=0,Q=100,K=100,H=0,S=0,R,N,ga=[],oa=function(T){for(var Z=0;Z<ga.length;Z++)ga[Z].call(c,c,T)},X=function(T){var Z=d.offset();R={l:Z.left|0,t:Z.top|0};clearTimeout(N);N=setTimeout(function(){Aa.call(c,T)},0);a(document).bind("mousemove",U).bind("mouseup",ea);T.preventDefault()},U=function(T){clearTimeout(N);N=setTimeout(function(){Aa.call(c,
T)},0);T.stopPropagation();T.preventDefault();return false},ea=function(T){a(document).unbind("mouseup",ea).unbind("mousemove",U);T.stopPropagation();T.preventDefault();return false},Aa=function(T){var Z=T.pageX-S.l;T=T.pageY-S.t;var oa=d.w,pa=d.h;if(Z<0)Z=0;else if(Z>oa)Z=oa;if(T<0)T=0;else if(T>pa)T=pa;ja.call(c,"xy",{x:Z/oa*s+u,y:T/pa*K+L})},ja=function(T,Z,oa){if(Z===undefined){if(T===undefined||T==null)T="xy";switch(T.toLowerCase()){case "x":return I;case "y":return Q;default:return{x:I,y:Q}}}if(!(oa!= T)},0);T.stopPropagation();T.preventDefault();return false},ea=function(T){a(document).unbind("mouseup",ea).unbind("mousemove",U);T.stopPropagation();T.preventDefault();return false},Aa=function(T){var Z=T.pageX-R.l;T=T.pageY-R.t;var na=d.w,pa=d.h;if(Z<0)Z=0;else if(Z>na)Z=na;if(T<0)T=0;else if(T>pa)T=pa;ja.call(c,"xy",{x:Z/na*s+u,y:T/pa*K+L})},ja=function(T,Z,na){if(Z===undefined){if(T===undefined||T==null)T="xy";switch(T.toLowerCase()){case "x":return H;case "y":return S;default:return{x:H,y:S}}}if(!(na!=
null&&oa==c)){var pa=false,ma,la;if(T==null)T="xy";switch(T.toLowerCase()){case "x":ma=Z&&(Z.x&&Z.x|0||Z|0)||0;break;case "y":la=Z&&(Z.y&&Z.y|0||Z|0)||0;break;default:ma=Z&&Z.x&&Z.x|0||0;la=Z&&Z.y&&Z.y|0||0}if(ma!=null){if(ma<u)ma=u;else if(ma>C)ma=C;if(I!=ma){I=ma;pa=true}}if(la!=null){if(la<L)la=L;else if(la>R)la=R;if(Q!=la){Q=la;pa=true}}pa&&na.call(c,oa||c)}},ba=function(T){a.isFunction(T)&&ga.push(T)};a.extend(true,c,{val:ja,range:function(T,Z){if(Z===undefined){if(T===undefined||T==null)T="all"; null&&na==c)){var pa=false,ma,la;if(T==null)T="xy";switch(T.toLowerCase()){case "x":ma=Z&&(Z.x&&Z.x|0||Z|0)||0;break;case "y":la=Z&&(Z.y&&Z.y|0||Z|0)||0;break;default:ma=Z&&Z.x&&Z.x|0||0;la=Z&&Z.y&&Z.y|0||0}if(ma!=null){if(ma<u)ma=u;else if(ma>C)ma=C;if(H!=ma){H=ma;pa=true}}if(la!=null){if(la<L)la=L;else if(la>Q)la=Q;if(S!=la){S=la;pa=true}}pa&&oa.call(c,na||c)}},ba=function(T){a.isFunction(T)&&ga.push(T)};a.extend(true,c,{val:ja,range:function(T,Z){if(Z===undefined){if(T===undefined||T==null)T="all";
switch(T.toLowerCase()){case "minx":return u;case "maxx":return C;case "rangex":return{minX:u,maxX:C,rangeX:s};case "miny":return L;case "maxy":return R;case "rangey":return{minY:L,maxY:R,rangeY:K};default:return{minX:u,maxX:C,rangeX:s,minY:L,maxY:R,rangeY:K}}}var oa,pa,ma,la;if(T==null)T="all";switch(T.toLowerCase()){case "minx":oa=Z&&(Z.minX&&Z.minX|0||Z|0)||0;break;case "maxx":pa=Z&&(Z.maxX&&Z.maxX|0||Z|0)||0;break;case "rangex":oa=Z&&Z.minX&&Z.minX|0||0;pa=Z&&Z.maxX&&Z.maxX|0||0;break;case "miny":ma= switch(T.toLowerCase()){case "minx":return u;case "maxx":return C;case "rangex":return{minX:u,maxX:C,rangeX:s};case "miny":return L;case "maxy":return Q;case "rangey":return{minY:L,maxY:Q,rangeY:K};default:return{minX:u,maxX:C,rangeX:s,minY:L,maxY:Q,rangeY:K}}}var na,pa,ma,la;if(T==null)T="all";switch(T.toLowerCase()){case "minx":na=Z&&(Z.minX&&Z.minX|0||Z|0)||0;break;case "maxx":pa=Z&&(Z.maxX&&Z.maxX|0||Z|0)||0;break;case "rangex":na=Z&&Z.minX&&Z.minX|0||0;pa=Z&&Z.maxX&&Z.maxX|0||0;break;case "miny":ma=
Z&&(Z.minY&&Z.minY|0||Z|0)||0;break;case "maxy":la=Z&&(Z.maxY&&Z.maxY|0||Z|0)||0;break;case "rangey":ma=Z&&Z.minY&&Z.minY|0||0;la=Z&&Z.maxY&&Z.maxY|0||0;break;default:oa=Z&&Z.minX&&Z.minX|0||0;pa=Z&&Z.maxX&&Z.maxX|0||0;ma=Z&&Z.minY&&Z.minY|0||0;la=Z&&Z.maxY&&Z.maxY|0||0}if(oa!=null&&u!=oa){u=oa;s=C-u}if(pa!=null&&C!=pa){C=pa;s=C-u}if(ma!=null&&L!=ma){L=ma;K=R-L}if(la!=null&&R!=la){R=la;K=R-L}},bind:ba,unbind:function(T){if(a.isFunction(T))for(var Z;(Z=a.inArray(T,ga))!=-1;)ga.splice(Z,1)},destroy:function(){a(document).unbind("mouseup", Z&&(Z.minY&&Z.minY|0||Z|0)||0;break;case "maxy":la=Z&&(Z.maxY&&Z.maxY|0||Z|0)||0;break;case "rangey":ma=Z&&Z.minY&&Z.minY|0||0;la=Z&&Z.maxY&&Z.maxY|0||0;break;default:na=Z&&Z.minX&&Z.minX|0||0;pa=Z&&Z.maxX&&Z.maxX|0||0;ma=Z&&Z.minY&&Z.minY|0||0;la=Z&&Z.maxY&&Z.maxY|0||0}if(na!=null&&u!=na){u=na;s=C-u}if(pa!=null&&C!=pa){C=pa;s=C-u}if(ma!=null&&L!=ma){L=ma;K=Q-L}if(la!=null&&Q!=la){Q=la;K=Q-L}},bind:ba,unbind:function(T){if(a.isFunction(T))for(var Z;(Z=a.inArray(T,ga))!=-1;)ga.splice(Z,1)},destroy:function(){a(document).unbind("mouseup",
ea).unbind("mousemove",U);d.unbind("mousedown",X);ga=m=d=null}});m.src=f.arrow&&f.arrow.image;m.w=f.arrow&&f.arrow.width||m.width();m.h=f.arrow&&f.arrow.height||m.height();d.w=f.map&&f.map.width||d.width();d.h=f.map&&f.map.height||d.height();d.bind("mousedown",X);ba.call(c,function(){var T=0,Z=0,oa=d.w,pa=d.h,ma=m.w,la=m.h;setTimeout(function(){if(s>0)T=I==C?oa:I/s*oa|0;if(K>0)Z=Q==R?pa:Q/K*pa|0;if(ma>=oa)T=(oa>>1)-(ma>>1);else T-=ma>>1;if(la>=pa)Z=(pa>>1)-(la>>1);else Z-=la>>1;m.css({left:T+"px", ea).unbind("mousemove",U);d.unbind("mousedown",X);ga=m=d=null}});m.src=f.arrow&&f.arrow.image;m.w=f.arrow&&f.arrow.width||m.width();m.h=f.arrow&&f.arrow.height||m.height();d.w=f.map&&f.map.width||d.width();d.h=f.map&&f.map.height||d.height();d.bind("mousedown",X);ba.call(c,function(){var T=0,Z=0,na=d.w,pa=d.h,ma=m.w,la=m.h;setTimeout(function(){if(s>0)T=H==C?na:H/s*na|0;if(K>0)Z=S==Q?pa:S/K*pa|0;if(ma>=na)T=(na>>1)-(ma>>1);else T-=ma>>1;if(la>=pa)Z=(pa>>1)-(la>>1);else Z-=la>>1;m.css({left:T+"px",
top:Z+"px"})},0)})},g=function(d,f,c,m){var u=this;d=d.find("td.Text input");var C=d.eq(3),s=d.eq(4),L=d.eq(5),R=d.length>7?d.eq(6):null,K=d.eq(0),I=d.eq(1),Q=d.eq(2),S=d.eq(d.length>7?7:6),N=d.length>7?d.eq(8):null,ga=function(ja){if(!(ja.target.value==""&&ja.target!=S.get(0)&&(c!=null&&ja.target!=c.get(0)||c==null))){if(!U(ja))return ja;switch(ja.target){case C.get(0):switch(ja.keyCode){case 38:C.val(ea.call(u,(C.val()<<0)+1,0,255));f.val("r",C.val(),ja.target);return false;case 40:C.val(ea.call(u, top:Z+"px"})},0)})},g=function(d,f,c,m){var u=this;d=d.find("td.Text input");var C=d.eq(3),s=d.eq(4),L=d.eq(5),Q=d.length>7?d.eq(6):null,K=d.eq(0),H=d.eq(1),S=d.eq(2),R=d.eq(d.length>7?7:6),N=d.length>7?d.eq(8):null,ga=function(ja){if(!(ja.target.value==""&&ja.target!=R.get(0)&&(c!=null&&ja.target!=c.get(0)||c==null))){if(!U(ja))return ja;switch(ja.target){case C.get(0):switch(ja.keyCode){case 38:C.val(ea.call(u,(C.val()<<0)+1,0,255));f.val("r",C.val(),ja.target);return false;case 40:C.val(ea.call(u,
(C.val()<<0)-1,0,255));f.val("r",C.val(),ja.target);return false}break;case s.get(0):switch(ja.keyCode){case 38:s.val(ea.call(u,(s.val()<<0)+1,0,255));f.val("g",s.val(),ja.target);return false;case 40:s.val(ea.call(u,(s.val()<<0)-1,0,255));f.val("g",s.val(),ja.target);return false}break;case L.get(0):switch(ja.keyCode){case 38:L.val(ea.call(u,(L.val()<<0)+1,0,255));f.val("b",L.val(),ja.target);return false;case 40:L.val(ea.call(u,(L.val()<<0)-1,0,255));f.val("b",L.val(),ja.target);return false}break; (C.val()<<0)-1,0,255));f.val("r",C.val(),ja.target);return false}break;case s.get(0):switch(ja.keyCode){case 38:s.val(ea.call(u,(s.val()<<0)+1,0,255));f.val("g",s.val(),ja.target);return false;case 40:s.val(ea.call(u,(s.val()<<0)-1,0,255));f.val("g",s.val(),ja.target);return false}break;case L.get(0):switch(ja.keyCode){case 38:L.val(ea.call(u,(L.val()<<0)+1,0,255));f.val("b",L.val(),ja.target);return false;case 40:L.val(ea.call(u,(L.val()<<0)-1,0,255));f.val("b",L.val(),ja.target);return false}break;
case R&&R.get(0):switch(ja.keyCode){case 38:R.val(ea.call(u,parseFloat(R.val())+1,0,100));f.val("a",Math.precision(R.val()*255/100,m),ja.target);return false;case 40:R.val(ea.call(u,parseFloat(R.val())-1,0,100));f.val("a",Math.precision(R.val()*255/100,m),ja.target);return false}break;case K.get(0):switch(ja.keyCode){case 38:K.val(ea.call(u,(K.val()<<0)+1,0,360));f.val("h",K.val(),ja.target);return false;case 40:K.val(ea.call(u,(K.val()<<0)-1,0,360));f.val("h",K.val(),ja.target);return false}break; case Q&&Q.get(0):switch(ja.keyCode){case 38:Q.val(ea.call(u,parseFloat(Q.val())+1,0,100));f.val("a",Math.precision(Q.val()*255/100,m),ja.target);return false;case 40:Q.val(ea.call(u,parseFloat(Q.val())-1,0,100));f.val("a",Math.precision(Q.val()*255/100,m),ja.target);return false}break;case K.get(0):switch(ja.keyCode){case 38:K.val(ea.call(u,(K.val()<<0)+1,0,360));f.val("h",K.val(),ja.target);return false;case 40:K.val(ea.call(u,(K.val()<<0)-1,0,360));f.val("h",K.val(),ja.target);return false}break;
case I.get(0):switch(ja.keyCode){case 38:I.val(ea.call(u,(I.val()<<0)+1,0,100));f.val("s",I.val(),ja.target);return false;case 40:I.val(ea.call(u,(I.val()<<0)-1,0,100));f.val("s",I.val(),ja.target);return false}break;case Q.get(0):switch(ja.keyCode){case 38:Q.val(ea.call(u,(Q.val()<<0)+1,0,100));f.val("v",Q.val(),ja.target);return false;case 40:Q.val(ea.call(u,(Q.val()<<0)-1,0,100));f.val("v",Q.val(),ja.target);return false}}}},na=function(ja){if(!(ja.target.value==""&&ja.target!=S.get(0)&&(c!=null&& case H.get(0):switch(ja.keyCode){case 38:H.val(ea.call(u,(H.val()<<0)+1,0,100));f.val("s",H.val(),ja.target);return false;case 40:H.val(ea.call(u,(H.val()<<0)-1,0,100));f.val("s",H.val(),ja.target);return false}break;case S.get(0):switch(ja.keyCode){case 38:S.val(ea.call(u,(S.val()<<0)+1,0,100));f.val("v",S.val(),ja.target);return false;case 40:S.val(ea.call(u,(S.val()<<0)-1,0,100));f.val("v",S.val(),ja.target);return false}}}},oa=function(ja){if(!(ja.target.value==""&&ja.target!=R.get(0)&&(c!=null&&
ja.target!=c.get(0)||c==null))){if(!U(ja))return ja;switch(ja.target){case C.get(0):C.val(ea.call(u,C.val(),0,255));f.val("r",C.val(),ja.target);break;case s.get(0):s.val(ea.call(u,s.val(),0,255));f.val("g",s.val(),ja.target);break;case L.get(0):L.val(ea.call(u,L.val(),0,255));f.val("b",L.val(),ja.target);break;case R&&R.get(0):R.val(ea.call(u,R.val(),0,100));f.val("a",Math.precision(R.val()*255/100,m),ja.target);break;case K.get(0):K.val(ea.call(u,K.val(),0,360));f.val("h",K.val(),ja.target);break; ja.target!=c.get(0)||c==null))){if(!U(ja))return ja;switch(ja.target){case C.get(0):C.val(ea.call(u,C.val(),0,255));f.val("r",C.val(),ja.target);break;case s.get(0):s.val(ea.call(u,s.val(),0,255));f.val("g",s.val(),ja.target);break;case L.get(0):L.val(ea.call(u,L.val(),0,255));f.val("b",L.val(),ja.target);break;case Q&&Q.get(0):Q.val(ea.call(u,Q.val(),0,100));f.val("a",Math.precision(Q.val()*255/100,m),ja.target);break;case K.get(0):K.val(ea.call(u,K.val(),0,360));f.val("h",K.val(),ja.target);break;
case I.get(0):I.val(ea.call(u,I.val(),0,100));f.val("s",I.val(),ja.target);break;case Q.get(0):Q.val(ea.call(u,Q.val(),0,100));f.val("v",Q.val(),ja.target);break;case S.get(0):S.val(S.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));c&&c.val(S.val());f.val("hex",S.val()!=""?S.val():null,ja.target);break;case c&&c.get(0):c.val(c.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));S.val(c.val());f.val("hex",c.val()!=""?c.val():null,ja.target);break;case N&&N.get(0):N.val(N.val().replace(/[^a-fA-F0-9]/g, case H.get(0):H.val(ea.call(u,H.val(),0,100));f.val("s",H.val(),ja.target);break;case S.get(0):S.val(ea.call(u,S.val(),0,100));f.val("v",S.val(),ja.target);break;case R.get(0):R.val(R.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));c&&c.val(R.val());f.val("hex",R.val()!=""?R.val():null,ja.target);break;case c&&c.get(0):c.val(c.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));R.val(c.val());f.val("hex",c.val()!=""?c.val():null,ja.target);break;case N&&N.get(0):N.val(N.val().replace(/[^a-fA-F0-9]/g,
"").toLowerCase().substring(0,2));f.val("a",N.val()!=null?parseInt(N.val(),16):null,ja.target)}}},X=function(ja){if(f.val()!=null)switch(ja.target){case C.get(0):C.val(f.val("r"));break;case s.get(0):s.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,m));break;case K.get(0):K.val(f.val("h"));break;case I.get(0):I.val(f.val("s"));break;case Q.get(0):Q.val(f.val("v"));break;case S.get(0):case c&&c.get(0):S.val(f.val("hex"));c&&c.val(f.val("hex")); "").toLowerCase().substring(0,2));f.val("a",N.val()!=null?parseInt(N.val(),16):null,ja.target)}}},X=function(ja){if(f.val()!=null)switch(ja.target){case C.get(0):C.val(f.val("r"));break;case s.get(0):s.val(f.val("g"));break;case L.get(0):L.val(f.val("b"));break;case Q&&Q.get(0):Q.val(Math.precision(f.val("a")*100/255,m));break;case K.get(0):K.val(f.val("h"));break;case H.get(0):H.val(f.val("s"));break;case S.get(0):S.val(f.val("v"));break;case R.get(0):case c&&c.get(0):R.val(f.val("hex"));c&&c.val(f.val("hex"));
break;case N&&N.get(0):N.val(f.val("ahex").substring(6))}},U=function(ja){switch(ja.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ja.ctrlKey)return false}return true},ea=function(ja,ba,T){if(ja==""||isNaN(ja))return ba;if(ja>T)return T;if(ja<ba)return ba;return ja},Aa=function(ja,ba){var T=ja.val("all");if(ba!=C.get(0))C.val(T!=null?T.r:"");if(ba!=s.get(0))s.val(T!=null?T.g:"");if(ba!=L.get(0))L.val(T!=null?T.b:"");if(R&&ba!=R.get(0))R.val(T!= break;case N&&N.get(0):N.val(f.val("ahex").substring(6))}},U=function(ja){switch(ja.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ja.ctrlKey)return false}return true},ea=function(ja,ba,T){if(ja==""||isNaN(ja))return ba;if(ja>T)return T;if(ja<ba)return ba;return ja},Aa=function(ja,ba){var T=ja.val("all");if(ba!=C.get(0))C.val(T!=null?T.r:"");if(ba!=s.get(0))s.val(T!=null?T.g:"");if(ba!=L.get(0))L.val(T!=null?T.b:"");if(Q&&ba!=Q.get(0))Q.val(T!=
null?Math.precision(T.a*100/255,m):"");if(ba!=K.get(0))K.val(T!=null?T.h:"");if(ba!=I.get(0))I.val(T!=null?T.s:"");if(ba!=Q.get(0))Q.val(T!=null?T.v:"");if(ba!=S.get(0)&&(c&&ba!=c.get(0)||!c))S.val(T!=null?T.hex:"");if(c&&ba!=c.get(0)&&ba!=S.get(0))c.val(T!=null?T.hex:"");if(N&&ba!=N.get(0))N.val(T!=null?T.ahex.substring(6):"")};a.extend(true,u,{destroy:function(){C.add(s).add(L).add(R).add(K).add(I).add(Q).add(S).add(c).add(N).unbind("keyup",na).unbind("blur",X);C.add(s).add(L).add(R).add(K).add(I).add(Q).unbind("keydown", null?Math.precision(T.a*100/255,m):"");if(ba!=K.get(0))K.val(T!=null?T.h:"");if(ba!=H.get(0))H.val(T!=null?T.s:"");if(ba!=S.get(0))S.val(T!=null?T.v:"");if(ba!=R.get(0)&&(c&&ba!=c.get(0)||!c))R.val(T!=null?T.hex:"");if(c&&ba!=c.get(0)&&ba!=R.get(0))c.val(T!=null?T.hex:"");if(N&&ba!=N.get(0))N.val(T!=null?T.ahex.substring(6):"")};a.extend(true,u,{destroy:function(){C.add(s).add(L).add(Q).add(K).add(H).add(S).add(R).add(c).add(N).unbind("keyup",oa).unbind("blur",X);C.add(s).add(L).add(Q).add(K).add(H).add(S).unbind("keydown",
ga);f.unbind(Aa);N=S=Q=I=K=R=L=s=C=null}});C.add(s).add(L).add(R).add(K).add(I).add(Q).add(S).add(c).add(N).bind("keyup",na).bind("blur",X);C.add(s).add(L).add(R).add(K).add(I).add(Q).bind("keydown",ga);f.bind(Aa)};a.jPicker={List:[],Color:function(d){var f=this,c,m,u,C,s,L,R,K=[],I=function(S){for(var N=0;N<K.length;N++)K[N].call(f,f,S)},Q=function(S,N,ga){if(N===undefined){if(S===undefined||S==null||S=="")S="all";if(c==null)return null;switch(S.toLowerCase()){case "ahex":return v.rgbaToHex({r:c, ga);f.unbind(Aa);N=R=S=H=K=Q=L=s=C=null}});C.add(s).add(L).add(Q).add(K).add(H).add(S).add(R).add(c).add(N).bind("keyup",oa).bind("blur",X);C.add(s).add(L).add(Q).add(K).add(H).add(S).bind("keydown",ga);f.bind(Aa)};a.jPicker={List:[],Color:function(d){var f=this,c,m,u,C,s,L,Q,K=[],H=function(R){for(var N=0;N<K.length;N++)K[N].call(f,f,R)},S=function(R,N,ga){if(N===undefined){if(R===undefined||R==null||R=="")R="all";if(c==null)return null;switch(R.toLowerCase()){case "ahex":return v.rgbaToHex({r:c,
g:m,b:u,a:C});case "hex":return Q("ahex").substring(0,6);case "all":return{r:c,g:m,b:u,a:C,h:s,s:L,v:R,hex:Q.call(f,"hex"),ahex:Q.call(f,"ahex")};default:N={};for(var na=0;na<S.length;na++)switch(S.charAt(na)){case "r":if(S.length==1)N=c;else N.r=c;break;case "g":if(S.length==1)N=m;else N.g=m;break;case "b":if(S.length==1)N=u;else N.b=u;break;case "a":if(S.length==1)N=C;else N.a=C;break;case "h":if(S.length==1)N=s;else N.h=s;break;case "s":if(S.length==1)N=L;else N.s=L;break;case "v":if(S.length== g:m,b:u,a:C});case "hex":return S("ahex").substring(0,6);case "all":return{r:c,g:m,b:u,a:C,h:s,s:L,v:Q,hex:S.call(f,"hex"),ahex:S.call(f,"ahex")};default:N={};for(var oa=0;oa<R.length;oa++)switch(R.charAt(oa)){case "r":if(R.length==1)N=c;else N.r=c;break;case "g":if(R.length==1)N=m;else N.g=m;break;case "b":if(R.length==1)N=u;else N.b=u;break;case "a":if(R.length==1)N=C;else N.a=C;break;case "h":if(R.length==1)N=s;else N.h=s;break;case "s":if(R.length==1)N=L;else N.s=L;break;case "v":if(R.length==
1)N=R;else N.v=R}return N=={}?Q.call(f,"all"):N}}if(!(ga!=null&&ga==f)){var X=false;if(S==null)S="";if(N==null){if(c!=null){c=null;X=true}if(m!=null){m=null;X=true}if(u!=null){u=null;X=true}if(C!=null){C=null;X=true}if(s!=null){s=null;X=true}if(L!=null){L=null;X=true}if(R!=null){R=null;X=true}X&&I.call(f,ga||f)}else switch(S.toLowerCase()){case "ahex":case "hex":N=v.hexToRgba(N&&(N.ahex||N.hex)||N||"00000000");Q.call(f,"rgba",{r:N.r,g:N.g,b:N.b,a:S=="ahex"?N.a:C!=null?C:255},ga);break;default:if(N&& 1)N=Q;else N.v=Q}return N=={}?S.call(f,"all"):N}}if(!(ga!=null&&ga==f)){var X=false;if(R==null)R="";if(N==null){if(c!=null){c=null;X=true}if(m!=null){m=null;X=true}if(u!=null){u=null;X=true}if(C!=null){C=null;X=true}if(s!=null){s=null;X=true}if(L!=null){L=null;X=true}if(Q!=null){Q=null;X=true}X&&H.call(f,ga||f)}else switch(R.toLowerCase()){case "ahex":case "hex":N=v.hexToRgba(N&&(N.ahex||N.hex)||N||"00000000");S.call(f,"rgba",{r:N.r,g:N.g,b:N.b,a:R=="ahex"?N.a:C!=null?C:255},ga);break;default:if(N&&
(N.ahex!=null||N.hex!=null)){Q.call(f,"ahex",N.ahex||N.hex||"00000000",ga);break}var U={},ea=false,Aa=false;if(N.r!==undefined&&!S.indexOf("r")==-1)S+="r";if(N.g!==undefined&&!S.indexOf("g")==-1)S+="g";if(N.b!==undefined&&!S.indexOf("b")==-1)S+="b";if(N.a!==undefined&&!S.indexOf("a")==-1)S+="a";if(N.h!==undefined&&!S.indexOf("h")==-1)S+="h";if(N.s!==undefined&&!S.indexOf("s")==-1)S+="s";if(N.v!==undefined&&!S.indexOf("v")==-1)S+="v";for(na=0;na<S.length;na++)switch(S.charAt(na)){case "r":if(Aa)continue; (N.ahex!=null||N.hex!=null)){S.call(f,"ahex",N.ahex||N.hex||"00000000",ga);break}var U={},ea=false,Aa=false;if(N.r!==undefined&&!R.indexOf("r")==-1)R+="r";if(N.g!==undefined&&!R.indexOf("g")==-1)R+="g";if(N.b!==undefined&&!R.indexOf("b")==-1)R+="b";if(N.a!==undefined&&!R.indexOf("a")==-1)R+="a";if(N.h!==undefined&&!R.indexOf("h")==-1)R+="h";if(N.s!==undefined&&!R.indexOf("s")==-1)R+="s";if(N.v!==undefined&&!R.indexOf("v")==-1)R+="v";for(oa=0;oa<R.length;oa++)switch(R.charAt(oa)){case "r":if(Aa)continue;
ea=true;U.r=N&&N.r&&N.r|0||N&&N|0||0;if(U.r<0)U.r=0;else if(U.r>255)U.r=255;if(c!=U.r){c=U.r;X=true}break;case "g":if(Aa)continue;ea=true;U.g=N&&N.g&&N.g|0||N&&N|0||0;if(U.g<0)U.g=0;else if(U.g>255)U.g=255;if(m!=U.g){m=U.g;X=true}break;case "b":if(Aa)continue;ea=true;U.b=N&&N.b&&N.b|0||N&&N|0||0;if(U.b<0)U.b=0;else if(U.b>255)U.b=255;if(u!=U.b){u=U.b;X=true}break;case "a":U.a=N&&N.a!=null?N.a|0:N!=null?N|0:255;if(U.a<0)U.a=0;else if(U.a>255)U.a=255;if(C!=U.a){C=U.a;X=true}break;case "h":if(ea)continue; ea=true;U.r=N&&N.r&&N.r|0||N&&N|0||0;if(U.r<0)U.r=0;else if(U.r>255)U.r=255;if(c!=U.r){c=U.r;X=true}break;case "g":if(Aa)continue;ea=true;U.g=N&&N.g&&N.g|0||N&&N|0||0;if(U.g<0)U.g=0;else if(U.g>255)U.g=255;if(m!=U.g){m=U.g;X=true}break;case "b":if(Aa)continue;ea=true;U.b=N&&N.b&&N.b|0||N&&N|0||0;if(U.b<0)U.b=0;else if(U.b>255)U.b=255;if(u!=U.b){u=U.b;X=true}break;case "a":U.a=N&&N.a!=null?N.a|0:N!=null?N|0:255;if(U.a<0)U.a=0;else if(U.a>255)U.a=255;if(C!=U.a){C=U.a;X=true}break;case "h":if(ea)continue;
Aa=true;U.h=N&&N.h&&N.h|0||N&&N|0||0;if(U.h<0)U.h=0;else if(U.h>360)U.h=360;if(s!=U.h){s=U.h;X=true}break;case "s":if(ea)continue;Aa=true;U.s=N&&N.s!=null?N.s|0:N!=null?N|0:100;if(U.s<0)U.s=0;else if(U.s>100)U.s=100;if(L!=U.s){L=U.s;X=true}break;case "v":if(ea)continue;Aa=true;U.v=N&&N.v!=null?N.v|0:N!=null?N|0:100;if(U.v<0)U.v=0;else if(U.v>100)U.v=100;if(R!=U.v){R=U.v;X=true}}if(X){if(ea){c=c||0;m=m||0;u=u||0;N=v.rgbToHsv({r:c,g:m,b:u});s=N.h;L=N.s;R=N.v}else if(Aa){s=s||0;L=L!=null?L:100;R=R!= Aa=true;U.h=N&&N.h&&N.h|0||N&&N|0||0;if(U.h<0)U.h=0;else if(U.h>360)U.h=360;if(s!=U.h){s=U.h;X=true}break;case "s":if(ea)continue;Aa=true;U.s=N&&N.s!=null?N.s|0:N!=null?N|0:100;if(U.s<0)U.s=0;else if(U.s>100)U.s=100;if(L!=U.s){L=U.s;X=true}break;case "v":if(ea)continue;Aa=true;U.v=N&&N.v!=null?N.v|0:N!=null?N|0:100;if(U.v<0)U.v=0;else if(U.v>100)U.v=100;if(Q!=U.v){Q=U.v;X=true}}if(X){if(ea){c=c||0;m=m||0;u=u||0;N=v.rgbToHsv({r:c,g:m,b:u});s=N.h;L=N.s;Q=N.v}else if(Aa){s=s||0;L=L!=null?L:100;Q=Q!=
null?R:100;N=v.hsvToRgb({h:s,s:L,v:R});c=N.r;m=N.g;u=N.b}C=C!=null?C:255;I.call(f,ga||f)}}}};a.extend(true,f,{val:Q,bind:function(S){a.isFunction(S)&&K.push(S)},unbind:function(S){if(a.isFunction(S))for(var N;(N=a.inArray(S,K))!=-1;)K.splice(N,1)},destroy:function(){K=null}});if(d)if(d.ahex!=null)Q("ahex",d);else if(d.hex!=null)Q((d.a!=null?"a":"")+"hex",d.a!=null?{ahex:d.hex+v.intToHex(d.a)}:d);else if(d.r!=null&&d.g!=null&&d.b!=null)Q("rgb"+(d.a!=null?"a":""),d);else if(d.h!=null&&d.s!=null&&d.v!= null?Q:100;N=v.hsvToRgb({h:s,s:L,v:Q});c=N.r;m=N.g;u=N.b}C=C!=null?C:255;H.call(f,ga||f)}}}};a.extend(true,f,{val:S,bind:function(R){a.isFunction(R)&&K.push(R)},unbind:function(R){if(a.isFunction(R))for(var N;(N=a.inArray(R,K))!=-1;)K.splice(N,1)},destroy:function(){K=null}});if(d)if(d.ahex!=null)S("ahex",d);else if(d.hex!=null)S((d.a!=null?"a":"")+"hex",d.a!=null?{ahex:d.hex+v.intToHex(d.a)}:d);else if(d.r!=null&&d.g!=null&&d.b!=null)S("rgb"+(d.a!=null?"a":""),d);else if(d.h!=null&&d.s!=null&&d.v!=
null)Q("hsv"+(d.a!=null?"a":""),d)},ColorMethods:{hexToRgba:function(d){d=this.validateHex(d);if(d=="")return{r:null,g:null,b:null,a:null};var f="00",c="00",m="00",u="255";if(d.length==6)d+="ff";if(d.length>6){f=d.substring(0,2);c=d.substring(2,4);m=d.substring(4,6);u=d.substring(6,d.length)}else{if(d.length>4){f=d.substring(4,d.length);d=d.substring(0,4)}if(d.length>2){c=d.substring(2,d.length);d=d.substring(0,2)}if(d.length>0)m=d.substring(0,d.length)}return{r:this.hexToInt(f),g:this.hexToInt(c), null)S("hsv"+(d.a!=null?"a":""),d)},ColorMethods:{hexToRgba:function(d){d=this.validateHex(d);if(d=="")return{r:null,g:null,b:null,a:null};var f="00",c="00",m="00",u="255";if(d.length==6)d+="ff";if(d.length>6){f=d.substring(0,2);c=d.substring(2,4);m=d.substring(4,6);u=d.substring(6,d.length)}else{if(d.length>4){f=d.substring(4,d.length);d=d.substring(0,4)}if(d.length>2){c=d.substring(2,d.length);d=d.substring(0,2)}if(d.length>0)m=d.substring(0,d.length)}return{r:this.hexToInt(f),g:this.hexToInt(c),
b:this.hexToInt(m),a:this.hexToInt(u)}},validateHex:function(d){if(typeof d=="object")return"";d=d.toLowerCase().replace(/[^a-f0-9]/g,"");if(d.length>8)d=d.substring(0,8);return d},rgbaToHex:function(d){return this.intToHex(d.r)+this.intToHex(d.g)+this.intToHex(d.b)+this.intToHex(d.a)},intToHex:function(d){d=(d|0).toString(16);if(d.length==1)d="0"+d;return d.toLowerCase()},hexToInt:function(d){return parseInt(d,16)},rgbToHsv:function(d){var f=d.r/255,c=d.g/255;d=d.b/255;var m={h:0,s:0,v:0},u=0,C= b:this.hexToInt(m),a:this.hexToInt(u)}},validateHex:function(d){if(typeof d=="object")return"";d=d.toLowerCase().replace(/[^a-f0-9]/g,"");if(d.length>8)d=d.substring(0,8);return d},rgbaToHex:function(d){return this.intToHex(d.r)+this.intToHex(d.g)+this.intToHex(d.b)+this.intToHex(d.a)},intToHex:function(d){d=(d|0).toString(16);if(d.length==1)d="0"+d;return d.toLowerCase()},hexToInt:function(d){return parseInt(d,16)},rgbToHsv:function(d){var f=d.r/255,c=d.g/255;d=d.b/255;var m={h:0,s:0,v:0},u=0,C=
0;if(f>=c&&f>=d){C=f;u=c>d?d:c}else if(c>=d&&c>=f){C=c;u=f>d?d:f}else{C=d;u=c>f?f:c}m.v=C;m.s=C?(C-u)/C:0;if(m.s){u=C-u;m.h=f==C?(c-d)/u:c==C?2+(d-f)/u:4+(f-c)/u;m.h=parseInt(m.h*60);if(m.h<0)m.h+=360}else m.h=0;m.s=m.s*100|0;m.v=m.v*100|0;return m},hsvToRgb:function(d){var f={r:0,g:0,b:0,a:100},c=d.h,m=d.s;d=d.v;if(m==0)f.r=d==0?f.g=f.b=0:f.g=f.b=d*255/100|0;else{if(c==360)c=0;c/=60;m/=100;d/=100;var u=c|0,C=c-u;c=d*(1-m);var s=d*(1-m*C);m=d*(1-m*(1-C));switch(u){case 0:f.r=d;f.g=m;f.b=c;break;case 1:f.r= 0;if(f>=c&&f>=d){C=f;u=c>d?d:c}else if(c>=d&&c>=f){C=c;u=f>d?d:f}else{C=d;u=c>f?f:c}m.v=C;m.s=C?(C-u)/C:0;if(m.s){u=C-u;m.h=f==C?(c-d)/u:c==C?2+(d-f)/u:4+(f-c)/u;m.h=parseInt(m.h*60);if(m.h<0)m.h+=360}else m.h=0;m.s=m.s*100|0;m.v=m.v*100|0;return m},hsvToRgb:function(d){var f={r:0,g:0,b:0,a:100},c=d.h,m=d.s;d=d.v;if(m==0)f.r=d==0?f.g=f.b=0:f.g=f.b=d*255/100|0;else{if(c==360)c=0;c/=60;m/=100;d/=100;var u=c|0,C=c-u;c=d*(1-m);var s=d*(1-m*C);m=d*(1-m*(1-C));switch(u){case 0:f.r=d;f.g=m;f.b=c;break;case 1:f.r=
s;f.g=d;f.b=c;break;case 2:f.r=c;f.g=d;f.b=m;break;case 3:f.r=c;f.g=s;f.b=d;break;case 4:f.r=m;f.g=c;f.b=d;break;case 5:f.r=d;f.g=c;f.b=s}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,p=a.jPicker.List,v=a.jPicker.ColorMethods;a.fn.jPicker=function(d){var f=arguments;return this.each(function(){var c=this,m=a.extend(true,{},a.fn.jPicker.defaults,d);if(a(c).get(0).nodeName.toLowerCase()=="input"){a.extend(true,m,{window:{bindToInput:true,expandable:true,input:a(c)}});if(a(c).val()== s;f.g=d;f.b=c;break;case 2:f.r=c;f.g=d;f.b=m;break;case 3:f.r=c;f.g=s;f.b=d;break;case 4:f.r=m;f.g=c;f.b=d;break;case 5:f.r=d;f.g=c;f.b=s}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,p=a.jPicker.List,v=a.jPicker.ColorMethods;a.fn.jPicker=function(d){var f=arguments;return this.each(function(){var c=this,m=a.extend(true,{},a.fn.jPicker.defaults,d);if(a(c).get(0).nodeName.toLowerCase()=="input"){a.extend(true,m,{window:{bindToInput:true,expandable:true,input:a(c)}});if(a(c).val()==
""){m.color.active=new b({hex:null});m.color.current=new b({hex:null})}else if(v.validateHex(a(c).val())){m.color.active=new b({hex:a(c).val(),a:m.color.active.val("a")});m.color.current=new b({hex:a(c).val(),a:m.color.active.val("a")})}}if(m.window.expandable)a(c).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>'); ""){m.color.active=new b({hex:null});m.color.current=new b({hex:null})}else if(v.validateHex(a(c).val())){m.color.active=new b({hex:a(c).val(),a:m.color.active.val("a")});m.color.current=new b({hex:a(c).val(),a:m.color.active.val("a")})}}if(m.window.expandable)a(c).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 m.window.liveUpdate=false;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,C=null,s=null,L=null,R=null,K=null,I=null,Q=null,S=null,N=null,ga=null,na=null,X=null,U=null,ea=null,Aa=null,ja=null,ba=null,T=null,Z=null,oa=null,pa=null,ma=null,la=null,xa=null,ya=null,Ja=null,Ha=null,Ga=null,Ma=function(M){var P=ka.active,ca=P.val("hex"),Da,Oa;m.color.mode=M;switch(M){case "h":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,R,0);ta.call(c,R,100);Ea.call(c, else m.window.liveUpdate=false;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,C=null,s=null,L=null,Q=null,K=null,H=null,S=null,R=null,N=null,ga=null,oa=null,X=null,U=null,ea=null,Aa=null,ja=null,ba=null,T=null,Z=null,na=null,pa=null,ma=null,la=null,xa=null,ya=null,Ja=null,Ha=null,Ga=null,Ma=function(M){var P=ka.active,ca=P.val("hex"),Da,Oa;m.color.mode=M;switch(M){case "h":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,Q,0);ta.call(c,Q,100);Ea.call(c,
K,260);ta.call(c,K,100);Ta.call(c,L,"transparent");Ea.call(c,Q,0);ta.call(c,Q,100);Ea.call(c,S,260);ta.call(c,S,100);Ea.call(c,N,260);ta.call(c,N,100);Ea.call(c,ga,260);ta.call(c,ga,100);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:100,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:360});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("s"),y:100-P.val("v")},U);ea.val("y",360-P.val("h"),ea);break;case "s":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,R,-260);Ea.call(c, K,260);ta.call(c,K,100);Ta.call(c,L,"transparent");Ea.call(c,S,0);ta.call(c,S,100);Ea.call(c,R,260);ta.call(c,R,100);Ea.call(c,N,260);ta.call(c,N,100);Ea.call(c,ga,260);ta.call(c,ga,100);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:100,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:360});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("s"),y:100-P.val("v")},U);ea.val("y",360-P.val("h"),ea);break;case "s":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,Q,-260);Ea.call(c,
K,-520);Ea.call(c,Q,-260);Ea.call(c,S,-520);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("v")},U);ea.val("y",100-P.val("s"),ea);break;case "v":setTimeout(function(){Ta.call(c,s,"000000");Ea.call(c,R,-780);Ea.call(c,K,260);Ta.call(c,L,ca);Ea.call(c,Q,-520);Ea.call(c,S,260);ta.call(c,S,100);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:360, K,-520);Ea.call(c,S,-260);Ea.call(c,R,-520);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("v")},U);ea.val("y",100-P.val("s"),ea);break;case "v":setTimeout(function(){Ta.call(c,s,"000000");Ea.call(c,Q,-780);Ea.call(c,K,260);Ta.call(c,L,ca);Ea.call(c,S,-520);Ea.call(c,R,260);ta.call(c,R,100);Ea.call(c,X,260);ta.call(c,X,100)},0);U.range("all",{minX:0,maxX:360,
minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("s")},U);ea.val("y",100-P.val("v"),ea);break;case "r":Da=-1040;Oa=-780;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("b"),y:255-P.val("g")},U);ea.val("y",255-P.val("r"),ea);break;case "g":Da=-1560;Oa=-1820;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255}); minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("s")},U);ea.val("y",100-P.val("v"),ea);break;case "r":Da=-1040;Oa=-780;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("b"),y:255-P.val("g")},U);ea.val("y",255-P.val("r"),ea);break;case "g":Da=-1560;Oa=-1820;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});
if(P.val("ahex")==null)break;U.val("xy",{x:P.val("b"),y:255-P.val("r")},U);ea.val("y",255-P.val("g"),ea);break;case "b":Da=-2080;Oa=-2860;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("r"),y:255-P.val("g")},U);ea.val("y",255-P.val("b"),ea);break;case "a":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,R,-260);Ea.call(c,K,-520);Ea.call(c,Q,260);Ea.call(c,S,260);ta.call(c,S,100);Ea.call(c,X,0);ta.call(c, if(P.val("ahex")==null)break;U.val("xy",{x:P.val("b"),y:255-P.val("r")},U);ea.val("y",255-P.val("g"),ea);break;case "b":Da=-2080;Oa=-2860;U.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("r"),y:255-P.val("g")},U);ea.val("y",255-P.val("b"),ea);break;case "a":setTimeout(function(){Ta.call(c,s,"transparent");Ea.call(c,Q,-260);Ea.call(c,K,-520);Ea.call(c,S,260);Ea.call(c,R,260);ta.call(c,R,100);Ea.call(c,X,0);ta.call(c,
X,100)},0);U.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("v")},U);ea.val("y",255-P.val("a"),ea);break;default:throw"Invalid Mode";}switch(M){case "s":case "v":case "a":setTimeout(function(){ta.call(c,R,100);ta.call(c,Q,100);Ea.call(c,N,260);ta.call(c,N,100);Ea.call(c,ga,260);ta.call(c,ga,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Ta.call(c,s,"transparent");Ta.call(c,L,"transparent"); X,100)},0);U.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;U.val("xy",{x:P.val("h"),y:100-P.val("v")},U);ea.val("y",255-P.val("a"),ea);break;default:throw"Invalid Mode";}switch(M){case "s":case "v":case "a":setTimeout(function(){ta.call(c,Q,100);ta.call(c,S,100);Ea.call(c,N,260);ta.call(c,N,100);Ea.call(c,ga,260);ta.call(c,ga,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Ta.call(c,s,"transparent");Ta.call(c,L,"transparent");
ta.call(c,Q,100);ta.call(c,R,100);Ea.call(c,R,Da);Ea.call(c,K,Da-260);Ea.call(c,Q,Oa-780);Ea.call(c,S,Oa-520);Ea.call(c,N,Oa);Ea.call(c,ga,Oa-260);Ea.call(c,X,260);ta.call(c,X,100)},0)}P.val("ahex")!=null&&Ca.call(c,P)},Ca=function(M,P){if(P==null||P!=ea&&P!=U)va.call(c,M,P);setTimeout(function(){kb.call(c,M);vb.call(c,M);cb.call(c,M)},0)},wa=function(M,P){var ca=ka.active;if(!(P!=U&&ca.val()==null)){var Da=M.val("all");switch(m.color.mode){case "h":ca.val("sv",{s:Da.x,v:100-Da.y},P);break;case "s":case "a":ca.val("hv", ta.call(c,S,100);ta.call(c,Q,100);Ea.call(c,Q,Da);Ea.call(c,K,Da-260);Ea.call(c,S,Oa-780);Ea.call(c,R,Oa-520);Ea.call(c,N,Oa);Ea.call(c,ga,Oa-260);Ea.call(c,X,260);ta.call(c,X,100)},0)}P.val("ahex")!=null&&Ca.call(c,P)},Ca=function(M,P){if(P==null||P!=ea&&P!=U)va.call(c,M,P);setTimeout(function(){kb.call(c,M);vb.call(c,M);cb.call(c,M)},0)},wa=function(M,P){var ca=ka.active;if(!(P!=U&&ca.val()==null)){var Da=M.val("all");switch(m.color.mode){case "h":ca.val("sv",{s:Da.x,v:100-Da.y},P);break;case "s":case "a":ca.val("hv",
{h:Da.x,v:100-Da.y},P);break;case "v":ca.val("hs",{h:Da.x,s:100-Da.y},P);break;case "r":ca.val("gb",{g:255-Da.y,b:Da.x},P);break;case "g":ca.val("rb",{r:255-Da.y,b:Da.x},P);break;case "b":ca.val("rg",{r:Da.x,g:255-Da.y},P)}}},ra=function(M,P){var ca=ka.active;if(!(P!=ea&&ca.val()==null))switch(m.color.mode){case "h":ca.val("h",{h:360-M.val("y")},P);break;case "s":ca.val("s",{s:100-M.val("y")},P);break;case "v":ca.val("v",{v:100-M.val("y")},P);break;case "r":ca.val("r",{r:255-M.val("y")},P);break; {h:Da.x,v:100-Da.y},P);break;case "v":ca.val("hs",{h:Da.x,s:100-Da.y},P);break;case "r":ca.val("gb",{g:255-Da.y,b:Da.x},P);break;case "g":ca.val("rb",{r:255-Da.y,b:Da.x},P);break;case "b":ca.val("rg",{r:Da.x,g:255-Da.y},P)}}},ra=function(M,P){var ca=ka.active;if(!(P!=ea&&ca.val()==null))switch(m.color.mode){case "h":ca.val("h",{h:360-M.val("y")},P);break;case "s":ca.val("s",{s:100-M.val("y")},P);break;case "v":ca.val("v",{v:100-M.val("y")},P);break;case "r":ca.val("r",{r:255-M.val("y")},P);break;
case "g":ca.val("g",{g:255-M.val("y")},P);break;case "b":ca.val("b",{b:255-M.val("y")},P);break;case "a":ca.val("a",255-M.val("y"),P)}},va=function(M,P){if(P!=U)switch(m.color.mode){case "h":var ca=M.val("sv");U.val("xy",{x:ca!=null?ca.s:100,y:100-(ca!=null?ca.v:100)},P);break;case "s":case "a":ca=M.val("hv");U.val("xy",{x:ca&&ca.h||0,y:100-(ca!=null?ca.v:100)},P);break;case "v":ca=M.val("hs");U.val("xy",{x:ca&&ca.h||0,y:100-(ca!=null?ca.s:100)},P);break;case "r":ca=M.val("bg");U.val("xy",{x:ca&& case "g":ca.val("g",{g:255-M.val("y")},P);break;case "b":ca.val("b",{b:255-M.val("y")},P);break;case "a":ca.val("a",255-M.val("y"),P)}},va=function(M,P){if(P!=U)switch(m.color.mode){case "h":var ca=M.val("sv");U.val("xy",{x:ca!=null?ca.s:100,y:100-(ca!=null?ca.v:100)},P);break;case "s":case "a":ca=M.val("hv");U.val("xy",{x:ca&&ca.h||0,y:100-(ca!=null?ca.v:100)},P);break;case "v":ca=M.val("hs");U.val("xy",{x:ca&&ca.h||0,y:100-(ca!=null?ca.s:100)},P);break;case "r":ca=M.val("bg");U.val("xy",{x:ca&&
ca.b||0,y:255-(ca&&ca.g||0)},P);break;case "g":ca=M.val("br");U.val("xy",{x:ca&&ca.b||0,y:255-(ca&&ca.r||0)},P);break;case "b":ca=M.val("rg");U.val("xy",{x:ca&&ca.r||0,y:255-(ca&&ca.g||0)},P)}if(P!=ea)switch(m.color.mode){case "h":ea.val("y",360-(M.val("h")||0),P);break;case "s":ca=M.val("s");ea.val("y",100-(ca!=null?ca:100),P);break;case "v":ca=M.val("v");ea.val("y",100-(ca!=null?ca:100),P);break;case "r":ea.val("y",255-(M.val("r")||0),P);break;case "g":ea.val("y",255-(M.val("g")||0),P);break;case "b":ea.val("y", ca.b||0,y:255-(ca&&ca.g||0)},P);break;case "g":ca=M.val("br");U.val("xy",{x:ca&&ca.b||0,y:255-(ca&&ca.r||0)},P);break;case "b":ca=M.val("rg");U.val("xy",{x:ca&&ca.r||0,y:255-(ca&&ca.g||0)},P)}if(P!=ea)switch(m.color.mode){case "h":ea.val("y",360-(M.val("h")||0),P);break;case "s":ca=M.val("s");ea.val("y",100-(ca!=null?ca:100),P);break;case "v":ca=M.val("v");ea.val("y",100-(ca!=null?ca:100),P);break;case "r":ea.val("y",255-(M.val("r")||0),P);break;case "g":ea.val("y",255-(M.val("g")||0),P);break;case "b":ea.val("y",
255-(M.val("b")||0),P);break;case "a":ca=M.val("a");ea.val("y",255-(ca!=null?ca:255),P)}},kb=function(M){try{var P=M.val("all");oa.css({backgroundColor:P&&"#"+P.hex||"transparent"});ta.call(c,oa,P&&Math.precision(P.a*100/255,4)||0)}catch(ca){}},vb=function(M){switch(m.color.mode){case "h":Ta.call(c,s,(new b({h:M.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var P=M.val("s");ta.call(c,K,100-(P!=null?P:100));break;case "v":P=M.val("v");ta.call(c,R,P!=null?P:100);break;case "r":ta.call(c, 255-(M.val("b")||0),P);break;case "a":ca=M.val("a");ea.val("y",255-(ca!=null?ca:255),P)}},kb=function(M){try{var P=M.val("all");na.css({backgroundColor:P&&"#"+P.hex||"transparent"});ta.call(c,na,P&&Math.precision(P.a*100/255,4)||0)}catch(ca){}},vb=function(M){switch(m.color.mode){case "h":Ta.call(c,s,(new b({h:M.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var P=M.val("s");ta.call(c,K,100-(P!=null?P:100));break;case "v":P=M.val("v");ta.call(c,Q,P!=null?P:100);break;case "r":ta.call(c,
K,Math.precision((M.val("r")||0)/255*100,4));break;case "g":ta.call(c,K,Math.precision((M.val("g")||0)/255*100,4));break;case "b":ta.call(c,K,Math.precision((M.val("b")||0)/255*100))}M=M.val("a");ta.call(c,I,Math.precision((255-(M||0))*100/255,4))},cb=function(M){switch(m.color.mode){case "h":var P=M.val("a");ta.call(c,na,Math.precision((255-(P||0))*100/255,4));break;case "s":P=M.val("hva");var ca=new b({h:P&&P.h||0,s:100,v:P!=null?P.v:100});Ta.call(c,L,ca.val("hex"));ta.call(c,S,100-(P!=null?P.v: K,Math.precision((M.val("r")||0)/255*100,4));break;case "g":ta.call(c,K,Math.precision((M.val("g")||0)/255*100,4));break;case "b":ta.call(c,K,Math.precision((M.val("b")||0)/255*100))}M=M.val("a");ta.call(c,H,Math.precision((255-(M||0))*100/255,4))},cb=function(M){switch(m.color.mode){case "h":var P=M.val("a");ta.call(c,oa,Math.precision((255-(P||0))*100/255,4));break;case "s":P=M.val("hva");var ca=new b({h:P&&P.h||0,s:100,v:P!=null?P.v:100});Ta.call(c,L,ca.val("hex"));ta.call(c,R,100-(P!=null?P.v:
100));ta.call(c,na,Math.precision((255-(P&&P.a||0))*100/255,4));break;case "v":P=M.val("hsa");ca=new b({h:P&&P.h||0,s:P!=null?P.s:100,v:100});Ta.call(c,L,ca.val("hex"));ta.call(c,na,Math.precision((255-(P&&P.a||0))*100/255,4));break;case "r":case "g":case "b":ca=P=0;M=M.val("rgba");if(m.color.mode=="r"){P=M&&M.b||0;ca=M&&M.g||0}else if(m.color.mode=="g"){P=M&&M.b||0;ca=M&&M.r||0}else if(m.color.mode=="b"){P=M&&M.r||0;ca=M&&M.g||0}var Da=ca>P?P:ca;ta.call(c,S,P>ca?Math.precision((P-ca)/(255-ca)*100, 100));ta.call(c,oa,Math.precision((255-(P&&P.a||0))*100/255,4));break;case "v":P=M.val("hsa");ca=new b({h:P&&P.h||0,s:P!=null?P.s:100,v:100});Ta.call(c,L,ca.val("hex"));ta.call(c,oa,Math.precision((255-(P&&P.a||0))*100/255,4));break;case "r":case "g":case "b":ca=P=0;M=M.val("rgba");if(m.color.mode=="r"){P=M&&M.b||0;ca=M&&M.g||0}else if(m.color.mode=="g"){P=M&&M.b||0;ca=M&&M.r||0}else if(m.color.mode=="b"){P=M&&M.r||0;ca=M&&M.g||0}var Da=ca>P?P:ca;ta.call(c,R,P>ca?Math.precision((P-ca)/(255-ca)*100,
4):0);ta.call(c,N,ca>P?Math.precision((ca-P)/(255-P)*100,4):0);ta.call(c,ga,Math.precision(Da/255*100,4));ta.call(c,na,Math.precision((255-(M&&M.a||0))*100/255,4));break;case "a":P=M.val("a");Ta.call(c,L,M.val("hex")||"000000");ta.call(c,na,P!=null?0:100);ta.call(c,X,P!=null?100:0)}},Ta=function(M,P){M.css({backgroundColor:P&&P.length==6&&"#"+P||"transparent"})},Va=function(M,P){if(u&&(P.indexOf("AlphaBar.png")!=-1||P.indexOf("Bars.png")!=-1||P.indexOf("Maps.png")!=-1)){M.attr("pngSrc",P);M.css({backgroundImage:"none", 4):0);ta.call(c,N,ca>P?Math.precision((ca-P)/(255-P)*100,4):0);ta.call(c,ga,Math.precision(Da/255*100,4));ta.call(c,oa,Math.precision((255-(M&&M.a||0))*100/255,4));break;case "a":P=M.val("a");Ta.call(c,L,M.val("hex")||"000000");ta.call(c,oa,P!=null?0:100);ta.call(c,X,P!=null?100:0)}},Ta=function(M,P){M.css({backgroundColor:P&&P.length==6&&"#"+P||"transparent"})},Va=function(M,P){if(u&&(P.indexOf("AlphaBar.png")!=-1||P.indexOf("Bars.png")!=-1||P.indexOf("Maps.png")!=-1)){M.attr("pngSrc",P);M.css({backgroundImage:"none",
filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+P+"', sizingMethod='scale')"})}else M.css({backgroundImage:"url('"+P+"')"})},Ea=function(M,P){M.css({top:P+"px"})},ta=function(M,P){M.css({visibility:P>0?"visible":"hidden"});if(P>0&&P<100)if(u){var ca=M.attr("pngSrc");ca!=null&&(ca.indexOf("AlphaBar.png")!=-1||ca.indexOf("Bars.png")!=-1||ca.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ca+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+ filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+P+"', sizingMethod='scale')"})}else M.css({backgroundImage:"url('"+P+"')"})},Ea=function(M,P){M.css({top:P+"px"})},ta=function(M,P){M.css({visibility:P>0?"visible":"hidden"});if(P>0&&P<100)if(u){var ca=M.attr("pngSrc");ca!=null&&(ca.indexOf("AlphaBar.png")!=-1||ca.indexOf("Bars.png")!=-1||ca.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ca+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+
P+")"}):M.css({opacity:Math.precision(P/100,4)})}else M.css({opacity:Math.precision(P/100,4)});else if(P==0||P==100)if(u){ca=M.attr("pngSrc");ca!=null&&(ca.indexOf("AlphaBar.png")!=-1||ca.indexOf("Bars.png")!=-1||ca.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ca+"', sizingMethod='scale')"}):M.css({opacity:""})}else M.css({opacity:""})},$a=function(){ka.active.val("ahex",ka.current.val("ahex"))},Ka=function(){ka.current.val("ahex",ka.active.val("ahex"))}, P+")"}):M.css({opacity:Math.precision(P/100,4)})}else M.css({opacity:Math.precision(P/100,4)});else if(P==0||P==100)if(u){ca=M.attr("pngSrc");ca!=null&&(ca.indexOf("AlphaBar.png")!=-1||ca.indexOf("Bars.png")!=-1||ca.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ca+"', sizingMethod='scale')"}):M.css({opacity:""})}else M.css({opacity:""})},$a=function(){ka.active.val("ahex",ka.current.val("ahex"))},Ka=function(){ka.current.val("ahex",ka.active.val("ahex"))},
Sa=function(M){a(this).parents("tbody:first").find('input:radio[value!="'+M.target.value+'"]').removeAttr("checked");Ma.call(c,M.target.value)},Fa=function(){$a.call(c)},db=function(){$a.call(c);m.window.expandable&&fb.call(c);a.isFunction(ob)&&ob.call(c,ka.active,la)},lb=function(){Ka.call(c);m.window.expandable&&fb.call(c);a.isFunction(ib)&&ib.call(c,ka.active,ma)},Ua=function(){pb.call(c)},Xa=function(M){var P=M.val("hex");pa.css({backgroundColor:P&&"#"+P||"transparent"});ta.call(c,pa,Math.precision((M.val("a")|| Sa=function(M){a(this).parents("tbody:first").find('input:radio[value!="'+M.target.value+'"]').removeAttr("checked");Ma.call(c,M.target.value)},Fa=function(){$a.call(c)},db=function(){$a.call(c);m.window.expandable&&fb.call(c);a.isFunction(ob)&&ob.call(c,ka.active,la)},lb=function(){Ka.call(c);m.window.expandable&&fb.call(c);a.isFunction(ib)&&ib.call(c,ka.active,ma)},Ua=function(){pb.call(c)},Xa=function(M){var P=M.val("hex");pa.css({backgroundColor:P&&"#"+P||"transparent"});ta.call(c,pa,Math.precision((M.val("a")||
@ -641,16 +641,16 @@ null?ca.s:"")+'" title="'+aa.tooltips.saturation.textbox+'"/>&nbsp;%</td></tr><t
aa.tooltips.blue.radio+'"><input type="radio" value="b"'+(m.color.mode=="b"?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ca!=null?ca.b:"")+'" title="'+aa.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(M.alphaSupport?'<label title="'+aa.tooltips.alpha.radio+'"><input type="radio" value="a"'+(m.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(M.alphaSupport?'<input type="text" maxlength="'+ aa.tooltips.blue.radio+'"><input type="radio" value="b"'+(m.color.mode=="b"?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ca!=null?ca.b:"")+'" title="'+aa.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(M.alphaSupport?'<label title="'+aa.tooltips.alpha.radio+'"><input type="radio" value="a"'+(m.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(M.alphaSupport?'<input type="text" maxlength="'+
(3+M.alphaPrecision)+'" value="'+(ca!=null?Math.precision(ca.a*100/255,M.alphaPrecision):"")+'" title="'+aa.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+aa.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(ca!=null?ca.hex:"")+'"/></label>'+(M.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(ca!=null?ca.ahex.substring(6):"")+'" title="'+aa.tooltips.hex.alpha+'"/></td>':"&nbsp;")+ (3+M.alphaPrecision)+'" value="'+(ca!=null?Math.precision(ca.a*100/255,M.alphaPrecision):"")+'" title="'+aa.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+aa.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(ca!=null?ca.hex:"")+'"/></label>'+(M.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(ca!=null?ca.ahex.substring(6):"")+'" title="'+aa.tooltips.hex.alpha+'"/></td>':"&nbsp;")+
"</tr></tbody></table>";if(M.expandable){C.html(Da);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:M.position.x=="left"?P.offset().left-530-(M.position.y=="center"?25:0)+"px":M.position.x=="center"?P.offset().left-260+"px":M.position.x=="right"?P.offset().left-10+(M.position.y== "</tr></tbody></table>";if(M.expandable){C.html(Da);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:M.position.x=="left"?P.offset().left-530-(M.position.y=="center"?25:0)+"px":M.position.x=="center"?P.offset().left-260+"px":M.position.x=="right"?P.offset().left-10+(M.position.y==
"center"?25:0)+"px":M.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":P.offset().left+parseInt(M.position.x)+"px",position:"absolute",top:M.position.y=="top"?P.offset().top-312+"px":M.position.y=="center"?P.offset().top-156+"px":M.position.y=="bottom"?P.offset().top+25+"px":P.offset().top+parseInt(M.position.y)+"px"})}else{C=a(c);C.html(Da)}Da=C.find("tbody:first");s=Da.find("div.Map:first");L=Da.find("div.Bar:first");var Oa=s.find("span"),Wa=L.find("span");R=Oa.filter(".Map1:first"); "center"?25:0)+"px":M.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":P.offset().left+parseInt(M.position.x)+"px",position:"absolute",top:M.position.y=="top"?P.offset().top-312+"px":M.position.y=="center"?P.offset().top-156+"px":M.position.y=="bottom"?P.offset().top+25+"px":P.offset().top+parseInt(M.position.y)+"px"})}else{C=a(c);C.html(Da)}Da=C.find("tbody:first");s=Da.find("div.Map:first");L=Da.find("div.Bar:first");var Oa=s.find("span"),Wa=L.find("span");Q=Oa.filter(".Map1:first");
K=Oa.filter(".Map2:first");I=Oa.filter(".Map3:first");Q=Wa.filter(".Map1:first");S=Wa.filter(".Map2:first");N=Wa.filter(".Map3:first");ga=Wa.filter(".Map4:first");na=Wa.filter(".Map5:first");X=Wa.filter(".Map6:first");U=new q(s,{map:{width:ia.colorMap.width,height:ia.colorMap.height},arrow:{image:ia.clientPath+ia.colorMap.arrow.file,width:ia.colorMap.arrow.width,height:ia.colorMap.arrow.height}});U.bind(wa);ea=new q(L,{map:{width:ia.colorBar.width,height:ia.colorBar.height},arrow:{image:ia.clientPath+ K=Oa.filter(".Map2:first");H=Oa.filter(".Map3:first");S=Wa.filter(".Map1:first");R=Wa.filter(".Map2:first");N=Wa.filter(".Map3:first");ga=Wa.filter(".Map4:first");oa=Wa.filter(".Map5:first");X=Wa.filter(".Map6:first");U=new q(s,{map:{width:ia.colorMap.width,height:ia.colorMap.height},arrow:{image:ia.clientPath+ia.colorMap.arrow.file,width:ia.colorMap.arrow.width,height:ia.colorMap.arrow.height}});U.bind(wa);ea=new q(L,{map:{width:ia.colorBar.width,height:ia.colorBar.height},arrow:{image:ia.clientPath+
ia.colorBar.arrow.file,width:ia.colorBar.arrow.width,height:ia.colorBar.arrow.height}});ea.bind(ra);Aa=new g(Da,ka.active,M.expandable&&M.bindToInput?M.input:null,M.alphaPrecision);Oa=ca!=null?ca.hex:null;var Za=Da.find(".Preview");Wa=Da.find(".Button");oa=Za.find(".Active:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});pa=Za.find(".Current:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"}).bind("click",Fa);ta.call(c,pa,Math.precision(ka.current.val("a")*100)/255,4);ma=Wa.find(".Ok:first").bind("click touchstart", ia.colorBar.arrow.file,width:ia.colorBar.arrow.width,height:ia.colorBar.arrow.height}});ea.bind(ra);Aa=new g(Da,ka.active,M.expandable&&M.bindToInput?M.input:null,M.alphaPrecision);Oa=ca!=null?ca.hex:null;var Za=Da.find(".Preview");Wa=Da.find(".Button");na=Za.find(".Active:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});pa=Za.find(".Current:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"}).bind("click",Fa);ta.call(c,pa,Math.precision(ka.current.val("a")*100)/255,4);ma=Wa.find(".Ok:first").bind("click touchstart",
lb);la=Wa.find(".Cancel:first").bind("click touchstart",db);xa=Wa.find(".Grid:first");setTimeout(function(){Va.call(c,R,ia.clientPath+"Maps.png");Va.call(c,K,ia.clientPath+"Maps.png");Va.call(c,I,ia.clientPath+"map-opacity.png");Va.call(c,Q,ia.clientPath+"Bars.png");Va.call(c,S,ia.clientPath+"Bars.png");Va.call(c,N,ia.clientPath+"Bars.png");Va.call(c,ga,ia.clientPath+"Bars.png");Va.call(c,na,ia.clientPath+"bar-opacity.png");Va.call(c,X,ia.clientPath+"AlphaBar.png");Va.call(c,Za.find("div:last"),ia.clientPath+ lb);la=Wa.find(".Cancel:first").bind("click touchstart",db);xa=Wa.find(".Grid:first");setTimeout(function(){Va.call(c,Q,ia.clientPath+"Maps.png");Va.call(c,K,ia.clientPath+"Maps.png");Va.call(c,H,ia.clientPath+"map-opacity.png");Va.call(c,S,ia.clientPath+"Bars.png");Va.call(c,R,ia.clientPath+"Bars.png");Va.call(c,N,ia.clientPath+"Bars.png");Va.call(c,ga,ia.clientPath+"Bars.png");Va.call(c,oa,ia.clientPath+"bar-opacity.png");Va.call(c,X,ia.clientPath+"AlphaBar.png");Va.call(c,Za.find("div:last"),ia.clientPath+
"preview-opacity.png")},0);Da.find("td.Radio input").bind("click touchstart",Sa);if(ka.quickList&&ka.quickList.length>0){Wa="";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 nb=ka.quickList[i].val("a"),Ra=ka.quickList[i].val("ahex");if(!M.alphaSupport&&Ra)Ra=Ra.substring(0,6)+"ff";var mb=ka.quickList[i].val("hex");Wa+='<span class="QuickColor"'+(Ra&&' title="#'+Ra+'"'||"")+' style="background-color:'+ "preview-opacity.png")},0);Da.find("td.Radio input").bind("click touchstart",Sa);if(ka.quickList&&ka.quickList.length>0){Wa="";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 nb=ka.quickList[i].val("a"),Ra=ka.quickList[i].val("ahex");if(!M.alphaSupport&&Ra)Ra=Ra.substring(0,6)+"ff";var mb=ka.quickList[i].val("hex");Wa+='<span class="QuickColor"'+(Ra&&' title="#'+Ra+'"'||"")+' style="background-color:'+
(mb&&"#"+mb||"")+";"+(mb?"":"background-image:url("+ia.clientPath+"NoColor.png)")+(M.alphaSupport&&nb&&nb<255?";opacity:"+Math.precision(nb/255,4)+";filter:Alpha(opacity="+Math.precision(nb/2.55,4)+")":"")+'">&nbsp;</span>'}Va.call(c,xa,ia.clientPath+"bar-opacity.png");xa.html(Wa);xa.find(".QuickColor").click(sb)}Ma.call(c,m.color.mode);ka.active.bind(Ca);a.isFunction(ab)&&ka.active.bind(ab);ka.current.bind(Xa);if(M.expandable){c.icon=P.parents(".Icon:first");ya=c.icon.find(".Color:first").css({backgroundColor:Oa&& (mb&&"#"+mb||"")+";"+(mb?"":"background-image:url("+ia.clientPath+"NoColor.png)")+(M.alphaSupport&&nb&&nb<255?";opacity:"+Math.precision(nb/255,4)+";filter:Alpha(opacity="+Math.precision(nb/2.55,4)+")":"")+'">&nbsp;</span>'}Va.call(c,xa,ia.clientPath+"bar-opacity.png");xa.html(Wa);xa.find(".QuickColor").click(sb)}Ma.call(c,m.color.mode);ka.active.bind(Ca);a.isFunction(ab)&&ka.active.bind(ab);ka.current.bind(Xa);if(M.expandable){c.icon=P.parents(".Icon:first");ya=c.icon.find(".Color:first").css({backgroundColor:Oa&&
"#"+Oa||"transparent"});Ja=c.icon.find(".Alpha:first");Va.call(c,Ja,ia.clientPath+"bar-opacity.png");ta.call(c,Ja,Math.precision((255-(ca!=null?ca.a:0))*100/255,4));Ha=c.icon.find(".Image:first").css({backgroundImage:"url('"+ia.clientPath+ia.picker.file+"')"}).bind("click",Ua);if(M.bindToInput&&M.updateInputColor)M.input.css({backgroundColor:Oa&&"#"+Oa||"transparent",color:ca==null||ca.v>75?"#000000":"#ffffff"});Ga=Da.find(".Move:first").bind("mousedown",sa);ka.active.bind(wb)}else pb.call(c)},ia= "#"+Oa||"transparent"});Ja=c.icon.find(".Alpha:first");Va.call(c,Ja,ia.clientPath+"bar-opacity.png");ta.call(c,Ja,Math.precision((255-(ca!=null?ca.a:0))*100/255,4));Ha=c.icon.find(".Image:first").css({backgroundImage:"url('"+ia.clientPath+ia.picker.file+"')"}).bind("click",Ua);if(M.bindToInput&&M.updateInputColor)M.input.css({backgroundColor:Oa&&"#"+Oa||"transparent",color:ca==null||ca.v>75?"#000000":"#ffffff"});Ga=Da.find(".Move:first").bind("mousedown",sa);ka.active.bind(wb)}else pb.call(c)},ia=
m.images,aa=m.localization,ka={active:(typeof m.color.active).toString().toLowerCase()=="string"?new b({ahex:!m.window.alphaSupport&&m.color.active?m.color.active.substring(0,6)+"ff":m.color.active}):new b({ahex:!m.window.alphaSupport&&m.color.active.val("ahex")?m.color.active.val("ahex").substring(0,6)+"ff":m.color.active.val("ahex")}),current:(typeof m.color.active).toString().toLowerCase()=="string"?new b({ahex:!m.window.alphaSupport&&m.color.active?m.color.active.substring(0,6)+"ff":m.color.active}): m.images,aa=m.localization,ka={active:(typeof m.color.active).toString().toLowerCase()=="string"?new b({ahex:!m.window.alphaSupport&&m.color.active?m.color.active.substring(0,6)+"ff":m.color.active}):new b({ahex:!m.window.alphaSupport&&m.color.active.val("ahex")?m.color.active.val("ahex").substring(0,6)+"ff":m.color.active.val("ahex")}),current:(typeof m.color.active).toString().toLowerCase()=="string"?new b({ahex:!m.window.alphaSupport&&m.color.active?m.color.active.substring(0,6)+"ff":m.color.active}):
new b({ahex:!m.window.alphaSupport&&m.color.active.val("ahex")?m.color.active.val("ahex").substring(0,6)+"ff":m.color.active.val("ahex")}),quickList:m.color.quickList};a.extend(true,c,{commitCallback:ib,liveCallback:ab,cancelCallback:ob,color:ka,show:pb,hide:fb,destroy:function(){C.find("td.Radio input touchstart").unbind("click",Sa);pa.unbind("click touchstart",Fa);la.unbind("click touchstart",db);ma.unbind("click touchstart",lb);if(m.window.expandable){Ha.unbind("click",Ua);Ga.unbind("mousedown", new b({ahex:!m.window.alphaSupport&&m.color.active.val("ahex")?m.color.active.val("ahex").substring(0,6)+"ff":m.color.active.val("ahex")}),quickList:m.color.quickList};a.extend(true,c,{commitCallback:ib,liveCallback:ab,cancelCallback:ob,color:ka,show:pb,hide:fb,destroy:function(){C.find("td.Radio input touchstart").unbind("click",Sa);pa.unbind("click touchstart",Fa);la.unbind("click touchstart",db);ma.unbind("click touchstart",lb);if(m.window.expandable){Ha.unbind("click",Ua);Ga.unbind("mousedown",
sa);c.icon=null}C.find(".QuickColor").unbind("click",sb);X=na=ga=N=S=Q=I=K=R=L=s=null;U.destroy();U=null;ea.destroy();ea=null;Aa.destroy();ab=ob=ib=xa=la=ma=pa=oa=Aa=null;C.html("");for(i=0;i<p.length;i++)p[i]==c&&p.splice(i,1)}});p.push(c);setTimeout(function(){tb.call(c)},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}, sa);c.icon=null}C.find(".QuickColor").unbind("click",sb);X=oa=ga=N=R=S=H=K=Q=L=s=null;U.destroy();U=null;ea.destroy();ea=null;Aa.destroy();ab=ob=ib=xa=la=ma=pa=na=Aa=null;C.html("");for(i=0;i<p.length;i++)p[i]==c&&p.splice(i,1)}});p.push(c);setTimeout(function(){tb.call(c)},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, 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: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: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,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}), 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}),
@ -662,12 +662,12 @@ a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEvent
return new $.jGraduate.Paint(c)};return{name:"eyedropper",svgicons:"extensions/eyedropper-icon.xml",buttons:[{id:"tool_eyedropper",type:"mode",title:"Eye Dropper Tool",position:8,key:"I",icon:"extensions/eyedropper.png",events:{click:function(){q.setMode("eyedropper")}}}],mouseDown:function(v){var d=q.getMode(),f=v.event;f=f.target.id==="svgroot"?document.getElementById("canvas_background"):f.target;if(d=="eyedropper"&&f){b.fillPaint=f.getAttribute("fill")||"white";b.fillOpacity=f.getAttribute("fill-opacity")|| return new $.jGraduate.Paint(c)};return{name:"eyedropper",svgicons:"extensions/eyedropper-icon.xml",buttons:[{id:"tool_eyedropper",type:"mode",title:"Eye Dropper Tool",position:8,key:"I",icon:"extensions/eyedropper.png",events:{click:function(){q.setMode("eyedropper")}}}],mouseDown:function(v){var d=q.getMode(),f=v.event;f=f.target.id==="svgroot"?document.getElementById("canvas_background"):f.target;if(d=="eyedropper"&&f){b.fillPaint=f.getAttribute("fill")||"white";b.fillOpacity=f.getAttribute("fill-opacity")||
1;b.strokePaint=f.getAttribute("stroke")||"none";b.strokeOpacity=f.getAttribute("stroke-opacity")||1;b.strokeWidth=f.getAttribute("stroke-width");b.strokeDashArray=f.getAttribute("stroke-dasharray");b.strokeLinecap=f.getAttribute("stroke-linecap");b.strokeLinejoin=f.getAttribute("stroke-linejoin");b.opacity=f.getAttribute("opacity")||1;v.selectedElements=v.selectedElements.filter(Boolean);if(v.selectedElements.length){if($.inArray(v.selectedElements.nodeName,["g","use"])==-1){var c={},m=function(C, 1;b.strokePaint=f.getAttribute("stroke")||"none";b.strokeOpacity=f.getAttribute("stroke-opacity")||1;b.strokeWidth=f.getAttribute("stroke-width");b.strokeDashArray=f.getAttribute("stroke-dasharray");b.strokeLinecap=f.getAttribute("stroke-linecap");b.strokeLinejoin=f.getAttribute("stroke-linejoin");b.opacity=f.getAttribute("opacity")||1;v.selectedElements=v.selectedElements.filter(Boolean);if(v.selectedElements.length){if($.inArray(v.selectedElements.nodeName,["g","use"])==-1){var c={},m=function(C,
s,L){c[s]=C.getAttribute(s);C.setAttribute(s,L)},u=new a.BatchCommand;v.selectedElements.forEach(function(C){b.fillPaint&&m(C,"fill",b.fillPaint);b.fillOpacity&&m(C,"fill-opacity",b.fillOpacity);b.strokePaint&&m(C,"stroke",b.strokePaint);b.strokeOpacity&&m(C,"stroke-opacity",b.strokeOpacity);b.strokeWidth&&m(C,"stroke-width",b.strokeWidth);b.strokeDashArray&&m(C,"stroke-dasharray",b.strokeDashArray);b.opacity&&m(C,"opacity",b.opacity);b.strokeLinecap&&m(C,"stroke-linecap",b.strokeLinecap);b.strokeLinejoin&& s,L){c[s]=C.getAttribute(s);C.setAttribute(s,L)},u=new a.BatchCommand;v.selectedElements.forEach(function(C){b.fillPaint&&m(C,"fill",b.fillPaint);b.fillOpacity&&m(C,"fill-opacity",b.fillOpacity);b.strokePaint&&m(C,"stroke",b.strokePaint);b.strokeOpacity&&m(C,"stroke-opacity",b.strokeOpacity);b.strokeWidth&&m(C,"stroke-width",b.strokeWidth);b.strokeDashArray&&m(C,"stroke-dasharray",b.strokeDashArray);b.opacity&&m(C,"opacity",b.opacity);b.strokeLinecap&&m(C,"stroke-linecap",b.strokeLinecap);b.strokeLinejoin&&
m(C,"stroke-linejoin",b.strokeLinejoin);u.addSubCommand(new g(C,c));c={}});v=p(b.fillPaint,b.fillOpacity*100,"fill");d=p(b.strokePaint,b.strokeOpacity*100,"stroke");svgEditor.paintBox.fill.update(true);svgEditor.paintBox.stroke.update(true);q.undoMgr.addCommandToHistory(u)}}else{v=p(b.fillPaint,b.fillOpacity*100,"fill");d=p(b.strokePaint,b.strokeOpacity*100,"stroke");svgEditor.paintBox.fill.setPaint(v);svgEditor.paintBox.stroke.setPaint(d)}}}}});svgEditor.addExtension("view_grid",function(a){function q(c){d.attr("width");d.attr("height");var m=svgedit.units.getTypeMap()[svgEditor.curConfig.baseUnit],u=[0.01,0.1,1,10,100,1E3];svgCanvas.getContentElem().getAttribute("x");var C=p;m=m*c;var s=100/m,L=1;for(c=0;c<u.length;c++){var R=u[c];L=R;if(s<=R)break}u=L*m;C.width=u;C.height=u;m=C.getContext("2d");s=u/10;m.globalAlpha=0.2;m.strokeStyle="#000";for(c=1;c<10;c++){L=Math.round(s*c)+0.5;m.moveTo(L,u);m.lineTo(L,0);m.moveTo(u,L);m.lineTo(0,L)}m.stroke(); m(C,"stroke-linejoin",b.strokeLinejoin);u.addSubCommand(new g(C,c));c={}});v=p(b.fillPaint,b.fillOpacity*100,"fill");d=p(b.strokePaint,b.strokeOpacity*100,"stroke");svgEditor.paintBox.fill.update(true);svgEditor.paintBox.stroke.update(true);q.undoMgr.addCommandToHistory(u)}}else{v=p(b.fillPaint,b.fillOpacity*100,"fill");d=p(b.strokePaint,b.strokeOpacity*100,"stroke");svgEditor.paintBox.fill.setPaint(v);svgEditor.paintBox.stroke.setPaint(d)}}}}});svgEditor.addExtension("view_grid",function(a){function q(c){d.attr("width");d.attr("height");var m=svgedit.units.getTypeMap()[svgEditor.curConfig.baseUnit],u=[0.01,0.1,1,10,100,1E3];svgCanvas.getContentElem().getAttribute("x");var C=p;m=m*c;var s=100/m,L=1;for(c=0;c<u.length;c++){var Q=u[c];L=Q;if(s<=Q)break}u=L*m;C.width=u;C.height=u;m=C.getContext("2d");s=u/10;m.globalAlpha=0.2;m.strokeStyle="#000";for(c=1;c<10;c++){L=Math.round(s*c)+0.5;m.moveTo(L,u);m.lineTo(L,0);m.moveTo(u,L);m.lineTo(0,L)}m.stroke();
m.beginPath();m.globalAlpha=0.5;m.moveTo(0.5,u);m.lineTo(0.5,0);m.moveTo(u,0.5);m.lineTo(0,0.5);m.stroke();C=C.toDataURL("image/png");f.setAttribute("width",u);f.setAttribute("height",u);f.parentNode.setAttribute("width",u);f.parentNode.setAttribute("height",u);svgCanvas.setHref(f,C)}if(!document.getElementById("canvasGrid")){var g=document.getElementById("svgcanvas").ownerDocument,b=false;a=a.assignAttributes;var p=document.createElement("canvas");$(p).hide().appendTo("body");var v=g.createElementNS("http://www.w3.org/2000/svg", m.beginPath();m.globalAlpha=0.5;m.moveTo(0.5,u);m.lineTo(0.5,0);m.moveTo(u,0.5);m.lineTo(0,0.5);m.stroke();C=C.toDataURL("image/png");f.setAttribute("width",u);f.setAttribute("height",u);f.parentNode.setAttribute("width",u);f.parentNode.setAttribute("height",u);svgCanvas.setHref(f,C)}if(!document.getElementById("canvasGrid")){var g=document.getElementById("svgcanvas").ownerDocument,b=false;a=a.assignAttributes;var p=document.createElement("canvas");$(p).hide().appendTo("body");var v=g.createElementNS("http://www.w3.org/2000/svg",
"g");a(v,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"});var d=$("#canvas_background");d.after(v);v=g.createElementNS("http://www.w3.org/2000/svg","pattern");a(v,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var f=g.createElementNS("http://www.w3.org/2000/svg","image");a(f,{x:0,y:0,width:100,height:100});v.appendChild(f);$("#svgroot defs").append(v);g=g.createElementNS("http://www.w3.org/2000/svg","rect");a(g,{width:"100%",height:"100%", "g");a(v,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"});var d=$("#canvas_background");d.after(v);v=g.createElementNS("http://www.w3.org/2000/svg","pattern");a(v,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var f=g.createElementNS("http://www.w3.org/2000/svg","image");a(f,{x:0,y:0,width:100,height:100});v.appendChild(f);$("#svgroot defs").append(v);g=g.createElementNS("http://www.w3.org/2000/svg","rect");a(g,{width:"100%",height:"100%",
x:0,y:0,"stroke-width":0,stroke:"none",fill:"url(#gridpattern)",style:"pointer-events: none; display:visible;"});$("#canvasGrid").append(g)}return{name:"view_grid",zoomChanged:function(c){b&&q(c)},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(g)}return{name:"view_grid",zoomChanged:function(c){b&&q(c)},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","inline");q(svgCanvas.getZoom())}}}}]}});svgEditor.addExtension("shapes",function(){function a(){$("#shape_buttons").empty();$("#shape_buttons").append(L.buttons)}function q(K){var I=s[K];if(I){L=I;I.buttons.length||g(K,I);a()}else{$("#shape_buttons").html("Loading...");$.getJSON("extensions/shapelib/"+K+".json",function(Q){L=s[K]={data:Q.data,size:Q.size,fill:Q.fill};g(K,Q);a()})}}function g(K,I){var Q=L.size||300,S=L.fill||false,N=Q*0.05;N=[-N,-N,Q+N*2,Q+N*2].join(" ");Q=S?0:Q/30;Q=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+ b=true;$("#view_grid").addClass("push_button_pressed");$("#canvasGrid").attr("display","inline");q(svgCanvas.getZoom())}}}}]}});svgEditor.addExtension("shapes",function(){function a(){$("#shape_buttons").empty();$("#shape_buttons").append(L.buttons)}function q(K){var H=s[K];if(H){L=H;H.buttons.length||g(K,H);a()}else{$("#shape_buttons").html("Loading...");$.getJSON("extensions/shapelib/"+K+".json",function(S){L=s[K]={data:S.data,size:S.size,fill:S.fill};g(K,S);a()})}}function g(K,H){var S=L.size||300,R=L.fill||false,N=S*0.05;N=[-N,-N,S+N*2,S+N*2].join(" ");S=R?0:S/30;S=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+
N+'"><path fill="#333" stroke="transparent" stroke-width="'+Q+'" /></svg></svg>',"text/xml");Q.documentElement.setAttribute("width",40);Q.documentElement.setAttribute("height",40);Q=$(document.importNode(Q.documentElement,true));S=I.data;L.buttons=[];for(var ga in S){N=S[ga];var na=Q.clone();na.find("path").attr("d",N);N=na.wrap('<div class="tool_button">').parent().attr({id:R+"_"+ga,title:ga});L.buttons.push(N[0])}}var b,p,v=svgEditor.canvas,d,f,c,m=v.getRootElem(),u={},C={basic:"Basic",object:"Objects", N+'"><path fill="#333" stroke="transparent" stroke-width="'+S+'" /></svg></svg>',"text/xml");S.documentElement.setAttribute("width",40);S.documentElement.setAttribute("height",40);S=$(document.importNode(S.documentElement,true));R=H.data;L.buttons=[];for(var ga in R){N=R[ga];var oa=S.clone();oa.find("path").attr("d",N);N=oa.wrap('<div class="tool_button">').parent().attr({id:Q+"_"+ga,title:ga});L.buttons.push(N[0])}}var b,p,v=svgEditor.canvas,d,f,c,m=v.getRootElem(),u={},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"},s={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", 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"},s={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",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", 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",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", 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",
@ -676,13 +676,13 @@ cylinder:"m299.0007,83.77844c0,18.28676 -66.70958,33.11111 -149.00002,33.11111m1
arrow_u_turn:"m1.00059,299.00055l0,-167.62497l0,0c0,-72.00411 58.37087,-130.37499 130.375,-130.37499l0,0l0,0c34.57759,0 67.73898,13.7359 92.18906,38.18595c24.45006,24.45005 38.18593,57.61144 38.18593,92.18904l0,18.625l37.24997,0l-74.49995,74.50002l-74.50002,-74.50002l37.25,0l0,-18.625c0,-30.8589 -25.0161,-55.87498 -55.87498,-55.87498l0,0l0,0c-30.85892,0 -55.875,25.01608 -55.875,55.87498l0,167.62497z",arrow_left_up:"m0.99865,224.5l74.50004,-74.5l0,37.25l111.74991,0l0,-111.75l-37.25,0l74.5,-74.5l74.5,74.5l-37.25,0l0,186.25l-186.24989,0l0,37.25l-74.50005,-74.5z", arrow_u_turn:"m1.00059,299.00055l0,-167.62497l0,0c0,-72.00411 58.37087,-130.37499 130.375,-130.37499l0,0l0,0c34.57759,0 67.73898,13.7359 92.18906,38.18595c24.45006,24.45005 38.18593,57.61144 38.18593,92.18904l0,18.625l37.24997,0l-74.49995,74.50002l-74.50002,-74.50002l37.25,0l0,-18.625c0,-30.8589 -25.0161,-55.87498 -55.87498,-55.87498l0,0l0,0c-30.85892,0 -55.875,25.01608 -55.875,55.87498l0,167.62497z",arrow_left_up:"m0.99865,224.5l74.50004,-74.5l0,37.25l111.74991,0l0,-111.75l-37.25,0l74.5,-74.5l74.5,74.5l-37.25,0l0,186.25l-186.24989,0l0,37.25l-74.50005,-74.5z",
plaque:"m-0.00197,49.94376l0,0c27.5829,0 49.94327,-22.36036 49.94327,-49.94327l199.76709,0l0,0c0,27.5829 22.36037,49.94327 49.94325,49.94327l0,199.7671l0,0c-27.58289,0 -49.94325,22.36034 -49.94325,49.94325l-199.76709,0c0,-27.58292 -22.36037,-49.94325 -49.94327,-49.94325z",page:"m249.3298,298.99744l9.9335,-39.73413l39.73413,-9.93355l-49.66763,49.66768l-248.33237,0l0,-298.00001l298.00001,0l0,248.33234",cross:"m0.99844,99.71339l98.71494,0l0,-98.71495l101.26279,0l0,98.71495l98.71495,0l0,101.2628l-98.71495,0l0,98.71494l-101.26279,0l0,-98.71494l-98.71494,0z", plaque:"m-0.00197,49.94376l0,0c27.5829,0 49.94327,-22.36036 49.94327,-49.94327l199.76709,0l0,0c0,27.5829 22.36037,49.94327 49.94325,49.94327l0,199.7671l0,0c-27.58289,0 -49.94325,22.36034 -49.94325,49.94325l-199.76709,0c0,-27.58292 -22.36037,-49.94325 -49.94327,-49.94325z",page:"m249.3298,298.99744l9.9335,-39.73413l39.73413,-9.93355l-49.66763,49.66768l-248.33237,0l0,-298.00001l298.00001,0l0,248.33234",cross:"m0.99844,99.71339l98.71494,0l0,-98.71495l101.26279,0l0,98.71495l98.71495,0l0,101.2628l-98.71495,0l0,98.71494l-101.26279,0l0,-98.71494l-98.71494,0z",
divide:"m150,0.99785l0,0c25.17819,0 45.58916,20.41097 45.58916,45.58916c0,25.17821 -20.41096,45.58916 -45.58916,45.58916c-25.17822,0 -45.58916,-20.41093 -45.58916,-45.58916c0,-25.1782 20.41093,-45.58916 45.58916,-45.58916zm0,296.25203c-25.17822,0 -45.58916,-20.41095 -45.58916,-45.58917c0,-25.17819 20.41093,-45.58916 45.58916,-45.58916c25.17819,0 45.58916,20.41096 45.58916,45.58916c0,25.17822 -20.41096,45.58917 -45.58916,45.58917zm-134.06754,-193.71518l268.13507,0l0,91.17833l-268.13507,0z",minus:"m0.99887,102.39503l297.49445,0l0,95.2112l-297.49445,0z", divide:"m150,0.99785l0,0c25.17819,0 45.58916,20.41097 45.58916,45.58916c0,25.17821 -20.41096,45.58916 -45.58916,45.58916c-25.17822,0 -45.58916,-20.41093 -45.58916,-45.58916c0,-25.1782 20.41093,-45.58916 45.58916,-45.58916zm0,296.25203c-25.17822,0 -45.58916,-20.41095 -45.58916,-45.58917c0,-25.17819 20.41093,-45.58916 45.58916,-45.58916c25.17819,0 45.58916,20.41096 45.58916,45.58916c0,25.17822 -20.41096,45.58917 -45.58916,45.58917zm-134.06754,-193.71518l268.13507,0l0,91.17833l-268.13507,0z",minus:"m0.99887,102.39503l297.49445,0l0,95.2112l-297.49445,0z",
times:"m1.00089,73.36786l72.36697,-72.36697l76.87431,76.87368l76.87431,-76.87368l72.36765,72.36697l-76.87433,76.87431l76.87433,76.87431l-72.36765,72.36765l-76.87431,-76.87433l-76.87431,76.87433l-72.36697,-72.36765l76.87368,-76.87431l-76.87368,-76.87431z"},buttons:[]}},L=s.basic,R="shapelib";return{svgicons:"extensions/ext-shapes.xml",buttons:[{id:"tool_shapelib",type:"mode_flyout",position:6,title:"Shape library",icon:"extensions/ext-shapes.png",events:{click:function(){v.setMode(R)}}}],callback:function(){var K= times:"m1.00089,73.36786l72.36697,-72.36697l76.87431,76.87368l76.87431,-76.87368l72.36765,72.36697l-76.87433,76.87431l76.87433,76.87431l-72.36765,72.36765l-76.87431,-76.87433l-76.87431,76.87433l-72.36697,-72.36765l76.87368,-76.87431l-76.87368,-76.87431z"},buttons:[]}},L=s.basic,Q="shapelib";return{svgicons:"extensions/ext-shapes.xml",buttons:[{id:"tool_shapelib",type:"mode_flyout",position:6,title:"Shape library",icon:"extensions/ext-shapes.png",events:{click:function(){v.setMode(Q)}}}],callback:function(){var K=
$('<div id="shape_buttons">');$("#tools_shapelib > *").wrapAll(K);var I=$("#tools_shapelib_show");q("basic");$("#shape_buttons").mouseup(function(S){S=$(S.target).closest("div.tool_button");if(S.length){var N=S.children().clone().attr({width:24,height:24});I.children(":not(.flyout_arrow_horiz)").remove();I.append(N).attr("data-curopt","#"+S[0].id).mouseup();v.setMode(R);p=S[0].id.substr((R+"_").length);b=L.data[p];$(".tools_flyout").fadeOut()}});K=$('<div id="shape_cats">');var Q="";$.each(C,function(S, $('<div id="shape_buttons">');$("#tools_shapelib > *").wrapAll(K);var H=$("#tools_shapelib_show");q("basic");$("#shape_buttons").mouseup(function(R){R=$(R.target).closest("div.tool_button");if(R.length){var N=R.children().clone().attr({width:24,height:24});H.children(":not(.flyout_arrow_horiz)").remove();H.append(N).attr("data-curopt","#"+R[0].id).mouseup();v.setMode(Q);p=R[0].id.substr((Q+"_").length);b=L.data[p];$(".tools_flyout").fadeOut()}});K=$('<div id="shape_cats">');var S="";$.each(C,function(R,
N){Q+="<div data-cat="+S+">"+N+"</div>"});K.html(Q).children().bind("mouseup",function(){var S=$(this);S.siblings().removeClass("current");S.addClass("current");q(S.attr("data-cat"));return false});K.children().eq(0).addClass("current");$("#tools_shapelib").prepend(K);I.mouseup(function(){v.setMode(b?R:"select")});$("#tool_shapelib").remove();K=$("#tools_shapelib").height();$("#tools_shapelib").css({"margin-top":-(K/2),"margin-left":3})},mouseDown:function(K){if(v.getMode()===R){var I=f=K.start_x; N){S+="<div data-cat="+R+">"+N+"</div>"});K.html(S).children().bind("mouseup",function(){var R=$(this);R.siblings().removeClass("current");R.addClass("current");q(R.attr("data-cat"));return false});K.children().eq(0).addClass("current");$("#tools_shapelib").prepend(K);H.mouseup(function(){v.setMode(b?Q:"select")});$("#tool_shapelib").remove();K=$("#tools_shapelib").height();$("#tools_shapelib").css({"margin-top":-(K/2),"margin-left":3})},mouseDown:function(K){if(v.getMode()===Q){var H=f=K.start_x;
K=c=K.start_y;var Q=v.getStyle();d=v.addSvgElementFromJson({element:"path",curStyles:true,attr:{d:b,id:v.getNextId(),opacity:Q.opacity/2,style:"pointer-events:none"}});d.setAttribute("d",b);if(/[a-z]/.test(b)){b=L.data[p]=v.pathActions.convertPath(d);d.setAttribute("d",b);v.pathActions.fixEnd(d)}d.setAttribute("transform","translate("+I+","+K+") scale(0.005) translate("+-I+","+-K+")");v.recalculateDimensions(d);v.getTransformList(d);u=d.getBBox();totalScale={sx:1,sy:1};return{started:true}}},mouseMove:function(K){if(v.getMode()=== K=c=K.start_y;var S=v.getStyle();d=v.addSvgElementFromJson({element:"path",curStyles:true,attr:{d:b,id:v.getNextId(),opacity:S.opacity/2,style:"pointer-events:none"}});d.setAttribute("d",b);if(/[a-z]/.test(b)){b=L.data[p]=v.pathActions.convertPath(d);d.setAttribute("d",b);v.pathActions.fixEnd(d)}d.setAttribute("transform","translate("+H+","+K+") scale(0.005) translate("+-H+","+-K+")");v.recalculateDimensions(d);v.getTransformList(d);u=d.getBBox();totalScale={sx:1,sy:1};return{started:true}}},mouseMove:function(K){if(v.getMode()===
R){var I=v.getZoom(),Q=K.event,S=K.mouse_x/I,N=K.mouse_y/I;K=v.getTransformList(d);var ga=d.getBBox();I=ga.x;var na=ga.y,X=ga.width,U=ga.height,ea=S-f,Aa=N-c,ja={x:Math.min(f,S),y:Math.min(c,N),width:Math.abs(S-f),height:Math.abs(N-c)},ba=ga=0;U=U?(U+Aa)/U:1;X=X?(X+ea)/X:1;X=ja.width/u.width;U=ja.height/u.height;X=X||1;U=U||1;if(S<f)ga=u.width;if(N<c)ba=u.height;S=m.createSVGTransform();N=m.createSVGTransform();ja=m.createSVGTransform();S.setTranslate(-(I+ga),-(na+ba));if(Q.shiftKey){replaced=true; Q){var H=v.getZoom(),S=K.event,R=K.mouse_x/H,N=K.mouse_y/H;K=v.getTransformList(d);var ga=d.getBBox();H=ga.x;var oa=ga.y,X=ga.width,U=ga.height,ea=R-f,Aa=N-c,ja={x:Math.min(f,R),y:Math.min(c,N),width:Math.abs(R-f),height:Math.abs(N-c)},ba=ga=0;U=U?(U+Aa)/U:1;X=X?(X+ea)/X:1;X=ja.width/u.width;U=ja.height/u.height;X=X||1;U=U||1;if(R<f)ga=u.width;if(N<c)ba=u.height;R=m.createSVGTransform();N=m.createSVGTransform();ja=m.createSVGTransform();R.setTranslate(-(H+ga),-(oa+ba));if(S.shiftKey){replaced=true;
Q=Math.min(Math.abs(X),Math.abs(U));X=Q*(X<0?-1:1);U=Q*(U<0?-1:1);if(totalScale.sx!=totalScale.sy){Q=totalScale.sx>totalScale.sy?1:totalScale.sx/totalScale.sy;X*=totalScale.sy>totalScale.sx?1:totalScale.sy/totalScale.sx;U*=Q}}totalScale.sx*=X;totalScale.sy*=U;N.setScale(X,U);ja.setTranslate(I+ga,na+ba);K.appendItem(ja);K.appendItem(N);K.appendItem(S);v.recalculateDimensions(d);u=d.getBBox()}},mouseUp:function(K){if(v.getMode()===R){if(K.mouse_x==f&&K.mouse_y==c)return{keep:false,element:d,started:false}; S=Math.min(Math.abs(X),Math.abs(U));X=S*(X<0?-1:1);U=S*(U<0?-1:1);if(totalScale.sx!=totalScale.sy){S=totalScale.sx>totalScale.sy?1:totalScale.sx/totalScale.sy;X*=totalScale.sy>totalScale.sx?1:totalScale.sy/totalScale.sx;U*=S}}totalScale.sx*=X;totalScale.sy*=U;N.setScale(X,U);ja.setTranslate(H+ga,oa+ba);K.appendItem(ja);K.appendItem(N);K.appendItem(R);v.recalculateDimensions(d);u=d.getBBox()}},mouseUp:function(K){if(v.getMode()===Q){if(K.mouse_x==f&&K.mouse_y==c)return{keep:false,element:d,started:false};
v.setMode("select");return{keep:true,element:d,started:false}}}}});(function(){for(var a=0,q=["ms","moz","webkit","o"],g=0;g<q.length&&!window.requestAnimationFrame;++g){window.requestAnimationFrame=window[q[g]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[q[g]+"CancelAnimationFrame"]||window[q[g]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var p=(new Date).getTime(),v=Math.max(0,16-(p-a)),d=window.setTimeout(function(){b(p+v)},v);a=p+v;return d};if(!window.cancelAnimationFrame)window.cancelAnimationFrame= v.setMode("select");return{keep:true,element:d,started:false}}}}});(function(){for(var a=0,q=["ms","moz","webkit","o"],g=0;g<q.length&&!window.requestAnimationFrame;++g){window.requestAnimationFrame=window[q[g]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[q[g]+"CancelAnimationFrame"]||window[q[g]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var p=(new Date).getTime(),v=Math.max(0,16-(p-a)),d=window.setTimeout(function(){b(p+v)},v);a=p+v;return d};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
function(b){clearTimeout(b)}})();(function(a){function q(s){var L=s.originalEvent;if(!L.touches||L.targetTouches.length===1&&L.touches.length===1){d.call(this,s);s=a(this);s.bind(u,g);s.bind(m,b)}else{clearTimeout(C);v.call(this)}}function g(s){if(C!=null){var L=s.originalEvent;s=L.changedTouches?L.changedTouches[0].pageX:L.pageX;L=L.changedTouches?L.changedTouches[0].pageY:L.pageY;var R=a(this).data("taphold.point");s=s-R.x;L=L-R.y;if(Math.sqrt(s*s+L*L)>c){clearTimeout(C);v.call(this)}}}function b(){clearTimeout(C);v.call(this)} function(b){clearTimeout(b)}})();(function(a){function q(s){var L=s.originalEvent;if(!L.touches||L.targetTouches.length===1&&L.touches.length===1){d.call(this,s);s=a(this);s.bind(u,g);s.bind(m,b)}else{clearTimeout(C);v.call(this)}}function g(s){if(C!=null){var L=s.originalEvent;s=L.changedTouches?L.changedTouches[0].pageX:L.pageX;L=L.changedTouches?L.changedTouches[0].pageY:L.pageY;var Q=a(this).data("taphold.point");s=s-Q.x;L=L-Q.y;if(Math.sqrt(s*s+L*L)>c){clearTimeout(C);v.call(this)}}}function b(){clearTimeout(C);v.call(this)}
function p(s){v.call(this);a(this).data("taphold.handler").call(this,s)}function v(){C=null;a(this).unbind(u,g);a(this).unbind(m,b)}function d(s){if(C==null){var L=this;C=setTimeout(function(){p.call(L,s)},f);var R=s.originalEvent,K={};K.x=R.changedTouches?R.changedTouches[0].pageX:R.pageX;K.y=R.changedTouches?R.changedTouches[0].pageY:R.pageY;a(this).data("taphold.point",K)}}var f=1E3,c=5,m="touchend",u="touchmove",C=null;a.event.special.taphold={setup:function(){},add:function(s){a(this).data("taphold.handler", function p(s){v.call(this);a(this).data("taphold.handler").call(this,s)}function v(){C=null;a(this).unbind(u,g);a(this).unbind(m,b)}function d(s){if(C==null){var L=this;C=setTimeout(function(){p.call(L,s)},f);var Q=s.originalEvent,K={};K.x=Q.changedTouches?Q.changedTouches[0].pageX:Q.pageX;K.y=Q.changedTouches?Q.changedTouches[0].pageY:Q.pageY;a(this).data("taphold.point",K)}}var f=1E3,c=5,m="touchend",u="touchmove",C=null;a.event.special.taphold={setup:function(){},add:function(s){a(this).data("taphold.handler",
s.handler);s.data?a(this).bind("touchstart",s.data,q):a(this).bind("touchstart",q)},remove:function(s){clearTimeout(C);v.call(this);s.data?a(this).unbind("touchstart",s.data,q):a(this).unbind("touchstart",q)},teardown:function(){}}})(jQuery); s.handler);s.data?a(this).bind("touchstart",s.data,q):a(this).bind("touchstart",q)},remove:function(s){clearTimeout(C);v.call(this);s.data?a(this).unbind("touchstart",s.data,q):a(this).unbind("touchstart",q)},teardown:function(){}}})(jQuery);