2013-06-26 22:42:24 -04:00
/ * !
2013-11-26 11:33:56 -05:00
* Paper . js v0 . 9.13 - The Swiss Army Knife of Vector Graphics Scripting .
2013-06-26 22:42:24 -04:00
* http : //paperjs.org/
*
* Copyright ( c ) 2011 - 2013 , Juerg Lehni & Jonathan Puckey
* http : //lehni.org/ & http://jonathanpuckey.com/
*
* Distributed under the MIT license . See LICENSE file for details .
*
* All rights reserved .
*
2013-11-26 11:33:56 -05:00
* Date : Tue Nov 26 17 : 33 : 03 2013 + 0100
2013-06-26 22:42:24 -04:00
*
* * *
*
* straps . js - Class inheritance library with support for bean - style accessors
*
* Copyright ( c ) 2006 - 2013 Juerg Lehni
* http : //lehni.org/
*
* Distributed under the MIT license .
*
* * *
*
* acorn . js
* http : //marijnhaverbeke.nl/acorn/
*
* Acorn is a tiny , fast JavaScript parser written in JavaScript ,
* created by Marijn Haverbeke and released under an MIT license .
*
* /
2013-11-26 11:33:56 -05:00
var paper = new function ( t ) { var e = new function ( ) { function i ( e , i , n , r , a , o ) { function u ( r , s , o , u ) { var s = s || ( s = _ ( i , r ) ) && ( s . get ? s : s . value ) ; "string" == typeof s && "#" === s [ 0 ] && ( s = e [ s . substring ( 1 ) ] || s ) ; var c , d = "function" == typeof s , f = s , v = a || d ? s && s . get ? r in e : e [ r ] : null ; ! ( o || s !== t && i . hasOwnProperty ( r ) ) || a && v || ( d && v && ( s . base = v ) , d && l && 0 === s . length && ( c = r . match ( /^(get|is)(([A-Z])(.*))$/ ) ) && l . push ( [ c [ 3 ] . toLowerCase ( ) + c [ 4 ] , c [ 2 ] ] ) , f && ! d && f . get && "function" == typeof f . get && 0 === f . get . length || ( f = { value : f , writable : ! 0 } ) , ( _ ( e , r ) || { configurable : ! 0 } ) . configurable && ( f . configurable = ! 0 , f . enumerable = n ) , g ( e , r , f ) ) , ! u || ! d || a && u [ r ] || ( u [ r ] = function ( t ) { return t && e [ r ] . apply ( t , h . call ( arguments , 1 ) ) } ) } var l ; if ( i ) { l = [ ] ; for ( var c in i ) i . hasOwnProperty ( c ) && ! s . test ( c ) && u ( c , null , ! 0 , o ) ; u ( "toString" ) , u ( "valueOf" ) ; for ( var d = 0 , f = l . length ; f > d ; d ++ ) { var v = l [ d ] , m = v [ 1 ] ; u ( v [ 0 ] , { get : e [ "get" + m ] || e [ "is" + m ] , set : e [ "set" + m ] } , ! 0 ) } } return e } function n ( i , n , r , s ) { try { i && ( s || t === s && c ( i ) ? u : l ) . call ( i , n , r = r || i ) } catch ( a ) { if ( a !== e . stop ) throw a } return r } function r ( t ) { return n ( t , function ( t , e ) { this [ e ] = t } , new t . constructor ) } var s = /^(statics|generics|preserve|enumerable|prototype|toString|valueOf)$/ , a = Object . prototype . toString , o = Array . prototype , h = o . slice , u = o . forEach || function ( t , e ) { for ( var i = 0 , n = this . length ; n > i ; i ++ ) t . call ( e , this [ i ] , i , this ) } , l = function ( t , e ) { for ( var i in this ) this . hasOwnProperty ( i ) && t . call ( e , this [ i ] , i , this ) } , c = Array . isArray = Array . isArray || function ( t ) { return "[object Array]" === a . call ( t ) } , d = Object . create || function ( t ) { return { _ _proto _ _ : t } } , _ = Object . getOwnPropertyDescriptor || function ( t , e ) { var i = t . _ _lookupGetter _ _ && t . _ _lookupGetter _ _ ( e ) ; return i ? { get : i , set : t . _ _lookupSetter _ _ ( e ) , enumerable : ! 0 , configurable : ! 0 } : t . hasOwnProperty ( e ) ? { value : t [ e ] , enumerable : ! 0 , configurable : ! 0 , writable : ! 0 } : null } , f = Object . defineProperty || function ( t , e , i ) { return ( i . get || i . set ) && t . _ _defineGetter _ _ ? ( i . get && t . _ _defineGetter _ _ ( e , i . get ) , i . set && t . _ _defineSetter _ _ ( e , i . set ) ) : t [ e ] = i . value , t } , g = function ( t , e , i ) { return delete t [ e ] , f ( t , e , i ) } ; return i ( function ( ) { } , { inject : function ( t ) { if ( t ) { var e = this . prototype , n = Object . getPrototypeOf ( e ) . constructor , r = t . statics === ! 0 ? t : t . statics ; r != t && i ( e , t , t . enumerable , n && n . prototype , t . preserve , t . generics && this ) , i ( this , r , ! 0 , n , t . preserve ) } for ( var s = 1 , a = arguments . length ; a > s ; s ++ ) this . inject ( arguments [ s ] ) ; return this } , extend : function ( ) { for ( var t , e = this , n = 0 , r = arguments . length ; r > n && ! ( t = arguments [ n ] . initialize ) ; n ++ ) ; return t = t || function ( ) { e . apply ( this , arguments ) } , t . prototype = d ( this . prototype ) , g ( t . prototype , "constructor" , { value : t , writable : ! 0 , configurable : ! 0 } ) , i ( t , this , ! 0 ) , arguments . length ? this . inject . apply ( t , arguments ) : t } } , ! 0 ) . inject ( { inject : function ( ) { for ( var t = 0 , e = arguments . length ; e > t ; t ++ ) i ( this , arguments [ t ] , arguments [ t ] . enumerable ) ; return this } , extend : function ( ) { var t = d ( this ) ; return t . inject . apply ( t , arguments ) } , each : function ( t , e ) { return n ( this , t , e ) } , clone : function ( ) { return r ( this ) } , statics : { each : n , clone : r , create : d , define : g , describe : _ , isPlainObject : function ( t ) { var i = null != t && t . constructor ; return i && ( i === Object || i === e || "Object" === i . name ) } , pick : function ( ) { for ( var e = 0 , i = arguments . length ; i > e ; e ++ ) if ( arguments [ e ] !== t ) return arguments [ e ] ; return null } , stop : { } } } ) } ; "undefined" != typeof module && ( module . exports = e ) , e . inject ( { generics : ! 0 , clone : function ( ) { return new this . constructor ( this ) } , toString : function ( ) { return null != this . _id ? ( this . _class || "Object" ) + ( this . _name ? " '" + this . _name + "'" : " @" + this . _id ) : "{ " + e . each ( this , function ( t , e ) { if ( ! /^_/ . test ( e ) ) { var i = typeof t ; this . push ( e + ": " + ( "number" === i ? a . instance . number ( t ) : "string" === i ? "'" + t + "'" : t ) ) } } , [ ] ) . join ( ", " ) + " }" } , exportJSON : function ( t ) { return e . exportJSON ( this , t ) } , toJSON : function ( ) { return e . serialize ( this ) } , _set : function ( i , n ) { if ( i && e . isPlainObject ( i ) ) { var r = i . _filtering || i ; for ( var s in r ) if ( s in this && r . hasOwnProperty ( s ) && ( ! n || ! n [ s ] ) ) { var a = i [ s ] ; a !== t && ( this [ s ] = a ) } return ! 0 } } , statics : { exports : { } , extend : function ie ( ) { var t = ie . base . apply ( this , arguments ) , i = t . prototype . _class ; return i && ! e . exports [ i ] && ( e . exports [ i ] = t ) , t } , equals : function ( t , i ) { function n ( t , e ) { for ( var i in t ) if ( t . hasOwnProperty ( i ) && ! e . hasOwnProperty ( i ) ) return ! 1 ; return ! 0 } if ( t === i ) return ! 0 ; if ( t && t . equals ) return t . equals ( i )
} , decompose : function ( ) { var t = this . _a , e = this . _b , i = this . _c , n = this . _d ; if ( o . isZero ( t * n - e * i ) ) return null ; var r = Math . sqrt ( t * t + e * e ) ; t /= r , e /= r ; var s = t * i + e * n ; i -= t * s , n -= e * s ; var a = Math . sqrt ( i * i + n * n ) ; return i /= a , n /= a , s /= a , e * i > t * n && ( t = - t , e = - e , s = - s , r = - r ) , { translation : this . getTranslation ( ) , scaling : new h ( r , a ) , rotation : 180 * - Math . atan2 ( e , t ) / Math . PI , shearing : s } } , getValues : function ( ) { return [ this . _a , this . _c , this . _b , this . _d , this . _tx , this . _ty ] } , getTranslation : function ( ) { return new h ( this . _tx , this . _ty ) } , getScaling : function ( ) { return ( this . decompose ( ) || { } ) . scaling } , getRotation : function ( ) { return ( this . decompose ( ) || { } ) . rotation } , inverted : function ( ) { var t = this . _getDeterminant ( ) ; return t && new g ( this . _d / t , - this . _c / t , - this . _b / t , this . _a / t , ( this . _b * this . _ty - this . _d * this . _tx ) / t , ( this . _c * this . _tx - this . _a * this . _ty ) / t ) } , shiftless : function ( ) { return new g ( this . _a , this . _c , this . _b , this . _d , 0 , 0 ) } , applyToContext : function ( t ) { t . transform ( this . _a , this . _c , this . _b , this . _d , this . _tx , this . _ty ) } } , new function ( ) { return e . each ( { scaleX : "_a" , scaleY : "_d" , translateX : "_tx" , translateY : "_ty" , shearX : "_b" , shearY : "_c" } , function ( t , i ) { i = e . capitalize ( i ) , this [ "get" + i ] = function ( ) { return this [ t ] } , this [ "set" + i ] = function ( e ) { this [ t ] = e } } , { } ) } ) , v = e . extend ( { _class : "Line" , initialize : function ( t , e , i , n , r ) { var s = ! 1 ; arguments . length >= 4 ? ( this . _px = t , this . _py = e , this . _vx = i , this . _vy = n , s = r ) : ( this . _px = t . x , this . _py = t . y , this . _vx = e . x , this . _vy = e . y , s = i ) , s || ( this . _vx -= this . _px , this . _vy -= this . _py ) } , getPoint : function ( ) { return new h ( this . _px , this . _py ) } , getVector : function ( ) { return new h ( this . _vx , this . _vy ) } , getLength : function ( ) { return this . getVector ( ) . getLength ( ) } , intersect : function ( t , e ) { return v . intersect ( this . _px , this . _py , this . _vx , this . _vy , t . _px , t . _py , t . _vx , t . _vy , ! 0 , e ) } , getSide : function ( t ) { return v . getSide ( this . _px , this . _py , this . _vx , this . _vy , t . x , t . y , ! 0 ) } , getDistance : function ( t ) { return Math . abs ( v . getSignedDistance ( this . _px , this . _py , this . _vx , this . _vy , t . x , t . y , ! 0 ) ) } , statics : { intersect : function ( t , e , i , n , r , s , a , u , l , c ) { l || ( i -= t , n -= e , a -= r , u -= s ) ; var d = u * i - a * n ; if ( ! o . isZero ( d ) ) { var _ = t - r , f = e - s , g = ( a * f - u * _ ) / d , v = ( i * f - n * _ ) / d ; if ( ( c || g >= 0 && 1 >= g ) && ( c || v >= 0 && 1 >= v ) ) return new h ( t + g * i , e + g * n ) } } , getSide : function ( t , e , i , n , r , s , a ) { a || ( i -= t , n -= e ) ; var o = r - t , h = s - e , u = o * n - h * i ; return 0 === u && ( u = o * i + h * n , u > 0 && ( o -= i , h -= n , u = o * i + h * n , 0 > u && ( u = 0 ) ) ) , 0 > u ? - 1 : u > 0 ? 1 : 0 } , getSignedDistance : function ( t , e , i , n , r , s , a ) { a || ( i -= t , n -= e ) ; var o = n / i , h = e - o * t ; return ( s - o * r - h ) / Math . sqrt ( o * o + 1 ) } } } ) , m = s . extend ( { _class : "Project" , _list : "projects" , _reference : "project" , initialize : function ( t ) { s . call ( this , ! 0 ) , this . layers = [ ] , this . symbols = [ ] , this . _currentStyle = new E , this . activeLayer = new x , t && ( this . view = t instanceof Z ? t : Z . create ( t ) ) , this . _selectedItems = { } , this . _selectedItemCount = 0 , this . _drawCount = 0 , this . options = { } } , _serialize : function ( t , i ) { return e . serialize ( this . layers , t , ! 0 , i ) } , clear : function ( ) { for ( var t = this . layers . length - 1 ; t >= 0 ; t -- ) this . layers [ t ] . remove ( ) ; this . symbols = [ ] } , isEmpty : function ( ) { return this . layers . length <= 1 && ( ! this . activeLayer || this . activeLayer . isEmpty ( ) ) } , remove : function ae ( ) { return ae . base . call ( this ) ? ( this . view && this . view . remove ( ) , ! 0 ) : ! 1 } , getCurrentStyle : function ( ) { return this . _currentStyle } , setCurrentStyle : function ( t ) { this . _currentStyle . initialize ( t ) } , getIndex : function ( ) { return this . _index } , addChild : function ( t ) { return t instanceof x ? ( e . splice ( this . layers , [ t ] ) , this . activeLayer || ( this . activeLayer = t ) ) : t instanceof y ? ( this . activeLayer || this . addChild ( new x ( { insert : ! 1 } ) ) ) . addChild ( t ) : t = null , t } , getSelectedItems : function ( ) { var t = [ ] ; for ( var e in this . _selectedItems ) { var i = this . _selectedItems [ e ] ; i . isInserted ( ) && t . push ( i ) } return t } , _updateSelection : function ( t ) { var e = t . _id , i = this . _selectedItems ; t . _selected ? i [ e ] !== t && ( this . _selectedItemCount ++ , i [ e ] = t ) : i [ e ] === t && ( this . _selectedItemCount -- , delete i [ e ] ) } , selectAll : function ( ) { for ( var t = this . layers , e = 0 , i = t . length ; i > e ; e ++ ) t [ e ] . setFullySelected ( ! 0 ) } , deselectAll : function ( ) { var t = this . _selectedItems ; for ( var e in t ) t [ e ] . setFullySelected ( ! 1 ) } , hitTest : function ( t , i ) { t = h . read ( arguments ) , i = P . getOptions ( e . read ( arguments ) ) ; for ( var n = this . layers . length - 1 ; n >= 0 ; n -- ) { var r = this . layers [ n ] . hitTest ( t , i ) ; if ( r ) return r } return null } } , new function ( ) { function t ( t , e , i ) { fo
t && ( paper = t . _scope ) , i . fire ( "load" ) , t && t . draw ( ! 0 ) } var i = this , n = document . getElementById ( t ) || new Image ; n . naturalWidth && n . naturalHeight ? setTimeout ( e , 0 ) : ( V . add ( n , { load : function ( ) { i . setImage ( n ) , e ( ) } } ) , n . src || ( n . src = t ) ) , this . setImage ( n ) } , getElement : function ( ) { return this . _canvas || this . _image } , getSubCanvas : function ( t ) { t = _ . read ( arguments ) ; var e = K . getContext ( t . getSize ( ) ) ; return e . drawImage ( this . getCanvas ( ) , t . x , t . y , t . width , t . height , 0 , 0 , t . width , t . height ) , e . canvas } , getSubRaster : function ( t ) { t = _ . read ( arguments ) ; var e = new C ( { canvas : this . getSubCanvas ( t ) , insert : ! 1 } ) ; return e . translate ( t . getCenter ( ) . subtract ( this . getSize ( ) . divide ( 2 ) ) ) , e . _matrix . preConcatenate ( this . _matrix ) , e . insertAbove ( this ) , e } , toDataURL : function ( ) { var t = this . _image && this . _image . src ; if ( /^data:/ . test ( t ) ) return t ; var e = this . getCanvas ( ) ; return e ? e . toDataURL ( ) : null } , drawImage : function ( t , e ) { e = h . read ( arguments , 1 ) , this . getContext ( ! 0 ) . drawImage ( t , e . x , e . y ) } , getAverageColor : function ( t ) { var i , n ; t ? t instanceof A ? ( n = t , i = t . getBounds ( ) ) : t . width ? i = new _ ( t ) : t . x && ( i = new _ ( t . x - . 5 , t . y - . 5 , 1 , 1 ) ) : i = this . getBounds ( ) ; var r = 32 , s = Math . min ( i . width , r ) , a = Math . min ( i . height , r ) , o = C . _sampleContext ; o ? o . clearRect ( 0 , 0 , r + 1 , r + 1 ) : o = C . _sampleContext = K . getContext ( new c ( r ) ) , o . save ( ) ; var h = ( new g ) . scale ( s / i . width , a / i . height ) . translate ( - i . x , - i . y ) ; h . applyToContext ( o ) , n && n . draw ( o , e . merge ( { clip : ! 0 , transforms : [ h ] } ) ) , this . _matrix . applyToContext ( o ) , o . drawImage ( this . getElement ( ) , - this . _size . width / 2 , - this . _size . height / 2 ) , o . restore ( ) ; for ( var u = o . getImageData ( . 5 , . 5 , Math . ceil ( s ) , Math . ceil ( a ) ) . data , l = [ 0 , 0 , 0 ] , d = 0 , f = 0 , v = u . length ; v > f ; f += 4 ) { var m = u [ f + 3 ] ; d += m , m /= 255 , l [ 0 ] += u [ f ] * m , l [ 1 ] += u [ f + 1 ] * m , l [ 2 ] += u [ f + 2 ] * m } for ( var f = 0 ; 3 > f ; f ++ ) l [ f ] /= d ; return d ? N . read ( l ) : null } , getPixel : function ( t ) { t = h . read ( arguments ) ; var e = this . getContext ( ) . getImageData ( t . x , t . y , 1 , 1 ) . data ; return new N ( "rgb" , [ e [ 0 ] / 255 , e [ 1 ] / 255 , e [ 2 ] / 255 ] , e [ 3 ] / 255 ) } , setPixel : function ( ) { var t = h . read ( arguments ) , e = N . read ( arguments ) , i = e . _convert ( "rgb" ) , n = e . _alpha , r = this . getContext ( ! 0 ) , s = r . createImageData ( 1 , 1 ) , a = s . data ; a [ 0 ] = 255 * i [ 0 ] , a [ 1 ] = 255 * i [ 1 ] , a [ 2 ] = 255 * i [ 2 ] , a [ 3 ] = null != n ? 255 * n : 255 , r . putImageData ( s , t . x , t . y ) } , createImageData : function ( t ) { return t = c . read ( arguments ) , this . getContext ( ) . createImageData ( t . width , t . height ) } , getImageData : function ( t ) { return t = _ . read ( arguments ) , t . isEmpty ( ) && ( t = new _ ( this . _size ) ) , this . getContext ( ) . getImageData ( t . x , t . y , t . width , t . height ) } , setImageData : function ( t , e ) { e = h . read ( arguments , 1 ) , this . getContext ( ! 0 ) . putImageData ( t , e . x , e . y ) } , _getBounds : function ( t , e ) { var i = new _ ( this . _size ) . setCenter ( 0 , 0 ) ; return e ? e . _transformBounds ( i ) : i } , _hitTest : function ( t ) { if ( this . _contains ( t ) ) { var e = this ; return new P ( "pixel" , e , { offset : t . add ( e . _size . divide ( 2 ) ) . round ( ) , color : { get : function ( ) { return e . getPixel ( this . offset ) } } } ) } } , _draw : function ( t ) { var e = this . getElement ( ) ; e && ( t . globalAlpha = this . _opacity , t . drawImage ( e , - this . _size . width / 2 , - this . _size . height / 2 ) ) } , _canComposite : function ( ) { return ! 0 } } ) , S = y . extend ( { _class : "PlacedSymbol" , _transformContent : ! 1 , _boundsGetter : { getBounds : "getStrokeBounds" } , _boundsSelected : ! 0 , _serializeFields : { symbol : null } , initialize : function ( e , i ) { this . _initialize ( e , i !== t && h . read ( arguments , 1 ) ) || this . setSymbol ( e instanceof p ? e : new p ( e ) ) } , _equals : function ( t ) { return this . _symbol === t . _symbol } , getSymbol : function ( ) { return this . _symbol } , setSymbol : function ( t ) { this . _symbol && delete this . _symbol . _instances [ this . _id ] , this . _symbol = t , t . _instances [ this . _id ] = this } , clone : function ( t ) { return this . _clone ( new S ( { symbol : this . symbol , insert : ! 1 } ) , t ) } , isEmpty : function ( ) { return this . _symbol . _definition . isEmpty ( ) } , _getBounds : function ( t , e ) { return this . symbol . _definition . _getCachedBounds ( t , e ) } , _hitTest : function ( t , e , i ) { var n = this . _symbol . _definition . _hitTest ( t , e , i ) ; return n && ( n . item = this ) , n } , _draw : function ( t , e ) { this . symbol . _definition . draw ( t , e ) } } ) , P = e . extend ( { _class : "HitResult" , initialize : function ( t , e , i ) { this . type = t , this . item = e , i && ( i . enumerable = ! 0 , this . inject ( i ) ) } , statics : { getOptions : function ( t ) { return t && t . _merged ? t : e . merge ( { type : null , tolerance : paper . project . options . hitTolerance || 2 , fill : ! t , stroke : ! t , segments : ! t , handles : ! 1 , ends : ! 1 , center : ! 1 , bounds : ! 1 , guides : ! 1 , selected : ! 1 , _merged : ! 0 } , t ) } } } ) , z = e . extend ( { _class : " Se
var s = i [ e ] ; return n + s . getLength ( 0 , t . getParameter ( ) ) } return null } , getLocationOf : function ( t ) { t = h . read ( arguments ) ; for ( var e = this . getCurves ( ) , i = 0 , n = e . length ; n > i ; i ++ ) { var r = e [ i ] . getLocationOf ( t ) ; if ( r ) return r } return null } , getLocationAt : function ( t , e ) { var i = this . getCurves ( ) , n = 0 ; if ( e ) { var r = ~ ~ t ; return i [ r ] . getLocationAt ( t - r , ! 0 ) } for ( var s = 0 , a = i . length ; a > s ; s ++ ) { var o = n , h = i [ s ] ; if ( n += h . getLength ( ) , n >= t ) return h . getLocationAt ( t - o ) } return t <= this . getLength ( ) ? new k ( i [ i . length - 1 ] , 1 ) : null } , getPointAt : function ( t , e ) { var i = this . getLocationAt ( t , e ) ; return i && i . getPoint ( ) } , getTangentAt : function ( t , e ) { var i = this . getLocationAt ( t , e ) ; return i && i . getTangent ( ) } , getNormalAt : function ( t , e ) { var i = this . getLocationAt ( t , e ) ; return i && i . getNormal ( ) } , getNearestLocation : function ( t ) { t = h . read ( arguments ) ; for ( var e = this . getCurves ( ) , i = 1 / 0 , n = null , r = 0 , s = e . length ; s > r ; r ++ ) { var a = e [ r ] . getNearestLocation ( t ) ; a . _distance < i && ( i = a . _distance , n = a ) } return n } , getNearestPoint : function ( t ) { return t = h . read ( arguments ) , this . getNearestLocation ( t ) . getPoint ( ) } , getStyle : function ( ) { var t = this . _parent ; return ( t && "compound-path" === t . _type ? t : this ) . _style } , toShape : function ( e ) { function i ( t , e ) { return d [ t ] . isColinear ( d [ e ] ) } function n ( t ) { return d [ t ] . isOrthogonal ( ) } function r ( t ) { return d [ t ] . isArc ( ) } function s ( t , e ) { return d [ t ] . _point . getDistance ( d [ e ] . _point ) } if ( ! this . _closed ) return null ; var a , h , u , l , d = this . _segments ; if ( this . isPolygon ( ) && 4 === d . length && i ( 0 , 2 ) && i ( 1 , 3 ) && n ( 1 ) ? ( a = b . Rectangle , h = new c ( s ( 0 , 3 ) , s ( 0 , 1 ) ) , l = d [ 1 ] . _point . add ( d [ 2 ] . _point ) . divide ( 2 ) ) : 8 === d . length && r ( 0 ) && r ( 2 ) && r ( 4 ) && r ( 6 ) && i ( 1 , 5 ) && i ( 3 , 7 ) ? ( a = b . Rectangle , h = new c ( s ( 1 , 6 ) , s ( 0 , 3 ) ) , u = h . subtract ( new c ( s ( 0 , 7 ) , s ( 1 , 2 ) ) ) . divide ( 2 ) , l = d [ 3 ] . _point . add ( d [ 4 ] . _point ) . divide ( 2 ) ) : 4 === d . length && r ( 0 ) && r ( 1 ) && r ( 2 ) && r ( 3 ) && ( o . isZero ( s ( 0 , 2 ) - s ( 1 , 3 ) ) ? ( a = b . Circle , u = s ( 0 , 2 ) / 2 ) : ( a = b . Ellipse , u = new c ( s ( 2 , 0 ) / 2 , s ( 3 , 1 ) / 2 ) ) , l = d [ 1 ] . _point ) , a ) { var _ = this . getPosition ( ! 0 ) , f = new a ( { center : _ , size : h , radius : u , insert : ! 1 } ) ; return f . rotate ( l . subtract ( _ ) . getAngle ( ) + 90 ) , f . setStyle ( this . _style ) , ( e || e === t ) && f . insertAbove ( this ) , f } return null } , _getWinding : function ( t ) { var e = this . _closed ; if ( ! e && ! this . hasFill ( ) || ! this . _getBounds ( "getRoughBounds" ) . _containsPoint ( t ) ) return 0 ; for ( var i = this . getCurves ( ) , n = this . _segments , r = 0 , s = [ ] , a = [ ] , o = ( e ? i [ i . length - 1 ] : new I ( n [ n . length - 1 ] . _point , n [ 0 ] . _point ) ) . getValues ( ) , h = 0 , u = i . length ; u > h ; h ++ ) { var l = i [ h ] . getValues ( ) , c = l [ 0 ] , d = l [ 1 ] ; ( c !== l [ 2 ] || d !== l [ 3 ] || c !== l [ 4 ] || d !== l [ 5 ] || c !== l [ 6 ] || d !== l [ 7 ] ) && ( r += I . _getWinding ( l , t . x , t . y , s , a ) ) } return e || ( r += I . _getWinding ( o , t . x , t . y , s , a ) ) , r } , _hitTest : function ( e , i ) { function n ( i , n , r ) { return e . getDistance ( n ) < p ? new P ( r , w , { segment : i , point : n } ) : t } function r ( t , e ) { var r = t . _point ; return ( e || i . segments ) && n ( t , r , "segment" ) || ! e && i . handles && ( n ( t , r . add ( t . _handleIn ) , "handle-in" ) || n ( t , r . add ( t . _handleOut ) , "handle-out" ) ) } function s ( t ) { d . push ( t ) } function a ( t ) { var e = d [ t ] , i = d [ ( t + 1 ) % d . length ] ; return [ e . x , e . y , e . x , e . y , i . x , i . y , i . x , i . y ] } function o ( t ) { for ( var e = d . length , i = [ ] , n = [ ] , r = 0 , s = 0 ; e > s ; s ++ ) r += I . _getWinding ( a ( s ) , t . x , t . y , i , n ) ; return ! ! r } function h ( t ) { return ( "round" !== u || "round" !== l ) && ( d = [ ] , m || t . _index > 0 && t . _index < v . length - 1 ? "round" !== u && ( t . _handleIn . isZero ( ) || t . _handleOut . isZero ( ) ) && O . _addSquareJoin ( t , u , y , c , s , ! 0 ) : "round" !== l && O . _addSquareCap ( t , l , y , s , ! 0 ) , d . length > 0 ) ? o ( e ) : e . getDistance ( t . _point ) <= y } var u , l , c , d , _ , f , g = this . getStyle ( ) , v = this . _segments , m = this . _closed , p = i . tolerance , y = 0 , w = this ; if ( i . stroke && ( y = g . getStrokeWidth ( ) / 2 , y > 0 ? ( u = g . getStrokeJoin ( ) , l = g . getStrokeCap ( ) , c = y * g . getMiterLimit ( ) ) : u = l = "round" , y += p ) , ! i . ends || i . segments || m ) { if ( i . segments || i . handles ) for ( var x = 0 , b = v . length ; b > x ; x ++ ) if ( f = r ( v [ x ] ) ) return f } else if ( f = r ( v [ 0 ] , ! 0 ) || r ( v [ v . length - 1 ] , ! 0 ) ) return f ; if ( y > 0 ) { if ( _ = this . getNearestLocation ( e ) ) { var C = _ . getParameter ( ) ; 0 === C || 1 === C ? h ( _ . getSegment ( ) ) || ( _ = null ) : _ . _distance > y && ( _ = null ) } if ( ! _ && "miter" === u ) for ( var x = 0 , b = v . length ; b > x ; x ++ ) { var S = v [ x ] ; if ( e . getDistance ( S . _point ) <= c && h ( S ) ) { _ = S . getLocation ( ) ; break } } } return ! _ && i . fill && this . hasFill ( ) && this . contains ( e ) ? new P ( "fill" , this ) : _ ? new P ( "stroke" , this , { location : _ } ) : null } } , new function ( ) { function t ( t , e , i , n ) { function r ( e ) { var i = a [ e ] , n = a [ e + 1 ] ; ( d != i || _ != n ) && ( t . beginPath ( ) , t . moveTo ( d , _ ) , t . lineTo ( i , n ) , t . stroke ( ) , t . beginPath ( ) ,
} , divide : function ( e , i , n ) { return t ( e / i , n ) } } ; return e . each ( i , function ( t , e ) { var i = { dontParse : /^(multiply|divide)$/ . test ( e ) } ; this [ e ] = function ( e ) { e = N . read ( arguments , 0 , 0 , i ) ; for ( var n = this . _type , r = this . _properties , s = this . _components , a = e . _convert ( n ) , o = 0 , h = s . length ; h > o ; o ++ ) a [ o ] = t ( s [ o ] , a [ o ] , "hue" === r [ o ] ) ; return new N ( n , a , null != this . _alpha ? t ( this . _alpha , e . getAlpha ( ) ) : null ) } } , { } ) } ) ; e . each ( N . _types , function ( t , i ) { var n = this [ e . capitalize ( i ) + "Color" ] = function ( t ) { var e = null != t && typeof t , n = "object" === e && null != t . length ? t : "string" === e ? null : arguments ; return n ? new N ( i , n ) : new N ( t ) } ; if ( 3 == i . length ) { var r = i . toUpperCase ( ) ; N [ r ] = this [ r + "Color" ] = n } } , e . exports ) ; var q = e . extend ( { _class : "Gradient" , initialize : function xe ( t , e ) { this . _id = xe . _id = ( xe . _id || 0 ) + 1 , t && this . _set ( t ) && ( t = e = null ) , this . _stops || this . setStops ( t || [ "white" , "black" ] ) , null == this . _radial && this . setRadial ( "string" == typeof e && "radial" === e || e || ! 1 ) } , _serialize : function ( t , i ) { return i . add ( this , function ( ) { return e . serialize ( [ this . _stops , this . _radial ] , t , ! 0 , i ) } ) } , _changed : function ( ) { for ( var t = 0 , e = this . _owners && this . _owners . length ; e > t ; t ++ ) this . _owners [ t ] . _changed ( ) } , _addOwner : function ( t ) { this . _owners || ( this . _owners = [ ] ) , this . _owners . push ( t ) } , _removeOwner : function ( t ) { var e = this . _owners ? this . _owners . indexOf ( t ) : - 1 ; - 1 != e && ( this . _owners . splice ( e , 1 ) , 0 === this . _owners . length && delete this . _owners ) } , clone : function ( ) { for ( var t = [ ] , e = 0 , i = this . _stops . length ; i > e ; e ++ ) t [ e ] = this . _stops [ e ] . clone ( ) ; return new this . constructor ( t ) } , getStops : function ( ) { return this . _stops } , setStops : function ( t ) { if ( this . stops ) for ( var e = 0 , i = this . _stops . length ; i > e ; e ++ ) delete this . _stops [ e ] . _owner ; if ( t . length < 2 ) throw Error ( "Gradient stop list needs to contain at least two stops." ) ; this . _stops = F . readAll ( t , 0 , ! 1 , ! 0 ) ; for ( var e = 0 , i = this . _stops . length ; i > e ; e ++ ) { var n = this . _stops [ e ] ; n . _owner = this , n . _defaultRamp && n . setRampPoint ( e / ( i - 1 ) ) } this . _changed ( ) } , getRadial : function ( ) { return this . _radial } , setRadial : function ( t ) { this . _radial = t , this . _changed ( ) } , equals : function ( t ) { if ( t === this ) return ! 0 ; if ( t && this . _class === t . _class && this . _stops . length === t . _stops . length ) { for ( var e = 0 , i = this . _stops . length ; i > e ; e ++ ) if ( ! this . _stops [ e ] . equals ( t . _stops [ e ] ) ) return ! 1 ; return ! 0 } return ! 1 } } ) , F = e . extend ( { _class : "GradientStop" , initialize : function ( e , i ) { if ( e ) { var n , r ; i === t && Array . isArray ( e ) ? ( n = e [ 0 ] , r = e [ 1 ] ) : e . color ? ( n = e . color , r = e . rampPoint ) : ( n = e , r = i ) , this . setColor ( n ) , this . setRampPoint ( r ) } } , clone : function ( ) { return new F ( this . _color . clone ( ) , this . _rampPoint ) } , _serialize : function ( t , i ) { return e . serialize ( [ this . _color , this . _rampPoint ] , t , ! 0 , i ) } , _changed : function ( ) { this . _owner && this . _owner . _changed ( 17 ) } , getRampPoint : function ( ) { return this . _rampPoint } , setRampPoint : function ( t ) { this . _defaultRamp = null == t , this . _rampPoint = t || 0 , this . _changed ( ) } , getColor : function ( ) { return this . _color } , setColor : function ( t ) { this . _color = N . read ( arguments ) , this . _color === t && ( this . _color = t . clone ( ) ) , this . _color . _owner = this , this . _changed ( ) } , equals : function ( t ) { return t === this || t && this . _class === t . _class && this . _color . equals ( t . _color ) && this . _rampPoint == t . _rampPoint || ! 1 } } ) , E = e . extend ( new function ( ) { var i = { fillColor : t , strokeColor : t , strokeWidth : 1 , strokeCap : "butt" , strokeJoin : "miter" , miterLimit : 10 , dashOffset : 0 , dashArray : [ ] , windingRule : "nonzero" , shadowColor : t , shadowBlur : 0 , shadowOffset : new h , selectedColor : t , font : "sans-serif" , fontSize : 12 , leading : null , justification : "left" } , n = { strokeWidth : 25 , strokeCap : 25 , strokeJoin : 25 , miterLimit : 25 , font : 5 , fontSize : 5 , leading : 5 , justification : 5 } , r = { } , s = { _defaults : i , _textDefaults : e . merge ( i , { fillColor : new N } ) } ; return e . each ( i , function ( i , a ) { var o = /Color$/ . test ( a ) , h = e . capitalize ( a ) , u = n [ a ] , l = "set" + h , c = "get" + h ; s [ l ] = function ( t ) { var e = this . _item && this . _item . _children ; if ( e && e . length > 0 && "compound-path" !== this . _item . _type ) for ( var i = 0 , n = e . length ; n > i ; i ++ ) e [ i ] . _style [ l ] ( t ) ; else { var r = this . _values [ a ] ; r != t && ( o && ( r && delete r . _owner , t && t . constructor === N && ( t . _owner && ( t = t . clone ( ) ) , t . _owner = this . _item ) ) , this . _values [ a ] = t , this . _item && this . _item . _changed ( u || 17 ) ) } } , s [ c ] = function ( ) { var i , n = this . _item && this . _item . _children ; if ( ! n || 0 === n . length || arguments [ 0 ] || "compound-path" === this . _item . _type ) { var i = this . _values [ a ] ; return i === t ? ( i = this . _defaul
s || ( a . _transformContent = ! 1 , a = x ( a , t , i ) , o . _currentStyle = a . _style . clone ( ) ) ; for ( var l = 0 , c = r . length ; c > l ; l ++ ) { var d , _ = r [ l ] ; 1 !== _ . nodeType || ! ( d = P ( _ , ! 1 , n ) ) || d instanceof p || u . push ( d ) } return a . addChildren ( u ) , s && ( a = x ( a . reduce ( ) , t , i ) ) , o . _currentStyle = h , ( s || "defs" === e ) && ( a . remove ( ) , a = null ) , a } function o ( t , e ) { var i = new O , n = t . points ; i . moveTo ( n . getItem ( 0 ) ) ; for ( var r = 1 , s = n . numberOfItems ; s > r ; r ++ ) i . lineTo ( n . getItem ( r ) ) ; return "polygon" === e && i . closePath ( ) , i } function u ( t ) { var e = t . getAttribute ( "d" ) , i = e . match ( /m/gi ) . length > 1 ? new L : new O ; return i . setPathData ( e ) , i } function l ( t , e ) { for ( var r = t . childNodes , s = [ ] , a = 0 , o = r . length ; o > a ; a ++ ) { var h = r [ a ] ; 1 === h . nodeType && s . push ( x ( new F , h ) ) } var u , l , c , d = "radialgradient" === e , _ = new q ( s , d ) ; return d ? ( u = n ( t , "cx" , "cy" ) , l = u . add ( i ( t , "r" ) , 0 ) , c = n ( t , "fx" , "fy" , ! 0 ) ) : ( u = n ( t , "x1" , "y1" ) , l = n ( t , "x2" , "y2" ) ) , x ( new N ( _ , u , l , c ) , t ) , null } function d ( t , e , i , n ) { for ( var r = ( n . getAttribute ( i ) || "" ) . split ( /\)\s*/g ) , s = new g , a = 0 , o = r . length ; o > a ; a ++ ) { var h = r [ a ] ; if ( ! h ) break ; for ( var u = h . split ( "(" ) , l = u [ 0 ] , c = u [ 1 ] . split ( /[\s,]+/g ) , d = 0 , _ = c . length ; _ > d ; d ++ ) c [ d ] = parseFloat ( c [ d ] ) ; switch ( l ) { case "matrix" : s . concatenate ( new g ( c [ 0 ] , c [ 1 ] , c [ 2 ] , c [ 3 ] , c [ 4 ] , c [ 5 ] ) ) ; break ; case "rotate" : s . rotate ( c [ 0 ] , c [ 1 ] , c [ 2 ] ) ; break ; case "translate" : s . translate ( c [ 0 ] , c [ 1 ] ) ; break ; case "scale" : s . scale ( c ) ; break ; case "skewX" : case "skewY" : var e = Math . tan ( c [ 0 ] * Math . PI / 180 ) , f = "skewX" == l ; s . shear ( f ? e : 0 , f ? 0 : e ) } } t . transform ( s ) } function f ( t , e , i ) { var n = t [ "fill-opacity" === i ? "getFillColor" : "getStrokeColor" ] ( ) ; n && n . setAlpha ( parseFloat ( e ) ) } function v ( i , n , r ) { var s = i . attributes [ n ] , a = s && s . value ; if ( ! a ) { var o = e . camelize ( n ) ; a = i . style [ o ] , a || r . node [ o ] === r . parent [ o ] || ( a = r . node [ o ] ) } return a ? "none" === a ? null : a : t } function x ( i , n , r ) { var s = { node : R . getStyles ( n ) || { } , parent : ! r && R . getStyles ( n . parentNode ) || { } } ; return e . each ( M , function ( r , a ) { var o = v ( n , a , s ) ; o !== t && ( i = e . pick ( r ( i , o , a , n , s ) , i ) ) } ) , i } function S ( t ) { var e = t && t . match ( /\((?:#|)([^)']+)/ ) ; return e && I [ e [ 1 ] ] } function P ( t , e , i ) { function n ( t ) { paper = s ; var n = P ( t , e , i ) , r = i . onLoad , a = s . project && s . project . view ; r && r . call ( this , n ) , a . draw ( ! 0 ) } if ( ! t ) return null ; i ? "function" == typeof i && ( i = { onLoad : i } ) : i = { } ; var r = t , s = paper ; if ( e ) { if ( "string" == typeof t && ! /^.*</ . test ( t ) ) return $ . request ( "get" , t , n ) ; if ( "undefined" != typeof File && t instanceof File ) { var a = new FileReader ; return a . onload = function ( ) { n ( a . result ) } , a . readAsText ( t ) } } if ( "string" == typeof t && ( r = ( new DOMParser ) . parseFromString ( t , "image/svg+xml" ) ) , ! r . nodeName ) throw Error ( "Unsupported SVG source: " + t ) ; var o = r . nodeName . toLowerCase ( ) , h = z [ o ] , u = h && h ( r , o , e , i ) || null , l = r . getAttribute && r . getAttribute ( "data-paper-data" ) ; return u && ( u instanceof w || ( u = x ( u , r , e ) ) , i . expandShapes && u instanceof b && ( u . remove ( ) , u = u . toPath ( ) ) , l && ( u . _data = JSON . parse ( l ) ) ) , e && ( I = { } ) , u } var z = { "#document" : function ( t , e , i , n ) { for ( var r = t . childNodes , s = 0 , a = r . length ; a > s ; s ++ ) { var o = r [ s ] ; if ( 1 === o . nodeType ) { var h = o . nextSibling ; document . body . appendChild ( o ) ; var u = P ( o , i , n ) ; return h ? t . insertBefore ( o , h ) : t . appendChild ( o ) , u } } } , g : a , svg : a , clippath : a , polygon : o , polyline : o , path : u , lineargradient : l , radialgradient : l , image : function ( t ) { var e = new C ( i ( t , "href" , ! 0 ) ) ; return e . attach ( "load" , function ( ) { var e = r ( t , "width" , "height" ) ; this . setSize ( e ) , this . translate ( n ( t , "x" , "y" ) . add ( e . divide ( 2 ) ) ) } ) , e } , symbol : function ( t , e , i , n ) { return new p ( a ( t , e , i , n ) , ! 0 ) } , defs : a , use : function ( t ) { var e = ( i ( t , "href" , ! 0 ) || "" ) . substring ( 1 ) , r = I [ e ] , s = n ( t , "x" , "y" ) ; return r ? r instanceof p ? r . place ( s ) : r . clone ( ) . translate ( s ) : null } , circle : function ( t ) { return new b . Circle ( n ( t , "cx" , "cy" ) , i ( t , "r" ) ) } , ellipse : function ( t ) { return new b . Ellipse ( { center : n ( t , "cx" , "cy" ) , radius : r ( t , "rx" , "ry" ) } ) } , rect : function ( t ) { var e = n ( t , "x" , "y" ) , i = r ( t , "width" , "height" ) , s = r ( t , "rx" , "ry" ) ; return new b . Rectangle ( new _ ( e , i ) , s ) } , line : function ( t ) { return new O . Line ( n ( t , "x1" , "y1" ) , n ( t , "x2" , "y2" ) ) } , text : function ( t ) { var e = new j ( n ( t , "x" , "y" ) . add ( n ( t , "dx" , "dy" ) ) ) ; return e . setContent ( t . textContent . trim ( ) || "" ) , e } } , M = e . merge ( e . each ( te , function ( t ) { this [ t . attribute ] = function ( e , i ) { if ( e [ t . set ] ( s ( i , t . type , t . fromSVG ) ) , "color" === t . type && e instanceof b ) { var n = e [ t . get ] ( ) ; n && n . transform ( ( new g ) . translate ( e . getPosition ( ! 0 ) . negate ( ) ) ) } } } , { } ) , { id : function ( t , e ) { I [ e ] = t , t . setName && t . setName ( e ) } , "clip-path" : function ( t , e )