2012-07-25 06:32:18 +00:00
function touchHandler ( a ) { var p = a . changedTouches , g = p [ 0 ] , c = "" ; switch ( a . type ) { case "touchstart" : c = "mousedown" ; break ; case "touchmove" : c = "mousemove" ; break ; case "touchend" : c = "mouseup" ; break ; default : return } var n = document . createEvent ( "MouseEvent" ) ; n . initMouseEvent ( c , true , true , window , 1 , g . screenX , g . screenY , g . clientX , g . clientY , false , false , false , false , 0 , null ) ; if ( p . length < 2 ) { g . target . dispatchEvent ( n ) ; a . preventDefault ( ) } } ; ( function ( a ) { function p ( g ) { if ( typeof g . data === "string" ) { var c = g . handler , n = 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 = "" , m = { } ; 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 ) m [ d + b ] =
true ; else { m [ d + f ] = true ; m [ d + a . hotkeys . shiftNums [ f ] ] = true ; if ( d === "shift+" ) m [ a . hotkeys . shiftNums [ f ] ] = true } b = 0 ; for ( f = n . length ; b < f ; b ++ ) if ( m [ n [ 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 : p } } ) } ) ( jQuery ) ; ( function ( a , p ) { function g ( da ) { return typeof da === "string" } function c ( da ) { var W = d . call ( arguments , 1 ) ; return function ( ) { return da . apply ( this , W . concat ( d . call ( arguments ) ) ) } } function n ( da , W , Z , oa , pa ) { var na ; if ( oa !== f ) { W = Z . match ( da ? /^([^#]*)\#?(.*)$/ : /^([^#?]*)\??([^#]*)(#?.*)/ ) ; Z = W [ 3 ] || "" ; if ( pa === 2 && g ( oa ) ) oa = oa . replace ( da ? ba : U , "" ) ; else { na = o ( W [ 2 ] ) ; oa = g ( oa ) ? o [ da ? ia : P ] ( oa ) : oa ; oa = pa === 2 ? oa : pa === 1 ? a . extend ( { } , oa , na ) : a . extend ( { } , na , oa ) ; oa = q ( oa ) ; if ( da ) oa = oa . replace ( xa , m ) } da = W [ 1 ] + ( da ? "#" : oa || ! W [ 1 ] ? "?" : "" ) + oa + Z } else da =
W ( Z !== f ? Z : p [ qa ] [ ga ] ) ; return da } function s ( da , W , Z ) { if ( W === f || typeof W === "boolean" ) { Z = W ; W = q [ da ? ia : P ] ( ) } else W = g ( W ) ? W . replace ( da ? ba : U , "" ) : W ; return o ( W , Z ) } function b ( da , W , Z , oa ) { if ( ! g ( Z ) && typeof Z !== "object" ) { oa = Z ; Z = W ; W = f } return this . each ( function ( ) { var pa = a ( this ) , na = W || Q ( ) [ ( this . nodeName || "" ) . toLowerCase ( ) ] || "" , ma = na && pa . attr ( na ) || "" ; pa . attr ( na , q [ da ] ( ma , Z , oa ) ) } ) } var f , d = Array . prototype . slice , m = decodeURIComponent , q = a . param , B , o , K , S = a . bbq = a . bbq || { } , M , J , Q , Y = a . event . special , P = "querystring" , ia = "fragment" , qa =
"location" , ga = "href" , U = /^.*\?|#.*$/g , ba = /^.*\#/ , xa , ka = { } ; q [ P ] = c ( n , 0 , function ( da ) { return da . replace ( /(?:^[^?#]*\?([^#]*).*$)?.*/ , "$1" ) } ) ; q [ ia ] = B = c ( n , 1 , function ( da ) { return da . replace ( /^[^#]*#?(.*)$/ , "$1" ) } ) ; B . noEscape = function ( da ) { da = da || "" ; da = a . map ( da . split ( "" ) , encodeURIComponent ) ; xa = RegExp ( da . join ( "|" ) , "g" ) } ; B . noEscape ( ",/" ) ; a . deparam = o = function ( da , W ) { var Z = { } , oa = { "true" : true , "false" : false , "null" : null } ; a . each ( da . replace ( /\+/g , " " ) . split ( "&" ) , function ( pa , na ) { var ma = na . split ( "=" ) , za = m ( ma [ 0 ] ) , Ha = Z , Fa =
0 , Ia = za . split ( "][" ) , La = Ia . length - 1 ; if ( /\[/ . test ( Ia [ 0 ] ) && /\]$/ . test ( Ia [ La ] ) ) { Ia [ La ] = Ia [ La ] . replace ( /\]$/ , "" ) ; Ia = Ia . shift ( ) . split ( "[" ) . concat ( Ia ) ; La = Ia . length - 1 } else La = 0 ; if ( ma . length === 2 ) { ma = m ( ma [ 1 ] ) ; if ( W ) ma = ma && ! isNaN ( ma ) ? + ma : ma === "undefined" ? f : oa [ ma ] !== f ? oa [ ma ] : ma ; if ( La ) for ( ; Fa <= La ; Fa ++ ) { za = Ia [ Fa ] === "" ? Ha . length : Ia [ Fa ] ; Ha = Ha [ za ] = Fa < La ? Ha [ za ] || ( Ia [ Fa + 1 ] && isNaN ( Ia [ Fa + 1 ] ) ? { } : [ ] ) : ma } else if ( a . isArray ( Z [ za ] ) ) Z [ za ] . push ( ma ) ; else Z [ za ] = Z [ za ] !== f ? [ Z [ za ] , ma ] : ma } else if ( za ) Z [ za ] = W ? f : "" } ) ; return Z } ; o [ P ] = c ( s ,
0 ) ; o [ ia ] = K = c ( s , 1 ) ; a . elemUrlAttr || ( a . elemUrlAttr = function ( da ) { return a . extend ( ka , da ) } ) ( { a : ga , base : ga , iframe : "src" , img : "src" , input : "src" , form : "action" , link : ga , script : "src" } ) ; Q = a . elemUrlAttr ; a . fn [ P ] = c ( b , P ) ; a . fn [ ia ] = c ( b , ia ) ; S . pushState = M = function ( da , W ) { if ( g ( da ) && /^#/ . test ( da ) && W === f ) W = 2 ; var Z = da !== f ; Z = B ( p [ qa ] [ ga ] , Z ? da : { } , Z ? W : 2 ) ; p [ qa ] [ ga ] = Z + ( /#/ . test ( Z ) ? "" : "#" ) } ; S . getState = J = function ( da , W ) { return da === f || typeof da === "boolean" ? K ( da ) : K ( W ) [ da ] } ; S . removeState = function ( da ) { var W = { } ; if ( da !== f ) { W = J ( ) ; a . each ( a . isArray ( da ) ?
da : arguments , function ( Z , oa ) { delete W [ oa ] } ) } M ( W , 2 ) } ; Y . hashchange = a . extend ( Y . hashchange , { add : function ( da ) { function W ( oa ) { var pa = oa [ ia ] = B ( ) ; oa . getState = function ( na , ma ) { return na === f || typeof na === "boolean" ? o ( pa , na ) : o ( pa , ma ) [ na ] } ; Z . apply ( this , arguments ) } var Z ; if ( a . isFunction ( da ) ) { Z = da ; return W } else { Z = da . handler ; da . handler = W } } } ) } ) ( jQuery , this ) ;
( function ( a , p , g ) { function c ( B ) { B = B || p [ b ] [ f ] ; return B . replace ( /^[^#]*#?(.*)$/ , "$1" ) } var n , s = a . event . special , b = "location" , f = "href" , d = document . documentMode , m = a . browser . msie && ( d === g || d < 8 ) , q = "onhashchange" in p && ! m ; a . hashchangeDelay = 100 ; s . hashchange = a . extend ( s . hashchange , { setup : function ( ) { if ( q ) return false ; a ( n . start ) } , teardown : function ( ) { if ( q ) return false ; a ( n . stop ) } } ) ; n = function ( ) { function B ( ) { M = J = function ( Q ) { return Q } ; if ( m ) { S = a ( '<iframe src="javascript:0"/>' ) . hide ( ) . insertAfter ( "body" ) [ 0 ] . contentWindow ;
J = function ( ) { return c ( S . document [ b ] [ f ] ) } ; M = function ( Q , Y ) { if ( Q !== Y ) { var P = S . document ; P . open ( ) . close ( ) ; P [ b ] . hash = "#" + Q } } ; M ( c ( ) ) } } var o = { } , K , S , M , J ; o . start = function ( ) { if ( ! K ) { var Q = c ( ) ; M || B ( ) ; ( function Y ( ) { var P = c ( ) , ia = J ( Q ) ; if ( P !== Q ) { M ( Q = P , ia ) ; a ( p ) . trigger ( "hashchange" ) } else if ( ia !== Q ) p [ b ] [ f ] = p [ b ] [ f ] . replace ( /#.*/ , "" ) + "#" + ia ; K = setTimeout ( Y , a . hashchangeDelay ) } ) ( ) } } ; o . stop = function ( ) { if ( ! S ) { K && clearTimeout ( K ) ; K = 0 } } ; return o } ( ) } ) ( jQuery , this ) ; ( function ( a ) { var p = { } , g ; a . svgIcons = function ( c , n ) { function s ( da , W ) { if ( da !== "ajax" ) { if ( Q ) return ; var Z = ( S = ga [ 0 ] . contentDocument ) && S . getElementById ( "svg_eof" ) ; if ( ! Z && ! ( W && Z ) ) { Y ++ ; if ( Y < 50 ) setTimeout ( s , 20 ) ; else { f ( ) ; Q = true } return } Q = true } K = a ( S . firstChild ) . children ( ) ; if ( n . no _img ) setTimeout ( function ( ) { J || b ( ) } , 500 ) ; else { Z = qa + "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D" ; M = a ( new Image ) . attr ( { src : Z , width : 0 , height : 0 } ) . appendTo ( "body" ) . load ( function ( ) { b ( true ) } ) . error ( function ( ) { b ( ) } ) } }
function b ( da , W ) { if ( ! J ) { if ( n . no _img ) da = false ; if ( da ) { var Z = a ( document . createElement ( "div" ) ) ; Z . hide ( ) . appendTo ( "body" ) } if ( W ) { var oa = n . fallback _path ? n . fallback _path : "" ; a . each ( W , function ( La , Ka ) { a ( "#" + La ) ; var Ea = a ( new Image ) . attr ( { "class" : "svg_icon" , src : oa + Ka , width : B , height : o , alt : "icon" } ) ; ka ( Ea , La ) } ) } else for ( var pa = K . length , na = 0 ; na < pa ; na ++ ) { var ma = K [ na ] , za = ma . id ; if ( za === "svg_eof" ) break ; a ( "#" + za ) ; ma = ma . getElementsByTagNameNS ( m , "svg" ) [ 0 ] ; var Ha = document . createElementNS ( m , "svg" ) ; Ha . setAttributeNS ( m , "viewBox" ,
[ 0 , 0 , B , o ] . join ( " " ) ) ; var Fa = ma . getAttribute ( "width" ) , Ia = ma . getAttribute ( "height" ) ; ma . removeAttribute ( "width" ) ; ma . removeAttribute ( "height" ) ; ma . getAttribute ( "viewBox" ) || ma . setAttribute ( "viewBox" , [ 0 , 0 , Fa , Ia ] . join ( " " ) ) ; Ha . setAttribute ( "xmlns" , m ) ; Ha . setAttribute ( "width" , B ) ; Ha . setAttribute ( "height" , o ) ; Ha . setAttribute ( "xmlns:xlink" , q ) ; Ha . setAttribute ( "class" , "svg_icon" ) ; ia || ( ma = ma . cloneNode ( true ) ) ; Ha . appendChild ( ma ) ; if ( da ) { ia || Ha . cloneNode ( true ) ; Z . empty ( ) . append ( Ha ) ; ma = qa + d ( Z . html ( ) ) ; ma = a ( new Image ) . attr ( { "class" : "svg_icon" ,
src : ma } ) } else ma = g ( a ( Ha ) , na ) ; ka ( ma , za ) } n . placement && a . each ( n . placement , function ( La , Ka ) { p [ Ka ] && a ( La ) . each ( function ( Ea ) { var ya = p [ Ka ] . clone ( ) ; if ( Ea > 0 && ! da ) ya = g ( ya , Ea , true ) ; xa ( a ( this ) , ya , Ka ) } ) } ) ; if ( ! W ) { da && Z . remove ( ) ; ga && ga . remove ( ) ; M && M . remove ( ) } n . resize && a . resizeSvgIcons ( n . resize ) ; J = true ; n . callback && n . callback ( p ) } } function f ( ) { if ( c . indexOf ( ".svgz" ) != - 1 ) { var da = c . replace ( ".svgz" , ".svg" ) ; window . console && console . log ( ".svgz failed, trying with .svg" ) ; a . svgIcons ( da , n ) } else n . fallback && b ( false , n . fallback ) }
function d ( da ) { if ( window . btoa ) return window . btoa ( da ) ; var W = Array ( Math . floor ( ( da . length + 2 ) / 3 ) * 4 ) , Z , oa , pa , na , ma , za , Ha = 0 , Fa = 0 ; do { Z = da . charCodeAt ( Ha ++ ) ; oa = da . charCodeAt ( Ha ++ ) ; pa = da . charCodeAt ( Ha ++ ) ; na = Z >> 2 ; Z = ( Z & 3 ) << 4 | oa >> 4 ; ma = ( oa & 15 ) << 2 | pa >> 6 ; za = pa & 63 ; if ( isNaN ( oa ) ) ma = za = 64 ; else if ( isNaN ( pa ) ) za = 64 ; W [ Fa ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( na ) ; W [ Fa ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( Z ) ; W [ Fa ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( ma ) ;
W [ Fa ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( za ) } while ( Ha < da . length ) ; return W . join ( "" ) } var m = "http://www.w3.org/2000/svg" , q = "http://www.w3.org/1999/xlink" , B = n . w ? n . w : 24 , o = n . h ? n . h : 24 , K , S , M , J = false , Q = false , Y = 0 , P = navigator . userAgent , ia = ! ! window . opera ; P . indexOf ( "Safari/" ) > - 1 && P . indexOf ( "Chrome/" ) ; var qa = "data:image/svg+xml;charset=utf-8;base64," ; if ( n . svgz ) { var ga = a ( '<object data="' + c + '" type=image/svg+xml>' ) . appendTo ( "body" ) . hide ( ) ; try { S = ga [ 0 ] . contentDocument ; ga . load ( s ) ;
s ( 0 , true ) } catch ( U ) { f ( ) } } else { var ba = new DOMParser ; a . ajax ( { url : c , dataType : "string" , success : function ( da ) { if ( da ) { S = ba . parseFromString ( da , "text/xml" ) ; a ( function ( ) { s ( "ajax" ) } ) } else a ( f ) } , error : function ( da ) { if ( window . opera ) a ( function ( ) { f ( ) } ) ; else if ( da . responseText ) { S = ba . parseFromString ( da . responseText , "text/xml" ) ; S . childNodes . length || a ( f ) ; a ( function ( ) { s ( "ajax" ) } ) } else a ( f ) } } ) } var xa = function ( da , W , Z , oa ) { ia && W . css ( "visibility" , "hidden" ) ; if ( n . replace ) { oa && W . attr ( "id" , Z ) ; ( Z = da . attr ( "class" ) ) && W . attr ( "class" ,
"svg_icon " + Z ) ; da . replaceWith ( W ) } else da . append ( W ) ; ia && setTimeout ( function ( ) { W . removeAttr ( "style" ) } , 1 ) } , ka = function ( da , W ) { if ( n . id _match === undefined || n . id _match !== false ) xa ( holder , da , W , true ) ; p [ W ] = da } ; g = function ( da , W ) { var Z = da . find ( "defs" ) ; if ( ! Z . length ) return da ; Z = ia ? Z . find ( "*" ) . filter ( function ( ) { return ! ! this . id } ) : Z . find ( "[id]" ) ; var oa = da [ 0 ] . getElementsByTagName ( "*" ) , pa = oa . length ; Z . each ( function ( na ) { var ma = this . id ; a ( S ) . find ( "#" + ma ) ; this . id = na = "x" + ma + W + na ; ma = "url(#" + ma + ")" ; var za = "url(#" + na + ")" ; for ( na =
0 ; na < pa ; na ++ ) { var Ha = oa [ na ] ; Ha . getAttribute ( "fill" ) === ma && Ha . setAttribute ( "fill" , za ) ; Ha . getAttribute ( "stroke" ) === ma && Ha . setAttribute ( "stroke" , za ) ; Ha . getAttribute ( "filter" ) === ma && Ha . setAttribute ( "filter" , za ) } } ) ; return da } } ; a . getSvgIcon = function ( c , n ) { var s = p [ c ] ; if ( n && s ) s = g ( s , 0 , true ) . clone ( true ) ; return s } ; a . resizeSvgIcons = function ( c ) { var n = ! a ( ".svg_icon:first" ) . length ; a . each ( c , function ( s , b ) { var f = a . isArray ( b ) , d = f ? b [ 0 ] : b , m = f ? b [ 1 ] : b ; if ( n ) s = s . replace ( /\.svg_icon/g , "svg" ) ; a ( s ) . each ( function ( ) { this . setAttribute ( "width" ,
d ) ; this . setAttribute ( "height" , m ) ; if ( window . opera && window . widget ) { this . parentNode . style . width = d + "px" ; this . parentNode . style . height = m + "px" } } ) } ) } } ) ( jQuery ) ; ( function ( ) { function a ( c , n , s ) { c = document . createElementNS ( p . svg , c ) ; if ( g ) for ( var b in n ) c . setAttribute ( b , n [ b ] ) ; else for ( b in n ) { var f = n [ 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 p = { 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 =
2012-07-24 12:42:34 +00:00
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 =
2012-07-25 06:32:18 +00:00
"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 n =
arguments ; return this . each ( function ( ) { function s ( ja , ca , la , N , R ) { var ea = R || a ( "stop" , { "stop-color" : ca , "stop-opacity" : la , offset : ja } , ba ) ; if ( R ) { ca = R . getAttribute ( "stop-color" ) ; la = R . getAttribute ( "stop-opacity" ) ; ja = R . getAttribute ( "offset" ) } else ba . appendChild ( ea ) ; if ( la === null ) la = 1 ; R = a ( "path" , { d : "M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z" , fill : "url(#jGraduate_trans)" , transform : "translate(" + ( 10 + ja * ia ) + ", 26)" } , Va ) ; var Ga =
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 : ca , "fill-opacity" : la , transform : "translate(" + ( 10 + ja * ia ) + ", 26)" , stroke : "#000" , "stroke-width" : 1.5 } , Va ) ; $ ( Ga ) . mousedown ( function ( Oa ) { b ( this ) ; Ya = ib ; Q . mousemove ( m ) . mouseup ( f ) ; ua = yb . offset ( ) ; Oa . preventDefault ( ) ; return false } ) . data ( "stop" , ea ) . data ( "bg" , R ) . dblclick ( function ( ) { $ ( "div.jGraduate_LightBox" ) . show ( ) ; for ( var Oa = this , Xa = + ea . getAttribute ( "stop-opacity" ) ||
1 , bb = ea . getAttribute ( "stop-color" ) || 1 , rb = ( parseFloat ( Xa ) * 255 ) . toString ( 16 ) ; rb . length < 2 ; ) rb = "0" + rb ; ca = bb . substr ( 1 ) + rb ; $ ( "#" + o + "_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 : ca , alphaSupport : true } } , function ( Wa ) { bb = Wa . val ( "hex" ) ? "#" + Wa . val ( "hex" ) : "none" ; Xa = Wa . val ( "a" ) !== null ? Wa . val ( "a" ) / 256 : 1 ; Oa . setAttribute ( "fill" , bb ) ; Oa . setAttribute ( "fill-opacity" , Xa ) ; ea . setAttribute ( "stop-color" ,
bb ) ; ea . setAttribute ( "stop-opacity" , Xa ) ; $ ( "div.jGraduate_LightBox" ) . hide ( ) ; $ ( "#" + o + "_jGraduate_stopPicker" ) . hide ( ) } , null , function ( ) { $ ( "div.jGraduate_LightBox" ) . hide ( ) ; $ ( "#" + o + "_jGraduate_stopPicker" ) . hide ( ) } ) } ) ; $ ( ba ) . find ( "stop" ) . each ( function ( ) { var Oa = $ ( this ) ; if ( + this . getAttribute ( "offset" ) > ja ) { if ( ! ca ) { var Xa = this . getAttribute ( "stop-color" ) , bb = this . getAttribute ( "stop-opacity" ) ; ea . setAttribute ( "stop-color" , Xa ) ; Ga . setAttribute ( "fill" , Xa ) ; ea . setAttribute ( "stop-opacity" , bb === null ? 1 : bb ) ; Ga . setAttribute ( "fill-opacity" ,
bb === null ? 1 : bb ) } Oa . before ( ea ) ; return false } } ) ; N && b ( Ga ) ; return ea } function b ( ja ) { ib && ib . setAttribute ( "stroke" , "#000" ) ; ja . setAttribute ( "stroke" , "blue" ) ; ib = ja ; ib . parentNode . appendChild ( ib ) } function f ( ) { Q . unbind ( "mousemove" , m ) ; if ( Aa . getAttribute ( "display" ) !== "none" ) { Aa . setAttribute ( "display" , "none" ) ; var ja = $ ( ib ) , ca = ja . data ( "stop" ) ; ja = ja . data ( "bg" ) ; $ ( [ ib , ca , ja ] ) . remove ( ) } Ya = null } function d ( ) { var ja = Ta ? "rotate(" + Ta + "," + Ba + "," + jb + ") " : "" ; fb === 1 && Ma === 1 ? ba . removeAttribute ( "gradientTransform" ) : ba . setAttribute ( "gradientTransform" ,
ja + "translate(" + - Ba * ( fb - 1 ) + "," + - jb * ( Ma - 1 ) + ") scale(" + fb + "," + Ma + ")" ) } function m ( ja ) { var ca = ja . pageX - ua . left ; ja = ja . pageY - ua . top ; ca = ca < 10 ? 10 : ca > ia + 10 ? ia + 10 : ca ; var la = "translate(" + ca + ", 26)" ; if ( ja < - 60 || ja > 130 ) { Aa . setAttribute ( "display" , "block" ) ; Aa . setAttribute ( "transform" , la ) } else Aa . setAttribute ( "display" , "none" ) ; Ya . setAttribute ( "transform" , la ) ; $ . data ( Ya , "bg" ) . setAttribute ( "transform" , la ) ; $ . data ( Ya , "stop" ) . setAttribute ( "offset" , ( ca - 10 ) / ia ) ; var N = 0 ; $ ( ba ) . find ( "stop" ) . each ( function ( ) { var R = this . getAttribute ( "offset" ) ,
ea = $ ( this ) ; if ( R < N ) { ea . prev ( ) . before ( ea ) ; wa = $ ( ba ) . find ( "stop" ) } N = R } ) } var q = $ ( this ) , B = $ . extend ( true , { } , jQuery . fn . jGraduateDefaults , c ) , o = q . attr ( "id" ) , K = "#" + q . attr ( "id" ) + " " ; if ( K ) { var S = function ( ) { switch ( q . paint . type ) { case "radialGradient" : q . paint . linearGradient = null ; break ; case "linearGradient" : q . paint . radialGradient = null ; break ; case "solidColor" : q . paint . radialGradient = q . paint . linearGradient = null } $ . isFunction ( q . okCallback ) && q . okCallback ( q . paint ) ; q . hide ( ) } , M = function ( ) { $ . isFunction ( q . cancelCallback ) && q . cancelCallback ( ) ;
q . hide ( ) } ; $ . extend ( true , q , { paint : new $ . jGraduate . Paint ( { copy : B . paint } ) , okCallback : $ . isFunction ( n [ 1 ] ) && n [ 1 ] || null , cancelCallback : $ . isFunction ( n [ 2 ] ) && n [ 2 ] || null } ) ; q . position ( ) ; var J = null , Q = $ ( window ) ; if ( q . paint . type == "none" ) q . paint = $ . jGraduate . Paint ( { solidColor : "ffffff" } ) ; q . addClass ( "jGraduate_Picker" ) ; q . 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="' +
o + '_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>' ) ; var Y = $ ( K + "> .jGraduate_colPick" ) , P = $ ( K + "> .jGraduate_gradPick" ) ; P . html ( '<div id="' + o + '_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">' + B . window . pickerTitle + '</h2><div id="' + o + '_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="' + o + '_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="' +
o + '_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + o + '_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="' + o + '_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' +
o + '_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="' + o + '_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + o + '_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="' +
o + '_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="' + o + '_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + o + '_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="' +
o + '_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="' + o + '_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + o + '_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="' + o + '_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="' +
o + '_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + o + '_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="' + o + '_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="' + o + '_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="' + B . images . clientPath +
'rangearrows2.gif"></div><label><input type="text" id="' + o + '_jGraduate_AngleInput" size="3" value="0"/>\u00ba </label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="' + o + '_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="' + o + '_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + o + '_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="' +
o + '_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="' + o + '_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>' ) ; var ia = 256 , qa = ia - 0 , ga = ia - 0 , U , ba , xa , ka = { } ; $ ( ".jGraduate_SliderBar" ) . width ( 145 ) ; var da = $ ( "#" + o + "_jGraduate_GradContainer" ) [ 0 ] , W = a ( "svg" , { id : o + "_jgraduate_svg" , width : ia , height : ia , xmlns : p . svg } , da ) ; U = U || q . paint . type ; var Z = ba = q . paint [ U ] , oa = q . paint . alpha , pa = U === "solidColor" ; switch ( U ) { case "solidColor" : case "linearGradient" : if ( ! pa ) { ba . id = o + "_lg_jgraduate_grad" ;
Z = ba = W . appendChild ( ba ) } a ( "radialGradient" , { id : o + "_rg_jgraduate_grad" } , W ) ; if ( U === "linearGradient" ) break ; case "radialGradient" : if ( ! pa ) { ba . id = o + "_rg_jgraduate_grad" ; Z = ba = W . appendChild ( ba ) } a ( "linearGradient" , { id : o + "_lg_jgraduate_grad" } , W ) } if ( pa ) { Z = ba = $ ( "#" + o + "_lg_jgraduate_grad" ) [ 0 ] ; J = q . paint [ U ] ; s ( 0 , "#" + J , 1 ) ; var na = typeof B . newstop ; if ( na === "string" ) switch ( B . newstop ) { case "same" : s ( 1 , "#" + J , 1 ) ; break ; case "inverse" : na = "" ; for ( var ma = 0 ; ma < 6 ; ma += 2 ) { J . substr ( ma , 2 ) ; var za = ( 255 - parseInt ( J . substr ( ma , 2 ) , 16 ) ) . toString ( 16 ) ;
if ( za . length < 2 ) za = 0 + za ; na += za } 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 || "#" + J , "opac" in B . newstop ? B . newstop . opac : 1 ) } J = parseFloat ( Z . getAttribute ( "x1" ) || 0 ) ; na = parseFloat ( Z . getAttribute ( "y1" ) || 0 ) ; ma = parseFloat ( Z . getAttribute ( "x2" ) || 1 ) ; za = parseFloat ( Z . getAttribute ( "y2" ) || 0 ) ; var Ha = parseFloat ( Z . getAttribute ( "cx" ) || 0.5 ) , Fa = parseFloat ( Z . getAttribute ( "cy" ) || 0.5 ) , Ia = parseFloat ( Z . getAttribute ( "fx" ) || Ha ) , La = parseFloat ( Z . getAttribute ( "fy" ) ||
Fa ) ; xa = a ( "rect" , { id : o + "_jgraduate_rect" , x : 0 , y : 0 , width : qa , height : ga , fill : "url(#" + o + "_jgraduate_grad)" , "fill-opacity" : oa / 100 } , W ) ; var Ka = $ ( "<div/>" ) . attr ( { "class" : "grad_coord jGraduate_lg_field" , title : "Begin Stop" } ) . text ( 1 ) . css ( { top : na * ia , left : J * ia } ) . data ( "coord" , "start" ) . appendTo ( da ) , Ea = Ka . clone ( ) . text ( 2 ) . css ( { top : za * ia , left : ma * ia } ) . attr ( "title" , "End stop" ) . data ( "coord" , "end" ) . appendTo ( da ) , ya = $ ( "<div/>" ) . attr ( { "class" : "grad_coord jGraduate_rg_field" , title : "Center stop" } ) . text ( "C" ) . css ( { top : Fa * ia , left : Ha *
ia } ) . data ( "coord" , "center" ) . appendTo ( da ) , Ca = ya . clone ( ) . text ( "F" ) . css ( { top : La * ia , left : Ia * ia , display : "none" } ) . attr ( "title" , "Focus point" ) . data ( "coord" , "focus" ) . appendTo ( da ) ; Ca [ 0 ] . id = o + "_jGraduate_focusCoord" ; $ ( K + " .grad_coord" ) ; $ . each ( [ "x1" , "y1" , "x2" , "y2" , "cx" , "cy" , "fx" , "fy" ] , function ( ja , ca ) { var la = ba . getAttribute ( ca ) , N = isNaN ( ca [ 1 ] ) ; la || ( la = N ? "0.5" : ca === "x2" ? "1.0" : "0.0" ) ; ka [ ca ] = $ ( "#" + o + "_jGraduate_" + ca ) . val ( la ) . change ( function ( ) { if ( isNaN ( parseFloat ( this . value ) ) || this . value < 0 ) this . value = 0 ; else if ( this . value >
1 ) this . value = 1 ; if ( ! ( ca [ 0 ] === "f" && ! kb ) ) if ( N && U === "radialGradient" || ! N && U === "linearGradient" ) ba . setAttribute ( ca , this . value ) ; var R = N ? ca [ 0 ] === "c" ? ya : Ca : ca [ 1 ] === "1" ? Ka : Ea , ea = ca . indexOf ( "x" ) >= 0 ? "left" : "top" ; R . css ( ea , this . value * ia ) } ) . change ( ) } ) ; var wa , Va , yb = $ ( "#" + o + "_jGraduate_StopSlider" ) , ib , Qa , Ya , Aa = a ( "path" , { d : "m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5" , fill : "none" , stroke : "#D00" , "stroke-width" : 5 , display : "none" } , Qa ) , ua , fb = 1 , Ma = 1 , Ta = 0 , Ba = Ha , jb = Fa ; Qa = a ( "svg" , { width : "100%" , height : 45 } , yb [ 0 ] ) ; da = a ( "pattern" , { width : 16 ,
height : 16 , patternUnits : "userSpaceOnUse" , id : "jGraduate_trans" } , Qa ) ; a ( "image" , { width : 16 , height : 16 } , da ) . setAttributeNS ( p . xlink , "xlink:href" , B . images . clientPath + "map-opacity.png" ) ; $ ( Qa ) . on ( "click touchstart" , function ( ja ) { ua = yb . offset ( ) ; if ( ja . target . tagName !== "path" ) { var ca = ja . pageX - ua . left - 8 ; ca = ca < 10 ? 10 : ca > ia + 10 ? ia + 10 : ca ; s ( ca / ia , 0 , 0 , true ) ; ja . stopPropagation ( ) } } ) ; $ ( Qa ) . mouseover ( function ( ) { Qa . appendChild ( Aa ) } ) ; Va = a ( "g" , { } , Qa ) ; a ( "line" , { x1 : 10 , y1 : 15 , x2 : ia + 10 , y2 : 15 , "stroke-width" : 2 , stroke : "#000" } , Qa ) ; var sb =
P . find ( ".jGraduate_spreadMethod" ) . change ( function ( ) { ba . setAttribute ( "spreadMethod" , $ ( this ) . val ( ) ) } ) , Za = null , cb = function ( ja ) { var ca = ja . pageX - lb . left , la = ja . pageY - lb . top ; ca = ca < 0 ? 0 : ca > ia ? ia : ca ; la = la < 0 ? 0 : la > ia ? ia : la ; Za . css ( "left" , ca ) . css ( "top" , la ) ; ca = ca / qa ; la = la / ga ; var N = Za . data ( "coord" ) , R = ba ; switch ( N ) { case "start" : ka . x1 . val ( ca ) ; ka . y1 . val ( la ) ; R . setAttribute ( "x1" , ca ) ; R . setAttribute ( "y1" , la ) ; break ; case "end" : ka . x2 . val ( ca ) ; ka . y2 . val ( la ) ; R . setAttribute ( "x2" , ca ) ; R . setAttribute ( "y2" , la ) ; break ; case "center" : ka . cx . val ( ca ) ;
ka . cy . val ( la ) ; R . setAttribute ( "cx" , ca ) ; R . setAttribute ( "cy" , la ) ; Ba = ca ; jb = la ; d ( ) ; break ; case "focus" : ka . fx . val ( ca ) ; ka . fy . val ( la ) ; R . setAttribute ( "fx" , ca ) ; R . setAttribute ( "fy" , la ) ; d ( ) } ja . preventDefault ( ) } , zb = function ( ) { Za = null ; Q . unbind ( "mousemove" , cb ) . unbind ( "mouseup" , zb ) } ; wa = ba . getElementsByTagNameNS ( p . svg , "stop" ) ; if ( sa < 2 ) { for ( ; sa < 2 ; ) { ba . appendChild ( document . createElementNS ( p . svg , "stop" ) ) ; ++ sa } wa = ba . getElementsByTagNameNS ( p . svg , "stop" ) } var sa = wa . length ; for ( ma = 0 ; ma < sa ; ma ++ ) s ( 0 , 0 , 0 , 0 , wa [ ma ] ) ; sb . val ( ba . getAttribute ( "spreadMethod" ) ||
"pad" ) ; var lb , kb = false ; xa . setAttribute ( "fill-opacity" , oa / 100 ) ; $ ( "#" + o + " div.grad_coord" ) . mousedown ( function ( ja ) { ja . preventDefault ( ) ; Za = $ ( this ) ; Za . offset ( ) ; lb = Za . parent ( ) . offset ( ) ; Q . mousemove ( cb ) . mouseup ( zb ) } ) ; $ ( "#" + o + "_jGraduate_Ok" ) . bind ( "click touchstart" , function ( ) { q . paint . type = U ; q . paint [ U ] = ba . cloneNode ( true ) ; q . paint . solidColor = null ; S ( ) } ) ; $ ( "#" + o + "_jGraduate_Cancel" ) . bind ( "click touchstart" , function ( ) { M ( ) } ) ; if ( U === "radialGradient" ) if ( kb ) Ca . show ( ) ; else { Ca . hide ( ) ; ka . fx . val ( "" ) ; ka . fy . val ( "" ) } $ ( "#" +
o + "_jGraduate_match_ctr" ) [ 0 ] . checked = ! kb ; var vb , nb ; $ ( "#" + o + "_jGraduate_match_ctr" ) . change ( function ( ) { kb = ! this . checked ; Ca . toggle ( kb ) ; ka . fx . val ( "" ) ; ka . fy . val ( "" ) ; var ja = ba ; if ( kb ) { var ca = vb || 0.5 , la = nb || 0.5 ; ja . setAttribute ( "fx" , ca ) ; ja . setAttribute ( "fy" , la ) ; ka . fx . val ( ca ) ; ka . fy . val ( la ) } else { vb = ja . getAttribute ( "fx" ) ; nb = ja . getAttribute ( "fy" ) ; ja . removeAttribute ( "fx" ) ; ja . removeAttribute ( "fy" ) } } ) ; wa = ba . getElementsByTagNameNS ( p . svg , "stop" ) ; sa = wa . length ; if ( sa < 2 ) { for ( ; sa < 2 ; ) { ba . appendChild ( document . createElementNS ( p . svg ,
"stop" ) ) ; ++ sa } wa = ba . getElementsByTagNameNS ( p . svg , "stop" ) } var gb ; oa = P = 0 ; if ( U === "radialGradient" ) { W = ba . gradientTransform . baseVal ; if ( W . numberOfItems === 2 ) { sa = W . getItem ( 0 ) ; W = W . getItem ( 1 ) ; if ( sa . type === 2 && W . type === 3 ) { sa = W . matrix ; if ( sa . a !== 1 ) P = Math . round ( - ( 1 - sa . a ) * 100 ) ; else if ( sa . d !== 1 ) P = Math . round ( ( 1 - sa . d ) * 100 ) } } else if ( W . numberOfItems === 3 ) { da = W . getItem ( 0 ) ; sa = W . getItem ( 1 ) ; W = W . getItem ( 2 ) ; if ( da . type === 4 && sa . type === 2 && W . type === 3 ) { oa = Math . round ( da . angle ) ; sa = W . matrix ; if ( sa . a !== 1 ) P = Math . round ( - ( 1 - sa . a ) * 100 ) ; else if ( sa . d !==
1 ) P = Math . round ( ( 1 - sa . d ) * 100 ) } } } P = { radius : { handle : "#" + o + "_jGraduate_RadiusArrows" , input : "#" + o + "_jGraduate_RadiusInput" , val : ( ba . getAttribute ( "r" ) || 0.5 ) * 100 } , opacity : { handle : "#" + o + "_jGraduate_OpacArrows" , input : "#" + o + "_jGraduate_OpacInput" , val : q . paint . alpha || 100 } , ellip : { handle : "#" + o + "_jGraduate_EllipArrows" , input : "#" + o + "_jGraduate_EllipInput" , val : P } , angle : { handle : "#" + o + "_jGraduate_AngleArrows" , input : "#" + o + "_jGraduate_AngleInput" , val : oa } } ; $ . each ( P , function ( ja , ca ) { var la = $ ( ca . handle ) ; la . mousedown ( function ( N ) { var R =
la . parent ( ) ; gb = { type : ja , elem : la , input : $ ( ca . input ) , parent : R , offset : R . offset ( ) } ; Q . mousemove ( tb ) . mouseup ( pb ) ; N . preventDefault ( ) } ) ; $ ( ca . input ) . val ( ca . val ) . change ( function ( ) { var N = + this . value , R = 0 , ea = U === "radialGradient" ; switch ( ja ) { case "radius" : ea && ba . setAttribute ( "r" , N / 100 ) ; R = Math . pow ( N / 100 , 0.4 ) / 2 * 145 ; break ; case "opacity" : q . paint . alpha = N ; xa . setAttribute ( "fill-opacity" , N / 100 ) ; R = N * 1.45 ; break ; case "ellip" : fb = Ma = 1 ; if ( N === 0 ) { R = 72.5 ; break } if ( N > 99.5 ) N = 99.5 ; if ( N > 0 ) Ma = 1 - N / 100 ; else fb = - ( N / 100 ) - 1 ; R = 145 * ( ( N + 100 ) /
2 ) / 100 ; ea && d ( ) ; break ; case "angle" : Ta = N ; R = Ta / 180 ; R += 0.5 ; R *= 145 ; ea && d ( ) } if ( R > 145 ) R = 145 ; else if ( R < 0 ) R = 0 ; la . css ( { "margin-left" : R - 5 } ) } ) . change ( ) } ) ; var tb = function ( ja ) { var ca = ja . pageX - gb . offset . left - parseInt ( gb . parent . css ( "border-left-width" ) ) ; if ( ca > 145 ) ca = 145 ; if ( ca <= 0 ) ca = 0 ; var la = ca - 5 ; ca /= 145 ; switch ( gb . type ) { case "radius" : ca = Math . pow ( ca * 2 , 2.5 ) ; if ( ca > 0.98 && ca < 1.02 ) ca = 1 ; if ( ca <= 0.01 ) ca = 0.01 ; ba . setAttribute ( "r" , ca ) ; break ; case "opacity" : q . paint . alpha = parseInt ( ca * 100 ) ; xa . setAttribute ( "fill-opacity" , ca ) ; break ;
case "ellip" : Ma = fb = 1 ; if ( ca < 0.5 ) { ca /= 0.5 ; fb = ca <= 0 ? 0.01 : ca } else if ( ca > 0.5 ) { ca /= 0.5 ; ca = 2 - ca ; Ma = ca <= 0 ? 0.01 : ca } d ( ) ; ca -= 1 ; if ( Ma === ca + 1 ) ca = Math . abs ( ca ) ; break ; case "angle" : ca -= 0.5 ; Ta = ca *= 180 ; d ( ) ; ca /= 100 } gb . elem . css ( { "margin-left" : la } ) ; ca = Math . round ( ca * 100 ) ; gb . input . val ( ca ) ; ja . preventDefault ( ) } , pb = function ( ) { Q . unbind ( "mousemove" , tb ) . unbind ( "mouseup" , pb ) ; gb = null } ; for ( P = ( q . paint . alpha * 255 / 100 ) . toString ( 16 ) ; P . length < 2 ; ) P = "0" + P ; P = P . split ( "." ) [ 0 ] ; J = q . paint . solidColor == "none" ? "" : q . paint . solidColor + P ; pa || ( J = wa [ 0 ] . getAttribute ( "stop-color" ) ) ;
$ . extend ( $ . fn . jPicker . defaults . window , { alphaSupport : true , effects : { type : "show" , speed : 0 } } ) ; Y . jPicker ( { window : { title : B . window . pickerTitle } , images : { clientPath : B . images . clientPath } , color : { active : J , alphaSupport : true } } , function ( ja ) { q . paint . type = "solidColor" ; q . paint . alpha = ja . val ( "ahex" ) ? Math . round ( ja . val ( "a" ) / 255 * 100 ) : 100 ; q . paint . solidColor = ja . val ( "hex" ) ? ja . val ( "hex" ) : "none" ; q . paint . radialGradient = null ; S ( ) } , null , function ( ) { M ( ) } ) ; var Ab = $ ( K + " .jGraduate_tabs li" ) ; Ab . on ( "click touchstart" , function ( ) { Ab . removeClass ( "jGraduate_tab_current" ) ;
$ ( this ) . addClass ( "jGraduate_tab_current" ) ; $ ( K + " > div" ) . hide ( ) ; var ja = $ ( this ) . attr ( "data-type" ) ; $ ( K + " .jGraduate_gradPick" ) . show ( ) ; if ( ja === "rg" || ja === "lg" ) { $ ( ".jGraduate_" + ja + "_field" ) . show ( ) ; $ ( ".jGraduate_" + ( ja === "lg" ? "rg" : "lg" ) + "_field" ) . hide ( ) ; $ ( "#" + o + "_jgraduate_rect" ) [ 0 ] . setAttribute ( "fill" , "url(#" + o + "_" + ja + "_jgraduate_grad)" ) ; U = ja === "lg" ? "linearGradient" : "radialGradient" ; $ ( "#" + o + "_jGraduate_OpacInput" ) . val ( q . paint . alpha ) . change ( ) ; var ca = $ ( "#" + o + "_" + ja + "_jgraduate_grad" ) [ 0 ] ; if ( ba !== ca ) { var la =
$ ( ba ) . find ( "stop" ) ; $ ( ca ) . empty ( ) . append ( la ) ; ba = ca ; ca = sb . val ( ) ; ba . setAttribute ( "spreadMethod" , ca ) } kb = ja === "rg" && ba . getAttribute ( "fx" ) != null && ! ( Ha == Ia && Fa == La ) ; $ ( "#" + o + "_jGraduate_focusCoord" ) . toggle ( kb ) ; if ( kb ) $ ( "#" + o + "_jGraduate_match_ctr" ) [ 0 ] . checked = false } else { $ ( K + " .jGraduate_gradPick" ) . hide ( ) ; $ ( K + " .jGraduate_colPick" ) . show ( ) } } ) ; $ ( K + " > div" ) . hide ( ) ; Ab . removeClass ( "jGraduate_tab_current" ) ; var Bb ; switch ( q . paint . type ) { case "linearGradient" : Bb = $ ( K + " .jGraduate_tab_lingrad" ) ; break ; case "radialGradient" : Bb =
$ ( K + " .jGraduate_tab_radgrad" ) ; break ; default : Bb = $ ( K + " .jGraduate_tab_color" ) } q . show ( ) ; setTimeout ( function ( ) { Bb . addClass ( "jGraduate_tab_current" ) . click ( ) } , 10 ) } else alert ( "Container element must have an id attribute to maintain unique id strings for sub-elements." ) } ) } } ) ( ) ; jQuery && function ( ) { var a = $ ( window ) , p = $ ( 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 n = $ ( this ) , s = $ ( n ) . offset ( ) , b = $ ( "#" + g . menu ) ; b . addClass ( "contextMenu" ) ; $ ( this ) . bind ( "mousedown" , function ( f ) { $ ( this ) . mouseup ( function ( d ) { var m = $ ( this ) ; m . unbind ( "mouseup" ) ; $ ( ".contextMenu" ) . hide ( ) ; if ( f . button === 2 || g . allowLeft ||
f . ctrlKey && svgedit . browser . isMac ( ) ) { d . stopPropagation ( ) ; if ( n . hasClass ( "disabled" ) || f . altKey ) return false ; var q = d . pageX , B = d . pageY ; d = a . width ( ) - b . width ( ) ; var o = a . height ( ) - b . height ( ) ; if ( q > d - 15 ) q = d - 15 ; if ( B > o - 30 ) B = o - 30 ; p . unbind ( "click" ) ; b . css ( { top : B , left : q } ) . 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" ) } ) ; p . keypress ( function ( K ) { switch ( K . 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 : p . trigger ( "click" ) } } ) ; b . find ( "A" ) . unbind ( "mouseup" ) ; b . find ( "LI:not(.disabled) A" ) . mouseup ( function ( ) { p . unbind ( "click" ) . unbind ( "keypress" ) ;
$ ( ".contextMenu" ) . hide ( ) ; c && c ( $ ( this ) . attr ( "href" ) . substr ( 1 ) , $ ( m ) , { x : q - s . left , y : B - s . top , docX : q , docY : B } ) ; return false } ) ; setTimeout ( function ( ) { p . click ( function ( ) { p . 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 } ) } ) ; $ ( n ) . 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 ( "," ) , n = 0 ; n < c . length ; n ++ ) $ ( this ) . find ( 'A[href="' + c [ n ] + '"]' ) . 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 ( "," ) , n = 0 ; n < c . length ; n ++ ) $ ( this ) . find ( 'A[href="' + c [ n ] + '"]' ) . parent ( ) . removeClass ( "disabled" ) } ) ; return $ ( this ) } , disableContextMenu : function ( ) { $ ( this ) . each ( function ( ) { $ ( this ) . addClass ( "disabled" ) } ) ; return $ ( this ) } , enableContextMenu : function ( ) { $ ( this ) . each ( function ( ) { $ ( this ) . removeClass ( "disabled" ) } ) ; return $ ( this ) } , destroyContextMenu : function ( ) { $ ( this ) . each ( function ( ) { $ ( this ) . unbind ( "mousedown" ) . unbind ( "mouseup" ) } ) ; return $ ( this ) } } ) } ( jQuery ) ; var svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . browser ) svgedit . browser = { } ; var a = ! ! document . createElementNS && ! ! document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) . createSVGRect ; svgedit . browser . supportsSvg = function ( ) { return a } ; if ( svgedit . browser . supportsSvg ( ) ) { var p = navigator . userAgent , g = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) , c = ! ! window . opera , n = p . indexOf ( "AppleWebKit" ) >= 0 , s = p . indexOf ( "Gecko/" ) >= 0 , b = p . indexOf ( "MSIE" ) >= 0 , f = p . indexOf ( "Chrome/" ) >= 0 , d = p . indexOf ( "Windows" ) >= 0 , m = p . indexOf ( "Macintosh" ) >=
0 , q = "ontouchstart" in window , B = ! ! g . querySelector , o = ! ! document . evaluate , K = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; qa . setAttribute ( "d" , "M0,0 10,10" ) ; var ga = qa . pathSegList ; qa = qa . createSVGPathSegLinetoAbs ( 5 , 5 ) ; try { ga . replaceItem ( qa , 0 ) ; return true } catch ( U ) { } return false } ( ) , S = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; qa . setAttribute ( "d" , "M0,0 10,10" ) ; var ga = qa . pathSegList ; qa = qa . createSVGPathSegLinetoAbs ( 5 , 5 ) ; try { ga . insertItemBefore ( qa ,
0 ) ; return true } catch ( U ) { } return false } ( ) , M = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) , ga = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; document . documentElement . appendChild ( qa ) ; ga . setAttribute ( "x" , 5 ) ; qa . appendChild ( ga ) ; var U = document . createElementNS ( "http://www.w3.org/2000/svg" , "text" ) ; U . textContent = "a" ; ga . appendChild ( U ) ; ga = U . getStartPositionOfChar ( 0 ) . x ; document . documentElement . removeChild ( qa ) ; return ga === 0 } ( ) , J = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" ,
"svg" ) ; document . documentElement . appendChild ( qa ) ; var ga = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; ga . setAttribute ( "d" , "M0,0 C0,0 10,10 10,0" ) ; qa . appendChild ( ga ) ; ga = ga . getBBox ( ) ; document . documentElement . removeChild ( qa ) ; return ga . height > 4 && ga . height < 5 } ( ) , Q = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; document . documentElement . appendChild ( qa ) ; var ga = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; ga . setAttribute ( "d" , "M0,0 10,0" ) ; var U =
document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; U . setAttribute ( "d" , "M5,0 15,0" ) ; var ba = document . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ; ba . appendChild ( ga ) ; ba . appendChild ( U ) ; qa . appendChild ( ba ) ; ga = ba . getBBox ( ) ; document . documentElement . removeChild ( qa ) ; return ga . width == 15 } ( ) , Y = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; qa . setAttribute ( "x" , 0.1 ) ; ( qa = qa . 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 qa } ( ) , P = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; qa . setAttribute ( "style" , "vector-effect:non-scaling-stroke" ) ; return qa . style . vectorEffect === "non-scaling-stroke" } ( ) , ia = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) . transform . baseVal , ga = g . createSVGTransform ( ) ; qa . appendItem ( ga ) ; return qa . getItem ( 0 ) == ga } ( ) ; svgedit . browser . isOpera = function ( ) { return c } ; svgedit . browser . isWebkit = function ( ) { return n } ; 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 m } ; svgedit . browser . isTouch = function ( ) { return q } ; svgedit . browser . supportsSelectors = function ( ) { return B } ; svgedit . browser . supportsXpath = function ( ) { return o } ; svgedit . browser . supportsPathReplaceItem = function ( ) { return K } ; svgedit . browser . supportsPathInsertItemBefore = function ( ) { return S } ; svgedit . browser . supportsPathBBox = function ( ) { return J } ;
svgedit . browser . supportsHVLineContainerBBox = function ( ) { return Q } ; svgedit . browser . supportsGoodTextCharPos = function ( ) { return M } ; svgedit . browser . supportsEditableText = function ( ) { return c } ; svgedit . browser . supportsGoodDecimals = function ( ) { return Y } ; svgedit . browser . supportsNonScalingStroke = function ( ) { return P } ; svgedit . browser . supportsNativeTransformLists = function ( ) { return ia } } 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" ) , p = { } ; svgedit . transformlist . SVGTransformList = function ( g ) { this . _elem = g || null ; this . _xforms = [ ] ; this . _update = function ( ) { var c = "" ; a . createSVGMatrix ( ) ; for ( var n = 0 ; n < this . numberOfItems ; ++ n ) { var s = this . _list . getItem ( n ) ; 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 n = /\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/ , s = true ; s ; ) { s = c . match ( n ) ; c = c . replace ( n , "" ) ; 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 ( /[, ]+/ ) , m = "abcdef" . split ( "" ) , q = a . createSVGMatrix ( ) ; $ . each ( d , function ( K , S ) { d [ K ] = parseFloat ( S ) ; if ( f == "matrix" ) q [ m [ K ] ] = d [ K ] } ) ; b = a . createSVGTransform ( ) ; var B = "set" + f . charAt ( 0 ) . toUpperCase ( ) + f . slice ( 1 ) , o = f == "matrix" ? [ q ] : d ; if ( f == "scale" && o . length == 1 ) o . push ( o [ 0 ] ) ; else if ( f == "translate" && o . length == 1 ) o . push ( 0 ) ; else if ( f == "rotate" && o . length == 1 ) { o . push ( 0 ) ; o . push ( 0 ) } b [ B ] . apply ( b , o ) ; this . _list . appendItem ( b ) } } } ; this . _removeFromOtherLists = function ( c ) { if ( c ) { var n =
false , s ; for ( s in p ) { for ( var b = p [ s ] , f = 0 , d = b . _xforms . length ; f < d ; ++ f ) if ( b . _xforms [ f ] == c ) { n = true ; b . removeItem ( f ) ; break } if ( n ) 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 , n ) { var s = null ; if ( n >= 0 ) if ( n < this . numberOfItems ) { this . _removeFromOtherLists ( c ) ;
s = Array ( this . numberOfItems + 1 ) ; for ( var b = 0 ; b < n ; ++ 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 , n ) { var s = null ; if ( n < this . numberOfItems && n >= 0 ) { this . _removeFromOtherLists ( c ) ; s = this . _xforms [ n ] = c ; this . _list . _update ( ) } return s } ; this . removeItem = function ( c ) { if ( c < this . numberOfItems && c >= 0 ) { for ( var n = 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 n } 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 ( ) { p = { } } ; svgedit . transformlist . removeElementFromListMap = function ( g ) { g . id && p [ g . id ] && delete p [ 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 n = p [ c ] ; if ( ! n || c == "temp" ) { p [ c ] = new svgedit . transformlist . SVGTransformList ( g ) ; p [ c ] . _init ( ) ; n = p [ c ] } return n } 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 ( p , g , c ) { return { x : c . a * p + c . c * g + c . e , y : c . b * p + c . d * g + c . f } } ; svgedit . math . isIdentity = function ( p ) { return p . a === 1 && p . b === 0 && p . c === 0 && p . d === 1 && p . e === 0 && p . f === 0 } ; svgedit . math . matrixMultiply = function ( ) { for ( var p = arguments , g = p . length , c = p [ g - 1 ] ; g -- > 1 ; ) c = p [ 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 ( p ) { if ( ! p ) return false ; for ( var g = p . numberOfItems ; g -- ; ) { var c = p . getItem ( g ) ; if ( c . type == 1 && ! svgedit . math . isIdentity ( c . matrix ) ) return true } return false } ; svgedit . math . transformBox = function ( p , g , c , n , s ) { var b = { x : p , y : g } , f = { x : p + c , y : g } ; c = { x : p + c , y : g + n } ; p = { x : p , y : g + n } ; g = svgedit . math . transformPoint ; b = g ( b . x , b . y , s ) ; var d = n = b . x , m = b . y , q = b . y ; f = g ( f . x , f . y , s ) ; n = Math . min ( n , f . x ) ; d = Math . max ( d , f . x ) ;
m = Math . min ( m , f . y ) ; q = Math . max ( q , f . y ) ; p = g ( p . x , p . y , s ) ; n = Math . min ( n , p . x ) ; d = Math . max ( d , p . x ) ; m = Math . min ( m , p . y ) ; q = Math . max ( q , p . y ) ; c = g ( c . x , c . y , s ) ; n = Math . min ( n , c . x ) ; d = Math . max ( d , c . x ) ; m = Math . min ( m , c . y ) ; q = Math . max ( q , c . y ) ; return { tl : b , tr : f , bl : p , br : c , aabox : { x : n , y : m , width : d - n , height : q - m } } } ; svgedit . math . transformListToTransform = function ( p , g , c ) { if ( p == null ) return a . createSVGTransformFromMatrix ( a . createSVGMatrix ( ) ) ; g = g == undefined ? 0 : g ; c = c == undefined ? p . numberOfItems - 1 : c ; g = parseInt ( g ) ; c = parseInt ( c ) ; if ( g > c ) { var n = c ; c = g ;
g = n } n = a . createSVGMatrix ( ) ; for ( g = g ; g <= c ; ++ g ) { var s = g >= 0 && g < p . numberOfItems ? p . getItem ( g ) . matrix : a . createSVGMatrix ( ) ; n = svgedit . math . matrixMultiply ( n , s ) } return a . createSVGTransformFromMatrix ( n ) } ; svgedit . math . getMatrix = function ( p ) { p = svgedit . transformlist . getTransformList ( p ) ; return svgedit . math . transformListToTransform ( p ) . matrix } ; svgedit . math . snapToAngle = function ( p , g , c , n ) { var s = Math . PI / 4 ; c = c - p ; var b = n - g ; n = Math . sqrt ( c * c + b * b ) ; s = Math . round ( Math . atan2 ( b , c ) / s ) * s ; return { x : p + n * Math . cos ( s ) , y : g + n * Math . sin ( s ) , a : s } } ;
svgedit . math . rectsIntersect = function ( p , g ) { return g . x < p . x + p . width && g . x + g . width > p . x && g . y < p . y + p . height && g . y + g . height > p . y } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . units ) svgedit . units = { } ; var a = [ "x" , "x1" , "cx" , "rx" , "width" ] , p = [ "y" , "y1" , "cy" , "ry" , "height" ] , g = $ . merge ( [ "r" , "radius" ] , a ) ; $ . merge ( g , p ) ; var c , n = { 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 ; n . em = f . width ; n . ex = f . height ; n [ "in" ] = b ; n . cm = b / 2.54 ; n . mm = b / 25.4 ; n . pt = b / 72 ; n . pc = b / 6 ; n [ "%" ] = 0 } ; svgedit . units . getTypeMap = function ( ) { return n } ; 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 / n [ 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 m = f . length , q = 0 ; q < m ; q ++ ) { var B = f [ q ] , o = b . getAttribute ( B ) ; if ( o ) isNaN ( o ) || b . setAttribute ( B , o / n [ 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 , m = c . getWidth ( ) , q = c . getHeight ( ) ; return a . indexOf ( b ) >= 0 ? d * m : p . indexOf ( b ) >= 0 ? d * q : d * Math . sqrt ( m * m + q * q ) / Math . sqrt ( 2 ) } else { m = f . substr ( - 2 ) ; d = f . substr ( 0 , f . length - 2 ) ; return d * n [ m ] } } ; svgedit . units . isValidUnit = function ( b , f , d ) { var m = false ; if ( g . indexOf ( b ) >= 0 ) if ( isNaN ( f ) ) { f = f . toLowerCase ( ) ; $ . each ( n , function ( o ) { if ( ! m ) if ( RegExp ( "^-?[\\d\\.]+" + o + "$" ) . test ( f ) ) m = true } ) } else m = true ; else if ( b == "id" ) { b = false ; try { var q = c . getElement ( f ) ;
b = q == null || q === d } catch ( B ) { } return b } else m = true ; return m } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { function a ( b ) { if ( svgedit . browser . supportsHVLineContainerBBox ( ) ) try { return b . getBBox ( ) } catch ( f ) { } var d = $ . data ( b , "ref" ) , m = null ; if ( d ) { var q = $ ( d ) . children ( ) . clone ( ) . attr ( "visibility" , "hidden" ) ; $ ( s ) . append ( q ) ; m = q . filter ( "line, path" ) } else m = $ ( b ) . find ( "line, path" ) ; var B = false ; if ( m . length ) { m . each ( function ( ) { var o = this . getBBox ( ) ; if ( ! o . width || ! o . height ) B = true } ) ; if ( B ) { b = d ? q : $ ( b ) . children ( ) ; ret = getStrokedBBox ( b ) } else ret = b . getBBox ( ) } else ret = b . getBBox ( ) ; d && q . remove ( ) ; return ret } if ( ! svgedit . utilities ) svgedit . utilities =
{ } ; var p = "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" . split ( "," ) , g = null , c = null , n = null , s = null ; svgedit . utilities . init = function ( b ) { g = b ; c = b . getDOMDocument ( ) ; n = 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 , m , q , B , o , K , S = 0 , M = 0 ; do { d = b . charCodeAt ( S ++ ) ; m = b . charCodeAt ( S ++ ) ; q = b . charCodeAt ( S ++ ) ; B = d >> 2 ; d = ( d & 3 ) << 4 | m >> 4 ; o = ( m & 15 ) << 2 | q >> 6 ; K = q & 63 ; if ( isNaN ( m ) ) o = K = 64 ; else if ( isNaN ( q ) ) K = 64 ; f [ M ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( B ) ; f [ M ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( d ) ; f [ M ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( o ) ; f [ M ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( K ) } while ( S <
b . length ) ; return f . join ( "" ) } ; svgedit . utilities . decode64 = function ( b ) { if ( window . atob ) return window . atob ( b ) ; var f = "" , d , m , q = "" , B , o = "" , K = 0 ; b = b . replace ( /[^A-Za-z0-9\+\/\=]/g , "" ) ; do { d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( K ++ ) ) ; m = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( K ++ ) ) ; B = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( K ++ ) ) ; o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( K ++ ) ) ;
d = d << 2 | m >> 4 ; m = ( m & 15 ) << 4 | B >> 2 ; q = ( B & 3 ) << 6 | o ; f += String . fromCharCode ( d ) ; if ( B != 64 ) f += String . fromCharCode ( m ) ; if ( o != 64 ) f += String . fromCharCode ( q ) } while ( K < b . length ) ; return unescape ( f ) } ; svgedit . utilities . convertToXMLReferences = function ( b ) { for ( var f = "" , d = 0 ; d < b . length ; d ++ ) { var m = b . charCodeAt ( d ) ; if ( m < 128 ) f += b [ d ] ; else if ( m > 127 ) f += "&#" + m + ";" } 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 ( m ) { throw Error ( "XML Parser could not be instantiated" ) ; } try { f = d . loadXML ? d . loadXML ( b ) ? d : false : d . parseFromString ( b , "text/xml" ) } catch ( q ) { 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 ) } } ;
2012-07-24 12:42:34 +00:00
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" ,
2012-07-25 06:32:18 +00:00
"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 m = f . getItem ( 0 ) ,
q = [ m . x , m . y ] ; for ( m = 0 ; m < d ; m ++ ) { var B = f . getItem ( m ) ; if ( typeof B . x != "undefined" ) { b [ 0 ] . push ( q [ 0 ] ) ; b [ 1 ] . push ( q [ 1 ] ) ; if ( B . x1 ) { for ( var o = [ B . x1 , B . y1 ] , K = [ B . x2 , B . y2 ] , S = [ B . x , B . y ] , M = 0 ; M < 2 ; M ++ ) { B = function ( ia ) { return Math . pow ( 1 - ia , 3 ) * q [ M ] + 3 * Math . pow ( 1 - ia , 2 ) * ia * o [ M ] + 3 * ( 1 - ia ) * Math . pow ( ia , 2 ) * K [ M ] + Math . pow ( ia , 3 ) * S [ M ] } ; var J = 6 * q [ M ] - 12 * o [ M ] + 6 * K [ M ] , Q = - 3 * q [ M ] + 9 * o [ M ] - 9 * K [ M ] + 3 * S [ M ] , Y = 3 * o [ M ] - 3 * q [ M ] ; if ( Q == 0 ) { if ( J != 0 ) { J = - Y / J ; 0 < J && J < 1 && b [ M ] . push ( B ( J ) ) } } else { Y = Math . pow ( J , 2 ) - 4 * Y * Q ; if ( ! ( Y < 0 ) ) { var P = ( - J + Math . sqrt ( Y ) ) / ( 2 * Q ) ; 0 < P && P <
1 && b [ M ] . push ( B ( P ) ) ; J = ( - J - Math . sqrt ( Y ) ) / ( 2 * Q ) ; 0 < J && J < 1 && b [ M ] . push ( B ( J ) ) } } } q = S } 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 ; m = Math . min . apply ( null , b [ 1 ] ) ; b = Math . max . apply ( null , b [ 1 ] ) - m ; return { x : f , y : m , 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 ( m ) { } break ;
case "path" : if ( svgedit . browser . supportsPathBBox ( ) ) try { b = f . getBBox ( ) } catch ( q ) { } 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 ( ~ p . indexOf ( d ) ) try { b = f . getBBox ( ) } catch ( B ) { f = $ ( f ) . closest ( "foreignObject" ) ; if ( f . length ) try { b = f [ 0 ] . getBBox ( ) } catch ( o ) { 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 m = d . numberOfItems , q = 0 ; q < m ; ++ q ) { var B = d . getItem ( q ) ; 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 + '"]' , n , 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 , m ) { d || ( d = 0 ) ; svgedit . browser . isOpera ( ) || s . suspendRedraw ( d ) ; for ( var q in f ) if ( d = q . substr ( 0 , 4 ) === "xml:" ? "http://www.w3.org/XML/1998/namespace" : q . substr ( 0 , 6 ) === "xlink:" ? "http://www.w3.org/1999/xlink" : null ) b . setAttributeNS ( d , q , f [ q ] ) ; else m ? svgedit . units . setUnitAttr ( b , q , f [ q ] ) : b . setAttribute ( q , f [ q ] ) ; 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 } , m ; for ( m in d ) { var q = d [ m ] ; b . getAttribute ( m ) == q && b . removeAttribute ( m ) } 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 p = { } ; $ . each ( a , function ( n , s ) { p [ s ] = n } ) ; var g = { a : [ "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "mask" , "opacity" , "stroke" , "stroke-dasharray" ,
2012-06-23 19:40:40 +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-25 06:32:18 +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 ( n , s ) { var b = { } ; $ . each ( s , function ( f , d ) { if ( d . indexOf ( ":" ) >=
0 ) { var m = d . split ( ":" ) ; b [ m [ 1 ] ] = p [ m [ 0 ] ] } else b [ d ] = d == "xmlns" ? "http://www.w3.org/2000/xmlns/" : null } ) ; c [ n ] = b } ) ; svgedit . sanitize . getNSMap = function ( ) { return a } ; svgedit . sanitize . sanitizeSvg = function ( n ) { if ( n . nodeType == 3 ) { n . nodeValue = n . nodeValue . replace ( /^\s+|\s+$/g , "" ) ; n . nodeValue . length || n . parentNode . removeChild ( n ) } if ( n . nodeType == 1 ) { var s = n . parentNode ; if ( n . ownerDocument && s ) { var b = g [ n . nodeName ] , f = c [ n . nodeName ] ; if ( b != undefined ) { for ( var d = [ ] , m = n . attributes . length ; m -- ; ) { var q = n . attributes . item ( m ) , B = q . nodeName ,
o = q . localName , K = q . namespaceURI ; if ( ! ( f . hasOwnProperty ( o ) && K == f [ o ] && K != "http://www.w3.org/2000/xmlns/" ) && ! ( K == "http://www.w3.org/2000/xmlns/" && a [ q . nodeValue ] ) ) { B . indexOf ( "se:" ) == 0 && d . push ( [ B , q . nodeValue ] ) ; n . removeAttributeNS ( K , o ) } if ( svgedit . browser . isGecko ( ) ) switch ( B ) { case "transform" : case "gradientTransform" : case "patternTransform" : o = q . nodeValue . replace ( /(\d)-/g , "$1 -" ) ; n . setAttribute ( B , o ) } if ( B == "style" ) { q = q . nodeValue . split ( ";" ) ; for ( B = q . length ; B -- ; ) { o = q [ B ] . split ( ":" ) ; b . indexOf ( o [ 0 ] ) >= 0 && n . setAttribute ( o [ 0 ] ,
o [ 1 ] ) } n . removeAttribute ( "style" ) } } $ . each ( d , function ( S , M ) { n . setAttributeNS ( "http://svg-edit.googlecode.com" , M [ 0 ] , M [ 1 ] ) } ) ; if ( ( m = svgedit . utilities . getHref ( n ) ) && [ "filter" , "linearGradient" , "pattern" , "radialGradient" , "textPath" , "use" ] . indexOf ( n . nodeName ) >= 0 ) if ( m [ 0 ] != "#" ) { svgedit . utilities . setHref ( n , "" ) ; n . removeAttributeNS ( "http://www.w3.org/1999/xlink" , "href" ) } if ( n . nodeName == "use" && ! svgedit . utilities . getHref ( n ) ) s . removeChild ( n ) ; else { $ . each ( [ "clip-path" , "fill" , "filter" , "marker-end" , "marker-mid" , "marker-start" ,
"mask" , "stroke" ] , function ( S , M ) { var J = n . getAttribute ( M ) ; if ( J ) if ( ( J = svgedit . utilities . getUrlFromAttr ( J ) ) && J [ 0 ] !== "#" ) { n . setAttribute ( M , "" ) ; n . removeAttribute ( M ) } } ) ; for ( m = n . childNodes . length ; m -- ; ) svgedit . sanitize . sanitizeSvg ( n . childNodes . item ( m ) ) } } else { for ( b = [ ] ; n . hasChildNodes ( ) ; ) b . push ( s . insertBefore ( n . firstChild , n ) ) ; s . removeChild ( n ) ; for ( m = b . length ; m -- ; ) svgedit . sanitize . sanitizeSvg ( b [ m ] ) } } } } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . history ) svgedit . history = { } ; svgedit . history . HistoryEventTypes = { BEFORE _APPLY : "before_apply" , AFTER _APPLY : "after_apply" , BEFORE _UNAPPLY : "before_unapply" , AFTER _UNAPPLY : "after_unapply" } ; svgedit . history . MoveElementCommand = function ( a , p , g , c ) { this . elem = a ; this . text = c ? "Move " + a . tagName + " to " + c : "Move " + a . tagName ; this . oldNextSibling = p ; 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-06-23 19:40:40 +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-25 06:32:18 +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 , p ) { this . elem = a ; this . text = p || "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-06-23 19:40:40 +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-25 06:32:18 +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 , p , g , c ) { this . elem = a ; this . text = c || "Delete " + a . tagName ; this . nextSibling = p ; this . parent = g ; svgedit . transformlist . removeElementFromListMap ( a ) } ; svgedit . history . RemoveElementCommand . type = function ( ) { return "svgedit.history.RemoveElementCommand" } ;
2012-06-23 19:40:40 +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-25 06:32:18 +00:00
svgedit . history . ChangeElementCommand = function ( a , p , g ) { this . elem = a ; this . text = g ? "Change " + a . tagName + " " + g : "Change " + a . tagName ; this . newValues = { } ; this . oldValues = p ; for ( var c in p ) 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 p = 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" ) p = true } if ( ! p ) if ( p = svgedit . utilities . getRotationAngle ( this . elem ) ) { g = elem . getBBox ( ) ; p = [ "rotate(" , p , " " , g . x + g . width / 2 , "," , g . y + g . height / 2 , ")" ] . join ( "" ) ; p != elem . getAttribute ( "transform" ) && elem . setAttribute ( "transform" , p ) } 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 p = 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" ) p = true } if ( ! p ) if ( p = svgedit . utilities . getRotationAngle ( this . elem ) ) { g = this . elem . getBBox ( ) ; p = [ "rotate(" , p , " " , g . x + g . width / 2 , "," , g . y + g . height / 2 , ")" ] . join ( "" ) ; p != this . elem . getAttribute ( "transform" ) && this . elem . setAttribute ( "transform" , p ) } svgedit . transformlist . removeElementFromListMap ( this . elem ) ;
2012-06-23 19:40:40 +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-25 06:32:18 +00:00
function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _APPLY , this ) ; for ( var p = this . stack . length , g = 0 ; g < p ; ++ 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 p = this . stack . length - 1 ; p >= 0 ; p -- ) this . stack [ p ] . unapply ( a ) ; a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _UNAPPLY ,
this ) } ; svgedit . history . BatchCommand . prototype . elements = function ( ) { for ( var a = [ ] , p = this . stack . length ; p -- ; ) for ( var g = this . stack [ p ] . 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-06-23 19:40:40 +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-25 06:32:18 +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 , p ) { for ( var g = ++ this . undoChangeStackPointer , c = p . length , n = Array ( c ) , s = Array ( c ) ; c -- ; ) { var b = p [ c ] ; if ( b != null ) { s [ c ] = b ; n [ c ] = b . getAttribute ( a ) } } this . undoableChangeStack [ g ] =
{ attrName : a , oldValues : n , elements : s } } ; svgedit . history . UndoManager . prototype . finishUndoableChange = function ( ) { for ( var a = this . undoChangeStackPointer -- , p = this . undoableChangeStack [ a ] , g = p . elements . length , c = p . attrName , n = new svgedit . history . BatchCommand ( "Change " + c ) ; g -- ; ) { var s = p . elements [ g ] ; if ( s != null ) { var b = { } ; b [ c ] = p . oldValues [ g ] ; b [ c ] != s . getAttribute ( c ) && n . addSubCommand ( new svgedit . history . ChangeElementCommand ( s , b , c ) ) } } this . undoableChangeStack [ a ] = null ; return n } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . select ) svgedit . select = { } ; var a , p , g ; svgedit . select . Selector = function ( c , n ) { this . id = c ; this . selectedElement = n ; this . locked = true ; this . selectorGroup = a . createSVGElement ( { element : "g" , attr : { id : "selectorGroup" + this . id } } ) ; this . selectorRect = this . selectorGroup . appendChild ( a . createSVGElement ( { element : "path" , attr : { id : "selectedBox" + this . id , fill : "none" , stroke : "#4F80FF" , "stroke-width" : "1" , "shape-rendering" : "crispEdges" , style : "pointer-events:none" } } ) ) ; svgedit . browser . isTouch ( ) && this . selectorRect . setAttribute ( "stroke-opacity" ,
0.3 ) ; this . gripCoords = { nw : null , n : null , ne : null , e : null , se : null , s : null , sw : null , w : null } ; this . reset ( this . selectedElement ) } ; svgedit . select . Selector . prototype . reset = function ( c ) { this . locked = true ; this . selectedElement = c ; this . resize ( ) ; this . selectorGroup . setAttribute ( "display" , "inline" ) } ; svgedit . select . Selector . prototype . updateGripCursors = function ( c ) { var n = [ ] ; c = Math . round ( c / 45 ) ; if ( c < 0 ) c += 8 ; for ( var s in g . selectorGrips ) n . push ( s ) ; for ( ; c > 0 ; ) { n . push ( n . shift ( ) ) ; c -- } c = 0 ; for ( s in g . selectorGrips ) { g . selectorGrips [ s ] . setAttribute ( "style" ,
"cursor:" + n [ c ] + "-resize" ) ; c ++ } } ; svgedit . select . Selector . prototype . showGrips = function ( c ) { g . selectorGripsGroup . setAttribute ( "display" , c ? "inline" : "none" ) ; var n = this . selectedElement ; this . hasGrips = c ; if ( n && c ) { this . selectorGroup . appendChild ( g . selectorGripsGroup ) ; this . updateGripCursors ( svgedit . utilities . getRotationAngle ( n ) ) } } ; svgedit . select . Selector . prototype . resize = function ( ) { var c = this . selectorRect , n = g , s = n . selectorGrips , b = this . selectedElement , f = b . getAttribute ( "stroke-width" ) , d = a . currentZoom ( ) , m = 1 / d ; if ( b . getAttribute ( "stroke" ) !==
"none" && ! isNaN ( f ) ) m += f / 2 ; var q = b . tagName ; if ( q === "text" ) m += 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 ( q === "g" && ! $ . data ( b , "gsvg" ) ) if ( q = a . getStrokedBBox ( b . childNodes ) ) B = q ; q = B . x ; var o = B . y , K = B . width ; B = B . height ; m *= d ; d = svgedit . math . transformBox ( q * d , o * d , K * d , B * d , f ) ; f = d . aabox ; q = f . x - m ; o = f . y - m ; K = f . width + m * 2 ; var S = f . height + m * 2 ; f = q + K / 2 ; B = o + S / 2 ; if ( b = svgedit . utilities . getRotationAngle ( b ) ) { q = a . svgRoot ( ) . createSVGTransform ( ) ;
q . setRotate ( - b , f , B ) ; q = q . matrix ; d . tl = svgedit . math . transformPoint ( d . tl . x , d . tl . y , q ) ; d . tr = svgedit . math . transformPoint ( d . tr . x , d . tr . y , q ) ; d . bl = svgedit . math . transformPoint ( d . bl . x , d . bl . y , q ) ; d . br = svgedit . math . transformPoint ( d . br . x , d . br . y , q ) ; q = d . tl ; K = q . x ; S = q . y ; var M = q . x , J = q . y ; q = Math . min ; o = Math . max ; K = q ( K , q ( d . tr . x , q ( d . bl . x , d . br . x ) ) ) - m ; S = q ( S , q ( d . tr . y , q ( d . bl . y , d . br . y ) ) ) - m ; M = o ( M , o ( d . tr . x , o ( d . bl . x , d . br . x ) ) ) + m ; J = o ( J , o ( d . tr . y , o ( d . bl . y , d . br . y ) ) ) + m ; q = K ; o = S ; K = M - K ; S = J - S } m = a . svgRoot ( ) . suspendRedraw ( 100 ) ; c . setAttribute ( "d" ,
"M" + q + "," + o + " L" + ( q + K ) + "," + o + " " + ( q + K ) + "," + ( o + S ) + " " + q + "," + ( o + S ) + "z" ) ; this . selectorGroup . setAttribute ( "transform" , b ? "rotate(" + [ b , f , B ] . join ( "," ) + ")" : "" ) ; if ( svgedit . browser . isTouch ( ) ) { q -= 15.75 ; o -= 15.75 } else { q -= 4 ; o -= 4 } this . gripCoords = { nw : [ q , o ] . map ( Math . round ) , ne : [ q + K , o ] . map ( Math . round ) , sw : [ q , o + S ] . map ( Math . round ) , se : [ q + K , o + S ] . map ( Math . round ) , n : [ q + K / 2 , o ] . map ( Math . round ) , w : [ q , o + S / 2 ] . map ( Math . round ) , e : [ q + K , o + S / 2 ] . map ( Math . round ) , s : [ q + K / 2 , o + S ] . map ( Math . round ) } ; for ( var Q in this . gripCoords ) { c = this . gripCoords [ Q ] ;
s [ Q ] . setAttribute ( "x" , c [ 0 ] ) ; s [ Q ] . setAttribute ( "y" , c [ 1 ] ) } this . rotateCoords = { nw : [ q , o ] , ne : [ q + K + 8 , o ] , sw : [ q , o + S + 8 ] , se : [ q + K + 8 , o + S + 8 ] } ; for ( Q in this . rotateCoords ) { c = this . rotateCoords [ Q ] ; n . rotateGrips [ Q ] . setAttribute ( "cx" , c [ 0 ] ) ; n . rotateGrips [ Q ] . setAttribute ( "cy" , c [ 1 ] ) } a . svgRoot ( ) . unsuspendRedraw ( m ) } ; svgedit . select . SelectorManager = function ( ) { this . rubberBandBox = this . selectorParentGroup = null ; this . selectors = [ ] ; this . selectorMap = { } ; this . selectorGrips = { nw : null , n : null , ne : null , e : null , se : null , s : null , sw : null , w : null } ;
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-25 06:32:18 +00:00
a . svgRoot ( ) . appendChild ( this . selectorParentGroup ) ; this . selectorMap = { } ; this . selectors = [ ] ; this . rubberBandBox = null ; for ( var c in this . rotateGrips ) { var n = 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(" + p . imgPath + "rotate.png) 12 12, auto;" } } ) ; $ . data ( n , "dir" , c ) ; $ . data ( n , "type" , "rotate" ) ; this . rotateGrips [ c ] = this . selectorGripsGroup . appendChild ( n ) } for ( c in this . selectorGrips ) { n = 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 ( ) ) { n . setAttribute ( "width" , 30.5 ) ; n . setAttribute ( "height" , 30.5 ) ; n . setAttribute ( "fill-opacity" , 0.3 ) } $ . data ( n , "dir" , c ) ; $ . data ( n , "type" , "resize" ) ; this . selectorGrips [ c ] = this . selectorGripsGroup . appendChild ( n ) } if ( ! $ ( "#canvasBackground" ) . length ) { c = p . 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" } } ) ; n = a . createSVGElement ( { element : "defs" , attr : { id : "placeholder_defs" } } ) ; var s = a . createSVGElement ( { element : "pattern" , attr : { id : "checkerPattern" , patternUnits : "userSpaceOnUse" , x : 0 , y : 0 , width : 20 , height : 20 , viewBox : "0 0 10 10" } } ) , b = a . createSVGElement ( { element : "rect" , attr : { x : 0 , y : 0 , width : 10 , height : 10 , fill : "#fff" } } ) , f = a . createSVGElement ( { element : "rect" , attr : { x : 0 , y : 0 , width : 5 , height : 5 , fill : "#eee" } } ) ,
d = a . createSVGElement ( { element : "rect" , attr : { x : 5 , y : 5 , width : 5 , height : 5 , fill : "#eee" } } ) , m = a . createSVGElement ( { element : "rect" , attr : { width : "100%" , height : "100%" , x : 0 , y : 0 , "stroke-width" : 1 , stroke : "#000" , fill : "url(#checkerPattern)" , style : "pointer-events:none" } } ) ; c . appendChild ( n ) ; n . appendChild ( s ) ; s . appendChild ( b ) ; s . appendChild ( f ) ; s . appendChild ( d ) ; c . appendChild ( m ) ; a . svgRoot ( ) . insertBefore ( c , a . svgContent ( ) ) } } ; svgedit . select . SelectorManager . prototype . requestSelector = function ( c ) { if ( c == null ) return null ; var n = 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 < n ; ++ 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 [ n ] = new svgedit . select . Selector ( n , c ) ; this . selectorParentGroup . appendChild ( this . selectors [ n ] . selectorGroup ) ; this . selectorMap [ c . id ] = this . selectors [ n ] ; return this . selectors [ n ] } ; svgedit . select . SelectorManager . prototype . releaseSelector =
function ( c ) { if ( c != null ) for ( var n = this . selectors . length , s = this . selectorMap [ c . id ] , b = 0 ; b < n ; ++ 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 , n ) { p = c ; a = n ; g = new svgedit . select . SelectorManager ; a . createSVGElement ( { element : "g" , attr : { id : "hover_group" } } ) } ; 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 ( "," ) , p = { LET _DOCUMENT _DECIDE : 0 , ALWAYS _RANDOMIZE : 1 , NEVER _RANDOMIZE : 2 } , g = p . LET _DOCUMENT _DECIDE ; svgedit . draw . Layer = function ( c , n ) { this . name _ = c ; this . group _ = n } ; svgedit . draw . Layer . prototype . getName = function ( ) { return this . name _ } ; svgedit . draw . Layer . prototype . getGroup = function ( ) { return this . group _ } ; svgedit . draw . randomizeIds = function ( c , n ) { g = c == false ? p . NEVER _RANDOMIZE :
p . ALWAYS _RANDOMIZE ; if ( g == p . ALWAYS _RANDOMIZE && ! n . getNonce ( ) ) n . setNonce ( Math . floor ( Math . random ( ) * 100001 ) ) ; else g == p . NEVER _RANDOMIZE && n . getNonce ( ) && n . clearNonce ( ) } ; svgedit . draw . Drawing = function ( c , n ) { 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 = n || "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 != p . NEVER _RANDOMIZE ) this . nonce _ = s ; else g == p . 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 _ } ;
2012-07-24 12:42:34 +00:00
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 =
2012-07-25 06:32:18 +00:00
this . obj _num , n = false ; if ( this . releasedNums . length > 0 ) { this . obj _num = this . releasedNums . pop ( ) ; n = true } else this . obj _num ++ ; for ( var s = this . getId ( ) ; this . getElem _ ( s ) ; ) { if ( n ) { this . obj _num = c ; n = false } this . obj _num ++ ; s = this . getId ( ) } if ( n ) this . obj _num = c ; return s } ; svgedit . draw . Drawing . prototype . releaseId = function ( c ) { var n = this . idPrefix + ( this . nonce _ ? this . nonce _ + "_" : "" ) ; if ( typeof c != "string" || c . indexOf ( n ) != 0 ) return false ; c = parseInt ( c . substr ( n . 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 n = 0 ; n < this . getNumLayers ( ) ; n ++ ) if ( this . all _layers [ n ] [ 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 n = 0 ; n < this . getNumLayers ( ) ; ++ n ) if ( c == this . getLayerName ( n ) ) { if ( this . current _layer != this . all _layers [ n ] [ 1 ] ) { this . current _layer . setAttribute ( "style" , "pointer-events:none" ) ; this . current _layer = this . all _layers [ n ] [ 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 , n = [ ] , s = [ ] , b = null , f = false , d = 0 ; d < c ; ++ d ) { var m = this . svgElem _ . childNodes . item ( d ) ; if ( m && m . nodeType == 1 ) if ( m . tagName == "g" ) { f = true ; var q = $ ( "title" , m ) . text ( ) ; if ( ! q && svgedit . browser . isOpera ( ) && m . querySelectorAll ) q = $ ( m . querySelectorAll ( "title" ) ) . text ( ) ;
if ( q ) { s . push ( q ) ; this . all _layers . push ( [ q , m ] ) ; b = m ; svgedit . utilities . walkTree ( m , function ( B ) { B . setAttribute ( "style" , "pointer-events:inherit" ) } ) ; b . setAttribute ( "style" , "pointer-events:none" ) } else n . push ( m ) } else if ( ~ a . indexOf ( m . nodeName ) ) { svgedit . utilities . getBBox ( m ) ; n . push ( m ) } } c = this . svgElem _ . ownerDocument ; if ( n . 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 < n . length ; ++ f ) b . appendChild ( n [ 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 n = this . svgElem _ . ownerDocument , s = n . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ; n = n . createElementNS ( "http://www.w3.org/2000/svg" , "title" ) ; n . textContent =
c ; s . appendChild ( n ) ; this . svgElem _ . appendChild ( s ) ; this . identifyLayers ( ) ; return s } ; svgedit . draw . Drawing . prototype . getLayerVisibility = function ( c ) { for ( var n = null , s = 0 ; s < this . getNumLayers ( ) ; ++ s ) if ( this . getLayerName ( s ) == c ) { n = this . all _layers [ s ] [ 1 ] ; break } if ( ! n ) return false ; return n . getAttribute ( "display" ) != "none" } ; svgedit . draw . Drawing . prototype . setLayerVisibility = function ( c , n ) { if ( typeof n != "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" , n ? "inline" : "none" ) ; return s } ; svgedit . draw . Drawing . prototype . getLayerOpacity = function ( c ) { for ( var n = 0 ; n < this . getNumLayers ( ) ; ++ n ) if ( this . getLayerName ( n ) == c ) { ( c = this . all _layers [ n ] [ 1 ] . getAttribute ( "opacity" ) ) || ( c = "1.0" ) ; return parseFloat ( c ) } return null } ; svgedit . draw . Drawing . prototype . setLayerOpacity = function ( c , n ) { if ( ! ( typeof n != "number" || n < 0 || n > 1 ) ) for ( var s = 0 ; s < this . getNumLayers ( ) ; ++ s ) if ( this . getLayerName ( s ) == c ) { this . all _layers [ s ] [ 1 ] . setAttribute ( "opacity" ,
n ) ; break } } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . path ) svgedit . path = { } ; var a = { pathNodeTooltip : "Drag node to move it. Double-click node to change segment type" , pathCtrlPtTooltip : "Drag control point to adjust curve properties" } , p = { 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 , n = { } ; 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 , m ) { g . push ( m + "Abs" ) ; g . push ( m + "Rel" ) } ) } ; svgedit . path . insertItemBefore = function ( f , d , m ) { f = f . pathSegList ; if ( svgedit . browser . supportsPathInsertItemBefore ( ) ) f . insertItemBefore ( d , m ) ; else { for ( var q = f . numberOfItems , B = [ ] , o = 0 ; o < q ; o ++ ) { var K = f . getItem ( o ) ; B . push ( K ) } f . clear ( ) ; for ( o = 0 ; o < q ; o ++ ) { o == m && f . appendItem ( d ) ; f . appendItem ( B [ o ] ) } } } ;
svgedit . path . ptObjToArr = function ( f , d ) { for ( var m = p [ f ] , q = m . length , B = Array ( q ) , o = 0 ; o < q ; o ++ ) B [ o ] = d [ m [ o ] ] ; return B } ; svgedit . path . getGripPt = function ( f , d ) { var m = { x : d ? d . x : f . item . x , y : d ? d . y : f . item . y } , q = f . path ; if ( q . matrix ) m = svgedit . math . transformPoint ( m . x , m . y , q . matrix ) ; m . x *= s . getCurrentZoom ( ) ; m . y *= s . getCurrentZoom ( ) ; return m } ; svgedit . path . getPointFromGrip = function ( f , d ) { var m = { x : f . x , y : f . y } ; if ( d . matrix ) { f = svgedit . math . transformPoint ( m . x , m . y , d . imatrix ) ; m . x = f . x ; m . y = f . y } m . x /= s . getCurrentZoom ( ) ; m . y /= s . getCurrentZoom ( ) ;
return m } ; svgedit . path . addPointGrip = function ( f , d , m ) { var q = 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 = q . appendChild ( B ) ; $ ( "#pathpointgrip_" + f ) . dblclick ( function ( ) { svgedit . path . path &&
svgedit . path . path . setSegType ( ) } ) } d && m && svgedit . utilities . assignAttributes ( B , { x : d - 2.5 , y : m - 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-25 06:32:18 +00:00
svgedit . path . getGripContainer ( ) . appendChild ( d ) ; return d } ; svgedit . path . getPointGrip = function ( f , d ) { var m = svgedit . path . addPointGrip ( f . index ) ; if ( d ) { var q = svgedit . path . getGripPt ( f ) ; svgedit . utilities . assignAttributes ( m , { x : q . x - 2.5 , y : q . y - 2.5 , display : "inline" } ) } return m } ; svgedit . path . getControlPoints = function ( f ) { var d = f . item , m = f . index ; if ( ! ( "x1" in d ) || ! ( "x2" in d ) ) return null ; var q = { } ; svgedit . path . getGripContainer ( ) ; for ( var B = [ svgedit . path . path . segs [ m - 1 ] . item , d ] , o = 1 ; o < 3 ; o ++ ) { var K = m + "c" + o , S = q [ "c" + o + "_line" ] =
svgedit . path . getCtrlLine ( K ) , M = svgedit . path . getGripPt ( f , { x : d [ "x" + o ] , y : d [ "y" + o ] } ) , J = svgedit . path . getGripPt ( f , { x : B [ o - 1 ] . x , y : B [ o - 1 ] . y } ) ; svgedit . utilities . assignAttributes ( S , { x1 : M . x , y1 : M . y , x2 : J . x , y2 : J . y , display : "inline" } ) ; q [ "c" + o + "_line" ] = S ; pointGrip = q [ "c" + o ] = svgedit . path . addCtrlGrip ( K ) ; svgedit . utilities . assignAttributes ( pointGrip , { cx : M . x , cy : M . y , display : "inline" } ) ; q [ "c" + o ] = pointGrip } return q } ; svgedit . path . replacePathSeg = function ( f , d , m , q ) { q = q || svgedit . path . path . elem ; f = q [ "createSVGPathSeg" + g [ f ] ] . apply ( q ,
m ) ; if ( svgedit . browser . supportsPathReplaceItem ( ) ) q . pathSegList . replaceItem ( f , d ) ; else { m = q . pathSegList ; q = m . numberOfItems ; for ( var B = [ ] , o = 0 ; o < q ; o ++ ) { var K = m . getItem ( o ) ; B . push ( K ) } m . clear ( ) ; for ( o = 0 ; o < q ; o ++ ) o == d ? m . appendItem ( f ) : m . appendItem ( B [ o ] ) } } ; svgedit . path . getSegSelector = function ( f , d ) { var m = f . index , q = svgedit . utilities . getElem ( "segline_" + m ) ; if ( ! q ) { var B = svgedit . path . getGripContainer ( ) ; q = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; svgedit . utilities . assignAttributes ( q , { id : "segline_" + m ,
display : "none" , fill : "none" , stroke : "#0FF" , "stroke-width" : 2 , style : "pointer-events:none" , d : "M0,0 0,0" } ) ; B . appendChild ( q ) } if ( d ) { m = f . prev ; if ( ! m ) { q . setAttribute ( "display" , "none" ) ; return q } m = svgedit . path . getGripPt ( m ) ; svgedit . path . replacePathSeg ( 2 , 0 , [ m . x , m . y ] , q ) ; B = svgedit . path . ptObjToArr ( f . type , f . item , true ) ; for ( var o = 0 ; o < B . length ; o += 2 ) { m = svgedit . path . getGripPt ( f , { x : B [ o ] , y : B [ o + 1 ] } ) ; B [ o ] = m . x ; B [ o + 1 ] = m . y } svgedit . path . replacePathSeg ( f . type , 1 , B , q ) } return q } ; svgedit . path . smoothControlPoints = this . smoothControlPoints =
function ( f , d , m ) { var q = f . x - m . x , B = f . y - m . y , o = d . x - m . x , K = d . y - m . y ; if ( ( q != 0 || B != 0 ) && ( o != 0 || K != 0 ) ) { f = Math . atan2 ( B , q ) ; d = Math . atan2 ( K , o ) ; q = Math . sqrt ( q * q + B * B ) ; o = Math . sqrt ( o * o + K * K ) ; B = s . getSVGRoot ( ) . createSVGPoint ( ) ; K = s . getSVGRoot ( ) . createSVGPoint ( ) ; if ( f < 0 ) f += 2 * Math . PI ; if ( d < 0 ) d += 2 * Math . PI ; var S = Math . abs ( f - d ) , M = Math . abs ( Math . PI - S ) / 2 ; if ( f - d > 0 ) { f = S < Math . PI ? f + M : f - M ; d = S < Math . PI ? d - M : d + M } else { f = S < Math . PI ? f - M : f + M ; d = S < Math . PI ? d + M : d - M } B . x = q * Math . cos ( f ) + m . x ; B . y = q * Math . sin ( f ) + m . y ; K . x = o * Math . cos ( d ) + m . x ; K . y = o * Math . sin ( d ) + m . y ;
return [ B , K ] } } ; 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 ,
2012-07-25 06:32:18 +00:00
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 m = this . item ; m = this . ctrlpts ?
[ m . x += f , m . y += d , m . x1 , m . y1 , m . x2 += f , m . y2 += d ] : [ m . x += f , m . y += d ] ; svgedit . path . replacePathSeg ( this . type , this . index , m ) ; if ( this . next && this . next . ctrlpts ) { m = this . next . item ; m = [ m . x , m . y , m . x1 += f , m . y1 += d , m . x2 , m . y2 ] ; svgedit . path . replacePathSeg ( this . next . type , this . next . index , m ) } if ( this . mate ) { m = this . mate . item ; m = [ m . x += f , m . y += d ] ; svgedit . path . replacePathSeg ( this . mate . type , this . mate . index , m ) } this . update ( true ) ; this . next && this . next . update ( true ) } ; svgedit . path . Segment . prototype . setLinked = function ( f ) { var d , m , q ; if ( f == 2 ) { m = 1 ; d =
this . next ; if ( ! d ) return ; q = this . item } else { m = 2 ; d = this . prev ; if ( ! d ) return ; q = d . item } var B = d . item ; B [ "x" + m ] = q . x + ( q . x - this . item [ "x" + f ] ) ; B [ "y" + m ] = q . y + ( q . 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 , m ) { var q = this . item ; q [ "x" + f ] += d ; q [ "y" + f ] += m ; svgedit . path . replacePathSeg ( this . type , this . index , [ q . x , q . y , q . x1 , q . y1 , q . x2 , q . 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-25 06:32:18 +00:00
this . elem . pathSegList , d = f . numberOfItems ; this . segs = [ ] ; this . selected _pts = [ ] ; this . first _seg = null ; for ( var m = 0 ; m < d ; m ++ ) { var q = f . getItem ( m ) ; q = new svgedit . path . Segment ( m , q ) ; q . path = this ; this . segs . push ( q ) } f = this . segs ; q = null ; for ( m = 0 ; m < d ; m ++ ) { var B = f [ m ] , o = m + 1 >= d ? null : f [ m + 1 ] , K = m - 1 < 0 ? null : f [ m - 1 ] ; if ( B . type === 2 ) { if ( K && K . type !== 1 ) { o = f [ q ] ; o . next = f [ q + 1 ] ; o . next . prev = o ; o . addGrip ( ) } q = m } else if ( o && o . type === 1 ) { B . next = f [ q + 1 ] ; B . next . prev = B ; B . mate = f [ q ] ; B . addGrip ( ) ; if ( this . first _seg == null ) this . first _seg = B } else if ( o ) { if ( B . type !==
1 ) { B . addGrip ( ) ; if ( o && o . type !== 2 ) { B . next = o ; B . next . prev = B } } } else if ( B . type !== 1 ) { o = f [ q ] ; o . next = f [ q + 1 ] ; o . next . prev = o ; o . addGrip ( ) ; B . addGrip ( ) ; if ( ! this . first _seg ) this . first _seg = f [ q ] } } return this } ; svgedit . path . Path . prototype . eachSeg = function ( f ) { for ( var d = this . segs . length , m = 0 ; m < d ; m ++ ) if ( f . call ( this . segs [ m ] , m ) === false ) break } ; svgedit . path . Path . prototype . addSeg = function ( f ) { var d = this . segs [ f ] ; if ( d . prev ) { var m = d . prev , q ; switch ( d . item . pathSegType ) { case 4 : var B = ( d . item . x + m . item . x ) / 2 , o = ( d . item . y + m . item . y ) / 2 ; q = this . elem . createSVGPathSegLinetoAbs ( B ,
o ) ; break ; case 6 : q = ( m . item . x + d . item . x1 ) / 2 ; var K = ( d . item . x1 + d . item . x2 ) / 2 , S = ( d . item . x2 + d . item . x ) / 2 , M = ( q + K ) / 2 ; K = ( K + S ) / 2 ; B = ( M + K ) / 2 ; var J = ( m . item . y + d . item . y1 ) / 2 , Q = ( d . item . y1 + d . item . y2 ) / 2 ; m = ( d . item . y2 + d . item . y ) / 2 ; var Y = ( J + Q ) / 2 ; Q = ( Q + m ) / 2 ; o = ( Y + Q ) / 2 ; q = this . elem . createSVGPathSegCurvetoCubicAbs ( B , o , q , J , M , Y ) ; svgedit . path . replacePathSeg ( d . type , f , [ d . item . x , d . item . y , K , Q , S , m ] ) } svgedit . path . insertItemBefore ( this . elem , q , f ) } } ; svgedit . path . Path . prototype . deleteSeg = function ( f ) { var d = this . segs [ f ] , m = this . elem . pathSegList ;
d . show ( false ) ; var q = d . next ; if ( d . mate ) { var B = [ q . item . x , q . item . y ] ; svgedit . path . replacePathSeg ( 2 , q . index , B ) ; svgedit . path . replacePathSeg ( 4 , d . index , B ) ; m . removeItem ( d . mate . index ) } else { if ( ! d . prev ) { B = [ q . item . x , q . item . y ] ; svgedit . path . replacePathSeg ( 2 , d . next . index , B ) } m . removeItem ( f ) } } ; svgedit . path . Path . prototype . subpathIsClosed = function ( f ) { var d = false ; svgedit . path . path . eachSeg ( function ( m ) { if ( m <= 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-25 06:32:18 +00:00
d ) { for ( var m = this . selected _pts . length ; m -- ; ) this . segs [ this . selected _pts [ m ] ] . move ( f , d ) } ; svgedit . path . Path . prototype . moveCtrl = function ( f , d ) { var m = this . segs [ this . selected _pts [ 0 ] ] ; m . moveCtrl ( this . dragctrl , f , d ) ; c && m . setLinked ( this . dragctrl ) } ; svgedit . path . Path . prototype . setSegType = function ( f ) { this . storeD ( ) ; for ( var d = this . selected _pts . length , m ; d -- ; ) { var q = this . segs [ this . selected _pts [ d ] ] , B = q . prev ; if ( B ) { if ( ! f ) { m = "Toggle Path Segment Type" ; f = q . type == 6 ? 4 : 6 } f -= 0 ; var o = q . item . x , K = q . item . y , S = B . item . x ; B = B . item . y ;
var M ; switch ( f ) { case 6 : if ( q . olditem ) { S = q . olditem ; M = [ o , K , S . x1 , S . y1 , S . x2 , S . y2 ] } else { M = o - S ; var J = K - B ; M = [ o , K , S + M / 3 , B + J / 3 , o - M / 3 , K - J / 3 ] } break ; case 4 : M = [ o , K ] ; q . olditem = q . item } q . setType ( f , M ) } } svgedit . path . path . endChanges ( m ) } ; svgedit . path . Path . prototype . selectPt = function ( f , d ) { this . clearSelection ( ) ; f == null && this . eachSeg ( function ( m ) { if ( this . prev ) f = m } ) ; 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 = n [ f . id ] ; d || ( d = n [ f . id ] = new svgedit . path . Path ( f ) ) ; return d } ; svgedit . path . removePath _ = function ( f ) { f in n && delete n [ 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 m = svgedit . utilities . getBBox ( f ) , q = svgedit . path . path . oldbbox , B = q . x + q . width / 2 , o = q . y + q . height / 2 ; q = m . x + m . width / 2 ; m = m . y + m . height / 2 ; q = q - B ; var K = m - o ; m = Math . sqrt ( q * q + K * K ) ; K = Math . atan2 ( K , q ) + d ; q = m * Math . cos ( K ) + B ; m = m * Math . sin ( K ) + o ; B = f . pathSegList ; for ( o = B . numberOfItems ; o ; ) { o -=
1 ; K = B . getItem ( o ) ; var S = K . pathSegType ; if ( S != 1 ) { var M = b ( K . x , K . y ) ; M = [ M . x , M . y ] ; if ( K . x1 != null && K . x2 != null ) { c _vals1 = b ( K . x1 , K . y1 ) ; c _vals2 = b ( K . x2 , K . y2 ) ; M . splice ( M . length , 0 , c _vals1 . x , c _vals1 . y , c _vals2 . x , c _vals2 . y ) } svgedit . path . replacePathSeg ( S , o , M ) } } svgedit . utilities . getBBox ( f ) ; B = svgroot . createSVGTransform ( ) ; f = svgedit . transformlist . getTransformList ( f ) ; B . setRotate ( d * 180 / Math . PI , q , m ) ; f . replaceItem ( B , 0 ) } } ; svgedit . path . clearData = function ( ) { n = { } } } ) ( ) ; 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 ( p , g ) { var c = this . length ; if ( ! c ) return a . apply ( this , arguments ) ; for ( var n = 0 ; n < c ; n ++ ) { var s = this [ n ] ; if ( s . namespaceURI === "http://www.w3.org/2000/svg" ) if ( g !== undefined ) s . setAttribute ( p , g ) ; else if ( $ . isArray ( p ) ) { c = p . length ; for ( n = { } ; c -- ; ) { var b = p [ c ] , f = s . getAttribute ( b ) ; if ( f || f === "0" ) f = isNaN ( f ) ? f : f - 0 ; n [ b ] = f } return n } else if ( typeof p === "object" ) for ( b in p ) s . setAttribute ( b , p [ b ] ) ; else { if ( ( f = s . getAttribute ( p ) ) || f === "0" ) f = isNaN ( f ) ? f : f - 0 ; return f } else return a . apply ( this ,
2012-06-23 19:40:40 +00:00
arguments ) } return this } } ) ( ) ;
2012-07-25 06:32:18 +00:00
$ . SvgCanvas = function ( a , p ) { function g ( e , h ) { for ( var l = svgedit . utilities . getBBox ( e ) , z = 0 ; z < 2 ; z ++ ) { var w = z === 0 ? "fill" : "stroke" , H = e . getAttribute ( w ) ; if ( H && H . indexOf ( "url(" ) === 0 ) { H = R ( H ) ; if ( H . tagName === "linearGradient" ) { var A = H . getAttribute ( "x1" ) || 0 , v = H . getAttribute ( "y1" ) || 0 , E = H . getAttribute ( "x2" ) || 1 , I = H . getAttribute ( "y2" ) || 0 ; A = l . width * A + l . x ; v = l . height * v + l . y ; E = l . width * E + l . x ; I = l . height * I + l . y ; A = P ( A , v , h ) ; I = P ( E , I , h ) ; E = { } ; E . x1 = ( A . x - l . x ) / l . width ; E . y1 = ( A . y - l . y ) / l . height ; E . x2 = ( I . x - l . x ) / l . width ; E . y2 = ( I . y - l . y ) / l . height ;
H = H . cloneNode ( true ) ; $ ( H ) . attr ( E ) ; H . id = la ( ) ; mb ( ) . appendChild ( H ) ; e . setAttribute ( w , "url(#" + H . id + ")" ) } } } } var c = "http://www.w3.org/2000/svg" , n = { show _outside _canvas : true , selectNew : true , dimensions : [ 640 , 480 ] } ; p && $ . extend ( n , p ) ; var s = n . 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 m = f . createElementNS ( c , "svg" ) ; ( b . clearSvgContentElement = function ( ) { for ( ; m . firstChild ; ) m . removeChild ( m . firstChild ) ; $ ( m ) . attr ( { id : "svgcontent" , width : s [ 0 ] , height : s [ 1 ] , x : s [ 0 ] , y : s [ 1 ] , overflow : n . 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/ " ) ; m . appendChild ( e ) } ) ( ) ; var q = "svg_" ; b . setIdPrefix =
function ( e ) { q = e } ; b . current _drawing _ = new svgedit . draw . Drawing ( m , q ) ; var B = b . getCurrentDrawing = function ( ) { return b . current _drawing _ } , o = 1 , K = null , S = { shape : { fill : ( n . initFill . color == "none" ? "" : "#" ) + n . initFill . color , fill _paint : null , fill _opacity : n . initFill . opacity , stroke : "#" + n . initStroke . color , stroke _paint : null , stroke _opacity : n . initStroke . opacity , stroke _width : n . initStroke . width , stroke _dasharray : "none" , stroke _linejoin : "miter" , stroke _linecap : "butt" , opacity : n . initOpacity } } ; S . text = $ . extend ( true , { } , S . shape ) ; $ . extend ( S . text ,
{ fill : "#000000" , stroke _width : 0 , font _size : 24 , font _family : "Junction" } ) ; var M = S . shape , J = Array ( 1 ) , Q = this . addSvgElementFromJson = function ( e ) { var h = svgedit . utilities . getElem ( e . attr . id ) , l = B ( ) . getCurrentLayer ( ) ; if ( h && e . element != h . tagName ) { l . removeChild ( h ) ; h = null } if ( ! h ) { h = f . createElementNS ( c , e . element ) ; if ( l ) ( K || l ) . appendChild ( h ) } e . curStyles && svgedit . utilities . assignAttributes ( h , { fill : M . fill , stroke : M . stroke , "stroke-width" : M . stroke _width , "stroke-dasharray" : M . stroke _dasharray , "stroke-linejoin" : M . stroke _linejoin ,
"stroke-linecap" : M . stroke _linecap , "stroke-opacity" : M . stroke _opacity , "fill-opacity" : M . fill _opacity , opacity : M . opacity / 2 , style : "pointer-events:inherit" } , 100 ) ; svgedit . utilities . assignAttributes ( h , e . attr , 100 ) ; svgedit . utilities . cleanupElement ( h ) ; return h } , Y = b . getTransformList = svgedit . transformlist . getTransformList , P = svgedit . math . transformPoint , ia = b . matrixMultiply = svgedit . math . matrixMultiply , qa = b . hasMatrixTransform = svgedit . math . hasMatrixTransform , ga = b . transformListToTransform = svgedit . math . transformListToTransform ,
U = svgedit . math . snapToAngle , ba = svgedit . math . getMatrix ; svgedit . units . init ( { getBaseUnit : function ( ) { return n . baseUnit } , getElement : svgedit . utilities . getElem , getHeight : function ( ) { return m . getAttribute ( "height" ) / o } , getWidth : function ( ) { return m . getAttribute ( "width" ) / o } , getRoundDigits : function ( ) { return fb . round _digits } } ) ; var xa = b . convertToNum = svgedit . units . convertToNum ; svgedit . utilities . init ( { getDOMDocument : function ( ) { return f } , getDOMContainer : function ( ) { return a } , getSVGRoot : function ( ) { return d } , getSelectedElements : function ( ) { return J } ,
getSVGContent : function ( ) { return m } } ) ; var ka = b . getUrlFromAttr = svgedit . utilities . getUrlFromAttr , da = b . getHref = svgedit . utilities . getHref , W = b . setHref = svgedit . utilities . setHref , Z = svgedit . utilities . getPathBBox ; b . getBBox = svgedit . utilities . getBBox ; var oa = b . getRotationAngle = svgedit . utilities . getRotationAngle , pa = b . getElem = svgedit . utilities . getElem , na = b . assignAttributes = svgedit . utilities . assignAttributes , ma = this . cleanupElement = svgedit . utilities . cleanupElement , za = svgedit . sanitize . getNSMap ( ) , Ha = b . sanitizeSvg = svgedit . sanitize . sanitizeSvg ,
Fa = svgedit . history . MoveElementCommand , Ia = svgedit . history . InsertElementCommand , La = svgedit . history . RemoveElementCommand , Ka = svgedit . history . ChangeElementCommand , Ea = svgedit . history . BatchCommand ; b . undoMgr = new svgedit . history . UndoManager ( { handleHistoryEvent : function ( e , h ) { var l = svgedit . history . HistoryEventTypes ; if ( e == l . BEFORE _UNAPPLY || e == l . BEFORE _APPLY ) b . clearSelection ( ) ; else if ( e == l . AFTER _APPLY || e == l . AFTER _UNAPPLY ) { var z = h . elements ( ) ; b . pathActions . clear ( ) ; N ( "changed" , z ) ; z = h . type ( ) ; l = e == l . AFTER _APPLY ; if ( z ==
Fa . type ( ) ) { l = l ? h . newParent : h . oldParent ; l == m && b . identifyLayers ( ) } else if ( z == Ia . type ( ) || z == La . type ( ) ) { h . parent == m && b . identifyLayers ( ) ; if ( z == Ia . type ( ) ) l && Qa ( h . elem ) ; else l || Qa ( h . elem ) ; h . elem . tagName === "use" && Kb ( h . elem ) } else if ( z == Ka . type ( ) ) { h . elem . tagName == "title" && h . elem . parentNode . parentNode == m && b . identifyLayers ( ) ; l = l ? h . newValues : h . oldValues ; l . stdDeviation && b . setBlurOffsets ( h . elem . parentNode , l . stdDeviation ) ; if ( h . elem . tagName === "use" && svgedit . browser . isWebkit ( ) ) { z = h . elem ; if ( ! z . getAttribute ( "x" ) && ! z . getAttribute ( "y" ) ) { l =
z . parentNode ; var w = z . nextSibling ; l . removeChild ( z ) ; l . insertBefore ( z , w ) } } } } } } ) ; var ya = function ( e ) { b . undoMgr . addCommandToHistory ( e ) } ; svgedit . select . init ( n , { createSVGElement : function ( e ) { return b . addSvgElementFromJson ( e ) } , svgRoot : function ( ) { return d } , svgContent : function ( ) { return m } , currentZoom : function ( ) { return o } , getStrokedBBox : function ( e ) { return b . getStrokedBBox ( [ e ] ) } } ) ; var Ca = this . selectorManager = svgedit . select . getSelectorManager ( ) ; svgedit . path . init ( { getCurrentZoom : function ( ) { return o } , getSVGRoot : function ( ) { return d } } ) ;
svgedit . utilities . snapToGrid = function ( e ) { var h = n . snappingStep , l = n . baseUnit ; if ( l !== "px" ) h *= svgedit . units . getTypeMap ( ) [ l ] ; return e = Math . round ( e / h ) * h } ; var wa = svgedit . utilities . snapToGrid , Va = { 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" } , yb = [ "clip-path" , "fill" , "filter" , "marker-end" , "marker-mid" , "marker-start" , "mask" , "stroke" ] , ib = $ . data ,
Qa = function ( e ) { var h = $ ( e ) . attr ( yb ) , l ; for ( l in h ) { var z = h [ l ] ; if ( z && z . indexOf ( "url(" ) === 0 ) { z = ka ( z ) . substr ( 1 ) ; if ( ! pa ( z ) ) { mb ( ) . appendChild ( vb [ z ] ) ; delete vb [ z ] } } } e = e . getElementsByTagName ( "*" ) ; if ( e . length ) { h = 0 ; for ( l = e . length ; h < l ; h ++ ) Qa ( e [ h ] ) } } , Ya = { } , Aa = n . imgPath + "logo.png" , ua = [ ] , fb = { round _digits : 5 } , Ma = false , Ta = null , Ba = "select" , jb = "none" , sb = { } , Za = S . text , cb = M , zb = null , sa = null , lb = [ ] , kb = { } , vb = { } ; b . clipBoard = [ ] ; var nb = this . runExtensions = function ( e , h , l ) { var z = false ; if ( l ) z = [ ] ; $ . each ( kb , function ( w , H ) { if ( e in H ) if ( l ) z . push ( H [ e ] ( h ) ) ;
else z = H [ e ] ( h ) } ) ; return z } ; this . addExtension = function ( e , h ) { if ( e in kb ) console . log ( 'Cannot add extension "' + e + '", an extension by that name already exists"' ) ; else { var l = $ . isFunction ( h ) ? h ( $ . extend ( b . getPrivateMethods ( ) , { svgroot : d , svgcontent : m , nonce : B ( ) . getNonce ( ) , selectorManager : Ca } ) ) : h ; kb [ e ] = l ; N ( "extension_added" , l ) } } ; var gb = this . round = function ( e ) { return parseInt ( e * o ) / o } , tb = this . getIntersectionList = function ( e ) { if ( sa == null ) return null ; var h = K || B ( ) . getCurrentLayer ( ) ; lb . length || ( lb = Ab ( h ) ) ; var l = null ;
try { l = h . getIntersectionList ( e , null ) } catch ( z ) { } if ( l == null || typeof l . item != "function" ) { l = [ ] ; if ( e ) e = e ; else { e = sa . getBBox ( ) ; h = { } ; for ( var w in e ) h [ w ] = e [ w ] / o ; e = h } for ( w = lb . length ; w -- ; ) e . width && e . width && svgedit . math . rectsIntersect ( e , lb [ w ] . bbox ) && l . push ( lb [ w ] . elem ) } return l } ; getStrokedBBox = this . getStrokedBBox = function ( e ) { e || ( e = pb ( ) ) ; if ( ! e . length ) return false ; var h = function ( I ) { try { var D = svgedit . utilities . getBBox ( I ) , G = svgedit . utilities . getRotationAngle ( I ) ; if ( G && G % 90 || svgedit . math . hasMatrixTransform ( svgedit . transformlist . getTransformList ( I ) ) ) { G =
false ; if ( [ "ellipse" , "path" , "line" , "polyline" , "polygon" ] . indexOf ( I . tagName ) >= 0 ) D = G = b . convertToPath ( I , true ) ; else if ( I . tagName == "rect" ) { var L = I . getAttribute ( "rx" ) , k = I . getAttribute ( "ry" ) ; if ( L || k ) D = G = b . convertToPath ( I , true ) } if ( ! G ) { var u = I . cloneNode ( true ) , C = document . createElementNS ( c , "g" ) , F = I . parentNode ; F . appendChild ( C ) ; C . appendChild ( u ) ; D = svgedit . utilities . bboxToObj ( C . getBBox ( ) ) ; F . removeChild ( C ) } } return D } catch ( O ) { console . log ( I , O ) ; return null } } , l ; $ . each ( e , function ( ) { if ( ! l ) if ( this . parentNode ) l = h ( this ) } ) ;
if ( l == null ) return null ; var z = l . x + l . width , w = l . y + l . height , H = l . x , A = l . y , v = function ( I ) { var D = I . getAttribute ( "stroke-width" ) , G = 0 ; if ( I . getAttribute ( "stroke" ) != "none" && ! isNaN ( D ) ) G += D / 2 ; return G } , E = [ ] ; $ . each ( e , function ( I , D ) { var G = h ( D ) ; if ( G ) { var L = v ( D ) ; H = Math . min ( H , G . x - L ) ; A = Math . min ( A , G . y - L ) ; E . push ( G ) } } ) ; l . x = H ; l . y = A ; $ . each ( e , function ( I , D ) { var G = E [ I ] ; if ( G && D . nodeType == 1 ) { var L = v ( D ) ; z = Math . max ( z , G . x + G . width + L ) ; w = Math . max ( w , G . y + G . height + L ) } } ) ; l . width = z - H ; l . height = w - A ; return l } ; var pb = this . getVisibleElements = function ( e ) { e ||
( e = $ ( m ) . children ( ) ) ; e . find ( "#canvas_background" ) . length && e . splice ( 0 , 1 ) ; var h = [ ] ; $ ( e ) . children ( ) . each ( function ( l , z ) { try { z . getBBox ( ) && h . push ( z ) } catch ( w ) { } } ) ; return h . reverse ( ) } , Ab = this . getVisibleElementsAndBBoxes = function ( e ) { e || ( e = $ ( m ) . children ( ) ) ; var h = [ ] ; $ ( e ) . children ( ) . each ( function ( l , z ) { try { z . getBBox ( ) && h . push ( { elem : z , bbox : getStrokedBBox ( [ z ] ) } ) } catch ( w ) { } } ) ; return h . reverse ( ) } , Bb = this . groupSvgElem = function ( e ) { var h = document . createElementNS ( c , "g" ) ; e . parentNode . replaceChild ( h , e ) ; $ ( h ) . append ( e ) . data ( "gsvg" ,
e ) [ 0 ] . id = la ( ) } , ja = function ( e ) { var h = document . createElementNS ( e . namespaceURI , e . nodeName ) ; h . removeAttribute ( "id" ) ; $ . each ( e . attributes , function ( z , w ) { w . localName != "-moz-math-font-style" && h . setAttributeNS ( w . namespaceURI , w . nodeName , w . nodeValue ) } ) ; if ( svgedit . browser . isWebkit ( ) && e . nodeName == "path" ) { var l = Ja . convertPath ( e ) ; h . setAttribute ( "d" , l ) } $ . each ( e . childNodes , function ( z , w ) { switch ( w . nodeType ) { case 1 : h . appendChild ( ja ( w ) ) ; break ; case 3 : h . textContent = w . 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" && Ib ( h ) ; h . id = la ( ) ; return h } , ca , la , N ; ( function ( e ) { var h = { } ; ca = e . getId = function ( ) { return B ( ) . getId ( ) } ; la = e . getNextId = function ( ) { return B ( ) . getNextId ( ) } ; N = e . call = function ( l , z ) { if ( h [ l ] ) return h [ l ] ( this , z ) } ; e . bind = function ( l , z ) { var w = h [ l ] ; h [ l ] = z ; return w } } ) ( b ) ; this . prepareSvg = function ( e ) { this . sanitizeSvg ( e . documentElement ) ; e = e . getElementsByTagNameNS ( c , "path" ) ; for ( var h = 0 , l = e . length ; h < l ; ++ h ) { var z =
e [ h ] ; z . setAttribute ( "d" , Ja . convertPath ( z ) ) ; Ja . fixEnd ( z ) } } ; var R = this . getRefElem = function ( e ) { return pa ( ka ( e ) . substr ( 1 ) ) } , ea = function ( e ) { if ( ! svgedit . browser . isGecko ( ) ) return e ; var h = e . cloneNode ( true ) ; e . parentNode . insertBefore ( h , e ) ; e . parentNode . removeChild ( e ) ; Ca . releaseSelector ( e ) ; J [ 0 ] = h ; Ca . requestSelector ( h ) . showGrips ( true ) ; return h } ; this . setRotationAngle = function ( e , h ) { e = parseFloat ( e ) ; var l = J [ 0 ] , z = l . getAttribute ( "transform" ) , w = svgedit . utilities . getBBox ( l ) , H = w . x + w . width / 2 , A = w . y + w . height / 2 ; w = Y ( l ) ; w . numberOfItems >
0 && w . getItem ( 0 ) . type == 4 && w . removeItem ( 0 ) ; if ( e != 0 ) { H = P ( H , A , ga ( w ) . matrix ) ; A = d . createSVGTransform ( ) ; A . setRotate ( e , H . x , H . y ) ; w . numberOfItems ? w . insertItemBefore ( A , 0 ) : w . appendItem ( A ) } else w . numberOfItems == 0 && l . removeAttribute ( "transform" ) ; if ( ! h ) { w = l . getAttribute ( "transform" ) ; l . setAttribute ( "transform" , z ) ; hb ( "transform" , w , J ) ; N ( "changed" , J ) } pa ( "pathpointgrip_container" ) ; l = Ca . requestSelector ( J [ 0 ] ) ; l . resize ( ) ; l . updateGripCursors ( e ) } ; var Ga = this . recalculateAllSelectedDimensions = function ( ) { for ( var e = new Ea ( jb ==
"none" ? "position" : "size" ) , h = J . length ; h -- ; ) { var l = Wa ( J [ h ] ) ; l && e . addSubCommand ( l ) } if ( ! e . isEmpty ( ) ) { ya ( e ) ; N ( "changed" , J ) } } , Oa = [ 0 , "z" , "M" , "m" , "L" , "l" , "C" , "c" , "Q" , "q" , "A" , "a" , "H" , "h" , "V" , "v" , "S" , "s" , "T" , "t" ] , Xa = function ( e ) { console . log ( [ e . a , e . b , e . c , e . d , e . e , e . f ] ) } , bb = this . remapElement = function ( e , h , l ) { var z = n . gridSnapping && e . parentNode . parentNode . localName === "svg" , w = function ( ) { if ( z ) for ( var G in h ) h [ G ] = wa ( h [ G ] ) ; na ( e , h , 1E3 , true ) } ; box = svgedit . utilities . getBBox ( e ) ; for ( var H = 0 ; H < 2 ; H ++ ) { var A = H === 0 ? "fill" : "stroke" ,
v = e . getAttribute ( A ) ; if ( v && v . indexOf ( "url(" ) === 0 ) if ( l . a < 0 || l . d < 0 ) { v = R ( v ) . cloneNode ( true ) ; if ( l . a < 0 ) { var E = v . getAttribute ( "x1" ) , I = v . getAttribute ( "x2" ) ; v . setAttribute ( "x1" , - ( E - 1 ) ) ; v . setAttribute ( "x2" , - ( I - 1 ) ) } if ( l . d < 0 ) { E = v . getAttribute ( "y1" ) ; I = v . getAttribute ( "y2" ) ; v . setAttribute ( "y1" , - ( E - 1 ) ) ; v . setAttribute ( "y2" , - ( I - 1 ) ) } v . id = la ( ) ; mb ( ) . appendChild ( v ) ; e . setAttribute ( A , "url(#" + v . id + ")" ) } } H = e . tagName ; if ( H === "g" || H === "text" || H === "use" ) if ( l . a == 1 && l . b == 0 && l . c == 0 && l . d == 1 && ( l . e != 0 || l . f != 0 ) ) { A = ga ( e ) . matrix ; A = ia ( A . inverse ( ) ,
l , A ) ; h . x = parseFloat ( h . x ) + A . e ; h . y = parseFloat ( h . y ) + A . f } else { A = Y ( e ) ; v = d . createSVGTransform ( ) ; v . setMatrix ( ia ( ga ( A ) . matrix , l ) ) ; A . clear ( ) ; A . appendItem ( v ) } switch ( H ) { case "foreignObject" : case "rect" : case "image" : if ( H === "image" && ( l . a < 0 || l . d < 0 ) ) { A = Y ( e ) ; v = d . createSVGTransform ( ) ; v . setMatrix ( ia ( ga ( A ) . matrix , l ) ) ; A . clear ( ) ; A . appendItem ( v ) } else { A = P ( h . x , h . y , l ) ; h . width = l . a * h . width ; h . height = l . d * h . height ; h . x = A . x + Math . min ( 0 , h . width ) ; h . y = A . y + Math . min ( 0 , h . height ) ; h . width = Math . abs ( h . width ) ; h . height = Math . abs ( h . height ) } w ( ) ;
break ; case "ellipse" : H = P ( h . cx , h . cy , l ) ; h . cx = H . x ; h . cy = H . y ; h . rx = l . a * h . rx ; h . ry = l . d * h . ry ; h . rx = Math . abs ( h . rx ) ; h . ry = Math . abs ( h . ry ) ; w ( ) ; break ; case "circle" : H = P ( h . cx , h . cy , l ) ; h . cx = H . x ; h . cy = H . y ; H = svgedit . math . transformBox ( box . x , box . y , box . width , box . height , l ) ; h . r = Math . min ( ( H . tr . x - H . tl . x ) / 2 , ( H . bl . y - H . tl . y ) / 2 ) ; if ( h . r ) h . r = Math . abs ( h . r ) ; w ( ) ; break ; case "line" : A = P ( h . x1 , h . y1 , l ) ; E = P ( h . x2 , h . y2 , l ) ; h . x1 = A . x ; h . y1 = A . y ; h . x2 = E . x ; h . y2 = E . y ; case "text" : l = e . querySelectorAll ( "tspan" ) ; for ( H = l . length ; H -- ; ) { A = xa ( "x" , e . getAttribute ( "x" ) ) ;
v = xa ( "x" , l [ H ] . getAttribute ( "x" ) ) ; E = xa ( "y" , e . getAttribute ( "y" ) ) ; I = xa ( "y" , l [ H ] . getAttribute ( "y" ) ) ; var D = { } ; if ( ! isNaN ( A ) && ! isNaN ( v ) && A != 0 && v != 0 && h . x ) D . x = h . x - ( A - v ) ; if ( ! isNaN ( E ) && ! isNaN ( I ) && E != 0 && I != 0 && h . y ) D . y = h . y - ( E - I ) ; if ( D . x || D . y ) na ( l [ H ] , D , 1E3 , true ) } w ( ) ; break ; case "use" : w ( ) ; break ; case "g" : ( w = $ ( e ) . data ( "gsvg" ) ) && na ( w , h , 1E3 , true ) ; break ; case "polyline" : case "polygon" : w = h . points . length ; for ( H = 0 ; H < w ; ++ H ) { I = h . points [ H ] ; I = P ( I . x , I . y , l ) ; h . points [ H ] . x = I . x ; h . points [ H ] . y = I . y } w = h . points . length ; l = "" ; for ( H = 0 ; H < w ; ++ H ) { I =
h . points [ H ] ; l += I . x + "," + I . y + " " } e . setAttribute ( "points" , l ) ; break ; case "path" : A = e . pathSegList ; w = A . numberOfItems ; h . d = Array ( w ) ; for ( H = 0 ; H < w ; ++ H ) { v = A . getItem ( H ) ; h . d [ H ] = { type : v . pathSegType , x : v . x , y : v . y , x1 : v . x1 , y1 : v . y1 , x2 : v . x2 , y2 : v . y2 , r1 : v . r1 , r2 : v . r2 , angle : v . angle , largeArcFlag : v . largeArcFlag , sweepFlag : v . sweepFlag } } w = h . d . length ; H = h . d [ 0 ] ; D = P ( H . x , H . y , l ) ; h . d [ 0 ] . x = D . x ; h . d [ 0 ] . y = D . y ; for ( H = 1 ; H < w ; ++ H ) { v = h . d [ H ] ; A = v . type ; if ( A % 2 == 0 ) { I = P ( v . x != undefined ? v . x : D . x , v . y != undefined ? v . y : D . y , l ) ; A = P ( v . x1 , v . y1 , l ) ; E = P ( v . x2 , v . y2 , l ) ;
v . x = I . x ; v . y = I . y ; v . x1 = A . x ; v . y1 = A . y ; v . x2 = E . x ; v . y2 = E . y } else { v . x = l . a * v . x ; v . y = l . d * v . y ; v . x1 = l . a * v . x1 ; v . y1 = l . d * v . y1 ; v . x2 = l . a * v . x2 ; v . y2 = l . d * v . y2 } v . r1 = l . a * v . r1 ; v . r2 = l . d * v . r2 } l = "" ; w = h . d . length ; for ( H = 0 ; H < w ; ++ H ) { v = h . d [ H ] ; A = v . type ; l += Oa [ A ] ; switch ( A ) { case 13 : case 12 : l += v . x + " " ; break ; case 15 : case 14 : l += v . y + " " ; break ; case 3 : case 5 : case 19 : case 2 : case 4 : case 18 : l += v . x + "," + v . y + " " ; break ; case 7 : case 6 : l += v . x1 + "," + v . y1 + " " + v . x2 + "," + v . y2 + " " + v . x + "," + v . y + " " ; break ; case 9 : case 8 : l += v . x1 + "," + v . y1 + " " + v . x + "," + v . y + " " ; break ;
case 11 : case 10 : l += v . r1 + "," + v . r2 + " " + v . angle + " " + + v . largeArcFlag + " " + + v . sweepFlag + " " + v . x + "," + v . y + " " ; break ; case 17 : case 16 : l += v . x2 + "," + v . y2 + " " + v . x + "," + v . y + " " } } e . setAttribute ( "d" , l ) } } , rb = function ( e , h , l ) { e = R ( e ) . firstChild ; var z = Y ( e ) , w = d . createSVGTransform ( ) ; w . setTranslate ( h , l ) ; z . appendItem ( w ) ; Wa ( e ) } , Wa = this . recalculateDimensions = function ( e ) { if ( e == null ) return null ; var h = Y ( e ) ; if ( h && h . numberOfItems > 0 ) { for ( var l = h . numberOfItems ; l -- ; ) { var z = h . getItem ( l ) ; if ( z . type === 0 ) h . removeItem ( l ) ; else if ( z . type ===
1 ) svgedit . math . isIdentity ( z . matrix ) && h . removeItem ( l ) ; else z . type === 4 && z . angle === 0 && h . removeItem ( l ) } if ( h . numberOfItems === 1 && oa ( e ) ) return null } if ( ! h || h . numberOfItems == 0 ) { e . removeAttribute ( "transform" ) ; return null } if ( h ) { l = h . numberOfItems ; for ( var w = [ ] ; l -- ; ) { z = h . getItem ( l ) ; if ( z . type === 1 ) w . push ( [ z . matrix , l ] ) ; else if ( w . length ) w = [ ] } if ( w . length === 2 ) { l = d . createSVGTransformFromMatrix ( ia ( w [ 1 ] [ 0 ] , w [ 0 ] [ 0 ] ) ) ; h . removeItem ( w [ 0 ] [ 1 ] ) ; h . removeItem ( w [ 1 ] [ 1 ] ) ; h . insertItemBefore ( l , w [ 1 ] [ 1 ] ) } l = h . numberOfItems ; if ( l >= 2 && h . getItem ( l -
2 ) . type === 1 && h . getItem ( l - 1 ) . type === 2 ) { w = d . createSVGTransform ( ) ; z = ia ( h . getItem ( l - 2 ) . matrix , h . getItem ( l - 1 ) . matrix ) ; w . setMatrix ( z ) ; h . removeItem ( l - 2 ) ; h . removeItem ( l - 2 ) ; h . appendItem ( w ) } } 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 H = $ ( e ) . data ( "gsvg" ) ; l = new Ea ( "Transform" ) ; var A = { } , v = null ; z = [ ] ; switch ( e . tagName ) { case "line" : z = [ "x1" , "y1" ,
"x2" , "y2" ] ; break ; case "circle" : z = [ "cx" , "cy" , "r" ] ; break ; case "ellipse" : z = [ "cx" , "cy" , "rx" , "ry" ] ; break ; case "foreignObject" : case "rect" : case "image" : z = [ "width" , "height" , "x" , "y" ] ; break ; case "use" : case "text" : case "tspan" : z = [ "x" , "y" ] ; break ; case "polygon" : case "polyline" : v = { } ; v . points = e . getAttribute ( "points" ) ; w = e . points ; var E = w . numberOfItems ; A . points = Array ( E ) ; for ( var I = 0 ; I < E ; ++ I ) { var D = w . getItem ( I ) ; A . points [ I ] = { x : D . x , y : D . y } } break ; case "path" : v = { } ; v . d = e . getAttribute ( "d" ) ; A . d = e . getAttribute ( "d" ) } if ( z . length ) { A =
$ ( e ) . attr ( z ) ; $ . each ( A , function ( ha , $a ) { A [ ha ] = xa ( ha , $a ) } ) } else if ( H ) A = { x : $ ( H ) . attr ( "x" ) || 0 , y : $ ( H ) . attr ( "y" ) || 0 } ; if ( v == null ) { v = $ . extend ( true , { } , A ) ; $ . each ( v , function ( ha , $a ) { v [ ha ] = xa ( ha , $a ) } ) } v . transform = Ta ? Ta : "" ; if ( e . tagName == "g" && ! H || e . tagName == "a" ) { w = svgedit . utilities . getBBox ( e ) ; var G = { x : w . x + w . width / 2 , y : w . y + w . height / 2 } , L = P ( w . x + w . width / 2 , w . y + w . height / 2 , ga ( h ) . matrix ) ; z = d . createSVGMatrix ( ) ; if ( w = oa ( e ) ) { I = w * Math . PI / 180 ; E = Math . abs ( I ) > 1.0 E - 10 ? Math . sin ( I ) / ( 1 - Math . cos ( I ) ) : 2 / I ; for ( I = 0 ; I < h . numberOfItems ; ++ I ) { z =
h . getItem ( I ) ; if ( z . type == 4 ) { z = z . matrix ; G . y = ( E * z . e + z . f ) / 2 ; G . x = ( z . e - E * z . f ) / 2 ; h . removeItem ( I ) ; break } } } I = z = H = 0 ; var k = h . numberOfItems ; if ( k ) var u = h . getItem ( 0 ) . matrix ; if ( k >= 3 && h . getItem ( k - 2 ) . type == 3 && h . getItem ( k - 3 ) . type == 2 && h . getItem ( k - 1 ) . type == 2 ) { I = 3 ; var C = h . getItem ( k - 3 ) . matrix , F = h . getItem ( k - 2 ) . matrix , O = h . getItem ( k - 1 ) . matrix ; E = e . childNodes ; for ( D = E . length ; D -- ; ) { var V = E . item ( D ) ; z = H = 0 ; if ( V . nodeType == 1 ) { var T = Y ( V ) ; if ( T ) { z = ga ( T ) . matrix ; H = oa ( V ) ; var X = Ta , aa = [ ] ; Ta = V . getAttribute ( "transform" ) ; if ( H || qa ( T ) ) { var fa =
d . createSVGTransform ( ) ; fa . setMatrix ( ia ( C , F , O , z ) ) ; T . clear ( ) ; T . appendItem ( fa ) ; aa . push ( fa ) } else { H = ia ( z . inverse ( ) , O , z ) ; fa = d . createSVGMatrix ( ) ; fa . e = - H . e ; fa . f = - H . f ; z = ia ( fa . inverse ( ) , z . inverse ( ) , C , F , O , z , H . inverse ( ) ) ; var ra = d . createSVGTransform ( ) , Pa = d . createSVGTransform ( ) , Da = d . createSVGTransform ( ) ; ra . setTranslate ( H . e , H . f ) ; Pa . setScale ( z . a , z . d ) ; Da . setTranslate ( fa . e , fa . f ) ; T . appendItem ( Da ) ; T . appendItem ( Pa ) ; T . appendItem ( ra ) ; aa . push ( Da ) ; aa . push ( Pa ) ; aa . push ( ra ) } l . addSubCommand ( Wa ( V ) ) ; Ta = X } } } h . removeItem ( k - 1 ) ; h . removeItem ( k -
2 ) ; h . removeItem ( k - 3 ) } else if ( k >= 3 && h . getItem ( k - 1 ) . type == 1 ) { I = 3 ; z = ga ( h ) . matrix ; fa = d . createSVGTransform ( ) ; fa . setMatrix ( z ) ; h . clear ( ) ; h . appendItem ( fa ) } else if ( ( k == 1 || k > 1 && h . getItem ( 1 ) . type != 3 ) && h . getItem ( 0 ) . type == 2 ) { I = 2 ; H = ga ( h ) . matrix ; h . removeItem ( 0 ) ; z = ga ( h ) . matrix . inverse ( ) ; z = ia ( z , H ) ; H = z . e ; z = z . f ; if ( H != 0 || z != 0 ) { E = e . childNodes ; D = E . length ; for ( k = [ ] ; D -- ; ) { V = E . item ( D ) ; if ( V . nodeType == 1 ) { if ( V . getAttribute ( "clip-path" ) ) { X = V . getAttribute ( "clip-path" ) ; if ( k . indexOf ( X ) === - 1 ) { rb ( X , H , z ) ; k . push ( X ) } } X = Ta ; Ta = V . getAttribute ( "transform" ) ;
if ( T = Y ( V ) ) { C = d . createSVGTransform ( ) ; C . setTranslate ( H , z ) ; T . numberOfItems ? T . insertItemBefore ( C , 0 ) : T . appendItem ( C ) ; l . addSubCommand ( Wa ( V ) ) ; T = e . getElementsByTagNameNS ( c , "use" ) ; V = "#" + V . id ; for ( C = T . length ; C -- ; ) { F = T . item ( C ) ; if ( V == da ( F ) ) { O = d . createSVGTransform ( ) ; O . setTranslate ( - H , - z ) ; Y ( F ) . insertItemBefore ( O , 0 ) ; l . addSubCommand ( Wa ( F ) ) } } Ta = X } } } k = [ ] ; Ta = X } } else if ( k == 1 && h . getItem ( 0 ) . type == 1 && ! w ) { I = 1 ; z = h . getItem ( 0 ) . matrix ; E = e . childNodes ; for ( D = E . length ; D -- ; ) { V = E . item ( D ) ; if ( V . nodeType == 1 ) { X = Ta ; Ta = V . getAttribute ( "transform" ) ;
if ( T = Y ( V ) ) { H = ia ( z , ga ( T ) . matrix ) ; k = d . createSVGTransform ( ) ; k . setMatrix ( H ) ; T . clear ( ) ; T . appendItem ( k , 0 ) ; l . addSubCommand ( Wa ( V ) ) ; Ta = X ; X = V . getAttribute ( "stroke-width" ) ; V . getAttribute ( "stroke" ) !== "none" && ! isNaN ( X ) && V . setAttribute ( "stroke-width" , X * ( ( Math . abs ( H . a ) + Math . abs ( H . d ) ) / 2 ) ) } } } h . clear ( ) } else { if ( w ) { G = d . createSVGTransform ( ) ; G . setRotate ( w , L . x , L . y ) ; h . numberOfItems ? h . insertItemBefore ( G , 0 ) : h . appendItem ( G ) } h . numberOfItems == 0 && e . removeAttribute ( "transform" ) ; return null } if ( I == 2 ) { if ( w ) { L = { x : G . x + u . e , y : G . y + u . f } ;
G = d . createSVGTransform ( ) ; G . setRotate ( w , L . x , L . y ) ; h . numberOfItems ? h . insertItemBefore ( G , 0 ) : h . appendItem ( G ) } } else if ( I == 3 ) { z = ga ( h ) . matrix ; u = d . createSVGTransform ( ) ; u . setRotate ( w , G . x , G . y ) ; u = u . matrix ; G = d . createSVGTransform ( ) ; G . setRotate ( w , L . x , L . y ) ; L = G . matrix . inverse ( ) ; X = z . inverse ( ) ; L = ia ( X , L , u , z ) ; H = L . e ; z = L . f ; if ( H != 0 || z != 0 ) { E = e . childNodes ; for ( D = E . length ; D -- ; ) { V = E . item ( D ) ; if ( V . nodeType == 1 ) { X = Ta ; Ta = V . getAttribute ( "transform" ) ; T = Y ( V ) ; C = d . createSVGTransform ( ) ; C . setTranslate ( H , z ) ; T . numberOfItems ? T . insertItemBefore ( C ,
0 ) : T . appendItem ( C ) ; l . addSubCommand ( Wa ( V ) ) ; Ta = X } } } if ( w ) h . numberOfItems ? h . insertItemBefore ( G , 0 ) : h . appendItem ( G ) } } else { w = svgedit . utilities . getBBox ( e ) ; if ( ! w && e . tagName != "path" ) return null ; z = d . createSVGMatrix ( ) ; if ( H = oa ( e ) ) { G = { x : w . x + w . width / 2 , y : w . y + w . height / 2 } ; L = P ( w . x + w . width / 2 , w . y + w . height / 2 , ga ( h ) . matrix ) ; I = H * Math . PI / 180 ; E = Math . abs ( I ) > 1.0 E - 10 ? Math . sin ( I ) / ( 1 - Math . cos ( I ) ) : 2 / I ; for ( I = 0 ; I < h . numberOfItems ; ++ I ) { z = h . getItem ( I ) ; if ( z . type == 4 ) { z = z . matrix ; G . y = ( E * z . e + z . f ) / 2 ; G . x = ( z . e - E * z . f ) / 2 ; h . removeItem ( I ) ; break } } } I =
0 ; k = h . numberOfItems ; if ( ! svgedit . browser . isWebkit ( ) ) if ( ( u = e . getAttribute ( "fill" ) ) && u . indexOf ( "url(" ) === 0 ) { u = R ( u ) ; X = "pattern" ; if ( u . tagName !== X ) X = "gradient" ; if ( u . getAttribute ( X + "Units" ) === "userSpaceOnUse" ) { z = ga ( h ) . matrix ; w = Y ( u ) ; w = ga ( w ) . matrix ; z = ia ( z , w ) ; w = "matrix(" + [ z . a , z . b , z . c , z . d , z . e , z . f ] . join ( "," ) + ")" ; u . setAttribute ( X + "Transform" , w ) } } if ( k >= 3 && h . getItem ( k - 2 ) . type == 3 && h . getItem ( k - 3 ) . type == 2 && h . getItem ( k - 1 ) . type == 2 ) { I = 3 ; z = ga ( h , k - 3 , k - 1 ) . matrix ; h . removeItem ( k - 1 ) ; h . removeItem ( k - 2 ) ; h . removeItem ( k - 3 ) } else if ( k ==
4 && h . getItem ( k - 1 ) . type == 1 ) { I = 3 ; z = ga ( h ) . matrix ; fa = d . createSVGTransform ( ) ; fa . setMatrix ( z ) ; h . clear ( ) ; h . appendItem ( fa ) ; z = d . createSVGMatrix ( ) } else if ( ( k == 1 || k > 1 && h . getItem ( 1 ) . type != 3 ) && h . getItem ( 0 ) . type == 2 ) { I = 2 ; u = h . getItem ( 0 ) . matrix ; X = ga ( h , 1 ) . matrix ; w = X . inverse ( ) ; z = ia ( w , u , X ) ; h . removeItem ( 0 ) } else if ( k == 1 && h . getItem ( 0 ) . type == 1 && ! H ) { z = ga ( h ) . matrix ; switch ( e . tagName ) { case "line" : A = $ ( e ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) ; case "polyline" : case "polygon" : A . points = e . getAttribute ( "points" ) ; if ( A . points ) { w = e . points ; E = w . numberOfItems ;
A . points = Array ( E ) ; for ( I = 0 ; I < E ; ++ I ) { D = w . getItem ( I ) ; A . points [ I ] = { x : D . x , y : D . y } } } case "path" : A . d = e . getAttribute ( "d" ) ; I = 1 ; h . clear ( ) } } else { I = 4 ; if ( H ) { G = d . createSVGTransform ( ) ; G . setRotate ( H , L . x , L . y ) ; h . numberOfItems ? h . insertItemBefore ( G , 0 ) : h . appendItem ( G ) } h . numberOfItems == 0 && e . removeAttribute ( "transform" ) ; return null } if ( I == 1 || I == 2 || I == 3 ) bb ( e , A , z ) ; if ( I == 2 ) { if ( H ) { qa ( h ) || ( L = { x : G . x + z . e , y : G . y + z . f } ) ; G = d . createSVGTransform ( ) ; G . setRotate ( H , L . x , L . y ) ; h . numberOfItems ? h . insertItemBefore ( G , 0 ) : h . appendItem ( G ) } } else if ( I ==
3 && H ) { z = ga ( h ) . matrix ; u = d . createSVGTransform ( ) ; u . setRotate ( H , G . x , G . y ) ; u = u . matrix ; G = d . createSVGTransform ( ) ; G . setRotate ( H , L . x , L . y ) ; L = G . matrix . inverse ( ) ; X = z . inverse ( ) ; L = ia ( X , L , u , z ) ; bb ( e , A , L ) ; if ( H ) h . numberOfItems ? h . insertItemBefore ( G , 0 ) : h . appendItem ( G ) } } h . numberOfItems == 0 && e . removeAttribute ( "transform" ) ; l . addSubCommand ( new Ka ( e , v ) ) ; return l } , qb = null , Ra = this . clearSelection = function ( e ) { if ( J [ 0 ] != null ) for ( var h = J . length , l = 0 ; l < h ; ++ l ) { var z = J [ l ] ; if ( z == null ) break ; Ca . releaseSelector ( z ) ; J [ l ] = null } e || N ( "selected" ,
J ) } , ub = this . addToSelection = function ( e , h ) { if ( e . length != 0 ) { for ( var l = 0 ; l < J . length ; ) { if ( J [ l ] == null ) break ; ++ l } for ( var z = e . length ; z -- ; ) { var w = e [ z ] ; if ( w && svgedit . utilities . getBBox ( w ) ) { if ( w . tagName === "a" && w . childNodes . length === 1 ) w = w . firstChild ; if ( J . indexOf ( w ) == - 1 ) { J [ l ] = w ; l ++ ; w = Ca . requestSelector ( w ) ; J . length > 1 && w . showGrips ( false ) } } } N ( "selected" , J ) ; h || J . length == 1 ? Ca . requestSelector ( J [ 0 ] ) . showGrips ( true ) : Ca . requestSelector ( J [ 0 ] ) . showGrips ( false ) ; for ( J . sort ( function ( H , A ) { if ( H && A && H . compareDocumentPosition ) return 3 -
( A . compareDocumentPosition ( H ) & 6 ) ; else if ( H == null ) return 1 } ) ; J [ 0 ] == null ; ) J . shift ( 0 ) } } , Cb = this . selectOnly = function ( e , h ) { Ra ( true ) ; ub ( e , h ) } ; this . removeFromSelection = function ( e ) { if ( J [ 0 ] != null ) if ( e . length != 0 ) { var h = Array ( J . length ) ; j = 0 ; len = J . length ; for ( var l = 0 ; l < len ; ++ l ) { var z = J [ l ] ; if ( z ) if ( e . indexOf ( z ) == - 1 ) { h [ j ] = z ; j ++ } else Ca . releaseSelector ( z ) } J = h } } ; this . selectAllInCurrentLayer = function ( ) { var e = B ( ) . getCurrentLayer ( ) ; if ( e ) { Ba = "select" ; Cb ( $ ( K || e ) . children ( ) ) } } ; var ob = 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 , m , h ] . indexOf ( e ) >= 0 ) return d ; if ( $ ( e ) . closest ( "#selectorParentGroup" ) . length ) return Ca . selectorParentGroup ; for ( ; e . parentNode !== ( K || h ) ; ) e = e . parentNode ; return e } ; ( function ( ) { var e = null , h = null , l = null , z =
null , w = null , H = { } , A = { minx : null , miny : null , maxx : null , maxy : null } ; $ ( a ) . mousedown ( function ( v ) { if ( ! ( v . originalEvent . touches && v . originalEvent . touches > 1 ) ) { var E = v . button === 2 ; qb = m . getScreenCTM ( ) . inverse ( ) ; var I = P ( v . pageX , v . pageY , qb ) , D = I . x * o ; I = I . y * o ; v . preventDefault ( ) ; if ( E ) Ba = "select" ; D = D / o ; I = I / o ; var G = ob ( v ) ; if ( G . tagName === "a" && G . childNodes . length === 1 ) G = G . firstChild ; var L = z = h = D , k = w = l = I ; if ( n . gridSnapping ) { D = wa ( D ) ; I = wa ( I ) ; h = wa ( h ) ; l = wa ( l ) } if ( G == Ca . selectorParentGroup && J [ 0 ] != null ) { G = v . target ; var u = ib ( G , "type" ) ;
if ( u == "rotate" ) { Ba = "rotate" ; current _rotate _mode = ib ( G , "dir" ) } else if ( u == "resize" ) { Ba = "resize" ; jb = ib ( G , "dir" ) } G = J [ 0 ] } Ta = G . getAttribute ( "transform" ) ; u = Y ( G ) ; switch ( Ba ) { case "select" : Ma = true ; jb = "none" ; if ( E ) Ma = false ; if ( G != d ) { if ( J . indexOf ( G ) == - 1 ) { v . shiftKey || Ra ( true ) ; ub ( [ G ] ) ; zb = G ; Ja . clear ( ) } if ( ! E ) for ( E = 0 ; E < J . length ; ++ E ) if ( J [ E ] != null ) { var C = Y ( J [ E ] ) ; C . numberOfItems ? C . insertItemBefore ( d . createSVGTransform ( ) , 0 ) : C . appendItem ( d . createSVGTransform ( ) ) } } else if ( ! E ) { Ra ( ) ; Ba = "multiselect" ; if ( sa == null ) sa = Ca . getRubberBandBox ( ) ;
z *= o ; w *= o ; na ( sa , { x : z , y : w , width : 0 , height : 0 , display : "inline" } , 100 ) } break ; case "zoom" : Ma = true ; if ( sa == null ) sa = Ca . getRubberBandBox ( ) ; na ( sa , { x : L * o , y : L * o , width : 0 , height : 0 , display : "inline" } , 100 ) ; break ; case "resize" : Ma = true ; h = D ; l = I ; H = svgedit . utilities . getBBox ( $ ( "#selectedBox0" ) [ 0 ] ) ; var F = { } ; $ . each ( H , function ( O , V ) { F [ O ] = V / o } ) ; H = F ; E = oa ( G ) ? 1 : 0 ; if ( qa ( u ) ) { u . insertItemBefore ( d . createSVGTransform ( ) , E ) ; u . insertItemBefore ( d . createSVGTransform ( ) , E ) ; u . insertItemBefore ( d . createSVGTransform ( ) , E ) } else { u . appendItem ( d . createSVGTransform ( ) ) ;
u . appendItem ( d . createSVGTransform ( ) ) ; u . appendItem ( d . createSVGTransform ( ) ) ; if ( svgedit . browser . supportsNonScalingStroke ( ) ) { if ( D = svgedit . browser . isChrome ( ) ) C = function ( O ) { var V = O . getAttributeNS ( null , "stroke" ) ; O . removeAttributeNS ( null , "stroke" ) ; setTimeout ( function ( ) { O . setAttributeNS ( null , "stroke" , V ) } , 1 ) } ; G . style . vectorEffect = "non-scaling-stroke" ; D && C ( G ) ; I = G . getElementsByTagName ( "*" ) ; L = I . length ; for ( E = 0 ; E < L ; E ++ ) { I [ E ] . style . vectorEffect = "non-scaling-stroke" ; D && C ( I [ E ] ) } } } break ; case "fhellipse" : case "fhrect" : case "fhpath" : Ma =
true ; e = L + "," + k + " " ; C = M . stroke _width == 0 ? 1 : M . stroke _width ; Q ( { element : "polyline" , curStyles : true , attr : { points : e , id : la ( ) , fill : "none" , opacity : M . opacity / 2 , "stroke-linecap" : "round" , style : "pointer-events:none" } } ) ; A . minx = L ; A . maxx = L ; A . miny = k ; A . maxy = k ; break ; case "image" : Ma = true ; C = Q ( { element : "image" , attr : { x : D , y : I , width : 0 , height : 0 , id : la ( ) , opacity : M . opacity / 2 , style : "pointer-events:inherit" } } ) ; W ( C , Aa ) ; Ib ( C ) ; break ; case "square" : case "rect" : Ma = true ; h = D ; l = I ; Q ( { element : "rect" , curStyles : true , attr : { x : D , y : I , width : 0 , height : 0 ,
id : la ( ) , opacity : M . opacity / 2 } } ) ; break ; case "line" : Ma = true ; C = M . stroke _width == 0 ? 1 : M . stroke _width ; Q ( { element : "line" , curStyles : true , attr : { x1 : D , y1 : I , x2 : D , y2 : I , id : la ( ) , stroke : M . stroke , "stroke-width" : C , "stroke-dasharray" : M . stroke _dasharray , "stroke-linejoin" : M . stroke _linejoin , "stroke-linecap" : M . stroke _linecap , "stroke-opacity" : M . stroke _opacity , fill : "none" , opacity : M . opacity / 2 , style : "pointer-events:none" } } ) ; break ; case "circle" : Ma = true ; Q ( { element : "circle" , curStyles : true , attr : { cx : D , cy : I , r : 0 , id : la ( ) , opacity : M . opacity /
2 } } ) ; break ; case "ellipse" : Ma = true ; Q ( { element : "ellipse" , curStyles : true , attr : { cx : D , cy : I , rx : 0 , ry : 0 , id : la ( ) , opacity : M . opacity / 2 } } ) ; break ; case "text" : Ma = true ; Q ( { element : "text" , curStyles : true , attr : { x : D , y : I , id : la ( ) , fill : Za . fill , "stroke-width" : Za . stroke _width , "font-size" : Za . font _size , "font-family" : Za . font _family , "text-anchor" : "left" , "xml:space" : "preserve" , opacity : M . opacity } } ) ; break ; case "path" : case "pathedit" : h *= o ; l *= o ; Ja . mouseDown ( v , G , h , l ) ; Ma = true ; break ; case "textedit" : h *= o ; l *= o ; eb . mouseDown ( v , G , h , l ) ; Ma =
true ; break ; case "rotate" : Ma = true ; b . undoMgr . beginUndoableChange ( "transform" , J ) ; document . getElementById ( "workarea" ) . className = "rotate" } C = nb ( "mouseDown" , { event : v , start _x : h , start _y : l , selectedElements : J } , true ) ; $ . each ( C , function ( O , V ) { if ( V && V . started ) Ma = true } ) ; if ( Ba ) document . getElementById ( "workarea" ) . className = Ba == "resize" ? v . target . style . cursor : Ba } } ) . mousemove ( function ( v ) { if ( ! ( v . originalEvent . touches && v . originalEvent . touches . length > 1 ) ) if ( Ma ) if ( ! ( v . button === 1 || b . spaceKey ) ) { var E = J [ 0 ] , I = P ( v . pageX , v . pageY ,
qb ) , D = I . x * o ; I = I . y * o ; var G = pa ( ca ( ) ) , L = x = D / o , k = y = I / o ; if ( n . gridSnapping ) { x = wa ( x ) ; y = wa ( y ) } v . preventDefault ( ) ; switch ( Ba ) { case "select" : if ( J [ 0 ] !== null ) { L = x - h ; var u = y - l ; if ( n . gridSnapping ) { L = wa ( L ) ; u = wa ( u ) } if ( v . shiftKey ) { var C = U ( h , l , x , y ) ; x = C . x ; y = C . y } if ( L != 0 || u != 0 ) { C = J . length ; for ( k = 0 ; k < C ; ++ k ) { E = J [ k ] ; if ( E == null ) break ; var F = d . createSVGTransform ( ) ; G = Y ( E ) ; F . setTranslate ( L , u ) ; G . numberOfItems ? G . replaceItem ( F , 0 ) : G . appendItem ( F ) ; Ca . requestSelector ( E ) . resize ( ) } if ( v . altKey ) if ( ! b . addClone ) { b . addClone = b . cloneSelectedElements ( 0 ,
0 , F ) ; b . removeClone = function ( ) { if ( parent = b . addClone . parentNode ) { parent . removeChild ( b . addClone ) ; b . addClone = false } } ; window . addEventListener ( "keyup" , b . removeClone ) } N ( "transition" , J ) } } break ; case "multiselect" : L *= o ; k *= o ; na ( sa , { x : Math . min ( z , L ) , y : Math . min ( w , k ) , width : Math . abs ( L - z ) , height : Math . abs ( k - w ) } , 100 ) ; G = [ ] ; L = [ ] ; F = tb ( ) ; C = J . length ; for ( k = 0 ; k < C ; ++ k ) { u = F . indexOf ( J [ k ] ) ; if ( u == - 1 ) G . push ( J [ k ] ) ; else F [ u ] = null } C = F . length ; for ( k = 0 ; k < C ; ++ k ) F [ k ] && L . push ( F [ k ] ) ; G . length > 0 && b . removeFromSelection ( G ) ; L . length > 0 && ub ( L ) ;
break ; case "resize" : G = Y ( E ) ; L = ( F = qa ( G ) ) ? H : svgedit . utilities . getBBox ( E ) ; C = L . x ; k = L . y ; var O = L . width , V = L . height ; L = x - h ; u = y - l ; if ( n . gridSnapping ) { L = wa ( L ) ; u = wa ( u ) ; V = wa ( V ) ; O = wa ( O ) } var T = oa ( E ) ; if ( T ) { var X = Math . sqrt ( L * L + u * u ) ; u = Math . atan2 ( u , L ) - T * Math . PI / 180 ; L = X * Math . cos ( u ) ; u = X * Math . sin ( u ) } if ( jb . indexOf ( "n" ) == - 1 && jb . indexOf ( "s" ) == - 1 ) u = 0 ; if ( jb . indexOf ( "e" ) == - 1 && jb . indexOf ( "w" ) == - 1 ) L = 0 ; var aa = X = 0 , fa = V ? ( V + u ) / V : 1 , ra = O ? ( O + L ) / O : 1 ; if ( jb . indexOf ( "n" ) >= 0 ) { fa = V ? ( V - u ) / V : 1 ; aa = V } if ( jb . indexOf ( "w" ) >= 0 ) { ra = O ? ( O - L ) / O : 1 ; X = O } L =
d . createSVGTransform ( ) ; u = d . createSVGTransform ( ) ; O = d . createSVGTransform ( ) ; if ( n . gridSnapping ) { C = wa ( C ) ; X = wa ( X ) ; k = wa ( k ) ; aa = wa ( aa ) } L . setTranslate ( - ( C + X ) , - ( k + aa ) ) ; if ( v . shiftKey ) if ( ra == 1 ) ra = fa ; else fa = ra ; u . setScale ( ra , fa ) ; O . setTranslate ( C + X , k + aa ) ; if ( F ) { F = T ? 1 : 0 ; G . replaceItem ( L , 2 + F ) ; G . replaceItem ( u , 1 + F ) ; G . replaceItem ( O , 0 + F ) } else { F = G . numberOfItems ; G . replaceItem ( O , F - 3 ) ; G . replaceItem ( u , F - 2 ) ; G . replaceItem ( L , F - 1 ) } Ca . requestSelector ( E ) . resize ( ) ; N ( "transition" , J ) ; break ; case "zoom" : L *= o ; k *= o ; na ( sa , { x : Math . min ( z * o ,
L ) , y : Math . min ( w * o , k ) , width : Math . abs ( L - z * o ) , height : Math . abs ( k - w * o ) } , 100 ) ; break ; case "text" : na ( G , { x : x , y : y } , 1E3 ) ; break ; case "line" : L = null ; window . opera || d . suspendRedraw ( 1E3 ) ; if ( n . gridSnapping ) { x = wa ( x ) ; y = wa ( y ) } F = x ; C = y ; if ( v . shiftKey ) { C = U ( h , l , F , C ) ; F = C . x ; C = C . y } G . setAttributeNS ( null , "x2" , F ) ; G . setAttributeNS ( null , "y2" , C ) ; window . opera || d . unsuspendRedraw ( L ) ; break ; case "foreignObject" : case "square" : case "rect" : case "image" : L = Math . abs ( x - h ) ; F = Math . abs ( y - l ) ; if ( Ba == "square" || v . shiftKey ) { L = F = Math . max ( L , F ) ; C = h < x ? h :
h - L ; k = l < y ? l : l - F } else { C = Math . min ( h , x ) ; k = Math . min ( l , y ) } if ( v . altKey ) { L *= 2 ; F *= 2 ; C = h - L / 2 ; k = l - F / 2 } if ( n . gridSnapping ) { L = wa ( L ) ; F = wa ( F ) ; C = wa ( C ) ; k = wa ( k ) } na ( G , { width : L , height : F , x : C , y : k } , 1E3 ) ; break ; case "circle" : L = $ ( G ) . attr ( [ "cx" , "cy" ] ) ; F = L . cx ; C = L . cy ; L = Math . sqrt ( ( x - F ) * ( x - F ) + ( y - C ) * ( y - C ) ) ; if ( n . gridSnapping ) L = wa ( L ) ; G . setAttributeNS ( null , "r" , L ) ; break ; case "ellipse" : L = $ ( G ) . attr ( [ "cx" , "cy" ] ) ; F = Math . abs ( h + ( x - h ) / 2 ) ; C = Math . abs ( l + ( y - l ) / 2 ) ; L = null ; window . opera || d . suspendRedraw ( 1E3 ) ; if ( n . gridSnapping ) { x = wa ( x ) ; F = wa ( F ) ; y = wa ( y ) ;
C = wa ( C ) } k = Math . abs ( h - F ) ; u = Math . abs ( l - C ) ; if ( v . shiftKey ) { u = k ; C = y > l ? l + k : l - k } if ( v . altKey ) { F = h ; C = l ; k = Math . abs ( x - F ) ; u = v . shiftKey ? k : Math . abs ( y - C ) } G . setAttributeNS ( null , "rx" , k ) ; G . setAttributeNS ( null , "ry" , u ) ; G . setAttributeNS ( null , "cx" , F ) ; G . setAttributeNS ( null , "cy" , C ) ; window . opera || d . unsuspendRedraw ( L ) ; break ; case "fhellipse" : case "fhrect" : A . minx = Math . min ( L , A . minx ) ; A . maxx = Math . max ( L , A . maxx ) ; A . miny = Math . min ( k , A . miny ) ; A . maxy = Math . max ( k , A . maxy ) ; case "fhpath" : e += + L + "," + k + " " ; G . setAttributeNS ( null , "points" , e ) ; break ;
case "path" : case "pathedit" : x *= o ; y *= o ; if ( n . gridSnapping ) { x = wa ( x ) ; y = wa ( y ) ; h = wa ( h ) ; l = wa ( l ) } if ( v . shiftKey ) { if ( F = svgedit . path . path ) { G = F . dragging ? F . dragging [ 0 ] : h ; F = F . dragging ? F . dragging [ 1 ] : l } else { G = h ; F = l } C = U ( G , F , x , y ) ; x = C . x ; y = C . y } if ( sa && sa . getAttribute ( "display" ) !== "none" ) { L *= o ; k *= o ; na ( sa , { x : Math . min ( z * o , L ) , y : Math . min ( w * o , k ) , width : Math . abs ( L - z * o ) , height : Math . abs ( k - w * o ) } , 100 ) } Ja . mouseMove ( v , x , y ) ; break ; case "textedit" : x *= o ; y *= o ; eb . mouseMove ( D , I ) ; break ; case "rotate" : L = svgedit . utilities . getBBox ( E ) ; F = L . x + L . width /
2 ; C = L . y + L . height / 2 ; G = ba ( E ) ; G = P ( F , C , G ) ; F = G . x ; C = G . y ; G = L . x ; k = L . y ; if ( current _rotate _mode == "nw" ) G = L . x + L . width ; if ( current _rotate _mode == "se" ) k = L . y + L . height ; if ( current _rotate _mode == "sw" ) { G = L . x + L . width ; k = L . y + L . height } compensation _angle = ( Math . atan2 ( C - k , F - G ) * ( 180 / Math . PI ) - 90 ) % 360 ; T = ( Math . atan2 ( C - y , F - x ) * ( 180 / Math . PI ) - 90 ) % 360 ; T += compensation _angle ; if ( n . gridSnapping ) T = wa ( T ) ; if ( v . shiftKey ) T = Math . round ( T / 45 ) * 45 ; b . setRotationAngle ( T < - 180 ? 360 + T : T , true ) ; N ( "transition" , J ) } nb ( "mouseMove" , { event : v , mouse _x : D , mouse _y : I ,
selected : E } ) } } ) . click ( function ( v ) { v . preventDefault ( ) ; return false } ) . dblclick ( function ( v ) { var E = v . target . parentNode ; if ( E !== K ) { var I = ob ( v ) , D = I . tagName ; if ( D === "text" && Ba !== "textedit" ) { v = P ( v . pageX , v . pageY , qb ) ; eb . select ( I , v . x , v . y ) } if ( ( D === "g" || D === "a" ) && oa ( I ) ) { Lb ( I ) ; I = J [ 0 ] ; Ra ( true ) } K && Jb ( ) ; E . tagName !== "g" && E . tagName !== "a" || E === B ( ) . getCurrentLayer ( ) || I === Ca . selectorParentGroup || Rb ( I ) } } ) . mouseup ( function ( v ) { b . addClone = false ; window . removeEventListener ( "keyup" , b . removeClone ) ; if ( v . button !== 2 ) { var E = zb ; zb = null ;
if ( Ma ) { var I = P ( v . pageX , v . pageY , qb ) , D = I . x * o ; I = I . y * o ; var G = D / o , L = I / o , k = pa ( ca ( ) ) , u = false ; Ma = false ; switch ( Ba ) { case "resize" : case "multiselect" : if ( sa != null ) { sa . setAttribute ( "display" , "none" ) ; lb = [ ] } Ba = "select" ; case "select" : if ( J [ 0 ] != null ) { if ( J [ 1 ] == null ) { D = J [ 0 ] ; switch ( D . tagName ) { case "g" : case "use" : case "image" : case "foreignObject" : break ; default : cb . fill = D . getAttribute ( "fill" ) ; cb . fill _opacity = D . getAttribute ( "fill-opacity" ) ; cb . stroke = D . getAttribute ( "stroke" ) ; cb . stroke _opacity = D . getAttribute ( "stroke-opacity" ) ;
cb . stroke _width = D . getAttribute ( "stroke-width" ) ; cb . stroke _dasharray = D . getAttribute ( "stroke-dasharray" ) ; cb . stroke _linejoin = D . getAttribute ( "stroke-linejoin" ) ; cb . stroke _linecap = D . getAttribute ( "stroke-linecap" ) } if ( D . tagName == "text" ) { Za . font _size = D . getAttribute ( "font-size" ) ; Za . font _family = D . getAttribute ( "font-family" ) } Ca . requestSelector ( D ) . showGrips ( true ) } Ga ( ) ; if ( G != z || L != w ) { v = J . length ; for ( D = 0 ; D < v ; ++ D ) { if ( J [ D ] == null ) break ; J [ D ] . firstChild || Ca . requestSelector ( J [ D ] ) . resize ( ) } } else { D = v . target ; if ( J [ 0 ] . nodeName ===
"path" && J [ 1 ] == null ) Ja . select ( J [ 0 ] ) ; else v . shiftKey && E != D && b . removeFromSelection ( [ D ] ) } if ( svgedit . browser . supportsNonScalingStroke ( ) ) if ( v = J [ 0 ] ) { v . removeAttribute ( "style" ) ; svgedit . utilities . walkTree ( v , function ( O ) { O . removeAttribute ( "style" ) } ) } } return ; case "zoom" : sa != null && sa . setAttribute ( "display" , "none" ) ; N ( "zoomed" , { x : Math . min ( z , G ) , y : Math . min ( w , L ) , width : Math . abs ( G - z ) , height : Math . abs ( L - w ) , factor : v . altKey ? 0.5 : 2 } ) ; return ; case "fhpath" : E = k . getAttribute ( "points" ) ; G = E . indexOf ( "," ) ; if ( u = G >= 0 ? E . indexOf ( "," ,
G + 1 ) >= 0 : E . indexOf ( " " , E . indexOf ( " " ) + 1 ) >= 0 ) k = Ja . smoothPolylineIntoPath ( k ) ; break ; case "line" : E = $ ( k ) . attr ( [ "x1" , "x2" , "y1" , "y2" ] ) ; u = E . x1 != E . x2 || E . y1 != E . y2 ; break ; case "foreignObject" : case "square" : case "rect" : case "image" : E = $ ( k ) . attr ( [ "width" , "height" ] ) ; u = E . width != 0 || E . height != 0 || Ba === "image" ; break ; case "circle" : u = k . getAttribute ( "r" ) != 0 ; break ; case "ellipse" : E = $ ( k ) . attr ( [ "rx" , "ry" ] ) ; u = E . rx != null || E . ry != null ; break ; case "fhellipse" : if ( A . maxx - A . minx > 0 && A . maxy - A . miny > 0 ) { k = Q ( { element : "ellipse" , curStyles : true ,
attr : { cx : ( A . minx + A . maxx ) / 2 , cy : ( A . miny + A . maxy ) / 2 , rx : ( A . maxx - A . minx ) / 2 , ry : ( A . maxy - A . miny ) / 2 , id : ca ( ) } } ) ; N ( "changed" , [ k ] ) ; u = true } break ; case "fhrect" : if ( A . maxx - A . minx > 0 && A . maxy - A . miny > 0 ) { k = Q ( { element : "rect" , curStyles : true , attr : { x : A . minx , y : A . miny , width : A . maxx - A . minx , height : A . maxy - A . miny , id : ca ( ) } } ) ; N ( "changed" , [ k ] ) ; u = true } break ; case "text" : u = true ; Cb ( [ k ] ) ; eb . start ( k ) ; break ; case "path" : k = null ; Ma = true ; E = Ja . mouseUp ( v , k , D , I ) ; k = E . element ; u = E . keep ; break ; case "pathedit" : u = true ; k = null ; Ja . mouseUp ( v ) ; break ; case "textedit" : u =
false ; k = null ; eb . mouseUp ( v , D , I ) ; break ; case "rotate" : u = true ; k = null ; Ba = "select" ; E = b . undoMgr . finishUndoableChange ( ) ; E . isEmpty ( ) || ya ( E ) ; Ga ( ) ; N ( "changed" , J ) } D = nb ( "mouseUp" , { event : v , mouse _x : D , mouse _y : I } , true ) ; $ . each ( D , function ( O , V ) { if ( V ) { u = V . keep || u ; k = V . element ; Ma = V . started || Ma } } ) ; if ( ! u && k != null ) { B ( ) . releaseId ( ca ( ) ) ; k . parentNode . removeChild ( k ) ; k = null ; for ( D = v . target ; D . parentNode . parentNode . tagName == "g" ; ) D = D . parentNode ; if ( ( Ba != "path" || ! drawn _path ) && D . parentNode . id != "selectorParentGroup" && D . id != "svgcanvas" &&
D . id != "svgroot" ) { b . setMode ( "select" ) ; Cb ( [ D ] , true ) } } else if ( k != null ) { b . addedNew = true ; v = 0.2 ; var C ; if ( false . beginElement && k . getAttribute ( "opacity" ) != M . opacity ) { C = $ ( false ) . clone ( ) . attr ( { to : M . opacity , dur : v } ) . appendTo ( k ) ; try { C [ 0 ] . beginElement ( ) } catch ( F ) { } } else v = 0 ; setTimeout ( function ( ) { C && C . remove ( ) ; k . setAttribute ( "opacity" , M . opacity ) ; k . setAttribute ( "style" , "pointer-events:inherit" ) ; ma ( k ) ; if ( Ba === "path" ) Ja . toEditMode ( k ) ; else n . selectNew && Cb ( [ k ] , true ) ; ya ( new Ia ( k ) ) ; N ( "changed" , [ k ] ) } , v * 1E3 ) } Ta = null } } } ) ; $ ( a ) . bind ( "mousewheel DOMMouseScroll" ,
function ( v ) { if ( v . shiftKey ) { v . preventDefault ( ) ; qb = m . getScreenCTM ( ) . inverse ( ) ; var E = P ( v . pageX , v . pageY , qb ) ; E = { x : E . x , y : E . y , width : 0 , height : 0 } ; if ( v . wheelDelta ) if ( v . wheelDelta >= 120 ) E . factor = 2 ; else { if ( v . wheelDelta <= - 120 ) E . factor = 0.5 } else if ( v . detail ) if ( v . detail > 0 ) E . factor = 0.5 ; else if ( v . detail < 0 ) E . factor = 2 ; E . factor && N ( "zoomed" , E ) } } ) } ) ( ) ; var Ib = function ( e ) { $ ( e ) . click ( function ( h ) { h . preventDefault ( ) } ) } , eb = b . textActions = function ( ) { function e ( T ) { var X = I . value === "" ; $ ( I ) . focus ( ) ; if ( ! arguments . length ) if ( X ) T = 0 ; else { if ( I . selectionEnd !==
I . selectionStart ) return ; T = I . selectionEnd } var aa ; aa = k [ T ] ; X || I . setSelectionRange ( T , T ) ; D = pa ( "text_cursor" ) ; if ( ! D ) { D = document . createElementNS ( c , "line" ) ; na ( D , { id : "text_cursor" , stroke : "#333" , "stroke-width" : 1 } ) ; D = pa ( "selectorParentGroup" ) . appendChild ( D ) } L || ( L = setInterval ( function ( ) { var fa = D . getAttribute ( "display" ) === "none" ; D . setAttribute ( "display" , fa ? "inline" : "none" ) } , 600 ) ) ; X = H ( aa . x , u . y ) ; aa = H ( aa . x , u . y + u . height ) ; na ( D , { x1 : X . x , y1 : X . y , x2 : aa . x , y2 : aa . y , visibility : "visible" , display : "inline" } ) ; G && G . setAttribute ( "d" ,
"" ) } function h ( T , X , aa ) { if ( T === X ) e ( X ) ; else { aa || I . setSelectionRange ( T , X ) ; G = pa ( "text_selectblock" ) ; if ( ! G ) { G = document . createElementNS ( c , "path" ) ; na ( G , { id : "text_selectblock" , fill : "green" , opacity : 0.5 , style : "pointer-events:none" } ) ; pa ( "selectorParentGroup" ) . appendChild ( G ) } T = k [ T ] ; var fa = k [ X ] ; D . setAttribute ( "visibility" , "hidden" ) ; X = H ( T . x , u . y ) ; aa = H ( T . x + ( fa . x - T . x ) , u . y ) ; var ra = H ( T . x , u . y + u . height ) ; T = H ( T . x + ( fa . x - T . x ) , u . y + u . height ) ; na ( G , { d : "M" + X . x + "," + X . y + " L" + aa . x + "," + aa . y + " " + T . x + "," + T . y + " " + ra . x + "," + ra . y + "z" , display : "inline" } ) } }
function l ( T , X ) { var aa = d . createSVGPoint ( ) ; aa . x = T ; aa . y = X ; if ( k . length == 1 ) return 0 ; aa = E . getCharNumAtPosition ( aa ) ; if ( aa < 0 ) { aa = k . length - 2 ; if ( T <= k [ 0 ] . x ) aa = 0 } else if ( aa >= k . length - 2 ) aa = k . length - 2 ; var fa = k [ aa ] ; T > fa . x + fa . width / 2 && aa ++ ; return aa } function z ( T , X , aa ) { var fa = I . selectionStart ; T = l ( T , X ) ; h ( Math . min ( fa , T ) , Math . max ( fa , T ) , ! aa ) } function w ( T , X ) { var aa = { x : T , y : X } ; aa . x /= o ; aa . y /= o ; if ( C ) { var fa = P ( aa . x , aa . y , C . inverse ( ) ) ; aa . x = fa . x ; aa . y = fa . y } return aa } function H ( T , X ) { var aa = { x : T , y : X } ; if ( C ) { var fa = P ( aa . x , aa . y , C ) ;
aa . x = fa . x ; aa . y = fa . y } aa . x *= o ; aa . y *= o ; return aa } function A ( T ) { h ( 0 , E . textContent . length ) ; $ ( this ) . unbind ( T ) } function v ( T ) { if ( V && E ) { var X = P ( T . pageX , T . pageY , qb ) ; X = w ( X . x * o , X . y * o ) ; X = l ( X . x , X . y ) ; var aa = E . textContent , fa = aa . substr ( 0 , X ) . replace ( /[a-z0-9]+$/i , "" ) . length ; aa = aa . substr ( X ) . match ( /^[a-z0-9]+/i ) ; h ( fa , ( aa ? aa [ 0 ] . length : 0 ) + X ) ; $ ( T . target ) . click ( A ) ; setTimeout ( function ( ) { $ ( T . target ) . unbind ( "click" , A ) } , 300 ) } } var E , I , D , G , L , k = [ ] , u , C , F , O , V ; return { select : function ( T , X , aa ) { E = T ; eb . toEditMode ( X , aa ) } , start : function ( T ) { E =
T ; eb . toEditMode ( ) } , mouseDown : function ( T , X , aa , fa ) { T = w ( aa , fa ) ; I . focus ( ) ; e ( l ( T . x , T . y ) ) ; F = aa ; O = fa } , mouseMove : function ( T , X ) { if ( ! ( evt . originalEvent . touches && evt . originalEvent . touches . length > 1 ) ) { var aa = w ( T , X ) ; z ( aa . x , aa . y ) } } , mouseUp : function ( T , X , aa ) { var fa = w ( X , aa ) ; z ( fa . x , fa . y , true ) ; T . target !== E && X < F + 2 && X > F - 2 && aa < O + 2 && aa > O - 2 && eb . toSelectMode ( true ) } , setCursor : e , toEditMode : function ( T , X ) { V = false ; Ba = "textedit" ; Ca . requestSelector ( E ) . showGrips ( false ) ; Ca . requestSelector ( E ) ; eb . init ( ) ; $ ( E ) . css ( "cursor" , "text" ) ; if ( arguments . length ) { var aa =
w ( T , X ) ; e ( l ( aa . x , aa . y ) ) } else e ( ) ; setTimeout ( function ( ) { V = true } , 300 ) } , toSelectMode : function ( T ) { Ba = "select" ; clearInterval ( L ) ; L = null ; G && $ ( G ) . attr ( "display" , "none" ) ; D && $ ( D ) . attr ( "visibility" , "hidden" ) ; $ ( E ) . css ( "cursor" , "move" ) ; if ( T ) { Ra ( ) ; $ ( E ) . css ( "cursor" , "move" ) ; N ( "selected" , [ E ] ) ; ub ( [ E ] , true ) } E && ! E . textContent . length && b . deleteSelectedElements ( ) ; $ ( I ) . blur ( ) ; E = false } , setInputElem : function ( T ) { I = T } , clear : function ( ) { Ba == "textedit" && eb . toSelectMode ( ) } , init : function ( ) { if ( E ) { if ( ! E . parentNode ) { E = J [ 0 ] ; Ca . requestSelector ( E ) . showGrips ( false ) } var T =
E . textContent . length , X = E . getAttribute ( "transform" ) ; u = svgedit . utilities . getBBox ( E ) ; C = X ? ba ( E ) : null ; k = Array ( T ) ; I . focus ( ) ; $ ( E ) . unbind ( "dblclick" , v ) . dblclick ( v ) ; if ( ! T ) var aa = { x : u . x + u . width / 2 , width : 0 } ; for ( X = 0 ; X < T ; X ++ ) { var fa = E . getStartPositionOfChar ( X ) ; aa = E . getEndPositionOfChar ( X ) ; if ( ! svgedit . browser . supportsGoodTextCharPos ( ) ) { var ra = b . contentW * o ; fa . x -= ra ; aa . x -= ra ; fa . x /= o ; aa . x /= o } k [ X ] = { x : fa . x , y : u . y , width : aa . x - fa . x , height : u . height } } k . push ( { x : aa . x , width : 0 } ) ; h ( I . selectionStart , I . selectionEnd , true ) } } } } ( ) , Ja =
b . pathActions = function ( ) { var e = false , h , l , z ; svgedit . path . Path . prototype . endChanges = function ( A ) { if ( svgedit . browser . isWebkit ( ) ) { var v = this . elem ; v . setAttribute ( "d" , Ja . convertPath ( v ) ) } A = new Ka ( this . elem , { d : this . last _d } , A ) ; ya ( A ) ; N ( "changed" , [ this . elem ] ) } ; svgedit . path . Path . prototype . addPtsToSelection = function ( A ) { $ . isArray ( A ) || ( A = [ A ] ) ; for ( var v = 0 ; v < A . length ; v ++ ) { var E = A [ v ] , I = this . segs [ E ] ; I . ptgrip && this . selected _pts . indexOf ( E ) == - 1 && E >= 0 && this . selected _pts . push ( E ) } this . selected _pts . sort ( ) ; v = this . selected _pts . length ;
for ( A = Array ( v ) ; v -- ; ) { I = this . segs [ this . selected _pts [ v ] ] ; I . select ( true ) ; A [ v ] = I . ptgrip } Ja . canDeleteNodes = true ; Ja . closed _subpath = this . subpathIsClosed ( this . selected _pts [ 0 ] ) ; N ( "selected" , A ) } ; var w = h = null , H = false ; return { mouseDown : function ( A , v , E , I ) { if ( Ba === "path" ) { mouse _x = E ; mouse _y = I ; I = mouse _x / o ; v = mouse _y / o ; E = pa ( "path_stretch_line" ) ; l = [ I , v ] ; if ( n . gridSnapping ) { I = wa ( I ) ; v = wa ( v ) ; mouse _x = wa ( mouse _x ) ; mouse _y = wa ( mouse _y ) } if ( ! E ) { E = document . createElementNS ( c , "path" ) ; na ( E , { id : "path_stretch_line" , stroke : "#22C" , "stroke-width" : "0.5" ,
fill : "none" } ) ; E = pa ( "selectorParentGroup" ) . appendChild ( E ) } E . setAttribute ( "display" , "inline" ) ; var D = null ; if ( w ) { D = w . pathSegList ; for ( var G = D . numberOfItems , L = 6 / o , k = false ; G ; ) { G -- ; var u = D . getItem ( G ) , C = u . x ; u = u . y ; if ( I >= C - L && I <= C + L && v >= u - L && v <= u + L ) { k = true ; break } } L = ca ( ) ; svgedit . path . removePath _ ( L ) ; L = pa ( L ) ; C = D . numberOfItems ; if ( k ) { if ( G <= 1 && C >= 2 ) { I = D . getItem ( 0 ) . x ; v = D . getItem ( 0 ) . y ; A = E . pathSegList . getItem ( 1 ) ; A = A . pathSegType === 4 ? w . createSVGPathSegLinetoAbs ( I , v ) : w . createSVGPathSegCurvetoCubicAbs ( I , v , A . x1 / o , A . y1 / o ,
I , v ) ; I = w . createSVGPathSegClosePath ( ) ; D . appendItem ( A ) ; D . appendItem ( I ) } else if ( C < 3 ) return D = false ; $ ( E ) . remove ( ) ; element = L ; w = null ; Ma = false ; if ( e ) { svgedit . path . path . matrix && bb ( L , { } , svgedit . path . path . matrix . inverse ( ) ) ; E = L . getAttribute ( "d" ) ; A = $ ( svgedit . path . path . elem ) . attr ( "d" ) ; $ ( svgedit . path . path . elem ) . attr ( "d" , A + E ) ; $ ( L ) . remove ( ) ; svgedit . path . path . matrix && svgedit . path . recalcRotatedPath ( ) ; svgedit . path . path . init ( ) ; Ja . toEditMode ( svgedit . path . path . elem ) ; svgedit . path . path . selectPt ( ) ; return false } } else { if ( ! $ . contains ( a ,
ob ( A ) ) ) { console . log ( "Clicked outside canvas" ) ; return false } D = w . pathSegList . numberOfItems ; G = w . pathSegList . getItem ( D - 1 ) ; L = G . x ; G = G . y ; if ( A . shiftKey ) { A = U ( L , G , I , v ) ; I = A . x ; v = A . y } A = E . pathSegList . getItem ( 1 ) ; A = A . pathSegType === 4 ? w . createSVGPathSegLinetoAbs ( gb ( I ) , gb ( v ) ) : w . createSVGPathSegCurvetoCubicAbs ( gb ( I ) , gb ( v ) , A . x1 / o , A . y1 / o , A . x2 / o , A . y2 / o ) ; w . pathSegList . appendItem ( A ) ; I *= o ; v *= o ; E . setAttribute ( "d" , [ "M" , I , v , I , v ] . join ( " " ) ) ; E = D ; if ( e ) E += svgedit . path . path . segs . length ; svgedit . path . addPointGrip ( E , I , v ) } } else { d _attr =
"M" + I + "," + v + " " ; w = Q ( { element : "path" , curStyles : true , attr : { d : d _attr , id : la ( ) , opacity : M . opacity / 2 } } ) ; E . setAttribute ( "d" , [ "M" , mouse _x , mouse _y , mouse _x , mouse _y ] . join ( " " ) ) ; E = e ? svgedit . path . path . segs . length : 0 ; svgedit . path . addPointGrip ( E , mouse _x , mouse _y ) } } else if ( svgedit . path . path ) { svgedit . path . path . storeD ( ) ; L = A . target . id ; if ( L . substr ( 0 , 14 ) == "pathpointgrip_" ) { v = svgedit . path . path . cur _pt = parseInt ( L . substr ( 14 ) ) ; svgedit . path . path . dragging = [ E , I ] ; D = svgedit . path . path . segs [ v ] ; if ( A . shiftKey ) D . selected ? svgedit . path . path . removePtFromSelection ( v ) :
svgedit . path . path . addPtsToSelection ( v ) ; else { if ( svgedit . path . path . selected _pts . length <= 1 || ! D . selected ) svgedit . path . path . clearSelection ( ) ; svgedit . path . path . addPtsToSelection ( v ) } } else if ( L . indexOf ( "ctrlpointgrip_" ) == 0 ) { svgedit . path . path . dragging = [ E , I ] ; A = L . split ( "_" ) [ 1 ] . split ( "c" ) ; v = A [ 0 ] - 0 ; svgedit . path . path . selectPt ( v , A [ 1 ] - 0 ) } if ( ! svgedit . path . path . dragging ) { if ( sa == null ) sa = Ca . getRubberBandBox ( ) ; na ( sa , { x : E * o , y : I * o , width : 0 , height : 0 , display : "inline" } , 100 ) } } } , mouseMove : function ( A , v , E ) { if ( ! ( A . originalEvent . touches &&
A . originalEvent . touches . length > 1 ) ) { H = true ; if ( Ba === "path" ) { if ( w ) { var I = w . pathSegList ; A = I . numberOfItems - 1 ; if ( l ) { var D = svgedit . path . addCtrlGrip ( "1c1" ) , G = svgedit . path . addCtrlGrip ( "0c2" ) ; G . getAttribute ( "cx" ) ; G . getAttribute ( "cy" ) ; D . setAttribute ( "cx" , v ) ; D . setAttribute ( "cy" , E ) ; D . setAttribute ( "display" , "inline" ) ; D = l [ 0 ] ; var L = l [ 1 ] ; I . getItem ( A ) ; var k = D + ( D - v / o ) , u = L + ( L - E / o ) ; G . setAttribute ( "cx" , k * o ) ; G . setAttribute ( "cy" , u * o ) ; G . setAttribute ( "display" , "inline" ) ; G = svgedit . path . getCtrlLine ( 1 ) ; var C = svgedit . path . getCtrlLine ( 2 ) ;
na ( G , { x1 : v , y1 : E , x2 : D * o , y2 : L * o , display : "inline" } ) ; na ( C , { x1 : k * o , y1 : u * o , x2 : D * o , y2 : L * o , display : "inline" } ) ; if ( A === 0 ) z = [ v , E ] ; else { I = I . getItem ( A - 1 ) ; v = I . x ; E = I . y ; if ( I . pathSegType === 6 ) { v += v - I . x2 ; E += E - I . y2 } else if ( z ) { v = z [ 0 ] / o ; E = z [ 1 ] / o } svgedit . path . replacePathSeg ( 6 , A , [ D , L , v , E , k , u ] , w ) } } else if ( D = pa ( "path_stretch_line" ) ) { A = I . getItem ( A ) ; if ( A . pathSegType === 6 ) svgedit . path . replacePathSeg ( 6 , 1 , [ v , E , ( A . x + ( A . x - A . x2 ) ) * o , ( A . y + ( A . y - A . y2 ) ) * o , v , E ] , D ) ; else z ? svgedit . path . replacePathSeg ( 6 , 1 , [ v , E , z [ 0 ] , z [ 1 ] , v , E ] , D ) : svgedit . path . replacePathSeg ( 4 ,
1 , [ v , E ] , D ) } } } else if ( svgedit . path . path . dragging ) { D = svgedit . path . getPointFromGrip ( { x : svgedit . path . path . dragging [ 0 ] , y : svgedit . path . path . dragging [ 1 ] } , svgedit . path . path ) ; L = svgedit . path . getPointFromGrip ( { x : v , y : E } , svgedit . path . path ) ; A = L . x - D . x ; D = L . y - D . y ; svgedit . path . path . dragging = [ v , E ] ; svgedit . path . path . dragctrl ? svgedit . path . path . moveCtrl ( A , D ) : svgedit . path . path . movePts ( A , D ) } else { svgedit . path . path . selected _pts = [ ] ; svgedit . path . path . eachSeg ( function ( ) { if ( this . next || this . prev ) { var F = sa . getBBox ( ) , O = svgedit . path . getGripPt ( this ) ;
F = svgedit . math . rectsIntersect ( F , { x : O . x , y : O . y , width : 0 , height : 0 } ) ; this . select ( F ) ; F && svgedit . path . path . selected _pts . push ( this . index ) } } ) } } } , mouseUp : function ( A , v ) { if ( Ba === "path" ) { l = null ; if ( ! w ) { v = pa ( ca ( ) ) ; Ma = false ; z = null } return { keep : true , element : v } } if ( svgedit . path . path . dragging ) { var E = svgedit . path . path . cur _pt ; svgedit . path . path . dragging = false ; svgedit . path . path . dragctrl = false ; svgedit . path . path . update ( ) ; H && svgedit . path . path . endChanges ( "Move path point(s)" ) ; ! A . shiftKey && ! H && svgedit . path . path . selectPt ( E ) } else if ( sa &&
sa . getAttribute ( "display" ) != "none" ) { sa . setAttribute ( "display" , "none" ) ; sa . getAttribute ( "width" ) <= 2 && sa . getAttribute ( "height" ) <= 2 && Ja . toSelectMode ( A . target ) } else Ja . toSelectMode ( A . target ) ; H = false } , toEditMode : function ( A ) { svgedit . path . path = svgedit . path . getPath _ ( A ) ; Ba = "pathedit" ; Ra ( ) ; svgedit . path . path . show ( true ) . update ( ) ; svgedit . path . path . oldbbox = svgedit . utilities . getBBox ( svgedit . path . path . elem ) ; e = false } , toSelectMode : function ( A ) { var v = A == svgedit . path . path . elem ; Ba = "select" ; svgedit . path . path . show ( false ) ;
h = false ; Ra ( ) ; svgedit . path . path . matrix && svgedit . path . recalcRotatedPath ( ) ; if ( v ) { N ( "selected" , [ A ] ) ; ub ( [ A ] , true ) } } , addSubPath : function ( A ) { if ( A ) { Ba = "path" ; e = true } else { Ja . clear ( true ) ; Ja . toEditMode ( svgedit . path . path . elem ) } } , select : function ( A ) { if ( h === A ) { Ja . toEditMode ( A ) ; Ba = "pathedit" } else h = A } , reorient : function ( ) { var A = J [ 0 ] ; if ( A ) if ( oa ( A ) != 0 ) { var v = new Ea ( "Reorient path" ) , E = { d : A . getAttribute ( "d" ) , transform : A . getAttribute ( "transform" ) } ; v . addSubCommand ( new Ka ( A , E ) ) ; Ra ( ) ; this . resetOrientation ( A ) ; ya ( v ) ; svgedit . path . getPath _ ( A ) . show ( false ) . matrix =
null ; this . clear ( ) ; ub ( [ A ] , true ) ; N ( "changed" , J ) } } , clear : function ( ) { h = null ; if ( w ) { var A = pa ( ca ( ) ) ; $ ( pa ( "path_stretch_line" ) ) . remove ( ) ; $ ( A ) . remove ( ) ; $ ( pa ( "pathpointgrip_container" ) ) . find ( "*" ) . attr ( "display" , "none" ) ; w = z = null ; Ma = false } else Ba == "pathedit" && this . toSelectMode ( ) ; svgedit . path . path && svgedit . path . path . init ( ) . show ( false ) } , resetOrientation : function ( A ) { if ( A == null || A . nodeName != "path" ) return false ; var v = Y ( A ) , E = ga ( v ) . matrix ; v . clear ( ) ; A . removeAttribute ( "transform" ) ; v = A . pathSegList ; for ( var I = v . numberOfItems ,
D = 0 ; D < I ; ++ D ) { var G = v . getItem ( D ) , L = G . pathSegType ; if ( L != 1 ) { var k = [ ] ; $ . each ( [ "" , 1 , 2 ] , function ( u , C ) { var F = G [ "x" + C ] , O = G [ "y" + C ] ; if ( F !== undefined && O !== undefined ) { F = P ( F , O , E ) ; k . splice ( k . length , 0 , F . x , F . y ) } } ) ; svgedit . path . replacePathSeg ( L , D , k , A ) } } g ( A , E ) } , zoomChange : function ( ) { Ba == "pathedit" && svgedit . path . path . update ( ) } , getNodePoint : function ( ) { var A = svgedit . path . path . segs [ svgedit . path . path . selected _pts . length ? svgedit . path . path . selected _pts [ 0 ] : 1 ] ; return { x : A . item . x , y : A . item . y , type : A . type } } , linkControlPoints : function ( A ) { svgedit . path . setLinkControlPoints ( A ) } ,
clonePathNode : function ( ) { svgedit . path . path . storeD ( ) ; for ( var A = svgedit . path . path . selected _pts , v = A . length , E = [ ] ; v -- ; ) { var I = A [ v ] ; svgedit . path . path . addSeg ( I ) ; E . push ( I + v ) ; E . push ( I + v + 1 ) } svgedit . path . path . init ( ) . addPtsToSelection ( E ) ; svgedit . path . path . endChanges ( "Clone path node(s)" ) } , opencloseSubPath : function ( ) { var A = svgedit . path . path . selected _pts ; if ( A . length === 1 ) { var v = svgedit . path . path . elem , E = v . pathSegList , I = A [ 0 ] , D = null , G = null ; svgedit . path . path . eachSeg ( function ( C ) { if ( this . type === 2 && C <= I ) G = this . item ; if ( C <=
I ) return true ; if ( this . type === 2 ) { D = C ; return false } else if ( this . type === 1 ) return D = false } ) ; if ( D == null ) D = svgedit . path . path . segs . length - 1 ; if ( D !== false ) { var L = v . createSVGPathSegLinetoAbs ( G . x , G . y ) , k = v . createSVGPathSegClosePath ( ) ; if ( D == svgedit . path . path . segs . length - 1 ) { E . appendItem ( L ) ; E . appendItem ( k ) } else { svgedit . path . insertItemBefore ( v , k , D ) ; svgedit . path . insertItemBefore ( v , L , D ) } svgedit . path . path . init ( ) . selectPt ( D + 1 ) } else if ( svgedit . path . path . segs [ I ] . mate ) { E . removeItem ( I ) ; E . removeItem ( I ) ; svgedit . path . path . init ( ) . selectPt ( I -
1 ) } else { for ( A = 0 ; A < E . numberOfItems ; A ++ ) { var u = E . getItem ( A ) ; if ( u . pathSegType === 2 ) L = A ; else if ( A === I ) E . removeItem ( L ) ; else if ( u . pathSegType === 1 && I < A ) { k = A - 1 ; E . removeItem ( A ) ; break } } for ( A = I - L - 1 ; A -- ; ) svgedit . path . insertItemBefore ( v , E . getItem ( L ) , k ) ; v = E . getItem ( L ) ; svgedit . path . replacePathSeg ( 2 , L , [ v . x , v . y ] ) ; A = I ; svgedit . path . path . init ( ) . selectPt ( 0 ) } } } , deletePathNode : function ( ) { if ( Ja . canDeleteNodes ) { svgedit . path . path . storeD ( ) ; for ( var A = svgedit . path . path . selected _pts , v = A . length ; v -- ; ) svgedit . path . path . deleteSeg ( A [ v ] ) ;
var E = function ( ) { var I = svgedit . path . path . elem . pathSegList , D = I . numberOfItems , G = function ( u , C ) { for ( ; C -- ; ) I . removeItem ( u ) } ; if ( D <= 1 ) return true ; for ( ; D -- ; ) { var L = I . getItem ( D ) ; if ( L . pathSegType === 1 ) { L = I . getItem ( D - 1 ) ; var k = I . getItem ( D - 2 ) ; if ( L . pathSegType === 2 ) { G ( D - 1 , 2 ) ; E ( ) ; break } else if ( k . pathSegType === 2 ) { G ( D - 2 , 3 ) ; E ( ) ; break } } else if ( L . pathSegType === 2 ) if ( D > 0 ) { L = I . getItem ( D - 1 ) . pathSegType ; if ( L === 2 ) { G ( D - 1 , 1 ) ; E ( ) ; break } else if ( L === 1 && I . numberOfItems - 1 === D ) { G ( D , 1 ) ; E ( ) ; break } } } return false } ; E ( ) ; if ( svgedit . path . path . elem . pathSegList . numberOfItems <=
1 ) { Ja . toSelectMode ( svgedit . path . path . elem ) ; b . deleteSelectedElements ( ) } else { svgedit . path . path . init ( ) ; svgedit . path . path . clearSelection ( ) ; if ( window . opera ) { A = $ ( svgedit . path . path . elem ) ; A . attr ( "d" , A . attr ( "d" ) ) } svgedit . path . path . endChanges ( "Delete path node(s)" ) } } } , smoothPolylineIntoPath : function ( A ) { var v = A . points , E = v . numberOfItems ; if ( E >= 4 ) { var I = v . getItem ( 0 ) , D = null ; A = [ ] ; A . push ( [ "M" , I . x , "," , I . y , " C" ] . join ( "" ) ) ; for ( var G = 1 ; G <= E - 4 ; G += 3 ) { var L = v . getItem ( G ) , k = v . getItem ( G + 1 ) , u = v . getItem ( G + 2 ) ; if ( D ) if ( ( I = svgedit . path . smoothControlPoints ( D ,
L , I ) ) && I . length == 2 ) { L = A [ A . length - 1 ] . split ( "," ) ; L [ 2 ] = I [ 0 ] . x ; L [ 3 ] = I [ 0 ] . y ; A [ A . length - 1 ] = L . join ( "," ) ; L = I [ 1 ] } A . push ( [ L . x , L . y , k . x , k . y , u . x , u . y ] . join ( "," ) ) ; I = u ; D = k } for ( A . push ( "L" ) ; G < E ; ++ G ) { k = v . getItem ( G ) ; A . push ( [ k . x , k . y ] . join ( "," ) ) } A = A . join ( " " ) ; A = Q ( { element : "path" , curStyles : true , attr : { id : ca ( ) , d : A , fill : "none" } } ) } return A } , setSegType : function ( A ) { svgedit . path . path . setSegType ( A ) } , moveNode : function ( A , v ) { var E = svgedit . path . path . selected _pts ; if ( E . length ) { svgedit . path . path . storeD ( ) ; E = svgedit . path . path . segs [ E [ 0 ] ] ;
var I = { x : 0 , y : 0 } ; I [ A ] = v - E . item [ A ] ; E . move ( I . x , I . y ) ; svgedit . path . path . endChanges ( "Move path point" ) } } , fixEnd : function ( A ) { for ( var v = A . pathSegList , E = v . numberOfItems , I , D = 0 ; D < E ; ++ D ) { var G = v . getItem ( D ) ; if ( G . pathSegType === 2 ) I = G ; if ( G . pathSegType === 1 ) { G = v . getItem ( D - 1 ) ; if ( G . x != I . x || G . y != I . y ) { v = A . createSVGPathSegLinetoAbs ( I . x , I . y ) ; svgedit . path . insertItemBefore ( A , v , D ) ; Ja . fixEnd ( A ) ; break } } } svgedit . browser . isWebkit ( ) && A . setAttribute ( "d" , Ja . convertPath ( A ) ) } , convertPath : function ( A , v ) { for ( var E = A . pathSegList , I = E . numberOfItems ,
D = 0 , G = 0 , L = "" , k = null , u = 0 ; u < I ; ++ u ) { var C = E . getItem ( u ) , F = C . x || 0 , O = C . y || 0 , V = C . x1 || 0 , T = C . y1 || 0 , X = C . x2 || 0 , aa = C . y2 || 0 , fa = C . pathSegType , ra = Oa [ fa ] [ "to" + ( v ? "Lower" : "Upper" ) + "Case" ] ( ) , Pa = function ( Da , ha , $a ) { ha = ha ? " " + ha . join ( " " ) : "" ; $a = $a ? " " + svgedit . units . shortFloat ( $a ) : "" ; $ . each ( Da , function ( Sa , ta ) { Da [ Sa ] = svgedit . units . shortFloat ( ta ) } ) ; L += ra + Da . join ( " " ) + ha + $a } ; switch ( fa ) { case 1 : L += "z" ; break ; case 12 : F -= D ; case 13 : if ( v ) { D += F ; ra = "l" } else { F += D ; D = F ; ra = "L" } Pa ( [ [ F , G ] ] ) ; break ; case 14 : O -= G ; case 15 : if ( v ) { G += O ; ra = "l" } else { O +=
G ; G = O ; ra = "L" } Pa ( [ [ D , O ] ] ) ; break ; case 2 : case 4 : case 18 : F -= D ; O -= G ; case 5 : case 3 : if ( k && E . getItem ( u - 1 ) . pathSegType === 1 && ! v ) { D = k [ 0 ] ; G = k [ 1 ] } case 19 : if ( v ) { D += F ; G += O } else { F += D ; O += G ; D = F ; G = O } if ( fa === 3 ) k = [ D , G ] ; Pa ( [ [ F , O ] ] ) ; break ; case 6 : F -= D ; V -= D ; X -= D ; O -= G ; T -= G ; aa -= G ; case 7 : if ( v ) { D += F ; G += O } else { F += D ; V += D ; X += D ; O += G ; T += G ; aa += G ; D = F ; G = O } Pa ( [ [ V , T ] , [ X , aa ] , [ F , O ] ] ) ; break ; case 8 : F -= D ; V -= D ; O -= G ; T -= G ; case 9 : if ( v ) { D += F ; G += O } else { F += D ; V += D ; O += G ; T += G ; D = F ; G = O } Pa ( [ [ V , T ] , [ F , O ] ] ) ; break ; case 10 : F -= D ; O -= G ; case 11 : if ( v ) { D += F ; G += O } else { F +=
D ; O += G ; D = F ; G = O } Pa ( [ [ C . r1 , C . r2 ] ] , [ C . angle , C . largeArcFlag ? 1 : 0 , C . sweepFlag ? 1 : 0 ] , [ F , O ] ) ; break ; case 16 : F -= D ; X -= D ; O -= G ; aa -= G ; case 17 : if ( v ) { D += F ; G += O } else { F += D ; X += D ; O += G ; aa += G ; D = F ; G = O } Pa ( [ [ X , aa ] , [ F , O ] ] ) } } return L } } } ( ) , Pb = this . removeUnusedDefElems = function ( ) { var e = m . getElementsByTagNameNS ( c , "defs" ) ; if ( ! e || ! e . length ) return 0 ; for ( var h = [ ] , l = 0 , z = [ "fill" , "stroke" , "filter" , "marker-start" , "marker-mid" , "marker-end" ] , w = z . length , H = m . getElementsByTagNameNS ( c , "*" ) , A = H . length , v = 0 ; v < A ; v ++ ) { for ( var E = H [ v ] , I = 0 ; I < w ; I ++ ) { var D =
ka ( E . getAttribute ( z [ I ] ) ) ; D && h . push ( D . substr ( 1 ) ) } ( E = da ( E ) ) && E . indexOf ( "#" ) === 0 && h . push ( E . substr ( 1 ) ) } e = $ ( e ) . find ( "linearGradient, radialGradient, filter, marker, svg, symbol" ) ; defelem _ids = [ ] ; for ( v = e . length ; v -- ; ) { z = e [ v ] ; w = z . id ; if ( h . indexOf ( w ) < 0 ) { vb [ w ] = z ; z . parentNode . removeChild ( z ) ; l ++ } } return l } ; this . svgCanvasToString = function ( ) { for ( ; Pb ( ) > 0 ; ) ; Ja . clear ( true ) ; $ . each ( m . childNodes , function ( l , z ) { l && z . nodeType === 8 && z . data . indexOf ( "Created with" ) >= 0 && m . insertBefore ( z , m . firstChild ) } ) ; if ( K ) { Jb ( ) ; Cb ( [ K ] ) } var e =
[ ] ; $ ( m ) . find ( "g:data(gsvg)" ) . each ( function ( ) { for ( var l = this . attributes , z = l . length , w = 0 ; w < z ; w ++ ) if ( l [ w ] . nodeName == "id" || l [ w ] . nodeName == "style" ) z -- ; if ( z <= 0 ) { l = this . firstChild ; e . push ( l ) ; $ ( this ) . replaceWith ( l ) } } ) ; var h = this . svgToString ( m , 0 ) ; e . length && $ ( e ) . each ( function ( ) { Bb ( this ) } ) ; return h } ; this . svgToString = function ( e , h ) { var l = [ ] , z = svgedit . utilities . toXml , w = n . baseUnit , H = RegExp ( "^-?[\\d\\.]+" + w + "$" ) ; if ( e ) { ma ( e ) ; var A = e . attributes , v , E , I = e . childNodes ; for ( E = 0 ; E < h ; E ++ ) l . push ( " " ) ; l . push ( "<" ) ; l . push ( e . nodeName ) ;
if ( e . id === "svgcontent" ) { E = Db ( ) ; if ( w !== "px" ) { E . w = svgedit . units . convertUnit ( E . w , w ) + w ; E . h = svgedit . units . convertUnit ( E . h , w ) + w } l . push ( ' width="' + E . w + '" height="' + E . h + '" xmlns="' + c + '"' ) ; var D = { } ; $ ( e ) . find ( "*" ) . andSelf ( ) . each ( function ( ) { $ . each ( this . attributes , function ( u , C ) { var F = C . namespaceURI ; if ( F && ! D [ F ] && za [ F ] !== "xmlns" && za [ F ] !== "xml" ) { D [ F ] = true ; l . push ( " xmlns:" + za [ F ] + '="' + F + '"' ) } } ) } ) ; E = A . length ; for ( w = [ "width" , "height" , "xmlns" , "x" , "y" , "viewBox" , "id" , "overflow" ] ; E -- ; ) { v = A . item ( E ) ; var G = z ( v . nodeValue ) ; if ( v . nodeName . indexOf ( "xmlns:" ) !==
0 ) if ( G != "" && w . indexOf ( v . localName ) == - 1 ) if ( ! v . namespaceURI || za [ v . namespaceURI ] ) { l . push ( " " ) ; l . push ( v . nodeName ) ; l . push ( '="' ) ; l . push ( G ) ; l . push ( '"' ) } } } else { if ( e . nodeName === "defs" && ! e . firstChild ) return ; var L = [ "-moz-math-font-style" , "_moz-math-font-style" ] ; for ( E = A . length - 1 ; E >= 0 ; E -- ) { v = A . item ( E ) ; G = z ( v . nodeValue ) ; if ( ! ( L . indexOf ( v . localName ) >= 0 ) ) if ( G != "" ) if ( G . indexOf ( "pointer-events" ) !== 0 ) if ( ! ( v . localName === "class" && G . indexOf ( "se_" ) === 0 ) ) { l . push ( " " ) ; if ( v . localName === "d" ) G = Ja . convertPath ( e , true ) ; if ( isNaN ( G ) ) { if ( H . test ( G ) ) G =
svgedit . units . shortFloat ( G ) + w } else G = svgedit . units . shortFloat ( G ) ; if ( fb . apply && e . nodeName === "image" && v . localName === "href" && fb . images && fb . images === "embed" ) { var k = Ya [ G ] ; if ( k ) G = k } if ( ! v . namespaceURI || v . namespaceURI == c || za [ v . namespaceURI ] ) { l . push ( v . nodeName ) ; l . push ( '="' ) ; l . push ( G ) ; l . push ( '"' ) } } } } if ( e . hasChildNodes ( ) ) { l . push ( ">" ) ; h ++ ; A = false ; for ( E = 0 ; E < I . length ; E ++ ) { w = I . item ( E ) ; switch ( w . nodeType ) { case 1 : l . push ( "\n" ) ; l . push ( this . svgToString ( I . item ( E ) , h ) ) ; break ; case 3 : w = w . nodeValue . replace ( /^\s+|\s+$/g , "" ) ;
if ( w != "" ) { A = true ; l . push ( z ( w ) + "" ) } break ; case 4 : l . push ( "\n" ) ; l . push ( Array ( h + 1 ) . join ( " " ) ) ; l . push ( "<![CDATA[" ) ; l . push ( w . nodeValue ) ; l . push ( "]]\>" ) ; break ; case 8 : l . push ( "\n" ) ; l . push ( Array ( h + 1 ) . join ( " " ) ) ; l . push ( "<!--" ) ; l . push ( w . data ) ; l . push ( "--\>" ) } } h -- ; if ( ! A ) { l . push ( "\n" ) ; for ( E = 0 ; E < h ; E ++ ) l . push ( " " ) } l . push ( "</" ) ; l . push ( e . nodeName ) ; l . push ( ">" ) } else l . push ( "/>" ) } return l . join ( "" ) } ; this . embedImage = function ( e , h ) { $ ( new Image ) . load ( function ( ) { var l = document . createElement ( "canvas" ) ; l . width = this . width ; l . height =
this . height ; l . getContext ( "2d" ) . drawImage ( this , 0 , 0 ) ; try { var z = ";svgedit_url=" + encodeURIComponent ( e ) ; z = l . toDataURL ( ) . replace ( ";base64" , z + ";base64" ) ; Ya [ e ] = z } catch ( w ) { Ya [ e ] = false } Aa = e ; h && h ( Ya [ e ] ) } ) . attr ( "src" , e ) } ; this . setGoodImage = function ( e ) { Aa = e } ; this . open = function ( ) { } ; this . save = function ( e ) { Ra ( ) ; e && $ . extend ( fb , e ) ; fb . apply = true ; e = this . svgCanvasToString ( ) ; N ( "saved" , e ) } ; this . rasterExport = function ( ) { Ra ( ) ; var e = [ ] , h = { feGaussianBlur : Va . exportNoBlur , foreignObject : Va . exportNoforeignObject , "[stroke-dasharray]" : Va . exportNoDashArray } ,
l = $ ( m ) ; if ( ! ( "font" in $ ( "<canvas>" ) [ 0 ] . getContext ( "2d" ) ) ) h . text = Va . exportNoText ; $ . each ( h , function ( z , w ) { l . find ( z ) . length && e . push ( w ) } ) ; h = this . svgCanvasToString ( ) ; N ( "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 Mb = this . uniquifyElems = function ( e ) { var h = { } , l = [ "filter" , "linearGradient" , "pattern" , "radialGradient" ,
"symbol" , "textPath" , "use" ] ; svgedit . utilities . walkTree ( e , function ( v ) { if ( v . nodeType == 1 ) { if ( v . id ) { v . id in h || ( h [ v . id ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ v . id ] . elem = v } $ . each ( yb , function ( I , D ) { var G = v . getAttributeNode ( D ) ; if ( G ) { var L = svgedit . utilities . getUrlFromAttr ( G . value ) ; if ( L = L ? L . substr ( 1 ) : null ) { L in h || ( h [ L ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ L ] . attrs . push ( G ) } } } ) ; var E = svgedit . utilities . getHref ( v ) ; if ( E && l . indexOf ( v . nodeName ) >= 0 ) if ( E = E . substr ( 1 ) ) { E in h || ( h [ E ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ E ] . hrefs . push ( v ) } } } ) ;
for ( var z in h ) if ( z ) { var w = h [ z ] . elem ; if ( w ) { e = la ( ) ; w . id = e ; w = h [ z ] . attrs ; for ( var H = w . length ; H -- ; ) { var A = w [ H ] ; A . ownerElement . setAttribute ( A . name , "url(#" + e + ")" ) } w = h [ z ] . hrefs ; for ( H = w . length ; H -- ; ) svgedit . utilities . setHref ( w [ H ] , "#" + e ) } } } , Kb = this . setUseData = function ( e ) { var h = $ ( e ) ; if ( e . tagName !== "use" ) h = h . find ( "use" ) ; h . each ( function ( ) { var l = da ( this ) . substr ( 1 ) ; if ( l = pa ( l ) ) { $ ( this ) . data ( "ref" , l ) ; if ( l . tagName == "symbol" || l . tagName == "svg" ) $ ( this ) . data ( "symbol" , l ) . data ( "ref" , l ) } } ) } , Eb = this . convertGradients = function ( e ) { var h =
$ ( e ) . find ( "linearGradient, radialGradient" ) ; if ( ! h . length && svgedit . browser . isWebkit ( ) ) h = $ ( e ) . find ( "*" ) . filter ( function ( ) { return this . tagName . indexOf ( "Gradient" ) >= 0 } ) ; h . each ( function ( ) { if ( $ ( this ) . attr ( "gradientUnits" ) === "userSpaceOnUse" ) { var l = $ ( m ) . find ( '[fill="url(#' + this . id + ')"],[stroke="url(#' + this . id + ')"]' ) ; if ( l . length ) if ( l = svgedit . utilities . getBBox ( l [ 0 ] ) ) if ( this . tagName === "linearGradient" ) { var z = $ ( this ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) , w = this . gradientTransform . baseVal ; if ( w && w . numberOfItems > 0 ) { var H =
ga ( w ) . matrix ; w = P ( z . x1 , z . y1 , H ) ; H = P ( z . x2 , z . y2 , H ) ; z . x1 = w . x ; z . y1 = w . y ; z . x2 = H . x ; z . y2 = H . y ; this . removeAttribute ( "gradientTransform" ) } $ ( this ) . attr ( { x1 : ( z . x1 - l . x ) / l . width , y1 : ( z . y1 - l . y ) / l . height , x2 : ( z . x2 - l . x ) / l . width , y2 : ( z . y2 - l . y ) / l . height } ) ; this . removeAttribute ( "gradientUnits" ) } } } ) } , Qb = this . convertToGroup = function ( e ) { e || ( e = J [ 0 ] ) ; var h = $ ( e ) , l = new Ea , z ; if ( h . data ( "gsvg" ) ) { l = $ ( e . firstChild ) . attr ( [ "x" , "y" ] ) ; $ ( e . firstChild . firstChild ) . unwrap ( ) ; $ ( e ) . removeData ( "gsvg" ) ; z = Y ( e ) ; var w = d . createSVGTransform ( ) ; w . setTranslate ( l . x ,
l . y ) ; z . appendItem ( w ) ; Wa ( e ) ; N ( "selected" , [ e ] ) } else if ( h . data ( "symbol" ) ) { e = h . data ( "symbol" ) ; z = h . attr ( "transform" ) ; w = h . attr ( [ "x" , "y" ] ) ; var H = e . getAttribute ( "viewBox" ) ; if ( H ) { H = H . split ( " " ) ; w . x -= + H [ 0 ] ; w . y -= + H [ 1 ] } z += " translate(" + ( w . x || 0 ) + "," + ( w . y || 0 ) + ")" ; w = h . prev ( ) ; l . addSubCommand ( new La ( h [ 0 ] , h [ 0 ] . nextSibling , h [ 0 ] . parentNode ) ) ; h . remove ( ) ; H = $ ( m ) . find ( "use:data(symbol)" ) . length ; h = f . createElementNS ( c , "g" ) ; for ( var A = e . childNodes , v = 0 ; v < A . length ; v ++ ) h . appendChild ( A [ v ] . cloneNode ( true ) ) ; if ( svgedit . browser . isGecko ( ) ) { A =
$ ( mb ( ) ) . children ( "linearGradient,radialGradient,pattern" ) . clone ( ) ; $ ( h ) . append ( A ) } z && h . setAttribute ( "transform" , z ) ; z = e . parentNode ; Mb ( h ) ; svgedit . browser . isGecko ( ) && $ ( mb ( ) ) . append ( $ ( h ) . find ( "linearGradient,radialGradient,pattern" ) ) ; h . id = la ( ) ; w . after ( h ) ; if ( z ) { if ( ! H ) { w = e . nextSibling ; z . removeChild ( e ) ; l . addSubCommand ( new La ( e , w , z ) ) } l . addSubCommand ( new Ia ( h ) ) } Kb ( h ) ; svgedit . browser . isGecko ( ) ? Eb ( mb ( ) ) : Eb ( h ) ; svgedit . utilities . walkTreePost ( h , function ( E ) { try { Wa ( E ) } catch ( I ) { console . log ( I ) } } ) ; $ ( h ) . find ( "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" ) . each ( function ( ) { if ( ! this . id ) this . id =
la ( ) } ) ; Cb ( [ h ] ) ; ( e = Lb ( h , true ) ) && l . addSubCommand ( e ) ; ya ( l ) } else console . log ( "Unexpected element to ungroup:" , e ) } ; this . setSvgString = function ( e ) { try { var h = svgedit . utilities . text2xml ( e ) ; this . prepareSvg ( h ) ; var l = new Ea ( "Change Source" ) , z = m . nextSibling , w = d . removeChild ( m ) ; l . addSubCommand ( new La ( w , z , d ) ) ; m = f . adoptNode ? f . adoptNode ( h . documentElement ) : f . importNode ( h . documentElement , true ) ; d . appendChild ( m ) ; var H = $ ( m ) ; b . current _drawing _ = new svgedit . draw . Drawing ( m , q ) ; var A = B ( ) . getNonce ( ) ; A ? N ( "setnonce" , A ) : N ( "unsetnonce" ) ;
H . find ( "image" ) . each ( function ( ) { var k = this ; Ib ( k ) ; var u = da ( this ) ; if ( u . indexOf ( "data:" ) === 0 ) { var C = u . match ( /svgedit_url=(.*?);/ ) ; if ( C ) { var F = decodeURIComponent ( C [ 1 ] ) ; $ ( new Image ) . load ( function ( ) { k . setAttributeNS ( "http://www.w3.org/1999/xlink" , "xlink:href" , F ) } ) . attr ( "src" , F ) } } b . embedImage ( u ) } ) ; H . find ( "svg" ) . each ( function ( ) { if ( ! $ ( this ) . closest ( "defs" ) . length ) { Mb ( this ) ; var k = this . parentNode ; if ( k . childNodes . length === 1 && k . nodeName === "g" ) { $ ( k ) . data ( "gsvg" , this ) ; k . id = k . id || la ( ) } else Bb ( this ) } } ) ; svgedit . browser . isGecko ( ) &&
H . find ( "linearGradient, radialGradient, pattern" ) . appendTo ( mb ( ) ) ; Kb ( H ) ; Eb ( H [ 0 ] ) ; svgedit . utilities . walkTreePost ( m , function ( k ) { try { Wa ( k ) } catch ( u ) { console . log ( u ) } } ) ; var v = { id : "svgcontent" , overflow : n . show _outside _canvas ? "visible" : "hidden" } , E = false ; if ( H . attr ( "viewBox" ) ) { var I = H . attr ( "viewBox" ) . split ( " " ) ; v . width = I [ 2 ] ; v . height = I [ 3 ] } else $ . each ( [ "width" , "height" ] , function ( k , u ) { var C = H . attr ( u ) ; C || ( C = "100%" ) ; if ( ( C + "" ) . substr ( - 1 ) === "%" ) E = true ; else v [ u ] = xa ( u , C ) } ) ; Fb ( ) ; H . children ( ) . find ( "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" ) . each ( function ( ) { if ( ! this . id ) this . id =
la ( ) } ) ; if ( E ) { var D = getStrokedBBox ( ) ; v . width = D . width + D . x ; v . height = D . height + D . y } if ( v . width <= 0 ) v . width = 100 ; if ( v . height <= 0 ) v . height = 100 ; H . attr ( v ) ; this . contentW = v . width ; this . contentH = v . height ; l . addSubCommand ( new Ia ( m ) ) ; var G = H . attr ( [ "width" , "height" ] ) ; l . addSubCommand ( new Ka ( d , G ) ) ; o = 1 ; svgedit . transformlist . resetListMap ( ) ; Ra ( ) ; svgedit . path . clearData ( ) ; d . appendChild ( Ca . selectorParentGroup ) ; ya ( l ) ; N ( "changed" , [ m ] ) } catch ( L ) { console . log ( L ) ; return false } return true } ; this . importSvgString = function ( e ) { try { var h =
svgedit . utilities . encode64 ( e . length + e ) . substr ( 0 , 32 ) , l = false ; if ( sb [ h ] ) if ( $ ( sb [ h ] . symbol ) . parents ( "#svgroot" ) . length ) l = true ; var z = new Ea ( "Import SVG" ) ; if ( l ) var w = sb [ h ] . symbol , H = sb [ h ] . xform ; else { var A = svgedit . utilities . text2xml ( e ) ; this . prepareSvg ( A ) ; var v ; v = f . adoptNode ? f . adoptNode ( A . documentElement ) : f . importNode ( A . documentElement , true ) ; Mb ( v ) ; var E = xa ( "width" , v . getAttribute ( "width" ) ) , I = xa ( "height" , v . getAttribute ( "height" ) ) , D = v . getAttribute ( "viewBox" ) , G = D ? D . split ( " " ) : [ 0 , 0 , E , I ] ; for ( e = 0 ; e < 4 ; ++ e ) G [ e ] = + G [ e ] ;
m . getAttribute ( "width" ) ; var L = + m . getAttribute ( "height" ) ; H = I > E ? "scale(" + L / 3 / G [ 3 ] + ")" : "scale(" + L / 3 / G [ 2 ] + ")" ; H = "translate(0) " + H + " translate(0)" ; w = f . createElementNS ( c , "symbol" ) ; var k = mb ( ) ; for ( svgedit . browser . isGecko ( ) && $ ( v ) . find ( "linearGradient, radialGradient, pattern" ) . appendTo ( k ) ; v . firstChild ; ) w . appendChild ( v . firstChild ) ; var u = v . attributes ; for ( v = 0 ; v < u . length ; v ++ ) { var C = u [ v ] ; w . setAttribute ( C . nodeName , C . nodeValue ) } w . id = la ( ) ; sb [ h ] = { symbol : w , xform : H } ; mb ( ) . appendChild ( w ) ; z . addSubCommand ( new Ia ( w ) ) } var F =
f . createElementNS ( c , "use" ) ; F . id = la ( ) ; W ( F , "#" + w . id ) ; ( K || B ( ) . getCurrentLayer ( ) ) . appendChild ( F ) ; z . addSubCommand ( new Ia ( F ) ) ; Ra ( ) ; F . setAttribute ( "transform" , H ) ; Wa ( F ) ; $ ( F ) . data ( "symbol" , w ) . data ( "ref" , w ) ; ub ( [ F ] ) ; ya ( z ) ; N ( "changed" , [ m ] ) } catch ( O ) { console . log ( O ) ; return false } return true } ; var Fb = b . identifyLayers = function ( ) { Jb ( ) ; B ( ) . identifyLayers ( ) } ; this . createLayer = function ( e ) { var h = new Ea ( "Create Layer" ) ; e = B ( ) . createLayer ( e ) ; h . addSubCommand ( new Ia ( e ) ) ; ya ( h ) ; Ra ( ) ; N ( "changed" , [ e ] ) } ; this . cloneLayer = function ( e ) { var h =
new Ea ( "Duplicate Layer" ) , l = f . createElementNS ( c , "g" ) , z = f . createElementNS ( c , "title" ) ; z . textContent = e ; l . appendChild ( z ) ; z = B ( ) . getCurrentLayer ( ) ; $ ( z ) . after ( l ) ; z = z . childNodes ; for ( var w = 0 ; w < z . length ; w ++ ) { var H = z [ w ] ; H . localName != "title" && l . appendChild ( ja ( H ) ) } Ra ( ) ; Fb ( ) ; h . addSubCommand ( new Ia ( l ) ) ; ya ( h ) ; b . setCurrentLayer ( e ) ; N ( "changed" , [ l ] ) } ; this . deleteCurrentLayer = function ( ) { var e = B ( ) . getCurrentLayer ( ) , h = e . nextSibling , l = e . parentNode ; if ( e = B ( ) . deleteCurrentLayer ( ) ) { var z = new Ea ( "Delete Layer" ) ; z . addSubCommand ( new La ( e ,
h , l ) ) ; ya ( z ) ; Ra ( ) ; N ( "changed" , [ l ] ) ; return true } return false } ; this . setCurrentLayer = function ( e ) { ( e = B ( ) . setCurrentLayer ( svgedit . utilities . toXml ( e ) ) ) && Ra ( ) ; return e } ; this . renameCurrentLayer = function ( e ) { var h = B ( ) ; if ( h . current _layer ) { var l = h . current _layer ; if ( ! b . setCurrentLayer ( e ) ) { for ( var z = new Ea ( "Rename Layer" ) , w = 0 ; w < h . getNumLayers ( ) ; ++ w ) if ( h . all _layers [ w ] [ 1 ] == l ) break ; var H = h . getLayerName ( w ) ; h . all _layers [ w ] [ 0 ] = svgedit . utilities . toXml ( e ) ; var A = l . childNodes . length ; for ( w = 0 ; w < A ; ++ w ) { var v = l . childNodes . item ( w ) ;
if ( v && v . tagName == "title" ) { for ( ; v . firstChild ; ) v . removeChild ( v . firstChild ) ; v . textContent = e ; z . addSubCommand ( new Ka ( v , { "#text" : H } ) ) ; ya ( z ) ; N ( "changed" , [ l ] ) ; return true } } } h . current _layer = l } return false } ; this . setCurrentLayerPosition = function ( e ) { var h = B ( ) ; if ( h . current _layer && e >= 0 && e < h . getNumLayers ( ) ) { for ( var l = 0 ; l < h . getNumLayers ( ) ; ++ l ) if ( h . all _layers [ l ] [ 1 ] == h . current _layer ) break ; if ( l == h . getNumLayers ( ) ) return false ; if ( l != e ) { var z = null , w = h . current _layer . nextSibling ; if ( e > l ) { if ( e < h . getNumLayers ( ) - 1 ) z = h . all _layers [ e +
1 ] [ 1 ] } else z = h . all _layers [ e ] [ 1 ] ; m . insertBefore ( h . current _layer , z ) ; ya ( new Fa ( h . current _layer , w , m ) ) ; Fb ( ) ; b . setCurrentLayer ( h . getLayerName ( e ) ) ; return true } } return false } ; this . setLayerVisibility = function ( e , h ) { var l = B ( ) , z = l . getLayerVisibility ( e ) , w = l . setLayerVisibility ( e , h ) ; if ( w ) ya ( new Ka ( w , { display : z ? "inline" : "none" } , "Layer Visibility" ) ) ; else return false ; if ( w == l . getCurrentLayer ( ) ) { Ra ( ) ; Ja . clear ( ) } return true } ; this . moveSelectedToLayer = function ( e ) { for ( var h = null , l = B ( ) , z = 0 ; z < l . getNumLayers ( ) ; ++ z ) if ( l . getLayerName ( z ) ==
e ) { h = l . all _layers [ z ] [ 1 ] ; break } if ( ! h ) return false ; e = new Ea ( "Move Elements to Layer" ) ; l = J ; for ( z = l . length ; z -- ; ) { var w = l [ z ] ; if ( w ) { var H = w . nextSibling , A = w . parentNode ; h . appendChild ( w ) ; e . addSubCommand ( new Fa ( w , H , A ) ) } } ya ( e ) ; return true } ; this . mergeLayer = function ( e ) { var h = new Ea ( "Merge Layer" ) , l = B ( ) , z = $ ( l . current _layer ) . prev ( ) [ 0 ] ; if ( z ) { for ( h . addSubCommand ( new La ( l . current _layer , l . current _layer . nextSibling , m ) ) ; l . current _layer . firstChild ; ) { var w = l . current _layer . firstChild ; if ( w . localName == "title" ) { h . addSubCommand ( new La ( w ,
w . nextSibling , l . current _layer ) ) ; l . current _layer . removeChild ( w ) } else { var H = w . nextSibling ; z . appendChild ( w ) ; h . addSubCommand ( new Fa ( w , H , l . current _layer ) ) } } m . removeChild ( l . current _layer ) ; if ( ! e ) { Ra ( ) ; Fb ( ) ; N ( "changed" , [ m ] ) ; ya ( h ) } l . current _layer = z ; return h } } ; this . mergeAllLayers = function ( ) { var e = new Ea ( "Merge all Layers" ) , h = B ( ) ; for ( h . current _layer = h . all _layers [ h . getNumLayers ( ) - 1 ] [ 1 ] ; $ ( m ) . children ( "g" ) . length > 1 ; ) e . addSubCommand ( b . mergeLayer ( true ) ) ; Ra ( ) ; Fb ( ) ; N ( "changed" , [ m ] ) ; ya ( e ) } ; var Jb = this . leaveContext =
function ( ) { var e = ua . length ; if ( e ) { for ( var h = 0 ; h < e ; h ++ ) { var l = ua [ h ] , z = ib ( l , "orig_opac" ) ; z !== 1 ? l . setAttribute ( "opacity" , z ) : l . removeAttribute ( "opacity" ) ; l . setAttribute ( "style" , "pointer-events: inherit" ) } ua = [ ] ; Ra ( true ) ; N ( "contextset" , null ) } K = null } , Rb = this . setContext = function ( e ) { Jb ( ) ; if ( typeof e === "string" ) e = pa ( e ) ; K = e ; $ ( e ) . parentsUntil ( "#svgcontent" ) . andSelf ( ) . siblings ( ) . each ( function ( ) { var h = this . getAttribute ( "opacity" ) || 1 ; ib ( this , "orig_opac" , h ) ; this . setAttribute ( "opacity" , h * 0.33 ) ; this . setAttribute ( "style" ,
"pointer-events: none" ) ; ua . push ( this ) } ) ; Ra ( ) ; N ( "contextset" , K ) } ; this . clear = function ( ) { Ja . clear ( ) ; Ra ( ) ; b . clearSvgContentElement ( ) ; b . current _drawing _ = new svgedit . draw . Drawing ( m ) ; b . createLayer ( "Layer 1" ) ; b . undoMgr . resetUndoStack ( ) ; Ca . initGroup ( ) ; sa = Ca . getRubberBandBox ( ) ; N ( "cleared" ) } ; this . linkControlPoints = Ja . linkControlPoints ; this . getContentElem = function ( ) { return m } ; this . getRootElem = function ( ) { return d } ; this . getSelectedElems = function ( ) { return J } ; var Db = this . getResolution = function ( ) { var e = m . getAttribute ( "width" ) /
o , h = m . getAttribute ( "height" ) / o ; return { w : e , h : h , zoom : o } } ; this . getZoom = function ( ) { return o } ; this . getVersion = function ( ) { return "svgcanvas.js ($Rev: 2082 $)" } ; this . setUiStrings = function ( e ) { $ . extend ( Va , e . notification ) } ; this . setConfig = function ( e ) { $ . extend ( n , e ) } ; this . getTitle = function ( e ) { if ( e = e || J [ 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 = J [ 0 ] ; h = $ ( h ) . data ( "gsvg" ) ||
h ; var l = $ ( h ) . children ( "title" ) , z = new Ea ( "Set Label" ) ; if ( e . length ) if ( l . length ) { l = l [ 0 ] ; z . addSubCommand ( new Ka ( l , { "#text" : l . textContent } ) ) ; l . textContent = e } else { l = f . createElementNS ( c , "title" ) ; l . textContent = e ; $ ( h ) . prepend ( l ) ; z . addSubCommand ( new Ia ( l ) ) } else { z . addSubCommand ( new La ( l [ 0 ] , l . nextSibling , h ) ) ; l . remove ( ) } ya ( z ) } ; this . getDocumentTitle = function ( ) { return b . getTitle ( m ) } ; this . setDocumentTitle = function ( e ) { for ( var h = m . childNodes , l = false , z = "" , w = new Ea ( "Change Image Title" ) , H = 0 ; H < h . length ; H ++ ) if ( h [ H ] . nodeName ==
"title" ) { l = h [ H ] ; z = l . textContent ; break } if ( ! l ) { l = f . createElementNS ( c , "title" ) ; m . insertBefore ( l , m . firstChild ) } if ( e . length ) l . textContent = e ; else l . parentNode . removeChild ( l ) ; w . addSubCommand ( new Ka ( l , { "#text" : z } ) ) ; ya ( w ) } ; this . getEditorNS = function ( e ) { e && m . setAttribute ( "xmlns:se" , "http://svg-edit.googlecode.com" ) ; return "http://svg-edit.googlecode.com" } ; this . setResolution = function ( e , h ) { var l = Db ( ) , z = l . w ; l = l . h ; var w ; if ( e == "fit" ) { var H = getStrokedBBox ( ) ; if ( H ) { w = new Ea ( "Fit Canvas to Content" ) ; var A = pb ( ) ; ub ( A ) ;
var v = [ ] , E = [ ] ; $ . each ( A , function ( ) { v . push ( H . x * - 1 ) ; E . push ( H . y * - 1 ) } ) ; A = b . moveSelectedElements ( v , E , true ) ; w . addSubCommand ( A ) ; Ra ( ) ; e = Math . round ( H . width ) ; h = Math . round ( H . height ) } else return false } if ( e != z || h != l ) { A = d . suspendRedraw ( 1E3 ) ; w || ( w = new Ea ( "Change Image Dimensions" ) ) ; e = xa ( "width" , e ) ; h = xa ( "height" , h ) ; m . setAttribute ( "width" , e ) ; m . setAttribute ( "height" , h ) ; this . contentW = e ; this . contentH = h ; w . addSubCommand ( new Ka ( m , { width : z , height : l } ) ) ; m . setAttribute ( "viewBox" , [ 0 , 0 , e / o , h / o ] . join ( " " ) ) ; w . addSubCommand ( new Ka ( m ,
{ viewBox : [ "0 0" , z , l ] . join ( " " ) } ) ) ; ya ( w ) ; d . unsuspendRedraw ( A ) ; if ( background = document . getElementById ( "canvas_background" ) ) { background . setAttribute ( "x" , - 1 ) ; background . setAttribute ( "y" , - 1 ) ; background . setAttribute ( "width" , e + 2 ) ; background . setAttribute ( "height" , h + 2 ) } N ( "changed" , [ m ] ) } return [ e , h ] } ; this . getOffset = function ( ) { return $ ( m ) . attr ( [ "x" , "y" ] ) } ; this . setBBoxZoom = function ( e , h , l ) { var z = 0.85 , w = function ( H ) { if ( ! H ) return false ; var A = Math . min ( Math . round ( h / H . width * 100 * z ) / 100 , Math . round ( l / H . height * 100 * z ) / 100 ) ;
b . setZoom ( A ) ; return { zoom : A , bbox : H } } ; if ( typeof e == "object" ) { e = e ; if ( e . width == 0 || e . height == 0 ) { b . setZoom ( e . zoom ? e . zoom : o * e . factor ) ; return { zoom : o , bbox : e } } return w ( e ) } switch ( e ) { case "selection" : if ( ! J [ 0 ] ) return ; e = $ . map ( J , function ( H ) { if ( H ) return H } ) ; e = getStrokedBBox ( e ) ; break ; case "canvas" : e = Db ( ) ; z = 0.95 ; e = { width : e . w , height : e . h , x : 0 , y : 0 } ; break ; case "content" : e = getStrokedBBox ( ) ; break ; case "layer" : e = getStrokedBBox ( pb ( B ( ) . getCurrentLayer ( ) ) ) ; break ; default : return } return w ( e ) } ; this . setZoom = function ( e ) { var h = Db ( ) ;
m . setAttribute ( "viewBox" , "0 0 " + h . w / e + " " + h . h / e ) ; o = e ; $ . each ( J , function ( l , z ) { z && Ca . requestSelector ( z ) . resize ( ) } ) ; Ja . zoomChange ( ) ; nb ( "zoomChanged" , e ) } ; this . getMode = function ( ) { return Ba } ; this . setMode = function ( e ) { Ja . clear ( true ) ; eb . clear ( ) ; $ ( "#workarea" ) . attr ( "class" , e ) ; cb = J [ 0 ] && J [ 0 ] . nodeName == "text" ? Za : M ; Ba = e } ; this . getColor = function ( e ) { return cb [ e ] } ; this . setColor = function ( e , h , l ) { M [ e ] = h ; cb [ e + "_paint" ] = { type : "solidColor" } ; for ( var z = [ ] , w = J . length ; w -- ; ) { var H = J [ w ] ; if ( H ) if ( H . tagName == "g" ) svgedit . utilities . walkTree ( H ,
function ( A ) { A . nodeName != "g" && z . push ( A ) } ) ; else if ( e == "fill" ) H . tagName != "polyline" && H . tagName != "line" && z . push ( H ) ; else z . push ( H ) } if ( z . length > 0 ) if ( l ) wb ( e , h , z ) ; else { hb ( e , h , z ) ; N ( "changed" , z ) } } ; var mb = function ( ) { var e = m . getElementsByTagNameNS ( c , "defs" ) ; if ( e . length > 0 ) e = e [ 0 ] ; else { e = f . createElementNS ( c , "defs" ) ; m . firstChild ? m . insertBefore ( e , m . firstChild . nextSibling ) : m . appendChild ( e ) } return e } , Ob = this . setGradient = function ( e ) { if ( ! ( ! cb [ e + "_paint" ] || cb [ e + "_paint" ] . type == "solidColor" ) ) { var h = b [ e + "Grad" ] , l = Nb ( h ) ,
z = mb ( ) ; if ( l ) h = l ; else { h = z . appendChild ( f . importNode ( h , true ) ) ; h . id = la ( ) } b . setColor ( e , "url(#" + h . id + ")" ) ; if ( e == "canvas" ) ( e = document . getElementById ( "canvas_background" ) ) && e . setAttribute ( "fill" , "url(#" + h . id + ")" ) } } , Nb = function ( e ) { var h = mb ( ) ; h = $ ( h ) . find ( "linearGradient, radialGradient" ) ; for ( var l = h . length , z = [ "r" , "cx" , "cy" , "fx" , "fy" ] ; l -- ; ) { var w = h [ l ] ; if ( e . tagName == "linearGradient" ) { if ( e . getAttribute ( "x1" ) != w . getAttribute ( "x1" ) || e . getAttribute ( "y1" ) != w . getAttribute ( "y1" ) || e . getAttribute ( "x2" ) != w . getAttribute ( "x2" ) ||
e . getAttribute ( "y2" ) != w . getAttribute ( "y2" ) ) continue } else { var H = $ ( e ) . attr ( z ) , A = $ ( w ) . attr ( z ) , v = false ; $ . each ( z , function ( k , u ) { if ( H [ u ] != A [ u ] ) v = true } ) ; if ( v ) continue } var E = e . getElementsByTagNameNS ( c , "stop" ) , I = w . getElementsByTagNameNS ( c , "stop" ) ; if ( E . length == I . length ) { for ( var D = E . length ; D -- ; ) { var G = E [ D ] , L = I [ D ] ; if ( G . getAttribute ( "offset" ) != L . getAttribute ( "offset" ) || G . getAttribute ( "stop-opacity" ) != L . getAttribute ( "stop-opacity" ) || G . getAttribute ( "stop-color" ) != L . getAttribute ( "stop-color" ) ) break } if ( D == - 1 ) return w } } return null } ;
this . setPaint = function ( e , h ) { var l = new $ . jGraduate . Paint ( h ) ; this . setPaintOpacity ( e , l . alpha / 100 , true ) ; cb [ e + "_paint" ] = l ; switch ( l . type ) { case "solidColor" : if ( l . solidColor != "none" && l . solidColor != "#none" ) this . setColor ( e , "#" + l . solidColor ) ; else { this . setColor ( e , "none" ) ; document . querySelector ( e == "fill" ? "#fill_color rect" : "#stroke_color rect" ) . setAttribute ( "fill" , "none" ) } break ; case "linearGradient" : case "radialGradient" : b [ e + "Grad" ] = l [ l . type ] ; Ob ( e ) } } ; this . getStrokeWidth = function ( ) { return cb . stroke _width } ; this . setStrokeWidth =
function ( e ) { if ( e == 0 && [ "line" , "path" ] . indexOf ( Ba ) >= 0 ) b . setStrokeWidth ( 1 ) ; else { cb . stroke _width = e ; for ( var h = [ ] , l = J . length ; l -- ; ) { var z = J [ l ] ; if ( z ) z . tagName == "g" ? svgedit . utilities . walkTree ( z , function ( w ) { w . nodeName != "g" && h . push ( w ) } ) : h . push ( z ) } if ( h . length > 0 ) { hb ( "stroke-width" , e , h ) ; N ( "changed" , J ) } } } ; this . setStrokeAttr = function ( e , h ) { M [ e . replace ( "-" , "_" ) ] = h ; for ( var l = [ ] , z = J . length ; z -- ; ) { var w = J [ z ] ; if ( w ) w . tagName == "g" ? svgedit . utilities . walkTree ( w , function ( H ) { H . nodeName != "g" && l . push ( H ) } ) : l . push ( w ) } if ( l . length >
0 ) { hb ( e , h , l ) ; N ( "changed" , J ) } } ; this . getStyle = function ( ) { return M } ; this . getOpacity = function ( ) { return M . opacity } ; this . setOpacity = function ( e ) { M . opacity = e ; hb ( "opacity" , e ) } ; this . getFillOpacity = function ( ) { return M . fill _opacity } ; this . getStrokeOpacity = function ( ) { return M . stroke _opacity } ; this . setPaintOpacity = function ( e , h , l ) { M [ e + "_opacity" ] = h ; l ? wb ( e + "-opacity" , h ) : hb ( e + "-opacity" , h ) } ; this . getBlur = function ( e ) { var h = 0 ; if ( e ) if ( e . getAttribute ( "filter" ) ) if ( e = pa ( e . id + "_blur" ) ) h = e . firstChild . getAttribute ( "stdDeviation" ) ;
return h } ; ( function ( ) { function e ( ) { var w = b . undoMgr . finishUndoableChange ( ) ; h . addSubCommand ( w ) ; ya ( h ) ; l = h = null } var h = null , l = null , z = false ; b . setBlurNoUndo = function ( w ) { if ( l ) if ( w === 0 ) { wb ( "filter" , "" ) ; z = true } else { var H = J [ 0 ] ; z && wb ( "filter" , "url(#" + H . id + "_blur)" ) ; if ( svgedit . browser . isWebkit ( ) ) { H . removeAttribute ( "filter" ) ; H . setAttribute ( "filter" , "url(#" + H . id + "_blur)" ) } wb ( "stdDeviation" , w , [ l . firstChild ] ) ; b . setBlurOffsets ( l , w ) } else b . setBlur ( w ) } ; b . setBlurOffsets = function ( w , H ) { if ( H > 3 ) na ( w , { x : "-50%" , y : "-50%" , width : "200%" ,
height : "200%" } , 100 ) ; else if ( ! svgedit . browser . isWebkit ( ) ) { w . removeAttribute ( "x" ) ; w . removeAttribute ( "y" ) ; w . removeAttribute ( "width" ) ; w . removeAttribute ( "height" ) } } ; b . setBlur = function ( w , H ) { if ( h ) e ( ) ; else { var A = J [ 0 ] , v = A . id ; l = pa ( v + "_blur" ) ; w -= 0 ; var E = new Ea ; if ( l ) { if ( w === 0 ) l = null } else { var I = Q ( { element : "feGaussianBlur" , attr : { "in" : "SourceGraphic" , stdDeviation : w } } ) ; l = Q ( { element : "filter" , attr : { id : v + "_blur" } } ) ; l . appendChild ( I ) ; mb ( ) . appendChild ( l ) ; E . addSubCommand ( new Ia ( l ) ) } I = { filter : A . getAttribute ( "filter" ) } ; if ( w ===
0 ) { A . removeAttribute ( "filter" ) ; E . addSubCommand ( new Ka ( A , I ) ) } else { hb ( "filter" , "url(#" + v + "_blur)" ) ; E . addSubCommand ( new Ka ( A , I ) ) ; b . setBlurOffsets ( l , w ) ; h = E ; b . undoMgr . beginUndoableChange ( "stdDeviation" , [ l ? l . firstChild : null ] ) ; if ( H ) { b . setBlurNoUndo ( w ) ; e ( ) } } } } } ) ( ) ; this . getBold = function ( ) { var e = J [ 0 ] ; if ( e != null && e . tagName == "text" && J [ 1 ] == null ) return e . getAttribute ( "font-weight" ) == "bold" ; return false } ; this . setBold = function ( e ) { var h = J [ 0 ] ; if ( h != null && h . tagName == "text" && J [ 1 ] == null ) hb ( "font-weight" , e ? "bold" : "normal" ) ;
J [ 0 ] . textContent || eb . setCursor ( ) } ; this . getItalic = function ( ) { var e = J [ 0 ] ; if ( e != null && e . tagName == "text" && J [ 1 ] == null ) return e . getAttribute ( "font-style" ) == "italic" ; return false } ; this . setItalic = function ( e ) { var h = J [ 0 ] ; if ( h != null && h . tagName == "text" && J [ 1 ] == null ) hb ( "font-style" , e ? "italic" : "normal" ) ; J [ 0 ] . textContent || eb . setCursor ( ) } ; this . getFontFamily = function ( ) { return Za . font _family } ; this . setFontFamily = function ( e ) { Za . font _family = e ; hb ( "font-family" , e ) ; J [ 0 ] && ! J [ 0 ] . textContent && eb . setCursor ( ) } ; this . setFontColor =
function ( e ) { Za . fill = e ; hb ( "fill" , e ) } ; this . getFontSize = function ( ) { return Za . fill } ; this . getFontSize = function ( ) { return Za . font _size } ; this . setFontSize = function ( e ) { Za . font _size = e ; hb ( "font-size" , e ) ; J [ 0 ] . textContent || eb . setCursor ( ) } ; this . getText = function ( ) { var e = J [ 0 ] ; if ( e == null ) return "" ; return e . textContent } ; this . setTextContent = function ( e ) { hb ( "#text" , e ) ; eb . init ( e ) ; eb . setCursor ( ) } ; this . setImageURL = function ( e ) { var h = J [ 0 ] ; if ( h ) { var l = $ ( h ) . attr ( [ "width" , "height" ] ) ; l = ! l . width || ! l . height ; var z = da ( h ) ; if ( z !== e ) l =
true ; else if ( ! l ) return ; var w = new Ea ( "Change Image URL" ) ; W ( h , e ) ; w . addSubCommand ( new Ka ( h , { "#href" : z } ) ) ; l ? $ ( new Image ) . load ( function ( ) { var H = $ ( h ) . attr ( [ "width" , "height" ] ) ; $ ( h ) . attr ( { width : this . width , height : this . height } ) ; Ca . requestSelector ( h ) . resize ( ) ; w . addSubCommand ( new Ka ( h , H ) ) ; ya ( w ) ; N ( "changed" , [ h ] ) } ) . attr ( "src" , e ) : ya ( w ) } } ; this . setLinkURL = function ( e ) { var h = J [ 0 ] ; if ( h ) { if ( h . tagName !== "a" ) { h = $ ( h ) . parents ( "a" ) ; if ( h . length ) h = h [ 0 ] ; else return } var l = da ( h ) ; if ( l !== e ) { var z = new Ea ( "Change Link URL" ) ; W ( h , e ) ;
z . addSubCommand ( new Ka ( h , { "#href" : l } ) ) ; ya ( z ) } } } ; this . elementsAreSame = function ( e ) { return ! e . length || e [ 0 ] == null ? null : J . every ( function ( h ) { return h && J [ 0 ] ? h . nodeName == J [ 0 ] . nodeName : null } ) } ; this . setRectRadius = function ( e ) { b . elementsAreSame ( J ) && J [ 0 ] . tagName == "rect" && J . forEach ( function ( h ) { var l = h . getAttribute ( "rx" ) ; if ( l != e ) { h . setAttribute ( "rx" , e ) ; h . setAttribute ( "ry" , e ) ; ya ( new Ka ( h , { rx : l , ry : l } , "Radius" ) ) ; N ( "changed" , [ h ] ) } } ) } ; this . makeHyperlink = function ( e ) { b . groupSelectedElements ( "a" , e ) } ; this . removeHyperlink =
function ( ) { b . ungroupSelectedElement ( ) } ; this . setSegType = function ( e ) { Ja . setSegType ( e ) } ; this . convertToPath = function ( e , h ) { if ( e == null ) $ . each ( J , function ( V , T ) { T && b . convertToPath ( T ) } ) ; else { if ( ! h ) var l = new Ea ( "Convert element to Path" ) ; var z = h ? { } : { fill : M . fill , "fill-opacity" : M . fill _opacity , stroke : M . stroke , "stroke-width" : M . stroke _width , "stroke-dasharray" : M . stroke _dasharray , "stroke-linejoin" : M . stroke _linejoin , "stroke-linecap" : M . stroke _linecap , "stroke-opacity" : M . stroke _opacity , opacity : M . opacity , visibility : "hidden" } ;
$ . each ( [ "marker-start" , "marker-end" , "marker-mid" , "filter" , "clip-path" ] , function ( ) { if ( e . getAttribute ( this ) ) z [ this ] = e . getAttribute ( this ) } ) ; var w = Q ( { element : "path" , attr : z } ) , H = e . getAttribute ( "transform" ) ; H && w . setAttribute ( "transform" , H ) ; var A = e . id , v = e . parentNode ; e . nextSibling ? v . insertBefore ( w , e ) : v . appendChild ( w ) ; var E = "" , I = function ( V ) { $ . each ( V , function ( T , X ) { var aa = X [ 1 ] ; E += X [ 0 ] ; for ( var fa = 0 ; fa < aa . length ; fa += 2 ) E += aa [ fa ] + "," + aa [ fa + 1 ] + " " } ) } , D = 1.81 ; switch ( e . tagName ) { case "ellipse" : case "circle" : var G = $ ( e ) . attr ( [ "rx" ,
"ry" , "cx" , "cy" ] ) , L = G . cx , k = G . cy , u = G . rx ; G = G . ry ; if ( e . tagName == "circle" ) u = G = $ ( e ) . attr ( "r" ) ; I ( [ [ "M" , [ L - u , k ] ] , [ "C" , [ L - u , k - G / D , L - u / D , k - G , L , k - G ] ] , [ "C" , [ L + u / D , k - G , L + u , k - G / D , L + u , k ] ] , [ "C" , [ L + u , k + G / D , L + u / D , k + G , L , k + G ] ] , [ "C" , [ L - u / D , k + G , L - u , k + G / D , L - u , k ] ] , [ "Z" , [ ] ] ] ) ; break ; case "path" : E = e . getAttribute ( "d" ) ; break ; case "line" : G = $ ( e ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) ; E = "M" + G . x1 + "," + G . y1 + "L" + G . x2 + "," + G . y2 ; break ; case "polyline" : case "polygon" : E = "M" + e . getAttribute ( "points" ) ; break ; case "rect" : G = $ ( e ) . attr ( [ "rx" , "ry" ] ) ; u = G . rx ; G =
G . ry ; var C = e . getBBox ( ) ; L = C . x ; k = C . y ; var F = C . width ; C = C . height ; D = 4 - D ; ! u && ! G ? I ( [ [ "M" , [ L , k ] ] , [ "L" , [ L + F , k ] ] , [ "L" , [ L + F , k + C ] ] , [ "L" , [ L , k + C ] ] , [ "L" , [ L , k ] ] , [ "Z" , [ ] ] ] ) : I ( [ [ "M" , [ L , k + G ] ] , [ "C" , [ L , k + G / D , L + u / D , k , L + u , k ] ] , [ "L" , [ L + F - u , k ] ] , [ "C" , [ L + F - u / D , k , L + F , k + G / D , L + F , k + G ] ] , [ "L" , [ L + F , k + C - G ] ] , [ "C" , [ L + F , k + C - G / D , L + F - u / D , k + C , L + F - u , k + C ] ] , [ "L" , [ L + u , k + C ] ] , [ "C" , [ L + u / D , k + C , L , k + C - G / D , L , k + C - G ] ] , [ "L" , [ L , k + G ] ] , [ "Z" , [ ] ] ] ) ; break ; default : w . parentNode . removeChild ( w ) } E && w . setAttribute ( "d" , E ) ; if ( h ) { Ja . resetOrientation ( w ) ; l = false ; try { l =
w . getBBox ( ) } catch ( O ) { } w . parentNode . removeChild ( w ) ; return l } else { if ( H ) { H = Y ( w ) ; qa ( H ) && Ja . resetOrientation ( w ) } l . addSubCommand ( new La ( e , e . nextSibling , v ) ) ; l . addSubCommand ( new Ia ( w ) ) ; Ra ( ) ; e . parentNode . removeChild ( e ) ; w . setAttribute ( "id" , A ) ; w . removeAttribute ( "visibility" ) ; ub ( [ w ] , true ) ; ya ( l ) } } } ; var wb = this . changeSelectedAttributeNoUndo = function ( e , h , l ) { var z = d . suspendRedraw ( 1E3 ) ; Ba == "pathedit" && Ja . moveNode ( e , h ) ; l = l || J ; for ( var w = l . length , H = [ "g" , "polyline" , "path" ] ; w -- ; ) { var A = l [ w ] ; if ( A != null ) { Ba === "textedit" &&
e !== "#text" && A . textContent . length && eb . toSelectMode ( A ) ; if ( ( e === "x" || e === "y" ) && H . indexOf ( A . tagName ) >= 0 ) { var v = getStrokedBBox ( [ A ] ) ; b . moveSelectedElements ( ( e === "x" ? h - v . x : 0 ) * o , ( e === "y" ? h - v . y : 0 ) * o , true ) } else { v = e === "#text" ? A . textContent : A . getAttribute ( e ) ; if ( v == null ) v = "" ; if ( v !== String ( h ) ) { if ( e == "#text" ) { svgedit . utilities . getBBox ( A ) ; A . textContent = h } else e == "#href" ? W ( A , h ) : A . setAttribute ( e , h ) ; J . indexOf ( A ) >= 0 && setTimeout ( function ( ) { A . parentNode && Ca . requestSelector ( A ) . resize ( ) } , 0 ) ; v = oa ( A ) ; if ( v != 0 && e != "transform" ) for ( var E =
Y ( A ) , I = E . numberOfItems ; I -- ; ) if ( E . getItem ( I ) . type == 4 ) { E . removeItem ( I ) ; var D = svgedit . utilities . getBBox ( A ) , G = P ( D . x + D . width / 2 , D . y + D . height / 2 , ga ( E ) . matrix ) ; D = G . x ; G = G . y ; var L = d . createSVGTransform ( ) ; L . setRotate ( v , D , G ) ; E . insertItemBefore ( L , I ) ; break } } } } } d . unsuspendRedraw ( z ) } , hb = this . changeSelectedAttribute = function ( e , h , l ) { l = l || J ; b . undoMgr . beginUndoableChange ( e , l ) ; wb ( e , h , l ) ; e = b . undoMgr . finishUndoableChange ( ) ; e . isEmpty ( ) || ya ( e ) } ; this . deleteSelectedElements = function ( ) { for ( var e = new Ea ( "Delete Elements" ) , h = J . length ,
l = [ ] , z = 0 ; z < h ; ++ z ) { var w = J [ z ] ; if ( w == null ) break ; var H = w . parentNode , A = w ; Ca . releaseSelector ( A ) ; svgedit . path . removePath _ ( A . id ) ; if ( H . tagName === "a" && H . childNodes . length === 1 ) { A = H ; H = H . parentNode } var v = A . nextSibling ; A = H . removeChild ( A ) ; l . push ( w ) ; J [ z ] = null ; e . addSubCommand ( new La ( A , v , H ) ) } e . isEmpty ( ) || ya ( e ) ; N ( "changed" , l ) ; Ra ( ) } ; this . cutSelectedElements = function ( ) { for ( var e = new Ea ( "Cut Elements" ) , h = J . length , l = [ ] , z = 0 ; z < h ; ++ z ) { var w = J [ z ] ; if ( w == null ) break ; var H = w . parentNode , A = w ; Ca . releaseSelector ( A ) ; svgedit . path . removePath _ ( A . id ) ;
var v = A . nextSibling ; A = H . removeChild ( A ) ; l . push ( w ) ; J [ z ] = null ; e . addSubCommand ( new La ( A , v , H ) ) } e . isEmpty ( ) || ya ( e ) ; N ( "changed" , l ) ; Ra ( ) ; b . clipBoard = l } ; this . copySelectedElements = function ( ) { b . clipBoard = $ . merge ( [ ] , J ) } ; this . pasteElements = function ( ) { var e = b . clipBoard , h = e . length ; if ( h ) { for ( var l = [ ] , z = new Ea ( "Paste elements" ) ; h -- ; ) { var w = e [ h ] ; if ( w ) { var H = ja ( w ) ; if ( ! pa ( w . id ) ) H . id = w . id ; l . push ( H ) ; ( K || B ( ) . getCurrentLayer ( ) ) . appendChild ( H ) ; z . addSubCommand ( new Ia ( H ) ) } } svgCanvas . clearSelection ( ) ; setTimeout ( function ( ) { Cb ( l ) } ,
100 ) ; ya ( z ) ; N ( "changed" , l ) } } ; this . groupSelectedElements = function ( e ) { e || ( e = "g" ) ; var h = "" ; switch ( e ) { case "a" : h = "Make hyperlink" ; var l = "" ; if ( arguments . length > 1 ) l = arguments [ 1 ] ; break ; default : e = "g" ; h = "Group Elements" } h = new Ea ( h ) ; var z = Q ( { element : e , attr : { id : la ( ) } } ) ; e === "a" && W ( z , l ) ; h . addSubCommand ( new Ia ( z ) ) ; for ( l = J . length ; l -- ; ) { var w = J [ l ] ; if ( w != null ) { if ( w . parentNode . tagName === "a" && w . parentNode . childNodes . length === 1 ) w = w . parentNode ; var H = w . nextSibling , A = w . parentNode ; z . appendChild ( w ) ; h . addSubCommand ( new Fa ( w ,
H , A ) ) } } h . isEmpty ( ) || ya ( h ) ; Cb ( [ z ] , true ) } ; var Lb = this . pushGroupProperties = function ( e , h ) { var l = e . childNodes , z = l . length , w = e . getAttribute ( "transform" ) , H = Y ( e ) , A = ga ( H ) . matrix , v = new Ea ( "Push group properties" ) , E = 0 , I = oa ( e ) , D = $ ( e ) . attr ( [ "filter" , "opacity" ] ) , G , L ; for ( E = 0 ; E < z ; E ++ ) { var k = l [ E ] ; if ( k . nodeType === 1 ) { if ( D . opacity !== null && D . opacity !== 1 ) { k . getAttribute ( "opacity" ) ; var u = Math . round ( ( k . getAttribute ( "opacity" ) || 1 ) * D . opacity * 100 ) / 100 ; hb ( "opacity" , u , [ k ] ) } if ( D . filter ) { var C = u = this . getBlur ( k ) ; L || ( L = this . getBlur ( e ) ) ;
if ( u ) u = L - 0 + ( u - 0 ) ; else if ( u === 0 ) u = L ; if ( C ) G = R ( k . getAttribute ( "filter" ) ) ; else if ( G ) { G = ja ( G ) ; mb ( ) . appendChild ( G ) } else G = R ( D . filter ) ; G . id = k . id + "_" + ( G . firstChild . tagName === "feGaussianBlur" ? "blur" : "filter" ) ; hb ( "filter" , "url(#" + G . id + ")" , [ k ] ) ; if ( u ) { hb ( "stdDeviation" , u , [ G . firstChild ] ) ; b . setBlurOffsets ( G , u ) } } u = Y ( k ) ; if ( ~ k . tagName . indexOf ( "Gradient" ) ) u = null ; if ( u ) if ( k . tagName !== "defs" ) if ( H . numberOfItems ) { if ( I && H . numberOfItems == 1 ) { var F = H . getItem ( 0 ) . matrix , O = d . createSVGMatrix ( ) ; if ( C = oa ( k ) ) O = u . getItem ( 0 ) . matrix ;
var V = svgedit . utilities . getBBox ( k ) , T = ga ( u ) . matrix , X = P ( V . x + V . width / 2 , V . y + V . height / 2 , T ) ; V = I + C ; T = d . createSVGTransform ( ) ; T . setRotate ( V , X . x , X . y ) ; F = ia ( F , O , T . matrix . inverse ( ) ) ; C && u . removeItem ( 0 ) ; if ( V ) u . numberOfItems ? u . insertItemBefore ( T , 0 ) : u . appendItem ( T ) ; if ( F . e || F . f ) { C = d . createSVGTransform ( ) ; C . setTranslate ( F . e , F . f ) ; u . numberOfItems ? u . insertItemBefore ( C , 0 ) : u . appendItem ( C ) } } else { C = k . getAttribute ( "transform" ) ; F = { } ; F . transform = C ? C : "" ; C = d . createSVGTransform ( ) ; F = ga ( u ) . matrix ; O = F . inverse ( ) ; F = ia ( O , A , F ) ; C . setMatrix ( F ) ;
u . appendItem ( C ) } ( k = Wa ( k ) ) && v . addSubCommand ( k ) } } } if ( w ) { F = { } ; F . transform = w ; e . setAttribute ( "transform" , "" ) ; e . removeAttribute ( "transform" ) ; v . addSubCommand ( new Ka ( e , F ) ) } if ( h && ! v . isEmpty ( ) ) return v } ; this . ungroupSelectedElement = function ( ) { var e = J [ 0 ] ; if ( $ ( e ) . data ( "gsvg" ) || $ ( e ) . data ( "symbol" ) ) Qb ( e ) ; else if ( e . tagName === "use" ) { var h = pa ( da ( e ) . substr ( 1 ) ) ; $ ( e ) . data ( "symbol" , h ) . data ( "ref" , h ) ; Qb ( e ) } else { h = $ ( e ) . parents ( "a" ) ; if ( h . length ) e = h [ 0 ] ; if ( e . tagName === "g" || e . tagName === "a" ) { h = new Ea ( "Ungroup Elements" ) ; var l =
Lb ( e , true ) ; l && h . addSubCommand ( l ) ; l = e . parentNode ; for ( var z = e . nextSibling , w = Array ( e . childNodes . length ) , H = 0 ; e . firstChild ; ) { var A = e . firstChild , v = A . nextSibling , E = A . parentNode ; if ( A . tagName === "title" ) { h . addSubCommand ( new La ( A , A . nextSibling , E ) ) ; E . removeChild ( A ) } else { w [ H ++ ] = A = l . insertBefore ( A , z ) ; h . addSubCommand ( new Fa ( A , v , E ) ) } } Ra ( ) ; z = e . nextSibling ; e = l . removeChild ( e ) ; h . addSubCommand ( new La ( e , z , l ) ) ; h . isEmpty ( ) || ya ( h ) ; ub ( w ) } } } ; this . moveToTopSelectedElement = function ( ) { var e = J [ 0 ] ; if ( e != null ) { e = e ; var h = e . parentNode ,
l = e . nextSibling ; e = e . parentNode . appendChild ( e ) ; if ( l != e . nextSibling ) { ya ( new Fa ( e , l , h , "top" ) ) ; N ( "changed" , [ e ] ) } } } ; this . moveToBottomSelectedElement = function ( ) { var e = J [ 0 ] ; if ( e != null ) { e = e ; var h = e . parentNode , l = e . nextSibling , z = e . parentNode . firstChild ; if ( z . tagName == "title" ) z = z . nextSibling ; if ( z . tagName == "defs" ) z = z . nextSibling ; e = e . parentNode . insertBefore ( e , z ) ; if ( l != e . nextSibling ) { ya ( new Fa ( e , l , h , "bottom" ) ) ; N ( "changed" , [ e ] ) } } } ; this . moveUpDownSelected = function ( e ) { var h = J [ 0 ] ; if ( h ) { lb = [ ] ; var l , z , w = $ ( tb ( getStrokedBBox ( [ h ] ) ) ) . toArray ( ) ;
e == "Down" && w . reverse ( ) ; $ . each ( w , function ( ) { if ( z ) { l = this ; return false } else if ( this == h ) z = true } ) ; if ( l ) { w = h . parentNode ; var H = h . nextSibling ; $ ( l ) [ e == "Down" ? "before" : "after" ] ( h ) ; if ( H != h . nextSibling ) { ya ( new Fa ( h , H , w , "Move " + e ) ) ; N ( "changed" , [ h ] ) } } } } ; this . moveSelectedElements = function ( e , h , l ) { if ( e . constructor != Array ) { e /= o ; h /= o } l = l || true ; for ( var z = new Ea ( "position" ) , w = J . length ; w -- ; ) { var H = J [ w ] ; if ( H != null ) { var A = d . createSVGTransform ( ) , v = Y ( H ) ; e . constructor == Array ? A . setTranslate ( e [ w ] , h [ w ] ) : A . setTranslate ( e , h ) ; v . numberOfItems ?
v . insertItemBefore ( A , 0 ) : v . appendItem ( A ) ; ( A = Wa ( H ) ) && z . addSubCommand ( A ) ; Ca . requestSelector ( H ) . resize ( ) } } if ( ! z . isEmpty ( ) ) { l && ya ( z ) ; N ( "changed" , J ) ; return z } } ; this . cloneSelectedElements = function ( e , h , l ) { for ( var z = new Ea ( "Clone Elements" ) , w = J . length , H = 0 ; H < w ; ++ H ) if ( J [ H ] == null ) break ; w = J . slice ( 0 , H ) ; this . clearSelection ( true ) ; for ( H = w . length ; H -- ; ) { var A = ja ( w [ H ] ) ; l && A . setAttribute ( "transform" , "" ) ; ( K || B ( ) . getCurrentLayer ( ) ) . appendChild ( A ) ; z . addSubCommand ( new Ia ( A ) ) } if ( ! z . isEmpty ( ) ) { ub ( w . reverse ( ) ) ; this . moveSelectedElements ( e ,
h , false ) ; ya ( z ) } return A } ; this . alignSelectedElements = function ( e , h ) { var l = [ ] , z = Number . MAX _VALUE , w = Number . MIN _VALUE , H = Number . MAX _VALUE , A = Number . MIN _VALUE , v = Number . MIN _VALUE , E = Number . MIN _VALUE , I = J . length ; if ( I ) { for ( var D = 0 ; D < I ; ++ D ) { if ( J [ D ] == null ) break ; l [ D ] = getStrokedBBox ( [ J [ D ] ] ) ; switch ( h ) { case "smallest" : if ( ( e == "l" || e == "c" || e == "r" ) && ( v == Number . MIN _VALUE || v > l [ D ] . width ) || ( e == "t" || e == "m" || e == "b" ) && ( E == Number . MIN _VALUE || E > l [ D ] . height ) ) { z = l [ D ] . x ; H = l [ D ] . y ; w = l [ D ] . x + l [ D ] . width ; A = l [ D ] . y + l [ D ] . height ; v = l [ D ] . width ;
E = l [ D ] . height } break ; case "largest" : if ( ( e == "l" || e == "c" || e == "r" ) && ( v == Number . MIN _VALUE || v < l [ D ] . width ) || ( e == "t" || e == "m" || e == "b" ) && ( E == Number . MIN _VALUE || E < l [ D ] . height ) ) { z = l [ D ] . x ; H = l [ D ] . y ; w = l [ D ] . x + l [ D ] . width ; A = l [ D ] . y + l [ D ] . height ; v = l [ D ] . width ; E = l [ D ] . height } break ; default : if ( l [ D ] . x < z ) z = l [ D ] . x ; if ( l [ D ] . y < H ) H = l [ D ] . y ; if ( l [ D ] . x + l [ D ] . width > w ) w = l [ D ] . x + l [ D ] . width ; if ( l [ D ] . y + l [ D ] . height > A ) A = l [ D ] . y + l [ D ] . height } } if ( h == "page" ) { H = z = 0 ; w = b . contentW ; A = b . contentH } v = Array ( I ) ; E = Array ( I ) ; for ( D = 0 ; D < I ; ++ D ) { if ( J [ D ] == null ) break ;
var G = l [ D ] ; v [ D ] = 0 ; E [ D ] = 0 ; switch ( e ) { case "l" : v [ D ] = z - G . x ; break ; case "c" : v [ D ] = ( z + w ) / 2 - ( G . x + G . width / 2 ) ; break ; case "r" : v [ D ] = w - ( G . x + G . width ) ; break ; case "t" : E [ D ] = H - G . y ; break ; case "m" : E [ D ] = ( H + A ) / 2 - ( G . y + G . height / 2 ) ; break ; case "b" : E [ D ] = A - ( G . y + G . height ) } } this . moveSelectedElements ( v , E ) } } ; this . contentW = Db ( ) . w ; this . contentH = Db ( ) . h ; this . updateCanvas = function ( e , h ) { d . setAttribute ( "width" , e ) ; d . setAttribute ( "height" , h ) ; var l = $ ( "#canvasBackground" ) [ 0 ] , z = m . getAttribute ( "x" ) , w = m . getAttribute ( "y" ) , H = e / 2 - this . contentW * o /
2 , A = h / 2 - this . contentH * o / 2 ; na ( m , { width : this . contentW * o , height : this . contentH * o , x : H , y : A , viewBox : "0 0 " + this . contentW + " " + this . contentH } ) ; na ( l , { width : m . getAttribute ( "width" ) , height : m . getAttribute ( "height" ) , x : H , y : A } ) ; ( l = pa ( "background_image" ) ) && na ( l , { width : "100%" , height : "100%" } ) ; Ca . selectorParentGroup . setAttribute ( "transform" , "translate(" + H + "," + A + ")" ) ; return { x : H , y : A , old _x : z , old _y : w , d _x : H - z , d _y : A - w } } ; this . setBackground = function ( e , h ) { var l = pa ( "canvasBackground" ) , z = $ ( l ) . find ( "rect" ) [ 0 ] , w = pa ( "background_image" ) ;
z . setAttribute ( "fill" , e ) ; if ( h ) { if ( ! w ) { w = f . createElementNS ( c , "image" ) ; na ( w , { id : "background_image" , width : "100%" , height : "100%" , preserveAspectRatio : "xMinYMin" , style : "pointer-events:none" } ) } W ( w , h ) ; l . appendChild ( w ) } else w && w . parentNode . removeChild ( w ) } ; this . cycleElement = function ( e ) { var h = J [ 0 ] , l = false , z = pb ( K || B ( ) . getCurrentLayer ( ) ) ; if ( z . length ) { if ( h == null ) { e = e ? z . length - 1 : 0 ; l = z [ e ] } else for ( var w = z . length ; w -- ; ) if ( z [ w ] == h ) { e = e ? w - 1 : w + 1 ; if ( e >= z . length ) e = 0 ; else if ( e < 0 ) e = z . length - 1 ; l = z [ e ] ; break } Cb ( [ l ] , true ) ; N ( "selected" ,
J ) } } ; this . clear ( ) ; this . getPrivateMethods = function ( ) { return { addCommandToHistory : ya , setGradient : Ob , addSvgElementFromJson : Q , assignAttributes : na , BatchCommand : Ea , call : N , ChangeElementCommand : Ka , copyElem : ja , ffClone : ea , findDefs : mb , findDuplicateGradient : Nb , getElem : pa , getId : ca , getIntersectionList : tb , getMouseTarget : ob , getNextId : la , getPathBBox : Z , getUrlFromAttr : ka , hasMatrixTransform : qa , identifyLayers : Fb , InsertElementCommand : Ia , isIdentity : svgedit . math . isIdentity , logMatrix : Xa , matrixMultiply : ia , MoveElementCommand : Fa ,
preventClickDefault : Ib , recalculateAllSelectedDimensions : Ga , recalculateDimensions : Wa , remapElement : bb , RemoveElementCommand : La , removeUnusedDefElems : Pb , round : gb , runExtensions : nb , sanitizeSvg : Ha , SVGEditTransformList : svgedit . transformlist . SVGTransformList , toString : toString , transformBox : svgedit . math . transformBox , transformListToTransform : ga , transformPoint : P , 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 p ( d , m ) { var q = g . setSvgString ( d ) !== false ; m = m || a . noop ; q ? m ( true ) : a . alert ( uiStrings . notification . errorLoadingSVG , function ( ) { m ( false ) } ) } var g , c = { } , n = false ; curConfig = { canvas _expansion : 1 , dimensions : [ 580 , 400 ] ,
2012-07-24 12:42:34 +00:00
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-25 06:32:18 +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 ( m , q ) { m in defaultPrefs && a . pref ( m , q ) } ) ; 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 ( k , u ) { var C = k . id , F = C . split ( "_" ) , O = F [ 0 ] ; F = F [ 1 ] ; u && g . setStrokeAttr ( "stroke-" + O , F ) ; wa ( ) ; wb ( "#cur_" + O , C , 20 ) ; a ( k ) . addClass ( "current" ) . siblings ( ) . removeClass ( "current" ) }
function m ( k , u ) { var C = document . getElementById ( "ruler_x_cursor" ) , F = document . getElementById ( "ruler_y_cursor" ) , O = document . getElementById ( "workarea" ) ; document . getElementById ( "title_show" ) ; svgedit . browser . isTouch ( ) && a ( "#workarea" ) . unbind ( "mousemove.rulers" ) . bind ( "mousemove.rulers" , function ( Sb ) { Sb . stopPropagation ( ) ; C . style . left = Sb . pageX - 66 + O . scrollLeft + "px" ; F . style . top = Sb . pageY - 48 + O . scrollTop + "px" } ) ; u || ( u = g . getZoom ( ) ) ; k || ( k = a ( "#svgcanvas" ) ) ; for ( var V = g . getContentElem ( ) , T = svgedit . units . getTypeMap ( ) [ curConfig . baseUnit ] ,
X = 0 ; X < 2 ; X ++ ) { var aa = X === 0 , fa = aa ? "x" : "y" , ra = aa ? "width" : "height" , Pa = V . getAttribute ( fa ) - 0 ; fa = a ( "#ruler_" + fa + " canvas:first" ) ; $hcanv = fa . clone ( ) ; fa . replaceWith ( $hcanv ) ; var Da = $hcanv [ 0 ] ; var ha = fa = k [ ra ] ( ) * 2 ; Da . parentNode . style [ ra ] = ha + "px" ; var $a = 0 , Sa , ta = Da . getContext ( "2d" ) ; ta . fillStyle = "rgb(200,0,0)" ; ta . fillRect ( 0 , 0 , Da . width , Da . height ) ; $hcanv . siblings ( ) . remove ( ) ; if ( fa >= 3E4 ) { var Na = parseInt ( fa / 3E4 ) + 1 ; Sa = Array ( Na ) ; Sa [ 0 ] = ta ; for ( var va = 1 ; va < Na ; va ++ ) { Da [ ra ] = 3E4 ; var ab = Da . cloneNode ( true ) ; Da . parentNode . appendChild ( ab ) ;
Sa [ va ] = ab . getContext ( "2d" ) } ab [ ra ] = fa % 3E4 ; fa = 3E4 } Da [ ra ] = fa ; ra = T * u ; var Ua = 50 / ra ; Da = 1 ; for ( va = 0 ; va < I . length ; va ++ ) { Da = Na = I [ va ] ; if ( Ua <= Na ) break } Ua = Da * ra ; ta . font = "normal 9px 'Lucida Grande', sans-serif" ; ta . fillStyle = "#777" ; for ( var db = Pa / ra % Da * ra , Hb = db - Ua ; db < ha ; db += Ua ) { Hb += Ua ; va = Math . round ( db ) + 0.5 ; if ( aa ) { ta . moveTo ( va , 15 ) ; ta . lineTo ( va , 0 ) } else { ta . moveTo ( 15 , va ) ; ta . lineTo ( 0 , va ) } Na = ( Hb - Pa ) / ra ; if ( Da >= 1 ) va = Math . round ( Na ) ; else { va = ( Da + "" ) . split ( "." ) [ 1 ] . length ; va = Na . toFixed ( va ) - 0 } if ( va !== 0 && va !== 1E3 && va % 1E3 === 0 ) va =
va / 1E3 + "K" ; if ( aa ) { ta . fillText ( va , db + 2 , 8 ) ; ta . fillStyle = "#777" } else { Na = ( va + "" ) . split ( "" ) ; for ( va = 0 ; va < Na . length ; va ++ ) { ta . fillText ( Na [ va ] , 1 , db + 9 + va * 9 ) ; ta . fillStyle = "#777" } } Na = Ua / 10 ; for ( va = 1 ; va < 10 ; va ++ ) { var xb = Math . round ( db + Na * va ) + 0.5 ; if ( Sa && xb > fa ) { $a ++ ; ta . stroke ( ) ; if ( $a >= Sa . length ) { va = 10 ; db = ha ; continue } ta = Sa [ $a ] ; db -= 3E4 ; xb = Math . round ( db + Na * va ) + 0.5 } var Gb = va % 2 ? 12 : 10 ; if ( aa ) { ta . moveTo ( xb , 15 ) ; ta . lineTo ( xb , Gb ) } else { ta . moveTo ( 15 , xb ) ; ta . lineTo ( Gb , xb ) } } } ta . strokeStyle = "#666" ; ta . stroke ( ) } } ( function ( ) { var k = window . opener ;
if ( k ) try { var u = k . document . createEvent ( "Event" ) ; u . initEvent ( "svgEditorReady" , true , true ) ; k . document . documentElement . dispatchEvent ( u ) } catch ( C ) { } } ) ( ) ; ( function ( ) { a ( "#canvas_width" ) . val ( curConfig . dimensions [ 0 ] ) ; a ( "#canvas_height" ) . val ( curConfig . dimensions [ 1 ] ) ; a ( "body" ) . toggleClass ( "touch" , svgedit . browser . isTouch ( ) ) ; var k = a . deparam . querystring ( true ) ; if ( ! a . isEmptyObject ( k ) ) { if ( k . dimensions ) k . dimensions = k . dimensions . split ( "," ) ; if ( k . extensions ) k . extensions = k . extensions . split ( "," ) ; if ( k . bkgd _color ) k . bkgd _color =
"#" + k . bkgd _color ; svgEditor . setConfig ( k ) ; var u = k . source , C = a . param . querystring ( ) ; if ( ! u ) if ( C . indexOf ( "source=data:" ) >= 0 ) u = C . match ( /source=(data:[^&]*)/ ) [ 1 ] ; if ( u ) if ( u . indexOf ( "data:" ) === 0 ) { u = u . replace ( / /g , "+" ) ; c . loadFromDataURI ( u ) } else c . loadFromString ( u ) ; else if ( C . indexOf ( "paramurl=" ) !== - 1 ) svgEditor . loadFromURL ( C . substr ( 9 ) ) ; else k . url && svgEditor . loadFromURL ( k . url ) } } ) ( ) ; var q = function ( ) { a . each ( curConfig . extensions , function ( ) { var k = this ; a . getScript ( curConfig . extPath + k , function ( u ) { if ( ! u ) { u = document . createElement ( "script" ) ;
u . src = curConfig . extPath + k ; document . querySelector ( "head" ) . appendChild ( u ) } } ) } ) } ; document . location . protocol === "file:" ? setTimeout ( q , 100 ) : q ( ) ; 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" ,
2012-07-25 06:32:18 +00:00
"#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 , "#fill_bg .svg_icon, #stroke_bg .svg_icon" : svgedit . browser . isTouch ( ) ? 24 : 24 , ".palette_item:first .svg_icon" : svgedit . browser . isTouch ( ) ? 30 : 16 , "#zoomLabel .svg_icon" : 16 , "#zoom_dropdown .svg_icon" : 7 } , callback : function ( ) { a ( ".toolbar_button button > svg, .toolbar_button button > img" ) . each ( function ( ) { a ( this ) . parent ( ) . prepend ( this ) } ) ;
a ( ".tool_button, .tool_button_current" ) . addClass ( "loaded" ) ; var k = a ( "#tools_left" ) ; if ( k . length != 0 ) { k . offset ( ) ; k . outerHeight ( ) } a ( ".tools_flyout" ) . each ( function ( ) { var u = a ( "#" + this . id + "_show" ) , C = u . attr ( "data-curopt" ) ; if ( ! u . children ( "svg, img" ) . length ) { C = a ( C ) . children ( ) . clone ( ) ; if ( C . length ) { C [ 0 ] . removeAttribute ( "style" ) ; u . append ( C ) } } } ) ; svgEditor . runCallbacks ( ) ; setTimeout ( function ( ) { a ( ".flyout_arrow_horiz:empty" ) . each ( function ( ) { a ( this ) . append ( a . getSvgIcon ( "arrow_right" ) . width ( 5 ) . height ( 5 ) ) } ) } , 1 ) } } ) ; a ( "#rulers" ) . on ( "dblclick" ,
function ( k ) { a ( "#base_unit_container" ) . css ( { top : k . pageY - 10 , left : k . pageX - 50 , display : "block" } ) } ) ; a ( "#base_unit_container" ) . on ( "mouseleave mouseenter" , function ( ) { t = setTimeout ( function ( ) { a ( "#base_unit_container" ) . fadeOut ( 500 ) } , 200 ) ; event . type == "mouseover" && clearTimeout ( t ) } ) ; a ( "#base_unit" ) . on ( "change" , function ( ) { savePreferences ( ) } ) ; c . canvas = g = new a . SvgCanvas ( document . getElementById ( "svgcanvas" ) , curConfig ) ; c . show _save _warning = false ; c . paintBox = { fill : null , stroke : null , canvas : null } ; q = navigator . platform . indexOf ( "Mac" ) >=
0 ; var B = navigator . userAgent . indexOf ( "AppleWebKit" ) >= 0 , o = q ? "meta+" : "ctrl+" , K = g . pathActions , S = g . undoMgr , M = svgedit . utilities , J = curConfig . imgPath + "placeholder.svg" , Q = a ( "#workarea" ) , Y = null , P = 1 , ia = "toolbars" , qa = "" ; q || a ( ".shortcut" ) . each ( function ( ) { var k = a ( this ) . text ( ) ; a ( this ) . text ( k . split ( "\u2318" ) . join ( "Ctrl+" ) ) } ) ; ( function ( ) { a ( "#dialog_container" ) . draggable ( { cancel : "#dialog_content, #dialog_buttons *" , containment : "window" } ) ; var k = a ( "#dialog_box" ) , u = a ( "#dialog_buttons" ) , C = function ( F , O , V , T ) { a ( "#dialog_content" ) . html ( "<p>" +
O . replace ( /\n/g , "</p><p>" ) + "</p>" ) . toggleClass ( "prompt" , F == "prompt" ) ; u . empty ( ) ; var X = a ( '<input type="button" value="' + uiStrings . common . ok + '">' ) . appendTo ( u ) ; F != "alert" && a ( '<input type="button" value="' + uiStrings . common . cancel + '">' ) . appendTo ( u ) . on ( "click, touchstart" , function ( ) { k . hide ( ) ; V ( false ) } ) ; if ( F == "prompt" ) { var aa = a ( '<input type="text">' ) . prependTo ( u ) ; aa . val ( T || "" ) ; aa . bind ( "keydown" , "return" , function ( ) { X . trigger ( "click touchstart" ) } ) } F == "process" && X . hide ( ) ; k . show ( ) ; X . on ( "click touchstart" , function ( ) { k . hide ( ) ;
var fa = F == "prompt" ? aa . val ( ) : true ; V && V ( fa ) } ) . focus ( ) ; F == "prompt" && aa . focus ( ) } ; a . alert = function ( F , O ) { C ( "alert" , F , O ) } ; a . confirm = function ( F , O ) { C ( "confirm" , F , O ) } ; a . process _cancel = function ( F , O ) { C ( "process" , F , O ) } ; a . prompt = function ( F , O , V ) { C ( "prompt" , F , V , O ) } } ) ( ) ; var ga = function ( ) { var k = a ( ".tool_button_current" ) ; if ( k . length && k [ 0 ] . id !== "tool_select" ) { k . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( "#tool_select" ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) } g . setMode ( "select" ) } ,
U = null , ba = false , xa = false , ka = "" , da = function ( k , u ) { var C = g . getResolution ( ) ; a ( "#svgcanvas" ) . position ( ) ; var F = g . setBBoxZoom ( u , Q . width ( ) - 15 , Q . height ( ) - 15 ) ; if ( F ) { var O = F . zoom ; F = F . bbox ; if ( O < 0.0010 ) Ca ( { value : 0.1 } ) ; else { var V = Date . now ( ) , T = O - C . zoom ; a ( "#zoom" ) ; var X = C . zoom , aa = function ( fa ) { fa = ( fa - V ) / 500 ; fa = Math . pow ( fa - 1 , 3 ) + 1 ; g . setZoom ( X + T * fa ) ; E ( ) ; fa < 1 ? requestAnimationFrame ( aa ) : a ( "#zoom" ) . val ( O * 100 ) } ; aa ( Date . now ( ) ) ; g . getMode ( ) == "zoom" && F . width && ga ( ) ; Db ( ) } } } ; a ( "#cur_context_panel" ) . delegate ( "a" , "click" , function ( ) { var k =
a ( this ) ; k . attr ( "data-root" ) ? g . leaveContext ( ) : g . setContext ( k . text ( ) ) ; return false } ) ; var W = function ( ) { c . paintBox . fill . prep ( ) ; c . paintBox . stroke . prep ( ) } , Z = { } , oa = function ( k ) { a . each ( k , function ( u , C ) { var F = a ( u ) . children ( ) , O = u + "_show" , V = a ( O ) , T = false ; F . addClass ( "tool_button" ) . unbind ( "click mousedown mouseup" ) . each ( function ( fa ) { var ra = C [ fa ] ; Z [ ra . sel ] = ra . fn ; if ( ra . isDefault ) T = fa ; fa = function ( Pa ) { var Da = ra ; if ( Pa . type === "keydown" ) { var ha = a ( Da . parent + "_show" ) . hasClass ( "tool_button_current" ) , $a = a ( Da . parent + "_show" ) . attr ( "data-curopt" ) ;
a . each ( k [ ra . parent ] , function ( ta , Na ) { if ( Na . sel == $a ) Da = ! Pa . shiftKey || ! ha ? Na : k [ ra . parent ] [ ta + 1 ] || k [ ra . parent ] [ 0 ] } ) } if ( a ( this ) . hasClass ( "disabled" ) ) return false ; Va ( O ) && Da . fn ( ) ; var Sa = Da . icon ? a . getSvgIcon ( Da . icon , true ) : a ( Da . sel ) . children ( ) . eq ( 0 ) . clone ( ) ; Sa [ 0 ] . setAttribute ( "width" , V . width ( ) ) ; Sa [ 0 ] . setAttribute ( "height" , V . height ( ) ) ; V . children ( ":not(.flyout_arrow_horiz)" ) . remove ( ) ; V . append ( Sa ) . attr ( "data-curopt" , Da . sel ) } ; a ( this ) . mouseup ( fa ) ; ra . key && a ( document ) . bind ( "keydown" , ra . key [ 0 ] + " shift+" + ra . key [ 0 ] ,
fa ) } ) ; if ( T ) V . attr ( "data-curopt" , C [ T ] . sel ) ; else V . attr ( "data-curopt" ) || V . attr ( "data-curopt" , C [ 0 ] . sel ) ; var X , aa = a ( O ) . position ( ) ; a ( u ) . css ( { left : aa . left + 34 , top : aa . top + 77 } ) ; V . mousedown ( function ( fa ) { a ( "#tools_shapelib" ) . is ( ":visible" ) && Va ( O , false ) ; if ( V . hasClass ( "disabled" ) ) return false ; var ra = a ( u ) , Pa = aa . left + 34 , Da = ra . width ( ) * - 1 , ha = ra . data ( "shown_popop" ) ? 200 : 0 ; X = setTimeout ( function ( ) { V . data ( "isLibrary" ) ? ra . css ( "left" , Pa ) . show ( ) : ra . css ( "left" , Da ) . show ( ) . animate ( { left : Pa } , 150 ) ; ra . data ( "shown_popop" , true ) } ,
ha ) ; fa . preventDefault ( ) } ) . mouseup ( function ( ) { clearTimeout ( X ) ; var fa = a ( this ) . attr ( "data-curopt" ) ; if ( V . data ( "isLibrary" ) && a ( O . replace ( "_show" , "" ) ) . is ( ":visible" ) ) Va ( O , true ) ; else Va ( O ) && fa in Z && Z [ fa ] ( ) } ) } ) ; ma ( ) } , pa = function ( k , u ) { return a ( "<div>" , { "class" : "tools_flyout" , id : k } ) . appendTo ( "#svg_editor" ) . append ( u ) } , na = function ( ) { a ( ".tools_flyout" ) . each ( function ( ) { var k = a ( "#" + this . id + "_show" ) , u = k . offset ( ) ; k = k . outerWidth ( ) ; a ( this ) . css ( { left : ( u . left + k ) * P , top : u . top } ) } ) } , ma = function ( ) { a ( ".tools_flyout" ) . each ( function ( ) { var k =
a ( "#" + this . id + "_show" ) ; if ( ! k . data ( "isLibrary" ) ) { var u = [ ] ; a ( this ) . children ( ) . each ( function ( ) { u . push ( this . title ) } ) ; k [ 0 ] . title = u . join ( " / " ) } } ) } , za , Ha = function ( k , u , C ) { var F = null ; if ( k . indexOf ( "url(#" ) === 0 ) { k = ( k = g . getRefElem ( k ) ) ? k . cloneNode ( true ) : a ( "#" + C + "_color defs *" ) [ 0 ] ; F = { alpha : u } ; F [ k . tagName ] = k } else F = k . indexOf ( "#" ) === 0 ? { alpha : u , solidColor : k . substr ( 1 ) } : { alpha : u , solidColor : "none" } ; return new a . jGraduate . Paint ( F ) } , Fa = g . getResolution ( ) ; if ( curConfig . baseUnit !== "px" ) { Fa . w = svgedit . units . convertUnit ( Fa . w ) +
curConfig . baseUnit ; Fa . h = svgedit . units . convertUnit ( Fa . h ) + curConfig . baseUnit } var Ia = function ( k ) { g . createLayer ( "background" ) ; cur _shape = g . addSvgElementFromJson ( { element : "rect" , attr : { x : - 1 , y : - 1 , width : Fa . w + 2 , height : Fa . h + 2 , stroke : "none" , id : "canvas_background" , opacity : 1 , fill : k || "#fff" , style : "pointer-events:none" } } ) ; g . setCurrentLayer ( "Layer 1" ) ; g . setCurrentLayerPosition ( "1" ) } ; document . getElementById ( "canvas_background" ) || Ia ( ) ; document . getElementById ( "canvas_background" ) . getAttribute ( "fill" ) ; var La = c . setImageURL =
function ( k ) { k || ( k = J ) ; g . setImageURL ( k ) ; a ( "#image_url" ) . val ( k ) } , Ka = function ( ) { var k = U ; if ( k != null && ! k . parentNode ) k = null ; if ( ba && ba [ 0 ] != null && ! ba [ 0 ] . parentNode ) ba = false ; g . getCurrentDrawing ( ) . getCurrentLayerName ( ) ; var u = g . getMode ( ) , C = curConfig . baseUnit !== "px" ? curConfig . baseUnit : null , F = u == "pathedit" , O = a ( "#cmenu_canvas li" ) ; a ( ".context_panel" ) . hide ( ) ; a ( ".menu_item" , "#edit_menu" ) . addClass ( "disabled" ) ; a ( ".menu_item" , "#object_menu" ) . addClass ( "disabled" ) ; if ( ba ) ( k = g . elementsAreSame ( ba ) ? ba [ 0 ] : null ) && a ( "#tools_top" ) . addClass ( "multiselected" ) ;
if ( ! k && ! ba ) { a ( "#tools_top" ) . removeClass ( "multiselected" ) ; a ( "#stroke_panel" ) . hide ( ) ; a ( "#canvas_panel" ) . show ( ) } if ( k != null ) { a ( "#stroke_panel" ) . show ( ) ; var V = k . nodeName , T = g . getRotationAngle ( k ) ; a ( "#angle" ) . val ( Math . round ( T ) ) ; T = g . getBlur ( k ) ; a ( "#blur" ) . val ( T ) ; if ( ! F && u != "pathedit" ) { a ( "#selected_panel" ) . show ( ) ; a ( ".action_selected" ) . removeClass ( "disabled" ) ; var X , aa ; if ( [ "g" , "polyline" , "path" ] . indexOf ( V ) >= 0 ) if ( u = g . getStrokedBBox ( [ k ] ) ) { X = u . x ; aa = u . y } if ( C ) { X = svgedit . units . convertUnit ( X ) ; aa = svgedit . units . convertUnit ( aa ) } a ( "#" +
V + "_x" ) . val ( Math . round ( X ) ) ; a ( "#" + V + "_y" ) . val ( Math . round ( aa ) ) ; [ "image" , "text" , "path" , "g" , "use" ] . indexOf ( V ) == - 1 && a ( ".action_path_convert_selected" ) . removeClass ( "disabled" ) ; V === "path" && a ( ".action_path_selected" ) . removeClass ( "disabled" ) } else { O = K . getNodePoint ( ) ; a ( "#tool_add_subpath" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; a ( "#tool_node_delete" ) . toggleClass ( "disabled" , ! K . canDeleteNodes ) ; wb ( "#tool_openclose_path" , K . closed _subpath ? "open_path" : "close_path" ) ; if ( O ) { V = a ( "#seg_type" ) ; if ( C ) { O . x =
svgedit . units . convertUnit ( O . x ) ; O . y = svgedit . units . convertUnit ( O . y ) } a ( "#path_node_x" ) . val ( Math . round ( O . x ) ) ; a ( "#path_node_y" ) . val ( Math . round ( O . y ) ) ; O . type ? V . val ( O . type ) . removeAttr ( "disabled" ) : V . val ( 4 ) . attr ( "disabled" , "disabled" ) } return } C = null ; if ( fa === "a" ) { C = g . getHref ( k ) ; a ( "#g_panel" ) . show ( ) } if ( k . parentNode . tagName === "a" ) if ( ! a ( k ) . siblings ( ) . length ) { a ( "#a_panel" ) . show ( ) ; C = g . getHref ( k . parentNode ) } a ( "#tool_make_link, #tool_make_link" ) . toggle ( ! C ) ; C && a ( "#link_url" ) . val ( C ) ; C = { 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 fa = k . tagName ; a ( k ) . data ( "gsvg" ) && a ( "#g_panel" ) . show ( ) ; fa == "path" && a ( "#path_panel" ) . show ( ) ; if ( C [ fa ] ) { C = C [ fa ] ; a ( "#" + fa + "_panel" ) . show ( ) ; fa == "rect" ? a ( "#cornerRadiusLabel" ) . show ( ) : a ( "#cornerRadiusLabel" ) . hide ( ) ; a . each ( C , function ( ra , Pa ) { var Da = k . getAttribute ( Pa ) ; if ( curConfig . baseUnit !== "px" && k [ Pa ] ) Da = svgedit . units . convertUnit ( k [ Pa ] . baseVal . value ) ; var ha = document . getElementById ( fa +
"_" + Pa ) ; ha . value = Math . round ( Da ) || 0 ; ha . getAttribute ( "data-cursor" ) === "true" && a . fn . dragInput . updateCursor ( ha ) } ) ; if ( fa == "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 ( k . getAttribute ( "font-family" ) ) ;
a ( "#font_size" ) . val ( k . getAttribute ( "font-size" ) ) ; a ( "#text" ) . val ( k . textContent ) ; g . addedNew && setTimeout ( function ( ) { a ( "#text" ) . focus ( ) . select ( ) } , 100 ) } else if ( fa == "image" ) La ( g . getHref ( k ) ) ; else if ( fa === "g" || fa === "use" ) { a ( "#container_panel" ) . show ( ) ; a ( ".action_group_selected" ) . removeClass ( "disabled" ) ; g . getTitle ( ) } } O [ ( fa === "g" ? "en" : "dis" ) + "ableContextMenuItems" ] ( "#ungroup" ) ; O [ ( fa === "g" || ! ba ? "dis" : "en" ) + "ableContextMenuItems" ] ( "#group" ) } else if ( ba ) { a ( "#multiselected_panel" ) . show ( ) ; a ( ".action_multi_selected" ) . removeClass ( "disabled" ) ;
O . enableContextMenuItems ( "#group" ) . disableContextMenuItems ( "#ungroup" ) } else O . disableContextMenuItems ( "#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back" ) ; S . getUndoStackSize ( ) > 0 ? a ( "#tool_undo" ) . removeClass ( "disabled" ) : a ( "#tool_undo" ) . addClass ( "disabled" ) ; S . getRedoStackSize ( ) > 0 ? a ( "#tool_redo" ) . removeClass ( "disabled" ) : a ( "#tool_redo" ) . addClass ( "disabled" ) ; g . addedNew = false } ; a ( "#text" ) . on ( "focus" , function ( ) { } ) ; a ( "#text" ) . on ( "blur" , function ( ) { } ) ; g . bind ( "selected" , function ( k ,
u ) { var C = g . getMode ( ) ; C === "select" && ga ( ) ; C = C == "pathedit" ; U = u . length == 1 || u [ 1 ] == null ? u [ 0 ] : null ; ba = u . length >= 2 && u [ 1 ] != null ? u : false ; if ( U != null ) if ( ! C ) { if ( U != null ) switch ( U . tagName ) { case "use" : case "image" : case "foreignObject" : break ; case "g" : case "a" : for ( var F = null , O = U . getElementsByTagName ( "*" ) , V = 0 , T = O . length ; V < T ; V ++ ) { var X = O [ V ] . getAttribute ( "stroke-width" ) ; if ( V === 0 ) F = X ; else if ( F !== X ) F = null } a ( "#stroke_width" ) . val ( F === null ? "" : F ) ; 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 ( U . getAttribute ( "stroke-width" ) || 1 ) ; a ( "#stroke_style" ) . val ( U . getAttribute ( "stroke-dasharray" ) || "none" ) ; F = U . getAttribute ( "stroke-linejoin" ) || "miter" ; a ( "#linejoin_" + F ) . length != 0 && d ( a ( "#linejoin_" + F ) [ 0 ] ) ; F = U . getAttribute ( "stroke-linecap" ) || "butt" ; a ( "#linecap_" + F ) . length != 0 && d ( a ( "#linecap_" + F ) [ 0 ] ) } if ( U != null ) { F = ( U . getAttribute ( "opacity" ) || 1 ) * 100 ; a ( "#group_opacity" ) . val ( F ) ; a ( "#opac_slider" ) . slider ( "option" , "value" , F ) ; a ( "#elem_id" ) . val ( U . id ) } } a ( "#path_node_panel" ) . toggle ( C ) ;
a ( "#tools_bottom_2,#tools_bottom_3" ) . toggle ( ! C ) ; if ( C ) { a ( ".tool_button_current" ) . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( "#tool_select" ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) ; wb ( "#tool_select" , "select_node" ) ; ba = false ; if ( u . length ) U = u [ 0 ] } else { if ( u [ 0 ] ) { C = g . selectorManager . requestSelector ( u [ 0 ] ) ; C . reset ( u [ 0 ] ) ; C . selectorRect . setAttribute ( "display" , "inline" ) } wb ( "#tool_select" , "select" ) } Ka ( ) ; g . runExtensions ( "selectedChanged" , { elems : u , selectedElement : U , multiselected : ba } ) } ) ;
g . bind ( "transition" , function ( k , u ) { var C = g . getMode ( ) , F = u [ 0 ] ; if ( F ) { ba = u . length >= 2 && u [ 1 ] != null ? u : null ; if ( ! ba ) switch ( C ) { case "rotate" : C = g . getRotationAngle ( F ) ; a ( "#angle" ) . val ( Math . round ( C ) ) ; rotateCursor ( C ) ; a ( "#tool_reorient" ) . toggleClass ( "disabled" , C == 0 ) } g . runExtensions ( "elementTransition" , { elems : u } ) } } ) ; g . bind ( "changed" , function ( k , u ) { var C = g . getMode ( ) ; C === "select" && ga ( ) ; for ( var F = 0 ; F < u . length ; ++ F ) { var O = u [ F ] ; if ( O && O . tagName === "svg" ) E ( ) ; else if ( O && U && U . parentNode == null ) U = O } c . show _save _warning = true ; Ka ( ) ;
if ( U && C === "select" ) { c . paintBox . fill . update ( ) ; c . paintBox . stroke . update ( ) } g . runExtensions ( "elementChanged" , { elems : u } ) } ) ; g . bind ( "saved" , function ( k , u ) { c . show _save _warning = false ; u = '<?xml version="1.0"?>\n' + u ; var C = navigator . userAgent ; if ( ~ C . indexOf ( "Chrome" ) && a . browser . version >= 533 || ~ C . indexOf ( "MSIE" ) ) mb ( 0 , true ) ; else { var F = k . open ( "data:image/svg+xml;base64," + M . encode64 ( u ) ) , O = a . pref ( "save_notice_done" ) ; if ( O !== "all" ) { var V = uiStrings . notification . saveFromBrowser . replace ( "%s" , "SVG" ) ; if ( C . indexOf ( "Gecko/" ) !==
- 1 ) if ( u . indexOf ( "<defs" ) !== - 1 ) { V += "\n\n" + uiStrings . notification . defsFailOnSave ; a . pref ( "save_notice_done" , "all" ) ; O = "all" } else a . pref ( "save_notice_done" , "part" ) ; else a . pref ( "save_notice_done" , "all" ) ; O !== "part" && F . alert ( V ) } } } ) ; g . bind ( "exported" , function ( k , u ) { var C = u . issues ; a ( "#export_canvas" ) . length || a ( "<canvas>" , { id : "export_canvas" } ) . hide ( ) . appendTo ( "body" ) ; var F = a ( "#export_canvas" ) [ 0 ] ; F . width = g . contentW ; F . height = g . contentH ; canvg ( F , u . svg , { renderCallback : function ( ) { var O = F . toDataURL ( "image/png" ) ; Y . location . href =
O ; if ( a . pref ( "export_notice_done" ) !== "all" ) { O = uiStrings . notification . saveFromBrowser . replace ( "%s" , "PNG" ) ; if ( C . length ) O += "\n\n" + uiStrings . notification . noteTheseIssues + "\n \u2022 " + C . join ( "\n \u2022 " ) ; a . pref ( "export_notice_done" , "all" ) ; Y . alert ( O ) } } } ) } ) ; g . bind ( "zoomed" , da ) ; g . bind ( "contextset" , function ( k , u ) { var C = "" ; if ( u ) { var F = "" ; C = '<a href="#" data-root="y">' + g . getCurrentDrawing ( ) . getCurrentLayerName ( ) + "</a>" ; a ( u ) . parentsUntil ( "#svgcontent > g" ) . andSelf ( ) . each ( function ( ) { if ( this . id ) { F += " > " + this . id ;
C += this !== u ? ' > <a href="#">' + this . id + "</a>" : " > " + this . id } } ) ; ka = F } else ka = null ; a ( "#cur_context_panel" ) . toggle ( ! ! u ) . html ( C ) ; Nb ( ) } ) ; g . bind ( "extension_added" , function ( k , u ) { function C ( ) { if ( za ) { clearTimeout ( za ) ; za = null } O || ( za = setTimeout ( function ( ) { O = true ; e ( s . iconsize ) } , 50 ) ) } var F = false , O = false , V = true , T = function ( ) { if ( u . callback && ! F && V ) { F = true ; u . callback ( ) } } , X = [ ] ; u . context _tools && a . each ( u . context _tools , function ( Da , ha ) { var $a = ha . container _id ? ' id="' + ha . container _id + '"' : "" , Sa = a ( "#" + ha . panel ) ; Sa . length || ( Sa =
a ( "<div>" , { id : ha . panel } ) . appendTo ( "#tools_top" ) . hide ( ) ) ; switch ( ha . type ) { case "tool_button" : var ta = '<div class="tool_button">' + ha . id + "</div>" , Na = a ( ta ) . appendTo ( Sa ) ; ha . events && a . each ( ha . events , function ( Ua , db ) { a ( Na ) . bind ( Ua , db ) } ) ; break ; case "select" : ta = "<label" + $a + '><select id="' + ha . id + '">' ; a . each ( ha . options , function ( Ua , db ) { ta += '<option value="' + Ua + '"' + ( Ua == ha . defval ? " selected" : "" ) + ">" + db + "</option>" } ) ; ta += "</select></label>" ; var va = a ( ta ) . appendTo ( Sa ) . find ( "select" ) ; a . each ( ha . events , function ( Ua , db ) { a ( va ) . bind ( Ua ,
db ) } ) ; break ; case "button-select" : ta = '<div id="' + ha . id + '" class="dropdown toolset" title="' + ha . title + '"><div id="cur_' + ha . id + '" class="icon_label"></div><button></button></div>' ; $a = a ( '<ul id="' + ha . id + '_opts"></ul>' ) . appendTo ( "#option_lists" ) ; ha . colnum && $a . addClass ( "optcols" + ha . colnum ) ; a ( ta ) . appendTo ( Sa ) . children ( ) ; X . push ( { elem : "#" + ha . id , list : "#" + ha . id + "_opts" , title : ha . title , callback : ha . events . change , cur : "#cur_" + ha . id } ) ; break ; case "input" : ta = "<label" + $a + '><span id="' + ha . id + '_label">' + ha . label + ':</span><input id="' +
ha . id + '" title="' + ha . title + '" size="' + ( ha . size || "4" ) + '" value="' + ( ha . defval || "" ) + '" type="text"/></label>' ; var ab = a ( ta ) . appendTo ( Sa ) . find ( "input" ) ; ha . spindata && ab . SpinButton ( ha . spindata ) ; ha . events && a . each ( ha . events , function ( Ua , db ) { ab . bind ( Ua , db ) } ) } } ) ; if ( u . buttons ) { var aa = { } , fa = { } , ra = u . svgicons , Pa = { } ; a . each ( u . buttons , function ( Da , ha ) { for ( var $a , Sa = ha . id , ta = Da ; a ( "#" + Sa ) . length ; ) Sa = ha . id + "_" + ++ ta ; if ( ra ) { aa [ Sa ] = ha . icon ; ta = ha . svgicon ? ha . svgicon : ha . id ; if ( ha . type == "app_menu" ) fa [ "#" + Sa + " > div" ] = ta ; else fa [ "#" +
Sa ] = ta } else $a = ha . type == "menu" ? "" : a ( '<img src="' + ha . icon + '">' ) ; var Na , va ; switch ( ha . type ) { case "mode_flyout" : case "mode" : Na = "tool_button" ; if ( ha . cls ) Na += " " + ha . cls ; va = "#tools_left" ; break ; case "context" : Na = "tool_button" ; va = "#" + ha . panel ; a ( va ) . length || a ( "<div>" , { id : ha . panel } ) . appendTo ( "#tools_top" ) ; break ; case "menu" : Na = "menu_item tool_button" ; va = "#" + ( ha . after || ha . panel ) ; break ; case "app_menu" : Na = "" ; va = ha . parent || "#main_menu ul" ; a ( va ) . length || a ( "<div>" , { id : ha . panel } ) . appendTo ( "#tools_top" ) } var ab = a ( ha . list ||
ha . type == "app_menu" ? "<li/>" : "<div/>" ) . attr ( "id" , Sa ) . attr ( "title" , ha . title ) . addClass ( Na ) ; if ( ! ha . includeWith && ! ha . list ) { if ( "position" in ha ) a ( va ) . children ( ) . eq ( ha . position ) . before ( ab ) ; else ha . type != "menu" || ! ha . after ? ab . appendTo ( va ) : a ( va ) . after ( ab ) ; if ( ha . type == "mode_flyout" ) { ta = a ( ab ) ; Na = ta . parent ( ) ; if ( ! ta . parent ( ) . hasClass ( "tools_flyout" ) ) { var Ua = ta [ 0 ] . id . replace ( "tool_" , "tools_" ) , db = ta . clone ( ) . attr ( "id" , Ua + "_show" ) . append ( a ( "<div>" , { "class" : "flyout_arrow_horiz" } ) ) ; ta . before ( db ) ; Na = pa ( Ua , ta ) ; Na . data ( "isLibrary" ,
true ) ; db . data ( "isLibrary" , true ) } fa [ "#" + Ua + "_show" ] = ha . id ; Sa = Pa [ "#" + Na [ 0 ] . id ] = [ { sel : "#" + Sa , fn : ha . events . click , icon : ha . id , isDefault : true } , Hb ] } else if ( ha . type == "app_menu" || ha . type == "menu" ) ab . append ( ha . title ) } else if ( ha . list ) { ab . addClass ( "push_button" ) ; a ( "#" + ha . list + "_opts" ) . append ( ab ) ; if ( ha . isDefault ) { a ( "#cur_" + ha . list ) . append ( ab . children ( ) . clone ( ) ) ; ta = ha . svgicon ? ha . svgicon : ha . id ; fa [ "#cur_" + ha . list ] = ta } } else if ( ha . includeWith ) { va = ha . includeWith ; ta = a ( va . button ) ; Na = ta . parent ( ) ; if ( ! ta . parent ( ) . hasClass ( "tools_flyout" ) ) { Ua =
ta [ 0 ] . id . replace ( "tool_" , "tools_" ) ; db = ta . clone ( ) . attr ( "id" , Ua + "_show" ) . append ( a ( "<div>" , { "class" : "flyout_arrow_horiz" } ) ) ; ta . before ( db ) ; Na = pa ( Ua , ta ) } var Hb = v . getButtonData ( va . button ) ; if ( va . isDefault ) fa [ "#" + Ua + "_show" ] = ha . id ; Sa = Pa [ "#" + Na [ 0 ] . id ] = [ { sel : "#" + Sa , fn : ha . events . click , icon : ha . id , key : ha . key , isDefault : ha . includeWith ? ha . includeWith . isDefault : 0 } , Hb ] ; Ua = "position" in va ? va . position : "last" ; Hb = Na . children ( ) . length ; if ( ! isNaN ( Ua ) && Ua >= 0 && Ua < Hb ) Na . children ( ) . eq ( Ua ) . before ( ab ) ; else { Na . append ( ab ) ; Sa . reverse ( ) } } ra ||
ab . append ( $a ) ; ha . list || a . each ( ha . events , function ( xb , Gb ) { if ( xb == "click" ) if ( ha . type == "mode" ) { ha . includeWith ? ab . bind ( xb , Gb ) : ab . bind ( xb , function ( ) { Va ( ab ) && Gb ( ) } ) ; if ( ha . key ) { a ( document ) . bind ( "keydown" , ha . key , Gb ) ; ha . title && ab . attr ( "title" , ha . title + " [" + ha . key + "]" ) } } else ab . bind ( xb , Gb ) ; else ab . bind ( xb , Gb ) } ) ; oa ( Pa ) } ) ; a . each ( X , function ( ) { Ya ( this . elem , this . list , this . callback , { seticon : true } ) } ) ; if ( ra ) V = false ; a . svgIcons ( ra , { w : 27 , h : 27 , id _match : false , no _img : ! B , fallback : aa , placement : fa , callback : function ( ) { s . iconsize &&
s . iconsize != "m" && C ( ) ; V = true ; T ( ) } } ) } T ( ) } ) ; g . textActions . setInputElem ( a ( "#text" ) [ 0 ] ) ; var Ea = '<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 ( k , u ) { Ea += '<div class="palette_item" style="background-color: ' + u + ';" data-rgb="' + u + '"></div>' } ) ; a ( "#palette" ) . append ( Ea ) ; var ya = a ( "#tool_angle_indicator" ) ; a ( "#tool_reorient" ) ; rotateCursor = function ( k ) { k = "rotate(" + k + "deg)" ; ya . css ( { "-webkit-transform" : k , "-moz-transform" : k , "-o-transform" : k , "-ms-transform" : k , transform : k } ) } ; var Ca = function ( k ) { var u = k . value / 100 ; if ( u < 0.0010 ) k . value = 0.1 ; else { k = g . getZoom ( ) ; da ( window , { width : 0 , height : 0 , x : ( Q [ 0 ] . scrollLeft + Q . width ( ) / 2 ) / k , y : ( Q [ 0 ] . scrollTop + Q . height ( ) /
2 ) / k , zoom : u } , true ) } } , wa = 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 ) ; wa ( ) } ) ; a ( "#seg_type" ) . change ( function ( ) { g . setSegType ( a ( this ) . val ( ) ) ; a ( "#seg_type_label" ) . html ( this . options [ this . selectedIndex ] . text ) } ) ; a ( "select" ) . change ( function ( ) { a ( this ) . blur ( ) } ) ; a ( "#font_family" ) . change ( function ( ) { g . setFontFamily ( this . value ) } ) ; a ( "#text" ) . keyup ( function ( ) { g . setTextContent ( this . value ) } ) ;
changeAttribute = function ( k , u ) { var C = k . getAttribute ( "data-attr" ) , F = k . value ; if ( ! svgedit . units . isValidUnit ( C , F , U ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; k . value = U . getAttribute ( C ) ; return false } u ? g . changeSelectedAttributeNoUndo ( C , F ) : g . changeSelectedAttribute ( C , F ) } ; a ( "#palette" ) . mouseover ( function ( ) { var k = a ( '<input type="hidden">' ) ; a ( this ) . append ( k ) ; k . focus ( ) . remove ( ) } ) ; a ( ".palette_item" ) . on ( "mousedown touchstart touchmove" , function ( ) { var k = a ( "#tool_stroke" ) . hasClass ( "active" ) , u = k ? "stroke" :
"fill" , C = a ( this ) . attr ( "data-rgb" ) , F = null ; if ( C === "transparent" || C === "initial" || C === "#none" ) { C = "none" ; F = new a . jGraduate . Paint } else F = new a . jGraduate . Paint ( { alpha : 100 , solidColor : C . substr ( 1 ) } ) ; c . paintBox [ u ] . setPaint ( F ) ; if ( k ) { g . setColor ( "stroke" , C ) ; C != "none" && g . getStrokeOpacity ( ) != 1 && g . setPaintOpacity ( "stroke" , 1 ) } else { g . setColor ( "fill" , C ) ; C != "none" && g . getFillOpacity ( ) != 1 && g . setPaintOpacity ( "fill" , 1 ) } } ) . bind ( "contextmenu" , function ( k ) { k . preventDefault ( ) } ) ; a ( "#toggle_stroke_tools" ) . toggle ( function ( ) { a ( ".stroke_tool" ) . css ( "display" ,
"table-cell" ) ; a ( this ) . addClass ( "expanded" ) ; z ( ) } , function ( ) { a ( ".stroke_tool" ) . css ( "display" , "none" ) ; a ( this ) . removeClass ( "expanded" ) ; z ( ) } ) ; var Va = function ( k , u ) { if ( a ( k ) . hasClass ( "disabled" ) ) return false ; if ( a ( k ) . parent ( ) . hasClass ( "tools_flyout" ) ) return true ; var C = C || "normal" ; u || a ( ".tools_flyout" ) . fadeOut ( C ) ; a ( "#styleoverrides" ) . text ( "" ) ; a ( ".tool_button_current" ) . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( k ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) ; return true } ; ( function ( ) { var k =
null , u = null , C = Q [ 0 ] , F = false , O = false ; a ( "#svgcanvas" ) . bind ( "mousemove mouseup touchend" , function ( V ) { if ( F !== false ) { C . scrollLeft -= V . clientX - k ; C . scrollTop -= V . clientY - u ; k = V . clientX ; u = V . clientY ; if ( V . type === "mouseup" || V . type === "touchend" ) F = false ; return false } } ) . on ( "mousedown touchmove" , function ( V ) { if ( V . button === 1 || O === true || V . originalEvent . touches && V . originalEvent . touches . length >= 2 ) { F = true ; k = V . clientX ; u = V . clientY ; return false } } ) ; a ( window ) . mouseup ( function ( ) { F = false ; a ( "body" ) . removeClass ( "dragging" ) } ) ; a ( document ) . bind ( "keydown" ,
"space" , function ( V ) { V . preventDefault ( ) ; g . spaceKey = O = true } ) . bind ( "keyup" , "space" , function ( V ) { V . preventDefault ( ) ; g . spaceKey = O = false } ) . bind ( "keydown" , "alt" , function ( ) { g . getMode ( ) === "zoom" && Q . addClass ( "out" ) } ) . bind ( "keyup" , "alt" , function ( ) { g . getMode ( ) === "zoom" && Q . removeClass ( "out" ) } ) } ) ( ) ; var yb = a ( ".menu" ) , ib = function ( k ) { k . target . style . background = "#fff" ; setTimeout ( function ( ) { k . target . style . background = "#ddd" } , 50 ) ; setTimeout ( function ( ) { k . target . style . background = "#fff" } , 150 ) ; setTimeout ( function ( ) { k . target . style . background =
"#ddd" } , 200 ) ; setTimeout ( function ( ) { k . target . style . background = "" } , 200 ) ; setTimeout ( function ( ) { a ( "#menu_bar" ) . removeClass ( "active" ) } , 220 ) ; return false } ; a ( ".menu_item" ) . on ( "mousedown touchstart" , function ( k ) { ib ( k ) } ) ; a ( "svg, body" ) . on ( "mousedown touchstart" , function ( k ) { top != self && ! k . isTrigger && typeof top . exports . setEditorFocus == "function" && top . exports . setEditorFocus ( ) ; if ( ! a ( k . target ) . hasClass ( "menu_title" ) && ! a ( k . target ) . parent ( ) . hasClass ( "menu_title" ) ) ! a ( k . target ) . hasClass ( "disabled" ) && a ( k . target ) . hasClass ( "menu_item" ) ?
ib ( k ) : a ( "#menu_bar" ) . removeClass ( "active" ) } ) ; var Qa = [ 6 , 12 , 16 , 33 , 50 , 66 , 100 , 150 , 200 , 300 , 400 , 600 , 800 , 1200 ] ; a ( "#workarea" ) . on ( "mousewheel" , function ( k , u , C , F ) { if ( k . altKey ) { k . preventDefault ( ) ; k = g . getZoom ( ) * 100 ; u = Qa . length ; for ( D = 0 ; D < u ; D ++ ) { C = Math . min ( u , D + 1 ) ; if ( F > 0 ) zoom = Qa [ D ] <= k ? Qa [ C ] : zoom ; if ( F < 0 ) zoom = Qa [ D ] < k ? Qa [ D ] : zoom } zoom && Ca ( { value : zoom } ) } } ) ; a ( ".menu_title" ) . on ( "mousedown" , function ( ) { a ( "#tools_shapelib" ) . hide ( ) ; a ( "#menu_bar" ) . toggleClass ( "active" ) ; yb . removeClass ( "open" ) ; a ( this ) . parent ( ) . addClass ( "open" ) } ) . on ( "mouseover" ,
function ( ) { yb . removeClass ( "open" ) ; a ( this ) . parent ( ) . addClass ( "open" ) } ) ; c . addDropDown = function ( k , u , C ) { if ( a ( k ) . length != 0 ) { var F = a ( k ) . find ( "button" ) , O = a ( k ) . find ( "ul" ) . attr ( "id" , a ( k ) [ 0 ] . id + "-list" ) ; C || a ( "#option_lists" ) . append ( O ) ; var V = false ; C && a ( k ) . addClass ( "dropup" ) ; O . find ( "li" ) . bind ( "mouseup" , u ) ; a ( window ) . mouseup ( function ( ) { if ( ! V ) { F . removeClass ( "down" ) ; O . hide ( ) } V = false } ) ; F . bind ( "mousedown" , function ( ) { if ( F . hasClass ( "down" ) ) { F . removeClass ( "down" ) ; O . hide ( ) } else { F . addClass ( "down" ) ; if ( ! C ) { var T = a ( k ) . offset ( ) ;
O . css ( { top : T . top , left : T . left - 110 } ) } O . show ( ) ; V = true } } ) . hover ( function ( ) { V = true } ) . mouseout ( function ( ) { V = false } ) } } ; var Ya = function ( k , u , C , F ) { var O = a ( k ) ; u = a ( u ) ; var V = false , T = F . dropUp ; T && a ( k ) . addClass ( "dropup" ) ; u . find ( "li" ) . bind ( "mouseup" , function ( ) { if ( F . seticon ) { wb ( "#cur_" + O [ 0 ] . id , a ( this ) . children ( ) ) ; a ( this ) . addClass ( "current" ) . siblings ( ) . removeClass ( "current" ) } C . apply ( this , arguments ) } ) ; a ( window ) . mouseup ( function ( ) { if ( ! V ) { O . removeClass ( "down" ) ; u . hide ( ) ; u . css ( { top : 0 , left : 0 } ) } V = false } ) ; u . height ( ) ; a ( k ) . bind ( "mousedown" ,
function ( ) { var X = a ( k ) . offset ( ) ; if ( T ) { X . top -= u . height ( ) ; X . left += 8 } else X . top += a ( k ) . height ( ) ; a ( u ) . offset ( X ) ; if ( O . hasClass ( "down" ) ) { O . removeClass ( "down" ) ; u . hide ( ) ; u . css ( { top : 0 , left : 0 } ) } else { O . addClass ( "down" ) ; u . show ( ) ; V = true ; return false } } ) . hover ( function ( ) { V = true } ) . mouseout ( function ( ) { V = false } ) ; F . multiclick && u . mousedown ( function ( ) { V = 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 k = this . id . replace ( "tool_pos" , "" ) . charAt ( 0 ) ; g . alignSelectedElements ( k , "page" ) } ) } ) ; ( function ( ) { var k , u = function ( ) { a ( k ) . blur ( ) } ; a ( "#svg_editor" ) . find ( "button, select, input:not(#text)" ) . focus ( function ( ) { k = this ; ia = "toolbars" ; Q . mousedown ( u ) } ) . blur ( function ( ) { ia = "canvas" ; Q . unbind ( "mousedown" , u ) ; g . getMode ( ) == "textedit" && a ( "#text" ) . focus ( ) } ) } ) ( ) ; var Aa = function ( ) { Va ( "#tool_select" ) && g . setMode ( "select" ) } , ua = function ( ) { Va ( "#tool_fhpath" ) && g . setMode ( "fhpath" ) } , fb = function ( ) { Va ( "#tool_line" ) &&
g . setMode ( "line" ) } , Ma = function ( ) { Va ( "#tool_rect" ) && g . setMode ( "rect" ) } , Ta = function ( ) { Va ( "#tool_ellipse" ) && g . setMode ( "ellipse" ) } , Ba = function ( ) { Va ( "#tool_image" ) && g . setMode ( "image" ) } , jb = function ( ) { Va ( "#tool_zoom" ) && g . setMode ( "zoom" ) } , sb = function ( ) { if ( Va ( "#tool_zoom" ) ) { Eb ( ) ; ga ( ) } } , Za = function ( ) { Va ( "#tool_text" ) && g . setMode ( "text" ) } , cb = function ( ) { Va ( "#tool_path" ) && g . setMode ( "path" ) } , zb = function ( ) { if ( U != null || ba ) g . deleteSelectedElements ( ) } , sa = function ( ) { if ( U != null || ba ) { window . event . type === "keydown" && ob ( a ( "#edit_menu" ) ) ;
g . cutSelectedElements ( ) } } , lb = function ( ) { if ( U != null || ba ) { window . event . type === "keydown" && ob ( a ( "#edit_menu" ) ) ; g . copySelectedElements ( ) } } , kb = function ( ) { window . event . type === "keydown" && ob ( a ( "#edit_menu" ) ) ; var k = g . getZoom ( ) , u = ( Q [ 0 ] . scrollLeft + Q . width ( ) / 2 ) / k - g . contentW ; k = ( Q [ 0 ] . scrollTop + Q . height ( ) / 2 ) / k - g . contentH ; g . pasteElements ( "point" , u , k ) } , vb = function ( ) { if ( U != null ) { window . event . type === "keydown" && ob ( a ( "#object_menu" ) ) ; g . moveToTopSelectedElement ( ) } } , nb = function ( ) { if ( U != null ) { window . event . type === "keydown" &&
ob ( a ( "#object_menu" ) ) ; g . moveToBottomSelectedElement ( ) } } , gb = function ( ) { if ( U != null ) { window . event . type === "keydown" && ob ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( "Up" ) } } , tb = function ( ) { if ( U != null ) { window . event . type === "keydown" && ob ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( "Down" ) } } , pb = function ( k ) { if ( U != null ) { window . event . type === "keydown" && ob ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( k ) } } , Ab = function ( ) { if ( U != null ) { g . convertToPath ( ) ; elems = g . getSelectedElems ( ) ; g . selectorManager . requestSelector ( elems [ 0 ] ) . selectorRect . setAttribute ( "display" ,
"none" ) ; g . setMode ( "pathedit" ) ; K . toEditMode ( elems [ 0 ] ) ; g . clearSelection ( ) } } , Bb = function ( ) { U != null && K . reorient ( ) } , ja = function ( ) { if ( U != null || ba ) a . prompt ( uiStrings . notification . enterNewLinkURL , "http://" , function ( k ) { k && g . makeHyperlink ( k ) } ) } , ca = function ( k , u ) { if ( U != null || ba ) { if ( curConfig . gridSnapping ) { var C = g . getZoom ( ) * curConfig . snappingStep ; k *= C ; u *= C } a ( "input" ) . blur ( ) ; g . moveSelectedElements ( k , u ) } } , la = function ( ) { var k = ! a ( "#tool_node_link" ) . hasClass ( "checked" ) ; k ? a ( "#tool_node_link" ) . addClass ( "checked" ) . find ( "input" ) . attr ( "checked" ,
true ) : a ( "#tool_node_link" ) . removeClass ( "checked" ) . find ( "input" ) . attr ( "checked" , false ) ; K . linkControlPoints ( k ) } , N = function ( ) { K . getNodePoint ( ) && K . clonePathNode ( ) } , R = function ( ) { K . getNodePoint ( ) && K . deletePathNode ( ) } , ea = function ( ) { var k = a ( "#tool_add_subpath" ) , u = ! k . hasClass ( "push_button_pressed" ) ; u ? k . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) : k . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; K . addSubPath ( u ) } , Ga = function ( ) { K . opencloseSubPath ( ) } , Oa = function ( ) { g . cycleElement ( 1 ) } ,
Xa = function ( ) { g . cycleElement ( 0 ) } , bb = function ( k , u ) { if ( ! ( U == null || ba ) ) { k || ( u *= - 1 ) ; var C = a ( "#angle" ) . val ( ) * 1 + u ; g . setRotationAngle ( C ) ; Ka ( ) } } , rb = function ( ) { var k = curConfig . dimensions ; a . confirm ( uiStrings . notification . QwantToClear , function ( u ) { if ( u ) { ga ( ) ; g . clear ( ) ; g . setResolution ( k [ 0 ] , k [ 1 ] ) ; E ( true ) ; Eb ( ) ; Ka ( ) ; W ( ) ; g . runExtensions ( "onNewDocument" ) } } ) } , Wa = function ( ) { g . setBold ( ! g . getBold ( ) ) ; Ka ( ) ; return false } , qb = function ( ) { g . setItalic ( ! g . getItalic ( ) ) ; Ka ( ) ; return false } , Ra = function ( ) { if ( ! b . pngsave ) { var k = uiStrings . notification . loadingImage ;
Y = window . open ( "data:text/html;charset=utf-8,<title>" + k + "</title><h1>" + k + "</h1>" ) } window . canvg ? g . rasterExport ( ) : a . getScript ( "canvg/rgbcolor.js" , function ( ) { a . getScript ( "canvg/canvg.js" , function ( ) { g . rasterExport ( ) } ) } ) } , ub = function ( ) { g . open ( ) } , Cb = function ( ) { } , ob = function ( k ) { var u = k . prev ( ) ; u . css ( "background" , "#09f" ) ; setTimeout ( function ( ) { u . css ( "background" , "" ) } , 200 ) } , Ib = function ( ) { if ( S . getUndoStackSize ( ) > 0 ) { window . event . type === "keydown" && ob ( a ( "#edit_menu" ) ) ; S . undo ( ) } } , eb = function ( ) { if ( S . getRedoStackSize ( ) >
0 ) { window . event . type === "keydown" && ob ( a ( "#edit_menu" ) ) ; S . redo ( ) } } , Ja = function ( ) { if ( ba ) g . groupSelectedElements ( ) ; else U && g . ungroupSelectedElement ( ) } , Pb = function ( ) { window . event . type === "keydown" && ob ( a ( "#edit_menu" ) ) ; g . cloneSelectedElements ( 20 , 20 ) } , Mb = function ( ) { var k = this . id . replace ( "tool_align" , "" ) . charAt ( 0 ) ; g . alignSelectedElements ( k , a ( "#align_relative_to" ) . val ( ) ) } , Kb = function ( ) { var k = document . querySelector ( "#tool_stroke rect" ) , u = document . querySelector ( "#tool_fill rect" ) , C = u . getAttribute ( "fill" ) , F = k . getAttribute ( "fill" ) ;
k = parseFloat ( k . getAttribute ( "stroke-opacity" ) ) ; if ( isNaN ( k ) ) k = 100 ; u = parseFloat ( u . getAttribute ( "fill-opacity" ) ) ; if ( isNaN ( u ) ) u = 100 ; F = Ha ( F , k , "stroke" ) ; C = Ha ( C , u , "fill" ) ; c . paintBox . fill . setPaint ( F , true ) ; c . paintBox . stroke . setPaint ( C , true ) } , Eb = function ( k ) { var u = g . getResolution ( ) ; k = k ? u . zoom * k : 1 ; a ( "#zoom" ) . val ( k * 100 ) ; g . setZoom ( k ) ; Db ( ) ; E ( true ) } , Qb = function ( ) { ! a ( "#tool_wireframe" ) . hasClass ( "push_button_pressed" ) ? a ( "#tool_wireframe" ) . addClass ( "push_button_pressed" ) : a ( "#tool_wireframe" ) . removeClass ( "push_button_pressed" ) ;
Q . toggleClass ( "wireframe" ) ; if ( ! H ) { var k = a ( "#wireframe_rules" ) ; k . length ? k . empty ( ) : a ( '<style id="wireframe_rules"></style>' ) . appendTo ( "head" ) ; Db ( ) } } , Fb = function ( ) { var k = ! a ( "#tool_snap" ) . hasClass ( "push_button_pressed" ) ; k ? a ( "#tool_snap" ) . addClass ( "push_button_pressed" ) : a ( "#tool_snap" ) . removeClass ( "push_button_pressed" ) ; curConfig . gridSnapping = k } , Jb = function ( ) { window . self != window . top && top . exports . setEditorFocus ( false ) } , Rb = 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 ) } , Db = function ( ) { if ( ! H ) { var k = "#workarea.wireframe #svgcontent * { stroke-width: " + 1 / g . getZoom ( ) + "px; }" ; a ( "#wireframe_rules" ) . text ( Q . hasClass ( "wireframe" ) ? k : "" ) } } , mb = function ( k , u ) { if ( ! xa ) { xa = true ; a ( "#save_output_btns" ) . toggle ( ! ! u ) ; a ( "#tool_source_back" ) . toggle ( ! u ) ; var C =
qa = g . getSvgString ( ) ; a ( "#svg_source_textarea" ) . val ( C ) ; a ( "#svg_source_editor" ) . fadeIn ( ) ; C = a ( "#svg_source_container" ) . height ( ) - 50 ; a ( "#svg_source_textarea" ) . css ( "height" , C ) ; a ( "#svg_source_textarea" ) . focus ( ) } } , Ob = function ( ) { if ( xa ) { var k = function ( ) { g . clearSelection ( ) ; l ( ) ; Eb ( ) ; Nb ( ) ; W ( ) } ; g . setSvgString ( a ( "#svg_source_textarea" ) . val ( ) ) ? k ( ) : a . confirm ( uiStrings . notification . QerrorsRevertToSource , function ( u ) { if ( ! u ) return false ; k ( ) } ) ; ga ( ) } } , Nb = function ( k ) { k = k || g . getDocumentTitle ( ) ; k = orig _title + ( k ? ": " + k : "" ) ; a ( "title:first" ) . text ( k ) } ,
wb = c . setIcon = function ( k , u ) { var C = typeof u === "string" ? a . getSvgIcon ( u , true ) : u . clone ( ) ; C ? a ( k ) . find ( "img" ) . replaceWith ( C ) : console . log ( "NOTE: Icon image missing: " + u ) } , hb ; hb = function ( ) { var k = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/ , u = document . getElementsByTagName ( "script" ) [ 0 ] , C ; for ( C in u . style ) if ( k . test ( C ) ) return C . match ( k ) [ 0 ] ; if ( "WebkitOpacity" in u . style ) return "Webkit" ; if ( "KhtmlOpacity" in u . style ) return "Khtml" ; return "" } ( ) ; var Lb = function ( k , u ) { hb . toLowerCase ( ) ; var C = [ "top" , "left" , "bottom" , "right" ] ; k . each ( function ( ) { for ( var F =
a ( this ) , O = F . outerWidth ( ) * ( u - 1 ) , V = F . outerHeight ( ) * ( u - 1 ) , T = 0 ; T < 4 ; T ++ ) { var X = C [ T ] , aa = F . data ( "orig_margin-" + X ) ; if ( aa == null ) { aa = parseInt ( F . css ( "margin-" + X ) ) ; F . data ( "orig_margin-" + X , aa ) } aa = aa * u ; if ( X === "right" ) aa += O ; else if ( X === "bottom" ) aa += V ; F . css ( "margin-" + X , aa ) } } ) } , e = c . setIconSize = function ( k , u ) { if ( ! ( k == s . size && ! u ) ) { var C = 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" ) ,
F = 1 ; F = typeof k == "number" ? k : { s : 0.75 , m : 1 , l : 1.25 , xl : 1.5 } [ k ] ; c . tool _scale = P = F ; na ( ) ; var O = C . parents ( ":hidden" ) ; O . css ( "visibility" , "hidden" ) . show ( ) ; Lb ( C , F ) ; O . css ( "visibility" , "visible" ) . hide ( ) ; C = a ( "#tool_size_rules" ) ; if ( C . length ) C . empty ( ) ; else C = a ( '<style id="tool_size_rules"></style>' ) . appendTo ( "head" ) ; if ( k != "m" ) { var V = "" ; a . each ( cssResizeRules , function ( T , X ) { T = "#svg_editor " + T . replace ( /,/g , ", #svg_editor" ) ; V += T + "{" ; a . each ( X , function ( aa , fa ) { if ( typeof fa === "number" ) var ra = fa * F + "px" ; else if ( fa [ k ] || fa . all ) ra =
fa [ k ] || fa . all ; V += aa + ":" + ra + ";" } ) ; V += "}" } ) ; O = "-" + hb . toLowerCase ( ) + "-" ; V += "#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{" + O + "transform: scale(" + F + ");} #svg_editor div.toolset .toolset {" + O + "transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {" + O + "transform: scale(" + 1 / F + ");}" ; C . text ( V ) } na ( ) } } , h = function ( ) { a ( "#dialog_box" ) . hide ( ) ;
if ( xa ) { if ( xa ) qa !== a ( "#svg_source_textarea" ) . val ( ) ? a . confirm ( uiStrings . notification . QignoreSourceChanges , function ( k ) { k && l ( ) } ) : l ( ) ; z ( ) } else ka && g . leaveContext ( ) } , l = function ( ) { a ( "#svg_source_editor" ) . hide ( ) ; xa = false ; a ( "#svg_source_textarea" ) . blur ( ) } ; a ( window ) . width ( ) ; a ( window ) . height ( ) ; var z = a . noop ; a ( window ) . resize ( function ( ) { E ( ) } ) ; ( function ( ) { Q . scroll ( function ( ) { if ( a ( "#ruler_x" ) . length != 0 ) a ( "#ruler_x" ) [ 0 ] . scrollLeft = Q [ 0 ] . scrollLeft ; if ( a ( "#ruler_y" ) . length != 0 ) a ( "#ruler_y" ) [ 0 ] . scrollTop = Q [ 0 ] . scrollTop } ) } ) ( ) ;
a ( "#url_notice" ) . click ( function ( ) { a . alert ( this . title ) } ) ; a ( "#change_image_url" ) . click ( function ( ) { var k = g . getHref ( U ) ; k = k . indexOf ( "data:" ) === 0 ? "" : k ; a . prompt ( uiStrings . notification . enterNewImgURL , k , function ( u ) { u && La ( u ) } ) } ) ; var w = function ( k ) { var u = k [ 0 ] . id == "stroke_color" ? "stroke" : "fill" , C = k [ 0 ] . id == "canvas_color" ; if ( C ) u = "canvas" ; var F = c . paintBox [ u ] . paint ; k = u == "stroke" ? "Pick a Stroke Paint and Opacity" : "Pick a Fill Paint and Opacity" ; C = C ? { right : 200 , top : 50 } : { left : 45 , bottom : 50 } ; a ( "#color_picker" ) . draggable ( { cancel : ".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker" ,
containment : "window" } ) . css ( C ) . jGraduate ( { paint : F , window : { pickerTitle : k } , images : { clientPath : curConfig . jGraduatePath } , newstop : "inverse" } , function ( O ) { F = new a . jGraduate . Paint ( O ) ; c . paintBox [ u ] . setPaint ( F ) ; g . setPaint ( u , F ) ; a ( "#color_picker" ) . hide ( ) } , function ( ) { a ( "#color_picker" ) . hide ( ) } ) } ; q = function ( k , u ) { var C = document . getElementById ( "canvas_background" ) , F = { color : "fff" , opacity : 1 } ; if ( u == "stroke" ) F = curConfig . initStroke ; if ( u == "fill" ) F = curConfig . initFill ; if ( u == "canvas" && C ) if ( C = C . getAttribute ( "fill" ) . match ( /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/ ) ) F =
{ color : ( "0" + parseInt ( C [ 1 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( "0" + parseInt ( C [ 2 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( "0" + parseInt ( C [ 3 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) , opacity : 1 } ; C = ( new DOMParser ) . parseFromString ( '<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#' + F . color + '" opacity="' + F . opacity + '"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>' , "text/xml" ) . documentElement ; C = a ( k ) [ 0 ] . appendChild ( document . importNode ( C , true ) ) ; u === "canvas" ? C . setAttribute ( "width" , 60.5 ) :
C . setAttribute ( "width" , "100%" ) ; this . rect = C . firstChild ; this . defs = C . getElementsByTagName ( "defs" ) [ 0 ] ; this . grad = this . defs . firstChild ; this . paint = new a . jGraduate . Paint ( { solidColor : F . color } ) ; this . type = u ; this . setPaint = function ( O , V ) { this . paint = O ; var T = "none" , X = O . type , aa = O . alpha / 100 ; switch ( X ) { case "solidColor" : T = O [ X ] == "none" || O [ X ] == "one" ? "none" : "#" + O [ X ] ; break ; case "linearGradient" : case "radialGradient" : this . defs . removeChild ( this . grad ) ; this . grad = this . defs . appendChild ( O [ X ] ) ; T = "url(#" + ( this . grad . id = "gradbox_" +
this . type ) + ")" } this . rect . setAttribute ( "fill" , T ) ; this . rect . setAttribute ( "opacity" , aa ) ; if ( V ) { g . setColor ( this . type , T , true ) ; g . setPaintOpacity ( this . type , aa , true ) } if ( this . type == "canvas" ) ( X = document . getElementById ( "canvas_background" ) ) ? X . setAttribute ( "fill" , T ) : Ia ( T ) } ; this . update = function ( O ) { if ( U ) { var V = this . type ; switch ( U . tagName ) { case "use" : case "image" : case "foreignObject" : return ; case "g" : case "a" : for ( var T = null , X = U . getElementsByTagName ( "*" ) , aa = 0 , fa = X . length ; aa < fa ; aa ++ ) { var ra = X [ aa ] . getAttribute ( V ) ; if ( aa ===
0 ) T = ra ; else if ( T !== ra ) { T = null ; break } } if ( T === null ) { X = null ; return } X = T ; T = 1 ; break ; default : T = parseFloat ( U . getAttribute ( V + "-opacity" ) ) ; if ( isNaN ( T ) ) T = 1 ; X = V === "fill" ? "black" : "none" ; X = U . getAttribute ( V ) || X } if ( O ) { g . setColor ( V , X , true ) ; g . setPaintOpacity ( V , T , true ) } T *= 100 ; this . setPaint ( Ha ( X , T , V ) ) } } ; this . prep = function ( ) { switch ( this . paint . type ) { case "linearGradient" : case "radialGradient" : var O = new a . jGraduate . Paint ( { copy : this . paint } ) ; g . setPaint ( u , O ) } } } ; c . paintBox . fill = new q ( "#fill_color" , "fill" ) ; c . paintBox . stroke =
new q ( "#stroke_color" , "stroke" ) ; c . paintBox . canvas = new q ( "#canvas_color" , "canvas" ) ; a ( "#stroke_width" ) . val ( curConfig . initStroke . width ) ; a ( "#group_opacity" ) . val ( curConfig . initOpacity * 100 ) ; q = c . paintBox . fill . rect . cloneNode ( false ) ; q . setAttribute ( "style" , "vector-effect:non-scaling-stroke" ) ; var H = q . style . vectorEffect === "non-scaling-stroke" ; q . removeAttribute ( "style" ) ; q = c . paintBox . fill . rect . ownerDocument . createElementNS ( "http://www.w3.org/2000/svg" , "feGaussianBlur" ) ; typeof q . stdDeviationX === "undefined" && a ( "#tool_blur" ) . hide ( ) ;
a ( q ) . remove ( ) ; setTimeout ( function ( ) { g . embedImage ( "images/placeholder.svg" , function ( k ) { if ( ! k ) { a ( "#image_save_opts [value=embed]" ) . attr ( "disabled" , "disabled" ) ; a ( "#image_save_opts input" ) . val ( [ "ref" ] ) ; 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" ) ) w ( a ( "#fill_color" ) ) ; else { a ( "#tool_fill" ) . addClass ( "active" ) ; a ( "#tool_stroke" ) . removeClass ( "active" ) } } ) ; a ( "#tool_stroke" ) . on ( "click" ,
function ( ) { if ( a ( "#tool_stroke" ) . hasClass ( "active" ) ) w ( a ( "#stroke_color" ) ) ; else { a ( "#tool_stroke" ) . addClass ( "active" ) ; a ( "#tool_fill" ) . removeClass ( "active" ) } } ) ; a ( "#tool_canvas" ) . on ( "click touchstart" , function ( ) { w ( a ( "#canvas_color" ) ) } ) ; a ( "#tool_stroke" ) . on ( "touchstart" , function ( ) { a ( "#tool_stroke" ) . addClass ( "active" ) ; a ( "#tool_fill" ) . removeClass ( "active" ) ; w ( a ( "#stroke_color" ) ) } ) ; a ( "#tool_fill" ) . on ( "touchstart" , function ( ) { a ( "#tool_fill" ) . addClass ( "active" ) ; a ( "#tool_stroke" ) . removeClass ( "active" ) ; w ( a ( "#fill_color" ) ) } ) ;
a ( "#zoom_select" ) . on ( "change" , function ( ) { var k = this . options [ this . selectedIndex ] . text ; k = k . split ( "%" ) [ 0 ] ; a ( "#zoom" ) . val ( k ) . trigger ( "change" ) } ) ; a ( ".push_button" ) . mousedown ( function ( ) { a ( this ) . hasClass ( "disabled" ) || a ( this ) . addClass ( "push_button_pressed" ) . removeClass ( "push_button" ) } ) . mouseout ( function ( ) { a ( this ) . removeClass ( "push_button_pressed" ) . addClass ( "push_button" ) } ) . mouseup ( function ( ) { a ( this ) . removeClass ( "push_button_pressed" ) . addClass ( "push_button" ) } ) ; a ( window ) . bind ( "load resize" , function ( ) { Q . css ( "line-height" ,
Q . height ( ) + "px" ) } ) ; var A = function ( ) { var k = a ( "#canvas_width" ) , u = a ( "#canvas_height" ) , C = k . val ( ) , F = u . val ( ) ; if ( C != "fit" && ! svgedit . units . isValidUnit ( "width" , C ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; k . parent ( ) . addClass ( "error" ) ; return false } k . parent ( ) . removeClass ( "error" ) ; if ( F != "fit" && ! svgedit . units . isValidUnit ( "height" , F ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; u . parent ( ) . addClass ( "error" ) ; return false } u . parent ( ) . removeClass ( "error" ) ; if ( ! g . setResolution ( C , F ) ) { a . alert ( uiStrings . notification . noContentToFitTo ) ;
C = g . getResolution ( ) ; k . val ( C . w ) ; u . val ( C . h ) ; return false } E ( ) } ; a ( "#resolution" ) . change ( function ( ) { var k = a ( "#canvas_width" ) [ 0 ] , u = a ( "#canvas_height" ) [ 0 ] ; if ( this . selectedIndex ) if ( this . value == "content" ) { k . value = "fit" ; u . value = "fit" ; A ( ) ; var C = g . getResolution ( ) ; k . value = C . w ; u . value = C . h } else { var F = this . value . split ( "x" ) ; F [ 0 ] = parseInt ( F [ 0 ] ) ; F [ 1 ] = parseInt ( F [ 1 ] ) ; var O = F [ 0 ] - k . value , V = F [ 1 ] - u . value , T = Date . now ( ) , X = function ( aa ) { aa = ( aa - T ) / 1E3 ; aa = Math . pow ( aa - 1 , 3 ) + 1 ; k . value = ( F [ 0 ] - O + aa * O ) . toFixed ( 0 ) ; u . value = ( F [ 1 ] - V + aa * V ) . toFixed ( 0 ) ;
A ( ) ; if ( aa >= 1 ) { aa = g . getResolution ( ) ; a ( "#canvas_width" ) . val ( aa . w . toFixed ( ) ) ; a ( "#canvas_height" ) . val ( aa . h . toFixed ( ) ) ; a ( "#resolution_label" ) . html ( "<div class='pull'>" + aa . w + "<span>\u00d7</span></br>" + aa . h + "</div>" ) } else requestAnimationFrame ( X ) } ; X ( Date . now ( ) ) } else { a ( "#resolution_label" ) . html ( "Custom" ) ; k . removeAttribute ( "readonly" ) ; k . focus ( ) ; k . select ( ) ; if ( k . value == "fit" ) { k . value = 100 ; u . value = 100 } } } ) ; a ( "#zoom" ) . change ( function ( ) { Ca ( this ) } ) ; a ( "input,select" ) . attr ( "autocomplete" , "off" ) ; var v = function ( ) { var k =
[ { sel : "#tool_select" , fn : Aa , evt : "click" , key : [ "V" , true ] } , { sel : "#tool_fhpath" , fn : ua , evt : "click" , key : [ "Q" , true ] } , { sel : "#tool_line" , fn : fb , evt : "click" , key : [ "L" , true ] } , { sel : "#tool_rect" , fn : Ma , evt : "click" , key : [ "R" , true ] , icon : "rect" } , { sel : "#tool_ellipse" , fn : Ta , evt : "mouseup" , key : [ "C" , true ] , icon : "ellipse" } , { sel : "#tool_path" , fn : cb , evt : "click" , key : [ "P" , true ] } , { sel : "#tool_text" , fn : Za , evt : "click" , key : [ "T" , true ] } , { sel : "#tool_image" , fn : Ba , evt : "mouseup" } , { sel : "#tool_zoom" , fn : jb , evt : "mouseup" , key : [ "Z" , true ] } , { sel : "#tool_clear" ,
fn : rb , evt : "mouseup" , key : [ o + "N" , true ] } , { sel : "#tool_save" , fn : function ( ) { xa ? Ob ( ) : clickSave ( ) } , evt : "mouseup" , key : [ o + "S" , true ] } , { sel : "#tool_export" , fn : Ra , evt : "mouseup" } , { sel : "#tool_open" , fn : ub , evt : "mouseup" } , { sel : "#tool_import" , fn : Cb , evt : "mouseup" } , { sel : "#tool_source" , fn : mb , evt : "click" , key : [ o + "U" , true ] } , { sel : "#tool_wireframe" , fn : Qb , evt : "click" } , { sel : "#tool_snap" , fn : Fb , evt : "click" } , { sel : "#tool_rulers" , fn : Rb , evt : "click" } , { sel : "#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel" ,
fn : h , evt : "click" , key : [ "esc" , false , false ] , hidekey : true } , { sel : "#tool_source_save" , fn : Ob , evt : "click" } , { sel : "#tool_delete,#tool_delete_multi" , fn : zb , evt : "click" , key : [ "del/backspace" , true ] } , { sel : "#tool_reorient" , fn : Bb , evt : "click" } , { sel : "#tool_node_link" , fn : la , evt : "click" } , { sel : "#tool_node_clone" , fn : N , evt : "click" } , { sel : "#tool_node_delete" , fn : R , evt : "click" } , { sel : "#tool_openclose_path" , fn : Ga , evt : "click" } , { sel : "#tool_add_subpath" , fn : ea , evt : "click" } , { sel : "#tool_move_top" , fn : vb , evt : "click" , key : o + "shift+up" } ,
{ sel : "#tool_move_bottom" , fn : nb , evt : "click" , key : o + "shift+down" } , { sel : "#tool_move_up" , fn : gb , evt : "click" , key : [ o + "up" , true ] } , { sel : "#tool_move_down" , fn : tb , evt : "click" , key : [ o + "down" , true ] } , { sel : "#tool_topath" , fn : Ab , evt : "click" } , { sel : "#tool_make_link,#tool_make_link_multi" , fn : ja , evt : "click" } , { sel : "#tool_clone,#tool_clone_multi" , fn : Pb , evt : "click" , key : [ o + "D" , true ] } , { sel : "#tool_group" , fn : Ja , evt : "click" , key : [ o + "G" , true ] } , { sel : "#tool_ungroup" , fn : Ja , evt : "click" , key : o + "shift+G" } , { sel : "#tool_unlink_use" , fn : Ja , evt : "click" } ,
{ sel : "[id^=tool_align]" , fn : Mb , evt : "click" } , { sel : "#tool_undo" , fn : Ib , evt : "click" , key : o + "z" } , { sel : "#tool_redo" , fn : eb , evt : "click" , key : [ "y" , true ] } , { sel : "#tool_cut" , fn : sa , evt : "click" , key : [ o + "x" , true ] } , { sel : "#tool_copy" , fn : lb , evt : "click" , key : o + "c" } , { sel : "#tool_paste" , fn : kb , evt : "click" , key : o + "v" } , { sel : "#tool_switch" , fn : Kb , evt : "click" , key : [ "x" , true ] } , { sel : "#tool_bold" , fn : Wa , evt : "mousedown" , key : [ o + "B" , true ] } , { sel : "#tool_italic" , fn : qb , evt : "mousedown" , key : [ o + "I" , true ] } , { sel : "#copy_save_done" , fn : h , evt : "click" } ,
{ key : "ctrl+left" , fn : function ( ) { bb ( 0 , 1 ) } } , { key : "ctrl+right" , fn : function ( ) { bb ( 1 , 1 ) } } , { key : "ctrl+shift+left" , fn : function ( ) { bb ( 0 , 5 ) } } , { key : "ctrl+shift+right" , fn : function ( ) { bb ( 1 , 5 ) } } , { key : "shift+O" , fn : Xa } , { key : "shift+P" , fn : Oa } , { key : [ o + "+" , true ] , fn : function ( ) { Eb ( 2 ) } } , { key : [ o + "-" , true ] , fn : function ( ) { Eb ( 0.5 ) } } , { key : [ "up" , true ] , fn : function ( ) { ca ( 0 , - 1 ) } } , { key : [ "down" , true ] , fn : function ( ) { ca ( 0 , 1 ) } } , { key : [ "left" , true ] , fn : function ( ) { ca ( - 1 , 0 ) } } , { key : [ "right" , true ] , fn : function ( ) { ca ( 1 , 0 ) } } , { key : "shift+up" , fn : function ( ) { ca ( 0 ,
- 10 ) } } , { key : "shift+down" , fn : function ( ) { ca ( 0 , 10 ) } } , { key : "shift+left" , fn : function ( ) { ca ( - 10 , 0 ) } } , { key : "shift+right" , fn : function ( ) { ca ( 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 : o + "A" , fn : function ( ) { g . selectAllInCurrentLayer ( ) } } , { key : o + "shift+z" , fn : eb } , { key : "esc" , fn : Jb } ] , u = { "4/Shift+4" : "#tools_rect_show" , "5/Shift+5" : "#tools_ellipse_show" } ; return { setAll : function ( ) { var C = { } ; a . each ( k , function ( F , O ) { if ( O . sel ) { var V = a ( O . sel ) ; if ( V . length == 0 ) return true ; if ( O . evt ) { if ( svgedit . browser . isTouch ( ) &&
O . evt === "click" ) O . evt = "mousedown" ; V [ O . evt ] ( O . fn ) } if ( O . parent && a ( O . parent + "_show" ) . length != 0 ) { var T = a ( O . parent ) ; T . length || ( T = pa ( O . parent . substr ( 1 ) ) ) ; T . append ( V ) ; a . isArray ( C [ O . parent ] ) || ( C [ O . parent ] = [ ] ) ; C [ O . parent ] . push ( O ) } } if ( O . key ) { var X = O . fn , aa = false ; if ( a . isArray ( O . key ) ) { T = O . key [ 0 ] ; if ( O . key . length > 1 ) aa = O . key [ 1 ] } else T = O . key ; T += "" ; svgedit . browser . isMac && T . indexOf ( "+" ) != - 1 && T . split ( "+" ) [ 0 ] == "ctrl" && T . replace ( "ctrl" , "cmd" ) ; a . each ( T . split ( "/" ) , function ( ra , Pa ) { a ( document ) . bind ( "keydown" , Pa , function ( Da ) { X ( ) ;
aa && Da . preventDefault ( ) ; return false } ) } ) ; if ( O . sel && ! O . hidekey && V . attr ( "title" ) ) { var fa = V . attr ( "title" ) . split ( "[" ) [ 0 ] + " (" + T + ")" ; u [ T ] = O . sel ; V . parents ( "#main_menu" ) . length || V . attr ( "title" , fa ) } } } ) ; oa ( C ) ; a ( window ) . bind ( "keydown" , "tab" , function ( F ) { if ( ia === "canvas" ) { F . preventDefault ( ) ; Oa ( ) } } ) . bind ( "keydown" , "shift+tab" , function ( F ) { if ( ia === "canvas" ) { F . preventDefault ( ) ; Xa ( ) } } ) ; a ( "#tool_zoom" ) . dblclick ( sb ) } , setTitles : function ( ) { a . each ( u , function ( C , F ) { var O = a ( F ) . parents ( "#main_menu" ) . length ; a ( F ) . each ( function ( ) { var V =
O ? a ( this ) . text ( ) . split ( " [" ) [ 0 ] : this . title . split ( " [" ) [ 0 ] , T = "" ; a . each ( C . split ( "/" ) , function ( X , aa ) { var fa = aa . split ( "+" ) , ra = "" ; if ( fa . length > 1 ) { ra = fa [ 0 ] + "+" ; aa = fa [ 1 ] } T += ( X ? "/" : "" ) + ra + ( uiStrings [ "key_" + aa ] || aa ) } ) ; if ( O ) this . lastChild . textContent = V + " [" + T + "]" ; else this . title = V + " [" + T + "]" } ) } ) } , getButtonData : function ( C ) { var F ; a . each ( k , function ( O , V ) { if ( V . sel === C ) F = V } ) ; return F } } } ( ) ; v . setAll ( ) ; c . ready ( function ( ) { var k = curConfig . initTool , u = a ( "#tools_left, #svg_editor .tools_flyout" ) , C = u . find ( "#tool_" + k ) ; k = u . find ( "#" +
k ) ; ( C . length ? C : k . length ? k : a ( "#tool_select" ) ) . click ( ) . mouseup ( ) ; curConfig . wireframe && a ( "#tool_wireframe" ) . click ( ) ; curConfig . showlayers && toggleSidePanel ( ) ; a ( "#rulers" ) . toggle ( ! ! curConfig . showRulers ) } ) ; a ( "#canvas_height" ) . dragInput ( { min : 10 , max : null , step : 10 , callback : A , cursor : false } ) ; a ( "#canvas_width" ) . dragInput ( { min : 10 , max : null , step : 10 , callback : A , 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 ( "#g_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#g_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#image_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#text_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#text_x" ) . dragInput ( { min : null ,
max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#image_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#rect_rx" ) . dragInput ( { min : 0 , max : 100 , step : 1 , callback : function ( k ) { g . setRectRadius ( k . value ) } , cursor : true } ) ; a ( "#stroke_width" ) . dragInput ( { min : 0 , max : 99 , step : 1 , callback : function ( k ) { var u = k . value ; if ( u == 0 && U && [ "line" , "polyline" ] . indexOf ( U . nodeName ) >= 0 ) u = k . value = 1 ; g . setStrokeWidth ( u ) } , cursor : true , smallStep : 0.1 , start : 1.5 } ) ; a ( "#angle" ) . dragInput ( { min : - 180 , max : 180 ,
step : 1 , callback : function ( k ) { g . setRotationAngle ( k . value ) ; rotateCursor ( k . value ) ; a ( "#tool_reorient" ) . toggleClass ( "disabled" , k . value == 0 ) } , cursor : false } ) ; a ( "#font_size" ) . dragInput ( { min : 1 , max : 250 , step : 1 , callback : function ( k ) { g . setFontSize ( k . value ) } , cursor : true , stepfunc : function ( k , u ) { var C = k . value - 0 , F = C + u , O = F >= C ; if ( u === 0 ) return C ; return C >= 24 ? O ? Math . round ( C * 1.1 ) : Math . round ( C / 1.1 ) : C <= 1 ? O ? C * 2 : C / 2 : F } } ) ; a ( "#group_opacity" ) . dragInput ( { min : 0 , max : 100 , step : 5 , callback : function ( k , u ) { if ( u == null ) u = k . value ; a ( "#group_opacity" ) . val ( u ) ;
if ( ! k || ! k . handle ) a ( "#opac_slider" ) . slider ( "option" , "value" , u ) ; g . setOpacity ( u / 100 ) } , cursor : true , start : 100 } ) ; a ( "#blur" ) . dragInput ( { min : 0 , max : 10 , step : 0.1 , callback : function ( k ) { val = k . 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 ( k ) { switch ( k ) { case "delete" : zb ( ) ; break ; case "cut" : sa ( ) ; break ; case "copy" : lb ( ) ; 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" : vb ( ) ; break ; case "move_up" : pb ( "Up" ) ; break ; case "move_down" : pb ( "Down" ) ; break ; case "move_back" : nb ( ) ; break ; default : svgedit . contextmenu && svgedit . contextmenu . hasCustomHandler ( k ) && svgedit . contextmenu . getCustomHandler ( k ) . call ( ) } } ) ; a ( ".contextMenu li" ) . mousedown ( function ( k ) { k . preventDefault ( ) } ) ; window . onbeforeunload = function ( ) { if ( S . getUndoStackSize ( ) ===
0 ) c . show _save _warning = false ; if ( ! curConfig . no _save _warning && c . show _save _warning ) return uiStrings . notification . unsavedChanges } ; c . openPrep = function ( k ) { a ( "#main_menu" ) . hide ( ) ; S . getUndoStackSize ( ) === 0 ? k ( true ) : a . confirm ( uiStrings . notification . QwantToOpen , k ) } ; if ( window . FileReader ) { q = a ( '<input type="file">' ) . change ( function ( ) { var k = this ; c . openPrep ( function ( u ) { if ( u ) { g . clear ( ) ; if ( k . files . length == 1 ) { u = new FileReader ; u . onloadend = function ( C ) { p ( C . target . result ) ; E ( ) } ; u . readAsText ( k . files [ 0 ] ) } } } ) } ) ; a ( "#tool_open" ) . show ( ) . prepend ( q ) ;
q = a ( '<input type="file">' ) . change ( function ( ) { a ( "#main_menu" ) . hide ( ) ; if ( this . files . length == 1 ) { var k = new FileReader ; k . onloadend = function ( u ) { g . importSvgString ( u . target . result , true ) ; E ( ) } ; k . readAsText ( this . files [ 0 ] ) } } ) ; a ( "#tool_import" ) . show ( ) . prepend ( q ) } for ( var E = c . updateCanvas = function ( k , u ) { var C = Q . width ( ) , F = Q . height ( ) , O = C , V = F , T = g . getZoom ( ) , X = a ( "#svgcanvas" ) , aa = { x : Q [ 0 ] . scrollLeft + O / 2 , y : Q [ 0 ] . scrollTop + V / 2 } , fa = curConfig . canvas _expansion ; C = Math . max ( O , g . contentW * T * fa ) ; F = Math . max ( V , g . contentH * T * fa ) ; C == O &&
F == V ? Q . css ( "overflow" , "hidden" ) : Q . css ( "overflow" , "scroll" ) ; fa = X . height ( ) / 2 ; var ra = X . width ( ) / 2 ; X . width ( C ) . height ( F ) ; var Pa = F / 2 , Da = C / 2 , ha = g . updateCanvas ( C , F ) , $a = Da / ra ; C = C / 2 - O / 2 ; F = F / 2 - V / 2 ; if ( u ) { u . x += ha . x ; u . y += ha . y } else u = { x : Da + ( aa . x - ra ) * $a , y : Pa + ( aa . y - fa ) * $a } ; if ( k ) if ( g . contentW > Q . width ( ) ) { Q [ 0 ] . scrollLeft = ha . x - 10 ; Q [ 0 ] . scrollTop = ha . y - 10 } else { Q [ 0 ] . scrollLeft = C ; Q [ 0 ] . scrollTop = F } else { Q [ 0 ] . scrollLeft = u . x - O / 2 ; Q [ 0 ] . scrollTop = u . y - V / 2 } if ( curConfig . showRulers ) { m ( X , T ) ; Q . scroll ( ) } } , I = [ ] , D = 0.1 ; D < 1E5 ; D *= 10 ) { I . push ( 1 *
D ) ; I . push ( 2 * D ) ; I . push ( 5 * D ) } E ( true ) ; try { var G = function ( k ) { if ( window . JSON && JSON . stringify ) return JSON . stringify ( k ) ; var u = arguments . callee ; if ( typeof k == "boolean" || typeof k == "number" ) return k + "" ; else if ( typeof k == "string" ) return '"' + k . replace ( /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g , function ( O ) { return "\\u" + ( "0000" + O . charCodeAt ( 0 ) . toString ( 16 ) ) . slice ( - 4 ) } ) + '"' ; else if ( k . length ) { for ( var C = 0 ; C < k . length ; C ++ ) k [ C ] = u ( k [ C ] ) ; return "[" +
k . join ( "," ) + "]" } else { C = [ ] ; for ( var F in k ) C . push ( u ( F ) + ":" + u ( k [ F ] ) ) ; return "{" + C . join ( "," ) + "}" } } ; window . addEventListener ( "message" , function ( k ) { var u = parseInt ( k . data . substr ( 0 , k . data . indexOf ( ";" ) ) ) ; try { k . source . postMessage ( "SVGe" + u + ";" + G ( eval ( k . data ) ) , "*" ) } catch ( C ) { k . source . postMessage ( "SVGe" + u + ";error:" + C . message , "*" ) } } , false ) } catch ( L ) { window . embed _error = L } a ( function ( ) { window . svgCanvas = g ; g . ready = svgEditor . ready } ) ; c . setLang = function ( k , u ) { a . pref ( "lang" , k ) ; a ( "#lang_select" ) . val ( k ) ; if ( u ) { g . runExtensions ( "langChanged" ,
k ) ; ma ( ) ; a . each ( { "#stroke_color" : "#tool_stroke .icon_label, #tool_stroke .color_block" , "#fill_color" : "#tool_fill label, #tool_fill .color_block" , "#linejoin_miter" : "#cur_linejoin" , "#linecap_butt" : "#cur_linecap" } , function ( C , F ) { a ( F ) . attr ( "title" , a ( C ) [ 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 ) { n ? d ( ) : f . push ( d ) } ; c . runCallbacks = function ( ) { a . each ( f , function ( ) { this ( ) } ) ; n = true } ; c . loadFromString =
function ( d ) { c . ready ( function ( ) { p ( d ) } ) } ; c . loadFromURL = function ( d , m ) { m || ( m = { } ) ; var q = m . cache , B = m . callback ; c . ready ( function ( ) { a . ajax ( { url : d , dataType : "text" , cache : ! ! q , success : function ( o ) { p ( o , B ) } , error : function ( o , K , S ) { o . status != 404 && o . responseText ? p ( o . responseText , B ) : a . alert ( uiStrings . notification . URLloadFail + ": \n" + S + "" , B ) } } ) } ) } ; c . loadFromDataURI = function ( d ) { c . ready ( function ( ) { var m = d . substring ( 26 ) ; p ( svgedit . utilities . decode64 ( m ) ) } ) } ; 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 p = $ ( this ) . parent ( ) , g = $ ( this ) , c = this . dragCfg . height , n = this . dragCfg . min , s = this . dragCfg . max , b = this . dragCfg . step , f = s - n > 0 ? ( s - n ) / b : 200 , d = f / c * b , m = 0 , q = this . getAttribute ( "data-attr" ) , B = svgEditor . canvas , o = B . getSelectedElems ( ) , K = svgedit . browser . isTouch ( ) , S = f && this . dragCfg . cursor ? $ ( "<div class='draginput_cursor' />" ) . appendTo ( p ) : false ; g . attr ( "readonly" ,
"readonly" ) ; S && ! isNaN ( this . dragCfg . start ) && S . css ( "top" , this . dragCfg . start * - 1 / d + c ) ; this . adjustValue = function ( M , J ) { var Q ; Q = isNaN ( this . value ) ? this . dragCfg . reset : $ . isFunction ( this . dragCfg . stepfunc ) ? this . dragCfg . stepfunc ( this , M ) : Number ( ( Number ( this . value ) + Number ( M ) ) . toFixed ( 5 ) ) ; if ( s !== null ) Q = Math . min ( Q , s ) ; if ( n !== null ) Q = Math . max ( Q , n ) ; S && this . updateCursor ( Q ) ; this . value = Q ; p . attr ( "data-value" , Q ) ; $ . isFunction ( this . dragCfg . callback ) && this . dragCfg . callback ( this , J ) } ; p . toggleClass ( "draginput" , p . is ( "label" ) ) ; this . move =
function ( M , J , Q ) { if ( K ) M = M . originalEvent . touches [ 0 ] ; if ( m === 0 ) m = J ; J = ( M . pageY - m ) * - 1 ; m = M . pageY ; Q = J * d ; this . adjustValue ( Q . toFixed ( b < 1 ? 1 : 0 ) ) } ; this . stop = function ( ) { $ ( "body" ) . removeClass ( "dragging" ) ; p . removeClass ( "active" ) ; $ ( window ) . unbind ( "mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput" ) ; m = 0 ; if ( o [ 0 ] ) { var M = B . undoMgr . finishUndoableChange ( ) ; M . isEmpty ( ) || B . undoMgr . addCommandToHistory ( M ) } this . adjustValue ( 0 ) } ; this . updateCursor = function ( ) { var M = parseFloat ( this . value ) * - 1 / d + c ; S . css ( "top" ,
M ) } ; this . start = function ( M ) { if ( K ) M = M . originalEvent . touches [ 0 ] ; var J = M . pageY , Q = this . value , Y = this ; B . undoMgr . beginUndoableChange ( q , o ) ; $ ( "body" ) . addClass ( "dragging" ) ; p . addClass ( "active" ) ; $ ( window ) . bind ( "mousemove.draginput touchmove.draginput" , function ( P ) { Y . move ( P , J , parseFloat ( Q ) ) } ) ; $ ( window ) . bind ( "mouseup.draginput touchend.draginput" , function ( ) { Y . stop ( ) } ) } ; $ ( this ) . attr ( "readonly" , "readonly" ) . attr ( "data-scale" , d ) . attr ( "data-domain" , c ) . attr ( "data-cursor" , S != false ) . bind ( "mousedown touchstart" , function ( M ) { this . blur ( ) ;
this . start ( M ) } ) . bind ( "dblclick taphold" , function ( ) { this . removeAttribute ( "readonly" , "readonly" ) ; this . focus ( ) ; this . select ( ) } ) . keydown ( function ( M ) { switch ( M . keyCode ) { case 13 : this . adjustValue ( 0 ) ; this . blur ( ) } } ) . focus ( function ( ) { this . getAttribute ( "readonly" ) === "readonly" && this . blur ( ) } ) . blur ( function ( ) { this . setAttribute ( "readonly" , "readonly" ) } ) . bind ( "mousewheel" , function ( M , J , Q , Y ) { if ( Y > 0 ) this . adjustValue ( this . dragCfg . step , true ) ; else Y < 0 && this . adjustValue ( - this . dragCfg . step , true ) ; M . preventDefault ( ) } ) } ) } ;
$ . fn . dragInput . updateCursor = function ( a ) { var p = parseFloat ( a . value ) , g = parseFloat ( a . getAttribute ( "data-scale" ) ) , c = parseFloat ( a . getAttribute ( "data-domain" ) ) ; p = p * - 1 / g + c + "px" ; a = a . parentNode . lastChild ; if ( a . className == "draginput_cursor" ) a . style . top = p } ; svgedit = svgedit || { } ;
( function ( ) { var a = this ; if ( ! svgedit . contextmenu ) svgedit . contextmenu = { } ; a . contextMenuExtensions = { } ; svgEditor . ready ( function ( ) { for ( menuItem in contextMenuExtensions ) { var p = contextMenuExtensions [ menuItem ] ; Object . keys ( a . contextMenuExtensions ) . length == 0 && $ ( "#cmenu_canvas" ) . append ( "<li class='separator'>" ) ; var g = p . shortcut || "" ; $ ( "#cmenu_canvas" ) . append ( "<li class='disabled'><a href='#" + p . id + "'>" + p . label + "<span class='shortcut'>" + g + "</span></a></li>" ) } } ) ; svgedit . contextmenu . resetCustomMenus = function ( ) { a . contextMenuExtensions =
{ } } ; svgedit . contextmenu . add = function ( p ) { if ( p && p . id && p . label && p . action && typeof p . action == "function" ) if ( p . id in a . contextMenuExtensions ) console . error ( 'Cannot add extension "' + p . id + '", an extension by that name already exists"' ) ; else { console . log ( "Registed contextmenu item: {id:" + p . id + ", label:" + p . label + "}" ) ; a . contextMenuExtensions [ p . id ] = p } 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 ( p ) { return a . contextMenuExtensions [ p ] && true } ; svgedit . contextmenu . getCustomHandler = function ( p ) { return a . contextMenuExtensions [ p ] . action } } ) ( ) ; ( function ( a , p ) { function g ( n ) { return ! a ( n ) . parents ( ) . andSelf ( ) . filter ( function ( ) { return a . curCSS ( this , "visibility" ) === "hidden" || a . expr . filters . hidden ( this ) } ) . length } function c ( n , s ) { var b = n . nodeName . toLowerCase ( ) ; if ( "area" === b ) { b = n . parentNode ; var f = b . name ; if ( ! n . 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 ) ? ! n . disabled : "a" == b ? n . href || s : s ) && g ( n ) } 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 ( n , s ) { return typeof n == "number" ? this . each ( function ( ) { var b =
this ; setTimeout ( function ( ) { a ( b ) . focus ( ) ; s && s . call ( b ) } , n ) } ) : this . _focus . apply ( this , arguments ) } , scrollParent : function ( ) { var n ; a . browser . msie && /(static|relative)/ . test ( this . css ( "position" ) ) || /absolute/ . test ( this . css ( "position" ) ) ? n = 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 ) : n = 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" ) ) || ! n . length ? a ( document ) : n } , zIndex : function ( n ) { if ( n !== p ) return this . css ( "zIndex" , n ) ; if ( this . length ) { n = a ( this [ 0 ] ) ; for ( var s ; n . length && n [ 0 ] !== document ; ) { s = n . css ( "position" ) ; if ( s === "absolute" || s === "relative" || s === "fixed" ) { s = parseInt ( n . css ( "zIndex" ) , 10 ) ; if ( ! isNaN ( s ) && s !== 0 ) return s } n = n . parent ( ) } } return 0 } , disableSelection : function ( ) { return this . bind ( ( a . support . selectstart ? "selectstart" :
"mousedown" ) + ".ui-disableSelection" , function ( n ) { n . preventDefault ( ) } ) } , enableSelection : function ( ) { return this . unbind ( ".ui-disableSelection" ) } } ) , a . each ( [ "Width" , "Height" ] , function ( n , s ) { function b ( q , B , o , K ) { a . each ( f , function ( ) { B -= parseFloat ( a . curCSS ( q , "padding" + this , true ) ) || 0 ; o && ( B -= parseFloat ( a . curCSS ( q , "border" + this + "Width" , true ) ) || 0 ) ; K && ( B -= parseFloat ( a . curCSS ( q , "margin" + this , true ) ) || 0 ) } ) ; return B } var f = s === "Width" ? [ "Left" , "Right" ] : [ "Top" , "Bottom" ] , d = s . toLowerCase ( ) , m = { innerWidth : a . fn . innerWidth , innerHeight : a . fn . innerHeight ,
outerWidth : a . fn . outerWidth , outerHeight : a . fn . outerHeight } ; a . fn [ "inner" + s ] = function ( q ) { if ( q === p ) return m [ "inner" + s ] . call ( this ) ; return this . each ( function ( ) { a ( this ) . css ( d , b ( this , q ) + "px" ) } ) } ; a . fn [ "outer" + s ] = function ( q , B ) { if ( typeof q != "number" ) return m [ "outer" + s ] . call ( this , q ) ; return this . each ( function ( ) { a ( this ) . css ( d , b ( this , q , true , B ) + "px" ) } ) } } ) , a . extend ( a . expr [ ":" ] , { data : function ( n , s , b ) { return ! ! a . data ( n , b [ 3 ] ) } , focusable : function ( n ) { return c ( n , ! isNaN ( a . attr ( n , "tabindex" ) ) ) } , tabbable : function ( n ) { var s = a . attr ( n ,
"tabindex" ) , b = isNaN ( s ) ; return ( b || s >= 0 ) && c ( n , ! b ) } } ) , a ( function ( ) { var n = document . body , s = n . 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 ; n . removeChild ( s ) . style . display = "none" } ) , a . extend ( a . ui , { plugin : { add : function ( n , s , b ) { n = a . ui [ n ] . prototype ; for ( var f in b ) { n . plugins [ f ] = n . plugins [ f ] || [ ] ; n . plugins [ f ] . push ( [ s , b [ f ] ] ) } } , call : function ( n , s , b ) { if ( ( s = n . plugins [ s ] ) &&
n . element [ 0 ] . parentNode ) for ( var f = 0 ; f < s . length ; f ++ ) n . options [ s [ f ] [ 0 ] ] && s [ f ] [ 1 ] . apply ( n . element , b ) } } , contains : function ( n , s ) { return document . compareDocumentPosition ? n . compareDocumentPosition ( s ) & 16 : n !== s && n . contains ( s ) } , hasScroll : function ( n , s ) { if ( a ( n ) . css ( "overflow" ) === "hidden" ) return false ; var b = s && s === "left" ? "scrollLeft" : "scrollTop" , f = false ; if ( n [ b ] > 0 ) return true ; n [ b ] = 1 ; f = n [ b ] > 0 ; n [ b ] = 0 ; return f } , isOverAxis : function ( n , s , b ) { return n > s && n < s + b } , isOver : function ( n , s , b , f , d , m ) { return a . ui . isOverAxis ( n , b , d ) &&
a . ui . isOverAxis ( s , f , m ) } } ) ) } ) ( jQuery ) ;
( function ( a , p ) { if ( a . cleanData ) { var g = a . cleanData ; a . cleanData = function ( n ) { for ( var s = 0 , b ; ( b = n [ s ] ) != null ; s ++ ) try { a ( b ) . triggerHandler ( "remove" ) } catch ( f ) { } g ( n ) } } else { var c = a . fn . remove ; a . fn . remove = function ( n , s ) { return this . each ( function ( ) { s || ( ! n || a . filter ( n , [ this ] ) . length ) && a ( "*" , this ) . add ( [ this ] ) . each ( function ( ) { try { a ( this ) . triggerHandler ( "remove" ) } catch ( b ) { } } ) ; return c . call ( a ( this ) , n , s ) } ) } } a . widget = function ( n , s , b ) { var f = n . split ( "." ) [ 0 ] , d ; n = n . split ( "." ) [ 1 ] ; d = f + "-" + n ; b || ( b = s , s = a . Widget ) ; a . expr [ ":" ] [ d ] =
function ( m ) { return ! ! a . data ( m , n ) } ; a [ f ] = a [ f ] || { } ; a [ f ] [ n ] = function ( m , q ) { arguments . length && this . _createWidget ( m , q ) } ; s = new s ; s . options = a . extend ( true , { } , s . options ) ; a [ f ] [ n ] . prototype = a . extend ( true , s , { namespace : f , widgetName : n , widgetEventPrefix : a [ f ] [ n ] . prototype . widgetEventPrefix || n , widgetBaseClass : d } , b ) ; a . widget . bridge ( n , a [ f ] [ n ] ) } ; a . widget . bridge = function ( n , s ) { a . fn [ n ] = function ( b ) { var f = typeof b == "string" , d = Array . prototype . slice . call ( arguments , 1 ) , m = this ; b = ! f && d . length ? a . extend . apply ( null , [ true , b ] . concat ( d ) ) :
b ; if ( f && b . charAt ( 0 ) === "_" ) return m ; f ? this . each ( function ( ) { var q = a . data ( this , n ) , B = q && a . isFunction ( q [ b ] ) ? q [ b ] . apply ( q , d ) : q ; if ( B !== q && B !== p ) { m = B ; return false } } ) : this . each ( function ( ) { var q = a . data ( this , n ) ; q ? q . option ( b || { } ) . _init ( ) : a . data ( this , n , new s ( b , this ) ) } ) ; return m } } ; a . Widget = function ( n , s ) { arguments . length && this . _createWidget ( n , s ) } ; a . Widget . prototype = { widgetName : "widget" , widgetEventPrefix : "" , options : { disabled : false } , _createWidget : function ( n , s ) { a . data ( s , this . widgetName , this ) ; this . element = a ( s ) ; this . options =
a . extend ( true , { } , this . options , this . _getCreateOptions ( ) , n ) ; 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 ( n , s ) { var b = n ; if ( arguments . length === 0 ) return a . extend ( { } , this . options ) ; if ( typeof n == "string" ) { if ( s === p ) return this . options [ n ] ; b = { } ; b [ n ] = s } this . _setOptions ( b ) ; return this } , _setOptions : function ( n ) { var s = this ; a . each ( n , function ( b , f ) { s . _setOption ( b , f ) } ) ; return this } , _setOption : function ( n , s ) { this . options [ n ] = s ; n === "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 ( n , s , b ) { var f , d = this . options [ n ] ; b = b || { } ; s = a . Event ( s ) ; s . type = ( n === this . widgetEventPrefix ? n : this . widgetEventPrefix + n ) . toLowerCase ( ) ; s . target = this . element [ 0 ] ; if ( n = s . originalEvent ) for ( f in n ) f in s || ( s [ f ] = n [ f ] ) ; this . element . trigger ( s , b ) ; return ! ( a . isFunction ( d ) && d . call ( this . element [ 0 ] , s , b ) === false || s . isDefaultPrevented ( ) ) } } } ) ( jQuery ) ;
( function ( a ) { var p = false ; a ( document ) . mouseup ( function ( ) { p = 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 ( ! p ) { this . _mouseStarted && this . _mouseUp ( g ) ; this . _mouseDownEvent = g ; var c = this , n = g . which == 1 , s = typeof this . options . cancel == "string" && g . target . nodeName ? a ( g . target ) . closest ( this . options . cancel ) . length : false ; if ( ! n || 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 p = 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-06-23 19:40:40 +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-25 06:32:18 +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 ( p ) { var g = this . options ;
if ( this . helper || g . disabled || a ( p . target ) . is ( ".ui-resizable-handle" ) ) return false ; this . handle = this . _getHandle ( p ) ; 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 ( p ) { var g = this . options ; this . helper =
this . _createHelper ( p ) ; 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 : p . pageX - this . offset . left , top : p . pageY - this . offset . top } , parent : this . _getParentOffset ( ) , relative : this . _getRelativeOffset ( ) } ) ;
this . originalPosition = this . position = this . _generatePosition ( p ) ; this . originalPageX = p . pageX ; this . originalPageY = p . pageY ; g . cursorAt && this . _adjustOffsetFromHelper ( g . cursorAt ) ; g . containment && this . _setContainment ( ) ; if ( this . _trigger ( "start" , p ) === false ) { this . _clear ( ) ; return false } this . _cacheHelperProportions ( ) ; a . ui . ddmanager && ! g . dropBehaviour && a . ui . ddmanager . prepareOffsets ( this , p ) ; this . helper . addClass ( "ui-draggable-dragging" ) ; this . _mouseDrag ( p , true ) ; a . ui . ddmanager && a . ui . ddmanager . dragStart ( this , p ) ; return true } ,
_mouseDrag : function ( p , g ) { this . position = this . _generatePosition ( p ) ; this . positionAbs = this . _convertPositionTo ( "absolute" ) ; if ( ! g ) { var c = this . _uiHash ( ) ; if ( this . _trigger ( "drag" , p , 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 , p ) ; return false } , _mouseStop : function ( p ) { var g =
false ; a . ui . ddmanager && ! this . options . dropBehaviour && ( g = a . ui . ddmanager . drop ( this , p ) ) ; 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" , p ) !== false && c . _clear ( ) } ) } else this . _trigger ( "stop" , p ) !== false && this . _clear ( ) ; return false } , _mouseUp : function ( p ) { this . options . iframeFix === true && a ( "div.ui-draggable-iframeFix" ) . each ( function ( ) { this . parentNode . removeChild ( this ) } ) ; a . ui . ddmanager && a . ui . ddmanager . dragStop ( this , p ) ; return a . ui . mouse . prototype . _mouseUp . call ( this , p ) } , cancel : function ( ) { this . helper . is ( ".ui-draggable-dragging" ) ? this . _mouseUp ( { } ) : this . _clear ( ) ; return this } , _getHandle : function ( p ) { 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 == p . target && ( g = true ) } ) ; return g } , _createHelper : function ( p ) { var g = this . options ; p = a . isFunction ( g . helper ) ? a ( g . helper . apply ( this . element [ 0 ] , [ p ] ) ) : g . helper == "clone" ? this . element . clone ( ) . removeAttr ( "id" ) : this . element ; p . parents ( "body" ) . length || p . appendTo ( g . appendTo == "parent" ? this . element [ 0 ] . parentNode : g . appendTo ) ; p [ 0 ] != this . element [ 0 ] && ! /(fixed|absolute)/ . test ( p . css ( "position" ) ) &&
p . css ( "position" , "absolute" ) ; return p } , _adjustOffsetFromHelper : function ( p ) { typeof p == "string" && ( p = p . split ( " " ) ) ; a . isArray ( p ) && ( p = { left : + p [ 0 ] , top : + p [ 1 ] || 0 } ) ; "left" in p && ( this . offset . click . left = p . left + this . margins . left ) ; "right" in p && ( this . offset . click . left = this . helperProportions . width - p . right + this . margins . left ) ; "top" in p && ( this . offset . click . top = p . top + this . margins . top ) ; "bottom" in p && ( this . offset . click . top = this . helperProportions . height - p . bottom + this . margins . top ) } , _getParentOffset : function ( ) { this . offsetParent =
this . helper . offsetParent ( ) ; var p = this . offsetParent . offset ( ) ; this . cssPosition == "absolute" && this . scrollParent [ 0 ] != document && a . ui . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) && ( p . left += this . scrollParent . scrollLeft ( ) , p . top += this . scrollParent . scrollTop ( ) ) ; if ( this . offsetParent [ 0 ] == document . body || this . offsetParent [ 0 ] . tagName && this . offsetParent [ 0 ] . tagName . toLowerCase ( ) == "html" && a . browser . msie ) p = { top : 0 , left : 0 } ; return { top : p . top + ( parseInt ( this . offsetParent . css ( "borderTopWidth" ) , 10 ) || 0 ) , left : p . left + ( parseInt ( this . offsetParent . css ( "borderLeftWidth" ) ,
10 ) || 0 ) } } , _getRelativeOffset : function ( ) { if ( this . cssPosition == "relative" ) { var p = this . element . position ( ) ; return { top : p . top - ( parseInt ( this . helper . css ( "top" ) , 10 ) || 0 ) + this . scrollParent . scrollTop ( ) , left : p . 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 p = this . options ; p . containment == "parent" && ( p . containment = this . helper [ 0 ] . parentNode ) ; if ( p . containment == "document" || p . containment == "window" ) this . containment = [ p . containment == "document" ? 0 : a ( window ) . scrollLeft ( ) - this . offset . relative . left - this . offset . parent . left , p . containment == "document" ? 0 : a ( window ) . scrollTop ( ) - this . offset . relative . top - this . offset . parent . top ,
( p . containment == "document" ? 0 : a ( window ) . scrollLeft ( ) ) + a ( p . containment == "document" ? document : window ) . width ( ) - this . helperProportions . width - this . margins . left , ( p . containment == "document" ? 0 : a ( window ) . scrollTop ( ) ) + ( a ( p . containment == "document" ? document : window ) . height ( ) || document . body . parentNode . scrollHeight ) - this . helperProportions . height - this . margins . top ] ; if ( ! /^(document|window|parent)$/ . test ( p . containment ) && p . containment . constructor != Array ) { p = a ( p . containment ) ; var g = p [ 0 ] ; if ( g ) { p . offset ( ) ; var c = a ( g ) . css ( "overflow" ) !=
2012-07-24 12:42:34 +00:00
"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" ) ,
2012-07-25 06:32:18 +00:00
10 ) || 0 ) - ( parseInt ( a ( g ) . css ( "paddingBottom" ) , 10 ) || 0 ) - this . helperProportions . height - this . margins . top - this . margins . bottom ] ; this . relative _container = p } } else p . containment . constructor == Array && ( this . containment = p . containment ) } , _convertPositionTo : function ( p , g ) { g || ( g = this . position ) ; var c = p == "absolute" ? 1 : - 1 , n = 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 ( n [ 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 : n . 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 : n . scrollLeft ( ) ) * c ) } } , _generatePosition : function ( p ) { 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 , n = /(html|body)/i . test ( c [ 0 ] . tagName ) , s = p . pageX , b = p . 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 ; p . pageX - this . offset . click . left < f [ 0 ] && ( s = f [ 0 ] + this . offset . click . left ) ;
p . pageY - this . offset . click . top < f [ 1 ] && ( b = f [ 1 ] + this . offset . click . top ) ; p . pageX - this . offset . click . left > f [ 2 ] && ( s = f [ 2 ] + this . offset . click . left ) ; p . 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 ( ) : n ? 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 ( ) : n ? 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 ( p , g , c ) { c = c || this . _uiHash ( ) ; a . ui . plugin . call ( this , p , [ g , c ] ) ; p == "drag" && ( this . positionAbs = this . _convertPositionTo ( "absolute" ) ) ; return a . Widget . prototype . _trigger . call ( this , p , 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 ( p , g ) { var c = a ( this ) . data ( "draggable" ) , n = c . options , s = a . extend ( { } , g , { item : c . element } ) ; c . sortables = [ ] ; a ( n . 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" , p , s ) ) } ) } , stop : function ( p , g ) { var c = a ( this ) . data ( "draggable" ) , n = 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 ( p ) , 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" , p , n ) ) } ) } , drag : function ( p , g ) { var c = a ( this ) . data ( "draggable" ) , n = 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 ( n ) . 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 ] } , p . target = this . instance . currentItem [ 0 ] , this . instance . _mouseCapture ( p , true ) , this . instance . _mouseStart ( p , 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" , p ) , c . dropped = this . instance . element , c . currentItem = c . element , this . instance . fromOutside = c ) , this . instance . currentItem && this . instance . _mouseDrag ( p ) ) : this . instance . isOver && ( this . instance . isOver = 0 , this . instance . cancelHelperRemoval = true , this . instance . options . revert = false , this . instance . _trigger ( "out" , p , this . instance . _uiHash ( this . instance ) ) , this . instance . _mouseStop ( p , true ) , this . instance . options . helper = this . instance . options . _helper , this . instance . currentItem . remove ( ) , this . instance . placeholder &&
this . instance . placeholder . remove ( ) , c . _trigger ( "fromSortable" , p ) , c . dropped = false ) } ) } } ) ; a . ui . plugin . add ( "draggable" , "cursor" , { start : function ( ) { var p = a ( "body" ) , g = a ( this ) . data ( "draggable" ) . options ; p . css ( "cursor" ) && ( g . _cursor = p . css ( "cursor" ) ) ; p . css ( "cursor" , g . cursor ) } , stop : function ( ) { var p = a ( this ) . data ( "draggable" ) . options ; p . _cursor && a ( "body" ) . css ( "cursor" , p . _cursor ) } } ) ; a . ui . plugin . add ( "draggable" , "opacity" , { start : function ( p , g ) { var c = a ( g . helper ) , n = a ( this ) . data ( "draggable" ) . options ; c . css ( "opacity" ) && ( n . _opacity =
c . css ( "opacity" ) ) ; c . css ( "opacity" , n . opacity ) } , stop : function ( p , 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 p = a ( this ) . data ( "draggable" ) ; p . scrollParent [ 0 ] != document && p . scrollParent [ 0 ] . tagName != "HTML" && ( p . overflowOffset = p . scrollParent . offset ( ) ) } , drag : function ( p ) { var g = a ( this ) . data ( "draggable" ) , c = g . options , n = false ; if ( g . scrollParent [ 0 ] != document && g . scrollParent [ 0 ] . tagName != "HTML" ) { if ( ! c . axis ||
c . axis != "x" ) g . overflowOffset . top + g . scrollParent [ 0 ] . offsetHeight - p . pageY < c . scrollSensitivity ? g . scrollParent [ 0 ] . scrollTop = n = g . scrollParent [ 0 ] . scrollTop + c . scrollSpeed : p . pageY - g . overflowOffset . top < c . scrollSensitivity && ( g . scrollParent [ 0 ] . scrollTop = n = g . scrollParent [ 0 ] . scrollTop - c . scrollSpeed ) ; if ( ! c . axis || c . axis != "y" ) g . overflowOffset . left + g . scrollParent [ 0 ] . offsetWidth - p . pageX < c . scrollSensitivity ? g . scrollParent [ 0 ] . scrollLeft = n = g . scrollParent [ 0 ] . scrollLeft + c . scrollSpeed : p . pageX - g . overflowOffset . left < c . scrollSensitivity &&
( g . scrollParent [ 0 ] . scrollLeft = n = g . scrollParent [ 0 ] . scrollLeft - c . scrollSpeed ) } else { if ( ! c . axis || c . axis != "x" ) p . pageY - a ( document ) . scrollTop ( ) < c . scrollSensitivity ? n = a ( document ) . scrollTop ( a ( document ) . scrollTop ( ) - c . scrollSpeed ) : a ( window ) . height ( ) - ( p . pageY - a ( document ) . scrollTop ( ) ) < c . scrollSensitivity && ( n = a ( document ) . scrollTop ( a ( document ) . scrollTop ( ) + c . scrollSpeed ) ) ; if ( ! c . axis || c . axis != "y" ) p . pageX - a ( document ) . scrollLeft ( ) < c . scrollSensitivity ? n = a ( document ) . scrollLeft ( a ( document ) . scrollLeft ( ) - c . scrollSpeed ) :
a ( window ) . width ( ) - ( p . pageX - a ( document ) . scrollLeft ( ) ) < c . scrollSensitivity && ( n = a ( document ) . scrollLeft ( a ( document ) . scrollLeft ( ) + c . scrollSpeed ) ) } n !== false && a . ui . ddmanager && ! c . dropBehaviour && a . ui . ddmanager . prepareOffsets ( g , p ) } } ) ; a . ui . plugin . add ( "draggable" , "snap" , { start : function ( ) { var p = a ( this ) . data ( "draggable" ) , g = p . options ; p . snapElements = [ ] ; a ( g . snap . constructor != String ? g . snap . items || ":data(draggable)" : g . snap ) . each ( function ( ) { var c = a ( this ) , n = c . offset ( ) ; this != p . element [ 0 ] && p . snapElements . push ( { item : this ,
width : c . outerWidth ( ) , height : c . outerHeight ( ) , top : n . top , left : n . left } ) } ) } , drag : function ( p , g ) { for ( var c = a ( this ) . data ( "draggable" ) , n = c . options , s = n . snapTolerance , b = g . offset . left , f = b + c . helperProportions . width , d = g . offset . top , m = d + c . helperProportions . height , q = c . snapElements . length - 1 ; q >= 0 ; q -- ) { var B = c . snapElements [ q ] . left , o = B + c . snapElements [ q ] . width , K = c . snapElements [ q ] . top , S = K + c . snapElements [ q ] . height ; if ( B - s < b && b < o + s && K - s < d && d < S + s || B - s < b && b < o + s && K - s < m && m < S + s || B - s < f && f < o + s && K - s < d && d < S + s || B - s < f && f < o + s && K - s < m &&
m < S + s ) { if ( n . snapMode != "inner" ) { var M = Math . abs ( K - m ) <= s , J = Math . abs ( S - d ) <= s , Q = Math . abs ( B - f ) <= s , Y = Math . abs ( o - b ) <= s ; M && ( g . position . top = c . _convertPositionTo ( "relative" , { top : K - c . helperProportions . height , left : 0 } ) . top - c . margins . top ) ; J && ( g . position . top = c . _convertPositionTo ( "relative" , { top : S , left : 0 } ) . top - c . margins . top ) ; Q && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : B - c . helperProportions . width } ) . left - c . margins . left ) ; Y && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : o } ) . left - c . margins . left ) } var P =
M || J || Q || Y ; if ( n . snapMode != "outer" ) { M = Math . abs ( K - d ) <= s ; J = Math . abs ( S - m ) <= s ; Q = Math . abs ( B - b ) <= s ; Y = Math . abs ( o - f ) <= s ; M && ( g . position . top = c . _convertPositionTo ( "relative" , { top : K , left : 0 } ) . top - c . margins . top ) ; J && ( g . position . top = c . _convertPositionTo ( "relative" , { top : S - c . helperProportions . height , left : 0 } ) . top - c . margins . top ) ; Q && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : B } ) . left - c . margins . left ) ; Y && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : o - c . helperProportions . width } ) . left - c . margins . left ) } ! c . snapElements [ q ] . snapping &&
( M || J || Q || Y || P ) && c . options . snap . snap && c . options . snap . snap . call ( c . element , p , a . extend ( c . _uiHash ( ) , { snapItem : c . snapElements [ q ] . item } ) ) ; c . snapElements [ q ] . snapping = M || J || Q || Y || P } else { c . snapElements [ q ] . snapping && c . options . snap . release && c . options . snap . release . call ( c . element , p , a . extend ( c . _uiHash ( ) , { snapItem : c . snapElements [ q ] . item } ) ) ; c . snapElements [ q ] . snapping = false } } } } ) ; a . ui . plugin . add ( "draggable" , "stack" , { start : function ( ) { var p = a ( this ) . data ( "draggable" ) . options ; p = a . makeArray ( a ( p . stack ) ) . sort ( function ( c ,
n ) { return ( parseInt ( a ( c ) . css ( "zIndex" ) , 10 ) || 0 ) - ( parseInt ( a ( n ) . css ( "zIndex" ) , 10 ) || 0 ) } ) ; if ( p . length ) { var g = parseInt ( p [ 0 ] . style . zIndex ) || 0 ; a ( p ) . each ( function ( c ) { this . style . zIndex = g + c } ) ; this [ 0 ] . style . zIndex = g + p . length } } } ) ; a . ui . plugin . add ( "draggable" , "zIndex" , { start : function ( p , g ) { var c = a ( g . helper ) , n = a ( this ) . data ( "draggable" ) . options ; c . css ( "zIndex" ) && ( n . _zIndex = c . css ( "zIndex" ) ) ; c . css ( "zIndex" , n . zIndex ) } , stop : function ( p , 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 p = this , g = this . options , c = this . element . find ( ".ui-slider-handle" ) . addClass ( "ui-state-default ui-corner-all" ) , n = 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 < n ; 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 ( p . 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 , m = a ( this ) . data ( "index.ui-slider-handle" ) , q , B , o ; if ( ! p . 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 ( ! p . _keySliding ) { p . _keySliding = true ; a ( this ) . addClass ( "ui-state-active" ) ; q = p . _start ( f , m ) ; if ( q === false ) return } } q = p . options . step ; p . options . values && p . options . values . length ?
B = o = p . values ( m ) : B = o = p . value ( ) ; switch ( f . keyCode ) { case a . ui . keyCode . HOME : o = p . _valueMin ( ) ; break ; case a . ui . keyCode . END : o = p . _valueMax ( ) ; break ; case a . ui . keyCode . PAGE _UP : o = p . _trimAlignValue ( B + ( p . _valueMax ( ) - p . _valueMin ( ) ) / 5 ) ; break ; case a . ui . keyCode . PAGE _DOWN : o = p . _trimAlignValue ( B - ( p . _valueMax ( ) - p . _valueMin ( ) ) / 5 ) ; break ; case a . ui . keyCode . UP : case a . ui . keyCode . RIGHT : if ( B === p . _valueMax ( ) ) return ; o = p . _trimAlignValue ( B + q ) ; break ; case a . ui . keyCode . DOWN : case a . ui . keyCode . LEFT : if ( B === p . _valueMin ( ) ) return ; o = p . _trimAlignValue ( B -
q ) } p . _slide ( f , m , o ) ; return d } } ) . keyup ( function ( f ) { var d = a ( this ) . data ( "index.ui-slider-handle" ) ; p . _keySliding && ( p . _keySliding = false , p . _stop ( f , d ) , p . _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 ( p ) { var g = this . options , c , n , 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 : p . pageX , y : p . pageY } ) ; n = this . _valueMax ( ) - this . _valueMin ( ) + 1 ; b = this ; this . handles . each ( function ( d ) { var m = Math . abs ( c - b . values ( d ) ) ; n > m && ( n = m , s = a ( this ) , f = d ) } ) ; g . range === true && this . values ( 1 ) === g . min && ( f += 1 , s = a ( this . handles [ f ] ) ) ; if ( this . _start ( p , f ) === false ) return false ;
this . _mouseSliding = true ; b . _handleIndex = f ; s . addClass ( "ui-state-active" ) . focus ( ) ; g = s . offset ( ) ; this . _clickOffset = ! a ( p . target ) . parents ( ) . andSelf ( ) . is ( ".ui-slider-handle" ) ? { left : 0 , top : 0 } : { left : p . pageX - g . left - s . width ( ) / 2 , top : p . 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 ( p , f , c ) ; return this . _animateOff = true } , _mouseStart : function ( ) { return true } , _mouseDrag : function ( p ) { var g =
this . _normValueFromMouse ( { x : p . pageX , y : p . pageY } ) ; this . _slide ( p , this . _handleIndex , g ) ; return false } , _mouseStop : function ( p ) { this . handles . removeClass ( "ui-state-active" ) ; this . _mouseSliding = false ; this . _stop ( p , this . _handleIndex ) ; this . _change ( p , this . _handleIndex ) ; this . _clickOffset = this . _handleIndex = null ; return this . _animateOff = false } , _detectOrientation : function ( ) { this . orientation = this . options . orientation === "vertical" ? "vertical" : "horizontal" } , _normValueFromMouse : function ( p ) { var g , c ; this . orientation === "horizontal" ?
( g = this . elementSize . width , c = p . x - this . elementOffset . left - ( this . _clickOffset ? this . _clickOffset . left : 0 ) ) : ( g = this . elementSize . height , c = p . y - this . elementOffset . top - ( this . _clickOffset ? this . _clickOffset . top : 0 ) ) ; p = c / g ; p > 1 && ( p = 1 ) ; p < 0 && ( p = 0 ) ; this . orientation === "vertical" && ( p = 1 - p ) ; g = this . _valueMax ( ) - this . _valueMin ( ) ; return this . _trimAlignValue ( this . _valueMin ( ) + p * g ) } , _start : function ( p , 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" , p , c ) } , _slide : function ( p , g , c ) { var n , s , b ; this . options . values && this . options . values . length ? ( n = this . values ( g ? 0 : 1 ) , this . options . values . length === 2 && this . options . range === true && ( g === 0 && c > n || g === 1 && c < n ) && ( c = n ) , c !== this . values ( g ) && ( s = this . values ( ) , s [ g ] = c , b = this . _trigger ( "slide" , p , { 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" , p , { handle : this . handles [ g ] , value : c } ) , b !==
false && this . value ( c ) ) } , _stop : function ( p , 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" , p , c ) } , _change : function ( p , 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" , p , c ) } } , value : function ( p ) { if ( arguments . length ) { this . options . value =
this . _trimAlignValue ( p ) ; this . _refreshValue ( ) ; this . _change ( null , 0 ) } else return this . _value ( ) } , values : function ( p , g ) { var c , n , s ; if ( arguments . length > 1 ) { this . options . values [ p ] = this . _trimAlignValue ( g ) ; this . _refreshValue ( ) ; this . _change ( null , p ) } else { if ( ! arguments . length ) return this . _values ( ) ; if ( ! a . isArray ( arguments [ 0 ] ) ) return this . options . values && this . options . values . length ? this . _values ( p ) : this . value ( ) ; c = this . options . values ; n = arguments [ 0 ] ; for ( s = 0 ; s < c . length ; s += 1 ) { c [ s ] = this . _trimAlignValue ( n [ s ] ) ; this . _change ( null ,
s ) } this . _refreshValue ( ) } } , _setOption : function ( p , g ) { var c , n = 0 ; a . isArray ( this . options . values ) && ( n = this . options . values . length ) ; a . Widget . prototype . _setOption . apply ( this , arguments ) ; switch ( p ) { 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 < n ; c += 1 ) this . _change ( null , c ) ; this . _animateOff = false } } , _value : function ( ) { var p = this . options . value ; return p = this . _trimAlignValue ( p ) } , _values : function ( p ) { var g , c ; if ( arguments . length ) { g = this . options . values [ p ] ;
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 ( p ) { if ( p <= this . _valueMin ( ) ) return this . _valueMin ( ) ; if ( p >= this . _valueMax ( ) ) return this . _valueMax ( ) ; var g = this . options . step > 0 ? this . options . step : 1 , c = ( p - this . _valueMin ( ) ) % g ; p = p - c ; Math . abs ( c ) * 2 >= g && ( p += c > 0 ? g : - g ) ; return parseFloat ( p . toFixed ( 5 ) ) } , _valueMin : function ( ) { return this . options . min } , _valueMax : function ( ) { return this . options . max } , _refreshValue : function ( ) { var p =
this . options . range , g = this . options , c = this , n = this . _animateOff ? false : g . animate , s , b = { } , f , d , m , q ; 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 ) [ n ? "animate" : "css" ] ( b , g . animate ) ; c . options . range === true && ( c . orientation === "horizontal" ? ( B === 0 && c . range . stop ( 1 , 1 ) [ n ? "animate" : "css" ] ( { left : s + "%" } , g . animate ) , B === 1 && c . range [ n ? "animate" : "css" ] ( { width : s -
f + "%" } , { queue : false , duration : g . animate } ) ) : ( B === 0 && c . range . stop ( 1 , 1 ) [ n ? "animate" : "css" ] ( { bottom : s + "%" } , g . animate ) , B === 1 && c . range [ n ? "animate" : "css" ] ( { height : s - f + "%" } , { queue : false , duration : g . animate } ) ) ) ; f = s } ) : ( d = this . value ( ) , m = this . _valueMin ( ) , q = this . _valueMax ( ) , s = q !== m ? ( d - m ) / ( q - m ) * 100 : 0 , b [ c . orientation === "horizontal" ? "left" : "bottom" ] = s + "%" , this . handle . stop ( 1 , 1 ) [ n ? "animate" : "css" ] ( b , g . animate ) , p === "min" && this . orientation === "horizontal" && this . range . stop ( 1 , 1 ) [ n ? "animate" : "css" ] ( { width : s + "%" } , g . animate ) ,
p === "max" && this . orientation === "horizontal" && this . range [ n ? "animate" : "css" ] ( { width : 100 - s + "%" } , { queue : false , duration : g . animate } ) , p === "min" && this . orientation === "vertical" && this . range . stop ( 1 , 1 ) [ n ? "animate" : "css" ] ( { height : s + "%" } , g . animate ) , p === "max" && this . orientation === "vertical" && this . range [ n ? "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 p = function ( b , f ) { var d = this , m = b . find ( "img:first" ) , q = 0 , B = 100 , o = 100 , K = 0 , S = 100 , M = 100 , J = 0 , Q = 0 , Y , P , ia = [ ] , qa = function ( W ) { for ( var Z = 0 ; Z < ia . length ; Z ++ ) ia [ Z ] . call ( d , d , W ) } , ga = function ( W ) { var Z = b . offset ( ) ; Y = { l : Z . left | 0 , t : Z . top | 0 } ; clearTimeout ( P ) ; P = setTimeout ( function ( ) { xa . call ( d , W ) } , 0 ) ; a ( document ) . bind ( "mousemove" , U ) . bind ( "mouseup" , ba ) ; W . preventDefault ( ) } , U = function ( W ) { clearTimeout ( P ) ; P = setTimeout ( function ( ) { xa . call ( d ,
W ) } , 0 ) ; W . stopPropagation ( ) ; W . preventDefault ( ) ; return false } , ba = function ( W ) { a ( document ) . unbind ( "mouseup" , ba ) . unbind ( "mousemove" , U ) ; W . stopPropagation ( ) ; W . preventDefault ( ) ; return false } , xa = function ( W ) { var Z = W . pageX - Y . l ; W = W . pageY - Y . t ; var oa = b . w , pa = b . h ; if ( Z < 0 ) Z = 0 ; else if ( Z > oa ) Z = oa ; if ( W < 0 ) W = 0 ; else if ( W > pa ) W = pa ; ka . call ( d , "xy" , { x : Z / oa * o + q , y : W / pa * M + K } ) } , ka = function ( W , Z , oa ) { if ( Z === undefined ) { if ( W === undefined || W == null ) W = "xy" ; switch ( W . toLowerCase ( ) ) { case "x" : return J ; case "y" : return Q ; default : return { x : J , y : Q } } } if ( ! ( oa !=
null && oa == d ) ) { var pa = false , na , ma ; if ( W == null ) W = "xy" ; switch ( W . toLowerCase ( ) ) { case "x" : na = Z && ( Z . x && Z . x | 0 || Z | 0 ) || 0 ; break ; case "y" : ma = Z && ( Z . y && Z . y | 0 || Z | 0 ) || 0 ; break ; default : na = Z && Z . x && Z . x | 0 || 0 ; ma = Z && Z . y && Z . y | 0 || 0 } if ( na != null ) { if ( na < q ) na = q ; else if ( na > B ) na = B ; if ( J != na ) { J = na ; pa = true } } if ( ma != null ) { if ( ma < K ) ma = K ; else if ( ma > S ) ma = S ; if ( Q != ma ) { Q = ma ; pa = true } } pa && qa . call ( d , oa || d ) } } , da = function ( W ) { a . isFunction ( W ) && ia . push ( W ) } ; a . extend ( true , d , { val : ka , range : function ( W , Z ) { if ( Z === undefined ) { if ( W === undefined || W == null ) W = "all" ;
switch ( W . toLowerCase ( ) ) { case "minx" : return q ; case "maxx" : return B ; case "rangex" : return { minX : q , maxX : B , rangeX : o } ; case "miny" : return K ; case "maxy" : return S ; case "rangey" : return { minY : K , maxY : S , rangeY : M } ; default : return { minX : q , maxX : B , rangeX : o , minY : K , maxY : S , rangeY : M } } } var oa , pa , na , ma ; if ( W == null ) W = "all" ; switch ( W . toLowerCase ( ) ) { case "minx" : oa = Z && ( Z . minX && Z . minX | 0 || Z | 0 ) || 0 ; break ; case "maxx" : pa = Z && ( Z . maxX && Z . maxX | 0 || Z | 0 ) || 0 ; break ; case "rangex" : oa = Z && Z . minX && Z . minX | 0 || 0 ; pa = Z && Z . maxX && Z . maxX | 0 || 0 ; break ; case "miny" : na =
Z && ( Z . minY && Z . minY | 0 || Z | 0 ) || 0 ; break ; case "maxy" : ma = Z && ( Z . maxY && Z . maxY | 0 || Z | 0 ) || 0 ; break ; case "rangey" : na = Z && Z . minY && Z . minY | 0 || 0 ; ma = Z && Z . maxY && Z . maxY | 0 || 0 ; break ; default : oa = Z && Z . minX && Z . minX | 0 || 0 ; pa = Z && Z . maxX && Z . maxX | 0 || 0 ; na = Z && Z . minY && Z . minY | 0 || 0 ; ma = Z && Z . maxY && Z . maxY | 0 || 0 } if ( oa != null && q != oa ) { q = oa ; o = B - q } if ( pa != null && B != pa ) { B = pa ; o = B - q } if ( na != null && K != na ) { K = na ; M = S - K } if ( ma != null && S != ma ) { S = ma ; M = S - K } } , bind : da , unbind : function ( W ) { if ( a . isFunction ( W ) ) for ( var Z ; ( Z = a . inArray ( W , ia ) ) != - 1 ; ) ia . splice ( Z , 1 ) } , destroy : function ( ) { a ( document ) . unbind ( "mouseup" ,
ba ) . unbind ( "mousemove" , U ) ; b . unbind ( "mousedown" , ga ) ; ia = m = b = null } } ) ; m . src = f . arrow && f . arrow . image ; m . w = f . arrow && f . arrow . width || m . width ( ) ; m . h = f . arrow && f . arrow . height || m . height ( ) ; b . w = f . map && f . map . width || b . width ( ) ; b . h = f . map && f . map . height || b . height ( ) ; b . bind ( "mousedown" , ga ) ; da . call ( d , function ( ) { var W = 0 , Z = 0 , oa = b . w , pa = b . h , na = m . w , ma = m . h ; setTimeout ( function ( ) { if ( o > 0 ) W = J == B ? oa : J / o * oa | 0 ; if ( M > 0 ) Z = Q == S ? pa : Q / M * pa | 0 ; if ( na >= oa ) W = ( oa >> 1 ) - ( na >> 1 ) ; else W -= na >> 1 ; if ( ma >= pa ) Z = ( pa >> 1 ) - ( ma >> 1 ) ; else Z -= ma >> 1 ; m . css ( { left : W + "px" ,
top : Z + "px" } ) } , 0 ) } ) } , g = function ( b , f , d , m ) { var q = this ; b = b . find ( "td.Text input" ) ; var B = b . eq ( 3 ) , o = b . eq ( 4 ) , K = b . eq ( 5 ) , S = b . length > 7 ? b . eq ( 6 ) : null , M = b . eq ( 0 ) , J = b . eq ( 1 ) , Q = b . eq ( 2 ) , Y = b . eq ( b . length > 7 ? 7 : 6 ) , P = b . length > 7 ? b . eq ( 8 ) : null , ia = function ( ka ) { if ( ! ( ka . target . value == "" && ka . target != Y . get ( 0 ) && ( d != null && ka . target != d . get ( 0 ) || d == null ) ) ) { if ( ! U ( ka ) ) return ka ; switch ( ka . target ) { case B . get ( 0 ) : switch ( ka . keyCode ) { case 38 : B . val ( ba . call ( q , ( B . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "r" , B . val ( ) , ka . target ) ; return false ; case 40 : B . val ( ba . call ( q ,
( B . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "r" , B . val ( ) , ka . target ) ; return false } break ; case o . get ( 0 ) : switch ( ka . keyCode ) { case 38 : o . val ( ba . call ( q , ( o . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "g" , o . val ( ) , ka . target ) ; return false ; case 40 : o . val ( ba . call ( q , ( o . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "g" , o . val ( ) , ka . target ) ; return false } break ; case K . get ( 0 ) : switch ( ka . keyCode ) { case 38 : K . val ( ba . call ( q , ( K . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "b" , K . val ( ) , ka . target ) ; return false ; case 40 : K . val ( ba . call ( q , ( K . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "b" , K . val ( ) , ka . target ) ; return false } break ;
case S && S . get ( 0 ) : switch ( ka . keyCode ) { case 38 : S . val ( ba . call ( q , parseFloat ( S . val ( ) ) + 1 , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( S . val ( ) * 255 / 100 , m ) , ka . target ) ; return false ; case 40 : S . val ( ba . call ( q , parseFloat ( S . val ( ) ) - 1 , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( S . val ( ) * 255 / 100 , m ) , ka . target ) ; return false } break ; case M . get ( 0 ) : switch ( ka . keyCode ) { case 38 : M . val ( ba . call ( q , ( M . val ( ) << 0 ) + 1 , 0 , 360 ) ) ; f . val ( "h" , M . val ( ) , ka . target ) ; return false ; case 40 : M . val ( ba . call ( q , ( M . val ( ) << 0 ) - 1 , 0 , 360 ) ) ; f . val ( "h" , M . val ( ) , ka . target ) ; return false } break ;
case J . get ( 0 ) : switch ( ka . keyCode ) { case 38 : J . val ( ba . call ( q , ( J . val ( ) << 0 ) + 1 , 0 , 100 ) ) ; f . val ( "s" , J . val ( ) , ka . target ) ; return false ; case 40 : J . val ( ba . call ( q , ( J . val ( ) << 0 ) - 1 , 0 , 100 ) ) ; f . val ( "s" , J . val ( ) , ka . target ) ; return false } break ; case Q . get ( 0 ) : switch ( ka . keyCode ) { case 38 : Q . val ( ba . call ( q , ( Q . val ( ) << 0 ) + 1 , 0 , 100 ) ) ; f . val ( "v" , Q . val ( ) , ka . target ) ; return false ; case 40 : Q . val ( ba . call ( q , ( Q . val ( ) << 0 ) - 1 , 0 , 100 ) ) ; f . val ( "v" , Q . val ( ) , ka . target ) ; return false } } } } , qa = function ( ka ) { if ( ! ( ka . target . value == "" && ka . target != Y . get ( 0 ) && ( d != null &&
ka . target != d . get ( 0 ) || d == null ) ) ) { if ( ! U ( ka ) ) return ka ; switch ( ka . target ) { case B . get ( 0 ) : B . val ( ba . call ( q , B . val ( ) , 0 , 255 ) ) ; f . val ( "r" , B . val ( ) , ka . target ) ; break ; case o . get ( 0 ) : o . val ( ba . call ( q , o . val ( ) , 0 , 255 ) ) ; f . val ( "g" , o . val ( ) , ka . target ) ; break ; case K . get ( 0 ) : K . val ( ba . call ( q , K . val ( ) , 0 , 255 ) ) ; f . val ( "b" , K . val ( ) , ka . target ) ; break ; case S && S . get ( 0 ) : S . val ( ba . call ( q , S . val ( ) , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( S . val ( ) * 255 / 100 , m ) , ka . target ) ; break ; case M . get ( 0 ) : M . val ( ba . call ( q , M . val ( ) , 0 , 360 ) ) ; f . val ( "h" , M . val ( ) , ka . target ) ; break ;
case J . get ( 0 ) : J . val ( ba . call ( q , J . val ( ) , 0 , 100 ) ) ; f . val ( "s" , J . val ( ) , ka . target ) ; break ; case Q . get ( 0 ) : Q . val ( ba . call ( q , Q . val ( ) , 0 , 100 ) ) ; f . val ( "v" , Q . val ( ) , ka . target ) ; break ; case Y . get ( 0 ) : Y . val ( Y . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 6 ) ) ; d && d . val ( Y . val ( ) ) ; f . val ( "hex" , Y . val ( ) != "" ? Y . val ( ) : null , ka . target ) ; break ; case d && d . get ( 0 ) : d . val ( d . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 6 ) ) ; Y . val ( d . val ( ) ) ; f . val ( "hex" , d . val ( ) != "" ? d . val ( ) : null , ka . target ) ; break ; case P && P . get ( 0 ) : P . val ( P . val ( ) . replace ( /[^a-fA-F0-9]/g ,
"" ) . toLowerCase ( ) . substring ( 0 , 2 ) ) ; f . val ( "a" , P . val ( ) != null ? parseInt ( P . val ( ) , 16 ) : null , ka . target ) } } } , ga = function ( ka ) { if ( f . val ( ) != null ) switch ( ka . target ) { case B . get ( 0 ) : B . val ( f . val ( "r" ) ) ; break ; case o . get ( 0 ) : o . val ( f . val ( "g" ) ) ; break ; case K . get ( 0 ) : K . val ( f . val ( "b" ) ) ; break ; case S && S . get ( 0 ) : S . val ( Math . precision ( f . val ( "a" ) * 100 / 255 , m ) ) ; break ; case M . get ( 0 ) : M . val ( f . val ( "h" ) ) ; break ; case J . get ( 0 ) : J . val ( f . val ( "s" ) ) ; break ; case Q . get ( 0 ) : Q . val ( f . val ( "v" ) ) ; break ; case Y . get ( 0 ) : case d && d . get ( 0 ) : Y . val ( f . val ( "hex" ) ) ; d && d . val ( f . val ( "hex" ) ) ;
break ; case P && P . get ( 0 ) : P . val ( f . val ( "ahex" ) . substring ( 6 ) ) } } , U = function ( ka ) { switch ( ka . keyCode ) { case 9 : case 16 : case 29 : case 37 : case 39 : return false ; case "c" . charCodeAt ( ) : case "v" . charCodeAt ( ) : if ( ka . ctrlKey ) return false } return true } , ba = function ( ka , da , W ) { if ( ka == "" || isNaN ( ka ) ) return da ; if ( ka > W ) return W ; if ( ka < da ) return da ; return ka } , xa = function ( ka , da ) { var W = ka . val ( "all" ) ; if ( da != B . get ( 0 ) ) B . val ( W != null ? W . r : "" ) ; if ( da != o . get ( 0 ) ) o . val ( W != null ? W . g : "" ) ; if ( da != K . get ( 0 ) ) K . val ( W != null ? W . b : "" ) ; if ( S && da != S . get ( 0 ) ) S . val ( W !=
null ? Math . precision ( W . a * 100 / 255 , m ) : "" ) ; if ( da != M . get ( 0 ) ) M . val ( W != null ? W . h : "" ) ; if ( da != J . get ( 0 ) ) J . val ( W != null ? W . s : "" ) ; if ( da != Q . get ( 0 ) ) Q . val ( W != null ? W . v : "" ) ; if ( da != Y . get ( 0 ) && ( d && da != d . get ( 0 ) || ! d ) ) Y . val ( W != null ? W . hex : "" ) ; if ( d && da != d . get ( 0 ) && da != Y . get ( 0 ) ) d . val ( W != null ? W . hex : "" ) ; if ( P && da != P . get ( 0 ) ) P . val ( W != null ? W . ahex . substring ( 6 ) : "" ) } ; a . extend ( true , q , { destroy : function ( ) { B . add ( o ) . add ( K ) . add ( S ) . add ( M ) . add ( J ) . add ( Q ) . add ( Y ) . add ( d ) . add ( P ) . unbind ( "keyup" , qa ) . unbind ( "blur" , ga ) ; B . add ( o ) . add ( K ) . add ( S ) . add ( M ) . add ( J ) . add ( Q ) . unbind ( "keydown" ,
ia ) ; f . unbind ( xa ) ; P = Y = Q = J = M = S = K = o = B = null } } ) ; B . add ( o ) . add ( K ) . add ( S ) . add ( M ) . add ( J ) . add ( Q ) . add ( Y ) . add ( d ) . add ( P ) . bind ( "keyup" , qa ) . bind ( "blur" , ga ) ; B . add ( o ) . add ( K ) . add ( S ) . add ( M ) . add ( J ) . add ( Q ) . bind ( "keydown" , ia ) ; f . bind ( xa ) } ; a . jPicker = { List : [ ] , Color : function ( b ) { var f = this , d , m , q , B , o , K , S , M = [ ] , J = function ( Y ) { for ( var P = 0 ; P < M . length ; P ++ ) M [ P ] . call ( f , f , Y ) } , Q = function ( Y , P , ia ) { if ( P === undefined ) { if ( Y === undefined || Y == null || Y == "" ) Y = "all" ; if ( d == null ) return null ; switch ( Y . toLowerCase ( ) ) { case "ahex" : return s . rgbaToHex ( { r : d ,
g : m , b : q , a : B } ) ; case "hex" : return Q ( "ahex" ) . substring ( 0 , 6 ) ; case "all" : return { r : d , g : m , b : q , a : B , h : o , s : K , v : S , hex : Q . call ( f , "hex" ) , ahex : Q . call ( f , "ahex" ) } ; default : P = { } ; for ( var qa = 0 ; qa < Y . length ; qa ++ ) switch ( Y . charAt ( qa ) ) { case "r" : if ( Y . length == 1 ) P = d ; else P . r = d ; break ; case "g" : if ( Y . length == 1 ) P = m ; else P . g = m ; break ; case "b" : if ( Y . length == 1 ) P = q ; else P . b = q ; break ; case "a" : if ( Y . length == 1 ) P = B ; else P . a = B ; break ; case "h" : if ( Y . length == 1 ) P = o ; else P . h = o ; break ; case "s" : if ( Y . length == 1 ) P = K ; else P . s = K ; break ; case "v" : if ( Y . length ==
1 ) P = S ; else P . v = S } return P == { } ? Q . call ( f , "all" ) : P } } if ( ! ( ia != null && ia == f ) ) { var ga = false ; if ( Y == null ) Y = "" ; if ( P == null ) { if ( d != null ) { d = null ; ga = true } if ( m != null ) { m = null ; ga = true } if ( q != null ) { q = null ; ga = true } if ( B != null ) { B = null ; ga = true } if ( o != null ) { o = null ; ga = true } if ( K != null ) { K = null ; ga = true } if ( S != null ) { S = null ; ga = true } ga && J . call ( f , ia || f ) } else switch ( Y . toLowerCase ( ) ) { case "ahex" : case "hex" : P = s . hexToRgba ( P && ( P . ahex || P . hex ) || P || "00000000" ) ; Q . call ( f , "rgba" , { r : P . r , g : P . g , b : P . b , a : Y == "ahex" ? P . a : B != null ? B : 255 } , ia ) ; break ; default : if ( P &&
( P . ahex != null || P . hex != null ) ) { Q . call ( f , "ahex" , P . ahex || P . hex || "00000000" , ia ) ; break } var U = { } , ba = false , xa = false ; if ( P . r !== undefined && ! Y . indexOf ( "r" ) == - 1 ) Y += "r" ; if ( P . g !== undefined && ! Y . indexOf ( "g" ) == - 1 ) Y += "g" ; if ( P . b !== undefined && ! Y . indexOf ( "b" ) == - 1 ) Y += "b" ; if ( P . a !== undefined && ! Y . indexOf ( "a" ) == - 1 ) Y += "a" ; if ( P . h !== undefined && ! Y . indexOf ( "h" ) == - 1 ) Y += "h" ; if ( P . s !== undefined && ! Y . indexOf ( "s" ) == - 1 ) Y += "s" ; if ( P . v !== undefined && ! Y . indexOf ( "v" ) == - 1 ) Y += "v" ; for ( qa = 0 ; qa < Y . length ; qa ++ ) switch ( Y . charAt ( qa ) ) { case "r" : if ( xa ) continue ;
ba = true ; U . r = P && P . r && P . r | 0 || P && P | 0 || 0 ; if ( U . r < 0 ) U . r = 0 ; else if ( U . r > 255 ) U . r = 255 ; if ( d != U . r ) { d = U . r ; ga = true } break ; case "g" : if ( xa ) continue ; ba = true ; U . g = P && P . g && P . g | 0 || P && P | 0 || 0 ; if ( U . g < 0 ) U . g = 0 ; else if ( U . g > 255 ) U . g = 255 ; if ( m != U . g ) { m = U . g ; ga = true } break ; case "b" : if ( xa ) continue ; ba = true ; U . b = P && P . b && P . b | 0 || P && P | 0 || 0 ; if ( U . b < 0 ) U . b = 0 ; else if ( U . b > 255 ) U . b = 255 ; if ( q != U . b ) { q = U . b ; ga = true } break ; case "a" : U . a = P && P . a != null ? P . a | 0 : P != null ? P | 0 : 255 ; if ( U . a < 0 ) U . a = 0 ; else if ( U . a > 255 ) U . a = 255 ; if ( B != U . a ) { B = U . a ; ga = true } break ; case "h" : if ( ba ) continue ;
xa = true ; U . h = P && P . h && P . h | 0 || P && P | 0 || 0 ; if ( U . h < 0 ) U . h = 0 ; else if ( U . h > 360 ) U . h = 360 ; if ( o != U . h ) { o = U . h ; ga = true } break ; case "s" : if ( ba ) continue ; xa = true ; U . s = P && P . s != null ? P . s | 0 : P != null ? P | 0 : 100 ; if ( U . s < 0 ) U . s = 0 ; else if ( U . s > 100 ) U . s = 100 ; if ( K != U . s ) { K = U . s ; ga = true } break ; case "v" : if ( ba ) continue ; xa = true ; U . v = P && P . v != null ? P . v | 0 : P != null ? P | 0 : 100 ; if ( U . v < 0 ) U . v = 0 ; else if ( U . v > 100 ) U . v = 100 ; if ( S != U . v ) { S = U . v ; ga = true } } if ( ga ) { if ( ba ) { d = d || 0 ; m = m || 0 ; q = q || 0 ; P = s . rgbToHsv ( { r : d , g : m , b : q } ) ; o = P . h ; K = P . s ; S = P . v } else if ( xa ) { o = o || 0 ; K = K != null ? K : 100 ; S =
S != null ? S : 100 ; P = s . hsvToRgb ( { h : o , s : K , v : S } ) ; d = P . r ; m = P . g ; q = P . b } B = B != null ? B : 255 ; J . call ( f , ia || f ) } } } } ; a . extend ( true , f , { val : Q , bind : function ( Y ) { a . isFunction ( Y ) && M . push ( Y ) } , unbind : function ( Y ) { if ( a . isFunction ( Y ) ) for ( var P ; ( P = a . inArray ( Y , M ) ) != - 1 ; ) M . splice ( P , 1 ) } , destroy : function ( ) { M = null } } ) ; if ( b ) if ( b . ahex != null ) Q ( "ahex" , b ) ; else if ( b . hex != null ) Q ( ( 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 ) Q ( "rgb" + ( b . a != null ? "a" : "" ) , b ) ; else if ( b . h != null && b . s != null &&
b . v != null ) Q ( "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" , m = "00" , q = "255" ; if ( b . length == 6 ) b += "ff" ; if ( b . length > 6 ) { f = b . substring ( 0 , 2 ) ; d = b . substring ( 2 , 4 ) ; m = b . substring ( 4 , 6 ) ; q = 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 ) m = b . substring ( 0 , b . length ) } return { r : this . hexToInt ( f ) , g : this . hexToInt ( d ) ,
b : this . hexToInt ( m ) , a : this . hexToInt ( q ) } } , 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 m = { h : 0 , s : 0 , v : 0 } , q = 0 , B =
0 ; if ( f >= d && f >= b ) { B = f ; q = d > b ? b : d } else if ( d >= b && d >= f ) { B = d ; q = f > b ? b : f } else { B = b ; q = d > f ? f : d } m . v = B ; m . s = B ? ( B - q ) / B : 0 ; if ( m . s ) { q = B - q ; m . h = f == B ? ( d - b ) / q : d == B ? 2 + ( b - f ) / q : 4 + ( f - d ) / q ; m . h = parseInt ( m . h * 60 ) ; if ( m . h < 0 ) m . h += 360 } else m . h = 0 ; m . s = m . s * 100 | 0 ; m . v = m . v * 100 | 0 ; return m } , hsvToRgb : function ( b ) { var f = { r : 0 , g : 0 , b : 0 , a : 100 } , d = b . h , m = b . s ; b = b . v ; if ( m == 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 ; m /= 100 ; b /= 100 ; var q = d | 0 , B = d - q ; d = b * ( 1 - m ) ; var o = b * ( 1 - m * B ) ; m = b * ( 1 - m * ( 1 - B ) ) ; switch ( q ) { case 0 : f . r = b ; f . g = m ; f . b = d ; break ; case 1 : f . r =
o ; f . g = b ; f . b = d ; break ; case 2 : f . r = d ; f . g = b ; f . b = m ; break ; case 3 : f . r = d ; f . g = o ; f . b = b ; break ; case 4 : f . r = m ; f . g = d ; f . b = b ; break ; case 5 : f . r = b ; f . g = d ; f . b = o } 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 , n = a . jPicker . List , s = a . jPicker . ColorMethods ; a . fn . jPicker = function ( b ) { var f = arguments ; return this . each ( function ( ) { var d = this , m = a . extend ( true , { } , a . fn . jPicker . defaults , b ) ; if ( a ( d ) . get ( 0 ) . nodeName . toLowerCase ( ) == "input" ) { a . extend ( true , m , { window : { bindToInput : true , expandable : true , input : a ( d ) } } ) ; if ( a ( d ) . val ( ) ==
"" ) { m . color . active = new c ( { hex : null } ) ; m . color . current = new c ( { hex : null } ) } else if ( s . validateHex ( a ( d ) . val ( ) ) ) { m . color . active = new c ( { hex : a ( d ) . val ( ) , a : m . color . active . val ( "a" ) } ) ; m . color . current = new c ( { hex : a ( d ) . val ( ) , a : m . color . active . val ( "a" ) } ) } } if ( m . 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 m . window . liveUpdate = false ; var q = parseFloat ( navigator . appVersion . split ( "MSIE" ) [ 1 ] ) < 7 && document . body . filters , B = null , o = null , K = null , S = null , M = null , J = null , Q = null , Y = null , P = null , ia = null , qa = null , ga = null , U = null , ba = null , xa = null , ka = null , da = null , W = null , Z = null , oa = null , pa = null , na = null , ma = null , za = null , Ha = null , Fa = null , Ia = null , La = null , Ka = function ( N ) { var R = la . active , ea = R . val ( "hex" ) , Ga , Oa ; m . color . mode = N ; switch ( N ) { case "h" : setTimeout ( function ( ) { Qa . call ( d , o , "transparent" ) ; Aa . call ( d , S , 0 ) ; ua . call ( d , S , 100 ) ; Aa . call ( d ,
M , 260 ) ; ua . call ( d , M , 100 ) ; Qa . call ( d , K , "transparent" ) ; Aa . call ( d , Q , 0 ) ; ua . call ( d , Q , 100 ) ; Aa . call ( d , Y , 260 ) ; ua . call ( d , Y , 100 ) ; Aa . call ( d , P , 260 ) ; ua . call ( d , P , 100 ) ; Aa . call ( d , ia , 260 ) ; ua . call ( d , ia , 100 ) ; Aa . call ( d , ga , 260 ) ; ua . call ( d , ga , 100 ) } , 0 ) ; U . range ( "all" , { minX : 0 , maxX : 100 , minY : 0 , maxY : 100 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 360 } ) ; if ( R . val ( "ahex" ) == null ) break ; U . val ( "xy" , { x : R . val ( "s" ) , y : 100 - R . val ( "v" ) } , U ) ; ba . val ( "y" , 360 - R . val ( "h" ) , ba ) ; break ; case "s" : setTimeout ( function ( ) { Qa . call ( d , o , "transparent" ) ; Aa . call ( d , S , - 260 ) ; Aa . call ( d ,
M , - 520 ) ; Aa . call ( d , Q , - 260 ) ; Aa . call ( d , Y , - 520 ) ; Aa . call ( d , ga , 260 ) ; ua . call ( d , ga , 100 ) } , 0 ) ; U . range ( "all" , { minX : 0 , maxX : 360 , minY : 0 , maxY : 100 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 100 } ) ; if ( R . val ( "ahex" ) == null ) break ; U . val ( "xy" , { x : R . val ( "h" ) , y : 100 - R . val ( "v" ) } , U ) ; ba . val ( "y" , 100 - R . val ( "s" ) , ba ) ; break ; case "v" : setTimeout ( function ( ) { Qa . call ( d , o , "000000" ) ; Aa . call ( d , S , - 780 ) ; Aa . call ( d , M , 260 ) ; Qa . call ( d , K , ea ) ; Aa . call ( d , Q , - 520 ) ; Aa . call ( d , Y , 260 ) ; ua . call ( d , Y , 100 ) ; Aa . call ( d , ga , 260 ) ; ua . call ( d , ga , 100 ) } , 0 ) ; U . range ( "all" , { minX : 0 , maxX : 360 ,
minY : 0 , maxY : 100 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 100 } ) ; if ( R . val ( "ahex" ) == null ) break ; U . val ( "xy" , { x : R . val ( "h" ) , y : 100 - R . val ( "s" ) } , U ) ; ba . val ( "y" , 100 - R . val ( "v" ) , ba ) ; break ; case "r" : Ga = - 1040 ; Oa = - 780 ; U . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( R . val ( "ahex" ) == null ) break ; U . val ( "xy" , { x : R . val ( "b" ) , y : 255 - R . val ( "g" ) } , U ) ; ba . val ( "y" , 255 - R . val ( "r" ) , ba ) ; break ; case "g" : Ga = - 1560 ; Oa = - 1820 ; U . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ;
if ( R . val ( "ahex" ) == null ) break ; U . val ( "xy" , { x : R . val ( "b" ) , y : 255 - R . val ( "r" ) } , U ) ; ba . val ( "y" , 255 - R . val ( "g" ) , ba ) ; break ; case "b" : Ga = - 2080 ; Oa = - 2860 ; U . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( R . val ( "ahex" ) == null ) break ; U . val ( "xy" , { x : R . val ( "r" ) , y : 255 - R . val ( "g" ) } , U ) ; ba . val ( "y" , 255 - R . val ( "b" ) , ba ) ; break ; case "a" : setTimeout ( function ( ) { Qa . call ( d , o , "transparent" ) ; Aa . call ( d , S , - 260 ) ; Aa . call ( d , M , - 520 ) ; Aa . call ( d , Q , 260 ) ; Aa . call ( d , Y , 260 ) ; ua . call ( d , Y , 100 ) ; Aa . call ( d , ga , 0 ) ; ua . call ( d ,
ga , 100 ) } , 0 ) ; U . range ( "all" , { minX : 0 , maxX : 360 , minY : 0 , maxY : 100 } ) ; ba . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( R . val ( "ahex" ) == null ) break ; U . val ( "xy" , { x : R . val ( "h" ) , y : 100 - R . val ( "v" ) } , U ) ; ba . val ( "y" , 255 - R . val ( "a" ) , ba ) ; break ; default : throw "Invalid Mode" ; } switch ( N ) { case "s" : case "v" : case "a" : setTimeout ( function ( ) { ua . call ( d , S , 100 ) ; ua . call ( d , Q , 100 ) ; Aa . call ( d , P , 260 ) ; ua . call ( d , P , 100 ) ; Aa . call ( d , ia , 260 ) ; ua . call ( d , ia , 100 ) } , 0 ) ; break ; case "r" : case "g" : case "b" : setTimeout ( function ( ) { Qa . call ( d , o , "transparent" ) ; Qa . call ( d , K , "transparent" ) ;
ua . call ( d , Q , 100 ) ; ua . call ( d , S , 100 ) ; Aa . call ( d , S , Ga ) ; Aa . call ( d , M , Ga - 260 ) ; Aa . call ( d , Q , Oa - 780 ) ; Aa . call ( d , Y , Oa - 520 ) ; Aa . call ( d , P , Oa ) ; Aa . call ( d , ia , Oa - 260 ) ; Aa . call ( d , ga , 260 ) ; ua . call ( d , ga , 100 ) } , 0 ) } R . val ( "ahex" ) != null && Ea . call ( d , R ) } , Ea = function ( N , R ) { if ( R == null || R != ba && R != U ) wa . call ( d , N , R ) ; setTimeout ( function ( ) { Va . call ( d , N ) ; yb . call ( d , N ) ; ib . call ( d , N ) } , 0 ) } , ya = function ( N , R ) { var ea = la . active ; if ( ! ( R != U && ea . val ( ) == null ) ) { var Ga = N . val ( "all" ) ; switch ( m . color . mode ) { case "h" : ea . val ( "sv" , { s : Ga . x , v : 100 - Ga . y } , R ) ; break ; case "s" : case "a" : ea . val ( "hv" ,
{ h : Ga . x , v : 100 - Ga . y } , R ) ; break ; case "v" : ea . val ( "hs" , { h : Ga . x , s : 100 - Ga . y } , R ) ; break ; case "r" : ea . val ( "gb" , { g : 255 - Ga . y , b : Ga . x } , R ) ; break ; case "g" : ea . val ( "rb" , { r : 255 - Ga . y , b : Ga . x } , R ) ; break ; case "b" : ea . val ( "rg" , { r : Ga . x , g : 255 - Ga . y } , R ) } } } , Ca = function ( N , R ) { var ea = la . active ; if ( ! ( R != ba && ea . val ( ) == null ) ) switch ( m . color . mode ) { case "h" : ea . val ( "h" , { h : 360 - N . val ( "y" ) } , R ) ; break ; case "s" : ea . val ( "s" , { s : 100 - N . val ( "y" ) } , R ) ; break ; case "v" : ea . val ( "v" , { v : 100 - N . val ( "y" ) } , R ) ; break ; case "r" : ea . val ( "r" , { r : 255 - N . val ( "y" ) } , R ) ; break ;
case "g" : ea . val ( "g" , { g : 255 - N . val ( "y" ) } , R ) ; break ; case "b" : ea . val ( "b" , { b : 255 - N . val ( "y" ) } , R ) ; break ; case "a" : ea . val ( "a" , 255 - N . val ( "y" ) , R ) } } , wa = function ( N , R ) { if ( R != U ) switch ( m . color . mode ) { case "h" : var ea = N . val ( "sv" ) ; U . val ( "xy" , { x : ea != null ? ea . s : 100 , y : 100 - ( ea != null ? ea . v : 100 ) } , R ) ; break ; case "s" : case "a" : ea = N . val ( "hv" ) ; U . val ( "xy" , { x : ea && ea . h || 0 , y : 100 - ( ea != null ? ea . v : 100 ) } , R ) ; break ; case "v" : ea = N . val ( "hs" ) ; U . val ( "xy" , { x : ea && ea . h || 0 , y : 100 - ( ea != null ? ea . s : 100 ) } , R ) ; break ; case "r" : ea = N . val ( "bg" ) ; U . val ( "xy" , { x : ea &&
ea . b || 0 , y : 255 - ( ea && ea . g || 0 ) } , R ) ; break ; case "g" : ea = N . val ( "br" ) ; U . val ( "xy" , { x : ea && ea . b || 0 , y : 255 - ( ea && ea . r || 0 ) } , R ) ; break ; case "b" : ea = N . val ( "rg" ) ; U . val ( "xy" , { x : ea && ea . r || 0 , y : 255 - ( ea && ea . g || 0 ) } , R ) } if ( R != ba ) switch ( m . color . mode ) { case "h" : ba . val ( "y" , 360 - ( N . val ( "h" ) || 0 ) , R ) ; break ; case "s" : ea = N . val ( "s" ) ; ba . val ( "y" , 100 - ( ea != null ? ea : 100 ) , R ) ; break ; case "v" : ea = N . val ( "v" ) ; ba . val ( "y" , 100 - ( ea != null ? ea : 100 ) , R ) ; break ; case "r" : ba . val ( "y" , 255 - ( N . val ( "r" ) || 0 ) , R ) ; break ; case "g" : ba . val ( "y" , 255 - ( N . val ( "g" ) || 0 ) , R ) ; break ; case "b" : ba . val ( "y" ,
255 - ( N . val ( "b" ) || 0 ) , R ) ; break ; case "a" : ea = N . val ( "a" ) ; ba . val ( "y" , 255 - ( ea != null ? ea : 255 ) , R ) } } , Va = function ( N ) { try { var R = N . val ( "all" ) ; oa . css ( { backgroundColor : R && "#" + R . hex || "transparent" } ) ; ua . call ( d , oa , R && Math . precision ( R . a * 100 / 255 , 4 ) || 0 ) } catch ( ea ) { } } , yb = function ( N ) { switch ( m . color . mode ) { case "h" : Qa . call ( d , o , ( new c ( { h : N . val ( "h" ) || 0 , s : 100 , v : 100 } ) ) . val ( "hex" ) ) ; break ; case "s" : case "a" : var R = N . val ( "s" ) ; ua . call ( d , M , 100 - ( R != null ? R : 100 ) ) ; break ; case "v" : R = N . val ( "v" ) ; ua . call ( d , S , R != null ? R : 100 ) ; break ; case "r" : ua . call ( d ,
M , Math . precision ( ( N . val ( "r" ) || 0 ) / 255 * 100 , 4 ) ) ; break ; case "g" : ua . call ( d , M , Math . precision ( ( N . val ( "g" ) || 0 ) / 255 * 100 , 4 ) ) ; break ; case "b" : ua . call ( d , M , Math . precision ( ( N . val ( "b" ) || 0 ) / 255 * 100 ) ) } N = N . val ( "a" ) ; ua . call ( d , J , Math . precision ( ( 255 - ( N || 0 ) ) * 100 / 255 , 4 ) ) } , ib = function ( N ) { switch ( m . color . mode ) { case "h" : var R = N . val ( "a" ) ; ua . call ( d , qa , Math . precision ( ( 255 - ( R || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "s" : R = N . val ( "hva" ) ; var ea = new c ( { h : R && R . h || 0 , s : 100 , v : R != null ? R . v : 100 } ) ; Qa . call ( d , K , ea . val ( "hex" ) ) ; ua . call ( d , Y , 100 - ( R != null ? R . v :
100 ) ) ; ua . call ( d , qa , Math . precision ( ( 255 - ( R && R . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "v" : R = N . val ( "hsa" ) ; ea = new c ( { h : R && R . h || 0 , s : R != null ? R . s : 100 , v : 100 } ) ; Qa . call ( d , K , ea . val ( "hex" ) ) ; ua . call ( d , qa , Math . precision ( ( 255 - ( R && R . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "r" : case "g" : case "b" : ea = R = 0 ; N = N . val ( "rgba" ) ; if ( m . color . mode == "r" ) { R = N && N . b || 0 ; ea = N && N . g || 0 } else if ( m . color . mode == "g" ) { R = N && N . b || 0 ; ea = N && N . r || 0 } else if ( m . color . mode == "b" ) { R = N && N . r || 0 ; ea = N && N . g || 0 } var Ga = ea > R ? R : ea ; ua . call ( d , Y , R > ea ? Math . precision ( ( R - ea ) / ( 255 - ea ) * 100 ,
4 ) : 0 ) ; ua . call ( d , P , ea > R ? Math . precision ( ( ea - R ) / ( 255 - R ) * 100 , 4 ) : 0 ) ; ua . call ( d , ia , Math . precision ( Ga / 255 * 100 , 4 ) ) ; ua . call ( d , qa , Math . precision ( ( 255 - ( N && N . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "a" : R = N . val ( "a" ) ; Qa . call ( d , K , N . val ( "hex" ) || "000000" ) ; ua . call ( d , qa , R != null ? 0 : 100 ) ; ua . call ( d , ga , R != null ? 100 : 0 ) } } , Qa = function ( N , R ) { N . css ( { backgroundColor : R && R . length == 6 && "#" + R || "transparent" } ) } , Ya = function ( N , R ) { if ( q && ( R . indexOf ( "AlphaBar.png" ) != - 1 || R . indexOf ( "Bars.png" ) != - 1 || R . indexOf ( "Maps.png" ) != - 1 ) ) { N . attr ( "pngSrc" , R ) ; N . css ( { backgroundImage : "none" ,
filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + R + "', sizingMethod='scale')" } ) } else N . css ( { backgroundImage : "url('" + R + "')" } ) } , Aa = function ( N , R ) { N . css ( { top : R + "px" } ) } , ua = function ( N , R ) { N . css ( { visibility : R > 0 ? "visible" : "hidden" } ) ; if ( R > 0 && R < 100 ) if ( q ) { var ea = N . attr ( "pngSrc" ) ; ea != null && ( ea . indexOf ( "AlphaBar.png" ) != - 1 || ea . indexOf ( "Bars.png" ) != - 1 || ea . indexOf ( "Maps.png" ) != - 1 ) ? N . css ( { filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + ea + "', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity=" +
R + ")" } ) : N . css ( { opacity : Math . precision ( R / 100 , 4 ) } ) } else N . css ( { opacity : Math . precision ( R / 100 , 4 ) } ) ; else if ( R == 0 || R == 100 ) if ( q ) { ea = N . attr ( "pngSrc" ) ; ea != null && ( ea . indexOf ( "AlphaBar.png" ) != - 1 || ea . indexOf ( "Bars.png" ) != - 1 || ea . indexOf ( "Maps.png" ) != - 1 ) ? N . css ( { filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + ea + "', sizingMethod='scale')" } ) : N . css ( { opacity : "" } ) } else N . css ( { opacity : "" } ) } , fb = function ( ) { la . active . val ( "ahex" , la . current . val ( "ahex" ) ) } , Ma = function ( ) { la . current . val ( "ahex" , la . active . val ( "ahex" ) ) } ,
Ta = function ( N ) { a ( this ) . parents ( "tbody:first" ) . find ( 'input:radio[value!="' + N . target . value + '"]' ) . removeAttr ( "checked" ) ; Ka . call ( d , N . target . value ) } , Ba = function ( ) { fb . call ( d ) } , jb = function ( ) { fb . call ( d ) ; m . window . expandable && Ab . call ( d ) ; a . isFunction ( tb ) && tb . call ( d , la . active , ma ) } , sb = function ( ) { Ma . call ( d ) ; m . window . expandable && Ab . call ( d ) ; a . isFunction ( nb ) && nb . call ( d , la . active , na ) } , Za = function ( ) { pb . call ( d ) } , cb = function ( N ) { var R = N . val ( "hex" ) ; pa . css ( { backgroundColor : R && "#" + R || "transparent" } ) ; ua . call ( d , pa , Math . precision ( ( N . val ( "a" ) ||
0 ) * 100 / 255 , 4 ) ) } , zb = function ( N ) { var R = N . val ( "hex" ) ; N = N . val ( "va" ) ; Ha . css ( { backgroundColor : R && "#" + R || "transparent" } ) ; ua . call ( d , Fa , Math . precision ( ( 255 - ( N && N . a || 0 ) ) * 100 / 255 , 4 ) ) ; if ( m . window . bindToInput && m . window . updateInputColor ) m . window . input . css ( { backgroundColor : R && "#" + R || "transparent" , color : N == null || N . v > 75 ? "#000000" : "#ffffff" } ) } , sa = function ( N ) { ka = parseInt ( B . css ( "left" ) ) ; da = parseInt ( B . css ( "top" ) ) ; W = N . pageX ; Z = N . pageY ; a ( document ) . bind ( "mousemove" , lb ) . bind ( "mouseup" , kb ) ; N . preventDefault ( ) } , lb = function ( N ) { B . css ( { left : ka -
( W - N . pageX ) + "px" , top : da - ( Z - N . pageY ) + "px" } ) ; m . window . expandable && ! a . support . boxModel && B . prev ( ) . css ( { left : B . css ( "left" ) , top : B . css ( "top" ) } ) ; N . stopPropagation ( ) ; N . preventDefault ( ) ; return false } , kb = function ( N ) { a ( document ) . unbind ( "mousemove" , lb ) . unbind ( "mouseup" , kb ) ; N . stopPropagation ( ) ; N . preventDefault ( ) ; return false } , vb = function ( N ) { N . preventDefault ( ) ; N . stopPropagation ( ) ; la . active . val ( "ahex" , a ( this ) . attr ( "title" ) || null , N . target ) ; return false } , nb = a . isFunction ( f [ 1 ] ) && f [ 1 ] || null , gb = a . isFunction ( f [ 2 ] ) && f [ 2 ] ||
null , tb = a . isFunction ( f [ 3 ] ) && f [ 3 ] || null , pb = function ( ) { la . current . val ( "ahex" , la . active . val ( "ahex" ) ) ; var N = function ( ) { if ( ! ( ! m . window . expandable || a . support . boxModel ) ) { var R = B . find ( "table:first" ) ; B . before ( "<iframe/>" ) ; B . prev ( ) . css ( { width : R . width ( ) , height : B . height ( ) , opacity : 0 , position : "absolute" , left : B . css ( "left" ) , top : B . css ( "top" ) } ) } } ; if ( m . window . expandable ) { a ( document . body ) . children ( "div.jPicker.Container" ) . css ( { zIndex : 10 } ) ; B . css ( { zIndex : 20 } ) } switch ( m . window . effects . type ) { case "fade" : B . fadeIn ( m . window . effects . speed . show ,
N ) ; break ; case "slide" : B . slideDown ( m . window . effects . speed . show , N ) ; break ; default : B . show ( m . window . effects . speed . show , N ) } } , Ab = function ( ) { var N = function ( ) { m . window . expandable && B . css ( { zIndex : 10 } ) ; ! m . window . expandable || a . support . boxModel || B . prev ( ) . remove ( ) } ; switch ( m . window . effects . type ) { case "fade" : B . fadeOut ( m . window . effects . speed . hide , N ) ; break ; case "slide" : B . slideUp ( m . window . effects . speed . hide , N ) ; break ; default : B . hide ( m . window . effects . speed . hide , N ) } } , Bb = function ( ) { var N = m . window , R = N . expandable ? a ( d ) . next ( ) . find ( ".Container:first" ) :
null ; B = N . expandable ? a ( "<div/>" ) : a ( d ) ; B . addClass ( "jPicker Container" ) ; N . expandable && B . hide ( ) ; B . get ( 0 ) . onselectstart = function ( Ra ) { if ( Ra . target . nodeName . toLowerCase ( ) !== "input" ) return false } ; var ea = la . active . val ( "all" ) ; if ( N . alphaPrecision < 0 ) N . alphaPrecision = 0 ; else if ( N . alphaPrecision > 2 ) N . alphaPrecision = 2 ; var Ga = '<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>' + ( N . expandable ? '<tr><td class="Move" colspan="5"> </td></tr>' : "" ) + '<tr><td rowspan="9"><h2 class="Title">' + ( N . title || ca . text . title ) +
'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="' + ja . clientPath + ja . 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="' + ja . clientPath + ja . colorBar . arrow . file + '" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">' +
ca . text . newColor + '<div class="color_preview"><span class="Active" title="' + ca . tooltips . colors . newColor + '"> </span><span class="Current" title="' + ca . tooltips . colors . currentColor + '"> </span></div></div>' + ca . text . currentColor + '</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="' + ca . text . ok + '" title="' + ca . tooltips . buttons . ok + '"/><input type="button" class="Cancel" value="' + ca . text . cancel + '" title="' + ca . tooltips . buttons . cancel + '"/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="' +
ca . tooltips . hue . radio + '"><input type="radio" value="h"' + ( m . color . mode == "h" ? ' checked="checked"' : "" ) + '/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . h : "" ) + '" title="' + ca . tooltips . hue . textbox + '"/> \u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="' + ca . tooltips . saturation . radio + '"><input type="radio" value="s"' + ( m . color . mode == "s" ? ' checked="checked"' : "" ) + '/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea !=
null ? ea . s : "" ) + '" title="' + ca . tooltips . saturation . textbox + '"/> %</td></tr><tr class="Value"><td class="Radio"><label title="' + ca . tooltips . value . radio + '"><input type="radio" value="v"' + ( m . color . mode == "v" ? ' checked="checked"' : "" ) + '/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . v : "" ) + '" title="' + ca . tooltips . value . textbox + '"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="' + ca . tooltips . red . radio + '"><input type="radio" value="r"' +
( m . color . mode == "r" ? ' checked="checked"' : "" ) + '/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . r : "" ) + '" title="' + ca . tooltips . red . textbox + '"/></td></tr><tr class="Green"><td class="Radio"><label title="' + ca . tooltips . green . radio + '"><input type="radio" value="g"' + ( m . color . mode == "g" ? ' checked="checked"' : "" ) + '/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . g : "" ) + '" title="' + ca . tooltips . green . textbox + '"/></td></tr><tr class="Blue"><td class="Radio"><label title="' +
ca . tooltips . blue . radio + '"><input type="radio" value="b"' + ( m . color . mode == "b" ? ' checked="checked"' : "" ) + '/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . b : "" ) + '" title="' + ca . tooltips . blue . textbox + '"/></td></tr><tr class="Alpha"><td class="Radio">' + ( N . alphaSupport ? '<label title="' + ca . tooltips . alpha . radio + '"><input type="radio" value="a"' + ( m . color . mode == "a" ? ' checked="checked"' : "" ) + "/>A:</label>" : " " ) + '</td><td class="Text">' + ( N . alphaSupport ? '<input type="text" maxlength="' +
( 3 + N . alphaPrecision ) + '" value="' + ( ea != null ? Math . precision ( ea . a * 100 / 255 , N . alphaPrecision ) : "" ) + '" title="' + ca . tooltips . alpha . textbox + '"/> %' : " " ) + '</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="' + ca . tooltips . hex . textbox + '">#:<input type="text" maxlength="6" class="Hex" value="' + ( ea != null ? ea . hex : "" ) + '"/></label>' + ( N . alphaSupport ? '<input type="text" maxlength="2" class="AHex" value="' + ( ea != null ? ea . ahex . substring ( 6 ) : "" ) + '" title="' + ca . tooltips . hex . alpha + '"/></td>' : " " ) +
"</tr></tbody></table>" ; if ( N . expandable ) { B . html ( Ga ) ; 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 : N . position . x == "left" ? R . offset ( ) . left - 530 - ( N . position . y == "center" ? 25 : 0 ) + "px" : N . position . x == "center" ? R . offset ( ) . left - 260 + "px" : N . position . x == "right" ? R . offset ( ) . left - 10 + ( N . position . y ==
"center" ? 25 : 0 ) + "px" : N . position . x == "screenCenter" ? ( a ( document ) . width ( ) >> 1 ) - 260 + "px" : R . offset ( ) . left + parseInt ( N . position . x ) + "px" , position : "absolute" , top : N . position . y == "top" ? R . offset ( ) . top - 312 + "px" : N . position . y == "center" ? R . offset ( ) . top - 156 + "px" : N . position . y == "bottom" ? R . offset ( ) . top + 25 + "px" : R . offset ( ) . top + parseInt ( N . position . y ) + "px" } ) } else { B = a ( d ) ; B . html ( Ga ) } Ga = B . find ( "tbody:first" ) ; o = Ga . find ( "div.Map:first" ) ; K = Ga . find ( "div.Bar:first" ) ; var Oa = o . find ( "span" ) , Xa = K . find ( "span" ) ; S = Oa . filter ( ".Map1:first" ) ;
M = Oa . filter ( ".Map2:first" ) ; J = Oa . filter ( ".Map3:first" ) ; Q = Xa . filter ( ".Map1:first" ) ; Y = Xa . filter ( ".Map2:first" ) ; P = Xa . filter ( ".Map3:first" ) ; ia = Xa . filter ( ".Map4:first" ) ; qa = Xa . filter ( ".Map5:first" ) ; ga = Xa . filter ( ".Map6:first" ) ; U = new p ( o , { map : { width : ja . colorMap . width , height : ja . colorMap . height } , arrow : { image : ja . clientPath + ja . colorMap . arrow . file , width : ja . colorMap . arrow . width , height : ja . colorMap . arrow . height } } ) ; U . bind ( ya ) ; ba = new p ( K , { map : { width : ja . colorBar . width , height : ja . colorBar . height } , arrow : { image : ja . clientPath +
ja . colorBar . arrow . file , width : ja . colorBar . arrow . width , height : ja . colorBar . arrow . height } } ) ; ba . bind ( Ca ) ; xa = new g ( Ga , la . active , N . expandable && N . bindToInput ? N . input : null , N . alphaPrecision ) ; Oa = ea != null ? ea . hex : null ; var bb = Ga . find ( ".Preview" ) ; Xa = Ga . find ( ".Button" ) ; oa = bb . find ( ".Active:first" ) . css ( { backgroundColor : Oa && "#" + Oa || "transparent" } ) ; pa = bb . find ( ".Current:first" ) . css ( { backgroundColor : Oa && "#" + Oa || "transparent" } ) . bind ( "click" , Ba ) ; ua . call ( d , pa , Math . precision ( la . current . val ( "a" ) * 100 ) / 255 , 4 ) ; na = Xa . find ( ".Ok:first" ) . bind ( "click touchstart" ,
sb ) ; ma = Xa . find ( ".Cancel:first" ) . bind ( "click touchstart" , jb ) ; za = Xa . find ( ".Grid:first" ) ; setTimeout ( function ( ) { Ya . call ( d , S , ja . clientPath + "Maps.png" ) ; Ya . call ( d , M , ja . clientPath + "Maps.png" ) ; Ya . call ( d , J , ja . clientPath + "map-opacity.png" ) ; Ya . call ( d , Q , ja . clientPath + "Bars.png" ) ; Ya . call ( d , Y , ja . clientPath + "Bars.png" ) ; Ya . call ( d , P , ja . clientPath + "Bars.png" ) ; Ya . call ( d , ia , ja . clientPath + "Bars.png" ) ; Ya . call ( d , qa , ja . clientPath + "bar-opacity.png" ) ; Ya . call ( d , ga , ja . clientPath + "AlphaBar.png" ) ; Ya . call ( d , bb . find ( "div:last" ) ,
ja . clientPath + "preview-opacity.png" ) } , 0 ) ; Ga . find ( "td.Radio input" ) . bind ( "click touchstart" , Ta ) ; if ( la . quickList && la . quickList . length > 0 ) { Xa = "" ; for ( i = 0 ; i < la . quickList . length ; i ++ ) { if ( ( typeof la . quickList [ i ] ) . toString ( ) . toLowerCase ( ) == "string" ) la . quickList [ i ] = new c ( { hex : la . quickList [ i ] } ) ; var rb = la . quickList [ i ] . val ( "a" ) , Wa = la . quickList [ i ] . val ( "ahex" ) ; if ( ! N . alphaSupport && Wa ) Wa = Wa . substring ( 0 , 6 ) + "ff" ; var qb = la . quickList [ i ] . val ( "hex" ) ; Xa += '<span class="QuickColor"' + ( Wa && ' title="#' + Wa + '"' || "" ) + ' style="background-color:' +
( qb && "#" + qb || "" ) + ";" + ( qb ? "" : "background-image:url(" + ja . clientPath + "NoColor.png)" ) + ( N . alphaSupport && rb && rb < 255 ? ";opacity:" + Math . precision ( rb / 255 , 4 ) + ";filter:Alpha(opacity=" + Math . precision ( rb / 2.55 , 4 ) + ")" : "" ) + '"> </span>' } Ya . call ( d , za , ja . clientPath + "bar-opacity.png" ) ; za . html ( Xa ) ; za . find ( ".QuickColor" ) . click ( vb ) } Ka . call ( d , m . color . mode ) ; la . active . bind ( Ea ) ; a . isFunction ( gb ) && la . active . bind ( gb ) ; la . current . bind ( cb ) ; if ( N . expandable ) { d . icon = R . parents ( ".Icon:first" ) ; Ha = d . icon . find ( ".Color:first" ) . css ( { backgroundColor : Oa &&
"#" + Oa || "transparent" } ) ; Fa = d . icon . find ( ".Alpha:first" ) ; Ya . call ( d , Fa , ja . clientPath + "bar-opacity.png" ) ; ua . call ( d , Fa , Math . precision ( ( 255 - ( ea != null ? ea . a : 0 ) ) * 100 / 255 , 4 ) ) ; Ia = d . icon . find ( ".Image:first" ) . css ( { backgroundImage : "url('" + ja . clientPath + ja . picker . file + "')" } ) . bind ( "click" , Za ) ; if ( N . bindToInput && N . updateInputColor ) N . input . css ( { backgroundColor : Oa && "#" + Oa || "transparent" , color : ea == null || ea . v > 75 ? "#000000" : "#ffffff" } ) ; La = Ga . find ( ".Move:first" ) . bind ( "mousedown" , sa ) ; la . active . bind ( zb ) } else pb . call ( d ) } , ja =
m . images , ca = m . localization , la = { active : ( typeof m . color . active ) . toString ( ) . toLowerCase ( ) == "string" ? new c ( { ahex : ! m . window . alphaSupport && m . color . active ? m . color . active . substring ( 0 , 6 ) + "ff" : m . color . active } ) : new c ( { ahex : ! m . window . alphaSupport && m . color . active . val ( "ahex" ) ? m . color . active . val ( "ahex" ) . substring ( 0 , 6 ) + "ff" : m . color . active . val ( "ahex" ) } ) , current : ( typeof m . color . active ) . toString ( ) . toLowerCase ( ) == "string" ? new c ( { ahex : ! m . window . alphaSupport && m . color . active ? m . color . active . substring ( 0 , 6 ) + "ff" : m . color . active } ) :
new c ( { ahex : ! m . window . alphaSupport && m . color . active . val ( "ahex" ) ? m . color . active . val ( "ahex" ) . substring ( 0 , 6 ) + "ff" : m . color . active . val ( "ahex" ) } ) , quickList : m . color . quickList } ; a . extend ( true , d , { commitCallback : nb , liveCallback : gb , cancelCallback : tb , color : la , show : pb , hide : Ab , destroy : function ( ) { B . find ( "td.Radio input touchstart" ) . unbind ( "click" , Ta ) ; pa . unbind ( "click touchstart" , Ba ) ; ma . unbind ( "click touchstart" , jb ) ; na . unbind ( "click touchstart" , sb ) ; if ( m . window . expandable ) { Ia . unbind ( "click" , Za ) ; La . unbind ( "mousedown" ,
sa ) ; d . icon = null } B . find ( ".QuickColor" ) . unbind ( "click" , vb ) ; ga = qa = ia = P = Y = Q = J = M = S = K = o = null ; U . destroy ( ) ; U = null ; ba . destroy ( ) ; ba = null ; xa . destroy ( ) ; gb = tb = nb = za = ma = na = pa = oa = xa = null ; B . html ( "" ) ; for ( i = 0 ; i < n . length ; i ++ ) n [ i ] == d && n . splice ( i , 1 ) } } ) ; n . push ( d ) ; setTimeout ( function ( ) { Bb . 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" , 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°)" } ,
2012-07-19 15:22:42 +00:00
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-25 06:32:18 +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 p ( n ) { var s = n || window . event , b = [ ] . slice . call ( arguments , 1 ) , f = 0 , d = 0 , m = 0 ; n = a . event . fix ( s ) ; n . type = "mousewheel" ; if ( s . wheelDelta ) f = s . wheelDelta / 120 ; if ( s . detail ) f = - s . detail / 3 ; m = f ; if ( s . axis !== undefined && s . axis === s . HORIZONTAL _AXIS ) { m = 0 ; d = - 1 * f } if ( s . wheelDeltaY !== undefined ) m = s . wheelDeltaY / 120 ; if ( s . wheelDeltaX !== undefined ) d = - 1 * s . wheelDeltaX / 120 ; b . unshift ( n , f , d , m ) ; 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 n = g . length ; n ; ) this . addEventListener ( g [ -- n ] , p , false ) ; else this . onmousewheel = p } , teardown : function ( ) { if ( this . removeEventListener ) for ( var n = g . length ; n ; ) this . removeEventListener ( g [ -- n ] , p , false ) ; else this . onmousewheel = null } } ; a . fn . extend ( { mousewheel : function ( n ) { return n ? this . bind ( "mousewheel" , n ) : this . trigger ( "mousewheel" ) } , unmousewheel : function ( n ) { return this . unbind ( "mousewheel" , n ) } } ) } ) ( jQuery ) ; svgEditor . addExtension ( "eyedropper" , function ( a ) { function p ( 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 , n = { fillPaint : "red" , fillOpacity : 1 , strokePaint : "black" , strokeOpacity : 1 , strokeWidth : 5 , strokeDashArray : null , opacity : 1 , strokeLinecap : "butt" , strokeLinejoin : "miter" } , s = function ( b , f , d ) { var m = null ; console . log ( b ) ; if ( b . indexOf ( "url(#" ) ===
0 ) { b = ( b = g . getRefElem ( b ) ) ? b . cloneNode ( true ) : $ ( "#" + d + "_color defs *" ) [ 0 ] ; m = { alpha : f } ; m [ b . tagName ] = b } else m = b . indexOf ( "#" ) === 0 ? { alpha : f , solidColor : b . substr ( 1 ) } : { alpha : f , solidColor : "none" } ; return new $ . jGraduate . Paint ( m ) } ; 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 : p , elementChanged : p , 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 ) { n . fillPaint = d . getAttribute ( "fill" ) || "white" ; n . fillOpacity = d . getAttribute ( "fill-opacity" ) || 1 ; n . strokePaint = d . getAttribute ( "stroke" ) || "none" ; n . strokeOpacity = d . getAttribute ( "stroke-opacity" ) || 1 ; n . strokeWidth = d . getAttribute ( "stroke-width" ) ; n . strokeDashArray = d . getAttribute ( "stroke-dasharray" ) ; n . strokeLinecap = d . getAttribute ( "stroke-linecap" ) ; n . strokeLinejoin = d . getAttribute ( "stroke-linejoin" ) ;
n . opacity = d . getAttribute ( "opacity" ) || 1 ; if ( $ . inArray ( b . selectedElements . nodeName , [ "g" , "use" ] ) == - 1 ) { var m = { } , q = function ( o , K , S ) { m [ K ] = o . getAttribute ( K ) ; o . setAttribute ( K , S ) } , B = new a . BatchCommand ; b . selectedElements . forEach ( function ( o ) { n . fillPaint && q ( o , "fill" , n . fillPaint ) ; n . fillOpacity && q ( o , "fill-opacity" , n . fillOpacity ) ; n . strokePaint && q ( o , "stroke" , n . strokePaint ) ; n . strokeOpacity && q ( o , "stroke-opacity" , n . strokeOpacity ) ; n . strokeWidth && q ( o , "stroke-width" , n . strokeWidth ) ; n . strokeDashArray && q ( o , "stroke-dasharray" ,
n . strokeDashArray ) ; n . opacity && q ( o , "opacity" , n . opacity ) ; n . strokeLinecap && q ( o , "stroke-linecap" , n . strokeLinecap ) ; n . strokeLinejoin && q ( o , "stroke-linejoin" , n . strokeLinejoin ) ; B . addSubCommand ( new c ( o , m ) ) ; console . log ( m ) ; m = { } } ) ; s ( n . fillPaint , n . fillOpacity * 100 , "fill" ) ; s ( n . strokePaint , n . strokeOpacity * 100 , "stroke" ) ; svgEditor . paintBox . fill . update ( true ) ; svgEditor . paintBox . stroke . update ( true ) ; g . undoMgr . addCommandToHistory ( B ) } } } } } ) ; svgEditor . addExtension ( "view_grid" , function ( a ) { function p ( d ) { b . attr ( "width" ) ; b . attr ( "height" ) ; var m = svgedit . units . getTypeMap ( ) [ svgEditor . curConfig . baseUnit ] , q = [ 0.01 , 0.1 , 1 , 10 , 100 , 1E3 ] ; svgCanvas . getContentElem ( ) . getAttribute ( "x" ) ; var B = n ; m = m * d ; var o = 100 / m , K = 1 ; for ( d = 0 ; d < q . length ; d ++ ) { var S = q [ d ] ; K = S ; if ( o <= S ) break } q = K * m ; B . width = q ; B . height = q ; m = B . getContext ( "2d" ) ; o = q / 10 ; m . globalAlpha = 0.2 ; m . strokeStyle = "#000" ; for ( d = 1 ; d < 10 ; d ++ ) { K = Math . round ( o * d ) + 0.5 ; m . moveTo ( K , q ) ; m . lineTo ( K , 0 ) ; m . moveTo ( q , K ) ; m . lineTo ( 0 , K ) } m . stroke ( ) ;
m . beginPath ( ) ; m . globalAlpha = 0.5 ; m . moveTo ( 0.5 , q ) ; m . lineTo ( 0.5 , 0 ) ; m . moveTo ( q , 0.5 ) ; m . lineTo ( 0 , 0.5 ) ; m . stroke ( ) ; B = B . toDataURL ( "image/png" ) ; f . setAttribute ( "width" , q ) ; f . setAttribute ( "height" , q ) ; f . parentNode . setAttribute ( "width" , q ) ; f . parentNode . setAttribute ( "height" , q ) ; svgCanvas . setHref ( f , B ) } if ( ! document . getElementById ( "canvasGrid" ) ) { var g = document . getElementById ( "svgcanvas" ) . ownerDocument , c = false ; a = a . assignAttributes ; var n = document . createElement ( "canvas" ) ; $ ( n ) . hide ( ) . appendTo ( "body" ) ; var s = g . createElementNS ( "http://www.w3.org/2000/svg" ,
2012-07-24 12:42:34 +00:00
"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%" ,
2012-07-25 06:32:18 +00:00
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 && p ( 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" ) ; p ( svgCanvas . getZoom ( ) ) } } } } ] } } ) ; svgEditor . addExtension ( "shapes" , function ( ) { function a ( ) { $ ( "#shape_buttons" ) . empty ( ) ; $ ( "#shape_buttons" ) . append ( K . buttons ) } function p ( M ) { var J = o [ M ] ; if ( J ) { K = J ; J . buttons . length || g ( M , J ) ; a ( ) } else { $ ( "#shape_buttons" ) . html ( "Loading..." ) ; $ . getJSON ( "extensions/shapelib/" + M + ".json" , function ( Q ) { K = o [ M ] = { data : Q . data , size : Q . size , fill : Q . fill } ; g ( M , Q ) ; a ( ) } ) } } function g ( M , J ) { var Q = K . size || 300 , Y = K . fill || false , P = Q * 0.05 ; P = [ - P , - P , Q + P * 2 , Q + P * 2 ] . join ( " " ) ; Q = Y ? 0 : Q / 30 ; Q = ( new DOMParser ) . parseFromString ( '<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="' +
P + '"><path fill="#333" stroke="transparent" stroke-width="' + Q + '" /></svg></svg>' , "text/xml" ) ; Q . documentElement . setAttribute ( "width" , 40 ) ; Q . documentElement . setAttribute ( "height" , 40 ) ; Y = $ ( document . importNode ( Q . documentElement , true ) ) ; var ia = J . data ; K . buttons = [ ] ; for ( var qa in ia ) { var ga = ia [ qa ] , U = Y . clone ( ) ; if ( ga . charAt ( ga . length - 1 ) == "x" ) { Q = 32 ; P = Q * 0.05 ; P = [ - P , - P , Q + P * 2 , Q + P * 2 ] . join ( " " ) ; U . find ( "svg" ) . attr ( "viewBox" , P ) ; ga . replace ( "x" , "" ) } U . find ( "path" ) . attr ( "d" , ga ) ; Q = U . wrap ( '<div class="tool_button">' ) . parent ( ) . attr ( { id : S +
"_" + qa , title : qa } ) ; K . buttons . push ( Q [ 0 ] ) } } var c , n , s = svgEditor . canvas , b , f , d , m = s . getRootElem ( ) , q = { } , 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" } , o = { 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-25 06:32:18 +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 : [ ] } } , K = o . basic , S = "shapelib" ; return { svgicons : "extensions/ext-shapes.xml" , buttons : [ { id : "tool_shapelib" , type : "mode_flyout" , position : 6 , title : "Shape library" , events : { click : function ( ) { s . setMode ( S ) } } } ] , callback : function ( ) { var M = $ ( '<div id="shape_buttons">' ) ;
$ ( "#tools_shapelib > *" ) . wrapAll ( M ) ; var J = $ ( "#tools_shapelib_show" ) ; p ( "basic" ) ; $ ( "#shape_buttons" ) . mouseup ( function ( Y ) { Y = $ ( Y . target ) . closest ( "div.tool_button" ) ; if ( Y . length ) { var P = Y . children ( ) . clone ( ) . attr ( { width : 24 , height : 24 } ) ; J . children ( ":not(.flyout_arrow_horiz)" ) . remove ( ) ; J . append ( P ) . attr ( "data-curopt" , "#" + Y [ 0 ] . id ) . mouseup ( ) ; s . setMode ( S ) ; n = Y [ 0 ] . id . substr ( ( S + "_" ) . length ) ; c = K . data [ n ] ; $ ( ".tools_flyout" ) . fadeOut ( ) } } ) ; M = $ ( '<div id="shape_cats">' ) ; var Q = "" ; $ . each ( B , function ( Y , P ) { Q += "<div data-cat=" +
Y + ">" + P + "</div>" } ) ; M . html ( Q ) . children ( ) . bind ( "mouseup" , function ( ) { var Y = $ ( this ) ; Y . siblings ( ) . removeClass ( "current" ) ; Y . addClass ( "current" ) ; p ( Y . attr ( "data-cat" ) ) ; return false } ) ; M . children ( ) . eq ( 0 ) . addClass ( "current" ) ; $ ( "#tools_shapelib" ) . prepend ( M ) ; J . mouseup ( function ( ) { s . setMode ( c ? S : "select" ) } ) ; $ ( "#tool_shapelib" ) . remove ( ) ; M = $ ( "#tools_shapelib" ) . height ( ) ; $ ( "#tools_shapelib" ) . css ( { "margin-top" : - ( M / 2 ) , "margin-left" : 3 } ) } , mouseDown : function ( M ) { if ( s . getMode ( ) === S ) { var J = f = M . start _x ; M = d = M . start _y ; var Q = s . getStyle ( ) ;
b = s . addSvgElementFromJson ( { element : "path" , curStyles : true , attr : { d : c , id : s . getNextId ( ) , opacity : Q . opacity / 2 , style : "pointer-events:none" } } ) ; b . setAttribute ( "d" , c ) ; if ( /[a-z]/ . test ( c ) ) { c = K . data [ n ] = s . pathActions . convertPath ( b ) ; b . setAttribute ( "d" , c ) ; s . pathActions . fixEnd ( b ) } b . setAttribute ( "transform" , "translate(" + J + "," + M + ") scale(0.005) translate(" + - J + "," + - M + ")" ) ; s . recalculateDimensions ( b ) ; s . getTransformList ( b ) ; q = b . getBBox ( ) ; totalScale = { sx : 1 , sy : 1 } ; return { started : true } } } , mouseMove : function ( M ) { if ( s . getMode ( ) ===
S ) { var J = s . getZoom ( ) , Q = M . event , Y = M . mouse _x / J , P = M . mouse _y / J ; M = s . getTransformList ( b ) ; var ia = b . getBBox ( ) ; J = ia . x ; var qa = ia . y , ga = ia . width , U = ia . height , ba = Y - f , xa = P - d , ka = { x : Math . min ( f , Y ) , y : Math . min ( d , P ) , width : Math . abs ( Y - f ) , height : Math . abs ( P - d ) } , da = ia = 0 ; U = U ? ( U + xa ) / U : 1 ; ga = ga ? ( ga + ba ) / ga : 1 ; ga = ka . width / q . width ; U = ka . height / q . height ; ga = ga || 1 ; U = U || 1 ; if ( Y < f ) ia = q . width ; if ( P < d ) da = q . height ; Y = m . createSVGTransform ( ) ; P = m . createSVGTransform ( ) ; ka = m . createSVGTransform ( ) ; Y . setTranslate ( - ( J + ia ) , - ( qa + da ) ) ; if ( Q . shiftKey ) { replaced =
true ; Q = Math . min ( Math . abs ( ga ) , Math . abs ( U ) ) ; ga = Q * ( ga < 0 ? - 1 : 1 ) ; U = Q * ( U < 0 ? - 1 : 1 ) ; if ( totalScale . sx != totalScale . sy ) { Q = totalScale . sx > totalScale . sy ? 1 : totalScale . sx / totalScale . sy ; ba = totalScale . sy > totalScale . sx ? 1 : totalScale . sy / totalScale . sx ; ga *= ba ; U *= Q ; console . log ( Q , ba ) } } totalScale . sx *= ga ; totalScale . sy *= U ; P . setScale ( ga , U ) ; ka . setTranslate ( J + ia , qa + da ) ; M . appendItem ( ka ) ; M . appendItem ( P ) ; M . appendItem ( Y ) ; s . recalculateDimensions ( b ) ; q = b . getBBox ( ) } } , mouseUp : function ( M ) { if ( s . getMode ( ) === S ) { if ( M . mouse _x == f && M . 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 , p = [ "ms" , "moz" , "webkit" , "o" ] , g = 0 ; g < p . length && ! window . requestAnimationFrame ; ++ g ) { window . requestAnimationFrame = window [ p [ g ] + "RequestAnimationFrame" ] ; window . cancelAnimationFrame = window [ p [ g ] + "CancelAnimationFrame" ] || window [ p [ g ] + "CancelRequestAnimationFrame" ] } if ( ! window . requestAnimationFrame ) window . requestAnimationFrame = function ( c ) { var n = ( new Date ) . getTime ( ) , s = Math . max ( 0 , 16 - ( n - a ) ) , b = window . setTimeout ( function ( ) { c ( n + s ) } , s ) ; a = n + s ; return b } ; if ( ! window . cancelAnimationFrame ) window . cancelAnimationFrame =
function ( c ) { clearTimeout ( c ) } } ) ( ) ; ( function ( a ) { function p ( o ) { var K = o . originalEvent ; if ( ! K . touches || K . targetTouches . length === 1 && K . touches . length === 1 ) { b . call ( this , o ) ; o = a ( this ) ; o . bind ( q , g ) ; o . bind ( m , c ) } else { clearTimeout ( B ) ; s . call ( this ) } } function g ( o ) { if ( B != null ) { var K = o . originalEvent ; o = K . changedTouches ? K . changedTouches [ 0 ] . pageX : K . pageX ; K = K . changedTouches ? K . changedTouches [ 0 ] . pageY : K . pageY ; var S = a ( this ) . data ( "taphold.point" ) ; o = o - S . x ; K = K - S . y ; if ( Math . sqrt ( o * o + K * K ) > d ) { clearTimeout ( B ) ; s . call ( this ) } } } function c ( ) { clearTimeout ( B ) ; s . call ( this ) }
function n ( o ) { s . call ( this ) ; a ( this ) . data ( "taphold.handler" ) . call ( this , o ) } function s ( ) { B = null ; a ( this ) . unbind ( q , g ) ; a ( this ) . unbind ( m , c ) } function b ( o ) { if ( B == null ) { var K = this ; B = setTimeout ( function ( ) { n . call ( K , o ) } , f ) ; var S = o . originalEvent , M = { } ; M . x = S . changedTouches ? S . changedTouches [ 0 ] . pageX : S . pageX ; M . y = S . changedTouches ? S . changedTouches [ 0 ] . pageY : S . pageY ; a ( this ) . data ( "taphold.point" , M ) } } var f = 1E3 , d = 5 , m = "touchend" , q = "touchmove" , B = null ; a . event . special . taphold = { setup : function ( ) { } , add : function ( o ) { a ( this ) . data ( "taphold.handler" ,
o . handler ) ; o . data ? a ( this ) . bind ( "touchstart" , o . data , p ) : a ( this ) . bind ( "touchstart" , p ) } , remove : function ( o ) { clearTimeout ( B ) ; s . call ( this ) ; o . data ? a ( this ) . unbind ( "touchstart" , o . data , p ) : a ( this ) . unbind ( "touchstart" , p ) } , teardown : function ( ) { } } } ) ( jQuery ) ;