(function(){if(!("SVGPathSeg"in window)){window.SVGPathSeg=function(a,o,e){this.pathSegType=a;this.pathSegTypeAsLetter=o;this._owningPathSegList=e};SVGPathSeg.PATHSEG_UNKNOWN=0;SVGPathSeg.PATHSEG_CLOSEPATH=1;SVGPathSeg.PATHSEG_MOVETO_ABS=2;SVGPathSeg.PATHSEG_MOVETO_REL=3;SVGPathSeg.PATHSEG_LINETO_ABS=4;SVGPathSeg.PATHSEG_LINETO_REL=5;SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS=6;SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL=7;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS=8;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL=9;SVGPathSeg.PATHSEG_ARC_ABS= 10;SVGPathSeg.PATHSEG_ARC_REL=11;SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS=12;SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL=13;SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS=14;SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL=15;SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16;SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19;SVGPathSeg.prototype._segmentChanged=function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)}; window.SVGPathSegClosePath=function(a){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CLOSEPATH,"z",a)};SVGPathSegClosePath.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegClosePath.prototype.toString=function(){return"[object SVGPathSegClosePath]"};SVGPathSegClosePath.prototype._asPathString=function(){return this.pathSegTypeAsLetter};SVGPathSegClosePath.prototype.clone=function(){return new SVGPathSegClosePath(undefined)};window.SVGPathSegMovetoAbs=function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_MOVETO_ABS, "M",a);this._x=o;this._y=e};SVGPathSegMovetoAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegMovetoAbs.prototype.toString=function(){return"[object SVGPathSegMovetoAbs]"};SVGPathSegMovetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegMovetoAbs.prototype.clone=function(){return new SVGPathSegMovetoAbs(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegMovetoAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x= a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegMovetoAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegMovetoRel=function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_MOVETO_REL,"m",a);this._x=o;this._y=e};SVGPathSegMovetoRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegMovetoRel.prototype.toString=function(){return"[object SVGPathSegMovetoRel]"};SVGPathSegMovetoRel.prototype._asPathString= function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegMovetoRel.prototype.clone=function(){return new SVGPathSegMovetoRel(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegMovetoRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegMovetoRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoAbs= function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_ABS,"L",a);this._x=o;this._y=e};SVGPathSegLinetoAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoAbs.prototype.toString=function(){return"[object SVGPathSegLinetoAbs]"};SVGPathSegLinetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegLinetoAbs.prototype.clone=function(){return new SVGPathSegLinetoAbs(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegLinetoAbs.prototype, "x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegLinetoAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoRel=function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_REL,"l",a);this._x=o;this._y=e};SVGPathSegLinetoRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoRel.prototype.toString=function(){return"[object SVGPathSegLinetoRel]"}; SVGPathSegLinetoRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegLinetoRel.prototype.clone=function(){return new SVGPathSegLinetoRel(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegLinetoRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegLinetoRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()}, enumerable:true});window.SVGPathSegCurvetoCubicAbs=function(a,o,e,b,l,s,c){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,"C",a);this._x=o;this._y=e;this._x1=b;this._y1=l;this._x2=s;this._y2=c};SVGPathSegCurvetoCubicAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicAbs]"};SVGPathSegCurvetoCubicAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+ " "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicAbs.prototype.clone=function(){return new SVGPathSegCurvetoCubicAbs(undefined,this._x,this._y,this._x1,this._y1,this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true}); Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, "y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoCubicRel=function(a,o,e,b,l,s,c){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,"c",a);this._x=o;this._y=e;this._x1=b;this._y1=l;this._x2=s;this._y2=c};SVGPathSegCurvetoCubicRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicRel]"};SVGPathSegCurvetoCubicRel.prototype._asPathString= function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicRel.prototype.clone=function(){return new SVGPathSegCurvetoCubicRel(undefined,this._x,this._y,this._x1,this._y1,this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y",{get:function(){return this._y}, set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2= a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoQuadraticAbs=function(a,o,e,b,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",a);this._x=o;this._y=e;this._x1=b;this._y1=l};SVGPathSegCurvetoQuadraticAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticAbs.prototype.toString= function(){return"[object SVGPathSegCurvetoQuadraticAbs]"};SVGPathSegCurvetoQuadraticAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y};SVGPathSegCurvetoQuadraticAbs.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticAbs(undefined,this._x,this._y,this._x1,this._y1)};Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true}); Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true}); window.SVGPathSegCurvetoQuadraticRel=function(a,o,e,b,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL,"q",a);this._x=o;this._y=e;this._x1=b;this._y1=l};SVGPathSegCurvetoQuadraticRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticRel]"};SVGPathSegCurvetoQuadraticRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y}; SVGPathSegCurvetoQuadraticRel.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticRel(undefined,this._x,this._y,this._x1,this._y1)};Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype, "x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true});window.SVGPathSegArcAbs=function(a,o,e,b,l,s,c,g){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_ARC_ABS,"A",a);this._x=o;this._y=e;this._r1=b;this._r2=l;this._angle=s;this._largeArcFlag=c;this._sweepFlag=g};SVGPathSegArcAbs.prototype= Object.create(SVGPathSeg.prototype);SVGPathSegArcAbs.prototype.toString=function(){return"[object SVGPathSegArcAbs]"};SVGPathSegArcAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y};SVGPathSegArcAbs.prototype.clone=function(){return new SVGPathSegArcAbs(undefined,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)};Object.defineProperty(SVGPathSegArcAbs.prototype, "x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"r1",{get:function(){return this._r1},set:function(a){this._r1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"r2",{get:function(){return this._r2},set:function(a){this._r2= a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"angle",{get:function(){return this._angle},set:function(a){this._angle=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(a){this._largeArcFlag=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(a){this._sweepFlag= a;this._segmentChanged()},enumerable:true});window.SVGPathSegArcRel=function(a,o,e,b,l,s,c,g){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_ARC_REL,"a",a);this._x=o;this._y=e;this._r1=b;this._r2=l;this._angle=s;this._largeArcFlag=c;this._sweepFlag=g};SVGPathSegArcRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegArcRel.prototype.toString=function(){return"[object SVGPathSegArcRel]"};SVGPathSegArcRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+ this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y};SVGPathSegArcRel.prototype.clone=function(){return new SVGPathSegArcRel(undefined,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)};Object.defineProperty(SVGPathSegArcRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"y",{get:function(){return this._y}, set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"r1",{get:function(){return this._r1},set:function(a){this._r1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"r2",{get:function(){return this._r2},set:function(a){this._r2=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"angle",{get:function(){return this._angle},set:function(a){this._angle= a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(a){this._largeArcFlag=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(a){this._sweepFlag=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoHorizontalAbs=function(a,o){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS, "H",a);this._x=o};SVGPathSegLinetoHorizontalAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoHorizontalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalAbs]"};SVGPathSegLinetoHorizontalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x};SVGPathSegLinetoHorizontalAbs.prototype.clone=function(){return new SVGPathSegLinetoHorizontalAbs(undefined,this._x)};Object.defineProperty(SVGPathSegLinetoHorizontalAbs.prototype,"x",{get:function(){return this._x}, set:function(a){this._x=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoHorizontalRel=function(a,o){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL,"h",a);this._x=o};SVGPathSegLinetoHorizontalRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoHorizontalRel.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalRel]"};SVGPathSegLinetoHorizontalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x};SVGPathSegLinetoHorizontalRel.prototype.clone= function(){return new SVGPathSegLinetoHorizontalRel(undefined,this._x)};Object.defineProperty(SVGPathSegLinetoHorizontalRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoVerticalAbs=function(a,o){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS,"V",a);this._y=o};SVGPathSegLinetoVerticalAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoVerticalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalAbs]"}; SVGPathSegLinetoVerticalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y};SVGPathSegLinetoVerticalAbs.prototype.clone=function(){return new SVGPathSegLinetoVerticalAbs(undefined,this._y)};Object.defineProperty(SVGPathSegLinetoVerticalAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoVerticalRel=function(a,o){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL,"v",a); this._y=o};SVGPathSegLinetoVerticalRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoVerticalRel.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalRel]"};SVGPathSegLinetoVerticalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y};SVGPathSegLinetoVerticalRel.prototype.clone=function(){return new SVGPathSegLinetoVerticalRel(undefined,this._y)};Object.defineProperty(SVGPathSegLinetoVerticalRel.prototype,"y",{get:function(){return this._y}, set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoCubicSmoothAbs=function(a,o,e,b,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",a);this._x=o;this._y=e;this._x2=b;this._y2=l};SVGPathSegCurvetoCubicSmoothAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothAbs]"};SVGPathSegCurvetoCubicSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+ " "+this._x2+" "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicSmoothAbs.prototype.clone=function(){return new SVGPathSegCurvetoCubicSmoothAbs(undefined,this._x,this._y,this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()}, enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoCubicSmoothRel=function(a,o,e,b,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",a);this._x=o; this._y=e;this._x2=b;this._y2=l};SVGPathSegCurvetoCubicSmoothRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothRel]"};SVGPathSegCurvetoCubicSmoothRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicSmoothRel.prototype.clone=function(){return new SVGPathSegCurvetoCubicSmoothRel(undefined,this._x,this._y, this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a;this._segmentChanged()}, enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoQuadraticSmoothAbs=function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",a);this._x=o;this._y=e};SVGPathSegCurvetoQuadraticSmoothAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"}; SVGPathSegCurvetoQuadraticSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegCurvetoQuadraticSmoothAbs.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype, "y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoQuadraticSmoothRel=function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",a);this._x=o;this._y=e};SVGPathSegCurvetoQuadraticSmoothRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"};SVGPathSegCurvetoQuadraticSmoothRel.prototype._asPathString= function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegCurvetoQuadraticSmoothRel.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticSmoothRel(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y= a;this._segmentChanged()},enumerable:true});SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new SVGPathSegClosePath(undefined)};SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(a,o){return new SVGPathSegMovetoAbs(undefined,a,o)};SVGPathElement.prototype.createSVGPathSegMovetoRel=function(a,o){return new SVGPathSegMovetoRel(undefined,a,o)};SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(a,o){return new SVGPathSegLinetoAbs(undefined,a,o)};SVGPathElement.prototype.createSVGPathSegLinetoRel= function(a,o){return new SVGPathSegLinetoRel(undefined,a,o)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(a,o,e,b,l,s){return new SVGPathSegCurvetoCubicAbs(undefined,a,o,e,b,l,s)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(a,o,e,b,l,s){return new SVGPathSegCurvetoCubicRel(undefined,a,o,e,b,l,s)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(a,o,e,b){return new SVGPathSegCurvetoQuadraticAbs(undefined,a,o,e,b)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel= function(a,o,e,b){return new SVGPathSegCurvetoQuadraticRel(undefined,a,o,e,b)};SVGPathElement.prototype.createSVGPathSegArcAbs=function(a,o,e,b,l,s,c){return new SVGPathSegArcAbs(undefined,a,o,e,b,l,s,c)};SVGPathElement.prototype.createSVGPathSegArcRel=function(a,o,e,b,l,s,c){return new SVGPathSegArcRel(undefined,a,o,e,b,l,s,c)};SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(a){return new SVGPathSegLinetoHorizontalAbs(undefined,a)};SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel= function(a){return new SVGPathSegLinetoHorizontalRel(undefined,a)};SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(a){return new SVGPathSegLinetoVerticalAbs(undefined,a)};SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(a){return new SVGPathSegLinetoVerticalRel(undefined,a)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(a,o,e,b){return new SVGPathSegCurvetoCubicSmoothAbs(undefined,a,o,e,b)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel= function(a,o,e,b){return new SVGPathSegCurvetoCubicSmoothRel(undefined,a,o,e,b)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(a,o){return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined,a,o)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(a,o){return new SVGPathSegCurvetoQuadraticSmoothRel(undefined,a,o)}}if(!("SVGPathSegList"in window)){window.SVGPathSegList=function(a){this._pathElement=a;this._list=this._parsePath(this._pathElement.getAttribute("d")); this._mutationObserverConfig={attributes:true,attributeFilter:["d"]};this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this));this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)};Object.defineProperty(SVGPathSegList.prototype,"numberOfItems",{get:function(){this._checkPathSynchronizedToList();return this._list.length},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"pathSegList",{get:function(){if(!this._pathSegList)this._pathSegList= new SVGPathSegList(this);return this._pathSegList},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"normalizedPathSegList",{get:function(){return this.pathSegList},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"animatedPathSegList",{get:function(){return this.pathSegList},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"animatedNormalizedPathSegList",{get:function(){return this.pathSegList},enumerable:true});SVGPathSegList.prototype._checkPathSynchronizedToList= function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())};SVGPathSegList.prototype._updateListFromPathMutations=function(a){if(this._pathElement){var o=false;a.forEach(function(e){if(e.attributeName=="d")o=true});if(o)this._list=this._parsePath(this._pathElement.getAttribute("d"))}};SVGPathSegList.prototype._writeListToPath=function(){this._pathElementMutationObserver.disconnect();this._pathElement.setAttribute("d",SVGPathSegList._pathSegArrayAsString(this._list)); this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)};SVGPathSegList.prototype.segmentChanged=function(){this._writeListToPath()};SVGPathSegList.prototype.clear=function(){this._checkPathSynchronizedToList();this._list.forEach(function(a){a._owningPathSegList=null});this._list=[];this._writeListToPath()};SVGPathSegList.prototype.initialize=function(a){this._checkPathSynchronizedToList();this._list=[a];a._owningPathSegList=this;this._writeListToPath();return a}; SVGPathSegList.prototype._checkValidIndex=function(a){if(isNaN(a)||a<0||a>=this.numberOfItems)throw"INDEX_SIZE_ERR";};SVGPathSegList.prototype.getItem=function(a){this._checkPathSynchronizedToList();this._checkValidIndex(a);return this._list[a]};SVGPathSegList.prototype.insertItemBefore=function(a,o){this._checkPathSynchronizedToList();if(o>this.numberOfItems)o=this.numberOfItems;if(a._owningPathSegList)a=a.clone();this._list.splice(o,0,a);a._owningPathSegList=this;this._writeListToPath();return a}; SVGPathSegList.prototype.replaceItem=function(a,o){this._checkPathSynchronizedToList();if(a._owningPathSegList)a=a.clone();this._checkValidIndex(o);this._list[o]=a;a._owningPathSegList=this;this._writeListToPath();return a};SVGPathSegList.prototype.removeItem=function(a){this._checkPathSynchronizedToList();this._checkValidIndex(a);var o=this._list[a];this._list.splice(a,1);this._writeListToPath();return o};SVGPathSegList.prototype.appendItem=function(a){this._checkPathSynchronizedToList();if(a._owningPathSegList)a= a.clone();this._list.push(a);a._owningPathSegList=this;this._writeListToPath();return a};SVGPathSegList._pathSegArrayAsString=function(a){var o="",e=true;a.forEach(function(b){if(e){e=false;o+=b._asPathString()}else o+=" "+b._asPathString()});return o};SVGPathSegList.prototype._parsePath=function(a){if(!a||a.length==0)return[];var o=this,e=function(){this.pathSegList=[]};e.prototype.appendSegment=function(l){this.pathSegList.push(l)};var b=function(l){this._string=l;this._currentIndex=0;this._endIndex= this._string.length;this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN;this._skipOptionalSpaces()};b.prototype._isCurrentSpace=function(){var l=this._string[this._currentIndex];return l<=" "&&(l==" "||l=="\n"||l=="\t"||l=="\r"||l=="\u000c")};b.prototype._skipOptionalSpaces=function(){for(;this._currentIndex="0"&&l<="9")&&s!=SVGPathSeg.PATHSEG_CLOSEPATH){if(s==SVGPathSeg.PATHSEG_MOVETO_ABS)return SVGPathSeg.PATHSEG_LINETO_ABS;if(s==SVGPathSeg.PATHSEG_MOVETO_REL)return SVGPathSeg.PATHSEG_LINETO_REL;return s}return SVGPathSeg.PATHSEG_UNKNOWN};b.prototype.initialCommandIsMoveTo=function(){if(!this.hasMoreData())return true;var l=this.peekSegmentType();return l==SVGPathSeg.PATHSEG_MOVETO_ABS|| l==SVGPathSeg.PATHSEG_MOVETO_REL};b.prototype._parseNumber=function(){var l=0,s=0,c=1,g=0,d=1,p=1,w=this._currentIndex;this._skipOptionalSpaces();if(this._currentIndex"9")&&this._string.charAt(this._currentIndex)!= ".")){for(var B=this._currentIndex;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!=B)for(var v=this._currentIndex-1,N=1;v>=B;){s+=N*(this._string.charAt(v--)-"0");N*=10}if(this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)> "9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)g+=(this._string.charAt(this._currentIndex++)-"0")*(c*=0.1)}if(this._currentIndex!=w&&this._currentIndex+1=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";){l*=10;l+=this._string.charAt(this._currentIndex)-"0";this._currentIndex++}}s=s+g;s*=d;if(l)s*=Math.pow(10,p*l);if(w!=this._currentIndex){this._skipOptionalSpacesOrDelimiter(); return s}}};b.prototype._parseArcFlag=function(){if(!(this._currentIndex>=this._endIndex)){var l=false;l=this._string.charAt(this._currentIndex++);if(l=="0")l=false;else if(l=="1")l=true;else return;this._skipOptionalSpacesOrDelimiter();return l}};b.prototype.parseSegment=function(){var l=this._string[this._currentIndex],s=this._pathSegTypeFromChar(l);if(s==SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand==SVGPathSeg.PATHSEG_UNKNOWN)return null;s=this._nextCommandHelper(l,this._previousCommand); if(s==SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;this._previousCommand=s;switch(s){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(o,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(o,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(o,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(o,this._parseNumber(), this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(o,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(o,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(o,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(o,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:this._skipOptionalSpaces(); return new SVGPathSegClosePath(o);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:l={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(o,l.x,l.y,l.x1,l.y1,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:l={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(o, l.x,l.y,l.x1,l.y1,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:l={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(o,l.x,l.y,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:l={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(o,l.x,l.y,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:l={x1:this._parseNumber(), y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(o,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:l={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticAbs(o,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(o,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(o, this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_ARC_REL:l={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcRel(o,l.x,l.y,l.x1,l.y1,l.arcAngle,l.arcLarge,l.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS:l={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(), x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcAbs(o,l.x,l.y,l.x1,l.y1,l.arcAngle,l.arcLarge,l.arcSweep);default:throw"Unknown path seg type.";}};e=new e;a=new b(a);if(!a.initialCommandIsMoveTo())return[];for(;a.hasMoreData();){b=a.parseSegment();if(!b)return[];e.appendSegment(b)}return e.pathSegList}}})();function touchHandler(a){var o=a.changedTouches,e=o[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var l=document.createEvent("MouseEvent");l.initMouseEvent(b,true,true,window,1,e.screenX,e.screenY,e.clientX,e.clientY,false,false,false,false,0,null);if(o.length<2){e.target.dispatchEvent(l);a.preventDefault()}};(function(a){function o(e){if(typeof e.data==="string"){var b=e.handler,l=e.data.toLowerCase().split(" ");e.handler=function(s){if(!(this!==s.target&&(/textarea|select/i.test(s.target.nodeName)||s.target.type==="text"))){var c=s.type!=="keypress"&&a.hotkeys.specialKeys[s.which],g=String.fromCharCode(s.which).toLowerCase(),d="",p={};if(s.altKey&&c!=="alt")d+="alt+";if(s.ctrlKey&&c!=="ctrl")d+="ctrl+";if(s.metaKey&&!s.ctrlKey&&c!=="meta")d+="meta+";if(s.shiftKey&&c!=="shift")d+="shift+";if(c)p[d+c]= true;else{p[d+g]=true;p[d+a.hotkeys.shiftNums[g]]=true;if(d==="shift+")p[a.hotkeys.shiftNums[g]]=true}c=0;for(g=l.length;c","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:o}})})(jQuery);(function(a,o){function e(da){return typeof da==="string"}function b(da){var U=d.call(arguments,1);return function(){return da.apply(this,U.concat(d.call(arguments)))}}function l(da,U,X,na,oa){var ma;if(na!==g){U=X.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);X=U[3]||"";if(oa===2&&e(na))na=na.replace(da?ga:Y,"");else{ma=v(U[2]);na=e(na)?v[da?Z:L](na):na;na=oa===2?na:oa===1?a.extend({},na,ma):a.extend({},ma,na);na=w(na);if(da)na=na.replace(Ba,p)}da=U[1]+(da?"#":na||!U[1]?"?":"")+na+X}else da= U(X!==g?X:o[qa][aa]);return da}function s(da,U,X){if(U===g||typeof U==="boolean"){X=U;U=w[da?Z:L]()}else U=e(U)?U.replace(da?ga:Y,""):U;return v(U,X)}function c(da,U,X,na){if(!e(X)&&typeof X!=="object"){na=X;X=U;U=g}return this.each(function(){var oa=a(this),ma=U||S()[(this.nodeName||"").toLowerCase()]||"",la=ma&&oa.attr(ma)||"";oa.attr(ma,w[da](la,X,na))})}var g,d=Array.prototype.slice,p=decodeURIComponent,w=a.param,B,v,N,Q=a.bbq=a.bbq||{},K,I,S,R=a.event.special,L="querystring",Z="fragment",qa= "location",aa="href",Y=/^.*\?|#.*$/g,ga=/^.*\#/,Ba,ja={};w[L]=b(l,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});w[Z]=B=b(l,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});B.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);Ba=RegExp(da.join("|"),"g")};B.noEscape(",/");a.deparam=v=function(da,U){var X={},na={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(oa,ma){var la=ma.split("="),ya=p(la[0]),za=X,Ja= 0,Ia=ya.split("]["),Fa=Ia.length-1;if(/\[/.test(Ia[0])&&/\]$/.test(Ia[Fa])){Ia[Fa]=Ia[Fa].replace(/\]$/,"");Ia=Ia.shift().split("[").concat(Ia);Fa=Ia.length-1}else Fa=0;if(la.length===2){la=p(la[1]);if(U)la=la&&!isNaN(la)?+la:la==="undefined"?g:na[la]!==g?na[la]:la;if(Fa)for(;Ja<=Fa;Ja++){ya=Ia[Ja]===""?za.length:Ia[Ja];za=za[ya]=Ja').hide().insertAfter("body")[0].contentWindow; I=function(){return b(Q.document[c][g])};K=function(S,R){if(S!==R){var L=Q.document;L.open().close();L[c].hash="#"+S}};K(b())}}var v={},N,Q,K,I;v.start=function(){if(!N){var S=b();K||B();(function R(){var L=b(),Z=I(S);if(L!==S){K(S=L,Z);a(o).trigger("hashchange")}else if(Z!==S)o[c][g]=o[c][g].replace(/#.*/,"")+"#"+Z;N=setTimeout(R,a.hashchangeDelay)})()}};v.stop=function(){if(!Q){N&&clearTimeout(N);N=0}};return v}()})(jQuery,this);(function(a){var o={},e;a.svgIcons=function(b,l){function s(da,U){if(da!=="ajax"){if(S)return;var X=(Q=aa[0].contentDocument)&&Q.getElementById("svg_eof");if(!X&&!(U&&X)){R++;if(R<50)setTimeout(s,20);else{g();S=true}return}S=true}N=a(Q.firstChild).children();if(l.no_img)setTimeout(function(){I||c()},500);else{X=qa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";K=a(new Image).attr({src:X,width:0,height:0}).appendTo("body").load(function(){c(true)}).error(function(){c()})}} function c(da,U){if(!I){if(l.no_img)da=false;if(da){var X=a(document.createElement("div"));X.hide().appendTo("body")}if(U){var na=l.fallback_path?l.fallback_path:"";a.each(U,function(Fa,Ma){a("#"+Fa);var Da=a(new Image).attr({"class":"svg_icon",src:na+Ma,width:B,height:v,alt:"icon"});ja(Da,Fa)})}else for(var oa=N.length,ma=0;ma0&&!da)wa=e(wa,Da,true);Ba(a(this),wa,Ma)})});if(!U){da&&X.remove();aa&&aa.remove();K&&K.remove()}l.resize&&a.resizeSvgIcons(l.resize);I=true;l.callback&&l.callback(o)}}function g(){if(b.indexOf(".svgz")!=-1){var da=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(da,l)}else l.fallback&&c(false,l.fallback)} function d(da){if(window.btoa)return window.btoa(da);var U=Array(Math.floor((da.length+2)/3)*4),X,na,oa,ma,la,ya,za=0,Ja=0;do{X=da.charCodeAt(za++);na=da.charCodeAt(za++);oa=da.charCodeAt(za++);ma=X>>2;X=(X&3)<<4|na>>4;la=(na&15)<<2|oa>>6;ya=oa&63;if(isNaN(na))la=ya=64;else if(isNaN(oa))ya=64;U[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);U[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(X);U[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la); U[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ya)}while(za-1&&L.indexOf("Chrome/");var qa="data:image/svg+xml;charset=utf-8;base64,";if(l.svgz){var aa=a('').appendTo("body").hide();try{Q=aa[0].contentDocument;aa.load(s); s(0,true)}catch(Y){g()}}else{var ga=new DOMParser;a.ajax({url:b,dataType:"string",success:function(da){if(da){Q=ga.parseFromString(da,"text/xml");a(function(){s("ajax")})}else a(g)},error:function(da){if(window.opera)a(function(){g()});else if(da.responseText){Q=ga.parseFromString(da.responseText,"text/xml");Q.childNodes.length||a(g);a(function(){s("ajax")})}else a(g)}})}var Ba=function(da,U,X,na){Z&&U.css("visibility","hidden");if(l.replace){na&&U.attr("id",X);(X=da.attr("class"))&&U.attr("class", "svg_icon "+X);da.replaceWith(U)}else da.append(U);Z&&setTimeout(function(){U.removeAttr("style")},1)},ja=function(da,U){if(l.id_match===undefined||l.id_match!==false)Ba(holder,da,U,true);o[U]=da};e=function(da,U){var X=da.find("defs");if(!X.length)return da;X=Z?X.find("*").filter(function(){return!!this.id}):X.find("[id]");var na=da[0].getElementsByTagName("*"),oa=na.length;X.each(function(ma){var la=this.id;a(Q).find("#"+la);this.id=ma="x"+la+U+ma;la="url(#"+la+")";var ya="url(#"+ma+")";for(ma= 0;ma=0;jQuery.fn.jGraduate=function(b){var l= arguments;return this.each(function(){function s(ia,ba,ka,M,P){var ea=P||a("stop",{"stop-color":ba,"stop-opacity":ka,offset:ia},ga);if(P){ba=P.getAttribute("stop-color");ka=P.getAttribute("stop-opacity");ia=P.getAttribute("offset")}else ga.appendChild(ea);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*Z)+", 26)"},kb);var Ea= a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:ba,"fill-opacity":ka,transform:"translate("+(10+ia*Z)+", 26)",stroke:"#000","stroke-width":1.5},kb);$(Ea).mousedown(function(Oa){c(this);Va=cb;S.mousemove(p).mouseup(g);ta=vb.offset();Oa.preventDefault();return false}).data("stop",ea).data("bg",P).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Wa=+ea.getAttribute("stop-opacity")|| 1,Za=ea.getAttribute("stop-color")||1,nb=(parseFloat(Wa)*255).toString(16);nb.length<2;)nb="0"+nb;ba=Za.substr(1)+nb;$("#"+v+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:B.images.clientPath},color:{active:ba,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);ea.setAttribute("stop-color", Za);ea.setAttribute("stop-opacity",Wa);$("div.jGraduate_LightBox").hide();$("#"+v+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+v+"_jGraduate_stopPicker").hide()})});$(ga).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ia){if(!ba){var Wa=this.getAttribute("stop-color"),Za=this.getAttribute("stop-opacity");ea.setAttribute("stop-color",Wa);Ea.setAttribute("fill",Wa);ea.setAttribute("stop-opacity",Za===null?1:Za);Ea.setAttribute("fill-opacity", Za===null?1:Za)}Oa.before(ea);return false}});M&&c(Ea);return ea}function c(ia){cb&&cb.setAttribute("stroke","#000");ia.setAttribute("stroke","blue");cb=ia;cb.parentNode.appendChild(cb)}function g(){S.unbind("mousemove",p);if(Ga.getAttribute("display")!=="none"){Ga.setAttribute("display","none");var ia=$(cb),ba=ia.data("stop");ia=ia.data("bg");$([cb,ba,ia]).remove()}Va=null}function d(){var ia=Sa?"rotate("+Sa+","+Ha+","+db+") ":"";$a===1&&Ka===1?ga.removeAttribute("gradientTransform"):ga.setAttribute("gradientTransform", ia+"translate("+-Ha*($a-1)+","+-db*(Ka-1)+") scale("+$a+","+Ka+")")}function p(ia){var ba=ia.pageX-ta.left;ia=ia.pageY-ta.top;ba=ba<10?10:ba>Z+10?Z+10:ba;var ka="translate("+ba+", 26)";if(ia<-60||ia>130){Ga.setAttribute("display","block");Ga.setAttribute("transform",ka)}else Ga.setAttribute("display","none");Va.setAttribute("transform",ka);$.data(Va,"bg").setAttribute("transform",ka);$.data(Va,"stop").setAttribute("offset",(ba-10)/Z);var M=0;$(ga).find("stop").each(function(){var P=this.getAttribute("offset"), ea=$(this);if(P
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var R=$(N+"> .jGraduate_colPick"),L=$(N+"> .jGraduate_gradPick");L.html('

    '+B.window.pickerTitle+'


    ');var Z=256,qa=Z-0,aa=Z-0,Y,ga,Ba,ja={};$(".jGraduate_SliderBar").width(145);var da=$("#"+v+"_jGraduate_GradContainer")[0],U=a("svg",{id:v+"_jgraduate_svg",width:Z,height:Z,xmlns:o.svg},da);Y=Y||w.paint.type;var X=ga=w.paint[Y],na=w.paint.alpha,oa=Y==="solidColor";switch(Y){case "solidColor":case "linearGradient":if(!oa){ga.id=v+"_lg_jgraduate_grad";X= ga=U.appendChild(ga)}a("radialGradient",{id:v+"_rg_jgraduate_grad"},U);if(Y==="linearGradient")break;case "radialGradient":if(!oa){ga.id=v+"_rg_jgraduate_grad";X=ga=U.appendChild(ga)}a("linearGradient",{id:v+"_lg_jgraduate_grad",x1:0,y1:0,x2:1,y2:0},U)}if(oa){X=ga=$("#"+v+"_lg_jgraduate_grad")[0];I=w.paint[Y];s(0,"#"+I,1);var ma=typeof B.newstop;if(ma==="string")switch(B.newstop){case "same":s(1,"#"+I,1);break;case "inverse":ma="";if(I.length===3)I=I.split("").map(function(ia){return ia+""+ia}).join(""); for(var la=0;la<6;la+=2){I.substr(la,2);var ya=(255-parseInt(I.substr(la,2),16)).toString(16);if(ya.length<2)ya=0+ya;ma+=ya}console.log(ma);s(1,"#"+ma,1);break;case "white":s(1,"#ffffff",1);break;case "black":s(1,"#000000",1)}else if(ma==="object")s(1,B.newstop.color||"#"+I,"opac"in B.newstop?B.newstop.opac:1)}I=parseFloat(X.getAttribute("x1")||0);ma=parseFloat(X.getAttribute("y1")||0);la=parseFloat(X.getAttribute("x2")||1);ya=parseFloat(X.getAttribute("y2")||0);var za=parseFloat(X.getAttribute("cx")|| 0.5),Ja=parseFloat(X.getAttribute("cy")||0.5),Ia=parseFloat(X.getAttribute("fx")||za),Fa=parseFloat(X.getAttribute("fy")||Ja);Ba=a("rect",{id:v+"_jgraduate_rect",x:0,y:0,width:qa,height:aa,fill:"url(#"+v+"_jgraduate_grad)","fill-opacity":na/100},U);var Ma=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*Z,left:I*Z}).data("coord","start").appendTo(da),Da=Ma.clone().text(2).css({top:ya*Z,left:la*Z}).attr("title","End stop").data("coord","end").appendTo(da), wa=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ja*Z,left:za*Z}).data("coord","center").appendTo(da),ra=wa.clone().text("F").css({top:Fa*Z,left:Ia*Z,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);ra[0].id=v+"_jGraduate_focusCoord";$(N+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ia,ba){var ka=ga.getAttribute(ba),M=isNaN(ba[1]);ka||(ka=M?"0.5":ba==="x2"?"1.0":"0.0");ja[ba]=$("#"+v+"_jGraduate_"+ ba).val(ka).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>1)this.value=1;if(!(ba[0]==="f"&&!eb))if(M&&Y==="radialGradient"||!M&&Y==="linearGradient")ga.setAttribute(ba,this.value);var P=M?ba[0]==="c"?wa:ra:ba[1]==="1"?Ma:Da,ea=ba.indexOf("x")>=0?"left":"top";P.css(ea,this.value*Z)}).change()});var va,kb,vb=$("#"+v+"_jGraduate_StopSlider"),cb,Ta,Va,Ga=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,Ha=za,db=Ja;Ta=a("svg",{width:"100%",height:45},vb[0]);da=a("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Ta);a("image",{width:16,height:16},da).setAttributeNS(o.xlink,"xlink:href",B.images.clientPath+"map-opacity.png");$(Ta).on("click touchstart",function(ia){ta=vb.offset();if(ia.target.tagName!=="path"){var ba=ia.pageX-ta.left-8;ba=ba<10?10:ba>Z+10?Z+10:ba;s(ba/Z,0,0,true);ia.stopPropagation()}});$(Ta).mouseover(function(){Ta.appendChild(Ga)}); kb=a("g",{},Ta);a("line",{x1:10,y1:15,x2:Z+10,y2:15,"stroke-width":2,stroke:"#000"},Ta);var lb=L.find(".jGraduate_spreadMethod").change(function(){ga.setAttribute("spreadMethod",$(this).val())}),Ua=null,Xa=function(ia){var ba=ia.pageX-hb.left,ka=ia.pageY-hb.top;ba=ba<0?0:ba>Z?Z:ba;ka=ka<0?0:ka>Z?Z:ka;Ua.css("left",ba).css("top",ka);ba=ba/qa;ka=ka/aa;var M=Ua.data("coord"),P=ga;switch(M){case "start":ja.x1.val(ba);ja.y1.val(ka);P.setAttribute("x1",ba);P.setAttribute("y1",ka);break;case "end":ja.x2.val(ba); ja.y2.val(ka);P.setAttribute("x2",ba);P.setAttribute("y2",ka);break;case "center":ja.cx.val(ba);ja.cy.val(ka);P.setAttribute("cx",ba);P.setAttribute("cy",ka);Ha=ba;db=ka;d();break;case "focus":ja.fx.val(ba);ja.fy.val(ka);P.setAttribute("fx",ba);P.setAttribute("fy",ka);d()}ia.preventDefault()},wb=function(){Ua=null;S.unbind("mousemove",Xa).unbind("mouseup",wb)};va=ga.getElementsByTagNameNS(o.svg,"stop");if(sa<2){for(;sa<2;){ga.appendChild(document.createElementNS(o.svg,"stop"));++sa}va=ga.getElementsByTagNameNS(o.svg, "stop")}var sa=va.length;for(la=0;la99.5)M=99.5;if(M>0)Ka=1-M/100;else $a=-(M/100)-1;P=145*((M+100)/2)/100;ea&&d();break;case "angle":Sa=M;P=Sa/180;P+=0.5;P*=145;ea&&d()}if(P>145)P=145;else if(P<0)P=0;ka.css({"margin-left":P-5})}).change()});var ob=function(ia){var ba=ia.pageX-ab.offset.left-parseInt(ab.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var ka=ba-5;ba/=145;switch(ab.type){case "radius":ba=Math.pow(ba*2,2.5);if(ba>0.98&&ba<1.02)ba=1;if(ba<=0.01)ba=0.01;ga.setAttribute("r",ba);break; case "opacity":w.paint.alpha=parseInt(ba*100);Ba.setAttribute("fill-opacity",ba);break;case "ellip":Ka=$a=1;if(ba<0.5){ba/=0.5;$a=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5;ba=2-ba;Ka=ba<=0?0.01:ba}d();ba-=1;if(Ka===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Sa=ba*=180;d();ba/=100}ab.elem.css({"margin-left":ka});ba=Math.round(ba*100);ab.input.val(ba);ia.preventDefault()},pb=function(){S.unbind("mousemove",ob).unbind("mouseup",pb);ab=null};for(L=(w.paint.alpha*255/100).toString(16);L.length<2;)L="0"+ L;L=L.split(".")[0];I=w.paint.solidColor=="none"?"":w.paint.solidColor+L;oa||(I=va[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});R.jPicker({window:{title:B.window.pickerTitle},images:{clientPath:B.images.clientPath},color:{active:I,alphaSupport:true}},function(ia){w.paint.type="solidColor";w.paint.alpha=ia.val("ahex")?Math.round(ia.val("a")/255*100):100;w.paint.solidColor=ia.val("hex")?ia.val("hex"):"none";w.paint.radialGradient= null;Q()},null,function(){K()});var fb=$(N+" .jGraduate_tabs li");fb.on("click touchstart",function(){fb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");$(N+" > div").hide();var ia=$(this).attr("data-type");$(N+" .jGraduate_gradPick").show();if(ia==="rg"||ia==="lg"){$(".jGraduate_"+ia+"_field").show();$(".jGraduate_"+(ia==="lg"?"rg":"lg")+"_field").hide();$("#"+v+"_jgraduate_rect")[0].setAttribute("fill","url(#"+v+"_"+ia+"_jgraduate_grad)");Y=ia==="lg"?"linearGradient": "radialGradient";$("#"+v+"_jGraduate_OpacInput").val(w.paint.alpha).change();var ba=$("#"+v+"_"+ia+"_jgraduate_grad")[0];if(ga!==ba){var ka=$(ga).find("stop");$(ba).empty().append(ka);ga=ba;ba=lb.val();ga.setAttribute("spreadMethod",ba)}eb=ia==="rg"&&ga.getAttribute("fx")!=null&&!(za==Ia&&Ja==Fa);$("#"+v+"_jGraduate_focusCoord").toggle(eb);if(eb)$("#"+v+"_jGraduate_match_ctr")[0].checked=false}else{$(N+" .jGraduate_gradPick").hide();$(N+" .jGraduate_colPick").show()}});$(N+" > div").hide();fb.removeClass("jGraduate_tab_current"); var tb;switch(w.paint.type){case "linearGradient":tb=$(N+" .jGraduate_tab_lingrad");break;case "radialGradient":tb=$(N+" .jGraduate_tab_radgrad");break;default:tb=$(N+" .jGraduate_tab_color")}w.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),o=$(document);$.extend($.fn,{contextMenu:function(e,b){if(e.menu==undefined)return false;if(e.inSpeed==undefined)e.inSpeed=150;if(e.outSpeed==undefined)e.outSpeed=75;if(e.inSpeed==0)e.inSpeed=-1;if(e.outSpeed==0)e.outSpeed=-1;$(this).each(function(){var l=$(this),s=$(l).offset(),c=$("#"+e.menu);c.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(p){var w=$(this);w.unbind("mouseup");$(".contextMenu").hide();if(d.button===2|| e.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||g(p,d,w)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var p=$(this);p.unbind("mouseup");g(d,d,p)});var g=function(d,p,w){if(typeof p=="undefined")p=d;d.stopPropagation();if(l.hasClass("disabled")||p.altKey)return false;var B=d.pageX,v=d.pageY;if(svgedit.browser.isTouch()){B=d.originalEvent.touches[0].pageX;v=d.originalEvent.touches[0].pageY}d=a.width()-c.width();p=a.height()-c.height();if(B>d-15)B=d-15; if(v>p-30)v=p-30;if(svgedit.browser.isTouch())v-=c.height()/2;o.unbind("click");c.css({top:v,left:B}).fadeIn(e.inSpeed);c.find("A").mouseover(function(){c.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){c.find("LI.hover").removeClass("hover")});o.keypress(function(N){switch(N.keyCode){case 38:if(c.find("LI.hover").length){c.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:last").addClass("hover")}else c.find("LI:last").addClass("hover"); break;case 40:if(c.find("LI.hover").length==0)c.find("LI:first").addClass("hover");else{c.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:first").addClass("hover")}break;case 13:c.find("LI.hover A").trigger("click");break;case 27:o.trigger("click")}});c.find("A").unbind("mouseup");c.find("LI:not(.disabled) A").mouseup(function(){o.unbind("click").unbind("keypress");$(".contextMenu").hide();b&&b($(this).attr("href").substr(1), $(w),{x:B-s.left,y:v-s.top,docX:B,docY:v});return false});setTimeout(function(){o.click(function(){o.unbind("click").unbind("keypress");c.fadeOut(e.outSpeed);return false})},0)};if($.browser.mozilla)$("#"+e.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+e.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+e.menu).each(function(){$(this).bind("mousedown.disableTextSelect",function(){return false})});$(l).add($("UL.contextMenu")).bind("contextmenu", function(){return false})});return $(this)},disableContextMenuItems:function(e){if(e==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(e!=undefined)for(var b=e.split(","),l=0;l=0,s=o.indexOf("Gecko/")>=0,c=o.indexOf("MSIE")>=0,g=o.indexOf("Chrome/")>=0,d=o.indexOf("Windows")>=0,p=o.indexOf("Macintosh")>= 0,w="ontouchstart"in window,B=!!e.querySelector,v=!!document.evaluate,N=function(){var L=document.createElementNS("http://www.w3.org/2000/svg","svg"),Z=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(L);Z.setAttribute("x",5);L.appendChild(Z);var qa=document.createElementNS("http://www.w3.org/2000/svg","text");qa.textContent="a";Z.appendChild(qa);Z=qa.getStartPositionOfChar(0);Z=Z.x;document.documentElement.removeChild(L);return Z===0}(),Q=function(){var L= document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(L);var Z=document.createElementNS("http://www.w3.org/2000/svg","path");Z.setAttribute("d","M0,0 C0,0 10,10 10,0");L.appendChild(Z);Z=Z.getBBox();document.documentElement.removeChild(L);return Z.height>4&&Z.height<5}(),K=function(){var L=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(L);var Z=document.createElementNS("http://www.w3.org/2000/svg","path"); Z.setAttribute("d","M0,0 10,0");var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M5,0 15,0");var aa=document.createElementNS("http://www.w3.org/2000/svg","g");aa.appendChild(Z);aa.appendChild(qa);L.appendChild(aa);Z=aa.getBBox();document.documentElement.removeChild(L);return Z.width==15}(),I=function(){var L=document.createElementNS("http://www.w3.org/2000/svg","rect");L.setAttribute("x",0.1);(L=L.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n Please upgrade to the latest version in which the problems have been fixed."); return L}(),S=function(){var L=document.createElementNS("http://www.w3.org/2000/svg","rect");L.setAttribute("style","vector-effect:non-scaling-stroke");return L.style.vectorEffect==="non-scaling-stroke"}(),R=function(){var L=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,Z=e.createSVGTransform();L.appendItem(Z);return L.getItem(0)==Z}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return l};svgedit.browser.isGecko=function(){return s}; svgedit.browser.isIE=function(){return c};svgedit.browser.isChrome=function(){return g};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return p};svgedit.browser.isTouch=function(){return w};svgedit.browser.supportsSelectors=function(){return B};svgedit.browser.supportsXpath=function(){return v};svgedit.browser.supportsPathBBox=function(){return Q};svgedit.browser.supportsHVLineContainerBBox=function(){return K};svgedit.browser.supportsGoodTextCharPos=function(){return N}; svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return I};svgedit.browser.supportsNonScalingStroke=function(){return S};svgedit.browser.supportsNativeTransformLists=function(){return R}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; (function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),o={};svgedit.transformlist.SVGTransformList=function(e){this._elem=e||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var l=0;l=0)return this._xforms[b];throw{code:1};};this.insertItemBefore=function(b,l){var s=null;if(l>=0)if(l=0){this._removeFromOtherLists(b);s=this._xforms[l]=b;this._list._update()}return s};this.removeItem=function(b){if(b=0){for(var l=this._xforms[b],s=Array(this.numberOfItems- 1),c=0;c1;)b=o[e-1].multiply(b);if(Math.abs(b.a)<1.0E-14)b.a=0;if(Math.abs(b.b)<1.0E-14)b.b=0;if(Math.abs(b.c)<1.0E-14)b.c=0;if(Math.abs(b.d)< 1.0E-14)b.d=0;if(Math.abs(b.e)<1.0E-14)b.e=0;if(Math.abs(b.f)<1.0E-14)b.f=0;return b};svgedit.math.hasMatrixTransform=function(o){if(!o)return false;for(var e=o.numberOfItems;e--;){var b=o.getItem(e);if(b.type==1&&!svgedit.math.isIdentity(b.matrix))return true}return false};svgedit.math.transformBox=function(o,e,b,l,s){var c={x:o,y:e},g={x:o+b,y:e};b={x:o+b,y:e+l};o={x:o,y:e+l};e=svgedit.math.transformPoint;c=e(c.x,c.y,s);var d=l=c.x,p=c.y,w=c.y;g=e(g.x,g.y,s);l=Math.min(l,g.x);d=Math.max(d,g.x); p=Math.min(p,g.y);w=Math.max(w,g.y);o=e(o.x,o.y,s);l=Math.min(l,o.x);d=Math.max(d,o.x);p=Math.min(p,o.y);w=Math.max(w,o.y);b=e(b.x,b.y,s);l=Math.min(l,b.x);d=Math.max(d,b.x);p=Math.min(p,b.y);w=Math.max(w,b.y);return{tl:c,tr:g,bl:o,br:b,aabox:{x:l,y:p,width:d-l,height:w-p}}};svgedit.math.transformListToTransform=function(o,e,b){if(o==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());e=e==undefined?0:e;b=b==undefined?o.numberOfItems-1:b;e=parseInt(e);b=parseInt(b);if(e>b){var l=b;b=e; e=l}l=a.createSVGMatrix();for(e=e;e<=b;++e){var s=e>=0&&eo.x&&e.yo.y}})();svgedit=svgedit||{}; (function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],o=["y","y1","cy","ry","height"],e=$.merge(["r","radius"],a);$.merge(e,o);var b,l={px:1};svgedit.units.init=function(c){b=c;c=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(c);var g=document.createElementNS("http://www.w3.org/2000/svg","rect");g.setAttribute("width","1em");g.setAttribute("height","1ex");g.setAttribute("x","1in");c.appendChild(g);g=g.getBBox();document.body.removeChild(c); c=g.x;l.em=g.width;l.ex=g.height;l["in"]=c;l.cm=c/2.54;l.mm=c/25.4;l.pt=c/72;l.pc=c/6;l["%"]=0};svgedit.units.getTypeMap=function(){return l};svgedit.units.shortFloat=function(c){var g=b.getRoundDigits();if(isNaN(c)){if($.isArray(c))return svgedit.units.shortFloat(c[0])+","+svgedit.units.shortFloat(c[1])}else return+(+c).toFixed(g);return parseFloat(c).toFixed(g)-0};svgedit.units.convertUnit=function(c,g){g=g||b.getBaseUnit();return svgedit.unit.shortFloat(c/l[g])};svgedit.units.setUnitAttr=function(c, g,d){isNaN(d)||c.getAttribute(g);c.setAttribute(g,d)};var s={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(c){var g=c.tagName,d=b.getBaseUnit();if(g=s[g])for(var p=g.length,w=0;w=0?d*p:o.indexOf(c)>=0?d*w:d*Math.sqrt(p*p+w*w)/Math.sqrt(2)}else{p=g.substr(-2);d=g.substr(0,g.length-2);return d*l[p]}};svgedit.units.isValidUnit=function(c,g,d){var p=false;if(e.indexOf(c)>=0)if(isNaN(g)){g=g.toLowerCase();$.each(l,function(v){if(!p)if(RegExp("^-?[\\d\\.]+"+v+"$").test(g))p=true})}else p=true;else if(c=="id"){c=false;try{var w=b.getElement(g); c=w==null||w===d}catch(B){}return c}else p=true;return p}})();svgedit=svgedit||{}; (function(){function a(c){if(svgedit.browser.supportsHVLineContainerBBox())try{return c.getBBox()}catch(g){}var d=$.data(c,"ref"),p=null;if(d){var w=$(d).children().clone().attr("visibility","hidden");$(s).append(w);p=w.filter("line, path")}else p=$(c).find("line, path");var B=false;if(p.length){p.each(function(){var v=this.getBBox();if(!v.width||!v.height)B=true});if(B){c=d?w:$(c).children();ret=getStrokedBBox(c)}else ret=c.getBBox()}else ret=c.getBBox();d&&w.remove();return ret}if(!svgedit.utilities)svgedit.utilities= {};var o="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),e=null,b=null,l=null,s=null;svgedit.utilities.init=function(c){e=c;b=c.getDOMDocument();l=c.getDOMContainer();s=c.getSVGRoot()};svgedit.utilities.toXml=function(c){return $("

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

    ").html(c).text()};svgedit.utilities.encode64=function(c){c=svgedit.utilities.convertToXMLReferences(c);if(window.btoa)return window.btoa(c); var g=Array(Math.floor((c.length+2)/3)*4),d,p,w,B,v,N,Q=0,K=0;do{d=c.charCodeAt(Q++);p=c.charCodeAt(Q++);w=c.charCodeAt(Q++);B=d>>2;d=(d&3)<<4|p>>4;v=(p&15)<<2|w>>6;N=w&63;if(isNaN(p))v=N=64;else if(isNaN(w))N=64;g[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(B);g[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);g[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(v);g[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(N)}while(Q< c.length);return g.join("")};svgedit.utilities.decode64=function(c){if(window.atob)return window.atob(c);var g="",d,p,w="",B,v="",N=0;c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(N++));p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(N++));B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(N++));v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(N++)); d=d<<2|p>>4;p=(p&15)<<4|B>>2;w=(B&3)<<6|v;g+=String.fromCharCode(d);if(B!=64)g+=String.fromCharCode(p);if(v!=64)g+=String.fromCharCode(w)}while(N127)g+="&#"+p+";"}return g};svgedit.utilities.text2xml=function(c){if(c.indexOf("=0)c=c.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var g;try{var d=window.DOMParser? new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(p){throw Error("XML Parser could not be instantiated");}try{g=d.loadXML?d.loadXML(c)?d:false:d.parseFromString(c,"text/xml")}catch(w){throw Error("Error parsing XML string");}return g};svgedit.utilities.bboxToObj=function(c){return{x:c.x,y:c.y,width:c.width,height:c.height}};svgedit.utilities.walkTree=function(c,g){if(c&&c.nodeType==1){g(c);for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),g)}}; svgedit.utilities.walkTreePost=function(c,g){if(c&&c.nodeType==1){for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),g);g(c)}};svgedit.utilities.getUrlFromAttr=function(c){if(c)if(c.indexOf('url("')===0)return c.substring(5,c.indexOf('"',6));else if(c.indexOf("url('")===0)return c.substring(5,c.indexOf("'",6));else if(c.indexOf("url(")===0)return c.substring(4,c.indexOf(")"));return null};svgedit.utilities.getHref=function(c){if(c)return c.getAttributeNS("http://www.w3.org/1999/xlink", "href")};svgedit.utilities.setHref=function(c,g){c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",g)};svgedit.utilities.findDefs=function(c){c=e.getSVGContent().documentElement;var g=c.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return g=g.length>0?g[0]:c.insertBefore(c.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),c.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(c){var g=c.pathSegList,d=g.numberOfItems;c=[[],[]];var p=g.getItem(0), w=[p.x,p.y];for(p=0;p=0){var p=d.split(":");c[p[1]]=o[p[0]]}else c[d]=d=="xmlns"?"http://www.w3.org/2000/xmlns/":null});b[l]=c});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(l){if(l.nodeType==3){l.nodeValue=l.nodeValue.replace(/^\s+|\s+$/g,"");l.nodeValue.length||l.parentNode.removeChild(l)}if(l.nodeType==1){var s=l.parentNode;if(l.ownerDocument&&s){var c=e[l.nodeName],g=b[l.nodeName];if(c!= undefined){for(var d=[],p=l.attributes.length;p--;){var w=l.attributes.item(p),B=w.nodeName,v=w.localName,N=w.namespaceURI;if(!(g.hasOwnProperty(v)&&N==g[v]&&N!="http://www.w3.org/2000/xmlns/")&&!(N=="http://www.w3.org/2000/xmlns/"&&a[w.nodeValue])){B.indexOf("se:")==0&&d.push([B,w.nodeValue]);l.removeAttributeNS(N,v)}if(svgedit.browser.isGecko())switch(B){case "transform":case "gradientTransform":case "patternTransform":v=w.nodeValue.replace(/(\d)-/g,"$1 -");l.setAttribute(B,v)}if(B=="style"){w= w.nodeValue.split(";");for(B=w.length;B--;){v=w[B].split(":");c.indexOf(v[0])>=0&&l.setAttribute(v[0],v[1])}l.removeAttribute("style")}}$.each(d,function(Q,K){l.setAttributeNS("http://svg-edit.googlecode.com",K[0],K[1])});if((p=svgedit.utilities.getHref(l))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(l.nodeName)>=0)if(p[0]!="#"){svgedit.utilities.setHref(l,"");l.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(l.nodeName=="use"&&!svgedit.utilities.getHref(l))s.removeChild(l); else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(Q,K){var I=l.getAttribute(K);if(I)if((I=svgedit.utilities.getUrlFromAttr(I))&&I[0]!=="#"){l.setAttribute(K,"");l.removeAttribute(K)}});for(p=l.childNodes.length;p--;)svgedit.sanitize.sanitizeSvg(l.childNodes.item(p))}}else{for(c=[];l.hasChildNodes();)c.push(s.insertBefore(l.firstChild,l));s.removeChild(l);for(p=c.length;p--;)svgedit.sanitize.sanitizeSvg(c[p])}}}}})();svgedit=svgedit||{}; (function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,o,e,b){this.elem=a;this.text=b?"Move "+a.tagName+" to "+b:"Move "+a.tagName;this.oldNextSibling=o;this.oldParent=e;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type= svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,o){this.elem=a;this.text=o||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type= svgedit.history.InsertElementCommand.type;svgedit.history.InsertElementCommand.prototype.getText=function(){return this.text};svgedit.history.InsertElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.InsertElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);this.parent=this.elem.parentNode;this.elem=this.elem.parentNode.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.InsertElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.RemoveElementCommand=function(a,o,e,b){this.elem=a;this.text=b||"Delete "+a.tagName;this.nextSibling=o;this.parent=e;svgedit.transformlist.removeElementFromListMap(a)};svgedit.history.RemoveElementCommand.type=function(){return"svgedit.history.RemoveElementCommand"}; svgedit.history.RemoveElementCommand.prototype.type=svgedit.history.RemoveElementCommand.type;svgedit.history.RemoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.RemoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.parent=this.elem.parentNode;this.elem=this.parent.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY, this)};svgedit.history.RemoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.nextSibling==null&&window.console&&console.log("Error: reference element was lost");this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.RemoveElementCommand.prototype.elements=function(){return[this.elem]}; svgedit.history.ChangeElementCommand=function(a,o,e){this.elem=a;this.text=e?"Change "+a.tagName+" "+e:"Change "+a.tagName;this.newValues={};this.oldValues=o;for(var b in o)this.newValues[b]=b=="#text"?a.textContent:b=="#href"?svgedit.utilities.getHref(a):a.getAttribute(b)};svgedit.history.ChangeElementCommand.type=function(){return"svgedit.history.ChangeElementCommand"};svgedit.history.ChangeElementCommand.prototype.type=svgedit.history.ChangeElementCommand.type;svgedit.history.ChangeElementCommand.prototype.getText= function(){return this.text};svgedit.history.ChangeElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);var o=false,e;for(e in this.newValues){if(this.newValues[e])if(e=="#text")this.elem.textContent=this.newValues[e];else e=="#href"?svgedit.utilities.setHref(this.elem,this.newValues[e]):this.elem.setAttribute(e,this.newValues[e]);else if(e=="#text")this.elem.textContent="";else{this.elem.setAttribute(e,"");this.elem.removeAttribute(e)}if(e== "transform")o=true}if(!o)if(o=svgedit.utilities.getRotationAngle(this.elem)){e=elem.getBBox();o=["rotate(",o," ",e.x+e.width/2,",",e.y+e.height/2,")"].join("");o!=elem.getAttribute("transform")&&elem.setAttribute("transform",o)}a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);var o=false,e;for(e in this.oldValues){if(this.oldValues[e])if(e== "#text")this.elem.textContent=this.oldValues[e];else e=="#href"?svgedit.utilities.setHref(this.elem,this.oldValues[e]):this.elem.setAttribute(e,this.oldValues[e]);else if(e=="#text")this.elem.textContent="";else this.elem.removeAttribute(e);if(e=="transform")o=true}if(!o)if(o=svgedit.utilities.getRotationAngle(this.elem)){e=this.elem.getBBox();o=["rotate(",o," ",e.x+e.width/2,",",e.y+e.height/2,")"].join("");o!=this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",o)}svgedit.transformlist.removeElementFromListMap(this.elem); a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.BatchCommand=function(a){this.text=a||"Batch Command";this.stack=[]};svgedit.history.BatchCommand.type=function(){return"svgedit.history.BatchCommand"};svgedit.history.BatchCommand.prototype.type=svgedit.history.BatchCommand.type;svgedit.history.BatchCommand.prototype.getText=function(){return this.text};svgedit.history.BatchCommand.prototype.apply= function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);for(var o=this.stack.length,e=0;e=0;o--)this.stack[o].unapply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],o=this.stack.length;o--;)for(var e=this.stack[o].elements(),b=e.length;b--;)a.indexOf(e[b])==-1&&a.push(e[b]);return a};svgedit.history.BatchCommand.prototype.addSubCommand=function(a){this.stack.push(a)};svgedit.history.BatchCommand.prototype.isEmpty=function(){return this.stack.length==0};svgedit.history.UndoManager=function(a){this.handler_=a||null;this.undoStackPointer=0;this.undoStack=[];this.undoChangeStackPointer= -1;this.undoableChangeStack=[]};svgedit.history.UndoManager.prototype.resetUndoStack=function(){this.undoStack=[];this.undoStackPointer=0};svgedit.history.UndoManager.prototype.getUndoStackSize=function(){return this.undoStackPointer};svgedit.history.UndoManager.prototype.getRedoStackSize=function(){return this.undoStack.length-this.undoStackPointer};svgedit.history.UndoManager.prototype.getNextUndoCommandText=function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText(): ""};svgedit.history.UndoManager.prototype.getNextRedoCommandText=function(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)};svgedit.history.UndoManager.prototype.redo=function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}; svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,o){for(var e=++this.undoChangeStackPointer,b=o.length,l=Array(b),s=Array(b);b--;){var c=o[b];if(c!=null){s[b]=c;l[b]=c.getAttribute(a)}}this.undoableChangeStack[e]= {attrName:a,oldValues:l,elements:s}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,o=this.undoableChangeStack[a],e=o.elements.length,b=o.attrName,l=new svgedit.history.BatchCommand("Change "+b);e--;){var s=o.elements[e];if(s!=null){var c={};c[b]=o.oldValues[e];c[b]!=s.getAttribute(b)&&l.addSubCommand(new svgedit.history.ChangeElementCommand(s,c,b))}}this.undoableChangeStack[a]=null;return l}})();svgedit=svgedit||{}; (function(){if(!svgedit.select)svgedit.select={};var a,o,e;svgedit.select.Selector=function(b,l){this.id=b;this.selectedElement=l;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));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 l=[];b=Math.round(b/45);if(b<0)b+=8;for(var s in e.selectorGrips)l.push(s);for(;b>0;){l.push(l.shift());b--}b=0;for(s in e.selectorGrips){e.selectorGrips[s].setAttribute("style", "cursor:"+l[b]+"-resize");b++}};svgedit.select.Selector.prototype.showGrips=function(b){e.selectorGripsGroup.setAttribute("display",b?"inline":"none");var l=this.selectedElement;this.hasGrips=b;if(l&&b){this.selectorGroup.appendChild(e.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(l))}};svgedit.select.Selector.prototype.resize=function(){var b=this.selectorRect,l=e,s=l.selectorGrips,c=this.selectedElement,g=c.getAttribute("stroke-width"),d=a.currentZoom(),p=1/d;if(c.getAttribute("stroke")!== "none"&&!isNaN(g))p+=g/2;var w=c.tagName;if(w==="text")p+=2/d;g=svgedit.transformlist.getTransformList(c);g=svgedit.math.transformListToTransform(g).matrix;g.e*=d;g.f*=d;var B=svgedit.utilities.getBBox(c);if(w==="g"&&!$.data(c,"gsvg"))if(w=a.getStrokedBBox(c.childNodes))B=w;w=B.x;var v=B.y,N=B.width;B=B.height;p*=d;d=svgedit.math.transformBox(w*d,v*d,N*d,B*d,g);g=d.aabox;w=g.x-p;v=g.y-p;N=g.width+p*2;var Q=g.height+p*2;g=w+N/2;B=v+Q/2;if(c=svgedit.utilities.getRotationAngle(c)){w=a.svgRoot().createSVGTransform(); w.setRotate(-c,g,B);w=w.matrix;d.tl=svgedit.math.transformPoint(d.tl.x,d.tl.y,w);d.tr=svgedit.math.transformPoint(d.tr.x,d.tr.y,w);d.bl=svgedit.math.transformPoint(d.bl.x,d.bl.y,w);d.br=svgedit.math.transformPoint(d.br.x,d.br.y,w);w=d.tl;N=w.x;Q=w.y;var K=w.x,I=w.y;w=Math.min;v=Math.max;N=w(N,w(d.tr.x,w(d.bl.x,d.br.x)))-p;Q=w(Q,w(d.tr.y,w(d.bl.y,d.br.y)))-p;K=v(K,v(d.tr.x,v(d.bl.x,d.br.x)))+p;I=v(I,v(d.tr.y,v(d.bl.y,d.br.y)))+p;w=N;v=Q;N=K-N;Q=I-Q}p=a.svgRoot().suspendRedraw(100);b.setAttribute("d", "M"+w+","+v+" L"+(w+N)+","+v+" "+(w+N)+","+(v+Q)+" "+w+","+(v+Q)+"z");this.selectorGroup.setAttribute("transform",c?"rotate("+[c,g,B].join(",")+")":"");if(svgedit.browser.isTouch()){w-=15.75;v-=15.75}else{w-=4;v-=4}this.gripCoords={nw:[w,v].map(Math.round),ne:[w+N,v].map(Math.round),sw:[w,v+Q].map(Math.round),se:[w+N,v+Q].map(Math.round),n:[w+N/2,v].map(Math.round),w:[w,v+Q/2].map(Math.round),e:[w+N,v+Q/2].map(Math.round),s:[w+N/2,v+Q].map(Math.round)};for(var S in this.gripCoords){b=this.gripCoords[S]; s[S].setAttribute("x",b[0]);s[S].setAttribute("y",b[1])}this.rotateCoords={nw:[w,v],ne:[w+N+8,v],sw:[w,v+Q+8],se:[w+N+8,v+Q+8]};for(S in this.rotateCoords){b=this.rotateCoords[S];l.rotateGrips[S].setAttribute("cx",b[0]);l.rotateGrips[S].setAttribute("cy",b[1])}a.svgRoot().unsuspendRedraw(p)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null}; this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup); a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var b in this.rotateGrips){var l=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("+o.imgPath+"rotate.png) 12 12, auto;"}});$.data(l,"dir",b);$.data(l,"type","rotate");this.rotateGrips[b]=this.selectorGripsGroup.appendChild(l)}for(b in this.selectorGrips){l=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()){l.setAttribute("width",30.5);l.setAttribute("height",30.5);l.setAttribute("fill-opacity",0.3)}$.data(l,"dir",b);$.data(l,"type","resize");this.selectorGrips[b]=this.selectorGripsGroup.appendChild(l)}if(!$("#canvasBackground").length){b=o.dimensions;b=a.createSVGElement({element:"svg",attr:{id:"canvasBackground", width:b[0],height:b[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});l=a.createSVGElement({element:"defs",attr:{id:"placeholder_defs"}});var s=a.createSVGElement({element:"pattern",attr:{id:"checkerPattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:20,height:20,viewBox:"0 0 10 10"}}),c=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:10,height:10,fill:"#fff"}}),g=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:5,height:5,fill:"#eee"}}), d=a.createSVGElement({element:"rect",attr:{x:5,y:5,width:5,height:5,fill:"#eee"}}),p=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"url(#checkerPattern)",style:"pointer-events:none"}});b.appendChild(l);l.appendChild(s);s.appendChild(c);s.appendChild(g);s.appendChild(d);b.appendChild(p);a.svgRoot().insertBefore(b,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(b){if(b==null)return null;var l=this.selectors.length; if(typeof this.selectorMap[b.id]=="object"){this.selectorMap[b.id].locked=true;return this.selectorMap[b.id]}for(var s=0;s element";this.svgElem_=b;this.obj_num=0;this.idPrefix=l||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= "";var s=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(s&&e!=o.NEVER_RANDOMIZE)this.nonce_=s;else e==o.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(b){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+b):$(this.svgElem_).find("[id="+b+"]")[0]};svgedit.draw.Drawing.prototype.getSvgElem=function(){return this.svgElem_};svgedit.draw.Drawing.prototype.getNonce=function(){return this.nonce_}; svgedit.draw.Drawing.prototype.setNonce=function(b){this.svgElem_.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:se","http://svg-edit.googlecode.com");this.svgElem_.setAttributeNS("http://svg-edit.googlecode.com","se:nonce",b);this.nonce_=b};svgedit.draw.Drawing.prototype.clearNonce=function(){this.nonce_=""};svgedit.draw.Drawing.prototype.getId=function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num};svgedit.draw.Drawing.prototype.getNextId=function(){var b= this.obj_num,l=false;if(this.releasedNums.length>0){this.obj_num=this.releasedNums.pop();l=true}else this.obj_num++;for(var s=this.getId();this.getElem_(s);){if(l){this.obj_num=b;l=false}this.obj_num++;s=this.getId()}if(l)this.obj_num=b;return s};svgedit.draw.Drawing.prototype.releaseId=function(b){var l=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof b!="string"||b.indexOf(l)!=0)return false;b=parseInt(b.substr(l.length));if(typeof b!="number"||b<=0||this.releasedNums.indexOf(b)!=-1)return false; this.releasedNums.push(b);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(b){for(var l=0;l=0&&b1){var b=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return b}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var b=this.svgElem_.childNodes.length,l=[],s=[],c=null,g=false,d=0;d0||!g){for(d=1;s.indexOf("Layer "+d)>=0;)d++;s="Layer "+d;c=b.createElementNS("http://www.w3.org/2000/svg","g");g=b.createElementNS("http://www.w3.org/2000/svg","title");g.textContent=s; c.appendChild(g);for(g=0;g1))for(var s= 0;s0){g=Q element";this.elem=g;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 g=this.elem.pathSegList,d=g.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var p=0;p=d?null:g[p+1],N=p-1<0?null:g[p-1];if(B.type===2){if(N&&N.type!==1){v=g[w];v.next=g[w+1];v.next.prev=v;v.addGrip()}w=p}else if(v&& v.type===1){B.next=g[w+1];B.next.prev=B;B.mate=g[w];B.addGrip();if(this.first_seg==null)this.first_seg=B}else if(v){if(B.type!==1){B.addGrip();if(v&&v.type!==2){B.next=v;B.next.prev=B}}}else if(B.type!==1){v=g[w];v.next=g[w+1];v.next.prev=v;v.addGrip();B.addGrip();if(!this.first_seg)this.first_seg=g[w]}}return this};svgedit.path.Path.prototype.eachSeg=function(g){for(var d=this.segs.length,p=0;p').documentElement, true);a.appendChild(d);var p=g.createElementNS(b,"svg");(c.clearSvgContentElement=function(){for(;p.firstChild;)p.removeChild(p.firstChild);$(p).attr({id:"svgcontent",width:s[0],height:s[1],x:s[0],y:s[1],overflow:l.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var f=g.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");p.appendChild(f)})();var w="svg_";c.setIdPrefix= function(f){w=f};c.current_drawing_=new svgedit.draw.Drawing(p,w);var B=c.getCurrentDrawing=function(){return c.current_drawing_},v=1,N=null,Q={shape:{fill:(l.initFill.color=="none"?"":"#")+l.initFill.color,fill_paint:null,fill_opacity:l.initFill.opacity,stroke:"#"+l.initStroke.color,stroke_paint:null,stroke_opacity:l.initStroke.opacity,stroke_width:l.initStroke.width,stroke_dasharray:"none",opacity:l.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=Q.shape,I=Array(1),S=this.addSvgElementFromJson=function(f){var k=svgedit.utilities.getElem(f.attr.id),m=B().getCurrentLayer();if(k&&f.element!=k.tagName){m.removeChild(k);k=null}if(!k){k=g.createElementNS(b,f.element);if(m)(N||m).appendChild(k)}f.curStyles&&svgedit.utilities.assignAttributes(k,{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(k,f.attr,100);svgedit.utilities.cleanupElement(k);return k},R=c.getTransformList=svgedit.transformlist.getTransformList,L=svgedit.math.transformPoint,Z=c.matrixMultiply=svgedit.math.matrixMultiply,qa=c.hasMatrixTransform=svgedit.math.hasMatrixTransform,aa=c.transformListToTransform=svgedit.math.transformListToTransform,Y=svgedit.math.snapToAngle,ga=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return l.baseUnit}, getElement:svgedit.utilities.getElem,getHeight:function(){return p.getAttribute("height")/v},getWidth:function(){return p.getAttribute("width")/v},getRoundDigits:function(){return $a.round_digits}});var Ba=c.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return g},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return I},getSVGContent:function(){return p}});var ja=c.getUrlFromAttr=svgedit.utilities.getUrlFromAttr, da=c.getHref=svgedit.utilities.getHref,U=c.setHref=svgedit.utilities.setHref,X=svgedit.utilities.getPathBBox;c.getBBox=svgedit.utilities.getBBox;var na=c.getRotationAngle=svgedit.utilities.getRotationAngle,oa=c.getElem=svgedit.utilities.getElem,ma=c.assignAttributes=svgedit.utilities.assignAttributes,la=this.cleanupElement=svgedit.utilities.cleanupElement,ya=svgedit.sanitize.getNSMap(),za=c.sanitizeSvg=svgedit.sanitize.sanitizeSvg,Ja=svgedit.history.MoveElementCommand,Ia=svgedit.history.InsertElementCommand, Fa=svgedit.history.RemoveElementCommand,Ma=svgedit.history.ChangeElementCommand,Da=svgedit.history.BatchCommand;c.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(f,k){var m=svgedit.history.HistoryEventTypes;if(f==m.BEFORE_UNAPPLY||f==m.BEFORE_APPLY)c.clearSelection();else if(f==m.AFTER_APPLY||f==m.AFTER_UNAPPLY){var C=k.elements();c.pathActions.clear();M("changed",C);C=k.type();m=f==m.AFTER_APPLY;if(C==Ja.type())(m?k.newParent:k.oldParent)==p&&c.identifyLayers();else if(C==Ia.type()|| C==Fa.type()){k.parent==p&&c.identifyLayers();if(C==Ia.type())m&&Ta(k.elem);else m||Ta(k.elem);k.elem.tagName==="use"&&Gb(k.elem)}else if(C==Ma.type()){k.elem.tagName=="title"&&k.elem.parentNode.parentNode==p&&c.identifyLayers();m=m?k.newValues:k.oldValues;m.stdDeviation&&c.setBlurOffsets(k.elem.parentNode,m.stdDeviation)}}}});var wa=function(f){c.undoMgr.addCommandToHistory(f)};svgedit.select.init(l,{createSVGElement:function(f){return c.addSvgElementFromJson(f)},svgRoot:function(){return d},svgContent:function(){return p}, currentZoom:function(){return v},getStrokedBBox:function(f){return c.getStrokedBBox([f])}});var ra=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return v},getSVGRoot:function(){return d}});svgedit.utilities.snapToGrid=function(f){var k=l.snappingStep,m=l.baseUnit;if(m!=="px")k*=svgedit.units.getTypeMap()[m];return f=Math.round(f/k)*k};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(f){var k=$(f).attr(vb),m;for(m in k){var C=k[m];if(C&&C.indexOf("url(")===0){C=ja(C).substr(1);if(!oa(C)){gb().appendChild(sb[C]);delete sb[C]}}}f=f.getElementsByTagName("*");if(f.length){k=0;for(m=f.length;k=0)n=q=c.convertToPath(h,true);else if(h.tagName=="rect"){var u=h.getAttribute("rx"),E=h.getAttribute("ry");if(u||E)n=q=c.convertToPath(h,true)}if(!q){var H=h.cloneNode(true),J=document.createElementNS(b, "g"),O=h.parentNode;O.appendChild(J);J.appendChild(H);n=svgedit.utilities.bboxToObj(J.getBBox());O.removeChild(J)}}return n}catch(W){console.log(h,W)}},m;$.each(f,function(){if(!m)if(this.parentNode)m=k(this)});if(m==null)return null;var C=m.x+m.width,A=m.y+m.height,G=m.x,D=m.y,z=function(h){var n=h.getAttribute("stroke-width"),q=0;if(h.getAttribute("stroke")!="none"&&!isNaN(n))q+=n/2;return q},F=[];$.each(f,function(h,n){var q=k(n);if(q){var u=z(n);G=Math.min(G,q.x-u);D=Math.min(D,q.y-u);F.push(q)}}); m.x=G;m.y=D;$.each(f,function(h,n){var q=F[h];if(q&&n.nodeType==1){var u=z(n);C=Math.max(C,q.x+q.width+u);A=Math.max(A,q.y+q.height+u)}});m.width=C-G;m.height=A-D;return m};var pb=this.getVisibleElements=function(f){f||(f=$(p).children());f.find("#canvas_background").length&&f.splice(0,1);var k=[];$(f).children().each(function(m,C){try{C.getBBox()&&k.push(C)}catch(A){}});return k.reverse()},fb=this.getVisibleElementsAndBBoxes=function(f){f||(f=$(p).children());var k=[];$(f).children().each(function(m, C){try{C.getBBox()&&k.push({elem:C,bbox:getStrokedBBox([C])})}catch(A){}});return k.reverse()},tb=this.groupSvgElem=function(f){var k=document.createElementNS(b,"g");f.parentNode.replaceChild(k,f);$(k).append(f).data("gsvg",f)[0].id=ka()},ia=function(f){var k=document.createElementNS(f.namespaceURI,f.nodeName);k.removeAttribute("id");$.each(f.attributes,function(C,A){A.localName!="-moz-math-font-style"&&k.setAttributeNS(A.namespaceURI,A.nodeName,A.nodeValue)});if(svgedit.browser.isWebkit()&&f.nodeName== "path"){var m=La.convertPath(f);k.setAttribute("d",m)}$.each(f.childNodes,function(C,A){switch(A.nodeType){case 1:k.appendChild(ia(A));break;case 3:k.textContent=A.nodeValue}});if($(f).data("gsvg"))$(k).data("gsvg",k.firstChild);else if($(f).data("symbol")){f=$(f).data("symbol");$(k).data("ref",f).data("symbol",f)}else k.tagName=="image"&&Fb(k);k.id=ka();return k},ba,ka,M;(function(f){var k={};ba=f.getId=function(){return B().getId()};ka=f.getNextId=function(){return B().getNextId()};M=f.call=function(m, C){if(k[m])return k[m](this,C)};f.bind=function(m,C){var A=k[m];k[m]=C;return A}})(c);this.prepareSvg=function(f){this.sanitizeSvg(f.documentElement);f=f.getElementsByTagNameNS(b,"path");for(var k=0,m=f.length;k0&&A.getItem(0).type==4&&A.removeItem(0);if(f!=0){G=L(G,D,aa(A).matrix);D=d.createSVGTransform();D.setRotate(f,G.x,G.y);A.numberOfItems?A.insertItemBefore(D,0):A.appendItem(D)}else A.numberOfItems==0&&m.removeAttribute("transform");if(!k){A=m.getAttribute("transform"); m.setAttribute("transform",C);Ya("transform",A,I);M("changed",I)}oa("pathpointgrip_container");m=ra.requestSelector(I[0]);m.resize();m.updateGripCursors(f)}};var Ea=this.recalculateAllSelectedDimensions=function(){for(var f=new Da(db=="none"?"position":"size"),k=I.length;k--;){var m=Ra(I[k]);m&&f.addSubCommand(m)}if(!f.isEmpty()){wa(f);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(f){console.log([f.a,f.b,f.c,f.d,f.e,f.f])},Za=this.remapElement= function(f,k,m){var C=l.gridSnapping&&f.parentNode.parentNode.localName==="svg",A=function(){if(C)for(var q in k)k[q]=va(k[q]);ma(f,k,1E3,true)};box=svgedit.utilities.getBBox(f);for(var G=0;G<2;G++){var D=G===0?"fill":"stroke",z=f.getAttribute(D);if(z&&z.indexOf("url(")===0)if(m.a<0||m.d<0){z=P(z).cloneNode(true);if(m.a<0){var F=z.getAttribute("x1"),h=z.getAttribute("x2");z.setAttribute("x1",-(F-1));z.setAttribute("x2",-(h-1))}if(m.d<0){F=z.getAttribute("y1");h=z.getAttribute("y2");z.setAttribute("y1", -(F-1));z.setAttribute("y2",-(h-1))}z.id=ka();gb().appendChild(z);f.setAttribute(D,"url(#"+z.id+")")}}G=f.tagName;if(G==="g"||G==="text"||G==="use")if(m.a==1&&m.b==0&&m.c==0&&m.d==1&&(m.e!=0||m.f!=0)){D=aa(f).matrix;D=Z(D.inverse(),m,D);k.x=parseFloat(k.x)+D.e;k.y=parseFloat(k.y)+D.f}else{D=R(f);z=d.createSVGTransform();z.setMatrix(Z(aa(D).matrix,m));D.clear();D.appendItem(z)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(m.a<0||m.d<0)){D=R(f);z=d.createSVGTransform();z.setMatrix(Z(aa(D).matrix, m));D.clear();D.appendItem(z)}else{D=L(k.x,k.y,m);k.width=m.a*k.width;k.height=m.d*k.height;k.x=D.x+Math.min(0,k.width);k.y=D.y+Math.min(0,k.height);k.width=Math.abs(k.width);k.height=Math.abs(k.height)}A();break;case "ellipse":G=L(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;k.rx=m.a*k.rx;k.ry=m.d*k.ry;k.rx=Math.abs(k.rx);k.ry=Math.abs(k.ry);A();break;case "circle":G=L(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,m);k.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/ 2);if(k.r)k.r=Math.abs(k.r);A();break;case "line":D=L(k.x1,k.y1,m);F=L(k.x2,k.y2,m);k.x1=D.x;k.y1=D.y;k.x2=F.x;k.y2=F.y;case "text":m=f.querySelectorAll("tspan");for(G=m.length;G--;){D=Ba("x",f.getAttribute("x"));z=Ba("x",m[G].getAttribute("x"));F=Ba("y",f.getAttribute("y"));h=Ba("y",m[G].getAttribute("y"));var n={};if(!isNaN(D)&&!isNaN(z)&&D!=0&&z!=0&&k.x)n.x=k.x-(D-z);if(!isNaN(F)&&!isNaN(h)&&F!=0&&h!=0&&k.y)n.y=k.y-(F-h);if(n.x||n.y)ma(m[G],n,1E3,true)}A();break;case "use":A();break;case "g":(A= $(f).data("gsvg"))&&ma(A,k,1E3,true);break;case "polyline":case "polygon":A=k.points.length;for(G=0;G0){for(var m=k.numberOfItems;m--;){var C=k.getItem(m);if(C.type===0)k.removeItem(m);else if(C.type===1)svgedit.math.isIdentity(C.matrix)&&k.removeItem(m);else C.type===4&&C.angle===0&&k.removeItem(m)}if(k.numberOfItems===1&&na(f))return null}if(!k||k.numberOfItems==0){f.removeAttribute("transform");return null}if(k){m=k.numberOfItems;for(var A=[];m--;){C=k.getItem(m);if(C.type===1)A.push([C.matrix,m]);else if(A.length)A=[]}if(A.length===2){m=d.createSVGTransformFromMatrix(Z(A[1][0], A[0][0]));k.removeItem(A[0][1]);k.removeItem(A[1][1]);k.insertItemBefore(m,A[1][1])}m=k.numberOfItems;if(m>=2&&k.getItem(m-2).type===1&&k.getItem(m-1).type===2){A=d.createSVGTransform();C=Z(k.getItem(m-2).matrix,k.getItem(m-1).matrix);A.setMatrix(C);k.removeItem(m-2);k.removeItem(m-2);k.appendItem(A)}}switch(f.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(k.numberOfItems===1&&k.getItem(0).type===1||k.numberOfItems===2&&k.getItem(0).type===1&&k.getItem(0).type=== 4)return null}var G=$(f).data("gsvg");m=new Da("Transform");var D={},z=null;C=[];switch(f.tagName){case "line":C=["x1","y1","x2","y2"];break;case "circle":C=["cx","cy","r"];break;case "ellipse":C=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":C=["width","height","x","y"];break;case "use":case "text":case "tspan":C=["x","y"];break;case "polygon":case "polyline":z={};z.points=f.getAttribute("points");A=f.points;var F=A.numberOfItems;D.points=Array(F);for(var h=0;h1.0E-10?Math.sin(h)/(1-Math.cos(h)):2/h;for(h=0;h=3&&k.getItem(E-2).type==3&&k.getItem(E-3).type==2&&k.getItem(E-1).type==2){h=3;var J=k.getItem(E-3).matrix,O=k.getItem(E-2).matrix,W=k.getItem(E-1).matrix;F=f.childNodes;for(n=F.length;n--;){var ca=F.item(n);C=G=0;if(ca.nodeType== 1){var T=R(ca);if(T){C=aa(T).matrix;G=na(ca);var fa=Sa,ha=[];Sa=ca.getAttribute("transform");if(G||qa(T)){var V=d.createSVGTransform();V.setMatrix(Z(J,O,W,C));T.clear();T.appendItem(V);ha.push(V)}else{G=Z(C.inverse(),W,C);V=d.createSVGMatrix();V.e=-G.e;V.f=-G.f;C=Z(V.inverse(),C.inverse(),J,O,W,C,G.inverse());var pa=d.createSVGTransform(),ua=d.createSVGTransform(),Aa=d.createSVGTransform();pa.setTranslate(G.e,G.f);ua.setScale(C.a,C.d);Aa.setTranslate(V.e,V.f);T.appendItem(Aa);T.appendItem(ua);T.appendItem(pa); ha.push(Aa);ha.push(ua);ha.push(pa)}m.addSubCommand(Ra(ca));Sa=fa}}}k.removeItem(E-1);k.removeItem(E-2);k.removeItem(E-3)}else if(E>=3&&k.getItem(E-1).type==1){h=3;C=aa(k).matrix;V=d.createSVGTransform();V.setMatrix(C);k.clear();k.appendItem(V)}else if((E==1||E>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){h=2;G=aa(k).matrix;k.removeItem(0);C=aa(k).matrix.inverse();C=Z(C,G);G=C.e;C=C.f;if(G!=0||C!=0){F=f.childNodes;n=F.length;for(E=[];n--;){ca=F.item(n);if(ca.nodeType==1){if(ca.getAttribute("clip-path")){fa= ca.getAttribute("clip-path");if(E.indexOf(fa)===-1){nb(fa,G,C);E.push(fa)}}fa=Sa;Sa=ca.getAttribute("transform");if(T=R(ca)){J=d.createSVGTransform();J.setTranslate(G,C);T.numberOfItems?T.insertItemBefore(J,0):T.appendItem(J);m.addSubCommand(Ra(ca));T=f.getElementsByTagNameNS(b,"use");ca="#"+ca.id;for(J=T.length;J--;){O=T.item(J);if(ca==da(O)){W=d.createSVGTransform();W.setTranslate(-G,-C);R(O).insertItemBefore(W,0);m.addSubCommand(Ra(O))}}Sa=fa}}}E=[];Sa=fa}}else if(E==1&&k.getItem(0).type==1&&!A){h= 1;C=k.getItem(0).matrix;F=f.childNodes;for(n=F.length;n--;){ca=F.item(n);if(ca.nodeType==1){fa=Sa;Sa=ca.getAttribute("transform");if(T=R(ca)){G=Z(C,aa(T).matrix);E=d.createSVGTransform();E.setMatrix(G);T.clear();T.appendItem(E,0);m.addSubCommand(Ra(ca));Sa=fa;fa=ca.getAttribute("stroke-width");ca.getAttribute("stroke")!=="none"&&!isNaN(fa)&&ca.setAttribute("stroke-width",fa*((Math.abs(G.a)+Math.abs(G.d))/2))}}}k.clear()}else{if(A){q=d.createSVGTransform();q.setRotate(A,u.x,u.y);k.numberOfItems?k.insertItemBefore(q, 0):k.appendItem(q)}k.numberOfItems==0&&f.removeAttribute("transform");return null}if(h==2){if(A){u={x:q.x+H.e,y:q.y+H.f};q=d.createSVGTransform();q.setRotate(A,u.x,u.y);k.numberOfItems?k.insertItemBefore(q,0):k.appendItem(q)}}else if(h==3){C=aa(k).matrix;H=d.createSVGTransform();H.setRotate(A,q.x,q.y);H=H.matrix;q=d.createSVGTransform();q.setRotate(A,u.x,u.y);u=q.matrix.inverse();fa=C.inverse();u=Z(fa,u,H,C);G=u.e;C=u.f;if(G!=0||C!=0){F=f.childNodes;for(n=F.length;n--;){ca=F.item(n);if(ca.nodeType== 1){fa=Sa;Sa=ca.getAttribute("transform");T=R(ca);J=d.createSVGTransform();J.setTranslate(G,C);T.numberOfItems?T.insertItemBefore(J,0):T.appendItem(J);m.addSubCommand(Ra(ca));Sa=fa}}}if(A)k.numberOfItems?k.insertItemBefore(q,0):k.appendItem(q)}}else{A=svgedit.utilities.getBBox(f);if(!A&&f.tagName!="path")return null;C=d.createSVGMatrix();if(G=na(f)){q={x:A.x+A.width/2,y:A.y+A.height/2};u=L(A.x+A.width/2,A.y+A.height/2,aa(k).matrix);h=G*Math.PI/180;F=Math.abs(h)>1.0E-10?Math.sin(h)/(1-Math.cos(h)): 2/h;for(h=0;h=3&&k.getItem(E-2).type== 3&&k.getItem(E-3).type==2&&k.getItem(E-1).type==2){h=3;C=aa(k,E-3,E-1).matrix;k.removeItem(E-1);k.removeItem(E-2);k.removeItem(E-3)}else if(E==4&&k.getItem(E-1).type==1){h=3;C=aa(k).matrix;V=d.createSVGTransform();V.setMatrix(C);k.clear();k.appendItem(V);C=d.createSVGMatrix()}else if((E==1||E>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){h=2;H=k.getItem(0).matrix;fa=aa(k,1).matrix;A=fa.inverse();C=Z(A,H,fa);k.removeItem(0)}else if(E==1&&k.getItem(0).type==1&&!G){C=aa(k).matrix;switch(f.tagName){case "line":D= $(f).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":D.points=f.getAttribute("points");if(D.points){A=f.points;F=A.numberOfItems;D.points=Array(F);for(h=0;h1&&A.showGrips(false)}}}M("selected",I);k||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-(D.compareDocumentPosition(G)&6);else if(G==null)return 1});I[0]==null;)I.shift(0)}},rb=this.selectOnly=function(f,k){xa(true);qb(f,k)};this.removeFromSelection=function(f){if(I[0]!=null)if(f.length!=0){var k=Array(I.length);j=0;len=I.length;for(var m=0;m=0&&f.id!="svgcanvas")for(;f.nodeName!="foreignObject";){f=f.parentNode;if(!f)return d}var k=B().getCurrentLayer();if([d,a,p,k].indexOf(f)>=0)return d;if($(f).closest("#selectorParentGroup").length)return ra.selectorParentGroup; for(;f.parentNode&&f.parentNode!==(N||k);)f=f.parentNode;return f};(function(){var f=null,k=null,m=null,C=null,A=null,G={},D={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(z){if(!c.spaceKey){var F=z.button===2;mb=p.querySelector("g").getScreenCTM().inverse();var h=L(z.pageX,z.pageY,mb),n=h.x*v;h=h.y*v;z.preventDefault();if(F)Ha="select";n=n/v;h=h/v;var q=Bb(z);if(q.tagName==="a"&&q.childNodes.length===1)q=q.firstChild;var u=C=k=n,E=A=m=h;if(l.gridSnapping){n=va(n);h=va(h);k=va(k); m=va(m)}if(q==ra.selectorParentGroup&&I[0]!=null){q=z.target;var H=cb(q,"type");if(H=="rotate"){Ha="rotate";current_rotate_mode=cb(q,"dir")}else if(H=="resize"){Ha="resize";db=cb(q,"dir")}q=I[0]}Sa=q.getAttribute("transform");H=R(q);switch(Ha){case "select":Ka=true;db="none";if(F)Ka=false;if(q!=d){if(I.indexOf(q)==-1){z.shiftKey||xa(true);qb([q]);wb=q;La.clear()}if(!F)for(F=0;F1))if(Ka)if(!(z.button=== 1||c.spaceKey)){var F=I[0],h=L(z.pageX,z.pageY,mb),n=h.x*v;h=h.y*v;var q=oa(ba()),u=x=n/v,E=y=h/v;if(l.gridSnapping){x=va(x);y=va(y)}z.preventDefault();switch(Ha){case "select":if(I[0]!==null){u=x-k;var H=y-m;if(l.gridSnapping){u=va(u);H=va(H)}if(z.shiftKey){var J=Y(k,m,x,y);x=J.x;y=J.y}if(u!=0||H!=0){E=I.length;for(var O=0;O0&&c.removeFromSelection(q);u.length>0&&qb(u);break;case "resize":q=R(F);u=(J=qa(q))?G:svgedit.utilities.getBBox(F);E=u.x;O=u.y;var ca=u.width,T=u.height;u=x-k;H=y-m;if(l.gridSnapping){u=va(u);H=va(H);T=va(T);ca=va(ca)}if(W=na(F)){var fa=Math.sqrt(u*u+H*H);H=Math.atan2(H,u)-W*Math.PI/180;u=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")==-1)u=0;var ha=fa=0,V=T?(T+H)/T:1,pa=ca?(ca+u)/ca:1;if(db.indexOf("n")>=0){V=T?(T- H)/T:1;ha=T}if(db.indexOf("w")>=0){pa=ca?(ca-u)/ca:1;fa=ca}u=d.createSVGTransform();H=d.createSVGTransform();ca=d.createSVGTransform();if(l.gridSnapping){E=va(E);fa=va(fa);O=va(O);ha=va(ha)}u.setTranslate(-(E+fa),-(O+ha));if(z.shiftKey)if(pa==1)pa=V;else V=pa;H.setScale(pa,V);ca.setTranslate(E+fa,O+ha);if(J){J=W?1:0;q.replaceItem(u,2+J);q.replaceItem(H,1+J);q.replaceItem(ca,0+J)}else{J=q.numberOfItems;q.replaceItem(ca,J-3);q.replaceItem(H,J-2);q.replaceItem(u,J-1)}ra.requestSelector(F).resize();M("transition", I);break;case "zoom":u*=v;E*=v;ma(sa,{x:Math.min(C*v,u),y:Math.min(A*v,E),width:Math.abs(u-C*v),height:Math.abs(E-A*v)},100);break;case "text":ma(q,{x:x,y:y},1E3);break;case "line":u=null;window.opera||d.suspendRedraw(1E3);if(l.gridSnapping){x=va(x);y=va(y)}E=x;J=y;if(z.shiftKey){J=Y(k,m,E,J);E=J.x;J=J.y}q.setAttributeNS(null,"x2",E);q.setAttributeNS(null,"y2",J);window.opera||d.unsuspendRedraw(u);break;case "foreignObject":case "square":case "rect":case "image":u=Math.abs(x-k);J=Math.abs(y-m);if(Ha== "square"||z.shiftKey){u=J=Math.max(u,J);E=km?m+O:m-O}if(z.altKey){J=k;E=m;O=Math.abs(x-J);H=z.shiftKey?O:Math.abs(y-E)}q.setAttributeNS(null,"rx",O);q.setAttributeNS(null,"ry",H);q.setAttributeNS(null,"cx",J);q.setAttributeNS(null,"cy",E);window.opera||d.unsuspendRedraw(u);break;case "fhellipse":case "fhrect":D.minx=Math.min(u,D.minx);D.maxx=Math.max(u,D.maxx);D.miny=Math.min(E,D.miny);D.maxy=Math.max(E,D.maxy);case "fhpath":f+=+u+","+ E+" ";q.setAttributeNS(null,"points",f);break;case "path":case "pathedit":x*=v;y*=v;if(l.gridSnapping){x=va(x);y=va(y);k=va(k);m=va(m)}if(z.shiftKey){if(J=svgedit.path.path){q=J.dragging?J.dragging[0]:k;J=J.dragging?J.dragging[1]:m}else{q=k;J=m}J=Y(q,J,x,y);x=J.x;y=J.y}if(sa&&sa.getAttribute("display")!=="none"){u*=v;E*=v;ma(sa,{x:Math.min(C*v,u),y:Math.min(A*v,E),width:Math.abs(u-C*v),height:Math.abs(E-A*v)},100)}La.mouseMove(z,x,y);break;case "textedit":x*=v;y*=v;bb.mouseMove(n,h);break;case "rotate":u= svgedit.utilities.getBBox(F);J=u.x+u.width/2;E=u.y+u.height/2;q=ga(F);q=L(J,E,q);J=q.x;E=q.y;q=u.x;O=u.y;if(current_rotate_mode=="nw")q=u.x+u.width;if(current_rotate_mode=="se")O=u.y+u.height;if(current_rotate_mode=="sw"){q=u.x+u.width;O=u.y+u.height}compensation_angle=(Math.atan2(E-O,J-q)*(180/Math.PI)-90)%360;W=(Math.atan2(E-y,J-x)*(180/Math.PI)-90)%360;W+=compensation_angle;if(l.gridSnapping)W=va(W);if(z.shiftKey)W=Math.round(W/45)*45;c.setRotationAngle(W<-180?360+W:W,true);M("transition",I)}ib("mouseMove", {event:z,mouse_x:n,mouse_y:h,selected:F})}}).click(function(z){z.preventDefault();return false}).dblclick(function(z){var F=z.target.parentNode,h=Bb(z),n=h.tagName;if(F!==N){if(n==="text"&&Ha!=="textedit"){z=L(z.pageX,z.pageY,mb);bb.select(h,z.x,z.y)}if((n==="g"||n==="a")&&na(h)){Db(h);h=I[0];xa(true)}N&&Eb();F.tagName!=="g"&&F.tagName!=="a"||F===B().getCurrentLayer()||h===ra.selectorParentGroup||Kb(h)}}).mouseup(function(z){c.addClones=false;window.removeEventListener("keyup",c.removeClones);I=I.filter(Boolean); if(z.button!==2){var F=wb;wb=null;if(Ka){var h=L(z.pageX,z.pageY,mb),n=h.x*v;h=h.y*v;var q=n/v,u=h/v,E=oa(ba()),H=false;Ka=false;switch(Ha){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");hb=[]}Ha="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");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)}Ea();C=C;A=A;n=Math.abs(u-A);if(n>1||n>1){z=I.length;for(n=0;n=0?F.indexOf(",",u+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||Ha==="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-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:ba()}});M("changed",[E]);H=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:ba()}});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,h);E=F.element;H=F.keep;break;case "pathedit":H=true;E=null;La.mouseUp(z); break;case "textedit":H=false;E=null;bb.mouseUp(z,n,h);break;case "rotate":H=true;E=null;Ha="select";F=c.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Ea();M("changed",I)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:h},true);$.each(n,function(W,ca){if(ca){H=ca.keep||H;E=ca.element;Ka=ca.started||Ka}});if(!H&&E!=null){B().releaseId(ba());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName=="g";)n=n.parentNode;if((Ha!="path"||!drawn_path)&&n.parentNode.id!="selectorParentGroup"&& n.id!="svgcanvas"&&n.id!="svgroot"){c.setMode("select");rb([n],true)}}else if(E!=null){c.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(Ha==="path")La.toEditMode(E);else l.selectNew&&rb([E],true);wa(new Ia(E));M("changed",[E])},z* 1E3)}Sa=null}}});$(a).bind("mousewheel DOMMouseScroll",function(z){if(z.shiftKey){z.preventDefault();mb=p.getScreenCTM().inverse();var F=L(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(f){$(f).click(function(k){k.preventDefault()})},bb=c.textActions=function(){function f(T){var fa=h.value=== "";$(h).focus();if(!arguments.length)if(fa)T=0;else{if(h.selectionEnd!==h.selectionStart)return;T=h.selectionEnd}var ha;ha=E[T];fa||h.setSelectionRange(T,T);n=oa("text_cursor");if(!n){n=document.createElementNS(b,"line");ma(n,{id:"text_cursor",stroke:"#333","stroke-width":1});n=oa("selectorParentGroup").appendChild(n)}u||(u=setInterval(function(){var V=n.getAttribute("display")==="none";n.setAttribute("display",V?"inline":"none")},600));fa=G(ha.x,H.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"});q&&q.setAttribute("d","M 0 0")}function k(T,fa,ha){if(T===fa)f(fa);else{ha||h.setSelectionRange(T,fa);q=oa("text_selectblock");if(!q){q=document.createElementNS(b,"path");ma(q,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});oa("selectorParentGroup").appendChild(q)}T=E[T];var V=E[fa];n.setAttribute("visibility","hidden");fa=G(T.x,H.y);ha=G(T.x+(V.x-T.x),H.y);var pa=G(T.x,H.y+H.height);T=G(T.x+(V.x-T.x),H.y+H.height); ma(q,{d:"M"+fa.x+","+fa.y+" L"+ha.x+","+ha.y+" "+T.x+","+T.y+" "+pa.x+","+pa.y+"z",display:"inline"})}}function m(T,fa){var ha=d.createSVGPoint();ha.x=T;ha.y=fa;if(E.length==1)return 0;ha=F.getCharNumAtPosition(ha);if(ha<0){ha=E.length-2;if(T<=E[0].x)ha=0}else if(ha>=E.length-2)ha=E.length-2;var V=E[ha];T>V.x+V.width/2&&ha++;return ha}function C(T,fa,ha){var V=h.selectionStart;T=m(T,fa);k(Math.min(V,T),Math.max(V,T),!ha)}function A(T,fa){var ha={x:T,y:fa};ha.x/=v;ha.y/=v;if(J){var V=L(ha.x,ha.y,J.inverse()); ha.x=V.x;ha.y=V.y}return ha}function G(T,fa){var ha={x:T,y:fa};if(J){var V=L(ha.x,ha.y,J);ha.x=V.x;ha.y=V.y}ha.x*=v;ha.y*=v;return ha}function D(T){k(0,F.textContent.length);$(this).unbind(T)}function z(T){if(ca&&F){var fa=L(T.pageX,T.pageY,mb);fa=A(fa.x*v,fa.y*v);fa=m(fa.x,fa.y);var ha=F.textContent,V=ha.substr(0,fa).replace(/[a-z0-9]+$/i,"").length;ha=ha.substr(fa).match(/^[a-z0-9]+/i);k(V,(ha?ha[0].length:0)+fa);$(T.target).click(D);setTimeout(function(){$(T.target).unbind("click",D)},300)}}var F, h,n,q,u,E=[],H,J,O,W,ca;return{select:function(T,fa,ha){F=T;bb.toEditMode(fa,ha)},start:function(T){F=T;bb.toEditMode()},mouseDown:function(T,fa,ha,V){T=A(ha,V);h.focus();f(m(T.x,T.y));O=ha;W=V},mouseMove:function(T,fa){var ha=A(T,fa);C(ha.x,ha.y)},mouseUp:function(T,fa,ha){var V=A(fa,ha);C(V.x,V.y,true);T.target!==F&&faO-2&&haW-2&&bb.toSelectMode(true)},setCursor:f,toEditMode:function(T,fa){rb([F],false);ca=false;Ha="textedit";ra.requestSelector(F).showGrips(false);ra.requestSelector(F); bb.init();$(F).css("cursor","text");if(arguments.length){var ha=A(T,fa);f(m(ha.x,ha.y))}else f();setTimeout(function(){ca=true},300)},toSelectMode:function(T){Ha="select";clearInterval(u);u=null;q&&$(q).attr("display","none");n&&$(n).attr("visibility","hidden");$(F).css("cursor","move");if(T){xa();$(F).css("cursor","move");M("selected",[F]);qb([F],true)}F&&!F.textContent.length&&c.deleteSelectedElements();$(h).blur();F=false},setInputElem:function(T){h=T},clear:function(){Ha=="textedit"&&bb.toSelectMode()}, init:function(){if(F){if(!F.parentNode){F=I[0];ra.requestSelector(F).showGrips(false)}var T=F.textContent.length,fa=F.getAttribute("transform");H=svgedit.utilities.getBBox(F);J=fa?ga(F):null;E=Array(T);h.focus();$(F).unbind("dblclick",z).dblclick(z);if(!T)var ha={x:H.x+H.width/2,width:0};for(fa=0;fa=0&&this.selected_pts.push(F)}this.selected_pts.sort();z=this.selected_pts.length;for(D=Array(z);z--;){h=this.segs[this.selected_pts[z]];h.select(true);D[z]=h.ptgrip}La.canDeleteNodes=true;La.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",D)};var A=k=null,G=false;this.lastCtrlPoint=[0,0];return{mouseDown:function(D,z,F,h){if(Ha==="path"){mouse_x=F;mouse_y=h;F=mouse_x/v;z=mouse_y/v;h=oa("path_stretch_line");m=[F,z];if(l.gridSnapping){F=va(F);z=va(z);mouse_x=va(mouse_x); mouse_y=va(mouse_y)}if(!h){h=document.createElementNS(b,"path");ma(h,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});h=oa("selectorParentGroup").appendChild(h)}h.setAttribute("display","inline");this.stretchy=h;var n=null;if(A){n=A.pathSegList;for(var q=n.numberOfItems,u=6/v,E=false;q;){q--;var H=n.getItem(q),J=H.x;H=H.y;if(F>=J-u&&F<=J+u&&z>=H-u&&z<=H+u){E=true;break}}u=ba();svgedit.path.removePath_(u);u=oa(u);J=n.numberOfItems;if(E){if(q<=1&&J>=2){F=n.getItem(0).x;z=n.getItem(0).y; q=svgedit.path.first_grip?svgedit.path.first_grip[0]/v:n.getItem(0).x;E=svgedit.path.first_grip?svgedit.path.first_grip[1]/v:n.getItem(0).y;D=h.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(F,z):A.createSVGPathSegCurvetoCubicAbs(F,z,D.x1/v,D.y1/v,q,E);F=A.createSVGPathSegClosePath();n.appendItem(D);n.appendItem(F)}else if(J<3)return n=false;$(h).remove();element=u;A=null;Ka=false;if(f){svgedit.path.path.matrix&&Za(u,{},svgedit.path.path.matrix.inverse());F=u.getAttribute("d"); h=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",h+F);$(u).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;q=A.pathSegList.getItem(n-1);u=q.x;q=q.y;if(D.shiftKey){z=Y(u,q,F,z);F=z.x;z=z.y}D=h.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(ab(F), ab(z)):A.createSVGPathSegCurvetoCubicAbs(ab(F),ab(z),D.x1/v,D.y1/v,D.x2/v,D.y2/v);A.pathSegList.appendItem(D);F*=v;z*=v;h.setAttribute("d",["M",F,z,F,z].join(" "));h=svgedit.path.addCtrlGrip("1c1");D=svgedit.path.addCtrlGrip("0c2");u=svgedit.path.getCtrlLine(1);q=svgedit.path.getCtrlLine(2);h.setAttribute("cx",F);h.setAttribute("cy",z);D.setAttribute("cx",F);D.setAttribute("cy",z);u.setAttribute("x1",F);u.setAttribute("x2",F);u.setAttribute("y1",z);u.setAttribute("y2",z);q.setAttribute("x1",F);q.setAttribute("x2", F);q.setAttribute("y1",z);q.setAttribute("y2",z);h=n;if(f)h+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(h,F,z)}n=true}else{d_attr="M"+F+","+z+" ";A=S({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:K.opacity/2}});h.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));h=f?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(h,mouse_x,mouse_y);svgedit.path.first_grip=null}}else if(svgedit.path.path){svgedit.path.path.storeD();u=D.target.id;if(u.substr(0, 14)=="pathpointgrip_"){z=svgedit.path.path.cur_pt=parseInt(u.substr(14));svgedit.path.path.dragging=[F,h];u=svgedit.path.path.segs[z];if(D.shiftKey)u.selected?svgedit.path.path.removePtFromSelection(z):svgedit.path.path.addPtsToSelection(z);else{if(svgedit.path.path.selected_pts.length<=1||!u.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(z)}}else if(u.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,h];D=u.split("_")[1].split("c");z=D[0]-0;n=D=D[1]-0;q= svgedit.path.path.segs[z];svgedit.path.path.selectPt(z,D);if(n==2){E=1;u=q.next}else{E=2;u=q.prev}if(!u)return;D=function(O,W){return Math.sqrt(Math.pow(O.x-W.x,2)+Math.pow(O.y-W.y,2))};z={x:q.item["x"+n],y:q.item["y"+n]};n=n==2?{x:q.item.x,y:q.item.y}:{x:u.item.x,y:u.item.y};q={x:u.item["x"+E],y:u.item["y"+E]};u=D(z,n);D=D(q,n);z=Math.abs(Math.round(Math.atan2(z.y-n.y,z.x-n.x)*(180/Math.PI),0)-Math.round(Math.atan2(q.y-n.y,q.x-n.x)*(180/Math.PI),0))==180;if(Math.abs(u-D)<5&&z){svgedit.path.setLinkControlPoints(true); svgedit.path.is_linked=true}else{svgedit.path.setLinkControlPoints(false);svgedit.path.is_linked=false}}if(!svgedit.path.path.dragging){if(sa==null)sa=ra.getRubberBandBox();ma(sa,{x:F*v,y:h*v,width:0,height:0,display:"inline"},100)}}},mouseMove:function(D,z,F){G=true;var h=!D.altKey;if(Ha==="path"){if(A){var n=A.pathSegList,q=n.numberOfItems-1,u=svgedit.path.addCtrlGrip("1c1"),E=svgedit.path.addCtrlGrip("0c2");if(m){var H=E.getAttribute("cx")/v||0,J=E.getAttribute("cy")/v||0;u.setAttribute("cx",z); u.setAttribute("cy",F);u.setAttribute("display","inline");D=m[0];u=m[1];n.getItem(q);var O=z/v,W=F/v;H=h?D+(D-O):H;h=h?u+(u-W):J;E.setAttribute("cx",H*v);E.setAttribute("cy",h*v);E.setAttribute("display","inline");E=svgedit.path.getCtrlLine(1);J=svgedit.path.getCtrlLine(2);ma(E,{x1:z,y1:F,x2:D*v,y2:u*v,display:"inline"});ma(J,{x1:H*v,y1:h*v,x2:D*v,y2:u*v,display:"inline"});if(q===0)C=[z,F];else{n=n.getItem(q-1);z=n.x;F=n.y;if(n.pathSegType===6){z+=z-n.x2;F+=F-n.y2}else if(C){z=C[0]/v;F=C[1]/v}svgedit.path.replacePathSeg(6, q,[D,u,this.lastCtrlPoint[0]/v,this.lastCtrlPoint[1]/v,H,h],A)}}else if(h=this.stretchy){q=n.getItem(q);n=z;u=F;if(D.target.id==="pathpointgrip_0"&&svgedit.path.first_grip){n=svgedit.path.first_grip[0];u=svgedit.path.first_grip[1]}if(q.pathSegType===6)svgedit.path.replacePathSeg(6,1,[z,F,(this.lastCtrlPoint[0]/v||q.x+(q.x-q.x2))*v,(this.lastCtrlPoint[1]/v||q.y+(q.y-q.y2))*v,n,u],h);else C?svgedit.path.replacePathSeg(6,1,[z,F,C[0],C[1],z,F],h):svgedit.path.replacePathSeg(4,1,[z,F],h)}}}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);D=svgedit.path.getPointFromGrip({x:z,y:F},svgedit.path.path);q=D.x-n.x;n=D.y-n.y;svgedit.path.path.dragging=[z,F];!h||!svgedit.path.is_linked?svgedit.path.setLinkControlPoints(false):svgedit.path.setLinkControlPoints(true);svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(q,n):svgedit.path.path.movePts(q,n)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next|| this.prev){var ca=sa.getBBox(),T=svgedit.path.getGripPt(this);ca=svgedit.math.rectsIntersect(ca,{x:T.x,y:T.y,width:0,height:0});this.select(ca);ca&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(D,z,F,h){var n=oa("ctrlpointgrip_1c1"),q=oa("ctrlpointgrip_0c2");this.lastCtrlPoint=n?[n.getAttribute("cx"),n.getAttribute("cy")]:[F,h];if(!svgedit.path.first_grip)svgedit.path.first_grip=q?[q.getAttribute("cx"),q.getAttribute("cy")]:[F,h];if(Ha==="path"){m=null;if(!A){z=oa(ba());Ka= false;C=null}return{keep:true,element:z}}if(svgedit.path.path.dragging){z=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(z)}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);Ha="pathedit";xa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);f=false},toSelectMode:function(D){var z=D==svgedit.path.path.elem;Ha="select";svgedit.path.path.show(false);k=false;xa();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(z){M("selected",[D]);qb([D],true)}},addSubPath:function(D){if(D){Ha="path";f=true}else{La.clear(true);La.toEditMode(svgedit.path.path.elem)}},select:function(D){if(k=== D){La.toEditMode(D);Ha="pathedit"}else k=D},reorient:function(){var D=I[0];if(D)if(na(D)!=0){var z=new Da("Reorient path"),F={d:D.getAttribute("d"),transform:D.getAttribute("transform")};z.addSubCommand(new Ma(D,F));xa();this.resetOrientation(D);wa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed",I)}},clear:function(D){k=null;if(A){var z=oa(ba());$(oa("path_stretch_line")).remove();D&&$(z).remove();$(oa("pathpointgrip_container")).find("*").attr("display", "none");A=C=null;Ka=false}else Ha=="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=aa(z).matrix;z.clear();D.removeAttribute("transform");z=D.pathSegList;for(var h=z.numberOfItems,n=0;n0){u=h.getItem(n-1).pathSegType;if(u===2){q(n-1,1);F();break}else if(u===1&&h.numberOfItems-1===n){q(n,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){c.setMode("select");c.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 h=z.getItem(0),n=null;D=[];D.push(["M",h.x,",",h.y," C"].join(""));for(var q=1;q<=F-4;q+=3){var u=z.getItem(q),E=z.getItem(q+1),H=z.getItem(q+2);if(n)if((h=svgedit.path.smoothControlPoints(n,u,h))&&h.length==2){u=D[D.length-1].split(",");u[2]=h[0].x;u[3]=h[0].y;D[D.length-1]=u.join(",");u=h[1]}D.push([u.x, u.y,E.x,E.y,H.x,H.y].join(","));h=H;n=E}for(D.push("L");q0;);La.clear(true);$.each(p.childNodes,function(m,C){m&&C.nodeType===8&&C.data.indexOf("Created with")>=0&&p.insertBefore(C,p.firstChild)});if(N){Eb();rb([N])}$("#canvasGrid").attr("display","none");var f=[];$(p).find("g:data(gsvg)").each(function(){for(var m=this.attributes, C=m.length,A=0;A=0;F--){z=D.item(F);q=C(z.nodeValue);if(!(u.indexOf(z.localName)>=0))if(q!="")if(q.indexOf("pointer-events")!==0)if(!(z.localName==="class"&&q.indexOf("se_")===0)){m.push(" ");if(z.localName==="d")q=La.convertPath(f,true);if(isNaN(q)){if(G.test(q))q=svgedit.units.shortFloat(q)+A}else q=svgedit.units.shortFloat(q); if($a.apply&&f.nodeName==="image"&&z.localName==="href"&&$a.images&&$a.images==="embed"){var E=Va[q];if(E)q=E}if(!z.namespaceURI||z.namespaceURI==b||ya[z.namespaceURI]){m.push(z.nodeName);m.push('="');m.push(q);m.push('"')}}}}if(f.hasChildNodes()){m.push(">");k++;D=false;for(F=0;F");break;case 8:m.push("\n");m.push(Array(k+1).join(" "));m.push("