2012-07-24 12:42:34 +00:00
( function ( a ) { function o ( g ) { if ( typeof g . data === "string" ) { var c = g . handler , m = g . data . toLowerCase ( ) . split ( " " ) ; g . handler = function ( s ) { if ( ! ( this !== s . target && ( /textarea|select/i . test ( s . target . nodeName ) || s . target . type === "text" ) ) ) { var b = s . type !== "keypress" && a . hotkeys . specialKeys [ s . which ] , f = String . fromCharCode ( s . which ) . toLowerCase ( ) , d = "" , l = { } ; if ( s . altKey && b !== "alt" ) d += "alt+" ; if ( s . ctrlKey && b !== "ctrl" ) d += "ctrl+" ; if ( s . metaKey && ! s . ctrlKey && b !== "meta" ) d += "meta+" ; if ( s . shiftKey && b !== "shift" ) d += "shift+" ; if ( b ) l [ d + b ] =
true ; else { l [ d + f ] = true ; l [ d + a . hotkeys . shiftNums [ f ] ] = true ; if ( d === "shift+" ) l [ a . hotkeys . shiftNums [ f ] ] = true } b = 0 ; for ( f = m . length ; b < f ; b ++ ) if ( l [ m [ b ] ] ) return c . 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 g ( ea ) { return typeof ea === "string" } function c ( ea ) { var aa = d . call ( arguments , 1 ) ; return function ( ) { return ea . apply ( this , aa . concat ( d . call ( arguments ) ) ) } } function m ( ea , aa , Z , la , sa ) { var na ; if ( la !== f ) { aa = Z . match ( ea ? /^([^#]*)\#?(.*)$/ : /^([^#?]*)\??([^#]*)(#?.*)/ ) ; Z = aa [ 3 ] || "" ; if ( sa === 2 && g ( la ) ) la = la . replace ( ea ? ba : R , "" ) ; else { na = q ( aa [ 2 ] ) ; la = g ( la ) ? q [ ea ? W : Q ] ( la ) : la ; la = sa === 2 ? la : sa === 1 ? a . extend ( { } , la , na ) : a . extend ( { } , na , la ) ; la = p ( la ) ; if ( ea ) la = la . replace ( ta , l ) } ea = aa [ 1 ] + ( ea ? "#" : la || ! aa [ 1 ] ? "?" : "" ) +
la + Z } else ea = aa ( Z !== f ? Z : o [ ha ] [ X ] ) ; return ea } function s ( ea , aa , Z ) { if ( aa === f || typeof aa === "boolean" ) { Z = aa ; aa = p [ ea ? W : Q ] ( ) } else aa = g ( aa ) ? aa . replace ( ea ? ba : R , "" ) : aa ; return q ( aa , Z ) } function b ( ea , aa , Z , la ) { if ( ! g ( Z ) && typeof Z !== "object" ) { la = Z ; Z = aa ; aa = f } return this . each ( function ( ) { var sa = a ( this ) , na = aa || V ( ) [ ( this . nodeName || "" ) . toLowerCase ( ) ] || "" , oa = na && sa . attr ( na ) || "" ; sa . attr ( na , p [ ea ] ( oa , Z , la ) ) } ) } var f , d = Array . prototype . slice , l = decodeURIComponent , p = a . param , B , q , M , U = a . bbq = a . bbq || { } , P , I , V , ca = a . event . special , Q = "querystring" ,
W = "fragment" , ha = "location" , X = "href" , R = /^.*\?|#.*$/g , ba = /^.*\#/ , ta , ja = { } ; p [ Q ] = c ( m , 0 , function ( ea ) { return ea . replace ( /(?:^[^?#]*\?([^#]*).*$)?.*/ , "$1" ) } ) ; p [ W ] = B = c ( m , 1 , function ( ea ) { return ea . replace ( /^[^#]*#?(.*)$/ , "$1" ) } ) ; B . noEscape = function ( ea ) { ea = ea || "" ; ea = a . map ( ea . split ( "" ) , encodeURIComponent ) ; ta = RegExp ( ea . join ( "|" ) , "g" ) } ; B . noEscape ( ",/" ) ; a . deparam = q = function ( ea , aa ) { var Z = { } , la = { "true" : true , "false" : false , "null" : null } ; a . each ( ea . replace ( /\+/g , " " ) . split ( "&" ) , function ( sa , na ) { var oa = na . split ( "=" ) , Ba =
l ( oa [ 0 ] ) , Ga = Z , Ja = 0 , Ca = Ba . split ( "][" ) , La = Ca . length - 1 ; if ( /\[/ . test ( Ca [ 0 ] ) && /\]$/ . test ( Ca [ La ] ) ) { Ca [ La ] = Ca [ La ] . replace ( /\]$/ , "" ) ; Ca = Ca . shift ( ) . split ( "[" ) . concat ( Ca ) ; La = Ca . length - 1 } else La = 0 ; if ( oa . length === 2 ) { oa = l ( oa [ 1 ] ) ; if ( aa ) oa = oa && ! isNaN ( oa ) ? + oa : oa === "undefined" ? f : la [ oa ] !== f ? la [ oa ] : oa ; if ( La ) for ( ; Ja <= La ; Ja ++ ) { Ba = Ca [ Ja ] === "" ? Ga . length : Ca [ Ja ] ; Ga = Ga [ Ba ] = Ja < La ? Ga [ Ba ] || ( Ca [ Ja + 1 ] && isNaN ( Ca [ Ja + 1 ] ) ? { } : [ ] ) : oa } else if ( a . isArray ( Z [ Ba ] ) ) Z [ Ba ] . push ( oa ) ; else Z [ Ba ] = Z [ Ba ] !== f ? [ Z [ Ba ] , oa ] : oa } else if ( Ba ) Z [ Ba ] = aa ? f : "" } ) ;
return Z } ; q [ Q ] = c ( s , 0 ) ; q [ W ] = M = c ( s , 1 ) ; a . elemUrlAttr || ( a . elemUrlAttr = function ( ea ) { return a . extend ( ja , ea ) } ) ( { a : X , base : X , iframe : "src" , img : "src" , input : "src" , form : "action" , link : X , script : "src" } ) ; V = a . elemUrlAttr ; a . fn [ Q ] = c ( b , Q ) ; a . fn [ W ] = c ( b , W ) ; U . pushState = P = function ( ea , aa ) { if ( g ( ea ) && /^#/ . test ( ea ) && aa === f ) aa = 2 ; var Z = ea !== f ; Z = B ( o [ ha ] [ X ] , Z ? ea : { } , Z ? aa : 2 ) ; o [ ha ] [ X ] = Z + ( /#/ . test ( Z ) ? "" : "#" ) } ; U . getState = I = function ( ea , aa ) { return ea === f || typeof ea === "boolean" ? M ( ea ) : M ( aa ) [ ea ] } ; U . removeState = function ( ea ) { var aa = { } ; if ( ea !==
f ) { aa = I ( ) ; a . each ( a . isArray ( ea ) ? ea : arguments , function ( Z , la ) { delete aa [ la ] } ) } P ( aa , 2 ) } ; ca . hashchange = a . extend ( ca . hashchange , { add : function ( ea ) { function aa ( la ) { var sa = la [ W ] = B ( ) ; la . getState = function ( na , oa ) { return na === f || typeof na === "boolean" ? q ( sa , na ) : q ( sa , oa ) [ na ] } ; Z . apply ( this , arguments ) } var Z ; if ( a . isFunction ( ea ) ) { Z = ea ; return aa } else { Z = ea . handler ; ea . handler = aa } } } ) } ) ( jQuery , this ) ;
( function ( a , o , g ) { function c ( B ) { B = B || o [ b ] [ f ] ; return B . replace ( /^[^#]*#?(.*)$/ , "$1" ) } var m , s = a . event . special , b = "location" , f = "href" , d = document . documentMode , l = a . browser . msie && ( d === g || d < 8 ) , p = "onhashchange" in o && ! l ; a . hashchangeDelay = 100 ; s . hashchange = a . extend ( s . hashchange , { setup : function ( ) { if ( p ) return false ; a ( m . start ) } , teardown : function ( ) { if ( p ) return false ; a ( m . stop ) } } ) ; m = function ( ) { function B ( ) { P = I = function ( V ) { return V } ; if ( l ) { U = a ( '<iframe src="javascript:0"/>' ) . hide ( ) . insertAfter ( "body" ) [ 0 ] . contentWindow ;
I = function ( ) { return c ( U . document [ b ] [ f ] ) } ; P = function ( V , ca ) { if ( V !== ca ) { var Q = U . document ; Q . open ( ) . close ( ) ; Q [ b ] . hash = "#" + V } } ; P ( c ( ) ) } } var q = { } , M , U , P , I ; q . start = function ( ) { if ( ! M ) { var V = c ( ) ; P || B ( ) ; ( function ca ( ) { var Q = c ( ) , W = I ( V ) ; if ( Q !== V ) { P ( V = Q , W ) ; a ( o ) . trigger ( "hashchange" ) } else if ( W !== V ) o [ b ] [ f ] = o [ b ] [ f ] . replace ( /#.*/ , "" ) + "#" + W ; M = setTimeout ( ca , a . hashchangeDelay ) } ) ( ) } } ; q . stop = function ( ) { if ( ! U ) { M && clearTimeout ( M ) ; M = 0 } } ; return q } ( ) } ) ( jQuery , this ) ; ( function ( a ) { var o = { } , g ; a . svgIcons = function ( c , m ) { function s ( ea , aa ) { if ( ea !== "ajax" ) { if ( V ) return ; var Z = ( U = X [ 0 ] . contentDocument ) && U . getElementById ( "svg_eof" ) ; if ( ! Z && ! ( aa && Z ) ) { ca ++ ; if ( ca < 50 ) setTimeout ( s , 20 ) ; else { f ( ) ; V = true } return } V = true } M = a ( U . firstChild ) . children ( ) ; if ( m . no _img ) setTimeout ( function ( ) { I || b ( ) } , 500 ) ; else { Z = ha + "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D" ; P = a ( new Image ) . attr ( { src : Z , width : 0 , height : 0 } ) . appendTo ( "body" ) . load ( function ( ) { b ( true ) } ) . error ( function ( ) { b ( ) } ) } }
function b ( ea , aa ) { if ( ! I ) { if ( m . no _img ) ea = false ; if ( ea ) { var Z = a ( document . createElement ( "div" ) ) ; Z . hide ( ) . appendTo ( "body" ) } if ( aa ) { var la = m . fallback _path ? m . fallback _path : "" ; a . each ( aa , function ( La , Na ) { a ( "#" + La ) ; var Ha = a ( new Image ) . attr ( { "class" : "svg_icon" , src : la + Na , width : B , height : q , alt : "icon" } ) ; ja ( Ha , La ) } ) } else for ( var sa = M . length , na = 0 ; na < sa ; na ++ ) { var oa = M [ na ] , Ba = oa . id ; if ( Ba === "svg_eof" ) break ; a ( "#" + Ba ) ; oa = oa . getElementsByTagNameNS ( l , "svg" ) [ 0 ] ; var Ga = document . createElementNS ( l , "svg" ) ; Ga . setAttributeNS ( l , "viewBox" ,
[ 0 , 0 , B , q ] . join ( " " ) ) ; var Ja = oa . getAttribute ( "width" ) , Ca = oa . getAttribute ( "height" ) ; oa . removeAttribute ( "width" ) ; oa . removeAttribute ( "height" ) ; oa . getAttribute ( "viewBox" ) || oa . setAttribute ( "viewBox" , [ 0 , 0 , Ja , Ca ] . join ( " " ) ) ; Ga . setAttribute ( "xmlns" , l ) ; Ga . setAttribute ( "width" , B ) ; Ga . setAttribute ( "height" , q ) ; Ga . setAttribute ( "xmlns:xlink" , p ) ; Ga . setAttribute ( "class" , "svg_icon" ) ; W || ( oa = oa . cloneNode ( true ) ) ; Ga . appendChild ( oa ) ; if ( ea ) { W || Ga . cloneNode ( true ) ; Z . empty ( ) . append ( Ga ) ; oa = ha + d ( Z . html ( ) ) ; oa = a ( new Image ) . attr ( { "class" : "svg_icon" ,
src : oa } ) } else oa = g ( a ( Ga ) , na ) ; ja ( oa , Ba ) } m . placement && a . each ( m . placement , function ( La , Na ) { o [ Na ] && a ( La ) . each ( function ( Ha ) { var va = o [ Na ] . clone ( ) ; if ( Ha > 0 && ! ea ) va = g ( va , Ha , true ) ; ta ( a ( this ) , va , Na ) } ) } ) ; if ( ! aa ) { ea && Z . remove ( ) ; X && X . remove ( ) ; P && P . remove ( ) } m . resize && a . resizeSvgIcons ( m . resize ) ; I = true ; m . callback && m . callback ( o ) } } function f ( ) { if ( c . indexOf ( ".svgz" ) != - 1 ) { var ea = c . replace ( ".svgz" , ".svg" ) ; window . console && console . log ( ".svgz failed, trying with .svg" ) ; a . svgIcons ( ea , m ) } else m . fallback && b ( false , m . fallback ) }
function d ( ea ) { if ( window . btoa ) return window . btoa ( ea ) ; var aa = Array ( Math . floor ( ( ea . length + 2 ) / 3 ) * 4 ) , Z , la , sa , na , oa , Ba , Ga = 0 , Ja = 0 ; do { Z = ea . charCodeAt ( Ga ++ ) ; la = ea . charCodeAt ( Ga ++ ) ; sa = ea . charCodeAt ( Ga ++ ) ; na = Z >> 2 ; Z = ( Z & 3 ) << 4 | la >> 4 ; oa = ( la & 15 ) << 2 | sa >> 6 ; Ba = sa & 63 ; if ( isNaN ( la ) ) oa = Ba = 64 ; else if ( isNaN ( sa ) ) Ba = 64 ; aa [ Ja ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( na ) ; aa [ Ja ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( Z ) ; aa [ Ja ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( oa ) ;
aa [ Ja ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( Ba ) } while ( Ga < ea . length ) ; return aa . join ( "" ) } var l = "http://www.w3.org/2000/svg" , p = "http://www.w3.org/1999/xlink" , B = m . w ? m . w : 24 , q = m . h ? m . h : 24 , M , U , P , I = false , V = false , ca = 0 , Q = navigator . userAgent , W = ! ! window . opera ; Q . indexOf ( "Safari/" ) > - 1 && Q . indexOf ( "Chrome/" ) ; var ha = "data:image/svg+xml;charset=utf-8;base64," ; if ( m . svgz ) { var X = a ( '<object data="' + c + '" type=image/svg+xml>' ) . appendTo ( "body" ) . hide ( ) ; try { U = X [ 0 ] . contentDocument ; X . load ( s ) ;
s ( 0 , true ) } catch ( R ) { f ( ) } } else { var ba = new DOMParser ; a . ajax ( { url : c , dataType : "string" , success : function ( ea ) { if ( ea ) { U = ba . parseFromString ( ea , "text/xml" ) ; a ( function ( ) { s ( "ajax" ) } ) } else a ( f ) } , error : function ( ea ) { if ( window . opera ) a ( function ( ) { f ( ) } ) ; else if ( ea . responseText ) { U = ba . parseFromString ( ea . responseText , "text/xml" ) ; U . childNodes . length || a ( f ) ; a ( function ( ) { s ( "ajax" ) } ) } else a ( f ) } } ) } var ta = function ( ea , aa , Z , la ) { W && aa . css ( "visibility" , "hidden" ) ; if ( m . replace ) { la && aa . attr ( "id" , Z ) ; ( Z = ea . attr ( "class" ) ) && aa . attr ( "class" ,
"svg_icon " + Z ) ; ea . replaceWith ( aa ) } else ea . append ( aa ) ; W && setTimeout ( function ( ) { aa . removeAttr ( "style" ) } , 1 ) } , ja = function ( ea , aa ) { if ( m . id _match === undefined || m . id _match !== false ) ta ( holder , ea , aa , true ) ; o [ aa ] = ea } ; g = function ( ea , aa ) { var Z = ea . find ( "defs" ) ; if ( ! Z . length ) return ea ; Z = W ? Z . find ( "*" ) . filter ( function ( ) { return ! ! this . id } ) : Z . find ( "[id]" ) ; var la = ea [ 0 ] . getElementsByTagName ( "*" ) , sa = la . length ; Z . each ( function ( na ) { var oa = this . id ; a ( U ) . find ( "#" + oa ) ; this . id = na = "x" + oa + aa + na ; oa = "url(#" + oa + ")" ; var Ba = "url(#" + na + ")" ;
for ( na = 0 ; na < sa ; na ++ ) { var Ga = la [ na ] ; Ga . getAttribute ( "fill" ) === oa && Ga . setAttribute ( "fill" , Ba ) ; Ga . getAttribute ( "stroke" ) === oa && Ga . setAttribute ( "stroke" , Ba ) ; Ga . getAttribute ( "filter" ) === oa && Ga . setAttribute ( "filter" , Ba ) } } ) ; return ea } } ; a . getSvgIcon = function ( c , m ) { var s = o [ c ] ; if ( m && s ) s = g ( s , 0 , true ) . clone ( true ) ; return s } ; a . resizeSvgIcons = function ( c ) { var m = ! a ( ".svg_icon:first" ) . length ; a . each ( c , function ( s , b ) { var f = a . isArray ( b ) , d = f ? b [ 0 ] : b , l = f ? b [ 1 ] : b ; if ( m ) s = s . replace ( /\.svg_icon/g , "svg" ) ; a ( s ) . each ( function ( ) { this . setAttribute ( "width" ,
d ) ; this . setAttribute ( "height" , l ) ; if ( window . opera && window . widget ) { this . parentNode . style . width = d + "px" ; this . parentNode . style . height = l + "px" } } ) } ) } } ) ( jQuery ) ; ( function ( ) { function a ( c , m , s ) { c = document . createElementNS ( o . svg , c ) ; if ( g ) for ( var b in m ) c . setAttribute ( b , m [ b ] ) ; else for ( b in m ) { var f = m [ b ] , d = c [ b ] ; if ( d && d . constructor === "SVGLength" ) d . baseVal . value = f ; else c . setAttribute ( b , f ) } s && s . appendChild ( c ) ; return c } 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 ( c ) { c = c || { } ; this . alpha = isNaN ( c . alpha ) ? 100 : c . alpha ; if ( c . copy ) { this . type =
c . copy . type ; this . alpha = c . copy . alpha ; this . radialGradient = this . linearGradient = this . solidColor = null ; switch ( this . type ) { case "solidColor" : this . solidColor = c . copy . solidColor ; break ; case "linearGradient" : this . linearGradient = c . copy . linearGradient . cloneNode ( true ) ; break ; case "radialGradient" : this . radialGradient = c . copy . radialGradient . cloneNode ( true ) } } else if ( c . linearGradient ) { this . type = "linearGradient" ; this . radialGradient = this . solidColor = null ; this . linearGradient = c . linearGradient . cloneNode ( true ) } else if ( c . radialGradient ) { this . type =
"radialGradient" ; this . linearGradient = this . solidColor = null ; this . radialGradient = c . radialGradient . cloneNode ( true ) } else if ( c . solidColor ) { this . type = "solidColor" ; this . solidColor = c . solidColor } else { this . type = "none" ; this . radialGradient = this . linearGradient = this . solidColor = null } } } ; jQuery . fn . jGraduateDefaults = { paint : new $ . jGraduate . Paint , window : { pickerTitle : "Drag markers to pick a paint" } , images : { clientPath : "images/" } , newstop : "inverse" } ; var g = navigator . userAgent . indexOf ( "Gecko/" ) >= 0 ; jQuery . fn . jGraduate = function ( c ) { var m =
arguments ; return this . each ( function ( ) { function s ( ma , ga , qa , S , O ) { var fa = O || a ( "stop" , { "stop-color" : ga , "stop-opacity" : qa , offset : ma } , ba ) ; if ( O ) { ga = O . getAttribute ( "stop-color" ) ; qa = O . getAttribute ( "stop-opacity" ) ; ma = O . getAttribute ( "offset" ) } else ba . appendChild ( fa ) ; if ( qa === null ) qa = 1 ; O = 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 + ma * W ) + ", 26)" } , Aa ) ; var Ia =
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 : ga , "fill-opacity" : qa , transform : "translate(" + ( 10 + ma * W ) + ", 26)" , stroke : "#000" , "stroke-width" : 1.5 } , Aa ) ; $ ( Ia ) . mousedown ( function ( Qa ) { b ( this ) ; $a = Ua ; V . mousemove ( l ) . mouseup ( f ) ; ya = vb . offset ( ) ; Qa . preventDefault ( ) ; return false } ) . data ( "stop" , fa ) . data ( "bg" , O ) . dblclick ( function ( ) { $ ( "div.jGraduate_LightBox" ) . show ( ) ; for ( var Qa = this , Ya = + fa . getAttribute ( "stop-opacity" ) ||
1 , kb = fa . getAttribute ( "stop-color" ) || 1 , mb = ( parseFloat ( Ya ) * 255 ) . toString ( 16 ) ; mb . length < 2 ; ) mb = "0" + mb ; ga = kb . substr ( 1 ) + mb ; $ ( "#" + q + "_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 : ga , alphaSupport : true } } , function ( nb ) { kb = nb . val ( "hex" ) ? "#" + nb . val ( "hex" ) : "none" ; Ya = nb . val ( "a" ) !== null ? nb . val ( "a" ) / 256 : 1 ; Qa . setAttribute ( "fill" , kb ) ; Qa . setAttribute ( "fill-opacity" , Ya ) ; fa . setAttribute ( "stop-color" ,
kb ) ; fa . setAttribute ( "stop-opacity" , Ya ) ; $ ( "div.jGraduate_LightBox" ) . hide ( ) ; $ ( "#" + q + "_jGraduate_stopPicker" ) . hide ( ) } , null , function ( ) { $ ( "div.jGraduate_LightBox" ) . hide ( ) ; $ ( "#" + q + "_jGraduate_stopPicker" ) . hide ( ) } ) } ) ; $ ( ba ) . find ( "stop" ) . each ( function ( ) { var Qa = $ ( this ) ; if ( + this . getAttribute ( "offset" ) > ma ) { if ( ! ga ) { var Ya = this . getAttribute ( "stop-color" ) , kb = this . getAttribute ( "stop-opacity" ) ; fa . setAttribute ( "stop-color" , Ya ) ; Ia . setAttribute ( "fill" , Ya ) ; fa . setAttribute ( "stop-opacity" , kb === null ? 1 : kb ) ; Ia . setAttribute ( "fill-opacity" ,
kb === null ? 1 : kb ) } Qa . before ( fa ) ; return false } } ) ; S && b ( Ia ) ; return fa } function b ( ma ) { Ua && Ua . setAttribute ( "stroke" , "#000" ) ; ma . setAttribute ( "stroke" , "blue" ) ; Ua = ma ; Ua . parentNode . appendChild ( Ua ) } function f ( ) { V . unbind ( "mousemove" , l ) ; if ( za . getAttribute ( "display" ) !== "none" ) { za . setAttribute ( "display" , "none" ) ; var ma = $ ( Ua ) , ga = ma . data ( "stop" ) ; ma = ma . data ( "bg" ) ; $ ( [ Ua , ga , ma ] ) . remove ( ) } $a = null } function d ( ) { var ma = Oa ? "rotate(" + Oa + "," + Za + "," + Ea + ") " : "" ; ob === 1 && fb === 1 ? ba . removeAttribute ( "gradientTransform" ) : ba . setAttribute ( "gradientTransform" ,
ma + "translate(" + - Za * ( ob - 1 ) + "," + - Ea * ( fb - 1 ) + ") scale(" + ob + "," + fb + ")" ) } function l ( ma ) { var ga = ma . pageX - ya . left ; ma = ma . pageY - ya . top ; ga = ga < 10 ? 10 : ga > W + 10 ? W + 10 : ga ; var qa = "translate(" + ga + ", 26)" ; if ( ma < - 60 || ma > 130 ) { za . setAttribute ( "display" , "block" ) ; za . setAttribute ( "transform" , qa ) } else za . setAttribute ( "display" , "none" ) ; $a . setAttribute ( "transform" , qa ) ; $ . data ( $a , "bg" ) . setAttribute ( "transform" , qa ) ; $ . data ( $a , "stop" ) . setAttribute ( "offset" , ( ga - 10 ) / W ) ; var S = 0 ; $ ( ba ) . find ( "stop" ) . each ( function ( ) { var O = this . getAttribute ( "offset" ) ,
fa = $ ( this ) ; if ( O < S ) { fa . prev ( ) . before ( fa ) ; ub = $ ( ba ) . find ( "stop" ) } S = O } ) } var p = $ ( this ) , B = $ . extend ( true , { } , jQuery . fn . jGraduateDefaults , c ) , q = p . attr ( "id" ) , M = "#" + p . attr ( "id" ) + " " ; if ( M ) { var U = function ( ) { switch ( p . paint . type ) { case "radialGradient" : p . paint . linearGradient = null ; break ; case "linearGradient" : p . paint . radialGradient = null ; break ; case "solidColor" : p . paint . radialGradient = p . paint . linearGradient = null } $ . isFunction ( p . okCallback ) && p . okCallback ( p . paint ) ; p . hide ( ) } , P = function ( ) { $ . isFunction ( p . cancelCallback ) && p . cancelCallback ( ) ;
p . hide ( ) } ; $ . extend ( true , p , { paint : new $ . jGraduate . Paint ( { copy : B . paint } ) , okCallback : $ . isFunction ( m [ 1 ] ) && m [ 1 ] || null , cancelCallback : $ . isFunction ( m [ 2 ] ) && m [ 2 ] || null } ) ; p . position ( ) ; var I = null , V = $ ( window ) ; if ( p . paint . type == "none" ) p . paint = $ . jGraduate . Paint ( { solidColor : "ffffff" } ) ; p . addClass ( "jGraduate_Picker" ) ; p . 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="' +
q + '_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>' ) ; var ca = $ ( M + "> .jGraduate_colPick" ) , Q = $ ( M + "> .jGraduate_gradPick" ) ; Q . html ( '<div id="' + q + '_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">' + B . window . pickerTitle + '</h2><div id="' + q + '_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="' + q + '_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="' +
q + '_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + q + '_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="' + q + '_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' +
q + '_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="' + q + '_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + q + '_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="' +
q + '_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="' + q + '_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + q + '_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="' +
q + '_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="' + q + '_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + q + '_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="' + q + '_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="' +
q + '_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + q + '_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="' + q + '_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="' + q + '_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="' + B . images . clientPath +
'rangearrows2.gif"></div><label><input type="text" id="' + q + '_jGraduate_AngleInput" size="3" value="0"/>\u00ba </label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="' + q + '_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="' + q + '_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + q + '_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="' +
q + '_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="' + q + '_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>' ) ; var W = 256 , ha = W - 0 , X = W - 0 , R , ba , ta , ja = { } ; $ ( ".jGraduate_SliderBar" ) . width ( 145 ) ; var ea = $ ( "#" + q + "_jGraduate_GradContainer" ) [ 0 ] , aa = a ( "svg" , { id : q + "_jgraduate_svg" , width : W , height : W , xmlns : o . svg } , ea ) ; R = R || p . paint . type ; var Z = ba = p . paint [ R ] , la = p . paint . alpha , sa = R === "solidColor" ; switch ( R ) { case "solidColor" : case "linearGradient" : if ( ! sa ) { ba . id = q + "_lg_jgraduate_grad" ; Z =
ba = aa . appendChild ( ba ) } a ( "radialGradient" , { id : q + "_rg_jgraduate_grad" } , aa ) ; if ( R === "linearGradient" ) break ; case "radialGradient" : if ( ! sa ) { ba . id = q + "_rg_jgraduate_grad" ; Z = ba = aa . appendChild ( ba ) } a ( "linearGradient" , { id : q + "_lg_jgraduate_grad" } , aa ) } if ( sa ) { Z = ba = $ ( "#" + q + "_lg_jgraduate_grad" ) [ 0 ] ; I = p . paint [ R ] ; s ( 0 , "#" + I , 1 ) ; var na = typeof B . newstop ; if ( na === "string" ) switch ( B . newstop ) { case "same" : s ( 1 , "#" + I , 1 ) ; break ; case "inverse" : na = "" ; for ( var oa = 0 ; oa < 6 ; oa += 2 ) { I . substr ( oa , 2 ) ; var Ba = ( 255 - parseInt ( I . substr ( oa , 2 ) , 16 ) ) . toString ( 16 ) ;
if ( Ba . length < 2 ) Ba = 0 + Ba ; na += Ba } s ( 1 , "#" + na , 1 ) ; break ; case "white" : s ( 1 , "#ffffff" , 1 ) ; break ; case "black" : s ( 1 , "#000000" , 1 ) } else if ( na === "object" ) s ( 1 , B . newstop . color || "#" + I , "opac" in B . newstop ? B . newstop . opac : 1 ) } I = parseFloat ( Z . getAttribute ( "x1" ) || 0 ) ; na = parseFloat ( Z . getAttribute ( "y1" ) || 0 ) ; oa = parseFloat ( Z . getAttribute ( "x2" ) || 1 ) ; Ba = parseFloat ( Z . getAttribute ( "y2" ) || 0 ) ; var Ga = parseFloat ( Z . getAttribute ( "cx" ) || 0.5 ) , Ja = parseFloat ( Z . getAttribute ( "cy" ) || 0.5 ) , Ca = parseFloat ( Z . getAttribute ( "fx" ) || Ga ) , La = parseFloat ( Z . getAttribute ( "fy" ) ||
Ja ) ; ta = a ( "rect" , { id : q + "_jgraduate_rect" , x : 0 , y : 0 , width : ha , height : X , fill : "url(#" + q + "_jgraduate_grad)" , "fill-opacity" : la / 100 } , aa ) ; var Na = $ ( "<div/>" ) . attr ( { "class" : "grad_coord jGraduate_lg_field" , title : "Begin Stop" } ) . text ( 1 ) . css ( { top : na * W , left : I * W } ) . data ( "coord" , "start" ) . appendTo ( ea ) , Ha = Na . clone ( ) . text ( 2 ) . css ( { top : Ba * W , left : oa * W } ) . attr ( "title" , "End stop" ) . data ( "coord" , "end" ) . appendTo ( ea ) , va = $ ( "<div/>" ) . attr ( { "class" : "grad_coord jGraduate_rg_field" , title : "Center stop" } ) . text ( "C" ) . css ( { top : Ja * W , left : Ga *
W } ) . data ( "coord" , "center" ) . appendTo ( ea ) , Fa = va . clone ( ) . text ( "F" ) . css ( { top : La * W , left : Ca * W , display : "none" } ) . attr ( "title" , "Focus point" ) . data ( "coord" , "focus" ) . appendTo ( ea ) ; Fa [ 0 ] . id = q + "_jGraduate_focusCoord" ; $ ( M + " .grad_coord" ) ; $ . each ( [ "x1" , "y1" , "x2" , "y2" , "cx" , "cy" , "fx" , "fy" ] , function ( ma , ga ) { var qa = ba . getAttribute ( ga ) , S = isNaN ( ga [ 1 ] ) ; qa || ( qa = S ? "0.5" : ga === "x2" ? "1.0" : "0.0" ) ; ja [ ga ] = $ ( "#" + q + "_jGraduate_" + ga ) . val ( qa ) . change ( function ( ) { if ( isNaN ( parseFloat ( this . value ) ) || this . value < 0 ) this . value = 0 ; else if ( this . value >
1 ) this . value = 1 ; if ( ! ( ga [ 0 ] === "f" && ! bb ) ) if ( S && R === "radialGradient" || ! S && R === "linearGradient" ) ba . setAttribute ( ga , this . value ) ; var O = S ? ga [ 0 ] === "c" ? va : Fa : ga [ 1 ] === "1" ? Na : Ha , fa = ga . indexOf ( "x" ) >= 0 ? "left" : "top" ; O . css ( fa , this . value * W ) } ) . change ( ) } ) ; var ub , Aa , vb = $ ( "#" + q + "_jGraduate_StopSlider" ) , Ua , Ta , $a , za = 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 ) , ya , ob = 1 , fb = 1 , Oa = 0 , Za = Ga , Ea = Ja ; Ta = a ( "svg" , { width : "100%" , height : 45 } , vb [ 0 ] ) ; ea = a ( "pattern" , { width : 16 ,
height : 16 , patternUnits : "userSpaceOnUse" , id : "jGraduate_trans" } , Ta ) ; a ( "image" , { width : 16 , height : 16 } , ea ) . setAttributeNS ( o . xlink , "xlink:href" , B . images . clientPath + "map-opacity.png" ) ; $ ( Ta ) . on ( "click touchstart" , function ( ma ) { ya = vb . offset ( ) ; if ( ma . target . tagName !== "path" ) { var ga = ma . pageX - ya . left - 8 ; ga = ga < 10 ? 10 : ga > W + 10 ? W + 10 : ga ; s ( ga / W , 0 , 0 , true ) ; ma . stopPropagation ( ) } } ) ; $ ( Ta ) . mouseover ( function ( ) { Ta . appendChild ( za ) } ) ; Aa = a ( "g" , { } , Ta ) ; a ( "line" , { x1 : 10 , y1 : 15 , x2 : W + 10 , y2 : 15 , "stroke-width" : 2 , stroke : "#000" } , Ta ) ; var pb =
Q . find ( ".jGraduate_spreadMethod" ) . change ( function ( ) { ba . setAttribute ( "spreadMethod" , $ ( this ) . val ( ) ) } ) , qb = null , gb = function ( ma ) { var ga = ma . pageX - Ma . left , qa = ma . pageY - Ma . top ; ga = ga < 0 ? 0 : ga > W ? W : ga ; qa = qa < 0 ? 0 : qa > W ? W : qa ; qb . css ( "left" , ga ) . css ( "top" , qa ) ; ga = ga / ha ; qa = qa / X ; var S = qb . data ( "coord" ) , O = ba ; switch ( S ) { case "start" : ja . x1 . val ( ga ) ; ja . y1 . val ( qa ) ; O . setAttribute ( "x1" , ga ) ; O . setAttribute ( "y1" , qa ) ; break ; case "end" : ja . x2 . val ( ga ) ; ja . y2 . val ( qa ) ; O . setAttribute ( "x2" , ga ) ; O . setAttribute ( "y2" , qa ) ; break ; case "center" : ja . cx . val ( ga ) ;
ja . cy . val ( qa ) ; O . setAttribute ( "cx" , ga ) ; O . setAttribute ( "cy" , qa ) ; Za = ga ; Ea = qa ; d ( ) ; break ; case "focus" : ja . fx . val ( ga ) ; ja . fy . val ( qa ) ; O . setAttribute ( "fx" , ga ) ; O . setAttribute ( "fy" , qa ) ; d ( ) } ma . preventDefault ( ) } , cb = function ( ) { qb = null ; V . unbind ( "mousemove" , gb ) . unbind ( "mouseup" , cb ) } ; ub = ba . getElementsByTagNameNS ( o . svg , "stop" ) ; if ( Sa < 2 ) { for ( ; Sa < 2 ; ) { ba . appendChild ( document . createElementNS ( o . svg , "stop" ) ) ; ++ Sa } ub = ba . getElementsByTagNameNS ( o . svg , "stop" ) } var Sa = ub . length ; for ( oa = 0 ; oa < Sa ; oa ++ ) s ( 0 , 0 , 0 , 0 , ub [ oa ] ) ; pb . val ( ba . getAttribute ( "spreadMethod" ) ||
"pad" ) ; var Ma , bb = false ; ta . setAttribute ( "fill-opacity" , la / 100 ) ; $ ( "#" + q + " div.grad_coord" ) . mousedown ( function ( ma ) { ma . preventDefault ( ) ; qb = $ ( this ) ; qb . offset ( ) ; Ma = qb . parent ( ) . offset ( ) ; V . mousemove ( gb ) . mouseup ( cb ) } ) ; $ ( "#" + q + "_jGraduate_Ok" ) . bind ( "click touchstart" , function ( ) { p . paint . type = R ; p . paint [ R ] = ba . cloneNode ( true ) ; p . paint . solidColor = null ; U ( ) } ) ; $ ( "#" + q + "_jGraduate_Cancel" ) . bind ( "click touchstart" , function ( ) { P ( ) } ) ; if ( R === "radialGradient" ) if ( bb ) Fa . show ( ) ; else { Fa . hide ( ) ; ja . fx . val ( "" ) ; ja . fy . val ( "" ) } $ ( "#" +
q + "_jGraduate_match_ctr" ) [ 0 ] . checked = ! bb ; var zb , xb ; $ ( "#" + q + "_jGraduate_match_ctr" ) . change ( function ( ) { bb = ! this . checked ; Fa . toggle ( bb ) ; ja . fx . val ( "" ) ; ja . fy . val ( "" ) ; var ma = ba ; if ( bb ) { var ga = zb || 0.5 , qa = xb || 0.5 ; ma . setAttribute ( "fx" , ga ) ; ma . setAttribute ( "fy" , qa ) ; ja . fx . val ( ga ) ; ja . fy . val ( qa ) } else { zb = ma . getAttribute ( "fx" ) ; xb = ma . getAttribute ( "fy" ) ; ma . removeAttribute ( "fx" ) ; ma . removeAttribute ( "fy" ) } } ) ; ub = ba . getElementsByTagNameNS ( o . svg , "stop" ) ; Sa = ub . length ; if ( Sa < 2 ) { for ( ; Sa < 2 ; ) { ba . appendChild ( document . createElementNS ( o . svg ,
"stop" ) ) ; ++ Sa } ub = ba . getElementsByTagNameNS ( o . svg , "stop" ) } var eb ; la = Q = 0 ; if ( R === "radialGradient" ) { aa = ba . gradientTransform . baseVal ; if ( aa . numberOfItems === 2 ) { Sa = aa . getItem ( 0 ) ; aa = aa . getItem ( 1 ) ; if ( Sa . type === 2 && aa . type === 3 ) { Sa = aa . matrix ; if ( Sa . a !== 1 ) Q = Math . round ( - ( 1 - Sa . a ) * 100 ) ; else if ( Sa . d !== 1 ) Q = Math . round ( ( 1 - Sa . d ) * 100 ) } } else if ( aa . numberOfItems === 3 ) { ea = aa . getItem ( 0 ) ; Sa = aa . getItem ( 1 ) ; aa = aa . getItem ( 2 ) ; if ( ea . type === 4 && Sa . type === 2 && aa . type === 3 ) { la = Math . round ( ea . angle ) ; Sa = aa . matrix ; if ( Sa . a !== 1 ) Q = Math . round ( - ( 1 -
Sa . a ) * 100 ) ; else if ( Sa . d !== 1 ) Q = Math . round ( ( 1 - Sa . d ) * 100 ) } } } Q = { radius : { handle : "#" + q + "_jGraduate_RadiusArrows" , input : "#" + q + "_jGraduate_RadiusInput" , val : ( ba . getAttribute ( "r" ) || 0.5 ) * 100 } , opacity : { handle : "#" + q + "_jGraduate_OpacArrows" , input : "#" + q + "_jGraduate_OpacInput" , val : p . paint . alpha || 100 } , ellip : { handle : "#" + q + "_jGraduate_EllipArrows" , input : "#" + q + "_jGraduate_EllipInput" , val : Q } , angle : { handle : "#" + q + "_jGraduate_AngleArrows" , input : "#" + q + "_jGraduate_AngleInput" , val : la } } ; $ . each ( Q , function ( ma , ga ) { var qa = $ ( ga . handle ) ;
qa . mousedown ( function ( S ) { var O = qa . parent ( ) ; eb = { type : ma , elem : qa , input : $ ( ga . input ) , parent : O , offset : O . offset ( ) } ; V . mousemove ( rb ) . mouseup ( Ab ) ; S . preventDefault ( ) } ) ; $ ( ga . input ) . val ( ga . val ) . change ( function ( ) { var S = + this . value , O = 0 , fa = R === "radialGradient" ; switch ( ma ) { case "radius" : fa && ba . setAttribute ( "r" , S / 100 ) ; O = Math . pow ( S / 100 , 0.4 ) / 2 * 145 ; break ; case "opacity" : p . paint . alpha = S ; ta . setAttribute ( "fill-opacity" , S / 100 ) ; O = S * 1.45 ; break ; case "ellip" : ob = fb = 1 ; if ( S === 0 ) { O = 72.5 ; break } if ( S > 99.5 ) S = 99.5 ; if ( S > 0 ) fb = 1 - S / 100 ; else ob =
- ( S / 100 ) - 1 ; O = 145 * ( ( S + 100 ) / 2 ) / 100 ; fa && d ( ) ; break ; case "angle" : Oa = S ; O = Oa / 180 ; O += 0.5 ; O *= 145 ; fa && d ( ) } if ( O > 145 ) O = 145 ; else if ( O < 0 ) O = 0 ; qa . css ( { "margin-left" : O - 5 } ) } ) . change ( ) } ) ; var rb = function ( ma ) { var ga = ma . pageX - eb . offset . left - parseInt ( eb . parent . css ( "border-left-width" ) ) ; if ( ga > 145 ) ga = 145 ; if ( ga <= 0 ) ga = 0 ; var qa = ga - 5 ; ga /= 145 ; switch ( eb . type ) { case "radius" : ga = Math . pow ( ga * 2 , 2.5 ) ; if ( ga > 0.98 && ga < 1.02 ) ga = 1 ; if ( ga <= 0.01 ) ga = 0.01 ; ba . setAttribute ( "r" , ga ) ; break ; case "opacity" : p . paint . alpha = parseInt ( ga * 100 ) ; ta . setAttribute ( "fill-opacity" ,
ga ) ; break ; case "ellip" : fb = ob = 1 ; if ( ga < 0.5 ) { ga /= 0.5 ; ob = ga <= 0 ? 0.01 : ga } else if ( ga > 0.5 ) { ga /= 0.5 ; ga = 2 - ga ; fb = ga <= 0 ? 0.01 : ga } d ( ) ; ga -= 1 ; if ( fb === ga + 1 ) ga = Math . abs ( ga ) ; break ; case "angle" : ga -= 0.5 ; Oa = ga *= 180 ; d ( ) ; ga /= 100 } eb . elem . css ( { "margin-left" : qa } ) ; ga = Math . round ( ga * 100 ) ; eb . input . val ( ga ) ; ma . preventDefault ( ) } , Ab = function ( ) { V . unbind ( "mousemove" , rb ) . unbind ( "mouseup" , Ab ) ; eb = null } ; for ( Q = ( p . paint . alpha * 255 / 100 ) . toString ( 16 ) ; Q . length < 2 ; ) Q = "0" + Q ; Q = Q . split ( "." ) [ 0 ] ; I = p . paint . solidColor == "none" ? "" : p . paint . solidColor + Q ; sa ||
( I = ub [ 0 ] . getAttribute ( "stop-color" ) ) ; $ . extend ( $ . fn . jPicker . defaults . window , { alphaSupport : true , effects : { type : "show" , speed : 0 } } ) ; ca . jPicker ( { window : { title : B . window . pickerTitle } , images : { clientPath : B . images . clientPath } , color : { active : I , alphaSupport : true } } , function ( ma ) { p . paint . type = "solidColor" ; p . paint . alpha = ma . val ( "ahex" ) ? Math . round ( ma . val ( "a" ) / 255 * 100 ) : 100 ; p . paint . solidColor = ma . val ( "hex" ) ? ma . val ( "hex" ) : "none" ; p . paint . radialGradient = null ; U ( ) } , null , function ( ) { P ( ) } ) ; var wb = $ ( M + " .jGraduate_tabs li" ) ; wb . on ( "click touchstart" ,
function ( ) { wb . removeClass ( "jGraduate_tab_current" ) ; $ ( this ) . addClass ( "jGraduate_tab_current" ) ; $ ( M + " > div" ) . hide ( ) ; var ma = $ ( this ) . attr ( "data-type" ) ; $ ( M + " .jGraduate_gradPick" ) . show ( ) ; if ( ma === "rg" || ma === "lg" ) { $ ( ".jGraduate_" + ma + "_field" ) . show ( ) ; $ ( ".jGraduate_" + ( ma === "lg" ? "rg" : "lg" ) + "_field" ) . hide ( ) ; $ ( "#" + q + "_jgraduate_rect" ) [ 0 ] . setAttribute ( "fill" , "url(#" + q + "_" + ma + "_jgraduate_grad)" ) ; R = ma === "lg" ? "linearGradient" : "radialGradient" ; $ ( "#" + q + "_jGraduate_OpacInput" ) . val ( p . paint . alpha ) . change ( ) ; var ga = $ ( "#" +
q + "_" + ma + "_jgraduate_grad" ) [ 0 ] ; if ( ba !== ga ) { var qa = $ ( ba ) . find ( "stop" ) ; $ ( ga ) . empty ( ) . append ( qa ) ; ba = ga ; ga = pb . val ( ) ; ba . setAttribute ( "spreadMethod" , ga ) } bb = ma === "rg" && ba . getAttribute ( "fx" ) != null && ! ( Ga == Ca && Ja == La ) ; $ ( "#" + q + "_jGraduate_focusCoord" ) . toggle ( bb ) ; if ( bb ) $ ( "#" + q + "_jGraduate_match_ctr" ) [ 0 ] . checked = false } else { $ ( M + " .jGraduate_gradPick" ) . hide ( ) ; $ ( M + " .jGraduate_colPick" ) . show ( ) } } ) ; $ ( M + " > div" ) . hide ( ) ; wb . removeClass ( "jGraduate_tab_current" ) ; var Db ; switch ( p . paint . type ) { case "linearGradient" : Db = $ ( M +
" .jGraduate_tab_lingrad" ) ; break ; case "radialGradient" : Db = $ ( M + " .jGraduate_tab_radgrad" ) ; break ; default : Db = $ ( M + " .jGraduate_tab_color" ) } p . show ( ) ; setTimeout ( function ( ) { Db . addClass ( "jGraduate_tab_current" ) . click ( ) } , 10 ) } else alert ( "Container element must have an id attribute to maintain unique id strings for sub-elements." ) } ) } } ) ( ) ; function touchHandler ( a ) { var o = a . changedTouches , g = o [ 0 ] , c = "" ; switch ( a . type ) { case "touchstart" : c = "mousedown" ; break ; case "touchmove" : c = "mousemove" ; break ; case "touchend" : c = "mouseup" ; break ; default : return } var m = document . createEvent ( "MouseEvent" ) ; m . initMouseEvent ( c , true , true , window , 1 , g . screenX , g . screenY , g . clientX , g . clientY , false , false , false , false , 0 , null ) ; if ( o . length < 2 ) { g . target . dispatchEvent ( m ) ; a . preventDefault ( ) } } ; jQuery && function ( ) { var a = $ ( window ) , o = $ ( document ) ; $ . extend ( $ . fn , { contextMenu : function ( g , c ) { if ( g . menu == undefined ) return false ; if ( g . inSpeed == undefined ) g . inSpeed = 150 ; if ( g . outSpeed == undefined ) g . outSpeed = 75 ; if ( g . inSpeed == 0 ) g . inSpeed = - 1 ; if ( g . outSpeed == 0 ) g . outSpeed = - 1 ; $ ( this ) . each ( function ( ) { var m = $ ( this ) , s = $ ( m ) . offset ( ) , b = $ ( "#" + g . menu ) ; b . addClass ( "contextMenu" ) ; $ ( this ) . bind ( "mousedown" , function ( f ) { $ ( this ) . mouseup ( function ( d ) { var l = $ ( this ) ; l . unbind ( "mouseup" ) ; $ ( ".contextMenu" ) . hide ( ) ; if ( f . button === 2 || g . allowLeft ||
f . ctrlKey && svgedit . browser . isMac ( ) ) { d . stopPropagation ( ) ; if ( m . hasClass ( "disabled" ) || f . altKey ) return false ; var p = d . pageX , B = d . pageY ; d = a . width ( ) - b . width ( ) ; var q = a . height ( ) - b . height ( ) ; if ( p > d - 15 ) p = d - 15 ; if ( B > q - 30 ) B = q - 30 ; o . unbind ( "click" ) ; b . css ( { top : B , left : p } ) . fadeIn ( g . inSpeed ) ; b . find ( "A" ) . mouseover ( function ( ) { b . find ( "LI.hover" ) . removeClass ( "hover" ) ; $ ( this ) . parent ( ) . addClass ( "hover" ) } ) . mouseout ( function ( ) { b . find ( "LI.hover" ) . removeClass ( "hover" ) } ) ; o . keypress ( function ( M ) { switch ( M . keyCode ) { case 38 : if ( b . find ( "LI.hover" ) . length ) { b . find ( "LI.hover" ) . removeClass ( "hover" ) . prevAll ( "LI:not(.disabled)" ) . eq ( 0 ) . addClass ( "hover" ) ;
b . find ( "LI.hover" ) . length || b . find ( "LI:last" ) . addClass ( "hover" ) } else b . find ( "LI:last" ) . addClass ( "hover" ) ; break ; case 40 : if ( b . find ( "LI.hover" ) . length == 0 ) b . find ( "LI:first" ) . addClass ( "hover" ) ; else { b . find ( "LI.hover" ) . removeClass ( "hover" ) . nextAll ( "LI:not(.disabled)" ) . eq ( 0 ) . addClass ( "hover" ) ; b . find ( "LI.hover" ) . length || b . find ( "LI:first" ) . addClass ( "hover" ) } break ; case 13 : b . find ( "LI.hover A" ) . trigger ( "click" ) ; break ; case 27 : o . trigger ( "click" ) } } ) ; b . find ( "A" ) . unbind ( "mouseup" ) ; b . find ( "LI:not(.disabled) A" ) . mouseup ( function ( ) { o . unbind ( "click" ) . unbind ( "keypress" ) ;
$ ( ".contextMenu" ) . hide ( ) ; c && c ( $ ( this ) . attr ( "href" ) . substr ( 1 ) , $ ( l ) , { x : p - s . left , y : B - s . top , docX : p , docY : B } ) ; return false } ) ; setTimeout ( function ( ) { o . click ( function ( ) { o . unbind ( "click" ) . unbind ( "keypress" ) ; b . fadeOut ( g . outSpeed ) ; return false } ) } , 0 ) } } ) } ) ; if ( $ . browser . mozilla ) $ ( "#" + g . menu ) . each ( function ( ) { $ ( this ) . css ( { MozUserSelect : "none" } ) } ) ; else $ . browser . msie ? $ ( "#" + g . menu ) . each ( function ( ) { $ ( this ) . bind ( "selectstart.disableTextSelect" , function ( ) { return false } ) } ) : $ ( "#" + g . menu ) . each ( function ( ) { $ ( this ) . bind ( "mousedown.disableTextSelect" ,
function ( ) { return false } ) } ) ; $ ( m ) . add ( $ ( "UL.contextMenu" ) ) . bind ( "contextmenu" , function ( ) { return false } ) } ) ; return $ ( this ) } , disableContextMenuItems : function ( g ) { if ( g == undefined ) { $ ( this ) . find ( "LI" ) . addClass ( "disabled" ) ; return $ ( this ) } $ ( this ) . each ( function ( ) { if ( g != undefined ) for ( var c = g . split ( "," ) , m = 0 ; m < c . length ; m ++ ) $ ( this ) . find ( 'A[href="' + c [ m ] + '"]' ) . parent ( ) . addClass ( "disabled" ) } ) ; return $ ( this ) } , enableContextMenuItems : function ( g ) { if ( g == undefined ) { $ ( this ) . find ( "LI.disabled" ) . removeClass ( "disabled" ) ; return $ ( this ) } $ ( this ) . each ( function ( ) { if ( g !=
undefined ) for ( var c = g . split ( "," ) , m = 0 ; m < c . length ; m ++ ) $ ( this ) . find ( 'A[href="' + c [ m ] + '"]' ) . 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 , g = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) , c = ! ! window . opera , m = o . indexOf ( "AppleWebKit" ) >= 0 , s = o . indexOf ( "Gecko/" ) >= 0 , b = o . indexOf ( "MSIE" ) >= 0 , f = o . indexOf ( "Chrome/" ) >= 0 , d = o . indexOf ( "Windows" ) >= 0 , l = o . indexOf ( "Macintosh" ) >=
0 , p = "ontouchstart" in window , B = ! ! g . querySelector , q = ! ! document . evaluate , M = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; ha . setAttribute ( "d" , "M0,0 10,10" ) ; var X = ha . pathSegList ; ha = ha . createSVGPathSegLinetoAbs ( 5 , 5 ) ; try { X . replaceItem ( ha , 0 ) ; return true } catch ( R ) { } return false } ( ) , U = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; ha . setAttribute ( "d" , "M0,0 10,10" ) ; var X = ha . pathSegList ; ha = ha . createSVGPathSegLinetoAbs ( 5 , 5 ) ; try { X . insertItemBefore ( ha ,
0 ) ; return true } catch ( R ) { } return false } ( ) , P = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) , X = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; document . documentElement . appendChild ( ha ) ; X . setAttribute ( "x" , 5 ) ; ha . appendChild ( X ) ; var R = document . createElementNS ( "http://www.w3.org/2000/svg" , "text" ) ; R . textContent = "a" ; X . appendChild ( R ) ; X = R . getStartPositionOfChar ( 0 ) . x ; document . documentElement . removeChild ( ha ) ; return X === 0 } ( ) , I = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" ,
"svg" ) ; document . documentElement . appendChild ( ha ) ; var X = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; X . setAttribute ( "d" , "M0,0 C0,0 10,10 10,0" ) ; ha . appendChild ( X ) ; X = X . getBBox ( ) ; document . documentElement . removeChild ( ha ) ; return X . height > 4 && X . height < 5 } ( ) , V = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; document . documentElement . appendChild ( ha ) ; var X = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; X . setAttribute ( "d" , "M0,0 10,0" ) ; var R = document . createElementNS ( "http://www.w3.org/2000/svg" ,
"path" ) ; R . setAttribute ( "d" , "M5,0 15,0" ) ; var ba = document . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ; ba . appendChild ( X ) ; ba . appendChild ( R ) ; ha . appendChild ( ba ) ; X = ba . getBBox ( ) ; document . documentElement . removeChild ( ha ) ; return X . width == 15 } ( ) , ca = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; ha . setAttribute ( "x" , 0.1 ) ; ( ha = ha . cloneNode ( false ) . getAttribute ( "x" ) . indexOf ( "," ) == - 1 ) || $ . alert ( "NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the <a href='http://opera.com'>latest version</a> in which the problems have been fixed." ) ;
return ha } ( ) , Q = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; ha . setAttribute ( "style" , "vector-effect:non-scaling-stroke" ) ; return ha . style . vectorEffect === "non-scaling-stroke" } ( ) , W = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) . transform . baseVal , X = g . createSVGTransform ( ) ; ha . appendItem ( X ) ; return ha . getItem ( 0 ) == X } ( ) ; svgedit . browser . isOpera = function ( ) { return c } ; svgedit . browser . isWebkit = function ( ) { return m } ; svgedit . browser . isGecko = function ( ) { return s } ;
svgedit . browser . isIE = function ( ) { return b } ; svgedit . browser . isChrome = function ( ) { return f } ; svgedit . browser . isWindows = function ( ) { return d } ; svgedit . browser . isMac = function ( ) { return l } ; svgedit . browser . isTouch = function ( ) { return p } ; svgedit . browser . supportsSelectors = function ( ) { return B } ; svgedit . browser . supportsXpath = function ( ) { return q } ; svgedit . browser . supportsPathReplaceItem = function ( ) { return M } ; svgedit . browser . supportsPathInsertItemBefore = function ( ) { return U } ; svgedit . browser . supportsPathBBox = function ( ) { return I } ;
svgedit . browser . supportsHVLineContainerBBox = function ( ) { return V } ; svgedit . browser . supportsGoodTextCharPos = function ( ) { return P } ; svgedit . browser . supportsEditableText = function ( ) { return c } ; svgedit . browser . supportsGoodDecimals = function ( ) { return ca } ; svgedit . browser . supportsNonScalingStroke = function ( ) { return Q } ; svgedit . browser . supportsNativeTransformLists = function ( ) { return W } } 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 ( g ) { this . _elem = g || null ; this . _xforms = [ ] ; this . _update = function ( ) { var c = "" ; a . createSVGMatrix ( ) ; for ( var m = 0 ; m < this . numberOfItems ; ++ m ) { var s = this . _list . getItem ( m ) ; c = c ; s = s ; var b = s . matrix , f = "" ; switch ( s . type ) { case 1 : f = "matrix(" + [ b . a , b . b , b . c , b . d , b . e , b . f ] . join ( "," ) + ")" ; break ; case 2 : f = "translate(" + b . e + "," + b . f + ")" ; break ; case 3 : f =
b . a == b . d ? "scale(" + b . a + ")" : "scale(" + b . a + "," + b . d + ")" ; break ; case 4 : var d = 0 ; f = 0 ; if ( s . angle != 0 ) { d = 1 - b . a ; f = ( d * b . f + b . b * b . e ) / ( d * d + b . b * b . b ) ; d = ( b . e - b . b * f ) / d } f = "rotate(" + s . angle + " " + d + "," + f + ")" } c = c + ( f + " " ) } this . _elem . setAttribute ( "transform" , c ) } ; this . _list = this ; this . _init = function ( ) { var c = this . _elem . getAttribute ( "transform" ) ; if ( c ) for ( var m = /\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/ , s = true ; s ; ) { s = c . match ( m ) ; c = c . replace ( m , "" ) ; if ( s && s [ 1 ] ) { var b = s [ 1 ] . split ( /\s*\(/ ) , f = b [ 0 ] ; b = b [ 1 ] . match ( /\s*(.*?)\s*\)/ ) ;
b [ 1 ] = b [ 1 ] . replace ( /(\d)-/g , "$1 -" ) ; var d = b [ 1 ] . split ( /[, ]+/ ) , l = "abcdef" . split ( "" ) , p = a . createSVGMatrix ( ) ; $ . each ( d , function ( M , U ) { d [ M ] = parseFloat ( U ) ; if ( f == "matrix" ) p [ l [ M ] ] = d [ M ] } ) ; b = a . createSVGTransform ( ) ; var B = "set" + f . charAt ( 0 ) . toUpperCase ( ) + f . slice ( 1 ) , q = f == "matrix" ? [ p ] : d ; if ( f == "scale" && q . length == 1 ) q . push ( q [ 0 ] ) ; else if ( f == "translate" && q . length == 1 ) q . push ( 0 ) ; else if ( f == "rotate" && q . length == 1 ) { q . push ( 0 ) ; q . push ( 0 ) } b [ B ] . apply ( b , q ) ; this . _list . appendItem ( b ) } } } ; this . _removeFromOtherLists = function ( c ) { if ( c ) { var m =
false , s ; for ( s in o ) { for ( var b = o [ s ] , f = 0 , d = b . _xforms . length ; f < d ; ++ f ) if ( b . _xforms [ f ] == c ) { m = true ; b . removeItem ( f ) ; break } if ( m ) break } } } ; this . numberOfItems = 0 ; this . clear = function ( ) { this . numberOfItems = 0 ; this . _xforms = [ ] } ; this . initialize = function ( c ) { this . numberOfItems = 1 ; this . _removeFromOtherLists ( c ) ; this . _xforms = [ c ] } ; this . getItem = function ( c ) { if ( c < this . numberOfItems && c >= 0 ) return this . _xforms [ c ] ; throw { code : 1 } ; } ; this . insertItemBefore = function ( c , m ) { var s = null ; if ( m >= 0 ) if ( m < this . numberOfItems ) { this . _removeFromOtherLists ( c ) ;
s = Array ( this . numberOfItems + 1 ) ; for ( var b = 0 ; b < m ; ++ b ) s [ b ] = this . _xforms [ b ] ; s [ b ] = c ; for ( var f = b + 1 ; b < this . numberOfItems ; ++ f , ++ b ) s [ f ] = this . _xforms [ b ] ; this . numberOfItems ++ ; this . _xforms = s ; s = c ; this . _list . _update ( ) } else s = this . _list . appendItem ( c ) ; return s } ; this . replaceItem = function ( c , m ) { var s = null ; if ( m < this . numberOfItems && m >= 0 ) { this . _removeFromOtherLists ( c ) ; s = this . _xforms [ m ] = c ; this . _list . _update ( ) } return s } ; this . removeItem = function ( c ) { if ( c < this . numberOfItems && c >= 0 ) { for ( var m = this . _xforms [ c ] , s = Array ( this . numberOfItems -
1 ) , b = 0 ; b < c ; ++ b ) s [ b ] = this . _xforms [ b ] ; for ( c = b ; c < this . numberOfItems - 1 ; ++ c , ++ b ) s [ c ] = this . _xforms [ b + 1 ] ; this . numberOfItems -- ; this . _xforms = s ; this . _list . _update ( ) ; return m } else throw { code : 1 } ; } ; this . appendItem = function ( c ) { this . _removeFromOtherLists ( c ) ; this . _xforms . push ( c ) ; this . numberOfItems ++ ; this . _list . _update ( ) ; return c } } ; svgedit . transformlist . resetListMap = function ( ) { o = { } } ; svgedit . transformlist . removeElementFromListMap = function ( g ) { g . id && o [ g . id ] && delete o [ g . id ] } ; svgedit . transformlist . getTransformList = function ( g ) { if ( svgedit . browser . supportsNativeTransformLists ( ) ) if ( g . transform ) return g . transform . baseVal ;
else if ( g . gradientTransform ) return g . gradientTransform . baseVal ; else { if ( g . patternTransform ) return g . patternTransform . baseVal } else { var c = g . id ; c || ( c = "temp" ) ; var m = o [ c ] ; if ( ! m || c == "temp" ) { o [ c ] = new svgedit . transformlist . SVGTransformList ( g ) ; o [ c ] . _init ( ) ; m = o [ c ] } return m } 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 , g , c ) { return { x : c . a * o + c . c * g + c . e , y : c . b * o + c . d * g + c . 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 , g = o . length , c = o [ g - 1 ] ; g -- > 1 ; ) c = o [ g - 1 ] . multiply ( c ) ; if ( Math . abs ( c . a ) < 1.0 E - 14 ) c . a = 0 ; if ( Math . abs ( c . b ) < 1.0 E - 14 ) c . b = 0 ; if ( Math . abs ( c . c ) < 1.0 E - 14 ) c . c = 0 ; if ( Math . abs ( c . d ) <
1.0 E - 14 ) c . d = 0 ; if ( Math . abs ( c . e ) < 1.0 E - 14 ) c . e = 0 ; if ( Math . abs ( c . f ) < 1.0 E - 14 ) c . f = 0 ; return c } ; svgedit . math . hasMatrixTransform = function ( o ) { if ( ! o ) return false ; for ( var g = o . numberOfItems ; g -- ; ) { var c = o . getItem ( g ) ; if ( c . type == 1 && ! svgedit . math . isIdentity ( c . matrix ) ) return true } return false } ; svgedit . math . transformBox = function ( o , g , c , m , s ) { var b = { x : o , y : g } , f = { x : o + c , y : g } ; c = { x : o + c , y : g + m } ; o = { x : o , y : g + m } ; g = svgedit . math . transformPoint ; b = g ( b . x , b . y , s ) ; var d = m = b . x , l = b . y , p = b . y ; f = g ( f . x , f . y , s ) ; m = Math . min ( m , f . x ) ; d = Math . max ( d , f . x ) ;
l = Math . min ( l , f . y ) ; p = Math . max ( p , f . y ) ; o = g ( o . x , o . y , s ) ; m = Math . min ( m , o . x ) ; d = Math . max ( d , o . x ) ; l = Math . min ( l , o . y ) ; p = Math . max ( p , o . y ) ; c = g ( c . x , c . y , s ) ; m = Math . min ( m , c . x ) ; d = Math . max ( d , c . x ) ; l = Math . min ( l , c . y ) ; p = Math . max ( p , c . y ) ; return { tl : b , tr : f , bl : o , br : c , aabox : { x : m , y : l , width : d - m , height : p - l } } } ; svgedit . math . transformListToTransform = function ( o , g , c ) { if ( o == null ) return a . createSVGTransformFromMatrix ( a . createSVGMatrix ( ) ) ; g = g == undefined ? 0 : g ; c = c == undefined ? o . numberOfItems - 1 : c ; g = parseInt ( g ) ; c = parseInt ( c ) ; if ( g > c ) { var m = c ; c = g ;
g = m } m = a . createSVGMatrix ( ) ; for ( g = g ; g <= c ; ++ g ) { var s = g >= 0 && g < o . numberOfItems ? o . getItem ( g ) . matrix : a . createSVGMatrix ( ) ; m = svgedit . math . matrixMultiply ( m , s ) } return a . createSVGTransformFromMatrix ( m ) } ; svgedit . math . getMatrix = function ( o ) { o = svgedit . transformlist . getTransformList ( o ) ; return svgedit . math . transformListToTransform ( o ) . matrix } ; svgedit . math . snapToAngle = function ( o , g , c , m ) { var s = Math . PI / 4 ; c = c - o ; var b = m - g ; m = Math . sqrt ( c * c + b * b ) ; s = Math . round ( Math . atan2 ( b , c ) / s ) * s ; return { x : o + m * Math . cos ( s ) , y : g + m * Math . sin ( s ) , a : s } } ;
svgedit . math . rectsIntersect = function ( o , g ) { return g . x < o . x + o . width && g . x + g . width > o . x && g . y < o . y + o . height && g . y + g . height > o . y } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . units ) svgedit . units = { } ; var a = [ "x" , "x1" , "cx" , "rx" , "width" ] , o = [ "y" , "y1" , "cy" , "ry" , "height" ] , g = $ . merge ( [ "r" , "radius" ] , a ) ; $ . merge ( g , o ) ; var c , m = { px : 1 } ; svgedit . units . init = function ( b ) { c = b ; b = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; document . body . appendChild ( b ) ; var f = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; f . setAttribute ( "width" , "1em" ) ; f . setAttribute ( "height" , "1ex" ) ; f . setAttribute ( "x" , "1in" ) ; b . appendChild ( f ) ; f = f . getBBox ( ) ; document . body . removeChild ( b ) ;
b = f . x ; m . em = f . width ; m . ex = f . height ; m [ "in" ] = b ; m . cm = b / 2.54 ; m . mm = b / 25.4 ; m . pt = b / 72 ; m . pc = b / 6 ; m [ "%" ] = 0 } ; svgedit . units . getTypeMap = function ( ) { return m } ; svgedit . units . shortFloat = function ( b ) { var f = c . getRoundDigits ( ) ; if ( isNaN ( b ) ) { if ( $ . isArray ( b ) ) return svgedit . units . shortFloat ( b [ 0 ] ) + "," + svgedit . units . shortFloat ( b [ 1 ] ) } else return + ( + b ) . toFixed ( f ) ; return parseFloat ( b ) . toFixed ( f ) - 0 } ; svgedit . units . convertUnit = function ( b , f ) { f = f || c . getBaseUnit ( ) ; return svgedit . unit . shortFloat ( b / m [ f ] ) } ; svgedit . units . setUnitAttr = function ( b ,
f , d ) { isNaN ( d ) || b . getAttribute ( f ) ; b . setAttribute ( f , 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 ( b ) { var f = b . tagName , d = c . getBaseUnit ( ) ; if ( f = s [ f ] ) for ( var l = f . length , p = 0 ; p < l ; p ++ ) { var B = f [ p ] , q = b . getAttribute ( B ) ; if ( q ) isNaN ( q ) || b . setAttribute ( B , q / m [ d ] + d ) } } ; svgedit . units . convertToNum =
function ( b , f ) { if ( ! isNaN ( f ) ) return f - 0 ; if ( f . substr ( - 1 ) === "%" ) { var d = f . substr ( 0 , f . length - 1 ) / 100 , l = c . getWidth ( ) , p = c . getHeight ( ) ; return a . indexOf ( b ) >= 0 ? d * l : o . indexOf ( b ) >= 0 ? d * p : d * Math . sqrt ( l * l + p * p ) / Math . sqrt ( 2 ) } else { l = f . substr ( - 2 ) ; d = f . substr ( 0 , f . length - 2 ) ; return d * m [ l ] } } ; svgedit . units . isValidUnit = function ( b , f , d ) { var l = false ; if ( g . indexOf ( b ) >= 0 ) if ( isNaN ( f ) ) { f = f . toLowerCase ( ) ; $ . each ( m , function ( q ) { if ( ! l ) if ( RegExp ( "^-?[\\d\\.]+" + q + "$" ) . test ( f ) ) l = true } ) } else l = true ; else if ( b == "id" ) { b = false ; try { var p = c . getElement ( f ) ;
b = p == null || p === d } catch ( B ) { } return b } else l = true ; return l } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { function a ( b ) { if ( svgedit . browser . supportsHVLineContainerBBox ( ) ) try { return b . getBBox ( ) } catch ( f ) { } var d = $ . data ( b , "ref" ) , l = null ; if ( d ) { var p = $ ( d ) . children ( ) . clone ( ) . attr ( "visibility" , "hidden" ) ; $ ( s ) . append ( p ) ; l = p . filter ( "line, path" ) } else l = $ ( b ) . find ( "line, path" ) ; var B = false ; if ( l . length ) { l . each ( function ( ) { var q = this . getBBox ( ) ; if ( ! q . width || ! q . height ) B = true } ) ; if ( B ) { b = d ? p : $ ( b ) . children ( ) ; ret = getStrokedBBox ( b ) } else ret = b . getBBox ( ) } else ret = b . getBBox ( ) ; d && p . 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 ( "," ) , g = null , c = null , m = null , s = null ; svgedit . utilities . init = function ( b ) { g = b ; c = b . getDOMDocument ( ) ; m = b . getDOMContainer ( ) ; s = b . getSVGRoot ( ) } ; svgedit . utilities . toXml = function ( b ) { return $ ( "<p/>" ) . text ( b ) . html ( ) } ; svgedit . utilities . fromXml = function ( b ) { return $ ( "<p/>" ) . html ( b ) . text ( ) } ; svgedit . utilities . encode64 = function ( b ) { b = svgedit . utilities . convertToXMLReferences ( b ) ; if ( window . btoa ) return window . btoa ( b ) ;
var f = Array ( Math . floor ( ( b . length + 2 ) / 3 ) * 4 ) , d , l , p , B , q , M , U = 0 , P = 0 ; do { d = b . charCodeAt ( U ++ ) ; l = b . charCodeAt ( U ++ ) ; p = b . charCodeAt ( U ++ ) ; B = d >> 2 ; d = ( d & 3 ) << 4 | l >> 4 ; q = ( l & 15 ) << 2 | p >> 6 ; M = p & 63 ; if ( isNaN ( l ) ) q = M = 64 ; else if ( isNaN ( p ) ) M = 64 ; f [ P ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( B ) ; f [ P ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( d ) ; f [ P ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( q ) ; f [ P ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( M ) } while ( U <
b . length ) ; return f . join ( "" ) } ; svgedit . utilities . decode64 = function ( b ) { if ( window . atob ) return window . atob ( b ) ; var f = "" , d , l , p = "" , B , q = "" , M = 0 ; b = b . replace ( /[^A-Za-z0-9\+\/\=]/g , "" ) ; do { d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( M ++ ) ) ; l = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( M ++ ) ) ; B = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( M ++ ) ) ; q = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( M ++ ) ) ;
d = d << 2 | l >> 4 ; l = ( l & 15 ) << 4 | B >> 2 ; p = ( B & 3 ) << 6 | q ; f += String . fromCharCode ( d ) ; if ( B != 64 ) f += String . fromCharCode ( l ) ; if ( q != 64 ) f += String . fromCharCode ( p ) } while ( M < b . length ) ; return unescape ( f ) } ; svgedit . utilities . convertToXMLReferences = function ( b ) { for ( var f = "" , d = 0 ; d < b . length ; d ++ ) { var l = b . charCodeAt ( d ) ; if ( l < 128 ) f += b [ d ] ; else if ( l > 127 ) f += "&#" + l + ";" } return f } ; svgedit . utilities . text2xml = function ( b ) { if ( b . indexOf ( "<svg:svg" ) >= 0 ) b = b . replace ( /<(\/?)svg:/g , "<$1" ) . replace ( "xmlns:svg" , "xmlns" ) ; var f ; try { var d = window . DOMParser ?
new DOMParser : new ActiveXObject ( "Microsoft.XMLDOM" ) ; d . async = false } catch ( l ) { throw Error ( "XML Parser could not be instantiated" ) ; } try { f = d . loadXML ? d . loadXML ( b ) ? d : false : d . parseFromString ( b , "text/xml" ) } catch ( p ) { throw Error ( "Error parsing XML string" ) ; } return f } ; svgedit . utilities . bboxToObj = function ( b ) { return { x : b . x , y : b . y , width : b . width , height : b . height } } ; svgedit . utilities . walkTree = function ( b , f ) { if ( b && b . nodeType == 1 ) { f ( b ) ; for ( var d = b . childNodes . length ; d -- ; ) svgedit . utilities . walkTree ( b . childNodes . item ( d ) , f ) } } ;
svgedit . utilities . walkTreePost = function ( b , f ) { if ( b && b . nodeType == 1 ) { for ( var d = b . childNodes . length ; d -- ; ) svgedit . utilities . walkTree ( b . childNodes . item ( d ) , f ) ; f ( b ) } } ; svgedit . utilities . getUrlFromAttr = function ( b ) { if ( b ) if ( b . indexOf ( 'url("' ) === 0 ) return b . substring ( 5 , b . indexOf ( '"' , 6 ) ) ; else if ( b . indexOf ( "url('" ) === 0 ) return b . substring ( 5 , b . indexOf ( "'" , 6 ) ) ; else if ( b . indexOf ( "url(" ) === 0 ) return b . substring ( 4 , b . indexOf ( ")" ) ) ; return null } ; svgedit . utilities . getHref = function ( b ) { return b . getAttributeNS ( "http://www.w3.org/1999/xlink" ,
"href" ) } ; svgedit . utilities . setHref = function ( b , f ) { b . setAttributeNS ( "http://www.w3.org/1999/xlink" , "xlink:href" , f ) } ; svgedit . utilities . findDefs = function ( b ) { b = g . getSVGContent ( ) . documentElement ; var f = b . getElementsByTagNameNS ( "http://www.w3.org/2000/svg" , "defs" ) ; return f = f . length > 0 ? f [ 0 ] : b . insertBefore ( b . ownerDocument . createElementNS ( "http://www.w3.org/2000/svg" , "defs" ) , b . firstChild . nextSibling ) } ; svgedit . utilities . getPathBBox = function ( b ) { var f = b . pathSegList , d = f . numberOfItems ; b = [ [ ] , [ ] ] ; var l = f . getItem ( 0 ) ,
p = [ l . x , l . y ] ; for ( l = 0 ; l < d ; l ++ ) { var B = f . getItem ( l ) ; if ( typeof B . x != "undefined" ) { b [ 0 ] . push ( p [ 0 ] ) ; b [ 1 ] . push ( p [ 1 ] ) ; if ( B . x1 ) { for ( var q = [ B . x1 , B . y1 ] , M = [ B . x2 , B . y2 ] , U = [ B . x , B . y ] , P = 0 ; P < 2 ; P ++ ) { B = function ( W ) { return Math . pow ( 1 - W , 3 ) * p [ P ] + 3 * Math . pow ( 1 - W , 2 ) * W * q [ P ] + 3 * ( 1 - W ) * Math . pow ( W , 2 ) * M [ P ] + Math . pow ( W , 3 ) * U [ P ] } ; var I = 6 * p [ P ] - 12 * q [ P ] + 6 * M [ P ] , V = - 3 * p [ P ] + 9 * q [ P ] - 9 * M [ P ] + 3 * U [ P ] , ca = 3 * q [ P ] - 3 * p [ P ] ; if ( V == 0 ) { if ( I != 0 ) { I = - ca / I ; 0 < I && I < 1 && b [ P ] . push ( B ( I ) ) } } else { ca = Math . pow ( I , 2 ) - 4 * ca * V ; if ( ! ( ca < 0 ) ) { var Q = ( - I + Math . sqrt ( ca ) ) / ( 2 * V ) ; 0 < Q && Q < 1 &&
b [ P ] . push ( B ( Q ) ) ; I = ( - I - Math . sqrt ( ca ) ) / ( 2 * V ) ; 0 < I && I < 1 && b [ P ] . push ( B ( I ) ) } } } p = U } else { b [ 0 ] . push ( B . x ) ; b [ 1 ] . push ( B . y ) } } } f = Math . min . apply ( null , b [ 0 ] ) ; d = Math . max . apply ( null , b [ 0 ] ) - f ; l = Math . min . apply ( null , b [ 1 ] ) ; b = Math . max . apply ( null , b [ 1 ] ) - l ; return { x : f , y : l , width : d , height : b } } ; svgedit . utilities . getBBox = function ( b ) { var f = b || g . geSelectedElements ( ) [ 0 ] ; if ( b . nodeType != 1 ) return null ; b = null ; var d = f . nodeName ; switch ( d ) { case "text" : if ( f . textContent === "" ) { f . textContent = "a" ; b = f . getBBox ( ) ; f . textContent = "" } else try { b = f . getBBox ( ) } catch ( l ) { } break ;
case "path" : if ( svgedit . browser . supportsPathBBox ( ) ) try { b = f . getBBox ( ) } catch ( p ) { } else b = svgedit . utilities . getPathBBox ( f ) ; break ; case "g" : case "a" : b = a ( f ) ; break ; default : if ( d === "use" ) b = a ( f , true ) ; if ( d === "use" ) { b || ( b = f . getBBox ( ) ) ; if ( ! svgedit . browser . isWebkit ( ) ) { d = { } ; d . width = b . width ; d . height = b . height ; d . x = b . x + parseFloat ( f . getAttribute ( "x" ) || 0 ) ; d . y = b . y + parseFloat ( f . getAttribute ( "y" ) || 0 ) ; b = d } } else if ( ~ o . indexOf ( d ) ) try { b = f . getBBox ( ) } catch ( B ) { f = $ ( f ) . closest ( "foreignObject" ) ; if ( f . length ) try { b = f [ 0 ] . getBBox ( ) } catch ( q ) { b =
null } else b = null } } if ( b ) b = svgedit . utilities . bboxToObj ( b ) ; return b } ; svgedit . utilities . getRotationAngle = function ( b , f ) { var d = b || g . getSelectedElements ( ) [ 0 ] ; d = svgedit . transformlist . getTransformList ( d ) ; if ( ! d ) return 0 ; for ( var l = d . numberOfItems , p = 0 ; p < l ; ++ p ) { var B = d . getItem ( p ) ; if ( B . type == 4 ) return f ? B . angle * Math . PI / 180 : B . angle } return 0 } ; svgedit . utilities . getElem = svgedit . browser . supportsSelectors ( ) ? function ( b ) { return s . querySelector ( "#" + b ) } : svgedit . browser . supportsXpath ( ) ? function ( b ) { return c . evaluate ( 'svg:svg[@id="svgroot"]//svg:*[@id="' +
b + '"]' , m , function ( ) { return "http://www.w3.org/2000/svg" } , 9 , null ) . singleNodeValue } : function ( b ) { return $ ( s ) . find ( "[id=" + b + "]" ) [ 0 ] } ; svgedit . utilities . assignAttributes = function ( b , f , d , l ) { d || ( d = 0 ) ; svgedit . browser . isOpera ( ) || s . suspendRedraw ( d ) ; for ( var p in f ) if ( d = p . substr ( 0 , 4 ) === "xml:" ? "http://www.w3.org/XML/1998/namespace" : p . substr ( 0 , 6 ) === "xlink:" ? "http://www.w3.org/1999/xlink" : null ) b . setAttributeNS ( d , p , f [ p ] ) ; else l ? svgedit . units . setUnitAttr ( b , p , f [ p ] ) : b . setAttribute ( p , f [ p ] ) ; svgedit . browser . isOpera ( ) || s . unsuspendRedraw ( null ) } ;
svgedit . utilities . cleanupElement = function ( b ) { var f = 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 } , l ; for ( l in d ) { var p = d [ l ] ; b . getAttribute ( l ) == p && b . removeAttribute ( l ) } s . unsuspendRedraw ( f ) } } ) ( ) ; 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 ( m , s ) { o [ s ] = m } ) ; var g = { a : [ "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "mask" , "opacity" , "stroke" , "stroke-dasharray" ,
2012-07-14 20:36:17 +00:00
"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" ] , image : [ "class" , "clip-path" , "clip-rule" , "filter" , "height" , "id" , "mask" , "opacity" , "requiredFeatures" , "style" , "systemLanguage" , "transform" , "width" , "x" , "xlink:href" , "xlink:title" , "y" ] , line : [ "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 : [ "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" ,
2012-07-24 12:42:34 +00:00
"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 : [ ] } , c = { } ; $ . each ( g , function ( m , s ) { var b = { } ; $ . each ( s , function ( f , d ) { if ( d . indexOf ( ":" ) >=
0 ) { var l = d . split ( ":" ) ; b [ l [ 1 ] ] = o [ l [ 0 ] ] } else b [ d ] = d == "xmlns" ? "http://www.w3.org/2000/xmlns/" : null } ) ; c [ m ] = b } ) ; svgedit . sanitize . getNSMap = function ( ) { return a } ; svgedit . sanitize . sanitizeSvg = function ( m ) { if ( m . nodeType == 3 ) { m . nodeValue = m . nodeValue . replace ( /^\s+|\s+$/g , "" ) ; m . nodeValue . length || m . parentNode . removeChild ( m ) } if ( m . nodeType == 1 ) { var s = m . parentNode ; if ( m . ownerDocument && s ) { var b = g [ m . nodeName ] , f = c [ m . nodeName ] ; if ( b != undefined ) { for ( var d = [ ] , l = m . attributes . length ; l -- ; ) { var p = m . attributes . item ( l ) , B = p . nodeName ,
q = p . localName , M = p . namespaceURI ; if ( ! ( f . hasOwnProperty ( q ) && M == f [ q ] && M != "http://www.w3.org/2000/xmlns/" ) && ! ( M == "http://www.w3.org/2000/xmlns/" && a [ p . nodeValue ] ) ) { B . indexOf ( "se:" ) == 0 && d . push ( [ B , p . nodeValue ] ) ; m . removeAttributeNS ( M , q ) } if ( svgedit . browser . isGecko ( ) ) switch ( B ) { case "transform" : case "gradientTransform" : case "patternTransform" : q = p . nodeValue . replace ( /(\d)-/g , "$1 -" ) ; m . setAttribute ( B , q ) } if ( B == "style" ) { p = p . nodeValue . split ( ";" ) ; for ( B = p . length ; B -- ; ) { q = p [ B ] . split ( ":" ) ; b . indexOf ( q [ 0 ] ) >= 0 && m . setAttribute ( q [ 0 ] ,
q [ 1 ] ) } m . removeAttribute ( "style" ) } } $ . each ( d , function ( U , P ) { m . setAttributeNS ( "http://svg-edit.googlecode.com" , P [ 0 ] , P [ 1 ] ) } ) ; if ( ( l = svgedit . utilities . getHref ( m ) ) && [ "filter" , "linearGradient" , "pattern" , "radialGradient" , "textPath" , "use" ] . indexOf ( m . nodeName ) >= 0 ) if ( l [ 0 ] != "#" ) { svgedit . utilities . setHref ( m , "" ) ; m . removeAttributeNS ( "http://www.w3.org/1999/xlink" , "href" ) } if ( m . nodeName == "use" && ! svgedit . utilities . getHref ( m ) ) s . removeChild ( m ) ; else { $ . each ( [ "clip-path" , "fill" , "filter" , "marker-end" , "marker-mid" , "marker-start" ,
"mask" , "stroke" ] , function ( U , P ) { var I = m . getAttribute ( P ) ; if ( I ) if ( ( I = svgedit . utilities . getUrlFromAttr ( I ) ) && I [ 0 ] !== "#" ) { m . setAttribute ( P , "" ) ; m . removeAttribute ( P ) } } ) ; for ( l = m . childNodes . length ; l -- ; ) svgedit . sanitize . sanitizeSvg ( m . childNodes . item ( l ) ) } } else { for ( b = [ ] ; m . hasChildNodes ( ) ; ) b . push ( s . insertBefore ( m . firstChild , m ) ) ; s . removeChild ( m ) ; for ( l = b . length ; l -- ; ) svgedit . sanitize . sanitizeSvg ( b [ l ] ) } } } } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . history ) svgedit . history = { } ; svgedit . history . HistoryEventTypes = { BEFORE _APPLY : "before_apply" , AFTER _APPLY : "after_apply" , BEFORE _UNAPPLY : "before_unapply" , AFTER _UNAPPLY : "after_unapply" } ; svgedit . history . MoveElementCommand = function ( a , o , g , c ) { this . elem = a ; this . text = c ? "Move " + a . tagName + " to " + c : "Move " + a . tagName ; this . oldNextSibling = o ; this . oldParent = g ; this . newNextSibling = a . nextSibling ; this . newParent = a . parentNode } ; svgedit . history . MoveElementCommand . type = function ( ) { return "svgedit.history.MoveElementCommand" } ; svgedit . history . MoveElementCommand . prototype . type =
2012-07-14 20:36:17 +00:00
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 ,
2012-07-24 12:42:34 +00:00
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 =
2012-07-14 20:36:17 +00:00
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 ,
2012-07-24 12:42:34 +00:00
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 , g , c ) { this . elem = a ; this . text = c || "Delete " + a . tagName ; this . nextSibling = o ; this . parent = g ; svgedit . transformlist . removeElementFromListMap ( a ) } ; svgedit . history . RemoveElementCommand . type = function ( ) { return "svgedit.history.RemoveElementCommand" } ;
2012-07-14 20:36:17 +00:00
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 ] } ;
2012-07-24 12:42:34 +00:00
svgedit . history . ChangeElementCommand = function ( a , o , g ) { this . elem = a ; this . text = g ? "Change " + a . tagName + " " + g : "Change " + a . tagName ; this . newValues = { } ; this . oldValues = o ; for ( var c in o ) this . newValues [ c ] = c == "#text" ? a . textContent : c == "#href" ? svgedit . utilities . getHref ( a ) : a . getAttribute ( c ) } ; svgedit . history . ChangeElementCommand . type = function ( ) { return "svgedit.history.ChangeElementCommand" } ; svgedit . history . ChangeElementCommand . prototype . type = svgedit . history . ChangeElementCommand . type ; svgedit . history . ChangeElementCommand . prototype . getText =
function ( ) { return this . text } ; svgedit . history . ChangeElementCommand . prototype . apply = function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _APPLY , this ) ; var o = false , g ; for ( g in this . newValues ) { if ( this . newValues [ g ] ) if ( g == "#text" ) this . elem . textContent = this . newValues [ g ] ; else g == "#href" ? svgedit . utilities . setHref ( this . elem , this . newValues [ g ] ) : this . elem . setAttribute ( g , this . newValues [ g ] ) ; else if ( g == "#text" ) this . elem . textContent = "" ; else { this . elem . setAttribute ( g , "" ) ; this . elem . removeAttribute ( g ) } if ( g ==
"transform" ) o = true } if ( ! o ) if ( o = svgedit . utilities . getRotationAngle ( this . elem ) ) { g = elem . getBBox ( ) ; o = [ "rotate(" , o , " " , g . x + g . width / 2 , "," , g . y + g . 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 , g ; for ( g in this . oldValues ) { if ( this . oldValues [ g ] ) if ( g ==
"#text" ) this . elem . textContent = this . oldValues [ g ] ; else g == "#href" ? svgedit . utilities . setHref ( this . elem , this . oldValues [ g ] ) : this . elem . setAttribute ( g , this . oldValues [ g ] ) ; else if ( g == "#text" ) this . elem . textContent = "" ; else this . elem . removeAttribute ( g ) ; if ( g == "transform" ) o = true } if ( ! o ) if ( o = svgedit . utilities . getRotationAngle ( this . elem ) ) { g = this . elem . getBBox ( ) ; o = [ "rotate(" , o , " " , g . x + g . width / 2 , "," , g . y + g . height / 2 , ")" ] . join ( "" ) ; o != this . elem . getAttribute ( "transform" ) && this . elem . setAttribute ( "transform" , o ) } svgedit . transformlist . removeElementFromListMap ( this . elem ) ;
2012-07-14 20:36:17 +00:00
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 =
2012-07-24 12:42:34 +00:00
function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _APPLY , this ) ; for ( var o = this . stack . length , g = 0 ; g < o ; ++ g ) this . stack [ g ] . 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 g = this . stack [ o ] . elements ( ) , c = g . length ; c -- ; ) a . indexOf ( g [ c ] ) == - 1 && a . push ( g [ c ] ) ; return a } ; svgedit . history . BatchCommand . prototype . addSubCommand = function ( a ) { this . stack . push ( a ) } ; svgedit . history . BatchCommand . prototype . isEmpty = function ( ) { return this . stack . length == 0 } ; svgedit . history . UndoManager = function ( a ) { this . handler _ = a || null ; this . undoStackPointer = 0 ; this . undoStack = [ ] ; this . undoChangeStackPointer =
2012-07-14 20:36:17 +00:00
- 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 _ ) } ;
2012-07-24 12:42:34 +00:00
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 g = ++ this . undoChangeStackPointer , c = o . length , m = Array ( c ) , s = Array ( c ) ; c -- ; ) { var b = o [ c ] ; if ( b != null ) { s [ c ] = b ; m [ c ] = b . getAttribute ( a ) } } this . undoableChangeStack [ g ] =
{ attrName : a , oldValues : m , elements : s } } ; svgedit . history . UndoManager . prototype . finishUndoableChange = function ( ) { for ( var a = this . undoChangeStackPointer -- , o = this . undoableChangeStack [ a ] , g = o . elements . length , c = o . attrName , m = new svgedit . history . BatchCommand ( "Change " + c ) ; g -- ; ) { var s = o . elements [ g ] ; if ( s != null ) { var b = { } ; b [ c ] = o . oldValues [ g ] ; b [ c ] != s . getAttribute ( c ) && m . addSubCommand ( new svgedit . history . ChangeElementCommand ( s , b , c ) ) } } this . undoableChangeStack [ a ] = null ; return m } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . select ) svgedit . select = { } ; var a , o , g ; svgedit . select . Selector = function ( c , m ) { this . id = c ; this . selectedElement = m ; this . locked = true ; this . selectorGroup = a . createSVGElement ( { element : "g" , attr : { id : "selectorGroup" + this . id } } ) ; this . selectorRect = this . selectorGroup . appendChild ( a . createSVGElement ( { element : "path" , attr : { id : "selectedBox" + this . id , fill : "none" , stroke : "#4F80FF" , "stroke-width" : "1" , "shape-rendering" : "crispEdges" , style : "pointer-events:none" } } ) ) ; svgedit . browser . isTouch ( ) && this . selectorRect . setAttribute ( "stroke-opacity" ,
0 ) ; this . gripCoords = { nw : null , n : null , ne : null , e : null , se : null , s : null , sw : null , w : null } ; this . reset ( this . selectedElement ) } ; svgedit . select . Selector . prototype . reset = function ( c ) { this . locked = true ; this . selectedElement = c ; this . resize ( ) ; this . selectorGroup . setAttribute ( "display" , "inline" ) } ; svgedit . select . Selector . prototype . updateGripCursors = function ( c ) { var m = [ ] ; c = Math . round ( c / 45 ) ; if ( c < 0 ) c += 8 ; for ( var s in g . selectorGrips ) m . push ( s ) ; for ( ; c > 0 ; ) { m . push ( m . shift ( ) ) ; c -- } c = 0 ; for ( s in g . selectorGrips ) { g . selectorGrips [ s ] . setAttribute ( "style" ,
"cursor:" + m [ c ] + "-resize" ) ; c ++ } } ; svgedit . select . Selector . prototype . showGrips = function ( c ) { g . selectorGripsGroup . setAttribute ( "display" , c ? "inline" : "none" ) ; var m = this . selectedElement ; this . hasGrips = c ; if ( m && c ) { this . selectorGroup . appendChild ( g . selectorGripsGroup ) ; this . updateGripCursors ( svgedit . utilities . getRotationAngle ( m ) ) } } ; svgedit . select . Selector . prototype . resize = function ( ) { var c = this . selectorRect , m = g , s = m . selectorGrips , b = this . selectedElement , f = b . getAttribute ( "stroke-width" ) , d = a . currentZoom ( ) , l = 1 / d ; if ( b . getAttribute ( "stroke" ) !==
"none" && ! isNaN ( f ) ) l += f / 2 ; var p = b . tagName ; if ( p === "text" ) l += 2 / d ; f = svgedit . transformlist . getTransformList ( b ) ; f = svgedit . math . transformListToTransform ( f ) . matrix ; f . e *= d ; f . f *= d ; var B = svgedit . utilities . getBBox ( b ) ; if ( p === "g" && ! $ . data ( b , "gsvg" ) ) if ( p = a . getStrokedBBox ( b . childNodes ) ) B = p ; p = B . x ; var q = B . y , M = B . width ; B = B . height ; l *= d ; d = svgedit . math . transformBox ( p * d , q * d , M * d , B * d , f ) ; f = d . aabox ; p = f . x - l ; q = f . y - l ; M = f . width + l * 2 ; var U = f . height + l * 2 ; f = p + M / 2 ; B = q + U / 2 ; if ( b = svgedit . utilities . getRotationAngle ( b ) ) { p = a . svgRoot ( ) . createSVGTransform ( ) ;
p . setRotate ( - b , f , B ) ; p = p . matrix ; d . tl = svgedit . math . transformPoint ( d . tl . x , d . tl . y , p ) ; d . tr = svgedit . math . transformPoint ( d . tr . x , d . tr . y , p ) ; d . bl = svgedit . math . transformPoint ( d . bl . x , d . bl . y , p ) ; d . br = svgedit . math . transformPoint ( d . br . x , d . br . y , p ) ; p = d . tl ; M = p . x ; U = p . y ; var P = p . x , I = p . y ; p = Math . min ; q = Math . max ; M = p ( M , p ( d . tr . x , p ( d . bl . x , d . br . x ) ) ) - l ; U = p ( U , p ( d . tr . y , p ( d . bl . y , d . br . y ) ) ) - l ; P = q ( P , q ( d . tr . x , q ( d . bl . x , d . br . x ) ) ) + l ; I = q ( I , q ( d . tr . y , q ( d . bl . y , d . br . y ) ) ) + l ; p = M ; q = U ; M = P - M ; U = I - U } l = a . svgRoot ( ) . suspendRedraw ( 100 ) ; c . setAttribute ( "d" ,
"M" + p + "," + q + " L" + ( p + M ) + "," + q + " " + ( p + M ) + "," + ( q + U ) + " " + p + "," + ( q + U ) + "z" ) ; this . selectorGroup . setAttribute ( "transform" , b ? "rotate(" + [ b , f , B ] . join ( "," ) + ")" : "" ) ; if ( svgedit . browser . isTouch ( ) ) { p -= 15.75 ; q -= 15.75 } else { p -= 4 ; q -= 4 } this . gripCoords = { nw : [ p , q ] . map ( Math . round ) , ne : [ p + M , q ] . map ( Math . round ) , sw : [ p , q + U ] . map ( Math . round ) , se : [ p + M , q + U ] . map ( Math . round ) , n : [ p + M / 2 , q ] . map ( Math . round ) , w : [ p , q + U / 2 ] . map ( Math . round ) , e : [ p + M , q + U / 2 ] . map ( Math . round ) , s : [ p + M / 2 , q + U ] . map ( Math . round ) } ; for ( var V in this . gripCoords ) { c = this . gripCoords [ V ] ;
s [ V ] . setAttribute ( "x" , c [ 0 ] ) ; s [ V ] . setAttribute ( "y" , c [ 1 ] ) } this . rotateCoords = { nw : [ p , q ] , ne : [ p + M + 8 , q ] , sw : [ p , q + U + 8 ] , se : [ p + M + 8 , q + U + 8 ] } ; for ( V in this . rotateCoords ) { c = this . rotateCoords [ V ] ; m . rotateGrips [ V ] . setAttribute ( "cx" , c [ 0 ] ) ; m . rotateGrips [ V ] . setAttribute ( "cy" , c [ 1 ] ) } a . svgRoot ( ) . unsuspendRedraw ( l ) } ; svgedit . select . SelectorManager = function ( ) { this . rubberBandBox = this . selectorParentGroup = null ; this . selectors = [ ] ; this . selectorMap = { } ; this . selectorGrips = { nw : null , n : null , ne : null , e : null , se : null , s : null , sw : null , w : null } ;
2012-07-24 02:30:12 +00:00
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 ) ;
2012-07-24 12:42:34 +00:00
a . svgRoot ( ) . appendChild ( this . selectorParentGroup ) ; this . selectorMap = { } ; this . selectors = [ ] ; this . rubberBandBox = null ; for ( var c in this . rotateGrips ) { var m = a . createSVGElement ( { element : "circle" , attr : { id : "selectorGrip_rotate_" + c , fill : "#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 ( m , "dir" , c ) ; $ . data ( m , "type" , "rotate" ) ; this . rotateGrips [ c ] = this . selectorGripsGroup . appendChild ( m ) } for ( c in this . selectorGrips ) { m = a . createSVGElement ( { element : "rect" ,
attr : { id : "selectorGrip_resize_" + c , width : 8 , height : 8 , fill : "#4F80FF" , stroke : "rgba(0,0,0,0)" , "stroke-width" : 1 , style : "cursor:" + c + "-resize" , "pointer-events" : "all" } } ) ; if ( svgedit . browser . isTouch ( ) ) { m . setAttribute ( "width" , 30.5 ) ; m . setAttribute ( "height" , 30.5 ) ; m . setAttribute ( "fill-opacity" , 0.3 ) } $ . data ( m , "dir" , c ) ; $ . data ( m , "type" , "resize" ) ; this . selectorGrips [ c ] = this . selectorGripsGroup . appendChild ( m ) } if ( ! $ ( "#canvasBackground" ) . length ) { c = o . dimensions ; c = a . createSVGElement ( { element : "svg" , attr : { id : "canvasBackground" ,
width : c [ 0 ] , height : c [ 1 ] , x : 0 , y : 0 , overflow : svgedit . browser . isWebkit ( ) ? "none" : "visible" , style : "pointer-events:none" } } ) ; m = a . createSVGElement ( { element : "rect" , attr : { width : "100%" , height : "100%" , x : 0 , y : 0 , "stroke-width" : 1 , stroke : "#000" , fill : "#FFF" , style : "pointer-events:none" } } ) ; c . appendChild ( m ) ; a . svgRoot ( ) . insertBefore ( c , a . svgContent ( ) ) } } ; svgedit . select . SelectorManager . prototype . requestSelector = function ( c ) { if ( c == null ) return null ; var m = this . selectors . length ; if ( typeof this . selectorMap [ c . id ] == "object" ) { this . selectorMap [ c . id ] . locked =
true ; return this . selectorMap [ c . id ] } for ( var s = 0 ; s < m ; ++ s ) if ( this . selectors [ s ] && ! this . selectors [ s ] . locked ) { this . selectors [ s ] . locked = true ; this . selectors [ s ] . reset ( c ) ; this . selectorMap [ c . id ] = this . selectors [ s ] ; return this . selectors [ s ] } this . selectors [ m ] = new svgedit . select . Selector ( m , c ) ; this . selectorParentGroup . appendChild ( this . selectors [ m ] . selectorGroup ) ; this . selectorMap [ c . id ] = this . selectors [ m ] ; return this . selectors [ m ] } ; svgedit . select . SelectorManager . prototype . releaseSelector = function ( c ) { if ( c != null ) for ( var m =
this . selectors . length , s = this . selectorMap [ c . id ] , b = 0 ; b < m ; ++ b ) if ( this . selectors [ b ] && this . selectors [ b ] == s ) { s . locked == false && console . log ( "WARNING! selector was released but was already unlocked" ) ; delete this . selectorMap [ c . id ] ; s . locked = false ; s . selectedElement = null ; s . showGrips ( false ) ; try { s . selectorGroup . setAttribute ( "display" , "none" ) } catch ( f ) { } break } } ; svgedit . select . SelectorManager . prototype . getRubberBandBox = function ( ) { if ( ! this . rubberBandBox ) this . rubberBandBox = this . selectorParentGroup . appendChild ( a . createSVGElement ( { element : "rect" ,
attr : { id : "selectorRubberBand" , fill : "transparent" , stroke : "#666" , "stroke-width" : 1 , "stroke-dasharray" : "3,2" , display : "none" , style : "pointer-events:none" } } ) ) ; return this . rubberBandBox } ; svgedit . select . init = function ( c , m ) { o = c ; a = m ; g = new svgedit . select . SelectorManager } ; svgedit . select . getSelectorManager = function ( ) { return g } } ) ( ) ; 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 } , g = o . LET _DOCUMENT _DECIDE ; svgedit . draw . Layer = function ( c , m ) { this . name _ = c ; this . group _ = m } ; svgedit . draw . Layer . prototype . getName = function ( ) { return this . name _ } ; svgedit . draw . Layer . prototype . getGroup = function ( ) { return this . group _ } ; svgedit . draw . randomizeIds = function ( c , m ) { g = c == false ? o . NEVER _RANDOMIZE :
o . ALWAYS _RANDOMIZE ; if ( g == o . ALWAYS _RANDOMIZE && ! m . getNonce ( ) ) m . setNonce ( Math . floor ( Math . random ( ) * 100001 ) ) ; else g == o . NEVER _RANDOMIZE && m . getNonce ( ) && m . clearNonce ( ) } ; svgedit . draw . Drawing = function ( c , m ) { if ( ! c || ! c . tagName || ! c . namespaceURI || c . tagName != "svg" || c . namespaceURI != "http://www.w3.org/2000/svg" ) throw "Error: svgedit.draw.Drawing instance initialized without a <svg> element" ; this . svgElem _ = c ; this . obj _num = 0 ; this . idPrefix = m || "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 && g != o . NEVER _RANDOMIZE ) this . nonce _ = s ; else g == o . ALWAYS _RANDOMIZE && this . setNonce ( Math . floor ( Math . random ( ) * 100001 ) ) } ; svgedit . draw . Drawing . prototype . getElem _ = function ( c ) { return this . svgElem _ . querySelector ? this . svgElem _ . querySelector ( "#" + c ) : $ ( this . svgElem _ ) . find ( "[id=" + c + "]" ) [ 0 ] } ; svgedit . draw . Drawing . prototype . getSvgElem = function ( ) { return this . svgElem _ } ; svgedit . draw . Drawing . prototype . getNonce = function ( ) { return this . nonce _ } ;
svgedit . draw . Drawing . prototype . setNonce = function ( c ) { this . svgElem _ . setAttributeNS ( "http://www.w3.org/2000/xmlns/" , "xmlns:se" , "http://svg-edit.googlecode.com" ) ; this . svgElem _ . setAttributeNS ( "http://svg-edit.googlecode.com" , "se:nonce" , c ) ; this . nonce _ = c } ; svgedit . draw . Drawing . prototype . clearNonce = function ( ) { this . nonce _ = "" } ; svgedit . draw . Drawing . prototype . getId = function ( ) { return this . nonce _ ? this . idPrefix + this . nonce _ + "_" + this . obj _num : this . idPrefix + this . obj _num } ; svgedit . draw . Drawing . prototype . getNextId = function ( ) { var c =
this . obj _num , m = false ; if ( this . releasedNums . length > 0 ) { this . obj _num = this . releasedNums . pop ( ) ; m = true } else this . obj _num ++ ; for ( var s = this . getId ( ) ; this . getElem _ ( s ) ; ) { if ( m ) { this . obj _num = c ; m = false } this . obj _num ++ ; s = this . getId ( ) } if ( m ) this . obj _num = c ; return s } ; svgedit . draw . Drawing . prototype . releaseId = function ( c ) { var m = this . idPrefix + ( this . nonce _ ? this . nonce _ + "_" : "" ) ; if ( typeof c != "string" || c . indexOf ( m ) != 0 ) return false ; c = parseInt ( c . substr ( m . length ) ) ; if ( typeof c != "number" || c <= 0 || this . releasedNums . indexOf ( c ) != - 1 ) return false ;
this . releasedNums . push ( c ) ; return true } ; svgedit . draw . Drawing . prototype . getNumLayers = function ( ) { return this . all _layers . length } ; svgedit . draw . Drawing . prototype . hasLayer = function ( c ) { for ( var m = 0 ; m < this . getNumLayers ( ) ; m ++ ) if ( this . all _layers [ m ] [ 0 ] == c ) return true ; return false } ; svgedit . draw . Drawing . prototype . getLayerName = function ( c ) { if ( c >= 0 && c < this . getNumLayers ( ) ) return this . all _layers [ c ] [ 0 ] ; return "" } ; svgedit . draw . Drawing . prototype . getCurrentLayer = function ( ) { return this . current _layer } ; svgedit . draw . Drawing . prototype . getCurrentLayerName =
function ( ) { for ( var c = 0 ; c < this . getNumLayers ( ) ; ++ c ) if ( this . all _layers [ c ] [ 1 ] == this . current _layer ) return this . getLayerName ( c ) ; return "" } ; svgedit . draw . Drawing . prototype . setCurrentLayer = function ( c ) { for ( var m = 0 ; m < this . getNumLayers ( ) ; ++ m ) if ( c == this . getLayerName ( m ) ) { if ( this . current _layer != this . all _layers [ m ] [ 1 ] ) { this . current _layer . setAttribute ( "style" , "pointer-events:none" ) ; this . current _layer = this . all _layers [ m ] [ 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 c = this . current _layer . parentNode . removeChild ( this . current _layer ) ; this . identifyLayers ( ) ; return c } return null } ; svgedit . draw . Drawing . prototype . identifyLayers = function ( ) { this . all _layers = [ ] ; for ( var c = this . svgElem _ . childNodes . length , m = [ ] , s = [ ] , b = null , f = false , d = 0 ; d < c ; ++ d ) { var l = this . svgElem _ . childNodes . item ( d ) ; if ( l && l . nodeType == 1 ) if ( l . tagName == "g" ) { f = true ; var p = $ ( "title" , l ) . text ( ) ; if ( ! p && svgedit . browser . isOpera ( ) && l . querySelectorAll ) p = $ ( l . querySelectorAll ( "title" ) ) . text ( ) ;
if ( p ) { s . push ( p ) ; this . all _layers . push ( [ p , l ] ) ; b = l ; svgedit . utilities . walkTree ( l , function ( B ) { B . setAttribute ( "style" , "pointer-events:inherit" ) } ) ; b . setAttribute ( "style" , "pointer-events:none" ) } else m . push ( l ) } else if ( ~ a . indexOf ( l . nodeName ) ) { svgedit . utilities . getBBox ( l ) ; m . push ( l ) } } c = this . svgElem _ . ownerDocument ; if ( m . length > 0 || ! f ) { for ( d = 1 ; s . indexOf ( "Layer " + d ) >= 0 ; ) d ++ ; s = "Layer " + d ; b = c . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ; f = c . createElementNS ( "http://www.w3.org/2000/svg" , "title" ) ; f . textContent = s ;
b . appendChild ( f ) ; for ( f = 0 ; f < m . length ; ++ f ) b . appendChild ( m [ f ] ) ; this . svgElem _ . appendChild ( b ) ; this . all _layers . push ( [ s , b ] ) } svgedit . utilities . walkTree ( b , function ( B ) { B . setAttribute ( "style" , "pointer-events:inherit" ) } ) ; this . current _layer = b ; this . current _layer . setAttribute ( "style" , "pointer-events:all" ) } ; svgedit . draw . Drawing . prototype . createLayer = function ( c ) { var m = this . svgElem _ . ownerDocument , s = m . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ; m = m . createElementNS ( "http://www.w3.org/2000/svg" , "title" ) ; m . textContent =
c ; s . appendChild ( m ) ; this . svgElem _ . appendChild ( s ) ; this . identifyLayers ( ) ; return s } ; svgedit . draw . Drawing . prototype . getLayerVisibility = function ( c ) { for ( var m = null , s = 0 ; s < this . getNumLayers ( ) ; ++ s ) if ( this . getLayerName ( s ) == c ) { m = this . all _layers [ s ] [ 1 ] ; break } if ( ! m ) return false ; return m . getAttribute ( "display" ) != "none" } ; svgedit . draw . Drawing . prototype . setLayerVisibility = function ( c , m ) { if ( typeof m != "boolean" ) return null ; for ( var s = null , b = 0 ; b < this . getNumLayers ( ) ; ++ b ) if ( this . getLayerName ( b ) == c ) { s = this . all _layers [ b ] [ 1 ] ;
break } if ( ! s ) return null ; s . getAttribute ( "display" ) ; s . setAttribute ( "display" , m ? "inline" : "none" ) ; return s } ; svgedit . draw . Drawing . prototype . getLayerOpacity = function ( c ) { for ( var m = 0 ; m < this . getNumLayers ( ) ; ++ m ) if ( this . getLayerName ( m ) == c ) { ( c = this . all _layers [ m ] [ 1 ] . getAttribute ( "opacity" ) ) || ( c = "1.0" ) ; return parseFloat ( c ) } return null } ; svgedit . draw . Drawing . prototype . setLayerOpacity = function ( c , m ) { if ( ! ( typeof m != "number" || m < 0 || m > 1 ) ) for ( var s = 0 ; s < this . getNumLayers ( ) ; ++ s ) if ( this . getLayerName ( s ) == c ) { this . all _layers [ s ] [ 1 ] . setAttribute ( "opacity" ,
2012-07-24 02:30:12 +00:00
m ) ; break } } } ) ( ) ; svgedit = svgedit || { } ;
2012-07-24 12:42:34 +00:00
( 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" ] } , g = [ ] , c = true , m = { } ; svgedit . path . setLinkControlPoints = function ( f ) { c = f } ; var s = svgedit . path . path = null ; svgedit . path . init =
function ( f ) { s = f ; g = [ 0 , "ClosePath" ] ; $ . each ( [ "Moveto" , "Lineto" , "CurvetoCubic" , "CurvetoQuadratic" , "Arc" , "LinetoHorizontal" , "LinetoVertical" , "CurvetoCubicSmooth" , "CurvetoQuadraticSmooth" ] , function ( d , l ) { g . push ( l + "Abs" ) ; g . push ( l + "Rel" ) } ) } ; svgedit . path . insertItemBefore = function ( f , d , l ) { f = f . pathSegList ; if ( svgedit . browser . supportsPathInsertItemBefore ( ) ) f . insertItemBefore ( d , l ) ; else { for ( var p = f . numberOfItems , B = [ ] , q = 0 ; q < p ; q ++ ) { var M = f . getItem ( q ) ; B . push ( M ) } f . clear ( ) ; for ( q = 0 ; q < p ; q ++ ) { q == l && f . appendItem ( d ) ; f . appendItem ( B [ q ] ) } } } ;
svgedit . path . ptObjToArr = function ( f , d ) { for ( var l = o [ f ] , p = l . length , B = Array ( p ) , q = 0 ; q < p ; q ++ ) B [ q ] = d [ l [ q ] ] ; return B } ; svgedit . path . getGripPt = function ( f , d ) { var l = { x : d ? d . x : f . item . x , y : d ? d . y : f . item . y } , p = f . path ; if ( p . matrix ) l = svgedit . math . transformPoint ( l . x , l . y , p . matrix ) ; l . x *= s . getCurrentZoom ( ) ; l . y *= s . getCurrentZoom ( ) ; return l } ; svgedit . path . getPointFromGrip = function ( f , d ) { var l = { x : f . x , y : f . y } ; if ( d . matrix ) { f = svgedit . math . transformPoint ( l . x , l . y , d . imatrix ) ; l . x = f . x ; l . y = f . y } l . x /= s . getCurrentZoom ( ) ; l . y /= s . getCurrentZoom ( ) ;
return l } ; svgedit . path . addPointGrip = function ( f , d , l ) { var p = svgedit . path . getGripContainer ( ) , B = svgedit . utilities . getElem ( "pathpointgrip_" + f ) ; if ( ! B ) { B = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; svgedit . utilities . assignAttributes ( B , { id : "pathpointgrip_" + f , display : "none" , width : 5 , height : 5 , fill : "#fff" , stroke : "#4F80FF" , "shape-rendering" : "crispEdges" , "stroke-width" : 1 , cursor : "move" , style : "pointer-events:all" , "xlink:title" : a . pathNodeTooltip } ) ; B = p . appendChild ( B ) ; $ ( "#pathpointgrip_" + f ) . dblclick ( function ( ) { svgedit . path . path &&
svgedit . path . path . setSegType ( ) } ) } d && l && svgedit . utilities . assignAttributes ( B , { x : d - 2.5 , y : l - 2.5 , display : "inline" } ) ; return B } ; svgedit . path . getGripContainer = function ( ) { var f = svgedit . utilities . getElem ( "pathpointgrip_container" ) ; if ( ! f ) { f = svgedit . utilities . getElem ( "selectorParentGroup" ) . appendChild ( document . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ) ; f . id = "pathpointgrip_container" } return f } ; svgedit . path . addCtrlGrip = function ( f ) { var d = svgedit . utilities . getElem ( "ctrlpointgrip_" + f ) ; if ( d ) return d ; d = document . createElementNS ( "http://www.w3.org/2000/svg" ,
2012-07-24 02:30:12 +00:00
"circle" ) ; svgedit . utilities . assignAttributes ( d , { id : "ctrlpointgrip_" + f , display : "none" , r : 3 , fill : "#4F80FF" , cursor : "move" , style : "pointer-events:all" , "xlink:title" : a . pathCtrlPtTooltip } ) ; svgedit . path . getGripContainer ( ) . appendChild ( d ) ; return d } ; svgedit . path . getCtrlLine = function ( f ) { var d = svgedit . utilities . getElem ( "ctrlLine_" + f ) ; if ( d ) return d ; d = document . createElementNS ( "http://www.w3.org/2000/svg" , "line" ) ; svgedit . utilities . assignAttributes ( d , { id : "ctrlLine_" + f , stroke : "#4F80FF" , "stroke-width" : 1 , style : "pointer-events:none" } ) ;
2012-07-24 12:42:34 +00:00
svgedit . path . getGripContainer ( ) . appendChild ( d ) ; return d } ; svgedit . path . getPointGrip = function ( f , d ) { var l = svgedit . path . addPointGrip ( f . index ) ; if ( d ) { var p = svgedit . path . getGripPt ( f ) ; svgedit . utilities . assignAttributes ( l , { x : p . x - 2.5 , y : p . y - 2.5 , display : "inline" } ) } return l } ; svgedit . path . getControlPoints = function ( f ) { var d = f . item , l = f . index ; if ( ! ( "x1" in d ) || ! ( "x2" in d ) ) return null ; var p = { } ; svgedit . path . getGripContainer ( ) ; for ( var B = [ svgedit . path . path . segs [ l - 1 ] . item , d ] , q = 1 ; q < 3 ; q ++ ) { var M = l + "c" + q , U = p [ "c" + q + "_line" ] =
svgedit . path . getCtrlLine ( M ) , P = svgedit . path . getGripPt ( f , { x : d [ "x" + q ] , y : d [ "y" + q ] } ) , I = svgedit . path . getGripPt ( f , { x : B [ q - 1 ] . x , y : B [ q - 1 ] . y } ) ; svgedit . utilities . assignAttributes ( U , { x1 : P . x , y1 : P . y , x2 : I . x , y2 : I . y , display : "inline" } ) ; p [ "c" + q + "_line" ] = U ; pointGrip = p [ "c" + q ] = svgedit . path . addCtrlGrip ( M ) ; svgedit . utilities . assignAttributes ( pointGrip , { cx : P . x , cy : P . y , display : "inline" } ) ; p [ "c" + q ] = pointGrip } return p } ; svgedit . path . replacePathSeg = function ( f , d , l , p ) { p = p || svgedit . path . path . elem ; f = p [ "createSVGPathSeg" + g [ f ] ] . apply ( p ,
l ) ; if ( svgedit . browser . supportsPathReplaceItem ( ) ) p . pathSegList . replaceItem ( f , d ) ; else { l = p . pathSegList ; p = l . numberOfItems ; for ( var B = [ ] , q = 0 ; q < p ; q ++ ) { var M = l . getItem ( q ) ; B . push ( M ) } l . clear ( ) ; for ( q = 0 ; q < p ; q ++ ) q == d ? l . appendItem ( f ) : l . appendItem ( B [ q ] ) } } ; svgedit . path . getSegSelector = function ( f , d ) { var l = f . index , p = svgedit . utilities . getElem ( "segline_" + l ) ; if ( ! p ) { var B = svgedit . path . getGripContainer ( ) ; p = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; svgedit . utilities . assignAttributes ( p , { id : "segline_" + l ,
display : "none" , fill : "none" , stroke : "#0FF" , "stroke-width" : 2 , style : "pointer-events:none" , d : "M0,0 0,0" } ) ; B . appendChild ( p ) } if ( d ) { l = f . prev ; if ( ! l ) { p . setAttribute ( "display" , "none" ) ; return p } l = svgedit . path . getGripPt ( l ) ; svgedit . path . replacePathSeg ( 2 , 0 , [ l . x , l . y ] , p ) ; B = svgedit . path . ptObjToArr ( f . type , f . item , true ) ; for ( var q = 0 ; q < B . length ; q += 2 ) { l = svgedit . path . getGripPt ( f , { x : B [ q ] , y : B [ q + 1 ] } ) ; B [ q ] = l . x ; B [ q + 1 ] = l . y } svgedit . path . replacePathSeg ( f . type , 1 , B , p ) } return p } ; svgedit . path . smoothControlPoints = this . smoothControlPoints =
function ( f , d , l ) { var p = f . x - l . x , B = f . y - l . y , q = d . x - l . x , M = d . y - l . y ; if ( ( p != 0 || B != 0 ) && ( q != 0 || M != 0 ) ) { f = Math . atan2 ( B , p ) ; d = Math . atan2 ( M , q ) ; p = Math . sqrt ( p * p + B * B ) ; q = Math . sqrt ( q * q + M * M ) ; B = s . getSVGRoot ( ) . createSVGPoint ( ) ; M = s . getSVGRoot ( ) . createSVGPoint ( ) ; if ( f < 0 ) f += 2 * Math . PI ; if ( d < 0 ) d += 2 * Math . PI ; var U = Math . abs ( f - d ) , P = Math . abs ( Math . PI - U ) / 2 ; if ( f - d > 0 ) { f = U < Math . PI ? f + P : f - P ; d = U < Math . PI ? d - P : d + P } else { f = U < Math . PI ? f - P : f + P ; d = U < Math . PI ? d + P : d - P } B . x = p * Math . cos ( f ) + l . x ; B . y = p * Math . sin ( f ) + l . y ; M . x = q * Math . cos ( d ) + l . x ; M . y = q * Math . sin ( d ) + l . y ;
return [ B , M ] } } ; svgedit . path . Segment = function ( f , d ) { this . selected = false ; this . index = f ; this . item = d ; this . type = d . pathSegType ; this . ctrlpts = [ ] ; this . segsel = this . ptgrip = null } ; svgedit . path . Segment . prototype . showCtrlPts = function ( f ) { for ( var d in this . ctrlpts ) this . ctrlpts [ d ] . setAttribute ( "display" , f ? "inline" : "none" ) } ; svgedit . path . Segment . prototype . selectCtrls = function ( ) { $ ( "#ctrlpointgrip_" + this . index + "c1, #ctrlpointgrip_" + this . index + "c2" ) . attr ( "fill" , "#4F80FF" ) } ; svgedit . path . Segment . prototype . show = function ( f ) { if ( this . ptgrip ) { this . ptgrip . setAttribute ( "display" ,
2012-07-24 02:30:12 +00:00
f ? "inline" : "none" ) ; this . segsel . setAttribute ( "display" , f ? "inline" : "none" ) ; this . showCtrlPts ( f ) } } ; svgedit . path . Segment . prototype . select = function ( f ) { if ( this . ptgrip ) { this . ptgrip . setAttribute ( "stroke" , f ? "#0FF" : "#00F" ) ; this . segsel . setAttribute ( "display" , f ? "inline" : "none" ) ; this . ctrlpts && this . selectCtrls ( f ) ; this . selected = f } } ; svgedit . path . Segment . prototype . addGrip = function ( ) { this . ptgrip = svgedit . path . getPointGrip ( this , true ) ; this . ctrlpts = svgedit . path . getControlPoints ( this , true ) ; this . segsel = svgedit . path . getSegSelector ( this ,
true ) } ; svgedit . path . Segment . prototype . update = function ( f ) { if ( this . ptgrip ) { var d = svgedit . path . getGripPt ( this ) ; svgedit . utilities . assignAttributes ( this . ptgrip , this . ptgrip . nodeName == "rect" ? { x : d . x - 2.5 , y : d . y - 2.5 } : { cx : d . x , cy : d . y } ) ; svgedit . path . getSegSelector ( this , true ) ; if ( this . ctrlpts ) { if ( f ) { this . item = svgedit . path . path . elem . pathSegList . getItem ( this . index ) ; this . type = this . item . pathSegType } svgedit . path . getControlPoints ( this ) } } } ; svgedit . path . Segment . prototype . move = function ( f , d ) { var l = this . item ; l = this . ctrlpts ?
2012-07-24 12:42:34 +00:00
[ l . x += f , l . y += d , l . x1 , l . y1 , l . x2 += f , l . y2 += d ] : [ l . x += f , l . y += d ] ; svgedit . path . replacePathSeg ( this . type , this . index , l ) ; if ( this . next && this . next . ctrlpts ) { l = this . next . item ; l = [ l . x , l . y , l . x1 += f , l . y1 += d , l . x2 , l . y2 ] ; svgedit . path . replacePathSeg ( this . next . type , this . next . index , l ) } if ( this . mate ) { l = this . mate . item ; l = [ l . x += f , l . y += d ] ; svgedit . path . replacePathSeg ( this . mate . type , this . mate . index , l ) } this . update ( true ) ; this . next && this . next . update ( true ) } ; svgedit . path . Segment . prototype . setLinked = function ( f ) { var d , l , p ; if ( f == 2 ) { l = 1 ; d =
this . next ; if ( ! d ) return ; p = this . item } else { l = 2 ; d = this . prev ; if ( ! d ) return ; p = d . item } var B = d . item ; B [ "x" + l ] = p . x + ( p . x - this . item [ "x" + f ] ) ; B [ "y" + l ] = p . y + ( p . y - this . item [ "y" + f ] ) ; 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 ( f , d , l ) { var p = this . item ; p [ "x" + f ] += d ; p [ "y" + f ] += l ; svgedit . path . replacePathSeg ( this . type , this . index , [ p . x , p . y , p . x1 , p . y1 , p . x2 , p . y2 ] ) ; this . update ( true ) } ; svgedit . path . Segment . prototype . setType = function ( f , d ) { svgedit . path . replacePathSeg ( f ,
2012-07-24 02:30:12 +00:00
this . index , d ) ; this . type = f ; this . item = svgedit . path . path . elem . pathSegList . getItem ( this . index ) ; this . showCtrlPts ( f === 6 ) ; this . ctrlpts = svgedit . path . getControlPoints ( this ) ; this . update ( true ) } ; svgedit . path . Path = function ( f ) { if ( ! f || f . tagName !== "path" ) throw "svgedit.path.Path constructed without a <path> element" ; this . elem = f ; this . segs = [ ] ; this . selected _pts = [ ] ; svgedit . path . path = this ; this . init ( ) } ; svgedit . path . Path . prototype . init = function ( ) { $ ( svgedit . path . getGripContainer ( ) ) . find ( "*" ) . attr ( "display" , "none" ) ; var f =
2012-07-24 12:42:34 +00:00
this . elem . pathSegList , d = f . numberOfItems ; this . segs = [ ] ; this . selected _pts = [ ] ; this . first _seg = null ; for ( var l = 0 ; l < d ; l ++ ) { var p = f . getItem ( l ) ; p = new svgedit . path . Segment ( l , p ) ; p . path = this ; this . segs . push ( p ) } f = this . segs ; p = null ; for ( l = 0 ; l < d ; l ++ ) { var B = f [ l ] , q = l + 1 >= d ? null : f [ l + 1 ] , M = l - 1 < 0 ? null : f [ l - 1 ] ; if ( B . type === 2 ) { if ( M && M . type !== 1 ) { q = f [ p ] ; q . next = f [ p + 1 ] ; q . next . prev = q ; q . addGrip ( ) } p = l } else if ( q && q . type === 1 ) { B . next = f [ p + 1 ] ; B . next . prev = B ; B . mate = f [ p ] ; B . addGrip ( ) ; if ( this . first _seg == null ) this . first _seg = B } else if ( q ) { if ( B . type !==
1 ) { B . addGrip ( ) ; if ( q && q . type !== 2 ) { B . next = q ; B . next . prev = B } } } else if ( B . type !== 1 ) { q = f [ p ] ; q . next = f [ p + 1 ] ; q . next . prev = q ; q . addGrip ( ) ; B . addGrip ( ) ; if ( ! this . first _seg ) this . first _seg = f [ p ] } } return this } ; svgedit . path . Path . prototype . eachSeg = function ( f ) { for ( var d = this . segs . length , l = 0 ; l < d ; l ++ ) if ( f . call ( this . segs [ l ] , l ) === false ) break } ; svgedit . path . Path . prototype . addSeg = function ( f ) { var d = this . segs [ f ] ; if ( d . prev ) { var l = d . prev , p ; switch ( d . item . pathSegType ) { case 4 : var B = ( d . item . x + l . item . x ) / 2 , q = ( d . item . y + l . item . y ) / 2 ; p = this . elem . createSVGPathSegLinetoAbs ( B ,
q ) ; break ; case 6 : p = ( l . item . x + d . item . x1 ) / 2 ; var M = ( d . item . x1 + d . item . x2 ) / 2 , U = ( d . item . x2 + d . item . x ) / 2 , P = ( p + M ) / 2 ; M = ( M + U ) / 2 ; B = ( P + M ) / 2 ; var I = ( l . item . y + d . item . y1 ) / 2 , V = ( d . item . y1 + d . item . y2 ) / 2 ; l = ( d . item . y2 + d . item . y ) / 2 ; var ca = ( I + V ) / 2 ; V = ( V + l ) / 2 ; q = ( ca + V ) / 2 ; p = this . elem . createSVGPathSegCurvetoCubicAbs ( B , q , p , I , P , ca ) ; svgedit . path . replacePathSeg ( d . type , f , [ d . item . x , d . item . y , M , V , U , l ] ) } svgedit . path . insertItemBefore ( this . elem , p , f ) } } ; svgedit . path . Path . prototype . deleteSeg = function ( f ) { var d = this . segs [ f ] , l = this . elem . pathSegList ;
d . show ( false ) ; var p = d . next ; if ( d . mate ) { var B = [ p . item . x , p . item . y ] ; svgedit . path . replacePathSeg ( 2 , p . index , B ) ; svgedit . path . replacePathSeg ( 4 , d . index , B ) ; l . removeItem ( d . mate . index ) } else { if ( ! d . prev ) { B = [ p . item . x , p . item . y ] ; svgedit . path . replacePathSeg ( 2 , d . next . index , B ) } l . removeItem ( f ) } } ; svgedit . path . Path . prototype . subpathIsClosed = function ( f ) { var d = false ; svgedit . path . path . eachSeg ( function ( l ) { if ( l <= f ) return true ; if ( this . type === 2 ) return false ; else if ( this . type === 1 ) { d = true ; return false } } ) ; return d } ; svgedit . path . Path . prototype . removePtFromSelection =
2012-07-24 02:30:12 +00:00
function ( f ) { var d = this . selected _pts . indexOf ( f ) ; if ( d != - 1 ) { this . segs [ f ] . 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 ( f ) { this . eachSeg ( function ( ) { this . show ( f ) } ) ; f && this . selectPt ( this . first _seg . index ) ; return this } ; svgedit . path . Path . prototype . movePts = function ( f ,
2012-07-24 12:42:34 +00:00
d ) { for ( var l = this . selected _pts . length ; l -- ; ) this . segs [ this . selected _pts [ l ] ] . move ( f , d ) } ; svgedit . path . Path . prototype . moveCtrl = function ( f , d ) { var l = this . segs [ this . selected _pts [ 0 ] ] ; l . moveCtrl ( this . dragctrl , f , d ) ; c && l . setLinked ( this . dragctrl ) } ; svgedit . path . Path . prototype . setSegType = function ( f ) { this . storeD ( ) ; for ( var d = this . selected _pts . length , l ; d -- ; ) { var p = this . segs [ this . selected _pts [ d ] ] , B = p . prev ; if ( B ) { if ( ! f ) { l = "Toggle Path Segment Type" ; f = p . type == 6 ? 4 : 6 } f -= 0 ; var q = p . item . x , M = p . item . y , U = B . item . x ; B = B . item . y ;
var P ; switch ( f ) { case 6 : if ( p . olditem ) { U = p . olditem ; P = [ q , M , U . x1 , U . y1 , U . x2 , U . y2 ] } else { P = q - U ; var I = M - B ; P = [ q , M , U + P / 3 , B + I / 3 , q - P / 3 , M - I / 3 ] } break ; case 4 : P = [ q , M ] ; p . olditem = p . item } p . setType ( f , P ) } } svgedit . path . path . endChanges ( l ) } ; svgedit . path . Path . prototype . selectPt = function ( f , d ) { this . clearSelection ( ) ; f == null && this . eachSeg ( function ( l ) { if ( this . prev ) f = l } ) ; this . addPtsToSelection ( f ) ; if ( d ) { this . dragctrl = d ; c && this . segs [ f ] . setLinked ( d ) } } ; svgedit . path . Path . prototype . update = function ( ) { var f = this . elem ; if ( svgedit . utilities . getRotationAngle ( f ) ) { this . matrix =
svgedit . math . getMatrix ( f ) ; this . imatrix = this . matrix . inverse ( ) } else this . imatrix = this . matrix = null ; this . eachSeg ( function ( d ) { this . item = f . pathSegList . getItem ( d ) ; this . update ( ) } ) ; return this } ; svgedit . path . getPath _ = function ( f ) { var d = m [ f . id ] ; d || ( d = m [ f . id ] = new svgedit . path . Path ( f ) ) ; return d } ; svgedit . path . removePath _ = function ( f ) { f in m && delete m [ f ] } ; var b = function ( f , d ) { dx = f - oldcx ; dy = d - oldcy ; r = Math . sqrt ( dx * dx + dy * dy ) ; theta = Math . atan2 ( dy , dx ) + angle ; dx = r * Math . cos ( theta ) + oldcx ; dy = r * Math . sin ( theta ) + oldcy ; dx -= newcx ;
dy -= newcy ; r = Math . sqrt ( dx * dx + dy * dy ) ; theta = Math . atan2 ( dy , dx ) - angle ; return { x : ( r * Math . cos ( theta ) + newcx ) / 1 , y : ( r * Math . sin ( theta ) + newcy ) / 1 } } ; svgedit . path . recalcRotatedPath = function ( ) { var f = svgedit . path . path . elem , d = svgedit . utilities . getRotationAngle ( f , true ) ; if ( d ) { var l = svgedit . utilities . getBBox ( f ) , p = svgedit . path . path . oldbbox , B = p . x + p . width / 2 , q = p . y + p . height / 2 ; p = l . x + l . width / 2 ; l = l . y + l . height / 2 ; p = p - B ; var M = l - q ; l = Math . sqrt ( p * p + M * M ) ; M = Math . atan2 ( M , p ) + d ; p = l * Math . cos ( M ) + B ; l = l * Math . sin ( M ) + q ; B = f . pathSegList ; for ( q = B . numberOfItems ; q ; ) { q -=
1 ; M = B . getItem ( q ) ; var U = M . pathSegType ; if ( U != 1 ) { var P = b ( M . x , M . y ) ; P = [ P . x , P . y ] ; if ( M . x1 != null && M . x2 != null ) { c _vals1 = b ( M . x1 , M . y1 ) ; c _vals2 = b ( M . x2 , M . y2 ) ; P . splice ( P . length , 0 , c _vals1 . x , c _vals1 . y , c _vals2 . x , c _vals2 . y ) } svgedit . path . replacePathSeg ( U , q , P ) } } svgedit . utilities . getBBox ( f ) ; B = svgroot . createSVGTransform ( ) ; f = svgedit . transformlist . getTransformList ( f ) ; B . setRotate ( d * 180 / Math . PI , p , l ) ; f . replaceItem ( B , 0 ) } } ; svgedit . path . clearData = function ( ) { m = { } } } ) ( ) ; 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 , g ) { var c = this . length ; if ( ! c ) return a . apply ( this , arguments ) ; for ( var m = 0 ; m < c ; m ++ ) { var s = this [ m ] ; if ( s . namespaceURI === "http://www.w3.org/2000/svg" ) if ( g !== undefined ) s . setAttribute ( o , g ) ; else if ( $ . isArray ( o ) ) { c = o . length ; for ( m = { } ; c -- ; ) { var b = o [ c ] , f = s . getAttribute ( b ) ; if ( f || f === "0" ) f = isNaN ( f ) ? f : f - 0 ; m [ b ] = f } return m } else if ( typeof o === "object" ) for ( b in o ) s . setAttribute ( b , o [ b ] ) ; else { if ( ( f = s . getAttribute ( o ) ) || f === "0" ) f = isNaN ( f ) ? f : f - 0 ; return f } else return a . apply ( this ,
2012-07-14 20:36:17 +00:00
arguments ) } return this } } ) ( ) ;
2012-07-24 12:42:34 +00:00
$ . SvgCanvas = function ( a , o ) { function g ( e , h ) { for ( var k = svgedit . utilities . getBBox ( e ) , w = 0 ; w < 2 ; w ++ ) { var v = w === 0 ? "fill" : "stroke" , F = e . getAttribute ( v ) ; if ( F && F . indexOf ( "url(" ) === 0 ) { F = fa ( F ) ; if ( F . tagName === "linearGradient" ) { var z = F . getAttribute ( "x1" ) || 0 , u = F . getAttribute ( "y1" ) || 0 , D = F . getAttribute ( "x2" ) || 1 , H = F . getAttribute ( "y2" ) || 0 ; z = k . width * z + k . x ; u = k . height * u + k . y ; D = k . width * D + k . x ; H = k . height * H + k . y ; z = Q ( z , u , h ) ; H = Q ( D , H , h ) ; D = { } ; D . x1 = ( z . x - k . x ) / k . width ; D . y1 = ( z . y - k . y ) / k . height ; D . x2 = ( H . x - k . x ) / k . width ; D . y2 = ( H . y - k . y ) / k . height ;
F = F . cloneNode ( true ) ; $ ( F ) . attr ( D ) ; F . id = S ( ) ; sb ( ) . appendChild ( F ) ; e . setAttribute ( v , "url(#" + F . id + ")" ) } } } } var c = "http://www.w3.org/2000/svg" , m = { show _outside _canvas : true , selectNew : true , dimensions : [ 640 , 480 ] } ; o && $ . extend ( m , o ) ; var s = m . dimensions , b = this , f = a . ownerDocument , d = f . importNode ( svgedit . utilities . text2xml ( '<svg id="svgroot" xmlns="' + c + '" 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 l = f . createElementNS ( c , "svg" ) ; ( b . clearSvgContentElement = function ( ) { for ( ; l . firstChild ; ) l . removeChild ( l . firstChild ) ; $ ( l ) . attr ( { id : "svgcontent" , width : s [ 0 ] , height : s [ 1 ] , x : s [ 0 ] , y : s [ 1 ] , overflow : m . show _outside _canvas ? "visible" : "hidden" , xmlns : c , "xmlns:se" : "http://svg-edit.googlecode.com" , "xmlns:xlink" : "http://www.w3.org/1999/xlink" } ) . appendTo ( d ) ; var e = f . createComment ( " Created with Method Draw - http://github.com/duopixel/Method-Draw/ " ) ; l . appendChild ( e ) } ) ( ) ; var p = "svg_" ; b . setIdPrefix =
function ( e ) { p = e } ; b . current _drawing _ = new svgedit . draw . Drawing ( l , p ) ; var B = b . getCurrentDrawing = function ( ) { return b . current _drawing _ } , q = 1 , M = null , U = { shape : { fill : ( m . initFill . color == "none" ? "" : "#" ) + m . initFill . color , fill _paint : null , fill _opacity : m . initFill . opacity , stroke : "#" + m . initStroke . color , stroke _paint : null , stroke _opacity : m . initStroke . opacity , stroke _width : m . initStroke . width , stroke _dasharray : "none" , stroke _linejoin : "miter" , stroke _linecap : "butt" , opacity : m . initOpacity } } ; U . text = $ . extend ( true , { } , U . shape ) ; $ . extend ( U . text ,
{ fill : "#000000" , stroke _width : 0 , font _size : 24 , font _family : "Junction" } ) ; var P = U . shape , I = Array ( 1 ) , V = this . addSvgElementFromJson = function ( e ) { var h = svgedit . utilities . getElem ( e . attr . id ) , k = B ( ) . getCurrentLayer ( ) ; if ( h && e . element != h . tagName ) { k . removeChild ( h ) ; h = null } if ( ! h ) { h = f . createElementNS ( c , e . element ) ; if ( k ) ( M || k ) . appendChild ( h ) } e . curStyles && svgedit . utilities . assignAttributes ( h , { fill : P . fill , stroke : P . stroke , "stroke-width" : P . stroke _width , "stroke-dasharray" : P . stroke _dasharray , "stroke-linejoin" : P . stroke _linejoin ,
"stroke-linecap" : P . stroke _linecap , "stroke-opacity" : P . stroke _opacity , "fill-opacity" : P . fill _opacity , opacity : P . opacity / 2 , style : "pointer-events:inherit" } , 100 ) ; svgedit . utilities . assignAttributes ( h , e . attr , 100 ) ; svgedit . utilities . cleanupElement ( h ) ; return h } , ca = b . getTransformList = svgedit . transformlist . getTransformList , Q = svgedit . math . transformPoint , W = b . matrixMultiply = svgedit . math . matrixMultiply , ha = b . hasMatrixTransform = svgedit . math . hasMatrixTransform , X = b . transformListToTransform = svgedit . math . transformListToTransform ,
R = svgedit . math . snapToAngle , ba = svgedit . math . getMatrix ; svgedit . units . init ( { getBaseUnit : function ( ) { return m . baseUnit } , getElement : svgedit . utilities . getElem , getHeight : function ( ) { return l . getAttribute ( "height" ) / q } , getWidth : function ( ) { return l . getAttribute ( "width" ) / q } , getRoundDigits : function ( ) { return fb . round _digits } } ) ; var ta = b . convertToNum = svgedit . units . convertToNum ; svgedit . utilities . init ( { getDOMDocument : function ( ) { return f } , getDOMContainer : function ( ) { return a } , getSVGRoot : function ( ) { return d } , getSelectedElements : function ( ) { return I } ,
getSVGContent : function ( ) { return l } } ) ; var ja = b . getUrlFromAttr = svgedit . utilities . getUrlFromAttr , ea = b . getHref = svgedit . utilities . getHref , aa = b . setHref = svgedit . utilities . setHref , Z = svgedit . utilities . getPathBBox ; b . getBBox = svgedit . utilities . getBBox ; var la = b . getRotationAngle = svgedit . utilities . getRotationAngle , sa = b . getElem = svgedit . utilities . getElem , na = b . assignAttributes = svgedit . utilities . assignAttributes , oa = this . cleanupElement = svgedit . utilities . cleanupElement , Ba = svgedit . sanitize . getNSMap ( ) , Ga = b . sanitizeSvg =
svgedit . sanitize . sanitizeSvg , Ja = svgedit . history . MoveElementCommand , Ca = svgedit . history . InsertElementCommand , La = svgedit . history . RemoveElementCommand , Na = svgedit . history . ChangeElementCommand , Ha = svgedit . history . BatchCommand ; b . undoMgr = new svgedit . history . UndoManager ( { handleHistoryEvent : function ( e , h ) { var k = svgedit . history . HistoryEventTypes ; if ( e == k . BEFORE _UNAPPLY || e == k . BEFORE _APPLY ) b . clearSelection ( ) ; else if ( e == k . AFTER _APPLY || e == k . AFTER _UNAPPLY ) { var w = h . elements ( ) ; b . pathActions . clear ( ) ; O ( "changed" , w ) ; w = h . type ( ) ;
k = e == k . AFTER _APPLY ; if ( w == Ja . type ( ) ) { k = k ? h . newParent : h . oldParent ; k == l && b . identifyLayers ( ) } else if ( w == Ca . type ( ) || w == La . type ( ) ) { h . parent == l && b . identifyLayers ( ) ; if ( w == Ca . type ( ) ) k && $a ( h . elem ) ; else k || $a ( h . elem ) ; h . elem . tagName === "use" && Qb ( h . elem ) } else if ( w == Na . type ( ) ) { h . elem . tagName == "title" && h . elem . parentNode . parentNode == l && b . identifyLayers ( ) ; k = k ? h . newValues : h . oldValues ; k . stdDeviation && b . setBlurOffsets ( h . elem . parentNode , k . stdDeviation ) ; if ( h . elem . tagName === "use" && svgedit . browser . isWebkit ( ) ) { w = h . elem ; if ( ! w . getAttribute ( "x" ) &&
! w . getAttribute ( "y" ) ) { k = w . parentNode ; var v = w . nextSibling ; k . removeChild ( w ) ; k . insertBefore ( w , v ) } } } } } } ) ; var va = function ( e ) { b . undoMgr . addCommandToHistory ( e ) } ; svgedit . select . init ( m , { createSVGElement : function ( e ) { return b . addSvgElementFromJson ( e ) } , svgRoot : function ( ) { return d } , svgContent : function ( ) { return l } , currentZoom : function ( ) { return q } , getStrokedBBox : function ( e ) { return b . getStrokedBBox ( [ e ] ) } } ) ; var Fa = this . selectorManager = svgedit . select . getSelectorManager ( ) , ub = this . hoverManager = svgedit . select . getSelectorManager ( ) ;
svgedit . path . init ( { getCurrentZoom : function ( ) { return q } , getSVGRoot : function ( ) { return d } } ) ; svgedit . utilities . snapToGrid = function ( e ) { var h = m . snappingStep , k = m . baseUnit ; if ( k !== "px" ) h *= svgedit . units . getTypeMap ( ) [ k ] ; return e = Math . round ( e / h ) * h } ; var Aa = svgedit . utilities . snapToGrid , vb = { 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" } , Ua = [ "clip-path" ,
"fill" , "filter" , "marker-end" , "marker-mid" , "marker-start" , "mask" , "stroke" ] , Ta = $ . data , $a = function ( e ) { var h = $ ( e ) . attr ( Ua ) , k ; for ( k in h ) { var w = h [ k ] ; if ( w && w . indexOf ( "url(" ) === 0 ) { w = ja ( w ) . substr ( 1 ) ; if ( ! sa ( w ) ) { sb ( ) . appendChild ( xb [ w ] ) ; delete xb [ w ] } } } e = e . getElementsByTagName ( "*" ) ; if ( e . length ) { h = 0 ; for ( k = e . length ; h < k ; h ++ ) $a ( e [ h ] ) } } , za = { } , ya = m . imgPath + "logo.png" , ob = [ ] , fb = { round _digits : 5 } , Oa = false , Za = null , Ea = "select" , pb = "none" , qb = { } , gb = U . text , cb = P , Sa = null , Ma = null , bb = [ ] , zb = { } , xb = { } ; b . clipBoard = [ ] ; var eb = this . runExtensions =
function ( e , h , k ) { var w = false ; if ( k ) w = [ ] ; $ . each ( zb , function ( v , F ) { if ( e in F ) if ( k ) w . push ( F [ e ] ( h ) ) ; else w = F [ e ] ( h ) } ) ; return w } ; this . addExtension = function ( e , h ) { if ( e in zb ) console . log ( 'Cannot add extension "' + e + '", an extension by that name already exists"' ) ; else { var k = $ . isFunction ( h ) ? h ( $ . extend ( b . getPrivateMethods ( ) , { svgroot : d , svgcontent : l , nonce : B ( ) . getNonce ( ) , selectorManager : Fa , hoverManager : ub } ) ) : h ; zb [ e ] = k ; O ( "extension_added" , k ) } } ; var rb = this . round = function ( e ) { return parseInt ( e * q ) / q } , Ab = this . getIntersectionList =
function ( e ) { if ( Ma == null ) return null ; var h = M || B ( ) . getCurrentLayer ( ) ; bb . length || ( bb = Db ( h ) ) ; var k = null ; try { k = h . getIntersectionList ( e , null ) } catch ( w ) { } if ( k == null || typeof k . item != "function" ) { k = [ ] ; if ( e ) e = e ; else { e = Ma . getBBox ( ) ; h = { } ; for ( var v in e ) h [ v ] = e [ v ] / q ; e = h } for ( v = bb . length ; v -- ; ) e . width && e . width && svgedit . math . rectsIntersect ( e , bb [ v ] . bbox ) && k . push ( bb [ v ] . elem ) } return k } ; getStrokedBBox = this . getStrokedBBox = function ( e ) { e || ( e = wb ( ) ) ; if ( ! e . length ) return false ; var h = function ( H ) { try { var C = svgedit . utilities . getBBox ( H ) ,
E = svgedit . utilities . getRotationAngle ( H ) ; if ( E && E % 90 || svgedit . math . hasMatrixTransform ( svgedit . transformlist . getTransformList ( H ) ) ) { E = false ; if ( [ "ellipse" , "path" , "line" , "polyline" , "polygon" ] . indexOf ( H . tagName ) >= 0 ) C = E = b . convertToPath ( H , true ) ; else if ( H . tagName == "rect" ) { var K = H . getAttribute ( "rx" ) , L = H . getAttribute ( "ry" ) ; if ( K || L ) C = E = b . convertToPath ( H , true ) } if ( ! E ) { var Y = H . cloneNode ( true ) , n = document . createElementNS ( c , "g" ) , A = H . parentNode ; A . appendChild ( n ) ; n . appendChild ( Y ) ; C = svgedit . utilities . bboxToObj ( n . getBBox ( ) ) ;
A . removeChild ( n ) } } return C } catch ( G ) { console . log ( H , G ) ; return null } } , k ; $ . each ( e , function ( ) { if ( ! k ) if ( this . parentNode ) k = h ( this ) } ) ; if ( k == null ) return null ; var w = k . x + k . width , v = k . y + k . height , F = k . x , z = k . y , u = function ( H ) { var C = H . getAttribute ( "stroke-width" ) , E = 0 ; if ( H . getAttribute ( "stroke" ) != "none" && ! isNaN ( C ) ) E += C / 2 ; return E } , D = [ ] ; $ . each ( e , function ( H , C ) { var E = h ( C ) ; if ( E ) { var K = u ( C ) ; F = Math . min ( F , E . x - K ) ; z = Math . min ( z , E . y - K ) ; D . push ( E ) } } ) ; k . x = F ; k . y = z ; $ . each ( e , function ( H , C ) { var E = D [ H ] ; if ( E && C . nodeType == 1 ) { var K = u ( C ) ; w =
Math . max ( w , E . x + E . width + K ) ; v = Math . max ( v , E . y + E . height + K ) } } ) ; k . width = w - F ; k . height = v - z ; return k } ; var wb = this . getVisibleElements = function ( e ) { e || ( e = $ ( l ) . children ( ) ) ; e . find ( "#canvas_background" ) . length && e . splice ( 0 , 1 ) ; var h = [ ] ; $ ( e ) . children ( ) . each ( function ( k , w ) { try { w . getBBox ( ) && h . push ( w ) } catch ( v ) { } } ) ; return h . reverse ( ) } , Db = this . getVisibleElementsAndBBoxes = function ( e ) { e || ( e = $ ( l ) . children ( ) ) ; var h = [ ] ; $ ( e ) . children ( ) . each ( function ( k , w ) { try { w . getBBox ( ) && h . push ( { elem : w , bbox : getStrokedBBox ( [ w ] ) } ) } catch ( v ) { } } ) ;
return h . reverse ( ) } , ma = this . groupSvgElem = function ( e ) { var h = document . createElementNS ( c , "g" ) ; e . parentNode . replaceChild ( h , e ) ; $ ( h ) . append ( e ) . data ( "gsvg" , e ) [ 0 ] . id = S ( ) } , ga = function ( e ) { var h = document . createElementNS ( e . namespaceURI , e . nodeName ) ; h . removeAttribute ( "id" ) ; $ . each ( e . attributes , function ( w , v ) { v . localName != "-moz-math-font-style" && h . setAttributeNS ( v . namespaceURI , v . nodeName , v . nodeValue ) } ) ; if ( svgedit . browser . isWebkit ( ) && e . nodeName == "path" ) { var k = Ka . convertPath ( e ) ; h . setAttribute ( "d" , k ) } $ . each ( e . childNodes ,
function ( w , v ) { switch ( v . nodeType ) { case 1 : h . appendChild ( ga ( v ) ) ; break ; case 3 : h . textContent = v . nodeValue } } ) ; if ( $ ( e ) . data ( "gsvg" ) ) $ ( h ) . data ( "gsvg" , h . firstChild ) ; else if ( $ ( e ) . data ( "symbol" ) ) { e = $ ( e ) . data ( "symbol" ) ; $ ( h ) . data ( "ref" , e ) . data ( "symbol" , e ) } else h . tagName == "image" && tb ( h ) ; h . id = S ( ) ; return h } , qa , S , O ; ( function ( e ) { var h = { } ; qa = e . getId = function ( ) { return B ( ) . getId ( ) } ; S = e . getNextId = function ( ) { return B ( ) . getNextId ( ) } ; O = e . call = function ( k , w ) { if ( h [ k ] ) return h [ k ] ( this , w ) } ; e . bind = function ( k , w ) { var v = h [ k ] ; h [ k ] =
w ; return v } } ) ( b ) ; this . prepareSvg = function ( e ) { this . sanitizeSvg ( e . documentElement ) ; e = e . getElementsByTagNameNS ( c , "path" ) ; for ( var h = 0 , k = e . length ; h < k ; ++ h ) { var w = e [ h ] ; w . setAttribute ( "d" , Ka . convertPath ( w ) ) ; Ka . fixEnd ( w ) } } ; var fa = this . getRefElem = function ( e ) { return sa ( ja ( e ) . substr ( 1 ) ) } , Ia = function ( e ) { if ( ! svgedit . browser . isGecko ( ) ) return e ; var h = e . cloneNode ( true ) ; e . parentNode . insertBefore ( h , e ) ; e . parentNode . removeChild ( e ) ; Fa . releaseSelector ( e ) ; I [ 0 ] = h ; Fa . requestSelector ( h ) . showGrips ( true ) ; return h } ; this . setRotationAngle =
function ( e , h ) { e = parseFloat ( e ) ; var k = I [ 0 ] , w = k . getAttribute ( "transform" ) , v = svgedit . utilities . getBBox ( k ) , F = v . x + v . width / 2 , z = v . y + v . height / 2 ; v = ca ( k ) ; v . numberOfItems > 0 && v . getItem ( 0 ) . type == 4 && v . removeItem ( 0 ) ; if ( e != 0 ) { F = Q ( F , z , X ( v ) . matrix ) ; z = d . createSVGTransform ( ) ; z . setRotate ( e , F . x , F . y ) ; v . numberOfItems ? v . insertItemBefore ( z , 0 ) : v . appendItem ( z ) } else v . numberOfItems == 0 && k . removeAttribute ( "transform" ) ; if ( ! h ) { v = k . getAttribute ( "transform" ) ; k . setAttribute ( "transform" , w ) ; jb ( "transform" , v , I ) ; O ( "changed" , I ) } sa ( "pathpointgrip_container" ) ;
k = Fa . requestSelector ( I [ 0 ] ) ; k . resize ( ) ; k . updateGripCursors ( e ) } ; var Qa = this . recalculateAllSelectedDimensions = function ( ) { for ( var e = new Ha ( pb == "none" ? "position" : "size" ) , h = I . length ; h -- ; ) { var k = hb ( I [ h ] ) ; k && e . addSubCommand ( k ) } if ( ! e . isEmpty ( ) ) { va ( e ) ; O ( "changed" , I ) } } , Ya = [ 0 , "z" , "M" , "m" , "L" , "l" , "C" , "c" , "Q" , "q" , "A" , "a" , "H" , "h" , "V" , "v" , "S" , "s" , "T" , "t" ] , kb = function ( e ) { console . log ( [ e . a , e . b , e . c , e . d , e . e , e . f ] ) } , mb = this . remapElement = function ( e , h , k ) { var w = m . gridSnapping && e . parentNode . parentNode . localName === "svg" , v = function ( ) { if ( w ) for ( var E in h ) h [ E ] =
Aa ( h [ E ] ) ; na ( e , h , 1E3 , true ) } ; box = svgedit . utilities . getBBox ( e ) ; for ( var F = 0 ; F < 2 ; F ++ ) { var z = F === 0 ? "fill" : "stroke" , u = e . getAttribute ( z ) ; if ( u && u . indexOf ( "url(" ) === 0 ) if ( k . a < 0 || k . d < 0 ) { u = fa ( u ) . cloneNode ( true ) ; if ( k . a < 0 ) { var D = u . getAttribute ( "x1" ) , H = u . getAttribute ( "x2" ) ; u . setAttribute ( "x1" , - ( D - 1 ) ) ; u . setAttribute ( "x2" , - ( H - 1 ) ) } if ( k . d < 0 ) { D = u . getAttribute ( "y1" ) ; H = u . getAttribute ( "y2" ) ; u . setAttribute ( "y1" , - ( D - 1 ) ) ; u . setAttribute ( "y2" , - ( H - 1 ) ) } u . id = S ( ) ; sb ( ) . appendChild ( u ) ; e . setAttribute ( z , "url(#" + u . id + ")" ) } } F = e . tagName ;
if ( F === "g" || F === "text" || F === "use" ) if ( k . a == 1 && k . b == 0 && k . c == 0 && k . d == 1 && ( k . e != 0 || k . f != 0 ) ) { z = X ( e ) . matrix ; z = W ( z . inverse ( ) , k , z ) ; h . x = parseFloat ( h . x ) + z . e ; h . y = parseFloat ( h . y ) + z . f } else { z = ca ( e ) ; u = d . createSVGTransform ( ) ; u . setMatrix ( W ( X ( z ) . matrix , k ) ) ; z . clear ( ) ; z . appendItem ( u ) } switch ( F ) { case "foreignObject" : case "rect" : case "image" : if ( F === "image" && ( k . a < 0 || k . d < 0 ) ) { z = ca ( e ) ; u = d . createSVGTransform ( ) ; u . setMatrix ( W ( X ( z ) . matrix , k ) ) ; z . clear ( ) ; z . appendItem ( u ) } else { z = Q ( h . x , h . y , k ) ; h . width = k . a * h . width ; h . height = k . d * h . height ;
h . x = z . x + Math . min ( 0 , h . width ) ; h . y = z . y + Math . min ( 0 , h . height ) ; h . width = Math . abs ( h . width ) ; h . height = Math . abs ( h . height ) } v ( ) ; break ; case "ellipse" : F = Q ( h . cx , h . cy , k ) ; h . cx = F . x ; h . cy = F . y ; h . rx = k . a * h . rx ; h . ry = k . d * h . ry ; h . rx = Math . abs ( h . rx ) ; h . ry = Math . abs ( h . ry ) ; v ( ) ; break ; case "circle" : F = Q ( h . cx , h . cy , k ) ; h . cx = F . x ; h . cy = F . y ; F = svgedit . math . transformBox ( box . x , box . y , box . width , box . height , k ) ; h . r = Math . min ( ( F . tr . x - F . tl . x ) / 2 , ( F . bl . y - F . tl . y ) / 2 ) ; if ( h . r ) h . r = Math . abs ( h . r ) ; v ( ) ; break ; case "line" : z = Q ( h . x1 , h . y1 , k ) ; D = Q ( h . x2 , h . y2 , k ) ; h . x1 = z . x ;
h . y1 = z . y ; h . x2 = D . x ; h . y2 = D . y ; case "text" : k = e . querySelectorAll ( "tspan" ) ; for ( F = k . length ; F -- ; ) { z = ta ( "x" , e . getAttribute ( "x" ) ) ; u = ta ( "x" , k [ F ] . getAttribute ( "x" ) ) ; D = ta ( "y" , e . getAttribute ( "y" ) ) ; H = ta ( "y" , k [ F ] . getAttribute ( "y" ) ) ; var C = { } ; if ( ! isNaN ( z ) && ! isNaN ( u ) && z != 0 && u != 0 && h . x ) C . x = h . x - ( z - u ) ; if ( ! isNaN ( D ) && ! isNaN ( H ) && D != 0 && H != 0 && h . y ) C . y = h . y - ( D - H ) ; if ( C . x || C . y ) na ( k [ F ] , C , 1E3 , true ) } v ( ) ; break ; case "use" : v ( ) ; break ; case "g" : ( v = $ ( e ) . data ( "gsvg" ) ) && na ( v , h , 1E3 , true ) ; break ; case "polyline" : case "polygon" : v = h . points . length ;
for ( F = 0 ; F < v ; ++ F ) { H = h . points [ F ] ; H = Q ( H . x , H . y , k ) ; h . points [ F ] . x = H . x ; h . points [ F ] . y = H . y } v = h . points . length ; k = "" ; for ( F = 0 ; F < v ; ++ F ) { H = h . points [ F ] ; k += H . x + "," + H . y + " " } e . setAttribute ( "points" , k ) ; break ; case "path" : z = e . pathSegList ; v = z . numberOfItems ; h . d = Array ( v ) ; for ( F = 0 ; F < v ; ++ F ) { u = z . getItem ( F ) ; h . d [ F ] = { type : u . pathSegType , x : u . x , y : u . y , x1 : u . x1 , y1 : u . y1 , x2 : u . x2 , y2 : u . y2 , r1 : u . r1 , r2 : u . r2 , angle : u . angle , largeArcFlag : u . largeArcFlag , sweepFlag : u . sweepFlag } } v = h . d . length ; F = h . d [ 0 ] ; C = Q ( F . x , F . y , k ) ; h . d [ 0 ] . x = C . x ; h . d [ 0 ] . y = C . y ; for ( F = 1 ; F <
v ; ++ F ) { u = h . d [ F ] ; z = u . type ; if ( z % 2 == 0 ) { H = Q ( u . x != undefined ? u . x : C . x , u . y != undefined ? u . y : C . y , k ) ; z = Q ( u . x1 , u . y1 , k ) ; D = Q ( u . x2 , u . y2 , k ) ; u . x = H . x ; u . y = H . y ; u . x1 = z . x ; u . y1 = z . y ; u . x2 = D . x ; u . y2 = D . y } else { u . x = k . a * u . x ; u . y = k . d * u . y ; u . x1 = k . a * u . x1 ; u . y1 = k . d * u . y1 ; u . x2 = k . a * u . x2 ; u . y2 = k . d * u . y2 } u . r1 = k . a * u . r1 ; u . r2 = k . d * u . r2 } k = "" ; v = h . d . length ; for ( F = 0 ; F < v ; ++ F ) { u = h . d [ F ] ; z = u . type ; k += Ya [ z ] ; switch ( z ) { case 13 : case 12 : k += u . x + " " ; break ; case 15 : case 14 : k += u . y + " " ; break ; case 3 : case 5 : case 19 : case 2 : case 4 : case 18 : k += u . x + "," + u . y + " " ; break ; case 7 : case 6 : k +=
u . x1 + "," + u . y1 + " " + u . x2 + "," + u . y2 + " " + u . x + "," + u . y + " " ; break ; case 9 : case 8 : k += u . x1 + "," + u . y1 + " " + u . x + "," + u . y + " " ; break ; case 11 : case 10 : k += u . r1 + "," + u . r2 + " " + u . angle + " " + + u . largeArcFlag + " " + + u . sweepFlag + " " + u . x + "," + u . y + " " ; break ; case 17 : case 16 : k += u . x2 + "," + u . y2 + " " + u . x + "," + u . y + " " } } e . setAttribute ( "d" , k ) } } , nb = function ( e , h , k ) { e = fa ( e ) . firstChild ; var w = ca ( e ) , v = d . createSVGTransform ( ) ; v . setTranslate ( h , k ) ; w . appendItem ( v ) ; hb ( e ) } , hb = this . recalculateDimensions = function ( e ) { if ( e == null ) return null ; var h = ca ( e ) ; if ( h &&
h . numberOfItems > 0 ) { for ( var k = h . numberOfItems ; k -- ; ) { var w = h . getItem ( k ) ; if ( w . type === 0 ) h . removeItem ( k ) ; else if ( w . type === 1 ) svgedit . math . isIdentity ( w . matrix ) && h . removeItem ( k ) ; else w . type === 4 && w . angle === 0 && h . removeItem ( k ) } if ( h . numberOfItems === 1 && la ( e ) ) return null } if ( ! h || h . numberOfItems == 0 ) { e . removeAttribute ( "transform" ) ; return null } if ( h ) { k = h . numberOfItems ; for ( var v = [ ] ; k -- ; ) { w = h . getItem ( k ) ; if ( w . type === 1 ) v . push ( [ w . matrix , k ] ) ; else if ( v . length ) v = [ ] } if ( v . length === 2 ) { k = d . createSVGTransformFromMatrix ( W ( v [ 1 ] [ 0 ] ,
v [ 0 ] [ 0 ] ) ) ; h . removeItem ( v [ 0 ] [ 1 ] ) ; h . removeItem ( v [ 1 ] [ 1 ] ) ; h . insertItemBefore ( k , v [ 1 ] [ 1 ] ) } k = h . numberOfItems ; if ( k >= 2 && h . getItem ( k - 2 ) . type === 1 && h . getItem ( k - 1 ) . type === 2 ) { v = d . createSVGTransform ( ) ; w = W ( h . getItem ( k - 2 ) . matrix , h . getItem ( k - 1 ) . matrix ) ; v . setMatrix ( w ) ; h . removeItem ( k - 2 ) ; h . removeItem ( k - 2 ) ; h . appendItem ( v ) } } switch ( e . tagName ) { case "line" : case "polyline" : case "polygon" : case "path" : break ; default : if ( h . numberOfItems === 1 && h . getItem ( 0 ) . type === 1 || h . numberOfItems === 2 && h . getItem ( 0 ) . type === 1 && h . getItem ( 0 ) . type ===
4 ) return null } var F = $ ( e ) . data ( "gsvg" ) ; k = new Ha ( "Transform" ) ; var z = { } , u = null ; w = [ ] ; switch ( e . tagName ) { case "line" : w = [ "x1" , "y1" , "x2" , "y2" ] ; break ; case "circle" : w = [ "cx" , "cy" , "r" ] ; break ; case "ellipse" : w = [ "cx" , "cy" , "rx" , "ry" ] ; break ; case "foreignObject" : case "rect" : case "image" : w = [ "width" , "height" , "x" , "y" ] ; break ; case "use" : case "text" : case "tspan" : w = [ "x" , "y" ] ; break ; case "polygon" : case "polyline" : u = { } ; u . points = e . getAttribute ( "points" ) ; v = e . points ; var D = v . numberOfItems ; z . points = Array ( D ) ; for ( var H = 0 ; H < D ; ++ H ) { var C =
v . getItem ( H ) ; z . points [ H ] = { x : C . x , y : C . y } } break ; case "path" : u = { } ; u . d = e . getAttribute ( "d" ) ; z . d = e . getAttribute ( "d" ) } if ( w . length ) { z = $ ( e ) . attr ( w ) ; $ . each ( z , function ( Ra , Da ) { z [ Ra ] = ta ( Ra , Da ) } ) } else if ( F ) z = { x : $ ( F ) . attr ( "x" ) || 0 , y : $ ( F ) . attr ( "y" ) || 0 } ; if ( u == null ) { u = $ . extend ( true , { } , z ) ; $ . each ( u , function ( Ra , Da ) { u [ Ra ] = ta ( Ra , Da ) } ) } u . transform = Za ? Za : "" ; if ( e . tagName == "g" && ! F || e . tagName == "a" ) { v = svgedit . utilities . getBBox ( e ) ; var E = { x : v . x + v . width / 2 , y : v . y + v . height / 2 } , K = Q ( v . x + v . width / 2 , v . y + v . height / 2 , X ( h ) . matrix ) ; w = d . createSVGMatrix ( ) ;
if ( v = la ( e ) ) { H = v * Math . PI / 180 ; D = Math . abs ( H ) > 1.0 E - 10 ? Math . sin ( H ) / ( 1 - Math . cos ( H ) ) : 2 / H ; for ( H = 0 ; H < h . numberOfItems ; ++ H ) { w = h . getItem ( H ) ; if ( w . type == 4 ) { w = w . matrix ; E . y = ( D * w . e + w . f ) / 2 ; E . x = ( w . e - D * w . f ) / 2 ; h . removeItem ( H ) ; break } } } H = w = F = 0 ; var L = h . numberOfItems ; if ( L ) var Y = h . getItem ( 0 ) . matrix ; if ( L >= 3 && h . getItem ( L - 2 ) . type == 3 && h . getItem ( L - 3 ) . type == 2 && h . getItem ( L - 1 ) . type == 2 ) { H = 3 ; var n = h . getItem ( L - 3 ) . matrix , A = h . getItem ( L - 2 ) . matrix , G = h . getItem ( L - 1 ) . matrix ; D = e . childNodes ; for ( C = D . length ; C -- ; ) { var N = D . item ( C ) ; w = F = 0 ; if ( N . nodeType ==
1 ) { var J = ca ( N ) ; if ( J ) { w = X ( J ) . matrix ; F = la ( N ) ; var T = Za , da = [ ] ; Za = N . getAttribute ( "transform" ) ; if ( F || ha ( J ) ) { var ia = d . createSVGTransform ( ) ; ia . setMatrix ( W ( n , A , G , w ) ) ; J . clear ( ) ; J . appendItem ( ia ) ; da . push ( ia ) } else { F = W ( w . inverse ( ) , G , w ) ; ia = d . createSVGMatrix ( ) ; ia . e = - F . e ; ia . f = - F . f ; w = W ( ia . inverse ( ) , w . inverse ( ) , n , A , G , w , F . inverse ( ) ) ; var pa = d . createSVGTransform ( ) , ra = d . createSVGTransform ( ) , ua = d . createSVGTransform ( ) ; pa . setTranslate ( F . e , F . f ) ; ra . setScale ( w . a , w . d ) ; ua . setTranslate ( ia . e , ia . f ) ; J . appendItem ( ua ) ; J . appendItem ( ra ) ;
J . appendItem ( pa ) ; da . push ( ua ) ; da . push ( ra ) ; da . push ( pa ) } k . addSubCommand ( hb ( N ) ) ; Za = T } } } h . removeItem ( L - 1 ) ; h . removeItem ( L - 2 ) ; h . removeItem ( L - 3 ) } else if ( L >= 3 && h . getItem ( L - 1 ) . type == 1 ) { H = 3 ; w = X ( h ) . matrix ; ia = d . createSVGTransform ( ) ; ia . setMatrix ( w ) ; h . clear ( ) ; h . appendItem ( ia ) } else if ( ( L == 1 || L > 1 && h . getItem ( 1 ) . type != 3 ) && h . getItem ( 0 ) . type == 2 ) { H = 2 ; F = X ( h ) . matrix ; h . removeItem ( 0 ) ; w = X ( h ) . matrix . inverse ( ) ; w = W ( w , F ) ; F = w . e ; w = w . f ; if ( F != 0 || w != 0 ) { D = e . childNodes ; C = D . length ; for ( L = [ ] ; C -- ; ) { N = D . item ( C ) ; if ( N . nodeType == 1 ) { if ( N . getAttribute ( "clip-path" ) ) { T =
N . getAttribute ( "clip-path" ) ; if ( L . indexOf ( T ) === - 1 ) { nb ( T , F , w ) ; L . push ( T ) } } T = Za ; Za = N . getAttribute ( "transform" ) ; if ( J = ca ( N ) ) { n = d . createSVGTransform ( ) ; n . setTranslate ( F , w ) ; J . numberOfItems ? J . insertItemBefore ( n , 0 ) : J . appendItem ( n ) ; k . addSubCommand ( hb ( N ) ) ; J = e . getElementsByTagNameNS ( c , "use" ) ; N = "#" + N . id ; for ( n = J . length ; n -- ; ) { A = J . item ( n ) ; if ( N == ea ( A ) ) { G = d . createSVGTransform ( ) ; G . setTranslate ( - F , - w ) ; ca ( A ) . insertItemBefore ( G , 0 ) ; k . addSubCommand ( hb ( A ) ) } } Za = T } } } L = [ ] ; Za = T } } else if ( L == 1 && h . getItem ( 0 ) . type == 1 && ! v ) { H = 1 ; w = h . getItem ( 0 ) . matrix ;
D = e . childNodes ; for ( C = D . length ; C -- ; ) { N = D . item ( C ) ; if ( N . nodeType == 1 ) { T = Za ; Za = N . getAttribute ( "transform" ) ; if ( J = ca ( N ) ) { F = W ( w , X ( J ) . matrix ) ; L = d . createSVGTransform ( ) ; L . setMatrix ( F ) ; J . clear ( ) ; J . appendItem ( L , 0 ) ; k . addSubCommand ( hb ( N ) ) ; Za = T ; T = N . getAttribute ( "stroke-width" ) ; N . getAttribute ( "stroke" ) !== "none" && ! isNaN ( T ) && N . setAttribute ( "stroke-width" , T * ( ( Math . abs ( F . a ) + Math . abs ( F . d ) ) / 2 ) ) } } } h . clear ( ) } else { if ( v ) { E = d . createSVGTransform ( ) ; E . setRotate ( v , K . x , K . y ) ; h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } h . numberOfItems ==
0 && e . removeAttribute ( "transform" ) ; return null } if ( H == 2 ) { if ( v ) { K = { x : E . x + Y . e , y : E . y + Y . f } ; E = d . createSVGTransform ( ) ; E . setRotate ( v , K . x , K . y ) ; h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } } else if ( H == 3 ) { w = X ( h ) . matrix ; Y = d . createSVGTransform ( ) ; Y . setRotate ( v , E . x , E . y ) ; Y = Y . matrix ; E = d . createSVGTransform ( ) ; E . setRotate ( v , K . x , K . y ) ; K = E . matrix . inverse ( ) ; T = w . inverse ( ) ; K = W ( T , K , Y , w ) ; F = K . e ; w = K . f ; if ( F != 0 || w != 0 ) { D = e . childNodes ; for ( C = D . length ; C -- ; ) { N = D . item ( C ) ; if ( N . nodeType == 1 ) { T = Za ; Za = N . getAttribute ( "transform" ) ;
J = ca ( N ) ; n = d . createSVGTransform ( ) ; n . setTranslate ( F , w ) ; J . numberOfItems ? J . insertItemBefore ( n , 0 ) : J . appendItem ( n ) ; k . addSubCommand ( hb ( N ) ) ; Za = T } } } if ( v ) h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } } else { v = svgedit . utilities . getBBox ( e ) ; if ( ! v && e . tagName != "path" ) return null ; w = d . createSVGMatrix ( ) ; if ( F = la ( e ) ) { E = { x : v . x + v . width / 2 , y : v . y + v . height / 2 } ; K = Q ( v . x + v . width / 2 , v . y + v . height / 2 , X ( h ) . matrix ) ; H = F * Math . PI / 180 ; D = Math . abs ( H ) > 1.0 E - 10 ? Math . sin ( H ) / ( 1 - Math . cos ( H ) ) : 2 / H ; for ( H = 0 ; H < h . numberOfItems ; ++ H ) { w = h . getItem ( H ) ;
if ( w . type == 4 ) { w = w . matrix ; E . y = ( D * w . e + w . f ) / 2 ; E . x = ( w . e - D * w . f ) / 2 ; h . removeItem ( H ) ; break } } } H = 0 ; L = h . numberOfItems ; if ( ! svgedit . browser . isWebkit ( ) ) if ( ( Y = e . getAttribute ( "fill" ) ) && Y . indexOf ( "url(" ) === 0 ) { Y = fa ( Y ) ; T = "pattern" ; if ( Y . tagName !== T ) T = "gradient" ; if ( Y . getAttribute ( T + "Units" ) === "userSpaceOnUse" ) { w = X ( h ) . matrix ; v = ca ( Y ) ; v = X ( v ) . matrix ; w = W ( w , v ) ; v = "matrix(" + [ w . a , w . b , w . c , w . d , w . e , w . f ] . join ( "," ) + ")" ; Y . setAttribute ( T + "Transform" , v ) } } if ( L >= 3 && h . getItem ( L - 2 ) . type == 3 && h . getItem ( L - 3 ) . type == 2 && h . getItem ( L - 1 ) . type == 2 ) { H =
3 ; w = X ( h , L - 3 , L - 1 ) . matrix ; h . removeItem ( L - 1 ) ; h . removeItem ( L - 2 ) ; h . removeItem ( L - 3 ) } else if ( L == 4 && h . getItem ( L - 1 ) . type == 1 ) { H = 3 ; w = X ( h ) . matrix ; ia = d . createSVGTransform ( ) ; ia . setMatrix ( w ) ; h . clear ( ) ; h . appendItem ( ia ) ; w = d . createSVGMatrix ( ) } else if ( ( L == 1 || L > 1 && h . getItem ( 1 ) . type != 3 ) && h . getItem ( 0 ) . type == 2 ) { H = 2 ; Y = h . getItem ( 0 ) . matrix ; T = X ( h , 1 ) . matrix ; v = T . inverse ( ) ; w = W ( v , Y , T ) ; h . removeItem ( 0 ) } else if ( L == 1 && h . getItem ( 0 ) . type == 1 && ! F ) { w = X ( h ) . matrix ; switch ( e . tagName ) { case "line" : z = $ ( e ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) ; case "polyline" : case "polygon" : z . points =
e . getAttribute ( "points" ) ; if ( z . points ) { v = e . points ; D = v . numberOfItems ; z . points = Array ( D ) ; for ( H = 0 ; H < D ; ++ H ) { C = v . getItem ( H ) ; z . points [ H ] = { x : C . x , y : C . y } } } case "path" : z . d = e . getAttribute ( "d" ) ; H = 1 ; h . clear ( ) } } else { H = 4 ; if ( F ) { E = d . createSVGTransform ( ) ; E . setRotate ( F , K . x , K . y ) ; h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } h . numberOfItems == 0 && e . removeAttribute ( "transform" ) ; return null } if ( H == 1 || H == 2 || H == 3 ) mb ( e , z , w ) ; if ( H == 2 ) { if ( F ) { ha ( h ) || ( K = { x : E . x + w . e , y : E . y + w . f } ) ; E = d . createSVGTransform ( ) ; E . setRotate ( F , K . x , K . y ) ;
h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } } else if ( H == 3 && F ) { w = X ( h ) . matrix ; Y = d . createSVGTransform ( ) ; Y . setRotate ( F , E . x , E . y ) ; Y = Y . matrix ; E = d . createSVGTransform ( ) ; E . setRotate ( F , K . x , K . y ) ; K = E . matrix . inverse ( ) ; T = w . inverse ( ) ; K = W ( T , K , Y , w ) ; mb ( e , z , K ) ; if ( F ) h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } } h . numberOfItems == 0 && e . removeAttribute ( "transform" ) ; k . addSubCommand ( new Na ( e , u ) ) ; return k } , Bb = null , Va = this . clearSelection = function ( e ) { if ( I [ 0 ] != null ) for ( var h = I . length , k = 0 ; k < h ; ++ k ) { var w = I [ k ] ;
if ( w == null ) break ; Fa . releaseSelector ( w ) ; I [ k ] = null } e || O ( "selected" , I ) } , yb = this . addToSelection = function ( e , h ) { if ( e . length != 0 ) { for ( var k = 0 ; k < I . length ; ) { if ( I [ k ] == null ) break ; ++ k } for ( var w = e . length ; w -- ; ) { var v = e [ w ] ; if ( v && svgedit . utilities . getBBox ( v ) ) { if ( v . tagName === "a" && v . childNodes . length === 1 ) v = v . firstChild ; if ( I . indexOf ( v ) == - 1 ) { I [ k ] = v ; k ++ ; v = Fa . requestSelector ( v ) ; I . length > 1 && v . showGrips ( false ) } } } O ( "selected" , I ) ; h || I . length == 1 ? Fa . requestSelector ( I [ 0 ] ) . showGrips ( true ) : Fa . requestSelector ( I [ 0 ] ) . showGrips ( false ) ;
for ( I . sort ( function ( F , z ) { if ( F && z && F . compareDocumentPosition ) return 3 - ( z . compareDocumentPosition ( F ) & 6 ) ; else if ( F == null ) return 1 } ) ; I [ 0 ] == null ; ) I . shift ( 0 ) } } , Eb = this . selectOnly = function ( e , h ) { Va ( true ) ; yb ( e , h ) } ; this . removeFromSelection = function ( e ) { if ( I [ 0 ] != null ) if ( e . length != 0 ) { var h = Array ( I . length ) ; j = 0 ; len = I . length ; for ( var k = 0 ; k < len ; ++ k ) { var w = I [ k ] ; if ( w ) if ( e . indexOf ( w ) == - 1 ) { h [ j ] = w ; j ++ } else Fa . releaseSelector ( w ) } I = h } } ; this . selectAllInCurrentLayer = function ( ) { var e = B ( ) . getCurrentLayer ( ) ; if ( e ) { Ea = "select" ;
Eb ( $ ( M || e ) . children ( ) ) } } ; var Mb = this . getMouseTarget = function ( e ) { if ( e == null ) return null ; e = e . target ; if ( e . correspondingUseElement ) e = e . correspondingUseElement ; if ( [ "http://www.w3.org/1998/Math/MathML" , "http://www.w3.org/1999/xhtml" ] . indexOf ( e . namespaceURI ) >= 0 && e . id != "svgcanvas" ) for ( ; e . nodeName != "foreignObject" ; ) { e = e . parentNode ; if ( ! e ) return d } var h = B ( ) . getCurrentLayer ( ) ; if ( [ d , a , l , h ] . indexOf ( e ) >= 0 ) return d ; if ( $ ( e ) . closest ( "#selectorParentGroup" ) . length ) return Fa . selectorParentGroup ; for ( ; e . parentNode !== ( M ||
h ) ; ) e = e . parentNode ; return e } ; ( function ( ) { var e = null , h = null , k = null , w = null , v = null , F = { } , z = { minx : null , miny : null , maxx : null , maxy : null } ; $ ( a ) . mousedown ( function ( u ) { if ( ! ( b . spaceKey || u . button === 1 ) ) { var D = u . button === 2 ; Bb = l . getScreenCTM ( ) . inverse ( ) ; var H = Q ( u . pageX , u . pageY , Bb ) , C = H . x * q ; H = H . y * q ; u . preventDefault ( ) ; if ( D ) Ea = "select" ; C = C / q ; H = H / q ; var E = Mb ( u ) ; if ( E . tagName === "a" && E . childNodes . length === 1 ) E = E . firstChild ; var K = w = h = C , L = v = k = H ; if ( m . gridSnapping ) { C = Aa ( C ) ; H = Aa ( H ) ; h = Aa ( h ) ; k = Aa ( k ) } if ( E == Fa . selectorParentGroup &&
I [ 0 ] != null ) { E = u . target ; var Y = Ta ( E , "type" ) ; if ( Y == "rotate" ) { Ea = "rotate" ; current _rotate _mode = Ta ( E , "dir" ) } else if ( Y == "resize" ) { Ea = "resize" ; pb = Ta ( E , "dir" ) } E = I [ 0 ] } Za = E . getAttribute ( "transform" ) ; Y = ca ( E ) ; switch ( Ea ) { case "select" : Oa = true ; pb = "none" ; if ( D ) Oa = false ; if ( E != d ) { if ( I . indexOf ( E ) == - 1 ) { u . shiftKey || Va ( true ) ; yb ( [ E ] ) ; Sa = E ; Ka . clear ( ) } if ( ! D ) for ( D = 0 ; D < I . length ; ++ D ) if ( I [ D ] != null ) { var n = ca ( I [ D ] ) ; n . numberOfItems ? n . insertItemBefore ( d . createSVGTransform ( ) , 0 ) : n . appendItem ( d . createSVGTransform ( ) ) } } else if ( ! D ) { Va ( ) ;
Ea = "multiselect" ; if ( Ma == null ) Ma = Fa . getRubberBandBox ( ) ; w *= q ; v *= q ; na ( Ma , { x : w , y : v , width : 0 , height : 0 , display : "inline" } , 100 ) } break ; case "zoom" : Oa = true ; if ( Ma == null ) Ma = Fa . getRubberBandBox ( ) ; na ( Ma , { x : K * q , y : K * q , width : 0 , height : 0 , display : "inline" } , 100 ) ; break ; case "resize" : Oa = true ; h = C ; k = H ; F = svgedit . utilities . getBBox ( $ ( "#selectedBox0" ) [ 0 ] ) ; var A = { } ; $ . each ( F , function ( G , N ) { A [ G ] = N / q } ) ; F = A ; D = la ( E ) ? 1 : 0 ; if ( ha ( Y ) ) { Y . insertItemBefore ( d . createSVGTransform ( ) , D ) ; Y . insertItemBefore ( d . createSVGTransform ( ) , D ) ; Y . insertItemBefore ( d . createSVGTransform ( ) ,
D ) } else { Y . appendItem ( d . createSVGTransform ( ) ) ; Y . appendItem ( d . createSVGTransform ( ) ) ; Y . appendItem ( d . createSVGTransform ( ) ) ; if ( svgedit . browser . supportsNonScalingStroke ( ) ) { if ( C = svgedit . browser . isChrome ( ) ) n = function ( G ) { var N = G . getAttributeNS ( null , "stroke" ) ; G . removeAttributeNS ( null , "stroke" ) ; setTimeout ( function ( ) { G . setAttributeNS ( null , "stroke" , N ) } , 1 ) } ; E . style . vectorEffect = "non-scaling-stroke" ; C && n ( E ) ; H = E . getElementsByTagName ( "*" ) ; K = H . length ; for ( D = 0 ; D < K ; D ++ ) { H [ D ] . style . vectorEffect = "non-scaling-stroke" ; C &&
n ( H [ D ] ) } } } break ; case "fhellipse" : case "fhrect" : case "fhpath" : Oa = true ; e = K + "," + L + " " ; n = P . stroke _width == 0 ? 1 : P . stroke _width ; V ( { element : "polyline" , curStyles : true , attr : { points : e , id : S ( ) , fill : "none" , opacity : P . opacity / 2 , "stroke-linecap" : "round" , style : "pointer-events:none" } } ) ; z . minx = K ; z . maxx = K ; z . miny = L ; z . maxy = L ; break ; case "image" : Oa = true ; n = V ( { element : "image" , attr : { x : C , y : H , width : 0 , height : 0 , id : S ( ) , opacity : P . opacity / 2 , style : "pointer-events:inherit" } } ) ; aa ( n , ya ) ; tb ( n ) ; break ; case "square" : case "rect" : Oa = true ; h = C ;
k = H ; V ( { element : "rect" , curStyles : true , attr : { x : C , y : H , width : 0 , height : 0 , id : S ( ) , opacity : P . opacity / 2 } } ) ; break ; case "line" : Oa = true ; n = P . stroke _width == 0 ? 1 : P . stroke _width ; V ( { element : "line" , curStyles : true , attr : { x1 : C , y1 : H , x2 : C , y2 : H , id : S ( ) , stroke : P . stroke , "stroke-width" : n , "stroke-dasharray" : P . stroke _dasharray , "stroke-linejoin" : P . stroke _linejoin , "stroke-linecap" : P . stroke _linecap , "stroke-opacity" : P . stroke _opacity , fill : "none" , opacity : P . opacity / 2 , style : "pointer-events:none" } } ) ; break ; case "circle" : Oa = true ; V ( { element : "circle" ,
curStyles : true , attr : { cx : C , cy : H , r : 0 , id : S ( ) , opacity : P . opacity / 2 } } ) ; break ; case "ellipse" : Oa = true ; V ( { element : "ellipse" , curStyles : true , attr : { cx : C , cy : H , rx : 0 , ry : 0 , id : S ( ) , opacity : P . opacity / 2 } } ) ; break ; case "text" : Oa = true ; V ( { element : "text" , curStyles : true , attr : { x : C , y : H , id : S ( ) , fill : gb . fill , "stroke-width" : gb . stroke _width , "font-size" : gb . font _size , "font-family" : gb . font _family , "text-anchor" : "left" , "xml:space" : "preserve" , opacity : P . opacity } } ) ; break ; case "path" : case "pathedit" : h *= q ; k *= q ; Ka . mouseDown ( u , E , h , k ) ; Oa = true ;
break ; case "textedit" : h *= q ; k *= q ; ib . mouseDown ( u , E , h , k ) ; Oa = true ; break ; case "rotate" : Oa = true ; b . undoMgr . beginUndoableChange ( "transform" , I ) ; document . getElementById ( "workarea" ) . className = "rotate" } n = eb ( "mouseDown" , { event : u , start _x : h , start _y : k , selectedElements : I } , true ) ; $ . each ( n , function ( G , N ) { if ( N && N . started ) Oa = true } ) ; if ( Ea ) document . getElementById ( "workarea" ) . className = Ea == "resize" ? u . target . style . cursor : Ea } } ) . mousemove ( function ( u ) { if ( Oa ) if ( ! ( u . button === 1 || b . spaceKey ) ) { var D = I [ 0 ] , H = Q ( u . pageX , u . pageY , Bb ) , C =
H . x * q ; H = H . y * q ; var E = sa ( qa ( ) ) , K = x = C / q , L = y = H / q ; if ( m . gridSnapping ) { x = Aa ( x ) ; y = Aa ( y ) } u . preventDefault ( ) ; switch ( Ea ) { case "select" : if ( I [ 0 ] !== null ) { K = x - h ; var Y = y - k ; if ( m . gridSnapping ) { K = Aa ( K ) ; Y = Aa ( Y ) } if ( u . shiftKey ) { var n = R ( h , k , x , y ) ; x = n . x ; y = n . y } if ( K != 0 || Y != 0 ) { n = I . length ; for ( L = 0 ; L < n ; ++ L ) { D = I [ L ] ; if ( D == null ) break ; var A = d . createSVGTransform ( ) ; E = ca ( D ) ; A . setTranslate ( K , Y ) ; E . numberOfItems ? E . replaceItem ( A , 0 ) : E . appendItem ( A ) ; if ( u . altKey ) if ( ! b . addClone ) { b . addClone = b . cloneSelectedElements ( 0 , 0 , true ) ; b . removeClone = function ( ) { if ( parent =
b . addClone . parentNode ) { parent . removeChild ( b . addClone ) ; b . addClone = false } } ; window . addEventListener ( "keyup" , b . removeClone ) } Fa . requestSelector ( D ) . resize ( ) } O ( "transition" , I ) } } break ; case "multiselect" : K *= q ; L *= q ; na ( Ma , { x : Math . min ( w , K ) , y : Math . min ( v , L ) , width : Math . abs ( K - w ) , height : Math . abs ( L - v ) } , 100 ) ; E = [ ] ; K = [ ] ; A = Ab ( ) ; n = I . length ; for ( L = 0 ; L < n ; ++ L ) { Y = A . indexOf ( I [ L ] ) ; if ( Y == - 1 ) E . push ( I [ L ] ) ; else A [ Y ] = null } n = A . length ; for ( L = 0 ; L < n ; ++ L ) A [ L ] && K . push ( A [ L ] ) ; E . length > 0 && b . removeFromSelection ( E ) ; K . length > 0 && yb ( K ) ; break ; case "resize" : E =
ca ( D ) ; K = ( n = ha ( E ) ) ? F : svgedit . utilities . getBBox ( D ) ; L = K . x ; A = K . y ; var G = K . width , N = K . height ; K = x - h ; Y = y - k ; if ( m . gridSnapping ) { K = Aa ( K ) ; Y = Aa ( Y ) ; N = Aa ( N ) ; G = Aa ( G ) } var J = la ( D ) ; if ( J ) { var T = Math . sqrt ( K * K + Y * Y ) ; Y = Math . atan2 ( Y , K ) - J * Math . PI / 180 ; K = T * Math . cos ( Y ) ; Y = T * Math . sin ( Y ) } if ( pb . indexOf ( "n" ) == - 1 && pb . indexOf ( "s" ) == - 1 ) Y = 0 ; if ( pb . indexOf ( "e" ) == - 1 && pb . indexOf ( "w" ) == - 1 ) K = 0 ; var da = T = 0 , ia = N ? ( N + Y ) / N : 1 , pa = G ? ( G + K ) / G : 1 ; if ( pb . indexOf ( "n" ) >= 0 ) { ia = N ? ( N - Y ) / N : 1 ; da = N } if ( pb . indexOf ( "w" ) >= 0 ) { pa = G ? ( G - K ) / G : 1 ; T = G } K = d . createSVGTransform ( ) ;
Y = d . createSVGTransform ( ) ; G = d . createSVGTransform ( ) ; if ( m . gridSnapping ) { L = Aa ( L ) ; T = Aa ( T ) ; A = Aa ( A ) ; da = Aa ( da ) } K . setTranslate ( - ( L + T ) , - ( A + da ) ) ; if ( u . shiftKey ) if ( pa == 1 ) pa = ia ; else ia = pa ; Y . setScale ( pa , ia ) ; G . setTranslate ( L + T , A + da ) ; if ( n ) { n = J ? 1 : 0 ; E . replaceItem ( K , 2 + n ) ; E . replaceItem ( Y , 1 + n ) ; E . replaceItem ( G , 0 + n ) } else { n = E . numberOfItems ; E . replaceItem ( G , n - 3 ) ; E . replaceItem ( Y , n - 2 ) ; E . replaceItem ( K , n - 1 ) } Fa . requestSelector ( D ) . resize ( ) ; O ( "transition" , I ) ; break ; case "zoom" : K *= q ; L *= q ; na ( Ma , { x : Math . min ( w * q , K ) , y : Math . min ( v * q , L ) , width : Math . abs ( K -
w * q ) , height : Math . abs ( L - v * q ) } , 100 ) ; break ; case "text" : na ( E , { x : x , y : y } , 1E3 ) ; break ; case "line" : K = null ; window . opera || d . suspendRedraw ( 1E3 ) ; if ( m . gridSnapping ) { x = Aa ( x ) ; y = Aa ( y ) } L = x ; n = y ; if ( u . shiftKey ) { n = R ( h , k , L , n ) ; L = n . x ; n = n . y } E . setAttributeNS ( null , "x2" , L ) ; E . setAttributeNS ( null , "y2" , n ) ; window . opera || d . unsuspendRedraw ( K ) ; break ; case "foreignObject" : case "square" : case "rect" : case "image" : K = Math . abs ( x - h ) ; n = Math . abs ( y - k ) ; if ( Ea == "square" || u . shiftKey ) { K = n = Math . max ( K , n ) ; L = h < x ? h : h - K ; A = k < y ? k : k - n } else { L = Math . min ( h , x ) ; A =
Math . min ( k , y ) } if ( u . altKey ) { K *= 2 ; n *= 2 ; L = h - K / 2 ; A = k - n / 2 } if ( m . gridSnapping ) { K = Aa ( K ) ; n = Aa ( n ) ; L = Aa ( L ) ; A = Aa ( A ) } na ( E , { width : K , height : n , x : L , y : A } , 1E3 ) ; break ; case "circle" : K = $ ( E ) . attr ( [ "cx" , "cy" ] ) ; n = K . cx ; L = K . cy ; K = Math . sqrt ( ( x - n ) * ( x - n ) + ( y - L ) * ( y - L ) ) ; if ( m . gridSnapping ) K = Aa ( K ) ; E . setAttributeNS ( null , "r" , K ) ; break ; case "ellipse" : K = $ ( E ) . attr ( [ "cx" , "cy" ] ) ; n = Math . abs ( h + ( x - h ) / 2 ) ; L = Math . abs ( k + ( y - k ) / 2 ) ; K = null ; window . opera || d . suspendRedraw ( 1E3 ) ; if ( m . gridSnapping ) { x = Aa ( x ) ; n = Aa ( n ) ; y = Aa ( y ) ; L = Aa ( L ) } A = Math . abs ( h - n ) ; Y = Math . abs ( k -
L ) ; if ( u . shiftKey ) { Y = A ; L = y > k ? k + A : k - A } if ( u . altKey ) { n = h ; L = k ; A = Math . abs ( x - n ) ; Y = u . shiftKey ? A : Math . abs ( y - L ) } E . setAttributeNS ( null , "rx" , A ) ; E . setAttributeNS ( null , "ry" , Y ) ; E . setAttributeNS ( null , "cx" , n ) ; E . setAttributeNS ( null , "cy" , L ) ; window . opera || d . unsuspendRedraw ( K ) ; break ; case "fhellipse" : case "fhrect" : z . minx = Math . min ( K , z . minx ) ; z . maxx = Math . max ( K , z . maxx ) ; z . miny = Math . min ( L , z . miny ) ; z . maxy = Math . max ( L , z . maxy ) ; case "fhpath" : e += + K + "," + L + " " ; E . setAttributeNS ( null , "points" , e ) ; break ; case "path" : case "pathedit" : x *= q ;
y *= q ; if ( m . gridSnapping ) { x = Aa ( x ) ; y = Aa ( y ) ; h = Aa ( h ) ; k = Aa ( k ) } if ( u . shiftKey ) { if ( n = svgedit . path . path ) { E = n . dragging ? n . dragging [ 0 ] : h ; n = n . dragging ? n . dragging [ 1 ] : k } else { E = h ; n = k } n = R ( E , n , x , y ) ; x = n . x ; y = n . y } if ( Ma && Ma . getAttribute ( "display" ) !== "none" ) { K *= q ; L *= q ; na ( Ma , { x : Math . min ( w * q , K ) , y : Math . min ( v * q , L ) , width : Math . abs ( K - w * q ) , height : Math . abs ( L - v * q ) } , 100 ) } Ka . mouseMove ( u , x , y ) ; break ; case "textedit" : x *= q ; y *= q ; ib . mouseMove ( C , H ) ; break ; case "rotate" : K = svgedit . utilities . getBBox ( D ) ; n = K . x + K . width / 2 ; L = K . y + K . height / 2 ; E = ba ( D ) ;
E = Q ( n , L , E ) ; n = E . x ; L = E . y ; E = K . x ; A = K . y ; if ( current _rotate _mode == "nw" ) E = K . x + K . width ; if ( current _rotate _mode == "se" ) A = K . y + K . height ; if ( current _rotate _mode == "sw" ) { E = K . x + K . width ; A = K . y + K . height } compensation _angle = ( Math . atan2 ( L - A , n - E ) * ( 180 / Math . PI ) - 90 ) % 360 ; J = ( Math . atan2 ( L - y , n - x ) * ( 180 / Math . PI ) - 90 ) % 360 ; J += compensation _angle ; if ( m . gridSnapping ) J = Aa ( J ) ; if ( u . shiftKey ) J = Math . round ( J / 45 ) * 45 ; b . setRotationAngle ( J < - 180 ? 360 + J : J , true ) ; O ( "transition" , I ) } eb ( "mouseMove" , { event : u , mouse _x : C , mouse _y : H , selected : D } ) } } ) . click ( function ( u ) { u . preventDefault ( ) ;
return false } ) . dblclick ( function ( u ) { var D = u . target . parentNode ; if ( D !== M ) { var H = Mb ( u ) , C = H . tagName ; if ( C === "text" && Ea !== "textedit" ) { u = Q ( u . pageX , u . pageY , Bb ) ; ib . select ( H , u . x , u . y ) } if ( ( C === "g" || C === "a" ) && la ( H ) ) { Fb ( H ) ; H = I [ 0 ] ; Va ( true ) } M && Nb ( ) ; D . tagName !== "g" && D . tagName !== "a" || D === B ( ) . getCurrentLayer ( ) || H === Fa . selectorParentGroup || Ub ( H ) } } ) . mouseup ( function ( u ) { b . addClone = false ; window . removeEventListener ( "keyup" , b . removeClone ) ; if ( u . button !== 2 ) { var D = Sa ; Sa = null ; if ( Oa ) { var H = Q ( u . pageX , u . pageY , Bb ) , C = H . x * q ; H = H . y *
q ; var E = C / q , K = H / q , L = sa ( qa ( ) ) , Y = false ; Oa = false ; switch ( Ea ) { case "resize" : case "multiselect" : if ( Ma != null ) { Ma . setAttribute ( "display" , "none" ) ; bb = [ ] } Ea = "select" ; case "select" : if ( I [ 0 ] != null ) { if ( I [ 1 ] == null ) { C = I [ 0 ] ; switch ( C . tagName ) { case "g" : case "use" : case "image" : case "foreignObject" : break ; default : cb . fill = C . getAttribute ( "fill" ) ; cb . fill _opacity = C . getAttribute ( "fill-opacity" ) ; cb . stroke = C . getAttribute ( "stroke" ) ; cb . stroke _opacity = C . getAttribute ( "stroke-opacity" ) ; cb . stroke _width = C . getAttribute ( "stroke-width" ) ;
cb . stroke _dasharray = C . getAttribute ( "stroke-dasharray" ) ; cb . stroke _linejoin = C . getAttribute ( "stroke-linejoin" ) ; cb . stroke _linecap = C . getAttribute ( "stroke-linecap" ) } if ( C . tagName == "text" ) { gb . font _size = C . getAttribute ( "font-size" ) ; gb . font _family = C . getAttribute ( "font-family" ) } Fa . requestSelector ( C ) . showGrips ( true ) } Qa ( ) ; if ( E != w || K != v ) { u = I . length ; for ( C = 0 ; C < u ; ++ C ) { if ( I [ C ] == null ) break ; I [ C ] . firstChild || Fa . requestSelector ( I [ C ] ) . resize ( ) } } else { C = u . target ; if ( I [ 0 ] . nodeName === "path" && I [ 1 ] == null ) Ka . select ( I [ 0 ] ) ; else u . shiftKey &&
D != C && b . removeFromSelection ( [ C ] ) } if ( svgedit . browser . supportsNonScalingStroke ( ) ) if ( u = I [ 0 ] ) { u . removeAttribute ( "style" ) ; svgedit . utilities . walkTree ( u , function ( G ) { G . removeAttribute ( "style" ) } ) } } return ; case "zoom" : Ma != null && Ma . setAttribute ( "display" , "none" ) ; O ( "zoomed" , { x : Math . min ( w , E ) , y : Math . min ( v , K ) , width : Math . abs ( E - w ) , height : Math . abs ( K - v ) , factor : u . altKey ? 0.5 : 2 } ) ; return ; case "fhpath" : D = L . getAttribute ( "points" ) ; E = D . indexOf ( "," ) ; if ( Y = E >= 0 ? D . indexOf ( "," , E + 1 ) >= 0 : D . indexOf ( " " , D . indexOf ( " " ) + 1 ) >= 0 ) L = Ka . smoothPolylineIntoPath ( L ) ;
break ; case "line" : D = $ ( L ) . attr ( [ "x1" , "x2" , "y1" , "y2" ] ) ; Y = D . x1 != D . x2 || D . y1 != D . y2 ; break ; case "foreignObject" : case "square" : case "rect" : case "image" : D = $ ( L ) . attr ( [ "width" , "height" ] ) ; Y = D . width != 0 || D . height != 0 || Ea === "image" ; break ; case "circle" : Y = L . getAttribute ( "r" ) != 0 ; break ; case "ellipse" : D = $ ( L ) . attr ( [ "rx" , "ry" ] ) ; Y = D . rx != null || D . ry != null ; break ; case "fhellipse" : if ( z . maxx - z . minx > 0 && z . maxy - z . miny > 0 ) { L = V ( { element : "ellipse" , curStyles : true , attr : { cx : ( z . minx + z . maxx ) / 2 , cy : ( z . miny + z . maxy ) / 2 , rx : ( z . maxx - z . minx ) / 2 , ry : ( z . maxy -
z . miny ) / 2 , id : qa ( ) } } ) ; O ( "changed" , [ L ] ) ; Y = true } break ; case "fhrect" : if ( z . maxx - z . minx > 0 && z . maxy - z . miny > 0 ) { L = V ( { element : "rect" , curStyles : true , attr : { x : z . minx , y : z . miny , width : z . maxx - z . minx , height : z . maxy - z . miny , id : qa ( ) } } ) ; O ( "changed" , [ L ] ) ; Y = true } break ; case "text" : Y = true ; Eb ( [ L ] ) ; ib . start ( L ) ; break ; case "path" : L = null ; Oa = true ; D = Ka . mouseUp ( u , L , C , H ) ; L = D . element ; Y = D . keep ; break ; case "pathedit" : Y = true ; L = null ; Ka . mouseUp ( u ) ; break ; case "textedit" : Y = false ; L = null ; ib . mouseUp ( u , C , H ) ; break ; case "rotate" : Y = true ; L = null ; Ea = "select" ;
D = b . undoMgr . finishUndoableChange ( ) ; D . isEmpty ( ) || va ( D ) ; Qa ( ) ; O ( "changed" , I ) } C = eb ( "mouseUp" , { event : u , mouse _x : C , mouse _y : H } , true ) ; $ . each ( C , function ( G , N ) { if ( N ) { Y = N . keep || Y ; L = N . element ; Oa = N . started || Oa } } ) ; if ( ! Y && L != null ) { B ( ) . releaseId ( qa ( ) ) ; L . parentNode . removeChild ( L ) ; L = null ; for ( C = u . target ; C . parentNode . parentNode . tagName == "g" ; ) C = C . parentNode ; if ( ( Ea != "path" || ! drawn _path ) && C . parentNode . id != "selectorParentGroup" && C . id != "svgcanvas" && C . id != "svgroot" ) { b . setMode ( "select" ) ; Eb ( [ C ] , true ) } } else if ( L != null ) { b . addedNew =
true ; u = 0.2 ; var n ; if ( false . beginElement && L . getAttribute ( "opacity" ) != P . opacity ) { n = $ ( false ) . clone ( ) . attr ( { to : P . opacity , dur : u } ) . appendTo ( L ) ; try { n [ 0 ] . beginElement ( ) } catch ( A ) { } } else u = 0 ; setTimeout ( function ( ) { n && n . remove ( ) ; L . setAttribute ( "opacity" , P . opacity ) ; L . setAttribute ( "style" , "pointer-events:inherit" ) ; oa ( L ) ; if ( Ea === "path" ) Ka . toEditMode ( L ) ; else m . selectNew && Eb ( [ L ] , true ) ; va ( new Ca ( L ) ) ; O ( "changed" , [ L ] ) } , u * 1E3 ) } Za = null } } } ) ; $ ( a ) . bind ( "mousewheel DOMMouseScroll" , function ( u ) { if ( u . shiftKey ) { u . preventDefault ( ) ;
Bb = l . getScreenCTM ( ) . inverse ( ) ; var D = Q ( u . pageX , u . pageY , Bb ) ; D = { x : D . x , y : D . y , width : 0 , height : 0 } ; if ( u . wheelDelta ) if ( u . wheelDelta >= 120 ) D . factor = 2 ; else { if ( u . wheelDelta <= - 120 ) D . factor = 0.5 } else if ( u . detail ) if ( u . detail > 0 ) D . factor = 0.5 ; else if ( u . detail < 0 ) D . factor = 2 ; D . factor && O ( "zoomed" , D ) } } ) } ) ( ) ; var tb = function ( e ) { $ ( e ) . click ( function ( h ) { h . preventDefault ( ) } ) } , ib = b . textActions = function ( ) { function e ( J ) { var T = H . value === "" ; $ ( H ) . focus ( ) ; if ( ! arguments . length ) if ( T ) J = 0 ; else { if ( H . selectionEnd !== H . selectionStart ) return ;
J = H . selectionEnd } var da ; da = L [ J ] ; T || H . setSelectionRange ( J , J ) ; C = sa ( "text_cursor" ) ; if ( ! C ) { C = document . createElementNS ( c , "line" ) ; na ( C , { id : "text_cursor" , stroke : "#333" , "stroke-width" : 1 } ) ; C = sa ( "selectorParentGroup" ) . appendChild ( C ) } K || ( K = setInterval ( function ( ) { var ia = C . getAttribute ( "display" ) === "none" ; C . setAttribute ( "display" , ia ? "inline" : "none" ) } , 600 ) ) ; T = F ( da . x , Y . y ) ; da = F ( da . x , Y . y + Y . height ) ; na ( C , { x1 : T . x , y1 : T . y , x2 : da . x , y2 : da . y , visibility : "visible" , display : "inline" } ) ; E && E . setAttribute ( "d" , "" ) } function h ( J , T ,
da ) { if ( J === T ) e ( T ) ; else { da || H . setSelectionRange ( J , T ) ; E = sa ( "text_selectblock" ) ; if ( ! E ) { E = document . createElementNS ( c , "path" ) ; na ( E , { id : "text_selectblock" , fill : "green" , opacity : 0.5 , style : "pointer-events:none" } ) ; sa ( "selectorParentGroup" ) . appendChild ( E ) } J = L [ J ] ; var ia = L [ T ] ; C . setAttribute ( "visibility" , "hidden" ) ; T = F ( J . x , Y . y ) ; da = F ( J . x + ( ia . x - J . x ) , Y . y ) ; var pa = F ( J . x , Y . y + Y . height ) ; J = F ( J . x + ( ia . x - J . x ) , Y . y + Y . height ) ; na ( E , { d : "M" + T . x + "," + T . y + " L" + da . x + "," + da . y + " " + J . x + "," + J . y + " " + pa . x + "," + pa . y + "z" , display : "inline" } ) } }
function k ( J , T ) { var da = d . createSVGPoint ( ) ; da . x = J ; da . y = T ; if ( L . length == 1 ) return 0 ; da = D . getCharNumAtPosition ( da ) ; if ( da < 0 ) { da = L . length - 2 ; if ( J <= L [ 0 ] . x ) da = 0 } else if ( da >= L . length - 2 ) da = L . length - 2 ; var ia = L [ da ] ; J > ia . x + ia . width / 2 && da ++ ; return da } function w ( J , T , da ) { var ia = H . selectionStart ; J = k ( J , T ) ; h ( Math . min ( ia , J ) , Math . max ( ia , J ) , ! da ) } function v ( J , T ) { var da = { x : J , y : T } ; da . x /= q ; da . y /= q ; if ( n ) { var ia = Q ( da . x , da . y , n . inverse ( ) ) ; da . x = ia . x ; da . y = ia . y } return da } function F ( J , T ) { var da = { x : J , y : T } ; if ( n ) { var ia = Q ( da . x , da . y , n ) ;
da . x = ia . x ; da . y = ia . y } da . x *= q ; da . y *= q ; return da } function z ( J ) { h ( 0 , D . textContent . length ) ; $ ( this ) . unbind ( J ) } function u ( J ) { if ( N && D ) { var T = Q ( J . pageX , J . pageY , Bb ) ; T = v ( T . x * q , T . y * q ) ; T = k ( T . x , T . y ) ; var da = D . textContent , ia = da . substr ( 0 , T ) . replace ( /[a-z0-9]+$/i , "" ) . length ; da = da . substr ( T ) . match ( /^[a-z0-9]+/i ) ; h ( ia , ( da ? da [ 0 ] . length : 0 ) + T ) ; $ ( J . target ) . click ( z ) ; setTimeout ( function ( ) { $ ( J . target ) . unbind ( "click" , z ) } , 300 ) } } var D , H , C , E , K , L = [ ] , Y , n , A , G , N ; return { select : function ( J , T , da ) { D = J ; ib . toEditMode ( T , da ) } , start : function ( J ) { D =
J ; ib . toEditMode ( ) } , mouseDown : function ( J , T , da , ia ) { J = v ( da , ia ) ; H . focus ( ) ; e ( k ( J . x , J . y ) ) ; A = da ; G = ia } , mouseMove : function ( J , T ) { var da = v ( J , T ) ; w ( da . x , da . y ) } , mouseUp : function ( J , T , da ) { var ia = v ( T , da ) ; w ( ia . x , ia . y , true ) ; J . target !== D && T < A + 2 && T > A - 2 && da < G + 2 && da > G - 2 && ib . toSelectMode ( true ) } , setCursor : e , toEditMode : function ( J , T ) { N = false ; Ea = "textedit" ; Fa . requestSelector ( D ) . showGrips ( false ) ; Fa . requestSelector ( D ) ; ib . init ( ) ; $ ( D ) . css ( "cursor" , "text" ) ; if ( arguments . length ) { var da = v ( J , T ) ; e ( k ( da . x , da . y ) ) } else e ( ) ; setTimeout ( function ( ) { N =
true } , 300 ) } , toSelectMode : function ( J ) { Ea = "select" ; clearInterval ( K ) ; K = null ; E && $ ( E ) . attr ( "display" , "none" ) ; C && $ ( C ) . attr ( "visibility" , "hidden" ) ; $ ( D ) . css ( "cursor" , "move" ) ; if ( J ) { Va ( ) ; $ ( D ) . css ( "cursor" , "move" ) ; O ( "selected" , [ D ] ) ; yb ( [ D ] , true ) } D && ! D . textContent . length && b . deleteSelectedElements ( ) ; $ ( H ) . blur ( ) ; D = false } , setInputElem : function ( J ) { H = J } , clear : function ( ) { Ea == "textedit" && ib . toSelectMode ( ) } , init : function ( ) { if ( D ) { if ( ! D . parentNode ) { D = I [ 0 ] ; Fa . requestSelector ( D ) . showGrips ( false ) } var J = D . textContent . length ,
T = D . getAttribute ( "transform" ) ; Y = svgedit . utilities . getBBox ( D ) ; n = T ? ba ( D ) : null ; L = Array ( J ) ; H . focus ( ) ; $ ( D ) . unbind ( "dblclick" , u ) . dblclick ( u ) ; if ( ! J ) var da = { x : Y . x + Y . width / 2 , width : 0 } ; for ( T = 0 ; T < J ; T ++ ) { var ia = D . getStartPositionOfChar ( T ) ; da = D . getEndPositionOfChar ( T ) ; if ( ! svgedit . browser . supportsGoodTextCharPos ( ) ) { var pa = b . contentW * q ; ia . x -= pa ; da . x -= pa ; ia . x /= q ; da . x /= q } L [ T ] = { x : ia . x , y : Y . y , width : da . x - ia . x , height : Y . height } } L . push ( { x : da . x , width : 0 } ) ; h ( H . selectionStart , H . selectionEnd , true ) } } } } ( ) , Ka = b . pathActions = function ( ) { var e =
false , h , k , w ; svgedit . path . Path . prototype . endChanges = function ( z ) { if ( svgedit . browser . isWebkit ( ) ) { var u = this . elem ; u . setAttribute ( "d" , Ka . convertPath ( u ) ) } z = new Na ( this . elem , { d : this . last _d } , z ) ; va ( z ) ; O ( "changed" , [ this . elem ] ) } ; svgedit . path . Path . prototype . addPtsToSelection = function ( z ) { $ . isArray ( z ) || ( z = [ z ] ) ; for ( var u = 0 ; u < z . length ; u ++ ) { var D = z [ u ] , H = this . segs [ D ] ; H . ptgrip && this . selected _pts . indexOf ( D ) == - 1 && D >= 0 && this . selected _pts . push ( D ) } this . selected _pts . sort ( ) ; u = this . selected _pts . length ; for ( z = Array ( u ) ; u -- ; ) { H =
this . segs [ this . selected _pts [ u ] ] ; H . select ( true ) ; z [ u ] = H . ptgrip } Ka . canDeleteNodes = true ; Ka . closed _subpath = this . subpathIsClosed ( this . selected _pts [ 0 ] ) ; O ( "selected" , z ) } ; var v = h = null , F = false ; return { mouseDown : function ( z , u , D , H ) { if ( Ea === "path" ) { mouse _x = D ; mouse _y = H ; H = mouse _x / q ; u = mouse _y / q ; D = sa ( "path_stretch_line" ) ; k = [ H , u ] ; if ( m . gridSnapping ) { H = Aa ( H ) ; u = Aa ( u ) ; mouse _x = Aa ( mouse _x ) ; mouse _y = Aa ( mouse _y ) } if ( ! D ) { D = document . createElementNS ( c , "path" ) ; na ( D , { id : "path_stretch_line" , stroke : "#22C" , "stroke-width" : "0.5" , fill : "none" } ) ;
D = sa ( "selectorParentGroup" ) . appendChild ( D ) } D . setAttribute ( "display" , "inline" ) ; var C = null ; if ( v ) { C = v . pathSegList ; for ( var E = C . numberOfItems , K = 6 / q , L = false ; E ; ) { E -- ; var Y = C . getItem ( E ) , n = Y . x ; Y = Y . y ; if ( H >= n - K && H <= n + K && u >= Y - K && u <= Y + K ) { L = true ; break } } K = qa ( ) ; svgedit . path . removePath _ ( K ) ; K = sa ( K ) ; n = C . numberOfItems ; if ( L ) { if ( E <= 1 && n >= 2 ) { H = C . getItem ( 0 ) . x ; u = C . getItem ( 0 ) . y ; z = D . pathSegList . getItem ( 1 ) ; z = z . pathSegType === 4 ? v . createSVGPathSegLinetoAbs ( H , u ) : v . createSVGPathSegCurvetoCubicAbs ( H , u , z . x1 / q , z . y1 / q , H , u ) ; H = v . createSVGPathSegClosePath ( ) ;
C . appendItem ( z ) ; C . appendItem ( H ) } else if ( n < 3 ) return C = false ; $ ( D ) . remove ( ) ; element = K ; v = null ; Oa = false ; if ( e ) { svgedit . path . path . matrix && mb ( K , { } , svgedit . path . path . matrix . inverse ( ) ) ; D = K . getAttribute ( "d" ) ; z = $ ( svgedit . path . path . elem ) . attr ( "d" ) ; $ ( svgedit . path . path . elem ) . attr ( "d" , z + D ) ; $ ( K ) . remove ( ) ; svgedit . path . path . matrix && svgedit . path . recalcRotatedPath ( ) ; svgedit . path . path . init ( ) ; Ka . toEditMode ( svgedit . path . path . elem ) ; svgedit . path . path . selectPt ( ) ; return false } } else { if ( ! $ . contains ( a , Mb ( z ) ) ) { console . log ( "Clicked outside canvas" ) ;
return false } C = v . pathSegList . numberOfItems ; E = v . pathSegList . getItem ( C - 1 ) ; K = E . x ; E = E . y ; if ( z . shiftKey ) { z = R ( K , E , H , u ) ; H = z . x ; u = z . y } z = D . pathSegList . getItem ( 1 ) ; z = z . pathSegType === 4 ? v . createSVGPathSegLinetoAbs ( rb ( H ) , rb ( u ) ) : v . createSVGPathSegCurvetoCubicAbs ( rb ( H ) , rb ( u ) , z . x1 / q , z . y1 / q , z . x2 / q , z . y2 / q ) ; v . pathSegList . appendItem ( z ) ; H *= q ; u *= q ; D . setAttribute ( "d" , [ "M" , H , u , H , u ] . join ( " " ) ) ; D = C ; if ( e ) D += svgedit . path . path . segs . length ; svgedit . path . addPointGrip ( D , H , u ) } } else { d _attr = "M" + H + "," + u + " " ; v = V ( { element : "path" , curStyles : true ,
attr : { d : d _attr , id : S ( ) , opacity : P . opacity / 2 } } ) ; D . setAttribute ( "d" , [ "M" , mouse _x , mouse _y , mouse _x , mouse _y ] . join ( " " ) ) ; D = e ? svgedit . path . path . segs . length : 0 ; svgedit . path . addPointGrip ( D , mouse _x , mouse _y ) } } else if ( svgedit . path . path ) { svgedit . path . path . storeD ( ) ; K = z . target . id ; if ( K . substr ( 0 , 14 ) == "pathpointgrip_" ) { u = svgedit . path . path . cur _pt = parseInt ( K . substr ( 14 ) ) ; svgedit . path . path . dragging = [ D , H ] ; C = svgedit . path . path . segs [ u ] ; if ( z . shiftKey ) C . selected ? svgedit . path . path . removePtFromSelection ( u ) : svgedit . path . path . addPtsToSelection ( u ) ;
else { if ( svgedit . path . path . selected _pts . length <= 1 || ! C . selected ) svgedit . path . path . clearSelection ( ) ; svgedit . path . path . addPtsToSelection ( u ) } } else if ( K . indexOf ( "ctrlpointgrip_" ) == 0 ) { svgedit . path . path . dragging = [ D , H ] ; z = K . split ( "_" ) [ 1 ] . split ( "c" ) ; u = z [ 0 ] - 0 ; svgedit . path . path . selectPt ( u , z [ 1 ] - 0 ) } if ( ! svgedit . path . path . dragging ) { if ( Ma == null ) Ma = Fa . getRubberBandBox ( ) ; na ( Ma , { x : D * q , y : H * q , width : 0 , height : 0 , display : "inline" } , 100 ) } } } , mouseMove : function ( z , u , D ) { F = true ; if ( Ea === "path" ) { if ( v ) { var H = v . pathSegList ; z = H . numberOfItems -
1 ; if ( k ) { var C = svgedit . path . addCtrlGrip ( "1c1" ) , E = svgedit . path . addCtrlGrip ( "0c2" ) ; E . getAttribute ( "cx" ) ; E . getAttribute ( "cy" ) ; C . setAttribute ( "cx" , u ) ; C . setAttribute ( "cy" , D ) ; C . setAttribute ( "display" , "inline" ) ; C = k [ 0 ] ; var K = k [ 1 ] ; H . getItem ( z ) ; var L = C + ( C - u / q ) , Y = K + ( K - D / q ) ; E . setAttribute ( "cx" , L * q ) ; E . setAttribute ( "cy" , Y * q ) ; E . setAttribute ( "display" , "inline" ) ; E = svgedit . path . getCtrlLine ( 1 ) ; var n = svgedit . path . getCtrlLine ( 2 ) ; na ( E , { x1 : u , y1 : D , x2 : C * q , y2 : K * q , display : "inline" } ) ; na ( n , { x1 : L * q , y1 : Y * q , x2 : C * q , y2 : K * q , display : "inline" } ) ;
if ( z === 0 ) w = [ u , D ] ; else { H = H . getItem ( z - 1 ) ; u = H . x ; D = H . y ; if ( H . pathSegType === 6 ) { u += u - H . x2 ; D += D - H . y2 } else if ( w ) { u = w [ 0 ] / q ; D = w [ 1 ] / q } svgedit . path . replacePathSeg ( 6 , z , [ C , K , u , D , L , Y ] , v ) } } else if ( C = sa ( "path_stretch_line" ) ) { z = H . getItem ( z ) ; if ( z . pathSegType === 6 ) svgedit . path . replacePathSeg ( 6 , 1 , [ u , D , ( z . x + ( z . x - z . x2 ) ) * q , ( z . y + ( z . y - z . y2 ) ) * q , u , D ] , C ) ; else w ? svgedit . path . replacePathSeg ( 6 , 1 , [ u , D , w [ 0 ] , w [ 1 ] , u , D ] , C ) : svgedit . path . replacePathSeg ( 4 , 1 , [ u , D ] , C ) } } } else if ( svgedit . path . path . dragging ) { C = svgedit . path . getPointFromGrip ( { x : svgedit . path . path . dragging [ 0 ] ,
y : svgedit . path . path . dragging [ 1 ] } , svgedit . path . path ) ; K = svgedit . path . getPointFromGrip ( { x : u , y : D } , svgedit . path . path ) ; z = K . x - C . x ; C = K . y - C . y ; svgedit . path . path . dragging = [ u , D ] ; svgedit . path . path . dragctrl ? svgedit . path . path . moveCtrl ( z , C ) : svgedit . path . path . movePts ( z , C ) } else { svgedit . path . path . selected _pts = [ ] ; svgedit . path . path . eachSeg ( function ( ) { if ( this . next || this . prev ) { var A = Ma . getBBox ( ) , G = svgedit . path . getGripPt ( this ) ; A = svgedit . math . rectsIntersect ( A , { x : G . x , y : G . y , width : 0 , height : 0 } ) ; this . select ( A ) ; A && svgedit . path . path . selected _pts . push ( this . index ) } } ) } } ,
mouseUp : function ( z , u ) { if ( Ea === "path" ) { k = null ; if ( ! v ) { u = sa ( qa ( ) ) ; Oa = false ; w = null } return { keep : true , element : u } } if ( svgedit . path . path . dragging ) { var D = svgedit . path . path . cur _pt ; svgedit . path . path . dragging = false ; svgedit . path . path . dragctrl = false ; svgedit . path . path . update ( ) ; F && svgedit . path . path . endChanges ( "Move path point(s)" ) ; ! z . shiftKey && ! F && svgedit . path . path . selectPt ( D ) } else if ( Ma && Ma . getAttribute ( "display" ) != "none" ) { Ma . setAttribute ( "display" , "none" ) ; Ma . getAttribute ( "width" ) <= 2 && Ma . getAttribute ( "height" ) <=
2 && Ka . toSelectMode ( z . target ) } else Ka . toSelectMode ( z . target ) ; F = false } , toEditMode : function ( z ) { svgedit . path . path = svgedit . path . getPath _ ( z ) ; Ea = "pathedit" ; Va ( ) ; svgedit . path . path . show ( true ) . update ( ) ; svgedit . path . path . oldbbox = svgedit . utilities . getBBox ( svgedit . path . path . elem ) ; e = false } , toSelectMode : function ( z ) { var u = z == svgedit . path . path . elem ; Ea = "select" ; svgedit . path . path . show ( false ) ; h = false ; Va ( ) ; svgedit . path . path . matrix && svgedit . path . recalcRotatedPath ( ) ; if ( u ) { O ( "selected" , [ z ] ) ; yb ( [ z ] , true ) } } , addSubPath : function ( z ) { if ( z ) { Ea =
"path" ; e = true } else { Ka . clear ( true ) ; Ka . toEditMode ( svgedit . path . path . elem ) } } , select : function ( z ) { if ( h === z ) { Ka . toEditMode ( z ) ; Ea = "pathedit" } else h = z } , reorient : function ( ) { var z = I [ 0 ] ; if ( z ) if ( la ( z ) != 0 ) { var u = new Ha ( "Reorient path" ) , D = { d : z . getAttribute ( "d" ) , transform : z . getAttribute ( "transform" ) } ; u . addSubCommand ( new Na ( z , D ) ) ; Va ( ) ; this . resetOrientation ( z ) ; va ( u ) ; svgedit . path . getPath _ ( z ) . show ( false ) . matrix = null ; this . clear ( ) ; yb ( [ z ] , true ) ; O ( "changed" , I ) } } , clear : function ( ) { h = null ; if ( v ) { var z = sa ( qa ( ) ) ; $ ( sa ( "path_stretch_line" ) ) . remove ( ) ;
$ ( z ) . remove ( ) ; $ ( sa ( "pathpointgrip_container" ) ) . find ( "*" ) . attr ( "display" , "none" ) ; v = w = null ; Oa = false } else Ea == "pathedit" && this . toSelectMode ( ) ; svgedit . path . path && svgedit . path . path . init ( ) . show ( false ) } , resetOrientation : function ( z ) { if ( z == null || z . nodeName != "path" ) return false ; var u = ca ( z ) , D = X ( u ) . matrix ; u . clear ( ) ; z . removeAttribute ( "transform" ) ; u = z . pathSegList ; for ( var H = u . numberOfItems , C = 0 ; C < H ; ++ C ) { var E = u . getItem ( C ) , K = E . pathSegType ; if ( K != 1 ) { var L = [ ] ; $ . each ( [ "" , 1 , 2 ] , function ( Y , n ) { var A = E [ "x" + n ] , G = E [ "y" + n ] ; if ( A !==
undefined && G !== undefined ) { A = Q ( A , G , D ) ; L . splice ( L . length , 0 , A . x , A . y ) } } ) ; svgedit . path . replacePathSeg ( K , C , L , z ) } } g ( z , D ) } , zoomChange : function ( ) { Ea == "pathedit" && svgedit . path . path . update ( ) } , getNodePoint : function ( ) { var z = svgedit . path . path . segs [ svgedit . path . path . selected _pts . length ? svgedit . path . path . selected _pts [ 0 ] : 1 ] ; return { x : z . item . x , y : z . item . y , type : z . type } } , linkControlPoints : function ( z ) { svgedit . path . setLinkControlPoints ( z ) } , clonePathNode : function ( ) { svgedit . path . path . storeD ( ) ; for ( var z = svgedit . path . path . selected _pts ,
u = z . length , D = [ ] ; u -- ; ) { var H = z [ u ] ; svgedit . path . path . addSeg ( H ) ; D . push ( H + u ) ; D . push ( H + u + 1 ) } svgedit . path . path . init ( ) . addPtsToSelection ( D ) ; svgedit . path . path . endChanges ( "Clone path node(s)" ) } , opencloseSubPath : function ( ) { var z = svgedit . path . path . selected _pts ; if ( z . length === 1 ) { var u = svgedit . path . path . elem , D = u . pathSegList , H = z [ 0 ] , C = null , E = null ; svgedit . path . path . eachSeg ( function ( n ) { if ( this . type === 2 && n <= H ) E = this . item ; if ( n <= H ) return true ; if ( this . type === 2 ) { C = n ; return false } else if ( this . type === 1 ) return C = false } ) ; if ( C ==
null ) C = svgedit . path . path . segs . length - 1 ; if ( C !== false ) { var K = u . createSVGPathSegLinetoAbs ( E . x , E . y ) , L = u . createSVGPathSegClosePath ( ) ; if ( C == svgedit . path . path . segs . length - 1 ) { D . appendItem ( K ) ; D . appendItem ( L ) } else { svgedit . path . insertItemBefore ( u , L , C ) ; svgedit . path . insertItemBefore ( u , K , C ) } svgedit . path . path . init ( ) . selectPt ( C + 1 ) } else if ( svgedit . path . path . segs [ H ] . mate ) { D . removeItem ( H ) ; D . removeItem ( H ) ; svgedit . path . path . init ( ) . selectPt ( H - 1 ) } else { for ( z = 0 ; z < D . numberOfItems ; z ++ ) { var Y = D . getItem ( z ) ; if ( Y . pathSegType ===
2 ) K = z ; else if ( z === H ) D . removeItem ( K ) ; else if ( Y . pathSegType === 1 && H < z ) { L = z - 1 ; D . removeItem ( z ) ; break } } for ( z = H - K - 1 ; z -- ; ) svgedit . path . insertItemBefore ( u , D . getItem ( K ) , L ) ; u = D . getItem ( K ) ; svgedit . path . replacePathSeg ( 2 , K , [ u . x , u . y ] ) ; z = H ; svgedit . path . path . init ( ) . selectPt ( 0 ) } } } , deletePathNode : function ( ) { if ( Ka . canDeleteNodes ) { svgedit . path . path . storeD ( ) ; for ( var z = svgedit . path . path . selected _pts , u = z . length ; u -- ; ) svgedit . path . path . deleteSeg ( z [ u ] ) ; var D = function ( ) { var H = svgedit . path . path . elem . pathSegList , C = H . numberOfItems ,
E = function ( Y , n ) { for ( ; n -- ; ) H . removeItem ( Y ) } ; if ( C <= 1 ) return true ; for ( ; C -- ; ) { var K = H . getItem ( C ) ; if ( K . pathSegType === 1 ) { K = H . getItem ( C - 1 ) ; var L = H . getItem ( C - 2 ) ; if ( K . pathSegType === 2 ) { E ( C - 1 , 2 ) ; D ( ) ; break } else if ( L . pathSegType === 2 ) { E ( C - 2 , 3 ) ; D ( ) ; break } } else if ( K . pathSegType === 2 ) if ( C > 0 ) { K = H . getItem ( C - 1 ) . pathSegType ; if ( K === 2 ) { E ( C - 1 , 1 ) ; D ( ) ; break } else if ( K === 1 && H . numberOfItems - 1 === C ) { E ( C , 1 ) ; D ( ) ; break } } } return false } ; D ( ) ; if ( svgedit . path . path . elem . pathSegList . numberOfItems <= 1 ) { Ka . toSelectMode ( svgedit . path . path . elem ) ;
b . deleteSelectedElements ( ) } else { svgedit . path . path . init ( ) ; svgedit . path . path . clearSelection ( ) ; if ( window . opera ) { z = $ ( svgedit . path . path . elem ) ; z . attr ( "d" , z . attr ( "d" ) ) } svgedit . path . path . endChanges ( "Delete path node(s)" ) } } } , smoothPolylineIntoPath : function ( z ) { var u = z . points , D = u . numberOfItems ; if ( D >= 4 ) { var H = u . getItem ( 0 ) , C = null ; z = [ ] ; z . push ( [ "M" , H . x , "," , H . y , " C" ] . join ( "" ) ) ; for ( var E = 1 ; E <= D - 4 ; E += 3 ) { var K = u . getItem ( E ) , L = u . getItem ( E + 1 ) , Y = u . getItem ( E + 2 ) ; if ( C ) if ( ( H = svgedit . path . smoothControlPoints ( C , K , H ) ) && H . length ==
2 ) { K = z [ z . length - 1 ] . split ( "," ) ; K [ 2 ] = H [ 0 ] . x ; K [ 3 ] = H [ 0 ] . y ; z [ z . length - 1 ] = K . join ( "," ) ; K = H [ 1 ] } z . push ( [ K . x , K . y , L . x , L . y , Y . x , Y . y ] . join ( "," ) ) ; H = Y ; C = L } for ( z . push ( "L" ) ; E < D ; ++ E ) { L = u . getItem ( E ) ; z . push ( [ L . x , L . y ] . join ( "," ) ) } z = z . join ( " " ) ; z = V ( { element : "path" , curStyles : true , attr : { id : qa ( ) , d : z , fill : "none" } } ) } return z } , setSegType : function ( z ) { svgedit . path . path . setSegType ( z ) } , moveNode : function ( z , u ) { var D = svgedit . path . path . selected _pts ; if ( D . length ) { svgedit . path . path . storeD ( ) ; D = svgedit . path . path . segs [ D [ 0 ] ] ; var H = { x : 0 , y : 0 } ;
H [ z ] = u - D . item [ z ] ; D . move ( H . x , H . y ) ; svgedit . path . path . endChanges ( "Move path point" ) } } , fixEnd : function ( z ) { for ( var u = z . pathSegList , D = u . numberOfItems , H , C = 0 ; C < D ; ++ C ) { var E = u . getItem ( C ) ; if ( E . pathSegType === 2 ) H = E ; if ( E . pathSegType === 1 ) { E = u . getItem ( C - 1 ) ; if ( E . x != H . x || E . y != H . y ) { u = z . createSVGPathSegLinetoAbs ( H . x , H . y ) ; svgedit . path . insertItemBefore ( z , u , C ) ; Ka . fixEnd ( z ) ; break } } } svgedit . browser . isWebkit ( ) && z . setAttribute ( "d" , Ka . convertPath ( z ) ) } , convertPath : function ( z , u ) { for ( var D = z . pathSegList , H = D . numberOfItems , C = 0 ,
E = 0 , K = "" , L = null , Y = 0 ; Y < H ; ++ Y ) { var n = D . getItem ( Y ) , A = n . x || 0 , G = n . y || 0 , N = n . x1 || 0 , J = n . y1 || 0 , T = n . x2 || 0 , da = n . y2 || 0 , ia = n . pathSegType , pa = Ya [ ia ] [ "to" + ( u ? "Lower" : "Upper" ) + "Case" ] ( ) , ra = function ( ua , Ra , Da ) { Ra = Ra ? " " + Ra . join ( " " ) : "" ; Da = Da ? " " + svgedit . units . shortFloat ( Da ) : "" ; $ . each ( ua , function ( ka , lb ) { ua [ ka ] = svgedit . units . shortFloat ( lb ) } ) ; K += pa + ua . join ( " " ) + Ra + Da } ; switch ( ia ) { case 1 : K += "z" ; break ; case 12 : A -= C ; case 13 : if ( u ) { C += A ; pa = "l" } else { A += C ; C = A ; pa = "L" } ra ( [ [ A , E ] ] ) ; break ; case 14 : G -= E ; case 15 : if ( u ) { E += G ; pa = "l" } else { G +=
E ; E = G ; pa = "L" } ra ( [ [ C , G ] ] ) ; break ; case 2 : case 4 : case 18 : A -= C ; G -= E ; case 5 : case 3 : if ( L && D . getItem ( Y - 1 ) . pathSegType === 1 && ! u ) { C = L [ 0 ] ; E = L [ 1 ] } case 19 : if ( u ) { C += A ; E += G } else { A += C ; G += E ; C = A ; E = G } if ( ia === 3 ) L = [ C , E ] ; ra ( [ [ A , G ] ] ) ; break ; case 6 : A -= C ; N -= C ; T -= C ; G -= E ; J -= E ; da -= E ; case 7 : if ( u ) { C += A ; E += G } else { A += C ; N += C ; T += C ; G += E ; J += E ; da += E ; C = A ; E = G } ra ( [ [ N , J ] , [ T , da ] , [ A , G ] ] ) ; break ; case 8 : A -= C ; N -= C ; G -= E ; J -= E ; case 9 : if ( u ) { C += A ; E += G } else { A += C ; N += C ; G += E ; J += E ; C = A ; E = G } ra ( [ [ N , J ] , [ A , G ] ] ) ; break ; case 10 : A -= C ; G -= E ; case 11 : if ( u ) { C += A ; E += G } else { A +=
C ; G += E ; C = A ; E = G } ra ( [ [ n . r1 , n . r2 ] ] , [ n . angle , n . largeArcFlag ? 1 : 0 , n . sweepFlag ? 1 : 0 ] , [ A , G ] ) ; break ; case 16 : A -= C ; T -= C ; G -= E ; da -= E ; case 17 : if ( u ) { C += A ; E += G } else { A += C ; T += C ; G += E ; da += E ; C = A ; E = G } ra ( [ [ T , da ] , [ A , G ] ] ) } } return K } } } ( ) , Ob = this . removeUnusedDefElems = function ( ) { var e = l . getElementsByTagNameNS ( c , "defs" ) ; if ( ! e || ! e . length ) return 0 ; for ( var h = [ ] , k = 0 , w = [ "fill" , "stroke" , "filter" , "marker-start" , "marker-mid" , "marker-end" ] , v = w . length , F = l . getElementsByTagNameNS ( c , "*" ) , z = F . length , u = 0 ; u < z ; u ++ ) { for ( var D = F [ u ] , H = 0 ; H < v ; H ++ ) { var C =
ja ( D . getAttribute ( w [ H ] ) ) ; C && h . push ( C . substr ( 1 ) ) } ( D = ea ( D ) ) && D . indexOf ( "#" ) === 0 && h . push ( D . substr ( 1 ) ) } e = $ ( e ) . find ( "linearGradient, radialGradient, filter, marker, svg, symbol" ) ; defelem _ids = [ ] ; for ( u = e . length ; u -- ; ) { w = e [ u ] ; v = w . id ; if ( h . indexOf ( v ) < 0 ) { xb [ v ] = w ; w . parentNode . removeChild ( w ) ; k ++ } } return k } ; this . svgCanvasToString = function ( ) { for ( ; Ob ( ) > 0 ; ) ; Ka . clear ( true ) ; $ . each ( l . childNodes , function ( k , w ) { k && w . nodeType === 8 && w . data . indexOf ( "Created with" ) >= 0 && l . insertBefore ( w , l . firstChild ) } ) ; if ( M ) { Nb ( ) ; Eb ( [ M ] ) } var e =
[ ] ; $ ( l ) . find ( "g:data(gsvg)" ) . each ( function ( ) { for ( var k = this . attributes , w = k . length , v = 0 ; v < w ; v ++ ) if ( k [ v ] . nodeName == "id" || k [ v ] . nodeName == "style" ) w -- ; if ( w <= 0 ) { k = this . firstChild ; e . push ( k ) ; $ ( this ) . replaceWith ( k ) } } ) ; var h = this . svgToString ( l , 0 ) ; e . length && $ ( e ) . each ( function ( ) { ma ( this ) } ) ; return h } ; this . svgToString = function ( e , h ) { var k = [ ] , w = svgedit . utilities . toXml , v = m . baseUnit , F = RegExp ( "^-?[\\d\\.]+" + v + "$" ) ; if ( e ) { oa ( e ) ; var z = e . attributes , u , D , H = e . childNodes ; for ( D = 0 ; D < h ; D ++ ) k . push ( " " ) ; k . push ( "<" ) ; k . push ( e . nodeName ) ;
if ( e . id === "svgcontent" ) { D = Hb ( ) ; if ( v !== "px" ) { D . w = svgedit . units . convertUnit ( D . w , v ) + v ; D . h = svgedit . units . convertUnit ( D . h , v ) + v } k . push ( ' width="' + D . w + '" height="' + D . h + '" xmlns="' + c + '"' ) ; var C = { } ; $ ( e ) . find ( "*" ) . andSelf ( ) . each ( function ( ) { $ . each ( this . attributes , function ( Y , n ) { var A = n . namespaceURI ; if ( A && ! C [ A ] && Ba [ A ] !== "xmlns" && Ba [ A ] !== "xml" ) { C [ A ] = true ; k . push ( " xmlns:" + Ba [ A ] + '="' + A + '"' ) } } ) } ) ; D = z . length ; for ( v = [ "width" , "height" , "xmlns" , "x" , "y" , "viewBox" , "id" , "overflow" ] ; D -- ; ) { u = z . item ( D ) ; var E = w ( u . nodeValue ) ; if ( u . nodeName . indexOf ( "xmlns:" ) !==
0 ) if ( E != "" && v . indexOf ( u . localName ) == - 1 ) if ( ! u . namespaceURI || Ba [ u . namespaceURI ] ) { k . push ( " " ) ; k . push ( u . nodeName ) ; k . push ( '="' ) ; k . push ( E ) ; k . push ( '"' ) } } } else { if ( e . nodeName === "defs" && ! e . firstChild ) return ; var K = [ "-moz-math-font-style" , "_moz-math-font-style" ] ; for ( D = z . length - 1 ; D >= 0 ; D -- ) { u = z . item ( D ) ; E = w ( u . nodeValue ) ; if ( ! ( K . indexOf ( u . localName ) >= 0 ) ) if ( E != "" ) if ( E . indexOf ( "pointer-events" ) !== 0 ) if ( ! ( u . localName === "class" && E . indexOf ( "se_" ) === 0 ) ) { k . push ( " " ) ; if ( u . localName === "d" ) E = Ka . convertPath ( e , true ) ; if ( isNaN ( E ) ) { if ( F . test ( E ) ) E =
svgedit . units . shortFloat ( E ) + v } else E = svgedit . units . shortFloat ( E ) ; if ( fb . apply && e . nodeName === "image" && u . localName === "href" && fb . images && fb . images === "embed" ) { var L = za [ E ] ; if ( L ) E = L } if ( ! u . namespaceURI || u . namespaceURI == c || Ba [ u . namespaceURI ] ) { k . push ( u . nodeName ) ; k . push ( '="' ) ; k . push ( E ) ; k . push ( '"' ) } } } } if ( e . hasChildNodes ( ) ) { k . push ( ">" ) ; h ++ ; z = false ; for ( D = 0 ; D < H . length ; D ++ ) { v = H . item ( D ) ; switch ( v . nodeType ) { case 1 : k . push ( "\n" ) ; k . push ( this . svgToString ( H . item ( D ) , h ) ) ; break ; case 3 : v = v . nodeValue . replace ( /^\s+|\s+$/g , "" ) ;
if ( v != "" ) { z = true ; k . push ( w ( v ) + "" ) } break ; case 4 : k . push ( "\n" ) ; k . push ( Array ( h + 1 ) . join ( " " ) ) ; k . push ( "<![CDATA[" ) ; k . push ( v . nodeValue ) ; k . push ( "]]\>" ) ; break ; case 8 : k . push ( "\n" ) ; k . push ( Array ( h + 1 ) . join ( " " ) ) ; k . push ( "<!--" ) ; k . push ( v . data ) ; k . push ( "--\>" ) } } h -- ; if ( ! z ) { k . push ( "\n" ) ; for ( D = 0 ; D < h ; D ++ ) k . push ( " " ) } k . push ( "</" ) ; k . push ( e . nodeName ) ; k . push ( ">" ) } else k . push ( "/>" ) } return k . join ( "" ) } ; this . embedImage = function ( e , h ) { $ ( new Image ) . load ( function ( ) { var k = document . createElement ( "canvas" ) ; k . width = this . width ; k . height =
this . height ; k . getContext ( "2d" ) . drawImage ( this , 0 , 0 ) ; try { var w = ";svgedit_url=" + encodeURIComponent ( e ) ; w = k . toDataURL ( ) . replace ( ";base64" , w + ";base64" ) ; za [ e ] = w } catch ( v ) { za [ e ] = false } ya = e ; h && h ( za [ e ] ) } ) . attr ( "src" , e ) } ; this . setGoodImage = function ( e ) { ya = e } ; this . open = function ( ) { } ; this . save = function ( e ) { Va ( ) ; e && $ . extend ( fb , e ) ; fb . apply = true ; e = this . svgCanvasToString ( ) ; O ( "saved" , e ) } ; this . rasterExport = function ( ) { Va ( ) ; var e = [ ] , h = { feGaussianBlur : vb . exportNoBlur , foreignObject : vb . exportNoforeignObject , "[stroke-dasharray]" : vb . exportNoDashArray } ,
k = $ ( l ) ; if ( ! ( "font" in $ ( "<canvas>" ) [ 0 ] . getContext ( "2d" ) ) ) h . text = vb . exportNoText ; $ . each ( h , function ( w , v ) { k . find ( w ) . length && e . push ( v ) } ) ; h = this . svgCanvasToString ( ) ; O ( "exported" , { svg : h , issues : e } ) } ; this . getSvgString = function ( ) { fb . 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 Rb = this . uniquifyElems = function ( e ) { var h = { } , k = [ "filter" , "linearGradient" , "pattern" , "radialGradient" ,
"symbol" , "textPath" , "use" ] ; svgedit . utilities . walkTree ( e , function ( u ) { if ( u . nodeType == 1 ) { if ( u . id ) { u . id in h || ( h [ u . id ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ u . id ] . elem = u } $ . each ( Ua , function ( H , C ) { var E = u . getAttributeNode ( C ) ; if ( E ) { var K = svgedit . utilities . getUrlFromAttr ( E . value ) ; if ( K = K ? K . substr ( 1 ) : null ) { K in h || ( h [ K ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ K ] . attrs . push ( E ) } } } ) ; var D = svgedit . utilities . getHref ( u ) ; if ( D && k . indexOf ( u . nodeName ) >= 0 ) if ( D = D . substr ( 1 ) ) { D in h || ( h [ D ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ D ] . hrefs . push ( u ) } } } ) ;
for ( var w in h ) if ( w ) { var v = h [ w ] . elem ; if ( v ) { e = S ( ) ; v . id = e ; v = h [ w ] . attrs ; for ( var F = v . length ; F -- ; ) { var z = v [ F ] ; z . ownerElement . setAttribute ( z . name , "url(#" + e + ")" ) } v = h [ w ] . hrefs ; for ( F = v . length ; F -- ; ) svgedit . utilities . setHref ( v [ F ] , "#" + e ) } } } , Qb = this . setUseData = function ( e ) { var h = $ ( e ) ; if ( e . tagName !== "use" ) h = h . find ( "use" ) ; h . each ( function ( ) { var k = ea ( this ) . substr ( 1 ) ; if ( k = sa ( k ) ) { $ ( this ) . data ( "ref" , k ) ; if ( k . tagName == "symbol" || k . tagName == "svg" ) $ ( this ) . data ( "symbol" , k ) . data ( "ref" , k ) } } ) } , Sb = this . convertGradients = function ( e ) { var h =
$ ( e ) . find ( "linearGradient, radialGradient" ) ; if ( ! h . length && svgedit . browser . isWebkit ( ) ) h = $ ( e ) . find ( "*" ) . filter ( function ( ) { return this . tagName . indexOf ( "Gradient" ) >= 0 } ) ; h . each ( function ( ) { if ( $ ( this ) . attr ( "gradientUnits" ) === "userSpaceOnUse" ) { var k = $ ( l ) . find ( '[fill="url(#' + this . id + ')"],[stroke="url(#' + this . id + ')"]' ) ; if ( k . length ) if ( k = svgedit . utilities . getBBox ( k [ 0 ] ) ) if ( this . tagName === "linearGradient" ) { var w = $ ( this ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) , v = this . gradientTransform . baseVal ; if ( v && v . numberOfItems > 0 ) { var F =
X ( v ) . matrix ; v = Q ( w . x1 , w . y1 , F ) ; F = Q ( w . x2 , w . y2 , F ) ; w . x1 = v . x ; w . y1 = v . y ; w . x2 = F . x ; w . y2 = F . y ; this . removeAttribute ( "gradientTransform" ) } $ ( this ) . attr ( { x1 : ( w . x1 - k . x ) / k . width , y1 : ( w . y1 - k . y ) / k . height , x2 : ( w . x2 - k . x ) / k . width , y2 : ( w . y2 - k . y ) / k . height } ) ; this . removeAttribute ( "gradientUnits" ) } } } ) } , Ib = this . convertToGroup = function ( e ) { e || ( e = I [ 0 ] ) ; var h = $ ( e ) , k = new Ha , w ; if ( h . data ( "gsvg" ) ) { k = $ ( e . firstChild ) . attr ( [ "x" , "y" ] ) ; $ ( e . firstChild . firstChild ) . unwrap ( ) ; $ ( e ) . removeData ( "gsvg" ) ; w = ca ( e ) ; var v = d . createSVGTransform ( ) ; v . setTranslate ( k . x ,
k . y ) ; w . appendItem ( v ) ; hb ( e ) ; O ( "selected" , [ e ] ) } else if ( h . data ( "symbol" ) ) { e = h . data ( "symbol" ) ; w = h . attr ( "transform" ) ; v = h . attr ( [ "x" , "y" ] ) ; var F = e . getAttribute ( "viewBox" ) ; if ( F ) { F = F . split ( " " ) ; v . x -= + F [ 0 ] ; v . y -= + F [ 1 ] } w += " translate(" + ( v . x || 0 ) + "," + ( v . y || 0 ) + ")" ; v = h . prev ( ) ; k . addSubCommand ( new La ( h [ 0 ] , h [ 0 ] . nextSibling , h [ 0 ] . parentNode ) ) ; h . remove ( ) ; F = $ ( l ) . find ( "use:data(symbol)" ) . length ; h = f . createElementNS ( c , "g" ) ; for ( var z = e . childNodes , u = 0 ; u < z . length ; u ++ ) h . appendChild ( z [ u ] . cloneNode ( true ) ) ; if ( svgedit . browser . isGecko ( ) ) { z =
$ ( sb ( ) ) . children ( "linearGradient,radialGradient,pattern" ) . clone ( ) ; $ ( h ) . append ( z ) } w && h . setAttribute ( "transform" , w ) ; w = e . parentNode ; Rb ( h ) ; svgedit . browser . isGecko ( ) && $ ( sb ( ) ) . append ( $ ( h ) . find ( "linearGradient,radialGradient,pattern" ) ) ; h . id = S ( ) ; v . after ( h ) ; if ( w ) { if ( ! F ) { v = e . nextSibling ; w . removeChild ( e ) ; k . addSubCommand ( new La ( e , v , w ) ) } k . addSubCommand ( new Ca ( h ) ) } Qb ( h ) ; svgedit . browser . isGecko ( ) ? Sb ( sb ( ) ) : Sb ( h ) ; svgedit . utilities . walkTreePost ( h , function ( D ) { try { hb ( D ) } catch ( H ) { console . log ( H ) } } ) ; $ ( h ) . find ( "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" ) . each ( function ( ) { if ( ! this . id ) this . id =
S ( ) } ) ; Eb ( [ h ] ) ; ( e = Fb ( h , true ) ) && k . addSubCommand ( e ) ; va ( k ) } else console . log ( "Unexpected element to ungroup:" , e ) } ; this . setSvgString = function ( e ) { try { var h = svgedit . utilities . text2xml ( e ) ; this . prepareSvg ( h ) ; var k = new Ha ( "Change Source" ) , w = l . nextSibling , v = d . removeChild ( l ) ; k . addSubCommand ( new La ( v , w , d ) ) ; l = f . adoptNode ? f . adoptNode ( h . documentElement ) : f . importNode ( h . documentElement , true ) ; d . appendChild ( l ) ; var F = $ ( l ) ; b . current _drawing _ = new svgedit . draw . Drawing ( l , p ) ; var z = B ( ) . getNonce ( ) ; z ? O ( "setnonce" , z ) : O ( "unsetnonce" ) ;
F . find ( "image" ) . each ( function ( ) { var L = this ; tb ( L ) ; var Y = ea ( this ) ; if ( Y . indexOf ( "data:" ) === 0 ) { var n = Y . match ( /svgedit_url=(.*?);/ ) ; if ( n ) { var A = decodeURIComponent ( n [ 1 ] ) ; $ ( new Image ) . load ( function ( ) { L . setAttributeNS ( "http://www.w3.org/1999/xlink" , "xlink:href" , A ) } ) . attr ( "src" , A ) } } b . embedImage ( Y ) } ) ; F . find ( "svg" ) . each ( function ( ) { if ( ! $ ( this ) . closest ( "defs" ) . length ) { Rb ( this ) ; var L = this . parentNode ; if ( L . childNodes . length === 1 && L . nodeName === "g" ) { $ ( L ) . data ( "gsvg" , this ) ; L . id = L . id || S ( ) } else ma ( this ) } } ) ; svgedit . browser . isGecko ( ) &&
F . find ( "linearGradient, radialGradient, pattern" ) . appendTo ( sb ( ) ) ; Qb ( F ) ; Sb ( F [ 0 ] ) ; svgedit . utilities . walkTreePost ( l , function ( L ) { try { hb ( L ) } catch ( Y ) { console . log ( Y ) } } ) ; var u = { id : "svgcontent" , overflow : m . show _outside _canvas ? "visible" : "hidden" } , D = false ; if ( F . attr ( "viewBox" ) ) { var H = F . attr ( "viewBox" ) . split ( " " ) ; u . width = H [ 2 ] ; u . height = H [ 3 ] } else $ . each ( [ "width" , "height" ] , function ( L , Y ) { var n = F . attr ( Y ) ; n || ( n = "100%" ) ; if ( ( n + "" ) . substr ( - 1 ) === "%" ) D = true ; else u [ Y ] = ta ( Y , n ) } ) ; Jb ( ) ; F . children ( ) . find ( "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" ) . each ( function ( ) { if ( ! this . id ) this . id =
S ( ) } ) ; if ( D ) { var C = getStrokedBBox ( ) ; u . width = C . width + C . x ; u . height = C . height + C . y } if ( u . width <= 0 ) u . width = 100 ; if ( u . height <= 0 ) u . height = 100 ; F . attr ( u ) ; this . contentW = u . width ; this . contentH = u . height ; k . addSubCommand ( new Ca ( l ) ) ; var E = F . attr ( [ "width" , "height" ] ) ; k . addSubCommand ( new Na ( d , E ) ) ; q = 1 ; svgedit . transformlist . resetListMap ( ) ; Va ( ) ; svgedit . path . clearData ( ) ; d . appendChild ( Fa . selectorParentGroup ) ; va ( k ) ; O ( "changed" , [ l ] ) } catch ( K ) { console . log ( K ) ; return false } return true } ; this . importSvgString = function ( e ) { try { var h = svgedit . utilities . encode64 ( e . length +
e ) . substr ( 0 , 32 ) , k = false ; if ( qb [ h ] ) if ( $ ( qb [ h ] . symbol ) . parents ( "#svgroot" ) . length ) k = true ; var w = new Ha ( "Import SVG" ) ; if ( k ) var v = qb [ h ] . symbol , F = qb [ h ] . xform ; else { var z = svgedit . utilities . text2xml ( e ) ; this . prepareSvg ( z ) ; var u ; u = f . adoptNode ? f . adoptNode ( z . documentElement ) : f . importNode ( z . documentElement , true ) ; Rb ( u ) ; var D = ta ( "width" , u . getAttribute ( "width" ) ) , H = ta ( "height" , u . getAttribute ( "height" ) ) , C = u . getAttribute ( "viewBox" ) , E = C ? C . split ( " " ) : [ 0 , 0 , D , H ] ; for ( e = 0 ; e < 4 ; ++ e ) E [ e ] = + E [ e ] ; l . getAttribute ( "width" ) ; var K = + l . getAttribute ( "height" ) ;
F = H > D ? "scale(" + K / 3 / E [ 3 ] + ")" : "scale(" + K / 3 / E [ 2 ] + ")" ; F = "translate(0) " + F + " translate(0)" ; v = f . createElementNS ( c , "symbol" ) ; var L = sb ( ) ; for ( svgedit . browser . isGecko ( ) && $ ( u ) . find ( "linearGradient, radialGradient, pattern" ) . appendTo ( L ) ; u . firstChild ; ) v . appendChild ( u . firstChild ) ; var Y = u . attributes ; for ( u = 0 ; u < Y . length ; u ++ ) { var n = Y [ u ] ; v . setAttribute ( n . nodeName , n . nodeValue ) } v . id = S ( ) ; qb [ h ] = { symbol : v , xform : F } ; sb ( ) . appendChild ( v ) ; w . addSubCommand ( new Ca ( v ) ) } var A = f . createElementNS ( c , "use" ) ; A . id = S ( ) ; aa ( A , "#" + v . id ) ; ( M ||
B ( ) . getCurrentLayer ( ) ) . appendChild ( A ) ; w . addSubCommand ( new Ca ( A ) ) ; Va ( ) ; A . setAttribute ( "transform" , F ) ; hb ( A ) ; $ ( A ) . data ( "symbol" , v ) . data ( "ref" , v ) ; yb ( [ A ] ) ; va ( w ) ; O ( "changed" , [ l ] ) } catch ( G ) { console . log ( G ) ; return false } return true } ; var Jb = b . identifyLayers = function ( ) { Nb ( ) ; B ( ) . identifyLayers ( ) } ; this . createLayer = function ( e ) { var h = new Ha ( "Create Layer" ) ; e = B ( ) . createLayer ( e ) ; h . addSubCommand ( new Ca ( e ) ) ; va ( h ) ; Va ( ) ; O ( "changed" , [ e ] ) } ; this . cloneLayer = function ( e ) { var h = new Ha ( "Duplicate Layer" ) , k = f . createElementNS ( c ,
"g" ) , w = f . createElementNS ( c , "title" ) ; w . textContent = e ; k . appendChild ( w ) ; w = B ( ) . getCurrentLayer ( ) ; $ ( w ) . after ( k ) ; w = w . childNodes ; for ( var v = 0 ; v < w . length ; v ++ ) { var F = w [ v ] ; F . localName != "title" && k . appendChild ( ga ( F ) ) } Va ( ) ; Jb ( ) ; h . addSubCommand ( new Ca ( k ) ) ; va ( h ) ; b . setCurrentLayer ( e ) ; O ( "changed" , [ k ] ) } ; this . deleteCurrentLayer = function ( ) { var e = B ( ) . getCurrentLayer ( ) , h = e . nextSibling , k = e . parentNode ; if ( e = B ( ) . deleteCurrentLayer ( ) ) { var w = new Ha ( "Delete Layer" ) ; w . addSubCommand ( new La ( e , h , k ) ) ; va ( w ) ; Va ( ) ; O ( "changed" , [ k ] ) ; return true } return false } ;
this . setCurrentLayer = function ( e ) { ( e = B ( ) . setCurrentLayer ( svgedit . utilities . toXml ( e ) ) ) && Va ( ) ; return e } ; this . renameCurrentLayer = function ( e ) { var h = B ( ) ; if ( h . current _layer ) { var k = h . current _layer ; if ( ! b . setCurrentLayer ( e ) ) { for ( var w = new Ha ( "Rename Layer" ) , v = 0 ; v < h . getNumLayers ( ) ; ++ v ) if ( h . all _layers [ v ] [ 1 ] == k ) break ; var F = h . getLayerName ( v ) ; h . all _layers [ v ] [ 0 ] = svgedit . utilities . toXml ( e ) ; var z = k . childNodes . length ; for ( v = 0 ; v < z ; ++ v ) { var u = k . childNodes . item ( v ) ; if ( u && u . tagName == "title" ) { for ( ; u . firstChild ; ) u . removeChild ( u . firstChild ) ;
u . textContent = e ; w . addSubCommand ( new Na ( u , { "#text" : F } ) ) ; va ( w ) ; O ( "changed" , [ k ] ) ; return true } } } h . current _layer = k } return false } ; this . setCurrentLayerPosition = function ( e ) { var h = B ( ) ; if ( h . current _layer && e >= 0 && e < h . getNumLayers ( ) ) { for ( var k = 0 ; k < h . getNumLayers ( ) ; ++ k ) if ( h . all _layers [ k ] [ 1 ] == h . current _layer ) break ; if ( k == h . getNumLayers ( ) ) return false ; if ( k != e ) { var w = null , v = h . current _layer . nextSibling ; if ( e > k ) { if ( e < h . getNumLayers ( ) - 1 ) w = h . all _layers [ e + 1 ] [ 1 ] } else w = h . all _layers [ e ] [ 1 ] ; l . insertBefore ( h . current _layer , w ) ;
va ( new Ja ( h . current _layer , v , l ) ) ; Jb ( ) ; b . setCurrentLayer ( h . getLayerName ( e ) ) ; return true } } return false } ; this . setLayerVisibility = function ( e , h ) { var k = B ( ) , w = k . getLayerVisibility ( e ) , v = k . setLayerVisibility ( e , h ) ; if ( v ) va ( new Na ( v , { display : w ? "inline" : "none" } , "Layer Visibility" ) ) ; else return false ; if ( v == k . getCurrentLayer ( ) ) { Va ( ) ; Ka . clear ( ) } return true } ; this . moveSelectedToLayer = function ( e ) { for ( var h = null , k = B ( ) , w = 0 ; w < k . getNumLayers ( ) ; ++ w ) if ( k . getLayerName ( w ) == e ) { h = k . all _layers [ w ] [ 1 ] ; break } if ( ! h ) return false ; e =
new Ha ( "Move Elements to Layer" ) ; k = I ; for ( w = k . length ; w -- ; ) { var v = k [ w ] ; if ( v ) { var F = v . nextSibling , z = v . parentNode ; h . appendChild ( v ) ; e . addSubCommand ( new Ja ( v , F , z ) ) } } va ( e ) ; return true } ; this . mergeLayer = function ( e ) { var h = new Ha ( "Merge Layer" ) , k = B ( ) , w = $ ( k . current _layer ) . prev ( ) [ 0 ] ; if ( w ) { for ( h . addSubCommand ( new La ( k . current _layer , k . current _layer . nextSibling , l ) ) ; k . current _layer . firstChild ; ) { var v = k . current _layer . firstChild ; if ( v . localName == "title" ) { h . addSubCommand ( new La ( v , v . nextSibling , k . current _layer ) ) ; k . current _layer . removeChild ( v ) } else { var F =
v . nextSibling ; w . appendChild ( v ) ; h . addSubCommand ( new Ja ( v , F , k . current _layer ) ) } } l . removeChild ( k . current _layer ) ; if ( ! e ) { Va ( ) ; Jb ( ) ; O ( "changed" , [ l ] ) ; va ( h ) } k . current _layer = w ; return h } } ; this . mergeAllLayers = function ( ) { var e = new Ha ( "Merge all Layers" ) , h = B ( ) ; for ( h . current _layer = h . all _layers [ h . getNumLayers ( ) - 1 ] [ 1 ] ; $ ( l ) . children ( "g" ) . length > 1 ; ) e . addSubCommand ( b . mergeLayer ( true ) ) ; Va ( ) ; Jb ( ) ; O ( "changed" , [ l ] ) ; va ( e ) } ; var Nb = this . leaveContext = function ( ) { var e = ob . length ; if ( e ) { for ( var h = 0 ; h < e ; h ++ ) { var k = ob [ h ] , w = Ta ( k , "orig_opac" ) ;
w !== 1 ? k . setAttribute ( "opacity" , w ) : k . removeAttribute ( "opacity" ) ; k . setAttribute ( "style" , "pointer-events: inherit" ) } ob = [ ] ; Va ( true ) ; O ( "contextset" , null ) } M = null } , Ub = this . setContext = function ( e ) { Nb ( ) ; if ( typeof e === "string" ) e = sa ( e ) ; M = e ; $ ( e ) . parentsUntil ( "#svgcontent" ) . andSelf ( ) . siblings ( ) . each ( function ( ) { var h = this . getAttribute ( "opacity" ) || 1 ; Ta ( this , "orig_opac" , h ) ; this . setAttribute ( "opacity" , h * 0.33 ) ; this . setAttribute ( "style" , "pointer-events: none" ) ; ob . push ( this ) } ) ; Va ( ) ; O ( "contextset" , M ) } ; this . clear = function ( ) { Ka . clear ( ) ;
Va ( ) ; b . clearSvgContentElement ( ) ; b . current _drawing _ = new svgedit . draw . Drawing ( l ) ; b . createLayer ( "Layer 1" ) ; b . undoMgr . resetUndoStack ( ) ; Fa . initGroup ( ) ; Ma = Fa . getRubberBandBox ( ) ; O ( "cleared" ) } ; this . linkControlPoints = Ka . linkControlPoints ; this . getContentElem = function ( ) { return l } ; this . getRootElem = function ( ) { return d } ; this . getSelectedElems = function ( ) { return I } ; var Hb = this . getResolution = function ( ) { var e = l . getAttribute ( "width" ) / q , h = l . getAttribute ( "height" ) / q ; return { w : e , h : h , zoom : q } } ; this . getZoom = function ( ) { return q } ;
this . getVersion = function ( ) { return "svgcanvas.js ($Rev: 2082 $)" } ; this . setUiStrings = function ( e ) { $ . extend ( vb , e . notification ) } ; this . setConfig = function ( e ) { $ . extend ( m , e ) } ; this . getTitle = function ( e ) { if ( e = e || I [ 0 ] ) { e = $ ( e ) . data ( "gsvg" ) || $ ( e ) . data ( "symbol" ) || e ; e = e . childNodes ; for ( var h = 0 ; h < e . length ; h ++ ) if ( e [ h ] . nodeName == "title" ) return e [ h ] . textContent ; return "" } } ; this . setGroupTitle = function ( e ) { var h = I [ 0 ] ; h = $ ( h ) . data ( "gsvg" ) || h ; var k = $ ( h ) . children ( "title" ) , w = new Ha ( "Set Label" ) ; if ( e . length ) if ( k . length ) { k = k [ 0 ] ; w . addSubCommand ( new Na ( k ,
{ "#text" : k . textContent } ) ) ; k . textContent = e } else { k = f . createElementNS ( c , "title" ) ; k . textContent = e ; $ ( h ) . prepend ( k ) ; w . addSubCommand ( new Ca ( k ) ) } else { w . addSubCommand ( new La ( k [ 0 ] , k . nextSibling , h ) ) ; k . remove ( ) } va ( w ) } ; this . getDocumentTitle = function ( ) { return b . getTitle ( l ) } ; this . setDocumentTitle = function ( e ) { for ( var h = l . childNodes , k = false , w = "" , v = new Ha ( "Change Image Title" ) , F = 0 ; F < h . length ; F ++ ) if ( h [ F ] . nodeName == "title" ) { k = h [ F ] ; w = k . textContent ; break } if ( ! k ) { k = f . createElementNS ( c , "title" ) ; l . insertBefore ( k , l . firstChild ) } if ( e . length ) k . textContent =
e ; else k . parentNode . removeChild ( k ) ; v . addSubCommand ( new Na ( k , { "#text" : w } ) ) ; va ( v ) } ; this . getEditorNS = function ( e ) { e && l . setAttribute ( "xmlns:se" , "http://svg-edit.googlecode.com" ) ; return "http://svg-edit.googlecode.com" } ; this . setResolution = function ( e , h ) { var k = Hb ( ) , w = k . w ; k = k . h ; var v ; if ( e == "fit" ) { var F = getStrokedBBox ( ) ; if ( F ) { v = new Ha ( "Fit Canvas to Content" ) ; var z = wb ( ) ; yb ( z ) ; var u = [ ] , D = [ ] ; $ . each ( z , function ( ) { u . push ( F . x * - 1 ) ; D . push ( F . y * - 1 ) } ) ; z = b . moveSelectedElements ( u , D , true ) ; v . addSubCommand ( z ) ; Va ( ) ; e = Math . round ( F . width ) ;
h = Math . round ( F . height ) } else return false } if ( e != w || h != k ) { z = d . suspendRedraw ( 1E3 ) ; v || ( v = new Ha ( "Change Image Dimensions" ) ) ; e = ta ( "width" , e ) ; h = ta ( "height" , h ) ; l . setAttribute ( "width" , e ) ; l . setAttribute ( "height" , h ) ; this . contentW = e ; this . contentH = h ; v . addSubCommand ( new Na ( l , { width : w , height : k } ) ) ; l . setAttribute ( "viewBox" , [ 0 , 0 , e / q , h / q ] . join ( " " ) ) ; v . addSubCommand ( new Na ( l , { viewBox : [ "0 0" , w , k ] . join ( " " ) } ) ) ; va ( v ) ; d . unsuspendRedraw ( z ) ; if ( background = document . getElementById ( "canvas_background" ) ) { background . setAttribute ( "x" ,
- 1 ) ; background . setAttribute ( "y" , - 1 ) ; background . setAttribute ( "width" , e + 2 ) ; background . setAttribute ( "height" , h + 2 ) } O ( "changed" , [ l ] ) } return [ e , h ] } ; this . getOffset = function ( ) { return $ ( l ) . attr ( [ "x" , "y" ] ) } ; this . setBBoxZoom = function ( e , h , k ) { var w = 0.85 , v = function ( F ) { if ( ! F ) return false ; var z = Math . min ( Math . round ( h / F . width * 100 * w ) / 100 , Math . round ( k / F . height * 100 * w ) / 100 ) ; b . setZoom ( z ) ; return { zoom : z , bbox : F } } ; if ( typeof e == "object" ) { e = e ; if ( e . width == 0 || e . height == 0 ) { b . setZoom ( e . zoom ? e . zoom : q * e . factor ) ; return { zoom : q , bbox : e } } return v ( e ) } switch ( e ) { case "selection" : if ( ! I [ 0 ] ) return ;
e = $ . map ( I , function ( F ) { if ( F ) return F } ) ; e = getStrokedBBox ( e ) ; break ; case "canvas" : e = Hb ( ) ; w = 0.95 ; e = { width : e . w , height : e . h , x : 0 , y : 0 } ; break ; case "content" : e = getStrokedBBox ( ) ; break ; case "layer" : e = getStrokedBBox ( wb ( B ( ) . getCurrentLayer ( ) ) ) ; break ; default : return } return v ( e ) } ; this . setZoom = function ( e ) { var h = Hb ( ) ; l . setAttribute ( "viewBox" , "0 0 " + h . w / e + " " + h . h / e ) ; q = e ; $ . each ( I , function ( k , w ) { w && Fa . requestSelector ( w ) . resize ( ) } ) ; Ka . zoomChange ( ) ; eb ( "zoomChanged" , e ) } ; this . getMode = function ( ) { return Ea } ; this . setMode = function ( e ) { Ka . clear ( true ) ;
ib . clear ( ) ; $ ( "#workarea" ) . attr ( "class" , e ) ; cb = I [ 0 ] && I [ 0 ] . nodeName == "text" ? gb : P ; Ea = e } ; this . getColor = function ( e ) { return cb [ e ] } ; this . setColor = function ( e , h , k ) { P [ e ] = h ; cb [ e + "_paint" ] = { type : "solidColor" } ; for ( var w = [ ] , v = I . length ; v -- ; ) { var F = I [ v ] ; if ( F ) if ( F . tagName == "g" ) svgedit . utilities . walkTree ( F , function ( z ) { z . nodeName != "g" && w . push ( z ) } ) ; else if ( e == "fill" ) F . tagName != "polyline" && F . tagName != "line" && w . push ( F ) ; else w . push ( F ) } if ( w . length > 0 ) if ( k ) Gb ( e , h , w ) ; else { jb ( e , h , w ) ; O ( "changed" , w ) } } ; var sb = function ( ) { var e = l . getElementsByTagNameNS ( c ,
"defs" ) ; if ( e . length > 0 ) e = e [ 0 ] ; else { e = f . createElementNS ( c , "defs" ) ; l . firstChild ? l . insertBefore ( e , l . firstChild . nextSibling ) : l . appendChild ( e ) } return e } , Pb = this . setGradient = function ( e ) { if ( ! ( ! cb [ e + "_paint" ] || cb [ e + "_paint" ] . type == "solidColor" ) ) { var h = b [ e + "Grad" ] , k = Tb ( h ) , w = sb ( ) ; if ( k ) h = k ; else { h = w . appendChild ( f . importNode ( h , true ) ) ; h . id = S ( ) } b . setColor ( e , "url(#" + h . id + ")" ) ; if ( e == "canvas" ) ( e = document . getElementById ( "canvas_background" ) ) && e . setAttribute ( "fill" , "url(#" + h . id + ")" ) } } , Tb = function ( e ) { var h = sb ( ) ; h = $ ( h ) . find ( "linearGradient, radialGradient" ) ;
for ( var k = h . length , w = [ "r" , "cx" , "cy" , "fx" , "fy" ] ; k -- ; ) { var v = h [ k ] ; if ( e . tagName == "linearGradient" ) { if ( e . getAttribute ( "x1" ) != v . getAttribute ( "x1" ) || e . getAttribute ( "y1" ) != v . getAttribute ( "y1" ) || e . getAttribute ( "x2" ) != v . getAttribute ( "x2" ) || e . getAttribute ( "y2" ) != v . getAttribute ( "y2" ) ) continue } else { var F = $ ( e ) . attr ( w ) , z = $ ( v ) . attr ( w ) , u = false ; $ . each ( w , function ( L , Y ) { if ( F [ Y ] != z [ Y ] ) u = true } ) ; if ( u ) continue } var D = e . getElementsByTagNameNS ( c , "stop" ) , H = v . getElementsByTagNameNS ( c , "stop" ) ; if ( D . length == H . length ) { for ( var C =
D . length ; C -- ; ) { var E = D [ C ] , K = H [ C ] ; if ( E . getAttribute ( "offset" ) != K . getAttribute ( "offset" ) || E . getAttribute ( "stop-opacity" ) != K . getAttribute ( "stop-opacity" ) || E . getAttribute ( "stop-color" ) != K . getAttribute ( "stop-color" ) ) break } if ( C == - 1 ) return v } } return null } ; this . setPaint = function ( e , h ) { var k = new $ . jGraduate . Paint ( h ) ; this . setPaintOpacity ( e , k . alpha / 100 , true ) ; cb [ e + "_paint" ] = k ; switch ( k . type ) { case "solidColor" : if ( k . solidColor != "none" && k . solidColor != "#none" ) this . setColor ( e , "#" + k . solidColor ) ; else { this . setColor ( e ,
"none" ) ; document . querySelector ( e == "fill" ? "#fill_color rect" : "#stroke_color rect" ) . setAttribute ( "fill" , "none" ) } break ; case "linearGradient" : case "radialGradient" : b [ e + "Grad" ] = k [ k . type ] ; Pb ( e ) } } ; this . getStrokeWidth = function ( ) { return cb . stroke _width } ; this . setStrokeWidth = function ( e ) { if ( e == 0 && [ "line" , "path" ] . indexOf ( Ea ) >= 0 ) b . setStrokeWidth ( 1 ) ; else { cb . stroke _width = e ; for ( var h = [ ] , k = I . length ; k -- ; ) { var w = I [ k ] ; if ( w ) w . tagName == "g" ? svgedit . utilities . walkTree ( w , function ( v ) { v . nodeName != "g" && h . push ( v ) } ) : h . push ( w ) } if ( h . length >
0 ) { jb ( "stroke-width" , e , h ) ; O ( "changed" , I ) } } } ; this . setStrokeAttr = function ( e , h ) { P [ e . replace ( "-" , "_" ) ] = h ; for ( var k = [ ] , w = I . length ; w -- ; ) { var v = I [ w ] ; if ( v ) v . tagName == "g" ? svgedit . utilities . walkTree ( v , function ( F ) { F . nodeName != "g" && k . push ( F ) } ) : k . push ( v ) } if ( k . length > 0 ) { jb ( e , h , k ) ; O ( "changed" , I ) } } ; this . getStyle = function ( ) { return P } ; this . getOpacity = function ( ) { return P . opacity } ; this . setOpacity = function ( e ) { P . opacity = e ; jb ( "opacity" , e ) } ; this . getFillOpacity = function ( ) { return P . fill _opacity } ; this . getStrokeOpacity = function ( ) { return P . stroke _opacity } ;
this . setPaintOpacity = function ( e , h , k ) { P [ e + "_opacity" ] = h ; k ? Gb ( e + "-opacity" , h ) : jb ( e + "-opacity" , h ) } ; this . getBlur = function ( e ) { var h = 0 ; if ( e ) if ( e . getAttribute ( "filter" ) ) if ( e = sa ( e . id + "_blur" ) ) h = e . firstChild . getAttribute ( "stdDeviation" ) ; return h } ; ( function ( ) { function e ( ) { var v = b . undoMgr . finishUndoableChange ( ) ; h . addSubCommand ( v ) ; va ( h ) ; k = h = null } var h = null , k = null , w = false ; b . setBlurNoUndo = function ( v ) { if ( k ) if ( v === 0 ) { Gb ( "filter" , "" ) ; w = true } else { var F = I [ 0 ] ; w && Gb ( "filter" , "url(#" + F . id + "_blur)" ) ; if ( svgedit . browser . isWebkit ( ) ) { F . removeAttribute ( "filter" ) ;
F . setAttribute ( "filter" , "url(#" + F . id + "_blur)" ) } Gb ( "stdDeviation" , v , [ k . firstChild ] ) ; b . setBlurOffsets ( k , v ) } else b . setBlur ( v ) } ; b . setBlurOffsets = function ( v , F ) { if ( F > 3 ) na ( v , { x : "-50%" , y : "-50%" , width : "200%" , height : "200%" } , 100 ) ; else if ( ! svgedit . browser . isWebkit ( ) ) { v . removeAttribute ( "x" ) ; v . removeAttribute ( "y" ) ; v . removeAttribute ( "width" ) ; v . removeAttribute ( "height" ) } } ; b . setBlur = function ( v , F ) { if ( h ) e ( ) ; else { var z = I [ 0 ] , u = z . id ; k = sa ( u + "_blur" ) ; v -= 0 ; var D = new Ha ; if ( k ) { if ( v === 0 ) k = null } else { var H = V ( { element : "feGaussianBlur" ,
attr : { "in" : "SourceGraphic" , stdDeviation : v } } ) ; k = V ( { element : "filter" , attr : { id : u + "_blur" } } ) ; k . appendChild ( H ) ; sb ( ) . appendChild ( k ) ; D . addSubCommand ( new Ca ( k ) ) } H = { filter : z . getAttribute ( "filter" ) } ; if ( v === 0 ) { z . removeAttribute ( "filter" ) ; D . addSubCommand ( new Na ( z , H ) ) } else { jb ( "filter" , "url(#" + u + "_blur)" ) ; D . addSubCommand ( new Na ( z , H ) ) ; b . setBlurOffsets ( k , v ) ; h = D ; b . undoMgr . beginUndoableChange ( "stdDeviation" , [ k ? k . firstChild : null ] ) ; if ( F ) { b . setBlurNoUndo ( v ) ; e ( ) } } } } } ) ( ) ; this . getBold = function ( ) { var e = I [ 0 ] ; if ( e != null && e . tagName ==
"text" && I [ 1 ] == null ) return e . getAttribute ( "font-weight" ) == "bold" ; return false } ; this . setBold = function ( e ) { var h = I [ 0 ] ; if ( h != null && h . tagName == "text" && I [ 1 ] == null ) jb ( "font-weight" , e ? "bold" : "normal" ) ; I [ 0 ] . textContent || ib . setCursor ( ) } ; this . getItalic = function ( ) { var e = I [ 0 ] ; if ( e != null && e . tagName == "text" && I [ 1 ] == null ) return e . getAttribute ( "font-style" ) == "italic" ; return false } ; this . setItalic = function ( e ) { var h = I [ 0 ] ; if ( h != null && h . tagName == "text" && I [ 1 ] == null ) jb ( "font-style" , e ? "italic" : "normal" ) ; I [ 0 ] . textContent || ib . setCursor ( ) } ;
this . getFontFamily = function ( ) { return gb . font _family } ; this . setFontFamily = function ( e ) { gb . font _family = e ; jb ( "font-family" , e ) ; I [ 0 ] && ! I [ 0 ] . textContent && ib . setCursor ( ) } ; this . setFontColor = function ( e ) { gb . fill = e ; jb ( "fill" , e ) } ; this . getFontSize = function ( ) { return gb . fill } ; this . getFontSize = function ( ) { return gb . font _size } ; this . setFontSize = function ( e ) { gb . font _size = e ; jb ( "font-size" , e ) ; I [ 0 ] . textContent || ib . setCursor ( ) } ; this . getText = function ( ) { var e = I [ 0 ] ; if ( e == null ) return "" ; return e . textContent } ; this . setTextContent =
function ( e ) { jb ( "#text" , e ) ; ib . init ( e ) ; ib . setCursor ( ) } ; this . setImageURL = function ( e ) { var h = I [ 0 ] ; if ( h ) { var k = $ ( h ) . attr ( [ "width" , "height" ] ) ; k = ! k . width || ! k . height ; var w = ea ( h ) ; if ( w !== e ) k = true ; else if ( ! k ) return ; var v = new Ha ( "Change Image URL" ) ; aa ( h , e ) ; v . addSubCommand ( new Na ( h , { "#href" : w } ) ) ; k ? $ ( new Image ) . load ( function ( ) { var F = $ ( h ) . attr ( [ "width" , "height" ] ) ; $ ( h ) . attr ( { width : this . width , height : this . height } ) ; Fa . requestSelector ( h ) . resize ( ) ; v . addSubCommand ( new Na ( h , F ) ) ; va ( v ) ; O ( "changed" , [ h ] ) } ) . attr ( "src" , e ) : va ( v ) } } ;
this . setLinkURL = function ( e ) { var h = I [ 0 ] ; if ( h ) { if ( h . tagName !== "a" ) { h = $ ( h ) . parents ( "a" ) ; if ( h . length ) h = h [ 0 ] ; else return } var k = ea ( h ) ; if ( k !== e ) { var w = new Ha ( "Change Link URL" ) ; aa ( h , e ) ; w . addSubCommand ( new Na ( h , { "#href" : k } ) ) ; va ( w ) } } } ; this . setRectRadius = function ( e ) { var h = I [ 0 ] ; if ( h != null && h . tagName == "rect" ) { var k = h . getAttribute ( "rx" ) ; if ( k != e ) { h . setAttribute ( "rx" , e ) ; h . setAttribute ( "ry" , e ) ; va ( new Na ( h , { rx : k , ry : k } , "Radius" ) ) ; O ( "changed" , [ h ] ) } } } ; this . makeHyperlink = function ( e ) { b . groupSelectedElements ( "a" , e ) } ; this . removeHyperlink =
function ( ) { b . ungroupSelectedElement ( ) } ; this . setSegType = function ( e ) { Ka . setSegType ( e ) } ; this . convertToPath = function ( e , h ) { if ( e == null ) $ . each ( I , function ( N , J ) { J && b . convertToPath ( J ) } ) ; else { if ( ! h ) var k = new Ha ( "Convert element to Path" ) ; var w = h ? { } : { fill : P . fill , "fill-opacity" : P . fill _opacity , stroke : P . stroke , "stroke-width" : P . stroke _width , "stroke-dasharray" : P . stroke _dasharray , "stroke-linejoin" : P . stroke _linejoin , "stroke-linecap" : P . stroke _linecap , "stroke-opacity" : P . stroke _opacity , opacity : P . opacity , visibility : "hidden" } ;
$ . each ( [ "marker-start" , "marker-end" , "marker-mid" , "filter" , "clip-path" ] , function ( ) { if ( e . getAttribute ( this ) ) w [ this ] = e . getAttribute ( this ) } ) ; var v = V ( { element : "path" , attr : w } ) , F = e . getAttribute ( "transform" ) ; F && v . setAttribute ( "transform" , F ) ; var z = e . id , u = e . parentNode ; e . nextSibling ? u . insertBefore ( v , e ) : u . appendChild ( v ) ; var D = "" , H = function ( N ) { $ . each ( N , function ( J , T ) { var da = T [ 1 ] ; D += T [ 0 ] ; for ( var ia = 0 ; ia < da . length ; ia += 2 ) D += da [ ia ] + "," + da [ ia + 1 ] + " " } ) } , C = 1.81 ; switch ( e . tagName ) { case "ellipse" : case "circle" : var E = $ ( e ) . attr ( [ "rx" ,
"ry" , "cx" , "cy" ] ) , K = E . cx , L = E . cy , Y = E . rx ; E = E . ry ; if ( e . tagName == "circle" ) Y = E = $ ( e ) . attr ( "r" ) ; H ( [ [ "M" , [ K - Y , L ] ] , [ "C" , [ K - Y , L - E / C , K - Y / C , L - E , K , L - E ] ] , [ "C" , [ K + Y / C , L - E , K + Y , L - E / C , K + Y , L ] ] , [ "C" , [ K + Y , L + E / C , K + Y / C , L + E , K , L + E ] ] , [ "C" , [ K - Y / C , L + E , K - Y , L + E / C , K - Y , L ] ] , [ "Z" , [ ] ] ] ) ; break ; case "path" : D = e . getAttribute ( "d" ) ; break ; case "line" : E = $ ( e ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) ; D = "M" + E . x1 + "," + E . y1 + "L" + E . x2 + "," + E . y2 ; break ; case "polyline" : case "polygon" : D = "M" + e . getAttribute ( "points" ) ; break ; case "rect" : E = $ ( e ) . attr ( [ "rx" , "ry" ] ) ; Y = E . rx ; E =
E . ry ; var n = e . getBBox ( ) ; K = n . x ; L = n . y ; var A = n . width ; n = n . height ; C = 4 - C ; ! Y && ! E ? H ( [ [ "M" , [ K , L ] ] , [ "L" , [ K + A , L ] ] , [ "L" , [ K + A , L + n ] ] , [ "L" , [ K , L + n ] ] , [ "L" , [ K , L ] ] , [ "Z" , [ ] ] ] ) : H ( [ [ "M" , [ K , L + E ] ] , [ "C" , [ K , L + E / C , K + Y / C , L , K + Y , L ] ] , [ "L" , [ K + A - Y , L ] ] , [ "C" , [ K + A - Y / C , L , K + A , L + E / C , K + A , L + E ] ] , [ "L" , [ K + A , L + n - E ] ] , [ "C" , [ K + A , L + n - E / C , K + A - Y / C , L + n , K + A - Y , L + n ] ] , [ "L" , [ K + Y , L + n ] ] , [ "C" , [ K + Y / C , L + n , K , L + n - E / C , K , L + n - E ] ] , [ "L" , [ K , L + E ] ] , [ "Z" , [ ] ] ] ) ; break ; default : v . parentNode . removeChild ( v ) } D && v . setAttribute ( "d" , D ) ; if ( h ) { Ka . resetOrientation ( v ) ; k = false ; try { k =
v . getBBox ( ) } catch ( G ) { } v . parentNode . removeChild ( v ) ; return k } else { if ( F ) { F = ca ( v ) ; ha ( F ) && Ka . resetOrientation ( v ) } k . addSubCommand ( new La ( e , e . nextSibling , u ) ) ; k . addSubCommand ( new Ca ( v ) ) ; Va ( ) ; e . parentNode . removeChild ( e ) ; v . setAttribute ( "id" , z ) ; v . removeAttribute ( "visibility" ) ; yb ( [ v ] , true ) ; va ( k ) } } } ; var Gb = this . changeSelectedAttributeNoUndo = function ( e , h , k ) { var w = d . suspendRedraw ( 1E3 ) ; Ea == "pathedit" && Ka . moveNode ( e , h ) ; k = k || I ; for ( var v = k . length , F = [ "g" , "polyline" , "path" ] ; v -- ; ) { var z = k [ v ] ; if ( z != null ) { Ea === "textedit" &&
e !== "#text" && z . textContent . length && ib . toSelectMode ( z ) ; if ( ( e === "x" || e === "y" ) && F . indexOf ( z . tagName ) >= 0 ) { var u = getStrokedBBox ( [ z ] ) ; b . moveSelectedElements ( ( e === "x" ? h - u . x : 0 ) * q , ( e === "y" ? h - u . y : 0 ) * q , true ) } else { u = e === "#text" ? z . textContent : z . getAttribute ( e ) ; if ( u == null ) u = "" ; if ( u !== String ( h ) ) { if ( e == "#text" ) { svgedit . utilities . getBBox ( z ) ; z . textContent = h } else e == "#href" ? aa ( z , h ) : z . setAttribute ( e , h ) ; I . indexOf ( z ) >= 0 && setTimeout ( function ( ) { z . parentNode && Fa . requestSelector ( z ) . resize ( ) } , 0 ) ; u = la ( z ) ; if ( u != 0 && e != "transform" ) for ( var D =
ca ( z ) , H = D . numberOfItems ; H -- ; ) if ( D . getItem ( H ) . type == 4 ) { D . removeItem ( H ) ; var C = svgedit . utilities . getBBox ( z ) , E = Q ( C . x + C . width / 2 , C . y + C . height / 2 , X ( D ) . matrix ) ; C = E . x ; E = E . y ; var K = d . createSVGTransform ( ) ; K . setRotate ( u , C , E ) ; D . insertItemBefore ( K , H ) ; break } } } } } d . unsuspendRedraw ( w ) } , jb = this . changeSelectedAttribute = function ( e , h , k ) { k = k || I ; b . undoMgr . beginUndoableChange ( e , k ) ; Gb ( e , h , k ) ; e = b . undoMgr . finishUndoableChange ( ) ; e . isEmpty ( ) || va ( e ) } ; this . deleteSelectedElements = function ( ) { for ( var e = new Ha ( "Delete Elements" ) , h = I . length ,
k = [ ] , w = 0 ; w < h ; ++ w ) { var v = I [ w ] ; if ( v == null ) break ; var F = v . parentNode , z = v ; Fa . releaseSelector ( z ) ; svgedit . path . removePath _ ( z . id ) ; if ( F . tagName === "a" && F . childNodes . length === 1 ) { z = F ; F = F . parentNode } var u = z . nextSibling ; z = F . removeChild ( z ) ; k . push ( v ) ; I [ w ] = null ; e . addSubCommand ( new La ( z , u , F ) ) } e . isEmpty ( ) || va ( e ) ; O ( "changed" , k ) ; Va ( ) } ; this . cutSelectedElements = function ( ) { for ( var e = new Ha ( "Cut Elements" ) , h = I . length , k = [ ] , w = 0 ; w < h ; ++ w ) { var v = I [ w ] ; if ( v == null ) break ; var F = v . parentNode , z = v ; Fa . releaseSelector ( z ) ; svgedit . path . removePath _ ( z . id ) ;
var u = z . nextSibling ; z = F . removeChild ( z ) ; k . push ( v ) ; I [ w ] = null ; e . addSubCommand ( new La ( z , u , F ) ) } e . isEmpty ( ) || va ( e ) ; O ( "changed" , k ) ; Va ( ) ; b . clipBoard = k } ; this . copySelectedElements = function ( ) { b . clipBoard = $ . merge ( [ ] , I ) } ; this . pasteElements = function ( ) { var e = b . clipBoard , h = e . length ; if ( h ) { for ( var k = [ ] , w = new Ha ( "Paste elements" ) ; h -- ; ) { var v = e [ h ] ; if ( v ) { var F = ga ( v ) ; if ( ! sa ( v . id ) ) F . id = v . id ; k . push ( F ) ; ( M || B ( ) . getCurrentLayer ( ) ) . appendChild ( F ) ; w . addSubCommand ( new Ca ( F ) ) } } svgCanvas . clearSelection ( ) ; setTimeout ( function ( ) { Eb ( k ) } ,
100 ) ; va ( w ) ; O ( "changed" , k ) } } ; this . groupSelectedElements = function ( e ) { e || ( e = "g" ) ; var h = "" ; switch ( e ) { case "a" : h = "Make hyperlink" ; var k = "" ; if ( arguments . length > 1 ) k = arguments [ 1 ] ; break ; default : e = "g" ; h = "Group Elements" } h = new Ha ( h ) ; var w = V ( { element : e , attr : { id : S ( ) } } ) ; e === "a" && aa ( w , k ) ; h . addSubCommand ( new Ca ( w ) ) ; for ( k = I . length ; k -- ; ) { var v = I [ k ] ; if ( v != null ) { if ( v . parentNode . tagName === "a" && v . parentNode . childNodes . length === 1 ) v = v . parentNode ; var F = v . nextSibling , z = v . parentNode ; w . appendChild ( v ) ; h . addSubCommand ( new Ja ( v ,
F , z ) ) } } h . isEmpty ( ) || va ( h ) ; Eb ( [ w ] , true ) } ; var Fb = this . pushGroupProperties = function ( e , h ) { var k = e . childNodes , w = k . length , v = e . getAttribute ( "transform" ) , F = ca ( e ) , z = X ( F ) . matrix , u = new Ha ( "Push group properties" ) , D = 0 , H = la ( e ) , C = $ ( e ) . attr ( [ "filter" , "opacity" ] ) , E , K ; for ( D = 0 ; D < w ; D ++ ) { var L = k [ D ] ; if ( L . nodeType === 1 ) { if ( C . opacity !== null && C . opacity !== 1 ) { L . getAttribute ( "opacity" ) ; var Y = Math . round ( ( L . getAttribute ( "opacity" ) || 1 ) * C . opacity * 100 ) / 100 ; jb ( "opacity" , Y , [ L ] ) } if ( C . filter ) { var n = Y = this . getBlur ( L ) ; K || ( K = this . getBlur ( e ) ) ;
if ( Y ) Y = K - 0 + ( Y - 0 ) ; else if ( Y === 0 ) Y = K ; if ( n ) E = fa ( L . getAttribute ( "filter" ) ) ; else if ( E ) { E = ga ( E ) ; sb ( ) . appendChild ( E ) } else E = fa ( C . filter ) ; E . id = L . id + "_" + ( E . firstChild . tagName === "feGaussianBlur" ? "blur" : "filter" ) ; jb ( "filter" , "url(#" + E . id + ")" , [ L ] ) ; if ( Y ) { jb ( "stdDeviation" , Y , [ E . firstChild ] ) ; b . setBlurOffsets ( E , Y ) } } Y = ca ( L ) ; if ( ~ L . tagName . indexOf ( "Gradient" ) ) Y = null ; if ( Y ) if ( L . tagName !== "defs" ) if ( F . numberOfItems ) { if ( H && F . numberOfItems == 1 ) { var A = F . getItem ( 0 ) . matrix , G = d . createSVGMatrix ( ) ; if ( n = la ( L ) ) G = Y . getItem ( 0 ) . matrix ;
var N = svgedit . utilities . getBBox ( L ) , J = X ( Y ) . matrix , T = Q ( N . x + N . width / 2 , N . y + N . height / 2 , J ) ; N = H + n ; J = d . createSVGTransform ( ) ; J . setRotate ( N , T . x , T . y ) ; A = W ( A , G , J . matrix . inverse ( ) ) ; n && Y . removeItem ( 0 ) ; if ( N ) Y . numberOfItems ? Y . insertItemBefore ( J , 0 ) : Y . appendItem ( J ) ; if ( A . e || A . f ) { n = d . createSVGTransform ( ) ; n . setTranslate ( A . e , A . f ) ; Y . numberOfItems ? Y . insertItemBefore ( n , 0 ) : Y . appendItem ( n ) } } else { n = L . getAttribute ( "transform" ) ; A = { } ; A . transform = n ? n : "" ; n = d . createSVGTransform ( ) ; A = X ( Y ) . matrix ; G = A . inverse ( ) ; A = W ( G , z , A ) ; n . setMatrix ( A ) ;
Y . appendItem ( n ) } ( L = hb ( L ) ) && u . addSubCommand ( L ) } } } if ( v ) { A = { } ; A . transform = v ; e . setAttribute ( "transform" , "" ) ; e . removeAttribute ( "transform" ) ; u . addSubCommand ( new Na ( e , A ) ) } if ( h && ! u . isEmpty ( ) ) return u } ; this . ungroupSelectedElement = function ( ) { var e = I [ 0 ] ; if ( $ ( e ) . data ( "gsvg" ) || $ ( e ) . data ( "symbol" ) ) Ib ( e ) ; else if ( e . tagName === "use" ) { var h = sa ( ea ( e ) . substr ( 1 ) ) ; $ ( e ) . data ( "symbol" , h ) . data ( "ref" , h ) ; Ib ( e ) } else { h = $ ( e ) . parents ( "a" ) ; if ( h . length ) e = h [ 0 ] ; if ( e . tagName === "g" || e . tagName === "a" ) { h = new Ha ( "Ungroup Elements" ) ; var k =
Fb ( e , true ) ; k && h . addSubCommand ( k ) ; k = e . parentNode ; for ( var w = e . nextSibling , v = Array ( e . childNodes . length ) , F = 0 ; e . firstChild ; ) { var z = e . firstChild , u = z . nextSibling , D = z . parentNode ; if ( z . tagName === "title" ) { h . addSubCommand ( new La ( z , z . nextSibling , D ) ) ; D . removeChild ( z ) } else { v [ F ++ ] = z = k . insertBefore ( z , w ) ; h . addSubCommand ( new Ja ( z , u , D ) ) } } Va ( ) ; w = e . nextSibling ; e = k . removeChild ( e ) ; h . addSubCommand ( new La ( e , w , k ) ) ; h . isEmpty ( ) || va ( h ) ; yb ( v ) } } } ; this . moveToTopSelectedElement = function ( ) { var e = I [ 0 ] ; if ( e != null ) { e = e ; var h = e . parentNode ,
k = e . nextSibling ; e = e . parentNode . appendChild ( e ) ; if ( k != e . nextSibling ) { va ( new Ja ( e , k , h , "top" ) ) ; O ( "changed" , [ e ] ) } } } ; this . moveToBottomSelectedElement = function ( ) { var e = I [ 0 ] ; if ( e != null ) { e = e ; var h = e . parentNode , k = e . nextSibling , w = e . parentNode . firstChild ; if ( w . tagName == "title" ) w = w . nextSibling ; if ( w . tagName == "defs" ) w = w . nextSibling ; e = e . parentNode . insertBefore ( e , w ) ; if ( k != e . nextSibling ) { va ( new Ja ( e , k , h , "bottom" ) ) ; O ( "changed" , [ e ] ) } } } ; this . moveUpDownSelected = function ( e ) { var h = I [ 0 ] ; if ( h ) { bb = [ ] ; var k , w , v = $ ( Ab ( getStrokedBBox ( [ h ] ) ) ) . toArray ( ) ;
e == "Down" && v . reverse ( ) ; $ . each ( v , function ( ) { if ( w ) { k = this ; return false } else if ( this == h ) w = true } ) ; if ( k ) { v = h . parentNode ; var F = h . nextSibling ; $ ( k ) [ e == "Down" ? "before" : "after" ] ( h ) ; if ( F != h . nextSibling ) { va ( new Ja ( h , F , v , "Move " + e ) ) ; O ( "changed" , [ h ] ) } } } } ; this . moveSelectedElements = function ( e , h , k ) { if ( e . constructor != Array ) { e /= q ; h /= q } k = k || true ; for ( var w = new Ha ( "position" ) , v = I . length ; v -- ; ) { var F = I [ v ] ; if ( F != null ) { var z = d . createSVGTransform ( ) , u = ca ( F ) ; e . constructor == Array ? z . setTranslate ( e [ v ] , h [ v ] ) : z . setTranslate ( e , h ) ;
u . numberOfItems ? u . insertItemBefore ( z , 0 ) : u . appendItem ( z ) ; ( z = hb ( F ) ) && w . addSubCommand ( z ) ; Fa . requestSelector ( F ) . resize ( ) } } if ( ! w . isEmpty ( ) ) { k && va ( w ) ; O ( "changed" , I ) ; return w } } ; this . cloneSelectedElements = function ( e , h , k ) { for ( var w = new Ha ( "Clone Elements" ) , v = I . length , F = 0 ; F < v ; ++ F ) if ( I [ F ] == null ) break ; v = I . slice ( 0 , F ) ; this . clearSelection ( true ) ; for ( F = v . length ; F -- ; ) { var z = ga ( v [ F ] ) ; k && z . removeAttribute ( "transform" ) ; ( M || B ( ) . getCurrentLayer ( ) ) . appendChild ( z ) ; w . addSubCommand ( new Ca ( z ) ) } if ( ! w . isEmpty ( ) ) { yb ( v . reverse ( ) ) ;
this . moveSelectedElements ( e , h , false ) ; va ( w ) } return z } ; this . alignSelectedElements = function ( e , h ) { var k = [ ] , w = Number . MAX _VALUE , v = Number . MIN _VALUE , F = Number . MAX _VALUE , z = Number . MIN _VALUE , u = Number . MIN _VALUE , D = Number . MIN _VALUE , H = I . length ; if ( H ) { for ( var C = 0 ; C < H ; ++ C ) { if ( I [ C ] == null ) break ; k [ C ] = getStrokedBBox ( [ I [ C ] ] ) ; switch ( h ) { case "smallest" : if ( ( e == "l" || e == "c" || e == "r" ) && ( u == Number . MIN _VALUE || u > k [ C ] . width ) || ( e == "t" || e == "m" || e == "b" ) && ( D == Number . MIN _VALUE || D > k [ C ] . height ) ) { w = k [ C ] . x ; F = k [ C ] . y ; v = k [ C ] . x + k [ C ] . width ; z = k [ C ] . y +
k [ C ] . height ; u = k [ C ] . width ; D = k [ C ] . height } break ; case "largest" : if ( ( e == "l" || e == "c" || e == "r" ) && ( u == Number . MIN _VALUE || u < k [ C ] . width ) || ( e == "t" || e == "m" || e == "b" ) && ( D == Number . MIN _VALUE || D < k [ C ] . height ) ) { w = k [ C ] . x ; F = k [ C ] . y ; v = k [ C ] . x + k [ C ] . width ; z = k [ C ] . y + k [ C ] . height ; u = k [ C ] . width ; D = k [ C ] . height } break ; default : if ( k [ C ] . x < w ) w = k [ C ] . x ; if ( k [ C ] . y < F ) F = k [ C ] . y ; if ( k [ C ] . x + k [ C ] . width > v ) v = k [ C ] . x + k [ C ] . width ; if ( k [ C ] . y + k [ C ] . height > z ) z = k [ C ] . y + k [ C ] . height } } if ( h == "page" ) { F = w = 0 ; v = b . contentW ; z = b . contentH } u = Array ( H ) ; D = Array ( H ) ; for ( C = 0 ; C < H ; ++ C ) { if ( I [ C ] ==
null ) break ; var E = k [ C ] ; u [ C ] = 0 ; D [ C ] = 0 ; switch ( e ) { case "l" : u [ C ] = w - E . x ; break ; case "c" : u [ C ] = ( w + v ) / 2 - ( E . x + E . width / 2 ) ; break ; case "r" : u [ C ] = v - ( E . x + E . width ) ; break ; case "t" : D [ C ] = F - E . y ; break ; case "m" : D [ C ] = ( F + z ) / 2 - ( E . y + E . height / 2 ) ; break ; case "b" : D [ C ] = z - ( E . y + E . height ) } } this . moveSelectedElements ( u , D ) } } ; this . contentW = Hb ( ) . w ; this . contentH = Hb ( ) . h ; this . updateCanvas = function ( e , h ) { d . setAttribute ( "width" , e ) ; d . setAttribute ( "height" , h ) ; var k = $ ( "#canvasBackground" ) [ 0 ] , w = l . getAttribute ( "x" ) , v = l . getAttribute ( "y" ) , F = e / 2 - this . contentW *
q / 2 , z = h / 2 - this . contentH * q / 2 ; na ( l , { width : this . contentW * q , height : this . contentH * q , x : F , y : z , viewBox : "0 0 " + this . contentW + " " + this . contentH } ) ; na ( k , { width : l . getAttribute ( "width" ) , height : l . getAttribute ( "height" ) , x : F , y : z } ) ; ( k = sa ( "background_image" ) ) && na ( k , { width : "100%" , height : "100%" } ) ; Fa . selectorParentGroup . setAttribute ( "transform" , "translate(" + F + "," + z + ")" ) ; return { x : F , y : z , old _x : w , old _y : v , d _x : F - w , d _y : z - v } } ; this . setBackground = function ( e , h ) { var k = sa ( "canvasBackground" ) , w = $ ( k ) . find ( "rect" ) [ 0 ] , v = sa ( "background_image" ) ;
w . setAttribute ( "fill" , e ) ; if ( h ) { if ( ! v ) { v = f . createElementNS ( c , "image" ) ; na ( v , { id : "background_image" , width : "100%" , height : "100%" , preserveAspectRatio : "xMinYMin" , style : "pointer-events:none" } ) } aa ( v , h ) ; k . appendChild ( v ) } else v && v . parentNode . removeChild ( v ) } ; this . cycleElement = function ( e ) { var h = I [ 0 ] , k = false , w = wb ( M || B ( ) . getCurrentLayer ( ) ) ; if ( w . length ) { if ( h == null ) { e = e ? w . length - 1 : 0 ; k = w [ e ] } else for ( var v = w . length ; v -- ; ) if ( w [ v ] == h ) { e = e ? v - 1 : v + 1 ; if ( e >= w . length ) e = 0 ; else if ( e < 0 ) e = w . length - 1 ; k = w [ e ] ; break } Eb ( [ k ] , true ) ; O ( "selected" ,
I ) } } ; this . clear ( ) ; this . getPrivateMethods = function ( ) { return { addCommandToHistory : va , setGradient : Pb , addSvgElementFromJson : V , assignAttributes : na , BatchCommand : Ha , call : O , ChangeElementCommand : Na , copyElem : ga , ffClone : Ia , findDefs : sb , findDuplicateGradient : Tb , getElem : sa , getId : qa , getIntersectionList : Ab , getMouseTarget : Mb , getNextId : S , getPathBBox : Z , getUrlFromAttr : ja , hasMatrixTransform : ha , identifyLayers : Jb , InsertElementCommand : Ca , isIdentity : svgedit . math . isIdentity , logMatrix : kb , matrixMultiply : W , MoveElementCommand : Ja ,
preventClickDefault : tb , recalculateAllSelectedDimensions : Qa , recalculateDimensions : hb , remapElement : mb , RemoveElementCommand : La , removeUnusedDefElems : Ob , round : rb , runExtensions : eb , sanitizeSvg : Ga , SVGEditTransformList : svgedit . transformlist . SVGTransformList , toString : toString , transformBox : svgedit . math . transformBox , transformListToTransform : X , transformPoint : Q , walkTree : svgedit . utilities . walkTree } } } ; ( function ( ) { document . addEventListener ( "touchstart" , touchHandler , true ) ; document . addEventListener ( "touchmove" , touchHandler , true ) ; document . addEventListener ( "touchend" , touchHandler , true ) ; document . addEventListener ( "touchcancel" , touchHandler , true ) ; if ( ! window . svgEditor ) window . svgEditor = function ( a ) { function o ( d , l ) { var p = g . setSvgString ( d ) !== false ; l = l || a . noop ; p ? l ( true ) : a . alert ( uiStrings . notification . errorLoadingSVG , function ( ) { l ( false ) } ) } var g , c = { } , m = 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 : "Sans-serif" } ; uiStrings = c . uiStrings = { common : { ok : "OK" , cancel : "Cancel" , key _up : "Up" , key _down : "Down" ,
2012-07-19 14:54:50 +00:00
key _backspace : "Backspace" , key _del : "Del" } , layers : { layer : "Layer" } , notification : { invalidAttrValGiven : "Invalid value given" , noContentToFitTo : "No content to fit to" , dupeLayerName : "There is already a layer named that!" , enterUniqueLayerName : "Please enter a unique layer name" , enterNewLayerName : "Please enter the new layer name" , layerHasThatName : "Layer already has that name" , QmoveElemsToLayer : 'Move selected elements to layer "%s"?' , QwantToClear : "Do you want to clear the drawing?\nThis will also erase your undo history!" ,
QwantToOpen : "Do you want to open a new file?\nThis will also erase your undo history!" , QerrorsRevertToSource : "There were parsing errors in your SVG source.\nRevert back to original SVG source?" , QignoreSourceChanges : "Ignore changes made to SVG source?" , featNotSupported : "Feature not supported" , enterNewImgURL : "Enter the new image URL" , defsFailOnSave : "NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved." , loadingImage : "Loading image, please wait..." ,
2012-07-24 12:42:34 +00:00
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 = { } , b = { } ; c . curConfig = curConfig ; c . tool _scale = 1 ; c . setConfig = function ( d ) { a . each ( d , function ( l , p ) { l in defaultPrefs && a . pref ( l , p ) } ) ; a . extend ( true , curConfig ,
d ) ; if ( d . extensions ) curConfig . extensions = d . extensions } ; c . setCustomHandlers = function ( d ) { c . ready ( function ( ) { if ( d . open ) { a ( '#tool_open > input[type="file"]' ) . remove ( ) ; a ( "#tool_open" ) . show ( ) ; g . open = d . open } if ( d . save ) { c . show _save _warning = false ; g . bind ( "saved" , d . save ) } d . pngsave && g . bind ( "exported" , d . pngsave ) ; b = d } ) } ; c . randomizeIds = function ( ) { g . randomizeIds ( arguments ) } ; c . init = function ( ) { function d ( n , A ) { var G = n . id , N = G . split ( "_" ) , J = N [ 0 ] ; N = N [ 1 ] ; A && g . setStrokeAttr ( "stroke-" + J , N ) ; vb ( ) ; Fb ( "#cur_" + J , G , 20 ) ; a ( n ) . addClass ( "current" ) . siblings ( ) . removeClass ( "current" ) }
function l ( n , A ) { var G = document . getElementById ( "ruler_x_cursor" ) , N = document . getElementById ( "ruler_y_cursor" ) , J = document . getElementById ( "workarea" ) ; document . getElementById ( "title_show" ) ; svgedit . browser . isTouch ( ) && a ( "#workarea" ) . unbind ( "mousemove.rulers" ) . bind ( "mousemove.rulers" , function ( Vb ) { Vb . stopPropagation ( ) ; G . style . left = Vb . pageX - 66 + J . scrollLeft + "px" ; N . style . top = Vb . pageY - 48 + J . scrollTop + "px" } ) ; A || ( A = g . getZoom ( ) ) ; n || ( n = a ( "#svgcanvas" ) ) ; for ( var T = g . getContentElem ( ) , da = svgedit . units . getTypeMap ( ) [ curConfig . baseUnit ] ,
ia = 0 ; ia < 2 ; ia ++ ) { var pa = ia === 0 , ra = pa ? "x" : "y" , ua = pa ? "width" : "height" , Ra = T . getAttribute ( ra ) - 0 ; ra = a ( "#ruler_" + ra + " canvas:first" ) ; $hcanv = ra . clone ( ) ; ra . replaceWith ( $hcanv ) ; var Da = $hcanv [ 0 ] ; var ka = ra = n [ ua ] ( ) * 2 ; Da . parentNode . style [ ua ] = ka + "px" ; var lb = 0 , Wa , wa = Da . getContext ( "2d" ) ; wa . fillStyle = "rgb(200,0,0)" ; wa . fillRect ( 0 , 0 , Da . width , Da . height ) ; $hcanv . siblings ( ) . remove ( ) ; if ( ra >= 3E4 ) { var Pa = parseInt ( ra / 3E4 ) + 1 ; Wa = Array ( Pa ) ; Wa [ 0 ] = wa ; for ( var xa = 1 ; xa < Pa ; xa ++ ) { Da [ ua ] = 3E4 ; var ab = Da . cloneNode ( true ) ; Da . parentNode . appendChild ( ab ) ;
Wa [ xa ] = ab . getContext ( "2d" ) } ab [ ua ] = ra % 3E4 ; ra = 3E4 } Da [ ua ] = ra ; ua = da * A ; var Xa = 50 / ua ; Da = 1 ; for ( xa = 0 ; xa < E . length ; xa ++ ) { Da = Pa = E [ xa ] ; if ( Xa <= Pa ) break } Xa = Da * ua ; wa . font = "normal 9px 'Lucida Grande', sans-serif" ; wa . fillStyle = "#777" ; for ( var db = Ra / ua % Da * ua , Lb = db - Xa ; db < ka ; db += Xa ) { Lb += Xa ; xa = Math . round ( db ) + 0.5 ; if ( pa ) { wa . moveTo ( xa , 15 ) ; wa . lineTo ( xa , 0 ) } else { wa . moveTo ( 15 , xa ) ; wa . lineTo ( 0 , xa ) } Pa = ( Lb - Ra ) / ua ; if ( Da >= 1 ) xa = Math . round ( Pa ) ; else { xa = ( Da + "" ) . split ( "." ) [ 1 ] . length ; xa = Pa . toFixed ( xa ) - 0 } if ( xa !== 0 && xa !== 1E3 && xa % 1E3 === 0 ) xa =
xa / 1E3 + "K" ; if ( pa ) { wa . fillText ( xa , db + 2 , 8 ) ; wa . fillStyle = "#777" } else { Pa = ( xa + "" ) . split ( "" ) ; for ( xa = 0 ; xa < Pa . length ; xa ++ ) { wa . fillText ( Pa [ xa ] , 1 , db + 9 + xa * 9 ) ; wa . fillStyle = "#777" } } Pa = Xa / 10 ; for ( xa = 1 ; xa < 10 ; xa ++ ) { var Cb = Math . round ( db + Pa * xa ) + 0.5 ; if ( Wa && Cb > ra ) { lb ++ ; wa . stroke ( ) ; if ( lb >= Wa . length ) { xa = 10 ; db = ka ; continue } wa = Wa [ lb ] ; db -= 3E4 ; Cb = Math . round ( db + Pa * xa ) + 0.5 } var Kb = xa % 2 ? 12 : 10 ; if ( pa ) { wa . moveTo ( Cb , 15 ) ; wa . lineTo ( Cb , Kb ) } else { wa . moveTo ( 15 , Cb ) ; wa . lineTo ( Kb , Cb ) } } } wa . strokeStyle = "#666" ; wa . stroke ( ) } } ( function ( ) { var n = window . opener ;
if ( n ) try { var A = n . document . createEvent ( "Event" ) ; A . initEvent ( "svgEditorReady" , true , true ) ; n . document . documentElement . dispatchEvent ( A ) } catch ( G ) { } } ) ( ) ; ( function ( ) { a ( "#canvas_width" ) . val ( curConfig . dimensions [ 0 ] ) ; a ( "#canvas_height" ) . val ( curConfig . dimensions [ 1 ] ) ; a ( "body" ) . toggleClass ( "touch" , svgedit . browser . isTouch ( ) ) ; var n = a . deparam . querystring ( true ) ; if ( ! a . isEmptyObject ( n ) ) { if ( n . dimensions ) n . dimensions = n . dimensions . split ( "," ) ; if ( n . extensions ) n . extensions = n . extensions . split ( "," ) ; if ( n . bkgd _color ) n . bkgd _color =
"#" + n . bkgd _color ; svgEditor . setConfig ( n ) ; var A = n . source , G = a . param . querystring ( ) ; if ( ! A ) if ( G . indexOf ( "source=data:" ) >= 0 ) A = G . match ( /source=(data:[^&]*)/ ) [ 1 ] ; if ( A ) if ( A . indexOf ( "data:" ) === 0 ) { A = A . replace ( / /g , "+" ) ; c . loadFromDataURI ( A ) } else c . loadFromString ( A ) ; else if ( G . indexOf ( "paramurl=" ) !== - 1 ) svgEditor . loadFromURL ( G . substr ( 9 ) ) ; else n . url && svgEditor . loadFromURL ( n . url ) } } ) ( ) ; var p = function ( ) { a . each ( curConfig . extensions , function ( ) { var n = this ; a . getScript ( curConfig . extPath + n , function ( A ) { if ( ! A ) { A = document . createElement ( "script" ) ;
A . src = curConfig . extPath + n ; document . querySelector ( "head" ) . appendChild ( A ) } } ) } ) } ; document . location . protocol === "file:" ? setTimeout ( p , 100 ) : p ( ) ; a . svgIcons ( curConfig . imgPath + "svg_edit_icons.svg" , { w : 27 , h : 27 , id _match : false , no _img : ! svgedit . browser . isWebkit ( ) , fallback _path : curConfig . imgPath , fallback : { logo : "logo.png" , select : "select.png" , select _node : "select_node.png" , pencil : "fhpath.png" , pen : "line.png" , square : "square.png" , rect : "rect.png" , fh _rect : "freehand-square.png" , circle : "circle.png" , ellipse : "ellipse.png" , fh _ellipse : "freehand-circle.png" ,
2012-07-24 02:30:12 +00:00
path : "path.png" , text : "text.png" , image : "image.png" , zoom : "zoom.png" , "delete" : "delete.png" , node _delete : "node_delete.png" , align _left : "align-left.png" , align _center : "align-center" , align _right : "align-right" , align _top : "align-top" , align _middle : "align-middle" , align _bottom : "align-bottom" , 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_square" : "square" , "#tool_fhrect" : "fh_rect" ,
"#tool_ellipse,#tools_ellipse_show" : "ellipse" , "#tool_circle" : "circle" , "#tool_fhellipse" : "fh_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" , "#palette .palette_item:first, #fill_bg, #stroke_bg" : "no_color" } , resize : { "#logo .svg_icon" : 15 , ".flyout_arrow_horiz .svg_icon" : 5 , ".layer_button .svg_icon, #layerlist td.layervis .svg_icon" : 14 , "#main_button .dropdown .svg_icon" : 9 , "#fill_bg .svg_icon, #stroke_bg .svg_icon" : svgedit . browser . isTouch ( ) ? 36 : 24 , ".palette_item:first .svg_icon" : svgedit . browser . isTouch ( ) ?
2012-07-24 12:42:34 +00:00
30 : 16 , ".toolbar_button button .svg_icon" : 16 , ".stroke_tool div div .svg_icon" : 20 , "#tools_bottom label .svg_icon" : 18 , "#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 n = a ( "#tools_left" ) ; if ( n . length != 0 ) { n . offset ( ) ; n . outerHeight ( ) } a ( ".tools_flyout" ) . each ( function ( ) { var A = a ( "#" + this . id + "_show" ) , G = A . attr ( "data-curopt" ) ; if ( ! A . children ( "svg, img" ) . length ) { G =
a ( G ) . children ( ) . clone ( ) ; if ( G . length ) { G [ 0 ] . removeAttribute ( "style" ) ; A . append ( G ) } } } ) ; svgEditor . runCallbacks ( ) ; setTimeout ( function ( ) { a ( ".flyout_arrow_horiz:empty" ) . each ( function ( ) { a ( this ) . append ( a . getSvgIcon ( "arrow_right" ) . width ( 5 ) . height ( 5 ) ) } ) } , 1 ) } } ) ; a ( "#rulers" ) . on ( "dblclick" , function ( n ) { a ( "#base_unit_container" ) . css ( { top : n . pageY - 10 , left : n . 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 ( ) } ) ; c . canvas = g = new a . SvgCanvas ( document . getElementById ( "svgcanvas" ) , curConfig ) ; c . show _save _warning = false ; c . paintBox = { fill : null , stroke : null , canvas : null } ; p = navigator . platform . indexOf ( "Mac" ) >= 0 ; var B = navigator . userAgent . indexOf ( "AppleWebKit" ) >= 0 , q = p ? "meta+" : "ctrl+" , M = g . pathActions , U = g . undoMgr , P = svgedit . utilities , I = curConfig . imgPath + "placeholder.svg" , V = a ( "#workarea" ) , ca = null , Q = 1 , W = "toolbars" , ha = "" ; p || a ( ".shortcut" ) . each ( function ( ) { var n =
a ( this ) . text ( ) ; a ( this ) . text ( n . split ( "\u2318" ) . join ( "Ctrl+" ) ) } ) ; ( function ( ) { a ( "#dialog_container" ) . draggable ( { cancel : "#dialog_content, #dialog_buttons *" , containment : "window" } ) ; var n = a ( "#dialog_box" ) , A = a ( "#dialog_buttons" ) , G = function ( N , J , T , da ) { a ( "#dialog_content" ) . html ( "<p>" + J . replace ( /\n/g , "</p><p>" ) + "</p>" ) . toggleClass ( "prompt" , N == "prompt" ) ; A . empty ( ) ; var ia = a ( '<input type="button" value="' + uiStrings . common . ok + '">' ) . appendTo ( A ) ; N != "alert" && a ( '<input type="button" value="' + uiStrings . common . cancel +
'">' ) . appendTo ( A ) . on ( "click, touchstart" , function ( ) { n . hide ( ) ; T ( false ) } ) ; if ( N == "prompt" ) { var pa = a ( '<input type="text">' ) . prependTo ( A ) ; pa . val ( da || "" ) ; pa . bind ( "keydown" , "return" , function ( ) { ia . trigger ( "click touchstart" ) } ) } N == "process" && ia . hide ( ) ; n . show ( ) ; ia . on ( "click touchstart" , function ( ) { n . hide ( ) ; var ra = N == "prompt" ? pa . val ( ) : true ; T && T ( ra ) } ) . focus ( ) ; N == "prompt" && pa . focus ( ) } ; a . alert = function ( N , J ) { G ( "alert" , N , J ) } ; a . confirm = function ( N , J ) { G ( "confirm" , N , J ) } ; a . process _cancel = function ( N , J ) { G ( "process" , N , J ) } ;
a . prompt = function ( N , J , T ) { G ( "prompt" , N , T , J ) } } ) ( ) ; var X = function ( ) { var n = a ( ".tool_button_current" ) ; if ( n . length && n [ 0 ] . id !== "tool_select" ) { n . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( "#tool_select" ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) } g . setMode ( "select" ) } , R = null , ba = false , ta = false , ja = "" , ea = a ( "title:first" ) . text ( ) , aa = function ( n , A ) { var G = g . getResolution ( ) ; a ( "#svgcanvas" ) . position ( ) ; var N = g . setBBoxZoom ( A , V . width ( ) - 15 , V . height ( ) - 15 ) ; if ( N ) { var J = N . zoom ; N = N . bbox ; if ( J <
0.0010 ) Aa ( { value : 0.1 } ) ; else { var T = Date . now ( ) , da = J - G . zoom ; a ( "#zoom" ) ; var ia = G . zoom ; console . log ( da ) ; var pa = function ( ra ) { ra = ( ra - T ) / 500 ; ra = Math . pow ( ra - 1 , 3 ) + 1 ; g . setZoom ( ia + da * ra ) ; C ( ) ; ra < 1 ? requestAnimationFrame ( pa ) : a ( "#zoom" ) . val ( J * 100 ) } ; pa ( Date . now ( ) ) ; g . getMode ( ) == "zoom" && N . width && X ( ) ; Pb ( ) } } } ; a ( "#cur_context_panel" ) . delegate ( "a" , "click" , function ( ) { var n = a ( this ) ; n . attr ( "data-root" ) ? g . leaveContext ( ) : g . setContext ( n . text ( ) ) ; return false } ) ; var Z = function ( ) { c . paintBox . fill . prep ( ) ; c . paintBox . stroke . prep ( ) } , la =
{ } , sa = function ( n ) { a . each ( n , function ( A , G ) { var N = a ( A ) . children ( ) , J = A + "_show" , T = a ( J ) , da = false ; N . addClass ( "tool_button" ) . unbind ( "click mousedown mouseup" ) . each ( function ( ra ) { var ua = G [ ra ] ; la [ ua . sel ] = ua . fn ; if ( ua . isDefault ) da = ra ; ra = function ( Ra ) { var Da = ua ; if ( Ra . type === "keydown" ) { var ka = a ( Da . parent + "_show" ) . hasClass ( "tool_button_current" ) , lb = a ( Da . parent + "_show" ) . attr ( "data-curopt" ) ; a . each ( n [ ua . parent ] , function ( wa , Pa ) { if ( Pa . sel == lb ) Da = ! Ra . shiftKey || ! ka ? Pa : n [ ua . parent ] [ wa + 1 ] || n [ ua . parent ] [ 0 ] } ) } if ( a ( this ) . hasClass ( "disabled" ) ) return false ;
Ua ( J ) && Da . fn ( ) ; var Wa = Da . icon ? a . getSvgIcon ( Da . icon , true ) : a ( Da . sel ) . children ( ) . eq ( 0 ) . clone ( ) ; Wa [ 0 ] . setAttribute ( "width" , T . width ( ) ) ; Wa [ 0 ] . setAttribute ( "height" , T . height ( ) ) ; T . children ( ":not(.flyout_arrow_horiz)" ) . remove ( ) ; T . append ( Wa ) . attr ( "data-curopt" , Da . sel ) } ; a ( this ) . mouseup ( ra ) ; ua . key && a ( document ) . bind ( "keydown" , ua . key [ 0 ] + " shift+" + ua . key [ 0 ] , ra ) } ) ; if ( da ) T . attr ( "data-curopt" , G [ da ] . sel ) ; else T . attr ( "data-curopt" ) || T . attr ( "data-curopt" , G [ 0 ] . sel ) ; var ia , pa = a ( J ) . position ( ) ; a ( A ) . css ( { left : pa . left + 34 , top : pa . top +
77 } ) ; T . mousedown ( function ( ra ) { a ( "#tools_shapelib" ) . is ( ":visible" ) && Ua ( J , false ) ; if ( T . hasClass ( "disabled" ) ) return false ; var ua = a ( A ) , Ra = pa . left + 34 , Da = ua . width ( ) * - 1 , ka = ua . data ( "shown_popop" ) ? 200 : 0 ; ia = setTimeout ( function ( ) { T . data ( "isLibrary" ) ? ua . css ( "left" , Ra ) . show ( ) : ua . css ( "left" , Da ) . show ( ) . animate ( { left : Ra } , 150 ) ; ua . data ( "shown_popop" , true ) } , ka ) ; ra . preventDefault ( ) } ) . mouseup ( function ( ) { clearTimeout ( ia ) ; var ra = a ( this ) . attr ( "data-curopt" ) ; if ( T . data ( "isLibrary" ) && a ( J . replace ( "_show" , "" ) ) . is ( ":visible" ) ) Ua ( J ,
true ) ; else Ua ( J ) && ra in la && la [ ra ] ( ) } ) } ) ; Ba ( ) } , na = function ( n , A ) { return a ( "<div>" , { "class" : "tools_flyout" , id : n } ) . appendTo ( "#svg_editor" ) . append ( A ) } , oa = function ( ) { a ( ".tools_flyout" ) . each ( function ( ) { var n = a ( "#" + this . id + "_show" ) , A = n . offset ( ) ; n = n . outerWidth ( ) ; a ( this ) . css ( { left : ( A . left + n ) * Q , top : A . top } ) } ) } , Ba = function ( ) { a ( ".tools_flyout" ) . each ( function ( ) { var n = a ( "#" + this . id + "_show" ) ; if ( ! n . data ( "isLibrary" ) ) { var A = [ ] ; a ( this ) . children ( ) . each ( function ( ) { A . push ( this . title ) } ) ; n [ 0 ] . title = A . join ( " / " ) } } ) } , Ga ,
Ja = function ( n , A , G ) { var N = null ; if ( n . indexOf ( "url(#" ) === 0 ) { n = ( n = g . getRefElem ( n ) ) ? n . cloneNode ( true ) : a ( "#" + G + "_color defs *" ) [ 0 ] ; N = { alpha : A } ; N [ n . tagName ] = n } else N = n . indexOf ( "#" ) === 0 ? { alpha : A , solidColor : n . substr ( 1 ) } : { alpha : A , solidColor : "none" } ; return new a . jGraduate . Paint ( N ) } , Ca = g . getResolution ( ) ; if ( curConfig . baseUnit !== "px" ) { Ca . w = svgedit . units . convertUnit ( Ca . w ) + curConfig . baseUnit ; Ca . h = svgedit . units . convertUnit ( Ca . h ) + curConfig . baseUnit } var La = function ( n ) { g . createLayer ( "background" ) ; cur _shape = g . addSvgElementFromJson ( { element : "rect" ,
attr : { x : - 1 , y : - 1 , width : Ca . w + 2 , height : Ca . h + 2 , stroke : "none" , id : "canvas_background" , opacity : 1 , fill : n || "#fff" , style : "pointer-events:none" } } ) ; g . setCurrentLayer ( "Layer 1" ) ; g . setCurrentLayerPosition ( "1" ) } ; document . getElementById ( "canvas_background" ) || La ( ) ; document . getElementById ( "canvas_background" ) . getAttribute ( "fill" ) ; var Na = c . setImageURL = function ( n ) { n || ( n = I ) ; g . setImageURL ( n ) ; a ( "#image_url" ) . val ( n ) } , Ha = function ( n ) { var A = Math . min ( Math . max ( 12 + n . value . length * 6 , 50 ) , 300 ) ; a ( n ) . width ( A ) } , va = function ( ) { var n = R ;
if ( n != null && ! n . parentNode ) n = null ; g . getCurrentDrawing ( ) . getCurrentLayerName ( ) ; var A = g . getMode ( ) , G = curConfig . baseUnit !== "px" ? curConfig . baseUnit : null , N = A == "pathedit" , J = a ( "#cmenu_canvas li" ) ; a ( "#selected_panel, #multiselected_panel, #g_panel, #path_panel, #rect_panel, #canvas_panel, #circle_panel,\t\t\t\t\t#ellipse_panel, #line_panel, #text_panel, #image_panel, #container_panel, #use_panel, #a_panel" ) . hide ( ) ; a ( ".menu_item" , "#edit_menu" ) . addClass ( "disabled" ) ; a ( ".menu_item" , "#object_menu" ) . addClass ( "disabled" ) ;
! n && ! ba && a ( "#canvas_panel" ) . show ( ) ; if ( n != null ) { var T = n . nodeName , da = g . getRotationAngle ( n ) ; a ( "#angle" ) . val ( Math . round ( da ) ) ; da = g . getBlur ( n ) ; a ( "#blur" ) . val ( da ) ; if ( ! N && A != "pathedit" ) { a ( "#selected_panel" ) . show ( ) ; a ( ".action_selected" ) . removeClass ( "disabled" ) ; var ia , pa ; if ( [ "g" , "polyline" , "path" ] . indexOf ( T ) >= 0 ) if ( A = g . getStrokedBBox ( [ n ] ) ) { ia = A . x ; pa = A . y } if ( G ) { ia = svgedit . units . convertUnit ( ia ) ; pa = svgedit . units . convertUnit ( pa ) } a ( "#" + T + "_x" ) . val ( Math . round ( ia ) ) ; a ( "#" + T + "_y" ) . val ( Math . round ( pa ) ) ; [ "image" , "text" ,
"path" , "g" , "use" ] . indexOf ( T ) == - 1 && a ( ".action_path_convert_selected" ) . removeClass ( "disabled" ) ; T === "path" && a ( ".action_path_selected" ) . removeClass ( "disabled" ) } else { J = M . getNodePoint ( ) ; a ( "#tool_add_subpath" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; a ( "#tool_node_delete" ) . toggleClass ( "disabled" , ! M . canDeleteNodes ) ; Fb ( "#tool_openclose_path" , M . closed _subpath ? "open_path" : "close_path" ) ; if ( J ) { T = a ( "#seg_type" ) ; if ( G ) { J . x = svgedit . units . convertUnit ( J . x ) ; J . y = svgedit . units . convertUnit ( J . y ) } a ( "#path_node_x" ) . val ( Math . round ( J . x ) ) ;
a ( "#path_node_y" ) . val ( Math . round ( J . y ) ) ; J . type ? T . val ( J . type ) . removeAttr ( "disabled" ) : T . val ( 4 ) . attr ( "disabled" , "disabled" ) } return } G = null ; if ( ra === "a" ) { G = g . getHref ( n ) ; a ( "#g_panel" ) . show ( ) } if ( n . parentNode . tagName === "a" ) if ( ! a ( n ) . siblings ( ) . length ) { a ( "#a_panel" ) . show ( ) ; G = g . getHref ( n . parentNode ) } a ( "#tool_make_link, #tool_make_link" ) . toggle ( ! G ) ; G && a ( "#link_url" ) . val ( G ) ; G = { 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 : [ ] } ; var ra = n . tagName ; a ( n ) . data ( "gsvg" ) && a ( "#g_panel" ) . show ( ) ; ra == "path" && a ( "#path_panel" ) . show ( ) ; if ( G [ ra ] ) { G = G [ ra ] ; a ( "#" + ra + "_panel" ) . show ( ) ; ra == "rect" ? a ( "#cornerRadiusLabel" ) . show ( ) : a ( "#cornerRadiusLabel" ) . hide ( ) ; a . each ( G , function ( ua , Ra ) { var Da = n . getAttribute ( Ra ) ; if ( curConfig . baseUnit !== "px" && n [ Ra ] ) Da = svgedit . units . convertUnit ( n [ Ra ] . baseVal . value ) ; var ka = document . getElementById ( ra + "_" + Ra ) ; ka . value = Math . round ( Da ) || 0 ; ka . getAttribute ( "data-cursor" ) === "true" && a . fn . dragInput . updateCursor ( ka ) } ) ;
if ( ra == "text" ) { a ( "#text_panel" ) . css ( "display" , "inline" ) ; g . getItalic ( ) ? a ( "#tool_italic" ) . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) : a ( "#tool_italic" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; g . getBold ( ) ? a ( "#tool_bold" ) . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) : a ( "#tool_bold" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; a ( "#font_family" ) . val ( n . getAttribute ( "font-family" ) ) ; a ( "#font_size" ) . val ( n . getAttribute ( "font-size" ) ) ; a ( "#text" ) . val ( n . textContent ) ;
g . addedNew && setTimeout ( function ( ) { a ( "#text" ) . focus ( ) . select ( ) } , 100 ) } else if ( ra == "image" ) Na ( g . getHref ( n ) ) ; else if ( ra === "g" || ra === "use" ) { a ( "#container_panel" ) . show ( ) ; a ( ".action_group_selected" ) . removeClass ( "disabled" ) ; G = g . getTitle ( ) ; T = a ( "#g_title" ) [ 0 ] ; T . value = G ; Ha ( T ) ; ra == "use" ? T . setAttribute ( "disabled" , "disabled" ) : T . removeAttribute ( "disabled" ) } } J [ ( ra === "g" ? "en" : "dis" ) + "ableContextMenuItems" ] ( "#ungroup" ) ; J [ ( ra === "g" || ! ba ? "dis" : "en" ) + "ableContextMenuItems" ] ( "#group" ) } else if ( ba ) { a ( "#multiselected_panel" ) . show ( ) ;
a ( ".action_multi_selected" ) . removeClass ( "disabled" ) ; J . enableContextMenuItems ( "#group" ) . disableContextMenuItems ( "#ungroup" ) } else J . disableContextMenuItems ( "#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back" ) ; U . getUndoStackSize ( ) > 0 ? a ( "#tool_undo" ) . removeClass ( "disabled" ) : a ( "#tool_undo" ) . addClass ( "disabled" ) ; U . getRedoStackSize ( ) > 0 ? a ( "#tool_redo" ) . removeClass ( "disabled" ) : a ( "#tool_redo" ) . addClass ( "disabled" ) ; g . addedNew = false } ; a ( "#text" ) . focus ( function ( ) { } ) ; a ( "#text" ) . blur ( function ( ) { } ) ;
g . bind ( "selected" , function ( n , A ) { var G = g . getMode ( ) ; G === "select" && X ( ) ; G = G == "pathedit" ; R = A . length == 1 || A [ 1 ] == null ? A [ 0 ] : null ; ba = A . length >= 2 && A [ 1 ] != null ; if ( R != null ) if ( ! G ) { if ( R != null ) switch ( R . tagName ) { case "use" : case "image" : case "foreignObject" : break ; case "g" : case "a" : for ( var N = null , J = R . getElementsByTagName ( "*" ) , T = 0 , da = J . length ; T < da ; T ++ ) { var ia = J [ T ] . getAttribute ( "stroke-width" ) ; if ( T === 0 ) N = ia ; else if ( N !== ia ) N = null } a ( "#stroke_width" ) . val ( N === null ? "" : N ) ; c . paintBox . fill . update ( true ) ; c . paintBox . stroke . update ( true ) ;
break ; default : c . paintBox . fill . update ( true ) ; c . paintBox . stroke . update ( true ) ; a ( "#stroke_width" ) . val ( R . getAttribute ( "stroke-width" ) || 1 ) ; a ( "#stroke_style" ) . val ( R . getAttribute ( "stroke-dasharray" ) || "none" ) ; N = R . getAttribute ( "stroke-linejoin" ) || "miter" ; a ( "#linejoin_" + N ) . length != 0 && d ( a ( "#linejoin_" + N ) [ 0 ] ) ; N = R . getAttribute ( "stroke-linecap" ) || "butt" ; a ( "#linecap_" + N ) . length != 0 && d ( a ( "#linecap_" + N ) [ 0 ] ) } if ( R != null ) { N = ( R . getAttribute ( "opacity" ) || 1 ) * 100 ; a ( "#group_opacity" ) . val ( N ) ; a ( "#opac_slider" ) . slider ( "option" ,
"value" , N ) ; a ( "#elem_id" ) . val ( R . id ) } } a ( "#path_node_panel" ) . toggle ( G ) ; a ( "#tools_bottom_2,#tools_bottom_3" ) . toggle ( ! G ) ; if ( G ) { a ( ".tool_button_current" ) . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( "#tool_select" ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) ; Fb ( "#tool_select" , "select_node" ) ; ba = false ; if ( A . length ) R = A [ 0 ] } else { if ( A [ 0 ] ) { G = g . selectorManager . requestSelector ( A [ 0 ] ) ; G . reset ( A [ 0 ] ) ; G . selectorRect . setAttribute ( "display" , "inline" ) } Fb ( "#tool_select" , "select" ) } va ( ) ; g . runExtensions ( "selectedChanged" ,
{ elems : A , selectedElement : R , multiselected : ba } ) } ) ; g . bind ( "transition" , function ( n , A ) { var G = g . getMode ( ) , N = A [ 0 ] ; if ( N ) { ba = A . length >= 2 && A [ 1 ] != null ; if ( ! ba ) switch ( G ) { case "rotate" : G = g . getRotationAngle ( N ) ; a ( "#angle" ) . val ( Math . round ( G ) ) ; rotateCursor ( G ) ; a ( "#tool_reorient" ) . toggleClass ( "disabled" , G == 0 ) } g . runExtensions ( "elementTransition" , { elems : A } ) } } ) ; g . bind ( "changed" , function ( n , A ) { var G = g . getMode ( ) ; G === "select" && X ( ) ; for ( var N = 0 ; N < A . length ; ++ N ) { var J = A [ N ] ; if ( J && J . tagName === "svg" ) C ( ) ; else if ( J && R && R . parentNode ==
null ) R = J } c . show _save _warning = true ; va ( ) ; if ( R && G === "select" ) { c . paintBox . fill . update ( ) ; c . paintBox . stroke . update ( ) } g . runExtensions ( "elementChanged" , { elems : A } ) } ) ; g . bind ( "saved" , function ( n , A ) { c . show _save _warning = false ; A = '<?xml version="1.0"?>\n' + A ; var G = navigator . userAgent ; if ( ~ G . indexOf ( "Chrome" ) && a . browser . version >= 533 || ~ G . indexOf ( "MSIE" ) ) Tb ( 0 , true ) ; else { var N = n . open ( "data:image/svg+xml;base64," + P . encode64 ( A ) ) , J = a . pref ( "save_notice_done" ) ; if ( J !== "all" ) { var T = uiStrings . notification . saveFromBrowser . replace ( "%s" ,
"SVG" ) ; if ( G . indexOf ( "Gecko/" ) !== - 1 ) if ( A . indexOf ( "<defs" ) !== - 1 ) { T += "\n\n" + uiStrings . notification . defsFailOnSave ; a . pref ( "save_notice_done" , "all" ) ; J = "all" } else a . pref ( "save_notice_done" , "part" ) ; else a . pref ( "save_notice_done" , "all" ) ; J !== "part" && N . alert ( T ) } } } ) ; g . bind ( "exported" , function ( n , A ) { var G = A . issues ; a ( "#export_canvas" ) . length || a ( "<canvas>" , { id : "export_canvas" } ) . hide ( ) . appendTo ( "body" ) ; var N = a ( "#export_canvas" ) [ 0 ] ; N . width = g . contentW ; N . height = g . contentH ; canvg ( N , A . svg , { renderCallback : function ( ) { var J =
N . toDataURL ( "image/png" ) ; ca . location . href = J ; if ( a . pref ( "export_notice_done" ) !== "all" ) { J = uiStrings . notification . saveFromBrowser . replace ( "%s" , "PNG" ) ; if ( G . length ) J += "\n\n" + uiStrings . notification . noteTheseIssues + "\n \u2022 " + G . join ( "\n \u2022 " ) ; a . pref ( "export_notice_done" , "all" ) ; ca . alert ( J ) } } } ) } ) ; g . bind ( "zoomed" , aa ) ; g . bind ( "contextset" , function ( n , A ) { var G = "" ; if ( A ) { var N = "" ; G = '<a href="#" data-root="y">' + g . getCurrentDrawing ( ) . getCurrentLayerName ( ) + "</a>" ; a ( A ) . parentsUntil ( "#svgcontent > g" ) . andSelf ( ) . each ( function ( ) { if ( this . id ) { N +=
" > " + this . id ; G += this !== A ? ' > <a href="#">' + this . id + "</a>" : " > " + this . id } } ) ; ja = N } else ja = null ; a ( "#cur_context_panel" ) . toggle ( ! ! A ) . html ( G ) ; jb ( ) } ) ; g . bind ( "extension_added" , function ( n , A ) { function G ( ) { if ( Ga ) { clearTimeout ( Ga ) ; Ga = null } J || ( Ga = setTimeout ( function ( ) { J = true ; k ( s . iconsize ) } , 50 ) ) } var N = false , J = false , T = true , da = function ( ) { if ( A . callback && ! N && T ) { N = true ; A . callback ( ) } } , ia = [ ] ; A . context _tools && a . each ( A . context _tools , function ( Da , ka ) { var lb = ka . container _id ? ' id="' + ka . container _id + '"' : "" , Wa = a ( "#" + ka . panel ) ;
Wa . length || ( Wa = a ( "<div>" , { id : ka . panel } ) . appendTo ( "#tools_top" ) . hide ( ) ) ; switch ( ka . type ) { case "tool_button" : var wa = '<div class="tool_button">' + ka . id + "</div>" , Pa = a ( wa ) . appendTo ( Wa ) ; ka . events && a . each ( ka . events , function ( Xa , db ) { a ( Pa ) . bind ( Xa , db ) } ) ; break ; case "select" : wa = "<label" + lb + '><select id="' + ka . id + '">' ; a . each ( ka . options , function ( Xa , db ) { wa += '<option value="' + Xa + '"' + ( Xa == ka . defval ? " selected" : "" ) + ">" + db + "</option>" } ) ; wa += "</select></label>" ; var xa = a ( wa ) . appendTo ( Wa ) . find ( "select" ) ; a . each ( ka . events ,
function ( Xa , db ) { a ( xa ) . bind ( Xa , db ) } ) ; break ; case "button-select" : wa = '<div id="' + ka . id + '" class="dropdown toolset" title="' + ka . title + '"><div id="cur_' + ka . id + '" class="icon_label"></div><button></button></div>' ; lb = a ( '<ul id="' + ka . id + '_opts"></ul>' ) . appendTo ( "#option_lists" ) ; ka . colnum && lb . addClass ( "optcols" + ka . colnum ) ; a ( wa ) . appendTo ( Wa ) . children ( ) ; ia . push ( { elem : "#" + ka . id , list : "#" + ka . id + "_opts" , title : ka . title , callback : ka . events . change , cur : "#cur_" + ka . id } ) ; break ; case "input" : wa = "<label" + lb + '><span id="' +
ka . id + '_label">' + ka . label + ':</span><input id="' + ka . id + '" title="' + ka . title + '" size="' + ( ka . size || "4" ) + '" value="' + ( ka . defval || "" ) + '" type="text"/></label>' ; var ab = a ( wa ) . appendTo ( Wa ) . find ( "input" ) ; ka . spindata && ab . SpinButton ( ka . spindata ) ; ka . events && a . each ( ka . events , function ( Xa , db ) { ab . bind ( Xa , db ) } ) } } ) ; if ( A . buttons ) { var pa = { } , ra = { } , ua = A . svgicons , Ra = { } ; a . each ( A . buttons , function ( Da , ka ) { for ( var lb , Wa = ka . id , wa = Da ; a ( "#" + Wa ) . length ; ) Wa = ka . id + "_" + ++ wa ; if ( ua ) { pa [ Wa ] = ka . icon ; wa = ka . svgicon ? ka . svgicon : ka . id ; if ( ka . type ==
"app_menu" ) ra [ "#" + Wa + " > div" ] = wa ; else ra [ "#" + Wa ] = wa } else lb = ka . type == "menu" ? "" : a ( '<img src="' + ka . icon + '">' ) ; var Pa , xa ; switch ( ka . type ) { case "mode_flyout" : case "mode" : Pa = "tool_button" ; if ( ka . cls ) Pa += " " + ka . cls ; xa = "#tools_left" ; break ; case "context" : Pa = "tool_button" ; xa = "#" + ka . panel ; a ( xa ) . length || a ( "<div>" , { id : ka . panel } ) . appendTo ( "#tools_top" ) ; break ; case "menu" : Pa = "menu_item tool_button" ; xa = "#" + ( ka . after || ka . panel ) ; break ; case "app_menu" : Pa = "" ; xa = ka . parent || "#main_menu ul" ; a ( xa ) . length || a ( "<div>" , { id : ka . panel } ) . appendTo ( "#tools_top" ) } var ab =
a ( ka . list || ka . type == "app_menu" ? "<li/>" : "<div/>" ) . attr ( "id" , Wa ) . attr ( "title" , ka . title ) . addClass ( Pa ) ; if ( ! ka . includeWith && ! ka . list ) { if ( "position" in ka ) a ( xa ) . children ( ) . eq ( ka . position ) . before ( ab ) ; else ka . type != "menu" || ! ka . after ? ab . appendTo ( xa ) : a ( xa ) . after ( ab ) ; if ( ka . type == "mode_flyout" ) { wa = a ( ab ) ; Pa = wa . parent ( ) ; if ( ! wa . parent ( ) . hasClass ( "tools_flyout" ) ) { var Xa = wa [ 0 ] . id . replace ( "tool_" , "tools_" ) , db = wa . clone ( ) . attr ( "id" , Xa + "_show" ) . append ( a ( "<div>" , { "class" : "flyout_arrow_horiz" } ) ) ; wa . before ( db ) ; Pa = na ( Xa , wa ) ;
Pa . data ( "isLibrary" , true ) ; db . data ( "isLibrary" , true ) } ra [ "#" + Xa + "_show" ] = ka . id ; Wa = Ra [ "#" + Pa [ 0 ] . id ] = [ { sel : "#" + Wa , fn : ka . events . click , icon : ka . id , isDefault : true } , Lb ] } else if ( ka . type == "app_menu" || ka . type == "menu" ) ab . append ( ka . title ) } else if ( ka . list ) { ab . addClass ( "push_button" ) ; a ( "#" + ka . list + "_opts" ) . append ( ab ) ; if ( ka . isDefault ) { a ( "#cur_" + ka . list ) . append ( ab . children ( ) . clone ( ) ) ; wa = ka . svgicon ? ka . svgicon : ka . id ; ra [ "#cur_" + ka . list ] = wa } } else if ( ka . includeWith ) { xa = ka . includeWith ; wa = a ( xa . button ) ; Pa = wa . parent ( ) ; if ( ! wa . parent ( ) . hasClass ( "tools_flyout" ) ) { Xa =
wa [ 0 ] . id . replace ( "tool_" , "tools_" ) ; db = wa . clone ( ) . attr ( "id" , Xa + "_show" ) . append ( a ( "<div>" , { "class" : "flyout_arrow_horiz" } ) ) ; wa . before ( db ) ; Pa = na ( Xa , wa ) } var Lb = H . getButtonData ( xa . button ) ; if ( xa . isDefault ) ra [ "#" + Xa + "_show" ] = ka . id ; Wa = Ra [ "#" + Pa [ 0 ] . id ] = [ { sel : "#" + Wa , fn : ka . events . click , icon : ka . id , key : ka . key , isDefault : ka . includeWith ? ka . includeWith . isDefault : 0 } , Lb ] ; Xa = "position" in xa ? xa . position : "last" ; Lb = Pa . children ( ) . length ; if ( ! isNaN ( Xa ) && Xa >= 0 && Xa < Lb ) Pa . children ( ) . eq ( Xa ) . before ( ab ) ; else { Pa . append ( ab ) ; Wa . reverse ( ) } } ua ||
ab . append ( lb ) ; ka . list || a . each ( ka . events , function ( Cb , Kb ) { if ( Cb == "click" ) if ( ka . type == "mode" ) { ka . includeWith ? ab . bind ( Cb , Kb ) : ab . bind ( Cb , function ( ) { Ua ( ab ) && Kb ( ) } ) ; if ( ka . key ) { a ( document ) . bind ( "keydown" , ka . key , Kb ) ; ka . title && ab . attr ( "title" , ka . title + " [" + ka . key + "]" ) } } else ab . bind ( Cb , Kb ) ; else ab . bind ( Cb , Kb ) } ) ; sa ( Ra ) } ) ; a . each ( ia , function ( ) { ya ( this . elem , this . list , this . callback , { seticon : true } ) } ) ; if ( ua ) T = false ; a . svgIcons ( ua , { w : 27 , h : 27 , id _match : false , no _img : ! B , fallback : pa , placement : ra , callback : function ( ) { s . iconsize &&
s . iconsize != "m" && G ( ) ; T = true ; da ( ) } } ) } da ( ) } ) ; g . textActions . setInputElem ( a ( "#text" ) [ 0 ] ) ; var Fa = '<div class="palette_item" data-rgb="none"></div>' ; a . each ( [ "#000000" , "#3f3f3f" , "#7f7f7f" , "#bfbfbf" , "#ffffff" , "#ff0000" , "#ff7f00" , "#ffff00" , "#7fff00" , "#00ff00" , "#00ff7f" , "#00ffff" , "#007fff" , "#0000ff" , "#7f00ff" , "#ff00ff" , "#ff007f" , "#7f0000" , "#7f3f00" , "#7f7f00" , "#3f7f00" , "#007f00" , "#007f3f" , "#007f7f" , "#003f7f" , "#00007f" , "#3f007f" , "#7f007f" , "#7f003f" , "#ffaaaa" , "#ffd4aa" , "#ffffaa" , "#d4ffaa" , "#aaffaa" , "#aaffd4" ,
"#aaffff" , "#aad4ff" ] , function ( n , A ) { Fa += '<div class="palette_item" style="background-color: ' + A + ';" data-rgb="' + A + '"></div>' } ) ; a ( "#palette" ) . append ( Fa ) ; var ub = a ( "#tool_angle_indicator" ) ; a ( "#tool_reorient" ) ; rotateCursor = function ( n ) { n = "rotate(" + n + "deg)" ; ub . css ( { "-webkit-transform" : n , "-moz-transform" : n , "-o-transform" : n , "-ms-transform" : n , transform : n } ) } ; var Aa = function ( n ) { var A = n . value / 100 ; if ( A < 0.0010 ) n . value = 0.1 ; else { n = g . getZoom ( ) ; aa ( window , { width : 0 , height : 0 , x : ( V [ 0 ] . scrollLeft + V . width ( ) / 2 ) / n , y : ( V [ 0 ] . scrollTop +
V . height ( ) / 2 ) / n , zoom : A } , true ) } } , vb = function ( ) { window . opera && a ( "<p/>" ) . hide ( ) . appendTo ( "body" ) . remove ( ) } ; a ( "#stroke_style" ) . change ( function ( ) { g . setStrokeAttr ( "stroke-dasharray" , a ( this ) . val ( ) ) ; a ( "#stroke_style_label" ) . html ( this . options [ this . selectedIndex ] . text ) ; vb ( ) } ) ; a ( "#seg_type" ) . change ( function ( ) { g . setSegType ( a ( this ) . val ( ) ) ; a ( "#seg_type_label" ) . html ( this . options [ this . selectedIndex ] . text ) } ) ; a ( "select" ) . change ( function ( ) { a ( this ) . blur ( ) } ) ; a ( "#font_family" ) . change ( function ( ) { g . setFontFamily ( this . value ) } ) ;
a ( "#text" ) . keyup ( function ( ) { g . setTextContent ( this . value ) } ) ; a ( "#image_url" ) . change ( function ( ) { Na ( this . value ) } ) ; a ( "#link_url" ) . change ( function ( ) { this . value . length ? g . setLinkURL ( this . value ) : g . removeHyperlink ( ) } ) ; a ( "#g_title" ) . change ( function ( ) { g . setGroupTitle ( this . value ) } ) ; changeAttribute = function ( n , A ) { var G = n . getAttribute ( "data-attr" ) , N = n . value ; if ( svgedit . units . isValidUnit ( G , N , R ) ) n . blur ( ) ; else { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; n . value = R . getAttribute ( G ) ; return false } if ( G !== "id" ) if ( isNaN ( N ) ) N =
g . convertToNum ( G , N ) ; else if ( curConfig . baseUnit !== "px" ) { var J = svgedit . units . getTypeMap ( ) ; if ( R [ G ] || g . getMode ( ) === "pathedit" || G === "x" || G === "y" ) N *= J [ curConfig . baseUnit ] } A ? g . changeSelectedAttributeNoUndo ( G , N ) : g . changeSelectedAttribute ( G , N ) } ; a ( "#palette" ) . mouseover ( function ( ) { var n = a ( '<input type="hidden">' ) ; a ( this ) . append ( n ) ; n . focus ( ) . remove ( ) } ) ; a ( ".palette_item" ) . mousedown ( function ( ) { var n = a ( "#tool_stroke" ) . hasClass ( "active" ) , A = n ? "stroke" : "fill" , G = a ( this ) . attr ( "data-rgb" ) , N = null ; if ( G === "transparent" ||
G === "initial" || G === "#none" ) { G = "none" ; N = new a . jGraduate . Paint } else N = new a . jGraduate . Paint ( { alpha : 100 , solidColor : G . substr ( 1 ) } ) ; c . paintBox [ A ] . setPaint ( N ) ; if ( n ) { g . setColor ( "stroke" , G ) ; G != "none" && g . getStrokeOpacity ( ) != 1 && g . setPaintOpacity ( "stroke" , 1 ) } else { g . setColor ( "fill" , G ) ; G != "none" && g . getFillOpacity ( ) != 1 && g . setPaintOpacity ( "fill" , 1 ) } } ) . bind ( "contextmenu" , function ( n ) { n . preventDefault ( ) } ) ; a ( "#toggle_stroke_tools" ) . toggle ( function ( ) { a ( ".stroke_tool" ) . css ( "display" , "table-cell" ) ; a ( this ) . addClass ( "expanded" ) ;
F ( ) } , function ( ) { a ( ".stroke_tool" ) . css ( "display" , "none" ) ; a ( this ) . removeClass ( "expanded" ) ; F ( ) } ) ; var Ua = function ( n , A ) { if ( a ( n ) . hasClass ( "disabled" ) ) return false ; if ( a ( n ) . parent ( ) . hasClass ( "tools_flyout" ) ) return true ; var G = G || "normal" ; A || a ( ".tools_flyout" ) . fadeOut ( G ) ; a ( "#styleoverrides" ) . text ( "" ) ; a ( ".tool_button_current" ) . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( n ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) ; return true } ; ( function ( ) { var n = null , A = null , G = V [ 0 ] , N = false , J =
false ; a ( "#svgcanvas" ) . bind ( "mousemove mouseup" , function ( T ) { if ( N !== false ) { G . scrollLeft -= T . clientX - n ; G . scrollTop -= T . clientY - A ; n = T . clientX ; A = T . clientY ; if ( T . type === "mouseup" ) N = false ; return false } } ) . mousedown ( function ( T ) { if ( T . button === 1 || J === true ) { N = true ; n = T . clientX ; A = T . clientY ; return false } } ) ; a ( window ) . mouseup ( function ( ) { N = false ; a ( "body" ) . removeClass ( "dragging" ) } ) ; a ( document ) . bind ( "keydown" , "space" , function ( T ) { T . preventDefault ( ) ; g . spaceKey = J = true } ) . bind ( "keyup" , "space" , function ( T ) { T . preventDefault ( ) ;
g . spaceKey = J = false } ) . bind ( "keydown" , "alt" , function ( ) { g . getMode ( ) === "zoom" && V . addClass ( "out" ) } ) . bind ( "keyup" , "alt" , function ( ) { g . getMode ( ) === "zoom" && V . removeClass ( "out" ) } ) } ) ( ) ; var Ta = a ( ".menu" ) , $a = function ( n ) { n . target . style . background = "#fff" ; setTimeout ( function ( ) { n . target . style . background = "#ddd" } , 50 ) ; setTimeout ( function ( ) { n . target . style . background = "#fff" } , 150 ) ; setTimeout ( function ( ) { n . target . style . background = "#ddd" } , 200 ) ; setTimeout ( function ( ) { n . target . style . background = "" } , 200 ) ; setTimeout ( function ( ) { a ( "#menu_bar" ) . removeClass ( "active" ) } ,
220 ) ; return false } ; a ( ".menu_item" ) . on ( "mousedown touchstart" , function ( n ) { $a ( n ) } ) ; a ( "svg, body" ) . on ( "mousedown touchstart" , function ( n ) { top != self && ! n . isTrigger && typeof top . exports . setEditorFocus == "function" && top . exports . setEditorFocus ( ) ; if ( ! a ( n . target ) . hasClass ( "menu_title" ) && ! a ( n . target ) . parent ( ) . hasClass ( "menu_title" ) ) ! a ( n . target ) . hasClass ( "disabled" ) && a ( n . target ) . hasClass ( "menu_item" ) ? $a ( n ) : a ( "#menu_bar" ) . removeClass ( "active" ) } ) ; var za = [ 6 , 12 , 16 , 33 , 50 , 66 , 100 , 150 , 200 , 300 , 400 , 600 , 800 , 1200 ] ; a ( "#workarea" ) . on ( "mousewheel" ,
function ( n , A , G , N ) { if ( n . altKey ) { n . preventDefault ( ) ; n = g . getZoom ( ) * 100 ; A = za . length ; for ( K = 0 ; K < A ; K ++ ) { G = Math . min ( A , K + 1 ) ; if ( N > 0 ) zoom = za [ K ] <= n ? za [ G ] : zoom ; if ( N < 0 ) zoom = za [ K ] < n ? za [ K ] : zoom } zoom && Aa ( { value : zoom } ) } } ) ; a ( ".menu_title" ) . on ( "mousedown" , function ( ) { a ( "#tools_shapelib" ) . hide ( ) ; a ( "#menu_bar" ) . toggleClass ( "active" ) ; Ta . removeClass ( "open" ) ; a ( this ) . parent ( ) . addClass ( "open" ) } ) . on ( "mouseover" , function ( ) { Ta . removeClass ( "open" ) ; a ( this ) . parent ( ) . addClass ( "open" ) } ) ; c . addDropDown = function ( n , A , G ) { if ( a ( n ) . length !=
0 ) { var N = a ( n ) . find ( "button" ) , J = a ( n ) . find ( "ul" ) . attr ( "id" , a ( n ) [ 0 ] . id + "-list" ) ; G || a ( "#option_lists" ) . append ( J ) ; var T = false ; G && a ( n ) . addClass ( "dropup" ) ; J . find ( "li" ) . bind ( "mouseup" , A ) ; a ( window ) . mouseup ( function ( ) { if ( ! T ) { N . removeClass ( "down" ) ; J . hide ( ) } T = false } ) ; N . bind ( "mousedown" , function ( ) { if ( N . hasClass ( "down" ) ) { N . removeClass ( "down" ) ; J . hide ( ) } else { N . addClass ( "down" ) ; if ( ! G ) { var da = a ( n ) . offset ( ) ; J . css ( { top : da . top , left : da . left - 110 } ) } J . show ( ) ; T = true } } ) . hover ( function ( ) { T = true } ) . mouseout ( function ( ) { T = false } ) } } ;
var ya = function ( n , A , G , N ) { var J = a ( n ) ; A = a ( A ) ; var T = false , da = N . dropUp ; da && a ( n ) . addClass ( "dropup" ) ; A . find ( "li" ) . bind ( "mouseup" , function ( ) { if ( N . seticon ) { Fb ( "#cur_" + J [ 0 ] . id , a ( this ) . children ( ) ) ; a ( this ) . addClass ( "current" ) . siblings ( ) . removeClass ( "current" ) } G . apply ( this , arguments ) } ) ; a ( window ) . mouseup ( function ( ) { if ( ! T ) { J . removeClass ( "down" ) ; A . hide ( ) ; A . css ( { top : 0 , left : 0 } ) } T = false } ) ; A . height ( ) ; a ( n ) . bind ( "mousedown" , function ( ) { var ia = a ( n ) . offset ( ) ; if ( da ) { ia . top -= A . height ( ) ; ia . left += 8 } else ia . top += a ( n ) . height ( ) ;
a ( A ) . offset ( ia ) ; if ( J . hasClass ( "down" ) ) { J . removeClass ( "down" ) ; A . hide ( ) ; A . css ( { top : 0 , left : 0 } ) } else { J . addClass ( "down" ) ; A . show ( ) ; T = true ; return false } } ) . hover ( function ( ) { T = true } ) . mouseout ( function ( ) { T = false } ) ; N . multiclick && A . mousedown ( function ( ) { T = true } ) } ; c . addDropDown ( "#font_family_dropdown" , function ( ) { a ( this ) . text ( ) ; a ( "#font_family" ) . val ( a ( this ) . text ( ) ) . change ( ) } ) ; a ( "div" , "#position_opts" ) . each ( function ( ) { this . addEventListener ( "mouseup" , function ( ) { var n = this . id . replace ( "tool_pos" , "" ) . charAt ( 0 ) ; g . alignSelectedElements ( n ,
"page" ) } ) } ) ; ( function ( ) { var n , A = function ( ) { a ( n ) . blur ( ) } ; a ( "#svg_editor" ) . find ( "button, select, input:not(#text)" ) . focus ( function ( ) { n = this ; W = "toolbars" ; V . mousedown ( A ) } ) . blur ( function ( ) { W = "canvas" ; V . unbind ( "mousedown" , A ) ; g . getMode ( ) == "textedit" && a ( "#text" ) . focus ( ) } ) } ) ( ) ; var ob = function ( ) { Ua ( "#tool_select" ) && g . setMode ( "select" ) } , fb = function ( ) { Ua ( "#tool_fhpath" ) && g . setMode ( "fhpath" ) } , Oa = function ( ) { Ua ( "#tool_line" ) && g . setMode ( "line" ) } , Za = function ( ) { Ua ( "#tool_rect" ) && g . setMode ( "rect" ) } , Ea = function ( ) { Ua ( "#tool_ellipse" ) &&
g . setMode ( "ellipse" ) } , pb = function ( ) { Ua ( "#tool_image" ) && g . setMode ( "image" ) } , qb = function ( ) { Ua ( "#tool_zoom" ) && g . setMode ( "zoom" ) } , gb = function ( ) { if ( Ua ( "#tool_zoom" ) ) { Ib ( ) ; X ( ) } } , cb = function ( ) { Ua ( "#tool_text" ) && g . setMode ( "text" ) } , Sa = function ( ) { Ua ( "#tool_path" ) && g . setMode ( "path" ) } , Ma = function ( ) { if ( R != null || ba ) g . deleteSelectedElements ( ) } , bb = function ( ) { if ( R != null || ba ) { window . event . type === "keydown" && tb ( a ( "#edit_menu" ) ) ; g . cutSelectedElements ( ) } } , zb = function ( ) { if ( R != null || ba ) { window . event . type === "keydown" && tb ( a ( "#edit_menu" ) ) ;
g . copySelectedElements ( ) } } , xb = function ( ) { window . event . type === "keydown" && tb ( a ( "#edit_menu" ) ) ; var n = g . getZoom ( ) , A = ( V [ 0 ] . scrollLeft + V . width ( ) / 2 ) / n - g . contentW ; n = ( V [ 0 ] . scrollTop + V . height ( ) / 2 ) / n - g . contentH ; g . pasteElements ( "point" , A , n ) } , eb = function ( ) { if ( R != null ) { window . event . type === "keydown" && tb ( a ( "#object_menu" ) ) ; g . moveToTopSelectedElement ( ) } } , rb = function ( ) { if ( R != null ) { window . event . type === "keydown" && tb ( a ( "#object_menu" ) ) ; g . moveToBottomSelectedElement ( ) } } , Ab = function ( ) { if ( R != null ) { window . event . type === "keydown" &&
tb ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( "Up" ) } } , wb = function ( ) { if ( R != null ) { window . event . type === "keydown" && tb ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( "Down" ) } } , Db = function ( n ) { if ( R != null ) { window . event . type === "keydown" && tb ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( n ) } } , ma = function ( ) { if ( R != null ) { g . convertToPath ( ) ; elems = g . getSelectedElems ( ) ; g . selectorManager . requestSelector ( elems [ 0 ] ) . selectorRect . setAttribute ( "display" , "none" ) ; g . setMode ( "pathedit" ) ; M . toEditMode ( elems [ 0 ] ) ; g . clearSelection ( ) } } , ga = function ( ) { R !=
null && M . reorient ( ) } , qa = function ( ) { if ( R != null || ba ) a . prompt ( uiStrings . notification . enterNewLinkURL , "http://" , function ( n ) { n && g . makeHyperlink ( n ) } ) } , S = function ( n , A ) { if ( R != null || ba ) { if ( curConfig . gridSnapping ) { var G = g . getZoom ( ) * curConfig . snappingStep ; n *= G ; A *= G } a ( "input" ) . blur ( ) ; g . moveSelectedElements ( n , A ) } } , O = function ( ) { var n = ! a ( "#tool_node_link" ) . hasClass ( "checked" ) ; n ? a ( "#tool_node_link" ) . addClass ( "checked" ) . find ( "input" ) . attr ( "checked" , true ) : a ( "#tool_node_link" ) . removeClass ( "checked" ) . find ( "input" ) . attr ( "checked" ,
false ) ; M . linkControlPoints ( n ) } , fa = function ( ) { M . getNodePoint ( ) && M . clonePathNode ( ) } , Ia = function ( ) { M . getNodePoint ( ) && M . deletePathNode ( ) } , Qa = function ( ) { var n = a ( "#tool_add_subpath" ) , A = ! n . hasClass ( "push_button_pressed" ) ; A ? n . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) : n . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; M . addSubPath ( A ) } , Ya = function ( ) { M . opencloseSubPath ( ) } , kb = function ( ) { g . cycleElement ( 1 ) } , mb = function ( ) { g . cycleElement ( 0 ) } , nb = function ( n , A ) { if ( ! ( R == null || ba ) ) { n || ( A *= - 1 ) ;
var G = a ( "#angle" ) . val ( ) * 1 + A ; g . setRotationAngle ( G ) ; va ( ) } } , hb = function ( ) { var n = curConfig . dimensions ; a . confirm ( uiStrings . notification . QwantToClear , function ( A ) { if ( A ) { X ( ) ; g . clear ( ) ; g . setResolution ( n [ 0 ] , n [ 1 ] ) ; C ( true ) ; Ib ( ) ; va ( ) ; Z ( ) ; g . runExtensions ( "onNewDocument" ) } } ) } , Bb = function ( ) { g . setBold ( ! g . getBold ( ) ) ; va ( ) ; return false } , Va = function ( ) { g . setItalic ( ! g . getItalic ( ) ) ; va ( ) ; return false } , yb = function ( ) { if ( ! b . pngsave ) { var n = uiStrings . notification . loadingImage ; ca = window . open ( "data:text/html;charset=utf-8,<title>" +
n + "</title><h1>" + n + "</h1>" ) } window . canvg ? g . rasterExport ( ) : a . getScript ( "canvg/rgbcolor.js" , function ( ) { a . getScript ( "canvg/canvg.js" , function ( ) { g . rasterExport ( ) } ) } ) } , Eb = function ( ) { g . open ( ) } , Mb = function ( ) { } , tb = function ( n ) { var A = n . prev ( ) ; A . css ( "background" , "#09f" ) ; setTimeout ( function ( ) { A . css ( "background" , "" ) } , 200 ) } , ib = function ( ) { if ( U . getUndoStackSize ( ) > 0 ) { window . event . type === "keydown" && tb ( a ( "#edit_menu" ) ) ; U . undo ( ) } } , Ka = function ( ) { if ( U . getRedoStackSize ( ) > 0 ) { window . event . type === "keydown" && tb ( a ( "#edit_menu" ) ) ;
U . redo ( ) } } , Ob = function ( ) { if ( ba ) g . groupSelectedElements ( ) ; else R && g . ungroupSelectedElement ( ) } , Rb = function ( ) { window . event . type === "keydown" && tb ( a ( "#edit_menu" ) ) ; g . cloneSelectedElements ( 20 , 20 ) } , Qb = function ( ) { var n = this . id . replace ( "tool_align" , "" ) . charAt ( 0 ) ; g . alignSelectedElements ( n , a ( "#align_relative_to" ) . val ( ) ) } , Sb = function ( ) { var n = document . querySelector ( "#tool_stroke rect" ) , A = document . querySelector ( "#tool_fill rect" ) , G = A . getAttribute ( "fill" ) , N = n . getAttribute ( "fill" ) ; n = parseFloat ( n . getAttribute ( "stroke-opacity" ) ) ;
if ( isNaN ( n ) ) n = 100 ; A = parseFloat ( A . getAttribute ( "fill-opacity" ) ) ; if ( isNaN ( A ) ) A = 100 ; N = Ja ( N , n , "stroke" ) ; G = Ja ( G , A , "fill" ) ; c . paintBox . fill . setPaint ( N , true ) ; c . paintBox . stroke . setPaint ( G , true ) } , Ib = function ( n ) { var A = g . getResolution ( ) ; n = n ? A . zoom * n : 1 ; a ( "#zoom" ) . val ( n * 100 ) ; g . setZoom ( n ) ; Pb ( ) ; C ( true ) } , Jb = function ( ) { ! a ( "#tool_wireframe" ) . hasClass ( "push_button_pressed" ) ? a ( "#tool_wireframe" ) . addClass ( "push_button_pressed" ) : a ( "#tool_wireframe" ) . removeClass ( "push_button_pressed" ) ; V . toggleClass ( "wireframe" ) ; if ( ! u ) { var n =
a ( "#wireframe_rules" ) ; n . length ? n . empty ( ) : a ( '<style id="wireframe_rules"></style>' ) . appendTo ( "head" ) ; Pb ( ) } } , Nb = function ( ) { var n = ! a ( "#tool_snap" ) . hasClass ( "push_button_pressed" ) ; n ? a ( "#tool_snap" ) . addClass ( "push_button_pressed" ) : a ( "#tool_snap" ) . removeClass ( "push_button_pressed" ) ; curConfig . gridSnapping = n } , Ub = function ( ) { g . clearSelection ( ) ; a ( "#tool_canvas" ) . trigger ( "click" ) } , Hb = function ( ) { window . self != window . top && top . exports . setEditorFocus ( false ) } , sb = function ( ) { if ( a ( "#tool_rulers" ) . hasClass ( "push_button_pressed" ) ) { a ( "#tool_rulers" ) . removeClass ( "push_button_pressed" ) ;
a ( "#show_rulers" ) . attr ( "checked" , false ) ; curConfig . showRulers = false } else { a ( "#tool_rulers" ) . addClass ( "push_button_pressed" ) ; a ( "#show_rulers" ) . attr ( "checked" , true ) ; curConfig . showRulers = true } a ( "#rulers" ) . toggle ( ! ! curConfig . showRulers ) } , Pb = function ( ) { if ( ! u ) { var n = "#workarea.wireframe #svgcontent * { stroke-width: " + 1 / g . getZoom ( ) + "px; }" ; a ( "#wireframe_rules" ) . text ( V . hasClass ( "wireframe" ) ? n : "" ) } } , Tb = function ( n , A ) { if ( ! ta ) { ta = true ; a ( "#save_output_btns" ) . toggle ( ! ! A ) ; a ( "#tool_source_back" ) . toggle ( ! A ) ; var G =
ha = g . getSvgString ( ) ; a ( "#svg_source_textarea" ) . val ( G ) ; a ( "#svg_source_editor" ) . fadeIn ( ) ; G = a ( "#svg_source_container" ) . height ( ) - 50 ; a ( "#svg_source_textarea" ) . css ( "height" , G ) ; a ( "#svg_source_textarea" ) . focus ( ) } } , Gb = function ( ) { if ( ta ) { var n = function ( ) { g . clearSelection ( ) ; v ( ) ; Ib ( ) ; jb ( ) ; Z ( ) } ; g . setSvgString ( a ( "#svg_source_textarea" ) . val ( ) ) ? n ( ) : a . confirm ( uiStrings . notification . QerrorsRevertToSource , function ( A ) { if ( ! A ) return false ; n ( ) } ) ; X ( ) } } , jb = function ( n ) { n = n || g . getDocumentTitle ( ) ; n = ea + ( n ? ": " + n : "" ) ; a ( "title:first" ) . text ( n ) } ,
Fb = c . setIcon = function ( n , A ) { var G = typeof A === "string" ? a . getSvgIcon ( A , true ) : A . clone ( ) ; G ? a ( n ) . find ( "img" ) . replaceWith ( G ) : console . log ( "NOTE: Icon image missing: " + A ) } , e ; e = function ( ) { var n = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/ , A = document . getElementsByTagName ( "script" ) [ 0 ] , G ; for ( G in A . style ) if ( n . test ( G ) ) return G . match ( n ) [ 0 ] ; if ( "WebkitOpacity" in A . style ) return "Webkit" ; if ( "KhtmlOpacity" in A . style ) return "Khtml" ; return "" } ( ) ; var h = function ( n , A ) { e . toLowerCase ( ) ; var G = [ "top" , "left" , "bottom" , "right" ] ; n . each ( function ( ) { for ( var N =
a ( this ) , J = N . outerWidth ( ) * ( A - 1 ) , T = N . outerHeight ( ) * ( A - 1 ) , da = 0 ; da < 4 ; da ++ ) { var ia = G [ da ] , pa = N . data ( "orig_margin-" + ia ) ; if ( pa == null ) { pa = parseInt ( N . css ( "margin-" + ia ) ) ; N . data ( "orig_margin-" + ia , pa ) } pa = pa * A ; if ( ia === "right" ) pa += J ; else if ( ia === "bottom" ) pa += T ; N . css ( "margin-" + ia , pa ) } } ) } , k = c . setIconSize = function ( n , A ) { if ( ! ( n == s . size && ! A ) ) { var G = a ( "#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout" ) ,
N = 1 ; N = typeof n == "number" ? n : { s : 0.75 , m : 1 , l : 1.25 , xl : 1.5 } [ n ] ; c . tool _scale = Q = N ; oa ( ) ; var J = G . parents ( ":hidden" ) ; J . css ( "visibility" , "hidden" ) . show ( ) ; h ( G , N ) ; J . css ( "visibility" , "visible" ) . hide ( ) ; G = a ( "#tool_size_rules" ) ; if ( G . length ) G . empty ( ) ; else G = a ( '<style id="tool_size_rules"></style>' ) . appendTo ( "head" ) ; if ( n != "m" ) { var T = "" ; a . each ( cssResizeRules , function ( da , ia ) { da = "#svg_editor " + da . replace ( /,/g , ", #svg_editor" ) ; T += da + "{" ; a . each ( ia , function ( pa , ra ) { if ( typeof ra === "number" ) var ua = ra * N + "px" ; else if ( ra [ n ] || ra . all ) ua =
ra [ n ] || ra . all ; T += pa + ":" + ua + ";" } ) ; T += "}" } ) ; J = "-" + e . toLowerCase ( ) + "-" ; T += "#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{" + J + "transform: scale(" + N + ");} #svg_editor div.toolset .toolset {" + J + "transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {" + J + "transform: scale(" + 1 / N + ");}" ; G . text ( T ) } oa ( ) } } , w = function ( ) { a ( "#dialog_box" ) . hide ( ) ;
if ( ta ) { if ( ta ) ha !== a ( "#svg_source_textarea" ) . val ( ) ? a . confirm ( uiStrings . notification . QignoreSourceChanges , function ( n ) { n && v ( ) } ) : v ( ) ; F ( ) } else ja && g . leaveContext ( ) } , v = function ( ) { a ( "#svg_source_editor" ) . hide ( ) ; ta = false ; a ( "#svg_source_textarea" ) . blur ( ) } ; a ( window ) . width ( ) ; a ( window ) . height ( ) ; var F = a . noop ; a ( window ) . resize ( function ( ) { C ( ) } ) ; ( function ( ) { V . scroll ( function ( ) { if ( a ( "#ruler_x" ) . length != 0 ) a ( "#ruler_x" ) [ 0 ] . scrollLeft = V [ 0 ] . scrollLeft ; if ( a ( "#ruler_y" ) . length != 0 ) a ( "#ruler_y" ) [ 0 ] . scrollTop = V [ 0 ] . scrollTop } ) } ) ( ) ;
a ( "#url_notice" ) . click ( function ( ) { a . alert ( this . title ) } ) ; a ( "#change_image_url" ) . click ( function ( ) { var n = g . getHref ( R ) ; n = n . indexOf ( "data:" ) === 0 ? "" : n ; a . prompt ( uiStrings . notification . enterNewImgURL , n , function ( A ) { A && Na ( A ) } ) } ) ; var z = function ( n ) { var A = n [ 0 ] . id == "stroke_color" ? "stroke" : "fill" , G = n [ 0 ] . id == "canvas_color" ; if ( G ) A = "canvas" ; var N = c . paintBox [ A ] . paint ; n = A == "stroke" ? "Pick a Stroke Paint and Opacity" : "Pick a Fill Paint and Opacity" ; G = G ? { right : 200 , top : 50 } : { left : 45 , bottom : 50 } ; a ( "#color_picker" ) . draggable ( { cancel : ".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker" ,
containment : "window" } ) . css ( G ) . jGraduate ( { paint : N , window : { pickerTitle : n } , images : { clientPath : curConfig . jGraduatePath } , newstop : "inverse" } , function ( J ) { N = new a . jGraduate . Paint ( J ) ; c . paintBox [ A ] . setPaint ( N ) ; g . setPaint ( A , N ) ; a ( "#color_picker" ) . hide ( ) } , function ( ) { a ( "#color_picker" ) . hide ( ) } ) } ; p = function ( n , A ) { var G = document . getElementById ( "canvas_background" ) , N = { color : "fff" , opacity : 1 } ; if ( A == "stroke" ) N = curConfig . initStroke ; if ( A == "fill" ) N = curConfig . initFill ; if ( A == "canvas" && G ) if ( G = G . getAttribute ( "fill" ) . match ( /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/ ) ) N =
{ color : ( "0" + parseInt ( G [ 1 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( "0" + parseInt ( G [ 2 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( "0" + parseInt ( G [ 3 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) , opacity : 1 } ; G = ( new DOMParser ) . parseFromString ( '<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#' + N . color + '" opacity="' + N . opacity + '"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>' , "text/xml" ) . documentElement ; G = a ( n ) [ 0 ] . appendChild ( document . importNode ( G , true ) ) ; A === "canvas" ? G . setAttribute ( "width" , 60.5 ) :
G . setAttribute ( "width" , "100%" ) ; this . rect = G . firstChild ; this . defs = G . getElementsByTagName ( "defs" ) [ 0 ] ; this . grad = this . defs . firstChild ; this . paint = new a . jGraduate . Paint ( { solidColor : N . color } ) ; this . type = A ; this . setPaint = function ( J , T ) { this . paint = J ; var da = "none" , ia = J . type , pa = J . alpha / 100 ; switch ( ia ) { case "solidColor" : da = J [ ia ] == "none" || J [ ia ] == "one" ? "none" : "#" + J [ ia ] ; break ; case "linearGradient" : case "radialGradient" : this . defs . removeChild ( this . grad ) ; this . grad = this . defs . appendChild ( J [ ia ] ) ; da = "url(#" + ( this . grad . id = "gradbox_" +
this . type ) + ")" } this . rect . setAttribute ( "fill" , da ) ; this . rect . setAttribute ( "opacity" , pa ) ; if ( T ) { g . setColor ( this . type , da , true ) ; g . setPaintOpacity ( this . type , pa , true ) } if ( this . type == "canvas" ) ( ia = document . getElementById ( "canvas_background" ) ) ? ia . setAttribute ( "fill" , da ) : La ( da ) } ; this . update = function ( J ) { if ( R ) { var T = this . type ; switch ( R . tagName ) { case "use" : case "image" : case "foreignObject" : return ; case "g" : case "a" : for ( var da = null , ia = R . getElementsByTagName ( "*" ) , pa = 0 , ra = ia . length ; pa < ra ; pa ++ ) { var ua = ia [ pa ] . getAttribute ( T ) ;
if ( pa === 0 ) da = ua ; else if ( da !== ua ) { da = null ; break } } if ( da === null ) { ia = null ; return } ia = da ; da = 1 ; break ; default : da = parseFloat ( R . getAttribute ( T + "-opacity" ) ) ; if ( isNaN ( da ) ) da = 1 ; ia = T === "fill" ? "black" : "none" ; ia = R . getAttribute ( T ) || ia } if ( J ) { g . setColor ( T , ia , true ) ; g . setPaintOpacity ( T , da , true ) } da *= 100 ; this . setPaint ( Ja ( ia , da , T ) ) } } ; this . prep = function ( ) { switch ( this . paint . type ) { case "linearGradient" : case "radialGradient" : var J = new a . jGraduate . Paint ( { copy : this . paint } ) ; g . setPaint ( A , J ) } } } ; c . paintBox . fill = new p ( "#fill_color" ,
"fill" ) ; c . paintBox . stroke = new p ( "#stroke_color" , "stroke" ) ; c . paintBox . canvas = new p ( "#canvas_color" , "canvas" ) ; a ( "#stroke_width" ) . val ( curConfig . initStroke . width ) ; a ( "#group_opacity" ) . val ( curConfig . initOpacity * 100 ) ; p = c . paintBox . fill . rect . cloneNode ( false ) ; p . setAttribute ( "style" , "vector-effect:non-scaling-stroke" ) ; var u = p . style . vectorEffect === "non-scaling-stroke" ; p . removeAttribute ( "style" ) ; p = c . paintBox . fill . rect . ownerDocument . createElementNS ( "http://www.w3.org/2000/svg" , "feGaussianBlur" ) ; typeof p . stdDeviationX ===
"undefined" && a ( "#tool_blur" ) . hide ( ) ; a ( p ) . remove ( ) ; setTimeout ( function ( ) { g . embedImage ( "images/placeholder.svg" , function ( n ) { if ( ! n ) { 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" ) ) z ( a ( "#fill_color" ) ) ; else { a ( "#tool_fill" ) . addClass ( "active" ) ; a ( "#tool_stroke" ) . removeClass ( "active" ) } } ) ;
a ( "#tool_canvas" ) . on ( "click touchstart" , function ( ) { z ( a ( "#canvas_color" ) ) } ) ; a ( "#tool_stroke" ) . on ( "click touchstart" , function ( ) { if ( a ( "#tool_stroke" ) . hasClass ( "active" ) ) z ( a ( "#stroke_color" ) ) ; else { a ( "#tool_stroke" ) . addClass ( "active" ) ; a ( "#tool_fill" ) . removeClass ( "active" ) } } ) ; a ( "#zoomLabel" ) . click ( function ( ) { a ( "#zoom_dropdown button" ) . mousedown ( ) ; a ( window ) . mouseup ( ) } ) ; 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 ( ) { V . css ( "line-height" , V . height ( ) + "px" ) } ) ; var D = function ( ) { var n = a ( "#canvas_width" ) , A = a ( "#canvas_height" ) , G = n . val ( ) , N = A . val ( ) ; if ( G != "fit" && ! svgedit . units . isValidUnit ( "width" , G ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; n . parent ( ) . addClass ( "error" ) ; return false } n . parent ( ) . removeClass ( "error" ) ; if ( N != "fit" && ! svgedit . units . isValidUnit ( "height" , N ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; A . parent ( ) . addClass ( "error" ) ; return false } A . parent ( ) . removeClass ( "error" ) ;
if ( ! g . setResolution ( G , N ) ) { a . alert ( uiStrings . notification . noContentToFitTo ) ; G = g . getResolution ( ) ; n . val ( G . w ) ; A . val ( G . h ) ; return false } C ( ) } ; a ( "#resolution" ) . change ( function ( ) { var n = a ( "#canvas_width" ) [ 0 ] , A = a ( "#canvas_height" ) [ 0 ] ; if ( this . selectedIndex ) if ( this . value == "content" ) { n . value = "fit" ; A . value = "fit" ; D ( ) ; var G = g . getResolution ( ) ; n . value = G . w ; A . value = G . h } else { var N = this . value . split ( "x" ) ; N [ 0 ] = parseInt ( N [ 0 ] ) ; N [ 1 ] = parseInt ( N [ 1 ] ) ; var J = N [ 0 ] - n . value , T = N [ 1 ] - A . value , da = Date . now ( ) , ia = function ( pa ) { pa = ( pa - da ) / 1E3 ;
pa = Math . pow ( pa - 1 , 3 ) + 1 ; n . value = ( N [ 0 ] - J + pa * J ) . toFixed ( 0 ) ; A . value = ( N [ 1 ] - T + pa * T ) . toFixed ( 0 ) ; D ( ) ; if ( pa >= 1 ) { pa = g . getResolution ( ) ; a ( "#canvas_width" ) . val ( pa . w . toFixed ( ) ) ; a ( "#canvas_height" ) . val ( pa . h . toFixed ( ) ) ; a ( "#resolution_label" ) . html ( "<div class='pull'>" + pa . w + "<span>\u00d7</span></br>" + pa . h + "</div>" ) } else requestAnimationFrame ( ia ) } ; ia ( Date . now ( ) ) } else { a ( "#resolution_label" ) . html ( "Custom" ) ; n . removeAttribute ( "readonly" ) ; n . focus ( ) ; n . select ( ) ; if ( n . value == "fit" ) { n . value = 100 ; A . value = 100 } } } ) ; a ( "#zoom" ) . change ( function ( ) { Aa ( this ) } ) ;
a ( "input,select" ) . attr ( "autocomplete" , "off" ) ; var H = function ( ) { var n = [ { sel : "#tool_select" , fn : ob , evt : "click" , key : [ "V" , true ] } , { sel : "#tool_fhpath" , fn : fb , evt : "click" , key : [ "Q" , true ] } , { sel : "#tool_line" , fn : Oa , evt : "click" , key : [ "L" , true ] } , { sel : "#tool_rect" , fn : Za , evt : "click" , key : [ "R" , true ] , icon : "rect" } , { sel : "#tool_ellipse" , fn : Ea , evt : "mouseup" , key : [ "C" , true ] , icon : "ellipse" } , { sel : "#tool_path" , fn : Sa , evt : "click" , key : [ "P" , true ] } , { sel : "#tool_text" , fn : cb , evt : "click" , key : [ "T" , true ] } , { sel : "#tool_image" , fn : pb , evt : "mouseup" } ,
{ sel : "#tool_zoom" , fn : qb , evt : "mouseup" , key : [ "Z" , true ] } , { sel : "#tool_clear" , fn : hb , evt : "mouseup" , key : [ q + "N" , true ] } , { sel : "#tool_save" , fn : function ( ) { ta ? Gb ( ) : clickSave ( ) } , evt : "mouseup" , key : [ q + "S" , true ] } , { sel : "#tool_export" , fn : yb , evt : "mouseup" } , { sel : "#tool_open" , fn : Eb , evt : "mouseup" } , { sel : "#tool_import" , fn : Mb , evt : "mouseup" } , { sel : "#tool_source" , fn : Tb , evt : "click" , key : [ q + "U" , true ] } , { sel : "#tool_wireframe" , fn : Jb , evt : "click" } , { sel : "#tool_snap" , fn : Nb , evt : "click" } , { sel : "#tool_rulers" , fn : sb , evt : "click" } , { sel : "#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel" ,
fn : w , evt : "click" , key : [ "esc" , false , false ] , hidekey : true } , { sel : "#tool_source_save" , fn : Gb , evt : "click" } , { sel : "#tool_delete,#tool_delete_multi" , fn : Ma , evt : "click" , key : [ "del/backspace" , true ] } , { sel : "#tool_reorient" , fn : ga , evt : "click" } , { sel : "#tool_node_link" , fn : O , evt : "click" } , { sel : "#tool_node_clone" , fn : fa , evt : "click" } , { sel : "#tool_node_delete" , fn : Ia , evt : "click" } , { sel : "#tool_openclose_path" , fn : Ya , evt : "click" } , { sel : "#tool_add_subpath" , fn : Qa , evt : "click" } , { sel : "#tool_move_top" , fn : eb , evt : "click" , key : q + "shift+up" } ,
{ sel : "#tool_move_bottom" , fn : rb , evt : "click" , key : q + "shift+down" } , { sel : "#tool_move_up" , fn : Ab , evt : "click" , key : [ q + "up" , true ] } , { sel : "#tool_move_down" , fn : wb , evt : "click" , key : [ q + "down" , true ] } , { sel : "#tool_topath" , fn : ma , evt : "click" } , { sel : "#tool_make_link,#tool_make_link_multi" , fn : qa , evt : "click" } , { sel : "#tool_clone,#tool_clone_multi" , fn : Rb , evt : "click" , key : [ q + "D" , true ] } , { sel : "#tool_group" , fn : Ob , evt : "click" , key : [ q + "G" , true ] } , { sel : "#tool_ungroup" , fn : Ob , evt : "click" , key : q + "shift+G" } , { sel : "#tool_unlink_use" , fn : Ob , evt : "click" } ,
{ sel : "[id^=tool_align]" , fn : Qb , evt : "click" } , { sel : "#tool_undo" , fn : ib , evt : "click" , key : q + "z" } , { sel : "#tool_redo" , fn : Ka , evt : "click" , key : [ "y" , true ] } , { sel : "#tool_canvas_color_menu" , fn : Ub , evt : "click" } , { sel : "#tool_cut" , fn : bb , evt : "click" , key : [ q + "x" , true ] } , { sel : "#tool_copy" , fn : zb , evt : "click" , key : q + "c" } , { sel : "#tool_paste" , fn : xb , evt : "click" , key : q + "v" } , { sel : "#tool_switch" , fn : Sb , evt : "click" , key : [ "x" , true ] } , { sel : "#tool_bold" , fn : Bb , evt : "mousedown" , key : [ q + "B" , true ] } , { sel : "#tool_italic" , fn : Va , evt : "mousedown" , key : [ q +
"I" , true ] } , { sel : "#copy_save_done" , fn : w , evt : "click" } , { key : "ctrl+left" , fn : function ( ) { nb ( 0 , 1 ) } } , { key : "ctrl+right" , fn : function ( ) { nb ( 1 , 1 ) } } , { key : "ctrl+shift+left" , fn : function ( ) { nb ( 0 , 5 ) } } , { key : "ctrl+shift+right" , fn : function ( ) { nb ( 1 , 5 ) } } , { key : "shift+O" , fn : mb } , { key : "shift+P" , fn : kb } , { key : [ q + "+" , true ] , fn : function ( ) { Ib ( 2 ) } } , { key : [ q + "-" , true ] , fn : function ( ) { Ib ( 0.5 ) } } , { key : [ "up" , true ] , fn : function ( ) { S ( 0 , - 1 ) } } , { key : [ "down" , true ] , fn : function ( ) { S ( 0 , 1 ) } } , { key : [ "left" , true ] , fn : function ( ) { S ( - 1 , 0 ) } } , { key : [ "right" , true ] ,
fn : function ( ) { S ( 1 , 0 ) } } , { key : "shift+up" , fn : function ( ) { S ( 0 , - 10 ) } } , { key : "shift+down" , fn : function ( ) { S ( 0 , 10 ) } } , { key : "shift+left" , fn : function ( ) { S ( - 10 , 0 ) } } , { key : "shift+right" , fn : function ( ) { S ( 10 , 0 ) } } , { key : [ "alt+up" , true ] , fn : function ( ) { g . cloneSelectedElements ( 0 , - 1 ) } } , { key : [ "alt+down" , true ] , fn : function ( ) { g . cloneSelectedElements ( 0 , 1 ) } } , { key : [ "alt+left" , true ] , fn : function ( ) { g . cloneSelectedElements ( - 1 , 0 ) } } , { key : [ "alt+right" , true ] , fn : function ( ) { g . cloneSelectedElements ( 1 , 0 ) } } , { key : [ "alt+shift+up" , true ] , fn : function ( ) { g . cloneSelectedElements ( 0 ,
- 10 ) } } , { key : [ "alt+shift+down" , true ] , fn : function ( ) { g . cloneSelectedElements ( 0 , 10 ) } } , { key : [ "alt+shift+left" , true ] , fn : function ( ) { g . cloneSelectedElements ( - 10 , 0 ) } } , { key : [ "alt+shift+right" , true ] , fn : function ( ) { g . cloneSelectedElements ( 10 , 0 ) } } , { key : q + "A" , fn : function ( ) { g . selectAllInCurrentLayer ( ) } } , { key : q + "shift+z" , fn : Ka } , { key : "esc" , fn : Hb } ] , A = { "4/Shift+4" : "#tools_rect_show" , "5/Shift+5" : "#tools_ellipse_show" } ; return { setAll : function ( ) { var G = { } ; a . each ( n , function ( N , J ) { if ( J . sel ) { var T = a ( J . sel ) ; if ( T . length == 0 ) return true ;
if ( J . evt ) { if ( svgedit . browser . isTouch ( ) && J . evt === "click" ) J . evt = "mousedown" ; T [ J . evt ] ( J . fn ) } if ( J . parent && a ( J . parent + "_show" ) . length != 0 ) { var da = a ( J . parent ) ; da . length || ( da = na ( J . parent . substr ( 1 ) ) ) ; da . append ( T ) ; a . isArray ( G [ J . parent ] ) || ( G [ J . parent ] = [ ] ) ; G [ J . parent ] . push ( J ) } } if ( J . key ) { var ia = J . fn , pa = false ; if ( a . isArray ( J . key ) ) { da = J . key [ 0 ] ; if ( J . key . length > 1 ) pa = J . key [ 1 ] } else da = J . key ; da += "" ; svgedit . browser . isMac && da . indexOf ( "+" ) != - 1 && da . split ( "+" ) [ 0 ] == "ctrl" && da . replace ( "ctrl" , "cmd" ) ; a . each ( da . split ( "/" ) , function ( ua ,
Ra ) { a ( document ) . bind ( "keydown" , Ra , function ( Da ) { ia ( ) ; pa && Da . preventDefault ( ) ; return false } ) } ) ; if ( J . sel && ! J . hidekey && T . attr ( "title" ) ) { var ra = T . attr ( "title" ) . split ( "[" ) [ 0 ] + " (" + da + ")" ; A [ da ] = J . sel ; T . parents ( "#main_menu" ) . length || T . attr ( "title" , ra ) } } } ) ; sa ( G ) ; a ( ".attr_changer, #image_url" ) . bind ( "keydown" , "return" , function ( N ) { a ( this ) . change ( ) ; N . preventDefault ( ) } ) ; a ( window ) . bind ( "keydown" , "tab" , function ( N ) { if ( W === "canvas" ) { N . preventDefault ( ) ; kb ( ) } } ) . bind ( "keydown" , "shift+tab" , function ( N ) { if ( W === "canvas" ) { N . preventDefault ( ) ;
mb ( ) } } ) ; a ( "#tool_zoom" ) . dblclick ( gb ) } , setTitles : function ( ) { a . each ( A , function ( G , N ) { var J = a ( N ) . parents ( "#main_menu" ) . length ; a ( N ) . each ( function ( ) { var T = J ? a ( this ) . text ( ) . split ( " [" ) [ 0 ] : this . title . split ( " [" ) [ 0 ] , da = "" ; a . each ( G . split ( "/" ) , function ( ia , pa ) { var ra = pa . split ( "+" ) , ua = "" ; if ( ra . length > 1 ) { ua = ra [ 0 ] + "+" ; pa = ra [ 1 ] } da += ( ia ? "/" : "" ) + ua + ( uiStrings [ "key_" + pa ] || pa ) } ) ; if ( J ) this . lastChild . textContent = T + " [" + da + "]" ; else this . title = T + " [" + da + "]" } ) } ) } , getButtonData : function ( G ) { var N ; a . each ( n , function ( J , T ) { if ( T . sel ===
G ) N = T } ) ; return N } } } ( ) ; H . setAll ( ) ; c . ready ( function ( ) { var n = curConfig . initTool , A = a ( "#tools_left, #svg_editor .tools_flyout" ) , G = A . find ( "#tool_" + n ) ; n = A . find ( "#" + n ) ; ( G . length ? G : n . length ? n : 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 : D , cursor : false } ) ; a ( "#canvas_width" ) . dragInput ( { min : 10 , max : null , step : 10 , callback : D ,
cursor : false } ) ; a ( "#rect_width" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#rect_height" ) . dragInput ( { min : 0 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#ellipse_cx" ) . dragInput ( { min : 0 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#ellipse_cy" ) . dragInput ( { min : 0 , 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 : 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 ( "#group_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#group_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 : function ( n ) { g . setRectRadius ( n . value ) } , cursor : true } ) ; a ( "#stroke_width" ) . dragInput ( { min : 0 , max : 99 , step : 1 , callback : function ( n ) { var A =
n . value ; if ( A == 0 && R && [ "line" , "polyline" ] . indexOf ( R . nodeName ) >= 0 ) A = n . value = 1 ; g . setStrokeWidth ( A ) } , cursor : true , smallStep : 0.1 , start : 1.5 } ) ; a ( "#angle" ) . dragInput ( { min : - 180 , max : 180 , step : 1 , callback : function ( n ) { g . setRotationAngle ( n . value ) ; rotateCursor ( n . value ) ; a ( "#tool_reorient" ) . toggleClass ( "disabled" , n . value == 0 ) } , cursor : false } ) ; a ( "#font_size" ) . dragInput ( { min : 1 , max : 250 , step : 1 , callback : function ( n ) { g . setFontSize ( n . value ) } , cursor : true , stepfunc : function ( n , A ) { var G = n . value - 0 , N = G + A , J = N >= G ; if ( A === 0 ) return G ; return G >=
24 ? J ? Math . round ( G * 1.1 ) : Math . round ( G / 1.1 ) : G <= 1 ? J ? G * 2 : G / 2 : N } } ) ; a ( "#group_opacity" ) . dragInput ( { min : 0 , max : 100 , step : 5 , callback : function ( n , A ) { if ( A == null ) A = n . value ; a ( "#group_opacity" ) . val ( A ) ; if ( ! n || ! n . handle ) a ( "#opac_slider" ) . slider ( "option" , "value" , A ) ; g . setOpacity ( A / 100 ) } , cursor : true , start : 100 } ) ; a ( "#blur" ) . dragInput ( { min : 0 , max : 10 , step : 0.1 , callback : function ( n ) { val = n . value ; a ( "#blur" ) . val ( val ) ; window . event . type == "mouseup" ? g . setBlur ( val , true ) : g . setBlurNoUndo ( val ) } , cursor : true , start : 0 } ) ; a ( "#zoom" ) . val ( g . getZoom ( ) *
100 ) ; a ( "#workarea" ) . contextMenu ( { menu : "cmenu_canvas" , inSpeed : 0 } , function ( n ) { switch ( n ) { case "delete" : Ma ( ) ; break ; case "cut" : bb ( ) ; break ; case "copy" : zb ( ) ; break ; case "paste" : g . pasteElements ( ) ; break ; case "paste_in_place" : g . pasteElements ( "in_place" ) ; break ; case "group" : g . groupSelectedElements ( ) ; break ; case "ungroup" : g . ungroupSelectedElement ( ) ; break ; case "move_front" : eb ( ) ; break ; case "move_up" : Db ( "Up" ) ; break ; case "move_down" : Db ( "Down" ) ; break ; case "move_back" : rb ( ) ; break ; default : svgedit . contextmenu && svgedit . contextmenu . hasCustomHandler ( n ) &&
svgedit . contextmenu . getCustomHandler ( n ) . call ( ) } } ) ; a ( ".contextMenu li" ) . mousedown ( function ( n ) { n . preventDefault ( ) } ) ; window . onbeforeunload = function ( ) { if ( U . getUndoStackSize ( ) === 0 ) c . show _save _warning = false ; if ( ! curConfig . no _save _warning && c . show _save _warning ) return uiStrings . notification . unsavedChanges } ; c . openPrep = function ( n ) { a ( "#main_menu" ) . hide ( ) ; U . getUndoStackSize ( ) === 0 ? n ( true ) : a . confirm ( uiStrings . notification . QwantToOpen , n ) } ; if ( window . FileReader ) { p = a ( '<input type="file">' ) . change ( function ( ) { var n = this ;
c . openPrep ( function ( A ) { if ( A ) { g . clear ( ) ; if ( n . files . length == 1 ) { A = new FileReader ; A . onloadend = function ( G ) { o ( G . target . result ) ; C ( ) } ; A . readAsText ( n . files [ 0 ] ) } } } ) } ) ; a ( "#tool_open" ) . show ( ) . prepend ( p ) ; p = a ( '<input type="file">' ) . change ( function ( ) { a ( "#main_menu" ) . hide ( ) ; if ( this . files . length == 1 ) { var n = new FileReader ; n . onloadend = function ( A ) { g . importSvgString ( A . target . result , true ) ; C ( ) } ; n . readAsText ( this . files [ 0 ] ) } } ) ; a ( "#tool_import" ) . show ( ) . prepend ( p ) } for ( var C = c . updateCanvas = function ( n , A ) { var G = V . width ( ) , N = V . height ( ) ,
J = G , T = N , da = g . getZoom ( ) , ia = a ( "#svgcanvas" ) , pa = { x : V [ 0 ] . scrollLeft + J / 2 , y : V [ 0 ] . scrollTop + T / 2 } , ra = curConfig . canvas _expansion ; G = Math . max ( J , g . contentW * da * ra ) ; N = Math . max ( T , g . contentH * da * ra ) ; G == J && N == T ? V . css ( "overflow" , "hidden" ) : V . css ( "overflow" , "scroll" ) ; ra = ia . height ( ) / 2 ; var ua = ia . width ( ) / 2 ; ia . width ( G ) . height ( N ) ; var Ra = N / 2 , Da = G / 2 , ka = g . updateCanvas ( G , N ) , lb = Da / ua ; G = G / 2 - J / 2 ; N = N / 2 - T / 2 ; if ( A ) { A . x += ka . x ; A . y += ka . y } else A = { x : Da + ( pa . x - ua ) * lb , y : Ra + ( pa . y - ra ) * lb } ; if ( n ) if ( g . contentW > V . width ( ) ) { V [ 0 ] . scrollLeft = ka . x - 10 ;
V [ 0 ] . scrollTop = ka . y - 10 } else { V [ 0 ] . scrollLeft = G ; V [ 0 ] . scrollTop = N } else { V [ 0 ] . scrollLeft = A . x - J / 2 ; V [ 0 ] . scrollTop = A . y - T / 2 } if ( curConfig . showRulers ) { l ( ia , da ) ; V . scroll ( ) } } , E = [ ] , K = 0.1 ; K < 1E5 ; K *= 10 ) { E . push ( 1 * K ) ; E . push ( 2 * K ) ; E . push ( 5 * K ) } C ( true ) ; try { var L = function ( n ) { if ( window . JSON && JSON . stringify ) return JSON . stringify ( n ) ; var A = arguments . callee ; if ( typeof n == "boolean" || typeof n == "number" ) return n + "" ; else if ( typeof n == "string" ) return '"' + n . replace ( /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g ,
function ( J ) { return "\\u" + ( "0000" + J . charCodeAt ( 0 ) . toString ( 16 ) ) . slice ( - 4 ) } ) + '"' ; else if ( n . length ) { for ( var G = 0 ; G < n . length ; G ++ ) n [ G ] = A ( n [ G ] ) ; return "[" + n . join ( "," ) + "]" } else { G = [ ] ; for ( var N in n ) G . push ( A ( N ) + ":" + A ( n [ N ] ) ) ; return "{" + G . join ( "," ) + "}" } } ; window . addEventListener ( "message" , function ( n ) { var A = parseInt ( n . data . substr ( 0 , n . data . indexOf ( ";" ) ) ) ; try { n . source . postMessage ( "SVGe" + A + ";" + L ( eval ( n . data ) ) , "*" ) } catch ( G ) { n . source . postMessage ( "SVGe" + A + ";error:" + G . message , "*" ) } } , false ) } catch ( Y ) { window . embed _error = Y } a ( function ( ) { window . svgCanvas =
g ; g . ready = svgEditor . ready } ) ; c . setLang = function ( n , A ) { a . pref ( "lang" , n ) ; a ( "#lang_select" ) . val ( n ) ; if ( A ) { g . runExtensions ( "langChanged" , n ) ; Ba ( ) ; a . each ( { "#stroke_color" : "#tool_stroke .icon_label, #tool_stroke .color_block" , "#fill_color" : "#tool_fill label, #tool_fill .color_block" , "#linejoin_miter" : "#cur_linejoin" , "#linecap_butt" : "#cur_linecap" } , function ( G , N ) { a ( N ) . attr ( "title" , a ( G ) [ 0 ] . title ) } ) ; a ( "#multiselected_panel div[id^=tool_align]" ) . each ( function ( ) { a ( "#tool_pos" + this . id . substr ( 10 ) ) [ 0 ] . title = this . title } ) } } } ;
var f = [ ] ; c . ready = function ( d ) { m ? d ( ) : f . push ( d ) } ; c . runCallbacks = function ( ) { a . each ( f , function ( ) { this ( ) } ) ; m = true } ; c . loadFromString = function ( d ) { c . ready ( function ( ) { o ( d ) } ) } ; c . loadFromURL = function ( d , l ) { l || ( l = { } ) ; var p = l . cache , B = l . callback ; c . ready ( function ( ) { a . ajax ( { url : d , dataType : "text" , cache : ! ! p , success : function ( q ) { o ( q , B ) } , error : function ( q , M , U ) { q . status != 404 && q . responseText ? o ( q . responseText , B ) : a . alert ( uiStrings . notification . URLloadFail + ": \n" + U + "" , B ) } } ) } ) } ; c . loadFromDataURI = function ( d ) { c . ready ( function ( ) { var l =
d . substring ( 26 ) ; o ( svgedit . utilities . decode64 ( l ) ) } ) } ; c . addExtension = function ( ) { var d = arguments ; a ( function ( ) { g && g . addExtension . apply ( this , d ) } ) } ; return c } ( jQuery ) ; $ ( svgEditor . init ) } ) ( ) ; $ . fn . dragInput = function ( a ) { return this . each ( function ( ) { this . repeating = false ; this . dragCfg = { min : a && ! isNaN ( parseFloat ( a . min ) ) ? Number ( a . min ) : null , max : a && ! isNaN ( parseFloat ( a . max ) ) ? Number ( a . max ) : null , step : a && a . step ? Number ( a . step ) : 1 , stepfunc : a && a . stepfunc ? a . stepfunc : false , page : a && a . page ? Number ( a . page ) : 10 , reset : a && a . reset ? a . reset : this . value , delay : a && a . delay ? Number ( a . delay ) : 500 , interval : a && a . interval ? Number ( a . interval ) : 100 , 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 ) . parent ( ) ; $ ( this ) ; var g = this . dragCfg . height , c = this . dragCfg . min , m = this . dragCfg . max , s = this . dragCfg . step , b = m - c > 0 ? ( m - c ) / s : 200 , f = b / g * s , d = 0 , l = this . getAttribute ( "data-attr" ) , p = svgEditor . canvas , B = p . getSelectedElems ( ) , q = svgedit . browser . isTouch ( ) , M = b && this . dragCfg . cursor ? $ ( "<div class='draginput_cursor' />" ) . appendTo ( o ) : false ; M &&
! isNaN ( this . dragCfg . start ) && M . css ( "top" , this . dragCfg . start * - 1 / f + g ) ; this . adjustValue = function ( U , P ) { var I ; I = isNaN ( this . value ) ? this . dragCfg . reset : $ . isFunction ( this . dragCfg . stepfunc ) ? this . dragCfg . stepfunc ( this , U ) : Number ( ( Number ( this . value ) + Number ( U ) ) . toFixed ( 5 ) ) ; if ( m !== null ) I = Math . min ( I , m ) ; if ( c !== null ) I = Math . max ( I , c ) ; M && this . updateCursor ( I ) ; this . value = I ; o . attr ( "data-value" , I ) ; $ . isFunction ( this . dragCfg . callback ) && this . dragCfg . callback ( this , P ) } ; o . toggleClass ( "draginput" , o . is ( "label" ) ) ; this . move = function ( U ,
P , I ) { if ( q ) U = U . originalEvent . touches [ 0 ] ; if ( d === 0 ) d = P ; P = ( U . pageY - d ) * - 1 ; d = U . pageY ; I = P * f ; this . adjustValue ( I . toFixed ( s < 1 ? 1 : 0 ) ) } ; this . stop = function ( ) { $ ( "body" ) . removeClass ( "dragging" ) ; o . removeClass ( "active" ) ; $ ( window ) . unbind ( "mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput" ) ; d = 0 ; if ( B [ 0 ] ) { var U = p . undoMgr . finishUndoableChange ( ) ; U . isEmpty ( ) || p . undoMgr . addCommandToHistory ( U ) } this . adjustValue ( 0 ) } ; this . updateCursor = function ( ) { var U = parseFloat ( this . value ) * - 1 / f + g ; $ ( this ) . next ( ".draginput_cursor" ) . css ( "top" ,
U ) } ; this . start = function ( U ) { if ( q ) U = U . originalEvent . touches [ 0 ] ; var P = U . pageY , I = this . value , V = this ; p . undoMgr . beginUndoableChange ( l , B ) ; $ ( "body" ) . addClass ( "dragging" ) ; o . addClass ( "active" ) ; $ ( window ) . bind ( "mousemove.draginput touchmove.draginput" , function ( ca ) { V . move ( ca , P , parseFloat ( I ) ) } ) ; $ ( window ) . bind ( "mouseup.draginput touchend.draginput" , function ( ) { V . stop ( ) } ) } ; $ ( this ) . attr ( "readonly" , "readonly" ) . attr ( "data-scale" , f ) . attr ( "data-domain" , g ) . attr ( "data-cursor" , M != false ) . bind ( "mousedown touchstart" , function ( U ) { this . start ( U ) } ) . bind ( "dblclick taphold" ,
function ( ) { this . removeAttribute ( "readonly" , "readonly" ) ; this . focus ( ) ; this . select ( ) } ) . blur ( function ( ) { this . setAttribute ( "readonly" , "readonly" ) ; this . adjustValue ( 0 ) } ) . keydown ( function ( U ) { switch ( U . keyCode ) { case 13 : this . blur ( ) ; break ; case 38 : this . adjustValue ( this . dragCfg . step ) ; break ; case 40 : this . adjustValue ( - this . dragCfg . step ) ; break ; case 33 : this . adjustValue ( this . dragCfg . page ) ; break ; case 34 : this . adjustValue ( - this . dragCfg . page ) } } ) . keypress ( function ( U ) { if ( this . repeating ) switch ( U . keyCode ) { case 38 : this . adjustValue ( this . dragCfg . step ) ;
break ; case 40 : this . adjustValue ( - this . dragCfg . step ) ; break ; case 33 : this . adjustValue ( this . dragCfg . page ) ; break ; case 34 : this . adjustValue ( - this . dragCfg . page ) } else this . repeating = true } ) . keyup ( function ( U ) { this . repeating = false ; switch ( U . keyCode ) { case 38 : case 40 : case 33 : case 34 : case 13 : this . adjustValue ( 0 ) } } ) . bind ( "mousewheel" , function ( U , P , I , V ) { if ( V > 0 ) this . adjustValue ( this . dragCfg . step , true ) ; else V < 0 && this . adjustValue ( - this . dragCfg . step , true ) ; U . preventDefault ( ) } ) } ) } ;
$ . fn . dragInput . updateCursor = function ( a ) { var o = parseFloat ( a . value ) , g = parseFloat ( a . getAttribute ( "data-scale" ) ) , c = parseFloat ( a . getAttribute ( "data-domain" ) ) ; o = o * - 1 / g + c + "px" ; if ( a = a . nextElementSibling ) a . style . top = o } ; svgedit = svgedit || { } ;
( function ( ) { var a = this ; if ( ! svgedit . contextmenu ) svgedit . contextmenu = { } ; a . contextMenuExtensions = { } ; svgEditor . ready ( function ( ) { for ( menuItem in contextMenuExtensions ) { var o = contextMenuExtensions [ menuItem ] ; Object . keys ( a . contextMenuExtensions ) . length == 0 && $ ( "#cmenu_canvas" ) . append ( "<li class='separator'>" ) ; var g = o . shortcut || "" ; $ ( "#cmenu_canvas" ) . append ( "<li class='disabled'><a href='#" + o . id + "'>" + o . label + "<span class='shortcut'>" + g + "</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 g ( m ) { return ! a ( m ) . parents ( ) . andSelf ( ) . filter ( function ( ) { return a . curCSS ( this , "visibility" ) === "hidden" || a . expr . filters . hidden ( this ) } ) . length } function c ( m , s ) { var b = m . nodeName . toLowerCase ( ) ; if ( "area" === b ) { b = m . parentNode ; var f = b . name ; if ( ! m . href || ! f || b . nodeName . toLowerCase ( ) !== "map" ) return false ; b = a ( "img[usemap=#" + f + "]" ) [ 0 ] ; return ! ! b && g ( b ) } return ( /input|select|textarea|button|object/ . test ( b ) ? ! m . disabled : "a" == b ? m . href || s : s ) && g ( m ) } 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 ( m , s ) { return typeof m == "number" ? this . each ( function ( ) { var b =
this ; setTimeout ( function ( ) { a ( b ) . focus ( ) ; s && s . call ( b ) } , m ) } ) : this . _focus . apply ( this , arguments ) } , scrollParent : function ( ) { var m ; a . browser . msie && /(static|relative)/ . test ( this . css ( "position" ) ) || /absolute/ . test ( this . css ( "position" ) ) ? m = 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 ) : m = 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" ) ) || ! m . length ? a ( document ) : m } , zIndex : function ( m ) { if ( m !== o ) return this . css ( "zIndex" , m ) ; if ( this . length ) { m = a ( this [ 0 ] ) ; for ( var s ; m . length && m [ 0 ] !== document ; ) { s = m . css ( "position" ) ; if ( s === "absolute" || s === "relative" || s === "fixed" ) { s = parseInt ( m . css ( "zIndex" ) , 10 ) ; if ( ! isNaN ( s ) && s !== 0 ) return s } m = m . parent ( ) } } return 0 } , disableSelection : function ( ) { return this . bind ( ( a . support . selectstart ? "selectstart" :
"mousedown" ) + ".ui-disableSelection" , function ( m ) { m . preventDefault ( ) } ) } , enableSelection : function ( ) { return this . unbind ( ".ui-disableSelection" ) } } ) , a . each ( [ "Width" , "Height" ] , function ( m , s ) { function b ( p , B , q , M ) { a . each ( f , function ( ) { B -= parseFloat ( a . curCSS ( p , "padding" + this , true ) ) || 0 ; q && ( B -= parseFloat ( a . curCSS ( p , "border" + this + "Width" , true ) ) || 0 ) ; M && ( B -= parseFloat ( a . curCSS ( p , "margin" + this , true ) ) || 0 ) } ) ; return B } var f = s === "Width" ? [ "Left" , "Right" ] : [ "Top" , "Bottom" ] , d = s . toLowerCase ( ) , l = { innerWidth : a . fn . innerWidth , innerHeight : a . fn . innerHeight ,
outerWidth : a . fn . outerWidth , outerHeight : a . fn . outerHeight } ; a . fn [ "inner" + s ] = function ( p ) { if ( p === o ) return l [ "inner" + s ] . call ( this ) ; return this . each ( function ( ) { a ( this ) . css ( d , b ( this , p ) + "px" ) } ) } ; a . fn [ "outer" + s ] = function ( p , B ) { if ( typeof p != "number" ) return l [ "outer" + s ] . call ( this , p ) ; return this . each ( function ( ) { a ( this ) . css ( d , b ( this , p , true , B ) + "px" ) } ) } } ) , a . extend ( a . expr [ ":" ] , { data : function ( m , s , b ) { return ! ! a . data ( m , b [ 3 ] ) } , focusable : function ( m ) { return c ( m , ! isNaN ( a . attr ( m , "tabindex" ) ) ) } , tabbable : function ( m ) { var s = a . attr ( m ,
"tabindex" ) , b = isNaN ( s ) ; return ( b || s >= 0 ) && c ( m , ! b ) } } ) , a ( function ( ) { var m = document . body , s = m . 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 ; m . removeChild ( s ) . style . display = "none" } ) , a . extend ( a . ui , { plugin : { add : function ( m , s , b ) { m = a . ui [ m ] . prototype ; for ( var f in b ) { m . plugins [ f ] = m . plugins [ f ] || [ ] ; m . plugins [ f ] . push ( [ s , b [ f ] ] ) } } , call : function ( m , s , b ) { if ( ( s = m . plugins [ s ] ) &&
m . element [ 0 ] . parentNode ) for ( var f = 0 ; f < s . length ; f ++ ) m . options [ s [ f ] [ 0 ] ] && s [ f ] [ 1 ] . apply ( m . element , b ) } } , contains : function ( m , s ) { return document . compareDocumentPosition ? m . compareDocumentPosition ( s ) & 16 : m !== s && m . contains ( s ) } , hasScroll : function ( m , s ) { if ( a ( m ) . css ( "overflow" ) === "hidden" ) return false ; var b = s && s === "left" ? "scrollLeft" : "scrollTop" , f = false ; if ( m [ b ] > 0 ) return true ; m [ b ] = 1 ; f = m [ b ] > 0 ; m [ b ] = 0 ; return f } , isOverAxis : function ( m , s , b ) { return m > s && m < s + b } , isOver : function ( m , s , b , f , d , l ) { return a . ui . isOverAxis ( m , b , d ) &&
2012-07-24 02:30:12 +00:00
a . ui . isOverAxis ( s , f , l ) } } ) ) } ) ( jQuery ) ;
2012-07-24 12:42:34 +00:00
( function ( a , o ) { if ( a . cleanData ) { var g = a . cleanData ; a . cleanData = function ( m ) { for ( var s = 0 , b ; ( b = m [ s ] ) != null ; s ++ ) try { a ( b ) . triggerHandler ( "remove" ) } catch ( f ) { } g ( m ) } } else { var c = a . fn . remove ; a . fn . remove = function ( m , s ) { return this . each ( function ( ) { s || ( ! m || a . filter ( m , [ this ] ) . length ) && a ( "*" , this ) . add ( [ this ] ) . each ( function ( ) { try { a ( this ) . triggerHandler ( "remove" ) } catch ( b ) { } } ) ; return c . call ( a ( this ) , m , s ) } ) } } a . widget = function ( m , s , b ) { var f = m . split ( "." ) [ 0 ] , d ; m = m . split ( "." ) [ 1 ] ; d = f + "-" + m ; b || ( b = s , s = a . Widget ) ; a . expr [ ":" ] [ d ] =
function ( l ) { return ! ! a . data ( l , m ) } ; a [ f ] = a [ f ] || { } ; a [ f ] [ m ] = function ( l , p ) { arguments . length && this . _createWidget ( l , p ) } ; s = new s ; s . options = a . extend ( true , { } , s . options ) ; a [ f ] [ m ] . prototype = a . extend ( true , s , { namespace : f , widgetName : m , widgetEventPrefix : a [ f ] [ m ] . prototype . widgetEventPrefix || m , widgetBaseClass : d } , b ) ; a . widget . bridge ( m , a [ f ] [ m ] ) } ; a . widget . bridge = function ( m , s ) { a . fn [ m ] = function ( b ) { var f = typeof b == "string" , d = Array . prototype . slice . call ( arguments , 1 ) , l = this ; b = ! f && d . length ? a . extend . apply ( null , [ true , b ] . concat ( d ) ) :
b ; if ( f && b . charAt ( 0 ) === "_" ) return l ; f ? this . each ( function ( ) { var p = a . data ( this , m ) , B = p && a . isFunction ( p [ b ] ) ? p [ b ] . apply ( p , d ) : p ; if ( B !== p && B !== o ) { l = B ; return false } } ) : this . each ( function ( ) { var p = a . data ( this , m ) ; p ? p . option ( b || { } ) . _init ( ) : a . data ( this , m , new s ( b , this ) ) } ) ; return l } } ; a . Widget = function ( m , s ) { arguments . length && this . _createWidget ( m , s ) } ; a . Widget . prototype = { widgetName : "widget" , widgetEventPrefix : "" , options : { disabled : false } , _createWidget : function ( m , s ) { a . data ( s , this . widgetName , this ) ; this . element = a ( s ) ; this . options =
a . extend ( true , { } , this . options , this . _getCreateOptions ( ) , m ) ; var b = this ; this . element . bind ( "remove." + this . widgetName , function ( ) { b . 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 ( m , s ) { var b = m ; if ( arguments . length === 0 ) return a . extend ( { } , this . options ) ; if ( typeof m == "string" ) { if ( s === o ) return this . options [ m ] ; b = { } ; b [ m ] = s } this . _setOptions ( b ) ; return this } , _setOptions : function ( m ) { var s = this ; a . each ( m , function ( b , f ) { s . _setOption ( b , f ) } ) ; return this } , _setOption : function ( m , s ) { this . options [ m ] = s ; m === "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 ( m , s , b ) { var f , d = this . options [ m ] ; b = b || { } ; s = a . Event ( s ) ; s . type = ( m === this . widgetEventPrefix ? m : this . widgetEventPrefix + m ) . toLowerCase ( ) ; s . target = this . element [ 0 ] ; if ( m = s . originalEvent ) for ( f in m ) f in s || ( s [ f ] = m [ f ] ) ; this . element . trigger ( s , b ) ; return ! ( a . isFunction ( d ) && d . call ( this . element [ 0 ] , s , b ) === 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 g = this ; this . element . bind ( "mousedown." + this . widgetName , function ( c ) { return g . _mouseDown ( c ) } ) . bind ( "click." + this . widgetName , function ( c ) { if ( true === a . data ( c . target , g . widgetName + ".preventClickEvent" ) ) { a . removeData ( c . target , g . widgetName + ".preventClickEvent" ) ; c . stopImmediatePropagation ( ) ; return false } } ) ; this . started = false } , _mouseDestroy : function ( ) { this . element . unbind ( "." +
this . widgetName ) } , _mouseDown : function ( g ) { if ( ! o ) { this . _mouseStarted && this . _mouseUp ( g ) ; this . _mouseDownEvent = g ; var c = this , m = g . which == 1 , s = typeof this . options . cancel == "string" && g . target . nodeName ? a ( g . target ) . closest ( this . options . cancel ) . length : false ; if ( ! m || s || ! this . _mouseCapture ( g ) ) return true ; ( this . mouseDelayMet = ! this . options . delay ) || ( this . _mouseDelayTimer = setTimeout ( function ( ) { c . mouseDelayMet = true } , this . options . delay ) ) ; if ( this . _mouseDistanceMet ( g ) && this . _mouseDelayMet ( g ) ) { this . _mouseStarted = this . _mouseStart ( g ) !==
false ; if ( ! this . _mouseStarted ) { g . preventDefault ( ) ; return true } } true === a . data ( g . target , this . widgetName + ".preventClickEvent" ) && a . removeData ( g . target , this . widgetName + ".preventClickEvent" ) ; this . _mouseMoveDelegate = function ( b ) { return c . _mouseMove ( b ) } ; this . _mouseUpDelegate = function ( b ) { return c . _mouseUp ( b ) } ; a ( document ) . bind ( "mousemove." + this . widgetName , this . _mouseMoveDelegate ) . bind ( "mouseup." + this . widgetName , this . _mouseUpDelegate ) ; g . preventDefault ( ) ; return o = true } } , _mouseMove : function ( g ) { if ( a . browser . msie &&
2012-07-24 02:30:12 +00:00
! ( document . documentMode >= 9 ) && ! g . button ) return this . _mouseUp ( g ) ; if ( this . _mouseStarted ) { this . _mouseDrag ( g ) ; return g . preventDefault ( ) } this . _mouseDistanceMet ( g ) && this . _mouseDelayMet ( g ) && ( this . _mouseStarted = this . _mouseStart ( this . _mouseDownEvent , g ) !== false , this . _mouseStarted ? this . _mouseDrag ( g ) : this . _mouseUp ( g ) ) ; return ! this . _mouseStarted } , _mouseUp : function ( g ) { a ( document ) . unbind ( "mousemove." + this . widgetName , this . _mouseMoveDelegate ) . unbind ( "mouseup." + this . widgetName , this . _mouseUpDelegate ) ; this . _mouseStarted &&
( this . _mouseStarted = false , g . target == this . _mouseDownEvent . target && a . data ( g . target , this . widgetName + ".preventClickEvent" , true ) , this . _mouseStop ( g ) ) ; return false } , _mouseDistanceMet : function ( g ) { return Math . max ( Math . abs ( this . _mouseDownEvent . pageX - g . pageX ) , Math . abs ( this . _mouseDownEvent . pageY - g . pageY ) ) >= this . options . distance } , _mouseDelayMet : function ( ) { return this . mouseDelayMet } , _mouseStart : function ( ) { } , _mouseDrag : function ( ) { } , _mouseStop : function ( ) { } , _mouseCapture : function ( ) { return true } } ) } ) ( jQuery ) ;
2012-07-14 20:36:17 +00:00
( 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" &&
2012-07-24 12:42:34 +00:00
! /^(?: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 g = this . options ;
if ( this . helper || g . disabled || a ( o . target ) . is ( ".ui-resizable-handle" ) ) return false ; this . handle = this . _getHandle ( o ) ; if ( ! this . handle ) return false ; g . iframeFix && a ( g . iframeFix === true ? "iframe" : g . 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 g = 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 ; g . cursorAt && this . _adjustOffsetFromHelper ( g . cursorAt ) ; g . containment && this . _setContainment ( ) ; if ( this . _trigger ( "start" , o ) === false ) { this . _clear ( ) ; return false } this . _cacheHelperProportions ( ) ; a . ui . ddmanager && ! g . 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 , g ) { this . position = this . _generatePosition ( o ) ; this . positionAbs = this . _convertPositionTo ( "absolute" ) ; if ( ! g ) { var c = this . _uiHash ( ) ; if ( this . _trigger ( "drag" , o , c ) === false ) { this . _mouseUp ( { } ) ; return false } this . position = c . 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 g =
false ; a . ui . ddmanager && ! this . options . dropBehaviour && ( g = a . ui . ddmanager . drop ( this , o ) ) ; this . dropped && ( g = this . dropped , this . dropped = false ) ; if ( ( ! this . element [ 0 ] || ! this . element [ 0 ] . parentNode ) && this . options . helper == "original" ) return false ; if ( this . options . revert == "invalid" && ! g || this . options . revert == "valid" && g || this . options . revert === true || a . isFunction ( this . options . revert ) && this . options . revert . call ( this . element , g ) ) { var c = this ; a ( this . helper ) . animate ( this . originalPosition , parseInt ( this . options . revertDuration , 10 ) ,
function ( ) { c . _trigger ( "stop" , o ) !== false && c . _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 g = ! 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 && ( g = true ) } ) ; return g } , _createHelper : function ( o ) { var g = this . options ; o = a . isFunction ( g . helper ) ? a ( g . helper . apply ( this . element [ 0 ] , [ o ] ) ) : g . helper == "clone" ? this . element . clone ( ) . removeAttr ( "id" ) : this . element ; o . parents ( "body" ) . length || o . appendTo ( g . appendTo == "parent" ? this . element [ 0 ] . parentNode : g . 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 g = o [ 0 ] ; if ( g ) { o . offset ( ) ; var c = a ( g ) . css ( "overflow" ) !=
"hidden" ; this . containment = [ ( parseInt ( a ( g ) . css ( "borderLeftWidth" ) , 10 ) || 0 ) + ( parseInt ( a ( g ) . css ( "paddingLeft" ) , 10 ) || 0 ) , ( parseInt ( a ( g ) . css ( "borderTopWidth" ) , 10 ) || 0 ) + ( parseInt ( a ( g ) . css ( "paddingTop" ) , 10 ) || 0 ) , ( c ? Math . max ( g . scrollWidth , g . offsetWidth ) : g . offsetWidth ) - ( parseInt ( a ( g ) . css ( "borderLeftWidth" ) , 10 ) || 0 ) - ( parseInt ( a ( g ) . css ( "paddingRight" ) , 10 ) || 0 ) - this . helperProportions . width - this . margins . left - this . margins . right , ( c ? Math . max ( g . scrollHeight , g . offsetHeight ) : g . offsetHeight ) - ( parseInt ( a ( g ) . css ( "borderTopWidth" ) ,
10 ) || 0 ) - ( parseInt ( a ( g ) . 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 , g ) { g || ( g = this . position ) ; var c = o == "absolute" ? 1 : - 1 , m = 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 ( m [ 0 ] . tagName ) ; return { top : g . top +
this . offset . relative . top * c + this . offset . parent . top * c - ( a . browser . safari && a . browser . version < 526 && this . cssPosition == "fixed" ? 0 : ( this . cssPosition == "fixed" ? - this . scrollParent . scrollTop ( ) : s ? 0 : m . scrollTop ( ) ) * c ) , left : g . left + this . offset . relative . left * c + this . offset . parent . left * c - ( a . browser . safari && a . browser . version < 526 && this . cssPosition == "fixed" ? 0 : ( this . cssPosition == "fixed" ? - this . scrollParent . scrollLeft ( ) : s ? 0 : m . scrollLeft ( ) ) * c ) } } , _generatePosition : function ( o ) { var g = this . options , c = this . cssPosition == "absolute" &&
( this . scrollParent [ 0 ] == document || ! a . ui . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) ? this . offsetParent : this . scrollParent , m = /(html|body)/i . test ( c [ 0 ] . tagName ) , s = o . pageX , b = o . pageY ; if ( this . originalPosition ) { var f ; if ( this . containment ) { if ( this . relative _container ) { f = this . relative _container . offset ( ) ; f = [ this . containment [ 0 ] + f . left , this . containment [ 1 ] + f . top , this . containment [ 2 ] + f . left , this . containment [ 3 ] + f . top ] } else f = this . containment ; o . pageX - this . offset . click . left < f [ 0 ] && ( s = f [ 0 ] + this . offset . click . left ) ;
o . pageY - this . offset . click . top < f [ 1 ] && ( b = f [ 1 ] + this . offset . click . top ) ; o . pageX - this . offset . click . left > f [ 2 ] && ( s = f [ 2 ] + this . offset . click . left ) ; o . pageY - this . offset . click . top > f [ 3 ] && ( b = f [ 3 ] + this . offset . click . top ) } if ( g . grid ) { b = g . grid [ 1 ] ? this . originalPageY + Math . round ( ( b - this . originalPageY ) / g . grid [ 1 ] ) * g . grid [ 1 ] : this . originalPageY ; b = f ? b - this . offset . click . top < f [ 1 ] || b - this . offset . click . top > f [ 3 ] ? b - this . offset . click . top < f [ 1 ] ? b + g . grid [ 1 ] : b - g . grid [ 1 ] : b : b ; s = g . grid [ 0 ] ? this . originalPageX + Math . round ( ( s - this . originalPageX ) /
g . grid [ 0 ] ) * g . grid [ 0 ] : this . originalPageX ; s = f ? s - this . offset . click . left < f [ 0 ] || s - this . offset . click . left > f [ 2 ] ? s - this . offset . click . left < f [ 0 ] ? s + g . grid [ 0 ] : s - g . grid [ 0 ] : s : s } } return { top : b - 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 ( ) : m ? 0 : c . 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 ( ) : m ? 0 : c . 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 , g , c ) { c = c || this . _uiHash ( ) ; a . ui . plugin . call ( this , o , [ g , c ] ) ; o == "drag" && ( this . positionAbs = this . _convertPositionTo ( "absolute" ) ) ; return a . Widget . prototype . _trigger . call ( this , o , g ,
c ) } , 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 , g ) { var c = a ( this ) . data ( "draggable" ) , m = c . options , s = a . extend ( { } , g , { item : c . element } ) ; c . sortables = [ ] ; a ( m . connectToSortable ) . each ( function ( ) { var b = a . data ( this , "sortable" ) ; b && ! b . options . disabled && ( c . sortables . push ( { instance : b , shouldRevert : b . options . revert } ) ,
b . refreshPositions ( ) , b . _trigger ( "activate" , o , s ) ) } ) } , stop : function ( o , g ) { var c = a ( this ) . data ( "draggable" ) , m = a . extend ( { } , g , { item : c . element } ) ; a . each ( c . sortables , function ( ) { this . instance . isOver ? ( this . instance . isOver = 0 , c . 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 , c . options . helper == "original" && this . instance . currentItem . css ( { top : "auto" , left : "auto" } ) ) :
( this . instance . cancelHelperRemoval = false , this . instance . _trigger ( "deactivate" , o , m ) ) } ) } , drag : function ( o , g ) { var c = a ( this ) . data ( "draggable" ) , m = this ; a . each ( c . sortables , function ( ) { this . instance . positionAbs = c . positionAbs ; this . instance . helperProportions = c . helperProportions ; this . instance . offset . click = c . offset . click ; this . instance . _intersectsWith ( this . instance . containerCache ) ? ( this . instance . isOver || ( this . instance . isOver = 1 , this . instance . currentItem = a ( m ) . 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 g . helper [ 0 ] } , o . target = this . instance . currentItem [ 0 ] , this . instance . _mouseCapture ( o , true ) , this . instance . _mouseStart ( o , true , true ) , this . instance . offset . click . top = c . offset . click . top , this . instance . offset . click . left = c . offset . click . left , this . instance . offset . parent . left -= c . offset . parent . left - this . instance . offset . parent . left , this . instance . offset . parent . top -= c . offset . parent . top - this . instance . offset . parent . top ,
c . _trigger ( "toSortable" , o ) , c . dropped = this . instance . element , c . currentItem = c . element , this . instance . fromOutside = c ) , 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 ( ) , c . _trigger ( "fromSortable" , o ) , c . dropped = false ) } ) } } ) ; a . ui . plugin . add ( "draggable" , "cursor" , { start : function ( ) { var o = a ( "body" ) , g = a ( this ) . data ( "draggable" ) . options ; o . css ( "cursor" ) && ( g . _cursor = o . css ( "cursor" ) ) ; o . css ( "cursor" , g . 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 , g ) { var c = a ( g . helper ) , m = a ( this ) . data ( "draggable" ) . options ; c . css ( "opacity" ) && ( m . _opacity =
c . css ( "opacity" ) ) ; c . css ( "opacity" , m . opacity ) } , stop : function ( o , g ) { var c = a ( this ) . data ( "draggable" ) . options ; c . _opacity && a ( g . helper ) . css ( "opacity" , c . _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 g = a ( this ) . data ( "draggable" ) , c = g . options , m = false ; if ( g . scrollParent [ 0 ] != document && g . scrollParent [ 0 ] . tagName != "HTML" ) { if ( ! c . axis ||
c . axis != "x" ) g . overflowOffset . top + g . scrollParent [ 0 ] . offsetHeight - o . pageY < c . scrollSensitivity ? g . scrollParent [ 0 ] . scrollTop = m = g . scrollParent [ 0 ] . scrollTop + c . scrollSpeed : o . pageY - g . overflowOffset . top < c . scrollSensitivity && ( g . scrollParent [ 0 ] . scrollTop = m = g . scrollParent [ 0 ] . scrollTop - c . scrollSpeed ) ; if ( ! c . axis || c . axis != "y" ) g . overflowOffset . left + g . scrollParent [ 0 ] . offsetWidth - o . pageX < c . scrollSensitivity ? g . scrollParent [ 0 ] . scrollLeft = m = g . scrollParent [ 0 ] . scrollLeft + c . scrollSpeed : o . pageX - g . overflowOffset . left < c . scrollSensitivity &&
( g . scrollParent [ 0 ] . scrollLeft = m = g . scrollParent [ 0 ] . scrollLeft - c . scrollSpeed ) } else { if ( ! c . axis || c . axis != "x" ) o . pageY - a ( document ) . scrollTop ( ) < c . scrollSensitivity ? m = a ( document ) . scrollTop ( a ( document ) . scrollTop ( ) - c . scrollSpeed ) : a ( window ) . height ( ) - ( o . pageY - a ( document ) . scrollTop ( ) ) < c . scrollSensitivity && ( m = a ( document ) . scrollTop ( a ( document ) . scrollTop ( ) + c . scrollSpeed ) ) ; if ( ! c . axis || c . axis != "y" ) o . pageX - a ( document ) . scrollLeft ( ) < c . scrollSensitivity ? m = a ( document ) . scrollLeft ( a ( document ) . scrollLeft ( ) - c . scrollSpeed ) :
a ( window ) . width ( ) - ( o . pageX - a ( document ) . scrollLeft ( ) ) < c . scrollSensitivity && ( m = a ( document ) . scrollLeft ( a ( document ) . scrollLeft ( ) + c . scrollSpeed ) ) } m !== false && a . ui . ddmanager && ! c . dropBehaviour && a . ui . ddmanager . prepareOffsets ( g , o ) } } ) ; a . ui . plugin . add ( "draggable" , "snap" , { start : function ( ) { var o = a ( this ) . data ( "draggable" ) , g = o . options ; o . snapElements = [ ] ; a ( g . snap . constructor != String ? g . snap . items || ":data(draggable)" : g . snap ) . each ( function ( ) { var c = a ( this ) , m = c . offset ( ) ; this != o . element [ 0 ] && o . snapElements . push ( { item : this ,
width : c . outerWidth ( ) , height : c . outerHeight ( ) , top : m . top , left : m . left } ) } ) } , drag : function ( o , g ) { for ( var c = a ( this ) . data ( "draggable" ) , m = c . options , s = m . snapTolerance , b = g . offset . left , f = b + c . helperProportions . width , d = g . offset . top , l = d + c . helperProportions . height , p = c . snapElements . length - 1 ; p >= 0 ; p -- ) { var B = c . snapElements [ p ] . left , q = B + c . snapElements [ p ] . width , M = c . snapElements [ p ] . top , U = M + c . snapElements [ p ] . height ; if ( B - s < b && b < q + s && M - s < d && d < U + s || B - s < b && b < q + s && M - s < l && l < U + s || B - s < f && f < q + s && M - s < d && d < U + s || B - s < f && f < q + s && M - s < l &&
l < U + s ) { if ( m . snapMode != "inner" ) { var P = Math . abs ( M - l ) <= s , I = Math . abs ( U - d ) <= s , V = Math . abs ( B - f ) <= s , ca = Math . abs ( q - b ) <= s ; P && ( g . position . top = c . _convertPositionTo ( "relative" , { top : M - c . helperProportions . height , left : 0 } ) . top - c . margins . top ) ; I && ( g . position . top = c . _convertPositionTo ( "relative" , { top : U , left : 0 } ) . top - c . margins . top ) ; V && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : B - c . helperProportions . width } ) . left - c . margins . left ) ; ca && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : q } ) . left - c . margins . left ) } var Q =
P || I || V || ca ; if ( m . snapMode != "outer" ) { P = Math . abs ( M - d ) <= s ; I = Math . abs ( U - l ) <= s ; V = Math . abs ( B - b ) <= s ; ca = Math . abs ( q - f ) <= s ; P && ( g . position . top = c . _convertPositionTo ( "relative" , { top : M , left : 0 } ) . top - c . margins . top ) ; I && ( g . position . top = c . _convertPositionTo ( "relative" , { top : U - c . helperProportions . height , left : 0 } ) . top - c . margins . top ) ; V && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : B } ) . left - c . margins . left ) ; ca && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : q - c . helperProportions . width } ) . left -
c . margins . left ) } ! c . snapElements [ p ] . snapping && ( P || I || V || ca || Q ) && c . options . snap . snap && c . options . snap . snap . call ( c . element , o , a . extend ( c . _uiHash ( ) , { snapItem : c . snapElements [ p ] . item } ) ) ; c . snapElements [ p ] . snapping = P || I || V || ca || Q } else { c . snapElements [ p ] . snapping && c . options . snap . release && c . options . snap . release . call ( c . element , o , a . extend ( c . _uiHash ( ) , { snapItem : c . snapElements [ p ] . item } ) ) ; c . snapElements [ p ] . 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 ( c , m ) { return ( parseInt ( a ( c ) . css ( "zIndex" ) , 10 ) || 0 ) - ( parseInt ( a ( m ) . css ( "zIndex" ) , 10 ) || 0 ) } ) ; if ( o . length ) { var g = parseInt ( o [ 0 ] . style . zIndex ) || 0 ; a ( o ) . each ( function ( c ) { this . style . zIndex = g + c } ) ; this [ 0 ] . style . zIndex = g + o . length } } } ) ; a . ui . plugin . add ( "draggable" , "zIndex" , { start : function ( o , g ) { var c = a ( g . helper ) , m = a ( this ) . data ( "draggable" ) . options ; c . css ( "zIndex" ) && ( m . _zIndex = c . css ( "zIndex" ) ) ; c . css ( "zIndex" , m . zIndex ) } , stop : function ( o , g ) { var c = a ( this ) . data ( "draggable" ) . options ;
c . _zIndex && a ( g . helper ) . css ( "zIndex" , c . _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 , g = this . options , c = this . element . find ( ".ui-slider-handle" ) . addClass ( "ui-state-default ui-corner-all" ) , m = g . values && g . 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" + ( g . disabled ? " ui-slider-disabled ui-disabled" : "" ) ) ; this . range = a ( [ ] ) ; g . range && ( g . range === true && ( g . values || ( g . values = [ this . _valueMin ( ) , this . _valueMin ( ) ] ) , g . values . length && g . values . length !== 2 && ( g . values = [ g . values [ 0 ] , g . values [ 0 ] ] ) ) , this . range = a ( "<div></div>" ) . appendTo ( this . element ) . addClass ( "ui-slider-range ui-widget-header" + ( g . range === "min" || g . range === "max" ? " ui-slider-range-" + g . range : "" ) ) ) ; for ( var b = c . length ; b < m ; b += 1 ) s . push ( "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>" ) ;
this . handles = c . add ( a ( s . join ( "" ) ) . appendTo ( o . element ) ) ; this . handle = this . handles . eq ( 0 ) ; this . handles . add ( this . range ) . filter ( "a" ) . click ( function ( f ) { f . preventDefault ( ) } ) . hover ( function ( ) { g . disabled || a ( this ) . addClass ( "ui-state-hover" ) } , function ( ) { a ( this ) . removeClass ( "ui-state-hover" ) } ) . focus ( function ( ) { g . 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 ( f ) { a ( this ) . data ( "index.ui-slider-handle" ,
f ) } ) ; this . handles . keydown ( function ( f ) { var d = true , l = a ( this ) . data ( "index.ui-slider-handle" ) , p , B , q ; if ( ! o . options . disabled ) { switch ( f . 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" ) ; p = o . _start ( f , l ) ; if ( p === false ) return } } p = o . options . step ; o . options . values && o . options . values . length ?
B = q = o . values ( l ) : B = q = o . value ( ) ; switch ( f . keyCode ) { case a . ui . keyCode . HOME : q = o . _valueMin ( ) ; break ; case a . ui . keyCode . END : q = o . _valueMax ( ) ; break ; case a . ui . keyCode . PAGE _UP : q = o . _trimAlignValue ( B + ( o . _valueMax ( ) - o . _valueMin ( ) ) / 5 ) ; break ; case a . ui . keyCode . PAGE _DOWN : q = o . _trimAlignValue ( B - ( o . _valueMax ( ) - o . _valueMin ( ) ) / 5 ) ; break ; case a . ui . keyCode . UP : case a . ui . keyCode . RIGHT : if ( B === o . _valueMax ( ) ) return ; q = o . _trimAlignValue ( B + p ) ; break ; case a . ui . keyCode . DOWN : case a . ui . keyCode . LEFT : if ( B === o . _valueMin ( ) ) return ; q = o . _trimAlignValue ( B -
p ) } o . _slide ( f , l , q ) ; return d } } ) . keyup ( function ( f ) { var d = a ( this ) . data ( "index.ui-slider-handle" ) ; o . _keySliding && ( o . _keySliding = false , o . _stop ( f , d ) , o . _change ( f , 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 g = this . options , c , m , s , b , f ; if ( g . disabled ) return false ; this . elementSize = { width : this . element . outerWidth ( ) , height : this . element . outerHeight ( ) } ; this . elementOffset = this . element . offset ( ) ; c = this . _normValueFromMouse ( { x : o . pageX , y : o . pageY } ) ; m = this . _valueMax ( ) - this . _valueMin ( ) + 1 ; b = this ; this . handles . each ( function ( d ) { var l = Math . abs ( c - b . values ( d ) ) ; m > l && ( m = l , s = a ( this ) , f = d ) } ) ; g . range === true && this . values ( 1 ) === g . min && ( f += 1 , s = a ( this . handles [ f ] ) ) ; if ( this . _start ( o , f ) === false ) return false ;
this . _mouseSliding = true ; b . _handleIndex = f ; s . addClass ( "ui-state-active" ) . focus ( ) ; g = s . offset ( ) ; this . _clickOffset = ! a ( o . target ) . parents ( ) . andSelf ( ) . is ( ".ui-slider-handle" ) ? { left : 0 , top : 0 } : { left : o . pageX - g . left - s . width ( ) / 2 , top : o . pageY - g . 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 , f , c ) ; return this . _animateOff = true } , _mouseStart : function ( ) { return true } , _mouseDrag : function ( o ) { var g =
this . _normValueFromMouse ( { x : o . pageX , y : o . pageY } ) ; this . _slide ( o , this . _handleIndex , g ) ; 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 g , c ; this . orientation === "horizontal" ?
( g = this . elementSize . width , c = o . x - this . elementOffset . left - ( this . _clickOffset ? this . _clickOffset . left : 0 ) ) : ( g = this . elementSize . height , c = o . y - this . elementOffset . top - ( this . _clickOffset ? this . _clickOffset . top : 0 ) ) ; o = c / g ; o > 1 && ( o = 1 ) ; o < 0 && ( o = 0 ) ; this . orientation === "vertical" && ( o = 1 - o ) ; g = this . _valueMax ( ) - this . _valueMin ( ) ; return this . _trimAlignValue ( this . _valueMin ( ) + o * g ) } , _start : function ( o , g ) { var c = { handle : this . handles [ g ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( c . value = this . values ( g ) ,
c . values = this . values ( ) ) ; return this . _trigger ( "start" , o , c ) } , _slide : function ( o , g , c ) { var m , s , b ; this . options . values && this . options . values . length ? ( m = this . values ( g ? 0 : 1 ) , this . options . values . length === 2 && this . options . range === true && ( g === 0 && c > m || g === 1 && c < m ) && ( c = m ) , c !== this . values ( g ) && ( s = this . values ( ) , s [ g ] = c , b = this . _trigger ( "slide" , o , { handle : this . handles [ g ] , value : c , values : s } ) , this . values ( g ? 0 : 1 ) , b !== false && this . values ( g , c , true ) ) ) : c !== this . value ( ) && ( b = this . _trigger ( "slide" , o , { handle : this . handles [ g ] , value : c } ) , b !==
false && this . value ( c ) ) } , _stop : function ( o , g ) { var c = { handle : this . handles [ g ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( c . value = this . values ( g ) , c . values = this . values ( ) ) ; this . _trigger ( "stop" , o , c ) } , _change : function ( o , g ) { if ( ! this . _keySliding && ! this . _mouseSliding ) { var c = { handle : this . handles [ g ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( c . value = this . values ( g ) , c . values = this . values ( ) ) ; this . _trigger ( "change" , o , c ) } } , 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 , g ) { var c , m , s ; if ( arguments . length > 1 ) { this . options . values [ o ] = this . _trimAlignValue ( g ) ; 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 ( ) ; c = this . options . values ; m = arguments [ 0 ] ; for ( s = 0 ; s < c . length ; s += 1 ) { c [ s ] = this . _trimAlignValue ( m [ s ] ) ; this . _change ( null ,
s ) } this . _refreshValue ( ) } } , _setOption : function ( o , g ) { var c , m = 0 ; a . isArray ( this . options . values ) && ( m = this . options . values . length ) ; a . Widget . prototype . _setOption . apply ( this , arguments ) ; switch ( o ) { case "disabled" : g ? ( 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 ( c = 0 ; c < m ; c += 1 ) this . _change ( null , c ) ; this . _animateOff = false } } , _value : function ( ) { var o = this . options . value ; return o = this . _trimAlignValue ( o ) } , _values : function ( o ) { var g , c ; if ( arguments . length ) { g = this . options . values [ o ] ;
return g = this . _trimAlignValue ( g ) } g = this . options . values . slice ( ) ; for ( c = 0 ; c < g . length ; c += 1 ) g [ c ] = this . _trimAlignValue ( g [ c ] ) ; return g } , _trimAlignValue : function ( o ) { if ( o <= this . _valueMin ( ) ) return this . _valueMin ( ) ; if ( o >= this . _valueMax ( ) ) return this . _valueMax ( ) ; var g = this . options . step > 0 ? this . options . step : 1 , c = ( o - this . _valueMin ( ) ) % g ; o = o - c ; Math . abs ( c ) * 2 >= g && ( o += c > 0 ? g : - g ) ; return parseFloat ( o . toFixed ( 5 ) ) } , _valueMin : function ( ) { return this . options . min } , _valueMax : function ( ) { return this . options . max } , _refreshValue : function ( ) { var o =
this . options . range , g = this . options , c = this , m = this . _animateOff ? false : g . animate , s , b = { } , f , d , l , p ; this . options . values && this . options . values . length ? this . handles . each ( function ( B ) { s = ( c . values ( B ) - c . _valueMin ( ) ) / ( c . _valueMax ( ) - c . _valueMin ( ) ) * 100 ; b [ c . orientation === "horizontal" ? "left" : "bottom" ] = s + "%" ; a ( this ) . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( b , g . animate ) ; c . options . range === true && ( c . orientation === "horizontal" ? ( B === 0 && c . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { left : s + "%" } , g . animate ) , B === 1 && c . range [ m ? "animate" : "css" ] ( { width : s -
f + "%" } , { queue : false , duration : g . animate } ) ) : ( B === 0 && c . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { bottom : s + "%" } , g . animate ) , B === 1 && c . range [ m ? "animate" : "css" ] ( { height : s - f + "%" } , { queue : false , duration : g . animate } ) ) ) ; f = s } ) : ( d = this . value ( ) , l = this . _valueMin ( ) , p = this . _valueMax ( ) , s = p !== l ? ( d - l ) / ( p - l ) * 100 : 0 , b [ c . orientation === "horizontal" ? "left" : "bottom" ] = s + "%" , this . handle . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( b , g . animate ) , o === "min" && this . orientation === "horizontal" && this . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { width : s + "%" } , g . animate ) ,
o === "max" && this . orientation === "horizontal" && this . range [ m ? "animate" : "css" ] ( { width : 100 - s + "%" } , { queue : false , duration : g . animate } ) , o === "min" && this . orientation === "vertical" && this . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { height : s + "%" } , g . animate ) , o === "max" && this . orientation === "vertical" && this . range [ m ? "animate" : "css" ] ( { height : 100 - s + "%" } , { queue : false , duration : g . animate } ) ) } } ) ; a . extend ( a . ui . slider , { version : "1.8.17" } ) } ) ( jQuery ) ; ( function ( a ) { Math . precision = function ( b , f ) { if ( f === undefined ) f = 0 ; return Math . round ( b * Math . pow ( 10 , f ) ) / Math . pow ( 10 , f ) } ; var o = function ( b , f ) { var d = this , l = b . find ( "img:first" ) , p = 0 , B = 100 , q = 100 , M = 0 , U = 100 , P = 100 , I = 0 , V = 0 , ca , Q , W = [ ] , ha = function ( aa ) { for ( var Z = 0 ; Z < W . length ; Z ++ ) W [ Z ] . call ( d , d , aa ) } , X = function ( aa ) { var Z = b . offset ( ) ; ca = { l : Z . left | 0 , t : Z . top | 0 } ; clearTimeout ( Q ) ; Q = setTimeout ( function ( ) { ta . call ( d , aa ) } , 0 ) ; a ( document ) . bind ( "mousemove" , R ) . bind ( "mouseup" , ba ) ; aa . preventDefault ( ) } , R = function ( aa ) { clearTimeout ( Q ) ; Q =
setTimeout ( function ( ) { ta . call ( d , aa ) } , 0 ) ; aa . stopPropagation ( ) ; aa . preventDefault ( ) ; return false } , ba = function ( aa ) { a ( document ) . unbind ( "mouseup" , ba ) . unbind ( "mousemove" , R ) ; aa . stopPropagation ( ) ; aa . preventDefault ( ) ; return false } , ta = function ( aa ) { var Z = aa . pageX - ca . l ; aa = aa . pageY - ca . t ; var la = b . w , sa = b . h ; if ( Z < 0 ) Z = 0 ; else if ( Z > la ) Z = la ; if ( aa < 0 ) aa = 0 ; else if ( aa > sa ) aa = sa ; ja . call ( d , "xy" , { x : Z / la * q + p , y : aa / sa * P + M } ) } , ja = function ( aa , Z , la ) { if ( Z === undefined ) { if ( aa === undefined || aa == null ) aa = "xy" ; switch ( aa . toLowerCase ( ) ) { case "x" : return I ;
case "y" : return V ; default : return { x : I , y : V } } } if ( ! ( la != null && la == d ) ) { var sa = false , na , oa ; if ( aa == null ) aa = "xy" ; switch ( aa . toLowerCase ( ) ) { case "x" : na = Z && ( Z . x && Z . x | 0 || Z | 0 ) || 0 ; break ; case "y" : oa = Z && ( Z . y && Z . y | 0 || Z | 0 ) || 0 ; break ; default : na = Z && Z . x && Z . x | 0 || 0 ; oa = Z && Z . y && Z . y | 0 || 0 } if ( na != null ) { if ( na < p ) na = p ; else if ( na > B ) na = B ; if ( I != na ) { I = na ; sa = true } } if ( oa != null ) { if ( oa < M ) oa = M ; else if ( oa > U ) oa = U ; if ( V != oa ) { V = oa ; sa = true } } sa && ha . call ( d , la || d ) } } , ea = function ( aa ) { a . isFunction ( aa ) && W . push ( aa ) } ; a . extend ( true , d , { val : ja , range : function ( aa ,
Z ) { if ( Z === undefined ) { if ( aa === undefined || aa == null ) aa = "all" ; switch ( aa . toLowerCase ( ) ) { case "minx" : return p ; case "maxx" : return B ; case "rangex" : return { minX : p , maxX : B , rangeX : q } ; case "miny" : return M ; case "maxy" : return U ; case "rangey" : return { minY : M , maxY : U , rangeY : P } ; default : return { minX : p , maxX : B , rangeX : q , minY : M , maxY : U , rangeY : P } } } var la , sa , na , oa ; if ( aa == null ) aa = "all" ; switch ( aa . toLowerCase ( ) ) { case "minx" : la = Z && ( Z . minX && Z . minX | 0 || Z | 0 ) || 0 ; break ; case "maxx" : sa = Z && ( Z . maxX && Z . maxX | 0 || Z | 0 ) || 0 ; break ; case "rangex" : la =
Z && Z . minX && Z . minX | 0 || 0 ; sa = Z && Z . maxX && Z . maxX | 0 || 0 ; break ; case "miny" : na = Z && ( Z . minY && Z . minY | 0 || Z | 0 ) || 0 ; break ; case "maxy" : oa = Z && ( Z . maxY && Z . maxY | 0 || Z | 0 ) || 0 ; break ; case "rangey" : na = Z && Z . minY && Z . minY | 0 || 0 ; oa = Z && Z . maxY && Z . maxY | 0 || 0 ; break ; default : la = Z && Z . minX && Z . minX | 0 || 0 ; sa = Z && Z . maxX && Z . maxX | 0 || 0 ; na = Z && Z . minY && Z . minY | 0 || 0 ; oa = Z && Z . maxY && Z . maxY | 0 || 0 } if ( la != null && p != la ) { p = la ; q = B - p } if ( sa != null && B != sa ) { B = sa ; q = B - p } if ( na != null && M != na ) { M = na ; P = U - M } if ( oa != null && U != oa ) { U = oa ; P = U - M } } , bind : ea , unbind : function ( aa ) { if ( a . isFunction ( aa ) ) for ( var Z ; ( Z =
a . inArray ( aa , W ) ) != - 1 ; ) W . splice ( Z , 1 ) } , destroy : function ( ) { a ( document ) . unbind ( "mouseup" , ba ) . unbind ( "mousemove" , R ) ; b . unbind ( "mousedown" , X ) ; W = l = b = null } } ) ; l . src = f . arrow && f . arrow . image ; l . w = f . arrow && f . arrow . width || l . width ( ) ; l . h = f . arrow && f . arrow . height || l . height ( ) ; b . w = f . map && f . map . width || b . width ( ) ; b . h = f . map && f . map . height || b . height ( ) ; b . bind ( "mousedown" , X ) ; ea . call ( d , function ( ) { var aa = 0 , Z = 0 , la = b . w , sa = b . h , na = l . w , oa = l . h ; setTimeout ( function ( ) { if ( q > 0 ) aa = I == B ? la : I / q * la | 0 ; if ( P > 0 ) Z = V == U ? sa : V / P * sa | 0 ; if ( na >= la ) aa = ( la >>
1 ) - ( na >> 1 ) ; else aa -= na >> 1 ; if ( oa >= sa ) Z = ( sa >> 1 ) - ( oa >> 1 ) ; else Z -= oa >> 1 ; l . css ( { left : aa + "px" , top : Z + "px" } ) } , 0 ) } ) } , g = function ( b , f , d , l ) { var p = this ; b = b . find ( "td.Text input" ) ; var B = b . eq ( 3 ) , q = b . eq ( 4 ) , M = b . eq ( 5 ) , U = b . length > 7 ? b . eq ( 6 ) : null , P = b . eq ( 0 ) , I = b . eq ( 1 ) , V = b . eq ( 2 ) , ca = b . eq ( b . length > 7 ? 7 : 6 ) , Q = b . length > 7 ? b . eq ( 8 ) : null , W = function ( ja ) { if ( ! ( ja . target . value == "" && ja . target != ca . get ( 0 ) && ( d != null && ja . target != d . get ( 0 ) || d == null ) ) ) { if ( ! R ( ja ) ) return ja ; switch ( ja . target ) { case B . get ( 0 ) : switch ( ja . keyCode ) { case 38 : B . val ( ba . call ( p ,
( B . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "r" , B . val ( ) , ja . target ) ; return false ; case 40 : B . val ( ba . call ( p , ( B . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "r" , B . val ( ) , ja . target ) ; return false } break ; case q . get ( 0 ) : switch ( ja . keyCode ) { case 38 : q . val ( ba . call ( p , ( q . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "g" , q . val ( ) , ja . target ) ; return false ; case 40 : q . val ( ba . call ( p , ( q . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "g" , q . val ( ) , ja . target ) ; return false } break ; case M . get ( 0 ) : switch ( ja . keyCode ) { case 38 : M . val ( ba . call ( p , ( M . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "b" , M . val ( ) , ja . target ) ; return false ; case 40 : M . val ( ba . call ( p ,
( M . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "b" , M . val ( ) , ja . target ) ; return false } break ; case U && U . get ( 0 ) : switch ( ja . keyCode ) { case 38 : U . val ( ba . call ( p , parseFloat ( U . val ( ) ) + 1 , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( U . val ( ) * 255 / 100 , l ) , ja . target ) ; return false ; case 40 : U . val ( ba . call ( p , parseFloat ( U . val ( ) ) - 1 , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( U . val ( ) * 255 / 100 , l ) , ja . target ) ; return false } break ; case P . get ( 0 ) : switch ( ja . keyCode ) { case 38 : P . val ( ba . call ( p , ( P . val ( ) << 0 ) + 1 , 0 , 360 ) ) ; f . val ( "h" , P . val ( ) , ja . target ) ; return false ; case 40 : P . val ( ba . call ( p ,
( P . val ( ) << 0 ) - 1 , 0 , 360 ) ) ; f . val ( "h" , P . val ( ) , ja . target ) ; return false } break ; case I . get ( 0 ) : switch ( ja . keyCode ) { case 38 : I . val ( ba . call ( p , ( I . val ( ) << 0 ) + 1 , 0 , 100 ) ) ; f . val ( "s" , I . val ( ) , ja . target ) ; return false ; case 40 : I . val ( ba . call ( p , ( I . val ( ) << 0 ) - 1 , 0 , 100 ) ) ; f . val ( "s" , I . val ( ) , ja . target ) ; return false } break ; case V . get ( 0 ) : switch ( ja . keyCode ) { case 38 : V . val ( ba . call ( p , ( V . val ( ) << 0 ) + 1 , 0 , 100 ) ) ; f . val ( "v" , V . val ( ) , ja . target ) ; return false ; case 40 : V . val ( ba . call ( p , ( V . val ( ) << 0 ) - 1 , 0 , 100 ) ) ; f . val ( "v" , V . val ( ) , ja . target ) ; return false } } } } ,
ha = function ( ja ) { if ( ! ( ja . target . value == "" && ja . target != ca . get ( 0 ) && ( d != null && ja . target != d . get ( 0 ) || d == null ) ) ) { if ( ! R ( ja ) ) return ja ; switch ( ja . target ) { case B . get ( 0 ) : B . val ( ba . call ( p , B . val ( ) , 0 , 255 ) ) ; f . val ( "r" , B . val ( ) , ja . target ) ; break ; case q . get ( 0 ) : q . val ( ba . call ( p , q . val ( ) , 0 , 255 ) ) ; f . val ( "g" , q . val ( ) , ja . target ) ; break ; case M . get ( 0 ) : M . val ( ba . call ( p , M . val ( ) , 0 , 255 ) ) ; f . val ( "b" , M . val ( ) , ja . target ) ; break ; case U && U . get ( 0 ) : U . val ( ba . call ( p , U . val ( ) , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( U . val ( ) * 255 / 100 , l ) , ja . target ) ; break ; case P . get ( 0 ) : P . val ( ba . call ( p ,
P . val ( ) , 0 , 360 ) ) ; f . val ( "h" , P . val ( ) , ja . target ) ; break ; case I . get ( 0 ) : I . val ( ba . call ( p , I . val ( ) , 0 , 100 ) ) ; f . val ( "s" , I . val ( ) , ja . target ) ; break ; case V . get ( 0 ) : V . val ( ba . call ( p , V . val ( ) , 0 , 100 ) ) ; f . val ( "v" , V . val ( ) , ja . target ) ; break ; case ca . get ( 0 ) : ca . val ( ca . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 6 ) ) ; d && d . val ( ca . val ( ) ) ; f . val ( "hex" , ca . val ( ) != "" ? ca . val ( ) : null , ja . target ) ; break ; case d && d . get ( 0 ) : d . val ( d . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 6 ) ) ; ca . val ( d . val ( ) ) ; f . val ( "hex" , d . val ( ) !=
"" ? d . val ( ) : null , ja . target ) ; break ; case Q && Q . get ( 0 ) : Q . val ( Q . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 2 ) ) ; f . val ( "a" , Q . val ( ) != null ? parseInt ( Q . val ( ) , 16 ) : null , ja . target ) } } } , X = function ( ja ) { if ( f . val ( ) != null ) switch ( ja . target ) { case B . get ( 0 ) : B . val ( f . val ( "r" ) ) ; break ; case q . get ( 0 ) : q . val ( f . val ( "g" ) ) ; break ; case M . get ( 0 ) : M . val ( f . val ( "b" ) ) ; break ; case U && U . get ( 0 ) : U . val ( Math . precision ( f . val ( "a" ) * 100 / 255 , l ) ) ; break ; case P . get ( 0 ) : P . val ( f . val ( "h" ) ) ; break ; case I . get ( 0 ) : I . val ( f . val ( "s" ) ) ; break ; case V . get ( 0 ) : V . val ( f . val ( "v" ) ) ;
break ; case ca . get ( 0 ) : case d && d . get ( 0 ) : ca . val ( f . val ( "hex" ) ) ; d && d . val ( f . val ( "hex" ) ) ; break ; case Q && Q . get ( 0 ) : Q . val ( f . val ( "ahex" ) . substring ( 6 ) ) } } , R = 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 } , ba = function ( ja , ea , aa ) { if ( ja == "" || isNaN ( ja ) ) return ea ; if ( ja > aa ) return aa ; if ( ja < ea ) return ea ; return ja } , ta = function ( ja , ea ) { var aa = ja . val ( "all" ) ; if ( ea != B . get ( 0 ) ) B . val ( aa != null ? aa . r : "" ) ; if ( ea != q . get ( 0 ) ) q . val ( aa !=
null ? aa . g : "" ) ; if ( ea != M . get ( 0 ) ) M . val ( aa != null ? aa . b : "" ) ; if ( U && ea != U . get ( 0 ) ) U . val ( aa != null ? Math . precision ( aa . a * 100 / 255 , l ) : "" ) ; if ( ea != P . get ( 0 ) ) P . val ( aa != null ? aa . h : "" ) ; if ( ea != I . get ( 0 ) ) I . val ( aa != null ? aa . s : "" ) ; if ( ea != V . get ( 0 ) ) V . val ( aa != null ? aa . v : "" ) ; if ( ea != ca . get ( 0 ) && ( d && ea != d . get ( 0 ) || ! d ) ) ca . val ( aa != null ? aa . hex : "" ) ; if ( d && ea != d . get ( 0 ) && ea != ca . get ( 0 ) ) d . val ( aa != null ? aa . hex : "" ) ; if ( Q && ea != Q . get ( 0 ) ) Q . val ( aa != null ? aa . ahex . substring ( 6 ) : "" ) } ; a . extend ( true , p , { destroy : function ( ) { B . add ( q ) . add ( M ) . add ( U ) . add ( P ) . add ( I ) . add ( V ) . add ( ca ) . add ( d ) . add ( Q ) . unbind ( "keyup" ,
ha ) . unbind ( "blur" , X ) ; B . add ( q ) . add ( M ) . add ( U ) . add ( P ) . add ( I ) . add ( V ) . unbind ( "keydown" , W ) ; f . unbind ( ta ) ; Q = ca = V = I = P = U = M = q = B = null } } ) ; B . add ( q ) . add ( M ) . add ( U ) . add ( P ) . add ( I ) . add ( V ) . add ( ca ) . add ( d ) . add ( Q ) . bind ( "keyup" , ha ) . bind ( "blur" , X ) ; B . add ( q ) . add ( M ) . add ( U ) . add ( P ) . add ( I ) . add ( V ) . bind ( "keydown" , W ) ; f . bind ( ta ) } ; a . jPicker = { List : [ ] , Color : function ( b ) { var f = this , d , l , p , B , q , M , U , P = [ ] , I = function ( ca ) { for ( var Q = 0 ; Q < P . length ; Q ++ ) P [ Q ] . call ( f , f , ca ) } , V = function ( ca , Q , W ) { if ( Q === undefined ) { if ( ca === undefined || ca == null || ca == "" ) ca =
"all" ; if ( d == null ) return null ; switch ( ca . toLowerCase ( ) ) { case "ahex" : return s . rgbaToHex ( { r : d , g : l , b : p , a : B } ) ; case "hex" : return V ( "ahex" ) . substring ( 0 , 6 ) ; case "all" : return { r : d , g : l , b : p , a : B , h : q , s : M , v : U , hex : V . call ( f , "hex" ) , ahex : V . call ( f , "ahex" ) } ; default : Q = { } ; for ( var ha = 0 ; ha < ca . length ; ha ++ ) switch ( ca . charAt ( ha ) ) { case "r" : if ( ca . length == 1 ) Q = d ; else Q . r = d ; break ; case "g" : if ( ca . length == 1 ) Q = l ; else Q . g = l ; break ; case "b" : if ( ca . length == 1 ) Q = p ; else Q . b = p ; break ; case "a" : if ( ca . length == 1 ) Q = B ; else Q . a = B ; break ; case "h" : if ( ca . length ==
1 ) Q = q ; else Q . h = q ; break ; case "s" : if ( ca . length == 1 ) Q = M ; else Q . s = M ; break ; case "v" : if ( ca . length == 1 ) Q = U ; else Q . v = U } return Q == { } ? V . call ( f , "all" ) : Q } } if ( ! ( W != null && W == f ) ) { var X = false ; if ( ca == null ) ca = "" ; if ( Q == null ) { if ( d != null ) { d = null ; X = true } if ( l != null ) { l = null ; X = true } if ( p != null ) { p = null ; X = true } if ( B != null ) { B = null ; X = true } if ( q != null ) { q = null ; X = true } if ( M != null ) { M = null ; X = true } if ( U != null ) { U = null ; X = true } X && I . call ( f , W || f ) } else switch ( ca . toLowerCase ( ) ) { case "ahex" : case "hex" : Q = s . hexToRgba ( Q && ( Q . ahex || Q . hex ) || Q || "00000000" ) ;
V . call ( f , "rgba" , { r : Q . r , g : Q . g , b : Q . b , a : ca == "ahex" ? Q . a : B != null ? B : 255 } , W ) ; break ; default : if ( Q && ( Q . ahex != null || Q . hex != null ) ) { V . call ( f , "ahex" , Q . ahex || Q . hex || "00000000" , W ) ; break } var R = { } , ba = false , ta = false ; if ( Q . r !== undefined && ! ca . indexOf ( "r" ) == - 1 ) ca += "r" ; if ( Q . g !== undefined && ! ca . indexOf ( "g" ) == - 1 ) ca += "g" ; if ( Q . b !== undefined && ! ca . indexOf ( "b" ) == - 1 ) ca += "b" ; if ( Q . a !== undefined && ! ca . indexOf ( "a" ) == - 1 ) ca += "a" ; if ( Q . h !== undefined && ! ca . indexOf ( "h" ) == - 1 ) ca += "h" ; if ( Q . s !== undefined && ! ca . indexOf ( "s" ) == - 1 ) ca += "s" ; if ( Q . v !== undefined &&
! ca . indexOf ( "v" ) == - 1 ) ca += "v" ; for ( ha = 0 ; ha < ca . length ; ha ++ ) switch ( ca . charAt ( ha ) ) { case "r" : if ( ta ) continue ; ba = true ; R . r = Q && Q . r && Q . r | 0 || Q && Q | 0 || 0 ; if ( R . r < 0 ) R . r = 0 ; else if ( R . r > 255 ) R . r = 255 ; if ( d != R . r ) { d = R . r ; X = true } break ; case "g" : if ( ta ) continue ; ba = true ; R . g = Q && Q . g && Q . g | 0 || Q && Q | 0 || 0 ; if ( R . g < 0 ) R . g = 0 ; else if ( R . g > 255 ) R . g = 255 ; if ( l != R . g ) { l = R . g ; X = true } break ; case "b" : if ( ta ) continue ; ba = true ; R . b = Q && Q . b && Q . b | 0 || Q && Q | 0 || 0 ; if ( R . b < 0 ) R . b = 0 ; else if ( R . b > 255 ) R . b = 255 ; if ( p != R . b ) { p = R . b ; X = true } break ; case "a" : R . a = Q && Q . a != null ? Q . a | 0 : Q !=
null ? Q | 0 : 255 ; if ( R . a < 0 ) R . a = 0 ; else if ( R . a > 255 ) R . a = 255 ; if ( B != R . a ) { B = R . a ; X = true } break ; case "h" : if ( ba ) continue ; ta = true ; R . h = Q && Q . h && Q . h | 0 || Q && Q | 0 || 0 ; if ( R . h < 0 ) R . h = 0 ; else if ( R . h > 360 ) R . h = 360 ; if ( q != R . h ) { q = R . h ; X = true } break ; case "s" : if ( ba ) continue ; ta = true ; R . s = Q && Q . s != null ? Q . s | 0 : Q != null ? Q | 0 : 100 ; if ( R . s < 0 ) R . s = 0 ; else if ( R . s > 100 ) R . s = 100 ; if ( M != R . s ) { M = R . s ; X = true } break ; case "v" : if ( ba ) continue ; ta = true ; R . v = Q && Q . v != null ? Q . v | 0 : Q != null ? Q | 0 : 100 ; if ( R . v < 0 ) R . v = 0 ; else if ( R . v > 100 ) R . v = 100 ; if ( U != R . v ) { U = R . v ; X = true } } if ( X ) { if ( ba ) { d =
d || 0 ; l = l || 0 ; p = p || 0 ; Q = s . rgbToHsv ( { r : d , g : l , b : p } ) ; q = Q . h ; M = Q . s ; U = Q . v } else if ( ta ) { q = q || 0 ; M = M != null ? M : 100 ; U = U != null ? U : 100 ; Q = s . hsvToRgb ( { h : q , s : M , v : U } ) ; d = Q . r ; l = Q . g ; p = Q . b } B = B != null ? B : 255 ; I . call ( f , W || f ) } } } } ; a . extend ( true , f , { val : V , bind : function ( ca ) { a . isFunction ( ca ) && P . push ( ca ) } , unbind : function ( ca ) { if ( a . isFunction ( ca ) ) for ( var Q ; ( Q = a . inArray ( ca , P ) ) != - 1 ; ) P . splice ( Q , 1 ) } , destroy : function ( ) { P = null } } ) ; if ( b ) if ( b . ahex != null ) V ( "ahex" , b ) ; else if ( b . hex != null ) V ( ( b . a != null ? "a" : "" ) + "hex" , b . a != null ? { ahex : b . hex + s . intToHex ( b . a ) } :
b ) ; else if ( b . r != null && b . g != null && b . b != null ) V ( "rgb" + ( b . a != null ? "a" : "" ) , b ) ; else if ( b . h != null && b . s != null && b . v != null ) V ( "hsv" + ( b . a != null ? "a" : "" ) , b ) } , ColorMethods : { hexToRgba : function ( b ) { b = this . validateHex ( b ) ; if ( b == "" ) return { r : null , g : null , b : null , a : null } ; var f = "00" , d = "00" , l = "00" , p = "255" ; if ( b . length == 6 ) b += "ff" ; if ( b . length > 6 ) { f = b . substring ( 0 , 2 ) ; d = b . substring ( 2 , 4 ) ; l = b . substring ( 4 , 6 ) ; p = b . substring ( 6 , b . length ) } else { if ( b . length > 4 ) { f = b . substring ( 4 , b . length ) ; b = b . substring ( 0 , 4 ) } if ( b . length > 2 ) { d = b . substring ( 2 , b . length ) ;
b = b . substring ( 0 , 2 ) } if ( b . length > 0 ) l = b . substring ( 0 , b . length ) } return { r : this . hexToInt ( f ) , g : this . hexToInt ( d ) , b : this . hexToInt ( l ) , a : this . hexToInt ( p ) } } , validateHex : function ( b ) { if ( typeof b == "object" ) return "" ; b = b . toLowerCase ( ) . replace ( /[^a-f0-9]/g , "" ) ; if ( b . length > 8 ) b = b . substring ( 0 , 8 ) ; return b } , rgbaToHex : function ( b ) { return this . intToHex ( b . r ) + this . intToHex ( b . g ) + this . intToHex ( b . b ) + this . intToHex ( b . a ) } , intToHex : function ( b ) { b = ( b | 0 ) . toString ( 16 ) ; if ( b . length == 1 ) b = "0" + b ; return b . toLowerCase ( ) } , hexToInt : function ( b ) { return parseInt ( b ,
16 ) } , rgbToHsv : function ( b ) { var f = b . r / 255 , d = b . g / 255 ; b = b . b / 255 ; var l = { h : 0 , s : 0 , v : 0 } , p = 0 , B = 0 ; if ( f >= d && f >= b ) { B = f ; p = d > b ? b : d } else if ( d >= b && d >= f ) { B = d ; p = f > b ? b : f } else { B = b ; p = d > f ? f : d } l . v = B ; l . s = B ? ( B - p ) / B : 0 ; if ( l . s ) { p = B - p ; l . h = f == B ? ( d - b ) / p : d == B ? 2 + ( b - f ) / p : 4 + ( f - d ) / p ; l . h = parseInt ( l . h * 60 ) ; if ( l . h < 0 ) l . h += 360 } else l . h = 0 ; l . s = l . s * 100 | 0 ; l . v = l . v * 100 | 0 ; return l } , hsvToRgb : function ( b ) { var f = { r : 0 , g : 0 , b : 0 , a : 100 } , d = b . h , l = b . s ; b = b . v ; if ( l == 0 ) f . r = b == 0 ? f . g = f . b = 0 : f . g = f . b = b * 255 / 100 | 0 ; else { if ( d == 360 ) d = 0 ; d /= 60 ; l /= 100 ; b /= 100 ; var p = d | 0 , B = d -
p ; d = b * ( 1 - l ) ; var q = b * ( 1 - l * B ) ; l = b * ( 1 - l * ( 1 - B ) ) ; switch ( p ) { case 0 : f . r = b ; f . g = l ; f . b = d ; break ; case 1 : f . r = q ; f . g = b ; f . b = d ; break ; case 2 : f . r = d ; f . g = b ; f . b = l ; break ; case 3 : f . r = d ; f . g = q ; f . b = b ; break ; case 4 : f . r = l ; f . g = d ; f . b = b ; break ; case 5 : f . r = b ; f . g = d ; f . b = q } f . r = f . r * 255 | 0 ; f . g = f . g * 255 | 0 ; f . b = f . b * 255 | 0 } return f } } } ; var c = a . jPicker . Color , m = a . jPicker . List , s = a . jPicker . ColorMethods ; a . fn . jPicker = function ( b ) { var f = arguments ; return this . each ( function ( ) { var d = this , l = a . extend ( true , { } , a . fn . jPicker . defaults , b ) ; if ( a ( d ) . get ( 0 ) . nodeName . toLowerCase ( ) ==
"input" ) { a . extend ( true , l , { window : { bindToInput : true , expandable : true , input : a ( d ) } } ) ; if ( a ( d ) . val ( ) == "" ) { l . color . active = new c ( { hex : null } ) ; l . color . current = new c ( { hex : null } ) } else if ( s . validateHex ( a ( d ) . val ( ) ) ) { l . color . active = new c ( { hex : a ( d ) . val ( ) , a : l . color . active . val ( "a" ) } ) ; l . color . current = new c ( { hex : a ( d ) . val ( ) , a : l . color . active . val ( "a" ) } ) } } if ( l . window . expandable ) a ( d ) . after ( '<span class="jPicker"><span class="Icon"><span class="Color"> </span><span class="Alpha"> </span><span class="Image" title="Click To Open Color Picker"> </span><span class="Container"> </span></span></span>' ) ;
else l . window . liveUpdate = false ; var p = parseFloat ( navigator . appVersion . split ( "MSIE" ) [ 1 ] ) < 7 && document . body . filters , B = null , q = null , M = null , U = null , P = null , I = null , V = null , ca = null , Q = null , W = null , ha = null , X = null , R = null , ba = null , ta = null , ja = null , ea = null , aa = null , Z = null , la = null , sa = null , na = null , oa = null , Ba = null , Ga = null , Ja = null , Ca = null , La = null , Na = function ( S ) { var O = qa . active , fa = O . val ( "hex" ) , Ia , Qa ; l . color . mode = S ; switch ( S ) { case "h" : setTimeout ( function ( ) { Ta . call ( d , q , "transparent" ) ; za . call ( d , U , 0 ) ; ya . call ( d , U , 100 ) ; za . call ( d ,
P , 260 ) ; ya . call ( d , P , 100 ) ; Ta . call ( d , M , "transparent" ) ; za . call ( d , V , 0 ) ; ya . call ( d , V , 100 ) ; za . call ( d , ca , 260 ) ; ya . call ( d , ca , 100 ) ; za . call ( d , Q , 260 ) ; ya . call ( d , Q , 100 ) ; za . call ( d , W , 260 ) ; ya . call ( d , W , 100 ) ; za . call ( d , X , 260 ) ; ya . call ( d , X , 100 ) } , 0 ) ; R . range ( "all" , { minX : 0 , maxX : 100 , minY : 0 , maxY : 100 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 360 } ) ; if ( O . val ( "ahex" ) == null ) break ; R . val ( "xy" , { x : O . val ( "s" ) , y : 100 - O . val ( "v" ) } , R ) ; ba . val ( "y" , 360 - O . val ( "h" ) , ba ) ; break ; case "s" : setTimeout ( function ( ) { Ta . call ( d , q , "transparent" ) ; za . call ( d , U , - 260 ) ; za . call ( d ,
P , - 520 ) ; za . call ( d , V , - 260 ) ; za . call ( d , ca , - 520 ) ; za . call ( d , X , 260 ) ; ya . call ( d , X , 100 ) } , 0 ) ; R . range ( "all" , { minX : 0 , maxX : 360 , minY : 0 , maxY : 100 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 100 } ) ; if ( O . val ( "ahex" ) == null ) break ; R . val ( "xy" , { x : O . val ( "h" ) , y : 100 - O . val ( "v" ) } , R ) ; ba . val ( "y" , 100 - O . val ( "s" ) , ba ) ; break ; case "v" : setTimeout ( function ( ) { Ta . call ( d , q , "000000" ) ; za . call ( d , U , - 780 ) ; za . call ( d , P , 260 ) ; Ta . call ( d , M , fa ) ; za . call ( d , V , - 520 ) ; za . call ( d , ca , 260 ) ; ya . call ( d , ca , 100 ) ; za . call ( d , X , 260 ) ; ya . call ( d , X , 100 ) } , 0 ) ; R . range ( "all" , { minX : 0 , maxX : 360 ,
minY : 0 , maxY : 100 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 100 } ) ; if ( O . val ( "ahex" ) == null ) break ; R . val ( "xy" , { x : O . val ( "h" ) , y : 100 - O . val ( "s" ) } , R ) ; ba . val ( "y" , 100 - O . val ( "v" ) , ba ) ; break ; case "r" : Ia = - 1040 ; Qa = - 780 ; R . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( O . val ( "ahex" ) == null ) break ; R . val ( "xy" , { x : O . val ( "b" ) , y : 255 - O . val ( "g" ) } , R ) ; ba . val ( "y" , 255 - O . val ( "r" ) , ba ) ; break ; case "g" : Ia = - 1560 ; Qa = - 1820 ; R . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ;
if ( O . val ( "ahex" ) == null ) break ; R . val ( "xy" , { x : O . val ( "b" ) , y : 255 - O . val ( "r" ) } , R ) ; ba . val ( "y" , 255 - O . val ( "g" ) , ba ) ; break ; case "b" : Ia = - 2080 ; Qa = - 2860 ; R . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( O . val ( "ahex" ) == null ) break ; R . val ( "xy" , { x : O . val ( "r" ) , y : 255 - O . val ( "g" ) } , R ) ; ba . val ( "y" , 255 - O . val ( "b" ) , ba ) ; break ; case "a" : setTimeout ( function ( ) { Ta . call ( d , q , "transparent" ) ; za . call ( d , U , - 260 ) ; za . call ( d , P , - 520 ) ; za . call ( d , V , 260 ) ; za . call ( d , ca , 260 ) ; ya . call ( d , ca , 100 ) ; za . call ( d , X , 0 ) ; ya . call ( d ,
X , 100 ) } , 0 ) ; R . range ( "all" , { minX : 0 , maxX : 360 , minY : 0 , maxY : 100 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( O . val ( "ahex" ) == null ) break ; R . val ( "xy" , { x : O . val ( "h" ) , y : 100 - O . val ( "v" ) } , R ) ; ba . val ( "y" , 255 - O . val ( "a" ) , ba ) ; break ; default : throw "Invalid Mode" ; } switch ( S ) { case "s" : case "v" : case "a" : setTimeout ( function ( ) { ya . call ( d , U , 100 ) ; ya . call ( d , V , 100 ) ; za . call ( d , Q , 260 ) ; ya . call ( d , Q , 100 ) ; za . call ( d , W , 260 ) ; ya . call ( d , W , 100 ) } , 0 ) ; break ; case "r" : case "g" : case "b" : setTimeout ( function ( ) { Ta . call ( d , q , "transparent" ) ; Ta . call ( d , M , "transparent" ) ;
ya . call ( d , V , 100 ) ; ya . call ( d , U , 100 ) ; za . call ( d , U , Ia ) ; za . call ( d , P , Ia - 260 ) ; za . call ( d , V , Qa - 780 ) ; za . call ( d , ca , Qa - 520 ) ; za . call ( d , Q , Qa ) ; za . call ( d , W , Qa - 260 ) ; za . call ( d , X , 260 ) ; ya . call ( d , X , 100 ) } , 0 ) } O . val ( "ahex" ) != null && Ha . call ( d , O ) } , Ha = function ( S , O ) { if ( O == null || O != ba && O != R ) ub . call ( d , S , O ) ; setTimeout ( function ( ) { Aa . call ( d , S ) ; vb . call ( d , S ) ; Ua . call ( d , S ) } , 0 ) } , va = function ( S , O ) { var fa = qa . active ; if ( ! ( O != R && fa . val ( ) == null ) ) { var Ia = S . val ( "all" ) ; switch ( l . color . mode ) { case "h" : fa . val ( "sv" , { s : Ia . x , v : 100 - Ia . y } , O ) ; break ; case "s" : case "a" : fa . val ( "hv" ,
{ h : Ia . x , v : 100 - Ia . y } , O ) ; break ; case "v" : fa . val ( "hs" , { h : Ia . x , s : 100 - Ia . y } , O ) ; break ; case "r" : fa . val ( "gb" , { g : 255 - Ia . y , b : Ia . x } , O ) ; break ; case "g" : fa . val ( "rb" , { r : 255 - Ia . y , b : Ia . x } , O ) ; break ; case "b" : fa . val ( "rg" , { r : Ia . x , g : 255 - Ia . y } , O ) } } } , Fa = function ( S , O ) { var fa = qa . active ; if ( ! ( O != ba && fa . val ( ) == null ) ) switch ( l . color . mode ) { case "h" : fa . val ( "h" , { h : 360 - S . val ( "y" ) } , O ) ; break ; case "s" : fa . val ( "s" , { s : 100 - S . val ( "y" ) } , O ) ; break ; case "v" : fa . val ( "v" , { v : 100 - S . val ( "y" ) } , O ) ; break ; case "r" : fa . val ( "r" , { r : 255 - S . val ( "y" ) } , O ) ; break ;
case "g" : fa . val ( "g" , { g : 255 - S . val ( "y" ) } , O ) ; break ; case "b" : fa . val ( "b" , { b : 255 - S . val ( "y" ) } , O ) ; break ; case "a" : fa . val ( "a" , 255 - S . val ( "y" ) , O ) } } , ub = function ( S , O ) { if ( O != R ) switch ( l . color . mode ) { case "h" : var fa = S . val ( "sv" ) ; R . val ( "xy" , { x : fa != null ? fa . s : 100 , y : 100 - ( fa != null ? fa . v : 100 ) } , O ) ; break ; case "s" : case "a" : fa = S . val ( "hv" ) ; R . val ( "xy" , { x : fa && fa . h || 0 , y : 100 - ( fa != null ? fa . v : 100 ) } , O ) ; break ; case "v" : fa = S . val ( "hs" ) ; R . val ( "xy" , { x : fa && fa . h || 0 , y : 100 - ( fa != null ? fa . s : 100 ) } , O ) ; break ; case "r" : fa = S . val ( "bg" ) ; R . val ( "xy" , { x : fa &&
fa . b || 0 , y : 255 - ( fa && fa . g || 0 ) } , O ) ; break ; case "g" : fa = S . val ( "br" ) ; R . val ( "xy" , { x : fa && fa . b || 0 , y : 255 - ( fa && fa . r || 0 ) } , O ) ; break ; case "b" : fa = S . val ( "rg" ) ; R . val ( "xy" , { x : fa && fa . r || 0 , y : 255 - ( fa && fa . g || 0 ) } , O ) } if ( O != ba ) switch ( l . color . mode ) { case "h" : ba . val ( "y" , 360 - ( S . val ( "h" ) || 0 ) , O ) ; break ; case "s" : fa = S . val ( "s" ) ; ba . val ( "y" , 100 - ( fa != null ? fa : 100 ) , O ) ; break ; case "v" : fa = S . val ( "v" ) ; ba . val ( "y" , 100 - ( fa != null ? fa : 100 ) , O ) ; break ; case "r" : ba . val ( "y" , 255 - ( S . val ( "r" ) || 0 ) , O ) ; break ; case "g" : ba . val ( "y" , 255 - ( S . val ( "g" ) || 0 ) , O ) ; break ; case "b" : ba . val ( "y" ,
255 - ( S . val ( "b" ) || 0 ) , O ) ; break ; case "a" : fa = S . val ( "a" ) ; ba . val ( "y" , 255 - ( fa != null ? fa : 255 ) , O ) } } , Aa = function ( S ) { try { var O = S . val ( "all" ) ; la . css ( { backgroundColor : O && "#" + O . hex || "transparent" } ) ; ya . call ( d , la , O && Math . precision ( O . a * 100 / 255 , 4 ) || 0 ) } catch ( fa ) { } } , vb = function ( S ) { switch ( l . color . mode ) { case "h" : Ta . call ( d , q , ( new c ( { h : S . val ( "h" ) || 0 , s : 100 , v : 100 } ) ) . val ( "hex" ) ) ; break ; case "s" : case "a" : var O = S . val ( "s" ) ; ya . call ( d , P , 100 - ( O != null ? O : 100 ) ) ; break ; case "v" : O = S . val ( "v" ) ; ya . call ( d , U , O != null ? O : 100 ) ; break ; case "r" : ya . call ( d ,
P , Math . precision ( ( S . val ( "r" ) || 0 ) / 255 * 100 , 4 ) ) ; break ; case "g" : ya . call ( d , P , Math . precision ( ( S . val ( "g" ) || 0 ) / 255 * 100 , 4 ) ) ; break ; case "b" : ya . call ( d , P , Math . precision ( ( S . val ( "b" ) || 0 ) / 255 * 100 ) ) } S = S . val ( "a" ) ; ya . call ( d , I , Math . precision ( ( 255 - ( S || 0 ) ) * 100 / 255 , 4 ) ) } , Ua = function ( S ) { switch ( l . color . mode ) { case "h" : var O = S . val ( "a" ) ; ya . call ( d , ha , Math . precision ( ( 255 - ( O || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "s" : O = S . val ( "hva" ) ; var fa = new c ( { h : O && O . h || 0 , s : 100 , v : O != null ? O . v : 100 } ) ; Ta . call ( d , M , fa . val ( "hex" ) ) ; ya . call ( d , ca , 100 - ( O != null ? O . v :
100 ) ) ; ya . call ( d , ha , Math . precision ( ( 255 - ( O && O . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "v" : O = S . val ( "hsa" ) ; fa = new c ( { h : O && O . h || 0 , s : O != null ? O . s : 100 , v : 100 } ) ; Ta . call ( d , M , fa . val ( "hex" ) ) ; ya . call ( d , ha , Math . precision ( ( 255 - ( O && O . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "r" : case "g" : case "b" : fa = O = 0 ; S = S . val ( "rgba" ) ; if ( l . color . mode == "r" ) { O = S && S . b || 0 ; fa = S && S . g || 0 } else if ( l . color . mode == "g" ) { O = S && S . b || 0 ; fa = S && S . r || 0 } else if ( l . color . mode == "b" ) { O = S && S . r || 0 ; fa = S && S . g || 0 } var Ia = fa > O ? O : fa ; ya . call ( d , ca , O > fa ? Math . precision ( ( O - fa ) / ( 255 - fa ) * 100 ,
4 ) : 0 ) ; ya . call ( d , Q , fa > O ? Math . precision ( ( fa - O ) / ( 255 - O ) * 100 , 4 ) : 0 ) ; ya . call ( d , W , Math . precision ( Ia / 255 * 100 , 4 ) ) ; ya . call ( d , ha , Math . precision ( ( 255 - ( S && S . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "a" : O = S . val ( "a" ) ; Ta . call ( d , M , S . val ( "hex" ) || "000000" ) ; ya . call ( d , ha , O != null ? 0 : 100 ) ; ya . call ( d , X , O != null ? 100 : 0 ) } } , Ta = function ( S , O ) { S . css ( { backgroundColor : O && O . length == 6 && "#" + O || "transparent" } ) } , $a = function ( S , O ) { if ( p && ( O . indexOf ( "AlphaBar.png" ) != - 1 || O . indexOf ( "Bars.png" ) != - 1 || O . indexOf ( "Maps.png" ) != - 1 ) ) { S . attr ( "pngSrc" , O ) ; S . css ( { backgroundImage : "none" ,
filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + O + "', sizingMethod='scale')" } ) } else S . css ( { backgroundImage : "url('" + O + "')" } ) } , za = function ( S , O ) { S . css ( { top : O + "px" } ) } , ya = function ( S , O ) { S . css ( { visibility : O > 0 ? "visible" : "hidden" } ) ; if ( O > 0 && O < 100 ) if ( p ) { var fa = S . attr ( "pngSrc" ) ; fa != null && ( fa . indexOf ( "AlphaBar.png" ) != - 1 || fa . indexOf ( "Bars.png" ) != - 1 || fa . indexOf ( "Maps.png" ) != - 1 ) ? S . css ( { filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + fa + "', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity=" +
O + ")" } ) : S . css ( { opacity : Math . precision ( O / 100 , 4 ) } ) } else S . css ( { opacity : Math . precision ( O / 100 , 4 ) } ) ; else if ( O == 0 || O == 100 ) if ( p ) { fa = S . attr ( "pngSrc" ) ; fa != null && ( fa . indexOf ( "AlphaBar.png" ) != - 1 || fa . indexOf ( "Bars.png" ) != - 1 || fa . indexOf ( "Maps.png" ) != - 1 ) ? S . css ( { filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + fa + "', sizingMethod='scale')" } ) : S . css ( { opacity : "" } ) } else S . css ( { opacity : "" } ) } , ob = function ( ) { qa . active . val ( "ahex" , qa . current . val ( "ahex" ) ) } , fb = function ( ) { qa . current . val ( "ahex" , qa . active . val ( "ahex" ) ) } ,
Oa = function ( S ) { a ( this ) . parents ( "tbody:first" ) . find ( 'input:radio[value!="' + S . target . value + '"]' ) . removeAttr ( "checked" ) ; Na . call ( d , S . target . value ) } , Za = function ( ) { ob . call ( d ) } , Ea = function ( ) { ob . call ( d ) ; l . window . expandable && wb . call ( d ) ; a . isFunction ( rb ) && rb . call ( d , qa . active , oa ) } , pb = function ( ) { fb . call ( d ) ; l . window . expandable && wb . call ( d ) ; a . isFunction ( xb ) && xb . call ( d , qa . active , na ) } , qb = function ( ) { Ab . call ( d ) } , gb = function ( S ) { var O = S . val ( "hex" ) ; sa . css ( { backgroundColor : O && "#" + O || "transparent" } ) ; ya . call ( d , sa , Math . precision ( ( S . val ( "a" ) ||
0 ) * 100 / 255 , 4 ) ) } , cb = function ( S ) { var O = S . val ( "hex" ) ; S = S . val ( "va" ) ; Ga . css ( { backgroundColor : O && "#" + O || "transparent" } ) ; ya . call ( d , Ja , Math . precision ( ( 255 - ( S && S . a || 0 ) ) * 100 / 255 , 4 ) ) ; if ( l . window . bindToInput && l . window . updateInputColor ) l . window . input . css ( { backgroundColor : O && "#" + O || "transparent" , color : S == null || S . v > 75 ? "#000000" : "#ffffff" } ) } , Sa = function ( S ) { ja = parseInt ( B . css ( "left" ) ) ; ea = parseInt ( B . css ( "top" ) ) ; aa = S . pageX ; Z = S . pageY ; a ( document ) . bind ( "mousemove" , Ma ) . bind ( "mouseup" , bb ) ; S . preventDefault ( ) } , Ma = function ( S ) { B . css ( { left : ja -
( aa - S . pageX ) + "px" , top : ea - ( Z - S . pageY ) + "px" } ) ; l . window . expandable && ! a . support . boxModel && B . prev ( ) . css ( { left : B . css ( "left" ) , top : B . css ( "top" ) } ) ; S . stopPropagation ( ) ; S . preventDefault ( ) ; return false } , bb = function ( S ) { a ( document ) . unbind ( "mousemove" , Ma ) . unbind ( "mouseup" , bb ) ; S . stopPropagation ( ) ; S . preventDefault ( ) ; return false } , zb = function ( S ) { S . preventDefault ( ) ; S . stopPropagation ( ) ; qa . active . val ( "ahex" , a ( this ) . attr ( "title" ) || null , S . target ) ; return false } , xb = a . isFunction ( f [ 1 ] ) && f [ 1 ] || null , eb = a . isFunction ( f [ 2 ] ) && f [ 2 ] ||
null , rb = a . isFunction ( f [ 3 ] ) && f [ 3 ] || null , Ab = function ( ) { qa . current . val ( "ahex" , qa . active . val ( "ahex" ) ) ; var S = function ( ) { if ( ! ( ! l . window . expandable || a . support . boxModel ) ) { var O = B . find ( "table:first" ) ; B . before ( "<iframe/>" ) ; B . prev ( ) . css ( { width : O . width ( ) , height : B . height ( ) , opacity : 0 , position : "absolute" , left : B . css ( "left" ) , top : B . css ( "top" ) } ) } } ; if ( l . window . expandable ) { a ( document . body ) . children ( "div.jPicker.Container" ) . css ( { zIndex : 10 } ) ; B . css ( { zIndex : 20 } ) } switch ( l . window . effects . type ) { case "fade" : B . fadeIn ( l . window . effects . speed . show ,
S ) ; break ; case "slide" : B . slideDown ( l . window . effects . speed . show , S ) ; break ; default : B . show ( l . window . effects . speed . show , S ) } } , wb = function ( ) { var S = function ( ) { l . window . expandable && B . css ( { zIndex : 10 } ) ; ! l . window . expandable || a . support . boxModel || B . prev ( ) . remove ( ) } ; switch ( l . window . effects . type ) { case "fade" : B . fadeOut ( l . window . effects . speed . hide , S ) ; break ; case "slide" : B . slideUp ( l . window . effects . speed . hide , S ) ; break ; default : B . hide ( l . window . effects . speed . hide , S ) } } , Db = function ( ) { var S = l . window , O = S . expandable ? a ( d ) . next ( ) . find ( ".Container:first" ) :
null ; B = S . expandable ? a ( "<div/>" ) : a ( d ) ; B . addClass ( "jPicker Container" ) ; S . expandable && B . hide ( ) ; B . get ( 0 ) . onselectstart = function ( Bb ) { if ( Bb . target . nodeName . toLowerCase ( ) !== "input" ) return false } ; var fa = qa . active . val ( "all" ) ; if ( S . alphaPrecision < 0 ) S . alphaPrecision = 0 ; else if ( S . alphaPrecision > 2 ) S . alphaPrecision = 2 ; var Ia = '<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>' + ( S . expandable ? '<tr><td class="Move" colspan="5"> </td></tr>' : "" ) + '<tr><td rowspan="9"><h2 class="Title">' + ( S . title || ga . text . title ) +
'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="' + ma . clientPath + ma . 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="' + ma . clientPath + ma . colorBar . arrow . file + '" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">' +
2012-07-24 02:30:12 +00:00
ga . text . newColor + '<div class="color_preview"><span class="Active" title="' + ga . tooltips . colors . newColor + '"> </span><span class="Current" title="' + ga . tooltips . colors . currentColor + '"> </span></div></div>' + ga . text . currentColor + '</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="' + ga . text . ok + '" title="' + ga . tooltips . buttons . ok + '"/><input type="button" class="Cancel" value="' + ga . text . cancel + '" title="' + ga . tooltips . buttons . cancel + '"/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="' +
ga . tooltips . hue . radio + '"><input type="radio" value="h"' + ( l . color . mode == "h" ? ' checked="checked"' : "" ) + '/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa != null ? fa . h : "" ) + '" title="' + ga . tooltips . hue . textbox + '"/> \u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="' + ga . tooltips . saturation . radio + '"><input type="radio" value="s"' + ( l . color . mode == "s" ? ' checked="checked"' : "" ) + '/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa !=
null ? fa . s : "" ) + '" title="' + ga . tooltips . saturation . textbox + '"/> %</td></tr><tr class="Value"><td class="Radio"><label title="' + ga . tooltips . value . radio + '"><input type="radio" value="v"' + ( l . color . mode == "v" ? ' checked="checked"' : "" ) + '/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa != null ? fa . v : "" ) + '" title="' + ga . tooltips . value . textbox + '"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="' + ga . tooltips . red . radio + '"><input type="radio" value="r"' +
( l . color . mode == "r" ? ' checked="checked"' : "" ) + '/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa != null ? fa . r : "" ) + '" title="' + ga . tooltips . red . textbox + '"/></td></tr><tr class="Green"><td class="Radio"><label title="' + ga . tooltips . green . radio + '"><input type="radio" value="g"' + ( l . color . mode == "g" ? ' checked="checked"' : "" ) + '/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa != null ? fa . g : "" ) + '" title="' + ga . tooltips . green . textbox + '"/></td></tr><tr class="Blue"><td class="Radio"><label title="' +
2012-07-24 12:42:34 +00:00
ga . tooltips . blue . radio + '"><input type="radio" value="b"' + ( l . color . mode == "b" ? ' checked="checked"' : "" ) + '/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa != null ? fa . b : "" ) + '" title="' + ga . tooltips . blue . textbox + '"/></td></tr><tr class="Alpha"><td class="Radio">' + ( S . alphaSupport ? '<label title="' + ga . tooltips . alpha . radio + '"><input type="radio" value="a"' + ( l . color . mode == "a" ? ' checked="checked"' : "" ) + "/>A:</label>" : " " ) + '</td><td class="Text">' + ( S . alphaSupport ? '<input type="text" maxlength="' +
( 3 + S . alphaPrecision ) + '" value="' + ( fa != null ? Math . precision ( fa . a * 100 / 255 , S . alphaPrecision ) : "" ) + '" title="' + ga . tooltips . alpha . textbox + '"/> %' : " " ) + '</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="' + ga . tooltips . hex . textbox + '">#:<input type="text" maxlength="6" class="Hex" value="' + ( fa != null ? fa . hex : "" ) + '"/></label>' + ( S . alphaSupport ? '<input type="text" maxlength="2" class="AHex" value="' + ( fa != null ? fa . ahex . substring ( 6 ) : "" ) + '" title="' + ga . tooltips . hex . alpha + '"/></td>' : " " ) +
"</tr></tbody></table>" ; if ( S . expandable ) { B . html ( Ia ) ; 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 : S . position . x == "left" ? O . offset ( ) . left - 530 - ( S . position . y == "center" ? 25 : 0 ) + "px" : S . position . x == "center" ? O . offset ( ) . left - 260 + "px" : S . position . x == "right" ? O . offset ( ) . left - 10 + ( S . position . y ==
"center" ? 25 : 0 ) + "px" : S . position . x == "screenCenter" ? ( a ( document ) . width ( ) >> 1 ) - 260 + "px" : O . offset ( ) . left + parseInt ( S . position . x ) + "px" , position : "absolute" , top : S . position . y == "top" ? O . offset ( ) . top - 312 + "px" : S . position . y == "center" ? O . offset ( ) . top - 156 + "px" : S . position . y == "bottom" ? O . offset ( ) . top + 25 + "px" : O . offset ( ) . top + parseInt ( S . position . y ) + "px" } ) } else { B = a ( d ) ; B . html ( Ia ) } Ia = B . find ( "tbody:first" ) ; q = Ia . find ( "div.Map:first" ) ; M = Ia . find ( "div.Bar:first" ) ; var Qa = q . find ( "span" ) , Ya = M . find ( "span" ) ; U = Qa . filter ( ".Map1:first" ) ;
P = Qa . filter ( ".Map2:first" ) ; I = Qa . filter ( ".Map3:first" ) ; V = Ya . filter ( ".Map1:first" ) ; ca = Ya . filter ( ".Map2:first" ) ; Q = Ya . filter ( ".Map3:first" ) ; W = Ya . filter ( ".Map4:first" ) ; ha = Ya . filter ( ".Map5:first" ) ; X = Ya . filter ( ".Map6:first" ) ; R = new o ( q , { map : { width : ma . colorMap . width , height : ma . colorMap . height } , arrow : { image : ma . clientPath + ma . colorMap . arrow . file , width : ma . colorMap . arrow . width , height : ma . colorMap . arrow . height } } ) ; R . bind ( va ) ; ba = new o ( M , { map : { width : ma . colorBar . width , height : ma . colorBar . height } , arrow : { image : ma . clientPath +
ma . colorBar . arrow . file , width : ma . colorBar . arrow . width , height : ma . colorBar . arrow . height } } ) ; ba . bind ( Fa ) ; ta = new g ( Ia , qa . active , S . expandable && S . bindToInput ? S . input : null , S . alphaPrecision ) ; Qa = fa != null ? fa . hex : null ; var kb = Ia . find ( ".Preview" ) ; Ya = Ia . find ( ".Button" ) ; la = kb . find ( ".Active:first" ) . css ( { backgroundColor : Qa && "#" + Qa || "transparent" } ) ; sa = kb . find ( ".Current:first" ) . css ( { backgroundColor : Qa && "#" + Qa || "transparent" } ) . bind ( "click" , Za ) ; ya . call ( d , sa , Math . precision ( qa . current . val ( "a" ) * 100 ) / 255 , 4 ) ; na = Ya . find ( ".Ok:first" ) . bind ( "click" ,
pb ) ; oa = Ya . find ( ".Cancel:first" ) . bind ( "click" , Ea ) ; Ba = Ya . find ( ".Grid:first" ) ; setTimeout ( function ( ) { $a . call ( d , U , ma . clientPath + "Maps.png" ) ; $a . call ( d , P , ma . clientPath + "Maps.png" ) ; $a . call ( d , I , ma . clientPath + "map-opacity.png" ) ; $a . call ( d , V , ma . clientPath + "Bars.png" ) ; $a . call ( d , ca , ma . clientPath + "Bars.png" ) ; $a . call ( d , Q , ma . clientPath + "Bars.png" ) ; $a . call ( d , W , ma . clientPath + "Bars.png" ) ; $a . call ( d , ha , ma . clientPath + "bar-opacity.png" ) ; $a . call ( d , X , ma . clientPath + "AlphaBar.png" ) ; $a . call ( d , kb . find ( "div:last" ) , ma . clientPath +
"preview-opacity.png" ) } , 0 ) ; Ia . find ( "td.Radio input" ) . bind ( "click" , Oa ) ; if ( qa . quickList && qa . quickList . length > 0 ) { Ya = "" ; for ( i = 0 ; i < qa . quickList . length ; i ++ ) { if ( ( typeof qa . quickList [ i ] ) . toString ( ) . toLowerCase ( ) == "string" ) qa . quickList [ i ] = new c ( { hex : qa . quickList [ i ] } ) ; var mb = qa . quickList [ i ] . val ( "a" ) , nb = qa . quickList [ i ] . val ( "ahex" ) ; if ( ! S . alphaSupport && nb ) nb = nb . substring ( 0 , 6 ) + "ff" ; var hb = qa . quickList [ i ] . val ( "hex" ) ; Ya += '<span class="QuickColor"' + ( nb && ' title="#' + nb + '"' || "" ) + ' style="background-color:' + ( hb && "#" +
hb || "" ) + ";" + ( hb ? "" : "background-image:url(" + ma . clientPath + "NoColor.png)" ) + ( S . alphaSupport && mb && mb < 255 ? ";opacity:" + Math . precision ( mb / 255 , 4 ) + ";filter:Alpha(opacity=" + Math . precision ( mb / 2.55 , 4 ) + ")" : "" ) + '"> </span>' } $a . call ( d , Ba , ma . clientPath + "bar-opacity.png" ) ; Ba . html ( Ya ) ; Ba . find ( ".QuickColor" ) . click ( zb ) } Na . call ( d , l . color . mode ) ; qa . active . bind ( Ha ) ; a . isFunction ( eb ) && qa . active . bind ( eb ) ; qa . current . bind ( gb ) ; if ( S . expandable ) { d . icon = O . parents ( ".Icon:first" ) ; Ga = d . icon . find ( ".Color:first" ) . css ( { backgroundColor : Qa &&
"#" + Qa || "transparent" } ) ; Ja = d . icon . find ( ".Alpha:first" ) ; $a . call ( d , Ja , ma . clientPath + "bar-opacity.png" ) ; ya . call ( d , Ja , Math . precision ( ( 255 - ( fa != null ? fa . a : 0 ) ) * 100 / 255 , 4 ) ) ; Ca = d . icon . find ( ".Image:first" ) . css ( { backgroundImage : "url('" + ma . clientPath + ma . picker . file + "')" } ) . bind ( "click" , qb ) ; if ( S . bindToInput && S . updateInputColor ) S . input . css ( { backgroundColor : Qa && "#" + Qa || "transparent" , color : fa == null || fa . v > 75 ? "#000000" : "#ffffff" } ) ; La = Ia . find ( ".Move:first" ) . bind ( "mousedown" , Sa ) ; qa . active . bind ( cb ) } else Ab . call ( d ) } , ma =
l . images , ga = l . localization , qa = { active : ( typeof l . color . active ) . toString ( ) . toLowerCase ( ) == "string" ? new c ( { ahex : ! l . window . alphaSupport && l . color . active ? l . color . active . substring ( 0 , 6 ) + "ff" : l . color . active } ) : new c ( { ahex : ! l . window . alphaSupport && l . color . active . val ( "ahex" ) ? l . color . active . val ( "ahex" ) . substring ( 0 , 6 ) + "ff" : l . color . active . val ( "ahex" ) } ) , current : ( typeof l . color . active ) . toString ( ) . toLowerCase ( ) == "string" ? new c ( { ahex : ! l . window . alphaSupport && l . color . active ? l . color . active . substring ( 0 , 6 ) + "ff" : l . color . active } ) :
new c ( { ahex : ! l . window . alphaSupport && l . color . active . val ( "ahex" ) ? l . color . active . val ( "ahex" ) . substring ( 0 , 6 ) + "ff" : l . color . active . val ( "ahex" ) } ) , quickList : l . color . quickList } ; a . extend ( true , d , { commitCallback : xb , liveCallback : eb , cancelCallback : rb , color : qa , show : Ab , hide : wb , destroy : function ( ) { B . find ( "td.Radio input" ) . unbind ( "click" , Oa ) ; sa . unbind ( "click" , Za ) ; oa . unbind ( "click" , Ea ) ; na . unbind ( "click" , pb ) ; if ( l . window . expandable ) { Ca . unbind ( "click" , qb ) ; La . unbind ( "mousedown" , Sa ) ; d . icon = null } B . find ( ".QuickColor" ) . unbind ( "click" ,
zb ) ; X = ha = W = Q = ca = V = I = P = U = M = q = null ; R . destroy ( ) ; R = null ; ba . destroy ( ) ; ba = null ; ta . destroy ( ) ; eb = rb = xb = Ba = oa = na = sa = la = ta = null ; B . html ( "" ) ; for ( i = 0 ; i < m . length ; i ++ ) m [ i ] == d && m . splice ( i , 1 ) } } ) ; m . push ( d ) ; setTimeout ( function ( ) { Db . 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 c ( { ahex : "#ffcc00ff" } ) ,
quickList : [ new c ( { h : 360 , s : 33 , v : 100 } ) , new c ( { h : 360 , s : 66 , v : 100 } ) , new c ( { h : 360 , s : 100 , v : 100 } ) , new c ( { h : 360 , s : 100 , v : 75 } ) , new c ( { h : 360 , s : 100 , v : 50 } ) , new c ( { h : 180 , s : 0 , v : 100 } ) , new c ( { h : 30 , s : 33 , v : 100 } ) , new c ( { h : 30 , s : 66 , v : 100 } ) , new c ( { h : 30 , s : 100 , v : 100 } ) , new c ( { h : 30 , s : 100 , v : 75 } ) , new c ( { h : 30 , s : 100 , v : 50 } ) , new c ( { h : 180 , s : 0 , v : 90 } ) , new c ( { h : 60 , s : 33 , v : 100 } ) , new c ( { h : 60 , s : 66 , v : 100 } ) , new c ( { h : 60 , s : 100 , v : 100 } ) , new c ( { h : 60 , s : 100 , v : 75 } ) , new c ( { h : 60 , s : 100 , v : 50 } ) , new c ( { h : 180 , s : 0 , v : 80 } ) , new c ( { h : 90 , s : 33 , v : 100 } ) , new c ( { h : 90 ,
s : 66 , v : 100 } ) , new c ( { h : 90 , s : 100 , v : 100 } ) , new c ( { h : 90 , s : 100 , v : 75 } ) , new c ( { h : 90 , s : 100 , v : 50 } ) , new c ( { h : 180 , s : 0 , v : 70 } ) , new c ( { h : 120 , s : 33 , v : 100 } ) , new c ( { h : 120 , s : 66 , v : 100 } ) , new c ( { h : 120 , s : 100 , v : 100 } ) , new c ( { h : 120 , s : 100 , v : 75 } ) , new c ( { h : 120 , s : 100 , v : 50 } ) , new c ( { h : 180 , s : 0 , v : 60 } ) , new c ( { h : 150 , s : 33 , v : 100 } ) , new c ( { h : 150 , s : 66 , v : 100 } ) , new c ( { h : 150 , s : 100 , v : 100 } ) , new c ( { h : 150 , s : 100 , v : 75 } ) , new c ( { h : 150 , s : 100 , v : 50 } ) , new c ( { h : 180 , s : 0 , v : 50 } ) , new c ( { h : 180 , s : 33 , v : 100 } ) , new c ( { h : 180 , s : 66 , v : 100 } ) , new c ( { h : 180 , s : 100 , v : 100 } ) ,
new c ( { h : 180 , s : 100 , v : 75 } ) , new c ( { h : 180 , s : 100 , v : 50 } ) , new c ( { h : 180 , s : 0 , v : 40 } ) , new c ( { h : 210 , s : 33 , v : 100 } ) , new c ( { h : 210 , s : 66 , v : 100 } ) , new c ( { h : 210 , s : 100 , v : 100 } ) , new c ( { h : 210 , s : 100 , v : 75 } ) , new c ( { h : 210 , s : 100 , v : 50 } ) , new c ( { h : 180 , s : 0 , v : 30 } ) , new c ( { h : 240 , s : 33 , v : 100 } ) , new c ( { h : 240 , s : 66 , v : 100 } ) , new c ( { h : 240 , s : 100 , v : 100 } ) , new c ( { h : 240 , s : 100 , v : 75 } ) , new c ( { h : 240 , s : 100 , v : 50 } ) , new c ( { h : 180 , s : 0 , v : 20 } ) , new c ( { h : 270 , s : 33 , v : 100 } ) , new c ( { h : 270 , s : 66 , v : 100 } ) , new c ( { h : 270 , s : 100 , v : 100 } ) , new c ( { h : 270 , s : 100 , v : 75 } ) , new c ( { h : 270 ,
s : 100 , v : 50 } ) , new c ( { h : 180 , s : 0 , v : 10 } ) , new c ( { h : 300 , s : 33 , v : 100 } ) , new c ( { h : 300 , s : 66 , v : 100 } ) , new c ( { h : 300 , s : 100 , v : 100 } ) , new c ( { h : 300 , s : 100 , v : 75 } ) , new c ( { h : 300 , s : 100 , v : 50 } ) , new c ( { h : 180 , s : 0 , v : 0 } ) , new c ( { h : 330 , s : 33 , v : 100 } ) , new c ( { h : 330 , s : 66 , v : 100 } ) , new c ( { h : 330 , s : 100 , v : 100 } ) , new c ( { h : 330 , s : 100 , v : 75 } ) , new c ( { h : 330 , s : 100 , v : 50 } ) , new c ] } , 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" ,
2012-07-19 15:22:42 +00:00
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)" } ,
2012-07-24 12:42:34 +00:00
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 ( m ) { var s = m || window . event , b = [ ] . slice . call ( arguments , 1 ) , f = 0 , d = 0 , l = 0 ; m = a . event . fix ( s ) ; m . type = "mousewheel" ; if ( s . wheelDelta ) f = s . wheelDelta / 120 ; if ( s . detail ) f = - s . detail / 3 ; l = f ; if ( s . axis !== undefined && s . axis === s . HORIZONTAL _AXIS ) { l = 0 ; d = - 1 * f } if ( s . wheelDeltaY !== undefined ) l = s . wheelDeltaY / 120 ; if ( s . wheelDeltaX !== undefined ) d = - 1 * s . wheelDeltaX / 120 ; b . unshift ( m , f , d , l ) ; return ( a . event . dispatch || a . event . handle ) . apply ( this , b ) } var g = [ "DOMMouseScroll" , "mousewheel" ] ; if ( a . event . fixHooks ) for ( var c = g . length ; c ; ) a . event . fixHooks [ g [ -- c ] ] =
a . event . mouseHooks ; a . event . special . mousewheel = { setup : function ( ) { if ( this . addEventListener ) for ( var m = g . length ; m ; ) this . addEventListener ( g [ -- m ] , o , false ) ; else this . onmousewheel = o } , teardown : function ( ) { if ( this . removeEventListener ) for ( var m = g . length ; m ; ) this . removeEventListener ( g [ -- m ] , o , false ) ; else this . onmousewheel = null } } ; a . fn . extend ( { mousewheel : function ( m ) { return m ? this . bind ( "mousewheel" , m ) : this . trigger ( "mousewheel" ) } , unmousewheel : function ( m ) { return this . unbind ( "mousewheel" , m ) } } ) } ) ( jQuery ) ; svgEditor . addExtension ( "eyedropper" , function ( a ) { function o ( b ) { if ( g . getMode ( ) != "eyedropper" ) { var f = $ ( "#tool_eyedropper" ) ; b . elems [ 0 ] && $ . inArray ( b . elems [ 0 ] . nodeName , [ "svg" , "g" , "use" ] ) == - 1 ? f . removeClass ( "disabled" ) : f . addClass ( "disabled" ) } } var g = svgEditor . canvas , c = svgedit . history . ChangeElementCommand , m = { fillPaint : "red" , fillOpacity : 1 , strokePaint : "black" , strokeOpacity : 1 , strokeWidth : 5 , strokeDashArray : null , opacity : 1 , strokeLinecap : "butt" , strokeLinejoin : "miter" } , s = function ( b , f , d ) { var l = null ; console . log ( b ) ; if ( b . indexOf ( "url(#" ) ===
0 ) { b = ( b = g . getRefElem ( b ) ) ? b . cloneNode ( true ) : $ ( "#" + d + "_color defs *" ) [ 0 ] ; l = { alpha : f } ; l [ b . tagName ] = b } else l = b . indexOf ( "#" ) === 0 ? { alpha : f , solidColor : b . substr ( 1 ) } : { alpha : f , solidColor : "none" } ; return new $ . jGraduate . Paint ( l ) } ; return { name : "eyedropper" , svgicons : "extensions/eyedropper-icon.xml" , buttons : [ { id : "tool_eyedropper" , type : "mode" , title : "Eye Dropper Tool" , key : "I" , "class" : "disabled" , events : { click : function ( ) { g . setMode ( "eyedropper" ) } } } ] , selectedChanged : o , elementChanged : o , mouseDown : function ( b ) { var f = g . getMode ( ) ,
d = b . event ; d = d . target . id === "svgroot" ? document . getElementById ( "canvas_background" ) : d . target ; if ( f == "eyedropper" && d ) { m . fillPaint = d . getAttribute ( "fill" ) || "white" ; m . fillOpacity = d . getAttribute ( "fill-opacity" ) || 1 ; m . strokePaint = d . getAttribute ( "stroke" ) || "none" ; m . strokeOpacity = d . getAttribute ( "stroke-opacity" ) || 1 ; m . strokeWidth = d . getAttribute ( "stroke-width" ) ; m . strokeDashArray = d . getAttribute ( "stroke-dasharray" ) ; m . strokeLinecap = d . getAttribute ( "stroke-linecap" ) ; m . strokeLinejoin = d . getAttribute ( "stroke-linejoin" ) ;
m . opacity = d . getAttribute ( "opacity" ) || 1 ; if ( $ . inArray ( b . selectedElements . nodeName , [ "g" , "use" ] ) == - 1 ) { var l = { } , p = function ( q , M , U ) { l [ M ] = q . getAttribute ( M ) ; q . setAttribute ( M , U ) } , B = new a . BatchCommand ; b . selectedElements . forEach ( function ( q ) { m . fillPaint && p ( q , "fill" , m . fillPaint ) ; m . fillOpacity && p ( q , "fill-opacity" , m . fillOpacity ) ; m . strokePaint && p ( q , "stroke" , m . strokePaint ) ; m . strokeOpacity && p ( q , "stroke-opacity" , m . strokeOpacity ) ; m . strokeWidth && p ( q , "stroke-width" , m . strokeWidth ) ; m . strokeDashArray && p ( q , "stroke-dasharray" ,
m . strokeDashArray ) ; m . opacity && p ( q , "opacity" , m . opacity ) ; m . strokeLinecap && p ( q , "stroke-linecap" , m . strokeLinecap ) ; m . strokeLinejoin && p ( q , "stroke-linejoin" , m . strokeLinejoin ) ; B . addSubCommand ( new c ( q , l ) ) ; console . log ( l ) ; l = { } } ) ; s ( m . fillPaint , m . fillOpacity * 100 , "fill" ) ; s ( m . strokePaint , m . strokeOpacity * 100 , "stroke" ) ; svgEditor . paintBox . fill . update ( true ) ; svgEditor . paintBox . stroke . update ( true ) ; g . undoMgr . addCommandToHistory ( B ) } } } } } ) ; svgEditor . addExtension ( "Markers" , function ( a ) { function o ( W , ha ) { var X = W . getAttribute ( ha ) ; if ( ! X ) return null ; X = X . match ( /\(\#(.*)\)/ ) ; if ( ! X || X . length !== 2 ) return null ; return a . getElem ( X [ 1 ] ) } function g ( W ) { $ ( "#marker_panel" ) . toggle ( W ) ; $ ( "#marker_panel_title" ) . length < 1 && $ ( "#marker_panel" ) . prepend ( "<h4 id='marker_panel_title'>Arrows</h4>" ) ; if ( W ) { var ha = U [ 0 ] , X , R ; $ . each ( P , function ( ba , ta ) { var ja = o ( ha , "marker-" + ta ) , ea = $ ( "#" + ta + "_marker" ) ; if ( ja ) { if ( ! ja . attributes . se _type ) return ; R = X = "\\" + ja . attributes . se _type . textContent ;
if ( X == "\\textmarker" ) X = ja . lastChild . textContent ; else ea . hide ( ) } else { R = X = "\\nomarker" ; ea . hide ( ) } ea . val ( X ) ; l ( ta , R ) } ) } } function c ( W , ha ) { var X = a . getElem ( W ) ; if ( ! X ) if ( ! ( ha == "" || ha == "\\nomarker" ) ) { var R = U [ 0 ] . getAttribute ( "stroke" ) , ba = 50 , ta = 50 , ja = "0 0 100 100" , ea = 5 , aa = 5 ; se _type = ha . substr ( 0 , 1 ) == "\\" ? ha . substr ( 1 ) : "textmarker" ; if ( ca [ se _type ] ) { X = M ( { element : "marker" , attr : { id : W , markerUnits : "strokeWidth" , orient : "auto" , style : "pointer-events:none" , se _type : se _type } } ) ; if ( se _type != "textmarker" ) { var Z = M ( ca [ se _type ] ) ,
la = R ; if ( se _type . substr ( - 2 ) == "_o" ) la = "none" ; Z . setAttribute ( "fill" , la ) ; Z . setAttribute ( "stroke" , R ) ; Z . setAttribute ( "stroke-width" , 10 ) ; X . appendChild ( Z ) } else { Z = M ( ca [ se _type ] ) ; Z . textContent = ha ; la = Z . getBBox ( ) ; la . x = 0 ; la . y = 0 ; la . width += 2 ; la . height += 2 ; Z . setAttribute ( "x" , 1 ) ; Z . setAttribute ( "y" , la . height - 1 - la . height / 4 ) ; Z . setAttribute ( "fill" , R ) ; ba = la . width / 2 + 1 ; ta = la . height / 2 + 1 ; ja = la . x + " " + la . y + " " + la . width + " " + la . height ; ea = la . width / 10 ; aa = la . height / 10 ; R = M ( { element : "rect" , attr : { x : la . x , y : la . y , width : la . width , height : la . height ,
fill : "#ffffff" , stroke : "none" , "stroke-width" : 0 } } ) ; X . setAttribute ( "orient" , 0 ) ; X . appendChild ( R ) ; X . appendChild ( Z ) } X . setAttribute ( "viewBox" , ja ) ; X . setAttribute ( "markerWidth" , ea ) ; X . setAttribute ( "markerHeight" , aa ) ; X . setAttribute ( "refX" , ba ) ; X . setAttribute ( "refY" , ta ) ; a . findDefs ( ) . appendChild ( X ) ; return X } } } function m ( ) { var W = { start _marker : "start" , mid _marker : "mid" , end _marker : "end" } [ this . id ] , ha = "marker-" + W , X = this . value , R = U [ 0 ] , ba = o ( R , ha ) ; ba && $ ( ba ) . remove ( ) ; R . removeAttribute ( ha ) ; if ( X == "" ) X = "\\nomarker" ; if ( X == "\\nomarker" ) { l ( W ,
X ) ; a . call ( "changed" , U ) } else { ba = I + W + "_" + R . id ; c ( ba , X ) ; svgCanvas . changeSelectedAttribute ( ha , "url(#" + ba + ")" ) ; R . tagName == "line" && W == "mid" && s ( R ) ; a . call ( "changed" , U ) ; l ( W , X ) } } function s ( W ) { if ( W . tagName != "line" ) return W ; var ha = W . getAttribute ( "x1" ) - 0 , X = W . getAttribute ( "x2" ) - 0 , R = W . getAttribute ( "y1" ) - 0 , ba = W . getAttribute ( "y2" ) - 0 , ta = W . id , ja = M ( { element : "polyline" , attr : { points : ha + "," + R + ( " " + ( ha + X ) / 2 + "," + ( R + ba ) / 2 + " " ) + X + "," + ba , stroke : W . getAttribute ( "stroke" ) , "stroke-width" : W . getAttribute ( "stroke-width" ) , fill : "none" ,
opacity : W . getAttribute ( "opacity" ) || 1 } } ) ; $ . each ( P , function ( ea , aa ) { var Z = "marker-" + aa ; W . getAttribute ( Z ) && ja . setAttribute ( Z , W . getAttribute ( Z ) ) } ) ; ha = new a . BatchCommand ; ha . addSubCommand ( new a . RemoveElementCommand ( W , W . parentNode ) ) ; ha . addSubCommand ( new a . InsertElementCommand ( ja ) ) ; $ ( W ) . after ( ja ) . remove ( ) ; svgCanvas . clearSelection ( ) ; ja . id = ta ; svgCanvas . addToSelection ( [ ja ] ) ; a . addCommandToHistory ( ha ) ; return ja } function b ( W ) { var ha = W . getAttribute ( "stroke" ) ; $ . each ( P , function ( X , R ) { var ba = o ( W , "marker-" + R ) ; if ( ba ) if ( ba . attributes . se _type ) if ( ba =
ba . lastElementChild ) { var ta = ba . getAttribute ( "fill" ) , ja = ba . getAttribute ( "stroke" ) ; ta && ta != "none" && ba . setAttribute ( "fill" , ha ) ; ja && ja != "none" && ba . setAttribute ( "stroke" , ha ) } } ) } function f ( W ) { $ . each ( P , function ( ha , X ) { var R = I + X + "_" + W . id , ba = "marker-" + X , ta = o ( W , ba ) ; if ( ta && ta . attributes . se _type ) if ( ta = W . getAttribute ( ba ) ) { var ja = W . id . length ; ta = ta . substr ( - ja - 1 , ja ) ; if ( W . id != ta ) { ta = $ ( "#" + X + "_marker" ) . attr ( "value" ) ; c ( R , ta ) ; svgCanvas . changeSelectedAttribute ( ba , "url(#" + R + ")" ) ; if ( W . tagName == "line" && X == "mid" ) W = s ( W ) ; a . call ( "changed" ,
U ) } } } ) } function d ( W , ha ) { $ ( "#" + W + "_marker" ) . val ( ha ) ; $ ( "#" + W + "_marker" ) . change ( ) ; $ ( "#" + W + "_marker" ) } function l ( W , ha ) { if ( ha . substr ( 0 , 1 ) != "\\" ) ha = "\\textmarker" ; var X = "#" + V + W + "_" + ha . substr ( 1 ) ; svgEditor . setIcon ( "#cur_" + W + "_marker_list" , $ ( X ) . children ( ) ) ; $ ( X ) . addClass ( "current" ) . siblings ( ) . removeClass ( "current" ) } function p ( W ) { var ha = $ ( "#" + W + "_marker" ) . val ( ) ; if ( ha . substr ( 0 , 1 ) == "\\" ) ha = "" ; $ . prompt ( "Enter text for " + W + " marker" , ha , function ( X ) { X && d ( W , X ) } ) } function B ( ) { var W = this . id . split ( "_" ) , ha = W [ 1 ] , X = W [ 2 ] ;
if ( W [ 3 ] ) X += "_" + W [ 3 ] ; X != "textmarker" ? d ( ha , "\\" + X ) : p ( ha ) } function q ( W , ha ) { var X = Q [ W ] , R ; for ( R in X ) if ( X [ R ] . id == ha ) return X [ R ] . title ; return ha } var M = a . addSvgElementFromJson , U , P = [ "start" , "mid" , "end" ] , I = "se_marker_" , V = "mkr_" , ca = { nomarker : { } , leftarrow : { element : "path" , attr : { d : "M0,50 L100,90 L70,50 L100,10 Z" } } , rightarrow : { element : "path" , attr : { d : "M100,50 L0,90 L30,50 L0,10 Z" } } , textmarker : { element : "text" , attr : { x : 0 , y : 0 , "stroke-width" : 0 , stroke : "none" , "font-size" : 75 , "font-family" : "serif" , "text-anchor" : "left" ,
"xml:space" : "preserve" } } , forwardslash : { element : "path" , attr : { d : "M30,100 L70,0" } } , reverseslash : { element : "path" , attr : { d : "M30,0 L70,100" } } , verticalslash : { element : "path" , attr : { d : "M50,0 L50,100" } } , box : { element : "path" , attr : { d : "M20,20 L20,80 L80,80 L80,20 Z" } } , star : { element : "path" , attr : { d : "M10,30 L90,30 L20,90 L50,10 L80,90 Z" } } , xmark : { element : "path" , attr : { d : "M20,80 L80,20 M80,80 L20,20" } } , triangle : { element : "path" , attr : { d : "M10,80 L50,20 L80,80 Z" } } , mcircle : { element : "circle" , attr : { r : 30 , cx : 50 , cy : 50 } } } , Q = { en : [ { id : "start_marker_list" ,
2012-07-19 15:22:42 +00:00
title : "Select start marker type" } , { id : "mid_marker_list" , title : "Select mid marker type" } , { id : "end_marker_list" , title : "Select end marker type" } , { id : "nomarker" , title : "No Marker" } , { id : "leftarrow" , title : "Left Arrow" } , { id : "rightarrow" , title : "Right Arrow" } , { id : "textmarker" , title : "Text Marker" } , { id : "forwardslash" , title : "Forward Slash" } , { id : "reverseslash" , title : "Reverse Slash" } , { id : "verticalslash" , title : "Vertical Slash" } , { id : "box" , title : "Box" } , { id : "star" , title : "Star" } , { id : "xmark" , title : "X" } , { id : "triangle" ,
2012-07-24 12:42:34 +00:00
title : "Triangle" } , { id : "mcircle" , title : "Circle" } , { id : "leftarrow_o" , title : "Open Left Arrow" } , { id : "rightarrow_o" , title : "Open Right Arrow" } , { id : "box_o" , title : "Open Box" } , { id : "star_o" , title : "Open Star" } , { id : "triangle_o" , title : "Open Triangle" } , { id : "mcircle_o" , title : "Open Circle" } ] } ; $ . each ( [ "leftarrow" , "rightarrow" , "box" , "star" , "mcircle" , "triangle" ] , function ( W , ha ) { ca [ ha + "_o" ] = ca [ ha ] } ) ; return { name : "Markers" , svgicons : "extensions/markers-icons.xml" , buttons : function ( ) { var W = [ ] ; $ . each ( P , function ( ha , X ) { var R =
X + "_marker_list" , ba = true ; $ . each ( ca , function ( ta ) { var ja = q ( "en" , ta ) ; W . push ( { id : V + X + "_" + ta , svgicon : ta , title : ja , type : "context" , events : { click : B } , panel : "marker_panel" , list : R , isDefault : ba } ) ; ba = false } ) } ) ; return W } ( ) , context _tools : [ { type : "input" , panel : "marker_panel" , title : "Start marker" , id : "start_marker" , label : "Start" , size : 3 , events : { change : m } } , { type : "button-select" , panel : "marker_panel" , title : q ( "en" , "start_marker_list" ) , id : "start_marker_list" , colnum : 3 , events : { change : B } } , { type : "input" , panel : "marker_panel" , title : "Middle marker" ,
id : "mid_marker" , label : "Middle" , defval : "" , size : 3 , events : { change : m } } , { type : "button-select" , panel : "marker_panel" , title : q ( "en" , "mid_marker_list" ) , id : "mid_marker_list" , colnum : 3 , events : { change : B } } , { type : "input" , panel : "marker_panel" , title : "End marker" , id : "end_marker" , label : "End" , size : 3 , events : { change : m } } , { type : "button-select" , panel : "marker_panel" , title : q ( "en" , "end_marker_list" ) , id : "end_marker_list" , colnum : 3 , events : { change : B } } ] , callback : function ( ) { $ ( "#marker_panel" ) . addClass ( "toolset" ) . hide ( ) } , addLangData : function ( W ) { return { data : Q [ W ] } } ,
selectedChanged : function ( W ) { U = W . elems ; for ( var ha = U . length , X = [ "line" , "path" , "polyline" , "polygon" ] ; ha -- ; ) { var R = U [ ha ] ; if ( R && $ . inArray ( R . tagName , X ) != - 1 ) W . selectedElement && ! W . multiselected ? g ( true ) : g ( false ) ; else g ( false ) } } , elementChanged : function ( W ) { if ( ( W = W . elems [ 0 ] ) && ( W . getAttribute ( "marker-start" ) || W . getAttribute ( "marker-mid" ) || W . getAttribute ( "marker-end" ) ) ) { b ( W ) ; f ( W ) } changing _flag = false } } } ) ; svgEditor . addExtension ( "view_grid" , function ( a ) { function o ( d ) { b . attr ( "width" ) ; b . attr ( "height" ) ; var l = svgedit . units . getTypeMap ( ) [ svgEditor . curConfig . baseUnit ] , p = [ 0.01 , 0.1 , 1 , 10 , 100 , 1E3 ] ; svgCanvas . getContentElem ( ) . getAttribute ( "x" ) ; var B = m ; l = l * d ; var q = 100 / l , M = 1 ; for ( d = 0 ; d < p . length ; d ++ ) { var U = p [ d ] ; M = U ; if ( q <= U ) break } p = M * l ; B . width = p ; B . height = p ; l = B . getContext ( "2d" ) ; q = p / 10 ; l . globalAlpha = 0.2 ; l . strokeStyle = "#000" ; for ( d = 1 ; d < 10 ; d ++ ) { M = Math . round ( q * d ) + 0.5 ; l . moveTo ( M , p ) ; l . lineTo ( M , 0 ) ; l . moveTo ( p , M ) ; l . lineTo ( 0 , M ) } l . stroke ( ) ;
l . beginPath ( ) ; l . globalAlpha = 0.5 ; l . moveTo ( 0.5 , p ) ; l . lineTo ( 0.5 , 0 ) ; l . moveTo ( p , 0.5 ) ; l . lineTo ( 0 , 0.5 ) ; l . stroke ( ) ; B = B . toDataURL ( "image/png" ) ; f . setAttribute ( "width" , p ) ; f . setAttribute ( "height" , p ) ; f . parentNode . setAttribute ( "width" , p ) ; f . parentNode . setAttribute ( "height" , p ) ; svgCanvas . setHref ( f , B ) } if ( ! document . getElementById ( "canvasGrid" ) ) { var g = document . getElementById ( "svgcanvas" ) . ownerDocument , c = false ; a = a . assignAttributes ; var m = document . createElement ( "canvas" ) ; $ ( m ) . hide ( ) . appendTo ( "body" ) ; var s = g . createElementNS ( "http://www.w3.org/2000/svg" ,
"g" ) ; a ( s , { id : "canvasGrid" , width : "100%" , height : "100%" , x : 0 , y : 0 , overflow : "visible" , display : "none" } ) ; var b = $ ( "#canvas_background" ) ; b . after ( s ) ; s = g . createElementNS ( "http://www.w3.org/2000/svg" , "pattern" ) ; a ( s , { id : "gridpattern" , patternUnits : "userSpaceOnUse" , x : 0 , y : 0 , width : 100 , height : 100 } ) ; var f = g . createElementNS ( "http://www.w3.org/2000/svg" , "image" ) ; a ( f , { x : 0 , y : 0 , width : 100 , height : 100 } ) ; s . appendChild ( f ) ; $ ( "#svgroot defs" ) . append ( s ) ; g = g . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; a ( g , { width : "100%" , height : "100%" ,
x : 0 , y : 0 , "stroke-width" : 0 , stroke : "none" , fill : "url(#gridpattern)" , style : "pointer-events: none; display:visible;" } ) ; $ ( "#canvasGrid" ) . append ( g ) } return { name : "view_grid" , zoomChanged : function ( d ) { c && o ( d ) } , buttons : [ { id : "view_grid" , type : "menu" , after : "tool_wireframe" , panel : "view_menu" , title : "View Grid" , events : { click : function ( ) { if ( $ ( "#view_grid" ) . hasClass ( "push_button_pressed" ) ) { svgEditor . curConfig . showGrid = c = false ; $ ( "#view_grid" ) . removeClass ( "push_button_pressed" ) ; $ ( "#canvasGrid" ) . attr ( "display" , "none" ) } else { svgEditor . curConfig . showGrid =
c = true ; $ ( "#view_grid" ) . addClass ( "push_button_pressed" ) ; $ ( "#canvasGrid" ) . attr ( "display" , "normal" ) ; o ( svgCanvas . getZoom ( ) ) } } } } ] } } ) ; svgEditor . addExtension ( "shapes" , function ( ) { function a ( ) { $ ( "#shape_buttons" ) . empty ( ) ; $ ( "#shape_buttons" ) . append ( M . buttons ) } function o ( P ) { var I = q [ P ] ; if ( I ) { M = I ; I . buttons . length || g ( P , I ) ; a ( ) } else { $ ( "#shape_buttons" ) . html ( "Loading..." ) ; $ . getJSON ( "extensions/shapelib/" + P + ".json" , function ( V ) { M = q [ P ] = { data : V . data , size : V . size , fill : V . fill } ; g ( P , V ) ; a ( ) } ) } } function g ( P , I ) { var V = M . size || 300 , ca = M . fill || false , Q = V * 0.05 ; Q = [ - Q , - Q , V + Q * 2 , V + Q * 2 ] . join ( " " ) ; V = ca ? 0 : V / 30 ; V = ( new DOMParser ) . parseFromString ( '<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="' +
Q + '"><path fill="#333" stroke="transparent" stroke-width="' + V + '" /></svg></svg>' , "text/xml" ) ; V . documentElement . setAttribute ( "width" , 40 ) ; V . documentElement . setAttribute ( "height" , 40 ) ; ca = $ ( document . importNode ( V . documentElement , true ) ) ; var W = I . data ; M . buttons = [ ] ; for ( var ha in W ) { var X = W [ ha ] , R = ca . clone ( ) ; if ( X . charAt ( X . length - 1 ) == "x" ) { V = 32 ; Q = V * 0.05 ; Q = [ - Q , - Q , V + Q * 2 , V + Q * 2 ] . join ( " " ) ; R . find ( "svg" ) . attr ( "viewBox" , Q ) ; X . replace ( "x" , "" ) } R . find ( "path" ) . attr ( "d" , X ) ; V = R . wrap ( '<div class="tool_button">' ) . parent ( ) . attr ( { id : U +
"_" + ha , title : ha } ) ; M . buttons . push ( V [ 0 ] ) } } var c , m , s = svgEditor . canvas , b , f , d , l = s . getRootElem ( ) , p = { } , 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" } , q = { 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" ,
2012-07-19 15:25:04 +00:00
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" ,
2012-07-24 12:42:34 +00:00
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 : [ ] } } , M = q . basic , U = "shapelib" ; return { svgicons : "extensions/ext-shapes.xml" , buttons : [ { id : "tool_shapelib" , type : "mode_flyout" , position : 6 , title : "Shape library" , events : { click : function ( ) { s . setMode ( U ) } } } ] , callback : function ( ) { var P = $ ( '<div id="shape_buttons">' ) ;
$ ( "#tools_shapelib > *" ) . wrapAll ( P ) ; var I = $ ( "#tools_shapelib_show" ) ; o ( "basic" ) ; $ ( "#shape_buttons" ) . mouseup ( function ( ca ) { ca = $ ( ca . target ) . closest ( "div.tool_button" ) ; if ( ca . length ) { var Q = ca . children ( ) . clone ( ) . attr ( { width : 24 , height : 24 } ) ; I . children ( ":not(.flyout_arrow_horiz)" ) . remove ( ) ; I . append ( Q ) . attr ( "data-curopt" , "#" + ca [ 0 ] . id ) . mouseup ( ) ; s . setMode ( U ) ; m = ca [ 0 ] . id . substr ( ( U + "_" ) . length ) ; c = M . data [ m ] ; $ ( ".tools_flyout" ) . fadeOut ( ) } } ) ; P = $ ( '<div id="shape_cats">' ) ; var V = "" ; $ . each ( B , function ( ca , Q ) { V += "<div data-cat=" +
ca + ">" + Q + "</div>" } ) ; P . html ( V ) . children ( ) . bind ( "mouseup" , function ( ) { var ca = $ ( this ) ; ca . siblings ( ) . removeClass ( "current" ) ; ca . addClass ( "current" ) ; o ( ca . attr ( "data-cat" ) ) ; return false } ) ; P . children ( ) . eq ( 0 ) . addClass ( "current" ) ; $ ( "#tools_shapelib" ) . prepend ( P ) ; I . mouseup ( function ( ) { s . setMode ( c ? U : "select" ) } ) ; $ ( "#tool_shapelib" ) . remove ( ) ; P = $ ( "#tools_shapelib" ) . height ( ) ; $ ( "#tools_shapelib" ) . css ( { "margin-top" : - ( P / 2 ) , "margin-left" : 3 } ) } , mouseDown : function ( P ) { if ( s . getMode ( ) === U ) { var I = f = P . start _x ; P = d = P . start _y ; var V =
s . getStyle ( ) ; b = s . addSvgElementFromJson ( { element : "path" , curStyles : true , attr : { d : c , id : s . getNextId ( ) , opacity : V . opacity / 2 , style : "pointer-events:none" } } ) ; b . setAttribute ( "d" , c ) ; if ( /[a-z]/ . test ( c ) ) { c = M . data [ m ] = s . pathActions . convertPath ( b ) ; b . setAttribute ( "d" , c ) ; s . pathActions . fixEnd ( b ) } b . setAttribute ( "transform" , "translate(" + I + "," + P + ") scale(0.005) translate(" + - I + "," + - P + ")" ) ; s . recalculateDimensions ( b ) ; s . getTransformList ( b ) ; p = b . getBBox ( ) ; totalScale = { sx : 1 , sy : 1 } ; return { started : true } } } , mouseMove : function ( P ) { if ( s . getMode ( ) ===
U ) { var I = s . getZoom ( ) , V = P . event , ca = P . mouse _x / I , Q = P . mouse _y / I ; P = s . getTransformList ( b ) ; var W = b . getBBox ( ) ; I = W . x ; var ha = W . y , X = W . width , R = W . height , ba = ca - f , ta = Q - d , ja = { x : Math . min ( f , ca ) , y : Math . min ( d , Q ) , width : Math . abs ( ca - f ) , height : Math . abs ( Q - d ) } , ea = W = 0 ; R = R ? ( R + ta ) / R : 1 ; X = X ? ( X + ba ) / X : 1 ; X = ja . width / p . width ; R = ja . height / p . height ; X = X || 1 ; R = R || 1 ; if ( ca < f ) W = p . width ; if ( Q < d ) ea = p . height ; ca = l . createSVGTransform ( ) ; Q = l . createSVGTransform ( ) ; ja = l . createSVGTransform ( ) ; ca . setTranslate ( - ( I + W ) , - ( ha + ea ) ) ; if ( V . shiftKey ) { replaced = true ;
V = Math . min ( Math . abs ( X ) , Math . abs ( R ) ) ; X = V * ( X < 0 ? - 1 : 1 ) ; R = V * ( R < 0 ? - 1 : 1 ) ; if ( totalScale . sx != totalScale . sy ) { V = totalScale . sx > totalScale . sy ? 1 : totalScale . sx / totalScale . sy ; ba = totalScale . sy > totalScale . sx ? 1 : totalScale . sy / totalScale . sx ; X *= ba ; R *= V ; console . log ( V , ba ) } } totalScale . sx *= X ; totalScale . sy *= R ; Q . setScale ( X , R ) ; ja . setTranslate ( I + W , ha + ea ) ; P . appendItem ( ja ) ; P . appendItem ( Q ) ; P . appendItem ( ca ) ; s . recalculateDimensions ( b ) ; p = b . getBBox ( ) } } , mouseUp : function ( P ) { if ( s . getMode ( ) === U ) { if ( P . mouse _x == f && P . mouse _y == d ) return { keep : false ,
element : b , started : false } ; s . setMode ( "select" ) ; return { keep : true , element : b , started : false } } } } } ) ; ( function ( ) { for ( var a = 0 , o = [ "ms" , "moz" , "webkit" , "o" ] , g = 0 ; g < o . length && ! window . requestAnimationFrame ; ++ g ) { window . requestAnimationFrame = window [ o [ g ] + "RequestAnimationFrame" ] ; window . cancelAnimationFrame = window [ o [ g ] + "CancelAnimationFrame" ] || window [ o [ g ] + "CancelRequestAnimationFrame" ] } if ( ! window . requestAnimationFrame ) window . requestAnimationFrame = function ( c ) { var m = ( new Date ) . getTime ( ) , s = Math . max ( 0 , 16 - ( m - a ) ) , b = window . setTimeout ( function ( ) { c ( m + s ) } , s ) ; a = m + s ; return b } ; if ( ! window . cancelAnimationFrame ) window . cancelAnimationFrame =
function ( c ) { clearTimeout ( c ) } } ) ( ) ;