2015-12-07 22:20:26 +00:00
( 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 < this . _endIndex && this . _isCurrentSpace ( ) ; ) this . _currentIndex ++ ; return this . _currentIndex < this . _endIndex } ; b . prototype . _skipOptionalSpacesOrDelimiter = function ( ) { if ( this . _currentIndex < this . _endIndex &&
! this . _isCurrentSpace ( ) && this . _string . charAt ( this . _currentIndex ) != "," ) return false ; if ( this . _skipOptionalSpaces ( ) ) if ( this . _currentIndex < this . _endIndex && this . _string . charAt ( this . _currentIndex ) == "," ) { this . _currentIndex ++ ; this . _skipOptionalSpaces ( ) } return this . _currentIndex < this . _endIndex } ; b . prototype . hasMoreData = function ( ) { return this . _currentIndex < this . _endIndex } ; b . prototype . peekSegmentType = function ( ) { return this . _pathSegTypeFromChar ( this . _string [ this . _currentIndex ] ) } ; b . prototype . _pathSegTypeFromChar =
function ( l ) { switch ( l ) { case "Z" : case "z" : return SVGPathSeg . PATHSEG _CLOSEPATH ; case "M" : return SVGPathSeg . PATHSEG _MOVETO _ABS ; case "m" : return SVGPathSeg . PATHSEG _MOVETO _REL ; case "L" : return SVGPathSeg . PATHSEG _LINETO _ABS ; case "l" : return SVGPathSeg . PATHSEG _LINETO _REL ; case "C" : return SVGPathSeg . PATHSEG _CURVETO _CUBIC _ABS ; case "c" : return SVGPathSeg . PATHSEG _CURVETO _CUBIC _REL ; case "Q" : return SVGPathSeg . PATHSEG _CURVETO _QUADRATIC _ABS ; case "q" : return SVGPathSeg . PATHSEG _CURVETO _QUADRATIC _REL ; case "A" : return SVGPathSeg . PATHSEG _ARC _ABS ;
case "a" : return SVGPathSeg . PATHSEG _ARC _REL ; case "H" : return SVGPathSeg . PATHSEG _LINETO _HORIZONTAL _ABS ; case "h" : return SVGPathSeg . PATHSEG _LINETO _HORIZONTAL _REL ; case "V" : return SVGPathSeg . PATHSEG _LINETO _VERTICAL _ABS ; case "v" : return SVGPathSeg . PATHSEG _LINETO _VERTICAL _REL ; case "S" : return SVGPathSeg . PATHSEG _CURVETO _CUBIC _SMOOTH _ABS ; case "s" : return SVGPathSeg . PATHSEG _CURVETO _CUBIC _SMOOTH _REL ; case "T" : return SVGPathSeg . PATHSEG _CURVETO _QUADRATIC _SMOOTH _ABS ; case "t" : return SVGPathSeg . PATHSEG _CURVETO _QUADRATIC _SMOOTH _REL ;
default : return SVGPathSeg . PATHSEG _UNKNOWN } } ; b . prototype . _nextCommandHelper = function ( l , s ) { if ( ( l == "+" || l == "-" || l == "." || l >= "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 < this . _endIndex && this . _string . charAt ( this . _currentIndex ) == "+" ) this . _currentIndex ++ ; else if ( this . _currentIndex < this . _endIndex && this . _string . charAt ( this . _currentIndex ) == "-" ) { this . _currentIndex ++ ; d = - 1 } if ( ! ( this . _currentIndex == this . _endIndex || ( this . _string . charAt ( this . _currentIndex ) < "0" || this . _string . charAt ( this . _currentIndex ) > "9" ) && this . _string . charAt ( this . _currentIndex ) !=
"." ) ) { for ( var B = this . _currentIndex ; this . _currentIndex < this . _endIndex && this . _string . charAt ( 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 ) == "." ) { this . _currentIndex ++ ; if ( this . _currentIndex >= this . _endIndex || this . _string . charAt ( this . _currentIndex ) < "0" || this . _string . charAt ( this . _currentIndex ) >
"9" ) return ; for ( ; this . _currentIndex < this . _endIndex && this . _string . charAt ( 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 ) == "e" || this . _string . charAt ( this . _currentIndex ) == "E" ) && this . _string . charAt ( this . _currentIndex + 1 ) != "x" && this . _string . charAt ( this . _currentIndex + 1 ) != "m" ) { this . _currentIndex ++ ; if ( this . _string . charAt ( this . _currentIndex ) ==
"+" ) this . _currentIndex ++ ; else if ( this . _string . charAt ( this . _currentIndex ) == "-" ) { this . _currentIndex ++ ; p = - 1 } if ( this . _currentIndex >= this . _endIndex || this . _string . charAt ( this . _currentIndex ) < "0" || this . _string . charAt ( this . _currentIndex ) > "9" ) return ; for ( ; this . _currentIndex < this . _endIndex && this . _string . charAt ( 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 < g ; c ++ ) if ( p [ l [ c ] ] ) return b . apply ( this , arguments ) } } } } a . hotkeys = { version : "0.8" , specialKeys : { 8 : "backspace" , 9 : "tab" , 13 : "return" , 16 : "shift" , 17 : "ctrl" , 18 : "alt" , 19 : "pause" , 20 : "capslock" , 27 : "esc" , 32 : "space" , 33 : "pageup" , 34 : "pagedown" , 35 : "end" , 36 : "home" , 37 : "left" , 38 : "up" , 39 : "right" , 40 : "down" , 45 : "insert" , 46 : "del" , 96 : "0" , 97 : "1" , 98 : "2" , 99 : "3" , 100 : "4" , 101 : "5" , 102 : "6" , 103 : "7" , 104 : "8" , 105 : "9" ,
106 : "*" , 107 : "+" , 109 : "-" , 110 : "." , 111 : "/" , 112 : "f1" , 113 : "f2" , 114 : "f3" , 115 : "f4" , 116 : "f5" , 117 : "f6" , 118 : "f7" , 119 : "f8" , 120 : "f9" , 121 : "f10" , 122 : "f11" , 123 : "f12" , 144 : "numlock" , 145 : "scroll" , 191 : "/" , 224 : "meta" , 219 : "[" , 221 : "]" } , shiftNums : { "`" : "~" , "1" : "!" , "2" : "@" , "3" : "#" , "4" : "$" , "5" : "%" , "6" : "^" , "7" : "&" , "8" : "*" , "9" : "(" , "0" : ")" , "-" : "_" , "=" : "+" , ";" : ": " , "'" : '"' , "," : "<" , "." : ">" , "/" : "?" , "\\" : "|" } } ; a . each ( [ "keydown" , "keyup" , "keypress" ] , function ( ) { a . event . special [ this ] = { add : 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 < Fa ? za [ ya ] || ( Ia [ Ja + 1 ] && isNaN ( Ia [ Ja + 1 ] ) ? { } : [ ] ) : la } else if ( a . isArray ( X [ ya ] ) ) X [ ya ] . push ( la ) ; else X [ ya ] = X [ ya ] !== g ? [ X [ ya ] , la ] : la } else if ( ya ) X [ ya ] = U ? g : "" } ) ; return X } ; v [ L ] = b ( s ,
0 ) ; v [ Z ] = N = b ( s , 1 ) ; a . elemUrlAttr || ( a . elemUrlAttr = function ( da ) { return a . extend ( ja , da ) } ) ( { a : aa , base : aa , iframe : "src" , img : "src" , input : "src" , form : "action" , link : aa , script : "src" } ) ; S = a . elemUrlAttr ; a . fn [ L ] = b ( c , L ) ; a . fn [ Z ] = b ( c , Z ) ; Q . pushState = K = function ( da , U ) { if ( e ( da ) && /^#/ . test ( da ) && U === g ) U = 2 ; var X = da !== g ; X = B ( o [ qa ] [ aa ] , X ? da : { } , X ? U : 2 ) ; o [ qa ] [ aa ] = X + ( /#/ . test ( X ) ? "" : "#" ) } ; Q . getState = I = function ( da , U ) { return da === g || typeof da === "boolean" ? N ( da ) : N ( U ) [ da ] } ; Q . removeState = function ( da ) { var U = { } ; if ( da !== g ) { U = I ( ) ; a . each ( a . isArray ( da ) ?
da : arguments , function ( X , na ) { delete U [ na ] } ) } K ( U , 2 ) } ; R . hashchange = a . extend ( R . hashchange , { add : function ( da ) { function U ( na ) { var oa = na [ Z ] = B ( ) ; na . getState = function ( ma , la ) { return ma === g || typeof ma === "boolean" ? v ( oa , ma ) : v ( oa , la ) [ ma ] } ; X . apply ( this , arguments ) } var X ; if ( a . isFunction ( da ) ) { X = da ; return U } else { X = da . handler ; da . handler = U } } } ) } ) ( jQuery , this ) ;
( function ( a , o , e ) { function b ( B ) { B = B || o [ c ] [ g ] ; return B . replace ( /^[^#]*#?(.*)$/ , "$1" ) } var l , s = a . event . special , c = "location" , g = "href" , d = document . documentMode , p = a . browser . msie && ( d === e || d < 8 ) , w = "onhashchange" in o && ! p ; a . hashchangeDelay = 100 ; s . hashchange = a . extend ( s . hashchange , { setup : function ( ) { if ( w ) return false ; a ( l . start ) } , teardown : function ( ) { if ( w ) return false ; a ( l . stop ) } } ) ; l = function ( ) { function B ( ) { K = I = function ( S ) { return S } ; if ( p ) { Q = a ( '<iframe src="javascript:0"/>' ) . 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 ; ma < oa ; ma ++ ) { var la = N [ ma ] , ya = la . id ; if ( ya === "svg_eof" ) break ; a ( "#" + ya ) ; la = la . getElementsByTagNameNS ( p , "svg" ) [ 0 ] ; var za = document . createElementNS ( p , "svg" ) ; za . setAttributeNS ( p , "viewBox" ,
[ 0 , 0 , B , v ] . join ( " " ) ) ; var Ja = la . getAttribute ( "width" ) , Ia = la . getAttribute ( "height" ) ; la . removeAttribute ( "width" ) ; la . removeAttribute ( "height" ) ; la . getAttribute ( "viewBox" ) || la . setAttribute ( "viewBox" , [ 0 , 0 , Ja , Ia ] . join ( " " ) ) ; za . setAttribute ( "xmlns" , p ) ; za . setAttribute ( "width" , B ) ; za . setAttribute ( "height" , v ) ; za . setAttribute ( "xmlns:xlink" , w ) ; za . setAttribute ( "class" , "svg_icon" ) ; Z || ( la = la . cloneNode ( true ) ) ; za . appendChild ( la ) ; if ( da ) { Z || za . cloneNode ( true ) ; X . empty ( ) . append ( za ) ; la = qa + d ( X . html ( ) ) ; la = a ( new Image ) . attr ( { "class" : "svg_icon" ,
src : la } ) } else la = e ( a ( za ) , ma ) ; ja ( la , ya ) } l . placement && a . each ( l . placement , function ( Fa , Ma ) { o [ Ma ] && a ( Fa ) . each ( function ( Da ) { var wa = o [ Ma ] . clone ( ) ; if ( Da > 0 && ! 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 < da . length ) ; return U . join ( "" ) } var p = "http://www.w3.org/2000/svg" , w = "http://www.w3.org/1999/xlink" , B = l . w ? l . w : 24 , v = l . h ? l . h : 24 , N , Q , K , I = false , S = false , R = 0 , L = navigator . userAgent , Z = ! ! window . opera ; L . indexOf ( "Safari/" ) > - 1 && L . indexOf ( "Chrome/" ) ; var qa = "data:image/svg+xml;charset=utf-8;base64," ; if ( l . svgz ) { var aa = a ( '<object data="' + b + '" type=image/svg+xml>' ) . 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 < oa ; ma ++ ) { var za = na [ ma ] ; za . getAttribute ( "fill" ) === la && za . setAttribute ( "fill" , ya ) ; za . getAttribute ( "stroke" ) === la && za . setAttribute ( "stroke" , ya ) ; za . getAttribute ( "filter" ) === la && za . setAttribute ( "filter" , ya ) } } ) ; return da } } ; a . getSvgIcon = function ( b , l ) { var s = o [ b ] ; if ( l && s ) s = e ( s , 0 , true ) . clone ( true ) ; return s } ; a . resizeSvgIcons = function ( b ) { var l = ! a ( ".svg_icon:first" ) . length ; a . each ( b , function ( s , c ) { var g = a . isArray ( c ) , d = g ? c [ 0 ] : c , p = g ? c [ 1 ] : c ; if ( l ) s = s . replace ( /\.svg_icon/g , "svg" ) ; a ( s ) . each ( function ( ) { this . setAttribute ( "width" ,
d ) ; this . setAttribute ( "height" , p ) ; if ( window . opera && window . widget ) { this . parentNode . style . width = d + "px" ; this . parentNode . style . height = p + "px" } } ) } ) } } ) ( jQuery ) ; ( function ( ) { function a ( b , l , s ) { b = document . createElementNS ( o . svg , b ) ; if ( e ) for ( var c in l ) b . setAttribute ( c , l [ c ] ) ; else for ( c in l ) { var g = l [ c ] , d = b [ c ] ; if ( d && d . constructor === "SVGLength" ) d . baseVal . value = g ; else b . setAttribute ( c , g ) } s && s . appendChild ( b ) ; return b } var o = { svg : "http://www.w3.org/2000/svg" , xlink : "http://www.w3.org/1999/xlink" } ; if ( ! window . console ) window . console = new function ( ) { this . log = function ( ) { } ; this . dir = function ( ) { } } ; $ . jGraduate = { Paint : function ( b ) { b = b || { } ; this . alpha = isNaN ( b . alpha ) ? 100 : b . alpha ; if ( b . copy ) { this . type =
b . copy . type ; this . alpha = b . copy . alpha ; this . radialGradient = this . linearGradient = this . solidColor = null ; switch ( this . type ) { case "solidColor" : this . solidColor = b . copy . solidColor ; break ; case "linearGradient" : this . linearGradient = b . copy . linearGradient . cloneNode ( true ) ; break ; case "radialGradient" : this . radialGradient = b . copy . radialGradient . cloneNode ( true ) } } else if ( b . linearGradient ) { this . type = "linearGradient" ; this . radialGradient = this . solidColor = null ; this . linearGradient = b . linearGradient . cloneNode ( true ) } else if ( b . radialGradient ) { this . type =
"radialGradient" ; this . linearGradient = this . solidColor = null ; this . radialGradient = b . radialGradient . cloneNode ( true ) } else if ( b . solidColor ) { this . type = "solidColor" ; this . solidColor = b . solidColor } else { this . type = "none" ; this . radialGradient = this . linearGradient = this . solidColor = null } } } ; jQuery . fn . jGraduateDefaults = { paint : new $ . jGraduate . Paint , window : { pickerTitle : "Drag markers to pick a paint" } , images : { clientPath : "images/" } , newstop : "inverse" } ; var e = navigator . userAgent . indexOf ( "Gecko/" ) >= 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 < M ) { ea . prev ( ) . before ( ea ) ; va = $ ( ga ) . find ( "stop" ) } M = P } ) } var w = $ ( this ) , B = $ . extend ( true , { } , jQuery . fn . jGraduateDefaults , b ) , v = w . attr ( "id" ) , N = "#" + w . attr ( "id" ) + " " ; if ( N ) { var Q = function ( ) { switch ( w . paint . type ) { case "radialGradient" : w . paint . linearGradient = null ; break ; case "linearGradient" : w . paint . radialGradient = null ; break ; case "solidColor" : w . paint . radialGradient = w . paint . linearGradient = null } $ . isFunction ( w . okCallback ) && w . okCallback ( w . paint ) ; w . hide ( ) } , K = function ( ) { $ . isFunction ( w . cancelCallback ) && w . cancelCallback ( ) ;
w . hide ( ) } ; $ . extend ( true , w , { paint : new $ . jGraduate . Paint ( { copy : B . paint } ) , okCallback : $ . isFunction ( l [ 1 ] ) && l [ 1 ] || null , cancelCallback : $ . isFunction ( l [ 2 ] ) && l [ 2 ] || null } ) ; w . position ( ) ; var I = null , S = $ ( window ) ; if ( w . paint . type == "none" ) w . paint = $ . jGraduate . Paint ( { solidColor : "ffffff" } ) ; w . addClass ( "jGraduate_Picker" ) ; w . html ( '<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="' +
v + '_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>' ) ; var R = $ ( N + "> .jGraduate_colPick" ) , L = $ ( N + "> .jGraduate_gradPick" ) ; L . html ( '<div id="' + v + '_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">' + B . window . pickerTitle + '</h2><div id="' + v + '_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="' + v + '_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="' +
v + '_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + v + '_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="' + v + '_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' +
v + '_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="' + v + '_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + v + '_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="' +
v + '_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="' + v + '_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + v + '_jGraduate_fy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_StopSection jGraduate_SpreadMethod"><label class="jGraduate_Form_Heading">Spread method</label><div class="jGraduate_Form_Section"><select class="jGraduate_spreadMethod"><option value=pad selected>Pad</option><option value=reflect>Reflect</option><option value=repeat>Repeat</option></select></div></div><div class="jGraduate_Form"><div class="jGraduate_Slider jGraduate_RadiusField jGraduate_rg_field"><label class="prelabel">Radius:</label><div id="' +
v + '_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="' + v + '_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + v + '_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="' + v + '_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="' +
v + '_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + v + '_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="' + v + '_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="' + v + '_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="' + B . images . clientPath +
'rangearrows2.gif"></div><label><input type="text" id="' + v + '_jGraduate_AngleInput" size="3" value="0"/>\u00ba </label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="' + v + '_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="' + v + '_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + v + '_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="' +
v + '_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="' + v + '_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>' ) ; 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" } , 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 = "" ; 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 } 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 = $ ( "<div/>" ) . 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 = $ ( "<div/>" ) . 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 ; la < sa ; la ++ ) s ( 0 , 0 , 0 , 0 , va [ la ] ) ; lb . val ( ga . getAttribute ( "spreadMethod" ) ||
"pad" ) ; var hb , eb = false ; Ba . setAttribute ( "fill-opacity" , na / 100 ) ; $ ( "#" + v + " div.grad_coord" ) . mousedown ( function ( ia ) { ia . preventDefault ( ) ; Ua = $ ( this ) ; Ua . offset ( ) ; hb = Ua . parent ( ) . offset ( ) ; S . mousemove ( Xa ) . mouseup ( wb ) } ) ; $ ( "#" + v + "_jGraduate_Ok" ) . bind ( "click touchstart" , function ( ) { w . paint . type = Y ; w . paint [ Y ] = ga . cloneNode ( true ) ; w . paint . solidColor = null ; Q ( ) } ) ; $ ( "#" + v + "_jGraduate_Cancel" ) . bind ( "click touchstart" , function ( ) { K ( ) } ) ; if ( Y === "radialGradient" ) if ( eb ) ra . show ( ) ; else { ra . hide ( ) ; ja . fx . val ( "" ) ; ja . fy . val ( "" ) } $ ( "#" +
v + "_jGraduate_match_ctr" ) [ 0 ] . checked = ! eb ; var sb , ib ; $ ( "#" + v + "_jGraduate_match_ctr" ) . change ( function ( ) { eb = ! this . checked ; ra . toggle ( eb ) ; ja . fx . val ( "" ) ; ja . fy . val ( "" ) ; var ia = ga ; if ( eb ) { var ba = sb || 0.5 , ka = ib || 0.5 ; ia . setAttribute ( "fx" , ba ) ; ia . setAttribute ( "fy" , ka ) ; ja . fx . val ( ba ) ; ja . fy . val ( ka ) } else { sb = ia . getAttribute ( "fx" ) ; ib = ia . getAttribute ( "fy" ) ; ia . removeAttribute ( "fx" ) ; ia . removeAttribute ( "fy" ) } } ) ; va = ga . getElementsByTagNameNS ( o . svg , "stop" ) ; sa = va . length ; if ( sa < 2 ) { for ( ; sa < 2 ; ) { ga . appendChild ( document . createElementNS ( o . svg ,
"stop" ) ) ; ++ sa } va = ga . getElementsByTagNameNS ( o . svg , "stop" ) } var ab ; na = L = 0 ; if ( Y === "radialGradient" ) { U = ga . gradientTransform . baseVal ; if ( U . numberOfItems === 2 ) { sa = U . getItem ( 0 ) ; U = U . getItem ( 1 ) ; if ( sa . type === 2 && U . type === 3 ) { sa = U . matrix ; if ( sa . a !== 1 ) L = Math . round ( - ( 1 - sa . a ) * 100 ) ; else if ( sa . d !== 1 ) L = Math . round ( ( 1 - sa . d ) * 100 ) } } else if ( U . numberOfItems === 3 ) { da = U . getItem ( 0 ) ; sa = U . getItem ( 1 ) ; U = U . getItem ( 2 ) ; if ( da . type === 4 && sa . type === 2 && U . type === 3 ) { na = Math . round ( da . angle ) ; sa = U . matrix ; if ( sa . a !== 1 ) L = Math . round ( - ( 1 - sa . a ) * 100 ) ; else if ( sa . d !==
1 ) L = Math . round ( ( 1 - sa . d ) * 100 ) } } } L = { radius : { handle : "#" + v + "_jGraduate_RadiusArrows" , input : "#" + v + "_jGraduate_RadiusInput" , val : ( ga . getAttribute ( "r" ) || 0.5 ) * 100 } , opacity : { handle : "#" + v + "_jGraduate_OpacArrows" , input : "#" + v + "_jGraduate_OpacInput" , val : w . paint . alpha || 100 } , ellip : { handle : "#" + v + "_jGraduate_EllipArrows" , input : "#" + v + "_jGraduate_EllipInput" , val : L } , angle : { handle : "#" + v + "_jGraduate_AngleArrows" , input : "#" + v + "_jGraduate_AngleInput" , val : na } } ; $ . each ( L , function ( ia , ba ) { var ka = $ ( ba . handle ) ; ka . mousedown ( function ( M ) { var P =
ka . parent ( ) ; ab = { type : ia , elem : ka , input : $ ( ba . input ) , parent : P , offset : P . offset ( ) } ; S . mousemove ( ob ) . mouseup ( pb ) ; M . preventDefault ( ) } ) ; $ ( ba . input ) . val ( ba . val ) . change ( function ( ) { var M = + this . value , P = 0 , ea = Y === "radialGradient" ; switch ( ia ) { case "radius" : ea && ga . setAttribute ( "r" , M / 100 ) ; P = Math . pow ( M / 100 , 0.4 ) / 2 * 145 ; break ; case "opacity" : w . paint . alpha = M ; Ba . setAttribute ( "fill-opacity" , M / 100 ) ; P = M * 1.45 ; break ; case "ellip" : $a = Ka = 1 ; if ( M === 0 ) { P = 72.5 ; break } if ( M > 99.5 ) M = 99.5 ; if ( M > 0 ) Ka = 1 - M / 100 ; else $a = - ( M / 100 ) - 1 ; P = 145 * ( ( M + 100 ) /
2 ) / 100 ; 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 < b . length ; l ++ ) $ ( this ) . find ( 'A[href="' + b [ l ] + '"]' ) . parent ( ) . addClass ( "disabled" ) } ) ; return $ ( this ) } , enableContextMenuItems : function ( e ) { if ( e == undefined ) { $ ( this ) . find ( "LI.disabled" ) . removeClass ( "disabled" ) ; return $ ( this ) } $ ( this ) . each ( function ( ) { if ( e != undefined ) for ( var b = e . split ( "," ) , l =
0 ; l < b . length ; l ++ ) $ ( this ) . find ( 'A[href="' + b [ l ] + '"]' ) . parent ( ) . removeClass ( "disabled" ) } ) ; return $ ( this ) } , disableContextMenu : function ( ) { $ ( this ) . each ( function ( ) { $ ( this ) . addClass ( "disabled" ) } ) ; return $ ( this ) } , enableContextMenu : function ( ) { $ ( this ) . each ( function ( ) { $ ( this ) . removeClass ( "disabled" ) } ) ; return $ ( this ) } , destroyContextMenu : function ( ) { $ ( this ) . each ( function ( ) { $ ( this ) . unbind ( "mousedown" ) . unbind ( "mouseup" ) } ) ; return $ ( this ) } } ) } ( jQuery ) ; var svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . browser ) svgedit . browser = { } ; var a = ! ! document . createElementNS && ! ! document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) . createSVGRect ; svgedit . browser . supportsSvg = function ( ) { return a } ; if ( svgedit . browser . supportsSvg ( ) ) { var o = navigator . userAgent , e = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) , b = ! ! window . opera , l = o . indexOf ( "AppleWebKit" ) >= 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 <a href='http://opera.com'>latest version</a> 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 < this . numberOfItems ; ++ l ) { var s = this . _list . getItem ( l ) ; b = b ; s = s ; var c = s . matrix , g = "" ; switch ( s . type ) { case 1 : g = "matrix(" + [ c . a , c . b , c . c , c . d , c . e , c . f ] . join ( "," ) + ")" ; break ; case 2 : g = "translate(" + c . e + "," + c . f + ")" ; break ; case 3 : g =
c . a == c . d ? "scale(" + c . a + ")" : "scale(" + c . a + "," + c . d + ")" ; break ; case 4 : var d = 0 ; g = 0 ; if ( s . angle != 0 ) { d = 1 - c . a ; g = ( d * c . f + c . b * c . e ) / ( d * d + c . b * c . b ) ; d = ( c . e - c . b * g ) / d } g = "rotate(" + s . angle + " " + d + "," + g + ")" } b = b + ( g + " " ) } this . _elem . setAttribute ( "transform" , b ) } ; this . _list = this ; this . _init = function ( ) { var b = this . _elem . getAttribute ( "transform" ) ; if ( b ) for ( var l = /\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/ , s = true ; s ; ) { s = b . match ( l ) ; b = b . replace ( l , "" ) ; if ( s && s [ 1 ] ) { var c = s [ 1 ] . split ( /\s*\(/ ) , g = c [ 0 ] ; c = c [ 1 ] . match ( /\s*(.*?)\s*\)/ ) ;
c [ 1 ] = c [ 1 ] . replace ( /(\d)-/g , "$1 -" ) ; var d = c [ 1 ] . split ( /[, ]+/ ) , p = "abcdef" . split ( "" ) , w = a . createSVGMatrix ( ) ; $ . each ( d , function ( N , Q ) { d [ N ] = parseFloat ( Q ) ; if ( g == "matrix" ) w [ p [ N ] ] = d [ N ] } ) ; c = a . createSVGTransform ( ) ; var B = "set" + g . charAt ( 0 ) . toUpperCase ( ) + g . slice ( 1 ) , v = g == "matrix" ? [ w ] : d ; if ( g == "scale" && v . length == 1 ) v . push ( v [ 0 ] ) ; else if ( g == "translate" && v . length == 1 ) v . push ( 0 ) ; else if ( g == "rotate" && v . length == 1 ) { v . push ( 0 ) ; v . push ( 0 ) } c [ B ] . apply ( c , v ) ; this . _list . appendItem ( c ) } } } ; this . _removeFromOtherLists = function ( b ) { if ( b ) { var l =
false , s ; for ( s in o ) { for ( var c = o [ s ] , g = 0 , d = c . _xforms . length ; g < d ; ++ g ) if ( c . _xforms [ g ] == b ) { l = true ; c . removeItem ( g ) ; break } if ( l ) break } } } ; this . numberOfItems = 0 ; this . clear = function ( ) { this . numberOfItems = 0 ; this . _xforms = [ ] } ; this . initialize = function ( b ) { this . numberOfItems = 1 ; this . _removeFromOtherLists ( b ) ; this . _xforms = [ b ] } ; this . getItem = function ( b ) { if ( b < this . numberOfItems && b >= 0 ) return this . _xforms [ b ] ; throw { code : 1 } ; } ; this . insertItemBefore = function ( b , l ) { var s = null ; if ( l >= 0 ) if ( l < this . numberOfItems ) { this . _removeFromOtherLists ( b ) ;
s = Array ( this . numberOfItems + 1 ) ; for ( var c = 0 ; c < l ; ++ c ) s [ c ] = this . _xforms [ c ] ; s [ c ] = b ; for ( var g = c + 1 ; c < this . numberOfItems ; ++ g , ++ c ) s [ g ] = this . _xforms [ c ] ; this . numberOfItems ++ ; this . _xforms = s ; s = b ; this . _list . _update ( ) } else s = this . _list . appendItem ( b ) ; return s } ; this . replaceItem = function ( b , l ) { var s = null ; if ( l < this . numberOfItems && l >= 0 ) { this . _removeFromOtherLists ( b ) ; s = this . _xforms [ l ] = b ; this . _list . _update ( ) } return s } ; this . removeItem = function ( b ) { if ( b < this . numberOfItems && b >= 0 ) { for ( var l = this . _xforms [ b ] , s = Array ( this . numberOfItems -
1 ) , c = 0 ; c < b ; ++ c ) s [ c ] = this . _xforms [ c ] ; for ( b = c ; b < this . numberOfItems - 1 ; ++ b , ++ c ) s [ b ] = this . _xforms [ c + 1 ] ; this . numberOfItems -- ; this . _xforms = s ; this . _list . _update ( ) ; return l } else throw { code : 1 } ; } ; this . appendItem = function ( b ) { this . _removeFromOtherLists ( b ) ; this . _xforms . push ( b ) ; this . numberOfItems ++ ; this . _list . _update ( ) ; return b } } ; svgedit . transformlist . resetListMap = function ( ) { o = { } } ; svgedit . transformlist . removeElementFromListMap = function ( e ) { e . id && o [ e . id ] && delete o [ e . id ] } ; svgedit . transformlist . getTransformList = function ( e ) { if ( svgedit . browser . supportsNativeTransformLists ( ) ) if ( e . transform ) return e . transform . baseVal ;
else if ( e . gradientTransform ) return e . gradientTransform . baseVal ; else { if ( e . patternTransform ) return e . patternTransform . baseVal } else { var b = e . id ; b || ( b = "temp" ) ; var l = o [ b ] ; if ( ! l || b == "temp" ) { o [ b ] = new svgedit . transformlist . SVGTransformList ( e ) ; o [ b ] . _init ( ) ; l = o [ b ] } return l } return null } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . math ) svgedit . math = { } ; var a = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; svgedit . math . transformPoint = function ( o , e , b ) { return { x : b . a * o + b . c * e + b . e , y : b . b * o + b . d * e + b . f } } ; svgedit . math . isIdentity = function ( o ) { return o . a === 1 && o . b === 0 && o . c === 0 && o . d === 1 && o . e === 0 && o . f === 0 } ; svgedit . math . matrixMultiply = function ( ) { for ( var o = arguments , e = o . length , b = o [ e - 1 ] ; e -- > 1 ; ) b = o [ e - 1 ] . multiply ( b ) ; if ( Math . abs ( b . a ) < 1.0 E - 14 ) b . a = 0 ; if ( Math . abs ( b . b ) < 1.0 E - 14 ) b . b = 0 ; if ( Math . abs ( b . c ) < 1.0 E - 14 ) b . c = 0 ; if ( Math . abs ( b . d ) <
1.0 E - 14 ) b . d = 0 ; if ( Math . abs ( b . e ) < 1.0 E - 14 ) b . e = 0 ; if ( Math . abs ( b . f ) < 1.0 E - 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 && e < o . numberOfItems ? o . getItem ( e ) . matrix : a . createSVGMatrix ( ) ; l = svgedit . math . matrixMultiply ( l , s ) } return a . createSVGTransformFromMatrix ( l ) } ; svgedit . math . getMatrix = function ( o ) { o = svgedit . transformlist . getTransformList ( o ) ; return svgedit . math . transformListToTransform ( o ) . matrix } ; svgedit . math . snapToAngle = function ( o , e , b , l ) { var s = Math . PI / 4 ; b = b - o ; var c = l - e ; l = Math . sqrt ( b * b + c * c ) ; s = Math . round ( Math . atan2 ( c , b ) / s ) * s ; return { x : o + l * Math . cos ( s ) , y : e + l * Math . sin ( s ) , a : s } } ;
svgedit . math . rectsIntersect = function ( o , e ) { if ( ! o || ! e ) return false ; return e . x < o . x + o . width && e . x + e . width > o . x && e . y < o . y + o . height && e . y + e . height > o . 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 < p ; w ++ ) { var B = g [ w ] , v = c . getAttribute ( B ) ; if ( v ) isNaN ( v ) || c . setAttribute ( B , v / l [ d ] + d ) } } ; svgedit . units . convertToNum =
function ( c , g ) { if ( ! isNaN ( g ) ) return g - 0 ; if ( g . substr ( - 1 ) === "%" ) { var d = g . substr ( 0 , g . length - 1 ) / 100 , p = b . getWidth ( ) , w = b . getHeight ( ) ; return a . indexOf ( c ) >= 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 $ ( "<p/>" ) . text ( c ) . html ( ) } ; svgedit . utilities . fromXml = function ( c ) { return $ ( "<p/>" ) . 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 ( N < c . length ) ; return unescape ( g ) } ; svgedit . utilities . convertToXMLReferences = function ( c ) { for ( var g = "" , d = 0 ; d < c . length ; d ++ ) { var p = c . charCodeAt ( d ) ; if ( p < 128 ) g += c [ d ] ; else if ( p > 127 ) g += "&#" + p + ";" } return g } ; svgedit . utilities . text2xml = function ( c ) { if ( c . indexOf ( "<svg:svg" ) >= 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 < d ; p ++ ) { var B = g . getItem ( p ) ; if ( typeof B . x != "undefined" ) { c [ 0 ] . push ( w [ 0 ] ) ; c [ 1 ] . push ( w [ 1 ] ) ; if ( B . x1 ) { for ( var v = [ B . x1 , B . y1 ] , N = [ B . x2 , B . y2 ] , Q = [ B . x , B . y ] , K = 0 ; K < 2 ; K ++ ) { B = function ( Z ) { return Math . pow ( 1 - Z , 3 ) * w [ K ] + 3 * Math . pow ( 1 - Z , 2 ) * Z * v [ K ] + 3 * ( 1 - Z ) * Math . pow ( Z , 2 ) * N [ K ] + Math . pow ( Z , 3 ) * Q [ K ] } ; var I = 6 * w [ K ] - 12 * v [ K ] + 6 * N [ K ] , S = - 3 * w [ K ] + 9 * v [ K ] - 9 * N [ K ] + 3 * Q [ K ] , R = 3 * v [ K ] - 3 * w [ K ] ; if ( S == 0 ) { if ( I != 0 ) { I = - R / I ; 0 < I && I < 1 && c [ K ] . push ( B ( I ) ) } } else { R = Math . pow ( I , 2 ) - 4 * R * S ; if ( ! ( R < 0 ) ) { var L = ( - I + Math . sqrt ( R ) ) / ( 2 * S ) ; 0 < L && L < 1 && c [ K ] . push ( B ( L ) ) ;
I = ( - I - Math . sqrt ( R ) ) / ( 2 * S ) ; 0 < I && I < 1 && c [ K ] . push ( B ( I ) ) } } } w = Q } else { c [ 0 ] . push ( B . x ) ; c [ 1 ] . push ( B . y ) } } } g = Math . min . apply ( null , c [ 0 ] ) ; d = Math . max . apply ( null , c [ 0 ] ) - g ; p = Math . min . apply ( null , c [ 1 ] ) ; c = Math . max . apply ( null , c [ 1 ] ) - p ; return { x : g , y : p , width : d , height : c } } ; svgedit . utilities . getBBox = function ( c ) { var g = c || e . getSelectedElements ( ) [ 0 ] ; if ( c . nodeType != 1 ) return null ; c = null ; var d = g . nodeName ; switch ( d ) { case "text" : if ( g . textContent === "" ) { g . textContent = "a" ; c = g . getBBox ( ) ; g . textContent = "" } else try { c = g . getBBox ( ) } catch ( p ) { } break ;
case "path" : if ( svgedit . browser . supportsPathBBox ( ) ) try { c = g . getBBox ( ) } catch ( w ) { } else c = svgedit . utilities . getPathBBox ( g ) ; break ; case "g" : case "a" : c = a ( g ) ; break ; default : if ( d === "use" ) c = a ( g , true ) ; if ( d === "use" ) c || ( c = g . getBBox ( ) ) ; else if ( ~ o . indexOf ( d ) ) try { c = g . getBBox ( ) } catch ( B ) { g = $ ( g ) . closest ( "foreignObject" ) ; if ( g . length ) try { c = g [ 0 ] . getBBox ( ) } catch ( v ) { c = null } else c = null } } if ( c ) c = svgedit . utilities . bboxToObj ( c ) ; return c } ; svgedit . utilities . getRotationAngle = function ( c , g ) { var d = c || e . getSelectedElements ( ) [ 0 ] ; d = svgedit . transformlist . getTransformList ( d ) ;
if ( ! d ) return 0 ; for ( var p = d . numberOfItems , w = 0 ; w < p ; ++ w ) { var B = d . getItem ( w ) ; if ( B . type == 4 ) return g ? B . angle * Math . PI / 180 : B . angle } return 0 } ; svgedit . utilities . getElem = svgedit . browser . supportsSelectors ( ) ? function ( c ) { return s . querySelector ( "#" + c ) } : svgedit . browser . supportsXpath ( ) ? function ( c ) { return b . evaluate ( 'svg:svg[@id="svgroot"]//svg:*[@id="' + c + '"]' , l , function ( ) { return "http://www.w3.org/2000/svg" } , 9 , null ) . singleNodeValue } : function ( c ) { return $ ( s ) . find ( "[id=" + c + "]" ) [ 0 ] } ; svgedit . utilities . assignAttributes =
function ( c , g , d , p ) { d || ( d = 0 ) ; svgedit . browser . isOpera ( ) || s . suspendRedraw ( d ) ; for ( var w in g ) if ( d = w . substr ( 0 , 4 ) === "xml:" ? "http://www.w3.org/XML/1998/namespace" : w . substr ( 0 , 6 ) === "xlink:" ? "http://www.w3.org/1999/xlink" : null ) c . setAttributeNS ( d , w , g [ w ] ) ; else p ? svgedit . units . setUnitAttr ( c , w , g [ w ] ) : c . setAttribute ( w , g [ w ] ) ; svgedit . browser . isOpera ( ) || s . unsuspendRedraw ( null ) } ; svgedit . utilities . cleanupElement = function ( c ) { var g = s . suspendRedraw ( 60 ) , d = { "fill-opacity" : 1 , "stop-opacity" : 1 , opacity : 1 , stroke : "none" , "stroke-dasharray" : "none" ,
"stroke-linejoin" : "miter" , "stroke-linecap" : "butt" , "stroke-opacity" : 1 , "stroke-width" : 1 , rx : 0 , ry : 0 } , p ; for ( p in d ) { var w = d [ p ] ; c . getAttribute ( p ) == w && c . removeAttribute ( p ) } s . unsuspendRedraw ( g ) } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . sanitize ) svgedit . sanitize = { } ; var a = { } ; a [ "http://www.w3.org/1999/xlink" ] = "xlink" ; a [ "http://www.w3.org/XML/1998/namespace" ] = "xml" ; a [ "http://www.w3.org/2000/xmlns/" ] = "xmlns" ; a [ "http://svg-edit.googlecode.com" ] = "se" ; a [ "http://www.w3.org/1999/xhtml" ] = "xhtml" ; a [ "http://www.w3.org/1998/Math/MathML" ] = "mathml" ; var o = { } ; $ . each ( a , function ( l , s ) { o [ s ] = l } ) ; var e = { a : [ "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "mask" , "opacity" , "stroke" , "stroke-dasharray" ,
"stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" , "xlink:href" , "xlink:title" ] , circle : [ "class" , "clip-path" , "clip-rule" , "cx" , "cy" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "mask" , "opacity" , "r" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" ] , clipPath : [ "class" ,
"clipPathUnits" , "id" ] , defs : [ ] , style : [ "type" ] , desc : [ ] , ellipse : [ "class" , "clip-path" , "clip-rule" , "cx" , "cy" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "mask" , "opacity" , "requiredFeatures" , "rx" , "ry" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" ] , feGaussianBlur : [ "class" , "color-interpolation-filters" , "id" , "requiredFeatures" , "stdDeviation" ] , filter : [ "class" , "color-interpolation-filters" ,
"filterRes" , "filterUnits" , "height" , "id" , "primitiveUnits" , "requiredFeatures" , "width" , "x" , "xlink:href" , "y" ] , foreignObject : [ "class" , "font-size" , "height" , "id" , "opacity" , "requiredFeatures" , "style" , "transform" , "width" , "x" , "y" ] , g : [ "class" , "clip-path" , "clip-rule" , "id" , "display" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "mask" , "opacity" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" ,
"transform" , "font-family" , "font-size" , "font-style" , "font-weight" , "text-anchor" , "data-locked" ] , image : [ "class" , "clip-path" , "clip-rule" , "filter" , "height" , "id" , "mask" , "opacity" , "requiredFeatures" , "style" , "systemLanguage" , "transform" , "width" , "x" , "xlink:href" , "xlink:title" , "y" ] , line : [ "shape-rendering" , "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "marker-end" , "marker-mid" , "marker-start" , "mask" , "opacity" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" ,
"stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" , "x1" , "x2" , "y1" , "y2" ] , linearGradient : [ "class" , "id" , "gradientTransform" , "gradientUnits" , "requiredFeatures" , "spreadMethod" , "systemLanguage" , "x1" , "x2" , "xlink:href" , "y1" , "y2" ] , marker : [ "id" , "class" , "markerHeight" , "markerUnits" , "markerWidth" , "orient" , "preserveAspectRatio" , "refX" , "refY" , "systemLanguage" , "viewBox" ] , mask : [ "class" , "height" , "id" , "maskContentUnits" , "maskUnits" , "width" , "x" ,
"y" ] , metadata : [ "class" , "id" ] , path : [ "class" , "clip-path" , "clip-rule" , "d" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "marker-end" , "marker-mid" , "marker-start" , "mask" , "opacity" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" ] , pattern : [ "class" , "height" , "id" , "patternContentUnits" , "patternTransform" , "patternUnits" , "requiredFeatures" , "style" , "systemLanguage" , "viewBox" ,
"width" , "x" , "xlink:href" , "y" ] , polygon : [ "class" , "clip-path" , "clip-rule" , "id" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "class" , "marker-end" , "marker-mid" , "marker-start" , "mask" , "opacity" , "points" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" ] , polyline : [ "class" , "clip-path" , "clip-rule" , "id" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "marker-end" , "marker-mid" ,
"marker-start" , "mask" , "opacity" , "points" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" ] , radialGradient : [ "class" , "cx" , "cy" , "fx" , "fy" , "gradientTransform" , "gradientUnits" , "id" , "r" , "requiredFeatures" , "spreadMethod" , "systemLanguage" , "xlink:href" ] , rect : [ "shape-rendering" , "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "height" , "id" , "mask" ,
"opacity" , "requiredFeatures" , "rx" , "ry" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" , "width" , "x" , "y" ] , stop : [ "class" , "id" , "offset" , "requiredFeatures" , "stop-color" , "stop-opacity" , "style" , "systemLanguage" ] , svg : [ "class" , "clip-path" , "clip-rule" , "filter" , "id" , "height" , "mask" , "preserveAspectRatio" , "requiredFeatures" , "style" , "systemLanguage" , "viewBox" , "width" , "x" , "xmlns" , "xmlns:se" ,
"xmlns:xlink" , "y" ] , "switch" : [ "class" , "id" , "requiredFeatures" , "systemLanguage" ] , symbol : [ "class" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "font-family" , "font-size" , "font-style" , "font-weight" , "id" , "opacity" , "preserveAspectRatio" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" , "viewBox" ] , text : [ "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" ,
"filter" , "font-family" , "font-size" , "font-style" , "font-weight" , "id" , "mask" , "opacity" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "text-anchor" , "transform" , "x" , "xml:space" , "y" ] , textPath : [ "class" , "id" , "method" , "requiredFeatures" , "spacing" , "startOffset" , "style" , "systemLanguage" , "transform" , "xlink:href" ] , title : [ ] , tspan : [ "class" , "clip-path" , "clip-rule" , "dx" , "dy" , "fill" ,
"fill-opacity" , "fill-rule" , "filter" , "font-family" , "font-size" , "font-style" , "font-weight" , "id" , "mask" , "opacity" , "requiredFeatures" , "rotate" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "text-anchor" , "textLength" , "transform" , "x" , "xml:space" , "y" ] , use : [ "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "height" , "id" , "mask" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" ,
"stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "transform" , "width" , "x" , "xlink:href" , "y" ] , annotation : [ "encoding" ] , "annotation-xml" : [ "encoding" ] , maction : [ "actiontype" , "other" , "selection" ] , math : [ "class" , "id" , "display" , "xmlns" ] , menclose : [ "notation" ] , merror : [ ] , mfrac : [ "linethickness" ] , mi : [ "mathvariant" ] , mmultiscripts : [ ] , mn : [ ] , mo : [ "fence" , "lspace" , "maxsize" , "minsize" , "rspace" , "stretchy" ] , mover : [ ] , mpadded : [ "lspace" , "width" , "height" , "depth" , "voffset" ] , mphantom : [ ] ,
mprescripts : [ ] , mroot : [ ] , mrow : [ "xlink:href" , "xlink:type" , "xmlns:xlink" ] , mspace : [ "depth" , "height" , "width" ] , msqrt : [ ] , mstyle : [ "displaystyle" , "mathbackground" , "mathcolor" , "mathvariant" , "scriptlevel" ] , msub : [ ] , msubsup : [ ] , msup : [ ] , mtable : [ "align" , "columnalign" , "columnlines" , "columnspacing" , "displaystyle" , "equalcolumns" , "equalrows" , "frame" , "rowalign" , "rowlines" , "rowspacing" , "width" ] , mtd : [ "columnalign" , "columnspan" , "rowalign" , "rowspan" ] , mtext : [ ] , mtr : [ "columnalign" , "rowalign" ] , munder : [ ] , munderover : [ ] , none : [ ] ,
semantics : [ ] } , b = { } ; $ . each ( e , function ( l , s ) { var c = { } ; $ . each ( s , function ( g , d ) { if ( d . indexOf ( ":" ) >= 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 < o ; ++ e ) this . stack [ e ] . apply ( a ) ; a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _APPLY , this ) } ; svgedit . history . BatchCommand . prototype . unapply = function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _UNAPPLY , this ) ; for ( var o = this . stack . length - 1 ; o >= 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 . undoStackPointer < this . undoStack . length ? this . undoStack [ this . undoStackPointer ] . getText ( ) : "" } ; svgedit . history . UndoManager . prototype . undo = function ( ) { this . undoStackPointer > 0 && this . undoStack [ -- this . undoStackPointer ] . unapply ( this . handler _ ) } ; svgedit . history . UndoManager . prototype . redo = function ( ) { this . undoStackPointer < this . undoStack . length && this . undoStack . length > 0 && this . undoStack [ this . undoStackPointer ++ ] . apply ( this . handler _ ) } ;
svgedit . history . UndoManager . prototype . addCommandToHistory = function ( a ) { if ( this . undoStackPointer < this . undoStack . length && this . undoStack . length > 0 ) 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 < l ; ++ s ) if ( this . selectors [ s ] && ! this . selectors [ s ] . locked ) { this . selectors [ s ] . locked = true ; this . selectors [ s ] . reset ( b ) ; this . selectorMap [ b . id ] = this . selectors [ s ] ; return this . selectors [ s ] } this . selectors [ l ] = new svgedit . select . Selector ( l , b ) ; this . selectorParentGroup . appendChild ( this . selectors [ l ] . selectorGroup ) ; this . selectorMap [ b . id ] = this . selectors [ l ] ; return this . selectors [ l ] } ; svgedit . select . SelectorManager . prototype . releaseSelector =
function ( b ) { if ( b != null ) for ( var l = this . selectors . length , s = this . selectorMap [ b . id ] , c = 0 ; c < l ; ++ c ) if ( this . selectors [ c ] && this . selectors [ c ] == s ) { s . locked == false && console . log ( "WARNING! selector was released but was already unlocked" ) ; delete this . selectorMap [ b . id ] ; s . locked = false ; s . selectedElement = null ; s . showGrips ( false ) ; try { s . selectorGroup . setAttribute ( "display" , "none" ) } catch ( g ) { } break } } ; svgedit . select . SelectorManager . prototype . getRubberBandBox = function ( ) { if ( ! this . rubberBandBox ) this . rubberBandBox = this . selectorParentGroup . appendChild ( a . createSVGElement ( { element : "rect" ,
attr : { id : "selectorRubberBand" , fill : "none" , stroke : "#666" , "stroke-width" : 1 , "stroke-dasharray" : "3,2" , display : "none" , style : "pointer-events:none" } } ) ) ; return this . rubberBandBox } ; svgedit . select . init = function ( b , l ) { o = b ; a = l ; e = new svgedit . select . SelectorManager ; a . createSVGElement ( { element : "g" , attr : { id : "hover_group" } } ) } ; svgedit . select . getSelectorManager = function ( ) { return e } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . draw ) svgedit . draw = { } ; var a = "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" . split ( "," ) , o = { LET _DOCUMENT _DECIDE : 0 , ALWAYS _RANDOMIZE : 1 , NEVER _RANDOMIZE : 2 } , e = o . LET _DOCUMENT _DECIDE ; svgedit . draw . Layer = function ( b , l ) { this . name _ = b ; this . group _ = l } ; svgedit . draw . Layer . prototype . getName = function ( ) { return this . name _ } ; svgedit . draw . Layer . prototype . getGroup = function ( ) { return this . group _ } ; svgedit . draw . randomizeIds = function ( b , l ) { e = b == false ? o . NEVER _RANDOMIZE :
o . ALWAYS _RANDOMIZE ; if ( e == o . ALWAYS _RANDOMIZE && ! l . getNonce ( ) ) l . setNonce ( Math . floor ( Math . random ( ) * 100001 ) ) ; else e == o . NEVER _RANDOMIZE && l . getNonce ( ) && l . clearNonce ( ) } ; svgedit . draw . Drawing = function ( b , l ) { if ( ! b || ! b . tagName || ! b . namespaceURI || b . tagName != "svg" || b . namespaceURI != "http://www.w3.org/2000/svg" ) throw "Error: svgedit.draw.Drawing instance initialized without a <svg> 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 < this . getNumLayers ( ) ; l ++ ) if ( this . all _layers [ l ] [ 0 ] == b ) return true ; return false } ; svgedit . draw . Drawing . prototype . getLayerName = function ( b ) { if ( b >= 0 && b < this . getNumLayers ( ) ) return this . all _layers [ b ] [ 0 ] ; return "" } ; svgedit . draw . Drawing . prototype . getCurrentLayer = function ( ) { return this . current _layer } ; svgedit . draw . Drawing . prototype . getCurrentLayerName =
function ( ) { for ( var b = 0 ; b < this . getNumLayers ( ) ; ++ b ) if ( this . all _layers [ b ] [ 1 ] == this . current _layer ) return this . getLayerName ( b ) ; return "" } ; svgedit . draw . Drawing . prototype . setCurrentLayer = function ( b ) { for ( var l = 0 ; l < this . getNumLayers ( ) ; ++ l ) if ( b == this . getLayerName ( l ) ) { if ( this . current _layer != this . all _layers [ l ] [ 1 ] ) { this . current _layer . setAttribute ( "style" , "pointer-events:none" ) ; this . current _layer = this . all _layers [ l ] [ 1 ] ; this . current _layer . setAttribute ( "style" , "pointer-events:all" ) } return true } return false } ; svgedit . draw . Drawing . prototype . deleteCurrentLayer =
function ( ) { if ( this . current _layer && this . getNumLayers ( ) > 1 ) { 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 ; d < b ; ++ d ) { var p = this . svgElem _ . childNodes . item ( d ) ; if ( p && p . nodeType == 1 ) if ( p . tagName == "g" ) { g = true ; var w = $ ( "title" , p ) . text ( ) ; if ( ! w && svgedit . browser . isOpera ( ) && p . querySelectorAll ) w = $ ( p . querySelectorAll ( "title" ) ) . text ( ) ;
if ( w ) { s . push ( w ) ; this . all _layers . push ( [ w , p ] ) ; c = p ; svgedit . utilities . walkTree ( p , function ( B ) { B . setAttribute ( "style" , "pointer-events:inherit" ) } ) ; c . setAttribute ( "style" , "pointer-events:none" ) } else l . push ( p ) } else if ( ~ a . indexOf ( p . nodeName ) ) { svgedit . utilities . getBBox ( p ) ; l . push ( p ) } } b = this . svgElem _ . ownerDocument ; if ( l . length > 0 || ! 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 ; g < l . length ; ++ g ) c . appendChild ( l [ g ] ) ; this . svgElem _ . appendChild ( c ) ; this . all _layers . push ( [ s , c ] ) } svgedit . utilities . walkTree ( c , function ( B ) { B . setAttribute ( "style" , "pointer-events:inherit" ) } ) ; this . current _layer = c . getAttribute ( "data-locked" ) === "true" ? this . all _layers . slice ( - 2 ) [ 0 ] [ 1 ] : c ; this . current _layer . setAttribute ( "style" , "pointer-events:all" ) } ; svgedit . draw . Drawing . prototype . createLayer = function ( b ) { var l = this . svgElem _ . ownerDocument , s = l . createElementNS ( "http://www.w3.org/2000/svg" ,
"g" ) ; l = l . createElementNS ( "http://www.w3.org/2000/svg" , "title" ) ; l . textContent = b ; s . appendChild ( l ) ; this . svgElem _ . appendChild ( s ) ; this . identifyLayers ( ) ; return s } ; svgedit . draw . Drawing . prototype . getLayerVisibility = function ( b ) { for ( var l = null , s = 0 ; s < this . getNumLayers ( ) ; ++ s ) if ( this . getLayerName ( s ) == b ) { l = this . all _layers [ s ] [ 1 ] ; break } if ( ! l ) return false ; return l . getAttribute ( "display" ) != "none" } ; svgedit . draw . Drawing . prototype . setLayerVisibility = function ( b , l ) { if ( typeof l != "boolean" ) return null ; for ( var s = null , c = 0 ; c <
this . getNumLayers ( ) ; ++ c ) if ( this . getLayerName ( c ) == b ) { s = this . all _layers [ c ] [ 1 ] ; break } if ( ! s ) return null ; s . getAttribute ( "display" ) ; s . setAttribute ( "display" , l ? "inline" : "none" ) ; return s } ; svgedit . draw . Drawing . prototype . getLayerOpacity = function ( b ) { for ( var l = 0 ; l < this . getNumLayers ( ) ; ++ l ) if ( this . getLayerName ( l ) == b ) { ( b = this . all _layers [ l ] [ 1 ] . getAttribute ( "opacity" ) ) || ( b = "1.0" ) ; return parseFloat ( b ) } return null } ; svgedit . draw . Drawing . prototype . setLayerOpacity = function ( b , l ) { if ( ! ( typeof l != "number" || l < 0 || l > 1 ) ) for ( var s =
0 ; s < this . getNumLayers ( ) ; ++ s ) if ( this . getLayerName ( s ) == b ) { this . all _layers [ s ] [ 1 ] . setAttribute ( "opacity" , l ) ; break } } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . path ) svgedit . path = { } ; var a = { pathNodeTooltip : "Drag node to move it. Double-click node to change segment type" , pathCtrlPtTooltip : "Drag control point to adjust curve properties" } , o = { 2 : [ "x" , "y" ] , 4 : [ "x" , "y" ] , 6 : [ "x" , "y" , "x1" , "y1" , "x2" , "y2" ] , 8 : [ "x" , "y" , "x1" , "y1" ] , 10 : [ "x" , "y" , "r1" , "r2" , "angle" , "largeArcFlag" , "sweepFlag" ] , 12 : [ "x" ] , 14 : [ "y" ] , 16 : [ "x" , "y" , "x2" , "y2" ] , 18 : [ "x" , "y" ] } , e = [ ] , b = false , l = { } ; svgedit . path . setLinkControlPoints = function ( g ) { b = g } ; var s = svgedit . path . path = null ; svgedit . path . init =
function ( g ) { s = g ; e = [ 0 , "ClosePath" ] ; $ . each ( [ "Moveto" , "Lineto" , "CurvetoCubic" , "CurvetoQuadratic" , "Arc" , "LinetoHorizontal" , "LinetoVertical" , "CurvetoCubicSmooth" , "CurvetoQuadraticSmooth" ] , function ( d , p ) { e . push ( p + "Abs" ) ; e . push ( p + "Rel" ) } ) } ; svgedit . path . insertItemBefore = function ( g , d , p ) { g . pathSegList . insertItemBefore ( d , p ) } ; svgedit . path . ptObjToArr = function ( g , d ) { for ( var p = o [ g ] , w = p . length , B = Array ( w ) , v = 0 ; v < w ; v ++ ) B [ v ] = d [ p [ v ] ] ; return B } ; svgedit . path . getGripPt = function ( g , d ) { var p = { x : d ? d . x : g . item . x , y : d ? d . y : g . item . y } ,
w = g . path ; if ( w . matrix ) p = svgedit . math . transformPoint ( p . x , p . y , w . matrix ) ; p . x *= s . getCurrentZoom ( ) ; p . y *= s . getCurrentZoom ( ) ; return p } ; svgedit . path . getPointFromGrip = function ( g , d ) { var p = { x : g . x , y : g . y } ; if ( d . matrix ) { g = svgedit . math . transformPoint ( p . x , p . y , d . imatrix ) ; p . x = g . x ; p . y = g . y } p . x /= s . getCurrentZoom ( ) ; p . y /= s . getCurrentZoom ( ) ; return p } ; svgedit . path . addPointGrip = function ( g , d , p ) { var w = svgedit . path . getGripContainer ( ) , B = svgedit . utilities . getElem ( "pathpointgrip_" + g ) ; if ( ! B ) { B = document . createElementNS ( "http://www.w3.org/2000/svg" ,
"rect" ) ; svgedit . utilities . assignAttributes ( B , { id : "pathpointgrip_" + g , display : "none" , width : svgedit . browser . isTouch ( ) ? 30 : 5 , height : svgedit . browser . isTouch ( ) ? 30 : 5 , fill : "#fff" , stroke : "#4F80FF" , "shape-rendering" : "crispEdges" , "stroke-width" : 1 , cursor : "move" , style : "pointer-events:all" , "xlink:title" : a . pathNodeTooltip } ) ; B = w . appendChild ( B ) ; $ ( "#pathpointgrip_" + g ) . dblclick ( function ( ) { svgedit . path . path && svgedit . path . path . setSegType ( ) } ) } if ( d && p ) svgedit . utilities . assignAttributes ( B , { x : d - ( svgedit . browser . isTouch ( ) ?
15 : 2.5 ) , y : p - ( svgedit . browser . isTouch ( ) ? 15 : 2.5 ) , display : "inline" } ) ; return B } ; svgedit . path . getGripContainer = function ( ) { var g = svgedit . utilities . getElem ( "pathpointgrip_container" ) ; if ( ! g ) { g = svgedit . utilities . getElem ( "selectorParentGroup" ) . appendChild ( document . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ) ; g . id = "pathpointgrip_container" } return g } ; svgedit . path . addCtrlGrip = function ( g ) { var d = svgedit . utilities . getElem ( "ctrlpointgrip_" + g ) ; if ( d ) return d ; d = document . createElementNS ( "http://www.w3.org/2000/svg" ,
"circle" ) ; svgedit . utilities . assignAttributes ( d , { id : "ctrlpointgrip_" + g , display : "none" , r : svgedit . browser . isTouch ( ) ? 15 : 3 , fill : "#4F80FF" , stroke : "#4F80FF" , "stroke-opacity" : 0 , "stroke-width" : "3" , cursor : "move" , style : "pointer-events:all" , "xlink:title" : a . pathCtrlPtTooltip } ) ; svgedit . path . getGripContainer ( ) . appendChild ( d ) ; return d } ; svgedit . path . getCtrlLine = function ( g ) { var d = svgedit . utilities . getElem ( "ctrlLine_" + g ) ; if ( d ) return d ; d = document . createElementNS ( "http://www.w3.org/2000/svg" , "line" ) ; svgedit . utilities . assignAttributes ( d ,
{ id : "ctrlLine_" + g , stroke : "#4F80FF" , "stroke-width" : 1 , style : "pointer-events:none" } ) ; svgedit . path . getGripContainer ( ) . appendChild ( d ) ; return d } ; svgedit . path . getPointGrip = function ( g , d ) { var p = svgedit . path . addPointGrip ( g . index ) ; if ( d ) { var w = svgedit . path . getGripPt ( g ) ; svgedit . utilities . assignAttributes ( p , { x : w . x - ( svgedit . browser . isTouch ( ) ? 15 : 2.5 ) , y : w . y - ( svgedit . browser . isTouch ( ) ? 15 : 2.5 ) , display : "inline" } ) } return p } ; svgedit . path . getControlPoints = function ( g ) { var d = g . item , p = g . index ; if ( ! d || ! ( "x1" in d ) || ! ( "x2" in d ) ) return null ;
var w = { } ; svgedit . path . getGripContainer ( ) ; for ( var B = [ svgedit . path . path . segs [ p - 1 ] . item , d ] , v = 1 ; v < 3 ; v ++ ) { var N = p + "c" + v , Q = w [ "c" + v + "_line" ] = svgedit . path . getCtrlLine ( N ) , K = svgedit . path . getGripPt ( g , { x : d [ "x" + v ] , y : d [ "y" + v ] } ) , I = svgedit . path . getGripPt ( g , { x : B [ v - 1 ] . x , y : B [ v - 1 ] . y } ) ; svgedit . utilities . assignAttributes ( Q , { x1 : K . x , y1 : K . y , x2 : I . x , y2 : I . y , display : "inline" } ) ; w [ "c" + v + "_line" ] = Q ; pointGrip = w [ "c" + v ] = svgedit . path . addCtrlGrip ( N ) ; svgedit . utilities . assignAttributes ( pointGrip , { cx : K . x , cy : K . y , display : "inline" } ) ; w [ "c" +
v ] = pointGrip } return w } ; svgedit . path . replacePathSeg = function ( g , d , p , w ) { w = w || svgedit . path . path . elem ; g = w [ "createSVGPathSeg" + e [ g ] ] . apply ( w , p ) ; w . pathSegList . replaceItem ( g , d ) } ; svgedit . path . getSegSelector = function ( g , d ) { var p = g . index , w = svgedit . utilities . getElem ( "segline_" + p ) ; if ( ! w ) { var B = svgedit . path . getGripContainer ( ) ; w = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; svgedit . utilities . assignAttributes ( w , { id : "segline_" + p , display : "none" , fill : "none" , stroke : "#0ff" , "stroke-opacity" : 1 , "shape-rendering" : "crispEdges" ,
"stroke-width" : 2 , style : "pointer-events:none" , d : "M0,0 0,0" } ) ; B . appendChild ( w ) } if ( d ) { p = g . prev ; if ( ! p ) { w . setAttribute ( "display" , "none" ) ; return w } p = svgedit . path . getGripPt ( p ) ; svgedit . path . replacePathSeg ( 2 , 0 , [ p . x , p . y ] , w ) ; B = svgedit . path . ptObjToArr ( g . type , g . item , true ) ; for ( var v = 0 ; v < B . length ; v += 2 ) { p = svgedit . path . getGripPt ( g , { x : B [ v ] , y : B [ v + 1 ] } ) ; B [ v ] = p . x ; B [ v + 1 ] = p . y } svgedit . path . replacePathSeg ( g . type , 1 , B , w ) } return w } ; svgedit . path . smoothControlPoints = this . smoothControlPoints = function ( g , d , p ) { var w = g . x - p . x , B = g . y -
p . y , v = d . x - p . x , N = d . y - p . y ; if ( ( w != 0 || B != 0 ) && ( v != 0 || N != 0 ) ) { g = Math . atan2 ( B , w ) ; d = Math . atan2 ( N , v ) ; w = Math . sqrt ( w * w + B * B ) ; v = Math . sqrt ( v * v + N * N ) ; B = s . getSVGRoot ( ) . createSVGPoint ( ) ; N = s . getSVGRoot ( ) . createSVGPoint ( ) ; if ( g < 0 ) g += 2 * Math . PI ; if ( d < 0 ) d += 2 * Math . PI ; var Q = Math . abs ( g - d ) , K = Math . abs ( Math . PI - Q ) / 2 ; if ( g - d > 0 ) { g = Q < Math . PI ? g + K : g - K ; d = Q < Math . PI ? d - K : d + K } else { g = Q < Math . PI ? g - K : g + K ; d = Q < Math . PI ? d + K : d - K } B . x = w * Math . cos ( g ) + p . x ; B . y = w * Math . sin ( g ) + p . y ; N . x = v * Math . cos ( d ) + p . x ; N . y = v * Math . sin ( d ) + p . y ; return [ B , N ] } } ; svgedit . path . Segment =
function ( g , d ) { this . selected = false ; this . index = g ; this . item = d ; this . type = d . pathSegType ; this . ctrlpts = [ ] ; this . segsel = this . ptgrip = null } ; svgedit . path . Segment . prototype . showCtrlPts = function ( g ) { for ( var d in this . ctrlpts ) this . ctrlpts [ d ] . setAttribute ( "display" , g ? "inline" : "none" ) } ; svgedit . path . Segment . prototype . selectCtrls = function ( ) { $ ( "#ctrlpointgrip_" + this . index + "c1, #ctrlpointgrip_" + this . index + "c2" ) . attr ( "fill" , "#4F80FF" ) } ; svgedit . path . Segment . prototype . show = function ( g ) { if ( this . ptgrip ) { this . ptgrip . setAttribute ( "display" ,
g ? "inline" : "none" ) ; this . segsel . setAttribute ( "display" , g ? "inline" : "none" ) ; this . showCtrlPts ( g ) } } ; svgedit . path . Segment . prototype . select = function ( g ) { if ( this . ptgrip ) { this . ptgrip . setAttribute ( "stroke" , g ? "#4F80FF" : "#4F80FF" ) ; this . ptgrip . setAttribute ( "fill" , g ? "#4F80FF" : "#fff" ) ; this . segsel . setAttribute ( "display" , g ? "inline" : "none" ) ; this . ctrlpts && this . selectCtrls ( g ) ; this . selected = g } } ; svgedit . path . Segment . prototype . addGrip = function ( ) { this . ptgrip = svgedit . path . getPointGrip ( this , true ) ; this . ctrlpts = svgedit . path . getControlPoints ( this ,
true ) ; this . segsel = svgedit . path . getSegSelector ( this , true ) } ; svgedit . path . Segment . prototype . update = function ( g ) { if ( this . ptgrip ) { var d = svgedit . path . getGripPt ( this ) , p = svgedit . browser . isTouch ( ) ? 15 : 2.5 ; svgedit . utilities . assignAttributes ( this . ptgrip , this . ptgrip . nodeName == "rect" ? { x : d . x - p , y : d . y - p } : { cx : d . x , cy : d . y } ) ; svgedit . path . getSegSelector ( this , true ) ; if ( this . ctrlpts ) { if ( g ) { this . item = svgedit . path . path . elem . pathSegList . getItem ( this . index ) ; this . type = this . item . pathSegType } svgedit . path . getControlPoints ( this ) } } } ;
svgedit . path . Segment . prototype . move = function ( g , d ) { var p = this . item ; p = $ . extend ( { } , p ) ; p = this . ctrlpts ? [ p . x += g , p . y += d , p . x1 , p . y1 , p . x2 += g , p . y2 += d ] : [ p . x += g , p . y += d ] ; svgedit . path . replacePathSeg ( this . type , this . index , p ) ; if ( this . next && this . next . ctrlpts ) { p = this . next . item ; p = [ p . x , p . y , p . x1 += g , p . y1 += d , p . x2 , p . y2 ] ; svgedit . path . replacePathSeg ( this . next . type , this . next . index , p ) } if ( this . mate ) { p = this . mate . item ; p = [ p . x += g , p . y += d ] ; svgedit . path . replacePathSeg ( this . mate . type , this . mate . index , p ) } this . update ( true ) ; this . next && this . next . update ( true ) } ;
svgedit . path . Segment . prototype . setLinked = function ( g ) { var d , p , w ; if ( g == 2 ) { p = 1 ; d = this . next ; if ( ! d ) return ; w = this . item } else { p = 2 ; d = this . prev ; if ( ! d ) return ; w = d . item } var B = $ . extend ( { } , d . item ) ; B [ "x" + p ] = w . x + ( w . x - this . item [ "x" + g ] ) ; B [ "y" + p ] = w . y + ( w . y - this . item [ "y" + g ] ) ; svgedit . path . replacePathSeg ( d . type , d . index , [ B . x , B . y , B . x1 , B . y1 , B . x2 , B . y2 ] ) ; d . update ( true ) } ; svgedit . path . Segment . prototype . moveCtrl = function ( g , d , p ) { var w = $ . extend ( { } , this . item ) ; w [ "x" + g ] += d ; w [ "y" + g ] += p ; svgedit . path . replacePathSeg ( this . type , this . index ,
[ w . x , w . y , w . x1 , w . y1 , w . x2 , w . y2 ] ) ; this . update ( true ) } ; svgedit . path . Segment . prototype . setType = function ( g , d ) { svgedit . path . replacePathSeg ( g , this . index , d ) ; this . type = g ; this . item = svgedit . path . path . elem . pathSegList . getItem ( this . index ) ; this . showCtrlPts ( g === 6 ) ; this . ctrlpts = svgedit . path . getControlPoints ( this ) ; this . update ( true ) } ; svgedit . path . Path = function ( g ) { if ( ! g || g . tagName !== "path" ) throw "svgedit.path.Path constructed without a <path> 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 ; p ++ ) { var w = g . getItem ( p ) ; w = new svgedit . path . Segment ( p , w ) ; w . path = this ; this . segs . push ( w ) } g = this . segs ; w = null ; for ( p = 0 ; p < d ; p ++ ) { var B = g [ p ] , v = p + 1 >= 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 < d ; p ++ ) if ( g . call ( this . segs [ p ] , p ) === false ) break } ; svgedit . path . Path . prototype . addSeg = function ( g ) { var d = this . segs [ g ] ;
if ( d . prev ) { var p = d . prev , w ; switch ( d . item . pathSegType ) { case 4 : var B = ( d . item . x + p . item . x ) / 2 , v = ( d . item . y + p . item . y ) / 2 ; w = this . elem . createSVGPathSegLinetoAbs ( B , v ) ; break ; case 6 : w = ( p . item . x + d . item . x1 ) / 2 ; var N = ( d . item . x1 + d . item . x2 ) / 2 , Q = ( d . item . x2 + d . item . x ) / 2 , K = ( w + N ) / 2 ; N = ( N + Q ) / 2 ; B = ( K + N ) / 2 ; var I = ( p . item . y + d . item . y1 ) / 2 , S = ( d . item . y1 + d . item . y2 ) / 2 ; p = ( d . item . y2 + d . item . y ) / 2 ; var R = ( I + S ) / 2 ; S = ( S + p ) / 2 ; v = ( R + S ) / 2 ; w = this . elem . createSVGPathSegCurvetoCubicAbs ( B , v , w , I , K , R ) ; svgedit . path . replacePathSeg ( d . type , g , [ d . item . x , d . item . y ,
N , S , Q , p ] ) } svgedit . path . insertItemBefore ( this . elem , w , g ) } } ; svgedit . path . Path . prototype . deleteSeg = function ( g ) { var d = this . segs [ g ] , p = this . elem . pathSegList ; d . show ( false ) ; var w = d . next ; if ( d . mate ) { var B = [ w . item . x , w . item . y ] ; svgedit . path . replacePathSeg ( 2 , w . index , B ) ; svgedit . path . replacePathSeg ( 4 , d . index , B ) ; p . removeItem ( d . mate . index ) } else { if ( ! d . prev ) { B = [ w . item . x , w . item . y ] ; svgedit . path . replacePathSeg ( 2 , d . next . index , B ) } p . removeItem ( g ) } } ; svgedit . path . Path . prototype . subpathIsClosed = function ( g ) { var d = false ; svgedit . path . path . eachSeg ( function ( p ) { if ( p <=
g ) return true ; if ( this . type === 2 ) return false ; else if ( this . type === 1 ) { d = true ; return false } } ) ; return d } ; svgedit . path . Path . prototype . removePtFromSelection = function ( g ) { var d = this . selected _pts . indexOf ( g ) ; if ( d != - 1 ) { this . segs [ g ] . select ( false ) ; this . selected _pts . splice ( d , 1 ) } } ; svgedit . path . Path . prototype . clearSelection = function ( ) { this . eachSeg ( function ( ) { this . select ( false ) } ) ; this . selected _pts = [ ] } ; svgedit . path . Path . prototype . storeD = function ( ) { this . last _d = this . elem . getAttribute ( "d" ) } ; svgedit . path . Path . prototype . show =
function ( g ) { this . eachSeg ( function ( ) { this . show ( g ) } ) ; g && this . selectPt ( this . first _seg . index ) ; return this } ; svgedit . path . Path . prototype . movePts = function ( g , d ) { for ( var p = this . selected _pts . length ; p -- ; ) this . segs [ this . selected _pts [ p ] ] . move ( g , d ) } ; svgedit . path . Path . prototype . moveCtrl = function ( g , d ) { var p = this . segs [ this . selected _pts [ 0 ] ] ; p . moveCtrl ( this . dragctrl , g , d ) ; b && p . setLinked ( this . dragctrl ) } ; svgedit . path . Path . prototype . setSegType = function ( g ) { this . storeD ( ) ; for ( var d = this . selected _pts . length , p ; d -- ; ) { var w = this . segs [ this . selected _pts [ d ] ] ,
B = w . prev ; if ( B ) { if ( ! g ) { p = "Toggle Path Segment Type" ; g = w . type == 6 ? 4 : 6 } g -= 0 ; var v = w . item . x , N = w . item . y , Q = B . item . x ; B = B . item . y ; var K ; switch ( g ) { case 6 : if ( w . olditem ) { Q = w . olditem ; K = [ v , N , Q . x1 , Q . y1 , Q . x2 , Q . y2 ] } else { K = v - Q ; var I = N - B ; K = [ v , N , Q + K / 3 , B + I / 3 , v - K / 3 , N - I / 3 ] } break ; case 4 : K = [ v , N ] ; w . olditem = w . item } w . setType ( g , K ) } } svgedit . path . path . endChanges ( p ) } ; svgedit . path . Path . prototype . selectPt = function ( g , d ) { this . clearSelection ( ) ; g == null && this . eachSeg ( function ( p ) { if ( this . prev ) g = p } ) ; this . addPtsToSelection ( g ) ; if ( d ) { this . dragctrl =
d ; b && this . segs [ g ] . setLinked ( d ) } } ; svgedit . path . Path . prototype . update = function ( ) { var g = this . elem ; if ( svgedit . utilities . getRotationAngle ( g ) ) { this . matrix = svgedit . math . getMatrix ( g ) ; this . imatrix = this . matrix . inverse ( ) } else this . imatrix = this . matrix = null ; this . eachSeg ( function ( d ) { this . item = g . pathSegList . getItem ( d ) ; this . update ( ) } ) ; return this } ; svgedit . path . getPath _ = function ( g ) { var d = l [ g . id ] ; d || ( d = l [ g . id ] = new svgedit . path . Path ( g ) ) ; return d } ; svgedit . path . removePath _ = function ( g ) { g in l && delete l [ g ] } ; var c = function ( g ,
d , p , w , B , v , N ) { dx = g - p ; dy = d - w ; r = Math . sqrt ( dx * dx + dy * dy ) ; theta = Math . atan2 ( dy , dx ) + N ; dx = r * Math . cos ( theta ) + p ; dy = r * Math . sin ( theta ) + w ; dx -= B ; dy -= v ; r = Math . sqrt ( dx * dx + dy * dy ) ; theta = Math . atan2 ( dy , dx ) - N ; return { x : ( r * Math . cos ( theta ) + B ) / 1 , y : ( r * Math . sin ( theta ) + v ) / 1 } } ; svgedit . path . recalcRotatedPath = function ( ) { var g = svgedit . path . path . elem , d = svgedit . utilities . getRotationAngle ( g , true ) ; if ( d ) { var p = svgedit . utilities . getBBox ( g ) , w = svgedit . path . path . oldbbox , B = w . x + w . width / 2 ; w = w . y + w . height / 2 ; var v = p . x + p . width / 2 ; p = p . y + p . height /
2 ; v = v - B ; var N = p - w ; p = Math . sqrt ( v * v + N * N ) ; N = Math . atan2 ( N , v ) + d ; v = p * Math . cos ( N ) + B ; p = p * Math . sin ( N ) + w ; N = g . pathSegList ; for ( var Q = N . numberOfItems ; Q ; ) { Q -= 1 ; var K = N . getItem ( Q ) , I = K . pathSegType ; if ( I != 1 ) { var S = c ( K . x , K . y , B , w , v , p , d ) ; S = [ S . x , S . y ] ; if ( K . x1 != null && K . x2 != null ) { c _vals1 = c ( K . x1 , K . y1 , B , w , v , p , d ) ; c _vals2 = c ( K . x2 , K . y2 , B , w , v , p , d ) ; S . splice ( S . length , 0 , c _vals1 . x , c _vals1 . y , c _vals2 . x , c _vals2 . y ) } svgedit . path . replacePathSeg ( I , Q , S ) } } svgedit . utilities . getBBox ( g ) ; B = svgroot . createSVGTransform ( ) ; g = svgedit . transformlist . getTransformList ( g ) ;
B . setRotate ( d * 180 / Math . PI , v , p ) ; g . replaceItem ( B , 0 ) } } ; svgedit . path . clearData = function ( ) { l = { } } } ) ( ) ; if ( ! window . console ) { window . console = { } ; window . console . log = function ( ) { } ; window . console . dir = function ( ) { } } if ( window . opera ) { window . console . log = function ( a ) { opera . postError ( a ) } ; window . console . dir = function ( ) { } }
( function ( ) { var a = jQuery . fn . attr ; jQuery . fn . attr = function ( o , e ) { var b = this . length ; if ( ! b ) return a . apply ( this , arguments ) ; for ( var l = 0 ; l < b ; l ++ ) { var s = this [ l ] ; if ( s . namespaceURI === "http://www.w3.org/2000/svg" ) if ( e !== undefined ) s . setAttribute ( o , e ) ; else if ( $ . isArray ( o ) ) { b = o . length ; for ( l = { } ; b -- ; ) { var c = o [ b ] , g = s . getAttribute ( c ) ; if ( g || g === "0" ) g = isNaN ( g ) ? g : g - 0 ; l [ c ] = g } return l } else if ( typeof o === "object" ) for ( c in o ) s . setAttribute ( c , o [ c ] ) ; else { if ( ( g = s . getAttribute ( o ) ) || g === "0" ) g = isNaN ( g ) ? g : g - 0 ; return g } else return a . apply ( this ,
arguments ) } return this } } ) ( ) ;
$ . SvgCanvas = function ( a , o ) { function e ( f , k ) { for ( var m = svgedit . utilities . getBBox ( f ) , C = 0 ; C < 2 ; C ++ ) { var A = C === 0 ? "fill" : "stroke" , G = f . getAttribute ( A ) ; if ( G && G . indexOf ( "url(" ) === 0 ) { G = P ( G ) ; if ( G . tagName === "linearGradient" ) { var D = G . getAttribute ( "x1" ) || 0 , z = G . getAttribute ( "y1" ) || 0 , F = G . getAttribute ( "x2" ) || 1 , h = G . getAttribute ( "y2" ) || 0 ; D = m . width * D + m . x ; z = m . height * z + m . y ; F = m . width * F + m . x ; h = m . height * h + m . y ; D = L ( D , z , k ) ; h = L ( F , h , k ) ; F = { } ; F . x1 = ( D . x - m . x ) / m . width ; F . y1 = ( D . y - m . y ) / m . height ; F . x2 = ( h . x - m . x ) / m . width ; F . y2 = ( h . y - m . y ) / m . height ;
G = G . cloneNode ( true ) ; $ ( G ) . attr ( F ) ; G . id = ka ( ) ; gb ( ) . appendChild ( G ) ; f . setAttribute ( A , "url(#" + G . id + ")" ) } } } } var b = "http://www.w3.org/2000/svg" , l = { show _outside _canvas : true , selectNew : true , dimensions : [ 640 , 480 ] } ; o && $ . extend ( l , o ) ; var s = l . dimensions , c = this , g = a . ownerDocument , d = g . importNode ( svgedit . utilities . text2xml ( '<svg id="svgroot" xmlns="' + b + '" xlinkns="http://www.w3.org/1999/xlink" width="' + s [ 0 ] + '" height="' + s [ 1 ] + '" x="' + s [ 0 ] + '" y="' + s [ 1 ] + '" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>' ) . documentElement ,
true ) ; a . appendChild ( 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 < m ; k ++ ) Ta ( f [ k ] ) } } , Va = { } , Ga = l . imgPath + "logo.png" , ta = [ ] , $a = { round _digits : 5 } , Ka = false , Sa =
null , Ha = "select" , db = "none" , lb = { } , Ua = Q . text , Xa = K , wb = null , sa = null , hb = [ ] , eb = { } , sb = { } ; c . clipBoard = [ ] ; var ib = this . runExtensions = function ( f , k , m ) { var C = false ; if ( m ) C = [ ] ; $ . each ( eb , function ( A , G ) { if ( f in G ) if ( m ) C . push ( G [ f ] ( k ) ) ; else C = G [ f ] ( k ) } ) ; return C } ; this . addExtension = function ( f , k ) { if ( f in eb ) console . log ( 'Cannot add extension "' + f + '", an extension by that name already exists"' ) ; else { var m = $ . isFunction ( k ) ? k ( $ . extend ( c . getPrivateMethods ( ) , { svgroot : d , svgcontent : p , nonce : B ( ) . getNonce ( ) , selectorManager : ra } ) ) : k ;
eb [ f ] = m ; M ( "extension_added" , m ) } } ; var ab = this . round = function ( f ) { return parseInt ( f * v ) / v } , ob = this . getIntersectionList = function ( f ) { if ( sa == null ) return null ; var k = N || B ( ) . getCurrentLayer ( ) ; hb . length || ( hb = fb ( k ) ) ; var m = null ; try { m = k . getIntersectionList ( f , null ) } catch ( C ) { } if ( m == null || typeof m . item != "function" ) { m = [ ] ; if ( f ) f = f ; else { f = sa . getBBox ( ) ; k = { } ; for ( var A in f ) k [ A ] = f [ A ] / v ; f = k } for ( A = hb . length ; A -- ; ) f . width && f . width && svgedit . math . rectsIntersect ( f , hb [ A ] . bbox ) && m . push ( hb [ A ] . elem ) } return m } ; getStrokedBBox = this . getStrokedBBox =
function ( f ) { f || ( f = pb ( ) ) ; if ( ! f . length ) return false ; var k = function ( h ) { try { var n = svgedit . utilities . getBBox ( h ) , q = svgedit . utilities . getRotationAngle ( h ) ; if ( q && q % 90 || svgedit . math . hasMatrixTransform ( svgedit . transformlist . getTransformList ( h ) ) ) { q = false ; if ( [ "ellipse" , "path" , "line" , "polyline" , "polygon" ] . indexOf ( h . tagName ) >= 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 ; k < m ; ++ k ) { var C = f [ k ] ; C . setAttribute ( "d" , La . convertPath ( C ) ) ; La . fixEnd ( C ) } } ; var P = this . getRefElem = function ( f ) { return oa ( ja ( f ) . substr ( 1 ) ) } , ea = function ( f ) { if ( ! svgedit . browser . isGecko ( ) ) return f ; var k = f . cloneNode ( true ) ; f . parentNode . insertBefore ( k , f ) ; f . parentNode . removeChild ( f ) ; ra . releaseSelector ( f ) ;
I [ 0 ] = k ; ra . requestSelector ( k ) . showGrips ( true ) ; return k } ; this . setRotationAngle = function ( f , k ) { f = parseFloat ( f ) ; var m = I [ 0 ] ; if ( m ) { var C = m . getAttribute ( "transform" ) , A = svgedit . utilities . getBBox ( m ) , G = A . x + A . width / 2 , D = A . y + A . height / 2 ; A = R ( m ) ; A . numberOfItems > 0 && 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 ; G < A ; ++ G ) { h = k . points [ G ] ; h = L ( h . x , h . y , m ) ; k . points [ G ] . x = h . x ; k . points [ G ] . y = h . y } A = k . points . length ; m = "" ; for ( G = 0 ; G < A ; ++ G ) { h = k . points [ G ] ; m += h . x + "," + h . y + " " } f . setAttribute ( "points" , m ) ; break ; case "path" : D = f . pathSegList ; A = D . numberOfItems ; k . d = Array ( A ) ; for ( G = 0 ; G < A ; ++ G ) { z = D . getItem ( G ) ; k . d [ G ] = { type : z . pathSegType , x : z . x , y : z . y , x1 : z . x1 , y1 : z . y1 , x2 : z . x2 , y2 : z . y2 , r1 : z . r1 , r2 : z . r2 , angle : z . angle , largeArcFlag : z . largeArcFlag , sweepFlag : z . sweepFlag } } A =
k . d . length ; G = k . d [ 0 ] ; n = L ( G . x , G . y , m ) ; k . d [ 0 ] . x = n . x ; k . d [ 0 ] . y = n . y ; for ( G = 1 ; G < A ; ++ G ) { z = k . d [ G ] ; D = z . type ; if ( D % 2 == 0 ) { h = L ( z . x != undefined ? z . x : n . x , z . y != undefined ? z . y : n . y , m ) ; D = L ( z . x1 , z . y1 , m ) ; F = L ( z . x2 , z . y2 , m ) ; z . x = h . x ; z . y = h . y ; z . x1 = D . x ; z . y1 = D . y ; z . x2 = F . x ; z . y2 = F . y } else { z . x = m . a * z . x ; z . y = m . d * z . y ; z . x1 = m . a * z . x1 ; z . y1 = m . d * z . y1 ; z . x2 = m . a * z . x2 ; z . y2 = m . d * z . y2 } z . r1 = m . a * z . r1 ; z . r2 = m . d * z . r2 } m = "" ; A = k . d . length ; for ( G = 0 ; G < A ; ++ G ) { z = k . d [ G ] ; D = z . type ; m += Oa [ D ] ; switch ( D ) { case 13 : case 12 : m += z . x + " " ; break ; case 15 : case 14 : m += z . y + " " ; break ; case 3 : case 5 : case 19 : case 2 : case 4 : case 18 : m +=
z . x + "," + z . y + " " ; break ; case 7 : case 6 : m += z . x1 + "," + z . y1 + " " + z . x2 + "," + z . y2 + " " + z . x + "," + z . y + " " ; break ; case 9 : case 8 : m += z . x1 + "," + z . y1 + " " + z . x + "," + z . y + " " ; break ; case 11 : case 10 : m += z . r1 + "," + z . r2 + " " + z . angle + " " + + z . largeArcFlag + " " + + z . sweepFlag + " " + z . x + "," + z . y + " " ; break ; case 17 : case 16 : m += z . x2 + "," + z . y2 + " " + z . x + "," + z . y + " " } } f . setAttribute ( "d" , m ) } } , nb = function ( f , k , m ) { f = P ( f ) . firstChild ; var C = R ( f ) , A = d . createSVGTransform ( ) ; A . setTranslate ( k , m ) ; C . appendItem ( A ) ; Ra ( f ) } , Ra = this . recalculateDimensions = function ( f ) { if ( f ==
null ) return null ; var k = R ( f ) ; if ( k && k . numberOfItems > 0 ) { 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 ; h < F ; ++ h ) { var n =
A . getItem ( h ) ; D . points [ h ] = { x : n . x , y : n . y } } break ; case "path" : z = { } ; z . d = f . getAttribute ( "d" ) ; D . d = f . getAttribute ( "d" ) } if ( C . length ) { D = $ ( f ) . attr ( C ) ; $ . each ( D , function ( Ca , Pa ) { D [ Ca ] = Ba ( Ca , Pa ) } ) } else if ( G ) D = { x : $ ( G ) . attr ( "x" ) || 0 , y : $ ( G ) . attr ( "y" ) || 0 } ; if ( z == null ) { z = $ . extend ( true , { } , D ) ; $ . each ( z , function ( Ca , Pa ) { z [ Ca ] = Ba ( Ca , Pa ) } ) } z . transform = Sa ? Sa : "" ; if ( f . tagName == "g" && ! G || f . tagName == "a" ) { A = svgedit . utilities . getBBox ( f ) ; var 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 ) ; C = d . createSVGMatrix ( ) ;
if ( A = na ( f ) ) { h = A * Math . PI / 180 ; F = Math . abs ( h ) > 1.0 E - 10 ? Math . sin ( h ) / ( 1 - Math . cos ( h ) ) : 2 / h ; for ( h = 0 ; h < k . numberOfItems ; ++ h ) { C = k . getItem ( h ) ; if ( C . type == 4 ) { C = C . matrix ; q . y = ( F * C . e + C . f ) / 2 ; q . x = ( C . e - F * C . f ) / 2 ; k . removeItem ( h ) ; break } } } h = C = G = 0 ; var E = k . numberOfItems ; if ( E ) var H = k . getItem ( 0 ) . matrix ; if ( E >= 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.0 E - 10 ? Math . sin ( h ) / ( 1 - Math . cos ( h ) ) :
2 / h ; for ( h = 0 ; h < k . numberOfItems ; ++ h ) { C = k . getItem ( h ) ; if ( C . type == 4 ) { C = C . matrix ; q . y = ( F * C . e + C . f ) / 2 ; q . x = ( C . e - F * C . f ) / 2 ; k . removeItem ( h ) ; break } } } h = 0 ; E = k . numberOfItems ; if ( ! svgedit . browser . isWebkit ( ) ) if ( ( H = f . getAttribute ( "fill" ) ) && H . indexOf ( "url(" ) === 0 ) { H = P ( H ) ; fa = "pattern" ; if ( H . tagName !== fa ) fa = "gradient" ; if ( H . getAttribute ( fa + "Units" ) === "userSpaceOnUse" ) { C = aa ( k ) . matrix ; A = R ( H ) ; A = aa ( A ) . matrix ; C = Z ( C , A ) ; A = "matrix(" + [ C . a , C . b , C . c , C . d , C . e , C . f ] . join ( "," ) + ")" ; H . setAttribute ( fa + "Transform" , A ) } } if ( E >= 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 ; h < F ; ++ h ) { n = A . getItem ( h ) ; D . points [ h ] = { x : n . x , y : n . y } } } case "path" : D . d = f . getAttribute ( "d" ) ; h = 1 ; k . clear ( ) } } else { h = 4 ; if ( G ) { q = d . createSVGTransform ( ) ; q . setRotate ( G , u . x , u . y ) ; k . numberOfItems ? k . insertItemBefore ( q , 0 ) : k . appendItem ( q ) } k . numberOfItems == 0 && f . removeAttribute ( "transform" ) ; return null } if ( h == 1 || h == 2 || h == 3 ) Za ( f , D , C ) ; if ( h == 2 ) { if ( G ) { qa ( k ) ||
( u = { x : q . x + C . e , y : q . y + C . f } ) ; q = d . createSVGTransform ( ) ; q . setRotate ( G , u . x , u . y ) ; k . numberOfItems ? k . insertItemBefore ( q , 0 ) : k . appendItem ( q ) } } else if ( h == 3 && G ) { C = aa ( k ) . matrix ; H = d . createSVGTransform ( ) ; H . setRotate ( G , q . x , q . y ) ; H = H . matrix ; q = d . createSVGTransform ( ) ; q . setRotate ( G , u . x , u . y ) ; u = q . matrix . inverse ( ) ; fa = C . inverse ( ) ; u = Z ( fa , u , H , C ) ; Za ( f , D , u ) ; if ( G ) k . numberOfItems ? k . insertItemBefore ( q , 0 ) : k . appendItem ( q ) } } k . numberOfItems == 0 && f . removeAttribute ( "transform" ) ; m . addSubCommand ( new Ma ( f , z ) ) ; return m } , mb = null , xa = this . clearSelection =
function ( f ) { if ( I [ 0 ] != null ) for ( var k = I . length , m = 0 ; m < k ; ++ m ) { var C = I [ m ] ; if ( C == null ) break ; ra . releaseSelector ( C ) ; I [ m ] = null } f || M ( "selected" , I ) } , qb = this . addToSelection = function ( f , k ) { if ( f . length != 0 ) { for ( var m = 0 ; m < I . length ; ) { if ( I [ m ] == null ) break ; ++ m } for ( var C = f . length ; C -- ; ) { var A = f [ C ] ; if ( A && svgedit . utilities . getBBox ( A ) ) { if ( A . tagName === "a" && A . childNodes . length === 1 ) A = A . firstChild ; if ( I . indexOf ( A ) == - 1 ) { I [ m ] = A ; m ++ ; A = ra . requestSelector ( A ) ; I . length > 1 && 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 < len ; ++ m ) { var C = I [ m ] ; if ( C ) if ( f . indexOf ( C ) == - 1 ) { k [ j ] = C ; j ++ } else ra . releaseSelector ( C ) } I = k } } ; this . selectAllInCurrentLayer = function ( ) { var f =
B ( ) . getCurrentLayer ( ) ; if ( f ) { Ha = "select" ; rb ( $ ( N || f ) . children ( ) ) } } ; var Bb = this . getMouseTarget = function ( f ) { if ( f == null || f . target == null ) return null ; f = f . target ; if ( f . correspondingUseElement ) f = f . correspondingUseElement ; if ( [ "http://www.w3.org/1998/Math/MathML" , "http://www.w3.org/1999/xhtml" ] . indexOf ( f . namespaceURI ) >= 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 ; F < I . length ; ++ F ) if ( I [ F ] != null ) { var J = R ( I [ F ] ) ; J . numberOfItems ? J . insertItemBefore ( d . createSVGTransform ( ) , 0 ) : J . appendItem ( d . createSVGTransform ( ) ) } } else if ( ! F ) { xa ( ) ;
Ha = "multiselect" ; if ( sa == null ) sa = ra . getRubberBandBox ( ) ; C *= v ; A *= v ; ma ( sa , { x : C , y : A , width : 0 , height : 0 , display : "inline" } , 100 ) } break ; case "zoom" : Ka = true ; if ( sa == null ) sa = ra . getRubberBandBox ( ) ; ma ( sa , { x : u * v , y : u * v , width : 0 , height : 0 , display : "inline" } , 100 ) ; break ; case "resize" : Ka = true ; k = n ; m = h ; G = svgedit . utilities . getBBox ( $ ( "#selectedBox0" ) [ 0 ] ) ; var O = { } ; $ . each ( G , function ( W , ca ) { O [ W ] = ca / v } ) ; G = O ; F = na ( q ) ? 1 : 0 ; if ( qa ( H ) ) { H . insertItemBefore ( d . createSVGTransform ( ) , F ) ; H . insertItemBefore ( d . createSVGTransform ( ) , F ) ; H . insertItemBefore ( d . createSVGTransform ( ) ,
F ) } else { H . appendItem ( d . createSVGTransform ( ) ) ; H . appendItem ( d . createSVGTransform ( ) ) ; H . appendItem ( d . createSVGTransform ( ) ) ; if ( svgedit . browser . supportsNonScalingStroke ( ) ) { if ( n = svgedit . browser . isWebkit ( ) ) J = function ( W ) { var ca = W . getAttributeNS ( null , "stroke" ) ; W . removeAttributeNS ( null , "stroke" ) ; setTimeout ( function ( ) { W . setAttributeNS ( null , "stroke" , ca ) } , 0 ) } ; q . style . vectorEffect = "non-scaling-stroke" ; n && J ( q ) ; h = q . getElementsByTagName ( "*" ) ; u = h . length ; for ( F = 0 ; F < u ; F ++ ) { h [ F ] . style . vectorEffect = "non-scaling-stroke" ;
n && J ( h [ F ] ) } } } break ; case "fhellipse" : case "fhrect" : case "fhpath" : Ka = true ; f = u + "," + E + " " ; J = K . stroke _width == 0 ? 1 : K . stroke _width ; S ( { element : "polyline" , curStyles : true , attr : { points : f , id : ka ( ) , fill : "none" , opacity : K . opacity / 2 , "stroke-linecap" : "round" , style : "pointer-events:none" } } ) ; D . minx = u ; D . maxx = u ; D . miny = E ; D . maxy = E ; break ; case "image" : Ka = true ; J = S ( { element : "image" , attr : { x : n , y : h , width : 0 , height : 0 , id : ka ( ) , opacity : K . opacity / 2 , style : "pointer-events:inherit" } } ) ; U ( J , Ga ) ; Fb ( J ) ; break ; case "square" : case "rect" : Ka = true ;
k = n ; m = h ; S ( { element : "rect" , curStyles : true , attr : { x : n , y : h , width : 0 , height : 0 , id : ka ( ) , opacity : K . opacity / 2 } } ) ; break ; case "line" : Ka = true ; J = K . stroke _width == 0 ? 1 : K . stroke _width ; S ( { element : "line" , curStyles : true , attr : { x1 : n , y1 : h , x2 : n , y2 : h , id : ka ( ) , stroke : K . stroke , "stroke-width" : J , "stroke-dasharray" : K . stroke _dasharray , "stroke-linejoin" : K . stroke _linejoin , "stroke-linecap" : K . stroke _linecap , "stroke-opacity" : K . stroke _opacity , fill : "none" , opacity : K . opacity / 2 , style : "pointer-events:none" } } ) ; break ; case "circle" : Ka = true ; S ( { element : "circle" ,
2015-12-22 05:05:03 +00:00
curStyles : true , attr : { cx : n , cy : h , r : 0 , id : ka ( ) , opacity : K . opacity / 2 } } ) ; break ; case "ellipse" : Ka = true ; S ( { element : "ellipse" , curStyles : true , attr : { cx : n , cy : h , rx : 0 , ry : 0 , id : ka ( ) , opacity : K . opacity / 2 } } ) ; break ; case "text" : Ka = true ; S ( { element : "text" , curStyles : true , attr : { x : n , y : h , id : ka ( ) , fill : Ua . fill , "stroke-width" : Ua . stroke _width , "font-size" : Ua . font _size , "font-family" : Ua . font _family , "text-anchor" : "start" , "xml:space" : "preserve" , opacity : K . opacity } } ) ; break ; case "path" : case "pathedit" : k *= v ; m *= v ; La . mouseDown ( z , q , k , m ) ; Ka =
2015-12-07 22:20:26 +00:00
true ; break ; case "textedit" : k *= v ; m *= v ; bb . mouseDown ( z , q , k , m ) ; Ka = true ; break ; case "rotate" : Ka = true ; c . undoMgr . beginUndoableChange ( "transform" , I ) ; document . getElementById ( "workarea" ) . className = "rotate" } J = ib ( "mouseDown" , { event : z , start _x : k , start _y : m , selectedElements : I } , true ) ; $ . each ( J , function ( W , ca ) { if ( ca && ca . started ) Ka = true } ) ; if ( Ha ) document . getElementById ( "workarea" ) . className = Ha == "resize" ? z . target . style . cursor : Ha } } ) . mousemove ( function ( z ) { if ( ! ( z . originalEvent . touches && z . originalEvent . touches . length > 1 ) ) 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 ; O < E ; ++ O ) { F = I [ O ] ; if ( F == null ) break ; var W = d . createSVGTransform ( ) ; q = R ( F ) ; if ( J ) { u = J . x - k ; H = J . y - m } W . setTranslate ( u , H ) ; q . numberOfItems ? q . replaceItem ( W , 0 ) : q . appendItem ( W ) ; ra . requestSelector ( F ) . resize ( ) } if ( z . altKey ) if ( ! c . addClones ) { c . addClones =
c . cloneSelectedElements ( 0 , 0 , W ) ; c . removeClones = function ( ) { c . addClones && c . addClones . forEach ( function ( ua ) { ua . parentNode && ua . parentNode . removeChild ( ua ) ; c . addClones = false } ) } ; window . addEventListener ( "keyup" , c . removeClones ) } M ( "transition" , I ) } } break ; case "multiselect" : u *= v ; E *= v ; ma ( sa , { x : Math . min ( C , u ) , y : Math . min ( A , E ) , width : Math . abs ( u - C ) , height : Math . abs ( E - A ) } , 100 ) ; q = [ ] ; u = [ ] ; J = ob ( ) ; E = I . length ; for ( O = 0 ; O < E ; ++ O ) { H = J . indexOf ( I [ O ] ) ; if ( H == - 1 ) q . push ( I [ O ] ) ; else J [ H ] = null } E = J . length ; for ( O = 0 ; O < E ; ++ O ) J [ O ] && u . push ( J [ O ] ) ;
q . length > 0 && 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 = k < x ? k : k - u ; O = m < y ? m : m - J } else { E = Math . min ( k , x ) ; O = Math . min ( m , y ) } if ( z . altKey ) { u *= 2 ; J *= 2 ; E = k - u / 2 ; O = m - J / 2 } if ( l . gridSnapping ) { u = va ( u ) ; J = va ( J ) ; E = va ( E ) ; O = va ( O ) } ma ( q , { width : u , height : J , x : E , y : O } , 1E3 ) ; break ; case "circle" : u = $ ( q ) . attr ( [ "cx" , "cy" ] ) ; J = u . cx ; E = u . cy ; u = Math . sqrt ( ( x - J ) * ( x - J ) + ( y - E ) * ( y - E ) ) ; if ( l . gridSnapping ) u = va ( u ) ; q . setAttributeNS ( null , "r" , u ) ; break ; case "ellipse" : u = $ ( q ) . attr ( [ "cx" , "cy" ] ) ; J = Math . abs ( k + ( x - k ) / 2 ) ; E = Math . abs ( m + ( y - m ) / 2 ) ; u = null ; window . opera || d . suspendRedraw ( 1E3 ) ;
if ( l . gridSnapping ) { x = va ( x ) ; J = va ( J ) ; y = va ( y ) ; E = va ( E ) } O = Math . abs ( k - J ) ; H = Math . abs ( m - E ) ; if ( z . shiftKey ) { H = O ; E = y > m ? 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 < z ; ++ n ) { if ( I [ n ] == null ) break ; I [ n ] . firstChild || ra . requestSelector ( I [ n ] ) . resize ( ) } } else { n =
z . target ; if ( I [ 0 ] . nodeName === "path" && I [ 1 ] == null ) La . select ( I [ 0 ] ) ; else z . shiftKey && F != n && c . removeFromSelection ( [ n ] ) } if ( svgedit . browser . supportsNonScalingStroke ( ) ) if ( z = I [ 0 ] ) { z . removeAttribute ( "style" ) ; svgedit . utilities . walkTree ( z , function ( W ) { W . removeAttribute ( "style" ) } ) } } return ; case "zoom" : sa != null && sa . setAttribute ( "display" , "none" ) ; M ( "zoomed" , { x : Math . min ( C , q ) , y : Math . min ( A , u ) , width : Math . abs ( q - C ) , height : Math . abs ( u - A ) , factor : z . altKey ? 0.5 : 2 } ) ; return ; case "fhpath" : F = E . getAttribute ( "points" ) ; u = F . indexOf ( "," ) ;
if ( H = u >= 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 && fa < O + 2 && fa > O - 2 && ha < W + 2 && ha > W - 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 < T ; fa ++ ) { var V = F . getStartPositionOfChar ( fa ) ; ha = F . getEndPositionOfChar ( fa ) ; if ( ! svgedit . browser . supportsGoodTextCharPos ( ) ) { var pa = c . contentW * v ; V . x -= pa ; ha . x -= pa ; V . x /= v ; ha . x /= v } E [ fa ] = { x : V . x , y : H . y , width : ha . x -
V . x , height : H . height } } E . push ( { x : ha . x , width : 0 } ) ; k ( h . selectionStart , h . selectionEnd , true ) } } } } ( ) , La = c . pathActions = function ( ) { var f = false , k , m , C ; svgedit . path . Path . prototype . endChanges = function ( D ) { if ( svgedit . browser . isWebkit ( ) ) { var z = this . elem ; z . setAttribute ( "d" , La . convertPath ( z ) ) } D = new Ma ( this . elem , { d : this . last _d } , D ) ; wa ( D ) ; M ( "changed" , [ this . elem ] ) } ; svgedit . path . Path . prototype . addPtsToSelection = function ( D ) { $ . isArray ( D ) || ( D = [ D ] ) ; for ( var z = 0 ; z < D . length ; z ++ ) { var F = D [ z ] , h = this . segs [ F ] ; h . ptgrip && this . selected _pts . indexOf ( F ) ==
- 1 && F >= 0 && this . selected _pts . push ( F ) } this . selected _pts . sort ( ) ; z = this . selected _pts . length ; for ( D = Array ( z ) ; z -- ; ) { 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 && q ) svgedit . path . first _grip = [ q . getAttribute ( "cx" ) , q . getAttribute ( "cy" ) ] ; 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 ; n < h ; ++ n ) { var q = z . getItem ( n ) , u = q . pathSegType ; if ( u != 1 ) { var E = [ ] ; $ . each ( [ "" , 1 , 2 ] , function ( H , J ) { var O = q [ "x" + J ] , W = q [ "y" + J ] ; if ( O !== undefined && W !== undefined ) { O = L ( O , W , F ) ; E . splice ( E . length , 0 , O . x , O . y ) } } ) ;
svgedit . path . replacePathSeg ( u , n , E , D ) } } e ( D , F ) } , zoomChange : function ( ) { Ha == "pathedit" && svgedit . path . path . update ( ) } , getNodePoint : function ( ) { if ( svgedit . path . path ) { var D = svgedit . path . path . segs [ svgedit . path . path . selected _pts . length ? svgedit . path . path . selected _pts [ 0 ] : 1 ] ; return { x : D . item . x , y : D . item . y , type : D . type } } } , linkControlPoints : function ( D ) { svgedit . path . setLinkControlPoints ( D ) } , clonePathNode : function ( ) { svgedit . path . path . storeD ( ) ; for ( var D = svgedit . path . path . selected _pts , z = D . length , F = [ ] ; z -- ; ) { var h = D [ z ] ; svgedit . path . path . addSeg ( h ) ;
F . push ( h + z ) ; F . push ( h + z + 1 ) } svgedit . path . path . init ( ) . addPtsToSelection ( F ) ; svgedit . path . path . endChanges ( "Clone path node(s)" ) } , opencloseSubPath : function ( ) { var D = svgedit . path . path . selected _pts ; if ( D . length === 1 ) { var z = svgedit . path . path . elem , F = z . pathSegList , h = D [ 0 ] , n = null , q = null ; svgedit . path . path . eachSeg ( function ( J ) { if ( this . type === 2 && J <= h ) q = this . item ; if ( J <= h ) return true ; if ( this . type === 2 ) { n = J ; return false } else if ( this . type === 1 ) return n = false } ) ; if ( n == null ) n = svgedit . path . path . segs . length - 1 ; if ( n !== false ) { var u =
z . createSVGPathSegLinetoAbs ( q . x , q . y ) , E = z . createSVGPathSegClosePath ( ) ; if ( n == svgedit . path . path . segs . length ) { F . appendItem ( u ) ; F . appendItem ( E ) } else { svgedit . path . insertItemBefore ( z , E , n ) ; svgedit . path . insertItemBefore ( z , u , n ) } svgedit . path . path . init ( ) . selectPt ( n + 1 ) } else if ( svgedit . path . path . segs [ h ] . mate ) { F . removeItem ( h ) ; F . removeItem ( h ) ; svgedit . path . path . init ( ) . selectPt ( h - 1 ) } else { for ( D = 0 ; D < F . numberOfItems ; D ++ ) { var H = F . getItem ( D ) ; if ( H . pathSegType === 2 ) u = D ; else if ( D === h ) F . removeItem ( u ) ; else if ( H . pathSegType ===
1 && h < D ) { E = D - 1 ; F . removeItem ( D ) ; break } } for ( D = h - u - 1 ; D -- ; ) svgedit . path . insertItemBefore ( z , F . getItem ( u ) , E ) ; z = F . getItem ( u ) ; svgedit . path . replacePathSeg ( 2 , u , [ z . x , z . y ] ) ; D = h ; svgedit . path . path . init ( ) . selectPt ( 0 ) } } } , deletePathNode : function ( ) { if ( La . canDeleteNodes ) { svgedit . path . path . storeD ( ) ; for ( var D = svgedit . path . path . selected _pts , z = D . length ; z -- ; ) svgedit . path . path . deleteSeg ( D [ z ] ) ; var F = function ( ) { var h = svgedit . path . path . elem . pathSegList , n = h . numberOfItems , q = function ( H , J ) { for ( ; J -- ; ) h . removeItem ( H ) } ; if ( n <= 1 ) return true ;
for ( ; n -- ; ) { var u = h . getItem ( n ) ; if ( u . pathSegType === 1 ) { u = h . getItem ( n - 1 ) ; var E = h . getItem ( n - 2 ) ; if ( u . pathSegType === 2 ) { q ( n - 1 , 2 ) ; F ( ) ; break } else if ( E . pathSegType === 2 ) { q ( n - 2 , 3 ) ; F ( ) ; break } } else if ( u . pathSegType === 2 ) if ( n > 0 ) { 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" ) ; q < F ; ++ q ) { E = z . getItem ( q ) ; D . push ( [ E . x , E . y ] . join ( "," ) ) } D = D . join ( " " ) ; D = S ( { element : "path" , curStyles : true , attr : { id : ba ( ) , d : D , fill : "none" } } ) } return D } , setSegType : function ( D ) { svgedit . path . path . setSegType ( D ) } , moveNode : function ( D , z ) { var F = svgedit . path . path . selected _pts ; if ( F . length ) { svgedit . path . path . storeD ( ) ; F = svgedit . path . path . segs [ F [ 0 ] ] ; var h = { x : 0 , y : 0 } ; h [ D ] = z - F . item [ D ] ; F . move ( h . x , h . y ) ; svgedit . path . path . endChanges ( "Move path point" ) } } , fixEnd : function ( D ) { for ( var z =
D . pathSegList , F = z . numberOfItems , h , n = 0 ; n < F ; ++ n ) { var q = z . getItem ( n ) ; if ( q . pathSegType === 2 ) h = q ; if ( q . pathSegType === 1 ) { q = z . getItem ( n - 1 ) ; if ( q . x != h . x || q . y != h . y ) { z = D . createSVGPathSegLinetoAbs ( h . x , h . y ) ; svgedit . path . insertItemBefore ( D , z , n ) ; La . fixEnd ( D ) ; break } } } svgedit . browser . isWebkit ( ) && D . setAttribute ( "d" , La . convertPath ( D ) ) } , convertPath : function ( D , z ) { for ( var F = D . pathSegList , h = F . numberOfItems , n = 0 , q = 0 , u = "" , E = null , H = 0 ; H < h ; ++ H ) { var J = F . getItem ( H ) , O = J . x || 0 , W = J . y || 0 , ca = J . x1 || 0 , T = J . y1 || 0 , fa = J . x2 || 0 , ha = J . y2 || 0 , V = J . pathSegType ,
pa = Oa [ V ] [ "to" + ( z ? "Lower" : "Upper" ) + "Case" ] ( ) , ua = function ( Aa , Ca , Pa ) { Ca = Ca ? " " + Ca . join ( " " ) : "" ; Pa = Pa ? " " + svgedit . units . shortFloat ( Pa ) : "" ; $ . each ( Aa , function ( Qa , Na ) { Aa [ Qa ] = svgedit . units . shortFloat ( Na ) } ) ; u += pa + Aa . join ( " " ) + Ca + Pa } ; switch ( V ) { case 1 : u += "z" ; break ; case 12 : O -= n ; case 13 : if ( z ) { n += O ; pa = "l" } else { O += n ; n = O ; pa = "L" } ua ( [ [ O , q ] ] ) ; break ; case 14 : W -= q ; case 15 : if ( z ) { q += W ; pa = "l" } else { W += q ; q = W ; pa = "L" } ua ( [ [ n , W ] ] ) ; break ; case 2 : case 4 : case 18 : O -= n ; W -= q ; case 5 : case 3 : if ( E && F . getItem ( H - 1 ) . pathSegType === 1 && ! z ) { n = E [ 0 ] ;
q = E [ 1 ] } case 19 : if ( z ) { n += O ; q += W } else { O += n ; W += q ; n = O ; q = W } if ( V === 3 ) E = [ n , q ] ; ua ( [ [ O , W ] ] ) ; break ; case 6 : O -= n ; ca -= n ; fa -= n ; W -= q ; T -= q ; ha -= q ; case 7 : if ( z ) { n += O ; q += W } else { O += n ; ca += n ; fa += n ; W += q ; T += q ; ha += q ; n = O ; q = W } ua ( [ [ ca , T ] , [ fa , ha ] , [ O , W ] ] ) ; break ; case 8 : O -= n ; ca -= n ; W -= q ; T -= q ; case 9 : if ( z ) { n += O ; q += W } else { O += n ; ca += n ; W += q ; T += q ; n = O ; q = W } ua ( [ [ ca , T ] , [ O , W ] ] ) ; break ; case 10 : O -= n ; W -= q ; case 11 : if ( z ) { n += O ; q += W } else { O += n ; W += q ; n = O ; q = W } ua ( [ [ J . r1 , J . r2 ] ] , [ J . angle , J . largeArcFlag ? 1 : 0 , J . sweepFlag ? 1 : 0 ] , [ O , W ] ) ; break ; case 16 : O -= n ; fa -= n ; W -=
q ; ha -= q ; case 17 : if ( z ) { n += O ; q += W } else { O += n ; fa += n ; W += q ; ha += q ; n = O ; q = W } ua ( [ [ fa , ha ] , [ O , W ] ] ) } } return u } } } ( ) , yb = this . removeUnusedDefElems = function ( ) { var f = p . getElementsByTagNameNS ( b , "defs" ) ; if ( ! f || ! f . length ) return 0 ; for ( var k = [ ] , m = 0 , C = [ "fill" , "stroke" , "filter" , "marker-start" , "marker-mid" , "marker-end" ] , A = C . length , G = p . getElementsByTagNameNS ( b , "*" ) , D = G . length , z = 0 ; z < D ; z ++ ) { for ( var F = G [ z ] , h = 0 ; h < A ; h ++ ) if ( F ) { var n = ja ( F . getAttribute ( C [ h ] ) ) ; n && k . push ( n . substr ( 1 ) ) } ( F = da ( F ) ) && F . indexOf ( "#" ) === 0 && k . push ( F . substr ( 1 ) ) } f =
$ ( f ) . find ( "linearGradient, radialGradient, filter, marker, svg, symbol" ) ; defelem _ids = [ ] ; for ( z = f . length ; z -- ; ) { C = f [ z ] ; A = C . id ; if ( k . indexOf ( A ) < 0 ) { sb [ A ] = C ; C . parentNode . removeChild ( C ) ; m ++ } } return m } ; this . svgCanvasToString = function ( ) { for ( ; yb ( ) > 0 ; ) ; 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 < C ; A ++ ) if ( m [ A ] . nodeName == "id" || m [ A ] . nodeName == "style" ) C -- ; if ( C <= 0 ) { m = this . firstChild ; f . push ( m ) ; $ ( this ) . replaceWith ( m ) } } ) ; var k = this . svgToString ( p , 0 ) ; f . length && $ ( f ) . each ( function ( ) { tb ( this ) } ) ; return k } ; this . svgToString = function ( f , k ) { var m = [ ] , C = svgedit . utilities . toXml , A = l . baseUnit , G = RegExp ( "^-?[\\d\\.]+" + A + "$" ) ; if ( f ) { la ( f ) ; var D = f . attributes , z , F , h = f . childNodes ; for ( F = 0 ; F < k ; F ++ ) m . push ( " " ) ; m . push ( "<" ) ; m . push ( f . nodeName ) ; if ( f . id === "svgcontent" ) { F = zb ( ) ; if ( A !== "px" ) { F . w = svgedit . units . convertUnit ( F . w ,
A ) + A ; F . h = svgedit . units . convertUnit ( F . h , A ) + A } m . push ( ' width="' + F . w + '" height="' + F . h + '" xmlns="' + b + '"' ) ; var n = { } ; $ ( f ) . find ( "*" ) . andSelf ( ) . each ( function ( ) { $ . each ( this . attributes , function ( H , J ) { var O = J . namespaceURI ; if ( O && ! n [ O ] && ya [ O ] !== "xmlns" && ya [ O ] !== "xml" ) { n [ O ] = true ; m . push ( " xmlns:" + ya [ O ] + '="' + O + '"' ) } } ) } ) ; F = D . length ; for ( A = [ "width" , "height" , "xmlns" , "x" , "y" , "viewBox" , "id" , "overflow" ] ; F -- ; ) { z = D . item ( F ) ; var q = C ( z . nodeValue ) ; if ( z . nodeName . indexOf ( "xmlns:" ) !== 0 ) if ( q != "" && A . indexOf ( z . localName ) == - 1 ) if ( ! z . namespaceURI ||
ya [ z . namespaceURI ] ) { m . push ( " " ) ; m . push ( z . nodeName ) ; m . push ( '="' ) ; m . push ( q ) ; m . push ( '"' ) } } } else { if ( f . nodeName === "defs" && ! f . firstChild ) return ; var u = [ "-moz-math-font-style" , "_moz-math-font-style" ] ; for ( F = D . length - 1 ; F >= 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 < h . length ; F ++ ) { A = h . item ( F ) ; switch ( A . nodeType ) { case 1 : m . push ( "\n" ) ; m . push ( this . svgToString ( h . item ( F ) , k ) ) ; break ; case 3 : A = A . nodeValue . replace ( /^\s+|\s+$/g , "" ) ; if ( A != "" ) { D = true ; m . push ( C ( A ) + "" ) } break ; case 4 : m . push ( "\n" ) ; m . push ( Array ( k +
1 ) . join ( " " ) ) ; m . push ( "<![CDATA[" ) ; m . push ( A . nodeValue ) ; m . push ( "]]\>" ) ; break ; case 8 : m . push ( "\n" ) ; m . push ( Array ( k + 1 ) . join ( " " ) ) ; m . push ( "<!--" ) ; m . push ( A . data ) ; m . push ( "--\>" ) } } k -- ; if ( ! D ) { m . push ( "\n" ) ; for ( F = 0 ; F < k ; F ++ ) m . push ( " " ) } m . push ( "</" ) ; m . push ( f . nodeName ) ; m . push ( ">" ) } else m . push ( "/>" ) } return m . join ( "" ) } ; this . embedImage = function ( f , k ) { $ ( new Image ) . load ( function ( ) { var m = document . createElement ( "canvas" ) ; m . width = this . width ; m . height = this . height ; m . getContext ( "2d" ) . drawImage ( this , 0 , 0 ) ; try { var C = ";svgedit_url=" +
encodeURIComponent ( f ) ; C = m . toDataURL ( ) . replace ( ";base64" , C + ";base64" ) ; Va [ f ] = C } catch ( A ) { Va [ f ] = false } Ga = f ; k && k ( Va [ f ] ) } ) . attr ( "src" , f ) } ; this . setGoodImage = function ( f ) { Ga = f } ; this . open = function ( ) { } ; this . save = function ( f ) { xa ( ) ; f && $ . extend ( $a , f ) ; $a . apply = true ; f = this . svgCanvasToString ( ) ; M ( "saved" , f ) } ; this . rasterExport = function ( ) { xa ( ) ; var f = [ ] , k = { feGaussianBlur : kb . exportNoBlur , foreignObject : kb . exportNoforeignObject , "[stroke-dasharray]" : kb . exportNoDashArray } , m = $ ( p ) ; if ( ! ( "font" in $ ( "<canvas>" ) [ 0 ] . getContext ( "2d" ) ) ) k . text =
kb . exportNoText ; $ . each ( k , function ( C , A ) { m . find ( C ) . length && f . push ( A ) } ) ; k = this . svgCanvasToString ( ) ; M ( "exported" , { svg : k , issues : f } ) } ; this . getSvgString = function ( ) { $a . apply = false ; return this . svgCanvasToString ( ) } ; this . randomizeIds = function ( ) { arguments . length > 0 && arguments [ 0 ] == false ? svgedit . draw . randomizeIds ( false , B ( ) ) : svgedit . draw . randomizeIds ( true , B ( ) ) } ; var Hb = this . uniquifyElems = function ( f ) { var k = { } , m = [ "filter" , "linearGradient" , "pattern" , "radialGradient" , "symbol" , "textPath" , "use" ] ; svgedit . utilities . walkTree ( f ,
function ( z ) { if ( z . nodeType == 1 ) { if ( z . id ) { z . id in k || ( k [ z . id ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; k [ z . id ] . elem = z } $ . each ( vb , function ( h , n ) { var q = z . getAttributeNode ( n ) ; if ( q ) { var u = svgedit . utilities . getUrlFromAttr ( q . value ) ; if ( u = u ? u . substr ( 1 ) : null ) { u in k || ( k [ u ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; k [ u ] . attrs . push ( q ) } } } ) ; var F = svgedit . utilities . getHref ( z ) ; if ( F && m . indexOf ( z . nodeName ) >= 0 ) if ( F = F . substr ( 1 ) ) { F in k || ( k [ F ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; k [ F ] . hrefs . push ( z ) } } } ) ; for ( var C in k ) if ( C ) { var A = k [ C ] . elem ; if ( A ) { f =
ka ( ) ; A . id = f ; A = k [ C ] . attrs ; for ( var G = A . length ; G -- ; ) { var D = A [ G ] ; D . ownerElement . setAttribute ( D . name , "url(#" + f + ")" ) } A = k [ C ] . hrefs ; for ( G = A . length ; G -- ; ) svgedit . utilities . setHref ( A [ G ] , "#" + f ) } } } , Gb = this . setUseData = function ( f ) { var k = $ ( f ) ; if ( f . tagName !== "use" ) k = k . find ( "use" ) ; k . each ( function ( ) { var m = da ( this ) . substr ( 1 ) ; if ( m = oa ( m ) ) { $ ( this ) . data ( "ref" , m ) ; if ( m . tagName == "symbol" || m . tagName == "svg" ) $ ( this ) . data ( "symbol" , m ) . data ( "ref" , m ) } } ) } , Ib = this . convertGradients = function ( f ) { var k = $ ( f ) . find ( "linearGradient, radialGradient" ) ;
if ( ! k . length && svgedit . browser . isWebkit ( ) ) k = $ ( f ) . find ( "*" ) . filter ( function ( ) { return this . tagName . indexOf ( "Gradient" ) >= 0 } ) ; k . each ( function ( ) { if ( $ ( this ) . attr ( "gradientUnits" ) === "userSpaceOnUse" ) { var m = $ ( p ) . find ( '[fill="url(#' + this . id + ')"],[stroke="url(#' + this . id + ')"]' ) ; if ( m . length ) if ( m = svgedit . utilities . getBBox ( m [ 0 ] ) ) if ( this . tagName === "linearGradient" ) { var C = $ ( this ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) , A = this . gradientTransform . baseVal ; if ( A && A . numberOfItems > 0 ) { var G = aa ( A ) . matrix ; A = L ( C . x1 , C . y1 , G ) ; G = L ( C . x2 , C . y2 ,
G ) ; C . x1 = A . x ; C . y1 = A . y ; C . x2 = G . x ; C . y2 = G . y ; this . removeAttribute ( "gradientTransform" ) } $ ( this ) . attr ( { x1 : ( C . x1 - m . x ) / m . width , y1 : ( C . y1 - m . y ) / m . height , x2 : ( C . x2 - m . x ) / m . width , y2 : ( C . y2 - m . y ) / m . height } ) ; this . removeAttribute ( "gradientUnits" ) } } } ) } , Lb = this . convertToGroup = function ( f ) { f || ( f = I [ 0 ] ) ; var k = $ ( f ) , m = new Da , C ; if ( k . data ( "gsvg" ) ) { m = $ ( f . firstChild ) . attr ( [ "x" , "y" ] ) ; $ ( f . firstChild . firstChild ) . unwrap ( ) ; $ ( f ) . removeData ( "gsvg" ) ; C = R ( f ) ; var A = d . createSVGTransform ( ) ; A . setTranslate ( m . x , m . y ) ; C . appendItem ( A ) ; Ra ( f ) ; M ( "selected" ,
[ f ] ) } else if ( k . data ( "symbol" ) ) { f = k . data ( "symbol" ) ; C = k . attr ( "transform" ) ; A = k . attr ( [ "x" , "y" ] ) ; var G = f . getAttribute ( "viewBox" ) ; if ( G ) { G = G . split ( " " ) ; A . x -= + G [ 0 ] ; A . y -= + G [ 1 ] } C += " translate(" + ( A . x || 0 ) + "," + ( A . y || 0 ) + ")" ; A = k . prev ( ) ; m . addSubCommand ( new Fa ( k [ 0 ] , k [ 0 ] . nextSibling , k [ 0 ] . parentNode ) ) ; k . remove ( ) ; G = $ ( p ) . find ( "use:data(symbol)" ) . length ; k = g . createElementNS ( b , "g" ) ; for ( var D = f . childNodes , z = 0 ; z < D . length ; z ++ ) k . appendChild ( D [ z ] . cloneNode ( true ) ) ; if ( svgedit . browser . isGecko ( ) ) { D = $ ( gb ( ) ) . children ( "linearGradient,radialGradient,pattern" ) . clone ( ) ;
$ ( k ) . append ( D ) } C && k . setAttribute ( "transform" , C ) ; C = f . parentNode ; Hb ( k ) ; svgedit . browser . isGecko ( ) && $ ( gb ( ) ) . append ( $ ( k ) . find ( "linearGradient,radialGradient,pattern" ) ) ; k . id = ka ( ) ; A . after ( k ) ; if ( C ) { if ( ! G ) { A = f . nextSibling ; C . removeChild ( f ) ; m . addSubCommand ( new Fa ( f , A , C ) ) } m . addSubCommand ( new Ia ( k ) ) } Gb ( k ) ; svgedit . browser . isGecko ( ) ? Ib ( gb ( ) ) : Ib ( k ) ; svgedit . utilities . walkTreePost ( k , function ( F ) { try { Ra ( F ) } catch ( h ) { console . log ( h ) } } ) ; $ ( k ) . find ( "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" ) . each ( function ( ) { if ( ! this . id ) this . id =
ka ( ) } ) ; rb ( [ k ] ) ; ( f = Db ( k , true ) ) && m . addSubCommand ( f ) ; wa ( m ) } else console . log ( "Unexpected element to ungroup:" , f ) } ; this . setSvgString = function ( f ) { try { var k = svgedit . utilities . text2xml ( f ) ; this . prepareSvg ( k ) ; var m = new Da ( "Change Source" ) , C = p . nextSibling , A = d . removeChild ( p ) ; m . addSubCommand ( new Fa ( A , C , d ) ) ; p = g . adoptNode ? g . adoptNode ( k . documentElement ) : g . importNode ( k . documentElement , true ) ; d . appendChild ( p ) ; var G = $ ( p ) ; c . current _drawing _ = new svgedit . draw . Drawing ( p , w ) ; var D = B ( ) . getNonce ( ) ; D ? M ( "setnonce" , D ) : M ( "unsetnonce" ) ;
G . find ( "image" ) . each ( function ( ) { var J = this ; Fb ( J ) ; var O = da ( this ) ; if ( O . indexOf ( "data:" ) === 0 ) { var W = O . match ( /svgedit_url=(.*?);/ ) ; if ( W ) { var ca = decodeURIComponent ( W [ 1 ] ) ; $ ( new Image ) . load ( function ( ) { J . setAttributeNS ( "http://www.w3.org/1999/xlink" , "xlink:href" , ca ) } ) . attr ( "src" , ca ) } } c . embedImage ( O ) } ) ; G . find ( "svg" ) . each ( function ( ) { if ( ! $ ( this ) . closest ( "defs" ) . length ) { Hb ( this ) ; var J = this . parentNode ; if ( J . childNodes . length === 1 && J . nodeName === "g" ) { $ ( J ) . data ( "gsvg" , this ) ; J . id = J . id || ka ( ) } else tb ( this ) } } ) ; G . find ( "linearGradient, radialGradient, pattern" ) . appendTo ( gb ( ) ) ;
Gb ( G ) ; Ib ( G [ 0 ] ) ; svgedit . utilities . walkTreePost ( p , function ( J ) { try { Ra ( J ) } catch ( O ) { console . log ( O ) } } ) ; var z = { id : "svgcontent" , overflow : l . show _outside _canvas ? "visible" : "hidden" } , F = false ; if ( G . attr ( "viewBox" ) ) { var h = G . attr ( "viewBox" ) . split ( " " ) ; z . width = h [ 2 ] ; z . height = h [ 3 ] } else $ . each ( [ "width" , "height" ] , function ( J , O ) { var W = G . attr ( O ) ; W || ( W = "100%" ) ; if ( ( W + "" ) . substr ( - 1 ) === "%" ) F = true ; else z [ O ] = Ba ( O , W ) } ) ; xb ( ) ; G . children ( ) . find ( "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" ) . each ( function ( ) { if ( ! this . id ) this . id =
ka ( ) } ) ; if ( F ) { var n = getStrokedBBox ( ) ; z . width = n . width + n . x ; z . height = n . height + n . y } if ( z . width <= 0 ) z . width = 200 ; if ( z . height <= 0 ) z . height = 200 ; G . attr ( z ) ; this . contentW = z . width ; this . contentH = z . height ; $ ( "#canvas_width" ) . val ( this . contentW ) ; $ ( "#canvas_height" ) . val ( this . contentH ) ; var q = $ ( "#canvas_background" ) ; if ( q . length ) { var u = q . attr ( "fill-opacity" ) ; u = u ? parseInt ( u ) * 100 : 100 ; fill = this . getPaint ( q . attr ( "fill" ) , u , "canvas" ) } else fill = this . getPaint ( "none" , 100 , "canvas" ) ; methodDraw . paintBox . canvas . setPaint ( fill ) ; m . addSubCommand ( new Ia ( p ) ) ;
var E = G . attr ( [ "width" , "height" ] ) ; m . addSubCommand ( new Ma ( d , E ) ) ; v = 1 ; svgedit . transformlist . resetListMap ( ) ; xa ( ) ; svgedit . path . clearData ( ) ; d . appendChild ( ra . selectorParentGroup ) ; wa ( m ) ; M ( "changed" , [ p ] ) } catch ( H ) { console . log ( H ) ; return false } return true } ; this . getPaint = function ( f , k , m ) { var C = null ; if ( f . indexOf ( "url(#" ) === 0 ) { f = ( f = svgCanvas . getRefElem ( f ) ) ? f . cloneNode ( true ) : $ ( "#" + m + "_color defs *" ) [ 0 ] ; C = { alpha : k } ; C [ f . tagName ] = f } else C = f . indexOf ( "#" ) === 0 ? { alpha : k , solidColor : f . substr ( 1 ) } : { alpha : k , solidColor : "none" } ;
return new $ . jGraduate . Paint ( C ) } ; this . importSvgString = function ( f ) { try { var k = svgedit . utilities . encode64 ( f . length + f ) . substr ( 0 , 32 ) , m = false ; if ( lb [ k ] ) if ( $ ( lb [ k ] . symbol ) . parents ( "#svgroot" ) . length ) m = true ; var C = new Da ( "Import SVG" ) ; if ( m ) var A = lb [ k ] . symbol , G = lb [ k ] . xform ; else { var D = svgedit . utilities . text2xml ( f ) ; this . prepareSvg ( D ) ; var z ; z = g . adoptNode ? g . adoptNode ( D . documentElement ) : g . importNode ( D . documentElement , true ) ; Hb ( z ) ; var F = Ba ( "width" , z . getAttribute ( "width" ) ) , h = Ba ( "height" , z . getAttribute ( "height" ) ) , n =
z . getAttribute ( "viewBox" ) , q = n ? n . split ( " " ) : [ 0 , 0 , F , h ] ; for ( f = 0 ; f < 4 ; ++ f ) q [ f ] = + q [ f ] ; p . getAttribute ( "width" ) ; var u = + p . getAttribute ( "height" ) ; G = h > F ? "scale(" + u / 3 / q [ 3 ] + ")" : "scale(" + u / 3 / q [ 2 ] + ")" ; G = "translate(0) " + G + " translate(0)" ; A = g . createElementNS ( b , "symbol" ) ; var E = gb ( ) ; for ( svgedit . browser . isGecko ( ) && $ ( z ) . find ( "linearGradient, radialGradient, pattern" ) . appendTo ( E ) ; z . firstChild ; ) A . appendChild ( z . firstChild ) ; var H = z . attributes ; for ( z = 0 ; z < H . length ; z ++ ) { var J = H [ z ] ; A . setAttribute ( J . nodeName , J . nodeValue ) } A . id =
ka ( ) ; lb [ k ] = { symbol : A , xform : G } ; gb ( ) . appendChild ( A ) ; C . addSubCommand ( new Ia ( A ) ) } var O = g . createElementNS ( b , "use" ) ; O . id = ka ( ) ; U ( O , "#" + A . id ) ; ( N || B ( ) . getCurrentLayer ( ) ) . appendChild ( O ) ; C . addSubCommand ( new Ia ( O ) ) ; xa ( ) ; O . setAttribute ( "transform" , G ) ; Ra ( O ) ; $ ( O ) . data ( "symbol" , A ) . data ( "ref" , A ) ; qb ( [ O ] ) ; wa ( C ) ; M ( "changed" , [ p ] ) } catch ( W ) { console . log ( W ) ; return false } return true } ; var xb = c . identifyLayers = function ( ) { Eb ( ) ; B ( ) . identifyLayers ( ) } ; this . createLayer = function ( f ) { var k = new Da ( "Create Layer" ) ; f = B ( ) . createLayer ( f ) ;
k . addSubCommand ( new Ia ( f ) ) ; wa ( k ) ; xa ( ) ; M ( "changed" , [ f ] ) } ; this . cloneLayer = function ( f ) { var k = new Da ( "Duplicate Layer" ) , m = g . createElementNS ( b , "g" ) , C = g . createElementNS ( b , "title" ) ; C . textContent = f ; m . appendChild ( C ) ; C = B ( ) . getCurrentLayer ( ) ; $ ( C ) . after ( m ) ; C = C . childNodes ; for ( var A = 0 ; A < C . length ; A ++ ) { var G = C [ A ] ; G . localName != "title" && m . appendChild ( ia ( G ) ) } xa ( ) ; xb ( ) ; k . addSubCommand ( new Ia ( m ) ) ; wa ( k ) ; c . setCurrentLayer ( f ) ; M ( "changed" , [ m ] ) } ; this . deleteCurrentLayer = function ( ) { var f = B ( ) . getCurrentLayer ( ) , k = f . nextSibling ,
m = f . parentNode ; if ( f = B ( ) . deleteCurrentLayer ( ) ) { var C = new Da ( "Delete Layer" ) ; C . addSubCommand ( new Fa ( f , k , m ) ) ; wa ( C ) ; xa ( ) ; M ( "changed" , [ m ] ) ; return true } return false } ; this . setCurrentLayer = function ( f ) { ( f = B ( ) . setCurrentLayer ( svgedit . utilities . toXml ( f ) ) ) && xa ( ) ; return f } ; this . renameCurrentLayer = function ( f ) { var k = B ( ) ; if ( k . current _layer ) { var m = k . current _layer ; if ( ! c . setCurrentLayer ( f ) ) { for ( var C = new Da ( "Rename Layer" ) , A = 0 ; A < k . getNumLayers ( ) ; ++ A ) if ( k . all _layers [ A ] [ 1 ] == m ) break ; var G = k . getLayerName ( A ) ; k . all _layers [ A ] [ 0 ] =
svgedit . utilities . toXml ( f ) ; var D = m . childNodes . length ; for ( A = 0 ; A < D ; ++ A ) { var z = m . childNodes . item ( A ) ; if ( z && z . tagName == "title" ) { for ( ; z . firstChild ; ) z . removeChild ( z . firstChild ) ; z . textContent = f ; C . addSubCommand ( new Ma ( z , { "#text" : G } ) ) ; wa ( C ) ; M ( "changed" , [ m ] ) ; return true } } } k . current _layer = m } return false } ; this . setCurrentLayerPosition = function ( f ) { var k = B ( ) ; if ( k . current _layer && f >= 0 && f < k . getNumLayers ( ) ) { for ( var m = 0 ; m < k . getNumLayers ( ) ; ++ m ) if ( k . all _layers [ m ] [ 1 ] == k . current _layer ) break ; if ( m == k . getNumLayers ( ) ) return false ;
if ( m != f ) { var C = null , A = k . current _layer . nextSibling ; if ( f > m ) { if ( f < k . getNumLayers ( ) - 1 ) C = k . all _layers [ f + 1 ] [ 1 ] } else C = k . all _layers [ f ] [ 1 ] ; p . insertBefore ( k . current _layer , C ) ; wa ( new Ja ( k . current _layer , A , p ) ) ; xb ( ) ; c . setCurrentLayer ( k . getLayerName ( f ) ) ; return true } } return false } ; this . setLayerVisibility = function ( f , k ) { var m = B ( ) , C = m . getLayerVisibility ( f ) , A = m . setLayerVisibility ( f , k ) ; if ( A ) wa ( new Ma ( A , { display : C ? "inline" : "none" } , "Layer Visibility" ) ) ; else return false ; if ( A == m . getCurrentLayer ( ) ) { xa ( ) ; La . clear ( ) } return true } ;
this . moveSelectedToLayer = function ( f ) { for ( var k = null , m = B ( ) , C = 0 ; C < m . getNumLayers ( ) ; ++ C ) if ( m . getLayerName ( C ) == f ) { k = m . all _layers [ C ] [ 1 ] ; break } if ( ! k ) return false ; f = new Da ( "Move Elements to Layer" ) ; m = I ; for ( C = m . length ; C -- ; ) { var A = m [ C ] ; if ( A ) { var G = A . nextSibling , D = A . parentNode ; k . appendChild ( A ) ; f . addSubCommand ( new Ja ( A , G , D ) ) } } wa ( f ) ; return true } ; this . mergeLayer = function ( f ) { var k = new Da ( "Merge Layer" ) , m = B ( ) , C = $ ( m . current _layer ) . prev ( ) [ 0 ] ; if ( C ) { for ( k . addSubCommand ( new Fa ( m . current _layer , m . current _layer . nextSibling ,
p ) ) ; m . current _layer . firstChild ; ) { var A = m . current _layer . firstChild ; if ( A . localName == "title" ) { k . addSubCommand ( new Fa ( A , A . nextSibling , m . current _layer ) ) ; m . current _layer . removeChild ( A ) } else { var G = A . nextSibling ; C . appendChild ( A ) ; k . addSubCommand ( new Ja ( A , G , m . current _layer ) ) } } p . removeChild ( m . current _layer ) ; if ( ! f ) { xa ( ) ; xb ( ) ; M ( "changed" , [ p ] ) ; wa ( k ) } m . current _layer = C ; return k } } ; this . mergeAllLayers = function ( ) { var f = new Da ( "Merge all Layers" ) , k = B ( ) ; for ( k . current _layer = k . all _layers [ k . getNumLayers ( ) - 1 ] [ 1 ] ; $ ( p ) . children ( "g" ) . length >
1 ; ) f . addSubCommand ( c . mergeLayer ( true ) ) ; xa ( ) ; xb ( ) ; M ( "changed" , [ p ] ) ; wa ( f ) } ; var Eb = this . leaveContext = function ( ) { var f = ta . length ; if ( f ) { for ( var k = 0 ; k < f ; k ++ ) { var m = ta [ k ] , C = cb ( m , "orig_opac" ) ; C !== 1 ? m . setAttribute ( "opacity" , C ) : m . removeAttribute ( "opacity" ) ; m . setAttribute ( "style" , "pointer-events: inherit" ) } ta = [ ] ; xa ( true ) ; M ( "contextset" , null ) } N = null } , Kb = this . setContext = function ( f ) { Eb ( ) ; if ( typeof f === "string" ) f = oa ( f ) ; N = f ; $ ( f ) . parentsUntil ( "#svgcontent" ) . andSelf ( ) . siblings ( ) . each ( function ( ) { var k = this . getAttribute ( "opacity" ) ||
1 ; cb ( this , "orig_opac" , k ) ; this . setAttribute ( "opacity" , k * 0.33 ) ; this . setAttribute ( "style" , "pointer-events: none" ) ; ta . push ( this ) } ) ; xa ( ) ; M ( "contextset" , N ) } ; this . clear = function ( ) { La . clear ( ) ; xa ( ) ; c . clearSvgContentElement ( ) ; c . current _drawing _ = new svgedit . draw . Drawing ( p ) ; c . createLayer ( "Layer 1" ) ; c . undoMgr . resetUndoStack ( ) ; ra . initGroup ( ) ; sa = ra . getRubberBandBox ( ) ; M ( "cleared" ) } ; this . linkControlPoints = La . linkControlPoints ; this . getContentElem = function ( ) { return p } ; this . getRootElem = function ( ) { return d } ; this . getSelectedElems =
function ( ) { return I } ; var zb = this . getResolution = function ( ) { var f = p . getAttribute ( "width" ) / v , k = p . getAttribute ( "height" ) / v ; return { w : f , h : k , zoom : v } } ; this . getZoom = function ( ) { return v } ; this . getVersion = function ( ) { return "svgcanvas.js ($Rev: 2082 $)" } ; this . setUiStrings = function ( f ) { $ . extend ( kb , f . notification ) } ; this . setConfig = function ( f ) { $ . extend ( l , f ) } ; this . getTitle = function ( f ) { if ( f = f || I [ 0 ] ) { f = $ ( f ) . data ( "gsvg" ) || $ ( f ) . data ( "symbol" ) || f ; f = f . childNodes ; for ( var k = 0 ; k < f . length ; k ++ ) if ( f [ k ] . nodeName == "title" ) return f [ k ] . textContent ;
return "" } } ; this . setGroupTitle = function ( f ) { var k = I [ 0 ] ; k = $ ( k ) . data ( "gsvg" ) || k ; var m = $ ( k ) . children ( "title" ) , C = new Da ( "Set Label" ) ; if ( f . length ) if ( m . length ) { m = m [ 0 ] ; C . addSubCommand ( new Ma ( m , { "#text" : m . textContent } ) ) ; m . textContent = f } else { m = g . createElementNS ( b , "title" ) ; m . textContent = f ; $ ( k ) . prepend ( m ) ; C . addSubCommand ( new Ia ( m ) ) } else { C . addSubCommand ( new Fa ( m [ 0 ] , m . nextSibling , k ) ) ; m . remove ( ) } wa ( C ) } ; this . getDocumentTitle = function ( ) { return c . getTitle ( p ) } ; this . setDocumentTitle = function ( f ) { for ( var k = p . childNodes ,
m = false , C = "" , A = new Da ( "Change Image Title" ) , G = 0 ; G < k . length ; G ++ ) if ( k [ G ] . nodeName == "title" ) { m = k [ G ] ; C = m . textContent ; break } if ( ! m ) { m = g . createElementNS ( b , "title" ) ; p . insertBefore ( m , p . firstChild ) } if ( f . length ) m . textContent = f ; else m . parentNode . removeChild ( m ) ; A . addSubCommand ( new Ma ( m , { "#text" : C } ) ) ; wa ( A ) } ; this . getEditorNS = function ( f ) { f && p . setAttribute ( "xmlns:se" , "http://svg-edit.googlecode.com" ) ; return "http://svg-edit.googlecode.com" } ; this . setResolution = function ( f , k ) { var m = zb ( ) , C = m . w ; m = m . h ; var A ; if ( f == "fit" ) { var G =
getStrokedBBox ( ) ; if ( G ) { A = new Da ( "Fit Canvas to Content" ) ; var D = pb ( ) ; qb ( D ) ; var z = [ ] , F = [ ] ; $ . each ( D , function ( ) { z . push ( G . x * - 1 ) ; F . push ( G . y * - 1 ) } ) ; D = c . moveSelectedElements ( z , F , true ) ; A . addSubCommand ( D ) ; xa ( ) ; f = Math . round ( G . width ) ; k = Math . round ( G . height ) } else return false } if ( f != C || k != m ) { D = d . suspendRedraw ( 1E3 ) ; A || ( A = new Da ( "Change Image Dimensions" ) ) ; f = Ba ( "width" , f ) ; k = Ba ( "height" , k ) ; p . setAttribute ( "width" , f ) ; p . setAttribute ( "height" , k ) ; this . contentW = f ; this . contentH = k ; A . addSubCommand ( new Ma ( p , { width : C , height : m } ) ) ;
p . setAttribute ( "viewBox" , [ 0 , 0 , f / v , k / v ] . join ( " " ) ) ; A . addSubCommand ( new Ma ( p , { viewBox : [ "0 0" , C , m ] . join ( " " ) } ) ) ; wa ( A ) ; d . unsuspendRedraw ( D ) ; if ( background = document . getElementById ( "canvas_background" ) ) { background . setAttribute ( "x" , - 1 ) ; background . setAttribute ( "y" , - 1 ) ; background . setAttribute ( "width" , f + 2 ) ; background . setAttribute ( "height" , k + 2 ) } M ( "changed" , [ p ] ) } return [ f , k ] } ; this . getOffset = function ( ) { return $ ( p ) . attr ( [ "x" , "y" ] ) } ; this . setBBoxZoom = function ( f , k , m ) { var C = 0.85 , A = function ( G ) { if ( ! G ) return false ; var D =
Math . min ( Math . round ( k / G . width * 100 * C ) / 100 , Math . round ( m / G . height * 100 * C ) / 100 ) ; c . setZoom ( D ) ; return { zoom : D , bbox : G } } ; if ( typeof f == "object" ) { f = f ; if ( f . width == 0 || f . height == 0 ) { c . setZoom ( f . zoom ? f . zoom : v * f . factor ) ; return { zoom : v , bbox : f } } return A ( f ) } switch ( f ) { case "selection" : if ( ! I [ 0 ] ) return ; f = $ . map ( I , function ( G ) { if ( G ) return G } ) ; f = getStrokedBBox ( f ) ; break ; case "canvas" : f = zb ( ) ; C = 0.95 ; f = { width : f . w , height : f . h , x : 0 , y : 0 } ; break ; case "content" : f = getStrokedBBox ( ) ; break ; case "layer" : f = getStrokedBBox ( pb ( B ( ) . getCurrentLayer ( ) ) ) ;
break ; default : return } return A ( f ) } ; this . setZoom = function ( f ) { var k = zb ( ) ; p . setAttribute ( "viewBox" , "0 0 " + k . w / f + " " + k . h / f ) ; v = f ; $ . each ( I , function ( m , C ) { C && ra . requestSelector ( C ) . resize ( ) } ) ; La . zoomChange ( ) ; ib ( "zoomChanged" , f ) } ; this . getMode = function ( ) { return Ha } ; this . setMode = function ( f ) { La . clear ( ) ; bb . clear ( ) ; $ ( "#workarea" ) . attr ( "class" , f ) ; Xa = I [ 0 ] && I [ 0 ] . nodeName == "text" ? Ua : K ; Ha = f } ; this . getColor = function ( f ) { return Xa [ f ] } ; this . setColor = function ( f , k , m ) { K [ f ] = k ; Xa [ f + "_paint" ] = { type : "solidColor" } ; for ( var C = [ ] , A =
I . length ; A -- ; ) { var G = I [ A ] ; if ( G ) if ( G . tagName == "g" ) svgedit . utilities . walkTree ( G , function ( D ) { D . nodeName != "g" && C . push ( D ) } ) ; else if ( f == "fill" ) G . tagName != "polyline" && G . tagName != "line" && C . push ( G ) ; else C . push ( G ) } if ( C . length > 0 ) if ( m ) Ab ( f , k , C ) ; else { Ya ( f , k , C ) ; M ( "changed" , C ) } } ; var gb = function ( ) { var f = p . getElementsByTagNameNS ( b , "defs" ) ; if ( f . length > 0 ) f = f [ 0 ] ; else { f = g . createElementNS ( b , "defs" ) ; p . firstChild ? p . insertBefore ( f , p . firstChild . nextSibling ) : p . appendChild ( f ) } return f } , Nb = this . setGradient = function ( f ) { if ( ! ( ! Xa [ f +
"_paint" ] || Xa [ f + "_paint" ] . type == "solidColor" ) ) { var k = c [ f + "Grad" ] , m = Mb ( k ) , C = gb ( ) ; if ( m ) k = m ; else { k = C . appendChild ( g . importNode ( k , true ) ) ; k . id = ka ( ) } c . setColor ( f , "url(#" + k . id + ")" ) ; if ( f == "canvas" ) ( f = document . getElementById ( "canvas_background" ) ) && f . setAttribute ( "fill" , "url(#" + k . id + ")" ) } } , Mb = function ( f ) { var k = gb ( ) ; k = $ ( k ) . find ( "linearGradient, radialGradient" ) ; for ( var m = k . length , C = [ "r" , "cx" , "cy" , "fx" , "fy" ] ; m -- ; ) { var A = k [ m ] ; if ( f . tagName == "linearGradient" ) { if ( f . getAttribute ( "x1" ) != A . getAttribute ( "x1" ) || f . getAttribute ( "y1" ) !=
A . getAttribute ( "y1" ) || f . getAttribute ( "x2" ) != A . getAttribute ( "x2" ) || f . getAttribute ( "y2" ) != A . getAttribute ( "y2" ) ) continue } else { var G = $ ( f ) . attr ( C ) , D = $ ( A ) . attr ( C ) , z = false ; $ . each ( C , function ( E , H ) { if ( G [ H ] != D [ H ] ) z = true } ) ; if ( z ) continue } var F = f . getElementsByTagNameNS ( b , "stop" ) , h = A . getElementsByTagNameNS ( b , "stop" ) ; if ( F . length == h . length ) { for ( var n = F . length ; n -- ; ) { var q = F [ n ] , u = h [ n ] ; if ( q . getAttribute ( "offset" ) != u . getAttribute ( "offset" ) || q . getAttribute ( "stop-opacity" ) != u . getAttribute ( "stop-opacity" ) || q . getAttribute ( "stop-color" ) !=
u . getAttribute ( "stop-color" ) ) break } if ( n == - 1 ) return A } } return null } ; this . setPaint = function ( f , k ) { var m = new $ . jGraduate . Paint ( k ) ; this . setPaintOpacity ( f , m . alpha / 100 , true ) ; Xa [ f + "_paint" ] = m ; switch ( m . type ) { case "solidColor" : if ( m . solidColor != "none" && m . solidColor != "#none" ) this . setColor ( f , "#" + m . solidColor ) ; else { this . setColor ( f , "none" ) ; document . querySelector ( f == "fill" ? "#fill_color rect" : "#stroke_color rect" ) . setAttribute ( "fill" , "none" ) } break ; case "linearGradient" : case "radialGradient" : c [ f + "Grad" ] = m [ m . type ] ;
Nb ( f ) } } ; this . getStrokeWidth = function ( ) { return Xa . stroke _width } ; this . setStrokeWidth = function ( f ) { if ( f == 0 && [ "line" , "path" ] . indexOf ( Ha ) >= 0 ) c . setStrokeWidth ( 1 ) ; else { Xa . stroke _width = f ; for ( var k = [ ] , m = I . length ; m -- ; ) { var C = I [ m ] ; if ( C ) C . tagName == "g" ? svgedit . utilities . walkTree ( C , function ( A ) { A . nodeName != "g" && k . push ( A ) } ) : k . push ( C ) } if ( k . length > 0 ) { Ya ( "stroke-width" , f , k ) ; M ( "changed" , I ) } } } ; this . setStrokeAttr = function ( f , k ) { K [ f . replace ( "-" , "_" ) ] = k ; for ( var m = [ ] , C = I . length ; C -- ; ) { var A = I [ C ] ; if ( A ) A . tagName == "g" ? svgedit . utilities . walkTree ( A ,
function ( G ) { G . nodeName != "g" && m . push ( G ) } ) : m . push ( A ) } if ( m . length > 0 ) { Ya ( f , k , m ) ; M ( "changed" , I ) } } ; this . getStyle = function ( ) { return K } ; this . getOpacity = function ( ) { return K . opacity } ; this . setOpacity = function ( f ) { K . opacity = f ; Ya ( "opacity" , f ) } ; this . getFillOpacity = function ( ) { return K . fill _opacity } ; this . getStrokeOpacity = function ( ) { return K . stroke _opacity } ; this . setPaintOpacity = function ( f , k , m ) { K [ f + "_opacity" ] = k ; m ? Ab ( f + "-opacity" , k ) : Ya ( f + "-opacity" , k ) } ; this . getBlur = function ( f ) { var k = 0 ; if ( f ) if ( f . getAttribute ( "filter" ) ) if ( f =
oa ( f . id + "_blur" ) ) k = f . firstChild . getAttribute ( "stdDeviation" ) ; return k } ; ( function ( ) { function f ( ) { var A = c . undoMgr . finishUndoableChange ( ) ; k . addSubCommand ( A ) ; wa ( k ) ; m = k = null } var k = null , m = null , C = false ; c . setBlurNoUndo = function ( A ) { if ( m ) if ( A === 0 ) { Ab ( "filter" , "" ) ; C = true } else { var G = I [ 0 ] ; C && Ab ( "filter" , "url(#" + G . id + "_blur)" ) ; if ( svgedit . browser . isWebkit ( ) ) { G . removeAttribute ( "filter" ) ; G . setAttribute ( "filter" , "url(#" + G . id + "_blur)" ) } Ab ( "stdDeviation" , A , [ m . firstChild ] ) ; c . setBlurOffsets ( m , A ) } else c . setBlur ( A ) } ; c . setBlurOffsets =
function ( A , G ) { if ( G > 3 ) ma ( A , { x : "-50%" , y : "-50%" , width : "200%" , height : "200%" } , 100 ) ; else if ( ! svgedit . browser . isWebkit ( ) ) { A . removeAttribute ( "x" ) ; A . removeAttribute ( "y" ) ; A . removeAttribute ( "width" ) ; A . removeAttribute ( "height" ) } } ; c . setBlur = function ( A , G ) { if ( k ) f ( ) ; else { var D = I [ 0 ] , z = D . id ; m = oa ( z + "_blur" ) ; A -= 0 ; var F = new Da ; if ( m ) { if ( A === 0 ) m = null } else { var h = S ( { element : "feGaussianBlur" , attr : { "in" : "SourceGraphic" , stdDeviation : A } } ) ; m = S ( { element : "filter" , attr : { id : z + "_blur" } } ) ; m . appendChild ( h ) ; gb ( ) . appendChild ( m ) ; F . addSubCommand ( new Ia ( m ) ) } h =
{ filter : D . getAttribute ( "filter" ) } ; if ( A === 0 ) { D . removeAttribute ( "filter" ) ; F . addSubCommand ( new Ma ( D , h ) ) } else { Ya ( "filter" , "url(#" + z + "_blur)" ) ; F . addSubCommand ( new Ma ( D , h ) ) ; c . setBlurOffsets ( m , A ) ; k = F ; c . undoMgr . beginUndoableChange ( "stdDeviation" , [ m ? m . firstChild : null ] ) ; if ( G ) { c . setBlurNoUndo ( A ) ; f ( ) } } } } } ) ( ) ; this . getBold = function ( ) { var f = true ; I . filter ( Boolean ) . forEach ( function ( k ) { if ( k . getAttribute ( "font-weight" ) != "bold" ) f = false } ) ; return f } ; this . setBold = function ( f ) { var k = I . filter ( Boolean ) ; k . forEach ( function ( m ) { if ( m !=
null && m . tagName == "text" ) Ya ( "font-weight" , f ? "bold" : "normal" ) } ) ; k [ 0 ] . textContent || bb . setCursor ( ) } ; this . getItalic = function ( ) { var f = true ; I . filter ( Boolean ) . forEach ( function ( k ) { if ( k . getAttribute ( "font-style" ) != "italic" ) f = false } ) ; return f } ; this . setItalic = function ( f ) { var k = I . filter ( Boolean ) ; k . forEach ( function ( m ) { if ( m != null && m . tagName == "text" ) Ya ( "font-style" , f ? "italic" : "normal" ) } ) ; k [ 0 ] . textContent || bb . setCursor ( ) } ; this . getFontFamily = function ( ) { return Ua . font _family } ; this . setFontFamily = function ( f ) { Ua . font _family =
f ; Ya ( "font-family" , f ) ; I [ 0 ] && ! I [ 0 ] . textContent && bb . setCursor ( ) } ; this . setFontColor = function ( f ) { Ua . fill = f ; Ya ( "fill" , f ) } ; this . getFontSize = function ( ) { return Ua . fill } ; this . getFontSize = function ( ) { return Ua . font _size } ; this . setFontSize = function ( f ) { Ua . font _size = f ; Ya ( "font-size" , f ) ; I [ 0 ] . textContent || bb . setCursor ( ) } ; this . getText = function ( ) { var f = I [ 0 ] ; if ( f == null ) return "" ; return f . textContent } ; this . setTextContent = function ( f ) { Ya ( "#text" , f ) ; bb . init ( f ) ; bb . setCursor ( ) } ; this . setImageURL = function ( f ) { var k = I [ 0 ] ; if ( k ) { var m =
$ ( k ) . attr ( [ "width" , "height" ] ) ; m = ! m . width || ! m . height ; var C = da ( k ) ; if ( C !== f ) m = true ; else if ( ! m ) return ; var A = new Da ( "Change Image URL" ) ; U ( k , f ) ; A . addSubCommand ( new Ma ( k , { "#href" : C } ) ) ; m ? $ ( new Image ) . load ( function ( ) { var G = $ ( k ) . attr ( [ "width" , "height" ] ) ; $ ( k ) . attr ( { width : this . width , height : this . height } ) ; ra . requestSelector ( k ) . resize ( ) ; A . addSubCommand ( new Ma ( k , G ) ) ; wa ( A ) ; M ( "changed" , [ k ] ) } ) . attr ( "src" , f ) : wa ( A ) } } ; this . setLinkURL = function ( f ) { var k = I [ 0 ] ; if ( k ) { if ( k . tagName !== "a" ) { k = $ ( k ) . parents ( "a" ) ; if ( k . length ) k = k [ 0 ] ;
else return } var m = da ( k ) ; if ( m !== f ) { var C = new Da ( "Change Link URL" ) ; U ( k , f ) ; C . addSubCommand ( new Ma ( k , { "#href" : m } ) ) ; wa ( C ) } } } ; this . elementsAreSame = function ( f ) { return ! f . length || f [ 0 ] == null ? null : I . every ( function ( k ) { return k && I [ 0 ] ? k . nodeName == I [ 0 ] . nodeName : null } ) } ; this . setRectRadius = function ( f ) { c . elementsAreSame ( I ) && I [ 0 ] . tagName == "rect" && I . forEach ( function ( k ) { var m = k . getAttribute ( "rx" ) ; if ( m != f ) { k . setAttribute ( "rx" , f ) ; k . setAttribute ( "ry" , f ) ; wa ( new Ma ( k , { rx : m , ry : m } , "Radius" ) ) ; M ( "changed" , [ k ] ) } } ) } ; this . makeHyperlink =
function ( f ) { c . groupSelectedElements ( "a" , f ) } ; this . removeHyperlink = function ( ) { c . ungroupSelectedElement ( ) } ; this . setSegType = function ( f ) { La . setSegType ( f ) } ; this . convertToPath = function ( f , k ) { if ( f == null ) $ . each ( I , function ( ca , T ) { T && c . convertToPath ( T ) } ) ; else { if ( ! k ) var m = new Da ( "Convert element to Path" ) ; var C = k ? { } : { fill : K . fill , "fill-opacity" : K . fill _opacity , stroke : K . stroke , "stroke-width" : K . stroke _width , "stroke-dasharray" : K . stroke _dasharray , "stroke-linejoin" : K . stroke _linejoin , "stroke-linecap" : K . stroke _linecap ,
"stroke-opacity" : K . stroke _opacity , opacity : K . opacity , visibility : "hidden" } ; $ . each ( [ "marker-start" , "marker-end" , "marker-mid" , "filter" , "clip-path" ] , function ( ) { if ( f . getAttribute ( this ) ) C [ this ] = f . getAttribute ( this ) } ) ; var A = S ( { element : "path" , attr : C } ) , G = f . getAttribute ( "transform" ) ; G && A . setAttribute ( "transform" , G ) ; var D = f . id , z = f . parentNode ; f . nextSibling ? z . insertBefore ( A , f ) : z . appendChild ( A ) ; var F = "" , h = function ( ca ) { $ . each ( ca , function ( T , fa ) { var ha = fa [ 1 ] ; F += fa [ 0 ] ; for ( var V = 0 ; V < ha . length ; V += 2 ) F += ha [ V ] + "," + ha [ V +
1 ] + " " } ) } , n = 1.81 ; switch ( f . tagName ) { case "ellipse" : case "circle" : var q = $ ( f ) . attr ( [ "rx" , "ry" , "cx" , "cy" ] ) , u = q . cx , E = q . cy , H = q . rx ; q = q . ry ; if ( f . tagName == "circle" ) H = q = $ ( f ) . attr ( "r" ) ; h ( [ [ "M" , [ u - H , E ] ] , [ "C" , [ u - H , E - q / n , u - H / n , E - q , u , E - q ] ] , [ "C" , [ u + H / n , E - q , u + H , E - q / n , u + H , E ] ] , [ "C" , [ u + H , E + q / n , u + H / n , E + q , u , E + q ] ] , [ "C" , [ u - H / n , E + q , u - H , E + q / n , u - H , E ] ] , [ "Z" , [ ] ] ] ) ; break ; case "path" : F = f . getAttribute ( "d" ) ; break ; case "line" : q = $ ( f ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) ; F = "M" + q . x1 + "," + q . y1 + "L" + q . x2 + "," + q . y2 ; break ; case "polyline" : case "polygon" : F =
"M" + f . getAttribute ( "points" ) ; break ; case "rect" : q = $ ( f ) . attr ( [ "rx" , "ry" ] ) ; H = q . rx ; q = q . ry ; var J = f . getBBox ( ) ; u = J . x ; E = J . y ; var O = J . width ; J = J . height ; n = 4 - n ; if ( ! H && ! q ) h ( [ [ "M" , [ u , E ] ] , [ "L" , [ u + O , E ] ] , [ "L" , [ u + O , E + J ] ] , [ "L" , [ u , E + J ] ] , [ "L" , [ u , E ] ] , [ "Z" , [ ] ] ] ) ; else { q || ( q = H ) ; h ( [ [ "M" , [ u , E + q ] ] , [ "C" , [ u , E + q / n , u + H / n , E , u + H , E ] ] , [ "L" , [ u + O - H , E ] ] , [ "C" , [ u + O - H / n , E , u + O , E + q / n , u + O , E + q ] ] , [ "L" , [ u + O , E + J - q ] ] , [ "C" , [ u + O , E + J - q / n , u + O - H / n , E + J , u + O - H , E + J ] ] , [ "L" , [ u + H , E + J ] ] , [ "C" , [ u + H / n , E + J , u , E + J - q / n , u , E + J - q ] ] , [ "L" , [ u , E + q ] ] , [ "Z" , [ ] ] ] ) } break ; default : A . parentNode . removeChild ( A ) } F &&
A . setAttribute ( "d" , F ) ; if ( k ) { La . resetOrientation ( A ) ; m = false ; try { m = A . getBBox ( ) } catch ( W ) { } A . parentNode . removeChild ( A ) ; return m } else { if ( G ) { G = R ( A ) ; qa ( G ) && La . resetOrientation ( A ) } m . addSubCommand ( new Fa ( f , f . nextSibling , z ) ) ; m . addSubCommand ( new Ia ( A ) ) ; xa ( ) ; f . parentNode . removeChild ( f ) ; A . setAttribute ( "id" , D ) ; A . removeAttribute ( "visibility" ) ; qb ( [ A ] , true ) ; wa ( m ) } } } ; var Ab = this . changeSelectedAttributeNoUndo = function ( f , k , m ) { var C = d . suspendRedraw ( 1E3 ) ; Ha == "pathedit" && La . moveNode ( f , k ) ; m = m || I ; for ( var A = m . length , G = [ "g" ,
"polyline" , "path" ] ; A -- ; ) { var D = m [ A ] ; if ( D != null ) { Ha === "textedit" && f !== "#text" && D . textContent . length && bb . toSelectMode ( D ) ; if ( ( f === "x" || f === "y" ) && G . indexOf ( D . tagName ) >= 0 ) { var z = getStrokedBBox ( [ D ] ) ; c . moveSelectedElements ( ( f === "x" ? k - z . x : 0 ) * v , ( f === "y" ? k - z . y : 0 ) * v , true ) } else { z = f === "#text" ? D . textContent : D . getAttribute ( f ) ; if ( z == null ) z = "" ; if ( z !== String ( k ) ) { if ( f == "#text" ) { svgedit . utilities . getBBox ( D ) ; D . textContent = k } else f == "#href" ? U ( D , k ) : D . setAttribute ( f , k ) ; I . indexOf ( D ) >= 0 && setTimeout ( function ( ) { D . parentNode &&
ra . requestSelector ( D ) . resize ( ) } , 0 ) ; z = na ( D ) ; if ( z != 0 && f != "transform" ) for ( var F = R ( D ) , h = F . numberOfItems ; h -- ; ) if ( F . getItem ( h ) . type == 4 ) { F . removeItem ( h ) ; var n = svgedit . utilities . getBBox ( D ) , q = L ( n . x + n . width / 2 , n . y + n . height / 2 , aa ( F ) . matrix ) ; n = q . x ; q = q . y ; var u = d . createSVGTransform ( ) ; u . setRotate ( z , n , q ) ; F . insertItemBefore ( u , h ) ; break } } } } } d . unsuspendRedraw ( C ) } , Ya = this . changeSelectedAttribute = function ( f , k , m ) { m = m || I ; c . undoMgr . beginUndoableChange ( f , m ) ; Ab ( f , k , m ) ; f = c . undoMgr . finishUndoableChange ( ) ; f . isEmpty ( ) || wa ( f ) } ; this . deleteSelectedElements =
function ( ) { for ( var f = new Da ( "Delete Elements" ) , k = I . length , m = [ ] , C = 0 ; C < k ; ++ C ) { var A = I [ C ] ; if ( A == null ) break ; var G = A . parentNode , D = A ; ra . releaseSelector ( D ) ; svgedit . path . removePath _ ( D . id ) ; if ( G . tagName === "a" && G . childNodes . length === 1 ) { D = G ; G = G . parentNode } var z = D . nextSibling ; D = G . removeChild ( D ) ; m . push ( A ) ; I [ C ] = null ; f . addSubCommand ( new Fa ( D , z , G ) ) } f . isEmpty ( ) || wa ( f ) ; M ( "changed" , m ) ; xa ( ) } ; this . cutSelectedElements = function ( ) { for ( var f = new Da ( "Cut Elements" ) , k = I . length , m = [ ] , C = 0 ; C < k ; ++ C ) { var A = I [ C ] ; if ( A == null ) break ; var G =
A . parentNode , D = A ; ra . releaseSelector ( D ) ; svgedit . path . removePath _ ( D . id ) ; var z = D . nextSibling ; D = G . removeChild ( D ) ; m . push ( A ) ; I [ C ] = null ; f . addSubCommand ( new Fa ( D , z , G ) ) } f . isEmpty ( ) || wa ( f ) ; M ( "changed" , m ) ; xa ( ) ; c . clipBoard = m } ; this . copySelectedElements = function ( ) { c . clipBoard = $ . merge ( [ ] , I ) } ; this . pasteElements = function ( ) { var f = c . clipBoard , k = f . length ; if ( k ) { for ( var m = [ ] , C = new Da ( "Paste elements" ) ; k -- ; ) { var A = f [ k ] ; if ( A ) { var G = ia ( A ) ; if ( ! oa ( A . id ) ) G . id = A . id ; m . push ( G ) ; ( N || B ( ) . getCurrentLayer ( ) ) . appendChild ( G ) ; C . addSubCommand ( new Ia ( G ) ) } } svgCanvas . clearSelection ( ) ;
setTimeout ( function ( ) { rb ( m ) } , 100 ) ; wa ( C ) ; M ( "changed" , m ) } } ; this . groupSelectedElements = function ( f ) { f || ( f = "g" ) ; var k = "" ; switch ( f ) { case "a" : k = "Make hyperlink" ; var m = "" ; if ( arguments . length > 1 ) m = arguments [ 1 ] ; break ; default : f = "g" ; k = "Group Elements" } k = new Da ( k ) ; var C = S ( { element : f , attr : { id : ka ( ) } } ) ; f === "a" && U ( C , m ) ; k . addSubCommand ( new Ia ( C ) ) ; for ( m = I . length ; m -- ; ) { var A = I [ m ] ; if ( A != null ) { if ( A . parentNode . tagName === "a" && A . parentNode . childNodes . length === 1 ) A = A . parentNode ; var G = A . nextSibling , D = A . parentNode ; C . appendChild ( A ) ;
k . addSubCommand ( new Ja ( A , G , D ) ) } } k . isEmpty ( ) || wa ( k ) ; rb ( [ C ] , true ) } ; var Db = this . pushGroupProperties = function ( f , k ) { var m = f . childNodes , C = m . length , A = f . getAttribute ( "transform" ) , G = R ( f ) , D = aa ( G ) . matrix , z = new Da ( "Push group properties" ) , F = 0 , h = na ( f ) , n = $ ( f ) . attr ( [ "filter" , "opacity" ] ) , q , u ; for ( F = 0 ; F < C ; F ++ ) { var E = m [ F ] ; if ( E . nodeType === 1 ) { if ( n . opacity !== null && n . opacity !== 1 ) { E . getAttribute ( "opacity" ) ; var H = Math . round ( ( E . getAttribute ( "opacity" ) || 1 ) * n . opacity * 100 ) / 100 ; Ya ( "opacity" , H , [ E ] ) } if ( n . filter ) { var J = H = this . getBlur ( E ) ;
u || ( u = this . getBlur ( f ) ) ; if ( H ) H = u - 0 + ( H - 0 ) ; else if ( H === 0 ) H = u ; if ( J ) q = P ( E . getAttribute ( "filter" ) ) ; else if ( q ) { q = ia ( q ) ; gb ( ) . appendChild ( q ) } else q = P ( n . filter ) ; q . id = E . id + "_" + ( q . firstChild . tagName === "feGaussianBlur" ? "blur" : "filter" ) ; Ya ( "filter" , "url(#" + q . id + ")" , [ E ] ) ; if ( H ) { Ya ( "stdDeviation" , H , [ q . firstChild ] ) ; c . setBlurOffsets ( q , H ) } } H = R ( E ) ; if ( ~ E . tagName . indexOf ( "Gradient" ) ) H = null ; if ( H ) if ( E . tagName !== "defs" ) if ( G . numberOfItems ) { if ( h && G . numberOfItems == 1 ) { var O = G . getItem ( 0 ) . matrix , W = d . createSVGMatrix ( ) ; if ( J = na ( E ) ) W =
H . getItem ( 0 ) . matrix ; var ca = svgedit . utilities . getBBox ( E ) , T = aa ( H ) . matrix , fa = L ( ca . x + ca . width / 2 , ca . y + ca . height / 2 , T ) ; ca = h + J ; T = d . createSVGTransform ( ) ; T . setRotate ( ca , fa . x , fa . y ) ; O = Z ( O , W , T . matrix . inverse ( ) ) ; J && H . removeItem ( 0 ) ; if ( ca ) H . numberOfItems ? H . insertItemBefore ( T , 0 ) : H . appendItem ( T ) ; if ( O . e || O . f ) { J = d . createSVGTransform ( ) ; J . setTranslate ( O . e , O . f ) ; H . numberOfItems ? H . insertItemBefore ( J , 0 ) : H . appendItem ( J ) } } else { J = E . getAttribute ( "transform" ) ; O = { } ; O . transform = J ? J : "" ; J = d . createSVGTransform ( ) ; O = aa ( H ) . matrix ; W = O . inverse ( ) ;
O = Z ( W , D , O ) ; J . setMatrix ( O ) ; H . appendItem ( J ) } ( E = Ra ( E ) ) && z . addSubCommand ( E ) } } } if ( A ) { O = { } ; O . transform = A ; f . setAttribute ( "transform" , "" ) ; f . removeAttribute ( "transform" ) ; z . addSubCommand ( new Ma ( f , O ) ) } if ( k && ! z . isEmpty ( ) ) return z } ; this . ungroupSelectedElement = function ( ) { var f = I [ 0 ] ; if ( $ ( f ) . data ( "gsvg" ) || $ ( f ) . data ( "symbol" ) ) Lb ( f ) ; else if ( f . tagName === "use" ) { var k = oa ( da ( f ) . substr ( 1 ) ) ; $ ( f ) . data ( "symbol" , k ) . data ( "ref" , k ) ; Lb ( f ) } else { k = $ ( f ) . parents ( "a" ) ; if ( k . length ) f = k [ 0 ] ; if ( f . tagName === "g" || f . tagName === "a" ) { k = new Da ( "Ungroup Elements" ) ;
var m = Db ( f , true ) ; m && k . addSubCommand ( m ) ; m = f . parentNode ; for ( var C = f . nextSibling , A = Array ( f . childNodes . length ) , G = 0 ; f . firstChild ; ) { var D = f . firstChild , z = D . nextSibling , F = D . parentNode ; if ( D . tagName === "title" ) { k . addSubCommand ( new Fa ( D , D . nextSibling , F ) ) ; F . removeChild ( D ) } else { A [ G ++ ] = D = m . insertBefore ( D , C ) ; k . addSubCommand ( new Ja ( D , z , F ) ) } } xa ( ) ; C = f . nextSibling ; f = m . removeChild ( f ) ; k . addSubCommand ( new Fa ( f , C , m ) ) ; k . isEmpty ( ) || wa ( k ) ; qb ( A ) } } } ; this . moveToTopSelectedElement = function ( ) { var f = I . filter ( Boolean ) . reverse ( ) , k =
new Da ( "Move to top" ) ; f . forEach ( function ( m ) { m = m ; var C = m . parentNode , A = m . nextSibling ; m = m . parentNode . appendChild ( m ) ; if ( A != m . nextSibling ) { k . addSubCommand ( new Ja ( m , A , C , "top" ) ) ; M ( "changed" , [ m ] ) } k . isEmpty ( ) || wa ( k ) } ) } ; this . moveToBottomSelectedElement = function ( ) { var f = I . filter ( Boolean ) . reverse ( ) , k = new Da ( "Move to top" ) ; f . forEach ( function ( m ) { m = m ; var C = m . parentNode , A = m . nextSibling , G = m . parentNode . firstChild ; if ( G . tagName == "title" ) G = G . nextSibling ; if ( G . tagName == "defs" ) G = G . nextSibling ; m = m . parentNode . insertBefore ( m ,
G ) ; if ( A != m . nextSibling ) { k . addSubCommand ( new Ja ( m , A , C , "bottom" ) ) ; M ( "changed" , [ m ] ) } } ) ; k . isEmpty ( ) || wa ( k ) } ; this . moveUpDownSelected = function ( f ) { var k = I . filter ( Boolean ) ; f == "Down" && k . reverse ( ) ; var m = new Da ( "Move " + f ) ; k . forEach ( function ( C ) { hb = [ ] ; var A , G , D = $ ( ob ( getStrokedBBox ( [ C ] ) ) ) . toArray ( ) ; f == "Down" && D . reverse ( ) ; $ . each ( D , function ( ) { if ( G ) { A = this ; return false } else if ( this == C ) G = true } ) ; if ( A ) { D = C . parentNode ; var z = C . nextSibling ; $ ( A ) [ f == "Down" ? "before" : "after" ] ( C ) ; if ( z != C . nextSibling ) { m . addSubCommand ( new Ja ( C ,
z , D , "Move " + f ) ) ; M ( "changed" , [ C ] ) } } } ) ; m . isEmpty ( ) || wa ( m ) } ; this . moveSelectedElements = function ( f , k , m ) { if ( f . constructor != Array ) { f /= v ; k /= v } m = m || true ; for ( var C = new Da ( "position" ) , A = I . length ; A -- ; ) { var G = I [ A ] ; if ( G != null ) { var D = d . createSVGTransform ( ) , z = R ( G ) ; f . constructor == Array ? D . setTranslate ( f [ A ] , k [ A ] ) : D . setTranslate ( f , k ) ; z . numberOfItems ? z . insertItemBefore ( D , 0 ) : z . appendItem ( D ) ; ( D = Ra ( G ) ) && C . addSubCommand ( D ) ; ra . requestSelector ( G ) . resize ( ) } } if ( ! C . isEmpty ( ) ) { m && wa ( C ) ; M ( "changed" , I ) ; return C } } ; this . cloneSelectedElements =
function ( f , k , m ) { for ( var C = new Da ( "Clone Elements" ) , A = I . length , G = 0 ; G < A ; ++ G ) { var D = I [ G ] ; if ( D == null ) break } A = I . slice ( 0 , G ) ; this . clearSelection ( true ) ; G = A . length ; for ( clones = [ ] ; G -- ; ) { D = A [ G ] ; var z = ia ( A [ G ] ) , F = N || B ( ) . getCurrentLayer ( ) ; if ( m ) { tlist = R ( z ) ; tlist . removeItem ( m ) ; Ra ( z ) ; F . insertBefore ( z , D ) } else F . appendChild ( z ) ; clones . push ( z ) ; C . addSubCommand ( new Ia ( z ) ) } if ( ! C . isEmpty ( ) ) { qb ( A . reverse ( ) ) ; m || this . moveSelectedElements ( f , k , false ) ; wa ( C ) } return clones } ; this . alignSelectedElements = function ( f , k ) { var m = [ ] , C = Number . MAX _VALUE ,
A = Number . MIN _VALUE , G = Number . MAX _VALUE , D = Number . MIN _VALUE , z = Number . MIN _VALUE , F = Number . MIN _VALUE , h = I . length ; if ( h ) { for ( var n = 0 ; n < h ; ++ n ) { if ( I [ n ] == null ) break ; m [ n ] = getStrokedBBox ( [ I [ n ] ] ) ; switch ( k ) { case "smallest" : if ( ( f == "l" || f == "c" || f == "r" ) && ( z == Number . MIN _VALUE || z > m [ n ] . width ) || ( f == "t" || f == "m" || f == "b" ) && ( F == Number . MIN _VALUE || F > m [ n ] . height ) ) { C = m [ n ] . x ; G = m [ n ] . y ; A = m [ n ] . x + m [ n ] . width ; D = m [ n ] . y + m [ n ] . height ; z = m [ n ] . width ; F = m [ n ] . height } break ; case "largest" : if ( ( f == "l" || f == "c" || f == "r" ) && ( z == Number . MIN _VALUE || z < m [ n ] . width ) ||
( f == "t" || f == "m" || f == "b" ) && ( F == Number . MIN _VALUE || F < m [ n ] . height ) ) { C = m [ n ] . x ; G = m [ n ] . y ; A = m [ n ] . x + m [ n ] . width ; D = m [ n ] . y + m [ n ] . height ; z = m [ n ] . width ; F = m [ n ] . height } break ; default : if ( m [ n ] . x < C ) C = m [ n ] . x ; if ( m [ n ] . y < G ) G = m [ n ] . y ; if ( m [ n ] . x + m [ n ] . width > A ) A = m [ n ] . x + m [ n ] . width ; if ( m [ n ] . y + m [ n ] . height > D ) D = m [ n ] . y + m [ n ] . height } } if ( k == "page" ) { G = C = 0 ; A = c . contentW ; D = c . contentH } z = Array ( h ) ; F = Array ( h ) ; for ( n = 0 ; n < h ; ++ n ) { if ( I [ n ] == null ) break ; var q = m [ n ] ; z [ n ] = 0 ; F [ n ] = 0 ; switch ( f ) { case "l" : z [ n ] = C - q . x ; break ; case "c" : z [ n ] = ( C + A ) / 2 - ( q . x + q . width / 2 ) ; break ;
case "r" : z [ n ] = A - ( q . x + q . width ) ; break ; case "t" : F [ n ] = G - q . y ; break ; case "m" : F [ n ] = ( G + D ) / 2 - ( q . y + q . height / 2 ) ; break ; case "b" : F [ n ] = D - ( q . y + q . height ) } } this . moveSelectedElements ( z , F ) } } ; this . contentW = zb ( ) . w ; this . contentH = zb ( ) . h ; this . updateCanvas = function ( f , k ) { d . setAttribute ( "width" , f ) ; d . setAttribute ( "height" , k ) ; var m = $ ( "#canvasBackground" ) [ 0 ] , C = p . getAttribute ( "x" ) , A = p . getAttribute ( "y" ) , G = f / 2 - this . contentW * v / 2 , D = k / 2 - this . contentH * v / 2 ; ma ( p , { width : this . contentW * v , height : this . contentH * v , x : G , y : D , viewBox : "0 0 " + this . contentW +
" " + this . contentH } ) ; ma ( m , { width : p . getAttribute ( "width" ) , height : p . getAttribute ( "height" ) , x : G , y : D } ) ; ( m = oa ( "background_image" ) ) && ma ( m , { width : "100%" , height : "100%" } ) ; ra . selectorParentGroup . setAttribute ( "transform" , "translate(" + G + "," + D + ")" ) ; return { x : G , y : D , old _x : C , old _y : A , d _x : G - C , d _y : D - A } } ; this . setBackground = function ( f , k ) { var m = oa ( "canvasBackground" ) , C = $ ( m ) . find ( "rect" ) [ 0 ] , A = oa ( "background_image" ) ; C . setAttribute ( "fill" , f ) ; if ( k ) { if ( ! A ) { A = g . createElementNS ( b , "image" ) ; ma ( A , { id : "background_image" , width : "100%" ,
height : "100%" , preserveAspectRatio : "xMinYMin" , style : "pointer-events:none" } ) } U ( A , k ) ; m . appendChild ( A ) } else A && A . parentNode . removeChild ( A ) } ; this . cycleElement = function ( f ) { var k = I [ 0 ] , m = false , C = pb ( N || B ( ) . getCurrentLayer ( ) ) ; if ( C . length ) { if ( k == null ) { f = f ? C . length - 1 : 0 ; m = C [ f ] } else for ( var A = C . length ; A -- ; ) if ( C [ A ] == k ) { f = f ? A - 1 : A + 1 ; if ( f >= C . length ) f = 0 ; else if ( f < 0 ) f = C . length - 1 ; m = C [ f ] ; break } rb ( [ m ] , true ) ; M ( "selected" , I ) } } ; this . clear ( ) ; this . getPrivateMethods = function ( ) { return { addCommandToHistory : wa , setGradient : Nb , addSvgElementFromJson : S ,
assignAttributes : ma , BatchCommand : Da , call : M , ChangeElementCommand : Ma , copyElem : ia , ffClone : ea , findDefs : gb , findDuplicateGradient : Mb , getElem : oa , getId : ba , getIntersectionList : ob , getMouseTarget : Bb , getNextId : ka , getPathBBox : X , getUrlFromAttr : ja , hasMatrixTransform : qa , identifyLayers : xb , InsertElementCommand : Ia , isIdentity : svgedit . math . isIdentity , logMatrix : Wa , matrixMultiply : Z , MoveElementCommand : Ja , preventClickDefault : Fb , recalculateAllSelectedDimensions : Ea , recalculateDimensions : Ra , remapElement : Za , RemoveElementCommand : Fa ,
removeUnusedDefElems : yb , round : ab , runExtensions : ib , sanitizeSvg : za , SVGEditTransformList : svgedit . transformlist . SVGTransformList , toString : toString , transformBox : svgedit . math . transformBox , transformListToTransform : aa , transformPoint : L , walkTree : svgedit . utilities . walkTree } } } ; ( function ( ) { document . addEventListener ( "touchstart" , touchHandler , true ) ; document . addEventListener ( "touchmove" , touchHandler , true ) ; document . addEventListener ( "touchend" , touchHandler , true ) ; document . addEventListener ( "touchcancel" , touchHandler , true ) ; if ( ! window . methodDraw ) window . methodDraw = function ( a ) { function o ( d , p ) { var w = e . setSvgString ( d ) !== false ; p = p || a . noop ; w ? p ( true ) : a . alert ( uiStrings . notification . errorLoadingSVG , function ( ) { p ( false ) } ) } var e , b = { } , l = false ; curConfig = { canvas _expansion : 1 , dimensions : [ 580 , 400 ] ,
initFill : { color : "fff" , opacity : 1 } , initStroke : { width : 1.5 , color : "000" , opacity : 1 } , initOpacity : 1 , imgPath : "images/" , extPath : "extensions/" , jGraduatePath : "jgraduate/images/" , extensions : [ ] , initTool : "select" , wireframe : false , colorPickerCSS : false , gridSnapping : false , gridColor : "#000" , baseUnit : "px" , snappingStep : 10 , showRulers : svgedit . browser . isTouch ( ) ? false : true , show _outside _canvas : false , no _save _warning : true , initFont : "Helvetica, Arial, sans-serif" } ; uiStrings = b . uiStrings = { common : { ok : "OK" , cancel : "Cancel" , key _up : "Up" ,
key _down : "Down" , key _backspace : "Backspace" , key _del : "Del" } , layers : { layer : "Layer" } , notification : { invalidAttrValGiven : "Invalid value given" , noContentToFitTo : "No content to fit to" , dupeLayerName : "There is already a layer named that!" , enterUniqueLayerName : "Please enter a unique layer name" , enterNewLayerName : "Please enter the new layer name" , layerHasThatName : "Layer already has that name" , QmoveElemsToLayer : 'Move selected elements to layer "%s"?' , QwantToClear : "<strong>Do you want to clear the drawing?</strong>\nThis will also erase your undo history" ,
QwantToOpen : "Do you want to open a new file?\nThis will also erase your undo history" , QerrorsRevertToSource : "There were parsing errors in your SVG source.\nRevert back to original SVG source?" , QignoreSourceChanges : "Ignore changes made to SVG source?" , featNotSupported : "Feature not supported" , enterNewImgURL : "Enter the new image URL" , defsFailOnSave : "NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved." , loadingImage : "Loading image, please wait..." ,
saveFromBrowser : 'Select "Save As..." in your browser to save this image as a %s file.' , noteTheseIssues : "Also note the following issues: " , unsavedChanges : "There are unsaved changes." , enterNewLinkURL : "Enter the new hyperlink URL" , errorLoadingSVG : "Error: Unable to load SVG data" , URLloadFail : "Unable to load from URL" , retrieving : 'Retrieving "%s" ...' } } ; var s = { } , c = { } ; b . curConfig = curConfig ; b . tool _scale = 1 ; b . setConfig = function ( d ) { a . extend ( true , curConfig , d ) ; if ( d . extensions ) curConfig . extensions = d . extensions } ;
b . setCustomHandlers = function ( d ) { b . ready ( function ( ) { if ( d . open ) { a ( '#tool_open > input[type="file"]' ) . remove ( ) ; a ( "#tool_open" ) . show ( ) ; e . open = d . open } if ( d . save ) { b . show _save _warning = false ; e . bind ( "saved" , d . save ) } d . pngsave && e . bind ( "exported" , d . pngsave ) ; c = d } ) } ; b . randomizeIds = function ( ) { e . randomizeIds ( arguments ) } ; b . init = function ( ) { ( function ( ) { var h = window . opener ; if ( h ) try { var n = h . document . createEvent ( "Event" ) ; n . initEvent ( "methodDrawReady" , true , true ) ; h . document . documentElement . dispatchEvent ( n ) } catch ( q ) { } } ) ( ) ;
( function ( ) { a ( "body" ) . toggleClass ( "touch" , svgedit . browser . isTouch ( ) ) ; var h = a . deparam . querystring ( true ) ; if ( ! a . isEmptyObject ( h ) ) { if ( h . dimensions ) h . dimensions = h . dimensions . split ( "," ) ; if ( h . extensions ) h . extensions = h . extensions . split ( "," ) ; if ( h . bkgd _color ) h . bkgd _color = "#" + h . bkgd _color ; methodDraw . setConfig ( h ) ; var n = h . source , q = a . param . querystring ( ) ; if ( ! n ) if ( q . indexOf ( "source=data:" ) >= 0 ) n = q . match ( /source=(data:[^&]*)/ ) [ 1 ] ; if ( n ) if ( n . indexOf ( "data:" ) === 0 ) { n = n . replace ( / /g , "+" ) ; b . loadFromDataURI ( n ) } else b . loadFromString ( n ) ;
else if ( q . indexOf ( "paramurl=" ) !== - 1 ) methodDraw . loadFromURL ( q . substr ( 9 ) ) ; else h . url && methodDraw . loadFromURL ( h . url ) } } ) ( ) ; a ( "#canvas_width" ) . val ( curConfig . dimensions [ 0 ] ) ; a ( "#canvas_height" ) . val ( curConfig . dimensions [ 1 ] ) ; var d = function ( ) { a . each ( curConfig . extensions , function ( ) { var h = this ; a . getScript ( curConfig . extPath + h , function ( n ) { if ( ! n ) { n = document . createElement ( "script" ) ; n . src = curConfig . extPath + h ; document . querySelector ( "head" ) . appendChild ( n ) } } ) } ) } ; document . location . protocol === "file:" ? setTimeout ( d , 100 ) :
d ( ) ; a . svgIcons ( curConfig . imgPath + "svg_edit_icons.svg" , { w : 27 , h : 27 , id _match : false , no _img : true , fallback _path : curConfig . imgPath , fallback : { logo : "logo.png" , select : "select.png" , select _node : "select_node.png" , pencil : "pencil.png" , pen : "line.png" , rect : "square.png" , ellipse : "ellipse.png" , path : "path.png" , text : "text.png" , image : "image.png" , zoom : "zoom.png" , "delete" : "delete.png" , spapelib : "shapelib.png" , node _delete : "node_delete.png" , align _left : "align-left.png" , align _center : "align-center.png" , align _right : "align-right.png" ,
align _top : "align-top.png" , align _middle : "align-middle.png" , align _bottom : "align-bottom.png" , arrow _right : "flyouth.png" , arrow _down : "dropdown.gif" } , placement : { "#logo" : "logo" , "#tool_select" : "select" , "#tool_fhpath" : "pencil" , "#tool_line" : "pen" , "#tool_rect,#tools_rect_show" : "rect" , "#tool_ellipse,#tools_ellipse_show" : "ellipse" , "#tool_path" : "path" , "#tool_text,#layer_rename" : "text" , "#tool_image" : "image" , "#tool_zoom" : "zoom" , "#tool_node_clone" : "node_clone" , "#tool_node_delete" : "node_delete" , "#tool_add_subpath" : "add_subpath" ,
"#tool_openclose_path" : "open_path" , "#tool_alignleft, #tool_posleft" : "align_left" , "#tool_aligncenter, #tool_poscenter" : "align_center" , "#tool_alignright, #tool_posright" : "align_right" , "#tool_aligntop, #tool_postop" : "align_top" , "#tool_alignmiddle, #tool_posmiddle" : "align_middle" , "#tool_alignbottom, #tool_posbottom" : "align_bottom" , "#cur_position" : "align" , "#zoomLabel" : "zoom" } , resize : { "#logo .svg_icon" : 15 , ".flyout_arrow_horiz .svg_icon" : 5 , "#fill_bg .svg_icon, #stroke_bg .svg_icon" : svgedit . browser . isTouch ( ) ?
24 : 24 , ".palette_item:first .svg_icon" : svgedit . browser . isTouch ( ) ? 30 : 16 , "#zoomLabel .svg_icon" : 16 , "#zoom_dropdown .svg_icon" : 7 } , callback : function ( ) { a ( ".toolbar_button button > svg, .toolbar_button button > img" ) . each ( function ( ) { a ( this ) . parent ( ) . prepend ( this ) } ) ; a ( ".tool_button, .tool_button_current" ) . addClass ( "loaded" ) ; var h = a ( "#tools_left" ) ; if ( h . length != 0 ) { h . offset ( ) ; h . outerHeight ( ) } a ( ".tools_flyout" ) . each ( function ( ) { var n = a ( "#" + this . id + "_show" ) , q = n . attr ( "data-curopt" ) ; if ( ! n . children ( "svg, img" ) . length ) { q =
a ( q ) . children ( ) . clone ( ) ; if ( q . length ) { q [ 0 ] . removeAttribute ( "style" ) ; n . append ( q ) } } } ) ; methodDraw . runCallbacks ( ) ; setTimeout ( function ( ) { a ( ".flyout_arrow_horiz:empty" ) . each ( function ( ) { a ( this ) . append ( a . getSvgIcon ( "arrow_right" ) . width ( 5 ) . height ( 5 ) ) } ) } , 1 ) } } ) ; a ( "#rulers" ) . on ( "dblclick" , function ( h ) { a ( "#base_unit_container" ) . css ( { top : h . pageY - 10 , left : h . pageX - 50 , display : "block" } ) } ) ; a ( "#base_unit_container" ) . on ( "mouseleave mouseenter" , function ( ) { t = setTimeout ( function ( ) { a ( "#base_unit_container" ) . fadeOut ( 500 ) } , 200 ) ;
event . type == "mouseover" && clearTimeout ( t ) } ) ; a ( "#base_unit" ) . on ( "change" , function ( ) { savePreferences ( ) } ) ; b . canvas = e = new a . SvgCanvas ( document . getElementById ( "svgcanvas" ) , curConfig ) ; b . show _save _warning = false ; b . paintBox = { fill : null , stroke : null , canvas : null } ; d = navigator . platform . indexOf ( "Mac" ) >= 0 ; var p = navigator . userAgent . indexOf ( "AppleWebKit" ) >= 0 , w = d ? "meta+" : "ctrl+" , B = e . pathActions , v = e . undoMgr , N = svgedit . utilities , Q = curConfig . imgPath + "placeholder.svg" , K = a ( "#workarea" ) , I = a ( "#cmenu_canvas" ) , S = null , R = 1 , L = "toolbars" ,
Z = "" ; d || a ( ".shortcut" ) . each ( function ( ) { var h = a ( this ) . text ( ) ; a ( this ) . text ( h . split ( "\u2318" ) . join ( "Ctrl+" ) ) } ) ; ( function ( ) { a ( "#dialog_container" ) . draggable ( { cancel : "#dialog_content, #dialog_buttons *" , containment : "window" } ) ; var h = a ( "#dialog_box" ) , n = a ( "#dialog_buttons" ) , q = function ( u , E , H , J ) { a ( "#dialog_content" ) . html ( "<p>" + E . replace ( /\n/g , "</p><p>" ) + "</p>" ) . toggleClass ( "prompt" , u == "prompt" ) ; n . empty ( ) ; var O = a ( '<input type="button" value="' + uiStrings . common . ok + '">' ) . appendTo ( n ) ; u != "alert" && a ( '<input type="button" value="' +
uiStrings . common . cancel + '">' ) . appendTo ( n ) . on ( "click touchstart" , function ( ) { h . hide ( ) ; H ( false ) } ) ; if ( u == "prompt" ) { var W = a ( '<input type="text">' ) . prependTo ( n ) ; W . val ( J || "" ) ; W . bind ( "keydown" , "return" , function ( ) { O . trigger ( "click touchstart" ) } ) } u == "process" && O . hide ( ) ; h . show ( ) ; O . on ( "click touchstart" , function ( ) { h . hide ( ) ; var ca = u == "prompt" ? W . val ( ) : true ; H && H ( ca ) } ) . focus ( ) ; u == "prompt" && W . focus ( ) } ; a . alert = function ( u , E ) { q ( "alert" , u , E ) } ; a . confirm = function ( u , E ) { q ( "confirm" , u , E ) } ; a . process _cancel = function ( u , E ) { q ( "process" ,
u , E ) } ; a . prompt = function ( u , E , H ) { q ( "prompt" , u , H , E ) } } ) ( ) ; var qa = function ( ) { var h = a ( ".tool_button_current" ) ; if ( h . length && h [ 0 ] . id !== "tool_select" ) { h . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( "#tool_select" ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) } e . setMode ( "select" ) } , aa = null , Y = false , ga = false , Ba = "" , ja = function ( h , n ) { var q = e . getResolution ( ) , u = K ; a ( "#svgcanvas" ) . position ( ) ; if ( u = e . setBBoxZoom ( n , u . width ( ) - 15 , u . height ( ) - 15 ) ) { var E = u . zoom ; u = u . bbox ; if ( E < 0.001 ) wa ( { value : 0.1 } ) ;
else { typeof animatedZoom != "undefined" && h . cancelAnimationFrame ( animatedZoom ) ; var H = Date . now ( ) , J = E - q . zoom ; a ( "#zoom" ) ; var O = q . zoom , W = function ( ) { var ca = ( Date . now ( ) - H ) / 500 ; ca = Math . pow ( ca - 1 , 3 ) + 1 ; e . setZoom ( O + J * ca ) ; G ( ) ; if ( ca < 1 && ca > - 0.9 ) h . animatedZoom = requestAnimationFrame ( W ) ; else { a ( "#zoom" ) . val ( parseInt ( E * 100 ) ) ; a ( "option" , "#zoom_select" ) . removeAttr ( "selected" ) ; a ( "option[value=" + parseInt ( E * 100 ) + "]" , "#zoom_select" ) . attr ( "selected" , "selected" ) } } ; W ( ) ; e . getMode ( ) == "zoom" && u . width && qa ( ) ; xb ( ) } } } ; a ( "#cur_context_panel" ) . delegate ( "a" ,
"click" , function ( ) { var h = a ( this ) ; h . attr ( "data-root" ) ? e . leaveContext ( ) : e . setContext ( h . text ( ) ) ; e . clearSelection ( ) ; return false } ) ; var da = function ( ) { b . paintBox . fill . prep ( ) ; b . paintBox . stroke . prep ( ) } , U = { } , X = function ( h ) { a . each ( h , function ( n , q ) { var u = a ( n ) . children ( ) , E = n + "_show" , H = a ( E ) , J = false ; u . addClass ( "tool_button" ) . unbind ( "click mousedown mouseup" ) . each ( function ( ca ) { var T = q [ ca ] ; U [ T . sel ] = T . fn ; if ( T . isDefault ) J = ca ; ca = function ( fa ) { var ha = T ; if ( fa . type === "keydown" ) { var V = a ( ha . parent + "_show" ) . hasClass ( "tool_button_current" ) ,
pa = a ( ha . parent + "_show" ) . attr ( "data-curopt" ) ; a . each ( h [ T . parent ] , function ( Aa , Ca ) { if ( Ca . sel == pa ) ha = ! fa . shiftKey || ! V ? Ca : h [ T . parent ] [ Aa + 1 ] || h [ T . parent ] [ 0 ] } ) } if ( a ( this ) . hasClass ( "disabled" ) ) return false ; ra ( E ) && ha . fn ( ) ; var ua = ha . icon ? a . getSvgIcon ( ha . icon , true ) : a ( ha . sel ) . children ( ) . eq ( 0 ) . clone ( ) ; ua [ 0 ] . setAttribute ( "width" , H . width ( ) ) ; ua [ 0 ] . setAttribute ( "height" , H . height ( ) ) ; H . children ( ":not(.flyout_arrow_horiz)" ) . remove ( ) ; H . append ( ua ) . attr ( "data-curopt" , ha . sel ) } ; a ( this ) . mouseup ( ca ) ; T . key && a ( document ) . bind ( "keydown" ,
T . key [ 0 ] + " shift+" + T . key [ 0 ] , ca ) } ) ; if ( J ) H . attr ( "data-curopt" , q [ J ] . sel ) ; else H . attr ( "data-curopt" ) || H . attr ( "data-curopt" , q [ 0 ] . sel ) ; var O , W = a ( E ) . position ( ) ; a ( n ) . css ( { left : W . left + 34 , top : W . top + 77 } ) ; H . mousedown ( function ( ca ) { a ( "#workarea" ) . one ( "mousedown" , function ( ) { a ( "#tools_shapelib" ) . hide ( ) } ) ; a ( "#tools_shapelib" ) . is ( ":visible" ) && ra ( E , false ) ; if ( H . hasClass ( "disabled" ) ) return false ; var T = a ( n ) , fa = W . left + 34 , ha = T . width ( ) * - 1 , V = T . data ( "shown_popop" ) ? 200 : 0 ; O = setTimeout ( function ( ) { H . data ( "isLibrary" ) ? T . css ( "left" ,
fa ) . show ( ) : T . css ( "left" , ha ) . show ( ) . animate ( { left : fa } , 50 ) ; T . data ( "shown_popop" , true ) } , V ) ; ca . preventDefault ( ) } ) . mouseup ( function ( ) { clearTimeout ( O ) ; var ca = a ( this ) . attr ( "data-curopt" ) ; if ( H . data ( "isLibrary" ) && a ( E . replace ( "_show" , "" ) ) . is ( ":visible" ) ) ra ( E , true ) ; else ra ( E ) && ca in U && U [ ca ] ( ) } ) } ) ; ma ( ) } , na = function ( h , n ) { return a ( "<div>" , { "class" : "tools_flyout" , id : h } ) . appendTo ( "#svg_editor" ) . append ( n ) } , oa = function ( ) { a ( ".tools_flyout" ) . each ( function ( ) { var h = a ( "#" + this . id + "_show" ) , n = h . offset ( ) ; h = h . outerWidth ( ) ;
a ( this ) . css ( { left : ( n . left + h ) * R , top : n . top } ) } ) } , ma = function ( ) { a ( ".tools_flyout" ) . each ( function ( ) { var h = a ( "#" + this . id + "_show" ) ; if ( ! h . data ( "isLibrary" ) ) { var n = [ ] ; a ( this ) . children ( ) . each ( function ( ) { n . push ( this . title ) } ) ; h [ 0 ] . title = n . join ( " / " ) } } ) } , la , ya = function ( h , n , q ) { var u = null ; if ( h . indexOf ( "url(#" ) === 0 ) { h = ( h = e . getRefElem ( h ) ) ? h . cloneNode ( true ) : a ( "#" + q + "_color defs *" ) [ 0 ] ; u = { alpha : n } ; u [ h . tagName ] = h } else u = h . indexOf ( "#" ) === 0 ? { alpha : n , solidColor : h . substr ( 1 ) } : { alpha : n , solidColor : "none" } ; return new a . jGraduate . Paint ( u ) } ,
za = e . getResolution ( ) ; if ( curConfig . baseUnit !== "px" ) { za . w = svgedit . units . convertUnit ( za . w ) + curConfig . baseUnit ; za . h = svgedit . units . convertUnit ( za . h ) + curConfig . baseUnit } var Ja = function ( h ) { e . createLayer ( "background" ) ; cur _shape = e . addSvgElementFromJson ( { element : "rect" , attr : { x : - 1 , y : - 1 , width : za . w + 2 , height : za . h + 2 , stroke : "none" , id : "canvas_background" , opacity : 1 , fill : h || "#fff" , style : "pointer-events:none" } } ) ; e . setCurrentLayer ( "Layer 1" ) ; e . setCurrentLayerPosition ( "1" ) } ; document . getElementById ( "canvas_background" ) ||
Ja ( ) ; document . getElementById ( "canvas_background" ) . getAttribute ( "fill" ) ; var Ia = b . setImageURL = function ( h ) { h || ( h = Q ) ; e . setImageURL ( h ) ; a ( "#image_url" ) . val ( h ) } , Fa = function ( ) { var h = aa ; if ( h != null && ! h . parentNode ) h = null ; if ( Y && Y [ 0 ] != null && ! Y [ 0 ] . parentNode ) Y = false ; var n = e . getCurrentDrawing ( ) . getCurrentLayerName ( ) , q = e . getMode ( ) , u = curConfig . baseUnit !== "px" ? curConfig . baseUnit : null , E = q == "pathedit" ; if ( E ) { a ( ".context_panel" ) . hide ( ) ; a ( "#path_node_panel" ) . show ( ) ; a ( "#stroke_panel" ) . hide ( ) ; n = B . getNodePoint ( ) ; a ( "#tool_add_subpath" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ;
a ( "#tool_node_delete" ) . toggleClass ( "disabled" , ! B . canDeleteNodes ) ; zb ( "#tool_openclose_path" , B . closed _subpath ? "open_path" : "close_path" ) ; if ( n ) { E = a ( "#seg_type" ) ; if ( u ) { n . x = svgedit . units . convertUnit ( n . x ) ; n . y = svgedit . units . convertUnit ( n . y ) } a ( "#path_node_x" ) . val ( Math . round ( n . x ) ) ; a ( "#path_node_y" ) . val ( Math . round ( n . y ) ) ; if ( n . type ) { E . val ( n . type ) . removeAttr ( "disabled" ) ; a ( "#seg_type_label" ) . html ( n . type == 4 ? "Straight" : "Curve" ) } else E . val ( 4 ) . attr ( "disabled" , "disabled" ) } a ( "#tools_top" ) . removeClass ( "multiselected" ) ;
a ( "#stroke_panel" ) . hide ( ) ; a ( "#canvas_panel" ) . hide ( ) } else { var H = a ( "#cmenu_canvas li" ) ; a ( ".context_panel" ) . hide ( ) ; a ( ".menu_item" , "#edit_menu" ) . addClass ( "disabled" ) ; a ( ".menu_item" , "#object_menu" ) . addClass ( "disabled" ) ; if ( Y ) { Y = Y . filter ( Boolean ) ; ( h = e . elementsAreSame ( Y ) ? Y [ 0 ] : null ) && a ( "#tools_top" ) . addClass ( "multiselected" ) } if ( ! h && ! Y ) { a ( "#tools_top" ) . removeClass ( "multiselected" ) ; a ( "#stroke_panel" ) . hide ( ) ; a ( "#canvas_panel" ) . show ( ) } if ( h != null ) { a ( "#stroke_panel" ) . show ( ) ; var J = h . nodeName , O = e . getRotationAngle ( h ) ;
a ( "#angle" ) . val ( Math . round ( O ) ) ; O = e . getBlur ( h ) ; a ( "#blur" ) . val ( O ) ; if ( ! E && q != "pathedit" ) { a ( "#selected_panel" ) . show ( ) ; a ( ".action_selected" ) . removeClass ( "disabled" ) ; var W , ca ; if ( [ "g" , "polyline" , "path" ] . indexOf ( J ) >= 0 ) if ( q = e . getStrokedBBox ( [ h ] ) ) { W = q . x ; ca = q . y } if ( u ) { W = svgedit . units . convertUnit ( W ) ; ca = svgedit . units . convertUnit ( ca ) } a ( "#" + J + "_x" ) . val ( Math . round ( W ) ) ; a ( "#" + J + "_y" ) . val ( Math . round ( ca ) ) ; if ( J === "polyline" ) { a ( "#path_x" ) . val ( Math . round ( W ) ) ; a ( "#path_y" ) . val ( Math . round ( ca ) ) } [ "image" , "text" , "path" , "g" , "use" ] . indexOf ( J ) ==
- 1 && a ( ".action_path_convert_selected" ) . removeClass ( "disabled" ) ; J === "path" && a ( ".action_path_selected" ) . removeClass ( "disabled" ) } u = null ; if ( T === "a" ) { u = e . getHref ( h ) ; a ( "#g_panel" ) . show ( ) } if ( h . parentNode . tagName === "a" ) if ( ! a ( h ) . siblings ( ) . length ) { a ( "#a_panel" ) . show ( ) ; u = e . getHref ( h . parentNode ) } a ( "#tool_make_link, #tool_make_link" ) . toggle ( ! u ) ; u && a ( "#link_url" ) . val ( u ) ; u = { g : [ ] , a : [ ] , rect : [ "rx" , "width" , "height" , "x" , "y" ] , image : [ "width" , "height" , "x" , "y" ] , circle : [ "cx" , "cy" , "r" ] , ellipse : [ "cx" , "cy" , "rx" , "ry" ] , line : [ "x1" ,
"y1" , "x2" , "y2" ] , text : [ "x" , "y" ] , use : [ ] , path : [ ] } ; var T = h . tagName ; a ( h ) . data ( "gsvg" ) && a ( "#g_panel" ) . show ( ) ; if ( T == "path" || T == "polyline" ) a ( "#path_panel" ) . show ( ) ; if ( u [ T ] ) { u = u [ T ] ; a ( "#" + T + "_panel" ) . show ( ) ; T == "rect" ? a ( "#cornerRadiusLabel" ) . show ( ) : a ( "#cornerRadiusLabel" ) . hide ( ) ; a . each ( u , function ( fa , ha ) { var V = h . getAttribute ( ha ) ; if ( curConfig . baseUnit !== "px" && h [ ha ] ) V = svgedit . units . convertUnit ( h [ ha ] . baseVal . value ) ; var pa = document . getElementById ( T + "_" + ha ) ; pa . value = Math . round ( V ) || 0 ; pa . getAttribute ( "data-cursor" ) ===
"true" && a . fn . dragInput . updateCursor ( pa ) } ) ; if ( T == "text" ) { u = h . getAttribute ( "font-family" ) ; document . getElementById ( "font_family_dropdown" ) . selectedIndex = 3 ; a ( "#text_panel" ) . css ( "display" , "inline" ) ; a ( "#tool_italic" ) . toggleClass ( "active" , e . getItalic ( ) ) ; a ( "#tool_bold" ) . toggleClass ( "active" , e . getBold ( ) ) ; a ( "#font_family" ) . val ( u ) ; a ( "#font_size" ) . val ( h . getAttribute ( "font-size" ) ) ; a ( "#text" ) . val ( h . textContent ) ; a ( "#preview_font" ) . text ( u . split ( "," ) [ 0 ] . replace ( /'/g , "" ) ) . css ( "font-family" , u ) ; e . addedNew && setTimeout ( function ( ) { a ( "#text" ) . focus ( ) . select ( ) } ,
100 ) } else if ( T == "image" ) Ia ( e . getHref ( h ) ) ; else if ( T === "g" || T === "use" ) { a ( "#container_panel" ) . show ( ) ; a ( ".action_group_selected" ) . removeClass ( "disabled" ) ; e . getTitle ( ) } } H [ ( T === "g" ? "en" : "dis" ) + "ableContextMenuItems" ] ( "#ungroup" ) ; H [ ( T === "g" || ! Y ? "dis" : "en" ) + "ableContextMenuItems" ] ( "#group" ) } if ( Y ) { a ( "#multiselected_panel" ) . show ( ) ; a ( ".action_multi_selected" ) . removeClass ( "disabled" ) ; H . enableContextMenuItems ( "#group" ) . disableContextMenuItems ( "#ungroup" ) } h || H . disableContextMenuItems ( "#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back" ) ;
v . getUndoStackSize ( ) > 0 ? a ( "#tool_undo" ) . removeClass ( "disabled" ) : a ( "#tool_undo" ) . addClass ( "disabled" ) ; v . getRedoStackSize ( ) > 0 ? a ( "#tool_redo" ) . removeClass ( "disabled" ) : a ( "#tool_redo" ) . addClass ( "disabled" ) ; e . addedNew = false ; if ( h && ! E || Y ) { a ( "#selLayerNames" ) . removeAttr ( "disabled" ) . val ( n ) ; I . enableContextMenuItems ( "#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back" ) } } } ; a ( "#text" ) . on ( "focus" , function ( ) { } ) ; a ( "#text" ) . on ( "blur" , function ( ) { } ) ; e . bind ( "selected" , function ( h , n ) { var q = e . getMode ( ) ; q === "select" &&
qa ( ) ; if ( q === "pathedit" ) return Fa ( ) ; aa = n . length == 1 || n [ 1 ] == null ? n [ 0 ] : null ; n = n . filter ( Boolean ) ; Y = n . length >= 2 ? n : false ; if ( e . elementsAreSame ( Y ) ) aa = Y [ 0 ] ; if ( aa != null ) { a ( "#multiselected_panel" ) . hide ( ) ; if ( aa != null ) switch ( aa . tagName ) { case "use" : a ( ".context_panel" ) . hide ( ) ; a ( "#use_panel" ) . show ( ) ; break ; case "image" : a ( ".context_panel" ) . hide ( ) ; a ( "#image_panel" ) . show ( ) ; break ; case "foreignObject" : a ( ".context_panel" ) . hide ( ) ; break ; case "g" : case "a" : q = null ; for ( var u = aa . getElementsByTagName ( "*" ) , E = 0 , H = u . length ; E < H ; E ++ ) { var J =
u [ E ] . getAttribute ( "stroke-width" ) ; if ( E === 0 ) q = J ; else if ( q !== J ) q = null } a ( "#stroke_width" ) . val ( q === null ? "0" : q ) ; Fa ( ) ; break ; default : a ( "#stroke_width" ) . val ( aa . getAttribute ( "stroke-width" ) || 0 ) ; q = aa . getAttribute ( "stroke-dasharray" ) || "none" ; a ( "option" , "#stroke_style" ) . removeAttr ( "selected" ) ; a ( '#stroke_style option[value="' + q + '"]' ) . attr ( "selected" , "selected" ) ; a ( "#stroke_style" ) . trigger ( "change" ) ; a . fn . dragInput . updateCursor ( a ( "#stroke_width" ) [ 0 ] ) ; a . fn . dragInput . updateCursor ( a ( "#blur" ) [ 0 ] ) } if ( aa != null ) { q = ( aa . getAttribute ( "opacity" ) ||
1 ) * 100 ; a ( "#group_opacity" ) . val ( q ) ; a . fn . dragInput . updateCursor ( a ( "#group_opacity" ) [ 0 ] ) } Y . length && a ( "#tools_top" ) . addClass ( "multiselected" ) } else if ( Y . length ) { a ( ".context_panel" ) . hide ( ) ; a ( "#tools_top" ) . removeClass ( "multiselected" ) ; a ( "#multiselected_panel" ) . show ( ) } else { a ( ".context_panel" ) . hide ( ) ; a ( "#canvas_panel" ) . show ( ) ; a ( "#tools_top" ) . removeClass ( "multiselected" ) } e . runExtensions ( "selectedChanged" , { elems : n , selectedElement : aa , multiselected : Y } ) } ) ; e . bind ( "transition" , function ( h , n ) { var q = e . getMode ( ) , u = n [ 0 ] ;
if ( u ) { Y = n . length >= 2 && n [ 1 ] != null ? n : null ; if ( ! Y ) switch ( q ) { case "rotate" : q = e . getRotationAngle ( u ) ; a ( "#angle" ) . val ( Math . round ( q ) ) ; rotateCursor ( q ) ; a ( "#tool_reorient" ) . toggleClass ( "disabled" , q == 0 ) } e . runExtensions ( "elementTransition" , { elems : n } ) } } ) ; e . bind ( "changed" , function ( h , n ) { var q = e . getMode ( ) ; q === "select" && qa ( ) ; for ( var u = 0 ; u < n . length ; ++ u ) { var E = n [ u ] ; if ( E && E . tagName === "svg" ) G ( ) ; else if ( E && aa && aa . parentNode == null ) aa = E } b . show _save _warning = true ; Fa ( ) ; if ( aa && q === "select" ) { b . paintBox . fill . update ( ) ; b . paintBox . stroke . update ( ) } e . runExtensions ( "elementChanged" ,
{ elems : n } ) } ) ; e . bind ( "saved" , function ( h , n ) { b . show _save _warning = false ; n = '<?xml version="1.0"?>\n' + n ; var q = navigator . userAgent ; if ( ~ q . indexOf ( "MSIE" ) ) Eb ( 0 , true ) ; else { var u = h . open ( "data:image/svg+xml;base64," + N . encode64 ( n ) ) , E = a . pref ( "save_notice_done" ) ; if ( E !== "all" ) { var H = uiStrings . notification . saveFromBrowser . replace ( "%s" , "SVG" ) ; if ( q . indexOf ( "Gecko/" ) !== - 1 ) if ( n . indexOf ( "<defs" ) !== - 1 ) { H += "\n\n" + uiStrings . notification . defsFailOnSave ; a . pref ( "save_notice_done" , "all" ) ; E = "all" } else a . pref ( "save_notice_done" ,
"part" ) ; else a . pref ( "save_notice_done" , "all" ) ; E !== "part" && u . alert ( H ) } } } ) ; e . bind ( "exported" , function ( h , n ) { var q = n . issues ; a ( "#export_canvas" ) . length || a ( "<canvas>" , { id : "export_canvas" } ) . hide ( ) . appendTo ( "body" ) ; var u = a ( "#export_canvas" ) [ 0 ] ; u . width = e . contentW ; u . height = e . contentH ; canvg ( u , n . svg , { renderCallback : function ( ) { var E = u . toDataURL ( "image/png" ) ; S . location . href = E ; if ( a . pref ( "export_notice_done" ) !== "all" ) { E = uiStrings . notification . saveFromBrowser . replace ( "%s" , "PNG" ) ; if ( q . length ) E += "\n\n" + uiStrings . notification . noteTheseIssues +
"\n \u2022 " + q . join ( "\n \u2022 " ) ; a . pref ( "export_notice_done" , "all" ) ; S . alert ( E ) } } } ) } ) ; e . bind ( "zoomed" , ja ) ; e . bind ( "contextset" , function ( h , n ) { var q = "" ; if ( n ) { var u = "" ; q = '<a href="#" data-root="y">' + e . getCurrentDrawing ( ) . getCurrentLayerName ( ) + "</a>" ; a ( n ) . parentsUntil ( "#svgcontent > g" ) . andSelf ( ) . each ( function ( ) { if ( this . id ) { u += " > " + this . id ; q += this !== n ? ' > <a href="#">' + this . id + "</a>" : " > " + this . id } } ) ; Ba = u } else Ba = null ; a ( "#cur_context_panel" ) . toggle ( ! ! n ) . html ( q ) } ) ; e . bind ( "extension_added" , function ( h , n ) { function q ( ) { if ( la ) { clearTimeout ( la ) ;
la = null } E || ( la = setTimeout ( function ( ) { E = true ; Mb ( s . iconsize ) } , 50 ) ) } var u = false , E = false , H = true , J = function ( ) { if ( n . callback && ! u && H ) { u = true ; n . callback ( ) } } , O = [ ] ; n . context _tools && a . each ( n . context _tools , function ( ha , V ) { var pa = V . container _id ? ' id="' + V . container _id + '"' : "" , ua = a ( "#" + V . panel ) ; ua . length || ( ua = a ( "<div>" , { id : V . panel } ) . appendTo ( "#tools_top" ) . hide ( ) ) ; switch ( V . type ) { case "tool_button" : var Aa = '<div class="tool_button">' + V . id + "</div>" , Ca = a ( Aa ) . appendTo ( ua ) ; V . events && a . each ( V . events , function ( Na , jb ) { a ( Ca ) . bind ( Na ,
jb ) } ) ; break ; case "select" : Aa = "<label" + pa + '><select id="' + V . id + '">' ; a . each ( V . options , function ( Na , jb ) { Aa += '<option value="' + Na + '"' + ( Na == V . defval ? " selected" : "" ) + ">" + jb + "</option>" } ) ; Aa += "</select></label>" ; var Pa = a ( Aa ) . appendTo ( ua ) . find ( "select" ) ; a . each ( V . events , function ( Na , jb ) { a ( Pa ) . bind ( Na , jb ) } ) ; break ; case "button-select" : Aa = '<div id="' + V . id + '" class="dropdown toolset" title="' + V . title + '"><div id="cur_' + V . id + '" class="icon_label"></div><button></button></div>' ; pa = a ( '<ul id="' + V . id + '_opts"></ul>' ) . appendTo ( "#option_lists" ) ;
V . colnum && pa . addClass ( "optcols" + V . colnum ) ; a ( Aa ) . appendTo ( ua ) . children ( ) ; O . push ( { elem : "#" + V . id , list : "#" + V . id + "_opts" , title : V . title , callback : V . events . change , cur : "#cur_" + V . id } ) ; break ; case "input" : Aa = "<label" + pa + '><span id="' + V . id + '_label">' + V . label + ':</span><input id="' + V . id + '" title="' + V . title + '" size="' + ( V . size || "4" ) + '" value="' + ( V . defval || "" ) + '" type="text"/></label>' ; var Qa = a ( Aa ) . appendTo ( ua ) . find ( "input" ) ; V . spindata && Qa . SpinButton ( V . spindata ) ; V . events && a . each ( V . events , function ( Na , jb ) { Qa . bind ( Na ,
jb ) } ) } } ) ; if ( n . buttons ) { var W = { } , ca = { } , T = n . svgicons , fa = { } ; a . each ( n . buttons , function ( ha , V ) { for ( var pa , ua = V . id , Aa = ha ; a ( "#" + ua ) . length ; ) ua = V . id + "_" + ++ Aa ; if ( T ) { W [ ua ] = V . icon ; Aa = V . svgicon ? V . svgicon : V . id ; if ( V . type == "app_menu" ) ca [ "#" + ua + " > div" ] = Aa ; else ca [ "#" + ua ] = Aa } else pa = V . type == "menu" ? "" : a ( '<img src="' + V . icon + '">' ) ; var Ca , Pa ; switch ( V . type ) { case "mode_flyout" : case "mode" : Ca = "tool_button" ; if ( V . cls ) Ca += " " + V . cls ; Pa = "#tools_left" ; break ; case "context" : Ca = "tool_button" ; Pa = "#" + V . panel ; a ( Pa ) . length || a ( "<div>" ,
{ id : V . panel } ) . appendTo ( "#tools_top" ) ; break ; case "menu" : Ca = "menu_item tool_button" ; Pa = "#" + ( V . after || V . panel ) ; break ; case "app_menu" : Ca = "" ; Pa = V . parent || "#main_menu ul" ; a ( Pa ) . length || a ( "<div>" , { id : V . panel } ) . appendTo ( "#tools_top" ) } var Qa = a ( V . list || V . type == "app_menu" ? "<li/>" : "<div/>" ) . attr ( "id" , ua ) . attr ( "title" , V . title ) . addClass ( Ca ) ; if ( ! V . includeWith && ! V . list ) { if ( "position" in V ) a ( Pa ) . children ( ) . eq ( V . position ) . before ( Qa ) ; else V . type != "menu" || ! V . after ? Qa . appendTo ( Pa ) : a ( Pa ) . after ( Qa ) ; if ( V . type == "mode_flyout" ) { Aa =
a ( Qa ) ; Ca = Aa . parent ( ) ; if ( ! Aa . parent ( ) . hasClass ( "tools_flyout" ) ) { var Na = Aa [ 0 ] . id . replace ( "tool_" , "tools_" ) , jb = Aa . clone ( ) . attr ( "id" , Na + "_show" ) . append ( a ( "<div>" , { "class" : "flyout_arrow_horiz" } ) ) ; Aa . before ( jb ) ; Ca = na ( Na , Aa ) ; Ca . data ( "isLibrary" , true ) ; jb . data ( "isLibrary" , true ) } ca [ "#" + Na + "_show" ] = V . id ; ua = fa [ "#" + Ca [ 0 ] . id ] = [ { sel : "#" + ua , fn : V . events . click , icon : V . id , isDefault : true } , ub ] } else if ( V . type == "app_menu" || V . type == "menu" ) Qa . append ( V . title ) } else if ( V . list ) { Qa . addClass ( "push_button" ) ; a ( "#" + V . list + "_opts" ) . append ( Qa ) ;
if ( V . isDefault ) { a ( "#cur_" + V . list ) . append ( Qa . children ( ) . clone ( ) ) ; Aa = V . svgicon ? V . svgicon : V . id ; ca [ "#cur_" + V . list ] = Aa } } else if ( V . includeWith ) { Pa = V . includeWith ; Aa = a ( Pa . button ) ; Ca = Aa . parent ( ) ; if ( ! Aa . parent ( ) . hasClass ( "tools_flyout" ) ) { Na = Aa [ 0 ] . id . replace ( "tool_" , "tools_" ) ; jb = Aa . clone ( ) . attr ( "id" , Na + "_show" ) . append ( a ( "<div>" , { "class" : "flyout_arrow_horiz" } ) ) ; Aa . before ( jb ) ; Ca = na ( Na , Aa ) } var ub = C . getButtonData ( Pa . button ) ; if ( Pa . isDefault ) ca [ "#" + Na + "_show" ] = V . id ; ua = fa [ "#" + Ca [ 0 ] . id ] = [ { sel : "#" + ua , fn : V . events . click ,
icon : V . id , key : V . key , isDefault : V . includeWith ? V . includeWith . isDefault : 0 } , ub ] ; Na = "position" in Pa ? Pa . position : "last" ; ub = Ca . children ( ) . length ; if ( ! isNaN ( Na ) && Na >= 0 && Na < ub ) Ca . children ( ) . eq ( Na ) . before ( Qa ) ; else { Ca . append ( Qa ) ; ua . reverse ( ) } } T || Qa . append ( pa ) ; V . list || a . each ( V . events , function ( Cb , Jb ) { if ( Cb == "click" ) if ( V . type == "mode" ) { V . includeWith ? Qa . bind ( Cb , Jb ) : Qa . bind ( Cb , function ( ) { ra ( Qa ) && Jb ( ) } ) ; if ( V . key ) { a ( document ) . bind ( "keydown" , V . key , Jb ) ; V . title && Qa . attr ( "title" , V . title + " [" + V . key + "]" ) } } else Qa . bind ( Cb , Jb ) ;
else Qa . bind ( Cb , Jb ) } ) ; X ( fa ) } ) ; a . each ( O , function ( ) { vb ( this . elem , this . list , this . callback , { seticon : true } ) } ) ; if ( T ) H = false ; a . svgIcons ( T , { w : 27 , h : 27 , id _match : false , no _img : ! p , fallback : W , placement : ca , callback : function ( ) { s . iconsize && s . iconsize != "m" && q ( ) ; H = true ; J ( ) } } ) } J ( ) } ) ; e . textActions . setInputElem ( a ( "#text" ) [ 0 ] ) ; var Ma = '<div class="palette_item transparent" data-rgb="none"></div> <div class="palette_item black" data-rgb="#000000"></div> <div class="palette_item white" data-rgb="#ffffff"></div>' ;
[ "#444444" , "#482816" , "#422C10" , "#3B2F0E" , "#32320F" , "#293414" , "#1F361B" , "#153723" , "#0C372C" , "#083734" , "#0E353B" , "#1A333F" , "#273141" , "#332D40" , "#3E2A3C" , "#462735" , "#4B252D" , "#4D2425" , "#4C261D" , "#666666" , "#845335" , "#7B572D" , "#6F5C2A" , "#62612C" , "#546433" , "#46673D" , "#396849" , "#306856" , "#2D6862" , "#33666C" , "#426373" , "#535F75" , "#645A73" , "#74556D" , "#805064" , "#884D58" , "#8B4D4B" , "#894F3F" , "#999999" , "#C48157" , "#B8874D" , "#A98E49" , "#97944B" , "#849854" , "#729C62" , "#619E73" , "#559E84" , "#529D94" , "#5B9BA2" , "#6D97AB" ,
"#8391AE" , "#9A8AAB" , "#AF84A3" , "#BF7E96" , "#C97A86" , "#CE7975" , "#CC7C65" , "#BBBBBB" , "#FFB27C" , "#FABA6F" , "#E6C36A" , "#CFCA6D" , "#B8D078" , "#A0D58A" , "#8CD79F" , "#7DD8B5" , "#7AD6CA" , "#84D3DB" , "#9ACEE6" , "#B6C7EA" , "#D3BEE7" , "#EDB6DC" , "#FFAFCC" , "#FFAAB8" , "#FFA9A2" , "#FFAC8D" , "#DDDDDD" , "#FFE7A2" , "#FFF093" , "#FFFA8D" , "#FFFF91" , "#EEFF9F" , "#D1FFB4" , "#B9FFCE" , "#A8FFE9" , "#A4FFFF" , "#B1FFFF" , "#CBFFFF" , "#EDFFFF" , "#FFF5FF" , "#FFEBFF" , "#FFE2FF" , "#FFDCEC" , "#FFDBD2" , "#FFDFB8" ] . forEach ( function ( h ) { Ma += '<div class="palette_item" style="background-color: ' +
h + ';" data-rgb="' + h + '"></div>' } ) ; a ( "#palette" ) . append ( Ma ) ; var Da = a ( "#tool_angle_indicator" ) ; a ( "#tool_reorient" ) ; rotateCursor = function ( h ) { h = "rotate(" + h + "deg)" ; Da . css ( { "-webkit-transform" : h , "-moz-transform" : h , "-o-transform" : h , "-ms-transform" : h , transform : h } ) } ; var wa = function ( h ) { var n = h . value / 100 ; if ( n < 0.001 ) h . value = 0.1 ; else { h = e . getZoom ( ) ; var q = K ; ja ( window , { width : 0 , height : 0 , x : ( q [ 0 ] . scrollLeft + q . width ( ) / 2 ) / h , y : ( q [ 0 ] . scrollTop + q . height ( ) / 2 ) / h , zoom : n } , true ) } } ; a ( "#stroke_style" ) . change ( function ( ) { e . setStrokeAttr ( "stroke-dasharray" ,
a ( this ) . val ( ) ) ; a ( "#stroke_style_label" ) . html ( this . options [ this . selectedIndex ] . text ) ; window . opera && a ( "<p/>" ) . hide ( ) . appendTo ( "body" ) . remove ( ) } ) ; a ( "#seg_type" ) . change ( function ( ) { e . setSegType ( a ( this ) . val ( ) ) ; a ( "#seg_type_label" ) . html ( this . options [ this . selectedIndex ] . text ) } ) ; a ( "select" ) . change ( function ( ) { a ( this ) . blur ( ) } ) ; a ( "#font_family" ) . change ( function ( ) { e . setFontFamily ( this . value ) } ) ; a ( "#text" ) . keyup ( function ( ) { e . setTextContent ( this . value ) } ) ; changeAttribute = function ( h ) { var n = h . getAttribute ( "data-attr" ) ,
q = h . getAttribute ( "data-multiplier" ) || 1 ; q = parseFloat ( q ) ; q = h . value * q ; if ( ! svgedit . units . isValidUnit ( n , q , aa ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; h . value = aa . getAttribute ( n ) ; return false } e . changeSelectedAttributeNoUndo ( n , q ) } ; picking = false ; a ( document ) . on ( "mouseup" , function ( ) { picking = false } ) ; a ( "#palette" ) . on ( "mousemove mousedown touchstart touchmove" , ".palette_item" , function ( h ) { h . preventDefault ( ) ; if ( h . type == "mousedown" ) picking = true ; if ( picking ) { var n = a ( "#tool_stroke" ) . hasClass ( "active" ) , q =
n ? "stroke" : "fill" , u = a ( this ) . attr ( "data-rgb" ) , E = null , H = true ; if ( h . type == "mousedown" ) H = false ; if ( u === "transparent" || u === "initial" || u === "#none" ) { u = "none" ; E = new a . jGraduate . Paint } else E = new a . jGraduate . Paint ( { alpha : 100 , solidColor : u . substr ( 1 ) } ) ; b . paintBox [ q ] . setPaint ( E ) ; if ( n ) { e . setColor ( "stroke" , u , H ) ; u != "none" && e . getStrokeOpacity ( ) != 1 && e . setPaintOpacity ( "stroke" , 1 ) } else { e . setColor ( "fill" , u , H ) ; u != "none" && e . getFillOpacity ( ) != 1 && e . setPaintOpacity ( "fill" , 1 ) } } } ) . bind ( "contextmenu" , function ( h ) { h . preventDefault ( ) } ) ;
a ( "#toggle_stroke_tools" ) . toggle ( function ( ) { a ( ".stroke_tool" ) . css ( "display" , "table-cell" ) ; a ( this ) . addClass ( "expanded" ) ; Db ( ) } , function ( ) { a ( ".stroke_tool" ) . css ( "display" , "none" ) ; a ( this ) . removeClass ( "expanded" ) ; Db ( ) } ) ; var ra = function ( h , n ) { if ( a ( h ) . hasClass ( "disabled" ) ) return false ; if ( a ( h ) . parent ( ) . hasClass ( "tools_flyout" ) ) return true ; var q = q || "normal" ; n || a ( ".tools_flyout" ) . fadeOut ( q ) ; a ( "#styleoverrides" ) . text ( "" ) ; a ( ".tool_button_current" ) . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( h ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) ;
return true } ; ( function ( ) { var h = null , n = null , q = K [ 0 ] , u = false , E = false ; a ( "#svgcanvas" ) . on ( "mousemove mouseup touchend" , function ( H ) { if ( u !== false ) { q . scrollLeft -= H . clientX - h ; q . scrollTop -= H . clientY - n ; h = H . clientX ; n = H . clientY ; if ( H . type === "mouseup" || H . type === "touchend" ) u = false ; return false } } ) . on ( "mousedown touchmove" , function ( H ) { if ( H . button === 1 || E === true || H . originalEvent . touches && H . originalEvent . touches . length >= 2 ) { u = true ; h = H . clientX ; n = H . clientY ; return false } } ) ; a ( window ) . mouseup ( function ( ) { u = false } ) ; a ( document ) . bind ( "keydown" ,
"space" , function ( H ) { H . preventDefault ( ) ; e . spaceKey = E = true } ) . bind ( "keyup" , "space" , function ( H ) { H . preventDefault ( ) ; e . spaceKey = E = false } ) . bind ( "keydown" , "alt" , function ( ) { e . getMode ( ) === "zoom" && K . addClass ( "out" ) } ) . bind ( "keyup" , "alt" , function ( ) { e . getMode ( ) === "zoom" && K . removeClass ( "out" ) } ) } ) ( ) ; var va = a ( ".menu" ) , kb = function ( h ) { h . target . style . background = "#fff" ; setTimeout ( function ( ) { h . target . style . background = "#ddd" } , 50 ) ; setTimeout ( function ( ) { h . target . style . background = "#fff" } , 150 ) ; setTimeout ( function ( ) { h . target . style . background =
"#ddd" } , 200 ) ; setTimeout ( function ( ) { h . target . style . background = "" } , 200 ) ; setTimeout ( function ( ) { a ( "#menu_bar" ) . removeClass ( "active" ) } , 220 ) ; return false } ; a ( ".menu_item" ) . on ( "mousedown touchstart" , function ( h ) { kb ( h ) } ) ; a ( "svg, body" ) . on ( "mousedown touchstart" , function ( h ) { if ( ! ( h . target . nodeName && h . target . nodeName . toLowerCase ( ) === "input" ) ) if ( ! a ( h . target ) . hasClass ( "menu_title" ) && ! a ( h . target ) . parent ( ) . hasClass ( "menu_title" ) ) ! a ( h . target ) . hasClass ( "disabled" ) && a ( h . target ) . hasClass ( "menu_item" ) ? kb ( h ) : a ( "#menu_bar" ) . removeClass ( "active" ) } ) ;
a ( "#workarea" ) . on ( "mousewheel" , function ( h , n , q , u ) { if ( h . altKey || h . ctrlKey ) { h . preventDefault ( ) ; zoom = parseInt ( a ( "#zoom" ) . val ( ) ) ; a ( "#zoom" ) . val ( parseInt ( zoom + u * ( h . altKey ? 10 : 5 ) ) ) . change ( ) } } ) ; a ( ".menu_title" ) . on ( "mousedown" , function ( ) { a ( "#tools_shapelib" ) . hide ( ) ; a ( "#menu_bar" ) . toggleClass ( "active" ) ; va . removeClass ( "open" ) ; a ( this ) . parent ( ) . addClass ( "open" ) } ) . on ( "mouseover" , function ( ) { va . removeClass ( "open" ) ; a ( this ) . parent ( ) . addClass ( "open" ) } ) ; b . addDropDown = function ( h , n , q ) { if ( a ( h ) . length != 0 ) { var u = a ( h ) . find ( "button" ) ,
E = a ( h ) . find ( "ul" ) . attr ( "id" , a ( h ) [ 0 ] . id + "-list" ) ; q || a ( "#option_lists" ) . append ( E ) ; var H = false ; q && a ( h ) . addClass ( "dropup" ) ; E . find ( "li" ) . bind ( "mouseup" , n ) ; a ( window ) . mouseup ( function ( ) { if ( ! H ) { u . removeClass ( "down" ) ; E . hide ( ) } H = false } ) ; u . bind ( "mousedown" , function ( ) { if ( u . hasClass ( "down" ) ) { u . removeClass ( "down" ) ; E . hide ( ) } else { u . addClass ( "down" ) ; if ( ! q ) { var J = a ( h ) . offset ( ) ; E . css ( { top : J . top , left : J . left - 110 } ) } E . show ( ) ; H = true } } ) . hover ( function ( ) { H = true } ) . mouseout ( function ( ) { H = false } ) } } ; var vb = function ( h , n , q , u ) { var E =
a ( h ) ; n = a ( n ) ; var H = false , J = u . dropUp ; J && a ( h ) . addClass ( "dropup" ) ; n . find ( "li" ) . bind ( "mouseup" , function ( ) { if ( u . seticon ) { zb ( "#cur_" + E [ 0 ] . id , a ( this ) . children ( ) ) ; a ( this ) . addClass ( "current" ) . siblings ( ) . removeClass ( "current" ) } q . apply ( this , arguments ) } ) ; a ( window ) . mouseup ( function ( ) { if ( ! H ) { E . removeClass ( "down" ) ; n . hide ( ) ; n . css ( { top : 0 , left : 0 } ) } H = false } ) ; n . height ( ) ; a ( h ) . bind ( "mousedown" , function ( ) { var O = a ( h ) . offset ( ) ; if ( J ) { O . top -= n . height ( ) ; O . left += 8 } else O . top += a ( h ) . height ( ) ; a ( n ) . offset ( O ) ; if ( E . hasClass ( "down" ) ) { E . removeClass ( "down" ) ;
n . hide ( ) ; n . css ( { top : 0 , left : 0 } ) } else { E . addClass ( "down" ) ; n . show ( ) ; H = true ; return false } } ) . hover ( function ( ) { H = true } ) . mouseout ( function ( ) { H = false } ) ; u . multiclick && n . mousedown ( function ( ) { H = true } ) } ; a ( "#font_family_dropdown" ) . change ( function ( ) { var h = this . options [ this . selectedIndex ] . value , n = this . options [ this . selectedIndex ] . text ; a ( "#preview_font" ) . html ( n ) . css ( "font-family" , h ) ; a ( "#font_family" ) . val ( h ) . change ( ) } ) ; a ( "div" , "#position_opts" ) . each ( function ( ) { this . addEventListener ( "mouseup" , function ( ) { var h = this . id . replace ( "tool_pos" ,
"" ) . charAt ( 0 ) ; e . alignSelectedElements ( h , "page" ) } ) } ) ; ( function ( ) { var h , n = function ( ) { a ( h ) . blur ( ) } ; a ( "#svg_editor" ) . find ( "button, select, input:not(#text)" ) . focus ( function ( ) { h = this ; L = "toolbars" ; K . mousedown ( n ) } ) . blur ( function ( ) { L = "canvas" ; K . unbind ( "mousedown" , n ) ; e . getMode ( ) == "textedit" && a ( "#text" ) . focus ( ) } ) } ) ( ) ; var cb = function ( ) { ra ( "#tool_select" ) && e . setMode ( "select" ) } , Ta = function ( ) { ra ( "#tool_fhpath" ) && e . setMode ( "fhpath" ) } , Va = function ( ) { ra ( "#tool_line" ) && e . setMode ( "line" ) } , Ga = function ( ) { ra ( "#tool_rect" ) &&
e . setMode ( "rect" ) } , ta = function ( ) { ra ( "#tool_ellipse" ) && e . setMode ( "ellipse" ) } , $a = function ( ) { ra ( "#tool_image" ) && e . setMode ( "image" ) } , Ka = function ( ) { ra ( "#tool_zoom" ) && e . setMode ( "zoom" ) } , Sa = function ( ) { if ( ra ( "#tool_zoom" ) ) { yb ( ) ; qa ( ) } } , Ha = function ( ) { ra ( "#tool_text" ) && e . setMode ( "text" ) } , db = function ( ) { ra ( "#tool_path" ) && e . setMode ( "path" ) } , lb = function ( ) { if ( aa != null || Y ) e . deleteSelectedElements ( ) ; B . getNodePoint ( ) && B . deletePathNode ( ) } , Ua = function ( ) { if ( aa != null || Y ) { xa ( a ( "#edit_menu" ) ) ; e . cutSelectedElements ( ) } } , Xa =
function ( ) { if ( aa != null || Y ) { xa ( a ( "#edit_menu" ) ) ; e . copySelectedElements ( ) } } , wb = function ( ) { xa ( a ( "#edit_menu" ) ) ; var h = e . getZoom ( ) , n = ( K [ 0 ] . scrollLeft + K . width ( ) / 2 ) / h - e . contentW ; h = ( K [ 0 ] . scrollTop + K . height ( ) / 2 ) / h - e . contentH ; e . pasteElements ( "point" , n , h ) } , sa = function ( ) { if ( aa != null ) { xa ( a ( "#object_menu" ) ) ; e . moveToTopSelectedElement ( ) } } , hb = function ( ) { if ( aa != null ) { xa ( a ( "#object_menu" ) ) ; e . moveToBottomSelectedElement ( ) } } , eb = function ( ) { if ( aa != null ) { xa ( a ( "#object_menu" ) ) ; e . moveUpDownSelected ( "Up" ) } } , sb = function ( ) { if ( aa !=
null ) { xa ( a ( "#object_menu" ) ) ; e . moveUpDownSelected ( "Down" ) } } , ib = function ( h ) { if ( aa != null ) { xa ( a ( "#object_menu" ) ) ; e . moveUpDownSelected ( h ) } } , ab = function ( ) { if ( aa != null ) { e . convertToPath ( ) ; var h = e . getSelectedElems ( ) ; e . selectorManager . requestSelector ( h [ 0 ] ) . reset ( h [ 0 ] ) ; e . selectorManager . requestSelector ( h [ 0 ] ) . selectorRect . setAttribute ( "display" , "none" ) ; e . setMode ( "pathedit" ) ; B . toEditMode ( h [ 0 ] ) ; e . clearSelection ( ) ; Fa ( ) } } , ob = function ( ) { aa != null && B . reorient ( ) } , pb = function ( ) { if ( aa != null || Y ) a . prompt ( uiStrings . notification . enterNewLinkURL ,
"http://" , function ( h ) { h && e . makeHyperlink ( h ) } ) } , fb = function ( h , n ) { if ( aa != null || Y ) { if ( curConfig . gridSnapping ) { var q = e . getZoom ( ) * curConfig . snappingStep ; h *= q ; n *= q } a ( "input" ) . blur ( ) ; e . moveSelectedElements ( h , n ) } } , tb = function ( ) { } , ia = function ( ) { B . getNodePoint ( ) && B . clonePathNode ( ) } , ba = function ( ) { B . getNodePoint ( ) && B . deletePathNode ( ) } , ka = function ( ) { var h = a ( "#tool_add_subpath" ) , n = ! h . hasClass ( "push_button_pressed" ) ; n ? h . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) : h . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ;
B . addSubPath ( n ) } , M = function ( ) { B . opencloseSubPath ( ) } , P = function ( ) { e . cycleElement ( 1 ) } , ea = function ( ) { e . cycleElement ( 0 ) } , Ea = function ( h , n ) { if ( ! ( aa == null || Y ) ) { h || ( n *= - 1 ) ; var q = a ( "#angle" ) . val ( ) * 1 + n ; e . setRotationAngle ( q ) ; Fa ( ) } } , Oa = function ( ) { var h = curConfig . dimensions ; a . confirm ( uiStrings . notification . QwantToClear , function ( n ) { if ( n ) { qa ( ) ; e . clear ( ) ; e . setResolution ( h [ 0 ] , h [ 1 ] ) ; G ( true ) ; yb ( ) ; Fa ( ) ; da ( ) ; e . runExtensions ( "onNewDocument" ) } } ) } , Wa = function ( ) { e . setBold ( ! e . getBold ( ) ) ; Fa ( ) } , Za = function ( ) { e . setItalic ( ! e . getItalic ( ) ) ;
Fa ( ) } , nb = function ( ) { if ( ! c . pngsave ) { var h = uiStrings . notification . loadingImage ; S = window . open ( "data:text/html;charset=utf-8,<title>" + h + "</title><h1>" + h + "</h1>" ) } window . canvg ? e . rasterExport ( ) : a . getScript ( "canvg/rgbcolor.js" , function ( ) { a . getScript ( "canvg/canvg.js" , function ( ) { e . rasterExport ( ) } ) } ) } , Ra = function ( ) { e . open ( ) } , mb = function ( ) { } , xa = function ( h ) { var n = h . prev ( ) ; n . css ( { background : "white" , color : "black" } ) ; setTimeout ( function ( ) { n . removeAttr ( "style" ) } , 200 ) } , qb = function ( ) { if ( v . getUndoStackSize ( ) > 0 ) { xa ( a ( "#edit_menu" ) ) ;
v . undo ( ) } } , rb = function ( ) { if ( v . getRedoStackSize ( ) > 0 ) { xa ( a ( "#edit_menu" ) ) ; v . redo ( ) } } , Bb = function ( ) { if ( Y ) { xa ( a ( "#object_menu" ) ) ; e . groupSelectedElements ( ) } else if ( aa ) { xa ( a ( "#object_menu" ) ) ; e . ungroupSelectedElement ( ) } } , Fb = function ( ) { xa ( a ( "#edit_menu" ) ) ; e . cloneSelectedElements ( 20 , 20 ) } , bb = function ( ) { var h = this . id . replace ( "tool_align" , "" ) . charAt ( 0 ) ; e . alignSelectedElements ( h , a ( "#align_relative_to" ) . val ( ) ) } , La = function ( ) { var h = document . querySelector ( "#tool_stroke rect" ) ; a ( "#tool_stroke" ) . toggleClass ( "active" ) ;
a ( "#tool_fill" ) . toggleClass ( "active" ) ; var n = document . querySelector ( "#tool_fill rect" ) , q = n . getAttribute ( "fill" ) , u = h . getAttribute ( "fill" ) ; h = parseFloat ( h . getAttribute ( "stroke-opacity" ) ) ; if ( isNaN ( h ) ) h = 100 ; n = parseFloat ( n . getAttribute ( "fill-opacity" ) ) ; if ( isNaN ( n ) ) n = 100 ; u = ya ( u , h , "stroke" ) ; q = ya ( q , n , "fill" ) ; b . paintBox . fill . setPaint ( u , true ) ; b . paintBox . stroke . setPaint ( q , true ) } , yb = function ( h ) { var n = e . getResolution ( ) ; h = h ? n . zoom * h : 1 ; a ( "#zoom" ) . val ( h * 100 ) ; e . setZoom ( h ) ; xb ( ) ; G ( true ) } , Hb = function ( ) { xa ( a ( "#view_menu" ) ) ;
! a ( "#tool_wireframe" ) . hasClass ( "push_button_pressed" ) ? a ( "#tool_wireframe" ) . addClass ( "push_button_pressed" ) : a ( "#tool_wireframe" ) . removeClass ( "push_button_pressed" ) ; K . toggleClass ( "wireframe" ) ; if ( ! k ) { var h = a ( "#wireframe_rules" ) ; h . length ? h . empty ( ) : a ( '<style id="wireframe_rules"></style>' ) . appendTo ( "head" ) ; xb ( ) } } , Gb = function ( ) { xa ( a ( "#view_menu" ) ) ; var h = ! a ( "#tool_snap" ) . hasClass ( "push_button_pressed" ) ; h ? a ( "#tool_snap" ) . addClass ( "push_button_pressed" ) : a ( "#tool_snap" ) . removeClass ( "push_button_pressed" ) ; curConfig . gridSnapping =
h } , Ib = function ( ) { window . self != window . top && top . exit _fullscreen ( ) } , Lb = function ( ) { xa ( a ( "#view_menu" ) ) ; if ( a ( "#tool_rulers" ) . hasClass ( "push_button_pressed" ) ) { a ( "#tool_rulers" ) . removeClass ( "push_button_pressed" ) ; a ( "#show_rulers" ) . attr ( "checked" , false ) ; curConfig . showRulers = false } else { a ( "#tool_rulers" ) . addClass ( "push_button_pressed" ) ; a ( "#show_rulers" ) . attr ( "checked" , true ) ; curConfig . showRulers = true } a ( "#rulers" ) . toggle ( ! ! curConfig . showRulers ) } , xb = function ( ) { if ( ! k ) { var h = "#workarea.wireframe #svgcontent * { stroke-width: " +
1 / e . getZoom ( ) + "px; }" ; a ( "#wireframe_rules" ) . text ( K . hasClass ( "wireframe" ) ? h : "" ) } } , Eb = function ( h , n ) { if ( ! ga ) { xa ( a ( "#view_menu" ) ) ; ga = true ; a ( "#save_output_btns" ) . toggle ( ! ! n ) ; a ( "#tool_source_back" ) . toggle ( ! n ) ; var q = Z = e . getSvgString ( ) ; a ( "#svg_source_textarea" ) . val ( q ) ; a ( "#svg_source_editor" ) . fadeIn ( ) ; a ( "#svg_source_textarea" ) . focus ( ) . select ( ) } } , Kb = function ( ) { if ( ga ) { if ( e . setSvgString ( a ( "#svg_source_textarea" ) . val ( ) ) ) { e . clearSelection ( ) ; Ya ( ) ; yb ( ) ; da ( ) } else a . confirm ( uiStrings . notification . QerrorsRevertToSource ,
function ( h ) { if ( ! h ) return false ; e . clearSelection ( ) ; Ya ( ) ; yb ( ) ; da ( ) } ) ; qa ( ) } } , zb = b . setIcon = function ( h , n ) { var q = typeof n === "string" ? a . getSvgIcon ( n , true ) : n . clone ( ) ; q ? a ( h ) . find ( "img" ) . replaceWith ( q ) : console . log ( "NOTE: Icon image missing: " + n ) } , gb ; gb = function ( ) { var h = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/ , n = document . getElementsByTagName ( "script" ) [ 0 ] , q ; for ( q in n . style ) if ( h . test ( q ) ) return q . match ( h ) [ 0 ] ; if ( "WebkitOpacity" in n . style ) return "Webkit" ; if ( "KhtmlOpacity" in n . style ) return "Khtml" ; return "" } ( ) ; var Nb =
function ( h , n ) { gb . toLowerCase ( ) ; var q = [ "top" , "left" , "bottom" , "right" ] ; h . each ( function ( ) { for ( var u = a ( this ) , E = u . outerWidth ( ) * ( n - 1 ) , H = u . outerHeight ( ) * ( n - 1 ) , J = 0 ; J < 4 ; J ++ ) { var O = q [ J ] , W = u . data ( "orig_margin-" + O ) ; if ( W == null ) { W = parseInt ( u . css ( "margin-" + O ) ) ; u . data ( "orig_margin-" + O , W ) } W = W * n ; if ( O === "right" ) W += E ; else if ( O === "bottom" ) W += H ; u . css ( "margin-" + O , W ) } } ) } , Mb = b . setIconSize = function ( h , n ) { if ( ! ( h == s . size && ! n ) ) { var q = a ( "#tools_top .toolset, #editor_panel > *, #history_panel > *, #main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *, #g_panel > *, #tool_font_size > *, .tools_flyout" ) ,
u = 1 ; u = typeof h == "number" ? h : { s : 0.75 , m : 1 , l : 1.25 , xl : 1.5 } [ h ] ; b . tool _scale = R = u ; oa ( ) ; var E = q . parents ( ":hidden" ) ; E . css ( "visibility" , "hidden" ) . show ( ) ; Nb ( q , u ) ; E . css ( "visibility" , "visible" ) . hide ( ) ; q = a ( "#tool_size_rules" ) ; if ( q . length ) q . empty ( ) ; else q = a ( '<style id="tool_size_rules"></style>' ) . appendTo ( "head" ) ; if ( h != "m" ) { var H = "" ; a . each ( cssResizeRules , function ( J , O ) { J = "#svg_editor " + J . replace ( /,/g , ", #svg_editor" ) ; H += J + "{" ; a . each ( O , function ( W , ca ) { if ( typeof ca === "number" ) var T = ca * u + "px" ; else if ( ca [ h ] || ca . all ) T =
ca [ h ] || ca . all ; H += W + ":" + T + ";" } ) ; H += "}" } ) ; E = "-" + gb . toLowerCase ( ) + "-" ; H += "#tools_top .toolset, #editor_panel > *, #history_panel > *, #main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *, #g_panel > *, #tool_font_size > *, .tools_flyout{" + E + "transform: scale(" + u + ");} #svg_editor div.toolset .toolset {" + E + "transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {" + E + "transform: scale(" + 1 / u + ");}" ; q . text ( H ) } oa ( ) } } , Ab = function ( ) { a ( "#dialog_box" ) . hide ( ) ;
if ( ga ) { if ( ga ) Z !== a ( "#svg_source_textarea" ) . val ( ) ? a . confirm ( uiStrings . notification . QignoreSourceChanges , function ( h ) { h && Ya ( ) } ) : Ya ( ) ; Db ( ) } else Ba && e . leaveContext ( ) } , Ya = function ( ) { a ( "#svg_source_editor" ) . hide ( ) ; ga = false ; a ( "#svg_source_textarea" ) . blur ( ) } ; a ( window ) . width ( ) ; a ( window ) . height ( ) ; var Db = a . noop ; a ( window ) . resize ( function ( ) { G ( ) } ) ; ( function ( ) { K . scroll ( function ( ) { if ( a ( "#ruler_x" ) . length != 0 ) a ( "#ruler_x" ) [ 0 ] . scrollLeft = K [ 0 ] . scrollLeft ; if ( a ( "#ruler_y" ) . length != 0 ) a ( "#ruler_y" ) [ 0 ] . scrollTop = K [ 0 ] . scrollTop } ) } ) ( ) ;
a ( "#url_notice" ) . click ( function ( ) { a . alert ( this . title ) } ) ; a ( "#change_image_url" ) . click ( function ( ) { var h = e . getHref ( aa ) ; h = h . indexOf ( "data:" ) === 0 ? "" : h ; a . prompt ( uiStrings . notification . enterNewImgURL , h , function ( n ) { n && Ia ( n ) } ) } ) ; var f = function ( h ) { var n = h [ 0 ] . id == "stroke_color" ? "stroke" : "fill" , q = h [ 0 ] . id == "canvas_color" ; if ( q ) n = "canvas" ; var u = b . paintBox [ n ] . paint ; h = n == "stroke" ? "Pick a Stroke Paint and Opacity" : "Pick a Fill Paint and Opacity" ; q = q ? { right : 175 , top : 50 } : { left : 50 , bottom : 50 } ; a ( "#color_picker" ) . draggable ( { cancel : ".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker" ,
containment : "window" } ) . removeAttr ( "style" ) . css ( q ) . jGraduate ( { paint : u , window : { pickerTitle : h } , images : { clientPath : curConfig . jGraduatePath } , newstop : "inverse" } , function ( E ) { u = new a . jGraduate . Paint ( E ) ; b . paintBox [ n ] . setPaint ( u ) ; e . setPaint ( n , u ) ; a ( "#color_picker" ) . hide ( ) } , function ( ) { a ( "#color_picker" ) . hide ( ) } ) } ; d = function ( h , n ) { var q = document . getElementById ( "canvas_background" ) , u = { color : "fff" , opacity : 1 } ; if ( n == "stroke" ) u = curConfig . initStroke ; if ( n == "fill" ) u = curConfig . initFill ; if ( n == "canvas" && q ) if ( q = q . getAttribute ( "fill" ) . match ( /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/ ) ) u =
{ color : ( "0" + parseInt ( q [ 1 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( "0" + parseInt ( q [ 2 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( "0" + parseInt ( q [ 3 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) , opacity : 1 } ; q = ( new DOMParser ) . parseFromString ( '<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="#' + u . color + '" opacity="' + u . opacity + '"/> <defs><linearGradient id="gradbox_"/></defs></svg>' , "text/xml" ) . documentElement ; q = a ( h ) [ 0 ] . appendChild ( document . importNode ( q , true ) ) ; n === "canvas" ? q . setAttribute ( "width" , 60.5 ) :
q . setAttribute ( "width" , "100%" ) ; this . rect = q . firstChild ; this . defs = q . getElementsByTagName ( "defs" ) [ 0 ] ; this . grad = this . defs . firstChild ; this . paint = new a . jGraduate . Paint ( { solidColor : u . color } ) ; this . type = n ; this . setPaint = function ( E , H ) { this . paint = E ; var J = "none" , O = E . type , W = E . alpha / 100 ; switch ( O ) { case "solidColor" : J = E [ O ] == "none" || E [ O ] == "one" ? "none" : "#" + E [ O ] ; break ; case "linearGradient" : case "radialGradient" : this . defs . removeChild ( this . grad ) ; this . grad = this . defs . appendChild ( E [ O ] ) ; J = "url(#" + ( this . grad . id = "gradbox_" +
this . type ) + ")" } this . rect . setAttribute ( "fill" , J ) ; this . rect . setAttribute ( "opacity" , W ) ; if ( this . type == "canvas" ) if ( O = document . getElementById ( "canvas_background" ) ) { za = e . getResolution ( ) ; O . setAttribute ( "x" , - 1 ) ; O . setAttribute ( "y" , - 1 ) ; O . setAttribute ( "width" , za . w + 2 ) ; O . setAttribute ( "height" , za . h + 2 ) ; J . indexOf ( "url" ) == - 1 && O . setAttribute ( "fill" , J ) } else Ja ( J ) ; if ( H ) { e . setColor ( this . type , J , true ) ; e . setPaintOpacity ( this . type , W , true ) } } ; this . update = function ( E ) { if ( aa ) { var H = this . type ; switch ( aa . tagName ) { case "use" : case "image" : case "foreignObject" : return ;
case "g" : case "a" : for ( var J = null , O = aa . getElementsByTagName ( "*" ) , W = 0 , ca = O . length ; W < ca ; W ++ ) { var T = O [ W ] . getAttribute ( H ) ; if ( W === 0 ) J = T ; else if ( J !== T ) { J = null ; break } } if ( J === null ) { O = null ; return } O = J ; J = 1 ; break ; default : J = parseFloat ( aa . getAttribute ( H + "-opacity" ) ) ; if ( isNaN ( J ) ) J = 1 ; O = H === "fill" ? "black" : "none" ; O = aa . getAttribute ( H ) || O } if ( E ) { e . setColor ( H , O , true ) ; e . setPaintOpacity ( H , J , true ) } J *= 100 ; this . setPaint ( ya ( O , J , H ) ) } } ; this . prep = function ( ) { switch ( this . paint . type ) { case "linearGradient" : case "radialGradient" : var E =
new a . jGraduate . Paint ( { copy : this . paint } ) ; e . setPaint ( n , E ) } } } ; b . paintBox . fill = new d ( "#fill_color" , "fill" ) ; b . paintBox . stroke = new d ( "#stroke_color" , "stroke" ) ; b . paintBox . canvas = new d ( "#canvas_color" , "canvas" ) ; a ( "#stroke_width" ) . val ( curConfig . initStroke . width ) ; a ( "#group_opacity" ) . val ( curConfig . initOpacity * 100 ) ; d = b . paintBox . fill . rect . cloneNode ( false ) ; d . setAttribute ( "style" , "vector-effect:non-scaling-stroke" ) ; var k = d . style . vectorEffect === "non-scaling-stroke" ; d . removeAttribute ( "style" ) ; d = b . paintBox . fill . rect . ownerDocument . createElementNS ( "http://www.w3.org/2000/svg" ,
"feGaussianBlur" ) ; typeof d . stdDeviationX === "undefined" && a ( "#tool_blur" ) . hide ( ) ; a ( d ) . remove ( ) ; setTimeout ( function ( ) { e . embedImage ( "images/placeholder.svg" , function ( h ) { if ( ! h ) { a ( "#image_save_opts [value=embed]" ) . attr ( "disabled" , "disabled" ) ; a ( "#image_save_opts input" ) . val ( [ "ref" ] ) ; s . img _save = "ref" ; a ( "#image_opt_embed" ) . css ( "color" , "#666" ) . attr ( "title" , uiStrings . notification . featNotSupported ) } } ) } , 1E3 ) ; a ( "#tool_fill" ) . click ( function ( ) { if ( a ( "#tool_fill" ) . hasClass ( "active" ) ) f ( a ( "#fill_color" ) ) ; else { a ( "#tool_fill" ) . addClass ( "active" ) ;
a ( "#tool_stroke" ) . removeClass ( "active" ) } } ) ; a ( "#tool_stroke" ) . on ( "click" , function ( ) { if ( a ( "#tool_stroke" ) . hasClass ( "active" ) ) f ( a ( "#stroke_color" ) ) ; else { a ( "#tool_stroke" ) . addClass ( "active" ) ; a ( "#tool_fill" ) . removeClass ( "active" ) } } ) ; a ( "#tool_canvas" ) . on ( "click touchstart" , function ( ) { f ( a ( "#canvas_color" ) ) } ) ; a ( "#tool_stroke" ) . on ( "touchstart" , function ( ) { a ( "#tool_stroke" ) . addClass ( "active" ) ; a ( "#tool_fill" ) . removeClass ( "active" ) ; f ( a ( "#stroke_color" ) ) } ) ; a ( "#tool_fill" ) . on ( "touchstart" , function ( ) { a ( "#tool_fill" ) . addClass ( "active" ) ;
a ( "#tool_stroke" ) . removeClass ( "active" ) ; f ( a ( "#fill_color" ) ) } ) ; a ( "#zoom_select" ) . on ( "change" , function ( ) { var h = this . options [ this . selectedIndex ] . text ; h = h . split ( "%" ) [ 0 ] ; a ( "#zoom" ) . val ( h ) . trigger ( "change" ) } ) ; a ( ".push_button" ) . mousedown ( function ( ) { a ( this ) . hasClass ( "disabled" ) || a ( this ) . addClass ( "push_button_pressed" ) . removeClass ( "push_button" ) } ) . mouseout ( function ( ) { a ( this ) . removeClass ( "push_button_pressed" ) . addClass ( "push_button" ) } ) . mouseup ( function ( ) { a ( this ) . removeClass ( "push_button_pressed" ) . addClass ( "push_button" ) } ) ;
a ( window ) . bind ( "load resize" , function ( ) { K . css ( "line-height" , K . height ( ) + "px" ) } ) ; var m = function ( ) { var h = a ( "#canvas_width" ) , n = a ( "#canvas_height" ) , q = h . val ( ) , u = n . val ( ) ; if ( q != "fit" && ! svgedit . units . isValidUnit ( "width" , q ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; h . parent ( ) . addClass ( "error" ) ; return false } h . parent ( ) . removeClass ( "error" ) ; if ( u != "fit" && ! svgedit . units . isValidUnit ( "height" , u ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; n . parent ( ) . addClass ( "error" ) ; return false } n . parent ( ) . removeClass ( "error" ) ;
if ( ! e . setResolution ( q , u ) ) { a . alert ( uiStrings . notification . noContentToFitTo ) ; q = e . getResolution ( ) ; h . val ( q . w ) ; n . val ( q . h ) ; return false } G ( ) } ; a ( "#resolution" ) . change ( function ( ) { var h = a ( "#canvas_width" ) [ 0 ] , n = a ( "#canvas_height" ) [ 0 ] ; if ( this . selectedIndex ) if ( this . value == "content" ) { h . value = "fit" ; n . value = "fit" ; m ( ) ; var q = e . getResolution ( ) ; h . value = q . w ; n . value = q . h } else { var u = this . value . split ( "x" ) ; u [ 0 ] = parseInt ( u [ 0 ] ) ; u [ 1 ] = parseInt ( u [ 1 ] ) ; var E = u [ 0 ] - h . value , H = u [ 1 ] - n . value , J = Date . now ( ) , O = function ( ) { var W = ( Date . now ( ) -
J ) / 1E3 ; W = Math . pow ( W - 1 , 3 ) + 1 ; h . value = ( u [ 0 ] - E + W * E ) . toFixed ( 0 ) ; n . value = ( u [ 1 ] - H + W * H ) . toFixed ( 0 ) ; m ( ) ; if ( W >= 1 ) { W = e . getResolution ( ) ; a ( "#canvas_width" ) . val ( W . w . toFixed ( ) ) ; a ( "#canvas_height" ) . val ( W . h . toFixed ( ) ) ; a ( "#resolution_label" ) . html ( "<div class='pull'>" + W . w + "<span>\u00d7</span></br>" + W . h + "</div>" ) } else requestAnimationFrame ( O ) } ; O ( ) } else { a ( "#resolution_label" ) . html ( "Custom" ) ; h . removeAttribute ( "readonly" ) ; h . focus ( ) ; h . select ( ) ; if ( h . value == "fit" ) { h . value = 100 ; n . value = 100 } } } ) ; a ( "#zoom" ) . change ( function ( ) { wa ( this ) } ) ;
a ( "input,select" ) . attr ( "autocomplete" , "off" ) ; var C = function ( ) { var h = [ { sel : "#tool_select" , fn : cb , evt : "click" , key : [ "V" , true ] } , { sel : "#tool_fhpath" , fn : Ta , evt : "click" , key : [ "Q" , true ] } , { sel : "#tool_line" , fn : Va , evt : "click" , key : [ "L" , true ] } , { sel : "#tool_rect" , fn : Ga , evt : "click" , key : [ "R" , true ] , icon : "rect" } , { sel : "#tool_ellipse" , fn : ta , evt : "mouseup" , key : [ "C" , true ] , icon : "ellipse" } , { sel : "#tool_path" , fn : db , evt : "click" , key : [ "P" , true ] } , { sel : "#tool_text" , fn : Ha , evt : "click" , key : [ "T" , true ] } , { sel : "#tool_image" , fn : $a , evt : "mouseup" } ,
{ sel : "#tool_zoom" , fn : Ka , evt : "mouseup" , key : [ "Z" , true ] } , { sel : "#tool_clear" , fn : Oa , evt : "mouseup" , key : [ w + "N" , true ] } , { sel : "#tool_save" , fn : function ( ) { if ( ga ) Kb ( ) ; else { xa ( a ( "#file_menu" ) ) ; e . save ( { images : s . img _save , round _digits : 6 } ) } } , evt : "mouseup" , key : [ w + "S" , true ] } , { sel : "#tool_export" , fn : nb , evt : "mouseup" } , { sel : "#tool_open" , fn : Ra , evt : "mouseup" } , { sel : "#tool_import" , fn : mb , evt : "mouseup" } , { sel : "#tool_source" , fn : Eb , evt : "click" , key : [ w + "U" , true ] } , { sel : "#tool_wireframe" , fn : Hb , evt : "click" } , { sel : "#tool_snap" , fn : Gb , evt : "click" } ,
{ sel : "#tool_rulers" , fn : Lb , evt : "click" } , { sel : "#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel" , fn : Ab , evt : "click" , key : [ "esc" , false , false ] , hidekey : true } , { sel : "#tool_source_save" , fn : Kb , evt : "click" } , { sel : "#tool_delete,#tool_delete_multi" , fn : lb , evt : "click" , key : [ "del/backspace" , true ] } , { sel : "#tool_reorient" , fn : ob , evt : "click" } , { sel : "#tool_node_link" , fn : tb , evt : "change" } , { sel : "#tool_node_clone" , fn : ia , evt : "click" } , { sel : "#tool_node_delete" , fn : ba , evt : "click" } , { sel : "#tool_openclose_path" ,
fn : M , evt : "click" } , { sel : "#tool_add_subpath" , fn : ka , evt : "click" } , { sel : "#tool_move_top" , fn : sa , evt : "click" , key : w + "shift+up" } , { sel : "#tool_move_bottom" , fn : hb , evt : "click" , key : w + "shift+down" } , { sel : "#tool_move_up" , fn : eb , evt : "click" , key : [ w + "up" , true ] } , { sel : "#tool_move_down" , fn : sb , evt : "click" , key : [ w + "down" , true ] } , { sel : "#tool_topath" , fn : ab , evt : "click" } , { sel : "#tool_make_link,#tool_make_link_multi" , fn : pb , evt : "click" } , { sel : "#tool_clone,#tool_clone_multi" , fn : Fb , evt : "click" , key : [ w + "D" , true ] } , { sel : "#tool_group" , fn : Bb ,
evt : "click" , key : [ w + "G" , true ] } , { sel : "#tool_ungroup" , fn : Bb , evt : "click" , key : w + "shift+G" } , { sel : "#tool_unlink_use" , fn : Bb , evt : "click" } , { sel : "[id^=tool_align]" , fn : bb , evt : "click" } , { sel : "#tool_undo" , fn : qb , evt : "click" , key : w + "z" } , { sel : "#tool_redo" , fn : rb , evt : "click" , key : [ "y" , true ] } , { sel : "#tool_cut" , fn : Ua , evt : "click" , key : [ w + "x" , true ] } , { sel : "#tool_copy" , fn : Xa , evt : "click" , key : w + "c" } , { sel : "#tool_paste" , fn : wb , evt : "click" , key : w + "v" } , { sel : "#tool_switch" , fn : La , evt : "click" , key : [ "x" , true ] } , { sel : "#tool_bold" , fn : Wa , evt : "mousedown" ,
key : [ w + "B" , true ] } , { sel : "#tool_italic" , fn : Za , evt : "mousedown" , key : [ w + "I" , true ] } , { sel : "#copy_save_done" , fn : Ab , evt : "click" } , { key : "ctrl+left" , fn : function ( ) { Ea ( 0 , 1 ) } } , { key : "ctrl+right" , fn : function ( ) { Ea ( 1 , 1 ) } } , { key : "ctrl+shift+left" , fn : function ( ) { Ea ( 0 , 5 ) } } , { key : "ctrl+shift+right" , fn : function ( ) { Ea ( 1 , 5 ) } } , { key : "shift+O" , fn : ea } , { key : "shift+P" , fn : P } , { key : [ w + "+" , true ] , fn : function ( ) { yb ( 2 ) } } , { key : [ w + "-" , true ] , fn : function ( ) { yb ( 0.5 ) } } , { key : [ "up" , true ] , fn : function ( ) { fb ( 0 , - 1 ) } } , { key : [ "down" , true ] , fn : function ( ) { fb ( 0 ,
1 ) } } , { key : [ "left" , true ] , fn : function ( ) { fb ( - 1 , 0 ) } } , { key : [ "right" , true ] , fn : function ( ) { fb ( 1 , 0 ) } } , { key : "shift+up" , fn : function ( ) { fb ( 0 , - 10 ) } } , { key : "shift+down" , fn : function ( ) { fb ( 0 , 10 ) } } , { key : "shift+left" , fn : function ( ) { fb ( - 10 , 0 ) } } , { key : "shift+right" , fn : function ( ) { fb ( 10 , 0 ) } } , { key : [ "alt+up" , true ] , fn : function ( ) { e . cloneSelectedElements ( 0 , - 1 ) } } , { key : [ "alt+down" , true ] , fn : function ( ) { e . cloneSelectedElements ( 0 , 1 ) } } , { key : [ "alt+left" , true ] , fn : function ( ) { e . cloneSelectedElements ( - 1 , 0 ) } } , { key : [ "alt+right" , true ] , fn : function ( ) { e . cloneSelectedElements ( 1 ,
0 ) } } , { key : [ "alt+shift+up" , true ] , fn : function ( ) { e . cloneSelectedElements ( 0 , - 10 ) } } , { key : [ "alt+shift+down" , true ] , fn : function ( ) { e . cloneSelectedElements ( 0 , 10 ) } } , { key : [ "alt+shift+left" , true ] , fn : function ( ) { e . cloneSelectedElements ( - 10 , 0 ) } } , { key : [ "alt+shift+right" , true ] , fn : function ( ) { e . cloneSelectedElements ( 10 , 0 ) } } , { key : w + "A" , fn : function ( ) { e . selectAllInCurrentLayer ( ) } } , { key : "I" , fn : function ( ) { var q = a ( ".tool_button_current" ) ; if ( q . length && q [ 0 ] . id !== "tool_eyedropper" ) { q . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ;
a ( "#tool_eyedropper" ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) } e . setMode ( "eyedropper" ) } } , { key : w + "shift+z" , fn : rb } , { key : "esc" , fn : Ib } ] , n = { "4/Shift+4" : "#tools_rect_show" , "5/Shift+5" : "#tools_ellipse_show" } ; return { setAll : function ( ) { var q = { } ; a . each ( h , function ( u , E ) { if ( E . sel ) { var H = a ( E . sel ) ; if ( H . length == 0 ) return true ; if ( E . evt ) { if ( svgedit . browser . isTouch ( ) && E . evt === "click" ) E . evt = "mousedown" ; H [ E . evt ] ( E . fn ) } if ( E . parent && a ( E . parent + "_show" ) . length != 0 ) { var J = a ( E . parent ) ; J . length || ( J = na ( E . parent . substr ( 1 ) ) ) ;
J . append ( H ) ; a . isArray ( q [ E . parent ] ) || ( q [ E . parent ] = [ ] ) ; q [ E . parent ] . push ( E ) } } if ( E . key ) { var O = E . fn , W = false ; if ( a . isArray ( E . key ) ) { J = E . key [ 0 ] ; if ( E . key . length > 1 ) W = E . key [ 1 ] } else J = E . key ; J += "" ; svgedit . browser . isMac && J . indexOf ( "+" ) != - 1 && J . split ( "+" ) [ 0 ] == "ctrl" && J . replace ( "ctrl" , "cmd" ) ; a . each ( J . split ( "/" ) , function ( T , fa ) { a ( document ) . bind ( "keydown" , fa , function ( ha ) { O ( ) ; W && ha . preventDefault ( ) ; return false } ) } ) ; if ( E . sel && ! E . hidekey && H . attr ( "title" ) ) { var ca = H . attr ( "title" ) . split ( "[" ) [ 0 ] + " (" + J + ")" ; n [ J ] = E . sel ; H . parents ( "#main_menu" ) . length ||
H . attr ( "title" , ca ) } } } ) ; X ( q ) ; a ( window ) . bind ( "keydown" , "tab" , function ( u ) { if ( L === "canvas" ) { u . preventDefault ( ) ; P ( ) } } ) . bind ( "keydown" , "shift+tab" , function ( u ) { if ( L === "canvas" ) { u . preventDefault ( ) ; ea ( ) } } ) ; a ( "#tool_zoom" ) . dblclick ( Sa ) } , setTitles : function ( ) { a . each ( n , function ( q , u ) { var E = a ( u ) . parents ( "#main_menu" ) . length ; a ( u ) . each ( function ( ) { var H = E ? a ( this ) . text ( ) . split ( " [" ) [ 0 ] : this . title . split ( " [" ) [ 0 ] , J = "" ; a . each ( q . split ( "/" ) , function ( O , W ) { var ca = W . split ( "+" ) , T = "" ; if ( ca . length > 1 ) { T = ca [ 0 ] + "+" ; W = ca [ 1 ] } J += ( O ?
"/" : "" ) + T + ( uiStrings [ "key_" + W ] || W ) } ) ; if ( E ) this . lastChild . textContent = H + " [" + J + "]" ; else this . title = H + " [" + J + "]" } ) } ) } , getButtonData : function ( q ) { var u ; a . each ( h , function ( E , H ) { if ( H . sel === q ) u = H } ) ; return u } } } ( ) ; C . setAll ( ) ; b . ready ( function ( ) { var h = curConfig . initTool , n = a ( "#tools_left, #svg_editor .tools_flyout" ) , q = n . find ( "#tool_" + h ) ; h = n . find ( "#" + h ) ; ( q . length ? q : h . length ? h : a ( "#tool_select" ) ) . click ( ) . mouseup ( ) ; curConfig . wireframe && a ( "#tool_wireframe" ) . click ( ) ; curConfig . showlayers && toggleSidePanel ( ) ; a ( "#rulers" ) . toggle ( ! ! curConfig . showRulers ) } ) ;
a ( "#canvas_height" ) . dragInput ( { min : 10 , max : null , step : 10 , callback : m , cursor : false , dragAdjust : 0.1 } ) ; a ( "#canvas_width" ) . dragInput ( { min : 10 , max : null , step : 10 , callback : m , cursor : false , dragAdjust : 0.1 } ) ; a ( "#rect_width" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#rect_height" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#ellipse_cx" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#ellipse_cy" ) . dragInput ( { min : 1 , max : null ,
step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#ellipse_rx" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#ellipse_ry" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#image_height" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#circle_cx" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#circle_cy" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#circle_r" ) . dragInput ( { min : 1 ,
max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#image_height" ) . dragInput ( { min : 0 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#selected_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#selected_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#path_node_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#path_node_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute ,
cursor : false } ) ; a ( "#image_width" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#line_x1" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#line_x2" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#line_y1" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#line_y2" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#path_x" ) . dragInput ( { min : null ,
max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#path_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#rect_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#rect_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#g_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#g_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#image_x" ) . dragInput ( { min : null ,
max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#text_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#text_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#image_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#rect_rx" ) . dragInput ( { min : 0 , max : 100 , step : 1 , callback : changeAttribute , cursor : true } ) ; a ( "#stroke_width" ) . dragInput ( { min : 0 , max : 99 , step : 1 , callback : function ( h ) { var n = h . value ; if ( n == 0 &&
aa && [ "line" , "polyline" ] . indexOf ( aa . nodeName ) >= 0 ) n = h . value = 1 ; e . setStrokeWidth ( n ) } , cursor : true , smallStep : 0.1 , start : 1.5 } ) ; a ( "#angle" ) . dragInput ( { min : - 180 , max : 180 , step : 1 , callback : function ( h ) { e . setRotationAngle ( h . value , true ) ; rotateCursor ( h . value ) ; a ( "#tool_reorient" ) . toggleClass ( "disabled" , h . value == 0 ) } , cursor : false , dragAdjust : 0.5 } ) ; a ( "#font_size" ) . dragInput ( { min : 1 , max : 250 , step : 1 , callback : function ( h ) { e . setFontSize ( h . value ) } , cursor : true , stepfunc : function ( h , n ) { var q = h . value - 0 , u = q + n , E = u >= q ; if ( n === 0 ) return q ;
return q >= 24 ? E ? Math . round ( q * 1.1 ) : Math . round ( q / 1.1 ) : q <= 1 ? E ? q * 2 : q / 2 : u } , dragAdjust : 0.15 } ) ; a ( "#group_opacity" ) . dragInput ( { min : 0 , max : 100 , step : 5 , callback : changeAttribute , cursor : true , start : 100 } ) ; a ( "#blur" ) . dragInput ( { min : 0 , max : 10 , step : 0.1 , callback : function ( h , n ) { val = h . value ; a ( "#blur" ) . val ( val ) ; n ? e . setBlur ( val , true ) : e . setBlurNoUndo ( val ) } , cursor : true , start : 0 } ) ; a ( "#zoom" ) . val ( e . getZoom ( ) * 100 ) ; a ( "#workarea" ) . contextMenu ( { menu : "cmenu_canvas" , inSpeed : 0 } , function ( h ) { switch ( h ) { case "delete" : lb ( ) ; break ; case "cut" : Ua ( ) ;
break ; case "copy" : Xa ( ) ; break ; case "paste" : e . pasteElements ( ) ; break ; case "paste_in_place" : e . pasteElements ( "in_place" ) ; break ; case "group" : e . groupSelectedElements ( ) ; break ; case "ungroup" : e . ungroupSelectedElement ( ) ; break ; case "move_front" : sa ( ) ; break ; case "move_up" : ib ( "Up" ) ; break ; case "move_down" : ib ( "Down" ) ; break ; case "move_back" : hb ( ) ; break ; default : svgedit . contextmenu && svgedit . contextmenu . hasCustomHandler ( h ) && svgedit . contextmenu . getCustomHandler ( h ) . call ( ) } } ) ; a ( ".contextMenu li" ) . mousedown ( function ( h ) { h . preventDefault ( ) } ) ;
a ( "#cmenu_canvas li" ) . disableContextMenu ( ) ; I . enableContextMenuItems ( "#delete,#cut,#copy" ) ; window . onbeforeunload = function ( ) { if ( v . getUndoStackSize ( ) === 0 ) b . show _save _warning = false ; if ( ! curConfig . no _save _warning && b . show _save _warning ) return uiStrings . notification . unsavedChanges } ; b . openPrep = function ( h ) { a ( "#main_menu" ) . hide ( ) ; v . getUndoStackSize ( ) === 0 ? h ( true ) : a . confirm ( uiStrings . notification . QwantToOpen , h ) } ; if ( window . FileReader ) { d = function ( h ) { h . stopPropagation ( ) ; h . preventDefault ( ) ; a ( "#workarea" ) . removeAttr ( "style" ) ;
a ( "#main_menu" ) . hide ( ) ; var n = null ; if ( n = h . type == "drop" ? h . dataTransfer . files [ 0 ] : this . files [ 0 ] ) if ( n . type . indexOf ( "image" ) != - 1 ) if ( n . type . indexOf ( "svg" ) != - 1 ) { h = new FileReader ; h . onloadend = function ( q ) { e . importSvgString ( q . target . result , true ) ; e . ungroupSelectedElement ( ) ; e . ungroupSelectedElement ( ) ; e . groupSelectedElements ( ) ; e . alignSelectedElements ( "m" , "page" ) ; e . alignSelectedElements ( "c" , "page" ) } ; h . readAsText ( n ) } else { h = new FileReader ; h . onloadend = function ( q ) { insertNewImage = function ( J , O ) { var W = e . addSvgElementFromJson ( { element : "image" ,
attr : { x : 0 , y : 0 , width : J , height : O , id : e . getNextId ( ) , style : "pointer-events:inherit" } } ) ; e . setHref ( W , q . target . result ) ; e . selectOnly ( [ W ] ) ; e . alignSelectedElements ( "m" , "page" ) ; e . alignSelectedElements ( "c" , "page" ) ; Fa ( ) } ; var u = 100 , E = 100 , H = new Image ; H . src = q . target . result ; document . body . appendChild ( H ) ; H . onload = function ( ) { u = H . offsetWidth ; E = H . offsetHeight ; insertNewImage ( u , E ) ; document . body . removeChild ( H ) } } ; h . readAsDataURL ( n ) } } ; K = a ( "#workarea" ) ; K [ 0 ] . addEventListener ( "dragenter" , function ( h ) { h . stopPropagation ( ) ; h . preventDefault ( ) ;
K . css ( { "-webkit-transform" : "scale3d(1.1,1.1,1)" , "-moz-transform" : "scale3d(1.1,1.1,1)" , "-o-transform" : "scale(1.1)" , "-ms-transform" : "scale3d(1.1,1.1,1)" , transform : "scale3d(1.1,1.1,1)" } ) } , false ) ; K [ 0 ] . addEventListener ( "dragover" , function ( h ) { h . stopPropagation ( ) ; h . preventDefault ( ) } , false ) ; K [ 0 ] . addEventListener ( "dragleave" , function ( h ) { K . removeAttr ( "style" ) ; h . stopPropagation ( ) ; h . preventDefault ( ) } , false ) ; K [ 0 ] . addEventListener ( "drop" , d , false ) ; var A = a ( '<input type="file">' ) . change ( function ( ) { var h = this ; b . openPrep ( function ( n ) { if ( n ) { e . clear ( ) ;
if ( h . files . length == 1 ) { n = new FileReader ; n . onloadend = function ( q ) { o ( q . target . result ) ; G ( ) } ; n . readAsText ( h . files [ 0 ] ) } } } ) } ) ; a ( "#tool_open" ) . show ( ) . prepend ( A ) ; d = a ( '<input type="file">' ) . change ( d ) ; a ( "#tool_import" ) . show ( ) . prepend ( d ) } var G = b . updateCanvas = function ( h , n ) { var q = K . width ( ) , u = K . height ( ) , E = q , H = u , J = e . getZoom ( ) , O = K , W = a ( "#svgcanvas" ) , ca = { x : O [ 0 ] . scrollLeft + E / 2 , y : O [ 0 ] . scrollTop + H / 2 } , T = curConfig . canvas _expansion ; q = Math . max ( E , e . contentW * J * T ) ; u = Math . max ( H , e . contentH * J * T ) ; q == E && u == H ? K . css ( "overflow" , "hidden" ) :
K . css ( "overflow" , "scroll" ) ; T = W . height ( ) / 2 ; var fa = W . width ( ) / 2 ; W . width ( q ) . height ( u ) ; var ha = u / 2 , V = q / 2 , pa = e . updateCanvas ( q , u ) , ua = V / fa ; q = q / 2 - E / 2 ; u = u / 2 - H / 2 ; if ( n ) { n . x += pa . x ; n . y += pa . y } else n = { x : V + ( ca . x - fa ) * ua , y : ha + ( ca . y - T ) * ua } ; if ( h ) if ( e . contentW > O . width ( ) ) { K [ 0 ] . scrollLeft = pa . x - 10 ; K [ 0 ] . scrollTop = pa . y - 10 } else { O [ 0 ] . scrollLeft = q ; O [ 0 ] . scrollTop = u } else { O [ 0 ] . scrollLeft = n . x - E / 2 ; O [ 0 ] . scrollTop = n . y - H / 2 } if ( curConfig . showRulers ) { E = W ; J = J ; document . getElementById ( "workarea" ) ; document . getElementById ( "title_show" ) ; J || ( J =
e . getZoom ( ) ) ; E || ( E = a ( "#svgcanvas" ) ) ; H = e . getContentElem ( ) ; O = svgedit . units . getTypeMap ( ) [ curConfig . baseUnit ] ; for ( W = 0 ; W < 2 ; W ++ ) { fa = ( ca = W === 0 ) ? "x" : "y" ; ua = ca ? "width" : "height" ; T = H . getAttribute ( fa ) - 0 ; fa = a ( "#ruler_" + fa + " canvas:first" ) ; $hcanv = fa . clone ( ) ; fa . replaceWith ( $hcanv ) ; q = $hcanv [ 0 ] ; ha = fa = E [ ua ] ( ) * 2 ; q . parentNode . style [ ua ] = ha + "px" ; V = 0 ; var Aa ; pa = q . getContext ( "2d" ) ; pa . fillStyle = "rgb(200,0,0)" ; pa . fillRect ( 0 , 0 , q . width , q . height ) ; $hcanv . siblings ( ) . remove ( ) ; if ( fa >= 3E4 ) { var Ca = parseInt ( fa / 3E4 ) + 1 ; Aa = Array ( Ca ) ; Aa [ 0 ] =
pa ; for ( u = 1 ; u < Ca ; u ++ ) { q [ ua ] = 3E4 ; var Pa = q . cloneNode ( true ) ; q . parentNode . appendChild ( Pa ) ; Aa [ u ] = Pa . getContext ( "2d" ) } Pa [ ua ] = fa % 3E4 ; fa = 3E4 } q [ ua ] = fa ; ua = O * J ; var Qa = 50 / ua ; q = 1 ; for ( u = 0 ; u < D . length ; u ++ ) { q = Ca = D [ u ] ; if ( Qa <= Ca ) break } Qa = q * ua ; pa . font = "normal 9px 'Lucida Grande', sans-serif" ; pa . fillStyle = "#777" ; for ( var Na = T / ua % q * ua , jb = Na - Qa ; Na < ha ; Na += Qa ) { jb += Qa ; u = Math . round ( Na ) + 0.5 ; if ( ca ) { pa . moveTo ( u , 15 ) ; pa . lineTo ( u , 0 ) } else { pa . moveTo ( 15 , u ) ; pa . lineTo ( 0 , u ) } Ca = ( jb - T ) / ua ; if ( q >= 1 ) u = Math . round ( Ca ) ; else { u = ( q + "" ) . split ( "." ) [ 1 ] . length ;
u = Ca . toFixed ( u ) - 0 } if ( u !== 0 && u !== 1E3 && u % 1E3 === 0 ) u = u / 1E3 + "K" ; if ( ca ) { pa . fillText ( u , Na + 2 , 8 ) ; pa . fillStyle = "#777" } else { Ca = ( u + "" ) . split ( "" ) ; for ( u = 0 ; u < Ca . length ; u ++ ) { pa . fillText ( Ca [ u ] , 1 , Na + 9 + u * 9 ) ; pa . fillStyle = "#777" } } Ca = Qa / 10 ; for ( u = 1 ; u < 10 ; u ++ ) { var ub = Math . round ( Na + Ca * u ) + 0.5 ; if ( Aa && ub > fa ) { V ++ ; pa . stroke ( ) ; if ( V >= Aa . length ) { u = 10 ; Na = ha ; continue } pa = Aa [ V ] ; Na -= 3E4 ; ub = Math . round ( Na + Ca * u ) + 0.5 } var Cb = u % 2 ? 12 : 10 ; if ( ca ) { pa . moveTo ( ub , 15 ) ; pa . lineTo ( ub , Cb ) } else { pa . moveTo ( 15 , ub ) ; pa . lineTo ( Cb , ub ) } } } pa . strokeStyle = "#666" ; pa . stroke ( ) } K . scroll ( ) } } ,
D = [ ] ; for ( d = 0.1 ; d < 1E5 ; d *= 10 ) { D . push ( 1 * d ) ; D . push ( 2 * d ) ; D . push ( 5 * d ) } G ( true ) ; try { var z = function ( h ) { if ( window . JSON && JSON . stringify ) return JSON . stringify ( h ) ; var n = arguments . callee ; if ( typeof h == "boolean" || typeof h == "number" ) return h + "" ; else if ( typeof h == "string" ) return '"' + h . replace ( /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g , function ( E ) { return "\\u" + ( "0000" + E . charCodeAt ( 0 ) . toString ( 16 ) ) . slice ( - 4 ) } ) + '"' ; else if ( h . length ) { for ( var q =
0 ; q < h . length ; q ++ ) h [ q ] = n ( h [ q ] ) ; return "[" + h . join ( "," ) + "]" } else { q = [ ] ; for ( var u in h ) q . push ( n ( u ) + ":" + n ( h [ u ] ) ) ; return "{" + q . join ( "," ) + "}" } } ; window . addEventListener ( "message" , function ( h ) { var n = parseInt ( h . data . substr ( 0 , h . data . indexOf ( ";" ) ) ) ; try { h . source . postMessage ( "SVGe" + n + ";" + z ( eval ( h . data ) ) , "*" ) } catch ( q ) { h . source . postMessage ( "SVGe" + n + ";error:" + q . message , "*" ) } } , false ) } catch ( F ) { window . embed _error = F } a ( function ( ) { window . svgCanvas = e ; e . ready = methodDraw . ready } ) ; b . setLang = function ( h , n ) { a . pref ( "lang" , h ) ; a ( "#lang_select" ) . val ( h ) ;
if ( n ) { e . runExtensions ( "langChanged" , h ) ; ma ( ) ; a . each ( { "#stroke_color" : "#tool_stroke .icon_label, #tool_stroke .color_block" , "#fill_color" : "#tool_fill label, #tool_fill .color_block" , "#linejoin_miter" : "#cur_linejoin" , "#linecap_butt" : "#cur_linecap" } , function ( q , u ) { a ( u ) . attr ( "title" , a ( q ) [ 0 ] . title ) } ) ; a ( "#multiselected_panel div[id^=tool_align]" ) . each ( function ( ) { a ( "#tool_pos" + this . id . substr ( 10 ) ) [ 0 ] . title = this . title } ) } } } ; var g = [ ] ; b . ready = function ( d ) { l ? d ( ) : g . push ( d ) } ; b . runCallbacks = function ( ) { a . each ( g , function ( ) { this ( ) } ) ;
l = true } ; b . loadFromString = function ( d ) { b . ready ( function ( ) { o ( d ) } ) } ; b . loadFromURL = function ( d , p ) { p || ( p = { } ) ; var w = p . cache , B = p . callback ; b . ready ( function ( ) { a . ajax ( { url : d , dataType : "text" , cache : ! ! w , success : function ( v ) { o ( v , B ) } , error : function ( v , N , Q ) { v . status != 404 && v . responseText ? o ( v . responseText , B ) : a . alert ( uiStrings . notification . URLloadFail + ": \n" + Q + "" , B ) } } ) } ) } ; b . loadFromDataURI = function ( d ) { b . ready ( function ( ) { var p = d . substring ( 26 ) ; o ( svgedit . utilities . decode64 ( p ) ) } ) } ; b . addExtension = function ( ) { var d = arguments ;
a ( function ( ) { e && e . addExtension . apply ( this , d ) } ) } ; return b } ( jQuery ) ; $ ( methodDraw . init ) } ) ( ) ; $ . fn . dragInput = function ( a ) { return this . each ( function ( ) { this . repeating = false ; this . dragCfg = { min : a && ! isNaN ( parseFloat ( a . min ) ) ? Number ( a . min ) : null , max : a && ! isNaN ( parseFloat ( a . max ) ) ? Number ( a . max ) : null , step : a && Number ( a . step ) ? a . step : 1 , stepfunc : a && a . stepfunc ? a . stepfunc : false , dragAdjust : a && a . dragAdjust ? a . dragAdjust : 1 , height : 70 , cursor : a && a . cursor ? Boolean ( a . cursor ) : false , start : a && a . start ? Number ( a . start ) : 0 , _btn _width : 20 , _direction : null , _delay : null , _repeat : null , callback : a && a . callback ? a . callback : null } ; this . dragCfg . smallStep =
a && a . smallStep ? a . smallStep : this . dragCfg . step / 2 ; var o = this . dragCfg . dragAdjust , e = $ ( this ) . parent ( ) , b = $ ( this ) , l = this . dragCfg . height , s = this . dragCfg . min , c = this . dragCfg . max , g = this . dragCfg . step , d = c - s > 0 ? ( c - s ) / g : 200 , p = d / l * g , w = 0 , B = this . getAttribute ( "data-attr" ) , v = methodDraw . canvas , N = svgedit . browser . isTouch ( ) , Q = true , K = d && this . dragCfg . cursor ? $ ( "<div class='draginput_cursor' />" ) . appendTo ( e ) : false ; b . attr ( "readonly" , "readonly" ) ; K && ! isNaN ( this . dragCfg . start ) && K . css ( "top" , this . dragCfg . start * - 1 / p + l ) ; this . adjustValue =
function ( I , S ) { var R ; I = parseFloat ( I ) ; R = isNaN ( this . value ) ? this . dragCfg . reset : $ . isFunction ( this . dragCfg . stepfunc ) ? this . dragCfg . stepfunc ( this , I ) : Number ( ( Number ( this . value ) + Number ( I ) ) . toFixed ( 5 ) ) ; if ( c !== null ) R = Math . min ( R , c ) ; if ( s !== null ) R = Math . max ( R , s ) ; K && this . updateCursor ( R ) ; this . value = R ; e . attr ( "data-value" , R ) ; $ . isFunction ( this . dragCfg . callback ) && this . dragCfg . callback ( this , S ) } ; e . toggleClass ( "draginput" , e . is ( "label" ) ) ; this . move = function ( I , S , R ) { if ( N ) I = I . originalEvent . touches [ 0 ] ; if ( w === 0 ) w = S ; S = ( I . pageY - w ) *
- 1 ; w = I . pageY ; R = S * p * o ; this . adjustValue ( R . toFixed ( g < 1 ? 1 : 0 ) ) } ; this . stop = function ( ) { var I = v . getSelectedElems ( ) ; $ ( "body" ) . removeClass ( "dragging" ) ; e . removeClass ( "active" ) ; Q = true ; $ ( window ) . unbind ( "mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput" ) ; w = 0 ; if ( I [ 0 ] ) { I = v . undoMgr . finishUndoableChange ( ) ; I . isEmpty ( ) || v . undoMgr . addCommandToHistory ( I ) } this . adjustValue ( 0 , Q ) } ; this . updateCursor = function ( ) { var I = parseFloat ( this . value ) * - 1 / p + l ; K . css ( "top" , I ) } ; this . launch = function ( I ) { var S = v . getSelectedElems ( ) ;
if ( N ) I = I . originalEvent . touches [ 0 ] ; var R = I . pageY , L = this . value , Z = this ; v . undoMgr . beginUndoableChange ( B , S ) ; $ ( "body" ) . addClass ( "dragging" ) ; e . addClass ( "active" ) ; $ ( window ) . bind ( "mousemove.draginput touchmove.draginput" , function ( qa ) { Z . move ( qa , R , parseFloat ( L ) ) } ) ; $ ( window ) . bind ( "mouseup.draginput touchend.draginput" , function ( ) { Z . stop ( ) } ) } ; $ ( this ) . attr ( "readonly" , "readonly" ) . attr ( "data-scale" , p ) . attr ( "data-domain" , l ) . attr ( "data-cursor" , K != false ) . bind ( "mousedown touchstart" , function ( I ) { this . blur ( ) ; this . launch ( I ) } ) . bind ( "dblclick taphold" ,
function ( ) { this . removeAttribute ( "readonly" , "readonly" ) ; this . focus ( ) ; this . select ( ) } ) . keydown ( function ( I ) { switch ( I . keyCode ) { case 13 : this . adjustValue ( 0 ) ; this . blur ( ) } } ) . focus ( function ( ) { this . getAttribute ( "readonly" ) === "readonly" && this . blur ( ) } ) . blur ( function ( ) { this . setAttribute ( "readonly" , "readonly" ) } ) . bind ( "mousewheel" , function ( I , S , R , L ) { S = v . getSelectedElems ( ) ; Q && v . undoMgr . beginUndoableChange ( B , S ) ; Q = false ; clearTimeout ( window . undoTimeout ) ; window . undoTimeout = setTimeout ( function ( ) { Z . stop ( ) } , 200 ) ; var Z = this ;
if ( L > 0 ) this . adjustValue ( this . dragCfg . step ) ; else L < 0 && this . adjustValue ( - this . dragCfg . step ) ; I . preventDefault ( ) } ) } ) } ; $ . fn . dragInput . updateCursor = function ( a ) { var o = parseFloat ( a . value ) , e = parseFloat ( a . getAttribute ( "data-scale" ) ) , b = parseFloat ( a . getAttribute ( "data-domain" ) ) ; o = o * - 1 / e + b + "px" ; a = a . parentNode . lastChild ; if ( a . className == "draginput_cursor" ) a . style . top = o } ; svgedit = svgedit || { } ;
( function ( ) { var a = this ; if ( ! svgedit . contextmenu ) svgedit . contextmenu = { } ; a . contextMenuExtensions = { } ; methodDraw . ready ( function ( ) { for ( menuItem in contextMenuExtensions ) { var o = contextMenuExtensions [ menuItem ] ; Object . keys ( a . contextMenuExtensions ) . length == 0 && $ ( "#cmenu_canvas" ) . append ( "<li class='separator'>" ) ; var e = o . shortcut || "" ; $ ( "#cmenu_canvas" ) . append ( "<li class='disabled'><a href='#" + o . id + "'>" + o . label + "<span class='shortcut'>" + e + "</span></a></li>" ) } } ) ; svgedit . contextmenu . resetCustomMenus = function ( ) { a . contextMenuExtensions =
{ } } ; svgedit . contextmenu . add = function ( o ) { if ( o && o . id && o . label && o . action && typeof o . action == "function" ) if ( o . id in a . contextMenuExtensions ) console . error ( 'Cannot add extension "' + o . id + '", an extension by that name already exists"' ) ; else { console . log ( "Registed contextmenu item: {id:" + o . id + ", label:" + o . label + "}" ) ; a . contextMenuExtensions [ o . id ] = o } else console . error ( "Menu items must be defined and have at least properties: id, label, action, where action must be a function" ) } ; svgedit . contextmenu . hasCustomHandler =
function ( o ) { return a . contextMenuExtensions [ o ] && true } ; svgedit . contextmenu . getCustomHandler = function ( o ) { return a . contextMenuExtensions [ o ] . action } } ) ( ) ; ( function ( a , o ) { function e ( l ) { return ! a ( l ) . parents ( ) . andSelf ( ) . filter ( function ( ) { return a . curCSS ( this , "visibility" ) === "hidden" || a . expr . filters . hidden ( this ) } ) . length } function b ( l , s ) { var c = l . nodeName . toLowerCase ( ) ; if ( "area" === c ) { c = l . parentNode ; var g = c . name ; if ( ! l . href || ! g || c . nodeName . toLowerCase ( ) !== "map" ) return false ; c = a ( "img[usemap=#" + g + "]" ) [ 0 ] ; return ! ! c && e ( c ) } return ( /input|select|textarea|button|object/ . test ( c ) ? ! l . disabled : "a" == c ? l . href || s : s ) && e ( l ) } a . ui = a . ui || { } ; a . ui . version || ( a . extend ( a . ui , { version : "1.8.17" ,
keyCode : { ALT : 18 , BACKSPACE : 8 , CAPS _LOCK : 20 , COMMA : 188 , COMMAND : 91 , COMMAND _LEFT : 91 , COMMAND _RIGHT : 93 , CONTROL : 17 , DELETE : 46 , DOWN : 40 , END : 35 , ENTER : 13 , ESCAPE : 27 , HOME : 36 , INSERT : 45 , LEFT : 37 , MENU : 93 , NUMPAD _ADD : 107 , NUMPAD _DECIMAL : 110 , NUMPAD _DIVIDE : 111 , NUMPAD _ENTER : 108 , NUMPAD _MULTIPLY : 106 , NUMPAD _SUBTRACT : 109 , PAGE _DOWN : 34 , PAGE _UP : 33 , PERIOD : 190 , RIGHT : 39 , SHIFT : 16 , SPACE : 32 , TAB : 9 , UP : 38 , WINDOWS : 91 } } ) , a . fn . extend ( { propAttr : a . fn . prop || a . fn . attr , _focus : a . fn . focus , focus : function ( l , s ) { return typeof l == "number" ? this . each ( function ( ) { var c =
this ; setTimeout ( function ( ) { a ( c ) . focus ( ) ; s && s . call ( c ) } , l ) } ) : this . _focus . apply ( this , arguments ) } , scrollParent : function ( ) { var l ; a . browser . msie && /(static|relative)/ . test ( this . css ( "position" ) ) || /absolute/ . test ( this . css ( "position" ) ) ? l = this . parents ( ) . filter ( function ( ) { return /(relative|absolute|fixed)/ . test ( a . curCSS ( this , "position" , 1 ) ) && /(auto|scroll)/ . test ( a . curCSS ( this , "overflow" , 1 ) + a . curCSS ( this , "overflow-y" , 1 ) + a . curCSS ( this , "overflow-x" , 1 ) ) } ) . eq ( 0 ) : l = this . parents ( ) . filter ( function ( ) { return /(auto|scroll)/ . test ( a . curCSS ( this ,
"overflow" , 1 ) + a . curCSS ( this , "overflow-y" , 1 ) + a . curCSS ( this , "overflow-x" , 1 ) ) } ) . eq ( 0 ) ; return /fixed/ . test ( this . css ( "position" ) ) || ! l . length ? a ( document ) : l } , zIndex : function ( l ) { if ( l !== o ) return this . css ( "zIndex" , l ) ; if ( this . length ) { l = a ( this [ 0 ] ) ; for ( var s ; l . length && l [ 0 ] !== document ; ) { s = l . css ( "position" ) ; if ( s === "absolute" || s === "relative" || s === "fixed" ) { s = parseInt ( l . css ( "zIndex" ) , 10 ) ; if ( ! isNaN ( s ) && s !== 0 ) return s } l = l . parent ( ) } } return 0 } , disableSelection : function ( ) { return this . bind ( ( a . support . selectstart ? "selectstart" :
"mousedown" ) + ".ui-disableSelection" , function ( l ) { l . preventDefault ( ) } ) } , enableSelection : function ( ) { return this . unbind ( ".ui-disableSelection" ) } } ) , a . each ( [ "Width" , "Height" ] , function ( l , s ) { function c ( w , B , v , N ) { a . each ( g , function ( ) { B -= parseFloat ( a . curCSS ( w , "padding" + this , true ) ) || 0 ; v && ( B -= parseFloat ( a . curCSS ( w , "border" + this + "Width" , true ) ) || 0 ) ; N && ( B -= parseFloat ( a . curCSS ( w , "margin" + this , true ) ) || 0 ) } ) ; return B } var g = s === "Width" ? [ "Left" , "Right" ] : [ "Top" , "Bottom" ] , d = s . toLowerCase ( ) , p = { innerWidth : a . fn . innerWidth , innerHeight : a . fn . innerHeight ,
outerWidth : a . fn . outerWidth , outerHeight : a . fn . outerHeight } ; a . fn [ "inner" + s ] = function ( w ) { if ( w === o ) return p [ "inner" + s ] . call ( this ) ; return this . each ( function ( ) { a ( this ) . css ( d , c ( this , w ) + "px" ) } ) } ; a . fn [ "outer" + s ] = function ( w , B ) { if ( typeof w != "number" ) return p [ "outer" + s ] . call ( this , w ) ; return this . each ( function ( ) { a ( this ) . css ( d , c ( this , w , true , B ) + "px" ) } ) } } ) , a . extend ( a . expr [ ":" ] , { data : function ( l , s , c ) { return ! ! a . data ( l , c [ 3 ] ) } , focusable : function ( l ) { return b ( l , ! isNaN ( a . attr ( l , "tabindex" ) ) ) } , tabbable : function ( l ) { var s = a . attr ( l ,
"tabindex" ) , c = isNaN ( s ) ; return ( c || s >= 0 ) && b ( l , ! c ) } } ) , a ( function ( ) { var l = document . body , s = l . appendChild ( s = document . createElement ( "div" ) ) ; a . extend ( s . style , { minHeight : "100px" , height : "auto" , padding : 0 , borderWidth : 0 } ) ; a . support . minHeight = s . offsetHeight === 100 ; a . support . selectstart = "onselectstart" in s ; l . removeChild ( s ) . style . display = "none" } ) , a . extend ( a . ui , { plugin : { add : function ( l , s , c ) { l = a . ui [ l ] . prototype ; for ( var g in c ) { l . plugins [ g ] = l . plugins [ g ] || [ ] ; l . plugins [ g ] . push ( [ s , c [ g ] ] ) } } , call : function ( l , s , c ) { if ( ( s = l . plugins [ s ] ) &&
l . element [ 0 ] . parentNode ) for ( var g = 0 ; g < s . length ; g ++ ) l . options [ s [ g ] [ 0 ] ] && s [ g ] [ 1 ] . apply ( l . element , c ) } } , contains : function ( l , s ) { return document . compareDocumentPosition ? l . compareDocumentPosition ( s ) & 16 : l !== s && l . contains ( s ) } , hasScroll : function ( l , s ) { if ( a ( l ) . css ( "overflow" ) === "hidden" ) return false ; var c = s && s === "left" ? "scrollLeft" : "scrollTop" , g = false ; if ( l [ c ] > 0 ) return true ; l [ c ] = 1 ; g = l [ c ] > 0 ; l [ c ] = 0 ; return g } , isOverAxis : function ( l , s , c ) { return l > s && l < s + c } , isOver : function ( l , s , c , g , d , p ) { return a . ui . isOverAxis ( l , c , d ) &&
a . ui . isOverAxis ( s , g , p ) } } ) ) } ) ( jQuery ) ;
( function ( a , o ) { if ( a . cleanData ) { var e = a . cleanData ; a . cleanData = function ( l ) { for ( var s = 0 , c ; ( c = l [ s ] ) != null ; s ++ ) try { a ( c ) . triggerHandler ( "remove" ) } catch ( g ) { } e ( l ) } } else { var b = a . fn . remove ; a . fn . remove = function ( l , s ) { return this . each ( function ( ) { s || ( ! l || a . filter ( l , [ this ] ) . length ) && a ( "*" , this ) . add ( [ this ] ) . each ( function ( ) { try { a ( this ) . triggerHandler ( "remove" ) } catch ( c ) { } } ) ; return b . call ( a ( this ) , l , s ) } ) } } a . widget = function ( l , s , c ) { var g = l . split ( "." ) [ 0 ] , d ; l = l . split ( "." ) [ 1 ] ; d = g + "-" + l ; c || ( c = s , s = a . Widget ) ; a . expr [ ":" ] [ d ] =
function ( p ) { return ! ! a . data ( p , l ) } ; a [ g ] = a [ g ] || { } ; a [ g ] [ l ] = function ( p , w ) { arguments . length && this . _createWidget ( p , w ) } ; s = new s ; s . options = a . extend ( true , { } , s . options ) ; a [ g ] [ l ] . prototype = a . extend ( true , s , { namespace : g , widgetName : l , widgetEventPrefix : a [ g ] [ l ] . prototype . widgetEventPrefix || l , widgetBaseClass : d } , c ) ; a . widget . bridge ( l , a [ g ] [ l ] ) } ; a . widget . bridge = function ( l , s ) { a . fn [ l ] = function ( c ) { var g = typeof c == "string" , d = Array . prototype . slice . call ( arguments , 1 ) , p = this ; c = ! g && d . length ? a . extend . apply ( null , [ true , c ] . concat ( d ) ) :
c ; if ( g && c . charAt ( 0 ) === "_" ) return p ; g ? this . each ( function ( ) { var w = a . data ( this , l ) , B = w && a . isFunction ( w [ c ] ) ? w [ c ] . apply ( w , d ) : w ; if ( B !== w && B !== o ) { p = B ; return false } } ) : this . each ( function ( ) { var w = a . data ( this , l ) ; w ? w . option ( c || { } ) . _init ( ) : a . data ( this , l , new s ( c , this ) ) } ) ; return p } } ; a . Widget = function ( l , s ) { arguments . length && this . _createWidget ( l , s ) } ; a . Widget . prototype = { widgetName : "widget" , widgetEventPrefix : "" , options : { disabled : false } , _createWidget : function ( l , s ) { a . data ( s , this . widgetName , this ) ; this . element = a ( s ) ; this . options =
a . extend ( true , { } , this . options , this . _getCreateOptions ( ) , l ) ; var c = this ; this . element . bind ( "remove." + this . widgetName , function ( ) { c . destroy ( ) } ) ; this . _create ( ) ; this . _trigger ( "create" ) ; this . _init ( ) } , _getCreateOptions : function ( ) { return a . metadata && a . metadata . get ( this . element [ 0 ] ) [ this . widgetName ] } , _create : function ( ) { } , _init : function ( ) { } , destroy : function ( ) { this . element . unbind ( "." + this . widgetName ) . removeData ( this . widgetName ) ; this . widget ( ) . unbind ( "." + this . widgetName ) . removeAttr ( "aria-disabled" ) . removeClass ( this . widgetBaseClass +
"-disabled ui-state-disabled" ) } , widget : function ( ) { return this . element } , option : function ( l , s ) { var c = l ; if ( arguments . length === 0 ) return a . extend ( { } , this . options ) ; if ( typeof l == "string" ) { if ( s === o ) return this . options [ l ] ; c = { } ; c [ l ] = s } this . _setOptions ( c ) ; return this } , _setOptions : function ( l ) { var s = this ; a . each ( l , function ( c , g ) { s . _setOption ( c , g ) } ) ; return this } , _setOption : function ( l , s ) { this . options [ l ] = s ; l === "disabled" && this . widget ( ) [ s ? "addClass" : "removeClass" ] ( this . widgetBaseClass + "-disabled ui-state-disabled" ) . attr ( "aria-disabled" ,
s ) ; return this } , enable : function ( ) { return this . _setOption ( "disabled" , false ) } , disable : function ( ) { return this . _setOption ( "disabled" , true ) } , _trigger : function ( l , s , c ) { var g , d = this . options [ l ] ; c = c || { } ; s = a . Event ( s ) ; s . type = ( l === this . widgetEventPrefix ? l : this . widgetEventPrefix + l ) . toLowerCase ( ) ; s . target = this . element [ 0 ] ; if ( l = s . originalEvent ) for ( g in l ) g in s || ( s [ g ] = l [ g ] ) ; this . element . trigger ( s , c ) ; return ! ( a . isFunction ( d ) && d . call ( this . element [ 0 ] , s , c ) === false || s . isDefaultPrevented ( ) ) } } } ) ( jQuery ) ;
( function ( a ) { var o = false ; a ( document ) . mouseup ( function ( ) { o = false } ) ; a . widget ( "ui.mouse" , { options : { cancel : ":input,option" , distance : 1 , delay : 0 } , _mouseInit : function ( ) { var e = this ; this . element . bind ( "mousedown." + this . widgetName , function ( b ) { return e . _mouseDown ( b ) } ) . bind ( "click." + this . widgetName , function ( b ) { if ( true === a . data ( b . target , e . widgetName + ".preventClickEvent" ) ) { a . removeData ( b . target , e . widgetName + ".preventClickEvent" ) ; b . stopImmediatePropagation ( ) ; return false } } ) ; this . started = false } , _mouseDestroy : function ( ) { this . element . unbind ( "." +
this . widgetName ) } , _mouseDown : function ( e ) { if ( ! o ) { this . _mouseStarted && this . _mouseUp ( e ) ; this . _mouseDownEvent = e ; var b = this , l = e . which == 1 , s = typeof this . options . cancel == "string" && e . target . nodeName ? a ( e . target ) . closest ( this . options . cancel ) . length : false ; if ( ! l || s || ! this . _mouseCapture ( e ) ) return true ; ( this . mouseDelayMet = ! this . options . delay ) || ( this . _mouseDelayTimer = setTimeout ( function ( ) { b . mouseDelayMet = true } , this . options . delay ) ) ; if ( this . _mouseDistanceMet ( e ) && this . _mouseDelayMet ( e ) ) { this . _mouseStarted = this . _mouseStart ( e ) !==
false ; if ( ! this . _mouseStarted ) { e . preventDefault ( ) ; return true } } true === a . data ( e . target , this . widgetName + ".preventClickEvent" ) && a . removeData ( e . target , this . widgetName + ".preventClickEvent" ) ; this . _mouseMoveDelegate = function ( c ) { return b . _mouseMove ( c ) } ; this . _mouseUpDelegate = function ( c ) { return b . _mouseUp ( c ) } ; a ( document ) . bind ( "mousemove." + this . widgetName , this . _mouseMoveDelegate ) . bind ( "mouseup." + this . widgetName , this . _mouseUpDelegate ) ; e . preventDefault ( ) ; return o = true } } , _mouseMove : function ( e ) { if ( a . browser . msie &&
! ( document . documentMode >= 9 ) && ! e . button ) return this . _mouseUp ( e ) ; if ( this . _mouseStarted ) { this . _mouseDrag ( e ) ; return e . preventDefault ( ) } this . _mouseDistanceMet ( e ) && this . _mouseDelayMet ( e ) && ( this . _mouseStarted = this . _mouseStart ( this . _mouseDownEvent , e ) !== false , this . _mouseStarted ? this . _mouseDrag ( e ) : this . _mouseUp ( e ) ) ; return ! this . _mouseStarted } , _mouseUp : function ( e ) { a ( document ) . unbind ( "mousemove." + this . widgetName , this . _mouseMoveDelegate ) . unbind ( "mouseup." + this . widgetName , this . _mouseUpDelegate ) ; this . _mouseStarted &&
( this . _mouseStarted = false , e . target == this . _mouseDownEvent . target && a . data ( e . target , this . widgetName + ".preventClickEvent" , true ) , this . _mouseStop ( e ) ) ; return false } , _mouseDistanceMet : function ( e ) { return Math . max ( Math . abs ( this . _mouseDownEvent . pageX - e . pageX ) , Math . abs ( this . _mouseDownEvent . pageY - e . pageY ) ) >= this . options . distance } , _mouseDelayMet : function ( ) { return this . mouseDelayMet } , _mouseStart : function ( ) { } , _mouseDrag : function ( ) { } , _mouseStop : function ( ) { } , _mouseCapture : function ( ) { return true } } ) } ) ( jQuery ) ;
( function ( a ) { a . widget ( "ui.draggable" , a . ui . mouse , { widgetEventPrefix : "drag" , options : { addClasses : true , appendTo : "parent" , axis : false , connectToSortable : false , containment : false , cursor : "auto" , cursorAt : false , grid : false , handle : false , helper : "original" , iframeFix : false , opacity : false , refreshPositions : false , revert : false , revertDuration : 500 , scope : "default" , scroll : true , scrollSensitivity : 20 , scrollSpeed : 20 , snap : false , snapMode : "both" , snapTolerance : 20 , stack : false , zIndex : false } , _create : function ( ) { this . options . helper == "original" &&
! /^(?:r|a|f)/ . test ( this . element . css ( "position" ) ) && ( this . element [ 0 ] . style . position = "relative" ) ; this . options . addClasses && this . element . addClass ( "ui-draggable" ) ; this . options . disabled && this . element . addClass ( "ui-draggable-disabled" ) ; this . _mouseInit ( ) } , destroy : function ( ) { if ( this . element . data ( "draggable" ) ) { this . element . removeData ( "draggable" ) . unbind ( ".draggable" ) . removeClass ( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ) ; this . _mouseDestroy ( ) ; return this } } , _mouseCapture : function ( o ) { var e = this . options ;
if ( this . helper || e . disabled || a ( o . target ) . is ( ".ui-resizable-handle" ) ) return false ; this . handle = this . _getHandle ( o ) ; if ( ! this . handle ) return false ; e . iframeFix && a ( e . iframeFix === true ? "iframe" : e . iframeFix ) . each ( function ( ) { a ( '<div class="ui-draggable-iframeFix" style="background: #fff;"></div>' ) . css ( { width : this . offsetWidth + "px" , height : this . offsetHeight + "px" , position : "absolute" , opacity : "0.001" , zIndex : 1E3 } ) . css ( a ( this ) . offset ( ) ) . appendTo ( "body" ) } ) ; return true } , _mouseStart : function ( o ) { var e = this . options ; this . helper =
this . _createHelper ( o ) ; this . _cacheHelperProportions ( ) ; a . ui . ddmanager && ( a . ui . ddmanager . current = this ) ; this . _cacheMargins ( ) ; this . cssPosition = this . helper . css ( "position" ) ; this . scrollParent = this . helper . scrollParent ( ) ; this . offset = this . positionAbs = this . element . offset ( ) ; this . offset = { top : this . offset . top - this . margins . top , left : this . offset . left - this . margins . left } ; a . extend ( this . offset , { click : { left : o . pageX - this . offset . left , top : o . pageY - this . offset . top } , parent : this . _getParentOffset ( ) , relative : this . _getRelativeOffset ( ) } ) ;
this . originalPosition = this . position = this . _generatePosition ( o ) ; this . originalPageX = o . pageX ; this . originalPageY = o . pageY ; e . cursorAt && this . _adjustOffsetFromHelper ( e . cursorAt ) ; e . containment && this . _setContainment ( ) ; if ( this . _trigger ( "start" , o ) === false ) { this . _clear ( ) ; return false } this . _cacheHelperProportions ( ) ; a . ui . ddmanager && ! e . dropBehaviour && a . ui . ddmanager . prepareOffsets ( this , o ) ; this . helper . addClass ( "ui-draggable-dragging" ) ; this . _mouseDrag ( o , true ) ; a . ui . ddmanager && a . ui . ddmanager . dragStart ( this , o ) ; return true } ,
_mouseDrag : function ( o , e ) { this . position = this . _generatePosition ( o ) ; this . positionAbs = this . _convertPositionTo ( "absolute" ) ; if ( ! e ) { var b = this . _uiHash ( ) ; if ( this . _trigger ( "drag" , o , b ) === false ) { this . _mouseUp ( { } ) ; return false } this . position = b . position } if ( ! this . options . axis || this . options . axis != "y" ) this . helper [ 0 ] . style . left = this . position . left + "px" ; if ( ! this . options . axis || this . options . axis != "x" ) this . helper [ 0 ] . style . top = this . position . top + "px" ; a . ui . ddmanager && a . ui . ddmanager . drag ( this , o ) ; return false } , _mouseStop : function ( o ) { var e =
false ; a . ui . ddmanager && ! this . options . dropBehaviour && ( e = a . ui . ddmanager . drop ( this , o ) ) ; this . dropped && ( e = this . dropped , this . dropped = false ) ; if ( ( ! this . element [ 0 ] || ! this . element [ 0 ] . parentNode ) && this . options . helper == "original" ) return false ; if ( this . options . revert == "invalid" && ! e || this . options . revert == "valid" && e || this . options . revert === true || a . isFunction ( this . options . revert ) && this . options . revert . call ( this . element , e ) ) { var b = this ; a ( this . helper ) . animate ( this . originalPosition , parseInt ( this . options . revertDuration , 10 ) ,
function ( ) { b . _trigger ( "stop" , o ) !== false && b . _clear ( ) } ) } else this . _trigger ( "stop" , o ) !== false && this . _clear ( ) ; return false } , _mouseUp : function ( o ) { this . options . iframeFix === true && a ( "div.ui-draggable-iframeFix" ) . each ( function ( ) { this . parentNode . removeChild ( this ) } ) ; a . ui . ddmanager && a . ui . ddmanager . dragStop ( this , o ) ; return a . ui . mouse . prototype . _mouseUp . call ( this , o ) } , cancel : function ( ) { this . helper . is ( ".ui-draggable-dragging" ) ? this . _mouseUp ( { } ) : this . _clear ( ) ; return this } , _getHandle : function ( o ) { var e = ! this . options . handle ||
! a ( this . options . handle , this . element ) . length ? true : false ; a ( this . options . handle , this . element ) . find ( "*" ) . andSelf ( ) . each ( function ( ) { this == o . target && ( e = true ) } ) ; return e } , _createHelper : function ( o ) { var e = this . options ; o = a . isFunction ( e . helper ) ? a ( e . helper . apply ( this . element [ 0 ] , [ o ] ) ) : e . helper == "clone" ? this . element . clone ( ) . removeAttr ( "id" ) : this . element ; o . parents ( "body" ) . length || o . appendTo ( e . appendTo == "parent" ? this . element [ 0 ] . parentNode : e . appendTo ) ; o [ 0 ] != this . element [ 0 ] && ! /(fixed|absolute)/ . test ( o . css ( "position" ) ) &&
o . css ( "position" , "absolute" ) ; return o } , _adjustOffsetFromHelper : function ( o ) { typeof o == "string" && ( o = o . split ( " " ) ) ; a . isArray ( o ) && ( o = { left : + o [ 0 ] , top : + o [ 1 ] || 0 } ) ; "left" in o && ( this . offset . click . left = o . left + this . margins . left ) ; "right" in o && ( this . offset . click . left = this . helperProportions . width - o . right + this . margins . left ) ; "top" in o && ( this . offset . click . top = o . top + this . margins . top ) ; "bottom" in o && ( this . offset . click . top = this . helperProportions . height - o . bottom + this . margins . top ) } , _getParentOffset : function ( ) { this . offsetParent =
this . helper . offsetParent ( ) ; var o = this . offsetParent . offset ( ) ; this . cssPosition == "absolute" && this . scrollParent [ 0 ] != document && a . ui . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) && ( o . left += this . scrollParent . scrollLeft ( ) , o . top += this . scrollParent . scrollTop ( ) ) ; if ( this . offsetParent [ 0 ] == document . body || this . offsetParent [ 0 ] . tagName && this . offsetParent [ 0 ] . tagName . toLowerCase ( ) == "html" && a . browser . msie ) o = { top : 0 , left : 0 } ; return { top : o . top + ( parseInt ( this . offsetParent . css ( "borderTopWidth" ) , 10 ) || 0 ) , left : o . left + ( parseInt ( this . offsetParent . css ( "borderLeftWidth" ) ,
10 ) || 0 ) } } , _getRelativeOffset : function ( ) { if ( this . cssPosition == "relative" ) { var o = this . element . position ( ) ; return { top : o . top - ( parseInt ( this . helper . css ( "top" ) , 10 ) || 0 ) + this . scrollParent . scrollTop ( ) , left : o . left - ( parseInt ( this . helper . css ( "left" ) , 10 ) || 0 ) + this . scrollParent . scrollLeft ( ) } } return { top : 0 , left : 0 } } , _cacheMargins : function ( ) { this . margins = { left : parseInt ( this . element . css ( "marginLeft" ) , 10 ) || 0 , top : parseInt ( this . element . css ( "marginTop" ) , 10 ) || 0 , right : parseInt ( this . element . css ( "marginRight" ) , 10 ) || 0 , bottom : parseInt ( this . element . css ( "marginBottom" ) ,
10 ) || 0 } } , _cacheHelperProportions : function ( ) { this . helperProportions = { width : this . helper . outerWidth ( ) , height : this . helper . outerHeight ( ) } } , _setContainment : function ( ) { var o = this . options ; o . containment == "parent" && ( o . containment = this . helper [ 0 ] . parentNode ) ; if ( o . containment == "document" || o . containment == "window" ) this . containment = [ o . containment == "document" ? 0 : a ( window ) . scrollLeft ( ) - this . offset . relative . left - this . offset . parent . left , o . containment == "document" ? 0 : a ( window ) . scrollTop ( ) - this . offset . relative . top - this . offset . parent . top ,
( o . containment == "document" ? 0 : a ( window ) . scrollLeft ( ) ) + a ( o . containment == "document" ? document : window ) . width ( ) - this . helperProportions . width - this . margins . left , ( o . containment == "document" ? 0 : a ( window ) . scrollTop ( ) ) + ( a ( o . containment == "document" ? document : window ) . height ( ) || document . body . parentNode . scrollHeight ) - this . helperProportions . height - this . margins . top ] ; if ( ! /^(document|window|parent)$/ . test ( o . containment ) && o . containment . constructor != Array ) { o = a ( o . containment ) ; var e = o [ 0 ] ; if ( e ) { o . offset ( ) ; var b = a ( e ) . css ( "overflow" ) !=
"hidden" ; this . containment = [ ( parseInt ( a ( e ) . css ( "borderLeftWidth" ) , 10 ) || 0 ) + ( parseInt ( a ( e ) . css ( "paddingLeft" ) , 10 ) || 0 ) , ( parseInt ( a ( e ) . css ( "borderTopWidth" ) , 10 ) || 0 ) + ( parseInt ( a ( e ) . css ( "paddingTop" ) , 10 ) || 0 ) , ( b ? Math . max ( e . scrollWidth , e . offsetWidth ) : e . offsetWidth ) - ( parseInt ( a ( e ) . css ( "borderLeftWidth" ) , 10 ) || 0 ) - ( parseInt ( a ( e ) . css ( "paddingRight" ) , 10 ) || 0 ) - this . helperProportions . width - this . margins . left - this . margins . right , ( b ? Math . max ( e . scrollHeight , e . offsetHeight ) : e . offsetHeight ) - ( parseInt ( a ( e ) . css ( "borderTopWidth" ) ,
10 ) || 0 ) - ( parseInt ( a ( e ) . css ( "paddingBottom" ) , 10 ) || 0 ) - this . helperProportions . height - this . margins . top - this . margins . bottom ] ; this . relative _container = o } } else o . containment . constructor == Array && ( this . containment = o . containment ) } , _convertPositionTo : function ( o , e ) { e || ( e = this . position ) ; var b = o == "absolute" ? 1 : - 1 , l = this . cssPosition == "absolute" && ( this . scrollParent [ 0 ] == document || ! a . ui . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) ? this . offsetParent : this . scrollParent , s = /(html|body)/i . test ( l [ 0 ] . tagName ) ; return { top : e . top +
this . offset . relative . top * b + this . offset . parent . top * b - ( a . browser . safari && a . browser . version < 526 && this . cssPosition == "fixed" ? 0 : ( this . cssPosition == "fixed" ? - this . scrollParent . scrollTop ( ) : s ? 0 : l . scrollTop ( ) ) * b ) , left : e . left + this . offset . relative . left * b + this . offset . parent . left * b - ( a . browser . safari && a . browser . version < 526 && this . cssPosition == "fixed" ? 0 : ( this . cssPosition == "fixed" ? - this . scrollParent . scrollLeft ( ) : s ? 0 : l . scrollLeft ( ) ) * b ) } } , _generatePosition : function ( o ) { var e = this . options , b = this . cssPosition == "absolute" &&
( this . scrollParent [ 0 ] == document || ! a . ui . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) ? this . offsetParent : this . scrollParent , l = /(html|body)/i . test ( b [ 0 ] . tagName ) , s = o . pageX , c = o . pageY ; if ( this . originalPosition ) { var g ; if ( this . containment ) { if ( this . relative _container ) { g = this . relative _container . offset ( ) ; g = [ this . containment [ 0 ] + g . left , this . containment [ 1 ] + g . top , this . containment [ 2 ] + g . left , this . containment [ 3 ] + g . top ] } else g = this . containment ; o . pageX - this . offset . click . left < g [ 0 ] && ( s = g [ 0 ] + this . offset . click . left ) ;
o . pageY - this . offset . click . top < g [ 1 ] && ( c = g [ 1 ] + this . offset . click . top ) ; o . pageX - this . offset . click . left > g [ 2 ] && ( s = g [ 2 ] + this . offset . click . left ) ; o . pageY - this . offset . click . top > g [ 3 ] && ( c = g [ 3 ] + this . offset . click . top ) } if ( e . grid ) { c = e . grid [ 1 ] ? this . originalPageY + Math . round ( ( c - this . originalPageY ) / e . grid [ 1 ] ) * e . grid [ 1 ] : this . originalPageY ; c = g ? c - this . offset . click . top < g [ 1 ] || c - this . offset . click . top > g [ 3 ] ? c - this . offset . click . top < g [ 1 ] ? c + e . grid [ 1 ] : c - e . grid [ 1 ] : c : c ; s = e . grid [ 0 ] ? this . originalPageX + Math . round ( ( s - this . originalPageX ) /
e . grid [ 0 ] ) * e . grid [ 0 ] : this . originalPageX ; s = g ? s - this . offset . click . left < g [ 0 ] || s - this . offset . click . left > g [ 2 ] ? s - this . offset . click . left < g [ 0 ] ? s + e . grid [ 0 ] : s - e . grid [ 0 ] : s : s } } return { top : c - this . offset . click . top - this . offset . relative . top - this . offset . parent . top + ( a . browser . safari && a . browser . version < 526 && this . cssPosition == "fixed" ? 0 : this . cssPosition == "fixed" ? - this . scrollParent . scrollTop ( ) : l ? 0 : b . scrollTop ( ) ) , left : s - this . offset . click . left - this . offset . relative . left - this . offset . parent . left + ( a . browser . safari && a . browser . version <
526 && this . cssPosition == "fixed" ? 0 : this . cssPosition == "fixed" ? - this . scrollParent . scrollLeft ( ) : l ? 0 : b . scrollLeft ( ) ) } } , _clear : function ( ) { this . helper . removeClass ( "ui-draggable-dragging" ) ; this . helper [ 0 ] != this . element [ 0 ] && ! this . cancelHelperRemoval && this . helper . remove ( ) ; this . helper = null ; this . cancelHelperRemoval = false } , _trigger : function ( o , e , b ) { b = b || this . _uiHash ( ) ; a . ui . plugin . call ( this , o , [ e , b ] ) ; o == "drag" && ( this . positionAbs = this . _convertPositionTo ( "absolute" ) ) ; return a . Widget . prototype . _trigger . call ( this , o , e ,
b ) } , plugins : { } , _uiHash : function ( ) { return { helper : this . helper , position : this . position , originalPosition : this . originalPosition , offset : this . positionAbs } } } ) ; a . extend ( a . ui . draggable , { version : "1.8.17" } ) ; a . ui . plugin . add ( "draggable" , "connectToSortable" , { start : function ( o , e ) { var b = a ( this ) . data ( "draggable" ) , l = b . options , s = a . extend ( { } , e , { item : b . element } ) ; b . sortables = [ ] ; a ( l . connectToSortable ) . each ( function ( ) { var c = a . data ( this , "sortable" ) ; c && ! c . options . disabled && ( b . sortables . push ( { instance : c , shouldRevert : c . options . revert } ) ,
c . refreshPositions ( ) , c . _trigger ( "activate" , o , s ) ) } ) } , stop : function ( o , e ) { var b = a ( this ) . data ( "draggable" ) , l = a . extend ( { } , e , { item : b . element } ) ; a . each ( b . sortables , function ( ) { this . instance . isOver ? ( this . instance . isOver = 0 , b . cancelHelperRemoval = true , this . instance . cancelHelperRemoval = false , this . shouldRevert && ( this . instance . options . revert = true ) , this . instance . _mouseStop ( o ) , this . instance . options . helper = this . instance . options . _helper , b . options . helper == "original" && this . instance . currentItem . css ( { top : "auto" , left : "auto" } ) ) :
( this . instance . cancelHelperRemoval = false , this . instance . _trigger ( "deactivate" , o , l ) ) } ) } , drag : function ( o , e ) { var b = a ( this ) . data ( "draggable" ) , l = this ; a . each ( b . sortables , function ( ) { this . instance . positionAbs = b . positionAbs ; this . instance . helperProportions = b . helperProportions ; this . instance . offset . click = b . offset . click ; this . instance . _intersectsWith ( this . instance . containerCache ) ? ( this . instance . isOver || ( this . instance . isOver = 1 , this . instance . currentItem = a ( l ) . clone ( ) . removeAttr ( "id" ) . appendTo ( this . instance . element ) . data ( "sortable-item" ,
true ) , this . instance . options . _helper = this . instance . options . helper , this . instance . options . helper = function ( ) { return e . helper [ 0 ] } , o . target = this . instance . currentItem [ 0 ] , this . instance . _mouseCapture ( o , true ) , this . instance . _mouseStart ( o , true , true ) , this . instance . offset . click . top = b . offset . click . top , this . instance . offset . click . left = b . offset . click . left , this . instance . offset . parent . left -= b . offset . parent . left - this . instance . offset . parent . left , this . instance . offset . parent . top -= b . offset . parent . top - this . instance . offset . parent . top ,
b . _trigger ( "toSortable" , o ) , b . dropped = this . instance . element , b . currentItem = b . element , this . instance . fromOutside = b ) , this . instance . currentItem && this . instance . _mouseDrag ( o ) ) : this . instance . isOver && ( this . instance . isOver = 0 , this . instance . cancelHelperRemoval = true , this . instance . options . revert = false , this . instance . _trigger ( "out" , o , this . instance . _uiHash ( this . instance ) ) , this . instance . _mouseStop ( o , true ) , this . instance . options . helper = this . instance . options . _helper , this . instance . currentItem . remove ( ) , this . instance . placeholder &&
this . instance . placeholder . remove ( ) , b . _trigger ( "fromSortable" , o ) , b . dropped = false ) } ) } } ) ; a . ui . plugin . add ( "draggable" , "cursor" , { start : function ( ) { var o = a ( "body" ) , e = a ( this ) . data ( "draggable" ) . options ; o . css ( "cursor" ) && ( e . _cursor = o . css ( "cursor" ) ) ; o . css ( "cursor" , e . cursor ) } , stop : function ( ) { var o = a ( this ) . data ( "draggable" ) . options ; o . _cursor && a ( "body" ) . css ( "cursor" , o . _cursor ) } } ) ; a . ui . plugin . add ( "draggable" , "opacity" , { start : function ( o , e ) { var b = a ( e . helper ) , l = a ( this ) . data ( "draggable" ) . options ; b . css ( "opacity" ) && ( l . _opacity =
b . css ( "opacity" ) ) ; b . css ( "opacity" , l . opacity ) } , stop : function ( o , e ) { var b = a ( this ) . data ( "draggable" ) . options ; b . _opacity && a ( e . helper ) . css ( "opacity" , b . _opacity ) } } ) ; a . ui . plugin . add ( "draggable" , "scroll" , { start : function ( ) { var o = a ( this ) . data ( "draggable" ) ; o . scrollParent [ 0 ] != document && o . scrollParent [ 0 ] . tagName != "HTML" && ( o . overflowOffset = o . scrollParent . offset ( ) ) } , drag : function ( o ) { var e = a ( this ) . data ( "draggable" ) , b = e . options , l = false ; if ( e . scrollParent [ 0 ] != document && e . scrollParent [ 0 ] . tagName != "HTML" ) { if ( ! b . axis ||
b . axis != "x" ) e . overflowOffset . top + e . scrollParent [ 0 ] . offsetHeight - o . pageY < b . scrollSensitivity ? e . scrollParent [ 0 ] . scrollTop = l = e . scrollParent [ 0 ] . scrollTop + b . scrollSpeed : o . pageY - e . overflowOffset . top < b . scrollSensitivity && ( e . scrollParent [ 0 ] . scrollTop = l = e . scrollParent [ 0 ] . scrollTop - b . scrollSpeed ) ; if ( ! b . axis || b . axis != "y" ) e . overflowOffset . left + e . scrollParent [ 0 ] . offsetWidth - o . pageX < b . scrollSensitivity ? e . scrollParent [ 0 ] . scrollLeft = l = e . scrollParent [ 0 ] . scrollLeft + b . scrollSpeed : o . pageX - e . overflowOffset . left < b . scrollSensitivity &&
( e . scrollParent [ 0 ] . scrollLeft = l = e . scrollParent [ 0 ] . scrollLeft - b . scrollSpeed ) } else { if ( ! b . axis || b . axis != "x" ) o . pageY - a ( document ) . scrollTop ( ) < b . scrollSensitivity ? l = a ( document ) . scrollTop ( a ( document ) . scrollTop ( ) - b . scrollSpeed ) : a ( window ) . height ( ) - ( o . pageY - a ( document ) . scrollTop ( ) ) < b . scrollSensitivity && ( l = a ( document ) . scrollTop ( a ( document ) . scrollTop ( ) + b . scrollSpeed ) ) ; if ( ! b . axis || b . axis != "y" ) o . pageX - a ( document ) . scrollLeft ( ) < b . scrollSensitivity ? l = a ( document ) . scrollLeft ( a ( document ) . scrollLeft ( ) - b . scrollSpeed ) :
a ( window ) . width ( ) - ( o . pageX - a ( document ) . scrollLeft ( ) ) < b . scrollSensitivity && ( l = a ( document ) . scrollLeft ( a ( document ) . scrollLeft ( ) + b . scrollSpeed ) ) } l !== false && a . ui . ddmanager && ! b . dropBehaviour && a . ui . ddmanager . prepareOffsets ( e , o ) } } ) ; a . ui . plugin . add ( "draggable" , "snap" , { start : function ( ) { var o = a ( this ) . data ( "draggable" ) , e = o . options ; o . snapElements = [ ] ; a ( e . snap . constructor != String ? e . snap . items || ":data(draggable)" : e . snap ) . each ( function ( ) { var b = a ( this ) , l = b . offset ( ) ; this != o . element [ 0 ] && o . snapElements . push ( { item : this ,
width : b . outerWidth ( ) , height : b . outerHeight ( ) , top : l . top , left : l . left } ) } ) } , drag : function ( o , e ) { for ( var b = a ( this ) . data ( "draggable" ) , l = b . options , s = l . snapTolerance , c = e . offset . left , g = c + b . helperProportions . width , d = e . offset . top , p = d + b . helperProportions . height , w = b . snapElements . length - 1 ; w >= 0 ; w -- ) { var B = b . snapElements [ w ] . left , v = B + b . snapElements [ w ] . width , N = b . snapElements [ w ] . top , Q = N + b . snapElements [ w ] . height ; if ( B - s < c && c < v + s && N - s < d && d < Q + s || B - s < c && c < v + s && N - s < p && p < Q + s || B - s < g && g < v + s && N - s < d && d < Q + s || B - s < g && g < v + s && N - s < p &&
p < Q + s ) { if ( l . snapMode != "inner" ) { var K = Math . abs ( N - p ) <= s , I = Math . abs ( Q - d ) <= s , S = Math . abs ( B - g ) <= s , R = Math . abs ( v - c ) <= s ; K && ( e . position . top = b . _convertPositionTo ( "relative" , { top : N - b . helperProportions . height , left : 0 } ) . top - b . margins . top ) ; I && ( e . position . top = b . _convertPositionTo ( "relative" , { top : Q , left : 0 } ) . top - b . margins . top ) ; S && ( e . position . left = b . _convertPositionTo ( "relative" , { top : 0 , left : B - b . helperProportions . width } ) . left - b . margins . left ) ; R && ( e . position . left = b . _convertPositionTo ( "relative" , { top : 0 , left : v } ) . left - b . margins . left ) } var L =
K || I || S || R ; if ( l . snapMode != "outer" ) { K = Math . abs ( N - d ) <= s ; I = Math . abs ( Q - p ) <= s ; S = Math . abs ( B - c ) <= s ; R = Math . abs ( v - g ) <= s ; K && ( e . position . top = b . _convertPositionTo ( "relative" , { top : N , left : 0 } ) . top - b . margins . top ) ; I && ( e . position . top = b . _convertPositionTo ( "relative" , { top : Q - b . helperProportions . height , left : 0 } ) . top - b . margins . top ) ; S && ( e . position . left = b . _convertPositionTo ( "relative" , { top : 0 , left : B } ) . left - b . margins . left ) ; R && ( e . position . left = b . _convertPositionTo ( "relative" , { top : 0 , left : v - b . helperProportions . width } ) . left - b . margins . left ) } ! b . snapElements [ w ] . snapping &&
( K || I || S || R || L ) && b . options . snap . snap && b . options . snap . snap . call ( b . element , o , a . extend ( b . _uiHash ( ) , { snapItem : b . snapElements [ w ] . item } ) ) ; b . snapElements [ w ] . snapping = K || I || S || R || L } else { b . snapElements [ w ] . snapping && b . options . snap . release && b . options . snap . release . call ( b . element , o , a . extend ( b . _uiHash ( ) , { snapItem : b . snapElements [ w ] . item } ) ) ; b . snapElements [ w ] . snapping = false } } } } ) ; a . ui . plugin . add ( "draggable" , "stack" , { start : function ( ) { var o = a ( this ) . data ( "draggable" ) . options ; o = a . makeArray ( a ( o . stack ) ) . sort ( function ( b ,
l ) { return ( parseInt ( a ( b ) . css ( "zIndex" ) , 10 ) || 0 ) - ( parseInt ( a ( l ) . css ( "zIndex" ) , 10 ) || 0 ) } ) ; if ( o . length ) { var e = parseInt ( o [ 0 ] . style . zIndex ) || 0 ; a ( o ) . each ( function ( b ) { this . style . zIndex = e + b } ) ; this [ 0 ] . style . zIndex = e + o . length } } } ) ; a . ui . plugin . add ( "draggable" , "zIndex" , { start : function ( o , e ) { var b = a ( e . helper ) , l = a ( this ) . data ( "draggable" ) . options ; b . css ( "zIndex" ) && ( l . _zIndex = b . css ( "zIndex" ) ) ; b . css ( "zIndex" , l . zIndex ) } , stop : function ( o , e ) { var b = a ( this ) . data ( "draggable" ) . options ; b . _zIndex && a ( e . helper ) . css ( "zIndex" , b . _zIndex ) } } ) } ) ( jQuery ) ;
( function ( a ) { a . widget ( "ui.slider" , a . ui . mouse , { widgetEventPrefix : "slide" , options : { animate : false , distance : 0 , max : 100 , min : 0 , orientation : "horizontal" , range : false , step : 1 , value : 0 , values : null } , _create : function ( ) { var o = this , e = this . options , b = this . element . find ( ".ui-slider-handle" ) . addClass ( "ui-state-default ui-corner-all" ) , l = e . values && e . values . length || 1 , s = [ ] ; this . _mouseSliding = this . _keySliding = false ; this . _animateOff = true ; this . _handleIndex = null ; this . _detectOrientation ( ) ; this . _mouseInit ( ) ; this . element . addClass ( "ui-slider ui-slider-" +
this . orientation + " ui-widget ui-widget-content ui-corner-all" + ( e . disabled ? " ui-slider-disabled ui-disabled" : "" ) ) ; this . range = a ( [ ] ) ; e . range && ( e . range === true && ( e . values || ( e . values = [ this . _valueMin ( ) , this . _valueMin ( ) ] ) , e . values . length && e . values . length !== 2 && ( e . values = [ e . values [ 0 ] , e . values [ 0 ] ] ) ) , this . range = a ( "<div></div>" ) . appendTo ( this . element ) . addClass ( "ui-slider-range ui-widget-header" + ( e . range === "min" || e . range === "max" ? " ui-slider-range-" + e . range : "" ) ) ) ; for ( var c = b . length ; c < l ; c += 1 ) s . push ( "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>" ) ;
this . handles = b . add ( a ( s . join ( "" ) ) . appendTo ( o . element ) ) ; this . handle = this . handles . eq ( 0 ) ; this . handles . add ( this . range ) . filter ( "a" ) . click ( function ( g ) { g . preventDefault ( ) } ) . hover ( function ( ) { e . disabled || a ( this ) . addClass ( "ui-state-hover" ) } , function ( ) { a ( this ) . removeClass ( "ui-state-hover" ) } ) . focus ( function ( ) { e . disabled ? a ( this ) . blur ( ) : ( a ( ".ui-slider .ui-state-focus" ) . removeClass ( "ui-state-focus" ) , a ( this ) . addClass ( "ui-state-focus" ) ) } ) . blur ( function ( ) { a ( this ) . removeClass ( "ui-state-focus" ) } ) ; this . handles . each ( function ( g ) { a ( this ) . data ( "index.ui-slider-handle" ,
g ) } ) ; this . handles . keydown ( function ( g ) { var d = true , p = a ( this ) . data ( "index.ui-slider-handle" ) , w , B , v ; if ( ! o . options . disabled ) { switch ( g . keyCode ) { case a . ui . keyCode . HOME : case a . ui . keyCode . END : case a . ui . keyCode . PAGE _UP : case a . ui . keyCode . PAGE _DOWN : case a . ui . keyCode . UP : case a . ui . keyCode . RIGHT : case a . ui . keyCode . DOWN : case a . ui . keyCode . LEFT : d = false ; if ( ! o . _keySliding ) { o . _keySliding = true ; a ( this ) . addClass ( "ui-state-active" ) ; w = o . _start ( g , p ) ; if ( w === false ) return } } w = o . options . step ; o . options . values && o . options . values . length ?
B = v = o . values ( p ) : B = v = o . value ( ) ; switch ( g . keyCode ) { case a . ui . keyCode . HOME : v = o . _valueMin ( ) ; break ; case a . ui . keyCode . END : v = o . _valueMax ( ) ; break ; case a . ui . keyCode . PAGE _UP : v = o . _trimAlignValue ( B + ( o . _valueMax ( ) - o . _valueMin ( ) ) / 5 ) ; break ; case a . ui . keyCode . PAGE _DOWN : v = o . _trimAlignValue ( B - ( o . _valueMax ( ) - o . _valueMin ( ) ) / 5 ) ; break ; case a . ui . keyCode . UP : case a . ui . keyCode . RIGHT : if ( B === o . _valueMax ( ) ) return ; v = o . _trimAlignValue ( B + w ) ; break ; case a . ui . keyCode . DOWN : case a . ui . keyCode . LEFT : if ( B === o . _valueMin ( ) ) return ; v = o . _trimAlignValue ( B -
w ) } o . _slide ( g , p , v ) ; return d } } ) . keyup ( function ( g ) { var d = a ( this ) . data ( "index.ui-slider-handle" ) ; o . _keySliding && ( o . _keySliding = false , o . _stop ( g , d ) , o . _change ( g , d ) , a ( this ) . removeClass ( "ui-state-active" ) ) } ) ; this . _refreshValue ( ) ; this . _animateOff = false } , destroy : function ( ) { this . handles . remove ( ) ; this . range . remove ( ) ; this . element . removeClass ( "ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all" ) . removeData ( "slider" ) . unbind ( ".slider" ) ; this . _mouseDestroy ( ) ;
return this } , _mouseCapture : function ( o ) { var e = this . options , b , l , s , c , g ; if ( e . disabled ) return false ; this . elementSize = { width : this . element . outerWidth ( ) , height : this . element . outerHeight ( ) } ; this . elementOffset = this . element . offset ( ) ; b = this . _normValueFromMouse ( { x : o . pageX , y : o . pageY } ) ; l = this . _valueMax ( ) - this . _valueMin ( ) + 1 ; c = this ; this . handles . each ( function ( d ) { var p = Math . abs ( b - c . values ( d ) ) ; l > p && ( l = p , s = a ( this ) , g = d ) } ) ; e . range === true && this . values ( 1 ) === e . min && ( g += 1 , s = a ( this . handles [ g ] ) ) ; if ( this . _start ( o , g ) === false ) return false ;
this . _mouseSliding = true ; c . _handleIndex = g ; s . addClass ( "ui-state-active" ) . focus ( ) ; e = s . offset ( ) ; this . _clickOffset = ! a ( o . target ) . parents ( ) . andSelf ( ) . is ( ".ui-slider-handle" ) ? { left : 0 , top : 0 } : { left : o . pageX - e . left - s . width ( ) / 2 , top : o . pageY - e . top - s . height ( ) / 2 - ( parseInt ( s . css ( "borderTopWidth" ) , 10 ) || 0 ) - ( parseInt ( s . css ( "borderBottomWidth" ) , 10 ) || 0 ) + ( parseInt ( s . css ( "marginTop" ) , 10 ) || 0 ) } ; this . handles . hasClass ( "ui-state-hover" ) || this . _slide ( o , g , b ) ; return this . _animateOff = true } , _mouseStart : function ( ) { return true } , _mouseDrag : function ( o ) { var e =
this . _normValueFromMouse ( { x : o . pageX , y : o . pageY } ) ; this . _slide ( o , this . _handleIndex , e ) ; return false } , _mouseStop : function ( o ) { this . handles . removeClass ( "ui-state-active" ) ; this . _mouseSliding = false ; this . _stop ( o , this . _handleIndex ) ; this . _change ( o , this . _handleIndex ) ; this . _clickOffset = this . _handleIndex = null ; return this . _animateOff = false } , _detectOrientation : function ( ) { this . orientation = this . options . orientation === "vertical" ? "vertical" : "horizontal" } , _normValueFromMouse : function ( o ) { var e , b ; this . orientation === "horizontal" ?
( e = this . elementSize . width , b = o . x - this . elementOffset . left - ( this . _clickOffset ? this . _clickOffset . left : 0 ) ) : ( e = this . elementSize . height , b = o . y - this . elementOffset . top - ( this . _clickOffset ? this . _clickOffset . top : 0 ) ) ; o = b / e ; o > 1 && ( o = 1 ) ; o < 0 && ( o = 0 ) ; this . orientation === "vertical" && ( o = 1 - o ) ; e = this . _valueMax ( ) - this . _valueMin ( ) ; return this . _trimAlignValue ( this . _valueMin ( ) + o * e ) } , _start : function ( o , e ) { var b = { handle : this . handles [ e ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( b . value = this . values ( e ) ,
b . values = this . values ( ) ) ; return this . _trigger ( "start" , o , b ) } , _slide : function ( o , e , b ) { var l , s , c ; this . options . values && this . options . values . length ? ( l = this . values ( e ? 0 : 1 ) , this . options . values . length === 2 && this . options . range === true && ( e === 0 && b > l || e === 1 && b < l ) && ( b = l ) , b !== this . values ( e ) && ( s = this . values ( ) , s [ e ] = b , c = this . _trigger ( "slide" , o , { handle : this . handles [ e ] , value : b , values : s } ) , this . values ( e ? 0 : 1 ) , c !== false && this . values ( e , b , true ) ) ) : b !== this . value ( ) && ( c = this . _trigger ( "slide" , o , { handle : this . handles [ e ] , value : b } ) , c !==
false && this . value ( b ) ) } , _stop : function ( o , e ) { var b = { handle : this . handles [ e ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( b . value = this . values ( e ) , b . values = this . values ( ) ) ; this . _trigger ( "stop" , o , b ) } , _change : function ( o , e ) { if ( ! this . _keySliding && ! this . _mouseSliding ) { var b = { handle : this . handles [ e ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( b . value = this . values ( e ) , b . values = this . values ( ) ) ; this . _trigger ( "change" , o , b ) } } , value : function ( o ) { if ( arguments . length ) { this . options . value =
this . _trimAlignValue ( o ) ; this . _refreshValue ( ) ; this . _change ( null , 0 ) } else return this . _value ( ) } , values : function ( o , e ) { var b , l , s ; if ( arguments . length > 1 ) { this . options . values [ o ] = this . _trimAlignValue ( e ) ; this . _refreshValue ( ) ; this . _change ( null , o ) } else { if ( ! arguments . length ) return this . _values ( ) ; if ( ! a . isArray ( arguments [ 0 ] ) ) return this . options . values && this . options . values . length ? this . _values ( o ) : this . value ( ) ; b = this . options . values ; l = arguments [ 0 ] ; for ( s = 0 ; s < b . length ; s += 1 ) { b [ s ] = this . _trimAlignValue ( l [ s ] ) ; this . _change ( null ,
s ) } this . _refreshValue ( ) } } , _setOption : function ( o , e ) { var b , l = 0 ; a . isArray ( this . options . values ) && ( l = this . options . values . length ) ; a . Widget . prototype . _setOption . apply ( this , arguments ) ; switch ( o ) { case "disabled" : e ? ( this . handles . filter ( ".ui-state-focus" ) . blur ( ) , this . handles . removeClass ( "ui-state-hover" ) , this . handles . propAttr ( "disabled" , true ) , this . element . addClass ( "ui-disabled" ) ) : ( this . handles . propAttr ( "disabled" , false ) , this . element . removeClass ( "ui-disabled" ) ) ; break ; case "orientation" : this . _detectOrientation ( ) ;
this . element . removeClass ( "ui-slider-horizontal ui-slider-vertical" ) . addClass ( "ui-slider-" + this . orientation ) ; this . _refreshValue ( ) ; break ; case "value" : this . _animateOff = true ; this . _refreshValue ( ) ; this . _change ( null , 0 ) ; this . _animateOff = false ; break ; case "values" : this . _animateOff = true ; this . _refreshValue ( ) ; for ( b = 0 ; b < l ; b += 1 ) this . _change ( null , b ) ; this . _animateOff = false } } , _value : function ( ) { var o = this . options . value ; return o = this . _trimAlignValue ( o ) } , _values : function ( o ) { var e , b ; if ( arguments . length ) { e = this . options . values [ o ] ;
return e = this . _trimAlignValue ( e ) } e = this . options . values . slice ( ) ; for ( b = 0 ; b < e . length ; b += 1 ) e [ b ] = this . _trimAlignValue ( e [ b ] ) ; return e } , _trimAlignValue : function ( o ) { if ( o <= this . _valueMin ( ) ) return this . _valueMin ( ) ; if ( o >= this . _valueMax ( ) ) return this . _valueMax ( ) ; var e = this . options . step > 0 ? this . options . step : 1 , b = ( o - this . _valueMin ( ) ) % e ; o = o - b ; Math . abs ( b ) * 2 >= e && ( o += b > 0 ? e : - e ) ; return parseFloat ( o . toFixed ( 5 ) ) } , _valueMin : function ( ) { return this . options . min } , _valueMax : function ( ) { return this . options . max } , _refreshValue : function ( ) { var o =
this . options . range , e = this . options , b = this , l = this . _animateOff ? false : e . animate , s , c = { } , g , d , p , w ; this . options . values && this . options . values . length ? this . handles . each ( function ( B ) { s = ( b . values ( B ) - b . _valueMin ( ) ) / ( b . _valueMax ( ) - b . _valueMin ( ) ) * 100 ; c [ b . orientation === "horizontal" ? "left" : "bottom" ] = s + "%" ; a ( this ) . stop ( 1 , 1 ) [ l ? "animate" : "css" ] ( c , e . animate ) ; b . options . range === true && ( b . orientation === "horizontal" ? ( B === 0 && b . range . stop ( 1 , 1 ) [ l ? "animate" : "css" ] ( { left : s + "%" } , e . animate ) , B === 1 && b . range [ l ? "animate" : "css" ] ( { width : s -
g + "%" } , { queue : false , duration : e . animate } ) ) : ( B === 0 && b . range . stop ( 1 , 1 ) [ l ? "animate" : "css" ] ( { bottom : s + "%" } , e . animate ) , B === 1 && b . range [ l ? "animate" : "css" ] ( { height : s - g + "%" } , { queue : false , duration : e . animate } ) ) ) ; g = s } ) : ( d = this . value ( ) , p = this . _valueMin ( ) , w = this . _valueMax ( ) , s = w !== p ? ( d - p ) / ( w - p ) * 100 : 0 , c [ b . orientation === "horizontal" ? "left" : "bottom" ] = s + "%" , this . handle . stop ( 1 , 1 ) [ l ? "animate" : "css" ] ( c , e . animate ) , o === "min" && this . orientation === "horizontal" && this . range . stop ( 1 , 1 ) [ l ? "animate" : "css" ] ( { width : s + "%" } , e . animate ) ,
o === "max" && this . orientation === "horizontal" && this . range [ l ? "animate" : "css" ] ( { width : 100 - s + "%" } , { queue : false , duration : e . animate } ) , o === "min" && this . orientation === "vertical" && this . range . stop ( 1 , 1 ) [ l ? "animate" : "css" ] ( { height : s + "%" } , e . animate ) , o === "max" && this . orientation === "vertical" && this . range [ l ? "animate" : "css" ] ( { height : 100 - s + "%" } , { queue : false , duration : e . animate } ) ) } } ) ; a . extend ( a . ui . slider , { version : "1.8.17" } ) } ) ( jQuery ) ; ( function ( a ) { Math . precision = function ( c , g ) { if ( g === undefined ) g = 0 ; return Math . round ( c * Math . pow ( 10 , g ) ) / Math . pow ( 10 , g ) } ; var o = function ( c , g ) { var d = this , p = c . find ( "img:first" ) , w = 0 , B = 100 , v = 100 , N = 0 , Q = 100 , K = 100 , I = 0 , S = 0 , R , L , Z = [ ] , qa = function ( U ) { for ( var X = 0 ; X < Z . length ; X ++ ) Z [ X ] . call ( d , d , U ) } , aa = function ( U ) { var X = c . offset ( ) ; R = { l : X . left | 0 , t : X . top | 0 } ; clearTimeout ( L ) ; L = setTimeout ( function ( ) { Ba . call ( d , U ) } , 0 ) ; a ( document ) . bind ( "mousemove" , Y ) . bind ( "mouseup" , ga ) ; U . preventDefault ( ) } , Y = function ( U ) { clearTimeout ( L ) ; L = setTimeout ( function ( ) { Ba . call ( d ,
U ) } , 0 ) ; U . stopPropagation ( ) ; U . preventDefault ( ) ; return false } , ga = function ( U ) { a ( document ) . unbind ( "mouseup" , ga ) . unbind ( "mousemove" , Y ) ; U . stopPropagation ( ) ; U . preventDefault ( ) ; return false } , Ba = function ( U ) { var X = U . pageX - R . l ; U = U . pageY - R . t ; var na = c . w , oa = c . h ; if ( X < 0 ) X = 0 ; else if ( X > na ) X = na ; if ( U < 0 ) U = 0 ; else if ( U > oa ) U = oa ; ja . call ( d , "xy" , { x : X / na * v + w , y : U / oa * K + N } ) } , ja = function ( U , X , na ) { if ( X === undefined ) { if ( U === undefined || U == null ) U = "xy" ; switch ( U . toLowerCase ( ) ) { case "x" : return I ; case "y" : return S ; default : return { x : I , y : S } } } if ( ! ( na !=
null && na == d ) ) { var oa = false , ma , la ; if ( U == null ) U = "xy" ; switch ( U . toLowerCase ( ) ) { case "x" : ma = X && ( X . x && X . x | 0 || X | 0 ) || 0 ; break ; case "y" : la = X && ( X . y && X . y | 0 || X | 0 ) || 0 ; break ; default : ma = X && X . x && X . x | 0 || 0 ; la = X && X . y && X . y | 0 || 0 } if ( ma != null ) { if ( ma < w ) ma = w ; else if ( ma > B ) ma = B ; if ( I != ma ) { I = ma ; oa = true } } if ( la != null ) { if ( la < N ) la = N ; else if ( la > Q ) la = Q ; if ( S != la ) { S = la ; oa = true } } oa && qa . call ( d , na || d ) } } , da = function ( U ) { a . isFunction ( U ) && Z . push ( U ) } ; a . extend ( true , d , { val : ja , range : function ( U , X ) { if ( X === undefined ) { if ( U === undefined || U == null ) U = "all" ;
switch ( U . toLowerCase ( ) ) { case "minx" : return w ; case "maxx" : return B ; case "rangex" : return { minX : w , maxX : B , rangeX : v } ; case "miny" : return N ; case "maxy" : return Q ; case "rangey" : return { minY : N , maxY : Q , rangeY : K } ; default : return { minX : w , maxX : B , rangeX : v , minY : N , maxY : Q , rangeY : K } } } var na , oa , ma , la ; if ( U == null ) U = "all" ; switch ( U . toLowerCase ( ) ) { case "minx" : na = X && ( X . minX && X . minX | 0 || X | 0 ) || 0 ; break ; case "maxx" : oa = X && ( X . maxX && X . maxX | 0 || X | 0 ) || 0 ; break ; case "rangex" : na = X && X . minX && X . minX | 0 || 0 ; oa = X && X . maxX && X . maxX | 0 || 0 ; break ; case "miny" : ma =
X && ( X . minY && X . minY | 0 || X | 0 ) || 0 ; break ; case "maxy" : la = X && ( X . maxY && X . maxY | 0 || X | 0 ) || 0 ; break ; case "rangey" : ma = X && X . minY && X . minY | 0 || 0 ; la = X && X . maxY && X . maxY | 0 || 0 ; break ; default : na = X && X . minX && X . minX | 0 || 0 ; oa = X && X . maxX && X . maxX | 0 || 0 ; ma = X && X . minY && X . minY | 0 || 0 ; la = X && X . maxY && X . maxY | 0 || 0 } if ( na != null && w != na ) { w = na ; v = B - w } if ( oa != null && B != oa ) { B = oa ; v = B - w } if ( ma != null && N != ma ) { N = ma ; K = Q - N } if ( la != null && Q != la ) { Q = la ; K = Q - N } } , bind : da , unbind : function ( U ) { if ( a . isFunction ( U ) ) for ( var X ; ( X = a . inArray ( U , Z ) ) != - 1 ; ) Z . splice ( X , 1 ) } , destroy : function ( ) { a ( document ) . unbind ( "mouseup" ,
ga ) . unbind ( "mousemove" , Y ) ; c . unbind ( "mousedown" , aa ) ; Z = p = c = null } } ) ; p . src = g . arrow && g . arrow . image ; p . w = g . arrow && g . arrow . width || p . width ( ) ; p . h = g . arrow && g . arrow . height || p . height ( ) ; c . w = g . map && g . map . width || c . width ( ) ; c . h = g . map && g . map . height || c . height ( ) ; c . bind ( "mousedown" , aa ) ; da . call ( d , function ( ) { var U = 0 , X = 0 , na = c . w , oa = c . h , ma = p . w , la = p . h ; setTimeout ( function ( ) { if ( v > 0 ) U = I == B ? na : I / v * na | 0 ; if ( K > 0 ) X = S == Q ? oa : S / K * oa | 0 ; if ( ma >= na ) U = ( na >> 1 ) - ( ma >> 1 ) ; else U -= ma >> 1 ; if ( la >= oa ) X = ( oa >> 1 ) - ( la >> 1 ) ; else X -= la >> 1 ; p . css ( { left : U + "px" ,
top : X + "px" } ) } , 0 ) } ) } , e = function ( c , g , d , p ) { var w = this ; c = c . find ( "td.Text input" ) ; var B = c . eq ( 3 ) , v = c . eq ( 4 ) , N = c . eq ( 5 ) , Q = c . length > 7 ? c . eq ( 6 ) : null , K = c . eq ( 0 ) , I = c . eq ( 1 ) , S = c . eq ( 2 ) , R = c . eq ( c . length > 7 ? 7 : 6 ) , L = c . length > 7 ? c . eq ( 8 ) : null , Z = function ( ja ) { if ( ! ( ja . target . value == "" && ja . target != R . get ( 0 ) && ( d != null && ja . target != d . get ( 0 ) || d == null ) ) ) { if ( ! Y ( ja ) ) return ja ; switch ( ja . target ) { case B . get ( 0 ) : switch ( ja . keyCode ) { case 38 : B . val ( ga . call ( w , ( B . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; g . val ( "r" , B . val ( ) , ja . target ) ; return false ; case 40 : B . val ( ga . call ( w ,
( B . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; g . val ( "r" , B . val ( ) , ja . target ) ; return false } break ; case v . get ( 0 ) : switch ( ja . keyCode ) { case 38 : v . val ( ga . call ( w , ( v . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; g . val ( "g" , v . val ( ) , ja . target ) ; return false ; case 40 : v . val ( ga . call ( w , ( v . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; g . val ( "g" , v . val ( ) , ja . target ) ; return false } break ; case N . get ( 0 ) : switch ( ja . keyCode ) { case 38 : N . val ( ga . call ( w , ( N . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; g . val ( "b" , N . val ( ) , ja . target ) ; return false ; case 40 : N . val ( ga . call ( w , ( N . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; g . val ( "b" , N . val ( ) , ja . target ) ; return false } break ;
case Q && Q . get ( 0 ) : switch ( ja . keyCode ) { case 38 : Q . val ( ga . call ( w , parseFloat ( Q . val ( ) ) + 1 , 0 , 100 ) ) ; g . val ( "a" , Math . precision ( Q . val ( ) * 255 / 100 , p ) , ja . target ) ; return false ; case 40 : Q . val ( ga . call ( w , parseFloat ( Q . val ( ) ) - 1 , 0 , 100 ) ) ; g . val ( "a" , Math . precision ( Q . val ( ) * 255 / 100 , p ) , ja . target ) ; return false } break ; case K . get ( 0 ) : switch ( ja . keyCode ) { case 38 : K . val ( ga . call ( w , ( K . val ( ) << 0 ) + 1 , 0 , 360 ) ) ; g . val ( "h" , K . val ( ) , ja . target ) ; return false ; case 40 : K . val ( ga . call ( w , ( K . val ( ) << 0 ) - 1 , 0 , 360 ) ) ; g . val ( "h" , K . val ( ) , ja . target ) ; return false } break ;
case I . get ( 0 ) : switch ( ja . keyCode ) { case 38 : I . val ( ga . call ( w , ( I . val ( ) << 0 ) + 1 , 0 , 100 ) ) ; g . val ( "s" , I . val ( ) , ja . target ) ; return false ; case 40 : I . val ( ga . call ( w , ( I . val ( ) << 0 ) - 1 , 0 , 100 ) ) ; g . val ( "s" , I . val ( ) , ja . target ) ; return false } break ; case S . get ( 0 ) : switch ( ja . keyCode ) { case 38 : S . val ( ga . call ( w , ( S . val ( ) << 0 ) + 1 , 0 , 100 ) ) ; g . val ( "v" , S . val ( ) , ja . target ) ; return false ; case 40 : S . val ( ga . call ( w , ( S . val ( ) << 0 ) - 1 , 0 , 100 ) ) ; g . val ( "v" , S . val ( ) , ja . target ) ; return false } } } } , qa = function ( ja ) { if ( ! ( ja . target . value == "" && ja . target != R . get ( 0 ) && ( d != null &&
ja . target != d . get ( 0 ) || d == null ) ) ) { if ( ! Y ( ja ) ) return ja ; switch ( ja . target ) { case B . get ( 0 ) : B . val ( ga . call ( w , B . val ( ) , 0 , 255 ) ) ; g . val ( "r" , B . val ( ) , ja . target ) ; break ; case v . get ( 0 ) : v . val ( ga . call ( w , v . val ( ) , 0 , 255 ) ) ; g . val ( "g" , v . val ( ) , ja . target ) ; break ; case N . get ( 0 ) : N . val ( ga . call ( w , N . val ( ) , 0 , 255 ) ) ; g . val ( "b" , N . val ( ) , ja . target ) ; break ; case Q && Q . get ( 0 ) : Q . val ( ga . call ( w , Q . val ( ) , 0 , 100 ) ) ; g . val ( "a" , Math . precision ( Q . val ( ) * 255 / 100 , p ) , ja . target ) ; break ; case K . get ( 0 ) : K . val ( ga . call ( w , K . val ( ) , 0 , 360 ) ) ; g . val ( "h" , K . val ( ) , ja . target ) ; break ;
case I . get ( 0 ) : I . val ( ga . call ( w , I . val ( ) , 0 , 100 ) ) ; g . val ( "s" , I . val ( ) , ja . target ) ; break ; case S . get ( 0 ) : S . val ( ga . call ( w , S . val ( ) , 0 , 100 ) ) ; g . val ( "v" , S . val ( ) , ja . target ) ; break ; case R . get ( 0 ) : R . val ( R . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 6 ) ) ; d && d . val ( R . val ( ) ) ; g . val ( "hex" , R . val ( ) != "" ? R . val ( ) : null , ja . target ) ; break ; case d && d . get ( 0 ) : d . val ( d . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 6 ) ) ; R . val ( d . val ( ) ) ; g . val ( "hex" , d . val ( ) != "" ? d . val ( ) : null , ja . target ) ; break ; case L && L . get ( 0 ) : L . val ( L . val ( ) . replace ( /[^a-fA-F0-9]/g ,
"" ) . toLowerCase ( ) . substring ( 0 , 2 ) ) ; g . val ( "a" , L . val ( ) != null ? parseInt ( L . val ( ) , 16 ) : null , ja . target ) } } } , aa = function ( ja ) { if ( g . val ( ) != null ) switch ( ja . target ) { case B . get ( 0 ) : B . val ( g . val ( "r" ) ) ; break ; case v . get ( 0 ) : v . val ( g . val ( "g" ) ) ; break ; case N . get ( 0 ) : N . val ( g . val ( "b" ) ) ; break ; case Q && Q . get ( 0 ) : Q . val ( Math . precision ( g . val ( "a" ) * 100 / 255 , p ) ) ; break ; case K . get ( 0 ) : K . val ( g . val ( "h" ) ) ; break ; case I . get ( 0 ) : I . val ( g . val ( "s" ) ) ; break ; case S . get ( 0 ) : S . val ( g . val ( "v" ) ) ; break ; case R . get ( 0 ) : case d && d . get ( 0 ) : R . val ( g . val ( "hex" ) ) ; d && d . val ( g . val ( "hex" ) ) ;
break ; case L && L . get ( 0 ) : L . val ( g . val ( "ahex" ) . substring ( 6 ) ) } } , Y = function ( ja ) { switch ( ja . keyCode ) { case 9 : case 16 : case 29 : case 37 : case 39 : return false ; case "c" . charCodeAt ( ) : case "v" . charCodeAt ( ) : if ( ja . ctrlKey ) return false } return true } , ga = function ( ja , da , U ) { if ( ja == "" || isNaN ( ja ) ) return da ; if ( ja > U ) return U ; if ( ja < da ) return da ; return ja } , Ba = function ( ja , da ) { var U = ja . val ( "all" ) ; if ( da != B . get ( 0 ) ) B . val ( U != null ? U . r : "" ) ; if ( da != v . get ( 0 ) ) v . val ( U != null ? U . g : "" ) ; if ( da != N . get ( 0 ) ) N . val ( U != null ? U . b : "" ) ; if ( Q && da != Q . get ( 0 ) ) Q . val ( U !=
null ? Math . precision ( U . a * 100 / 255 , p ) : "" ) ; if ( da != K . get ( 0 ) ) K . val ( U != null ? U . h : "" ) ; if ( da != I . get ( 0 ) ) I . val ( U != null ? U . s : "" ) ; if ( da != S . get ( 0 ) ) S . val ( U != null ? U . v : "" ) ; if ( da != R . get ( 0 ) && ( d && da != d . get ( 0 ) || ! d ) ) R . val ( U != null ? U . hex : "" ) ; if ( d && da != d . get ( 0 ) && da != R . get ( 0 ) ) d . val ( U != null ? U . hex : "" ) ; if ( L && da != L . get ( 0 ) ) L . val ( U != null ? U . ahex . substring ( 6 ) : "" ) } ; a . extend ( true , w , { destroy : function ( ) { B . add ( v ) . add ( N ) . add ( Q ) . add ( K ) . add ( I ) . add ( S ) . add ( R ) . add ( d ) . add ( L ) . unbind ( "keyup" , qa ) . unbind ( "blur" , aa ) ; B . add ( v ) . add ( N ) . add ( Q ) . add ( K ) . add ( I ) . add ( S ) . unbind ( "keydown" ,
Z ) ; g . unbind ( Ba ) ; L = R = S = I = K = Q = N = v = B = null } } ) ; B . add ( v ) . add ( N ) . add ( Q ) . add ( K ) . add ( I ) . add ( S ) . add ( R ) . add ( d ) . add ( L ) . bind ( "keyup" , qa ) . bind ( "blur" , aa ) ; B . add ( v ) . add ( N ) . add ( Q ) . add ( K ) . add ( I ) . add ( S ) . bind ( "keydown" , Z ) ; g . bind ( Ba ) } ; a . jPicker = { List : [ ] , Color : function ( c ) { var g = this , d , p , w , B , v , N , Q , K = [ ] , I = function ( R ) { for ( var L = 0 ; L < K . length ; L ++ ) K [ L ] . call ( g , g , R ) } , S = function ( R , L , Z ) { if ( L === undefined ) { if ( R === undefined || R == null || R == "" ) R = "all" ; if ( d == null ) return null ; switch ( R . toLowerCase ( ) ) { case "ahex" : return s . rgbaToHex ( { r : d , g : p ,
b : w , a : B } ) ; case "hex" : return S ( "ahex" ) . substring ( 0 , 6 ) ; case "all" : return { r : d , g : p , b : w , a : B , h : v , s : N , v : Q , hex : S . call ( g , "hex" ) , ahex : S . call ( g , "ahex" ) } ; default : L = { } ; for ( var qa = 0 ; qa < R . length ; qa ++ ) switch ( R . charAt ( qa ) ) { case "r" : if ( R . length == 1 ) L = d ; else L . r = d ; break ; case "g" : if ( R . length == 1 ) L = p ; else L . g = p ; break ; case "b" : if ( R . length == 1 ) L = w ; else L . b = w ; break ; case "a" : if ( R . length == 1 ) L = B ; else L . a = B ; break ; case "h" : if ( R . length == 1 ) L = v ; else L . h = v ; break ; case "s" : if ( R . length == 1 ) L = N ; else L . s = N ; break ; case "v" : if ( R . length == 1 ) L =
Q ; else L . v = Q } return L == { } ? S . call ( g , "all" ) : L } } if ( ! ( Z != null && Z == g ) ) { var aa = false ; if ( R == null ) R = "" ; if ( L == null ) { if ( d != null ) { d = null ; aa = true } if ( p != null ) { p = null ; aa = true } if ( w != null ) { w = null ; aa = true } if ( B != null ) { B = null ; aa = true } if ( v != null ) { v = null ; aa = true } if ( N != null ) { N = null ; aa = true } if ( Q != null ) { Q = null ; aa = true } aa && I . call ( g , Z || g ) } else switch ( R . toLowerCase ( ) ) { case "ahex" : case "hex" : L = s . hexToRgba ( L && ( L . ahex || L . hex ) || L || "00000000" ) ; S . call ( g , "rgba" , { r : L . r , g : L . g , b : L . b , a : R == "ahex" ? L . a : B != null ? B : 255 } , Z ) ; break ; default : if ( L &&
( L . ahex != null || L . hex != null ) ) { S . call ( g , "ahex" , L . ahex || L . hex || "00000000" , Z ) ; break } var Y = { } , ga = false , Ba = false ; if ( L . r !== undefined && ! R . indexOf ( "r" ) == - 1 ) R += "r" ; if ( L . g !== undefined && ! R . indexOf ( "g" ) == - 1 ) R += "g" ; if ( L . b !== undefined && ! R . indexOf ( "b" ) == - 1 ) R += "b" ; if ( L . a !== undefined && ! R . indexOf ( "a" ) == - 1 ) R += "a" ; if ( L . h !== undefined && ! R . indexOf ( "h" ) == - 1 ) R += "h" ; if ( L . s !== undefined && ! R . indexOf ( "s" ) == - 1 ) R += "s" ; if ( L . v !== undefined && ! R . indexOf ( "v" ) == - 1 ) R += "v" ; for ( qa = 0 ; qa < R . length ; qa ++ ) switch ( R . charAt ( qa ) ) { case "r" : if ( Ba ) continue ;
ga = true ; Y . r = L && L . r && L . r | 0 || L && L | 0 || 0 ; if ( Y . r < 0 ) Y . r = 0 ; else if ( Y . r > 255 ) Y . r = 255 ; if ( d != Y . r ) { d = Y . r ; aa = true } break ; case "g" : if ( Ba ) continue ; ga = true ; Y . g = L && L . g && L . g | 0 || L && L | 0 || 0 ; if ( Y . g < 0 ) Y . g = 0 ; else if ( Y . g > 255 ) Y . g = 255 ; if ( p != Y . g ) { p = Y . g ; aa = true } break ; case "b" : if ( Ba ) continue ; ga = true ; Y . b = L && L . b && L . b | 0 || L && L | 0 || 0 ; if ( Y . b < 0 ) Y . b = 0 ; else if ( Y . b > 255 ) Y . b = 255 ; if ( w != Y . b ) { w = Y . b ; aa = true } break ; case "a" : Y . a = L && L . a != null ? L . a | 0 : L != null ? L | 0 : 255 ; if ( Y . a < 0 ) Y . a = 0 ; else if ( Y . a > 255 ) Y . a = 255 ; if ( B != Y . a ) { B = Y . a ; aa = true } break ; case "h" : if ( ga ) continue ;
Ba = true ; Y . h = L && L . h && L . h | 0 || L && L | 0 || 0 ; if ( Y . h < 0 ) Y . h = 0 ; else if ( Y . h > 360 ) Y . h = 360 ; if ( v != Y . h ) { v = Y . h ; aa = true } break ; case "s" : if ( ga ) continue ; Ba = true ; Y . s = L && L . s != null ? L . s | 0 : L != null ? L | 0 : 100 ; if ( Y . s < 0 ) Y . s = 0 ; else if ( Y . s > 100 ) Y . s = 100 ; if ( N != Y . s ) { N = Y . s ; aa = true } break ; case "v" : if ( ga ) continue ; Ba = true ; Y . v = L && L . v != null ? L . v | 0 : L != null ? L | 0 : 100 ; if ( Y . v < 0 ) Y . v = 0 ; else if ( Y . v > 100 ) Y . v = 100 ; if ( Q != Y . v ) { Q = Y . v ; aa = true } } if ( aa ) { if ( ga ) { d = d || 0 ; p = p || 0 ; w = w || 0 ; L = s . rgbToHsv ( { r : d , g : p , b : w } ) ; v = L . h ; N = L . s ; Q = L . v } else if ( Ba ) { v = v || 0 ; N = N != null ? N : 100 ; Q =
Q != null ? Q : 100 ; L = s . hsvToRgb ( { h : v , s : N , v : Q } ) ; d = L . r ; p = L . g ; w = L . b } B = B != null ? B : 255 ; I . call ( g , Z || g ) } } } } ; a . extend ( true , g , { val : S , bind : function ( R ) { a . isFunction ( R ) && K . push ( R ) } , unbind : function ( R ) { if ( a . isFunction ( R ) ) for ( var L ; ( L = a . inArray ( R , K ) ) != - 1 ; ) K . splice ( L , 1 ) } , destroy : function ( ) { K = null } } ) ; if ( c ) if ( c . ahex != null ) S ( "ahex" , c ) ; else if ( c . hex != null ) S ( ( c . a != null ? "a" : "" ) + "hex" , c . a != null ? { ahex : c . hex + s . intToHex ( c . a ) } : c ) ; else if ( c . r != null && c . g != null && c . b != null ) S ( "rgb" + ( c . a != null ? "a" : "" ) , c ) ; else if ( c . h != null && c . s != null &&
c . v != null ) S ( "hsv" + ( c . a != null ? "a" : "" ) , c ) } , ColorMethods : { hexToRgba : function ( c ) { c = this . validateHex ( c ) ; if ( c == "" ) return { r : null , g : null , b : null , a : null } ; var g = "00" , d = "00" , p = "00" , w = "255" ; if ( c . length == 6 ) c += "ff" ; if ( c . length > 6 ) { g = c . substring ( 0 , 2 ) ; d = c . substring ( 2 , 4 ) ; p = c . substring ( 4 , 6 ) ; w = c . substring ( 6 , c . length ) } else { if ( c . length > 4 ) { g = c . substring ( 4 , c . length ) ; c = c . substring ( 0 , 4 ) } if ( c . length > 2 ) { d = c . substring ( 2 , c . length ) ; c = c . substring ( 0 , 2 ) } if ( c . length > 0 ) p = c . substring ( 0 , c . length ) } return { r : this . hexToInt ( g ) , g : this . hexToInt ( d ) ,
b : this . hexToInt ( p ) , a : this . hexToInt ( w ) } } , validateHex : function ( c ) { if ( typeof c == "object" ) return "" ; c = c . toLowerCase ( ) . replace ( /[^a-f0-9]/g , "" ) ; if ( c . length > 8 ) c = c . substring ( 0 , 8 ) ; return c } , rgbaToHex : function ( c ) { return this . intToHex ( c . r ) + this . intToHex ( c . g ) + this . intToHex ( c . b ) + this . intToHex ( c . a ) } , intToHex : function ( c ) { c = ( c | 0 ) . toString ( 16 ) ; if ( c . length == 1 ) c = "0" + c ; return c . toLowerCase ( ) } , hexToInt : function ( c ) { return parseInt ( c , 16 ) } , rgbToHsv : function ( c ) { var g = c . r / 255 , d = c . g / 255 ; c = c . b / 255 ; var p = { h : 0 , s : 0 , v : 0 } , w = 0 , B =
0 ; if ( g >= d && g >= c ) { B = g ; w = d > c ? c : d } else if ( d >= c && d >= g ) { B = d ; w = g > c ? c : g } else { B = c ; w = d > g ? g : d } p . v = B ; p . s = B ? ( B - w ) / B : 0 ; if ( p . s ) { w = B - w ; p . h = g == B ? ( d - c ) / w : d == B ? 2 + ( c - g ) / w : 4 + ( g - d ) / w ; p . h = parseInt ( p . h * 60 ) ; if ( p . h < 0 ) p . h += 360 } else p . h = 0 ; p . s = p . s * 100 | 0 ; p . v = p . v * 100 | 0 ; return p } , hsvToRgb : function ( c ) { var g = { r : 0 , g : 0 , b : 0 , a : 100 } , d = c . h , p = c . s ; c = c . v ; if ( p == 0 ) g . r = c == 0 ? g . g = g . b = 0 : g . g = g . b = c * 255 / 100 | 0 ; else { if ( d == 360 ) d = 0 ; d /= 60 ; p /= 100 ; c /= 100 ; var w = d | 0 , B = d - w ; d = c * ( 1 - p ) ; var v = c * ( 1 - p * B ) ; p = c * ( 1 - p * ( 1 - B ) ) ; switch ( w ) { case 0 : g . r = c ; g . g = p ; g . b = d ; break ; case 1 : g . r =
v ; g . g = c ; g . b = d ; break ; case 2 : g . r = d ; g . g = c ; g . b = p ; break ; case 3 : g . r = d ; g . g = v ; g . b = c ; break ; case 4 : g . r = p ; g . g = d ; g . b = c ; break ; case 5 : g . r = c ; g . g = d ; g . b = v } g . r = g . r * 255 | 0 ; g . g = g . g * 255 | 0 ; g . b = g . b * 255 | 0 } return g } } } ; var b = a . jPicker . Color , l = a . jPicker . List , s = a . jPicker . ColorMethods ; a . fn . jPicker = function ( c ) { var g = arguments ; return this . each ( function ( ) { var d = this , p = a . extend ( true , { } , a . fn . jPicker . defaults , c ) ; if ( a ( d ) . get ( 0 ) . nodeName . toLowerCase ( ) == "input" ) { a . extend ( true , p , { window : { bindToInput : true , expandable : true , input : a ( d ) } } ) ; if ( a ( d ) . val ( ) ==
"" ) { p . color . active = new b ( { hex : null } ) ; p . color . current = new b ( { hex : null } ) } else if ( s . validateHex ( a ( d ) . val ( ) ) ) { p . color . active = new b ( { hex : a ( d ) . val ( ) , a : p . color . active . val ( "a" ) } ) ; p . color . current = new b ( { hex : a ( d ) . val ( ) , a : p . color . active . val ( "a" ) } ) } } if ( p . window . expandable ) a ( d ) . after ( '<span class="jPicker"><span class="Icon"><span class="Color"> </span><span class="Alpha"> </span><span class="Image" title="Click To Open Color Picker"> </span><span class="Container"> </span></span></span>' ) ;
else p . window . liveUpdate = false ; var w = parseFloat ( navigator . appVersion . split ( "MSIE" ) [ 1 ] ) < 7 && document . body . filters , B = null , v = null , N = null , Q = null , K = null , I = null , S = null , R = null , L = null , Z = null , qa = null , aa = null , Y = null , ga = null , Ba = null , ja = null , da = null , U = null , X = null , na = null , oa = null , ma = null , la = null , ya = null , za = null , Ja = null , Ia = null , Fa = null , Ma = function ( M ) { var P = ka . active , ea = P . val ( "hex" ) , Ea , Oa ; p . color . mode = M ; switch ( M ) { case "h" : setTimeout ( function ( ) { Ta . call ( d , v , "transparent" ) ; Ga . call ( d , Q , 0 ) ; ta . call ( d , Q , 100 ) ; Ga . call ( d ,
K , 260 ) ; ta . call ( d , K , 100 ) ; Ta . call ( d , N , "transparent" ) ; Ga . call ( d , S , 0 ) ; ta . call ( d , S , 100 ) ; Ga . call ( d , R , 260 ) ; ta . call ( d , R , 100 ) ; Ga . call ( d , L , 260 ) ; ta . call ( d , L , 100 ) ; Ga . call ( d , Z , 260 ) ; ta . call ( d , Z , 100 ) ; Ga . call ( d , aa , 260 ) ; ta . call ( d , aa , 100 ) } , 0 ) ; Y . range ( "all" , { minX : 0 , maxX : 100 , minY : 0 , maxY : 100 } ) ; ga . range ( "rangeY" , { minY : 0 , maxY : 360 } ) ; if ( P . val ( "ahex" ) == null ) break ; Y . val ( "xy" , { x : P . val ( "s" ) , y : 100 - P . val ( "v" ) } , Y ) ; ga . val ( "y" , 360 - P . val ( "h" ) , ga ) ; break ; case "s" : setTimeout ( function ( ) { Ta . call ( d , v , "transparent" ) ; Ga . call ( d , Q , - 260 ) ; Ga . call ( d ,
K , - 520 ) ; Ga . call ( d , S , - 260 ) ; Ga . call ( d , R , - 520 ) ; Ga . call ( d , aa , 260 ) ; ta . call ( d , aa , 100 ) } , 0 ) ; Y . range ( "all" , { minX : 0 , maxX : 360 , minY : 0 , maxY : 100 } ) ; ga . range ( "rangeY" , { minY : 0 , maxY : 100 } ) ; if ( P . val ( "ahex" ) == null ) break ; Y . val ( "xy" , { x : P . val ( "h" ) , y : 100 - P . val ( "v" ) } , Y ) ; ga . val ( "y" , 100 - P . val ( "s" ) , ga ) ; break ; case "v" : setTimeout ( function ( ) { Ta . call ( d , v , "000000" ) ; Ga . call ( d , Q , - 780 ) ; Ga . call ( d , K , 260 ) ; Ta . call ( d , N , ea ) ; Ga . call ( d , S , - 520 ) ; Ga . call ( d , R , 260 ) ; ta . call ( d , R , 100 ) ; Ga . call ( d , aa , 260 ) ; ta . call ( d , aa , 100 ) } , 0 ) ; Y . range ( "all" , { minX : 0 , maxX : 360 ,
minY : 0 , maxY : 100 } ) ; ga . range ( "rangeY" , { minY : 0 , maxY : 100 } ) ; if ( P . val ( "ahex" ) == null ) break ; Y . val ( "xy" , { x : P . val ( "h" ) , y : 100 - P . val ( "s" ) } , Y ) ; ga . val ( "y" , 100 - P . val ( "v" ) , ga ) ; break ; case "r" : Ea = - 1040 ; Oa = - 780 ; Y . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; ga . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( P . val ( "ahex" ) == null ) break ; Y . val ( "xy" , { x : P . val ( "b" ) , y : 255 - P . val ( "g" ) } , Y ) ; ga . val ( "y" , 255 - P . val ( "r" ) , ga ) ; break ; case "g" : Ea = - 1560 ; Oa = - 1820 ; Y . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; ga . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ;
if ( P . val ( "ahex" ) == null ) break ; Y . val ( "xy" , { x : P . val ( "b" ) , y : 255 - P . val ( "r" ) } , Y ) ; ga . val ( "y" , 255 - P . val ( "g" ) , ga ) ; break ; case "b" : Ea = - 2080 ; Oa = - 2860 ; Y . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; ga . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( P . val ( "ahex" ) == null ) break ; Y . val ( "xy" , { x : P . val ( "r" ) , y : 255 - P . val ( "g" ) } , Y ) ; ga . val ( "y" , 255 - P . val ( "b" ) , ga ) ; break ; case "a" : setTimeout ( function ( ) { Ta . call ( d , v , "transparent" ) ; Ga . call ( d , Q , - 260 ) ; Ga . call ( d , K , - 520 ) ; Ga . call ( d , S , 260 ) ; Ga . call ( d , R , 260 ) ; ta . call ( d , R , 100 ) ; Ga . call ( d , aa , 0 ) ; ta . call ( d ,
aa , 100 ) } , 0 ) ; Y . range ( "all" , { minX : 0 , maxX : 360 , minY : 0 , maxY : 100 } ) ; ga . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( P . val ( "ahex" ) == null ) break ; Y . val ( "xy" , { x : P . val ( "h" ) , y : 100 - P . val ( "v" ) } , Y ) ; ga . val ( "y" , 255 - P . val ( "a" ) , ga ) ; break ; default : throw "Invalid Mode" ; } switch ( M ) { case "s" : case "v" : case "a" : setTimeout ( function ( ) { ta . call ( d , Q , 100 ) ; ta . call ( d , S , 100 ) ; Ga . call ( d , L , 260 ) ; ta . call ( d , L , 100 ) ; Ga . call ( d , Z , 260 ) ; ta . call ( d , Z , 100 ) } , 0 ) ; break ; case "r" : case "g" : case "b" : setTimeout ( function ( ) { Ta . call ( d , v , "transparent" ) ; Ta . call ( d , N , "transparent" ) ;
ta . call ( d , S , 100 ) ; ta . call ( d , Q , 100 ) ; Ga . call ( d , Q , Ea ) ; Ga . call ( d , K , Ea - 260 ) ; Ga . call ( d , S , Oa - 780 ) ; Ga . call ( d , R , Oa - 520 ) ; Ga . call ( d , L , Oa ) ; Ga . call ( d , Z , Oa - 260 ) ; Ga . call ( d , aa , 260 ) ; ta . call ( d , aa , 100 ) } , 0 ) } P . val ( "ahex" ) != null && Da . call ( d , P ) } , Da = function ( M , P ) { if ( P == null || P != ga && P != Y ) va . call ( d , M , P ) ; setTimeout ( function ( ) { kb . call ( d , M ) ; vb . call ( d , M ) ; cb . call ( d , M ) } , 0 ) } , wa = function ( M , P ) { var ea = ka . active ; if ( ! ( P != Y && ea . val ( ) == null ) ) { var Ea = M . val ( "all" ) ; switch ( p . color . mode ) { case "h" : ea . val ( "sv" , { s : Ea . x , v : 100 - Ea . y } , P ) ; break ; case "s" : case "a" : ea . val ( "hv" ,
{ h : Ea . x , v : 100 - Ea . y } , P ) ; break ; case "v" : ea . val ( "hs" , { h : Ea . x , s : 100 - Ea . y } , P ) ; break ; case "r" : ea . val ( "gb" , { g : 255 - Ea . y , b : Ea . x } , P ) ; break ; case "g" : ea . val ( "rb" , { r : 255 - Ea . y , b : Ea . x } , P ) ; break ; case "b" : ea . val ( "rg" , { r : Ea . x , g : 255 - Ea . y } , P ) } } } , ra = function ( M , P ) { var ea = ka . active ; if ( ! ( P != ga && ea . val ( ) == null ) ) switch ( p . color . mode ) { case "h" : ea . val ( "h" , { h : 360 - M . val ( "y" ) } , P ) ; break ; case "s" : ea . val ( "s" , { s : 100 - M . val ( "y" ) } , P ) ; break ; case "v" : ea . val ( "v" , { v : 100 - M . val ( "y" ) } , P ) ; break ; case "r" : ea . val ( "r" , { r : 255 - M . val ( "y" ) } , P ) ; break ;
case "g" : ea . val ( "g" , { g : 255 - M . val ( "y" ) } , P ) ; break ; case "b" : ea . val ( "b" , { b : 255 - M . val ( "y" ) } , P ) ; break ; case "a" : ea . val ( "a" , 255 - M . val ( "y" ) , P ) } } , va = function ( M , P ) { if ( P != Y ) switch ( p . color . mode ) { case "h" : var ea = M . val ( "sv" ) ; Y . val ( "xy" , { x : ea != null ? ea . s : 100 , y : 100 - ( ea != null ? ea . v : 100 ) } , P ) ; break ; case "s" : case "a" : ea = M . val ( "hv" ) ; Y . val ( "xy" , { x : ea && ea . h || 0 , y : 100 - ( ea != null ? ea . v : 100 ) } , P ) ; break ; case "v" : ea = M . val ( "hs" ) ; Y . val ( "xy" , { x : ea && ea . h || 0 , y : 100 - ( ea != null ? ea . s : 100 ) } , P ) ; break ; case "r" : ea = M . val ( "bg" ) ; Y . val ( "xy" , { x : ea &&
ea . b || 0 , y : 255 - ( ea && ea . g || 0 ) } , P ) ; break ; case "g" : ea = M . val ( "br" ) ; Y . val ( "xy" , { x : ea && ea . b || 0 , y : 255 - ( ea && ea . r || 0 ) } , P ) ; break ; case "b" : ea = M . val ( "rg" ) ; Y . val ( "xy" , { x : ea && ea . r || 0 , y : 255 - ( ea && ea . g || 0 ) } , P ) } if ( P != ga ) switch ( p . color . mode ) { case "h" : ga . val ( "y" , 360 - ( M . val ( "h" ) || 0 ) , P ) ; break ; case "s" : ea = M . val ( "s" ) ; ga . val ( "y" , 100 - ( ea != null ? ea : 100 ) , P ) ; break ; case "v" : ea = M . val ( "v" ) ; ga . val ( "y" , 100 - ( ea != null ? ea : 100 ) , P ) ; break ; case "r" : ga . val ( "y" , 255 - ( M . val ( "r" ) || 0 ) , P ) ; break ; case "g" : ga . val ( "y" , 255 - ( M . val ( "g" ) || 0 ) , P ) ; break ; case "b" : ga . val ( "y" ,
255 - ( M . val ( "b" ) || 0 ) , P ) ; break ; case "a" : ea = M . val ( "a" ) ; ga . val ( "y" , 255 - ( ea != null ? ea : 255 ) , P ) } } , kb = function ( M ) { try { var P = M . val ( "all" ) ; na . css ( { backgroundColor : P && "#" + P . hex || "transparent" } ) ; ta . call ( d , na , P && Math . precision ( P . a * 100 / 255 , 4 ) || 0 ) } catch ( ea ) { } } , vb = function ( M ) { switch ( p . color . mode ) { case "h" : Ta . call ( d , v , ( new b ( { h : M . val ( "h" ) || 0 , s : 100 , v : 100 } ) ) . val ( "hex" ) ) ; break ; case "s" : case "a" : var P = M . val ( "s" ) ; ta . call ( d , K , 100 - ( P != null ? P : 100 ) ) ; break ; case "v" : P = M . val ( "v" ) ; ta . call ( d , Q , P != null ? P : 100 ) ; break ; case "r" : ta . call ( d ,
K , Math . precision ( ( M . val ( "r" ) || 0 ) / 255 * 100 , 4 ) ) ; break ; case "g" : ta . call ( d , K , Math . precision ( ( M . val ( "g" ) || 0 ) / 255 * 100 , 4 ) ) ; break ; case "b" : ta . call ( d , K , Math . precision ( ( M . val ( "b" ) || 0 ) / 255 * 100 ) ) } M = M . val ( "a" ) ; ta . call ( d , I , Math . precision ( ( 255 - ( M || 0 ) ) * 100 / 255 , 4 ) ) } , cb = function ( M ) { switch ( p . color . mode ) { case "h" : var P = M . val ( "a" ) ; ta . call ( d , qa , Math . precision ( ( 255 - ( P || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "s" : P = M . val ( "hva" ) ; var ea = new b ( { h : P && P . h || 0 , s : 100 , v : P != null ? P . v : 100 } ) ; Ta . call ( d , N , ea . val ( "hex" ) ) ; ta . call ( d , R , 100 - ( P != null ? P . v :
100 ) ) ; ta . call ( d , qa , Math . precision ( ( 255 - ( P && P . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "v" : P = M . val ( "hsa" ) ; ea = new b ( { h : P && P . h || 0 , s : P != null ? P . s : 100 , v : 100 } ) ; Ta . call ( d , N , ea . val ( "hex" ) ) ; ta . call ( d , qa , Math . precision ( ( 255 - ( P && P . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "r" : case "g" : case "b" : ea = P = 0 ; M = M . val ( "rgba" ) ; if ( p . color . mode == "r" ) { P = M && M . b || 0 ; ea = M && M . g || 0 } else if ( p . color . mode == "g" ) { P = M && M . b || 0 ; ea = M && M . r || 0 } else if ( p . color . mode == "b" ) { P = M && M . r || 0 ; ea = M && M . g || 0 } var Ea = ea > P ? P : ea ; ta . call ( d , R , P > ea ? Math . precision ( ( P - ea ) / ( 255 - ea ) * 100 ,
4 ) : 0 ) ; ta . call ( d , L , ea > P ? Math . precision ( ( ea - P ) / ( 255 - P ) * 100 , 4 ) : 0 ) ; ta . call ( d , Z , Math . precision ( Ea / 255 * 100 , 4 ) ) ; ta . call ( d , qa , Math . precision ( ( 255 - ( M && M . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "a" : P = M . val ( "a" ) ; Ta . call ( d , N , M . val ( "hex" ) || "000000" ) ; ta . call ( d , qa , P != null ? 0 : 100 ) ; ta . call ( d , aa , P != null ? 100 : 0 ) } } , Ta = function ( M , P ) { M . css ( { backgroundColor : P && P . length == 6 && "#" + P || "transparent" } ) } , Va = function ( M , P ) { if ( w && ( P . indexOf ( "AlphaBar.png" ) != - 1 || P . indexOf ( "Bars.png" ) != - 1 || P . indexOf ( "Maps.png" ) != - 1 ) ) { M . attr ( "pngSrc" , P ) ; M . css ( { backgroundImage : "none" ,
filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + P + "', sizingMethod='scale')" } ) } else M . css ( { backgroundImage : "url('" + P + "')" } ) } , Ga = function ( M , P ) { M . css ( { top : P + "px" } ) } , ta = function ( M , P ) { M . css ( { visibility : P > 0 ? "visible" : "hidden" } ) ; if ( P > 0 && P < 100 ) if ( w ) { var ea = M . attr ( "pngSrc" ) ; ea != null && ( ea . indexOf ( "AlphaBar.png" ) != - 1 || ea . indexOf ( "Bars.png" ) != - 1 || ea . indexOf ( "Maps.png" ) != - 1 ) ? M . css ( { filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + ea + "', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity=" +
P + ")" } ) : M . css ( { opacity : Math . precision ( P / 100 , 4 ) } ) } else M . css ( { opacity : Math . precision ( P / 100 , 4 ) } ) ; else if ( P == 0 || P == 100 ) if ( w ) { ea = M . attr ( "pngSrc" ) ; ea != null && ( ea . indexOf ( "AlphaBar.png" ) != - 1 || ea . indexOf ( "Bars.png" ) != - 1 || ea . indexOf ( "Maps.png" ) != - 1 ) ? M . css ( { filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + ea + "', sizingMethod='scale')" } ) : M . css ( { opacity : "" } ) } else M . css ( { opacity : "" } ) } , $a = function ( ) { ka . active . val ( "ahex" , ka . current . val ( "ahex" ) ) } , Ka = function ( ) { ka . current . val ( "ahex" , ka . active . val ( "ahex" ) ) } ,
Sa = function ( M ) { a ( this ) . parents ( "tbody:first" ) . find ( 'input:radio[value!="' + M . target . value + '"]' ) . removeAttr ( "checked" ) ; Ma . call ( d , M . target . value ) } , Ha = function ( ) { $a . call ( d ) } , db = function ( ) { $a . call ( d ) ; p . window . expandable && fb . call ( d ) ; a . isFunction ( ob ) && ob . call ( d , ka . active , la ) } , lb = function ( ) { Ka . call ( d ) ; p . window . expandable && fb . call ( d ) ; a . isFunction ( ib ) && ib . call ( d , ka . active , ma ) } , Ua = function ( ) { pb . call ( d ) } , Xa = function ( M ) { var P = M . val ( "hex" ) ; oa . css ( { backgroundColor : P && "#" + P || "transparent" } ) ; ta . call ( d , oa , Math . precision ( ( M . val ( "a" ) ||
0 ) * 100 / 255 , 4 ) ) } , wb = function ( M ) { var P = M . val ( "hex" ) ; M = M . val ( "va" ) ; za . css ( { backgroundColor : P && "#" + P || "transparent" } ) ; ta . call ( d , Ja , Math . precision ( ( 255 - ( M && M . a || 0 ) ) * 100 / 255 , 4 ) ) ; if ( p . window . bindToInput && p . window . updateInputColor ) p . window . input . css ( { backgroundColor : P && "#" + P || "transparent" , color : M == null || M . v > 75 ? "#000000" : "#ffffff" } ) } , sa = function ( M ) { ja = parseInt ( B . css ( "left" ) ) ; da = parseInt ( B . css ( "top" ) ) ; U = M . pageX ; X = M . pageY ; a ( document ) . bind ( "mousemove" , hb ) . bind ( "mouseup" , eb ) ; M . preventDefault ( ) } , hb = function ( M ) { B . css ( { left : ja -
( U - M . pageX ) + "px" , top : da - ( X - M . pageY ) + "px" } ) ; p . window . expandable && ! a . support . boxModel && B . prev ( ) . css ( { left : B . css ( "left" ) , top : B . css ( "top" ) } ) ; M . stopPropagation ( ) ; M . preventDefault ( ) ; return false } , eb = function ( M ) { a ( document ) . unbind ( "mousemove" , hb ) . unbind ( "mouseup" , eb ) ; M . stopPropagation ( ) ; M . preventDefault ( ) ; return false } , sb = function ( M ) { M . preventDefault ( ) ; M . stopPropagation ( ) ; ka . active . val ( "ahex" , a ( this ) . attr ( "title" ) || null , M . target ) ; return false } , ib = a . isFunction ( g [ 1 ] ) && g [ 1 ] || null , ab = a . isFunction ( g [ 2 ] ) && g [ 2 ] ||
null , ob = a . isFunction ( g [ 3 ] ) && g [ 3 ] || null , pb = function ( ) { ka . current . val ( "ahex" , ka . active . val ( "ahex" ) ) ; var M = function ( ) { if ( ! ( ! p . window . expandable || a . support . boxModel ) ) { var P = B . find ( "table:first" ) ; B . before ( "<iframe/>" ) ; B . prev ( ) . css ( { width : P . width ( ) , height : B . height ( ) , opacity : 0 , position : "absolute" , left : B . css ( "left" ) , top : B . css ( "top" ) } ) } } ; if ( p . window . expandable ) { a ( document . body ) . children ( "div.jPicker.Container" ) . css ( { zIndex : 10 } ) ; B . css ( { zIndex : 20 } ) } switch ( p . window . effects . type ) { case "fade" : B . fadeIn ( p . window . effects . speed . show ,
M ) ; break ; case "slide" : B . slideDown ( p . window . effects . speed . show , M ) ; break ; default : B . show ( p . window . effects . speed . show , M ) } } , fb = function ( ) { var M = function ( ) { p . window . expandable && B . css ( { zIndex : 10 } ) ; ! p . window . expandable || a . support . boxModel || B . prev ( ) . remove ( ) } ; switch ( p . window . effects . type ) { case "fade" : B . fadeOut ( p . window . effects . speed . hide , M ) ; break ; case "slide" : B . slideUp ( p . window . effects . speed . hide , M ) ; break ; default : B . hide ( p . window . effects . speed . hide , M ) } } , tb = function ( ) { var M = p . window , P = M . expandable ? a ( d ) . next ( ) . find ( ".Container:first" ) :
null ; B = M . expandable ? a ( "<div/>" ) : a ( d ) ; B . addClass ( "jPicker Container" ) ; M . expandable && B . hide ( ) ; B . get ( 0 ) . onselectstart = function ( xa ) { if ( xa . target . nodeName . toLowerCase ( ) !== "input" ) return false } ; var ea = ka . active . val ( "all" ) ; if ( M . alphaPrecision < 0 ) M . alphaPrecision = 0 ; else if ( M . alphaPrecision > 2 ) M . alphaPrecision = 2 ; var Ea = '<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>' + ( M . expandable ? '<tr><td class="Move" colspan="5"> </td></tr>' : "" ) + '<tr><td rowspan="9"><h2 class="Title">' + ( M . title || ba . text . title ) +
'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="' + ia . clientPath + ia . colorMap . arrow . file + '" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><span class="Map4"> </span><span class="Map5"> </span><span class="Map6"> </span><img src="' + ia . clientPath + ia . colorBar . arrow . file + '" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">' +
ba . text . newColor + '<div class="color_preview"><span class="Active" title="' + ba . tooltips . colors . newColor + '"> </span><span class="Current" title="' + ba . tooltips . colors . currentColor + '"> </span></div></div>' + ba . text . currentColor + '</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="' + ba . text . ok + '" title="' + ba . tooltips . buttons . ok + '"/><input type="button" class="Cancel" value="' + ba . text . cancel + '" title="' + ba . tooltips . buttons . cancel + '"/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="' +
ba . tooltips . hue . radio + '"><input type="radio" value="h"' + ( p . color . mode == "h" ? ' checked="checked"' : "" ) + '/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . h : "" ) + '" title="' + ba . tooltips . hue . textbox + '"/> \u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="' + ba . tooltips . saturation . radio + '"><input type="radio" value="s"' + ( p . color . mode == "s" ? ' checked="checked"' : "" ) + '/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea !=
null ? ea . s : "" ) + '" title="' + ba . tooltips . saturation . textbox + '"/> %</td></tr><tr class="Value"><td class="Radio"><label title="' + ba . tooltips . value . radio + '"><input type="radio" value="v"' + ( p . color . mode == "v" ? ' checked="checked"' : "" ) + '/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . v : "" ) + '" title="' + ba . tooltips . value . textbox + '"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="' + ba . tooltips . red . radio + '"><input type="radio" value="r"' +
( p . color . mode == "r" ? ' checked="checked"' : "" ) + '/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . r : "" ) + '" title="' + ba . tooltips . red . textbox + '"/></td></tr><tr class="Green"><td class="Radio"><label title="' + ba . tooltips . green . radio + '"><input type="radio" value="g"' + ( p . color . mode == "g" ? ' checked="checked"' : "" ) + '/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . g : "" ) + '" title="' + ba . tooltips . green . textbox + '"/></td></tr><tr class="Blue"><td class="Radio"><label title="' +
ba . tooltips . blue . radio + '"><input type="radio" value="b"' + ( p . color . mode == "b" ? ' checked="checked"' : "" ) + '/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . b : "" ) + '" title="' + ba . tooltips . blue . textbox + '"/></td></tr><tr class="Alpha"><td class="Radio">' + ( M . alphaSupport ? '<label title="' + ba . tooltips . alpha . radio + '"><input type="radio" value="a"' + ( p . color . mode == "a" ? ' checked="checked"' : "" ) + "/>A:</label>" : " " ) + '</td><td class="Text">' + ( M . alphaSupport ? '<input type="text" maxlength="' +
( 3 + M . alphaPrecision ) + '" value="' + ( ea != null ? Math . precision ( ea . a * 100 / 255 , M . alphaPrecision ) : "" ) + '" title="' + ba . tooltips . alpha . textbox + '"/> %' : " " ) + '</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="' + ba . tooltips . hex . textbox + '">#:<input type="text" maxlength="6" class="Hex" value="' + ( ea != null ? ea . hex : "" ) + '"/></label>' + ( M . alphaSupport ? '<input type="text" maxlength="2" class="AHex" value="' + ( ea != null ? ea . ahex . substring ( 6 ) : "" ) + '" title="' + ba . tooltips . hex . alpha + '"/></td>' : " " ) +
"</tr></tbody></table>" ; if ( M . expandable ) { B . html ( Ea ) ; a ( document . body ) . children ( "div.jPicker.Container" ) . length == 0 ? a ( document . body ) . prepend ( B ) : a ( document . body ) . children ( "div.jPicker.Container:last" ) . after ( B ) ; B . mousedown ( function ( ) { a ( document . body ) . children ( "div.jPicker.Container" ) . css ( { zIndex : 10 } ) ; B . css ( { zIndex : 20 } ) } ) ; B . css ( { left : M . position . x == "left" ? P . offset ( ) . left - 530 - ( M . position . y == "center" ? 25 : 0 ) + "px" : M . position . x == "center" ? P . offset ( ) . left - 260 + "px" : M . position . x == "right" ? P . offset ( ) . left - 10 + ( M . position . y ==
"center" ? 25 : 0 ) + "px" : M . position . x == "screenCenter" ? ( a ( document ) . width ( ) >> 1 ) - 260 + "px" : P . offset ( ) . left + parseInt ( M . position . x ) + "px" , position : "absolute" , top : M . position . y == "top" ? P . offset ( ) . top - 312 + "px" : M . position . y == "center" ? P . offset ( ) . top - 156 + "px" : M . position . y == "bottom" ? P . offset ( ) . top + 25 + "px" : P . offset ( ) . top + parseInt ( M . position . y ) + "px" } ) } else { B = a ( d ) ; B . html ( Ea ) } Ea = B . find ( "tbody:first" ) ; v = Ea . find ( "div.Map:first" ) ; N = Ea . find ( "div.Bar:first" ) ; var Oa = v . find ( "span" ) , Wa = N . find ( "span" ) ; Q = Oa . filter ( ".Map1:first" ) ;
K = Oa . filter ( ".Map2:first" ) ; I = Oa . filter ( ".Map3:first" ) ; S = Wa . filter ( ".Map1:first" ) ; R = Wa . filter ( ".Map2:first" ) ; L = Wa . filter ( ".Map3:first" ) ; Z = Wa . filter ( ".Map4:first" ) ; qa = Wa . filter ( ".Map5:first" ) ; aa = Wa . filter ( ".Map6:first" ) ; Y = new o ( v , { map : { width : ia . colorMap . width , height : ia . colorMap . height } , arrow : { image : ia . clientPath + ia . colorMap . arrow . file , width : ia . colorMap . arrow . width , height : ia . colorMap . arrow . height } } ) ; Y . bind ( wa ) ; ga = new o ( N , { map : { width : ia . colorBar . width , height : ia . colorBar . height } , arrow : { image : ia . clientPath +
ia . colorBar . arrow . file , width : ia . colorBar . arrow . width , height : ia . colorBar . arrow . height } } ) ; ga . bind ( ra ) ; Ba = new e ( Ea , ka . active , M . expandable && M . bindToInput ? M . input : null , M . alphaPrecision ) ; Oa = ea != null ? ea . hex : null ; var Za = Ea . find ( ".Preview" ) ; Wa = Ea . find ( ".Button" ) ; na = Za . find ( ".Active:first" ) . css ( { backgroundColor : Oa && "#" + Oa || "transparent" } ) ; oa = Za . find ( ".Current:first" ) . css ( { backgroundColor : Oa && "#" + Oa || "transparent" } ) . bind ( "click" , Ha ) ; ta . call ( d , oa , Math . precision ( ka . current . val ( "a" ) * 100 ) / 255 , 4 ) ; ma = Wa . find ( ".Ok:first" ) . bind ( "click touchstart" ,
lb ) ; la = Wa . find ( ".Cancel:first" ) . bind ( "click touchstart" , db ) ; ya = Wa . find ( ".Grid:first" ) ; setTimeout ( function ( ) { Va . call ( d , Q , ia . clientPath + "Maps.png" ) ; Va . call ( d , K , ia . clientPath + "Maps.png" ) ; Va . call ( d , I , ia . clientPath + "map-opacity.png" ) ; Va . call ( d , S , ia . clientPath + "Bars.png" ) ; Va . call ( d , R , ia . clientPath + "Bars.png" ) ; Va . call ( d , L , ia . clientPath + "Bars.png" ) ; Va . call ( d , Z , ia . clientPath + "Bars.png" ) ; Va . call ( d , qa , ia . clientPath + "bar-opacity.png" ) ; Va . call ( d , aa , ia . clientPath + "AlphaBar.png" ) ; Va . call ( d , Za . find ( "div:last" ) , ia . clientPath +
"preview-opacity.png" ) } , 0 ) ; Ea . find ( "td.Radio input" ) . bind ( "click touchstart" , Sa ) ; if ( ka . quickList && ka . quickList . length > 0 ) { Wa = "" ; for ( i = 0 ; i < ka . quickList . length ; i ++ ) { if ( ( typeof ka . quickList [ i ] ) . toString ( ) . toLowerCase ( ) == "string" ) ka . quickList [ i ] = new b ( { hex : ka . quickList [ i ] } ) ; var nb = ka . quickList [ i ] . val ( "a" ) , Ra = ka . quickList [ i ] . val ( "ahex" ) ; if ( ! M . alphaSupport && Ra ) Ra = Ra . substring ( 0 , 6 ) + "ff" ; var mb = ka . quickList [ i ] . val ( "hex" ) ; Wa += '<span class="QuickColor"' + ( Ra && ' title="#' + Ra + '"' || "" ) + ' style="background-color:' +
( mb && "#" + mb || "" ) + ";" + ( mb ? "" : "background-image:url(" + ia . clientPath + "NoColor.png)" ) + ( M . alphaSupport && nb && nb < 255 ? ";opacity:" + Math . precision ( nb / 255 , 4 ) + ";filter:Alpha(opacity=" + Math . precision ( nb / 2.55 , 4 ) + ")" : "" ) + '"> </span>' } Va . call ( d , ya , ia . clientPath + "bar-opacity.png" ) ; ya . html ( Wa ) ; ya . find ( ".QuickColor" ) . click ( sb ) } Ma . call ( d , p . color . mode ) ; ka . active . bind ( Da ) ; a . isFunction ( ab ) && ka . active . bind ( ab ) ; ka . current . bind ( Xa ) ; if ( M . expandable ) { d . icon = P . parents ( ".Icon:first" ) ; za = d . icon . find ( ".Color:first" ) . css ( { backgroundColor : Oa &&
"#" + Oa || "transparent" } ) ; Ja = d . icon . find ( ".Alpha:first" ) ; Va . call ( d , Ja , ia . clientPath + "bar-opacity.png" ) ; ta . call ( d , Ja , Math . precision ( ( 255 - ( ea != null ? ea . a : 0 ) ) * 100 / 255 , 4 ) ) ; Ia = d . icon . find ( ".Image:first" ) . css ( { backgroundImage : "url('" + ia . clientPath + ia . picker . file + "')" } ) . bind ( "click" , Ua ) ; if ( M . bindToInput && M . updateInputColor ) M . input . css ( { backgroundColor : Oa && "#" + Oa || "transparent" , color : ea == null || ea . v > 75 ? "#000000" : "#ffffff" } ) ; Fa = Ea . find ( ".Move:first" ) . bind ( "mousedown" , sa ) ; ka . active . bind ( wb ) } else pb . call ( d ) } , ia =
p . images , ba = p . localization , ka = { active : ( typeof p . color . active ) . toString ( ) . toLowerCase ( ) == "string" ? new b ( { ahex : ! p . window . alphaSupport && p . color . active ? p . color . active . substring ( 0 , 6 ) + "ff" : p . color . active } ) : new b ( { ahex : ! p . window . alphaSupport && p . color . active . val ( "ahex" ) ? p . color . active . val ( "ahex" ) . substring ( 0 , 6 ) + "ff" : p . color . active . val ( "ahex" ) } ) , current : ( typeof p . color . active ) . toString ( ) . toLowerCase ( ) == "string" ? new b ( { ahex : ! p . window . alphaSupport && p . color . active ? p . color . active . substring ( 0 , 6 ) + "ff" : p . color . active } ) :
new b ( { ahex : ! p . window . alphaSupport && p . color . active . val ( "ahex" ) ? p . color . active . val ( "ahex" ) . substring ( 0 , 6 ) + "ff" : p . color . active . val ( "ahex" ) } ) , quickList : p . color . quickList } ; a . extend ( true , d , { commitCallback : ib , liveCallback : ab , cancelCallback : ob , color : ka , show : pb , hide : fb , destroy : function ( ) { B . find ( "td.Radio input touchstart" ) . unbind ( "click" , Sa ) ; oa . unbind ( "click touchstart" , Ha ) ; la . unbind ( "click touchstart" , db ) ; ma . unbind ( "click touchstart" , lb ) ; if ( p . window . expandable ) { Ia . unbind ( "click" , Ua ) ; Fa . unbind ( "mousedown" ,
sa ) ; d . icon = null } B . find ( ".QuickColor" ) . unbind ( "click" , sb ) ; aa = qa = Z = L = R = S = I = K = Q = N = v = null ; Y . destroy ( ) ; Y = null ; ga . destroy ( ) ; ga = null ; Ba . destroy ( ) ; ab = ob = ib = ya = la = ma = oa = na = Ba = null ; B . html ( "" ) ; for ( i = 0 ; i < l . length ; i ++ ) l [ i ] == d && l . splice ( i , 1 ) } } ) ; l . push ( d ) ; setTimeout ( function ( ) { tb . call ( d ) } , 0 ) } ) } ; a . fn . jPicker . defaults = { window : { title : null , effects : { type : "slide" , speed : { show : "slow" , hide : "fast" } } , position : { x : "screenCenter" , y : "top" } , expandable : false , liveUpdate : true , alphaSupport : false , alphaPrecision : 0 , updateInputColor : true } ,
color : { mode : "h" , active : new b ( { ahex : "#ffcc00ff" } ) , quickList : [ new b ( { h : 360 , s : 33 , v : 100 } ) , new b ( { h : 360 , s : 66 , v : 100 } ) , new b ( { h : 360 , s : 100 , v : 100 } ) , new b ( { h : 360 , s : 100 , v : 75 } ) , new b ( { h : 360 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 100 } ) , new b ( { h : 30 , s : 33 , v : 100 } ) , new b ( { h : 30 , s : 66 , v : 100 } ) , new b ( { h : 30 , s : 100 , v : 100 } ) , new b ( { h : 30 , s : 100 , v : 75 } ) , new b ( { h : 30 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 90 } ) , new b ( { h : 60 , s : 33 , v : 100 } ) , new b ( { h : 60 , s : 66 , v : 100 } ) , new b ( { h : 60 , s : 100 , v : 100 } ) , new b ( { h : 60 , s : 100 , v : 75 } ) , new b ( { h : 60 , s : 100 , v : 50 } ) , new b ( { h : 180 ,
s : 0 , v : 80 } ) , new b ( { h : 90 , s : 33 , v : 100 } ) , new b ( { h : 90 , s : 66 , v : 100 } ) , new b ( { h : 90 , s : 100 , v : 100 } ) , new b ( { h : 90 , s : 100 , v : 75 } ) , new b ( { h : 90 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 70 } ) , new b ( { h : 120 , s : 33 , v : 100 } ) , new b ( { h : 120 , s : 66 , v : 100 } ) , new b ( { h : 120 , s : 100 , v : 100 } ) , new b ( { h : 120 , s : 100 , v : 75 } ) , new b ( { h : 120 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 60 } ) , new b ( { h : 150 , s : 33 , v : 100 } ) , new b ( { h : 150 , s : 66 , v : 100 } ) , new b ( { h : 150 , s : 100 , v : 100 } ) , new b ( { h : 150 , s : 100 , v : 75 } ) , new b ( { h : 150 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 50 } ) , new b ( { h : 180 , s : 33 , v : 100 } ) , new b ( { h : 180 ,
s : 66 , v : 100 } ) , new b ( { h : 180 , s : 100 , v : 100 } ) , new b ( { h : 180 , s : 100 , v : 75 } ) , new b ( { h : 180 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 40 } ) , new b ( { h : 210 , s : 33 , v : 100 } ) , new b ( { h : 210 , s : 66 , v : 100 } ) , new b ( { h : 210 , s : 100 , v : 100 } ) , new b ( { h : 210 , s : 100 , v : 75 } ) , new b ( { h : 210 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 30 } ) , new b ( { h : 240 , s : 33 , v : 100 } ) , new b ( { h : 240 , s : 66 , v : 100 } ) , new b ( { h : 240 , s : 100 , v : 100 } ) , new b ( { h : 240 , s : 100 , v : 75 } ) , new b ( { h : 240 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 20 } ) , new b ( { h : 270 , s : 33 , v : 100 } ) , new b ( { h : 270 , s : 66 , v : 100 } ) , new b ( { h : 270 , s : 100 , v : 100 } ) ,
new b ( { h : 270 , s : 100 , v : 75 } ) , new b ( { h : 270 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 10 } ) , new b ( { h : 300 , s : 33 , v : 100 } ) , new b ( { h : 300 , s : 66 , v : 100 } ) , new b ( { h : 300 , s : 100 , v : 100 } ) , new b ( { h : 300 , s : 100 , v : 75 } ) , new b ( { h : 300 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 0 } ) , new b ( { h : 330 , s : 33 , v : 100 } ) , new b ( { h : 330 , s : 66 , v : 100 } ) , new b ( { h : 330 , s : 100 , v : 100 } ) , new b ( { h : 330 , s : 100 , v : 75 } ) , new b ( { h : 330 , s : 100 , v : 50 } ) , new b ] } , images : { clientPath : "/jPicker/images/" , colorMap : { width : 256 , height : 256 , arrow : { file : "mappoint.gif" , width : 15 , height : 15 } } , colorBar : { width : 20 ,
height : 256 , arrow : { file : "rangearrows.gif" , width : 20 , height : 7 } } , picker : { file : "picker.gif" , width : 25 , height : 24 } } , localization : { text : { title : "Drag Markers To Pick A Color" , newColor : "new" , currentColor : "current" , ok : "OK" , cancel : "Cancel" } , tooltips : { colors : { newColor : "New Color - Press “OK” To Commit" , currentColor : "Click To Revert To Original Color" } , buttons : { ok : "Commit To This Color Selection" , cancel : "Cancel And Revert To Original Color" } , hue : { radio : "Set To “Hue” Color Mode" , textbox : "Enter A “Hue” Value (0-360°)" } ,
saturation : { radio : "Set To “Saturation” Color Mode" , textbox : "Enter A “Saturation” Value (0-100%)" } , value : { radio : "Set To “Value” Color Mode" , textbox : "Enter A “Value” Value (0-100%)" } , red : { radio : "Set To “Red” Color Mode" , textbox : "Enter A “Red” Value (0-255)" } , green : { radio : "Set To “Green” Color Mode" , textbox : "Enter A “Green” Value (0-255)" } , blue : { radio : "Set To “Blue” Color Mode" , textbox : "Enter A “Blue” Value (0-255)" } ,
alpha : { radio : "Set To “Alpha” Color Mode" , textbox : "Enter A “Alpha” Value (0-100)" } , hex : { textbox : "Enter A “Hex” Color Value (#000000-#ffffff)" , alpha : "Enter A “Alpha” Value (#00-#ff)" } } } } } ) ( jQuery , "1.1.6" ) ; ( function ( a ) { function o ( l ) { var s = l || window . event , c = [ ] . slice . call ( arguments , 1 ) , g = 0 , d = 0 , p = 0 ; l = a . event . fix ( s ) ; l . type = "mousewheel" ; if ( s . wheelDelta ) g = s . wheelDelta / 120 ; if ( s . detail ) g = - s . detail / 3 ; p = g ; if ( s . axis !== undefined && s . axis === s . HORIZONTAL _AXIS ) { p = 0 ; d = - 1 * g } if ( s . wheelDeltaY !== undefined ) p = s . wheelDeltaY / 120 ; if ( s . wheelDeltaX !== undefined ) d = - 1 * s . wheelDeltaX / 120 ; c . unshift ( l , g , d , p ) ; return ( a . event . dispatch || a . event . handle ) . apply ( this , c ) } var e = [ "DOMMouseScroll" , "mousewheel" ] ; if ( a . event . fixHooks ) for ( var b = e . length ; b ; ) a . event . fixHooks [ e [ -- b ] ] =
a . event . mouseHooks ; a . event . special . mousewheel = { setup : function ( ) { if ( this . addEventListener ) for ( var l = e . length ; l ; ) this . addEventListener ( e [ -- l ] , o , false ) ; else this . onmousewheel = o } , teardown : function ( ) { if ( this . removeEventListener ) for ( var l = e . length ; l ; ) this . removeEventListener ( e [ -- l ] , o , false ) ; else this . onmousewheel = null } } ; a . fn . extend ( { mousewheel : function ( l ) { return l ? this . bind ( "mousewheel" , l ) : this . trigger ( "mousewheel" ) } , unmousewheel : function ( l ) { return this . unbind ( "mousewheel" , l ) } } ) } ) ( jQuery ) ; methodDraw . addExtension ( "eyedropper" , function ( a ) { var o = methodDraw . canvas , e = svgedit . history . ChangeElementCommand , b = { fillPaint : "red" , fillOpacity : 1 , strokePaint : "black" , strokeOpacity : 1 , strokeWidth : 5 , strokeDashArray : null , opacity : 1 , strokeLinecap : "butt" , strokeLinejoin : "miter" } , l = function ( s , c , g ) { var d = null ; if ( s . indexOf ( "url(#" ) === 0 ) { s = ( s = o . getRefElem ( s ) ) ? s . cloneNode ( true ) : $ ( "#" + g + "_color defs *" ) [ 0 ] ; d = { alpha : c } ; d [ s . tagName ] = s } else d = s . indexOf ( "#" ) === 0 ? { alpha : c , solidColor : s . substr ( 1 ) } : { alpha : c , solidColor : "none" } ;
return new $ . jGraduate . Paint ( d ) } ; return { name : "eyedropper" , svgicons : "extensions/eyedropper-icon.xml" , buttons : [ { id : "tool_eyedropper" , type : "mode" , title : "Eye Dropper Tool" , position : 8 , key : "I" , icon : "extensions/eyedropper.png" , events : { click : function ( ) { o . setMode ( "eyedropper" ) } } } ] , mouseDown : function ( s ) { var c = o . getMode ( ) , g = s . event ; g = g . target . id === "svgroot" ? document . getElementById ( "canvas_background" ) : g . target ; if ( c == "eyedropper" && g ) { b . fillPaint = g . getAttribute ( "fill" ) || "white" ; b . fillOpacity = g . getAttribute ( "fill-opacity" ) ||
1 ; b . strokePaint = g . getAttribute ( "stroke" ) || "none" ; b . strokeOpacity = g . getAttribute ( "stroke-opacity" ) || 1 ; b . strokeWidth = g . getAttribute ( "stroke-width" ) ; b . strokeDashArray = g . getAttribute ( "stroke-dasharray" ) ; b . strokeLinecap = g . getAttribute ( "stroke-linecap" ) ; b . strokeLinejoin = g . getAttribute ( "stroke-linejoin" ) ; b . opacity = g . getAttribute ( "opacity" ) || 1 ; s . selectedElements = s . selectedElements . filter ( Boolean ) ; if ( s . selectedElements . length ) { if ( $ . inArray ( s . selectedElements . nodeName , [ "g" , "use" ] ) == - 1 ) { var d = { } , p = function ( B ,
v , N ) { d [ v ] = B . getAttribute ( v ) ; B . setAttribute ( v , N ) } , w = new a . BatchCommand ; s . selectedElements . forEach ( function ( B ) { b . fillPaint && p ( B , "fill" , b . fillPaint ) ; b . fillOpacity && p ( B , "fill-opacity" , b . fillOpacity ) ; b . strokePaint && p ( B , "stroke" , b . strokePaint ) ; b . strokeOpacity && p ( B , "stroke-opacity" , b . strokeOpacity ) ; b . strokeWidth && p ( B , "stroke-width" , b . strokeWidth ) ; b . strokeDashArray && p ( B , "stroke-dasharray" , b . strokeDashArray ) ; b . opacity && p ( B , "opacity" , b . opacity ) ; b . strokeLinecap && p ( B , "stroke-linecap" , b . strokeLinecap ) ; b . strokeLinejoin &&
p ( B , "stroke-linejoin" , b . strokeLinejoin ) ; w . addSubCommand ( new e ( B , d ) ) ; d = { } } ) ; s = l ( b . fillPaint , b . fillOpacity * 100 , "fill" ) ; c = l ( b . strokePaint , b . strokeOpacity * 100 , "stroke" ) ; methodDraw . paintBox . fill . update ( true ) ; methodDraw . paintBox . stroke . update ( true ) ; o . undoMgr . addCommandToHistory ( w ) } } else { s = l ( b . fillPaint , b . fillOpacity * 100 , "fill" ) ; c = l ( b . strokePaint , b . strokeOpacity * 100 , "stroke" ) ; methodDraw . paintBox . fill . setPaint ( s ) ; methodDraw . paintBox . stroke . setPaint ( c ) } } } } } ) ; methodDraw . addExtension ( "view_grid" , function ( a ) { function o ( p ) { g . attr ( "width" ) ; g . attr ( "height" ) ; var w = svgedit . units . getTypeMap ( ) [ methodDraw . curConfig . baseUnit ] , B = [ 0.01 , 0.1 , 1 , 10 , 100 , 1E3 ] ; b . getContentElem ( ) . getAttribute ( "x" ) ; var v = s ; w = w * p ; var N = 100 / w , Q = 1 ; for ( p = 0 ; p < B . length ; p ++ ) { var K = B [ p ] ; Q = K ; if ( N <= K ) break } B = Q * w ; v . width = B ; v . height = B ; w = v . getContext ( "2d" ) ; N = B / 10 ; w . globalAlpha = 0.2 ; w . strokeStyle = "#000" ; for ( p = 1 ; p < 10 ; p ++ ) { Q = Math . round ( N * p ) + 0.5 ; w . moveTo ( Q , B ) ; w . lineTo ( Q , 0 ) ; w . moveTo ( B , Q ) ; w . lineTo ( 0 , Q ) } w . stroke ( ) ;
w . beginPath ( ) ; w . globalAlpha = 0.5 ; w . moveTo ( 0.5 , B ) ; w . lineTo ( 0.5 , 0 ) ; w . moveTo ( B , 0.5 ) ; w . lineTo ( 0 , 0.5 ) ; w . stroke ( ) ; v = v . toDataURL ( "image/png" ) ; d . setAttribute ( "width" , B ) ; d . setAttribute ( "height" , B ) ; d . parentNode . setAttribute ( "width" , B ) ; d . parentNode . setAttribute ( "height" , B ) ; b . setHref ( d , v ) } if ( ! document . getElementById ( "canvasGrid" ) ) { var e = document . getElementById ( "svgcanvas" ) . ownerDocument , b = methodDraw . canvas , l = false ; a = a . assignAttributes ; var s = document . createElement ( "canvas" ) ; $ ( s ) . hide ( ) . appendTo ( "body" ) ; var c = e . createElementNS ( "http://www.w3.org/2000/svg" ,
"g" ) ; a ( c , { id : "canvasGrid" , width : "100%" , height : "100%" , x : 0 , y : 0 , overflow : "visible" , display : "none" } ) ; var g = $ ( "#canvas_background" ) ; g . after ( c ) ; c = e . createElementNS ( "http://www.w3.org/2000/svg" , "pattern" ) ; a ( c , { id : "gridpattern" , patternUnits : "userSpaceOnUse" , x : 0 , y : 0 , width : 100 , height : 100 } ) ; var d = e . createElementNS ( "http://www.w3.org/2000/svg" , "image" ) ; a ( d , { x : 0 , y : 0 , width : 100 , height : 100 } ) ; c . appendChild ( d ) ; $ ( "#svgroot defs" ) . append ( c ) ; e = e . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; a ( e , { width : "100%" , height : "100%" ,
x : 0 , y : 0 , "stroke-width" : 0 , stroke : "none" , fill : "url(#gridpattern)" , style : "pointer-events: none; display:visible;" } ) ; $ ( "#canvasGrid" ) . append ( e ) } return { name : "view_grid" , zoomChanged : function ( p ) { l && o ( p ) } , buttons : [ { id : "view_grid" , type : "menu" , after : "tool_wireframe" , panel : "view_menu" , title : "View Grid" , events : { click : function ( ) { if ( $ ( "#view_grid" ) . hasClass ( "push_button_pressed" ) ) { methodDraw . curConfig . showGrid = l = false ; $ ( "#view_grid" ) . removeClass ( "push_button_pressed" ) ; $ ( "#canvasGrid" ) . attr ( "display" , "none" ) } else { methodDraw . curConfig . showGrid =
l = true ; $ ( "#view_grid" ) . addClass ( "push_button_pressed" ) ; $ ( "#canvasGrid" ) . attr ( "display" , "inline" ) ; o ( b . getZoom ( ) ) } } } } ] } } ) ; methodDraw . addExtension ( "shapes" , function ( ) { function a ( ) { $ ( "#shape_buttons" ) . empty ( ) ; $ ( "#shape_buttons" ) . append ( N . buttons ) } function o ( K ) { var I = v [ K ] ; if ( I ) { N = I ; I . buttons . length || e ( K , I ) ; a ( ) } else { $ ( "#shape_buttons" ) . html ( "Loading..." ) ; $ . getJSON ( "extensions/shapelib/" + K + ".json" , function ( S ) { N = v [ K ] = { data : S . data , size : S . size , fill : S . fill } ; e ( K , S ) ; a ( ) } ) } } function e ( K , I ) { var S = N . size || 300 , R = N . fill || false , L = S * 0.05 ; L = [ - L , - L , S + L * 2 , S + L * 2 ] . join ( " " ) ; S = R ? 0 : S / 30 ; S = ( new DOMParser ) . parseFromString ( '<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="' +
L + '"><path fill="#333" stroke="transparent" stroke-width="' + S + '" /></svg></svg>' , "text/xml" ) ; S . documentElement . setAttribute ( "width" , 40 ) ; S . documentElement . setAttribute ( "height" , 40 ) ; S = $ ( document . importNode ( S . documentElement , true ) ) ; R = I . data ; N . buttons = [ ] ; for ( var Z in R ) { L = R [ Z ] ; var qa = S . clone ( ) ; qa . find ( "path" ) . attr ( "d" , L ) ; L = qa . wrap ( '<div class="tool_button">' ) . parent ( ) . attr ( { id : Q + "_" + Z , title : Z } ) ; N . buttons . push ( L [ 0 ] ) } } var b , l , s = methodDraw . canvas , c , g , d , p = s . getRootElem ( ) , w = { } , B = { basic : "Basic" , object : "Objects" ,
symbol : "Symbols" , arrow : "Arrows" , flowchart : "Flowchart" , nature : "Nature" , game : "Cards & Chess" , dialog _balloon : "Dialog balloons" , music : "Music" , weather : "Weather & Time" , ui : "User Interface" , social : "Social Web" } , v = { basic : { data : { star _points _5 : "m1,116.58409l113.82668,0l35.17332,-108.13487l35.17334,108.13487l113.82666,0l-92.08755,66.83026l35.17514,108.13487l-92.08759,-66.83208l-92.08757,66.83208l35.17515,-108.13487l-92.08758,-66.83026z" , donut : "m1,150l0,0c0,-82.29042 66.70958,-149 149,-149l0,0c39.51724,0 77.41599,15.69816 105.35889,43.64108c27.94293,27.94293 43.64111,65.84165 43.64111,105.35892l0,0c0,82.29041 -66.70958,149 -149,149l0,0c-82.29041,0 -149,-66.70959 -149,-149zm74.5,0l0,0c0,41.1452 33.35481,74.5 74.5,74.5c41.14522,0 74.5,-33.3548 74.5,-74.5c0,-41.1452 -33.3548,-74.5 -74.5,-74.5l0,0c-41.14519,0 -74.5,33.35481 -74.5,74.5z" ,
triangle : "m1,280.375l149,-260.75l149,260.75z" , right _triangle : "m1,299l0,-298l298,298z" , diamond : "m1,150l149,-149l149,149l-149,149l-149,-149z" , pentagon : "m1.00035,116.97758l148.99963,-108.4053l148.99998,108.4053l-56.91267,175.4042l-184.1741,0l-56.91284,-175.4042z" , hexagon : "m1,149.99944l63.85715,-127.71428l170.28572,0l63.85713,127.71428l-63.85713,127.71428l-170.28572,0l-63.85715,-127.71428z" , septagon1 : "m0.99917,191.06511l29.51249,-127.7108l119.48833,-56.83673l119.48836,56.83673l29.51303,127.7108l-82.69087,102.41679l-132.62103,0l-82.69031,-102.41679z" ,
heptagon : "m1,88.28171l87.28172,-87.28171l123.43653,0l87.28172,87.28171l0,123.43654l-87.28172,87.28172l-123.43653,0l-87.28172,-87.28172l0,-123.43654z" , decagon : "m1,150.00093l28.45646,-88.40318l74.49956,-54.63682l92.08794,0l74.50002,54.63682l28.45599,88.40318l-28.45599,88.40318l-74.50002,54.63681l-92.08794,0l-74.49956,-54.63681l-28.45646,-88.40318z" , dodecagon : "m1,110.07421l39.92579,-69.14842l69.14842,-39.92579l79.85159,0l69.14842,39.92579l39.92578,69.14842l0,79.85159l-39.92578,69.14842l-69.14842,39.92578l-79.85159,0l-69.14842,-39.92578l-39.92579,-69.14842l0,-79.85159z" ,
trapezoid : "m1,299l55.875,-298l186.25001,0l55.87498,298z" , dialog _balloon _1 : "m0.99786,35.96579l0,0c0,-19.31077 15.28761,-34.96524 34.14583,-34.96524l15.52084,0l0,0l74.50001,0l139.68748,0c9.05606,0 17.74118,3.68382 24.14478,10.24108c6.40356,6.55726 10.00107,15.45081 10.00107,24.72416l0,87.41311l0,0l0,52.44785l0,0c0,19.31078 -15.2876,34.96524 -34.14584,34.96524l-139.68748,0l-97.32507,88.90848l22.82506,-88.90848l-15.52084,0c-18.85822,0 -34.14583,-15.65446 -34.14583,-34.96524l0,0l0,-52.44785l0,0z" , heart : "m150,73c61,-175 300,0 0,225c-300,-225 -61,-400 0,-225z" ,
cylinder : "m299.0007,83.77844c0,18.28676 -66.70958,33.11111 -149.00002,33.11111m149.00002,-33.11111l0,0c0,18.28676 -66.70958,33.11111 -149.00002,33.11111c-82.29041,0 -148.99997,-14.82432 -148.99997,-33.11111m0,0l0,0c0,-18.28674 66.70956,-33.1111 148.99997,-33.1111c82.29044,0 149.00002,14.82436 149.00002,33.1111l0,132.44449c0,18.28674 -66.70958,33.11105 -149.00002,33.11105c-82.29041,0 -148.99997,-14.82431 -148.99997,-33.11105z" , arrow _up : "m1.49805,149.64304l148.50121,-148.00241l148.50121,148.00241l-74.25061,0l0,148.71457l-148.5012,0l0,-148.71457z" ,
arrow _u _turn : "m1.00059,299.00055l0,-167.62497l0,0c0,-72.00411 58.37087,-130.37499 130.375,-130.37499l0,0l0,0c34.57759,0 67.73898,13.7359 92.18906,38.18595c24.45006,24.45005 38.18593,57.61144 38.18593,92.18904l0,18.625l37.24997,0l-74.49995,74.50002l-74.50002,-74.50002l37.25,0l0,-18.625c0,-30.8589 -25.0161,-55.87498 -55.87498,-55.87498l0,0l0,0c-30.85892,0 -55.875,25.01608 -55.875,55.87498l0,167.62497z" , arrow _left _up : "m0.99865,224.5l74.50004,-74.5l0,37.25l111.74991,0l0,-111.75l-37.25,0l74.5,-74.5l74.5,74.5l-37.25,0l0,186.25l-186.24989,0l0,37.25l-74.50005,-74.5z" ,
plaque : "m-0.00197,49.94376l0,0c27.5829,0 49.94327,-22.36036 49.94327,-49.94327l199.76709,0l0,0c0,27.5829 22.36037,49.94327 49.94325,49.94327l0,199.7671l0,0c-27.58289,0 -49.94325,22.36034 -49.94325,49.94325l-199.76709,0c0,-27.58292 -22.36037,-49.94325 -49.94327,-49.94325z" , page : "m249.3298,298.99744l9.9335,-39.73413l39.73413,-9.93355l-49.66763,49.66768l-248.33237,0l0,-298.00001l298.00001,0l0,248.33234" , cross : "m0.99844,99.71339l98.71494,0l0,-98.71495l101.26279,0l0,98.71495l98.71495,0l0,101.2628l-98.71495,0l0,98.71494l-101.26279,0l0,-98.71494l-98.71494,0z" ,
divide : "m150,0.99785l0,0c25.17819,0 45.58916,20.41097 45.58916,45.58916c0,25.17821 -20.41096,45.58916 -45.58916,45.58916c-25.17822,0 -45.58916,-20.41093 -45.58916,-45.58916c0,-25.1782 20.41093,-45.58916 45.58916,-45.58916zm0,296.25203c-25.17822,0 -45.58916,-20.41095 -45.58916,-45.58917c0,-25.17819 20.41093,-45.58916 45.58916,-45.58916c25.17819,0 45.58916,20.41096 45.58916,45.58916c0,25.17822 -20.41096,45.58917 -45.58916,45.58917zm-134.06754,-193.71518l268.13507,0l0,91.17833l-268.13507,0z" , minus : "m0.99887,102.39503l297.49445,0l0,95.2112l-297.49445,0z" ,
times : "m1.00089,73.36786l72.36697,-72.36697l76.87431,76.87368l76.87431,-76.87368l72.36765,72.36697l-76.87433,76.87431l76.87433,76.87431l-72.36765,72.36765l-76.87431,-76.87433l-76.87431,76.87433l-72.36697,-72.36765l76.87368,-76.87431l-76.87368,-76.87431z" } , buttons : [ ] } } , N = v . basic , Q = "shapelib" ; return { svgicons : "extensions/ext-shapes.xml" , buttons : [ { id : "tool_shapelib" , type : "mode_flyout" , position : 6 , title : "Shape library" , icon : "extensions/ext-shapes.png" , events : { click : function ( ) { s . setMode ( Q ) } } } ] , callback : function ( ) { var K =
$ ( '<div id="shape_buttons">' ) ; $ ( "#tools_shapelib > *" ) . wrapAll ( K ) ; var I = $ ( "#tools_shapelib_show" ) ; o ( "basic" ) ; $ ( "#shape_buttons" ) . mouseup ( function ( R ) { R = $ ( R . target ) . closest ( "div.tool_button" ) ; if ( R . length ) { var L = R . children ( ) . clone ( ) . attr ( { width : 24 , height : 24 } ) ; I . children ( ":not(.flyout_arrow_horiz)" ) . remove ( ) ; I . append ( L ) . attr ( "data-curopt" , "#" + R [ 0 ] . id ) . mouseup ( ) ; s . setMode ( Q ) ; l = R [ 0 ] . id . substr ( ( Q + "_" ) . length ) ; b = N . data [ l ] ; $ ( ".tools_flyout" ) . fadeOut ( ) } } ) ; K = $ ( '<div id="shape_cats">' ) ; var S = "" ; $ . each ( B , function ( R ,
L ) { S += "<div data-cat=" + R + ">" + L + "</div>" } ) ; K . html ( S ) . children ( ) . bind ( "mouseup" , function ( ) { var R = $ ( this ) ; R . siblings ( ) . removeClass ( "current" ) ; R . addClass ( "current" ) ; o ( R . attr ( "data-cat" ) ) ; return false } ) ; K . children ( ) . eq ( 0 ) . addClass ( "current" ) ; $ ( "#tools_shapelib" ) . prepend ( K ) ; I . mouseup ( function ( ) { s . setMode ( b ? Q : "select" ) } ) ; $ ( "#tool_shapelib" ) . remove ( ) ; K = $ ( "#tools_shapelib" ) . height ( ) ; $ ( "#tools_shapelib" ) . css ( { "margin-top" : - ( K / 2 ) , "margin-left" : 3 } ) } , mouseDown : function ( K ) { if ( s . getMode ( ) === Q ) { var I = g = K . start _x ;
K = d = K . start _y ; var S = s . getStyle ( ) ; c = s . addSvgElementFromJson ( { element : "path" , curStyles : true , attr : { d : b , id : s . getNextId ( ) , opacity : S . opacity / 2 , style : "pointer-events:none" } } ) ; c . setAttribute ( "d" , b ) ; if ( /[a-z]/ . test ( b ) ) { b = N . data [ l ] = s . pathActions . convertPath ( c ) ; c . setAttribute ( "d" , b ) ; s . pathActions . fixEnd ( c ) } c . setAttribute ( "transform" , "translate(" + I + "," + K + ") scale(0.005) translate(" + - I + "," + - K + ")" ) ; s . recalculateDimensions ( c ) ; s . getTransformList ( c ) ; w = c . getBBox ( ) ; totalScale = { sx : 1 , sy : 1 } ; return { started : true } } } , mouseMove : function ( K ) { if ( s . getMode ( ) ===
Q ) { var I = s . getZoom ( ) , S = K . event , R = K . mouse _x / I , L = K . mouse _y / I ; K = s . getTransformList ( c ) ; var Z = c . getBBox ( ) ; I = Z . x ; var qa = Z . y , aa = Z . width , Y = Z . height , ga = R - g , Ba = L - d , ja = { x : Math . min ( g , R ) , y : Math . min ( d , L ) , width : Math . abs ( R - g ) , height : Math . abs ( L - d ) } , da = Z = 0 ; Y = Y ? ( Y + Ba ) / Y : 1 ; aa = aa ? ( aa + ga ) / aa : 1 ; aa = ja . width / w . width ; Y = ja . height / w . height ; aa = aa || 1 ; Y = Y || 1 ; if ( R < g ) Z = w . width ; if ( L < d ) da = w . height ; R = p . createSVGTransform ( ) ; L = p . createSVGTransform ( ) ; ja = p . createSVGTransform ( ) ; R . setTranslate ( - ( I + Z ) , - ( qa + da ) ) ; if ( S . shiftKey ) { replaced = true ;
S = Math . min ( Math . abs ( aa ) , Math . abs ( Y ) ) ; aa = S * ( aa < 0 ? - 1 : 1 ) ; Y = S * ( Y < 0 ? - 1 : 1 ) ; if ( totalScale . sx != totalScale . sy ) { S = totalScale . sx > totalScale . sy ? 1 : totalScale . sx / totalScale . sy ; aa *= totalScale . sy > totalScale . sx ? 1 : totalScale . sy / totalScale . sx ; Y *= S } } totalScale . sx *= aa ; totalScale . sy *= Y ; L . setScale ( aa , Y ) ; ja . setTranslate ( I + Z , qa + da ) ; K . appendItem ( ja ) ; K . appendItem ( L ) ; K . appendItem ( R ) ; s . recalculateDimensions ( c ) ; w = c . getBBox ( ) } } , mouseUp : function ( K ) { if ( s . getMode ( ) === Q ) { if ( K . mouse _x == g && K . mouse _y == d ) return { keep : false , element : c , started : false } ;
s . setMode ( "select" ) ; return { keep : true , element : c , started : false } } } } } ) ; ( function ( ) { for ( var a = 0 , o = [ "ms" , "moz" , "webkit" , "o" ] , e = 0 ; e < o . length && ! window . requestAnimationFrame ; ++ e ) { window . requestAnimationFrame = window [ o [ e ] + "RequestAnimationFrame" ] ; window . cancelAnimationFrame = window [ o [ e ] + "CancelAnimationFrame" ] || window [ o [ e ] + "CancelRequestAnimationFrame" ] } if ( ! window . requestAnimationFrame ) window . requestAnimationFrame = function ( b ) { var l = ( new Date ) . getTime ( ) , s = Math . max ( 0 , 16 - ( l - a ) ) , c = window . setTimeout ( function ( ) { b ( l + s ) } , s ) ; a = l + s ; return c } ; if ( ! window . cancelAnimationFrame ) window . cancelAnimationFrame =
function ( b ) { clearTimeout ( b ) } } ) ( ) ; ( function ( a ) { function o ( v ) { var N = v . originalEvent ; if ( ! N . touches || N . targetTouches . length === 1 && N . touches . length === 1 ) { c . call ( this , v ) ; v = a ( this ) ; v . bind ( w , e ) ; v . bind ( p , b ) } else { clearTimeout ( B ) ; s . call ( this ) } } function e ( v ) { if ( B != null ) { var N = v . originalEvent ; v = N . changedTouches ? N . changedTouches [ 0 ] . pageX : N . pageX ; N = N . changedTouches ? N . changedTouches [ 0 ] . pageY : N . pageY ; var Q = a ( this ) . data ( "taphold.point" ) ; v = v - Q . x ; N = N - Q . y ; if ( Math . sqrt ( v * v + N * N ) > d ) { clearTimeout ( B ) ; s . call ( this ) } } } function b ( ) { clearTimeout ( B ) ; s . call ( this ) }
function l ( v ) { s . call ( this ) ; a ( this ) . data ( "taphold.handler" ) . call ( this , v ) } function s ( ) { B = null ; a ( this ) . unbind ( w , e ) ; a ( this ) . unbind ( p , b ) } function c ( v ) { if ( B == null ) { var N = this ; B = setTimeout ( function ( ) { l . call ( N , v ) } , g ) ; var Q = v . originalEvent , K = { } ; K . x = Q . changedTouches ? Q . changedTouches [ 0 ] . pageX : Q . pageX ; K . y = Q . changedTouches ? Q . changedTouches [ 0 ] . pageY : Q . pageY ; a ( this ) . data ( "taphold.point" , K ) } } var g = 1E3 , d = 5 , p = "touchend" , w = "touchmove" , B = null ; a . event . special . taphold = { setup : function ( ) { } , add : function ( v ) { a ( this ) . data ( "taphold.handler" ,
v . handler ) ; v . data ? a ( this ) . bind ( "touchstart" , v . data , o ) : a ( this ) . bind ( "touchstart" , o ) } , remove : function ( v ) { clearTimeout ( B ) ; s . call ( this ) ; v . data ? a ( this ) . unbind ( "touchstart" , v . data , o ) : a ( this ) . unbind ( "touchstart" , o ) } , teardown : function ( ) { } } } ) ( jQuery ) ;