visage-app 0.3.3 → 0.9.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,104 +0,0 @@
1
- //MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2009 Aaron Newton <http://clientcide.com/>, Valerio Proietti <http://mad4milk.net> & the MooTools team <http://mootools.net/developers>, MIT Style License.
2
-
3
- MooTools.More={version:"1.2.3.1"};(function(){var a={language:"en-US",languages:{"en-US":{}},cascades:["en-US"]};var b;MooTools.lang=new Events();$extend(MooTools.lang,{setLanguage:function(c){if(!a.languages[c]){return this;
4
- }a.language=c;this.load();this.fireEvent("langChange",c);return this;},load:function(){var c=this.cascade(this.getCurrentLanguage());b={};$each(c,function(e,d){b[d]=this.lambda(e);
5
- },this);},getCurrentLanguage:function(){return a.language;},addLanguage:function(c){a.languages[c]=a.languages[c]||{};return this;},cascade:function(e){var c=(a.languages[e]||{}).cascades||[];
6
- c.combine(a.cascades);c.erase(e).push(e);var d=c.map(function(g){return a.languages[g];},this);return $merge.apply(this,d);},lambda:function(c){(c||{}).get=function(e,d){return $lambda(c[e]).apply(this,$splat(d));
7
- };return c;},get:function(e,d,c){if(b&&b[e]){return(d?b[e].get(d,c):b[e]);}},set:function(d,e,c){this.addLanguage(d);langData=a.languages[d];if(!langData[e]){langData[e]={};
8
- }$extend(langData[e],c);if(d==this.getCurrentLanguage()){this.load();this.fireEvent("langChange",d);}return this;},list:function(){return Hash.getKeys(a.languages);
9
- }});})();var Log=new Class({log:function(){Log.logger.call(this,arguments);}});Log.logged=[];Log.logger=function(){if(window.console&&console.log){console.log.apply(console,arguments);
10
- }else{Log.logged.push(arguments);}};Class.Mutators.Binds=function(a){return a;};Class.Mutators.initialize=function(a){return function(){$splat(this.Binds).each(function(b){var c=this[b];
11
- if(c){this[b]=c.bind(this);}},this);return a.apply(this,arguments);};};(function(){if(!Date.now){Date.now=$time;}Date.Methods={};["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds","Time","TimezoneOffset","Week","Timezone","GMTOffset","DayOfYear","LastMonth","LastDayOfMonth","UTCDate","UTCDay","UTCFullYear","AMPM","Ordinal","UTCHours","UTCMilliseconds","UTCMinutes","UTCMonth","UTCSeconds"].each(function(m){Date.Methods[m.toLowerCase()]=m;
12
- });$each({ms:"Milliseconds",year:"FullYear",min:"Minutes",mo:"Month",sec:"Seconds",hr:"Hours"},function(n,m){Date.Methods[m]=n;});var c=function(n,m){return new Array(m-n.toString().length+1).join("0")+n;
13
- };Date.implement({set:function(r,o){switch($type(r)){case"object":for(var q in r){this.set(q,r[q]);}break;case"string":r=r.toLowerCase();var n=Date.Methods;
14
- if(n[r]){this["set"+n[r]](o);}}return this;},get:function(o){o=o.toLowerCase();var n=Date.Methods;if(n[o]){return this["get"+n[o]]();}return null;},clone:function(){return new Date(this.get("time"));
15
- },increment:function(m,o){m=m||"day";o=$pick(o,1);switch(m){case"year":return this.increment("month",o*12);case"month":var n=this.get("date");this.set("date",1).set("mo",this.get("mo")+o);
16
- return this.set("date",n.min(this.get("lastdayofmonth")));case"week":return this.increment("day",o*7);case"day":return this.set("date",this.get("date")+o);
17
- }if(!Date.units[m]){throw new Error(m+" is not a supported interval");}return this.set("time",this.get("time")+o*Date.units[m]());},decrement:function(m,n){return this.increment(m,-1*$pick(n,1));
18
- },isLeapYear:function(){return Date.isLeapYear(this.get("year"));},clearTime:function(){return this.set({hr:0,min:0,sec:0,ms:0});},diff:function(p,n){n=n||"day";
19
- if($type(p)=="string"){p=Date.parse(p);}switch(n){case"year":return p.get("year")-this.get("year");case"month":var m=(p.get("year")-this.get("year"))*12;
20
- return m+p.get("mo")-this.get("mo");default:var o=p.get("time")-this.get("time");if(Date.units[n]()>o.abs()){return 0;}return((p.get("time")-this.get("time"))/Date.units[n]()).round();
21
- }return null;},getLastDayOfMonth:function(){return Date.daysInMonth(this.get("mo"),this.get("year"));},getDayOfYear:function(){return(Date.UTC(this.get("year"),this.get("mo"),this.get("date")+1)-Date.UTC(this.get("year"),0,1))/Date.units.day();
22
- },getWeek:function(){return(this.get("dayofyear")/7).ceil();},getOrdinal:function(m){return Date.getMsg("ordinal",m||this.get("date"));},getTimezone:function(){return this.toString().replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");
23
- },getGMTOffset:function(){var m=this.get("timezoneOffset");return((m>0)?"-":"+")+c((m.abs()/60).floor(),2)+c(m%60,2);},setAMPM:function(m){m=m.toUpperCase();
24
- var n=this.get("hr");if(n>11&&m=="AM"){return this.decrement("hour",12);}else{if(n<12&&m=="PM"){return this.increment("hour",12);}}return this;},getAMPM:function(){return(this.get("hr")<12)?"AM":"PM";
25
- },parse:function(m){this.set("time",Date.parse(m));return this;},isValid:function(m){return !!(m||this).valueOf();},format:function(m){if(!this.isValid()){return"invalid date";
26
- }m=m||"%x %X";m=i[m.toLowerCase()]||m;var n=this;return m.replace(/%([a-z%])/gi,function(o,p){switch(p){case"a":return Date.getMsg("days")[n.get("day")].substr(0,3);
27
- case"A":return Date.getMsg("days")[n.get("day")];case"b":return Date.getMsg("months")[n.get("month")].substr(0,3);case"B":return Date.getMsg("months")[n.get("month")];
28
- case"c":return n.toString();case"d":return c(n.get("date"),2);case"H":return c(n.get("hr"),2);case"I":return((n.get("hr")%12)||12);case"j":return c(n.get("dayofyear"),3);
29
- case"m":return c((n.get("mo")+1),2);case"M":return c(n.get("min"),2);case"o":return n.get("ordinal");case"p":return Date.getMsg(n.get("ampm"));case"S":return c(n.get("seconds"),2);
30
- case"U":return c(n.get("week"),2);case"w":return n.get("day");case"x":return n.format(Date.getMsg("shortDate"));case"X":return n.format(Date.getMsg("shortTime"));
31
- case"y":return n.get("year").toString().substr(2);case"Y":return n.get("year");case"T":return n.get("GMTOffset");case"Z":return n.get("Timezone");}return p;
32
- });},toISOString:function(){return this.format("iso8601");}});Date.alias("diff","compare");Date.alias("format","strftime");var i={db:"%Y-%m-%d %H:%M:%S",compact:"%Y%m%dT%H%M%S",iso8601:"%Y-%m-%dT%H:%M:%S%T",rfc822:"%a, %d %b %Y %H:%M:%S %Z","short":"%d %b %H:%M","long":"%B %d, %Y %H:%M"};
33
- var e=Date.parse;var k=function(p,r,o){var n=-1;var q=Date.getMsg(p+"s");switch($type(r)){case"object":n=q[r.get(p)];break;case"number":n=q[month-1];if(!n){throw new Error("Invalid "+p+" index: "+index);
34
- }break;case"string":var m=q.filter(function(s){return this.test(s);},new RegExp("^"+r,"i"));if(!m.length){throw new Error("Invalid "+p+" string");}if(m.length>1){throw new Error("Ambiguous "+p);
35
- }n=m[0];}return(o)?q.indexOf(n):n;};Date.extend({getMsg:function(n,m){return MooTools.lang.get("Date",n,m);},units:{ms:$lambda(1),second:$lambda(1000),minute:$lambda(60000),hour:$lambda(3600000),day:$lambda(86400000),week:$lambda(608400000),month:function(n,m){var o=new Date;
36
- return Date.daysInMonth($pick(n,o.get("mo")),$pick(m,o.get("year")))*86400000;},year:function(m){m=m||new Date().get("year");return Date.isLeapYear(m)?31622400000:31536000000;
37
- }},daysInMonth:function(n,m){return[31,Date.isLeapYear(m)?29:28,31,30,31,30,31,31,30,31,30,31][n];},isLeapYear:function(m){return new Date(m,1,29).get("date")==29;
38
- },parse:function(o){var n=$type(o);if(n=="number"){return new Date(o);}if(n!="string"){return o;}o=o.clean();if(!o.length){return null;}var m;Date.parsePatterns.some(function(q){var p=q.re.exec(o);
39
- return(p)?(m=q.handler(p)):false;});return m||new Date(e(o));},parseDay:function(m,n){return k("day",m,n);},parseMonth:function(n,m){return k("month",n,m);
40
- },parseUTC:function(n){var m=new Date(n);var o=Date.UTC(m.get("year"),m.get("mo"),m.get("date"),m.get("hr"),m.get("min"),m.get("sec"));return new Date(o);
41
- },orderIndex:function(m){return Date.getMsg("dateOrder").indexOf(m)+1;},defineFormat:function(m,n){i[m]=n;},defineFormats:function(m){for(var n in m){Date.defineFormat(n,m[f]);
42
- }},parsePatterns:[],defineParser:function(m){Date.parsePatterns.push(m.re&&m.handler?m:j(m));},defineParsers:function(){Array.flatten(arguments).each(Date.defineParser);
43
- },define2DigitYearStart:function(m){d=m%100;g=m-d;}});var g=1900;var d=70;var a=function(m){switch(m){case"x":return(Date.orderIndex("month")==1)?"%m[.-/]%d([.-/]%y)?":"%d[.-/]%m([.-/]%y)?";
44
- case"X":return"%H([.:]%M)?([.:]%S([.:]%s)?)?\\s?%p?\\s?%T?";case"o":return"[^\\d\\s]*";}return null;};var l={a:/[a-z]{3,}/,d:/[0-2]?[0-9]|3[01]/,H:/[01]?[0-9]|2[0-3]/,I:/0?[1-9]|1[0-2]/,M:/[0-5]?\d/,s:/\d+/,p:/[ap]\.?m\.?/,y:/\d{2}|\d{4}/,Y:/\d{4}/,T:/Z|[+-]\d{2}(?::?\d{2})?/};
45
- l.B=l.b=l.A=l.a;l.m=l.I;l.S=l.M;var b;var j=function(o){if(!b){return{format:o};}var m=[null];var n=(o.source||o).replace(/%([a-z])/gi,function(p,q){return a(q)||p;
46
- }).replace(/\((?!\?)/g,"(?:").replace(/ (?!\?|\*)/g,",? ").replace(/%([a-z%])/gi,function(q,s){var r=l[s];if(!r){return s;}m.push(s);return"("+r.source+")";
47
- });return{format:o,re:new RegExp("^"+n+"$","i"),handler:function(r){var p=new Date().clearTime();for(var q=1;q<m.length;q++){p=h.call(p,m[q],r[q]);}return p;
48
- }};};var h=function(m,n){if(!n){if(m=="m"||m=="d"){n=1;}else{return this;}}switch(m){case"a":case"A":return this.set("day",Date.parseDay(n,true));case"b":case"B":return this.set("mo",Date.parseMonth(n,true));
49
- case"d":return this.set("date",n);case"H":case"I":return this.set("hr",n);case"m":return this.set("mo",n-1);case"M":return this.set("min",n);case"p":return this.set("ampm",n.replace(/\./g,""));
50
- case"S":return this.set("sec",n);case"s":return this.set("ms",("0."+n)*1000);case"w":return this.set("day",n);case"Y":return this.set("year",n);case"y":n=+n;
51
- if(n<100){n+=g+(n<d?100:0);}return this.set("year",n);case"T":if(n=="Z"){n="+00";}var o=n.match(/([+-])(\d{2}):?(\d{2})?/);o=(o[1]+"1")*(o[2]*60+(+o[3]||0))+this.getTimezoneOffset();
52
- return this.set("time",(this*1)-o*60000);}return this;};Date.defineParsers("%Y([-./]%m([-./]%d((T| )%X)?)?)?","%Y%m%d(T%H(%M%S?)?)?","%x( %X)?","%d%o( %b( %Y)?)?( %X)?","%b %d%o?( %Y)?( %X)?","%b %Y");
53
- MooTools.lang.addEvent("langChange",function(m){if(!MooTools.lang.get("Date")){return;}b=m;Date.parsePatterns.each(function(o,n){if(o.format){Date.parsePatterns[n]=j(o.format);
54
- }});}).fireEvent("langChange",MooTools.lang.getCurrentLanguage());})();var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Object.type,element:$defined});
55
- this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=$type(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element;
56
- this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.Engine.trident)?"selectstart":"mousedown";this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};
57
- this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);
58
- return this;},start:function(c){if(this.options.preventDefault){c.preventDefault();}this.mouse.start=c.page;this.fireEvent("beforeStart",this.element);
59
- var a=this.options.limit;this.limit={x:[],y:[]};for(var d in this.options.modifiers){if(!this.options.modifiers[d]){continue;}if(this.options.style){this.value.now[d]=this.element.getStyle(this.options.modifiers[d]).toInt();
60
- }else{this.value.now[d]=this.element[this.options.modifiers[d]];}if(this.options.invert){this.value.now[d]*=-1;}this.mouse.pos[d]=c.page[d]-this.value.now[d];
61
- if(a&&a[d]){for(var b=2;b--;b){if($chk(a[d][b])){this.limit[d][b]=$lambda(a[d][b])();}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};
62
- }this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});this.document.addEvent(this.selection,this.bound.eventStop);},check:function(a){if(this.options.preventDefault){a.preventDefault();
63
- }var b=Math.round(Math.sqrt(Math.pow(a.page.x-this.mouse.start.x,2)+Math.pow(a.page.y-this.mouse.start.y,2)));if(b>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});
64
- this.fireEvent("start",[this.element,a]).fireEvent("snap",this.element);}},drag:function(a){if(this.options.preventDefault){a.preventDefault();}this.mouse.now=a.page;
65
- for(var b in this.options.modifiers){if(!this.options.modifiers[b]){continue;}this.value.now[b]=this.mouse.now[b]-this.mouse.pos[b];if(this.options.invert){this.value.now[b]*=-1;
66
- }if(this.options.limit&&this.limit[b]){if($chk(this.limit[b][1])&&(this.value.now[b]>this.limit[b][1])){this.value.now[b]=this.limit[b][1];}else{if($chk(this.limit[b][0])&&(this.value.now[b]<this.limit[b][0])){this.value.now[b]=this.limit[b][0];
67
- }}}if(this.options.grid[b]){this.value.now[b]-=((this.value.now[b]-(this.limit[b][0]||0))%this.options.grid[b]);}if(this.options.style){this.element.setStyle(this.options.modifiers[b],this.value.now[b]+this.options.unit);
68
- }else{this.element[this.options.modifiers[b]]=this.value.now[b];}}this.fireEvent("drag",[this.element,a]);},cancel:function(a){this.document.removeEvent("mousemove",this.bound.check);
69
- this.document.removeEvent("mouseup",this.bound.cancel);if(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element);
70
- }},stop:function(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.document.removeEvent("mousemove",this.bound.drag);this.document.removeEvent("mouseup",this.bound.stop);
71
- if(a){this.fireEvent("complete",[this.element,a]);}}});Element.implement({makeResizable:function(a){var b=new Drag(this,$merge({modifiers:{x:"width",y:"height"}},a));
72
- this.store("resizer",b);return b.addEvent("drag",function(){this.fireEvent("resize",b);}.bind(this));}});var Slider=new Class({Implements:[Events,Options],Binds:["clickedElement","draggedKnob","scrolledElement"],options:{onTick:function(a){if(this.options.snap){a=this.toPosition(this.step);
73
- }this.knob.setStyle(this.property,a);},snap:false,offset:0,range:false,wheel:false,steps:100,mode:"horizontal"},initialize:function(g,a,e){this.setOptions(e);
74
- this.element=document.id(g);this.knob=document.id(a);this.previousChange=this.previousEnd=this.step=-1;var h,b={},d={x:false,y:false};switch(this.options.mode){case"vertical":this.axis="y";
75
- this.property="top";h="offsetHeight";break;case"horizontal":this.axis="x";this.property="left";h="offsetWidth";}this.half=this.knob[h]/2;this.full=this.element[h]-this.knob[h]+(this.options.offset*2);
76
- this.min=$chk(this.options.range[0])?this.options.range[0]:0;this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;this.range=this.max-this.min;
77
- this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.stepWidth=this.stepSize*this.full/Math.abs(this.range);this.knob.setStyle("position","relative").setStyle(this.property,-this.options.offset);
78
- d[this.axis]=this.property;b[this.axis]=[-this.options.offset,this.full-this.options.offset];this.bound={clickedElement:this.clickedElement.bind(this),scrolledElement:this.scrolledElement.bindWithEvent(this),draggedKnob:this.draggedKnob.bind(this)};
79
- var c={snap:0,limit:b,modifiers:d,onDrag:this.bound.draggedKnob,onStart:this.bound.draggedKnob,onBeforeStart:(function(){this.isDragging=true;}).bind(this),onComplete:function(){this.isDragging=false;
80
- this.draggedKnob();this.end();}.bind(this)};if(this.options.snap){c.grid=Math.ceil(this.stepWidth);c.limit[this.axis][1]=this.full;}this.drag=new Drag(this.knob,c);
81
- this.attach();},attach:function(){this.element.addEvent("mousedown",this.bound.clickedElement);if(this.options.wheel){this.element.addEvent("mousewheel",this.bound.scrolledElement);
82
- }this.drag.attach();return this;},detach:function(){this.element.removeEvent("mousedown",this.bound.clickedElement);this.element.removeEvent("mousewheel",this.bound.scrolledElement);
83
- this.drag.detach();return this;},set:function(a){if(!((this.range>0)^(a<this.min))){a=this.min;}if(!((this.range>0)^(a>this.max))){a=this.max;}this.step=Math.round(a);
84
- this.checkStep();this.fireEvent("tick",this.toPosition(this.step));this.end();return this;},clickedElement:function(c){if(this.isDragging||c.target==this.knob){return;
85
- }var b=this.range<0?-1:1;var a=c.page[this.axis]-this.element.getPosition()[this.axis]-this.half;a=a.limit(-this.options.offset,this.full-this.options.offset);
86
- this.step=Math.round(this.min+b*this.toStep(a));this.checkStep();this.fireEvent("tick",a);this.end();},scrolledElement:function(a){var b=(this.options.mode=="horizontal")?(a.wheel<0):(a.wheel>0);
87
- this.set(b?this.step-this.stepSize:this.step+this.stepSize);a.stop();},draggedKnob:function(){var b=this.range<0?-1:1;var a=this.drag.value.now[this.axis];
88
- a=a.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+b*this.toStep(a));this.checkStep();},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;
89
- this.fireEvent("change",this.step);}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent("complete",this.step+"");
90
- }},toStep:function(a){var b=(a+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(b-=b%this.stepSize):b;},toPosition:function(a){return(this.full*Math.abs(this.min-a))/(this.steps*this.stepSize)-this.options.offset;
91
- }});Request.JSONP=new Class({Implements:[Chain,Events,Options,Log],options:{url:"",data:{},retries:0,timeout:0,link:"ignore",callbackKey:"callback",injectScript:document.head},initialize:function(a){this.setOptions(a);
92
- this.running=false;this.requests=0;this.triesRemaining=[];},check:function(){if(!this.running){return true;}switch(this.options.link){case"cancel":this.cancel();
93
- return true;case"chain":this.chain(this.caller.bind(this,arguments));return false;}return false;},send:function(c){if(!$chk(arguments[1])&&!this.check(c)){return this;
94
- }var e=$type(c),a=this.options,b=$chk(arguments[1])?arguments[1]:this.requests++;if(e=="string"||e=="element"){c={data:c};}c=$extend({data:a.data,url:a.url},c);
95
- if(!$chk(this.triesRemaining[b])){this.triesRemaining[b]=this.options.retries;}var d=this.triesRemaining[b];(function(){var g=this.getScript(c);this.log("JSONP retrieving script with url: "+g.get("src"));
96
- this.fireEvent("request",g);this.running=true;(function(){if(d){this.triesRemaining[b]=d-1;if(g){g.destroy();this.send(c,b);this.fireEvent("retry",this.triesRemaining[b]);
97
- }}else{if(g&&this.options.timeout){g.destroy();this.cancel();this.fireEvent("failure");}}}).delay(this.options.timeout,this);}).delay(Browser.Engine.trident?50:0,this);
98
- return this;},cancel:function(){if(!this.running){return this;}this.running=false;this.fireEvent("cancel");return this;},getScript:function(c){var b=Request.JSONP.counter,d;
99
- Request.JSONP.counter++;switch($type(c.data)){case"element":d=document.id(c.data).toQueryString();break;case"object":case"hash":d=Hash.toQueryString(c.data);
100
- }var e=c.url+(c.url.test("\\?")?"&":"?")+(c.callbackKey||this.options.callbackKey)+"=Request.JSONP.request_map.request_"+b+(d?"&"+d:"");if(e.length>2083){this.log("JSONP "+e+" will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs");
101
- }var a=new Element("script",{type:"text/javascript",src:e});Request.JSONP.request_map["request_"+b]=function(g){this.success(g,a);}.bind(this);return a.inject(this.options.injectScript);
102
- },success:function(b,a){if(a){a.destroy();}this.running=false;this.log("JSONP successfully retrieved: ",b);this.fireEvent("complete",[b]).fireEvent("success",[b]).callChain();
103
- }});Request.JSONP.counter=0;Request.JSONP.request_map={};MooTools.lang.set("en-US","Date",{months:["January","February","March","April","May","June","July","August","September","October","November","December"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dateOrder:["month","date","year"],shortDate:"%m/%d/%Y",shortTime:"%I:%M%p",AM:"AM",PM:"PM",ordinal:function(a){return(a>3&&a<21)?"th":["th","st","nd","rd","th"][Math.min(a%10,4)];
104
- },lessThanMinuteAgo:"less than a minute ago",minuteAgo:"about a minute ago",minutesAgo:"{delta} minutes ago",hourAgo:"about an hour ago",hoursAgo:"about {delta} hours ago",dayAgo:"1 day ago",daysAgo:"{delta} days ago",lessThanMinuteUntil:"less than a minute from now",minuteUntil:"about a minute from now",minutesUntil:"{delta} minutes from now",hourUntil:"about an hour from now",hoursUntil:"about {delta} hours from now",dayUntil:"1 day from now",daysUntil:"{delta} days from now"});
@@ -1,113 +0,0 @@
1
- /*
2
- * Raphael 1.4.3 - JavaScript Vector Library
3
- *
4
- * Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
5
- * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
6
- */
7
- Raphael=function(){function m(){if(m.is(arguments[0],U)){for(var a=arguments[0],b=Aa[K](m,a.splice(0,3+m.is(a[0],O))),c=b.set(),d=0,f=a[o];d<f;d++){var e=a[d]||{};nb.test(e.type)&&c[E](b[e.type]().attr(e))}return c}return Aa[K](m,arguments)}m.version="1.4.3";var V=/[, ]+/,nb=/^(circle|rect|path|ellipse|text|image)$/,p="prototype",z="hasOwnProperty",C=document,X=window,La={was:Object[p][z].call(X,"Raphael"),is:X.Raphael};function G(){}var y="appendChild",K="apply",M="concat",Ba="createTouch"in C,s=
8
- "",P=" ",H="split",Ma="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[H](P),Ca={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},Q="join",o="length",ca=String[p].toLowerCase,w=Math,Y=w.max,$=w.min,O="number",ea="string",U="array",N="toString",aa="fill",ob=Object[p][N],D=w.pow,E="push",ga=/^(?=[\da-f]$)/,Na=/^url\(['"]?([^\)]+?)['"]?\)$/i,pb=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+(?:\s*,\s*[\d\.]+)?)\s*\)|rgba?\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%(?:\s*,\s*[\d\.]+%))\s*\)|hs[bl]\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hs[bl]\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,
9
- F=w.round,W="setAttribute",A=parseFloat,da=parseInt,Da=" progid:DXImageTransform.Microsoft",pa=String[p].toUpperCase,qa={blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt",
10
- "stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},Ea={along:"along",blur:O,"clip-rect":"csv",cx:O,cy:O,fill:"colour","fill-opacity":O,"font-size":O,height:O,opacity:O,path:"path",r:O,rotation:"csv",rx:O,ry:O,scale:"csv",stroke:"colour","stroke-opacity":O,"stroke-width":O,translation:"csv",width:O,x:O,y:O},I="replace";m.type=X.SVGAngle||C.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure",
11
- "1.1")?"SVG":"VML";if(m.type=="VML"){var ha=C.createElement("div");ha.innerHTML="<!--[if vml]><br><br><![endif]--\>";if(ha.childNodes[o]!=2)return m.type=null;ha=null}m.svg=!(m.vml=m.type=="VML");G[p]=m[p];m._id=0;m._oid=0;m.fn={};m.is=function(a,b){b=ca.call(b);return b=="object"&&a===Object(a)||b=="undefined"&&typeof a==b||b=="null"&&a==null||ca.call(ob.call(a).slice(8,-1))==b};m.setWindow=function(a){X=a;C=X.document};function ra(a){if(m.vml){var b=/^\s+|\s+$/g;ra=T(function(d){var f;d=(d+s)[I](b,
12
- s);try{var e=new X.ActiveXObject("htmlfile");e.write("<body>");e.close();f=e.body}catch(g){f=X.createPopup().document.body}e=f.createTextRange();try{f.style.color=d;var h=e.queryCommandValue("ForeColor");h=(h&255)<<16|h&65280|(h&16711680)>>>16;return"#"+("000000"+h[N](16)).slice(-6)}catch(i){return"none"}})}else{var c=C.createElement("i");c.title="Rapha\u00ebl Colour Picker";c.style.display="none";C.body[y](c);ra=T(function(d){c.style.color=d;return C.defaultView.getComputedStyle(c,s).getPropertyValue("color")})}return ra(a)}
13
- function qb(){return"hsb("+[this.h,this.s,this.b]+")"}function rb(){return this.hex}m.hsb2rgb=T(function(a,b,c){if(m.is(a,"object")&&"h"in a&&"s"in a&&"b"in a){c=a.b;b=a.s;a=a.h}var d;if(c==0)return{r:0,g:0,b:0,hex:"#000"};if(a>1||b>1||c>1){a/=255;b/=255;c/=255}d=~~(a*6);a=a*6-d;var f=c*(1-b),e=c*(1-b*a),g=c*(1-b*(1-a));a=[c,e,f,f,g,c,c][d];b=[g,c,c,e,f,f,g][d];d=[f,f,g,c,c,e,f][d];a*=255;b*=255;d*=255;c={r:a,g:b,b:d,toString:rb};a=(~~a)[N](16);b=(~~b)[N](16);d=(~~d)[N](16);a=a[I](ga,"0");b=b[I](ga,
14
- "0");d=d[I](ga,"0");c.hex="#"+a+b+d;return c},m);m.rgb2hsb=T(function(a,b,c){if(m.is(a,"object")&&"r"in a&&"g"in a&&"b"in a){c=a.b;b=a.g;a=a.r}if(m.is(a,ea)){var d=m.getRGB(a);a=d.r;b=d.g;c=d.b}if(a>1||b>1||c>1){a/=255;b/=255;c/=255}var f=Y(a,b,c),e=$(a,b,c);d=f;if(e==f)return{h:0,s:0,b:f};else{var g=f-e;e=g/f;a=a==f?(b-c)/g:b==f?2+(c-a)/g:4+(a-b)/g;a/=6;a<0&&a++;a>1&&a--}return{h:a,s:e,b:d,toString:qb}},m);var sb=/,?([achlmqrstvxz]),?/gi,sa=/\s*,\s*/,tb={hs:1,rg:1};m._path2string=function(){return this.join(",")[I](sb,
15
- "$1")};function T(a,b,c){function d(){var f=Array[p].slice.call(arguments,0),e=f[Q]("\u25ba"),g=d.cache=d.cache||{},h=d.count=d.count||[];if(g[z](e))return c?c(g[e]):g[e];h[o]>=1000&&delete g[h.shift()];h[E](e);g[e]=a[K](b,f);return c?c(g[e]):g[e]}return d}m.getRGB=T(function(a){if(!a||(a+=s).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1};if(a=="none")return{r:-1,g:-1,b:-1,hex:"none"};!(tb[z](a.substring(0,2))||a.charAt()=="#")&&(a=ra(a));var b,c,d,f,e;if(a=a.match(pb)){if(a[2]){d=da(a[2].substring(5),
16
- 16);c=da(a[2].substring(3,5),16);b=da(a[2].substring(1,3),16)}if(a[3]){d=da((e=a[3].charAt(3))+e,16);c=da((e=a[3].charAt(2))+e,16);b=da((e=a[3].charAt(1))+e,16)}if(a[4]){a=a[4][H](sa);b=A(a[0]);c=A(a[1]);d=A(a[2]);f=A(a[3])}if(a[5]){a=a[5][H](sa);b=A(a[0])*2.55;c=A(a[1])*2.55;d=A(a[2])*2.55;f=A(a[3])}if(a[6]){a=a[6][H](sa);b=A(a[0]);c=A(a[1]);d=A(a[2]);return m.hsb2rgb(b,c,d)}if(a[7]){a=a[7][H](sa);b=A(a[0])*2.55;c=A(a[1])*2.55;d=A(a[2])*2.55;return m.hsb2rgb(b,c,d)}a={r:b,g:c,b:d};b=(~~b)[N](16);
17
- c=(~~c)[N](16);d=(~~d)[N](16);b=b[I](ga,"0");c=c[I](ga,"0");d=d[I](ga,"0");a.hex="#"+b+c+d;isFinite(A(f))&&(a.o=f);return a}return{r:-1,g:-1,b:-1,hex:"none",error:1}},m);m.getColor=function(a){a=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||0.75};var b=this.hsb2rgb(a.h,a.s,a.b);a.h+=0.075;if(a.h>1){a.h=0;a.s-=0.2;a.s<=0&&(this.getColor.start={h:0,s:1,b:a.b})}return b.hex};m.getColor.reset=function(){delete this.start};var ub=/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,
18
- vb=/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig;m.parsePathString=T(function(a){if(!a)return null;var b={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},c=[];if(m.is(a,U)&&m.is(a[0],U))c=ta(a);c[o]||(a+s)[I](ub,function(d,f,e){var g=[];d=ca.call(f);e[I](vb,function(h,i){i&&g[E](+i)});if(d=="m"&&g[o]>2){c[E]([f][M](g.splice(0,2)));d="l";f=f=="m"?"l":"L"}for(;g[o]>=b[d];){c[E]([f][M](g.splice(0,b[d])));if(!b[d])break}});c[N]=m._path2string;return c});m.findDotsAtSegment=function(a,b,c,d,f,e,g,h,i){var j=1-i,l=
19
- D(j,3)*a+D(j,2)*3*i*c+j*3*i*i*f+D(i,3)*g;j=D(j,3)*b+D(j,2)*3*i*d+j*3*i*i*e+D(i,3)*h;var n=a+2*i*(c-a)+i*i*(f-2*c+a),r=b+2*i*(d-b)+i*i*(e-2*d+b),q=c+2*i*(f-c)+i*i*(g-2*f+c),k=d+2*i*(e-d)+i*i*(h-2*e+d);a=(1-i)*a+i*c;b=(1-i)*b+i*d;f=(1-i)*f+i*g;e=(1-i)*e+i*h;h=90-w.atan((n-q)/(r-k))*180/w.PI;(n>q||r<k)&&(h+=180);return{x:l,y:j,m:{x:n,y:r},n:{x:q,y:k},start:{x:a,y:b},end:{x:f,y:e},alpha:h}};var va=T(function(a){if(!a)return{x:0,y:0,width:0,height:0};a=ua(a);for(var b=0,c=0,d=[],f=[],e,g=0,h=a[o];g<h;g++){e=
20
- a[g];if(e[0]=="M"){b=e[1];c=e[2];d[E](b);f[E](c)}else{b=wb(b,c,e[1],e[2],e[3],e[4],e[5],e[6]);d=d[M](b.min.x,b.max.x);f=f[M](b.min.y,b.max.y);b=e[5];c=e[6]}}a=$[K](0,d);e=$[K](0,f);return{x:a,y:e,width:Y[K](0,d)-a,height:Y[K](0,f)-e}});function ta(a){var b=[];if(!m.is(a,U)||!m.is(a&&a[0],U))a=m.parsePathString(a);for(var c=0,d=a[o];c<d;c++){b[c]=[];for(var f=0,e=a[c][o];f<e;f++)b[c][f]=a[c][f]}b[N]=m._path2string;return b}var Oa=T(function(a){if(!m.is(a,U)||!m.is(a&&a[0],U))a=m.parsePathString(a);
21
- var b=[],c=0,d=0,f=0,e=0,g=0;if(a[0][0]=="M"){c=a[0][1];d=a[0][2];f=c;e=d;g++;b[E](["M",c,d])}g=g;for(var h=a[o];g<h;g++){var i=b[g]=[],j=a[g];if(j[0]!=ca.call(j[0])){i[0]=ca.call(j[0]);switch(i[0]){case "a":i[1]=j[1];i[2]=j[2];i[3]=j[3];i[4]=j[4];i[5]=j[5];i[6]=+(j[6]-c).toFixed(3);i[7]=+(j[7]-d).toFixed(3);break;case "v":i[1]=+(j[1]-d).toFixed(3);break;case "m":f=j[1];e=j[2];default:for(var l=1,n=j[o];l<n;l++)i[l]=+(j[l]-(l%2?c:d)).toFixed(3)}}else{b[g]=[];if(j[0]=="m"){f=j[1]+c;e=j[2]+d}i=0;for(l=
22
- j[o];i<l;i++)b[g][i]=j[i]}j=b[g][o];switch(b[g][0]){case "z":c=f;d=e;break;case "h":c+=+b[g][j-1];break;case "v":d+=+b[g][j-1];break;default:c+=+b[g][j-2];d+=+b[g][j-1]}}b[N]=m._path2string;return b},0,ta),ka=T(function(a){if(!m.is(a,U)||!m.is(a&&a[0],U))a=m.parsePathString(a);var b=[],c=0,d=0,f=0,e=0,g=0;if(a[0][0]=="M"){c=+a[0][1];d=+a[0][2];f=c;e=d;g++;b[0]=["M",c,d]}g=g;for(var h=a[o];g<h;g++){var i=b[g]=[],j=a[g];if(j[0]!=pa.call(j[0])){i[0]=pa.call(j[0]);switch(i[0]){case "A":i[1]=j[1];i[2]=
23
- j[2];i[3]=j[3];i[4]=j[4];i[5]=j[5];i[6]=+(j[6]+c);i[7]=+(j[7]+d);break;case "V":i[1]=+j[1]+d;break;case "H":i[1]=+j[1]+c;break;case "M":f=+j[1]+c;e=+j[2]+d;default:for(var l=1,n=j[o];l<n;l++)i[l]=+j[l]+(l%2?c:d)}}else{l=0;for(n=j[o];l<n;l++)b[g][l]=j[l]}switch(i[0]){case "Z":c=f;d=e;break;case "H":c=i[1];break;case "V":d=i[1];break;default:c=b[g][b[g][o]-2];d=b[g][b[g][o]-1]}}b[N]=m._path2string;return b},null,ta);function wa(a,b,c,d){return[a,b,c,d,c,d]}function Pa(a,b,c,d,f,e){var g=1/3,h=2/3;return[g*
24
- a+h*c,g*b+h*d,g*f+h*c,g*e+h*d,f,e]}function Qa(a,b,c,d,f,e,g,h,i,j){var l=w.PI,n=l*120/180,r=l/180*(+f||0),q=[],k,t=T(function(J,fa,xa){var xb=J*w.cos(xa)-fa*w.sin(xa);J=J*w.sin(xa)+fa*w.cos(xa);return{x:xb,y:J}});if(j){x=j[0];k=j[1];e=j[2];B=j[3]}else{k=t(a,b,-r);a=k.x;b=k.y;k=t(h,i,-r);h=k.x;i=k.y;w.cos(l/180*f);w.sin(l/180*f);k=(a-h)/2;x=(b-i)/2;B=k*k/(c*c)+x*x/(d*d);if(B>1){B=w.sqrt(B);c=B*c;d=B*d}B=c*c;var L=d*d;B=(e==g?-1:1)*w.sqrt(w.abs((B*L-B*x*x-L*k*k)/(B*x*x+L*k*k)));e=B*c*x/d+(a+h)/2;var B=
25
- B*-d*k/c+(b+i)/2,x=w.asin(((b-B)/d).toFixed(7));k=w.asin(((i-B)/d).toFixed(7));x=a<e?l-x:x;k=h<e?l-k:k;x<0&&(x=l*2+x);k<0&&(k=l*2+k);if(g&&x>k)x-=l*2;if(!g&&k>x)k-=l*2}l=k-x;if(w.abs(l)>n){q=k;l=h;L=i;k=x+n*(g&&k>x?1:-1);h=e+c*w.cos(k);i=B+d*w.sin(k);q=Qa(h,i,c,d,f,0,g,l,L,[k,q,e,B])}l=k-x;f=w.cos(x);e=w.sin(x);g=w.cos(k);k=w.sin(k);l=w.tan(l/4);c=4/3*c*l;l=4/3*d*l;d=[a,b];a=[a+c*e,b-l*f];b=[h+c*k,i-l*g];h=[h,i];a[0]=2*d[0]-a[0];a[1]=2*d[1]-a[1];if(j)return[a,b,h][M](q);else{q=[a,b,h][M](q)[Q]()[H](",");
26
- j=[];h=0;for(i=q[o];h<i;h++)j[h]=h%2?t(q[h-1],q[h],r).y:t(q[h],q[h+1],r).x;return j}}function la(a,b,c,d,f,e,g,h,i){var j=1-i;return{x:D(j,3)*a+D(j,2)*3*i*c+j*3*i*i*f+D(i,3)*g,y:D(j,3)*b+D(j,2)*3*i*d+j*3*i*i*e+D(i,3)*h}}var wb=T(function(a,b,c,d,f,e,g,h){var i=f-2*c+a-(g-2*f+c),j=2*(c-a)-2*(f-c),l=a-c,n=(-j+w.sqrt(j*j-4*i*l))/2/i;i=(-j-w.sqrt(j*j-4*i*l))/2/i;var r=[b,h],q=[a,g];w.abs(n)>1000000000000&&(n=0.5);w.abs(i)>1000000000000&&(i=0.5);if(n>0&&n<1){n=la(a,b,c,d,f,e,g,h,n);q[E](n.x);r[E](n.y)}if(i>
27
- 0&&i<1){n=la(a,b,c,d,f,e,g,h,i);q[E](n.x);r[E](n.y)}i=e-2*d+b-(h-2*e+d);j=2*(d-b)-2*(e-d);l=b-d;n=(-j+w.sqrt(j*j-4*i*l))/2/i;i=(-j-w.sqrt(j*j-4*i*l))/2/i;w.abs(n)>1000000000000&&(n=0.5);w.abs(i)>1000000000000&&(i=0.5);if(n>0&&n<1){n=la(a,b,c,d,f,e,g,h,n);q[E](n.x);r[E](n.y)}if(i>0&&i<1){n=la(a,b,c,d,f,e,g,h,i);q[E](n.x);r[E](n.y)}return{min:{x:$[K](0,q),y:$[K](0,r)},max:{x:Y[K](0,q),y:Y[K](0,r)}}}),ua=T(function(a,b){var c=ka(a),d=b&&ka(b);a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};b={x:0,y:0,
28
- bx:0,by:0,X:0,Y:0,qx:null,qy:null};function f(q,k){var t;if(!q)return["C",k.x,k.y,k.x,k.y,k.x,k.y];!(q[0]in{T:1,Q:1})&&(k.qx=k.qy=null);switch(q[0]){case "M":k.X=q[1];k.Y=q[2];break;case "A":q=["C"][M](Qa[K](0,[k.x,k.y][M](q.slice(1))));break;case "S":t=k.x+(k.x-(k.bx||k.x));k=k.y+(k.y-(k.by||k.y));q=["C",t,k][M](q.slice(1));break;case "T":k.qx=k.x+(k.x-(k.qx||k.x));k.qy=k.y+(k.y-(k.qy||k.y));q=["C"][M](Pa(k.x,k.y,k.qx,k.qy,q[1],q[2]));break;case "Q":k.qx=q[1];k.qy=q[2];q=["C"][M](Pa(k.x,k.y,q[1],
29
- q[2],q[3],q[4]));break;case "L":q=["C"][M](wa(k.x,k.y,q[1],q[2]));break;case "H":q=["C"][M](wa(k.x,k.y,q[1],k.y));break;case "V":q=["C"][M](wa(k.x,k.y,k.x,q[1]));break;case "Z":q=["C"][M](wa(k.x,k.y,k.X,k.Y));break}return q}function e(q,k){if(q[k][o]>7){q[k].shift();for(var t=q[k];t[o];)q.splice(k++,0,["C"][M](t.splice(0,6)));q.splice(k,1);i=Y(c[o],d&&d[o]||0)}}function g(q,k,t,L,B){if(q&&k&&q[B][0]=="M"&&k[B][0]!="M"){k.splice(B,0,["M",L.x,L.y]);t.bx=0;t.by=0;t.x=q[B][1];t.y=q[B][2];i=Y(c[o],d&&
30
- d[o]||0)}}for(var h=0,i=Y(c[o],d&&d[o]||0);h<i;h++){c[h]=f(c[h],a);e(c,h);d&&(d[h]=f(d[h],b));d&&e(d,h);g(c,d,a,b,h);g(d,c,b,a,h);var j=c[h],l=d&&d[h],n=j[o],r=d&&l[o];a.x=j[n-2];a.y=j[n-1];a.bx=A(j[n-4])||a.x;a.by=A(j[n-3])||a.y;b.bx=d&&(A(l[r-4])||b.x);b.by=d&&(A(l[r-3])||b.y);b.x=d&&l[r-2];b.y=d&&l[r-1]}return d?[c,d]:c},null,ta),Ra=T(function(a){for(var b=[],c=0,d=a[o];c<d;c++){var f={},e=a[c].match(/^([^:]*):?([\d\.]*)/);f.color=m.getRGB(e[1]);if(f.color.error)return null;f.color=f.color.hex;
31
- e[2]&&(f.offset=e[2]+"%");b[E](f)}c=1;for(d=b[o]-1;c<d;c++)if(!b[c].offset){a=A(b[c-1].offset||0);e=0;for(f=c+1;f<d;f++)if(b[f].offset){e=b[f].offset;break}if(!e){e=100;f=d}e=A(e);for(e=(e-a)/(f-c+1);c<f;c++){a+=e;b[c].offset=a+"%"}}return b});function Sa(a,b,c,d){if(m.is(a,ea)||m.is(a,"object")){a=m.is(a,ea)?C.getElementById(a):a;if(a.tagName)return b==null?{container:a,width:a.style.pixelWidth||a.offsetWidth,height:a.style.pixelHeight||a.offsetHeight}:{container:a,width:b,height:c}}else return{container:1,
32
- x:a,y:b,width:c,height:d}}function Fa(a,b){var c=this;for(var d in b)if(b[z](d)&&!(d in a))switch(typeof b[d]){case "function":(function(f){a[d]=a===c?f:function(){return f[K](c,arguments)}})(b[d]);break;case "object":a[d]=a[d]||{};Fa.call(this,a[d],b[d]);break;default:a[d]=b[d];break}}function ia(a,b){a==b.top&&(b.top=a.prev);a==b.bottom&&(b.bottom=a.next);a.next&&(a.next.prev=a.prev);a.prev&&(a.prev.next=a.next)}function Ta(a,b){if(b.top!==a){ia(a,b);a.next=null;a.prev=b.top;b.top.next=a;b.top=
33
- a}}function Ua(a,b){if(b.bottom!==a){ia(a,b);a.next=b.bottom;a.prev=null;b.bottom.prev=a;b.bottom=a}}function Va(a,b,c){ia(a,c);b==c.top&&(c.top=a);b.next&&(b.next.prev=a);a.next=b.next;a.prev=b;b.next=a}function Wa(a,b,c){ia(a,c);b==c.bottom&&(c.bottom=a);b.prev&&(b.prev.next=a);a.prev=b.prev;b.prev=a;a.next=b}function Xa(a){return function(){throw new Error("Rapha\u00ebl: you are calling to method \u201c"+a+"\u201d of removed object");}}var Ya=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;if(m.svg){G[p].svgns=
34
- "http://www.w3.org/2000/svg";G[p].xlink="http://www.w3.org/1999/xlink";F=function(a){return+a+(~~a===a)*0.5};var v=function(a,b){if(b)for(var c in b)b[z](c)&&a[W](c,b[c]+s);else{a=C.createElementNS(G[p].svgns,a);a.style.webkitTapHighlightColor="rgba(0,0,0,0)";return a}};m[N]=function(){return"Your browser supports SVG.\nYou are running Rapha\u00ebl "+this.version};var Za=function(a,b){var c=v("path");b.canvas&&b.canvas[y](c);b=new u(c,b);b.type="path";ba(b,{fill:"none",stroke:"#000",path:a});return b},
35
- ma=function(a,b,c){var d="linear",f=0.5,e=0.5,g=a.style;b=(b+s)[I](Ya,function(l,n,r){d="radial";if(n&&r){f=A(n);e=A(r);l=(e>0.5)*2-1;D(f-0.5,2)+D(e-0.5,2)>0.25&&(e=w.sqrt(0.25-D(f-0.5,2))*l+0.5)&&e!=0.5&&(e=e.toFixed(5)-1.0E-5*l)}return s});b=b[H](/\s*\-\s*/);if(d=="linear"){var h=b.shift();h=-A(h);if(isNaN(h))return null;h=[0,0,w.cos(h*w.PI/180),w.sin(h*w.PI/180)];var i=1/(Y(w.abs(h[2]),w.abs(h[3]))||1);h[2]*=i;h[3]*=i;if(h[2]<0){h[0]=-h[2];h[2]=0}if(h[3]<0){h[1]=-h[3];h[3]=0}}b=Ra(b);if(!b)return null;
36
- i=a.getAttribute(aa);(i=i.match(/^url\(#(.*)\)$/))&&c.defs.removeChild(C.getElementById(i[1]));i=v(d+"Gradient");i.id="r"+(m._id++)[N](36);v(i,d=="radial"?{fx:f,fy:e}:{x1:h[0],y1:h[1],x2:h[2],y2:h[3]});c.defs[y](i);c=0;for(h=b[o];c<h;c++){var j=v("stop");v(j,{offset:b[c].offset?b[c].offset:!c?"0%":"100%","stop-color":b[c].color||"#fff"});i[y](j)}v(a,{fill:"url(#"+i.id+")",opacity:1,"fill-opacity":1});g.fill=s;g.opacity=1;return g.fillOpacity=1},Ga=function(a){var b=a.getBBox();v(a.pattern,{patternTransform:m.format("translate({0},{1})",
37
- b.x,b.y)})},ba=function(a,b){var c={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},d=a.node,f=a.attrs,e=a.rotate();function g(k,t){if(t=c[ca.call(t)]){var L=k.attrs["stroke-width"]||"1";k={round:L,square:L,butt:0}[k.attrs["stroke-linecap"]||b["stroke-linecap"]]||0;for(var B=[],x=t[o];x--;)B[x]=t[x]*L+(x%2?1:-1)*k;v(d,{"stroke-dasharray":B[Q](",")})}}b[z]("rotation")&&(e=b.rotation);var h=
38
- (e+s)[H](V);if(h.length-1){h[1]=+h[1];h[2]=+h[2]}else h=null;A(e)&&a.rotate(0,true);for(var i in b)if(b[z](i))if(qa[z](i)){var j=b[i];f[i]=j;switch(i){case "blur":a.blur(j);break;case "rotation":a.rotate(j,true);break;case "href":case "title":case "target":var l=d.parentNode;if(ca.call(l.tagName)!="a"){var n=v("a");l.insertBefore(n,d);n[y](d);l=n}l.setAttributeNS(a.paper.xlink,i,j);break;case "cursor":d.style.cursor=j;break;case "clip-rect":l=(j+s)[H](V);if(l[o]==4){a.clip&&a.clip.parentNode.parentNode.removeChild(a.clip.parentNode);
39
- var r=v("clipPath");n=v("rect");r.id="r"+(m._id++)[N](36);v(n,{x:l[0],y:l[1],width:l[2],height:l[3]});r[y](n);a.paper.defs[y](r);v(d,{"clip-path":"url(#"+r.id+")"});a.clip=n}if(!j){(j=C.getElementById(d.getAttribute("clip-path")[I](/(^url\(#|\)$)/g,s)))&&j.parentNode.removeChild(j);v(d,{"clip-path":s});delete a.clip}break;case "path":if(a.type=="path")v(d,{d:j?(f.path=ka(j)):"M0,0"});break;case "width":d[W](i,j);if(f.fx){i="x";j=f.x}else break;case "x":if(f.fx)j=-f.x-(f.width||0);case "rx":if(i==
40
- "rx"&&a.type=="rect")break;case "cx":h&&(i=="x"||i=="cx")&&(h[1]+=j-f[i]);d[W](i,F(j));a.pattern&&Ga(a);break;case "height":d[W](i,j);if(f.fy){i="y";j=f.y}else break;case "y":if(f.fy)j=-f.y-(f.height||0);case "ry":if(i=="ry"&&a.type=="rect")break;case "cy":h&&(i=="y"||i=="cy")&&(h[2]+=j-f[i]);d[W](i,F(j));a.pattern&&Ga(a);break;case "r":a.type=="rect"?v(d,{rx:j,ry:j}):d[W](i,j);break;case "src":a.type=="image"&&d.setAttributeNS(a.paper.xlink,"href",j);break;case "stroke-width":d.style.strokeWidth=
41
- j;d[W](i,j);f["stroke-dasharray"]&&g(a,f["stroke-dasharray"]);break;case "stroke-dasharray":g(a,j);break;case "translation":j=(j+s)[H](V);j[0]=+j[0]||0;j[1]=+j[1]||0;if(h){h[1]+=j[0];h[2]+=j[1]}ya.call(a,j[0],j[1]);break;case "scale":j=(j+s)[H](V);a.scale(+j[0]||1,+j[1]||+j[0]||1,isNaN(A(j[2]))?null:+j[2],isNaN(A(j[3]))?null:+j[3]);break;case aa:if(l=(j+s).match(Na)){r=v("pattern");var q=v("image");r.id="r"+(m._id++)[N](36);v(r,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1});v(q,{x:0,y:0});
42
- q.setAttributeNS(a.paper.xlink,"href",l[1]);r[y](q);j=C.createElement("img");j.style.cssText="position:absolute;left:-9999em;top-9999em";j.onload=function(){v(r,{width:this.offsetWidth,height:this.offsetHeight});v(q,{width:this.offsetWidth,height:this.offsetHeight});C.body.removeChild(this);a.paper.safari()};C.body[y](j);j.src=l[1];a.paper.defs[y](r);d.style.fill="url(#"+r.id+")";v(d,{fill:"url(#"+r.id+")"});a.pattern=r;a.pattern&&Ga(a);break}l=m.getRGB(j);if(l.error){if(({circle:1,ellipse:1}[z](a.type)||
43
- (j+s).charAt()!="r")&&ma(d,j,a.paper)){f.gradient=j;f.fill="none";break}}else{delete b.gradient;delete f.gradient;!m.is(f.opacity,"undefined")&&m.is(b.opacity,"undefined")&&v(d,{opacity:f.opacity});!m.is(f["fill-opacity"],"undefined")&&m.is(b["fill-opacity"],"undefined")&&v(d,{"fill-opacity":f["fill-opacity"]})}l[z]("o")&&v(d,{"fill-opacity":l.o/100});case "stroke":l=m.getRGB(j);d[W](i,l.hex);i=="stroke"&&l[z]("o")&&v(d,{"stroke-opacity":l.o/100});break;case "gradient":(({circle:1,ellipse:1})[z](a.type)||
44
- (j+s).charAt()!="r")&&ma(d,j,a.paper);break;case "opacity":case "fill-opacity":if(f.gradient){if(l=C.getElementById(d.getAttribute(aa)[I](/^url\(#|\)$/g,s))){l=l.getElementsByTagName("stop");l[l[o]-1][W]("stop-opacity",j)}break}default:i=="font-size"&&(j=da(j,10)+"px");l=i[I](/(\-.)/g,function(k){return pa.call(k.substring(1))});d.style[l]=j;d[W](i,j);break}}yb(a,b);if(h)a.rotate(h.join(P));else A(e)&&a.rotate(e,true)},$a=1.2,yb=function(a,b){if(!(a.type!="text"||!(b[z]("text")||b[z]("font")||b[z]("font-size")||
45
- b[z]("x")||b[z]("y")))){var c=a.attrs,d=a.node,f=d.firstChild?da(C.defaultView.getComputedStyle(d.firstChild,s).getPropertyValue("font-size"),10):10;if(b[z]("text")){for(c.text=b.text;d.firstChild;)d.removeChild(d.firstChild);b=(b.text+s)[H]("\n");for(var e=0,g=b[o];e<g;e++)if(b[e]){var h=v("tspan");e&&v(h,{dy:f*$a,x:c.x});h[y](C.createTextNode(b[e]));d[y](h)}}else{b=d.getElementsByTagName("tspan");e=0;for(g=b[o];e<g;e++)e&&v(b[e],{dy:f*$a,x:c.x})}v(d,{y:c.y});a=a.getBBox();(a=c.y-(a.y+a.height/2))&&
46
- isFinite(a)&&v(d,{y:c.y+a})}},u=function(a,b){this[0]=a;this.id=m._oid++;this.node=a;a.raphael=this;this.paper=b;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1};!b.bottom&&(b.bottom=this);(this.prev=b.top)&&(b.top.next=this);b.top=this;this.next=null};u[p].rotate=function(a,b,c){if(this.removed)return this;if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][Q](P);return this._.rt.deg}var d=this.getBBox();a=(a+s)[H](V);if(a[o]-
47
- 1){b=A(a[1]);c=A(a[2])}a=A(a[0]);if(b!=null)this._.rt.deg=a;else this._.rt.deg+=a;c==null&&(b=null);this._.rt.cx=b;this._.rt.cy=c;b=b==null?d.x+d.width/2:b;c=c==null?d.y+d.height/2:c;if(this._.rt.deg){this.transformations[0]=m.format("rotate({0} {1} {2})",this._.rt.deg,b,c);this.clip&&v(this.clip,{transform:m.format("rotate({0} {1} {2})",-this._.rt.deg,b,c)})}else{this.transformations[0]=s;this.clip&&v(this.clip,{transform:s})}v(this.node,{transform:this.transformations[Q](P)});return this};u[p].hide=
48
- function(){!this.removed&&(this.node.style.display="none");return this};u[p].show=function(){!this.removed&&(this.node.style.display="");return this};u[p].remove=function(){if(!this.removed){ia(this,this.paper);this.node.parentNode.removeChild(this.node);for(var a in this)delete this[a];this.removed=true}};u[p].getBBox=function(){if(this.removed)return this;if(this.type=="path")return va(this.attrs.path);if(this.node.style.display=="none"){this.show();var a=true}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=
49
- b||{}}if(this.type=="text"){b={x:b.x,y:Infinity,width:0,height:0};for(var d=0,f=this.node.getNumberOfChars();d<f;d++){var e=this.node.getExtentOfChar(d);e.y<b.y&&(b.y=e.y);e.y+e.height-b.y>b.height&&(b.height=e.y+e.height-b.y);e.x+e.width-b.x>b.width&&(b.width=e.x+e.width-b.x)}}a&&this.hide();return b};u[p].attr=function(a,b){if(this.removed)return this;if(a==null){a={};for(var c in this.attrs)if(this.attrs[z](c))a[c]=this.attrs[c];this._.rt.deg&&(a.rotation=this.rotate());(this._.sx!=1||this._.sy!=
50
- 1)&&(a.scale=this.scale());a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient;return a}if(b==null&&m.is(a,ea)){if(a=="translation")return ya.call(this);if(a=="rotation")return this.rotate();if(a=="scale")return this.scale();if(a==aa&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[a]}if(b==null&&m.is(a,U)){b={};c=0;for(var d=a.length;c<d;c++)b[a[c]]=this.attr(a[c]);return b}if(b!=null){c={};c[a]=b;ba(this,c)}else a!=null&&m.is(a,"object")&&
51
- ba(this,a);return this};u[p].toFront=function(){if(this.removed)return this;this.node.parentNode[y](this.node);var a=this.paper;a.top!=this&&Ta(this,a);return this};u[p].toBack=function(){if(this.removed)return this;if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);Ua(this,this.paper)}return this};u[p].insertAfter=function(a){if(this.removed)return this;var b=a.node;b.nextSibling?b.parentNode.insertBefore(this.node,b.nextSibling):
52
- b.parentNode[y](this.node);Va(this,a,this.paper);return this};u[p].insertBefore=function(a){if(this.removed)return this;var b=a.node;b.parentNode.insertBefore(this.node,b);Wa(this,a,this.paper);return this};u[p].blur=function(a){var b=this;if(+a!==0){var c=v("filter"),d=v("feGaussianBlur");b.attrs.blur=a;c.id="r"+(m._id++)[N](36);v(d,{stdDeviation:+a||1.5});c.appendChild(d);b.paper.defs.appendChild(c);b._blur=c;v(b.node,{filter:"url(#"+c.id+")"})}else{if(b._blur){b._blur.parentNode.removeChild(b._blur);
53
- delete b._blur;delete b.attrs.blur}b.node.removeAttribute("filter")}};var ab=function(a,b,c,d){b=F(b);c=F(c);var f=v("circle");a.canvas&&a.canvas[y](f);a=new u(f,a);a.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"};a.type="circle";v(f,a.attrs);return a},bb=function(a,b,c,d,f,e){b=F(b);c=F(c);var g=v("rect");a.canvas&&a.canvas[y](g);a=new u(g,a);a.attrs={x:b,y:c,width:d,height:f,r:e||0,rx:e||0,ry:e||0,fill:"none",stroke:"#000"};a.type="rect";v(g,a.attrs);return a},cb=function(a,b,c,d,f){b=F(b);c=F(c);
54
- var e=v("ellipse");a.canvas&&a.canvas[y](e);a=new u(e,a);a.attrs={cx:b,cy:c,rx:d,ry:f,fill:"none",stroke:"#000"};a.type="ellipse";v(e,a.attrs);return a},db=function(a,b,c,d,f,e){var g=v("image");v(g,{x:c,y:d,width:f,height:e,preserveAspectRatio:"none"});g.setAttributeNS(a.xlink,"href",b);a.canvas&&a.canvas[y](g);a=new u(g,a);a.attrs={x:c,y:d,width:f,height:e,src:b};a.type="image";return a},eb=function(a,b,c,d){var f=v("text");v(f,{x:b,y:c,"text-anchor":"middle"});a.canvas&&a.canvas[y](f);a=new u(f,
55
- a);a.attrs={x:b,y:c,"text-anchor":"middle",text:d,font:qa.font,stroke:"none",fill:"#000"};a.type="text";ba(a,a.attrs);return a},fb=function(a,b){this.width=a||this.width;this.height=b||this.height;this.canvas[W]("width",this.width);this.canvas[W]("height",this.height);return this},Aa=function(){var a=Sa[K](0,arguments),b=a&&a.container,c=a.x,d=a.y,f=a.width;a=a.height;if(!b)throw new Error("SVG container not found.");var e=v("svg");c=c||0;d=d||0;f=f||512;a=a||342;v(e,{xmlns:"http://www.w3.org/2000/svg",
56
- version:1.1,width:f,height:a});if(b==1){e.style.cssText="position:absolute;left:"+c+"px;top:"+d+"px";C.body[y](e)}else b.firstChild?b.insertBefore(e,b.firstChild):b[y](e);b=new G;b.width=f;b.height=a;b.canvas=e;Fa.call(b,b,m.fn);b.clear();return b};G[p].clear=function(){for(var a=this.canvas;a.firstChild;)a.removeChild(a.firstChild);this.bottom=this.top=null;(this.desc=v("desc"))[y](C.createTextNode("Created with Rapha\u00ebl"));a[y](this.desc);a[y](this.defs=v("defs"))};G[p].remove=function(){this.canvas.parentNode&&
57
- this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=Xa(a)}}if(m.vml){var gb={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},zb=/([clmz]),?([^clmz]*)/gi,Ab=/-?[^,\s-]+/g,na=1000+P+1000,ja=10,oa={path:1,rect:1},Bb=function(a){var b=/[ahqstv]/ig,c=ka;(a+s).match(b)&&(c=ua);b=/[clmz]/g;if(c==ka&&!(a+s).match(b))return a=(a+s)[I](zb,function(i,j,l){var n=[],r=ca.call(j)=="m",q=gb[j];l[I](Ab,function(k){if(r&&n[o]==2){q+=n+gb[j=="m"?"l":"L"];n=[]}n[E](F(k*ja))});return q+n});b=c(a);
58
- var d;a=[];for(var f=0,e=b[o];f<e;f++){c=b[f];d=ca.call(b[f][0]);d=="z"&&(d="x");for(var g=1,h=c[o];g<h;g++)d+=F(c[g]*ja)+(g!=h-1?",":s);a[E](d)}return a[Q](P)};m[N]=function(){return"Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\u00ebl "+this.version};Za=function(a,b){var c=R("group");c.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px";c.coordsize=b.coordsize;c.coordorigin=b.coordorigin;var d=R("shape"),f=d.style;f.width=
59
- b.width+"px";f.height=b.height+"px";d.coordsize=na;d.coordorigin=b.coordorigin;c[y](d);d=new u(d,c,b);f={fill:"none",stroke:"#000"};a&&(f.path=a);d.isAbsolute=true;d.type="path";d.path=[];d.Path=s;ba(d,f);b.canvas[y](c);return d};ba=function(a,b){a.attrs=a.attrs||{};var c=a.node,d=a.attrs,f=c.style,e;e=(b.x!=d.x||b.y!=d.y||b.width!=d.width||b.height!=d.height||b.r!=d.r)&&a.type=="rect";var g=a;for(var h in b)if(b[z](h))d[h]=b[h];if(e){d.path=hb(d.x,d.y,d.width,d.height,d.r);a.X=d.x;a.Y=d.y;a.W=d.width;
60
- a.H=d.height}b.href&&(c.href=b.href);b.title&&(c.title=b.title);b.target&&(c.target=b.target);b.cursor&&(f.cursor=b.cursor);"blur"in b&&a.blur(b.blur);if(b.path&&a.type=="path"||e)c.path=Bb(d.path);b.rotation!=null&&a.rotate(b.rotation,true);if(b.translation){e=(b.translation+s)[H](V);ya.call(a,e[0],e[1]);if(a._.rt.cx!=null){a._.rt.cx+=+e[0];a._.rt.cy+=+e[1];a.setBox(a.attrs,e[0],e[1])}}if(b.scale){e=(b.scale+s)[H](V);a.scale(+e[0]||1,+e[1]||+e[0]||1,+e[2]||null,+e[3]||null)}if("clip-rect"in b){e=
61
- (b["clip-rect"]+s)[H](V);if(e[o]==4){e[2]=+e[2]+ +e[0];e[3]=+e[3]+ +e[1];h=c.clipRect||C.createElement("div");var i=h.style,j=c.parentNode;i.clip=m.format("rect({1}px {2}px {3}px {0}px)",e);if(!c.clipRect){i.position="absolute";i.top=0;i.left=0;i.width=a.paper.width+"px";i.height=a.paper.height+"px";j.parentNode.insertBefore(h,j);h[y](j);c.clipRect=h}}if(!b["clip-rect"])c.clipRect&&(c.clipRect.style.clip=s)}if(a.type=="image"&&b.src)c.src=b.src;if(a.type=="image"&&b.opacity){c.filterOpacity=Da+".Alpha(opacity="+
62
- b.opacity*100+")";f.filter=(c.filterMatrix||s)+(c.filterOpacity||s)}b.font&&(f.font=b.font);b["font-family"]&&(f.fontFamily='"'+b["font-family"][H](",")[0][I](/^['"]+|['"]+$/g,s)+'"');b["font-size"]&&(f.fontSize=b["font-size"]);b["font-weight"]&&(f.fontWeight=b["font-weight"]);b["font-style"]&&(f.fontStyle=b["font-style"]);if(b.opacity!=null||b["stroke-width"]!=null||b.fill!=null||b.stroke!=null||b["stroke-width"]!=null||b["stroke-opacity"]!=null||b["fill-opacity"]!=null||b["stroke-dasharray"]!=null||
63
- b["stroke-miterlimit"]!=null||b["stroke-linejoin"]!=null||b["stroke-linecap"]!=null){c=a.shape||c;f=c.getElementsByTagName(aa)&&c.getElementsByTagName(aa)[0];e=false;!f&&(e=f=R(aa));if("fill-opacity"in b||"opacity"in b){a=((+d["fill-opacity"]+1||2)-1)*((+d.opacity+1||2)-1)*((+m.getRGB(b.fill).o+1||2)-1);a<0&&(a=0);a>1&&(a=1);f.opacity=a}b.fill&&(f.on=true);if(f.on==null||b.fill=="none")f.on=false;if(f.on&&b.fill)if(a=b.fill.match(Na)){f.src=a[1];f.type="tile"}else{f.color=m.getRGB(b.fill).hex;f.src=
64
- s;f.type="solid";if(m.getRGB(b.fill).error&&(g.type in{circle:1,ellipse:1}||(b.fill+s).charAt()!="r")&&ma(g,b.fill)){d.fill="none";d.gradient=b.fill}}e&&c[y](f);f=c.getElementsByTagName("stroke")&&c.getElementsByTagName("stroke")[0];e=false;!f&&(e=f=R("stroke"));if(b.stroke&&b.stroke!="none"||b["stroke-width"]||b["stroke-opacity"]!=null||b["stroke-dasharray"]||b["stroke-miterlimit"]||b["stroke-linejoin"]||b["stroke-linecap"])f.on=true;(b.stroke=="none"||f.on==null||b.stroke==0||b["stroke-width"]==
65
- 0)&&(f.on=false);a=m.getRGB(b.stroke);f.on&&b.stroke&&(f.color=a.hex);a=((+d["stroke-opacity"]+1||2)-1)*((+d.opacity+1||2)-1)*((+a.o+1||2)-1);h=(A(b["stroke-width"])||1)*0.75;a<0&&(a=0);a>1&&(a=1);b["stroke-width"]==null&&(h=d["stroke-width"]);b["stroke-width"]&&(f.weight=h);h&&h<1&&(a*=h)&&(f.weight=1);f.opacity=a;b["stroke-linejoin"]&&(f.joinstyle=b["stroke-linejoin"]||"miter");f.miterlimit=b["stroke-miterlimit"]||8;b["stroke-linecap"]&&(f.endcap=b["stroke-linecap"]=="butt"?"flat":b["stroke-linecap"]==
66
- "square"?"square":"round");if(b["stroke-dasharray"]){a={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};f.dashstyle=a[z](b["stroke-dasharray"])?a[b["stroke-dasharray"]]:s}e&&c[y](f)}if(g.type=="text"){f=g.paper.span.style;d.font&&(f.font=d.font);d["font-family"]&&(f.fontFamily=d["font-family"]);d["font-size"]&&(f.fontSize=d["font-size"]);d["font-weight"]&&(f.fontWeight=d["font-weight"]);
67
- d["font-style"]&&(f.fontStyle=d["font-style"]);g.node.string&&(g.paper.span.innerHTML=(g.node.string+s)[I](/</g,"&#60;")[I](/&/g,"&#38;")[I](/\n/g,"<br>"));g.W=d.w=g.paper.span.offsetWidth;g.H=d.h=g.paper.span.offsetHeight;g.X=d.x;g.Y=d.y+F(g.H/2);switch(d["text-anchor"]){case "start":g.node.style["v-text-align"]="left";g.bbx=F(g.W/2);break;case "end":g.node.style["v-text-align"]="right";g.bbx=-F(g.W/2);break;default:g.node.style["v-text-align"]="center";break}}};ma=function(a,b){a.attrs=a.attrs||
68
- {};var c="linear",d=".5 .5";a.attrs.gradient=b;b=(b+s)[I](Ya,function(i,j,l){c="radial";if(j&&l){j=A(j);l=A(l);D(j-0.5,2)+D(l-0.5,2)>0.25&&(l=w.sqrt(0.25-D(j-0.5,2))*((l>0.5)*2-1)+0.5);d=j+P+l}return s});b=b[H](/\s*\-\s*/);if(c=="linear"){var f=b.shift();f=-A(f);if(isNaN(f))return null}var e=Ra(b);if(!e)return null;a=a.shape||a.node;b=a.getElementsByTagName(aa)[0]||R(aa);!b.parentNode&&a.appendChild(b);if(e[o]){b.on=true;b.method="none";b.color=e[0].color;b.color2=e[e[o]-1].color;a=[];for(var g=0,
69
- h=e[o];g<h;g++)e[g].offset&&a[E](e[g].offset+P+e[g].color);b.colors&&(b.colors.value=a[o]?a[Q]():"0% "+b.color);if(c=="radial"){b.type="gradientradial";b.focus="100%";b.focussize=d;b.focusposition=d}else{b.type="gradient";b.angle=(270-f)%360}}return 1};u=function(a,b,c){this[0]=a;this.id=m._oid++;this.node=a;a.raphael=this;this.Y=this.X=0;this.attrs={};this.Group=b;this.paper=c;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};!c.bottom&&(c.bottom=this);(this.prev=c.top)&&(c.top.next=this);c.top=this;this.next=
70
- null};u[p].rotate=function(a,b,c){if(this.removed)return this;if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][Q](P);return this._.rt.deg}a=(a+s)[H](V);if(a[o]-1){b=A(a[1]);c=A(a[2])}a=A(a[0]);if(b!=null)this._.rt.deg=a;else this._.rt.deg+=a;c==null&&(b=null);this._.rt.cx=b;this._.rt.cy=c;this.setBox(this.attrs,b,c);this.Group.style.rotation=this._.rt.deg;return this};u[p].setBox=function(a,b,c){if(this.removed)return this;var d=this.Group.style,f=this.shape&&this.shape.style||
71
- this.node.style;a=a||{};for(var e in a)if(a[z](e))this.attrs[e]=a[e];b=b||this._.rt.cx;c=c||this._.rt.cy;var g=this.attrs,h;switch(this.type){case "circle":a=g.cx-g.r;e=g.cy-g.r;h=g=g.r*2;break;case "ellipse":a=g.cx-g.rx;e=g.cy-g.ry;h=g.rx*2;g=g.ry*2;break;case "image":a=+g.x;e=+g.y;h=g.width||0;g=g.height||0;break;case "text":this.textpath.v=["m",F(g.x),", ",F(g.y-2),"l",F(g.x)+1,", ",F(g.y-2)][Q](s);a=g.x-F(this.W/2);e=g.y-this.H/2;h=this.W;g=this.H;break;case "rect":case "path":if(this.attrs.path){g=
72
- va(this.attrs.path);a=g.x;e=g.y;h=g.width;g=g.height}else{e=a=0;h=this.paper.width;g=this.paper.height}break;default:e=a=0;h=this.paper.width;g=this.paper.height;break}b=b==null?a+h/2:b;c=c==null?e+g/2:c;b=b-this.paper.width/2;c=c-this.paper.height/2;var i;d.left!=(i=b+"px")&&(d.left=i);d.top!=(i=c+"px")&&(d.top=i);this.X=oa[z](this.type)?-b:a;this.Y=oa[z](this.type)?-c:e;this.W=h;this.H=g;if(oa[z](this.type)){f.left!=(i=-b*ja+"px")&&(f.left=i);f.top!=(i=-c*ja+"px")&&(f.top=i)}else if(this.type==
73
- "text"){f.left!=(i=-b+"px")&&(f.left=i);f.top!=(i=-c+"px")&&(f.top=i)}else{d.width!=(i=this.paper.width+"px")&&(d.width=i);d.height!=(i=this.paper.height+"px")&&(d.height=i);f.left!=(i=a-b+"px")&&(f.left=i);f.top!=(i=e-c+"px")&&(f.top=i);f.width!=(i=h+"px")&&(f.width=i);f.height!=(i=g+"px")&&(f.height=i)}};u[p].hide=function(){!this.removed&&(this.Group.style.display="none");return this};u[p].show=function(){!this.removed&&(this.Group.style.display="block");return this};u[p].getBBox=function(){if(this.removed)return this;
74
- if(oa[z](this.type))return va(this.attrs.path);return{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}};u[p].remove=function(){if(!this.removed){ia(this,this.paper);this.node.parentNode.removeChild(this.node);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);for(var a in this)delete this[a];this.removed=true}};u[p].attr=function(a,b){if(this.removed)return this;if(a==null){a={};for(var c in this.attrs)if(this.attrs[z](c))a[c]=this.attrs[c];
75
- this._.rt.deg&&(a.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(a.scale=this.scale());a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient;return a}if(b==null&&m.is(a,ea)){if(a=="translation")return ya.call(this);if(a=="rotation")return this.rotate();if(a=="scale")return this.scale();if(a==aa&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[a]}if(this.attrs&&b==null&&m.is(a,U)){var d={};c=0;for(b=a[o];c<b;c++)d[a[c]]=this.attr(a[c]);
76
- return d}if(b!=null){d={};d[a]=b}b==null&&m.is(a,"object")&&(d=a);if(d){if(d.text&&this.type=="text")this.node.string=d.text;ba(this,d);if(d.gradient&&({circle:1,ellipse:1}[z](this.type)||(d.gradient+s).charAt()!="r"))ma(this,d.gradient);(!oa[z](this.type)||this._.rt.deg)&&this.setBox(this.attrs)}return this};u[p].toFront=function(){!this.removed&&this.Group.parentNode[y](this.Group);this.paper.top!=this&&Ta(this,this.paper);return this};u[p].toBack=function(){if(this.removed)return this;if(this.Group.parentNode.firstChild!=
77
- this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);Ua(this,this.paper)}return this};u[p].insertAfter=function(a){if(this.removed)return this;a.Group.nextSibling?a.Group.parentNode.insertBefore(this.Group,a.Group.nextSibling):a.Group.parentNode[y](this.Group);Va(this,a,this.paper);return this};u[p].insertBefore=function(a){if(this.removed)return this;a.Group.parentNode.insertBefore(this.Group,a.Group);Wa(this,a,this.paper);return this};var Cb=/ progid:\S+Blur\([^\)]+\)/g;
78
- u[p].blur=function(a){var b=this.node.style,c=b.filter;c=c.replace(Cb,"");if(+a!==0){this.attrs.blur=a;b.filter=c+Da+".Blur(pixelradius="+(+a||1.5)+")";b.margin=Raphael.format("-{0}px 0 0 -{0}px",Math.round(+a||1.5))}else{b.filter=c;b.margin=0;delete this.attrs.blur}};ab=function(a,b,c,d){var f=R("group"),e=R("oval");f.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";f.coordsize=na;f.coordorigin=a.coordorigin;f[y](e);e=new u(e,f,a);e.type="circle";ba(e,{stroke:"#000",
79
- fill:"none"});e.attrs.cx=b;e.attrs.cy=c;e.attrs.r=d;e.setBox({x:b-d,y:c-d,width:d*2,height:d*2});a.canvas[y](f);return e};function hb(a,b,c,d,f){return f?m.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z",a+f,b,c-f*2,f,-f,d-f*2,f*2-c,f*2-d):m.format("M{0},{1}l{2},0,0,{3},{4},0z",a,b,c,d,-c)}bb=function(a,b,c,d,f,e){var g=hb(b,c,d,f,e);a=a.path(g);var h=a.attrs;a.X=h.x=b;a.Y=h.y=c;a.W=h.width=d;a.H=h.height=f;h.r=e;h.path=
80
- g;a.type="rect";return a};cb=function(a,b,c,d,f){var e=R("group"),g=R("oval");e.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";e.coordsize=na;e.coordorigin=a.coordorigin;e[y](g);g=new u(g,e,a);g.type="ellipse";ba(g,{stroke:"#000"});g.attrs.cx=b;g.attrs.cy=c;g.attrs.rx=d;g.attrs.ry=f;g.setBox({x:b-d,y:c-f,width:d*2,height:f*2});a.canvas[y](e);return g};db=function(a,b,c,d,f,e){var g=R("group"),h=R("image");g.style.cssText="position:absolute;left:0;top:0;width:"+
81
- a.width+"px;height:"+a.height+"px";g.coordsize=na;g.coordorigin=a.coordorigin;h.src=b;g[y](h);h=new u(h,g,a);h.type="image";h.attrs.src=b;h.attrs.x=c;h.attrs.y=d;h.attrs.w=f;h.attrs.h=e;h.setBox({x:c,y:d,width:f,height:e});a.canvas[y](g);return h};eb=function(a,b,c,d){var f=R("group"),e=R("shape"),g=e.style,h=R("path"),i=R("textpath");f.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";f.coordsize=na;f.coordorigin=a.coordorigin;h.v=m.format("m{0},{1}l{2},{1}",
82
- F(b*10),F(c*10),F(b*10)+1);h.textpathok=true;g.width=a.width;g.height=a.height;i.string=d+s;i.on=true;e[y](i);e[y](h);f[y](e);g=new u(i,f,a);g.shape=e;g.textpath=h;g.type="text";g.attrs.text=d;g.attrs.x=b;g.attrs.y=c;g.attrs.w=1;g.attrs.h=1;ba(g,{font:qa.font,stroke:"none",fill:"#000"});g.setBox();a.canvas[y](f);return g};fb=function(a,b){var c=this.canvas.style;a==+a&&(a+="px");b==+b&&(b+="px");c.width=a;c.height=b;c.clip="rect(0 "+a+" "+b+" 0)";return this};var R;C.createStyleSheet().addRule(".rvml",
83
- "behavior:url(#default#VML)");try{!C.namespaces.rvml&&C.namespaces.add("rvml","urn:schemas-microsoft-com:vml");R=function(a){return C.createElement("<rvml:"+a+' class="rvml">')}}catch(Kb){R=function(a){return C.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}Aa=function(){var a=Sa[K](0,arguments),b=a.container,c=a.height,d=a.width,f=a.x;a=a.y;if(!b)throw new Error("VML container not found.");var e=new G,g=e.canvas=C.createElement("div"),h=g.style;f=f||0;a=a||0;d=d||512;
84
- c=c||342;d==+d&&(d+="px");c==+c&&(c+="px");e.width=1000;e.height=1000;e.coordsize=ja*1000+P+ja*1000;e.coordorigin="0 0";e.span=C.createElement("span");e.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";g[y](e.span);h.cssText=m.format("width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",d,c);if(b==1){C.body[y](g);h.left=f+"px";h.top=a+"px";h.position="absolute"}else b.firstChild?b.insertBefore(g,
85
- b.firstChild):b[y](g);Fa.call(e,e,m.fn);return e};G[p].clear=function(){this.canvas.innerHTML=s;this.span=C.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas[y](this.span);this.bottom=this.top=null};G[p].remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=Xa(a);return true}}G[p].safari=/^Apple|^Google/.test(X.navigator.vendor)&&(!(X.navigator.userAgent.indexOf("Version/4.0")+
86
- 1)||X.navigator.platform.slice(0,2)=="iP")?function(){var a=this.rect(-99,-99,this.width+99,this.height+99);X.setTimeout(function(){a.remove()})}:function(){};function Db(){this.returnValue=false}function Eb(){return this.originalEvent.preventDefault()}function Fb(){this.cancelBubble=true}function Gb(){return this.originalEvent.stopPropagation()}var Hb=function(){if(C.addEventListener)return function(a,b,c,d){var f=Ba&&Ca[b]?Ca[b]:b;function e(g){if(Ba&&Ca[z](b))for(var h=0,i=g.targetTouches&&g.targetTouches.length;h<
87
- i;h++)if(g.targetTouches[h].target==a){i=g;g=g.targetTouches[h];g.originalEvent=i;g.preventDefault=Eb;g.stopPropagation=Gb;break}return c.call(d,g)}a.addEventListener(f,e,false);return function(){a.removeEventListener(f,e,false);return true}};else if(C.attachEvent)return function(a,b,c,d){function f(g){g=g||X.event;g.preventDefault=g.preventDefault||Db;g.stopPropagation=g.stopPropagation||Fb;return c.call(d,g)}a.attachEvent("on"+b,f);function e(){a.detachEvent("on"+b,f);return true}return e}}();for(ha=
88
- Ma[o];ha--;)(function(a){m[a]=u[p][a]=function(b){if(m.is(b,"function")){this.events=this.events||[];this.events.push({name:a,f:b,unbind:Hb(this.shape||this.node||C,a,b,this)})}return this};m["un"+a]=u[p]["un"+a]=function(b){for(var c=this.events,d=c[o];d--;)if(c[d].name==a&&c[d].f==b){c[d].unbind();c.splice(d,1);!c.length&&delete this.events;return this}return this}})(Ma[ha]);u[p].hover=function(a,b){return this.mouseover(a).mouseout(b)};u[p].unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};
89
- u[p].drag=function(a,b,c){this._drag={};var d=this.mousedown(function(g){(g.originalEvent?g.originalEvent:g).preventDefault();this._drag.x=g.clientX;this._drag.y=g.clientY;this._drag.id=g.identifier;b&&b.call(this,g.clientX,g.clientY);Raphael.mousemove(f).mouseup(e)});function f(g){var h=g.clientX,i=g.clientY;if(Ba)for(var j=g.touches.length,l;j--;){l=g.touches[j];if(l.identifier==d._drag.id){h=l.clientX;i=l.clientY;(g.originalEvent?g.originalEvent:g).preventDefault();break}}else g.preventDefault();
90
- a&&a.call(d,h-d._drag.x,i-d._drag.y,h,i)}function e(){d._drag={};Raphael.unmousemove(f).unmouseup(e);c&&c.call(d)}return this};G[p].circle=function(a,b,c){return ab(this,a||0,b||0,c||0)};G[p].rect=function(a,b,c,d,f){return bb(this,a||0,b||0,c||0,d||0,f||0)};G[p].ellipse=function(a,b,c,d){return cb(this,a||0,b||0,c||0,d||0)};G[p].path=function(a){a&&!m.is(a,ea)&&!m.is(a[0],U)&&(a+=s);return Za(m.format[K](m,arguments),this)};G[p].image=function(a,b,c,d,f){return db(this,a||"about:blank",b||0,c||0,
91
- d||0,f||0)};G[p].text=function(a,b,c){return eb(this,a||0,b||0,c||s)};G[p].set=function(a){arguments[o]>1&&(a=Array[p].splice.call(arguments,0,arguments[o]));return new Z(a)};G[p].setSize=fb;G[p].top=G[p].bottom=null;G[p].raphael=m;function ib(){return this.x+P+this.y}u[p].resetScale=function(){if(this.removed)return this;this._.sx=1;this._.sy=1;this.attrs.scale="1 1"};u[p].scale=function(a,b,c,d){if(this.removed)return this;if(a==null&&b==null)return{x:this._.sx,y:this._.sy,toString:ib};b=b||a;!+b&&
92
- (b=a);var f,e,g=this.attrs;if(a!=0){var h=this.getBBox(),i=h.x+h.width/2,j=h.y+h.height/2;f=a/this._.sx;e=b/this._.sy;c=+c||c==0?c:i;d=+d||d==0?d:j;h=~~(a/w.abs(a));var l=~~(b/w.abs(b)),n=this.node.style,r=c+(i-c)*f;j=d+(j-d)*e;switch(this.type){case "rect":case "image":var q=g.width*h*f,k=g.height*l*e;this.attr({height:k,r:g.r*$(h*f,l*e),width:q,x:r-q/2,y:j-k/2});break;case "circle":case "ellipse":this.attr({rx:g.rx*h*f,ry:g.ry*l*e,r:g.r*$(h*f,l*e),cx:r,cy:j});break;case "text":this.attr({x:r,y:j});
93
- break;case "path":i=Oa(g.path);for(var t=true,L=0,B=i[o];L<B;L++){var x=i[L],J=pa.call(x[0]);if(!(J=="M"&&t)){t=false;if(J=="A"){x[i[L][o]-2]*=f;x[i[L][o]-1]*=e;x[1]*=h*f;x[2]*=l*e;x[5]=+!(h+l?!+x[5]:+x[5])}else if(J=="H"){J=1;for(var fa=x[o];J<fa;J++)x[J]*=f}else if(J=="V"){J=1;for(fa=x[o];J<fa;J++)x[J]*=e}else{J=1;for(fa=x[o];J<fa;J++)x[J]*=J%2?f:e}}}e=va(i);f=r-e.x-e.width/2;e=j-e.y-e.height/2;i[0][1]+=f;i[0][2]+=e;this.attr({path:i});break}if(this.type in{text:1,image:1}&&(h!=1||l!=1))if(this.transformations){this.transformations[2]=
94
- "scale("[M](h,",",l,")");this.node[W]("transform",this.transformations[Q](P));f=h==-1?-g.x-(q||0):g.x;e=l==-1?-g.y-(k||0):g.y;this.attr({x:f,y:e});g.fx=h-1;g.fy=l-1}else{this.node.filterMatrix=Da+".Matrix(M11="[M](h,", M12=0, M21=0, M22=",l,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");n.filter=(this.node.filterMatrix||s)+(this.node.filterOpacity||s)}else if(this.transformations){this.transformations[2]=s;this.node[W]("transform",this.transformations[Q](P));g.fx=0;g.fy=0}else{this.node.filterMatrix=
95
- s;n.filter=(this.node.filterMatrix||s)+(this.node.filterOpacity||s)}g.scale=[a,b,c,d][Q](P);this._.sx=a;this._.sy=b}return this};u[p].clone=function(){if(this.removed)return null;var a=this.attr();delete a.scale;delete a.translation;return this.paper[this.type]().attr(a)};var jb=T(function(a,b,c,d,f,e,g,h,i){for(var j=0,l,n=0;n<1.001;n+=0.0010){var r=m.findDotsAtSegment(a,b,c,d,f,e,g,h,n);n&&(j+=D(D(l.x-r.x,2)+D(l.y-r.y,2),0.5));if(j>=i)return r;l=r}});function Ha(a,b){return function(c,d,f){c=ua(c);
96
- for(var e,g,h,i,j="",l={},n=0,r=0,q=c.length;r<q;r++){h=c[r];if(h[0]=="M"){e=+h[1];g=+h[2]}else{i=Ib(e,g,h[1],h[2],h[3],h[4],h[5],h[6]);if(n+i>d){if(b&&!l.start){e=jb(e,g,h[1],h[2],h[3],h[4],h[5],h[6],d-n);j+=["C",e.start.x,e.start.y,e.m.x,e.m.y,e.x,e.y];if(f)return j;l.start=j;j=["M",e.x,e.y+"C",e.n.x,e.n.y,e.end.x,e.end.y,h[5],h[6]][Q]();n+=i;e=+h[5];g=+h[6];continue}if(!a&&!b){e=jb(e,g,h[1],h[2],h[3],h[4],h[5],h[6],d-n);return{x:e.x,y:e.y,alpha:e.alpha}}}n+=i;e=+h[5];g=+h[6]}j+=h}l.end=j;e=a?n:
97
- b?l:m.findDotsAtSegment(e,g,h[1],h[2],h[3],h[4],h[5],h[6],1);e.alpha&&(e={x:e.x,y:e.y,alpha:e.alpha});return e}}var Ib=T(function(a,b,c,d,f,e,g,h){for(var i={x:0,y:0},j=0,l=0;l<1.01;l+=0.01){var n=la(a,b,c,d,f,e,g,h,l);l&&(j+=D(D(i.x-n.x,2)+D(i.y-n.y,2),0.5));i=n}return j}),kb=Ha(1),za=Ha(),Ia=Ha(0,1);u[p].getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return kb(this.attrs.path)}};u[p].getPointAtLength=function(a){if(this.type=="path")return za(this.attrs.path,
98
- a)};u[p].getSubpath=function(a,b){if(this.type=="path"){if(w.abs(this.getTotalLength()-b)<1.0E-6)return Ia(this.attrs.path,a).end;b=Ia(this.attrs.path,b,1);return a?Ia(b,a).end:b}};m.easing_formulas={linear:function(a){return a},"<":function(a){return D(a,3)},">":function(a){return D(a-1,3)+1},"<>":function(a){a*=2;if(a<1)return D(a,3)/2;a-=2;return(D(a,3)+2)/2},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a-=1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==
99
- 0||a==1)return a;var b=0.3,c=b/4;return D(2,-10*a)*w.sin((a-c)*2*w.PI/b)+1},bounce:function(a){var b=7.5625,c=2.75;if(a<1/c)a=b*a*a;else if(a<2/c){a-=1.5/c;a=b*a*a+0.75}else if(a<2.5/c){a-=2.25/c;a=b*a*a+0.9375}else{a-=2.625/c;a=b*a*a+0.984375}return a}};var S={length:0};function lb(){var a=+new Date;for(var b in S)if(b!="length"&&S[z](b)){var c=S[b];if(c.stop||c.el.removed){delete S[b];S[o]--}else{var d=a-c.start,f=c.ms,e=c.easing,g=c.from,h=c.diff,i=c.to,j=c.t,l=c.prev||0,n=c.el,r=c.callback,q=
100
- {},k;if(d<f){r=m.easing_formulas[e]?m.easing_formulas[e](d/f):d/f;for(var t in g)if(g[z](t)){switch(Ea[t]){case "along":k=r*f*h[t];i.back&&(k=i.len-k);e=za(i[t],k);n.translate(h.sx-h.x||0,h.sy-h.y||0);h.x=e.x;h.y=e.y;n.translate(e.x-h.sx,e.y-h.sy);i.rot&&n.rotate(h.r+e.alpha,e.x,e.y);break;case O:k=+g[t]+r*f*h[t];break;case "colour":k="rgb("+[Ja(F(g[t].r+r*f*h[t].r)),Ja(F(g[t].g+r*f*h[t].g)),Ja(F(g[t].b+r*f*h[t].b))][Q](",")+")";break;case "path":k=[];e=0;for(var L=g[t][o];e<L;e++){k[e]=[g[t][e][0]];
101
- for(var B=1,x=g[t][e][o];B<x;B++)k[e][B]=+g[t][e][B]+r*f*h[t][e][B];k[e]=k[e][Q](P)}k=k[Q](P);break;case "csv":switch(t){case "translation":k=h[t][0]*(d-l);e=h[t][1]*(d-l);j.x+=k;j.y+=e;k=k+P+e;break;case "rotation":k=+g[t][0]+r*f*h[t][0];g[t][1]&&(k+=","+g[t][1]+","+g[t][2]);break;case "scale":k=[+g[t][0]+r*f*h[t][0],+g[t][1]+r*f*h[t][1],2 in i[t]?i[t][2]:s,3 in i[t]?i[t][3]:s][Q](P);break;case "clip-rect":k=[];for(e=4;e--;)k[e]=+g[t][e]+r*f*h[t][e];break}break}q[t]=k}n.attr(q);n._run&&n._run.call(n)}else{if(i.along){e=
102
- za(i.along,i.len*!i.back);n.translate(h.sx-(h.x||0)+e.x-h.sx,h.sy-(h.y||0)+e.y-h.sy);i.rot&&n.rotate(h.r+e.alpha,e.x,e.y)}(j.x||j.y)&&n.translate(-j.x,-j.y);i.scale&&(i.scale+=s);n.attr(i);delete S[b];S[o]--;n.in_animation=null;m.is(r,"function")&&r.call(n)}c.prev=d}}m.svg&&n&&n.paper&&n.paper.safari();S[o]&&X.setTimeout(lb)}function Ja(a){return Y($(a,255),0)}function ya(a,b){if(a==null)return{x:this._.tx,y:this._.ty,toString:ib};this._.tx+=+a;this._.ty+=+b;switch(this.type){case "circle":case "ellipse":this.attr({cx:+a+
103
- this.attrs.cx,cy:+b+this.attrs.cy});break;case "rect":case "image":case "text":this.attr({x:+a+this.attrs.x,y:+b+this.attrs.y});break;case "path":var c=Oa(this.attrs.path);c[0][1]+=+a;c[0][2]+=+b;this.attr({path:c});break}return this}u[p].animateWith=function(a,b,c,d,f){S[a.id]&&(b.start=S[a.id].start);return this.animate(b,c,d,f)};u[p].animateAlong=mb();u[p].animateAlongBack=mb(1);function mb(a){return function(b,c,d,f){var e={back:a};m.is(d,"function")?(f=d):(e.rot=d);b&&b.constructor==u&&(b=b.attrs.path);
104
- b&&(e.along=b);return this.animate(e,c,f)}}u[p].onAnimation=function(a){this._run=a||0;return this};u[p].animate=function(a,b,c,d){if(m.is(c,"function")||!c)d=c||null;var f={},e={},g={};for(var h in a)if(a[z](h))if(Ea[z](h)){f[h]=this.attr(h);f[h]==null&&(f[h]=qa[h]);e[h]=a[h];switch(Ea[h]){case "along":var i=kb(a[h]),j=za(a[h],i*!!a.back),l=this.getBBox();g[h]=i/b;g.tx=l.x;g.ty=l.y;g.sx=j.x;g.sy=j.y;e.rot=a.rot;e.back=a.back;e.len=i;a.rot&&(g.r=A(this.rotate())||0);break;case O:g[h]=(e[h]-f[h])/
105
- b;break;case "colour":f[h]=m.getRGB(f[h]);i=m.getRGB(e[h]);g[h]={r:(i.r-f[h].r)/b,g:(i.g-f[h].g)/b,b:(i.b-f[h].b)/b};break;case "path":i=ua(f[h],e[h]);f[h]=i[0];j=i[1];g[h]=[];i=0;for(l=f[h][o];i<l;i++){g[h][i]=[0];for(var n=1,r=f[h][i][o];n<r;n++)g[h][i][n]=(j[i][n]-f[h][i][n])/b}break;case "csv":j=(a[h]+s)[H](V);i=(f[h]+s)[H](V);switch(h){case "translation":f[h]=[0,0];g[h]=[j[0]/b,j[1]/b];break;case "rotation":f[h]=i[1]==j[1]&&i[2]==j[2]?i:[0,j[1],j[2]];g[h]=[(j[0]-f[h][0])/b,0,0];break;case "scale":a[h]=
106
- j;f[h]=(f[h]+s)[H](V);g[h]=[(j[0]-f[h][0])/b,(j[1]-f[h][1])/b,0,0];break;case "clip-rect":f[h]=(f[h]+s)[H](V);g[h]=[];for(i=4;i--;)g[h][i]=(j[i]-f[h][i])/b;break}e[h]=j}}this.stop();this.in_animation=1;S[this.id]={start:a.start||+new Date,ms:b,easing:c,from:f,diff:g,to:e,el:this,callback:d,t:{x:0,y:0}};++S[o]==1&&lb();return this};u[p].stop=function(){S[this.id]&&S[o]--;delete S[this.id];return this};u[p].translate=function(a,b){return this.attr({translation:a+" "+b})};u[p][N]=function(){return"Rapha\u00ebl\u2019s object"};
107
- m.ae=S;function Z(a){this.items=[];this[o]=0;this.type="set";if(a)for(var b=0,c=a[o];b<c;b++)if(a[b]&&(a[b].constructor==u||a[b].constructor==Z)){this[this.items[o]]=this.items[this.items[o]]=a[b];this[o]++}}Z[p][E]=function(){for(var a,b,c=0,d=arguments[o];c<d;c++)if((a=arguments[c])&&(a.constructor==u||a.constructor==Z)){b=this.items[o];this[b]=this.items[b]=a;this[o]++}return this};Z[p].pop=function(){delete this[this[o]--];return this.items.pop()};for(var Ka in u[p])if(u[p][z](Ka))Z[p][Ka]=function(a){return function(){for(var b=
108
- 0,c=this.items[o];b<c;b++)this.items[b][a][K](this.items[b],arguments);return this}}(Ka);Z[p].attr=function(a,b){if(a&&m.is(a,U)&&m.is(a[0],"object")){b=0;for(var c=a[o];b<c;b++)this.items[b].attr(a[b])}else{c=0;for(var d=this.items[o];c<d;c++)this.items[c].attr(a,b)}return this};Z[p].animate=function(a,b,c,d){(m.is(c,"function")||!c)&&(d=c||null);var f=this.items[o],e=f,g,h=this,i;d&&(i=function(){!--f&&d.call(h)});c=m.is(c,ea)?c:i;for(g=this.items[--e].animate(a,b,c,i);e--;)this.items[e].animateWith(g,
109
- a,b,c,i);return this};Z[p].insertAfter=function(a){for(var b=this.items[o];b--;)this.items[b].insertAfter(a);return this};Z[p].getBBox=function(){for(var a=[],b=[],c=[],d=[],f=this.items[o];f--;){var e=this.items[f].getBBox();a[E](e.x);b[E](e.y);c[E](e.x+e.width);d[E](e.y+e.height)}a=$[K](0,a);b=$[K](0,b);return{x:a,y:b,width:Y[K](0,c)-a,height:Y[K](0,d)-b}};Z[p].clone=function(a){a=new Z;for(var b=0,c=this.items[o];b<c;b++)a[E](this.items[b].clone());return a};m.registerFont=function(a){if(!a.face)return a;
110
- this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)if(a.face[z](d))b.face[d]=a.face[d];if(this.fonts[c])this.fonts[c][E](b);else this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=da(a.face["units-per-em"],10);for(var f in a.glyphs)if(a.glyphs[z](f)){c=a.glyphs[f];b.glyphs[f]={w:c.w,k:{},d:c.d&&"M"+c.d[I](/[mlcxtrv]/g,function(g){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[g]||"M"})+"z"};if(c.k)for(var e in c.k)if(c[z](e))b.glyphs[f].k[e]=c.k[e]}}return a};
111
- G[p].getFont=function(a,b,c,d){d=d||"normal";c=c||"normal";b=+b||{normal:400,bold:700,lighter:300,bolder:800}[b]||400;if(m.fonts){var f=m.fonts[a];if(!f){a=new RegExp("(^|\\s)"+a[I](/[^\w\d\s+!~.:_-]/g,s)+"(\\s|$)","i");for(var e in m.fonts)if(m.fonts[z](e))if(a.test(e)){f=m.fonts[e];break}}var g;if(f){e=0;for(a=f[o];e<a;e++){g=f[e];if(g.face["font-weight"]==b&&(g.face["font-style"]==c||!g.face["font-style"])&&g.face["font-stretch"]==d)break}}return g}};G[p].print=function(a,b,c,d,f,e){e=e||"middle";
112
- var g=this.set(),h=(c+s)[H](s),i=0;m.is(d,c)&&(d=this.getFont(d));if(d){c=(f||16)/d.face["units-per-em"];var j=d.face.bbox.split(V);f=+j[0];e=+j[1]+(e=="baseline"?j[3]-j[1]+ +d.face.descent:(j[3]-j[1])/2);j=0;for(var l=h[o];j<l;j++){var n=j&&d.glyphs[h[j-1]]||{},r=d.glyphs[h[j]];i+=j?(n.w||d.w)+(n.k&&n.k[h[j]]||0):0;r&&r.d&&g[E](this.path(r.d).attr({fill:"#000",stroke:"none",translation:[i,0]}))}g.scale(c,c,f,e).translate(a-f,b-e)}return g};var Jb=/\{(\d+)\}/g;m.format=function(a,b){var c=m.is(b,
113
- U)?[0][M](b):arguments;a&&m.is(a,ea)&&c[o]-1&&(a=a[I](Jb,function(d,f){return c[++f]==null?s:c[f]}));return a||s};m.ninja=function(){La.was?(Raphael=La.is):delete Raphael;return m};m.el=u[p];return m}();
@@ -1,3395 +0,0 @@
1
- /*!
2
- * Raphael 1.4.3 - JavaScript Vector Library
3
- *
4
- * Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
5
- * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
6
- */
7
-
8
- Raphael = (function () {
9
- function R() {
10
- if (R.is(arguments[0], array)) {
11
- var a = arguments[0],
12
- cnv = create[apply](R, a.splice(0, 3 + R.is(a[0], nu))),
13
- res = cnv.set();
14
- for (var i = 0, ii = a[length]; i < ii; i++) {
15
- var j = a[i] || {};
16
- elements.test(j.type) && res[push](cnv[j.type]().attr(j));
17
- }
18
- return res;
19
- }
20
- return create[apply](R, arguments);
21
- }
22
- R.version = "1.4.3";
23
- var separator = /[, ]+/,
24
- elements = /^(circle|rect|path|ellipse|text|image)$/,
25
- proto = "prototype",
26
- has = "hasOwnProperty",
27
- doc = document,
28
- win = window,
29
- oldRaphael = {
30
- was: Object[proto][has].call(win, "Raphael"),
31
- is: win.Raphael
32
- },
33
- Paper = function () {},
34
- appendChild = "appendChild",
35
- apply = "apply",
36
- concat = "concat",
37
- supportsTouch = "createTouch" in doc,
38
- E = "",
39
- S = " ",
40
- split = "split",
41
- events = "click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[split](S),
42
- touchMap = {
43
- mousedown: "touchstart",
44
- mousemove: "touchmove",
45
- mouseup: "touchend"
46
- },
47
- join = "join",
48
- length = "length",
49
- lowerCase = String[proto].toLowerCase,
50
- math = Math,
51
- mmax = math.max,
52
- mmin = math.min,
53
- nu = "number",
54
- string = "string",
55
- array = "array",
56
- toString = "toString",
57
- fillString = "fill",
58
- objectToString = Object[proto][toString],
59
- paper = {},
60
- pow = math.pow,
61
- push = "push",
62
- rg = /^(?=[\da-f]$)/,
63
- ISURL = /^url\(['"]?([^\)]+?)['"]?\)$/i,
64
- colourRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+(?:\s*,\s*[\d\.]+)?)\s*\)|rgba?\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%(?:\s*,\s*[\d\.]+%))\s*\)|hs[bl]\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hs[bl]\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,
65
- round = math.round,
66
- setAttribute = "setAttribute",
67
- toFloat = parseFloat,
68
- toInt = parseInt,
69
- ms = " progid:DXImageTransform.Microsoft",
70
- upperCase = String[proto].toUpperCase,
71
- availableAttrs = {blur: 0, "clip-rect": "0 0 1e9 1e9", cursor: "default", cx: 0, cy: 0, fill: "#fff", "fill-opacity": 1, font: '10px "Arial"', "font-family": '"Arial"', "font-size": "10", "font-style": "normal", "font-weight": 400, gradient: 0, height: 0, href: "http://raphaeljs.com/", opacity: 1, path: "M0,0", r: 0, rotation: 0, rx: 0, ry: 0, scale: "1 1", src: "", stroke: "#000", "stroke-dasharray": "", "stroke-linecap": "butt", "stroke-linejoin": "butt", "stroke-miterlimit": 0, "stroke-opacity": 1, "stroke-width": 1, target: "_blank", "text-anchor": "middle", title: "Raphael", translation: "0 0", width: 0, x: 0, y: 0},
72
- availableAnimAttrs = {along: "along", blur: nu, "clip-rect": "csv", cx: nu, cy: nu, fill: "colour", "fill-opacity": nu, "font-size": nu, height: nu, opacity: nu, path: "path", r: nu, rotation: "csv", rx: nu, ry: nu, scale: "csv", stroke: "colour", "stroke-opacity": nu, "stroke-width": nu, translation: "csv", width: nu, x: nu, y: nu},
73
- rp = "replace";
74
- R.type = (win.SVGAngle || doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") ? "SVG" : "VML");
75
- if (R.type == "VML") {
76
- var d = doc.createElement("div");
77
- d.innerHTML = '<!--[if vml]><br><br><![endif]-->';
78
- if (d.childNodes[length] != 2) {
79
- return R.type = null;
80
- }
81
- d = null;
82
- }
83
- R.svg = !(R.vml = R.type == "VML");
84
- Paper[proto] = R[proto];
85
- R._id = 0;
86
- R._oid = 0;
87
- R.fn = {};
88
- R.is = function (o, type) {
89
- type = lowerCase.call(type);
90
- return (type == "object" && o === Object(o)) ||
91
- (type == "undefined" && typeof o == type) ||
92
- (type == "null" && o == null) ||
93
- lowerCase.call(objectToString.call(o).slice(8, -1)) == type;
94
- };
95
-
96
- R.setWindow = function (newwin) {
97
- win = newwin;
98
- doc = win.document;
99
- };
100
- // colour utilities
101
- var toHex = function (color) {
102
- if (R.vml) {
103
- // http://dean.edwards.name/weblog/2009/10/convert-any-colour-value-to-hex-in-msie/
104
- var trim = /^\s+|\s+$/g;
105
- toHex = cacher(function (color) {
106
- var bod;
107
- color = (color + E)[rp](trim, E);
108
- try {
109
- var docum = new win.ActiveXObject("htmlfile");
110
- docum.write("<body>");
111
- docum.close();
112
- bod = docum.body;
113
- } catch(e) {
114
- bod = win.createPopup().document.body;
115
- }
116
- var range = bod.createTextRange();
117
- try {
118
- bod.style.color = color;
119
- var value = range.queryCommandValue("ForeColor");
120
- value = ((value & 255) << 16) | (value & 65280) | ((value & 16711680) >>> 16);
121
- return "#" + ("000000" + value[toString](16)).slice(-6);
122
- } catch(e) {
123
- return "none";
124
- }
125
- });
126
- } else {
127
- var i = doc.createElement("i");
128
- i.title = "Rapha\xebl Colour Picker";
129
- i.style.display = "none";
130
- doc.body[appendChild](i);
131
- toHex = cacher(function (color) {
132
- i.style.color = color;
133
- return doc.defaultView.getComputedStyle(i, E).getPropertyValue("color");
134
- });
135
- }
136
- return toHex(color);
137
- };
138
- var hsbtoString = function () {
139
- return "hsb(" + [this.h, this.s, this.b] + ")";
140
- },
141
- rgbtoString = function () {
142
- return this.hex;
143
- };
144
- R.hsb2rgb = cacher(function (hue, saturation, brightness) {
145
- if (R.is(hue, "object") && "h" in hue && "s" in hue && "b" in hue) {
146
- brightness = hue.b;
147
- saturation = hue.s;
148
- hue = hue.h;
149
- }
150
- var red,
151
- green,
152
- blue;
153
- if (brightness == 0) {
154
- return {r: 0, g: 0, b: 0, hex: "#000"};
155
- }
156
- if (hue > 1 || saturation > 1 || brightness > 1) {
157
- hue /= 255;
158
- saturation /= 255;
159
- brightness /= 255;
160
- }
161
- var i = ~~(hue * 6),
162
- f = (hue * 6) - i,
163
- p = brightness * (1 - saturation),
164
- q = brightness * (1 - (saturation * f)),
165
- t = brightness * (1 - (saturation * (1 - f)));
166
- red = [brightness, q, p, p, t, brightness, brightness][i];
167
- green = [t, brightness, brightness, q, p, p, t][i];
168
- blue = [p, p, t, brightness, brightness, q, p][i];
169
- red *= 255;
170
- green *= 255;
171
- blue *= 255;
172
- var rgb = {r: red, g: green, b: blue, toString: rgbtoString},
173
- r = (~~red)[toString](16),
174
- g = (~~green)[toString](16),
175
- b = (~~blue)[toString](16);
176
- r = r[rp](rg, "0");
177
- g = g[rp](rg, "0");
178
- b = b[rp](rg, "0");
179
- rgb.hex = "#" + r + g + b;
180
- return rgb;
181
- }, R);
182
- R.rgb2hsb = cacher(function (red, green, blue) {
183
- if (R.is(red, "object") && "r" in red && "g" in red && "b" in red) {
184
- blue = red.b;
185
- green = red.g;
186
- red = red.r;
187
- }
188
- if (R.is(red, string)) {
189
- var clr = R.getRGB(red);
190
- red = clr.r;
191
- green = clr.g;
192
- blue = clr.b;
193
- }
194
- if (red > 1 || green > 1 || blue > 1) {
195
- red /= 255;
196
- green /= 255;
197
- blue /= 255;
198
- }
199
- var max = mmax(red, green, blue),
200
- min = mmin(red, green, blue),
201
- hue,
202
- saturation,
203
- brightness = max;
204
- if (min == max) {
205
- return {h: 0, s: 0, b: max};
206
- } else {
207
- var delta = (max - min);
208
- saturation = delta / max;
209
- if (red == max) {
210
- hue = (green - blue) / delta;
211
- } else if (green == max) {
212
- hue = 2 + ((blue - red) / delta);
213
- } else {
214
- hue = 4 + ((red - green) / delta);
215
- }
216
- hue /= 6;
217
- hue < 0 && hue++;
218
- hue > 1 && hue--;
219
- }
220
- return {h: hue, s: saturation, b: brightness, toString: hsbtoString};
221
- }, R);
222
- var p2s = /,?([achlmqrstvxz]),?/gi,
223
- commaSpaces = /\s*,\s*/,
224
- hsrg = {hs: 1, rg: 1};
225
- R._path2string = function () {
226
- return this.join(",")[rp](p2s, "$1");
227
- };
228
- function cacher(f, scope, postprocessor) {
229
- function newf() {
230
- var arg = Array[proto].slice.call(arguments, 0),
231
- args = arg[join]("\u25ba"),
232
- cache = newf.cache = newf.cache || {},
233
- count = newf.count = newf.count || [];
234
- if (cache[has](args)) {
235
- return postprocessor ? postprocessor(cache[args]) : cache[args];
236
- }
237
- count[length] >= 1e3 && delete cache[count.shift()];
238
- count[push](args);
239
- cache[args] = f[apply](scope, arg);
240
- return postprocessor ? postprocessor(cache[args]) : cache[args];
241
- }
242
- return newf;
243
- }
244
-
245
- R.getRGB = cacher(function (colour) {
246
- if (!colour || !!((colour = colour + E).indexOf("-") + 1)) {
247
- return {r: -1, g: -1, b: -1, hex: "none", error: 1};
248
- }
249
- if (colour == "none") {
250
- return {r: -1, g: -1, b: -1, hex: "none"};
251
- }
252
- !(hsrg[has](colour.substring(0, 2)) || colour.charAt() == "#") && (colour = toHex(colour));
253
- var res,
254
- red,
255
- green,
256
- blue,
257
- opacity,
258
- t,
259
- rgb = colour.match(colourRegExp);
260
- if (rgb) {
261
- if (rgb[2]) {
262
- blue = toInt(rgb[2].substring(5), 16);
263
- green = toInt(rgb[2].substring(3, 5), 16);
264
- red = toInt(rgb[2].substring(1, 3), 16);
265
- }
266
- if (rgb[3]) {
267
- blue = toInt((t = rgb[3].charAt(3)) + t, 16);
268
- green = toInt((t = rgb[3].charAt(2)) + t, 16);
269
- red = toInt((t = rgb[3].charAt(1)) + t, 16);
270
- }
271
- if (rgb[4]) {
272
- rgb = rgb[4][split](commaSpaces);
273
- red = toFloat(rgb[0]);
274
- green = toFloat(rgb[1]);
275
- blue = toFloat(rgb[2]);
276
- opacity = toFloat(rgb[3]);
277
- }
278
- if (rgb[5]) {
279
- rgb = rgb[5][split](commaSpaces);
280
- red = toFloat(rgb[0]) * 2.55;
281
- green = toFloat(rgb[1]) * 2.55;
282
- blue = toFloat(rgb[2]) * 2.55;
283
- opacity = toFloat(rgb[3]);
284
- }
285
- if (rgb[6]) {
286
- rgb = rgb[6][split](commaSpaces);
287
- red = toFloat(rgb[0]);
288
- green = toFloat(rgb[1]);
289
- blue = toFloat(rgb[2]);
290
- return R.hsb2rgb(red, green, blue);
291
- }
292
- if (rgb[7]) {
293
- rgb = rgb[7][split](commaSpaces);
294
- red = toFloat(rgb[0]) * 2.55;
295
- green = toFloat(rgb[1]) * 2.55;
296
- blue = toFloat(rgb[2]) * 2.55;
297
- return R.hsb2rgb(red, green, blue);
298
- }
299
- rgb = {r: red, g: green, b: blue};
300
- var r = (~~red)[toString](16),
301
- g = (~~green)[toString](16),
302
- b = (~~blue)[toString](16);
303
- r = r[rp](rg, "0");
304
- g = g[rp](rg, "0");
305
- b = b[rp](rg, "0");
306
- rgb.hex = "#" + r + g + b;
307
- isFinite(toFloat(opacity)) && (rgb.o = opacity);
308
- return rgb;
309
- }
310
- return {r: -1, g: -1, b: -1, hex: "none", error: 1};
311
- }, R);
312
- R.getColor = function (value) {
313
- var start = this.getColor.start = this.getColor.start || {h: 0, s: 1, b: value || .75},
314
- rgb = this.hsb2rgb(start.h, start.s, start.b);
315
- start.h += .075;
316
- if (start.h > 1) {
317
- start.h = 0;
318
- start.s -= .2;
319
- start.s <= 0 && (this.getColor.start = {h: 0, s: 1, b: start.b});
320
- }
321
- return rgb.hex;
322
- };
323
- R.getColor.reset = function () {
324
- delete this.start;
325
- };
326
- // path utilities
327
- var pathCommand = /([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,
328
- pathValues = /(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig;
329
- R.parsePathString = cacher(function (pathString) {
330
- if (!pathString) {
331
- return null;
332
- }
333
- var paramCounts = {a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0},
334
- data = [];
335
- if (R.is(pathString, array) && R.is(pathString[0], array)) { // rough assumption
336
- data = pathClone(pathString);
337
- }
338
- if (!data[length]) {
339
- (pathString + E)[rp](pathCommand, function (a, b, c) {
340
- var params = [],
341
- name = lowerCase.call(b);
342
- c[rp](pathValues, function (a, b) {
343
- b && params[push](+b);
344
- });
345
- if (name == "m" && params[length] > 2) {
346
- data[push]([b][concat](params.splice(0, 2)));
347
- name = "l";
348
- b = b == "m" ? "l" : "L";
349
- }
350
- while (params[length] >= paramCounts[name]) {
351
- data[push]([b][concat](params.splice(0, paramCounts[name])));
352
- if (!paramCounts[name]) {
353
- break;
354
- }
355
- }
356
- });
357
- }
358
- data[toString] = R._path2string;
359
- return data;
360
- });
361
- R.findDotsAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
362
- var t1 = 1 - t,
363
- x = pow(t1, 3) * p1x + pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + pow(t, 3) * p2x,
364
- y = pow(t1, 3) * p1y + pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + pow(t, 3) * p2y,
365
- mx = p1x + 2 * t * (c1x - p1x) + t * t * (c2x - 2 * c1x + p1x),
366
- my = p1y + 2 * t * (c1y - p1y) + t * t * (c2y - 2 * c1y + p1y),
367
- nx = c1x + 2 * t * (c2x - c1x) + t * t * (p2x - 2 * c2x + c1x),
368
- ny = c1y + 2 * t * (c2y - c1y) + t * t * (p2y - 2 * c2y + c1y),
369
- ax = (1 - t) * p1x + t * c1x,
370
- ay = (1 - t) * p1y + t * c1y,
371
- cx = (1 - t) * c2x + t * p2x,
372
- cy = (1 - t) * c2y + t * p2y,
373
- alpha = (90 - math.atan((mx - nx) / (my - ny)) * 180 / math.PI);
374
- (mx > nx || my < ny) && (alpha += 180);
375
- return {x: x, y: y, m: {x: mx, y: my}, n: {x: nx, y: ny}, start: {x: ax, y: ay}, end: {x: cx, y: cy}, alpha: alpha};
376
- };
377
- var pathDimensions = cacher(function (path) {
378
- if (!path) {
379
- return {x: 0, y: 0, width: 0, height: 0};
380
- }
381
- path = path2curve(path);
382
- var x = 0,
383
- y = 0,
384
- X = [],
385
- Y = [],
386
- p;
387
- for (var i = 0, ii = path[length]; i < ii; i++) {
388
- p = path[i];
389
- if (p[0] == "M") {
390
- x = p[1];
391
- y = p[2];
392
- X[push](x);
393
- Y[push](y);
394
- } else {
395
- var dim = curveDim(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
396
- X = X[concat](dim.min.x, dim.max.x);
397
- Y = Y[concat](dim.min.y, dim.max.y);
398
- x = p[5];
399
- y = p[6];
400
- }
401
- }
402
- var xmin = mmin[apply](0, X),
403
- ymin = mmin[apply](0, Y);
404
- return {
405
- x: xmin,
406
- y: ymin,
407
- width: mmax[apply](0, X) - xmin,
408
- height: mmax[apply](0, Y) - ymin
409
- };
410
- }),
411
- pathClone = function (pathArray) {
412
- var res = [];
413
- if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption
414
- pathArray = R.parsePathString(pathArray);
415
- }
416
- for (var i = 0, ii = pathArray[length]; i < ii; i++) {
417
- res[i] = [];
418
- for (var j = 0, jj = pathArray[i][length]; j < jj; j++) {
419
- res[i][j] = pathArray[i][j];
420
- }
421
- }
422
- res[toString] = R._path2string;
423
- return res;
424
- },
425
- pathToRelative = cacher(function (pathArray) {
426
- if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption
427
- pathArray = R.parsePathString(pathArray);
428
- }
429
- var res = [],
430
- x = 0,
431
- y = 0,
432
- mx = 0,
433
- my = 0,
434
- start = 0;
435
- if (pathArray[0][0] == "M") {
436
- x = pathArray[0][1];
437
- y = pathArray[0][2];
438
- mx = x;
439
- my = y;
440
- start++;
441
- res[push](["M", x, y]);
442
- }
443
- for (var i = start, ii = pathArray[length]; i < ii; i++) {
444
- var r = res[i] = [],
445
- pa = pathArray[i];
446
- if (pa[0] != lowerCase.call(pa[0])) {
447
- r[0] = lowerCase.call(pa[0]);
448
- switch (r[0]) {
449
- case "a":
450
- r[1] = pa[1];
451
- r[2] = pa[2];
452
- r[3] = pa[3];
453
- r[4] = pa[4];
454
- r[5] = pa[5];
455
- r[6] = +(pa[6] - x).toFixed(3);
456
- r[7] = +(pa[7] - y).toFixed(3);
457
- break;
458
- case "v":
459
- r[1] = +(pa[1] - y).toFixed(3);
460
- break;
461
- case "m":
462
- mx = pa[1];
463
- my = pa[2];
464
- default:
465
- for (var j = 1, jj = pa[length]; j < jj; j++) {
466
- r[j] = +(pa[j] - ((j % 2) ? x : y)).toFixed(3);
467
- }
468
- }
469
- } else {
470
- r = res[i] = [];
471
- if (pa[0] == "m") {
472
- mx = pa[1] + x;
473
- my = pa[2] + y;
474
- }
475
- for (var k = 0, kk = pa[length]; k < kk; k++) {
476
- res[i][k] = pa[k];
477
- }
478
- }
479
- var len = res[i][length];
480
- switch (res[i][0]) {
481
- case "z":
482
- x = mx;
483
- y = my;
484
- break;
485
- case "h":
486
- x += +res[i][len - 1];
487
- break;
488
- case "v":
489
- y += +res[i][len - 1];
490
- break;
491
- default:
492
- x += +res[i][len - 2];
493
- y += +res[i][len - 1];
494
- }
495
- }
496
- res[toString] = R._path2string;
497
- return res;
498
- }, 0, pathClone),
499
- pathToAbsolute = cacher(function (pathArray) {
500
- if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption
501
- pathArray = R.parsePathString(pathArray);
502
- }
503
- var res = [],
504
- x = 0,
505
- y = 0,
506
- mx = 0,
507
- my = 0,
508
- start = 0;
509
- if (pathArray[0][0] == "M") {
510
- x = +pathArray[0][1];
511
- y = +pathArray[0][2];
512
- mx = x;
513
- my = y;
514
- start++;
515
- res[0] = ["M", x, y];
516
- }
517
- for (var i = start, ii = pathArray[length]; i < ii; i++) {
518
- var r = res[i] = [],
519
- pa = pathArray[i];
520
- if (pa[0] != upperCase.call(pa[0])) {
521
- r[0] = upperCase.call(pa[0]);
522
- switch (r[0]) {
523
- case "A":
524
- r[1] = pa[1];
525
- r[2] = pa[2];
526
- r[3] = pa[3];
527
- r[4] = pa[4];
528
- r[5] = pa[5];
529
- r[6] = +(pa[6] + x);
530
- r[7] = +(pa[7] + y);
531
- break;
532
- case "V":
533
- r[1] = +pa[1] + y;
534
- break;
535
- case "H":
536
- r[1] = +pa[1] + x;
537
- break;
538
- case "M":
539
- mx = +pa[1] + x;
540
- my = +pa[2] + y;
541
- default:
542
- for (var j = 1, jj = pa[length]; j < jj; j++) {
543
- r[j] = +pa[j] + ((j % 2) ? x : y);
544
- }
545
- }
546
- } else {
547
- for (var k = 0, kk = pa[length]; k < kk; k++) {
548
- res[i][k] = pa[k];
549
- }
550
- }
551
- switch (r[0]) {
552
- case "Z":
553
- x = mx;
554
- y = my;
555
- break;
556
- case "H":
557
- x = r[1];
558
- break;
559
- case "V":
560
- y = r[1];
561
- break;
562
- default:
563
- x = res[i][res[i][length] - 2];
564
- y = res[i][res[i][length] - 1];
565
- }
566
- }
567
- res[toString] = R._path2string;
568
- return res;
569
- }, null, pathClone),
570
- l2c = function (x1, y1, x2, y2) {
571
- return [x1, y1, x2, y2, x2, y2];
572
- },
573
- q2c = function (x1, y1, ax, ay, x2, y2) {
574
- var _13 = 1 / 3,
575
- _23 = 2 / 3;
576
- return [
577
- _13 * x1 + _23 * ax,
578
- _13 * y1 + _23 * ay,
579
- _13 * x2 + _23 * ax,
580
- _13 * y2 + _23 * ay,
581
- x2,
582
- y2
583
- ];
584
- },
585
- a2c = function (x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {
586
- // for more information of where this math came from visit:
587
- // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
588
- var PI = math.PI,
589
- _120 = PI * 120 / 180,
590
- rad = PI / 180 * (+angle || 0),
591
- res = [],
592
- xy,
593
- rotate = cacher(function (x, y, rad) {
594
- var X = x * math.cos(rad) - y * math.sin(rad),
595
- Y = x * math.sin(rad) + y * math.cos(rad);
596
- return {x: X, y: Y};
597
- });
598
- if (!recursive) {
599
- xy = rotate(x1, y1, -rad);
600
- x1 = xy.x;
601
- y1 = xy.y;
602
- xy = rotate(x2, y2, -rad);
603
- x2 = xy.x;
604
- y2 = xy.y;
605
- var cos = math.cos(PI / 180 * angle),
606
- sin = math.sin(PI / 180 * angle),
607
- x = (x1 - x2) / 2,
608
- y = (y1 - y2) / 2;
609
- var h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
610
- if (h > 1) {
611
- h = math.sqrt(h);
612
- rx = h * rx;
613
- ry = h * ry;
614
- }
615
- var rx2 = rx * rx,
616
- ry2 = ry * ry,
617
- k = (large_arc_flag == sweep_flag ? -1 : 1) *
618
- math.sqrt(math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))),
619
- cx = k * rx * y / ry + (x1 + x2) / 2,
620
- cy = k * -ry * x / rx + (y1 + y2) / 2,
621
- f1 = math.asin(((y1 - cy) / ry).toFixed(7)),
622
- f2 = math.asin(((y2 - cy) / ry).toFixed(7));
623
-
624
- f1 = x1 < cx ? PI - f1 : f1;
625
- f2 = x2 < cx ? PI - f2 : f2;
626
- f1 < 0 && (f1 = PI * 2 + f1);
627
- f2 < 0 && (f2 = PI * 2 + f2);
628
- if (sweep_flag && f1 > f2) {
629
- f1 = f1 - PI * 2;
630
- }
631
- if (!sweep_flag && f2 > f1) {
632
- f2 = f2 - PI * 2;
633
- }
634
- } else {
635
- f1 = recursive[0];
636
- f2 = recursive[1];
637
- cx = recursive[2];
638
- cy = recursive[3];
639
- }
640
- var df = f2 - f1;
641
- if (math.abs(df) > _120) {
642
- var f2old = f2,
643
- x2old = x2,
644
- y2old = y2;
645
- f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);
646
- x2 = cx + rx * math.cos(f2);
647
- y2 = cy + ry * math.sin(f2);
648
- res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);
649
- }
650
- df = f2 - f1;
651
- var c1 = math.cos(f1),
652
- s1 = math.sin(f1),
653
- c2 = math.cos(f2),
654
- s2 = math.sin(f2),
655
- t = math.tan(df / 4),
656
- hx = 4 / 3 * rx * t,
657
- hy = 4 / 3 * ry * t,
658
- m1 = [x1, y1],
659
- m2 = [x1 + hx * s1, y1 - hy * c1],
660
- m3 = [x2 + hx * s2, y2 - hy * c2],
661
- m4 = [x2, y2];
662
- m2[0] = 2 * m1[0] - m2[0];
663
- m2[1] = 2 * m1[1] - m2[1];
664
- if (recursive) {
665
- return [m2, m3, m4][concat](res);
666
- } else {
667
- res = [m2, m3, m4][concat](res)[join]()[split](",");
668
- var newres = [];
669
- for (var i = 0, ii = res[length]; i < ii; i++) {
670
- newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;
671
- }
672
- return newres;
673
- }
674
- },
675
- findDotAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
676
- var t1 = 1 - t;
677
- return {
678
- x: pow(t1, 3) * p1x + pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + pow(t, 3) * p2x,
679
- y: pow(t1, 3) * p1y + pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + pow(t, 3) * p2y
680
- };
681
- },
682
- curveDim = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
683
- var a = (c2x - 2 * c1x + p1x) - (p2x - 2 * c2x + c1x),
684
- b = 2 * (c1x - p1x) - 2 * (c2x - c1x),
685
- c = p1x - c1x,
686
- t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a,
687
- t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a,
688
- y = [p1y, p2y],
689
- x = [p1x, p2x],
690
- dot;
691
- math.abs(t1) > 1e12 && (t1 = .5);
692
- math.abs(t2) > 1e12 && (t2 = .5);
693
- if (t1 > 0 && t1 < 1) {
694
- dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1);
695
- x[push](dot.x);
696
- y[push](dot.y);
697
- }
698
- if (t2 > 0 && t2 < 1) {
699
- dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2);
700
- x[push](dot.x);
701
- y[push](dot.y);
702
- }
703
- a = (c2y - 2 * c1y + p1y) - (p2y - 2 * c2y + c1y);
704
- b = 2 * (c1y - p1y) - 2 * (c2y - c1y);
705
- c = p1y - c1y;
706
- t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a;
707
- t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a;
708
- math.abs(t1) > 1e12 && (t1 = .5);
709
- math.abs(t2) > 1e12 && (t2 = .5);
710
- if (t1 > 0 && t1 < 1) {
711
- dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1);
712
- x[push](dot.x);
713
- y[push](dot.y);
714
- }
715
- if (t2 > 0 && t2 < 1) {
716
- dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2);
717
- x[push](dot.x);
718
- y[push](dot.y);
719
- }
720
- return {
721
- min: {x: mmin[apply](0, x), y: mmin[apply](0, y)},
722
- max: {x: mmax[apply](0, x), y: mmax[apply](0, y)}
723
- };
724
- }),
725
- path2curve = cacher(function (path, path2) {
726
- var p = pathToAbsolute(path),
727
- p2 = path2 && pathToAbsolute(path2),
728
- attrs = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
729
- attrs2 = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
730
- processPath = function (path, d) {
731
- var nx, ny;
732
- if (!path) {
733
- return ["C", d.x, d.y, d.x, d.y, d.x, d.y];
734
- }
735
- !(path[0] in {T:1, Q:1}) && (d.qx = d.qy = null);
736
- switch (path[0]) {
737
- case "M":
738
- d.X = path[1];
739
- d.Y = path[2];
740
- break;
741
- case "A":
742
- path = ["C"][concat](a2c[apply](0, [d.x, d.y][concat](path.slice(1))));
743
- break;
744
- case "S":
745
- nx = d.x + (d.x - (d.bx || d.x));
746
- ny = d.y + (d.y - (d.by || d.y));
747
- path = ["C", nx, ny][concat](path.slice(1));
748
- break;
749
- case "T":
750
- d.qx = d.x + (d.x - (d.qx || d.x));
751
- d.qy = d.y + (d.y - (d.qy || d.y));
752
- path = ["C"][concat](q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
753
- break;
754
- case "Q":
755
- d.qx = path[1];
756
- d.qy = path[2];
757
- path = ["C"][concat](q2c(d.x, d.y, path[1], path[2], path[3], path[4]));
758
- break;
759
- case "L":
760
- path = ["C"][concat](l2c(d.x, d.y, path[1], path[2]));
761
- break;
762
- case "H":
763
- path = ["C"][concat](l2c(d.x, d.y, path[1], d.y));
764
- break;
765
- case "V":
766
- path = ["C"][concat](l2c(d.x, d.y, d.x, path[1]));
767
- break;
768
- case "Z":
769
- path = ["C"][concat](l2c(d.x, d.y, d.X, d.Y));
770
- break;
771
- }
772
- return path;
773
- },
774
- fixArc = function (pp, i) {
775
- if (pp[i][length] > 7) {
776
- pp[i].shift();
777
- var pi = pp[i];
778
- while (pi[length]) {
779
- pp.splice(i++, 0, ["C"][concat](pi.splice(0, 6)));
780
- }
781
- pp.splice(i, 1);
782
- ii = mmax(p[length], p2 && p2[length] || 0);
783
- }
784
- },
785
- fixM = function (path1, path2, a1, a2, i) {
786
- if (path1 && path2 && path1[i][0] == "M" && path2[i][0] != "M") {
787
- path2.splice(i, 0, ["M", a2.x, a2.y]);
788
- a1.bx = 0;
789
- a1.by = 0;
790
- a1.x = path1[i][1];
791
- a1.y = path1[i][2];
792
- ii = mmax(p[length], p2 && p2[length] || 0);
793
- }
794
- };
795
- for (var i = 0, ii = mmax(p[length], p2 && p2[length] || 0); i < ii; i++) {
796
- p[i] = processPath(p[i], attrs);
797
- fixArc(p, i);
798
- p2 && (p2[i] = processPath(p2[i], attrs2));
799
- p2 && fixArc(p2, i);
800
- fixM(p, p2, attrs, attrs2, i);
801
- fixM(p2, p, attrs2, attrs, i);
802
- var seg = p[i],
803
- seg2 = p2 && p2[i],
804
- seglen = seg[length],
805
- seg2len = p2 && seg2[length];
806
- attrs.x = seg[seglen - 2];
807
- attrs.y = seg[seglen - 1];
808
- attrs.bx = toFloat(seg[seglen - 4]) || attrs.x;
809
- attrs.by = toFloat(seg[seglen - 3]) || attrs.y;
810
- attrs2.bx = p2 && (toFloat(seg2[seg2len - 4]) || attrs2.x);
811
- attrs2.by = p2 && (toFloat(seg2[seg2len - 3]) || attrs2.y);
812
- attrs2.x = p2 && seg2[seg2len - 2];
813
- attrs2.y = p2 && seg2[seg2len - 1];
814
- }
815
- return p2 ? [p, p2] : p;
816
- }, null, pathClone),
817
- parseDots = cacher(function (gradient) {
818
- var dots = [];
819
- for (var i = 0, ii = gradient[length]; i < ii; i++) {
820
- var dot = {},
821
- par = gradient[i].match(/^([^:]*):?([\d\.]*)/);
822
- dot.color = R.getRGB(par[1]);
823
- if (dot.color.error) {
824
- return null;
825
- }
826
- dot.color = dot.color.hex;
827
- par[2] && (dot.offset = par[2] + "%");
828
- dots[push](dot);
829
- }
830
- for (i = 1, ii = dots[length] - 1; i < ii; i++) {
831
- if (!dots[i].offset) {
832
- var start = toFloat(dots[i - 1].offset || 0),
833
- end = 0;
834
- for (var j = i + 1; j < ii; j++) {
835
- if (dots[j].offset) {
836
- end = dots[j].offset;
837
- break;
838
- }
839
- }
840
- if (!end) {
841
- end = 100;
842
- j = ii;
843
- }
844
- end = toFloat(end);
845
- var d = (end - start) / (j - i + 1);
846
- for (; i < j; i++) {
847
- start += d;
848
- dots[i].offset = start + "%";
849
- }
850
- }
851
- }
852
- return dots;
853
- }),
854
- getContainer = function (x, y, w, h) {
855
- var container;
856
- if (R.is(x, string) || R.is(x, "object")) {
857
- container = R.is(x, string) ? doc.getElementById(x) : x;
858
- if (container.tagName) {
859
- if (y == null) {
860
- return {
861
- container: container,
862
- width: container.style.pixelWidth || container.offsetWidth,
863
- height: container.style.pixelHeight || container.offsetHeight
864
- };
865
- } else {
866
- return {container: container, width: y, height: w};
867
- }
868
- }
869
- } else {
870
- return {container: 1, x: x, y: y, width: w, height: h};
871
- }
872
- },
873
- plugins = function (con, add) {
874
- var that = this;
875
- for (var prop in add) {
876
- if (add[has](prop) && !(prop in con)) {
877
- switch (typeof add[prop]) {
878
- case "function":
879
- (function (f) {
880
- con[prop] = con === that ? f : function () { return f[apply](that, arguments); };
881
- })(add[prop]);
882
- break;
883
- case "object":
884
- con[prop] = con[prop] || {};
885
- plugins.call(this, con[prop], add[prop]);
886
- break;
887
- default:
888
- con[prop] = add[prop];
889
- break;
890
- }
891
- }
892
- }
893
- },
894
- tear = function (el, paper) {
895
- el == paper.top && (paper.top = el.prev);
896
- el == paper.bottom && (paper.bottom = el.next);
897
- el.next && (el.next.prev = el.prev);
898
- el.prev && (el.prev.next = el.next);
899
- },
900
- tofront = function (el, paper) {
901
- if (paper.top === el) {
902
- return;
903
- }
904
- tear(el, paper);
905
- el.next = null;
906
- el.prev = paper.top;
907
- paper.top.next = el;
908
- paper.top = el;
909
- },
910
- toback = function (el, paper) {
911
- if (paper.bottom === el) {
912
- return;
913
- }
914
- tear(el, paper);
915
- el.next = paper.bottom;
916
- el.prev = null;
917
- paper.bottom.prev = el;
918
- paper.bottom = el;
919
- },
920
- insertafter = function (el, el2, paper) {
921
- tear(el, paper);
922
- el2 == paper.top && (paper.top = el);
923
- el2.next && (el2.next.prev = el);
924
- el.next = el2.next;
925
- el.prev = el2;
926
- el2.next = el;
927
- },
928
- insertbefore = function (el, el2, paper) {
929
- tear(el, paper);
930
- el2 == paper.bottom && (paper.bottom = el);
931
- el2.prev && (el2.prev.next = el);
932
- el.prev = el2.prev;
933
- el2.prev = el;
934
- el.next = el2;
935
- },
936
- removed = function (methodname) {
937
- return function () {
938
- throw new Error("Rapha\xebl: you are calling to method \u201c" + methodname + "\u201d of removed object");
939
- };
940
- },
941
- radial_gradient = /^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;
942
-
943
- // SVG
944
- if (R.svg) {
945
- Paper[proto].svgns = "http://www.w3.org/2000/svg";
946
- Paper[proto].xlink = "http://www.w3.org/1999/xlink";
947
- round = function (num) {
948
- return +num + (~~num === num) * .5;
949
- };
950
- var $ = function (el, attr) {
951
- if (attr) {
952
- for (var key in attr) {
953
- if (attr[has](key)) {
954
- el[setAttribute](key, attr[key] + E);
955
- }
956
- }
957
- } else {
958
- el = doc.createElementNS(Paper[proto].svgns, el);
959
- el.style.webkitTapHighlightColor = "rgba(0,0,0,0)";
960
- return el;
961
- }
962
- };
963
- R[toString] = function () {
964
- return "Your browser supports SVG.\nYou are running Rapha\xebl " + this.version;
965
- };
966
- var thePath = function (pathString, SVG) {
967
- var el = $("path");
968
- SVG.canvas && SVG.canvas[appendChild](el);
969
- var p = new Element(el, SVG);
970
- p.type = "path";
971
- setFillAndStroke(p, {fill: "none", stroke: "#000", path: pathString});
972
- return p;
973
- };
974
- var addGradientFill = function (o, gradient, SVG) {
975
- var type = "linear",
976
- fx = .5, fy = .5,
977
- s = o.style;
978
- gradient = (gradient + E)[rp](radial_gradient, function (all, _fx, _fy) {
979
- type = "radial";
980
- if (_fx && _fy) {
981
- fx = toFloat(_fx);
982
- fy = toFloat(_fy);
983
- var dir = ((fy > .5) * 2 - 1);
984
- pow(fx - .5, 2) + pow(fy - .5, 2) > .25 &&
985
- (fy = math.sqrt(.25 - pow(fx - .5, 2)) * dir + .5) &&
986
- fy != .5 &&
987
- (fy = fy.toFixed(5) - 1e-5 * dir);
988
- }
989
- return E;
990
- });
991
- gradient = gradient[split](/\s*\-\s*/);
992
- if (type == "linear") {
993
- var angle = gradient.shift();
994
- angle = -toFloat(angle);
995
- if (isNaN(angle)) {
996
- return null;
997
- }
998
- var vector = [0, 0, math.cos(angle * math.PI / 180), math.sin(angle * math.PI / 180)],
999
- max = 1 / (mmax(math.abs(vector[2]), math.abs(vector[3])) || 1);
1000
- vector[2] *= max;
1001
- vector[3] *= max;
1002
- if (vector[2] < 0) {
1003
- vector[0] = -vector[2];
1004
- vector[2] = 0;
1005
- }
1006
- if (vector[3] < 0) {
1007
- vector[1] = -vector[3];
1008
- vector[3] = 0;
1009
- }
1010
- }
1011
- var dots = parseDots(gradient);
1012
- if (!dots) {
1013
- return null;
1014
- }
1015
- var id = o.getAttribute(fillString);
1016
- id = id.match(/^url\(#(.*)\)$/);
1017
- id && SVG.defs.removeChild(doc.getElementById(id[1]));
1018
-
1019
- var el = $(type + "Gradient");
1020
- el.id = "r" + (R._id++)[toString](36);
1021
- $(el, type == "radial" ? {fx: fx, fy: fy} : {x1: vector[0], y1: vector[1], x2: vector[2], y2: vector[3]});
1022
- SVG.defs[appendChild](el);
1023
- for (var i = 0, ii = dots[length]; i < ii; i++) {
1024
- var stop = $("stop");
1025
- $(stop, {
1026
- offset: dots[i].offset ? dots[i].offset : !i ? "0%" : "100%",
1027
- "stop-color": dots[i].color || "#fff"
1028
- });
1029
- el[appendChild](stop);
1030
- }
1031
- $(o, {
1032
- fill: "url(#" + el.id + ")",
1033
- opacity: 1,
1034
- "fill-opacity": 1
1035
- });
1036
- s.fill = E;
1037
- s.opacity = 1;
1038
- s.fillOpacity = 1;
1039
- return 1;
1040
- };
1041
- var updatePosition = function (o) {
1042
- var bbox = o.getBBox();
1043
- $(o.pattern, {patternTransform: R.format("translate({0},{1})", bbox.x, bbox.y)});
1044
- };
1045
- var setFillAndStroke = function (o, params) {
1046
- var dasharray = {
1047
- "": [0],
1048
- "none": [0],
1049
- "-": [3, 1],
1050
- ".": [1, 1],
1051
- "-.": [3, 1, 1, 1],
1052
- "-..": [3, 1, 1, 1, 1, 1],
1053
- ". ": [1, 3],
1054
- "- ": [4, 3],
1055
- "--": [8, 3],
1056
- "- .": [4, 3, 1, 3],
1057
- "--.": [8, 3, 1, 3],
1058
- "--..": [8, 3, 1, 3, 1, 3]
1059
- },
1060
- node = o.node,
1061
- attrs = o.attrs,
1062
- rot = o.rotate(),
1063
- addDashes = function (o, value) {
1064
- value = dasharray[lowerCase.call(value)];
1065
- if (value) {
1066
- var width = o.attrs["stroke-width"] || "1",
1067
- butt = {round: width, square: width, butt: 0}[o.attrs["stroke-linecap"] || params["stroke-linecap"]] || 0,
1068
- dashes = [];
1069
- var i = value[length];
1070
- while (i--) {
1071
- dashes[i] = value[i] * width + ((i % 2) ? 1 : -1) * butt;
1072
- }
1073
- $(node, {"stroke-dasharray": dashes[join](",")});
1074
- }
1075
- };
1076
- params[has]("rotation") && (rot = params.rotation);
1077
- var rotxy = (rot + E)[split](separator);
1078
- if (!(rotxy.length - 1)) {
1079
- rotxy = null;
1080
- } else {
1081
- rotxy[1] = +rotxy[1];
1082
- rotxy[2] = +rotxy[2];
1083
- }
1084
- toFloat(rot) && o.rotate(0, true);
1085
- for (var att in params) {
1086
- if (params[has](att)) {
1087
- if (!availableAttrs[has](att)) {
1088
- continue;
1089
- }
1090
- var value = params[att];
1091
- attrs[att] = value;
1092
- switch (att) {
1093
- case "blur":
1094
- o.blur(value);
1095
- break;
1096
- case "rotation":
1097
- o.rotate(value, true);
1098
- break;
1099
- case "href":
1100
- case "title":
1101
- case "target":
1102
- var pn = node.parentNode;
1103
- if (lowerCase.call(pn.tagName) != "a") {
1104
- var hl = $("a");
1105
- pn.insertBefore(hl, node);
1106
- hl[appendChild](node);
1107
- pn = hl;
1108
- }
1109
- pn.setAttributeNS(o.paper.xlink, att, value);
1110
- break;
1111
- case "cursor":
1112
- node.style.cursor = value;
1113
- break;
1114
- case "clip-rect":
1115
- var rect = (value + E)[split](separator);
1116
- if (rect[length] == 4) {
1117
- o.clip && o.clip.parentNode.parentNode.removeChild(o.clip.parentNode);
1118
- var el = $("clipPath"),
1119
- rc = $("rect");
1120
- el.id = "r" + (R._id++)[toString](36);
1121
- $(rc, {
1122
- x: rect[0],
1123
- y: rect[1],
1124
- width: rect[2],
1125
- height: rect[3]
1126
- });
1127
- el[appendChild](rc);
1128
- o.paper.defs[appendChild](el);
1129
- $(node, {"clip-path": "url(#" + el.id + ")"});
1130
- o.clip = rc;
1131
- }
1132
- if (!value) {
1133
- var clip = doc.getElementById(node.getAttribute("clip-path")[rp](/(^url\(#|\)$)/g, E));
1134
- clip && clip.parentNode.removeChild(clip);
1135
- $(node, {"clip-path": E});
1136
- delete o.clip;
1137
- }
1138
- break;
1139
- case "path":
1140
- if (o.type == "path") {
1141
- $(node, {d: value ? attrs.path = pathToAbsolute(value) : "M0,0"});
1142
- }
1143
- break;
1144
- case "width":
1145
- node[setAttribute](att, value);
1146
- if (attrs.fx) {
1147
- att = "x";
1148
- value = attrs.x;
1149
- } else {
1150
- break;
1151
- }
1152
- case "x":
1153
- if (attrs.fx) {
1154
- value = -attrs.x - (attrs.width || 0);
1155
- }
1156
- case "rx":
1157
- if (att == "rx" && o.type == "rect") {
1158
- break;
1159
- }
1160
- case "cx":
1161
- rotxy && (att == "x" || att == "cx") && (rotxy[1] += value - attrs[att]);
1162
- node[setAttribute](att, round(value));
1163
- o.pattern && updatePosition(o);
1164
- break;
1165
- case "height":
1166
- node[setAttribute](att, value);
1167
- if (attrs.fy) {
1168
- att = "y";
1169
- value = attrs.y;
1170
- } else {
1171
- break;
1172
- }
1173
- case "y":
1174
- if (attrs.fy) {
1175
- value = -attrs.y - (attrs.height || 0);
1176
- }
1177
- case "ry":
1178
- if (att == "ry" && o.type == "rect") {
1179
- break;
1180
- }
1181
- case "cy":
1182
- rotxy && (att == "y" || att == "cy") && (rotxy[2] += value - attrs[att]);
1183
- node[setAttribute](att, round(value));
1184
- o.pattern && updatePosition(o);
1185
- break;
1186
- case "r":
1187
- if (o.type == "rect") {
1188
- $(node, {rx: value, ry: value});
1189
- } else {
1190
- node[setAttribute](att, value);
1191
- }
1192
- break;
1193
- case "src":
1194
- if (o.type == "image") {
1195
- node.setAttributeNS(o.paper.xlink, "href", value);
1196
- }
1197
- break;
1198
- case "stroke-width":
1199
- node.style.strokeWidth = value;
1200
- // Need following line for Firefox
1201
- node[setAttribute](att, value);
1202
- if (attrs["stroke-dasharray"]) {
1203
- addDashes(o, attrs["stroke-dasharray"]);
1204
- }
1205
- break;
1206
- case "stroke-dasharray":
1207
- addDashes(o, value);
1208
- break;
1209
- case "translation":
1210
- var xy = (value + E)[split](separator);
1211
- xy[0] = +xy[0] || 0;
1212
- xy[1] = +xy[1] || 0;
1213
- if (rotxy) {
1214
- rotxy[1] += xy[0];
1215
- rotxy[2] += xy[1];
1216
- }
1217
- translate.call(o, xy[0], xy[1]);
1218
- break;
1219
- case "scale":
1220
- xy = (value + E)[split](separator);
1221
- o.scale(+xy[0] || 1, +xy[1] || +xy[0] || 1, isNaN(toFloat(xy[2])) ? null : +xy[2], isNaN(toFloat(xy[3])) ? null : +xy[3]);
1222
- break;
1223
- case fillString:
1224
- var isURL = (value + E).match(ISURL);
1225
- if (isURL) {
1226
- el = $("pattern");
1227
- var ig = $("image");
1228
- el.id = "r" + (R._id++)[toString](36);
1229
- $(el, {x: 0, y: 0, patternUnits: "userSpaceOnUse", height: 1, width: 1});
1230
- $(ig, {x: 0, y: 0});
1231
- ig.setAttributeNS(o.paper.xlink, "href", isURL[1]);
1232
- el[appendChild](ig);
1233
-
1234
- var img = doc.createElement("img");
1235
- img.style.cssText = "position:absolute;left:-9999em;top-9999em";
1236
- img.onload = function () {
1237
- $(el, {width: this.offsetWidth, height: this.offsetHeight});
1238
- $(ig, {width: this.offsetWidth, height: this.offsetHeight});
1239
- doc.body.removeChild(this);
1240
- o.paper.safari();
1241
- };
1242
- doc.body[appendChild](img);
1243
- img.src = isURL[1];
1244
- o.paper.defs[appendChild](el);
1245
- node.style.fill = "url(#" + el.id + ")";
1246
- $(node, {fill: "url(#" + el.id + ")"});
1247
- o.pattern = el;
1248
- o.pattern && updatePosition(o);
1249
- break;
1250
- }
1251
- var clr = R.getRGB(value);
1252
- if (!clr.error) {
1253
- delete params.gradient;
1254
- delete attrs.gradient;
1255
- !R.is(attrs.opacity, "undefined") &&
1256
- R.is(params.opacity, "undefined") &&
1257
- $(node, {opacity: attrs.opacity});
1258
- !R.is(attrs["fill-opacity"], "undefined") &&
1259
- R.is(params["fill-opacity"], "undefined") &&
1260
- $(node, {"fill-opacity": attrs["fill-opacity"]});
1261
- } else if ((({circle: 1, ellipse: 1})[has](o.type) || (value + E).charAt() != "r") && addGradientFill(node, value, o.paper)) {
1262
- attrs.gradient = value;
1263
- attrs.fill = "none";
1264
- break;
1265
- }
1266
- clr[has]("o") && $(node, {"fill-opacity": clr.o / 100});
1267
- case "stroke":
1268
- clr = R.getRGB(value);
1269
- node[setAttribute](att, clr.hex);
1270
- att == "stroke" && clr[has]("o") && $(node, {"stroke-opacity": clr.o / 100});
1271
- break;
1272
- case "gradient":
1273
- (({circle: 1, ellipse: 1})[has](o.type) || (value + E).charAt() != "r") && addGradientFill(node, value, o.paper);
1274
- break;
1275
- case "opacity":
1276
- case "fill-opacity":
1277
- if (attrs.gradient) {
1278
- var gradient = doc.getElementById(node.getAttribute(fillString)[rp](/^url\(#|\)$/g, E));
1279
- if (gradient) {
1280
- var stops = gradient.getElementsByTagName("stop");
1281
- stops[stops[length] - 1][setAttribute]("stop-opacity", value);
1282
- }
1283
- break;
1284
- }
1285
- default:
1286
- att == "font-size" && (value = toInt(value, 10) + "px");
1287
- var cssrule = att[rp](/(\-.)/g, function (w) {
1288
- return upperCase.call(w.substring(1));
1289
- });
1290
- node.style[cssrule] = value;
1291
- // Need following line for Firefox
1292
- node[setAttribute](att, value);
1293
- break;
1294
- }
1295
- }
1296
- }
1297
-
1298
- tuneText(o, params);
1299
- if (rotxy) {
1300
- o.rotate(rotxy.join(S));
1301
- } else {
1302
- toFloat(rot) && o.rotate(rot, true);
1303
- }
1304
- };
1305
- var leading = 1.2,
1306
- tuneText = function (el, params) {
1307
- if (el.type != "text" || !(params[has]("text") || params[has]("font") || params[has]("font-size") || params[has]("x") || params[has]("y"))) {
1308
- return;
1309
- }
1310
- var a = el.attrs,
1311
- node = el.node,
1312
- fontSize = node.firstChild ? toInt(doc.defaultView.getComputedStyle(node.firstChild, E).getPropertyValue("font-size"), 10) : 10;
1313
-
1314
- if (params[has]("text")) {
1315
- a.text = params.text;
1316
- while (node.firstChild) {
1317
- node.removeChild(node.firstChild);
1318
- }
1319
- var texts = (params.text + E)[split]("\n");
1320
- for (var i = 0, ii = texts[length]; i < ii; i++) if (texts[i]) {
1321
- var tspan = $("tspan");
1322
- i && $(tspan, {dy: fontSize * leading, x: a.x});
1323
- tspan[appendChild](doc.createTextNode(texts[i]));
1324
- node[appendChild](tspan);
1325
- }
1326
- } else {
1327
- texts = node.getElementsByTagName("tspan");
1328
- for (i = 0, ii = texts[length]; i < ii; i++) {
1329
- i && $(texts[i], {dy: fontSize * leading, x: a.x});
1330
- }
1331
- }
1332
- $(node, {y: a.y});
1333
- var bb = el.getBBox(),
1334
- dif = a.y - (bb.y + bb.height / 2);
1335
- dif && isFinite(dif) && $(node, {y: a.y + dif});
1336
- },
1337
- Element = function (node, svg) {
1338
- var X = 0,
1339
- Y = 0;
1340
- this[0] = node;
1341
- this.id = R._oid++;
1342
- this.node = node;
1343
- node.raphael = this;
1344
- this.paper = svg;
1345
- this.attrs = this.attrs || {};
1346
- this.transformations = []; // rotate, translate, scale
1347
- this._ = {
1348
- tx: 0,
1349
- ty: 0,
1350
- rt: {deg: 0, cx: 0, cy: 0},
1351
- sx: 1,
1352
- sy: 1
1353
- };
1354
- !svg.bottom && (svg.bottom = this);
1355
- this.prev = svg.top;
1356
- svg.top && (svg.top.next = this);
1357
- svg.top = this;
1358
- this.next = null;
1359
- };
1360
- Element[proto].rotate = function (deg, cx, cy) {
1361
- if (this.removed) {
1362
- return this;
1363
- }
1364
- if (deg == null) {
1365
- if (this._.rt.cx) {
1366
- return [this._.rt.deg, this._.rt.cx, this._.rt.cy][join](S);
1367
- }
1368
- return this._.rt.deg;
1369
- }
1370
- var bbox = this.getBBox();
1371
- deg = (deg + E)[split](separator);
1372
- if (deg[length] - 1) {
1373
- cx = toFloat(deg[1]);
1374
- cy = toFloat(deg[2]);
1375
- }
1376
- deg = toFloat(deg[0]);
1377
- if (cx != null) {
1378
- this._.rt.deg = deg;
1379
- } else {
1380
- this._.rt.deg += deg;
1381
- }
1382
- (cy == null) && (cx = null);
1383
- this._.rt.cx = cx;
1384
- this._.rt.cy = cy;
1385
- cx = cx == null ? bbox.x + bbox.width / 2 : cx;
1386
- cy = cy == null ? bbox.y + bbox.height / 2 : cy;
1387
- if (this._.rt.deg) {
1388
- this.transformations[0] = R.format("rotate({0} {1} {2})", this._.rt.deg, cx, cy);
1389
- this.clip && $(this.clip, {transform: R.format("rotate({0} {1} {2})", -this._.rt.deg, cx, cy)});
1390
- } else {
1391
- this.transformations[0] = E;
1392
- this.clip && $(this.clip, {transform: E});
1393
- }
1394
- $(this.node, {transform: this.transformations[join](S)});
1395
- return this;
1396
- };
1397
- Element[proto].hide = function () {
1398
- !this.removed && (this.node.style.display = "none");
1399
- return this;
1400
- };
1401
- Element[proto].show = function () {
1402
- !this.removed && (this.node.style.display = "");
1403
- return this;
1404
- };
1405
- Element[proto].remove = function () {
1406
- if (this.removed) {
1407
- return;
1408
- }
1409
- tear(this, this.paper);
1410
- this.node.parentNode.removeChild(this.node);
1411
- for (var i in this) {
1412
- delete this[i];
1413
- }
1414
- this.removed = true;
1415
- };
1416
- Element[proto].getBBox = function () {
1417
- if (this.removed) {
1418
- return this;
1419
- }
1420
- if (this.type == "path") {
1421
- return pathDimensions(this.attrs.path);
1422
- }
1423
- if (this.node.style.display == "none") {
1424
- this.show();
1425
- var hide = true;
1426
- }
1427
- var bbox = {};
1428
- try {
1429
- bbox = this.node.getBBox();
1430
- } catch(e) {
1431
- // Firefox 3.0.x plays badly here
1432
- } finally {
1433
- bbox = bbox || {};
1434
- }
1435
- if (this.type == "text") {
1436
- bbox = {x: bbox.x, y: Infinity, width: 0, height: 0};
1437
- for (var i = 0, ii = this.node.getNumberOfChars(); i < ii; i++) {
1438
- var bb = this.node.getExtentOfChar(i);
1439
- (bb.y < bbox.y) && (bbox.y = bb.y);
1440
- (bb.y + bb.height - bbox.y > bbox.height) && (bbox.height = bb.y + bb.height - bbox.y);
1441
- (bb.x + bb.width - bbox.x > bbox.width) && (bbox.width = bb.x + bb.width - bbox.x);
1442
- }
1443
- }
1444
- hide && this.hide();
1445
- return bbox;
1446
- };
1447
- Element[proto].attr = function (name, value) {
1448
- if (this.removed) {
1449
- return this;
1450
- }
1451
- if (name == null) {
1452
- var res = {};
1453
- for (var i in this.attrs) if (this.attrs[has](i)) {
1454
- res[i] = this.attrs[i];
1455
- }
1456
- this._.rt.deg && (res.rotation = this.rotate());
1457
- (this._.sx != 1 || this._.sy != 1) && (res.scale = this.scale());
1458
- res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient;
1459
- return res;
1460
- }
1461
- if (value == null && R.is(name, string)) {
1462
- if (name == "translation") {
1463
- return translate.call(this);
1464
- }
1465
- if (name == "rotation") {
1466
- return this.rotate();
1467
- }
1468
- if (name == "scale") {
1469
- return this.scale();
1470
- }
1471
- if (name == fillString && this.attrs.fill == "none" && this.attrs.gradient) {
1472
- return this.attrs.gradient;
1473
- }
1474
- return this.attrs[name];
1475
- }
1476
- if (value == null && R.is(name, array)) {
1477
- var values = {};
1478
- for (var j = 0, jj = name.length; j < jj; j++) {
1479
- values[name[j]] = this.attr(name[j]);
1480
- }
1481
- return values;
1482
- }
1483
- if (value != null) {
1484
- var params = {};
1485
- params[name] = value;
1486
- setFillAndStroke(this, params);
1487
- } else if (name != null && R.is(name, "object")) {
1488
- setFillAndStroke(this, name);
1489
- }
1490
- return this;
1491
- };
1492
- Element[proto].toFront = function () {
1493
- if (this.removed) {
1494
- return this;
1495
- }
1496
- this.node.parentNode[appendChild](this.node);
1497
- var svg = this.paper;
1498
- svg.top != this && tofront(this, svg);
1499
- return this;
1500
- };
1501
- Element[proto].toBack = function () {
1502
- if (this.removed) {
1503
- return this;
1504
- }
1505
- if (this.node.parentNode.firstChild != this.node) {
1506
- this.node.parentNode.insertBefore(this.node, this.node.parentNode.firstChild);
1507
- toback(this, this.paper);
1508
- var svg = this.paper;
1509
- }
1510
- return this;
1511
- };
1512
- Element[proto].insertAfter = function (element) {
1513
- if (this.removed) {
1514
- return this;
1515
- }
1516
- var node = element.node;
1517
- if (node.nextSibling) {
1518
- node.parentNode.insertBefore(this.node, node.nextSibling);
1519
- } else {
1520
- node.parentNode[appendChild](this.node);
1521
- }
1522
- insertafter(this, element, this.paper);
1523
- return this;
1524
- };
1525
- Element[proto].insertBefore = function (element) {
1526
- if (this.removed) {
1527
- return this;
1528
- }
1529
- var node = element.node;
1530
- node.parentNode.insertBefore(this.node, node);
1531
- insertbefore(this, element, this.paper);
1532
- return this;
1533
- };
1534
- Element[proto].blur = function (size) {
1535
- // Experimental. No Safari support. Use it on your own risk.
1536
- var t = this;
1537
- if (+size !== 0) {
1538
- var fltr = $("filter"),
1539
- blur = $("feGaussianBlur");
1540
- t.attrs.blur = size;
1541
- fltr.id = "r" + (R._id++)[toString](36);
1542
- $(blur, {stdDeviation: +size || 1.5});
1543
- fltr.appendChild(blur);
1544
- t.paper.defs.appendChild(fltr);
1545
- t._blur = fltr;
1546
- $(t.node, {filter: "url(#" + fltr.id + ")"});
1547
- } else {
1548
- if (t._blur) {
1549
- t._blur.parentNode.removeChild(t._blur);
1550
- delete t._blur;
1551
- delete t.attrs.blur;
1552
- }
1553
- t.node.removeAttribute("filter");
1554
- }
1555
- };
1556
- var theCircle = function (svg, x, y, r) {
1557
- x = round(x);
1558
- y = round(y);
1559
- var el = $("circle");
1560
- svg.canvas && svg.canvas[appendChild](el);
1561
- var res = new Element(el, svg);
1562
- res.attrs = {cx: x, cy: y, r: r, fill: "none", stroke: "#000"};
1563
- res.type = "circle";
1564
- $(el, res.attrs);
1565
- return res;
1566
- };
1567
- var theRect = function (svg, x, y, w, h, r) {
1568
- x = round(x);
1569
- y = round(y);
1570
- var el = $("rect");
1571
- svg.canvas && svg.canvas[appendChild](el);
1572
- var res = new Element(el, svg);
1573
- res.attrs = {x: x, y: y, width: w, height: h, r: r || 0, rx: r || 0, ry: r || 0, fill: "none", stroke: "#000"};
1574
- res.type = "rect";
1575
- $(el, res.attrs);
1576
- return res;
1577
- };
1578
- var theEllipse = function (svg, x, y, rx, ry) {
1579
- x = round(x);
1580
- y = round(y);
1581
- var el = $("ellipse");
1582
- svg.canvas && svg.canvas[appendChild](el);
1583
- var res = new Element(el, svg);
1584
- res.attrs = {cx: x, cy: y, rx: rx, ry: ry, fill: "none", stroke: "#000"};
1585
- res.type = "ellipse";
1586
- $(el, res.attrs);
1587
- return res;
1588
- };
1589
- var theImage = function (svg, src, x, y, w, h) {
1590
- var el = $("image");
1591
- $(el, {x: x, y: y, width: w, height: h, preserveAspectRatio: "none"});
1592
- el.setAttributeNS(svg.xlink, "href", src);
1593
- svg.canvas && svg.canvas[appendChild](el);
1594
- var res = new Element(el, svg);
1595
- res.attrs = {x: x, y: y, width: w, height: h, src: src};
1596
- res.type = "image";
1597
- return res;
1598
- };
1599
- var theText = function (svg, x, y, text) {
1600
- var el = $("text");
1601
- $(el, {x: x, y: y, "text-anchor": "middle"});
1602
- svg.canvas && svg.canvas[appendChild](el);
1603
- var res = new Element(el, svg);
1604
- res.attrs = {x: x, y: y, "text-anchor": "middle", text: text, font: availableAttrs.font, stroke: "none", fill: "#000"};
1605
- res.type = "text";
1606
- setFillAndStroke(res, res.attrs);
1607
- return res;
1608
- };
1609
- var setSize = function (width, height) {
1610
- this.width = width || this.width;
1611
- this.height = height || this.height;
1612
- this.canvas[setAttribute]("width", this.width);
1613
- this.canvas[setAttribute]("height", this.height);
1614
- return this;
1615
- };
1616
- var create = function () {
1617
- var con = getContainer[apply](0, arguments),
1618
- container = con && con.container,
1619
- x = con.x,
1620
- y = con.y,
1621
- width = con.width,
1622
- height = con.height;
1623
- if (!container) {
1624
- throw new Error("SVG container not found.");
1625
- }
1626
- var cnvs = $("svg");
1627
- x = x || 0;
1628
- y = y || 0;
1629
- width = width || 512;
1630
- height = height || 342;
1631
- $(cnvs, {
1632
- xmlns: "http://www.w3.org/2000/svg",
1633
- version: 1.1,
1634
- width: width,
1635
- height: height
1636
- });
1637
- if (container == 1) {
1638
- cnvs.style.cssText = "position:absolute;left:" + x + "px;top:" + y + "px";
1639
- doc.body[appendChild](cnvs);
1640
- } else {
1641
- if (container.firstChild) {
1642
- container.insertBefore(cnvs, container.firstChild);
1643
- } else {
1644
- container[appendChild](cnvs);
1645
- }
1646
- }
1647
- container = new Paper;
1648
- container.width = width;
1649
- container.height = height;
1650
- container.canvas = cnvs;
1651
- plugins.call(container, container, R.fn);
1652
- container.clear();
1653
- return container;
1654
- };
1655
- Paper[proto].clear = function () {
1656
- var c = this.canvas;
1657
- while (c.firstChild) {
1658
- c.removeChild(c.firstChild);
1659
- }
1660
- this.bottom = this.top = null;
1661
- (this.desc = $("desc"))[appendChild](doc.createTextNode("Created with Rapha\xebl"));
1662
- c[appendChild](this.desc);
1663
- c[appendChild](this.defs = $("defs"));
1664
- };
1665
- Paper[proto].remove = function () {
1666
- this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
1667
- for (var i in this) {
1668
- this[i] = removed(i);
1669
- }
1670
- };
1671
- }
1672
-
1673
- // VML
1674
- if (R.vml) {
1675
- var map = {M: "m", L: "l", C: "c", Z: "x", m: "t", l: "r", c: "v", z: "x"},
1676
- bites = /([clmz]),?([^clmz]*)/gi,
1677
- val = /-?[^,\s-]+/g,
1678
- coordsize = 1e3 + S + 1e3,
1679
- zoom = 10,
1680
- pathlike = {path: 1, rect: 1},
1681
- path2vml = function (path) {
1682
- var total = /[ahqstv]/ig,
1683
- command = pathToAbsolute;
1684
- (path + E).match(total) && (command = path2curve);
1685
- total = /[clmz]/g;
1686
- if (command == pathToAbsolute && !(path + E).match(total)) {
1687
- var res = (path + E)[rp](bites, function (all, command, args) {
1688
- var vals = [],
1689
- isMove = lowerCase.call(command) == "m",
1690
- res = map[command];
1691
- args[rp](val, function (value) {
1692
- if (isMove && vals[length] == 2) {
1693
- res += vals + map[command == "m" ? "l" : "L"];
1694
- vals = [];
1695
- }
1696
- vals[push](round(value * zoom));
1697
- });
1698
- return res + vals;
1699
- });
1700
- return res;
1701
- }
1702
- var pa = command(path), p, r;
1703
- res = [];
1704
- for (var i = 0, ii = pa[length]; i < ii; i++) {
1705
- p = pa[i];
1706
- r = lowerCase.call(pa[i][0]);
1707
- r == "z" && (r = "x");
1708
- for (var j = 1, jj = p[length]; j < jj; j++) {
1709
- r += round(p[j] * zoom) + (j != jj - 1 ? "," : E);
1710
- }
1711
- res[push](r);
1712
- }
1713
- return res[join](S);
1714
- };
1715
-
1716
- R[toString] = function () {
1717
- return "Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl " + this.version;
1718
- };
1719
- thePath = function (pathString, vml) {
1720
- var g = createNode("group");
1721
- g.style.cssText = "position:absolute;left:0;top:0;width:" + vml.width + "px;height:" + vml.height + "px";
1722
- g.coordsize = vml.coordsize;
1723
- g.coordorigin = vml.coordorigin;
1724
- var el = createNode("shape"), ol = el.style;
1725
- ol.width = vml.width + "px";
1726
- ol.height = vml.height + "px";
1727
- el.coordsize = coordsize;
1728
- el.coordorigin = vml.coordorigin;
1729
- g[appendChild](el);
1730
- var p = new Element(el, g, vml),
1731
- attr = {fill: "none", stroke: "#000"};
1732
- pathString && (attr.path = pathString);
1733
- p.isAbsolute = true;
1734
- p.type = "path";
1735
- p.path = [];
1736
- p.Path = E;
1737
- setFillAndStroke(p, attr);
1738
- vml.canvas[appendChild](g);
1739
- return p;
1740
- };
1741
- setFillAndStroke = function (o, params) {
1742
- o.attrs = o.attrs || {};
1743
- var node = o.node,
1744
- a = o.attrs,
1745
- s = node.style,
1746
- xy,
1747
- newpath = (params.x != a.x || params.y != a.y || params.width != a.width || params.height != a.height || params.r != a.r) && o.type == "rect",
1748
- res = o;
1749
-
1750
- for (var par in params) if (params[has](par)) {
1751
- a[par] = params[par];
1752
- }
1753
- if (newpath) {
1754
- a.path = rectPath(a.x, a.y, a.width, a.height, a.r);
1755
- o.X = a.x;
1756
- o.Y = a.y;
1757
- o.W = a.width;
1758
- o.H = a.height;
1759
- }
1760
- params.href && (node.href = params.href);
1761
- params.title && (node.title = params.title);
1762
- params.target && (node.target = params.target);
1763
- params.cursor && (s.cursor = params.cursor);
1764
- "blur" in params && o.blur(params.blur);
1765
- if (params.path && o.type == "path" || newpath) {
1766
- node.path = path2vml(a.path);
1767
- }
1768
- if (params.rotation != null) {
1769
- o.rotate(params.rotation, true);
1770
- }
1771
- if (params.translation) {
1772
- xy = (params.translation + E)[split](separator);
1773
- translate.call(o, xy[0], xy[1]);
1774
- if (o._.rt.cx != null) {
1775
- o._.rt.cx +=+ xy[0];
1776
- o._.rt.cy +=+ xy[1];
1777
- o.setBox(o.attrs, xy[0], xy[1]);
1778
- }
1779
- }
1780
- if (params.scale) {
1781
- xy = (params.scale + E)[split](separator);
1782
- o.scale(+xy[0] || 1, +xy[1] || +xy[0] || 1, +xy[2] || null, +xy[3] || null);
1783
- }
1784
- if ("clip-rect" in params) {
1785
- var rect = (params["clip-rect"] + E)[split](separator);
1786
- if (rect[length] == 4) {
1787
- rect[2] = +rect[2] + (+rect[0]);
1788
- rect[3] = +rect[3] + (+rect[1]);
1789
- var div = node.clipRect || doc.createElement("div"),
1790
- dstyle = div.style,
1791
- group = node.parentNode;
1792
- dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect);
1793
- if (!node.clipRect) {
1794
- dstyle.position = "absolute";
1795
- dstyle.top = 0;
1796
- dstyle.left = 0;
1797
- dstyle.width = o.paper.width + "px";
1798
- dstyle.height = o.paper.height + "px";
1799
- group.parentNode.insertBefore(div, group);
1800
- div[appendChild](group);
1801
- node.clipRect = div;
1802
- }
1803
- }
1804
- if (!params["clip-rect"]) {
1805
- node.clipRect && (node.clipRect.style.clip = E);
1806
- }
1807
- }
1808
- if (o.type == "image" && params.src) {
1809
- node.src = params.src;
1810
- }
1811
- if (o.type == "image" && params.opacity) {
1812
- node.filterOpacity = ms + ".Alpha(opacity=" + (params.opacity * 100) + ")";
1813
- s.filter = (node.filterMatrix || E) + (node.filterOpacity || E);
1814
- }
1815
- params.font && (s.font = params.font);
1816
- params["font-family"] && (s.fontFamily = '"' + params["font-family"][split](",")[0][rp](/^['"]+|['"]+$/g, E) + '"');
1817
- params["font-size"] && (s.fontSize = params["font-size"]);
1818
- params["font-weight"] && (s.fontWeight = params["font-weight"]);
1819
- params["font-style"] && (s.fontStyle = params["font-style"]);
1820
- if (params.opacity != null ||
1821
- params["stroke-width"] != null ||
1822
- params.fill != null ||
1823
- params.stroke != null ||
1824
- params["stroke-width"] != null ||
1825
- params["stroke-opacity"] != null ||
1826
- params["fill-opacity"] != null ||
1827
- params["stroke-dasharray"] != null ||
1828
- params["stroke-miterlimit"] != null ||
1829
- params["stroke-linejoin"] != null ||
1830
- params["stroke-linecap"] != null) {
1831
- node = o.shape || node;
1832
- var fill = (node.getElementsByTagName(fillString) && node.getElementsByTagName(fillString)[0]),
1833
- newfill = false;
1834
- !fill && (newfill = fill = createNode(fillString));
1835
- if ("fill-opacity" in params || "opacity" in params) {
1836
- var opacity = ((+a["fill-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+R.getRGB(params.fill).o + 1 || 2) - 1);
1837
- opacity < 0 && (opacity = 0);
1838
- opacity > 1 && (opacity = 1);
1839
- fill.opacity = opacity;
1840
- }
1841
- params.fill && (fill.on = true);
1842
- if (fill.on == null || params.fill == "none") {
1843
- fill.on = false;
1844
- }
1845
- if (fill.on && params.fill) {
1846
- var isURL = params.fill.match(ISURL);
1847
- if (isURL) {
1848
- fill.src = isURL[1];
1849
- fill.type = "tile";
1850
- } else {
1851
- fill.color = R.getRGB(params.fill).hex;
1852
- fill.src = E;
1853
- fill.type = "solid";
1854
- if (R.getRGB(params.fill).error && (res.type in {circle: 1, ellipse: 1} || (params.fill + E).charAt() != "r") && addGradientFill(res, params.fill)) {
1855
- a.fill = "none";
1856
- a.gradient = params.fill;
1857
- }
1858
- }
1859
- }
1860
- newfill && node[appendChild](fill);
1861
- var stroke = (node.getElementsByTagName("stroke") && node.getElementsByTagName("stroke")[0]),
1862
- newstroke = false;
1863
- !stroke && (newstroke = stroke = createNode("stroke"));
1864
- if ((params.stroke && params.stroke != "none") ||
1865
- params["stroke-width"] ||
1866
- params["stroke-opacity"] != null ||
1867
- params["stroke-dasharray"] ||
1868
- params["stroke-miterlimit"] ||
1869
- params["stroke-linejoin"] ||
1870
- params["stroke-linecap"]) {
1871
- stroke.on = true;
1872
- }
1873
- (params.stroke == "none" || stroke.on == null || params.stroke == 0 || params["stroke-width"] == 0) && (stroke.on = false);
1874
- var strokeColor = R.getRGB(params.stroke);
1875
- stroke.on && params.stroke && (stroke.color = strokeColor.hex);
1876
- opacity = ((+a["stroke-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+strokeColor.o + 1 || 2) - 1);
1877
- var width = (toFloat(params["stroke-width"]) || 1) * .75;
1878
- opacity < 0 && (opacity = 0);
1879
- opacity > 1 && (opacity = 1);
1880
- params["stroke-width"] == null && (width = a["stroke-width"]);
1881
- params["stroke-width"] && (stroke.weight = width);
1882
- width && width < 1 && (opacity *= width) && (stroke.weight = 1);
1883
- stroke.opacity = opacity;
1884
-
1885
- params["stroke-linejoin"] && (stroke.joinstyle = params["stroke-linejoin"] || "miter");
1886
- stroke.miterlimit = params["stroke-miterlimit"] || 8;
1887
- params["stroke-linecap"] && (stroke.endcap = params["stroke-linecap"] == "butt" ? "flat" : params["stroke-linecap"] == "square" ? "square" : "round");
1888
- if (params["stroke-dasharray"]) {
1889
- var dasharray = {
1890
- "-": "shortdash",
1891
- ".": "shortdot",
1892
- "-.": "shortdashdot",
1893
- "-..": "shortdashdotdot",
1894
- ". ": "dot",
1895
- "- ": "dash",
1896
- "--": "longdash",
1897
- "- .": "dashdot",
1898
- "--.": "longdashdot",
1899
- "--..": "longdashdotdot"
1900
- };
1901
- stroke.dashstyle = dasharray[has](params["stroke-dasharray"]) ? dasharray[params["stroke-dasharray"]] : E;
1902
- }
1903
- newstroke && node[appendChild](stroke);
1904
- }
1905
- if (res.type == "text") {
1906
- s = res.paper.span.style;
1907
- a.font && (s.font = a.font);
1908
- a["font-family"] && (s.fontFamily = a["font-family"]);
1909
- a["font-size"] && (s.fontSize = a["font-size"]);
1910
- a["font-weight"] && (s.fontWeight = a["font-weight"]);
1911
- a["font-style"] && (s.fontStyle = a["font-style"]);
1912
- res.node.string && (res.paper.span.innerHTML = (res.node.string + E)[rp](/</g, "&#60;")[rp](/&/g, "&#38;")[rp](/\n/g, "<br>"));
1913
- res.W = a.w = res.paper.span.offsetWidth;
1914
- res.H = a.h = res.paper.span.offsetHeight;
1915
- res.X = a.x;
1916
- res.Y = a.y + round(res.H / 2);
1917
-
1918
- // text-anchor emulationm
1919
- switch (a["text-anchor"]) {
1920
- case "start":
1921
- res.node.style["v-text-align"] = "left";
1922
- res.bbx = round(res.W / 2);
1923
- break;
1924
- case "end":
1925
- res.node.style["v-text-align"] = "right";
1926
- res.bbx = -round(res.W / 2);
1927
- break;
1928
- default:
1929
- res.node.style["v-text-align"] = "center";
1930
- break;
1931
- }
1932
- }
1933
- };
1934
- addGradientFill = function (o, gradient) {
1935
- o.attrs = o.attrs || {};
1936
- var attrs = o.attrs,
1937
- fill,
1938
- type = "linear",
1939
- fxfy = ".5 .5";
1940
- o.attrs.gradient = gradient;
1941
- gradient = (gradient + E)[rp](radial_gradient, function (all, fx, fy) {
1942
- type = "radial";
1943
- if (fx && fy) {
1944
- fx = toFloat(fx);
1945
- fy = toFloat(fy);
1946
- pow(fx - .5, 2) + pow(fy - .5, 2) > .25 && (fy = math.sqrt(.25 - pow(fx - .5, 2)) * ((fy > .5) * 2 - 1) + .5);
1947
- fxfy = fx + S + fy;
1948
- }
1949
- return E;
1950
- });
1951
- gradient = gradient[split](/\s*\-\s*/);
1952
- if (type == "linear") {
1953
- var angle = gradient.shift();
1954
- angle = -toFloat(angle);
1955
- if (isNaN(angle)) {
1956
- return null;
1957
- }
1958
- }
1959
- var dots = parseDots(gradient);
1960
- if (!dots) {
1961
- return null;
1962
- }
1963
- o = o.shape || o.node;
1964
- fill = o.getElementsByTagName(fillString)[0] || createNode(fillString);
1965
- !fill.parentNode && o.appendChild(fill);
1966
- if (dots[length]) {
1967
- fill.on = true;
1968
- fill.method = "none";
1969
- fill.color = dots[0].color;
1970
- fill.color2 = dots[dots[length] - 1].color;
1971
- var clrs = [];
1972
- for (var i = 0, ii = dots[length]; i < ii; i++) {
1973
- dots[i].offset && clrs[push](dots[i].offset + S + dots[i].color);
1974
- }
1975
- fill.colors && (fill.colors.value = clrs[length] ? clrs[join]() : "0% " + fill.color);
1976
- if (type == "radial") {
1977
- fill.type = "gradientradial";
1978
- fill.focus = "100%";
1979
- fill.focussize = fxfy;
1980
- fill.focusposition = fxfy;
1981
- } else {
1982
- fill.type = "gradient";
1983
- fill.angle = (270 - angle) % 360;
1984
- }
1985
- }
1986
- return 1;
1987
- };
1988
- Element = function (node, group, vml) {
1989
- var Rotation = 0,
1990
- RotX = 0,
1991
- RotY = 0,
1992
- Scale = 1;
1993
- this[0] = node;
1994
- this.id = R._oid++;
1995
- this.node = node;
1996
- node.raphael = this;
1997
- this.X = 0;
1998
- this.Y = 0;
1999
- this.attrs = {};
2000
- this.Group = group;
2001
- this.paper = vml;
2002
- this._ = {
2003
- tx: 0,
2004
- ty: 0,
2005
- rt: {deg:0},
2006
- sx: 1,
2007
- sy: 1
2008
- };
2009
- !vml.bottom && (vml.bottom = this);
2010
- this.prev = vml.top;
2011
- vml.top && (vml.top.next = this);
2012
- vml.top = this;
2013
- this.next = null;
2014
- };
2015
- Element[proto].rotate = function (deg, cx, cy) {
2016
- if (this.removed) {
2017
- return this;
2018
- }
2019
- if (deg == null) {
2020
- if (this._.rt.cx) {
2021
- return [this._.rt.deg, this._.rt.cx, this._.rt.cy][join](S);
2022
- }
2023
- return this._.rt.deg;
2024
- }
2025
- deg = (deg + E)[split](separator);
2026
- if (deg[length] - 1) {
2027
- cx = toFloat(deg[1]);
2028
- cy = toFloat(deg[2]);
2029
- }
2030
- deg = toFloat(deg[0]);
2031
- if (cx != null) {
2032
- this._.rt.deg = deg;
2033
- } else {
2034
- this._.rt.deg += deg;
2035
- }
2036
- cy == null && (cx = null);
2037
- this._.rt.cx = cx;
2038
- this._.rt.cy = cy;
2039
- this.setBox(this.attrs, cx, cy);
2040
- this.Group.style.rotation = this._.rt.deg;
2041
- // gradient fix for rotation. TODO
2042
- // var fill = (this.shape || this.node).getElementsByTagName(fillString);
2043
- // fill = fill[0] || {};
2044
- // var b = ((360 - this._.rt.deg) - 270) % 360;
2045
- // !R.is(fill.angle, "undefined") && (fill.angle = b);
2046
- return this;
2047
- };
2048
- Element[proto].setBox = function (params, cx, cy) {
2049
- if (this.removed) {
2050
- return this;
2051
- }
2052
- var gs = this.Group.style,
2053
- os = (this.shape && this.shape.style) || this.node.style;
2054
- params = params || {};
2055
- for (var i in params) if (params[has](i)) {
2056
- this.attrs[i] = params[i];
2057
- }
2058
- cx = cx || this._.rt.cx;
2059
- cy = cy || this._.rt.cy;
2060
- var attr = this.attrs,
2061
- x,
2062
- y,
2063
- w,
2064
- h;
2065
- switch (this.type) {
2066
- case "circle":
2067
- x = attr.cx - attr.r;
2068
- y = attr.cy - attr.r;
2069
- w = h = attr.r * 2;
2070
- break;
2071
- case "ellipse":
2072
- x = attr.cx - attr.rx;
2073
- y = attr.cy - attr.ry;
2074
- w = attr.rx * 2;
2075
- h = attr.ry * 2;
2076
- break;
2077
- case "image":
2078
- x = +attr.x;
2079
- y = +attr.y;
2080
- w = attr.width || 0;
2081
- h = attr.height || 0;
2082
- break;
2083
- case "text":
2084
- this.textpath.v = ["m", round(attr.x), ", ", round(attr.y - 2), "l", round(attr.x) + 1, ", ", round(attr.y - 2)][join](E);
2085
- x = attr.x - round(this.W / 2);
2086
- y = attr.y - this.H / 2;
2087
- w = this.W;
2088
- h = this.H;
2089
- break;
2090
- case "rect":
2091
- case "path":
2092
- if (!this.attrs.path) {
2093
- x = 0;
2094
- y = 0;
2095
- w = this.paper.width;
2096
- h = this.paper.height;
2097
- } else {
2098
- var dim = pathDimensions(this.attrs.path);
2099
- x = dim.x;
2100
- y = dim.y;
2101
- w = dim.width;
2102
- h = dim.height;
2103
- }
2104
- break;
2105
- default:
2106
- x = 0;
2107
- y = 0;
2108
- w = this.paper.width;
2109
- h = this.paper.height;
2110
- break;
2111
- }
2112
- cx = (cx == null) ? x + w / 2 : cx;
2113
- cy = (cy == null) ? y + h / 2 : cy;
2114
- var left = cx - this.paper.width / 2,
2115
- top = cy - this.paper.height / 2, t;
2116
- gs.left != (t = left + "px") && (gs.left = t);
2117
- gs.top != (t = top + "px") && (gs.top = t);
2118
- this.X = pathlike[has](this.type) ? -left : x;
2119
- this.Y = pathlike[has](this.type) ? -top : y;
2120
- this.W = w;
2121
- this.H = h;
2122
- if (pathlike[has](this.type)) {
2123
- os.left != (t = -left * zoom + "px") && (os.left = t);
2124
- os.top != (t = -top * zoom + "px") && (os.top = t);
2125
- } else if (this.type == "text") {
2126
- os.left != (t = -left + "px") && (os.left = t);
2127
- os.top != (t = -top + "px") && (os.top = t);
2128
- } else {
2129
- gs.width != (t = this.paper.width + "px") && (gs.width = t);
2130
- gs.height != (t = this.paper.height + "px") && (gs.height = t);
2131
- os.left != (t = x - left + "px") && (os.left = t);
2132
- os.top != (t = y - top + "px") && (os.top = t);
2133
- os.width != (t = w + "px") && (os.width = t);
2134
- os.height != (t = h + "px") && (os.height = t);
2135
- }
2136
- };
2137
- Element[proto].hide = function () {
2138
- !this.removed && (this.Group.style.display = "none");
2139
- return this;
2140
- };
2141
- Element[proto].show = function () {
2142
- !this.removed && (this.Group.style.display = "block");
2143
- return this;
2144
- };
2145
- Element[proto].getBBox = function () {
2146
- if (this.removed) {
2147
- return this;
2148
- }
2149
- if (pathlike[has](this.type)) {
2150
- return pathDimensions(this.attrs.path);
2151
- }
2152
- return {
2153
- x: this.X + (this.bbx || 0),
2154
- y: this.Y,
2155
- width: this.W,
2156
- height: this.H
2157
- };
2158
- };
2159
- Element[proto].remove = function () {
2160
- if (this.removed) {
2161
- return;
2162
- }
2163
- tear(this, this.paper);
2164
- this.node.parentNode.removeChild(this.node);
2165
- this.Group.parentNode.removeChild(this.Group);
2166
- this.shape && this.shape.parentNode.removeChild(this.shape);
2167
- for (var i in this) {
2168
- delete this[i];
2169
- }
2170
- this.removed = true;
2171
- };
2172
- Element[proto].attr = function (name, value) {
2173
- if (this.removed) {
2174
- return this;
2175
- }
2176
- if (name == null) {
2177
- var res = {};
2178
- for (var i in this.attrs) if (this.attrs[has](i)) {
2179
- res[i] = this.attrs[i];
2180
- }
2181
- this._.rt.deg && (res.rotation = this.rotate());
2182
- (this._.sx != 1 || this._.sy != 1) && (res.scale = this.scale());
2183
- res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient;
2184
- return res;
2185
- }
2186
- if (value == null && R.is(name, string)) {
2187
- if (name == "translation") {
2188
- return translate.call(this);
2189
- }
2190
- if (name == "rotation") {
2191
- return this.rotate();
2192
- }
2193
- if (name == "scale") {
2194
- return this.scale();
2195
- }
2196
- if (name == fillString && this.attrs.fill == "none" && this.attrs.gradient) {
2197
- return this.attrs.gradient;
2198
- }
2199
- return this.attrs[name];
2200
- }
2201
- if (this.attrs && value == null && R.is(name, array)) {
2202
- var ii, values = {};
2203
- for (i = 0, ii = name[length]; i < ii; i++) {
2204
- values[name[i]] = this.attr(name[i]);
2205
- }
2206
- return values;
2207
- }
2208
- var params;
2209
- if (value != null) {
2210
- params = {};
2211
- params[name] = value;
2212
- }
2213
- value == null && R.is(name, "object") && (params = name);
2214
- if (params) {
2215
- if (params.text && this.type == "text") {
2216
- this.node.string = params.text;
2217
- }
2218
- setFillAndStroke(this, params);
2219
- if (params.gradient && (({circle: 1, ellipse: 1})[has](this.type) || (params.gradient + E).charAt() != "r")) {
2220
- addGradientFill(this, params.gradient);
2221
- }
2222
- (!pathlike[has](this.type) || this._.rt.deg) && this.setBox(this.attrs);
2223
- }
2224
- return this;
2225
- };
2226
- Element[proto].toFront = function () {
2227
- !this.removed && this.Group.parentNode[appendChild](this.Group);
2228
- this.paper.top != this && tofront(this, this.paper);
2229
- return this;
2230
- };
2231
- Element[proto].toBack = function () {
2232
- if (this.removed) {
2233
- return this;
2234
- }
2235
- if (this.Group.parentNode.firstChild != this.Group) {
2236
- this.Group.parentNode.insertBefore(this.Group, this.Group.parentNode.firstChild);
2237
- toback(this, this.paper);
2238
- }
2239
- return this;
2240
- };
2241
- Element[proto].insertAfter = function (element) {
2242
- if (this.removed) {
2243
- return this;
2244
- }
2245
- if (element.Group.nextSibling) {
2246
- element.Group.parentNode.insertBefore(this.Group, element.Group.nextSibling);
2247
- } else {
2248
- element.Group.parentNode[appendChild](this.Group);
2249
- }
2250
- insertafter(this, element, this.paper);
2251
- return this;
2252
- };
2253
- Element[proto].insertBefore = function (element) {
2254
- if (this.removed) {
2255
- return this;
2256
- }
2257
- element.Group.parentNode.insertBefore(this.Group, element.Group);
2258
- insertbefore(this, element, this.paper);
2259
- return this;
2260
- };
2261
- var blurregexp = / progid:\S+Blur\([^\)]+\)/g;
2262
- Element[proto].blur = function (size) {
2263
- var s = this.node.style,
2264
- f = s.filter;
2265
- f = f.replace(blurregexp, "");
2266
- if (+size !== 0) {
2267
- this.attrs.blur = size;
2268
- s.filter = f + ms + ".Blur(pixelradius=" + (+size || 1.5) + ")";
2269
- s.margin = Raphael.format("-{0}px 0 0 -{0}px", Math.round(+size || 1.5));
2270
- } else {
2271
- s.filter = f;
2272
- s.margin = 0;
2273
- delete this.attrs.blur;
2274
- }
2275
- };
2276
-
2277
- theCircle = function (vml, x, y, r) {
2278
- var g = createNode("group"),
2279
- o = createNode("oval"),
2280
- ol = o.style;
2281
- g.style.cssText = "position:absolute;left:0;top:0;width:" + vml.width + "px;height:" + vml.height + "px";
2282
- g.coordsize = coordsize;
2283
- g.coordorigin = vml.coordorigin;
2284
- g[appendChild](o);
2285
- var res = new Element(o, g, vml);
2286
- res.type = "circle";
2287
- setFillAndStroke(res, {stroke: "#000", fill: "none"});
2288
- res.attrs.cx = x;
2289
- res.attrs.cy = y;
2290
- res.attrs.r = r;
2291
- res.setBox({x: x - r, y: y - r, width: r * 2, height: r * 2});
2292
- vml.canvas[appendChild](g);
2293
- return res;
2294
- };
2295
- function rectPath(x, y, w, h, r) {
2296
- if (r) {
2297
- return R.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z", x + r, y, w - r * 2, r, -r, h - r * 2, r * 2 - w, r * 2 - h);
2298
- } else {
2299
- return R.format("M{0},{1}l{2},0,0,{3},{4},0z", x, y, w, h, -w);
2300
- }
2301
- }
2302
- theRect = function (vml, x, y, w, h, r) {
2303
- var path = rectPath(x, y, w, h, r),
2304
- res = vml.path(path),
2305
- a = res.attrs;
2306
- res.X = a.x = x;
2307
- res.Y = a.y = y;
2308
- res.W = a.width = w;
2309
- res.H = a.height = h;
2310
- a.r = r;
2311
- a.path = path;
2312
- res.type = "rect";
2313
- return res;
2314
- };
2315
- theEllipse = function (vml, x, y, rx, ry) {
2316
- var g = createNode("group"),
2317
- o = createNode("oval"),
2318
- ol = o.style;
2319
- g.style.cssText = "position:absolute;left:0;top:0;width:" + vml.width + "px;height:" + vml.height + "px";
2320
- g.coordsize = coordsize;
2321
- g.coordorigin = vml.coordorigin;
2322
- g[appendChild](o);
2323
- var res = new Element(o, g, vml);
2324
- res.type = "ellipse";
2325
- setFillAndStroke(res, {stroke: "#000"});
2326
- res.attrs.cx = x;
2327
- res.attrs.cy = y;
2328
- res.attrs.rx = rx;
2329
- res.attrs.ry = ry;
2330
- res.setBox({x: x - rx, y: y - ry, width: rx * 2, height: ry * 2});
2331
- vml.canvas[appendChild](g);
2332
- return res;
2333
- };
2334
- theImage = function (vml, src, x, y, w, h) {
2335
- var g = createNode("group"),
2336
- o = createNode("image"),
2337
- ol = o.style;
2338
- g.style.cssText = "position:absolute;left:0;top:0;width:" + vml.width + "px;height:" + vml.height + "px";
2339
- g.coordsize = coordsize;
2340
- g.coordorigin = vml.coordorigin;
2341
- o.src = src;
2342
- g[appendChild](o);
2343
- var res = new Element(o, g, vml);
2344
- res.type = "image";
2345
- res.attrs.src = src;
2346
- res.attrs.x = x;
2347
- res.attrs.y = y;
2348
- res.attrs.w = w;
2349
- res.attrs.h = h;
2350
- res.setBox({x: x, y: y, width: w, height: h});
2351
- vml.canvas[appendChild](g);
2352
- return res;
2353
- };
2354
- theText = function (vml, x, y, text) {
2355
- var g = createNode("group"),
2356
- el = createNode("shape"),
2357
- ol = el.style,
2358
- path = createNode("path"),
2359
- ps = path.style,
2360
- o = createNode("textpath");
2361
- g.style.cssText = "position:absolute;left:0;top:0;width:" + vml.width + "px;height:" + vml.height + "px";
2362
- g.coordsize = coordsize;
2363
- g.coordorigin = vml.coordorigin;
2364
- path.v = R.format("m{0},{1}l{2},{1}", round(x * 10), round(y * 10), round(x * 10) + 1);
2365
- path.textpathok = true;
2366
- ol.width = vml.width;
2367
- ol.height = vml.height;
2368
- o.string = text + E;
2369
- o.on = true;
2370
- el[appendChild](o);
2371
- el[appendChild](path);
2372
- g[appendChild](el);
2373
- var res = new Element(o, g, vml);
2374
- res.shape = el;
2375
- res.textpath = path;
2376
- res.type = "text";
2377
- res.attrs.text = text;
2378
- res.attrs.x = x;
2379
- res.attrs.y = y;
2380
- res.attrs.w = 1;
2381
- res.attrs.h = 1;
2382
- setFillAndStroke(res, {font: availableAttrs.font, stroke: "none", fill: "#000"});
2383
- res.setBox();
2384
- vml.canvas[appendChild](g);
2385
- return res;
2386
- };
2387
- setSize = function (width, height) {
2388
- var cs = this.canvas.style;
2389
- width == +width && (width += "px");
2390
- height == +height && (height += "px");
2391
- cs.width = width;
2392
- cs.height = height;
2393
- cs.clip = "rect(0 " + width + " " + height + " 0)";
2394
- return this;
2395
- };
2396
- var createNode;
2397
- doc.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
2398
- try {
2399
- !doc.namespaces.rvml && doc.namespaces.add("rvml", "urn:schemas-microsoft-com:vml");
2400
- createNode = function (tagName) {
2401
- return doc.createElement('<rvml:' + tagName + ' class="rvml">');
2402
- };
2403
- } catch (e) {
2404
- createNode = function (tagName) {
2405
- return doc.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
2406
- };
2407
- }
2408
- create = function () {
2409
- var con = getContainer[apply](0, arguments),
2410
- container = con.container,
2411
- height = con.height,
2412
- s,
2413
- width = con.width,
2414
- x = con.x,
2415
- y = con.y;
2416
- if (!container) {
2417
- throw new Error("VML container not found.");
2418
- }
2419
- var res = new Paper,
2420
- c = res.canvas = doc.createElement("div"),
2421
- cs = c.style;
2422
- x = x || 0;
2423
- y = y || 0;
2424
- width = width || 512;
2425
- height = height || 342;
2426
- width == +width && (width += "px");
2427
- height == +height && (height += "px");
2428
- res.width = 1e3;
2429
- res.height = 1e3;
2430
- res.coordsize = zoom * 1e3 + S + zoom * 1e3;
2431
- res.coordorigin = "0 0";
2432
- res.span = doc.createElement("span");
2433
- res.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
2434
- c[appendChild](res.span);
2435
- cs.cssText = R.format("width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden", width, height);
2436
- if (container == 1) {
2437
- doc.body[appendChild](c);
2438
- cs.left = x + "px";
2439
- cs.top = y + "px";
2440
- cs.position = "absolute";
2441
- } else {
2442
- if (container.firstChild) {
2443
- container.insertBefore(c, container.firstChild);
2444
- } else {
2445
- container[appendChild](c);
2446
- }
2447
- }
2448
- plugins.call(res, res, R.fn);
2449
- return res;
2450
- };
2451
- Paper[proto].clear = function () {
2452
- this.canvas.innerHTML = E;
2453
- this.span = doc.createElement("span");
2454
- this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
2455
- this.canvas[appendChild](this.span);
2456
- this.bottom = this.top = null;
2457
- };
2458
- Paper[proto].remove = function () {
2459
- this.canvas.parentNode.removeChild(this.canvas);
2460
- for (var i in this) {
2461
- this[i] = removed(i);
2462
- }
2463
- return true;
2464
- };
2465
- }
2466
-
2467
- // rest
2468
- // Safari or Chrome (WebKit) rendering bug workaround method
2469
- if ((/^Apple|^Google/).test(win.navigator.vendor) && (!(win.navigator.userAgent.indexOf("Version/4.0") + 1) || win.navigator.platform.slice(0, 2) == "iP")) {
2470
- Paper[proto].safari = function () {
2471
- var rect = this.rect(-99, -99, this.width + 99, this.height + 99);
2472
- win.setTimeout(function () {rect.remove();});
2473
- };
2474
- } else {
2475
- Paper[proto].safari = function () {};
2476
- }
2477
-
2478
- // Events
2479
- var preventDefault = function () {
2480
- this.returnValue = false;
2481
- },
2482
- preventTouch = function () {
2483
- return this.originalEvent.preventDefault();
2484
- },
2485
- stopPropagation = function () {
2486
- this.cancelBubble = true;
2487
- },
2488
- stopTouch = function () {
2489
- return this.originalEvent.stopPropagation();
2490
- },
2491
- addEvent = (function () {
2492
- if (doc.addEventListener) {
2493
- return function (obj, type, fn, element) {
2494
- var realName = supportsTouch && touchMap[type] ? touchMap[type] : type;
2495
- var f = function (e) {
2496
- if (supportsTouch && touchMap[has](type)) {
2497
- for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) {
2498
- if (e.targetTouches[i].target == obj) {
2499
- var olde = e;
2500
- e = e.targetTouches[i];
2501
- e.originalEvent = olde;
2502
- e.preventDefault = preventTouch;
2503
- e.stopPropagation = stopTouch;
2504
- break;
2505
- }
2506
- }
2507
- }
2508
- return fn.call(element, e);
2509
- };
2510
- obj.addEventListener(realName, f, false);
2511
- return function () {
2512
- obj.removeEventListener(realName, f, false);
2513
- return true;
2514
- };
2515
- };
2516
- } else if (doc.attachEvent) {
2517
- return function (obj, type, fn, element) {
2518
- var f = function (e) {
2519
- e = e || win.event;
2520
- e.preventDefault = e.preventDefault || preventDefault;
2521
- e.stopPropagation = e.stopPropagation || stopPropagation;
2522
- return fn.call(element, e);
2523
- };
2524
- obj.attachEvent("on" + type, f);
2525
- var detacher = function () {
2526
- obj.detachEvent("on" + type, f);
2527
- return true;
2528
- };
2529
- return detacher;
2530
- };
2531
- }
2532
- })();
2533
- for (var i = events[length]; i--;) {
2534
- (function (eventName) {
2535
- R[eventName] = Element[proto][eventName] = function (fn) {
2536
- if (R.is(fn, "function")) {
2537
- this.events = this.events || [];
2538
- this.events.push({name: eventName, f: fn, unbind: addEvent(this.shape || this.node || doc, eventName, fn, this)});
2539
- }
2540
- return this;
2541
- };
2542
- R["un" + eventName] = Element[proto]["un" + eventName] = function (fn) {
2543
- var events = this.events,
2544
- l = events[length];
2545
- while (l--) if (events[l].name == eventName && events[l].f == fn) {
2546
- events[l].unbind();
2547
- events.splice(l, 1);
2548
- !events.length && delete this.events;
2549
- return this;
2550
- }
2551
- return this;
2552
- };
2553
- })(events[i]);
2554
- }
2555
- Element[proto].hover = function (f_in, f_out) {
2556
- return this.mouseover(f_in).mouseout(f_out);
2557
- };
2558
- Element[proto].unhover = function (f_in, f_out) {
2559
- return this.unmouseover(f_in).unmouseout(f_out);
2560
- };
2561
- Element[proto].drag = function (onmove, onstart, onend) {
2562
- this._drag = {};
2563
- var el = this.mousedown(function (e) {
2564
- (e.originalEvent ? e.originalEvent : e).preventDefault();
2565
- this._drag.x = e.clientX;
2566
- this._drag.y = e.clientY;
2567
- this._drag.id = e.identifier;
2568
- onstart && onstart.call(this, e.clientX, e.clientY);
2569
- Raphael.mousemove(move).mouseup(up);
2570
- }),
2571
- move = function (e) {
2572
- var x = e.clientX,
2573
- y = e.clientY;
2574
- if (supportsTouch) {
2575
- var i = e.touches.length,
2576
- touch;
2577
- while (i--) {
2578
- touch = e.touches[i];
2579
- if (touch.identifier == el._drag.id) {
2580
- x = touch.clientX;
2581
- y = touch.clientY;
2582
- (e.originalEvent ? e.originalEvent : e).preventDefault();
2583
- break;
2584
- }
2585
- }
2586
- } else {
2587
- e.preventDefault();
2588
- }
2589
- onmove && onmove.call(el, x - el._drag.x, y - el._drag.y, x, y);
2590
- },
2591
- up = function () {
2592
- el._drag = {};
2593
- Raphael.unmousemove(move).unmouseup(up);
2594
- onend && onend.call(el);
2595
- };
2596
- return this;
2597
- };
2598
- Paper[proto].circle = function (x, y, r) {
2599
- return theCircle(this, x || 0, y || 0, r || 0);
2600
- };
2601
- Paper[proto].rect = function (x, y, w, h, r) {
2602
- return theRect(this, x || 0, y || 0, w || 0, h || 0, r || 0);
2603
- };
2604
- Paper[proto].ellipse = function (x, y, rx, ry) {
2605
- return theEllipse(this, x || 0, y || 0, rx || 0, ry || 0);
2606
- };
2607
- Paper[proto].path = function (pathString) {
2608
- pathString && !R.is(pathString, string) && !R.is(pathString[0], array) && (pathString += E);
2609
- return thePath(R.format[apply](R, arguments), this);
2610
- };
2611
- Paper[proto].image = function (src, x, y, w, h) {
2612
- return theImage(this, src || "about:blank", x || 0, y || 0, w || 0, h || 0);
2613
- };
2614
- Paper[proto].text = function (x, y, text) {
2615
- return theText(this, x || 0, y || 0, text || E);
2616
- };
2617
- Paper[proto].set = function (itemsArray) {
2618
- arguments[length] > 1 && (itemsArray = Array[proto].splice.call(arguments, 0, arguments[length]));
2619
- return new Set(itemsArray);
2620
- };
2621
- Paper[proto].setSize = setSize;
2622
- Paper[proto].top = Paper[proto].bottom = null;
2623
- Paper[proto].raphael = R;
2624
- function x_y() {
2625
- return this.x + S + this.y;
2626
- }
2627
- Element[proto].resetScale = function () {
2628
- if (this.removed) {
2629
- return this;
2630
- }
2631
- this._.sx = 1;
2632
- this._.sy = 1;
2633
- this.attrs.scale = "1 1";
2634
- };
2635
- Element[proto].scale = function (x, y, cx, cy) {
2636
- if (this.removed) {
2637
- return this;
2638
- }
2639
- if (x == null && y == null) {
2640
- return {
2641
- x: this._.sx,
2642
- y: this._.sy,
2643
- toString: x_y
2644
- };
2645
- }
2646
- y = y || x;
2647
- !+y && (y = x);
2648
- var dx,
2649
- dy,
2650
- dcx,
2651
- dcy,
2652
- a = this.attrs;
2653
- if (x != 0) {
2654
- var bb = this.getBBox(),
2655
- rcx = bb.x + bb.width / 2,
2656
- rcy = bb.y + bb.height / 2,
2657
- kx = x / this._.sx,
2658
- ky = y / this._.sy;
2659
- cx = (+cx || cx == 0) ? cx : rcx;
2660
- cy = (+cy || cy == 0) ? cy : rcy;
2661
- var dirx = ~~(x / math.abs(x)),
2662
- diry = ~~(y / math.abs(y)),
2663
- s = this.node.style,
2664
- ncx = cx + (rcx - cx) * kx,
2665
- ncy = cy + (rcy - cy) * ky;
2666
- switch (this.type) {
2667
- case "rect":
2668
- case "image":
2669
- var neww = a.width * dirx * kx,
2670
- newh = a.height * diry * ky;
2671
- this.attr({
2672
- height: newh,
2673
- r: a.r * mmin(dirx * kx, diry * ky),
2674
- width: neww,
2675
- x: ncx - neww / 2,
2676
- y: ncy - newh / 2
2677
- });
2678
- break;
2679
- case "circle":
2680
- case "ellipse":
2681
- this.attr({
2682
- rx: a.rx * dirx * kx,
2683
- ry: a.ry * diry * ky,
2684
- r: a.r * mmin(dirx * kx, diry * ky),
2685
- cx: ncx,
2686
- cy: ncy
2687
- });
2688
- break;
2689
- case "text":
2690
- this.attr({
2691
- x: ncx,
2692
- y: ncy
2693
- });
2694
- break;
2695
- case "path":
2696
- var path = pathToRelative(a.path),
2697
- skip = true;
2698
- for (var i = 0, ii = path[length]; i < ii; i++) {
2699
- var p = path[i],
2700
- P0 = upperCase.call(p[0]);
2701
- if (P0 == "M" && skip) {
2702
- continue;
2703
- } else {
2704
- skip = false;
2705
- }
2706
- if (P0 == "A") {
2707
- p[path[i][length] - 2] *= kx;
2708
- p[path[i][length] - 1] *= ky;
2709
- p[1] *= dirx * kx;
2710
- p[2] *= diry * ky;
2711
- p[5] = +!(dirx + diry ? !+p[5] : +p[5]);
2712
- } else if (P0 == "H") {
2713
- for (var j = 1, jj = p[length]; j < jj; j++) {
2714
- p[j] *= kx;
2715
- }
2716
- } else if (P0 == "V") {
2717
- for (j = 1, jj = p[length]; j < jj; j++) {
2718
- p[j] *= ky;
2719
- }
2720
- } else {
2721
- for (j = 1, jj = p[length]; j < jj; j++) {
2722
- p[j] *= (j % 2) ? kx : ky;
2723
- }
2724
- }
2725
- }
2726
- var dim2 = pathDimensions(path);
2727
- dx = ncx - dim2.x - dim2.width / 2;
2728
- dy = ncy - dim2.y - dim2.height / 2;
2729
- path[0][1] += dx;
2730
- path[0][2] += dy;
2731
- this.attr({path: path});
2732
- break;
2733
- }
2734
- if (this.type in {text: 1, image:1} && (dirx != 1 || diry != 1)) {
2735
- if (this.transformations) {
2736
- this.transformations[2] = "scale("[concat](dirx, ",", diry, ")");
2737
- this.node[setAttribute]("transform", this.transformations[join](S));
2738
- dx = (dirx == -1) ? -a.x - (neww || 0) : a.x;
2739
- dy = (diry == -1) ? -a.y - (newh || 0) : a.y;
2740
- this.attr({x: dx, y: dy});
2741
- a.fx = dirx - 1;
2742
- a.fy = diry - 1;
2743
- } else {
2744
- this.node.filterMatrix = ms + ".Matrix(M11="[concat](dirx,
2745
- ", M12=0, M21=0, M22=", diry,
2746
- ", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");
2747
- s.filter = (this.node.filterMatrix || E) + (this.node.filterOpacity || E);
2748
- }
2749
- } else {
2750
- if (this.transformations) {
2751
- this.transformations[2] = E;
2752
- this.node[setAttribute]("transform", this.transformations[join](S));
2753
- a.fx = 0;
2754
- a.fy = 0;
2755
- } else {
2756
- this.node.filterMatrix = E;
2757
- s.filter = (this.node.filterMatrix || E) + (this.node.filterOpacity || E);
2758
- }
2759
- }
2760
- a.scale = [x, y, cx, cy][join](S);
2761
- this._.sx = x;
2762
- this._.sy = y;
2763
- }
2764
- return this;
2765
- };
2766
- Element[proto].clone = function () {
2767
- if (this.removed) {
2768
- return null;
2769
- }
2770
- var attr = this.attr();
2771
- delete attr.scale;
2772
- delete attr.translation;
2773
- return this.paper[this.type]().attr(attr);
2774
- };
2775
- var getPointAtSegmentLength = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) {
2776
- var len = 0,
2777
- old;
2778
- for (var i = 0; i < 1.001; i+=.001) {
2779
- var dot = R.findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, i);
2780
- i && (len += pow(pow(old.x - dot.x, 2) + pow(old.y - dot.y, 2), .5));
2781
- if (len >= length) {
2782
- return dot;
2783
- }
2784
- old = dot;
2785
- }
2786
- }),
2787
- getLengthFactory = function (istotal, subpath) {
2788
- return function (path, length, onlystart) {
2789
- path = path2curve(path);
2790
- var x, y, p, l, sp = "", subpaths = {}, point,
2791
- len = 0;
2792
- for (var i = 0, ii = path.length; i < ii; i++) {
2793
- p = path[i];
2794
- if (p[0] == "M") {
2795
- x = +p[1];
2796
- y = +p[2];
2797
- } else {
2798
- l = segmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
2799
- if (len + l > length) {
2800
- if (subpath && !subpaths.start) {
2801
- point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
2802
- sp += ["C", point.start.x, point.start.y, point.m.x, point.m.y, point.x, point.y];
2803
- if (onlystart) {return sp;}
2804
- subpaths.start = sp;
2805
- sp = ["M", point.x, point.y + "C", point.n.x, point.n.y, point.end.x, point.end.y, p[5], p[6]][join]();
2806
- len += l;
2807
- x = +p[5];
2808
- y = +p[6];
2809
- continue;
2810
- }
2811
- if (!istotal && !subpath) {
2812
- point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
2813
- return {x: point.x, y: point.y, alpha: point.alpha};
2814
- }
2815
- }
2816
- len += l;
2817
- x = +p[5];
2818
- y = +p[6];
2819
- }
2820
- sp += p;
2821
- }
2822
- subpaths.end = sp;
2823
- point = istotal ? len : subpath ? subpaths : R.findDotsAtSegment(x, y, p[1], p[2], p[3], p[4], p[5], p[6], 1);
2824
- point.alpha && (point = {x: point.x, y: point.y, alpha: point.alpha});
2825
- return point;
2826
- };
2827
- },
2828
- segmentLength = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
2829
- var old = {x: 0, y: 0},
2830
- len = 0;
2831
- for (var i = 0; i < 1.01; i+=.01) {
2832
- var dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, i);
2833
- i && (len += pow(pow(old.x - dot.x, 2) + pow(old.y - dot.y, 2), .5));
2834
- old = dot;
2835
- }
2836
- return len;
2837
- });
2838
- var getTotalLength = getLengthFactory(1),
2839
- getPointAtLength = getLengthFactory(),
2840
- getSubpathsAtLength = getLengthFactory(0, 1);
2841
- Element[proto].getTotalLength = function () {
2842
- if (this.type != "path") {return;}
2843
- if (this.node.getTotalLength) {
2844
- return this.node.getTotalLength();
2845
- }
2846
- return getTotalLength(this.attrs.path);
2847
- };
2848
- Element[proto].getPointAtLength = function (length) {
2849
- if (this.type != "path") {return;}
2850
- return getPointAtLength(this.attrs.path, length);
2851
- };
2852
- Element[proto].getSubpath = function (from, to) {
2853
- if (this.type != "path") {return;}
2854
- if (math.abs(this.getTotalLength() - to) < 1e-6) {
2855
- return getSubpathsAtLength(this.attrs.path, from).end;
2856
- }
2857
- var a = getSubpathsAtLength(this.attrs.path, to, 1);
2858
- return from ? getSubpathsAtLength(a, from).end : a;
2859
- };
2860
-
2861
- // animation easing formulas
2862
- R.easing_formulas = {
2863
- linear: function (n) {
2864
- return n;
2865
- },
2866
- "<": function (n) {
2867
- return pow(n, 3);
2868
- },
2869
- ">": function (n) {
2870
- return pow(n - 1, 3) + 1;
2871
- },
2872
- "<>": function (n) {
2873
- n = n * 2;
2874
- if (n < 1) {
2875
- return pow(n, 3) / 2;
2876
- }
2877
- n -= 2;
2878
- return (pow(n, 3) + 2) / 2;
2879
- },
2880
- backIn: function (n) {
2881
- var s = 1.70158;
2882
- return n * n * ((s + 1) * n - s);
2883
- },
2884
- backOut: function (n) {
2885
- n = n - 1;
2886
- var s = 1.70158;
2887
- return n * n * ((s + 1) * n + s) + 1;
2888
- },
2889
- elastic: function (n) {
2890
- if (n == 0 || n == 1) {
2891
- return n;
2892
- }
2893
- var p = .3,
2894
- s = p / 4;
2895
- return pow(2, -10 * n) * math.sin((n - s) * (2 * math.PI) / p) + 1;
2896
- },
2897
- bounce: function (n) {
2898
- var s = 7.5625,
2899
- p = 2.75,
2900
- l;
2901
- if (n < (1 / p)) {
2902
- l = s * n * n;
2903
- } else {
2904
- if (n < (2 / p)) {
2905
- n -= (1.5 / p);
2906
- l = s * n * n + .75;
2907
- } else {
2908
- if (n < (2.5 / p)) {
2909
- n -= (2.25 / p);
2910
- l = s * n * n + .9375;
2911
- } else {
2912
- n -= (2.625 / p);
2913
- l = s * n * n + .984375;
2914
- }
2915
- }
2916
- }
2917
- return l;
2918
- }
2919
- };
2920
-
2921
- var animationElements = {length : 0},
2922
- animation = function () {
2923
- var Now = +new Date;
2924
- for (var l in animationElements) if (l != "length" && animationElements[has](l)) {
2925
- var e = animationElements[l];
2926
- if (e.stop || e.el.removed) {
2927
- delete animationElements[l];
2928
- animationElements[length]--;
2929
- continue;
2930
- }
2931
- var time = Now - e.start,
2932
- ms = e.ms,
2933
- easing = e.easing,
2934
- from = e.from,
2935
- diff = e.diff,
2936
- to = e.to,
2937
- t = e.t,
2938
- prev = e.prev || 0,
2939
- that = e.el,
2940
- callback = e.callback,
2941
- set = {},
2942
- now;
2943
- if (time < ms) {
2944
- var pos = R.easing_formulas[easing] ? R.easing_formulas[easing](time / ms) : time / ms;
2945
- for (var attr in from) if (from[has](attr)) {
2946
- switch (availableAnimAttrs[attr]) {
2947
- case "along":
2948
- now = pos * ms * diff[attr];
2949
- to.back && (now = to.len - now);
2950
- var point = getPointAtLength(to[attr], now);
2951
- that.translate(diff.sx - diff.x || 0, diff.sy - diff.y || 0);
2952
- diff.x = point.x;
2953
- diff.y = point.y;
2954
- that.translate(point.x - diff.sx, point.y - diff.sy);
2955
- to.rot && that.rotate(diff.r + point.alpha, point.x, point.y);
2956
- break;
2957
- case nu:
2958
- now = +from[attr] + pos * ms * diff[attr];
2959
- break;
2960
- case "colour":
2961
- now = "rgb(" + [
2962
- upto255(round(from[attr].r + pos * ms * diff[attr].r)),
2963
- upto255(round(from[attr].g + pos * ms * diff[attr].g)),
2964
- upto255(round(from[attr].b + pos * ms * diff[attr].b))
2965
- ][join](",") + ")";
2966
- break;
2967
- case "path":
2968
- now = [];
2969
- for (var i = 0, ii = from[attr][length]; i < ii; i++) {
2970
- now[i] = [from[attr][i][0]];
2971
- for (var j = 1, jj = from[attr][i][length]; j < jj; j++) {
2972
- now[i][j] = +from[attr][i][j] + pos * ms * diff[attr][i][j];
2973
- }
2974
- now[i] = now[i][join](S);
2975
- }
2976
- now = now[join](S);
2977
- break;
2978
- case "csv":
2979
- switch (attr) {
2980
- case "translation":
2981
- var x = diff[attr][0] * (time - prev),
2982
- y = diff[attr][1] * (time - prev);
2983
- t.x += x;
2984
- t.y += y;
2985
- now = x + S + y;
2986
- break;
2987
- case "rotation":
2988
- now = +from[attr][0] + pos * ms * diff[attr][0];
2989
- from[attr][1] && (now += "," + from[attr][1] + "," + from[attr][2]);
2990
- break;
2991
- case "scale":
2992
- now = [+from[attr][0] + pos * ms * diff[attr][0], +from[attr][1] + pos * ms * diff[attr][1], (2 in to[attr] ? to[attr][2] : E), (3 in to[attr] ? to[attr][3] : E)][join](S);
2993
- break;
2994
- case "clip-rect":
2995
- now = [];
2996
- i = 4;
2997
- while (i--) {
2998
- now[i] = +from[attr][i] + pos * ms * diff[attr][i];
2999
- }
3000
- break;
3001
- }
3002
- break;
3003
- }
3004
- set[attr] = now;
3005
- }
3006
- that.attr(set);
3007
- that._run && that._run.call(that);
3008
- } else {
3009
- if (to.along) {
3010
- point = getPointAtLength(to.along, to.len * !to.back);
3011
- that.translate(diff.sx - (diff.x || 0) + point.x - diff.sx, diff.sy - (diff.y || 0) + point.y - diff.sy);
3012
- to.rot && that.rotate(diff.r + point.alpha, point.x, point.y);
3013
- }
3014
- (t.x || t.y) && that.translate(-t.x, -t.y);
3015
- to.scale && (to.scale += E);
3016
- that.attr(to);
3017
- delete animationElements[l];
3018
- animationElements[length]--;
3019
- that.in_animation = null;
3020
- R.is(callback, "function") && callback.call(that);
3021
- }
3022
- e.prev = time;
3023
- }
3024
- R.svg && that && that.paper && that.paper.safari();
3025
- animationElements[length] && win.setTimeout(animation);
3026
- },
3027
- upto255 = function (color) {
3028
- return mmax(mmin(color, 255), 0);
3029
- },
3030
- translate = function (x, y) {
3031
- if (x == null) {
3032
- return {x: this._.tx, y: this._.ty, toString: x_y};
3033
- }
3034
- this._.tx += +x;
3035
- this._.ty += +y;
3036
- switch (this.type) {
3037
- case "circle":
3038
- case "ellipse":
3039
- this.attr({cx: +x + this.attrs.cx, cy: +y + this.attrs.cy});
3040
- break;
3041
- case "rect":
3042
- case "image":
3043
- case "text":
3044
- this.attr({x: +x + this.attrs.x, y: +y + this.attrs.y});
3045
- break;
3046
- case "path":
3047
- var path = pathToRelative(this.attrs.path);
3048
- path[0][1] += +x;
3049
- path[0][2] += +y;
3050
- this.attr({path: path});
3051
- break;
3052
- }
3053
- return this;
3054
- };
3055
- Element[proto].animateWith = function (element, params, ms, easing, callback) {
3056
- animationElements[element.id] && (params.start = animationElements[element.id].start);
3057
- return this.animate(params, ms, easing, callback);
3058
- };
3059
- Element[proto].animateAlong = along();
3060
- Element[proto].animateAlongBack = along(1);
3061
- function along(isBack) {
3062
- return function (path, ms, rotate, callback) {
3063
- var params = {back: isBack};
3064
- R.is(rotate, "function") ? (callback = rotate) : (params.rot = rotate);
3065
- path && path.constructor == Element && (path = path.attrs.path);
3066
- path && (params.along = path);
3067
- return this.animate(params, ms, callback);
3068
- };
3069
- }
3070
- Element[proto].onAnimation = function (f) {
3071
- this._run = f || 0;
3072
- return this;
3073
- };
3074
- Element[proto].animate = function (params, ms, easing, callback) {
3075
- if (R.is(easing, "function") || !easing) {
3076
- callback = easing || null;
3077
- }
3078
- var from = {},
3079
- to = {},
3080
- diff = {};
3081
- for (var attr in params) if (params[has](attr)) {
3082
- if (availableAnimAttrs[has](attr)) {
3083
- from[attr] = this.attr(attr);
3084
- (from[attr] == null) && (from[attr] = availableAttrs[attr]);
3085
- to[attr] = params[attr];
3086
- switch (availableAnimAttrs[attr]) {
3087
- case "along":
3088
- var len = getTotalLength(params[attr]),
3089
- point = getPointAtLength(params[attr], len * !!params.back),
3090
- bb = this.getBBox();
3091
- diff[attr] = len / ms;
3092
- diff.tx = bb.x;
3093
- diff.ty = bb.y;
3094
- diff.sx = point.x;
3095
- diff.sy = point.y;
3096
- to.rot = params.rot;
3097
- to.back = params.back;
3098
- to.len = len;
3099
- params.rot && (diff.r = toFloat(this.rotate()) || 0);
3100
- break;
3101
- case nu:
3102
- diff[attr] = (to[attr] - from[attr]) / ms;
3103
- break;
3104
- case "colour":
3105
- from[attr] = R.getRGB(from[attr]);
3106
- var toColour = R.getRGB(to[attr]);
3107
- diff[attr] = {
3108
- r: (toColour.r - from[attr].r) / ms,
3109
- g: (toColour.g - from[attr].g) / ms,
3110
- b: (toColour.b - from[attr].b) / ms
3111
- };
3112
- break;
3113
- case "path":
3114
- var pathes = path2curve(from[attr], to[attr]);
3115
- from[attr] = pathes[0];
3116
- var toPath = pathes[1];
3117
- diff[attr] = [];
3118
- for (var i = 0, ii = from[attr][length]; i < ii; i++) {
3119
- diff[attr][i] = [0];
3120
- for (var j = 1, jj = from[attr][i][length]; j < jj; j++) {
3121
- diff[attr][i][j] = (toPath[i][j] - from[attr][i][j]) / ms;
3122
- }
3123
- }
3124
- break;
3125
- case "csv":
3126
- var values = (params[attr] + E)[split](separator),
3127
- from2 = (from[attr] + E)[split](separator);
3128
- switch (attr) {
3129
- case "translation":
3130
- from[attr] = [0, 0];
3131
- diff[attr] = [values[0] / ms, values[1] / ms];
3132
- break;
3133
- case "rotation":
3134
- from[attr] = (from2[1] == values[1] && from2[2] == values[2]) ? from2 : [0, values[1], values[2]];
3135
- diff[attr] = [(values[0] - from[attr][0]) / ms, 0, 0];
3136
- break;
3137
- case "scale":
3138
- params[attr] = values;
3139
- from[attr] = (from[attr] + E)[split](separator);
3140
- diff[attr] = [(values[0] - from[attr][0]) / ms, (values[1] - from[attr][1]) / ms, 0, 0];
3141
- break;
3142
- case "clip-rect":
3143
- from[attr] = (from[attr] + E)[split](separator);
3144
- diff[attr] = [];
3145
- i = 4;
3146
- while (i--) {
3147
- diff[attr][i] = (values[i] - from[attr][i]) / ms;
3148
- }
3149
- break;
3150
- }
3151
- to[attr] = values;
3152
- }
3153
- }
3154
- }
3155
- this.stop();
3156
- this.in_animation = 1;
3157
- animationElements[this.id] = {
3158
- start: params.start || +new Date,
3159
- ms: ms,
3160
- easing: easing,
3161
- from: from,
3162
- diff: diff,
3163
- to: to,
3164
- el: this,
3165
- callback: callback,
3166
- t: {x: 0, y: 0}
3167
- };
3168
- ++animationElements[length] == 1 && animation();
3169
- return this;
3170
- };
3171
- Element[proto].stop = function () {
3172
- animationElements[this.id] && animationElements[length]--;
3173
- delete animationElements[this.id];
3174
- return this;
3175
- };
3176
- Element[proto].translate = function (x, y) {
3177
- return this.attr({translation: x + " " + y});
3178
- };
3179
- Element[proto][toString] = function () {
3180
- return "Rapha\xebl\u2019s object";
3181
- };
3182
- R.ae = animationElements;
3183
-
3184
- // Set
3185
- var Set = function (items) {
3186
- this.items = [];
3187
- this[length] = 0;
3188
- this.type = "set";
3189
- if (items) {
3190
- for (var i = 0, ii = items[length]; i < ii; i++) {
3191
- if (items[i] && (items[i].constructor == Element || items[i].constructor == Set)) {
3192
- this[this.items[length]] = this.items[this.items[length]] = items[i];
3193
- this[length]++;
3194
- }
3195
- }
3196
- }
3197
- };
3198
- Set[proto][push] = function () {
3199
- var item,
3200
- len;
3201
- for (var i = 0, ii = arguments[length]; i < ii; i++) {
3202
- item = arguments[i];
3203
- if (item && (item.constructor == Element || item.constructor == Set)) {
3204
- len = this.items[length];
3205
- this[len] = this.items[len] = item;
3206
- this[length]++;
3207
- }
3208
- }
3209
- return this;
3210
- };
3211
- Set[proto].pop = function () {
3212
- delete this[this[length]--];
3213
- return this.items.pop();
3214
- };
3215
- for (var method in Element[proto]) if (Element[proto][has](method)) {
3216
- Set[proto][method] = (function (methodname) {
3217
- return function () {
3218
- for (var i = 0, ii = this.items[length]; i < ii; i++) {
3219
- this.items[i][methodname][apply](this.items[i], arguments);
3220
- }
3221
- return this;
3222
- };
3223
- })(method);
3224
- }
3225
- Set[proto].attr = function (name, value) {
3226
- if (name && R.is(name, array) && R.is(name[0], "object")) {
3227
- for (var j = 0, jj = name[length]; j < jj; j++) {
3228
- this.items[j].attr(name[j]);
3229
- }
3230
- } else {
3231
- for (var i = 0, ii = this.items[length]; i < ii; i++) {
3232
- this.items[i].attr(name, value);
3233
- }
3234
- }
3235
- return this;
3236
- };
3237
- Set[proto].animate = function (params, ms, easing, callback) {
3238
- (R.is(easing, "function") || !easing) && (callback = easing || null);
3239
- var len = this.items[length],
3240
- i = len,
3241
- item,
3242
- set = this,
3243
- collector;
3244
- callback && (collector = function () {
3245
- !--len && callback.call(set);
3246
- });
3247
- easing = R.is(easing, string) ? easing : collector;
3248
- item = this.items[--i].animate(params, ms, easing, collector);
3249
- while (i--) {
3250
- this.items[i].animateWith(item, params, ms, easing, collector);
3251
- }
3252
- return this;
3253
- };
3254
- Set[proto].insertAfter = function (el) {
3255
- var i = this.items[length];
3256
- while (i--) {
3257
- this.items[i].insertAfter(el);
3258
- }
3259
- return this;
3260
- };
3261
- Set[proto].getBBox = function () {
3262
- var x = [],
3263
- y = [],
3264
- w = [],
3265
- h = [];
3266
- for (var i = this.items[length]; i--;) {
3267
- var box = this.items[i].getBBox();
3268
- x[push](box.x);
3269
- y[push](box.y);
3270
- w[push](box.x + box.width);
3271
- h[push](box.y + box.height);
3272
- }
3273
- x = mmin[apply](0, x);
3274
- y = mmin[apply](0, y);
3275
- return {
3276
- x: x,
3277
- y: y,
3278
- width: mmax[apply](0, w) - x,
3279
- height: mmax[apply](0, h) - y
3280
- };
3281
- };
3282
- Set[proto].clone = function (s) {
3283
- s = new Set;
3284
- for (var i = 0, ii = this.items[length]; i < ii; i++) {
3285
- s[push](this.items[i].clone());
3286
- }
3287
- return s;
3288
- };
3289
-
3290
- R.registerFont = function (font) {
3291
- if (!font.face) {
3292
- return font;
3293
- }
3294
- this.fonts = this.fonts || {};
3295
- var fontcopy = {
3296
- w: font.w,
3297
- face: {},
3298
- glyphs: {}
3299
- },
3300
- family = font.face["font-family"];
3301
- for (var prop in font.face) if (font.face[has](prop)) {
3302
- fontcopy.face[prop] = font.face[prop];
3303
- }
3304
- if (this.fonts[family]) {
3305
- this.fonts[family][push](fontcopy);
3306
- } else {
3307
- this.fonts[family] = [fontcopy];
3308
- }
3309
- if (!font.svg) {
3310
- fontcopy.face["units-per-em"] = toInt(font.face["units-per-em"], 10);
3311
- for (var glyph in font.glyphs) if (font.glyphs[has](glyph)) {
3312
- var path = font.glyphs[glyph];
3313
- fontcopy.glyphs[glyph] = {
3314
- w: path.w,
3315
- k: {},
3316
- d: path.d && "M" + path.d[rp](/[mlcxtrv]/g, function (command) {
3317
- return {l: "L", c: "C", x: "z", t: "m", r: "l", v: "c"}[command] || "M";
3318
- }) + "z"
3319
- };
3320
- if (path.k) {
3321
- for (var k in path.k) if (path[has](k)) {
3322
- fontcopy.glyphs[glyph].k[k] = path.k[k];
3323
- }
3324
- }
3325
- }
3326
- }
3327
- return font;
3328
- };
3329
- Paper[proto].getFont = function (family, weight, style, stretch) {
3330
- stretch = stretch || "normal";
3331
- style = style || "normal";
3332
- weight = +weight || {normal: 400, bold: 700, lighter: 300, bolder: 800}[weight] || 400;
3333
- if (!R.fonts) {
3334
- return;
3335
- }
3336
- var font = R.fonts[family];
3337
- if (!font) {
3338
- var name = new RegExp("(^|\\s)" + family[rp](/[^\w\d\s+!~.:_-]/g, E) + "(\\s|$)", "i");
3339
- for (var fontName in R.fonts) if (R.fonts[has](fontName)) {
3340
- if (name.test(fontName)) {
3341
- font = R.fonts[fontName];
3342
- break;
3343
- }
3344
- }
3345
- }
3346
- var thefont;
3347
- if (font) {
3348
- for (var i = 0, ii = font[length]; i < ii; i++) {
3349
- thefont = font[i];
3350
- if (thefont.face["font-weight"] == weight && (thefont.face["font-style"] == style || !thefont.face["font-style"]) && thefont.face["font-stretch"] == stretch) {
3351
- break;
3352
- }
3353
- }
3354
- }
3355
- return thefont;
3356
- };
3357
- Paper[proto].print = function (x, y, string, font, size, origin) {
3358
- origin = origin || "middle"; // baseline|middle
3359
- var out = this.set(),
3360
- letters = (string + E)[split](E),
3361
- shift = 0,
3362
- path = E,
3363
- scale;
3364
- R.is(font, string) && (font = this.getFont(font));
3365
- if (font) {
3366
- scale = (size || 16) / font.face["units-per-em"];
3367
- var bb = font.face.bbox.split(separator),
3368
- top = +bb[0],
3369
- height = +bb[1] + (origin == "baseline" ? bb[3] - bb[1] + (+font.face.descent) : (bb[3] - bb[1]) / 2);
3370
- for (var i = 0, ii = letters[length]; i < ii; i++) {
3371
- var prev = i && font.glyphs[letters[i - 1]] || {},
3372
- curr = font.glyphs[letters[i]];
3373
- shift += i ? (prev.w || font.w) + (prev.k && prev.k[letters[i]] || 0) : 0;
3374
- curr && curr.d && out[push](this.path(curr.d).attr({fill: "#000", stroke: "none", translation: [shift, 0]}));
3375
- }
3376
- out.scale(scale, scale, top, height).translate(x - top, y - height);
3377
- }
3378
- return out;
3379
- };
3380
-
3381
- var formatrg = /\{(\d+)\}/g;
3382
- R.format = function (token, params) {
3383
- var args = R.is(params, array) ? [0][concat](params) : arguments;
3384
- token && R.is(token, string) && args[length] - 1 && (token = token[rp](formatrg, function (str, i) {
3385
- return args[++i] == null ? E : args[i];
3386
- }));
3387
- return token || E;
3388
- };
3389
- R.ninja = function () {
3390
- oldRaphael.was ? (Raphael = oldRaphael.is) : delete Raphael;
3391
- return R;
3392
- };
3393
- R.el = Element[proto];
3394
- return R;
3395
- })();