作者 zhangFan

机场口岸通关物流辅助管理系统

运行版
正在显示 35 个修改的文件 包含 5481 行增加0 行删除
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
<script src="js/jstools.js" type="text/javascript" charset="utf-8"></script>
<script src="js/raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery/jquery.progressbar.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery/jquery.asyncqueue.js" type="text/javascript" charset="utf-8"></script>
<script src="js/Color.js" type="text/javascript" charset="utf-8"></script>
<script src="js/Polyline.js" type="text/javascript" charset="utf-8"></script>
<script src="js/ActivityImpl.js" type="text/javascript" charset="utf-8"></script>
<script src="js/ActivitiRest.js" type="text/javascript" charset="utf-8"></script>
<script src="js/LineBreakMeasurer.js" type="text/javascript" charset="utf-8"></script>
<script src="js/ProcessDiagramGenerator.js" type="text/javascript" charset="utf-8"></script>
<script src="js/ProcessDiagramCanvas.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css" media="screen">
</style>
</head>
<body>
<div class="wrapper">
<div id="pb1"></div>
<div id="overlayBox" >
<div id="diagramBreadCrumbs" class="diagramBreadCrumbs" onmousedown="return false" onselectstart="return false"></div>
<div id="diagramHolder" class="diagramHolder"></div>
<div class="diagram-info" id="diagramInfo"></div>
</div>
</div>
<script language='javascript'>
var DiagramGenerator = {};
var pb1;
$(document).ready(function(){
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
query_string[pair[0]] = pair[1];
}
var processDefinitionId = query_string["processDefinitionId"];
var processInstanceId = query_string["processInstanceId"];
console.log("Initialize progress bar");
pb1 = new $.ProgressBar({
boundingBox: '#pb1',
label: 'Progressbar!',
on: {
complete: function() {
console.log("Progress Bar COMPLETE");
this.set('label', 'complete!');
if (processInstanceId) {
ProcessDiagramGenerator.drawHighLights(processInstanceId);
}
},
valueChange: function(e) {
this.set('label', e.newVal + '%');
}
},
value: 0
});
console.log("Progress bar inited");
ProcessDiagramGenerator.options = {
diagramBreadCrumbsId: "diagramBreadCrumbs",
diagramHolderId: "diagramHolder",
diagramInfoId: "diagramInfo",
on: {
click: function(canvas, element, contextObject){
var mouseEvent = this;
console.log("[CLICK] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
if (contextObject.getProperty("type") == "callActivity") {
var processDefinitonKey = contextObject.getProperty("processDefinitonKey");
var processDefinitons = contextObject.getProperty("processDefinitons");
var processDefiniton = processDefinitons[0];
console.log("Load callActivity '" + processDefiniton.processDefinitionKey + "', contextObject: ", contextObject);
// Load processDefinition
ProcessDiagramGenerator.drawDiagram(processDefiniton.processDefinitionId);
}
},
rightClick: function(canvas, element, contextObject){
var mouseEvent = this;
console.log("[RIGHTCLICK] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
},
over: function(canvas, element, contextObject){
var mouseEvent = this;
//console.log("[OVER] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
// TODO: show tooltip-window with contextObject info
ProcessDiagramGenerator.showActivityInfo(contextObject);
},
out: function(canvas, element, contextObject){
var mouseEvent = this;
//console.log("[OUT] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
ProcessDiagramGenerator.hideInfo();
}
}
};
var baseUrl = window.document.location.protocol + "//" + window.document.location.host + "/";
var shortenedUrl = window.document.location.href.replace(baseUrl, "");
baseUrl = baseUrl + shortenedUrl.substring(0, shortenedUrl.indexOf("/"));
ActivitiRest.options = {
processInstanceHighLightsUrl: baseUrl + "/act/service/process-instance/{processInstanceId}/highlights?callback=?",
processDefinitionUrl: baseUrl + "/act/service/process-definition/{processDefinitionId}/diagram-layout?callback=?",
processDefinitionByKeyUrl: baseUrl + "/act/service/process-definition/{processDefinitionKey}/diagram-layout?callback=?",
processInstanceUrl: baseUrl + "/act/service/process-instance/{processInstanceId}/diagram-layout?callback=?"
};
if (processDefinitionId) {
ProcessDiagramGenerator.drawDiagram(processDefinitionId);
} else {
alert("processDefinitionId parameter is required");
}
});
</script>
</body>
</html>
... ...
var ActivitiRest = {
options: {},
getProcessDefinitionByKey: function(processDefinitionKey, callback) {
var url = Lang.sub(this.options.processDefinitionByKeyUrl, {processDefinitionKey: processDefinitionKey});
$.ajax({
url: url,
dataType: 'jsonp',
cache: false,
async: true,
success: function(data, textStatus) {
var processDefinition = data;
if (!processDefinition) {
console.error("Process definition '" + processDefinitionKey + "' not found");
} else {
callback.apply({processDefinitionId: processDefinition.id});
}
}
}).done(function(data, textStatus) {
console.log("ajax done");
}).fail(function(jqXHR, textStatus, error){
console.error('Get diagram layout['+processDefinitionKey+'] failure: ', textStatus, 'error: ', error, jqXHR);
});
},
getProcessDefinition: function(processDefinitionId, callback) {
var url = Lang.sub(this.options.processDefinitionUrl, {processDefinitionId: processDefinitionId});
$.ajax({
url: url,
dataType: 'jsonp',
cache: false,
async: true,
success: function(data, textStatus) {
var processDefinitionDiagramLayout = data;
if (!processDefinitionDiagramLayout) {
console.error("Process definition diagram layout '" + processDefinitionId + "' not found");
return;
} else {
callback.apply({processDefinitionDiagramLayout: processDefinitionDiagramLayout});
}
}
}).done(function(data, textStatus) {
console.log("ajax done");
}).fail(function(jqXHR, textStatus, error){
console.log('Get diagram layout['+processDefinitionId+'] failure: ', textStatus, jqXHR);
});
},
getHighLights: function(processInstanceId, callback) {
var url = Lang.sub(this.options.processInstanceHighLightsUrl, {processInstanceId: processInstanceId});
$.ajax({
url: url,
dataType: 'jsonp',
cache: false,
async: true,
success: function(data, textStatus) {
console.log("ajax returned data");
var highLights = data;
if (!highLights) {
console.log("highLights not found");
return;
} else {
callback.apply({highLights: highLights});
}
}
}).done(function(data, textStatus) {
console.log("ajax done");
}).fail(function(jqXHR, textStatus, error){
console.log('Get HighLights['+processInstanceId+'] failure: ', textStatus, jqXHR);
});
}
};
\ No newline at end of file
... ...
/** * * @author Tom Baeyens * @author (Javascript) Dmitry Farafonov */ var ActivityImpl = function(activityJson){ this.outgoingTransitions = []; this.outgoingTransitions = []; this.incomingTransitions = []; this.activityBehavior = null; this.parent = null; this.isScope = false; this.isAsync = false; this.isExclusive = false; this.x = -1; this.y = -1; this.width = -1; this.height = -1; this.properties = {}; //console.log("activityJson: ", activityJson); if (activityJson != undefined) { this.setId(activityJson.activityId); for (var propertyName in activityJson.properties) { this.setProperty(propertyName, activityJson.properties[propertyName]); } //this.setProperty("name", activityJson.activityName); //this.setProperty("type", activityJson.activityType); this.setX(activityJson.x); this.setY(activityJson.y); this.setWidth(activityJson.width); this.setHeight(activityJson.height); if (activityJson.multiInstance) this.setProperty("multiInstance", activityJson.multiInstance); if (activityJson.collapsed) { this.setProperty("collapsed", activityJson.collapsed); } if (activityJson.isInterrupting != undefined) this.setProperty("isInterrupting", activityJson.isInterrupting); } }; ActivityImpl.prototype = { outgoingTransitions: [], outgoingTransitions: [], incomingTransitions: [], activityBehavior: null, parent: null, isScope: false, isAsync: false, isExclusive: false, id: null, properties: {}, // Graphical information x: -1, y: -1, width: -1, height: -1, setId: function(id){ this.id = id; }, getId: function(){ return this.id; }, setProperty: function(name, value){ this.properties[name] = value; }, getProperty: function(name){ return this.properties[name]; }, createOutgoingTransition: function(transitionId){ }, toString: function(id) { return "Activity("+id+")"; }, getParentActivity: function(){ /* if (parent instanceof ActivityImpl) { 79 return (ActivityImpl) parent; 80 } 81 return null; */ return this.parent; }, // restricted setters /////////////////////////////////////////////////////// setOutgoingTransitions: function(outgoingTransitions){ this.outgoingTransitions = outgoingTransitions; }, setParent: function(parent){ this.parent = parent; }, setIncomingTransitions: function(incomingTransitions){ this.incomingTransitions = incomingTransitions; }, // getters and setters ////////////////////////////////////////////////////// getOutgoingTransitions: function(){ return this.outgoingTransitions; }, getActivityBehavior: function(){ return this.activityBehavior; }, setActivityBehavior: function(activityBehavior){ this.activityBehavior = activityBehavior; }, getParent: function(){ return this.parent; }, getIncomingTransitions: function(){ return this.incomingTransitions; }, isScope: function(){ return this.isScope; }, setScope: function(isScope){ this.isScope = isScope; }, getX: function(){ return this.x; }, setX: function(x){ this.x = x; }, getY: function(){ return this.y; }, setY: function(y){ this.y = y; }, getWidth: function(){ return this.width; }, setWidth: function(width){ this.width = width; }, getHeight: function(){ return this.height; }, setHeight: function(height){ this.height = height; }, isAsync: function() { return this.isAsync; }, setAsync: function(isAsync) { this.isAsync = isAsync; }, isExclusive: function() { return this.isExclusive; }, setExclusive: function(isExclusive) { this.isExclusive = isExclusive; }, vvoid: function(){} };
\ No newline at end of file
... ...
/**
* Web color table
*
* @author Dmitry Farafonov
*/
var Color = {
/**
* The color white. In the default sRGB space.
*/
white : Raphael.getRGB("rgb(255,255,255)"),
/**
* The color white. In the default sRGB space.
*/
WHITE : this.white,
/**
* The color light gray. In the default sRGB space.
*/
lightGray : Raphael.getRGB("rgb(192, 192, 192)"),
/**
* The color light gray. In the default sRGB space.
*/
LIGHT_GRAY : this.lightGray,
/**
* The color gray. In the default sRGB space.
*/
gray : Raphael.getRGB("rgb(128, 128, 128)"),
/**
* The color gray. In the default sRGB space.
*/
GRAY : this.gray,
/**
* The color dark gray. In the default sRGB space.
*/
darkGray : Raphael.getRGB("rgb(64, 64, 64)"),
/**
* The color dark gray. In the default sRGB space.
*/
DARK_GRAY : this.darkGray,
/**
* The color black. In the default sRGB space.
*/
black : Raphael.getRGB("rgb(0, 0, 0)"),
/**
* The color black. In the default sRGB space.
*/
BLACK : this.black,
/**
* The color red. In the default sRGB space.
*/
red : Raphael.getRGB("rgb(255, 0, 0)"),
/**
* The color red. In the default sRGB space.
*/
RED : this.red,
/**
* The color pink. In the default sRGB space.
*/
pink : Raphael.getRGB("rgb(255, 175, 175)"),
/**
* The color pink. In the default sRGB space.
*/
PINK : this.pink,
/**
* The color orange. In the default sRGB space.
*/
orange : Raphael.getRGB("rgb(255, 200, 0)"),
/**
* The color orange. In the default sRGB space.
*/
ORANGE : this.orange,
/**
* The color yellow. In the default sRGB space.
*/
yellow : Raphael.getRGB("rgb(255, 255, 0)"),
/**
* The color yellow. In the default sRGB space.
*/
YELLOW : this.yellow,
/**
* The color green. In the default sRGB space.
*/
green : Raphael.getRGB("rgb(0, 255, 0)"),
/**
* The color green. In the default sRGB space.
*/
GREEN : this.green,
/**
* The color magenta. In the default sRGB space.
*/
magenta : Raphael.getRGB("rgb(255, 0, 255)"),
/**
* The color magenta. In the default sRGB space.
*/
MAGENTA : this.magenta,
/**
* The color cyan. In the default sRGB space.
*/
cyan : Raphael.getRGB("rgb(0, 255, 255)"),
/**
* The color cyan. In the default sRGB space.
*/
CYAN : this.cyan,
/**
* The color blue. In the default sRGB space.
*/
blue : Raphael.getRGB("rgb(0, 0, 255)"),
/**
* The color blue. In the default sRGB space.
*/
BLUE : this.blue,
/************************************************************************/
// http://www.stm.dp.ua/web-design/color-html.php
Snow : Raphael.getRGB("#FFFAFA "), // 255 250 250
GhostWhite : Raphael.getRGB("#F8F8FF "), // 248 248 255
WhiteSmoke : Raphael.getRGB("#F5F5F5 "), // 245 245 245
Gainsboro : Raphael.getRGB("#DCDCDC "), // 220 220 220
FloralWhite : Raphael.getRGB("#FFFAF0 "), // 255 250 240
OldLace : Raphael.getRGB("#FDF5E6 "), // 253 245 230
Linen : Raphael.getRGB("#FAF0E6 "), // 250 240 230
AntiqueWhite : Raphael.getRGB("#FAEBD7 "), // 250 235 215
PapayaWhip : Raphael.getRGB("#FFEFD5 "), // 255 239 213
BlanchedAlmond : Raphael.getRGB("#FFEBCD "), // 255 235 205
Bisque : Raphael.getRGB("#FFE4C4 "), // 255 228 196
PeachPuff : Raphael.getRGB("#FFDAB9 "), // 255 218 185
NavajoWhite : Raphael.getRGB("#FFDEAD "), // 255 222 173
Moccasin : Raphael.getRGB("#FFE4B5 "), // 255 228 181
Cornsilk : Raphael.getRGB("#FFF8DC "), // 255 248 220
Ivory : Raphael.getRGB("#FFFFF0 "), // 255 255 240
LemonChiffon : Raphael.getRGB("#FFFACD "), // 255 250 205
Seashell : Raphael.getRGB("#FFF5EE "), // 255 245 238
Honeydew : Raphael.getRGB("#F0FFF0 "), // 240 255 240
MintCream : Raphael.getRGB("#F5FFFA "), // 245 255 250
Azure : Raphael.getRGB("#F0FFFF "), // 240 255 255
AliceBlue : Raphael.getRGB("#F0F8FF "), // 240 248 255
lavender : Raphael.getRGB("#E6E6FA "), // 230 230 250
LavenderBlush : Raphael.getRGB("#FFF0F5 "), // 255 240 245
MistyRose : Raphael.getRGB("#FFE4E1 "), // 255 228 225
White : Raphael.getRGB("#FFFFFF "), // 255 255 255
Black : Raphael.getRGB("#000000 "), // 0 0 0
DarkSlateGray : Raphael.getRGB("#2F4F4F "), // 47 79 79
DimGrey : Raphael.getRGB("#696969 "), // 105 105 105
SlateGrey : Raphael.getRGB("#708090 "), // 112 128 144
LightSlateGray : Raphael.getRGB("#778899 "), // 119 136 153
Grey : Raphael.getRGB("#BEBEBE "), // 190 190 190
LightGray : Raphael.getRGB("#D3D3D3 "), // 211 211 211
MidnightBlue : Raphael.getRGB("#191970 "), // 25 25 112
NavyBlue : Raphael.getRGB("#000080 "), // 0 0 128
CornflowerBlue : Raphael.getRGB("#6495ED "), // 100 149 237
DarkSlateBlue : Raphael.getRGB("#483D8B "), // 72 61 139
SlateBlue : Raphael.getRGB("#6A5ACD "), // 106 90 205
MediumSlateBlue : Raphael.getRGB("#7B68EE "), // 123 104 238
LightSlateBlue : Raphael.getRGB("#8470FF "), // 132 112 255
MediumBlue : Raphael.getRGB("#0000CD "), // 0 0 205
RoyalBlue : Raphael.getRGB("#4169E1 "), // 65 105 225
Blue : Raphael.getRGB("#0000FF "), // 0 0 255
DodgerBlue : Raphael.getRGB("#1E90FF "), // 30 144 255
DeepSkyBlue : Raphael.getRGB("#00BFFF "), // 0 191 255
SkyBlue : Raphael.getRGB("#87CEEB "), // 135 206 235
LightSkyBlue : Raphael.getRGB("#87CEFA "), // 135 206 250
SteelBlue : Raphael.getRGB("#4682B4 "), // 70 130 180
LightSteelBlue : Raphael.getRGB("#B0C4DE "), // 176 196 222
LightBlue : Raphael.getRGB("#ADD8E6 "), // 173 216 230
PowderBlue : Raphael.getRGB("#B0E0E6 "), // 176 224 230
PaleTurquoise : Raphael.getRGB("#AFEEEE "), // 175 238 238
DarkTurquoise : Raphael.getRGB("#00CED1 "), // 0 206 209
MediumTurquoise : Raphael.getRGB("#48D1CC "), // 72 209 204
Turquoise : Raphael.getRGB("#40E0D0 "), // 64 224 208
Cyan : Raphael.getRGB("#00FFFF "), // 0 255 255
LightCyan : Raphael.getRGB("#E0FFFF "), // 224 255 255
CadetBlue : Raphael.getRGB("#5F9EA0 "), // 95 158 160
MediumAquamarine: Raphael.getRGB("#66CDAA "), // 102 205 170
Aquamarine : Raphael.getRGB("#7FFFD4 "), // 127 255 212
DarkGreen : Raphael.getRGB("#006400 "), // 0 100 0
DarkOliveGreen : Raphael.getRGB("#556B2F "), // 85 107 47
DarkSeaGreen : Raphael.getRGB("#8FBC8F "), // 143 188 143
SeaGreen : Raphael.getRGB("#2E8B57 "), // 46 139 87
MediumSeaGreen : Raphael.getRGB("#3CB371 "), // 60 179 113
LightSeaGreen : Raphael.getRGB("#20B2AA "), // 32 178 170
PaleGreen : Raphael.getRGB("#98FB98 "), // 152 251 152
SpringGreen : Raphael.getRGB("#00FF7F "), // 0 255 127
LawnGreen : Raphael.getRGB("#7CFC00 "), // 124 252 0
Green : Raphael.getRGB("#00FF00 "), // 0 255 0
Chartreuse : Raphael.getRGB("#7FFF00 "), // 127 255 0
MedSpringGreen : Raphael.getRGB("#00FA9A "), // 0 250 154
GreenYellow : Raphael.getRGB("#ADFF2F "), // 173 255 47
LimeGreen : Raphael.getRGB("#32CD32 "), // 50 205 50
YellowGreen : Raphael.getRGB("#9ACD32 "), // 154 205 50
ForestGreen : Raphael.getRGB("#228B22 "), // 34 139 34
OliveDrab : Raphael.getRGB("#6B8E23 "), // 107 142 35
DarkKhaki : Raphael.getRGB("#BDB76B "), // 189 183 107
PaleGoldenrod : Raphael.getRGB("#EEE8AA "), // 238 232 170
LtGoldenrodYello: Raphael.getRGB("#FAFAD2 "), // 250 250 210
LightYellow : Raphael.getRGB("#FFFFE0 "), // 255 255 224
Yellow : Raphael.getRGB("#FFFF00 "), // 255 255 0
Gold : Raphael.getRGB("#FFD700 "), // 255 215 0
LightGoldenrod : Raphael.getRGB("#EEDD82 "), // 238 221 130
goldenrod : Raphael.getRGB("#DAA520 "), // 218 165 32
DarkGoldenrod : Raphael.getRGB("#B8860B "), // 184 134 11
RosyBrown : Raphael.getRGB("#BC8F8F "), // 188 143 143
IndianRed : Raphael.getRGB("#CD5C5C "), // 205 92 92
SaddleBrown : Raphael.getRGB("#8B4513 "), // 139 69 19
Sienna : Raphael.getRGB("#A0522D "), // 160 82 45
Peru : Raphael.getRGB("#CD853F "), // 205 133 63
Burlywood : Raphael.getRGB("#DEB887 "), // 222 184 135
Beige : Raphael.getRGB("#F5F5DC "), // 245 245 220
Wheat : Raphael.getRGB("#F5DEB3 "), // 245 222 179
SandyBrown : Raphael.getRGB("#F4A460 "), // 244 164 96
Tan : Raphael.getRGB("#D2B48C "), // 210 180 140
Chocolate : Raphael.getRGB("#D2691E "), // 210 105 30
Firebrick : Raphael.getRGB("#B22222 "), // 178 34 34
Brown : Raphael.getRGB("#A52A2A "), // 165 42 42
DarkSalmon : Raphael.getRGB("#E9967A "), // 233 150 122
Salmon : Raphael.getRGB("#FA8072 "), // 250 128 114
LightSalmon : Raphael.getRGB("#FFA07A "), // 255 160 122
Orange : Raphael.getRGB("#FFA500 "), // 255 165 0
DarkOrange : Raphael.getRGB("#FF8C00 "), // 255 140 0
Coral : Raphael.getRGB("#FF7F50 "), // 255 127 80
LightCoral : Raphael.getRGB("#F08080 "), // 240 128 128
Tomato : Raphael.getRGB("#FF6347 "), // 255 99 71
OrangeRed : Raphael.getRGB("#FF4500 "), // 255 69 0
Red : Raphael.getRGB("#FF0000 "), // 255 0 0
HotPink : Raphael.getRGB("#FF69B4 "), // 255 105 180
DeepPink : Raphael.getRGB("#FF1493 "), // 255 20 147
Pink : Raphael.getRGB("#FFC0CB "), // 255 192 203
LightPink : Raphael.getRGB("#FFB6C1 "), // 255 182 193
PaleVioletRed : Raphael.getRGB("#DB7093 "), // 219 112 147
Maroon : Raphael.getRGB("#B03060 "), // 176 48 96
MediumVioletRed : Raphael.getRGB("#C71585 "), // 199 21 133
VioletRed : Raphael.getRGB("#D02090 "), // 208 32 144
Magenta : Raphael.getRGB("#FF00FF "), // 255 0 255
Violet : Raphael.getRGB("#EE82EE "), // 238 130 238
Plum : Raphael.getRGB("#DDA0DD "), // 221 160 221
Orchid : Raphael.getRGB("#DA70D6 "), // 218 112 214
MediumOrchid : Raphael.getRGB("#BA55D3 "), // 186 85 211
DarkOrchid : Raphael.getRGB("#9932CC "), // 153 50 204
DarkViolet : Raphael.getRGB("#9400D3 "), // 148 0 211
BlueViolet : Raphael.getRGB("#8A2BE2 "), // 138 43 226
Purple : Raphael.getRGB("#A020F0 "), // 160 32 240
MediumPurple : Raphael.getRGB("#9370DB "), // 147 112 219
Thistle : Raphael.getRGB("#D8BFD8 "), // 216 191 216
Snow1 : Raphael.getRGB("#FFFAFA "), // 255 250 250
Snow2 : Raphael.getRGB("#EEE9E9 "), // 238 233 233
Snow3 : Raphael.getRGB("#CDC9C9 "), // 205 201 201
Snow4 : Raphael.getRGB("#8B8989 "), // 139 137 137
Seashell1 : Raphael.getRGB("#FFF5EE "), // 255 245 238
Seashell2 : Raphael.getRGB("#EEE5DE "), // 238 229 222
Seashell3 : Raphael.getRGB("#CDC5BF "), // 205 197 191
Seashell4 : Raphael.getRGB("#8B8682 "), // 139 134 130
AntiqueWhite1 : Raphael.getRGB("#FFEFDB "), // 255 239 219
AntiqueWhite2 : Raphael.getRGB("#EEDFCC "), // 238 223 204
AntiqueWhite3 : Raphael.getRGB("#CDC0B0 "), // 205 192 176
AntiqueWhite4 : Raphael.getRGB("#8B8378 "), // 139 131 120
Bisque1 : Raphael.getRGB("#FFE4C4 "), // 255 228 196
Bisque2 : Raphael.getRGB("#EED5B7 "), // 238 213 183
Bisque3 : Raphael.getRGB("#CDB79E "), // 205 183 158
Bisque4 : Raphael.getRGB("#8B7D6B "), // 139 125 107
PeachPuff1 : Raphael.getRGB("#FFDAB9 "), // 255 218 185
PeachPuff2 : Raphael.getRGB("#EECBAD "), // 238 203 173
PeachPuff3 : Raphael.getRGB("#CDAF95 "), // 205 175 149
PeachPuff4 : Raphael.getRGB("#8B7765 "), // 139 119 101
NavajoWhite1 : Raphael.getRGB("#FFDEAD "), // 255 222 173
NavajoWhite2 : Raphael.getRGB("#EECFA1 "), // 238 207 161
NavajoWhite3 : Raphael.getRGB("#CDB38B "), // 205 179 139
NavajoWhite4 : Raphael.getRGB("#8B795E "), // 139 121 94
LemonChiffon1 : Raphael.getRGB("#FFFACD "), // 255 250 205
LemonChiffon2 : Raphael.getRGB("#EEE9BF "), // 238 233 191
LemonChiffon3 : Raphael.getRGB("#CDC9A5 "), // 205 201 165
LemonChiffon4 : Raphael.getRGB("#8B8970 "), // 139 137 112
Cornsilk1 : Raphael.getRGB("#FFF8DC "), // 255 248 220
Cornsilk2 : Raphael.getRGB("#EEE8CD "), // 238 232 205
Cornsilk3 : Raphael.getRGB("#CDC8B1 "), // 205 200 177
Cornsilk4 : Raphael.getRGB("#8B8878 "), // 139 136 120
Ivory1 : Raphael.getRGB("#FFFFF0 "), // 255 255 240
Ivory2 : Raphael.getRGB("#EEEEE0 "), // 238 238 224
Ivory3 : Raphael.getRGB("#CDCDC1 "), // 205 205 193
Ivory4 : Raphael.getRGB("#8B8B83 "), // 139 139 131
Honeydew1 : Raphael.getRGB("#F0FFF0 "), // 240 255 240
Honeydew2 : Raphael.getRGB("#E0EEE0 "), // 224 238 224
Honeydew3 : Raphael.getRGB("#C1CDC1 "), // 193 205 193
Honeydew4 : Raphael.getRGB("#838B83 "), // 131 139 131
LavenderBlush1 : Raphael.getRGB("#FFF0F5 "), // 255 240 245
LavenderBlush2 : Raphael.getRGB("#EEE0E5 "), // 238 224 229
LavenderBlush3 : Raphael.getRGB("#CDC1C5 "), // 205 193 197
LavenderBlush4 : Raphael.getRGB("#8B8386 "), // 139 131 134
MistyRose1 : Raphael.getRGB("#FFE4E1 "), // 255 228 225
MistyRose2 : Raphael.getRGB("#EED5D2 "), // 238 213 210
MistyRose3 : Raphael.getRGB("#CDB7B5 "), // 205 183 181
MistyRose4 : Raphael.getRGB("#8B7D7B "), // 139 125 123
Azure1 : Raphael.getRGB("#F0FFFF "), // 240 255 255
Azure2 : Raphael.getRGB("#E0EEEE "), // 224 238 238
Azure3 : Raphael.getRGB("#C1CDCD "), // 193 205 205
Azure4 : Raphael.getRGB("#838B8B "), // 131 139 139
SlateBlue1 : Raphael.getRGB("#836FFF "), // 131 111 255
SlateBlue2 : Raphael.getRGB("#7A67EE "), // 122 103 238
SlateBlue3 : Raphael.getRGB("#6959CD "), // 105 89 205
SlateBlue4 : Raphael.getRGB("#473C8B "), // 71 60 139
RoyalBlue1 : Raphael.getRGB("#4876FF "), // 72 118 255
RoyalBlue2 : Raphael.getRGB("#436EEE "), // 67 110 238
RoyalBlue3 : Raphael.getRGB("#3A5FCD "), // 58 95 205
RoyalBlue4 : Raphael.getRGB("#27408B "), // 39 64 139
Blue1 : Raphael.getRGB("#0000FF "), // 0 0 255
Blue2 : Raphael.getRGB("#0000EE "), // 0 0 238
Blue3 : Raphael.getRGB("#0000CD "), // 0 0 205
Blue4 : Raphael.getRGB("#00008B "), // 0 0 139
DodgerBlue1 : Raphael.getRGB("#1E90FF "), // 30 144 255
DodgerBlue2 : Raphael.getRGB("#1C86EE "), // 28 134 238
DodgerBlue3 : Raphael.getRGB("#1874CD "), // 24 116 205
DodgerBlue4 : Raphael.getRGB("#104E8B "), // 16 78 139
SteelBlue1 : Raphael.getRGB("#63B8FF "), // 99 184 255
SteelBlue2 : Raphael.getRGB("#5CACEE "), // 92 172 238
SteelBlue3 : Raphael.getRGB("#4F94CD "), // 79 148 205
SteelBlue4 : Raphael.getRGB("#36648B "), // 54 100 139
DeepSkyBlue1 : Raphael.getRGB("#00BFFF "), // 0 191 255
DeepSkyBlue2 : Raphael.getRGB("#00B2EE "), // 0 178 238
DeepSkyBlue3 : Raphael.getRGB("#009ACD "), // 0 154 205
DeepSkyBlue4 : Raphael.getRGB("#00688B "), // 0 104 139
SkyBlue1 : Raphael.getRGB("#87CEFF "), // 135 206 255
SkyBlue2 : Raphael.getRGB("#7EC0EE "), // 126 192 238
SkyBlue3 : Raphael.getRGB("#6CA6CD "), // 108 166 205
SkyBlue4 : Raphael.getRGB("#4A708B "), // 74 112 139
LightSkyBlue1 : Raphael.getRGB("#B0E2FF "), // 176 226 255
LightSkyBlue2 : Raphael.getRGB("#A4D3EE "), // 164 211 238
LightSkyBlue3 : Raphael.getRGB("#8DB6CD "), // 141 182 205
LightSkyBlue4 : Raphael.getRGB("#607B8B "), // 96 123 139
SlateGray1 : Raphael.getRGB("#C6E2FF "), // 198 226 255
SlateGray2 : Raphael.getRGB("#B9D3EE "), // 185 211 238
SlateGray3 : Raphael.getRGB("#9FB6CD "), // 159 182 205
SlateGray4 : Raphael.getRGB("#6C7B8B "), // 108 123 139
LightSteelBlue1 : Raphael.getRGB("#CAE1FF "), // 202 225 255
LightSteelBlue2 : Raphael.getRGB("#BCD2EE "), // 188 210 238
LightSteelBlue3 : Raphael.getRGB("#A2B5CD "), // 162 181 205
LightSteelBlue4 : Raphael.getRGB("#6E7B8B "), // 110 123 139
LightBlue1 : Raphael.getRGB("#BFEFFF "), // 191 239 255
LightBlue2 : Raphael.getRGB("#B2DFEE "), // 178 223 238
LightBlue3 : Raphael.getRGB("#9AC0CD "), // 154 192 205
LightBlue4 : Raphael.getRGB("#68838B "), // 104 131 139
LightCyan1 : Raphael.getRGB("#E0FFFF "), // 224 255 255
LightCyan2 : Raphael.getRGB("#D1EEEE "), // 209 238 238
LightCyan3 : Raphael.getRGB("#B4CDCD "), // 180 205 205
LightCyan4 : Raphael.getRGB("#7A8B8B "), // 122 139 139
PaleTurquoise1 : Raphael.getRGB("#BBFFFF "), // 187 255 255
PaleTurquoise2 : Raphael.getRGB("#AEEEEE "), // 174 238 238
PaleTurquoise3 : Raphael.getRGB("#96CDCD "), // 150 205 205
PaleTurquoise4 : Raphael.getRGB("#668B8B "), // 102 139 139
CadetBlue1 : Raphael.getRGB("#98F5FF "), // 152 245 255
CadetBlue2 : Raphael.getRGB("#8EE5EE "), // 142 229 238
CadetBlue3 : Raphael.getRGB("#7AC5CD "), // 122 197 205
CadetBlue4 : Raphael.getRGB("#53868B "), // 83 134 139
Turquoise1 : Raphael.getRGB("#00F5FF "), // 0 245 255
Turquoise2 : Raphael.getRGB("#00E5EE "), // 0 229 238
Turquoise3 : Raphael.getRGB("#00C5CD "), // 0 197 205
Turquoise4 : Raphael.getRGB("#00868B "), // 0 134 139
Cyan1 : Raphael.getRGB("#00FFFF "), // 0 255 255
Cyan2 : Raphael.getRGB("#00EEEE "), // 0 238 238
Cyan3 : Raphael.getRGB("#00CDCD "), // 0 205 205
Cyan4 : Raphael.getRGB("#008B8B "), // 0 139 139
DarkSlateGray1 : Raphael.getRGB("#97FFFF "), // 151 255 255
DarkSlateGray2 : Raphael.getRGB("#8DEEEE "), // 141 238 238
DarkSlateGray3 : Raphael.getRGB("#79CDCD "), // 121 205 205
DarkSlateGray4 : Raphael.getRGB("#528B8B "), // 82 139 139
Aquamarine1 : Raphael.getRGB("#7FFFD4 "), // 127 255 212
Aquamarine2 : Raphael.getRGB("#76EEC6 "), // 118 238 198
Aquamarine3 : Raphael.getRGB("#66CDAA "), // 102 205 170
Aquamarine4 : Raphael.getRGB("#458B74 "), // 69 139 116
DarkSeaGreen1 : Raphael.getRGB("#C1FFC1 "), // 193 255 193
DarkSeaGreen2 : Raphael.getRGB("#B4EEB4 "), // 180 238 180
DarkSeaGreen3 : Raphael.getRGB("#9BCD9B "), // 155 205 155
DarkSeaGreen4 : Raphael.getRGB("#698B69 "), // 105 139 105
SeaGreen1 : Raphael.getRGB("#54FF9F "), // 84 255 159
SeaGreen2 : Raphael.getRGB("#4EEE94 "), // 78 238 148
SeaGreen3 : Raphael.getRGB("#43CD80 "), // 67 205 128
SeaGreen4 : Raphael.getRGB("#2E8B57 "), // 46 139 87
PaleGreen1 : Raphael.getRGB("#9AFF9A "), // 154 255 154
PaleGreen2 : Raphael.getRGB("#90EE90 "), // 144 238 144
PaleGreen3 : Raphael.getRGB("#7CCD7C "), // 124 205 124
PaleGreen4 : Raphael.getRGB("#548B54 "), // 84 139 84
SpringGreen1 : Raphael.getRGB("#00FF7F "), // 0 255 127
SpringGreen2 : Raphael.getRGB("#00EE76 "), // 0 238 118
SpringGreen3 : Raphael.getRGB("#00CD66 "), // 0 205 102
SpringGreen4 : Raphael.getRGB("#008B45 "), // 0 139 69
Green1 : Raphael.getRGB("#00FF00 "), // 0 255 0
Green2 : Raphael.getRGB("#00EE00 "), // 0 238 0
Green3 : Raphael.getRGB("#00CD00 "), // 0 205 0
Green4 : Raphael.getRGB("#008B00 "), // 0 139 0
Chartreuse1 : Raphael.getRGB("#7FFF00 "), // 127 255 0
Chartreuse2 : Raphael.getRGB("#76EE00 "), // 118 238 0
Chartreuse3 : Raphael.getRGB("#66CD00 "), // 102 205 0
Chartreuse4 : Raphael.getRGB("#458B00 "), // 69 139 0
OliveDrab1 : Raphael.getRGB("#C0FF3E "), // 192 255 62
OliveDrab2 : Raphael.getRGB("#B3EE3A "), // 179 238 58
OliveDrab3 : Raphael.getRGB("#9ACD32 "), // 154 205 50
OliveDrab4 : Raphael.getRGB("#698B22 "), // 105 139 34
DarkOliveGreen1 : Raphael.getRGB("#CAFF70 "), // 202 255 112
DarkOliveGreen2 : Raphael.getRGB("#BCEE68 "), // 188 238 104
DarkOliveGreen3 : Raphael.getRGB("#A2CD5A "), // 162 205 90
DarkOliveGreen4 : Raphael.getRGB("#6E8B3D "), // 110 139 61
Khaki1 : Raphael.getRGB("#FFF68F "), // 255 246 143
Khaki2 : Raphael.getRGB("#EEE685 "), // 238 230 133
Khaki3 : Raphael.getRGB("#CDC673 "), // 205 198 115
Khaki4 : Raphael.getRGB("#8B864E "), // 139 134 78
LightGoldenrod1 : Raphael.getRGB("#FFEC8B "), // 255 236 139
LightGoldenrod2 : Raphael.getRGB("#EEDC82 "), // 238 220 130
LightGoldenrod3 : Raphael.getRGB("#CDBE70 "), // 205 190 112
LightGoldenrod4 : Raphael.getRGB("#8B814C "), // 139 129 76
LightYellow1 : Raphael.getRGB("#FFFFE0 "), // 255 255 224
LightYellow2 : Raphael.getRGB("#EEEED1 "), // 238 238 209
LightYellow3 : Raphael.getRGB("#CDCDB4 "), // 205 205 180
LightYellow4 : Raphael.getRGB("#8B8B7A "), // 139 139 122
Yellow1 : Raphael.getRGB("#FFFF00 "), // 255 255 0
Yellow2 : Raphael.getRGB("#EEEE00 "), // 238 238 0
Yellow3 : Raphael.getRGB("#CDCD00 "), // 205 205 0
Yellow4 : Raphael.getRGB("#8B8B00 "), // 139 139 0
Gold1 : Raphael.getRGB("#FFD700 "), // 255 215 0
Gold2 : Raphael.getRGB("#EEC900 "), // 238 201 0
Gold3 : Raphael.getRGB("#CDAD00 "), // 205 173 0
Gold4 : Raphael.getRGB("#8B7500 "), // 139 117 0
Goldenrod1 : Raphael.getRGB("#FFC125 "), // 255 193 37
Goldenrod2 : Raphael.getRGB("#EEB422 "), // 238 180 34
Goldenrod3 : Raphael.getRGB("#CD9B1D "), // 205 155 29
Goldenrod4 : Raphael.getRGB("#8B6914 "), // 139 105 20
DarkGoldenrod1 : Raphael.getRGB("#FFB90F "), // 255 185 15
DarkGoldenrod2 : Raphael.getRGB("#EEAD0E "), // 238 173 14
DarkGoldenrod3 : Raphael.getRGB("#CD950C "), // 205 149 12
DarkGoldenrod4 : Raphael.getRGB("#8B658B "), // 139 101 8
RosyBrown1 : Raphael.getRGB("#FFC1C1 "), // 255 193 193
RosyBrown2 : Raphael.getRGB("#EEB4B4 "), // 238 180 180
RosyBrown3 : Raphael.getRGB("#CD9B9B "), // 205 155 155
RosyBrown4 : Raphael.getRGB("#8B6969 "), // 139 105 105
IndianRed1 : Raphael.getRGB("#FF6A6A "), // 255 106 106
IndianRed2 : Raphael.getRGB("#EE6363 "), // 238 99 99
IndianRed3 : Raphael.getRGB("#CD5555 "), // 205 85 85
IndianRed4 : Raphael.getRGB("#8B3A3A "), // 139 58 58
Sienna1 : Raphael.getRGB("#FF8247 "), // 255 130 71
Sienna2 : Raphael.getRGB("#EE7942 "), // 238 121 66
Sienna3 : Raphael.getRGB("#CD6839 "), // 205 104 57
Sienna4 : Raphael.getRGB("#8B4726 "), // 139 71 38
Burlywood1 : Raphael.getRGB("#FFD39B "), // 255 211 155
Burlywood2 : Raphael.getRGB("#EEC591 "), // 238 197 145
Burlywood3 : Raphael.getRGB("#CDAA7D "), // 205 170 125
Burlywood4 : Raphael.getRGB("#8B7355 "), // 139 115 85
Wheat1 : Raphael.getRGB("#FFE7BA "), // 255 231 186
Wheat2 : Raphael.getRGB("#EED8AE "), // 238 216 174
Wheat3 : Raphael.getRGB("#CDBA96 "), // 205 186 150
Wheat4 : Raphael.getRGB("#8B7E66 "), // 139 126 102
Tan1 : Raphael.getRGB("#FFA54F "), // 255 165 79
Tan2 : Raphael.getRGB("#EE9A49 "), // 238 154 73
Tan3 : Raphael.getRGB("#CD853F "), // 205 133 63
Tan4 : Raphael.getRGB("#8B5A2B "), // 139 90 43
Chocolate1 : Raphael.getRGB("#FF7F24 "), // 255 127 36
Chocolate2 : Raphael.getRGB("#EE7621 "), // 238 118 33
Chocolate3 : Raphael.getRGB("#CD661D "), // 205 102 29
Chocolate4 : Raphael.getRGB("#8B4513 "), // 139 69 19
Firebrick1 : Raphael.getRGB("#FF3030 "), // 255 48 48
Firebrick2 : Raphael.getRGB("#EE2C2C "), // 238 44 44
Firebrick3 : Raphael.getRGB("#CD2626 "), // 205 38 38
Firebrick4 : Raphael.getRGB("#8B1A1A "), // 139 26 26
Brown1 : Raphael.getRGB("#FF4040 "), // 255 64 64
Brown2 : Raphael.getRGB("#EE3B3B "), // 238 59 59
Brown3 : Raphael.getRGB("#CD3333 "), // 205 51 51
Brown4 : Raphael.getRGB("#8B2323 "), // 139 35 35
Salmon1 : Raphael.getRGB("#FF8C69 "), // 255 140 105
Salmon2 : Raphael.getRGB("#EE8262 "), // 238 130 98
Salmon3 : Raphael.getRGB("#CD7054 "), // 205 112 84
Salmon4 : Raphael.getRGB("#8B4C39 "), // 139 76 57
LightSalmon1 : Raphael.getRGB("#FFA07A "), // 255 160 122
LightSalmon2 : Raphael.getRGB("#EE9572 "), // 238 149 114
LightSalmon3 : Raphael.getRGB("#CD8162 "), // 205 129 98
LightSalmon4 : Raphael.getRGB("#8B5742 "), // 139 87 66
Orange1 : Raphael.getRGB("#FFA500 "), // 255 165 0
Orange2 : Raphael.getRGB("#EE9A00 "), // 238 154 0
Orange3 : Raphael.getRGB("#CD8500 "), // 205 133 0
Orange4 : Raphael.getRGB("#8B5A00 "), // 139 90 0
DarkOrange1 : Raphael.getRGB("#FF7F00 "), // 255 127 0
DarkOrange2 : Raphael.getRGB("#EE7600 "), // 238 118 0
DarkOrange3 : Raphael.getRGB("#CD6600 "), // 205 102 0
DarkOrange4 : Raphael.getRGB("#8B4500 "), // 139 69 0
Coral1 : Raphael.getRGB("#FF7256 "), // 255 114 86
Coral2 : Raphael.getRGB("#EE6A50 "), // 238 106 80
Coral3 : Raphael.getRGB("#CD5B45 "), // 205 91 69
Coral4 : Raphael.getRGB("#8B3E2F "), // 139 62 47
Tomato1 : Raphael.getRGB("#FF6347 "), // 255 99 71
Tomato2 : Raphael.getRGB("#EE5C42 "), // 238 92 66
Tomato3 : Raphael.getRGB("#CD4F39 "), // 205 79 57
Tomato4 : Raphael.getRGB("#8B3626 "), // 139 54 38
OrangeRed1 : Raphael.getRGB("#FF4500 "), // 255 69 0
OrangeRed2 : Raphael.getRGB("#EE4000 "), // 238 64 0
OrangeRed3 : Raphael.getRGB("#CD3700 "), // 205 55 0
OrangeRed4 : Raphael.getRGB("#8B2500 "), // 139 37 0
Red1 : Raphael.getRGB("#FF0000 "), // 255 0 0
Red2 : Raphael.getRGB("#EE0000 "), // 238 0 0
Red3 : Raphael.getRGB("#CD0000 "), // 205 0 0
Red4 : Raphael.getRGB("#8B0000 "), // 139 0 0
DeepPink1 : Raphael.getRGB("#FF1493 "), // 255 20 147
DeepPink2 : Raphael.getRGB("#EE1289 "), // 238 18 137
DeepPink3 : Raphael.getRGB("#CD1076 "), // 205 16 118
DeepPink4 : Raphael.getRGB("#8B0A50 "), // 139 10 80
HotPink1 : Raphael.getRGB("#FF6EB4 "), // 255 110 180
HotPink2 : Raphael.getRGB("#EE6AA7 "), // 238 106 167
HotPink3 : Raphael.getRGB("#CD6090 "), // 205 96 144
HotPink4 : Raphael.getRGB("#8B3A62 "), // 139 58 98
Pink1 : Raphael.getRGB("#FFB5C5 "), // 255 181 197
Pink2 : Raphael.getRGB("#EEA9B8 "), // 238 169 184
Pink3 : Raphael.getRGB("#CD919E "), // 205 145 158
Pink4 : Raphael.getRGB("#8B636C "), // 139 99 108
LightPink1 : Raphael.getRGB("#FFAEB9 "), // 255 174 185
LightPink2 : Raphael.getRGB("#EEA2AD "), // 238 162 173
LightPink3 : Raphael.getRGB("#CD8C95 "), // 205 140 149
LightPink4 : Raphael.getRGB("#8B5F65 "), // 139 95 101
PaleVioletRed1 : Raphael.getRGB("#FF82AB "), // 255 130 171
PaleVioletRed2 : Raphael.getRGB("#EE799F "), // 238 121 159
PaleVioletRed3 : Raphael.getRGB("#CD6889 "), // 205 104 137
PaleVioletRed4 : Raphael.getRGB("#8B475D "), // 139 71 93
Maroon1 : Raphael.getRGB("#FF34B3 "), // 255 52 179
Maroon2 : Raphael.getRGB("#EE30A7 "), // 238 48 167
Maroon3 : Raphael.getRGB("#CD2990 "), // 205 41 144
Maroon4 : Raphael.getRGB("#8B1C62 "), // 139 28 98
VioletRed1 : Raphael.getRGB("#FF3E96 "), // 255 62 150
VioletRed2 : Raphael.getRGB("#EE3A8C "), // 238 58 140
VioletRed3 : Raphael.getRGB("#CD3278 "), // 205 50 120
VioletRed4 : Raphael.getRGB("#8B2252 "), // 139 34 82
Magenta1 : Raphael.getRGB("#FF00FF "), // 255 0 255
Magenta2 : Raphael.getRGB("#EE00EE "), // 238 0 238
Magenta3 : Raphael.getRGB("#CD00CD "), // 205 0 205
Magenta4 : Raphael.getRGB("#8B008B "), // 139 0 139
Orchid1 : Raphael.getRGB("#FF83FA "), // 255 131 250
Orchid2 : Raphael.getRGB("#EE7AE9 "), // 238 122 233
Orchid3 : Raphael.getRGB("#CD69C9 "), // 205 105 201
Orchid4 : Raphael.getRGB("#8B4789 "), // 139 71 137
Plum1 : Raphael.getRGB("#FFBBFF "), // 255 187 255
Plum2 : Raphael.getRGB("#EEAEEE "), // 238 174 238
Plum3 : Raphael.getRGB("#CD96CD "), // 205 150 205
Plum4 : Raphael.getRGB("#8B668B "), // 139 102 139
MediumOrchid1 : Raphael.getRGB("#E066FF "), // 224 102 255
MediumOrchid2 : Raphael.getRGB("#D15FEE "), // 209 95 238
MediumOrchid3 : Raphael.getRGB("#B452CD "), // 180 82 205
MediumOrchid4 : Raphael.getRGB("#7A378B "), // 122 55 139
DarkOrchid1 : Raphael.getRGB("#BF3EFF "), // 191 62 255
DarkOrchid2 : Raphael.getRGB("#B23AEE "), // 178 58 238
DarkOrchid3 : Raphael.getRGB("#9A32CD "), // 154 50 205
DarkOrchid4 : Raphael.getRGB("#68228B "), // 104 34 139
Purple1 : Raphael.getRGB("#9B30FF "), // 155 48 255
Purple2 : Raphael.getRGB("#912CEE "), // 145 44 238
Purple3 : Raphael.getRGB("#7D26CD "), // 125 38 205
Purple4 : Raphael.getRGB("#551A8B "), // 85 26 139
MediumPurple1 : Raphael.getRGB("#AB82FF "), // 171 130 255
MediumPurple2 : Raphael.getRGB("#9F79EE "), // 159 121 238
MediumPurple3 : Raphael.getRGB("#8968CD "), // 137 104 205
MediumPurple4 : Raphael.getRGB("#5D478B "), // 93 71 139
Thistle1 : Raphael.getRGB("#FFE1FF "), // 255 225 255
Thistle2 : Raphael.getRGB("#EED2EE "), // 238 210 238
Thistle3 : Raphael.getRGB("#CDB5CD "), // 205 181 205
Thistle4 : Raphael.getRGB("#8B7B8B "), // 139 123 139
grey11 : Raphael.getRGB("#1C1C1C "), // 28 28 28
grey21 : Raphael.getRGB("#363636 "), // 54 54 54
grey31 : Raphael.getRGB("#4F4F4F "), // 79 79 79
grey41 : Raphael.getRGB("#696969 "), // 105 105 105
grey51 : Raphael.getRGB("#828282 "), // 130 130 130
grey61 : Raphael.getRGB("#9C9C9C "), // 156 156 156
grey71 : Raphael.getRGB("#B5B5B5 "), // 181 181 181
gray81 : Raphael.getRGB("#CFCFCF "), // 207 207 207
gray91 : Raphael.getRGB("#E8E8E8 "), // 232 232 232
DarkGrey : Raphael.getRGB("#A9A9A9 "), // 169 169 169
DarkBlue : Raphael.getRGB("#00008B "), // 0 0 139
DarkCyan : Raphael.getRGB("#008B8B "), // 0 139 139
DarkMagenta : Raphael.getRGB("#8B008B "), // 139 0 139
DarkRed : Raphael.getRGB("#8B0000 "), // 139 0 0
LightGreen : Raphael.getRGB("#90EE90 "), // 144 238 144
get: function(R, G, B){
return Raphael.getRGB("rgb(" + R + ", " + G + ", " + B + ")");
}
};
\ No newline at end of file
... ...
/**
* Word wrapping
*
* @author (Javascript) Dmitry Farafonov
*/
var AttributedStringIterator = function(text){
//this.text = this.rtrim(this.ltrim(text));
text = text.replace(/(\s)+/, " ");
this.text = this.rtrim(text);
/*
if (beginIndex < 0 || beginIndex > endIndex || endIndex > length()) {
throw new IllegalArgumentException("Invalid substring range");
}
*/
this.beginIndex = 0;
this.endIndex = this.text.length;
this.currentIndex = this.beginIndex;
//console.group("[AttributedStringIterator]");
var i = 0;
var string = this.text;
var fullPos = 0;
//console.log("string: \"" + string + "\", length: " + string.length);
this.startWordOffsets = [];
this.startWordOffsets.push(fullPos);
// TODO: remove i 1000
while (i<1000) {
var pos = string.search(/[ \t\n\f-\.\,]/);
if (pos == -1)
break;
// whitespace start
fullPos += pos;
string = string.substr(pos);
////console.log("fullPos: " + fullPos + ", pos: " + pos + ", string: ", string);
// remove whitespaces
var pos = string.search(/[^ \t\n\f-\.\,]/);
if (pos == -1)
break;
// whitespace end
fullPos += pos;
string = string.substr(pos);
////console.log("fullPos: " + fullPos);
this.startWordOffsets.push(fullPos);
i++;
}
//console.log("startWordOffsets: ", this.startWordOffsets);
//console.groupEnd();
};
AttributedStringIterator.prototype = {
getEndIndex: function(pos){
if (typeof(pos) == "undefined")
return this.endIndex;
var string = this.text.substr(pos, this.endIndex - pos);
var posEndOfLine = string.search(/[\n]/);
if (posEndOfLine == -1)
return this.endIndex;
else
return pos + posEndOfLine;
},
getBeginIndex: function(){
return this.beginIndex;
},
isWhitespace: function(pos){
var str = this.text[pos];
var whitespaceChars = " \t\n\f";
return (whitespaceChars.indexOf(str) != -1);
},
isNewLine: function(pos){
var str = this.text[pos];
var whitespaceChars = "\n";
return (whitespaceChars.indexOf(str) != -1);
},
preceding: function(pos){
//console.group("[AttributedStringIterator.preceding]");
for(var i in this.startWordOffsets) {
var startWordOffset = this.startWordOffsets[i];
if (pos < startWordOffset && i>0) {
//console.log("startWordOffset: " + this.startWordOffsets[i-1]);
//console.groupEnd();
return this.startWordOffsets[i-1];
}
}
//console.log("pos: " + pos);
//console.groupEnd();
return this.startWordOffsets[i];
},
following: function(pos){
//console.group("[AttributedStringIterator.following]");
for(var i in this.startWordOffsets) {
var startWordOffset = this.startWordOffsets[i];
if (pos < startWordOffset && i>0) {
//console.log("startWordOffset: " + this.startWordOffsets[i]);
//console.groupEnd();
return this.startWordOffsets[i];
}
}
//console.log("pos: " + pos);
//console.groupEnd();
return this.startWordOffsets[i];
},
ltrim: function(str){
var patt2=/^\s+/g;
return str.replace(patt2, "");
},
rtrim: function(str){
var patt2=/\s+$/g;
return str.replace(patt2, "");
},
getLayout: function(start, limit){
return this.text.substr(start, limit - start);
},
getCharAtPos: function(pos) {
return this.text[pos];
}
};
var LineBreakMeasurer = function(paper, x, y, text, fontAttrs){
this.paper = paper;
this.text = new AttributedStringIterator(text);
this.fontAttrs = fontAttrs;
if (this.text.getEndIndex() - this.text.getBeginIndex() < 1) {
throw {message: "Text must contain at least one character.", code: "IllegalArgumentException"};
}
//this.measurer = new TextMeasurer(paper, this.text, this.fontAttrs);
this.limit = this.text.getEndIndex();
this.pos = this.start = this.text.getBeginIndex();
this.rafaelTextObject = this.paper.text(x, y, this.text.text).attr(fontAttrs).attr("text-anchor", "start");
this.svgTextObject = this.rafaelTextObject[0];
};
LineBreakMeasurer.prototype = {
nextOffset: function(wrappingWidth, offsetLimit, requireNextWord) {
//console.group("[nextOffset]");
var nextOffset = this.pos;
if (this.pos < this.limit) {
if (offsetLimit <= this.pos) {
throw {message: "offsetLimit must be after current position", code: "IllegalArgumentException"};
}
var charAtMaxAdvance = this.getLineBreakIndex(this.pos, wrappingWidth);
//charAtMaxAdvance --;
//console.log("charAtMaxAdvance:", charAtMaxAdvance, ", [" + this.text.getCharAtPos(charAtMaxAdvance) + "]");
if (charAtMaxAdvance == this.limit) {
nextOffset = this.limit;
//console.log("charAtMaxAdvance == this.limit");
} else if (this.text.isNewLine(charAtMaxAdvance)) {
//console.log("isNewLine");
nextOffset = charAtMaxAdvance+1;
} else if (this.text.isWhitespace(charAtMaxAdvance)) {
// TODO: find next noSpaceChar
//return nextOffset;
nextOffset = this.text.following(charAtMaxAdvance);
} else {
// Break is in a word; back up to previous break.
/*
var testPos = charAtMaxAdvance + 1;
if (testPos == this.limit) {
console.error("hbz...");
} else {
nextOffset = this.text.preceding(charAtMaxAdvance);
}
*/
nextOffset = this.text.preceding(charAtMaxAdvance);
if (nextOffset <= this.pos) {
nextOffset = Math.max(this.pos+1, charAtMaxAdvance);
}
}
}
if (nextOffset > offsetLimit) {
nextOffset = offsetLimit;
}
//console.log("nextOffset: " + nextOffset);
//console.groupEnd();
return nextOffset;
},
nextLayout: function(wrappingWidth) {
//console.groupCollapsed("[nextLayout]");
if (this.pos < this.limit) {
var requireNextWord = false;
var layoutLimit = this.nextOffset(wrappingWidth, this.limit, requireNextWord);
//console.log("layoutLimit:", layoutLimit);
if (layoutLimit == this.pos) {
//console.groupEnd();
return null;
}
var result = this.text.getLayout(this.pos, layoutLimit);
//console.log("layout: \"" + result + "\"");
// remove end of line
//var posEndOfLine = this.text.getEndIndex(this.pos);
//if (posEndOfLine < result.length)
// result = result.substr(0, posEndOfLine);
this.pos = layoutLimit;
//console.groupEnd();
return result;
} else {
//console.groupEnd();
return null;
}
},
getLineBreakIndex: function(pos, wrappingWidth) {
//console.group("[getLineBreakIndex]");
//console.log("pos:"+pos + ", text: \""+ this.text.text.replace(/\n/g, "_").substr(pos, 1) + "\"");
var bb = this.rafaelTextObject.getBBox();
var charNum = -1;
try {
var svgPoint = this.svgTextObject.getStartPositionOfChar(pos);
//var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.blue});
svgPoint.x = svgPoint.x + wrappingWidth;
//svgPoint.y = bb.y;
//console.log("svgPoint:", svgPoint);
//var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.red});
charNum = this.svgTextObject.getCharNumAtPosition(svgPoint);
} catch (e){
console.warn("getStartPositionOfChar error, pos:" + pos);
/*
var testPos = pos + 1;
if (testPos < this.limit) {
return testPos
}
*/
}
//console.log("charNum:", charNum);
if (charNum == -1) {
//console.groupEnd();
return this.text.getEndIndex(pos);
} else {
// When case there is new line between pos and charnum then use this new line
var newLineIndex = this.text.getEndIndex(pos);
if (newLineIndex < charNum ) {
console.log("newLineIndex <= charNum, newLineIndex:"+newLineIndex+", charNum:"+charNum, "\"" + this.text.text.substr(newLineIndex+1).replace(/\n/g, "?") + "\"");
//console.groupEnd();
return newLineIndex;
}
//var charAtMaxAdvance = this.text.text.substring(charNum, charNum + 1);
var charAtMaxAdvance = this.text.getCharAtPos(charNum);
//console.log("!!charAtMaxAdvance: " + charAtMaxAdvance);
//console.groupEnd();
return charNum;
}
},
getPosition: function() {
return this.pos;
}
};
\ No newline at end of file
... ...
/**
* Class to generate polyline
*
* @author Dmitry Farafonov
*/
var ANCHOR_TYPE= {
main: "main",
middle: "middle",
first: "first",
last: "last"
};
function Anchor(uuid, type, x, y) {
this.uuid = uuid;
this.x = x
this.y = y
this.type = (type == ANCHOR_TYPE.middle) ? ANCHOR_TYPE.middle : ANCHOR_TYPE.main;
};
Anchor.prototype = {
uuid: null,
x: 0,
y: 0,
type: ANCHOR_TYPE.main,
isFirst: false,
isLast: false,
ndex: 0,
typeIndex: 0
};
function Polyline(uuid, points, strokeWidth) {
/* Array on coordinates:
* points: [{x: 410, y: 110}, 1
* {x: 570, y: 110}, 1 2
* {x: 620, y: 240}, 2 3
* {x: 750, y: 270}, 3 4
* {x: 650, y: 370}]; 4
*/
this.points = points;
/*
* path for graph
* [["M", x1, y1], ["L", x2, y2], ["C", ax, ay, bx, by, x3, y3], ["L", x3, y3]]
*/
this.path = [];
this.anchors = [];
if (strokeWidth) this.strokeWidth = strokeWidth;
this.closePath = false;
this.init();
};
Polyline.prototype = {
id: null,
points: [],
path: [],
anchors: [],
strokeWidth: 1,
radius: 15,
showDetails: false,
element: null,
isDefaultConditionAvailable: false,
closePath: false,
init: function(points){
var linesCount = this.getLinesCount();
if (linesCount < 1)
return;
this.normalizeCoordinates();
// create anchors
this.pushAnchor(ANCHOR_TYPE.first, this.getLine(0).x1, this.getLine(0).y1);
for(var i = 1; i < linesCount; i++){
var line1 = this.getLine(i-1),
line2 = this.getLine(i);
//this.pushAnchor(ANCHOR_TYPE.middle, line1.x1 + line1.x2-line1.x1, line1.y1 + line1.y2-line1.y1);
this.pushAnchor(ANCHOR_TYPE.main, line1.x2, line1.y2);
//this.pushAnchor(ANCHOR_TYPE.middle, line2.x1 + line2.x2-line2.x1, line2.y1 + line2.y2-line2.y1);
}
this.pushAnchor(ANCHOR_TYPE.last, this.getLine(linesCount-1).x2, this.getLine(linesCount-1).y2);
this.rebuildPath();
},
normalizeCoordinates: function(){
for(var i=0; i < this.points.length; i++){
this.points[i].x = parseFloat(this.points[i].x);
this.points[i].y = parseFloat(this.points[i].y);
}
},
getLinesCount: function(){
return this.points.length-1;
},
_getLine: function(i){
return {x1: this.points[i].x, y1: this.points[i].y, x2: this.points[i+1].x, y2: this.points[i+1].y};
},
getLine: function(i){
var line = this._getLine(i);
line.angle = this.getLineAngle(i) ;
return line;
},
getLineAngle: function(i){
var line = this._getLine(i);
return Math.atan2(line.y2 - line.y1, line.x2 - line.x1);
},
getLineLengthX: function(i){
var line = this.getLine(i);
return (line.x2 - line.x1);
},
getLineLengthY: function(i){
var line = this.getLine(i);
return (line.y2 - line.y1);
},
getLineLength: function(i){
var line = this.getLine(i);
return Math.sqrt(Math.pow(this.getLineLengthX(i), 2) + Math.pow(this.getLineLengthY(i), 2));
},
getAnchors: function(){
//
// ????
return this.anchors;
},
getAnchorsCount: function(type){
if (!type)
return this.anchors.length;
else {
var count = 0;
for(var i=0; i < this.getAnchorsCount(); i++){
var anchor = this.anchors[i];
if (anchor.getType() == type) {
count++;
}
}
return count;
}
},
pushAnchor: function(type, x, y, index){
if (type == ANCHOR_TYPE.first) {
index = 0;
typeIndex = 0;
} else if (type == ANCHOR_TYPE.last) {
index = this.getAnchorsCount();
typeIndex = 0;
} else if (!index) {
index = this.anchors.length;
} else {
// anchors, , index
//var anchor = this.getAnchor()
for(var i=0; i < this.getAnchorsCount(); i++){
var anchor = this.anchors[i];
if (anchor.index > index) {
anchor.index++;
anchor.typeIndex++;
}
}
}
var anchor = new Anchor(this.id, ANCHOR_TYPE.main, x, y, index, typeIndex);
this.anchors.push(anchor);
},
getAnchor: function(position){
return this.anchors[position];
},
getAnchorByType: function(type, position){
if (type == ANCHOR_TYPE.first)
return this.anchors[0];
if (type == ANCHOR_TYPE.last)
return this.anchors[this.getAnchorsCount()-1];
for(var i=0; i < this.getAnchorsCount(); i++){
var anchor = this.anchors[i];
if (anchor.type == type) {
if( position == anchor.position)
return anchor;
}
}
return null;
},
addNewPoint: function(position, x, y){
//
for(var i = 0; i < this.getLinesCount(); i++){
var line = this.getLine(i);
if (x > line.x1 && x < line.x2 && y > line.y1 && y < line.y2) {
this.points.splice(i+1,0,{x: x, y: y});
break;
}
}
this.rebuildPath();
},
rebuildPath: function(){
var path = [];
for(var i = 0; i < this.getAnchorsCount(); i++){
var anchor = this.getAnchor(i);
var pathType = ""
if (i==0)
pathType = "M";
else
pathType = "L";
// TODO: save previous points and calculate new path just if points are updated, and then save currents values as previous
var targetX = anchor.x, targetY = anchor.y;
if (i>0 && i < this.getAnchorsCount()-1) {
// get new x,y
var cx = anchor.x, cy = anchor.y;
// pivot point of prev line
var AO = this.getLineLength(i-1);
if (AO < this.radius) {
AO = this.radius;
}
this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i == 1 && AO > 10));
//console.log("isDefaultConditionAvailable", this.isDefaultConditionAvailable);
var ED = this.getLineLengthY(i-1) * this.radius / AO;
var OD = this.getLineLengthX(i-1) * this.radius / AO;
targetX = anchor.x - OD;
targetY = anchor.y - ED;
if (AO < 2*this.radius && i>1) {
targetX = anchor.x - this.getLineLengthX(i-1)/2;
targetY = anchor.y - this.getLineLengthY(i-1)/2;;
}
// pivot point of next line
var AO = this.getLineLength(i);
if (AO < this.radius) {
AO = this.radius;
}
var ED = this.getLineLengthY(i) * this.radius / AO;
var OD = this.getLineLengthX(i) * this.radius / AO;
var nextSrcX = anchor.x + OD;
var nextSrcY = anchor.y + ED;
if (AO < 2*this.radius && i<this.getAnchorsCount()-2) {
nextSrcX = anchor.x + this.getLineLengthX(i)/2;
nextSrcY = anchor.y + this.getLineLengthY(i)/2;;
}
var dx0 = (cx - targetX) / 3,
dy0 = (cy - targetY) / 3,
ax = cx - dx0,
ay = cy - dy0,
dx1 = (cx - nextSrcX) / 3,
dy1 = (cy - nextSrcY) / 3,
bx = cx - dx1,
by = cy - dy1,
zx=nextSrcX, zy=nextSrcY;
if (this.showDetails) {
var c = ProcessDiagramCanvas.g.path("M"+targetX+","+targetY+"L"+ax+","+ay).attr({stroke: Color.get(255, 153, 51), "stroke-dasharray": "- "});
var c = ProcessDiagramCanvas.g.path("M"+nextSrcX+","+nextSrcY+"L"+bx+","+by).attr({stroke: Color.get(255, 153, 51), "stroke-dasharray": "- "});
var c = ProcessDiagramCanvas.g.ellipse(ax, ay, 2, 2).attr({stroke: Color.SlateGrey});
var c = ProcessDiagramCanvas.g.ellipse(bx, by, 2, 2).attr({stroke: Color.SlateGrey});
var c = ProcessDiagramCanvas.g.ellipse(cx, cy, this.radius, this.radius).attr({stroke: Color.Gainsboro});
var c = ProcessDiagramCanvas.g.ellipse(targetX, targetY, 2, 2).attr({fill: Color.red});
var c = ProcessDiagramCanvas.g.ellipse(nextSrcX, nextSrcY, 2, 2).attr({fill: Color.red});
}
} else if (i==1 && this.getAnchorsCount() == 2){
var AO = this.getLineLength(i-1);
if (AO < this.radius) {
AO = this.radius;
}
this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i == 1 && AO > 10));
//console.log("-- isDefaultConditionAvailable", this.isDefaultConditionAvailable);
}
// anti smoothing
if (this.strokeWidth%2 == 1) {
targetX += 0.5;
targetY += 0.5;
}
path.push([pathType, targetX, targetY]);
if (i>0 && i < this.getAnchorsCount()-1) {
path.push(["C", ax, ay, bx, by, zx, zy]);
}
}
if (this.closePath) {
console.log("closePath:", this.closePath);
path.push(["Z"]);
}
this.path = path;
},
transform: function(transformation){
this.element.transform(transformation);
},
attr: function(attrs){
//console.log("attrs: " +attrs, "", this.element);
// TODO: foreach and set each
this.element.attr(attrs);
}
};
function Polygone(points, strokeWidth) {
/* Array on coordinates:
* points: [{x: 410, y: 110}, 1
* {x: 570, y: 110}, 1 2
* {x: 620, y: 240}, 2 3
* {x: 750, y: 270}, 3 4
* {x: 650, y: 370}]; 4
*/
this.points = points;
/*
* path for graph
* [["M", x1, y1], ["L", x2, y2], ["C", ax, ay, bx, by, x3, y3], ["L", x3, y3]]
*/
this.path = [];
this.anchors = [];
if (strokeWidth) this.strokeWidth = strokeWidth;
this.closePath = true;
this.init();
};
/*
* Poligone is inherited from Poliline: draws closedPath of polyline
*/
var Foo = function () { };
Foo.prototype = Polyline.prototype;
Polygone.prototype = new Foo();
Polygone.prototype.rebuildPath = function(){
var path = [];
//console.log("Polygone rebuildPath");
for(var i = 0; i < this.getAnchorsCount(); i++){
var anchor = this.getAnchor(i);
var pathType = ""
if (i==0)
pathType = "M";
else
pathType = "L";
var targetX = anchor.x, targetY = anchor.y;
// anti smoothing
if (this.strokeWidth%2 == 1) {
targetX += 0.5;
targetY += 0.5;
}
path.push([pathType, targetX, targetY]);
}
if (this.closePath)
path.push(["Z"]);
this.path = path;
};
/*
Polygone.prototype.transform = function(transformation){
this.element.transform(transformation);
};
*/
\ No newline at end of file
... ...
/**
* Represents a canvas on which BPMN 2.0 constructs can be drawn.
*
* Some of the icons used are licenced under a Creative Commons Attribution 2.5
* License, see http://www.famfamfam.com/lab/icons/silk/
*
* @see ProcessDiagramGenerator
* @author (Java) Joram Barrez
* @author (Javascript) Dmitry Farafonov
*/
//Color.Cornsilk
var ARROW_HEAD_SIMPLE = "simple";
var ARROW_HEAD_EMPTY = "empty";
var ARROW_HEAD_FILL = "FILL";
var MULTILINE_VERTICAL_ALIGN_TOP = "top";
var MULTILINE_VERTICAL_ALIGN_MIDDLE = "middle";
var MULTILINE_VERTICAL_ALIGN_BOTTOM = "bottom";
var MULTILINE_HORIZONTAL_ALIGN_LEFT = "start";
var MULTILINE_HORIZONTAL_ALIGN_MIDDLE = "middle";
var MULTILINE_HORIZONTAL_ALIGN_RIGHT = "end";
// Predefined sized
var TEXT_PADDING = 3;
var ARROW_WIDTH = 4;
var CONDITIONAL_INDICATOR_WIDTH = 16;
var MARKER_WIDTH = 12;
var ANNOTATION_TEXT_PADDING = 7;
// Colors
var TASK_COLOR = Color.OldLace; // original: Color.get(255, 255, 204);
var TASK_STROKE_COLOR = Color.black; /*Color.SlateGrey; */
//var EXPANDED_SUBPROCESS_ATTRS = Color.black; /*Color.SlateGrey; */
var BOUNDARY_EVENT_COLOR = Color.white;
var CONDITIONAL_INDICATOR_COLOR = Color.get(255, 255, 255);
var HIGHLIGHT_COLOR = Color.Firebrick1;
//var SEQUENCEFLOW_COLOR = Color.DimGrey;
var SEQUENCEFLOW_COLOR = Color.black;
var CATCHING_EVENT_COLOR = Color.black; /* Color.SlateGrey; */
var START_EVENT_COLOR = Color.get(251,251,251);
var START_EVENT_STROKE_COLOR = Color.black; /* Color.SlateGrey; */
var END_EVENT_COLOR = Color.get(251,251,251);
//var END_EVENT_STROKE_COLOR = Color.black;
var NONE_END_EVENT_COLOR = Color.Firebrick4;
var NONE_END_EVENT_STROKE_COLOR = Color.Firebrick4;
var ERROR_END_EVENT_COLOR = Color.Firebrick;
var ERROR_END_EVENT_STROKE_COLOR = Color.Firebrick;
//var LABEL_COLOR = Color.get(112, 146, 190);
var LABEL_COLOR = Color.get(72, 106, 150);
// Fonts
var NORMAL_FONT = {font: "10px Arial", opacity: 1, fill: Color.black};
var LABEL_FONT = {font: "11px Arial", "font-style":"italic", opacity: 1, "fill": LABEL_COLOR};
var LABEL_FONT_SMOOTH = {font: "10px Arial", "font-style":"italic", opacity: 1, "fill": LABEL_COLOR, stroke: LABEL_COLOR, "stroke-width":.4};
var TASK_FONT = {font: "11px Arial", opacity: 1, fill: Color.black};
var TASK_FONT_SMOOTH = {font: "11px Arial", opacity: 1, fill: Color.black, stroke: LABEL_COLOR, "stroke-width":.4};
var POOL_LANE_FONT = {font: "11px Arial", opacity: 1, fill: Color.black};
var EXPANDED_SUBPROCESS_FONT = {font: "11px Arial", opacity: 1, fill: Color.black};
// Strokes
var NORMAL_STROKE = 1;
var SEQUENCEFLOW_STROKE = 1.5;
var SEQUENCEFLOW_HIGHLIGHT_STROKE = 2;
var THICK_TASK_BORDER_STROKE = 2.5;
var GATEWAY_TYPE_STROKE = 3.2;
var END_EVENT_STROKE = NORMAL_STROKE+2;
var MULTI_INSTANCE_STROKE = 1.3;
var EVENT_SUBPROCESS_ATTRS = {"stroke": Color.black, "stroke-width": NORMAL_STROKE, "stroke-dasharray": ". "};
//var EXPANDED_SUBPROCESS_ATTRS = {"stroke": Color.black, "stroke-width": NORMAL_STROKE, "fill": Color.FloralWhite};
var EXPANDED_SUBPROCESS_ATTRS = {"stroke": Color.black, "stroke-width": NORMAL_STROKE, "fill": Color.WhiteSmoke};
var NON_INTERRUPTING_EVENT_STROKE = "- ";
var TASK_CORNER_ROUND = 10;
var EXPANDED_SUBPROCESS_CORNER_ROUND = 10;
// icons
var ICON_SIZE = 16;
var ICON_PADDING = 4;
var USERTASK_IMAGE = "images/deployer/user.png";
var SCRIPTTASK_IMAGE = "images/deployer/script.png";
var SERVICETASK_IMAGE = "images/deployer/service.png";
var RECEIVETASK_IMAGE = "images/deployer/receive.png";
var SENDTASK_IMAGE = "images/deployer/send.png";
var MANUALTASK_IMAGE = "images/deployer/manual.png";
var BUSINESS_RULE_TASK_IMAGE = "images/deployer/business_rule.png";
var TIMER_IMAGE = "images/deployer/timer.png";
var MESSAGE_CATCH_IMAGE = "images/deployer/message_catch.png";
var MESSAGE_THROW_IMAGE = "images/deployer/message_throw.png";
var ERROR_THROW_IMAGE = "images/deployer/error_throw.png";
var ERROR_CATCH_IMAGE = "images/deployer/error_catch.png";
var SIGNAL_CATCH_IMAGE = "images/deployer/signal_catch.png";
var SIGNAL_THROW_IMAGE = "images/deployer/signal_throw.png";
var MULTIPLE_CATCH_IMAGE = "images/deployer/multiple_catch.png";
var ObjectType = {
ELLIPSE: "ellipse",
FLOW: "flow",
RECT: "rect",
RHOMBUS: "rhombus"
};
function OBJ(type){
this.c = null;
this.type = type;
this.nestedElements = [];
};
OBJ.prototype = {
};
var CONNECTION_TYPE = {
SEQUENCE_FLOW: "sequence_flow",
MESSAGE_FLOW: "message_flow",
ASSOCIATION: "association"
};
var ProcessDiagramCanvas = function(){
};
ProcessDiagramCanvas.prototype = {
// var DefaultProcessDiagramCanvas = {
canvasHolder: "holder",
canvasWidth: 0,
canvasHeight: 0,
paint: Color.black,
strokeWidth: 0,
font: null,
fontSmoothing: null,
g: null,
ninjaPaper: null,
objects: [],
processDefinitionId: null,
activity: null,
frame: null,
debug: false,
/**
* Creates an empty canvas with given width and height.
*/
init: function(width, height, processDefinitionId){
this.canvasWidth = width;
this.canvasHeight = height;
// TODO: name it as 'canvasName'
if (!processDefinitionId)
processDefinitionId = "holder";
this.processDefinitionId = processDefinitionId;
this.canvasHolder = this.processDefinitionId;
var h = document.getElementById(this.canvasHolder);
if (!h) return;
h.style.width = this.canvasWidth;
h.style.height = this.canvasHeight;
this.g = Raphael(this.canvasHolder);
this.g.clear();
//this.setPaint(Color.DimGrey);
this.setPaint(Color.black);
//this.setPaint(Color.white);
this.setStroke(NORMAL_STROKE);
//this.setFont("Arial", 11);
this.setFont(NORMAL_FONT);
//this.font = this.g.getFont("Arial");
this.fontSmoothing = true;
// ninja!
var RaphaelOriginal = Raphael;
this.ninjaPaper =(function (local_raphael) {
var paper = local_raphael(1, 1, 1, 1, processDefinitionId);
return paper;
})(Raphael.ninja());
Raphael = RaphaelOriginal;
},
setPaint: function(color){
this.paint = color;
},
getPaint: function(){
return this.paint;
},
setStroke: function(strokeWidth){
this.strokeWidth = strokeWidth;
},
getStroke: function(){
return this.strokeWidth;
},
/*
setFont: function(family, weight, style, stretch){
this.font = this.g.getFont(family, weight);
},
*/
setFont: function(font){
this.font = font;
},
getFont: function(){
return this.font;
},
drawShaddow: function(object){
var border = object.clone();
border.attr({"stroke-width": this.strokeWidth + 6,
"stroke": Color.white,
"fill": Color.white,
"opacity": 1,
"stroke-dasharray":null});
//border.toBack();
object.toFront();
return border;
},
setConextObject: function(obj){
this.contextObject = obj;
},
getConextObject: function(){
return this.contextObject;
},
setContextToElement: function(object){
var contextObject = this.getConextObject();
object.id = contextObject.id;
object.data("contextObject", contextObject);
},
onClick: function(event, instance, element){
var overlay = element;
var set = overlay.data("set");
var contextObject = overlay.data("contextObject");
//console.log("["+contextObject.getProperty("type")+"], activityId: " + contextObject.getId());
if (ProcessDiagramGenerator.options && ProcessDiagramGenerator.options.on && ProcessDiagramGenerator.options.on.click) {
var args = [instance, element, contextObject];
ProcessDiagramGenerator.options.on.click.apply(event, args);
}
},
onRightClick: function(event, instance, element){
var overlay = element;
var set = overlay.data("set");
var contextObject = overlay.data("contextObject");
//console.log("[%s], activityId: %s (RIGHTCLICK)", contextObject.getProperty("type"), contextObject.getId());
if (ProcessDiagramGenerator.options && ProcessDiagramGenerator.options.on && ProcessDiagramGenerator.options.on.rightClick) {
var args = [instance, element, contextObject];
ProcessDiagramGenerator.options.on.rightClick.apply(event, args);
}
},
onHoverIn: function(event, instance, element){
var overlay = element;
var set = overlay.data("set");
var contextObject = overlay.data("contextObject");
var border = instance.g.getById(contextObject.id + "_border");
border.attr("opacity", 0.3);
// provide callback
if (ProcessDiagramGenerator.options && ProcessDiagramGenerator.options.on && ProcessDiagramGenerator.options.on.over) {
var args = [instance, element, contextObject];
ProcessDiagramGenerator.options.on.over.apply(event, args);
}
},
onHoverOut: function(event, instance, element){
var overlay = element;
var set = overlay.data("set");
var contextObject = overlay.data("contextObject");
var border = instance.g.getById(contextObject.id + "_border");
border.attr("opacity", 0.0);
// provide callback
if (ProcessDiagramGenerator.options && ProcessDiagramGenerator.options.on && ProcessDiagramGenerator.options.on.out) {
var args = [instance, element, contextObject];
ProcessDiagramGenerator.options.on.out.apply(event, args);
}
},
addHandlers: function(set, x, y, width, height, type){
var contextObject = this.getConextObject();
var cx = x+width/2, cy = y+height/2;
if (type == "event") {
var border = this.g.ellipse(cx, cy, width/2+4, height/2+4);
var overlay = this.g.ellipse(cx, cy, width/2, height/2);
} else if (type == "gateway") {
// rhombus
var border = this.g.path( "M" + (x - 4) + " " + (y + (height / 2)) +
"L" + (x + (width / 2)) + " " + (y + height + 4) +
"L" + (x + width + 4) + " " + (y + (height / 2)) +
"L" + (x + (width / 2)) + " " + (y - 4) +
"z" );
var overlay = this.g.path( "M" + x + " " + (y + (height / 2)) +
"L" + (x + (width / 2)) + " " + (y + height) +
"L" + (x + width) + " " + (y + (height / 2)) +
"L" + (x + (width / 2)) + " " + y +
"z" );
} else if (type == "task") {
var border = this.g.rect(x - 4, y - 4, width+9, height+9, TASK_CORNER_ROUND+4);
var overlay = this.g.rect(x, y, width, height, TASK_CORNER_ROUND);
}
border.attr({stroke: Color.get(132,112,255)/*Color.Tan1*/,"stroke-width": 4, opacity: 0.0});
border.id = contextObject.id + "_border";
set.push(border);
overlay.attr({stroke: Color.Orange,"stroke-width": 3, fill: Color.get(0,0,0), opacity: 0.0, cursor: "hand"});
overlay.data("set",set);
overlay.id = contextObject.id;
overlay.data("contextObject",contextObject);
var instance = this;
overlay.mousedown(function(event){if (event.button == 2) instance.onRightClick(event, instance, this);});
overlay.click(function(event){instance.onClick(event, instance, this);});
overlay.hover(function(event){instance.onHoverIn(event, instance, this);}, function(event){instance.onHoverOut(event, instance, this);});
},
/*
* Start Events:
*
* drawNoneStartEvent
* drawTimerStartEvent
* drawMessageStartEvent
* drawErrorStartEvent
* drawSignalStartEvent
* _drawStartEventImage
* _drawStartEvent
*/
drawNoneStartEvent: function(x, y, width, height) {
this.g.setStart();
var isInterrupting = undefined;
this._drawStartEvent(x, y, width, height, isInterrupting, null);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawTimerStartEvent: function(x, y, width, height, isInterrupting, name) {
this.g.setStart();
this._drawStartEvent(x, y, width, height, isInterrupting, null);
var cx = x + width/2 - this.getStroke()/4;
var cy = y + height/2 - this.getStroke()/4;
var w = width*.9;// - this.getStroke()*2;
var h = height*.9;// - this.getStroke()*2;
this._drawClock(cx, cy, w, h);
if (this.gebug)
var center = this.g.ellipse(cx, cy, 3, 3).attr({stroke:"none", fill: Color.green});
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawMessageStartEvent: function(x, y, width, height, isInterrupting, name) {
this.g.setStart();
this._drawStartEvent(x, y, width, height, isInterrupting, null);
this._drawStartEventImage(x, y, width, height, MESSAGE_CATCH_IMAGE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawErrorStartEvent: function(x, y, width, height, name) {
this.g.setStart();
var isInterrupting = undefined;
this._drawStartEvent(x, y, width, height, isInterrupting);
this._drawStartEventImage(x, y, width, height, ERROR_CATCH_IMAGE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawSignalStartEvent: function(x, y, width, height, isInterrupting, name) {
this.g.setStart();
this._drawStartEvent(x, y, width, height, isInterrupting, null);
this._drawStartEventImage(x, y, width, height, SIGNAL_CATCH_IMAGE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawMultipleStartEvent: function(x, y, width, height, isInterrupting, name) {
this.g.setStart();
this._drawStartEvent(x, y, width, height, isInterrupting, null);
var cx = x + width/2 - this.getStroke()/4;
var cy = y + height/2 - this.getStroke()/4;
var w = width*1;
var h = height*1;
this._drawPentagon(cx, cy, w, h);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
_drawStartEventImage: function(x, y, width, height, image){
var cx = x + width/2 - this.getStroke()/2;
var cy = y + height/2 - this.getStroke()/2;
var w = width*.65;// - this.getStroke()*2;
var h = height*.65;// - this.getStroke()*2;
var img = this.g.image(image, cx-w/2, cy-h/2, w, h);
},
_drawStartEvent: function(x, y, width, height, isInterrupting){
var originalPaint = this.getPaint();
if (typeof(START_EVENT_STROKE_COLOR) != "undefined")
this.setPaint(START_EVENT_STROKE_COLOR);
width -= this.strokeWidth / 2;
height -= this.strokeWidth / 2;
x = x + width/2;
y = y + height/2;
var circle = this.g.ellipse(x, y, width/2, height/2);
circle.attr({"stroke-width": this.strokeWidth,
"stroke": this.paint,
//"stroke": START_EVENT_STROKE_COLOR,
"fill": START_EVENT_COLOR});
// white shaddow
this.drawShaddow(circle);
if (isInterrupting!=null && isInterrupting!=undefined && !isInterrupting)
circle.attr({"stroke-dasharray": NON_INTERRUPTING_EVENT_STROKE});
this.setContextToElement(circle);
this.setPaint(originalPaint);
},
/*
* End Events:
*
* drawNoneEndEvent
* drawErrorEndEvent
* drawMessageEndEvent
* drawSignalEndEvent
* drawMultipleEndEvent
* _drawEndEventImage
* _drawNoneEndEvent
*/
drawNoneEndEvent: function(x, y, width, height) {
this.g.setStart();
this._drawNoneEndEvent(x, y, width, height, null, "noneEndEvent");
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawErrorEndEvent: function(x, y, width, height) {
this.g.setStart();
var type = "errorEndEvent";
this._drawNoneEndEvent(x, y, width, height, null, type);
this._drawEndEventImage(x, y, width, height, ERROR_THROW_IMAGE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawMessageEndEvent: function(x, y, width, height, name) {
this.g.setStart();
var type = "errorEndEvent";
this._drawNoneEndEvent(x, y, width, height, null, type);
this._drawEndEventImage(x, y, width, height, MESSAGE_THROW_IMAGE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawSignalEndEvent: function(x, y, width, height, name) {
this.g.setStart();
var type = "errorEndEvent";
this._drawNoneEndEvent(x, y, width, height, null, type);
this._drawEndEventImage(x, y, width, height, SIGNAL_THROW_IMAGE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawMultipleEndEvent: function(x, y, width, height, name) {
this.g.setStart();
var type = "errorEndEvent";
this._drawNoneEndEvent(x, y, width, height, null, type);
var cx = x + width/2;// - this.getStroke();
var cy = y + height/2;// - this.getStroke();
var w = width*1;
var h = height*1;
var filled = true;
this._drawPentagon(cx, cy, w, h, filled);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawTerminateEndEvent: function(x, y, width, height) {
this.g.setStart();
var type = "errorEndEvent";
this._drawNoneEndEvent(x, y, width, height, null, type);
var cx = x + width/2;// - this.getStroke()/2;
var cy = y + height/2;// - this.getStroke()/2;
var w = width/2*.6;
var h = height/2*.6;
var circle = this.g.ellipse(cx, cy, w, h).attr({fill: Color.black});
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
_drawEndEventImage: function(x, y, width, height, image){
var cx = x + width/2 - this.getStroke()/2;
var cy = y + height/2 - this.getStroke()/2;
var w = width*.65;
var h = height*.65;
var img = this.g.image(image, cx-w/2, cy-h/2, w, h);
},
_drawNoneEndEvent: function(x, y, width, height, image, type) {
var originalPaint = this.getPaint();
if (typeof(CATCHING_EVENT_COLOR) != "undefined")
this.setPaint(CATCHING_EVENT_COLOR);
var strokeColor = this.getPaint();
var fillColor = this.getPaint();
if (type == "errorEndEvent") {
strokeColor = ERROR_END_EVENT_STROKE_COLOR;
fillColor = ERROR_END_EVENT_COLOR;
} else if (type == "noneEndEvent") {
strokeColor = NONE_END_EVENT_STROKE_COLOR;
fillColor = NONE_END_EVENT_COLOR;
} else
// event circles
width -= this.strokeWidth / 2;
height -= this.strokeWidth / 2;
x = x + width/2;// + this.strokeWidth/2;
y = y + width/2;// + this.strokeWidth/2;
// outerCircle
var outerCircle = this.g.ellipse(x, y, width/2, height/2);
// white shaddow
var shaddow = this.drawShaddow(outerCircle);
outerCircle.attr({"stroke-width": this.strokeWidth,
"stroke": strokeColor,
"fill": fillColor});
var innerCircleX = x;
var innerCircleY = y;
var innerCircleWidth = width/2 - 2;
var innerCircleHeight = height/2 - 2;
var innerCircle = this.g.ellipse(innerCircleX, innerCircleY, innerCircleWidth, innerCircleHeight);
innerCircle.attr({"stroke-width": this.strokeWidth,
"stroke": strokeColor,
"fill": Color.white});
// TODO: implement it
//var originalPaint = this.getPaint();
//this.g.setPaint(BOUNDARY_EVENT_COLOR);
this.setPaint(originalPaint);
},
/*
* Catching Events:
*
* drawCatchingTimerEvent
* drawCatchingErrorEvent
* drawCatchingSignalEvent
* drawCatchingMessageEvent
* drawCatchingMultipleEvent
* _drawCatchingEventImage
* _drawCatchingEvent
*/
drawCatchingTimerEvent: function(x, y, width, height, isInterrupting, name) {
this.g.setStart();
this._drawCatchingEvent(x, y, width, height, isInterrupting, null);
var innerCircleWidth = width - 4;
var innerCircleHeight = height - 4;
var cx = x + width/2 - this.getStroke()/4;
var cy = y + height/2 - this.getStroke()/4;
var w = innerCircleWidth*.9;// - this.getStroke()*2;
var h = innerCircleHeight*.9;// - this.getStroke()*2;
this._drawClock(cx, cy, w, h);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawCatchingErrorEvent: function(x, y, width, height, isInterrupting, name) {
this.g.setStart();
this._drawCatchingEvent(x, y, width, height, isInterrupting, null);
this._drawCatchingEventImage(x, y, width, height, ERROR_CATCH_IMAGE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawCatchingSignalEvent: function(x, y, width, height, isInterrupting, name) {
this.g.setStart();
this._drawCatchingEvent(x, y, width, height, isInterrupting, null);
this._drawCatchingEventImage(x, y, width, height, SIGNAL_CATCH_IMAGE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawCatchingMessageEvent: function(x, y, width, height, isInterrupting, name) {
this.g.setStart();
this._drawCatchingEvent(x, y, width, height, isInterrupting, null);
this._drawCatchingEventImage(x, y, width, height, MESSAGE_CATCH_IMAGE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawCatchingMultipleEvent: function(x, y, width, height, isInterrupting, name) {
this.g.setStart();
this._drawCatchingEvent(x, y, width, height, isInterrupting, null);
var cx = x + width/2 - this.getStroke();
var cy = y + height/2 - this.getStroke();
var w = width*.9;
var h = height*.9;
this._drawPentagon(cx, cy, w, h);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
_drawCatchingEventImage: function(x, y, width, height, image){
var innerCircleWidth = width - 4;
var innerCircleHeight = height - 4;
var cx = x + width/2 - this.getStroke()/2;
var cy = y + height/2 - this.getStroke()/2;
var w = innerCircleWidth*.6;// - this.getStroke()*2;
var h = innerCircleHeight*.6;// - this.getStroke()*2;
var img = this.g.image(image, cx-w/2, cy-h/2, w, h);
},
_drawCatchingEvent: function(x, y, width, height, isInterrupting, image) {
var originalPaint = this.getPaint();
if (typeof(CATCHING_EVENT_COLOR) != "undefined")
this.setPaint(CATCHING_EVENT_COLOR);
// event circles
width -= this.strokeWidth / 2;
height -= this.strokeWidth / 2;
x = x + width/2;// + this.strokeWidth/2;
y = y + width/2;// + this.strokeWidth/2;
// outerCircle
var outerCircle = this.g.ellipse(x, y, width/2, height/2);
// white shaddow
var shaddow = this.drawShaddow(outerCircle);
//console.log("isInterrupting: " + isInterrupting, "x:" , x, "y:",y);
if (isInterrupting!=null && isInterrupting!=undefined && !isInterrupting)
outerCircle.attr({"stroke-dasharray": NON_INTERRUPTING_EVENT_STROKE});
outerCircle.attr({"stroke-width": this.strokeWidth,
"stroke": this.getPaint(),
"fill": BOUNDARY_EVENT_COLOR});
var innerCircleX = x;
var innerCircleY = y;
var innerCircleRadiusX = width/2 - 4;
var innerCircleRadiusY = height/2 - 4;
var innerCircle = this.g.ellipse(innerCircleX, innerCircleY, innerCircleRadiusX, innerCircleRadiusY);
innerCircle.attr({"stroke-width": this.strokeWidth,
"stroke": this.getPaint()});
if (image) {
var imageWidth = imageHeight = innerCircleRadiusX*1.2 + this.getStroke()*2;
var imageX = innerCircleX-imageWidth/2 - this.strokeWidth/2;
var imageY = innerCircleY-imageWidth/2 - this.strokeWidth/2;
var img = this.g.image(image, imageX, imageY, imageWidth, imageHeight);
}
this.setPaint(originalPaint);
var set = this.g.set();
set.push(outerCircle, innerCircle, shaddow);
this.setContextToElement(outerCircle);
// TODO: add shapes to set
/*
var st = this.g.set();
st.push(
this.g.ellipse(innerCircleX, innerCircleY, 2, 2),
this.g.ellipse(imageX, imageY, 2, 2)
);
st.attr({fill: "red", "stroke-width":0});
*/
},
/*
* Catching Events:
*
* drawThrowingNoneEvent
* drawThrowingSignalEvent
* drawThrowingMessageEvent
* drawThrowingMultipleEvent
*/
drawThrowingNoneEvent: function(x, y, width, height, name) {
this.g.setStart();
this._drawCatchingEvent(x, y, width, height, null, null);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawThrowingSignalEvent: function(x, y, width, height, name) {
this.g.setStart();
this._drawCatchingEvent(x, y, width, height, null, null);
this._drawCatchingEventImage(x, y, width, height, SIGNAL_THROW_IMAGE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawThrowingMessageEvent: function(x, y, width, height, name) {
this.g.setStart();
this._drawCatchingEvent(x, y, width, height, null, null);
this._drawCatchingEventImage(x, y, width, height, MESSAGE_THROW_IMAGE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
drawThrowingMultipleEvent: function(x, y, width, height, name) {
this.g.setStart();
this._drawCatchingEvent(x, y, width, height, null, null);
var cx = x + width/2 - this.getStroke();
var cy = y + height/2 - this.getStroke();
var w = width*.9;
var h = height*.9;
var filled = true;
this._drawPentagon(cx, cy, w, h, filled);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "event");
},
/*
* Draw flows:
*
* _connectFlowToActivity
* _drawFlow
* _drawDefaultSequenceFlowIndicator
* drawSequenceflow
* drawMessageflow
* drawAssociation
* _drawCircleTail
* _drawArrowHead
* _drawConditionalSequenceFlowIndicator
* drawSequenceflowWithoutArrow
*/
_connectFlowToActivity: function(sourceActivityId, destinationActivityId, waypoints){
var sourceActivity = this.g.getById(sourceActivityId);
var destinationActivity = this.g.getById(destinationActivityId);
if (sourceActivity == null || destinationActivity == null) {
if (sourceActivity == null)
console.error("source activity["+sourceActivityId+"] not found");
else
console.error("destination activity["+destinationActivityId+"] not found");
return null;
}
var bbSourceActivity = sourceActivity.getBBox()
var bbDestinationActivity = destinationActivity.getBBox()
var path = [];
var newWaypoints = [];
for(var i = 0; i < waypoints.length; i++){
var pathType = ""
if (i==0)
pathType = "M";
else
pathType = "L";
path.push([pathType, waypoints[i].x, waypoints[i].y]);
newWaypoints.push({x:waypoints[i].x, y:waypoints[i].y});
}
var ninjaPathSourceActivity = this.ninjaPaper.path(sourceActivity.realPath);
var ninjaPathDestinationActivity = this.ninjaPaper.path(destinationActivity.realPath);
var ninjaBBSourceActivity = ninjaPathSourceActivity.getBBox();
var ninjaBBDestinationActivity = ninjaPathDestinationActivity.getBBox();
// set target of the flow to the center of the taskObject
var newPath = path;
var originalSource = {x: newPath[0][1], y: newPath[0][2]};
var originalTarget = {x: newPath[newPath.length-1][1], y: newPath[newPath.length-1][2]};
newPath[0][1] = ninjaBBSourceActivity.x + (ninjaBBSourceActivity.x2 - ninjaBBSourceActivity.x ) / 2;
newPath[0][2] = ninjaBBSourceActivity.y + (ninjaBBSourceActivity.y2 - ninjaBBSourceActivity.y ) / 2;
newPath[newPath.length-1][1] = ninjaBBDestinationActivity.x + (ninjaBBDestinationActivity.x2 - ninjaBBDestinationActivity.x ) / 2;
newPath[newPath.length-1][2] = ninjaBBDestinationActivity.y + (ninjaBBDestinationActivity.y2 - ninjaBBDestinationActivity.y ) / 2;
var ninjaPathFlowObject = this.ninjaPaper.path(newPath);
var ninjaBBFlowObject = ninjaPathFlowObject.getBBox();
var intersectionsSource = Raphael.pathIntersection(ninjaPathSourceActivity.realPath, ninjaPathFlowObject.realPath);
var intersectionsDestination = Raphael.pathIntersection(ninjaPathDestinationActivity.realPath, ninjaPathFlowObject.realPath);
var intersectionSource = intersectionsSource.pop();
var intersectionDestination = intersectionsDestination.pop();
if (intersectionSource != undefined) {
if (this.gebug) {
var diameter = 5;
var dotOriginal = this.g.ellipse(originalSource.x, originalSource.y, diameter, diameter).attr({"fill": Color.white, "stroke": Color.Pink});
var dot = this.g.ellipse(intersectionSource.x, intersectionSource.y, diameter, diameter).attr({"fill": Color.white, "stroke": Color.Green});
}
newWaypoints[0].x = intersectionSource.x;
newWaypoints[0].y = intersectionSource.y;
}
if (intersectionDestination != undefined) {
if (this.gebug) {
var diameter = 5;
var dotOriginal = this.g.ellipse(originalTarget.x, originalTarget.y, diameter, diameter).attr({"fill": Color.white, "stroke": Color.Red});
var dot = this.g.ellipse(intersectionDestination.x, intersectionDestination.y, diameter, diameter).attr({"fill": Color.white, "stroke": Color.Blue});
}
newWaypoints[newWaypoints.length-1].x = intersectionDestination.x;
newWaypoints[newWaypoints.length-1].y = intersectionDestination.y;
}
this.ninjaPaper.clear();
return newWaypoints;
},
_drawFlow: function(waypoints, conditional, isDefault, highLighted, withArrowHead, connectionType){
var originalPaint = this.getPaint();
var originalStroke = this.getStroke();
this.setPaint(SEQUENCEFLOW_COLOR);
this.setStroke(SEQUENCEFLOW_STROKE);
if (highLighted) {
this.setPaint(HIGHLIGHT_COLOR);
this.setStroke(SEQUENCEFLOW_HIGHLIGHT_STROKE);
}
// TODO: generate polylineId or do something!!
var uuid = Raphael.createUUID();
var contextObject = this.getConextObject();
var newWaypoints = waypoints;
if (contextObject) {
var newWaypoints = this._connectFlowToActivity(contextObject.sourceActivityId, contextObject.destinationActivityId, waypoints);
if (!newWaypoints) {
console.error("Error draw flow from '"+contextObject.sourceActivityId+"' to '"+contextObject.destinationActivityId+"' ");
return;
}
}
var polyline = new Polyline(uuid, newWaypoints, this.getStroke());
//var polyline = new Polyline(waypoints, 3);
polyline.element = this.g.path(polyline.path);
polyline.element.attr("stroke-width", this.getStroke());
polyline.element.attr("stroke", this.getPaint());
if (contextObject) {
polyline.element.id = contextObject.id;
polyline.element.data("contextObject", contextObject);
} else {
polyline.element.id = uuid;
}
/*
polyline.element.mouseover(function(){
this.attr({"stroke-width": NORMAL_STROKE + 2});
}).mouseout(function(){
this.attr({"stroke-width": NORMAL_STROKE});
});
*/
var last = polyline.getAnchorsCount()-1;
var x = polyline.getAnchor(last).x;
var y = polyline.getAnchor(last).y;
//var c = this.g.ellipse(x, y, 5, 5);
var lastLineIndex = polyline.getLinesCount()-1;
var line = polyline.getLine(lastLineIndex);
var firstLine = polyline.getLine(0);
var arrowHead = null,
circleTail = null,
defaultSequenceFlowIndicator = null,
conditionalSequenceFlowIndicator = null;
if (connectionType == CONNECTION_TYPE.MESSAGE_FLOW) {
circleTail = this._drawCircleTail(firstLine, connectionType);
}
if(withArrowHead)
arrowHead = this._drawArrowHead(line, connectionType);
//console.log("isDefault: ", isDefault, ", isDefaultConditionAvailable: ", polyline.isDefaultConditionAvailable);
if (isDefault && polyline.isDefaultConditionAvailable) {
//var angle = polyline.getLineAngle(0);
//console.log("firstLine", firstLine);
defaultSequenceFlowIndicator = this._drawDefaultSequenceFlowIndicator(firstLine);
}
if (conditional) {
conditionalSequenceFlowIndicator = this._drawConditionalSequenceFlowIndicator(firstLine);
}
// draw flow name
var flowName = contextObject.name;
if (flowName) {
var xPointArray = contextObject.xPointArray;
var yPointArray = contextObject.yPointArray;
var textX = xPointArray[0] < xPointArray[1] ? xPointArray[0] : xPointArray[1];
var textY = yPointArray[0] < yPointArray[1] ? yPointArray[1] : yPointArray[0];
// fix xy
textX += 20;
textY -= 10;
this.g.text(textX, textY, flowName).attr(LABEL_FONT);
}
var st = this.g.set();
st.push(polyline.element, arrowHead, circleTail, conditionalSequenceFlowIndicator);
polyline.element.data("set", st);
polyline.element.data("withArrowHead", withArrowHead);
var polyCloneAttrNormal = {"stroke-width": this.getStroke() + 5, stroke: Color.get(132,112,255), opacity: 0.0, cursor: "hand"};
var polyClone = st.clone().attr(polyCloneAttrNormal).hover(function () {
//if (polyLine.data("isSelected")) return;
polyClone.attr({opacity: 0.2});
}, function () {
//if (polyLine.data("isSelected")) return;
polyClone.attr({opacity: 0.0});
});
polyClone.data("objectId", polyline.element.id);
polyClone.click(function(){
var instance = this;
var objectId = instance.data("objectId");
var object = this.paper.getById(objectId);
var contextObject = object.data("contextObject");
if (contextObject) {
console.log("[flow], objectId: " + object.id +", flow: " + contextObject.flow);
ProcessDiagramGenerator.showFlowInfo(contextObject);
}
}).dblclick(function(){
console.log("!!! DOUBLE CLICK !!!");
}).hover(function (mouseEvent) {
var instance = this;
var objectId = instance.data("objectId");
var object = this.paper.getById(objectId);
var contextObject = object.data("contextObject");
if (contextObject)
ProcessDiagramGenerator.showFlowInfo(contextObject);
});
polyClone.data("parentId", uuid);
if (!connectionType || connectionType == CONNECTION_TYPE.SEQUENCE_FLOW)
polyline.element.attr("stroke-width", this.getStroke());
else if (connectionType == CONNECTION_TYPE.MESSAGE_FLOW)
polyline.element.attr({"stroke-dasharray": "--"});
else if (connectionType == CONNECTION_TYPE.ASSOCIATION)
polyline.element.attr({"stroke-dasharray": ". "});
this.setPaint(originalPaint);
this.setStroke(originalStroke);
},
_drawDefaultSequenceFlowIndicator: function(line) {
//console.log("line: ", line);
var len = 10; c = len/2, f = 8;
var defaultIndicator = this.g.path("M" + (-c) + " " + 0 + "L" + (c) + " " + 0);
defaultIndicator.attr("stroke-width", this.getStroke()+0);
defaultIndicator.attr("stroke", this.getPaint());
var cosAngle = Math.cos((line.angle));
var sinAngle = Math.sin((line.angle));
var dx = f * cosAngle;
var dy = f * sinAngle;
var x1 = line.x1 + dx + 0*c*cosAngle;
var y1 = line.y1 + dy + 0*c*sinAngle;
defaultIndicator.transform("t" + (x1) + "," + (y1) + "");
defaultIndicator.transform("...r" + Raphael.deg(line.angle - 3*Math.PI / 4) + " " + 0 + " " + 0);
/*
var c0 = this.g.ellipse(0, 0, 1, 1).attr({stroke: Color.Blue});
c0.transform("t" + (line.x1) + "," + (line.y1) + "");
var center = this.g.ellipse(0, 0, 1, 1).attr({stroke: Color.Red});
center.transform("t" + (line.x1+dx) + "," + (line.y1+dy) + "");
*/
return defaultIndicator;
},
drawSequenceflow: function(waypoints, conditional, isDefault, highLighted) {
var withArrowHead = true;
this._drawFlow(waypoints, conditional, isDefault, highLighted, withArrowHead, CONNECTION_TYPE.SEQUENCE_FLOW);
},
drawMessageflow: function(waypoints, highLighted) {
var withArrowHead = true;
var conditional=isDefault=false;
this._drawFlow(waypoints, conditional, isDefault, highLighted, withArrowHead, CONNECTION_TYPE.MESSAGE_FLOW);
},
drawAssociation: function(waypoints, withArrowHead, highLighted) {
var withArrowHead = withArrowHead;
var conditional=isDefault=false;
this._drawFlow(waypoints, conditional, isDefault, highLighted, withArrowHead, CONNECTION_TYPE.ASSOCIATION);
},
_drawCircleTail: function(line, connectionType){
var diameter = ARROW_WIDTH/2*1.5;
// anti smoothing
if (this.strokeWidth%2 == 1)
line.x1 += .5, line.y1 += .5;
var circleTail = this.g.ellipse(line.x1, line.y1, diameter, diameter);
circleTail.attr("fill", Color.white);
circleTail.attr("stroke", this.getPaint());
return circleTail;
},
_drawArrowHead: function(line, connectionType){
var doubleArrowWidth = 2 * ARROW_WIDTH;
if (connectionType == CONNECTION_TYPE.ASSOCIATION)
var arrowHead = this.g.path("M-" + (ARROW_WIDTH/2+.5) + " -" + doubleArrowWidth + "L 0 0 L" + (ARROW_WIDTH/2+.5) + " -" + doubleArrowWidth);
else
var arrowHead = this.g.path("M0 0L-" + (ARROW_WIDTH/2+.5) + " -" + doubleArrowWidth + "L" + (ARROW_WIDTH/2+.5) + " -" + doubleArrowWidth + "z");
//arrowHead.transform("t" + 0 + ",-" + this.getStroke() + "");
// anti smoothing
if (this.strokeWidth%2 == 1)
line.x2 += .5, line.y2 += .5;
arrowHead.transform("t" + line.x2 + "," + line.y2 + "");
arrowHead.transform("...r" + Raphael.deg(line.angle - Math.PI / 2) + " " + 0 + " " + 0);
if (!connectionType || connectionType == CONNECTION_TYPE.SEQUENCE_FLOW)
arrowHead.attr("fill", this.getPaint());
else if (connectionType == CONNECTION_TYPE.MESSAGE_FLOW)
arrowHead.attr("fill", Color.white);
arrowHead.attr("stroke-width", this.getStroke());
arrowHead.attr("stroke", this.getPaint());
return arrowHead;
},
/*
drawArrowHead2: function(srcX, srcY, targetX, targetY) {
var doubleArrowWidth = 2 * ARROW_WIDTH;
//var arrowHead = this.g.path("M-" + ARROW_WIDTH/2 + " -" + doubleArrowWidth + "L0 0" + "L" + ARROW_WIDTH/2 + " -" + doubleArrowWidth + "z");
var arrowHead = this.g.path("M0 0L-" + ARROW_WIDTH/1.5 + " -" + doubleArrowWidth + "L" + ARROW_WIDTH/1.5 + " -" + doubleArrowWidth + "z");
//var c = DefaultProcessDiagramCanvas.g.ellipse(0, 0, 3, 3);
//c.transform("t"+targetX+","+targetY+"");
var angle = Math.atan2(targetY - srcY, targetX - srcX);
arrowHead.transform("t"+targetX+","+targetY+"");
arrowHead.transform("...r" + Raphael.deg(angle - Math.PI / 2) + " "+0+" "+0);
//console.log(arrowHead.transform());
//console.log("--> " + Raphael.deg(angle - Math.PI / 2));
arrowHead.attr("fill", this.getPaint());
arrowHead.attr("stroke", this.getPaint());
/ *
// shaddow
var c0 = arrowHead.clone();
c0.transform("...t-1 1");
c0.attr("stroke-width", this.strokeWidth);
c0.attr("stroke", Color.black);
c0.attr("opacity", 0.15);
c0.toBack();
* /
},
*/
_drawConditionalSequenceFlowIndicator: function(line){
var horizontal = (CONDITIONAL_INDICATOR_WIDTH * 0.7);
var halfOfHorizontal = horizontal / 2;
var halfOfVertical = CONDITIONAL_INDICATOR_WIDTH / 2;
var uuid = null;
var waypoints = [{x: 0, y: 0},
{x: -halfOfHorizontal, y: halfOfVertical},
{x: 0, y: CONDITIONAL_INDICATOR_WIDTH},
{x: halfOfHorizontal, y: halfOfVertical}];
/*
var polyline = new Polyline(uuid, waypoints, this.getStroke());
polyline.element = this.g.path(polyline.path);
polyline.element.attr("stroke-width", this.getStroke());
polyline.element.attr("stroke", this.getPaint());
polyline.element.id = uuid;
*/
var polygone = new Polygone(waypoints, this.getStroke());
polygone.element = this.g.path(polygone.path);
polygone.element.attr("fill", Color.white);
polygone.transform("t" + line.x1 + "," + line.y1 + "");
polygone.transform("...r" + Raphael.deg(line.angle - Math.PI / 2) + " " + 0 + " " + 0);
var cosAngle = Math.cos((line.angle));
var sinAngle = Math.sin((line.angle));
//polygone.element.attr("stroke-width", this.getStroke());
//polygone.element.attr("stroke", this.getPaint());
polygone.attr({"stroke-width": this.getStroke(), "stroke": this.getPaint()});
return polygone.element;
},
drawSequenceflowWithoutArrow: function(waypoints, conditional, isDefault, highLighted) {
var withArrowHead = false;
this._drawFlow(waypoints, conditional, isDefault, highLighted, withArrowHead, CONNECTION_TYPE.SEQUENCE_FLOW);
},
/*
* Draw artifacts
*/
drawPoolOrLane: function(x, y, width, height, name){
// anti smoothing
if (this.strokeWidth%2 == 1)
x = Math.round(x) + .5, y = Math.round(y) + .5;
// shape
var rect = this.g.rect(x, y, width, height);
var attr = {"stroke-width": NORMAL_STROKE, stroke: TASK_STROKE_COLOR};
rect.attr(attr);
// Add the name as text, vertical
if(name != null && name.length > 0) {
var attr = POOL_LANE_FONT;
// Include some padding
var availableTextSpace = height - 6;
// Create rotation for derived font
var truncated = this.fitTextToWidth(name, availableTextSpace);
var realWidth = this.getStringWidth(truncated, attr);
var realHeight = this.getStringHeight(truncated, attr);
//console.log("truncated:", truncated, ", height:", height, ", realHeight:", realHeight, ", availableTextSpace:", availableTextSpace, ", realWidth:", realWidth);
var newX = x + 2 + realHeight*1 - realHeight/2;
var newY = 3 + y + availableTextSpace - (availableTextSpace - realWidth) / 2 - realWidth/2;
var textElement = this.g.text(newX, newY, truncated).attr(attr);
//console.log(".getBBox(): ", t.getBBox());
textElement.transform("r" + Raphael.deg(270 * Math.PI/180) + " " + newX + " " + newY);
}
// TODO: add to set
},
_drawTask: function(name, x, y, width, height, thickBorder) {
var originalPaint = this.getPaint();
this.setPaint(TASK_COLOR);
// anti smoothing
if (this.strokeWidth%2 == 1)
x = Math.round(x) + .5, y = Math.round(y) + .5;
// shape
var shape = this.g.rect(x, y, width, height, TASK_CORNER_ROUND);
var attr = {"stroke-width": this.strokeWidth, stroke: TASK_STROKE_COLOR, fill: this.getPaint()};
shape.attr(attr);
//shape.attr({fill: "90-"+this.getPaint()+"-" + Color.get(250, 250, 244)});
var contextObject = this.getConextObject();
if (contextObject) {
shape.id = contextObject.id;
shape.data("contextObject", contextObject);
}
//var activity = this.getConextObject();
//console.log("activity: " + activity.getId(), activity);
//Object.clone(activity);
/*
c.mouseover(function(){
this.attr({"stroke-width": NORMAL_STROKE + 2});
}).mouseout(function(){
this.attr({"stroke-width": NORMAL_STROKE});
});
*/
this.setPaint(originalPaint);
// white shaddow
this.drawShaddow(shape);
if (thickBorder) {
shape.attr({"stroke-width": THICK_TASK_BORDER_STROKE});
} else {
//g.draw(rect);
}
// text
if (name) {
var fontAttr = TASK_FONT;
// Include some padding
var paddingX = 5;
var paddingY = 5;
var availableTextSpace = width - paddingX*2;
// TODO: this.setFont
// var originalFont = this.getFont();
// this.setFont(TASK_FONT)
/*
var truncated = this.fitTextToWidth(name, availableTextSpace);
var realWidth = this.getStringWidth(truncated, fontAttr);
var realHeight = this.getStringHeight(truncated, fontAttr);
//var t = this.g.text(x + width/2 + realWidth*0/2 + paddingX*0, y + height/2, truncated).attr(fontAttr);
*/
//console.log("draw task name: " + name);
var boxWidth = width - (2 * TEXT_PADDING);
var boxHeight = height - ICON_SIZE - ICON_PADDING - ICON_PADDING - MARKER_WIDTH - 2 - 2;
var boxX = x + width/2 - boxWidth/2;
var boxY = y + height/2 - boxHeight/2 + ICON_PADDING + ICON_PADDING - 2 - 2;
/*
var boxWidth = width - (2 * ANNOTATION_TEXT_PADDING);
var boxHeight = height - (2 * ANNOTATION_TEXT_PADDING);
var boxX = x + width/2 - boxWidth/2;
var boxY = y + height/2 - boxHeight/2;
*/
this.drawTaskLabel(name, boxX, boxY, boxWidth, boxHeight);
}
},
drawTaskLabel: function(text, x, y, boxWidth, boxHeight){
var originalFont = this.getFont();
this.setFont(TASK_FONT);
this._drawMultilineText(text, x, y, boxWidth, boxHeight, MULTILINE_VERTICAL_ALIGN_MIDDLE, MULTILINE_HORIZONTAL_ALIGN_MIDDLE);
this.setFont(originalFont);
},
drawAnnotationText: function(text, x, y, width, height){
//this._drawMultilineText(text, x, y, width, height, "start");
var originalPaint = this.getPaint();
var originalFont = this.getFont();
this.setPaint(Color.black);
this.setFont(TASK_FONT);
this._drawMultilineText(text, x, y, width, height, MULTILINE_VERTICAL_ALIGN_TOP, MULTILINE_HORIZONTAL_ALIGN_LEFT);
this.setPaint(originalPaint);
this.setFont(originalFont);
},
drawLabel: function(text, x, y, width, height){
//this._drawMultilineText(text, x, y, width, height, "start");
var originalPaint = this.getPaint();
var originalFont = this.getFont();
this.setPaint(LABEL_COLOR);
//this.setFont(LABEL_FONT);
this.setFont(LABEL_FONT_SMOOTH);
// predefined box width for labels
// TODO: use label width as is, but not height (for stretching)
if (!width || !height) {
width = 100;
height = 0;
}
// TODO: remove it. It is debug
x = x - width/2;
this._drawMultilineText(text, x, y, width, height, MULTILINE_VERTICAL_ALIGN_TOP, MULTILINE_HORIZONTAL_ALIGN_MIDDLE);
this.setPaint(originalPaint);
this.setFont(originalFont);
},
/*
drawMultilineLabel: function(text, x, y){
var originalFont = this.getFont();
this.setFont(LABEL_FONT_SMOOTH);
var boxWidth = 80;
x = x - boxWidth/2
this._drawMultilineText(text, x, y, boxWidth, null, "middle");
this.setFont(originalFont);
},
*/
getStringWidth: function(text, fontAttrs){
var textElement = this.g.text(0, 0, text).attr(fontAttrs).hide();
var bb = textElement.getBBox();
//console.log("string width: ", t.getBBox().width);
return textElement.getBBox().width;
},
getStringHeight: function(text, fontAttrs){
var textElement = this.g.text(0, 0, text).attr(fontAttrs).hide();
var bb = textElement.getBBox();
//console.log("string height: ", t.getBBox().height);
return textElement.getBBox().height;
},
fitTextToWidth: function(original, width) {
var text = original;
// TODO: move attr on parameters
var attr = {font: "11px Arial", opacity: 0};
// remove length for "..."
var dots = this.g.text(0, 0, "...").attr(attr).hide();
var dotsBB = dots.getBBox();
var maxWidth = width - dotsBB.width;
var textElement = this.g.text(0, 0, text).attr(attr).hide();
var bb = textElement.getBBox();
// it's a little bit incorrect with "..."
while (bb.width > maxWidth && text.length > 0) {
text = text.substring(0, text.length - 1);
textElement.attr({"text": text});
bb = textElement.getBBox();
}
// remove element from paper
textElement.remove();
if (text != original) {
text = text + "...";
}
return text;
},
wrapTextToWidth: function(original, width){
//return original;
var text = original;
var wrappedText = "\n";
// TODO: move attr on parameters
var attr = {font: "11px Arial", opacity: 0};
var textElement = this.g.text(0, 0, wrappedText).attr(attr).hide();
var bb = textElement.getBBox();
var resultText = "";
var i = 0, j = 0;
while (text.length > 0) {
while (bb.width < width && text.length>0) {
// remove "\n"
wrappedText = wrappedText.substring(0,wrappedText.length-1);
// add new char, add "\n"
wrappedText = wrappedText + text.substring(0,1) + "\n";
text = text.substring(1);
textElement.attr({"text": wrappedText});
bb = textElement.getBBox();
i++;
if (i>200) break;
}
// remove "\n"
wrappedText = wrappedText.substring(0, wrappedText.length - 1);
if (text.length == 0) {
resultText += wrappedText;
break;
}
// return last char to text
text = wrappedText.substring(wrappedText.length-1) + text;
// remove last char from wrappedText
wrappedText = wrappedText.substring(0, wrappedText.length-1) + "\n";
textElement.attr({"text": wrappedText});
bb = textElement.getBBox();
//console.log(">> ", wrappedText, ", ", text);
resultText += wrappedText;
wrappedText = "\n";
j++;
if (j>20) break;
}
// remove element from paper
textElement.remove();
return resultText;
},
wrapTextToWidth2: function(original, width){
var text = original;
var wrappedText = "\n";
// TODO: move attr on parameters
var attr = {font: "11px Arial", opacity: 0};
var textElement = this.g.text(0, 0, wrappedText).attr(attr).hide();
var bb = textElement.getBBox();
var resultText = "";
var i = 0, j = 0;
while (text.length > 0) {
while (bb.width < width && text.length>0) {
// remove "\n"
wrappedText = wrappedText.substring(0,wrappedText.length-1);
// add new char, add "\n"
wrappedText = wrappedText + text.substring(0,1) + "\n";
text = text.substring(1);
textElement.attr({"text": wrappedText});
bb = textElement.getBBox();
i++;
if (i>200) break;
}
// remove "\n"
wrappedText = wrappedText.substring(0, wrappedText.length - 1);
if (text.length == 0) {
resultText += wrappedText;
break;
}
// return last char to text
text = wrappedText.substring(wrappedText.length-1) + text;
// remove last char from wrappedText
wrappedText = wrappedText.substring(0, wrappedText.length-1) + "\n";
textElement.attr({"text": wrappedText});
bb = textElement.getBBox();
//console.log(">> ", wrappedText, ", ", text);
resultText += wrappedText;
wrappedText = "\n";
j++;
if (j>20) break;
}
// remove element from paper
textElement.remove();
return resultText;
},
drawUserTask: function(name, x, y, width, height) {
this.g.setStart();
this._drawTask(name, x, y, width, height);
var img = this.g.image(USERTASK_IMAGE, x + ICON_PADDING, y + ICON_PADDING, ICON_SIZE, ICON_SIZE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "task");
},
drawScriptTask: function(name, x, y, width, height) {
this.g.setStart();
this._drawTask(name, x, y, width, height);
var img = this.g.image(SCRIPTTASK_IMAGE, x + ICON_PADDING, y + ICON_PADDING, ICON_SIZE, ICON_SIZE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "task");
},
drawServiceTask: function(name, x, y, width, height) {
this.g.setStart();
this._drawTask(name, x, y, width, height);
var img = this.g.image(SERVICETASK_IMAGE, x + ICON_PADDING, y + ICON_PADDING, ICON_SIZE, ICON_SIZE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "task");
},
drawReceiveTask: function(name, x, y, width, height) {
this.g.setStart();
this._drawTask(name, x, y, width, height);
var img = this.g.image(RECEIVETASK_IMAGE, x + 7, y + 7, ICON_SIZE, ICON_SIZE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "task");
},
drawSendTask: function(name, x, y, width, height) {
this.g.setStart();
this._drawTask(name, x, y, width, height);
var img = this.g.image(SENDTASK_IMAGE, x + 7, y + 7, ICON_SIZE, ICON_SIZE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "task");
},
drawManualTask: function(name, x, y, width, height) {
this.g.setStart();
this._drawTask(name, x, y, width, height);
var img = this.g.image(MANUALTASK_IMAGE, x + 7, y + 7, ICON_SIZE, ICON_SIZE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "task");
},
drawBusinessRuleTask: function(name, x, y, width, height) {
this.g.setStart();
this._drawTask(name, x, y, width, height);
var img = this.g.image(BUSINESS_RULE_TASK_IMAGE, x + 7, y + 7, ICON_SIZE, ICON_SIZE);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "task");
},
drawExpandedSubProcess: function(name, x, y, width, height, isTriggeredByEvent){
this.g.setStart();
// anti smoothing
if (this.strokeWidth%2 == 1)
x = Math.round(x) + .5, y = Math.round(y) + .5;
// shape
var rect = this.g.rect(x, y, width, height, EXPANDED_SUBPROCESS_CORNER_ROUND);
// Use different stroke (dashed)
if(isTriggeredByEvent) {
rect.attr(EVENT_SUBPROCESS_ATTRS);
} else {
rect.attr(EXPANDED_SUBPROCESS_ATTRS);
}
this.setContextToElement(rect);
var fontAttr = EXPANDED_SUBPROCESS_FONT;
// Include some padding
var paddingX = 10;
var paddingY = 5;
var availableTextSpace = width - paddingX*2;
var truncated = this.fitTextToWidth(name, availableTextSpace);
var realWidth = this.getStringWidth(truncated, fontAttr);
var realHeight = this.getStringHeight(truncated, fontAttr);
var textElement = this.g.text(x + width/2 - realWidth*0/2 + 0*paddingX, y + realHeight/2 + paddingY, truncated).attr(fontAttr);
var set = this.g.setFinish();
// TODO: Expanded Sub Process may has specific handlers
//this.addHandlers(set, x, y, width, height, "task");
},
drawCollapsedSubProcess: function(name, x, y, width, height, isTriggeredByEvent) {
this.g.setStart();
this._drawCollapsedTask(name, x, y, width, height, false);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "task");
},
drawCollapsedCallActivity: function(name, x, y, width, height) {
this.g.setStart();
this._drawCollapsedTask(name, x, y, width, height, true);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "task");
},
_drawCollapsedTask: function(name, x, y, width, height, thickBorder) {
// The collapsed marker is now visualized separately
this._drawTask(name, x, y, width, height, thickBorder);
},
drawCollapsedMarker: function(x, y, width, height){
// rectangle
var rectangleWidth = MARKER_WIDTH;
var rectangleHeight = MARKER_WIDTH;
// anti smoothing
if (this.strokeWidth%2 == 1)
y += .5;
var rect = this.g.rect(x + (width - rectangleWidth) / 2, y + height - rectangleHeight - 3, rectangleWidth, rectangleHeight);
// plus inside rectangle
var cx = rect.attr("x") + rect.attr("width")/2;
var cy = rect.attr("y") + rect.attr("height")/2;
var line = this.g.path(
"M" + cx + " " + (cy+2) + "L" + cx + " " + (cy-2) +
"M" + (cx-2) + " " + cy + "L" + (cx+2) + " " + cy
).attr({"stroke-width": this.strokeWidth});
},
drawActivityMarkers: function(x, y, width, height, multiInstanceSequential, multiInstanceParallel, collapsed){
if (collapsed) {
if (!multiInstanceSequential && !multiInstanceParallel) {
this.drawCollapsedMarker(x, y, width, height);
} else {
this.drawCollapsedMarker(x - MARKER_WIDTH / 2 - 2, y, width, height);
if (multiInstanceSequential) {
console.log("is collapsed and multiInstanceSequential");
this.drawMultiInstanceMarker(true, x + MARKER_WIDTH / 2 + 2, y, width, height);
} else if (multiInstanceParallel) {
console.log("is collapsed and multiInstanceParallel");
this.drawMultiInstanceMarker(false, x + MARKER_WIDTH / 2 + 2, y, width, height);
}
}
} else {
if (multiInstanceSequential) {
console.log("is multiInstanceSequential");
this.drawMultiInstanceMarker(true, x, y, width, height);
} else if (multiInstanceParallel) {
console.log("is multiInstanceParallel");
this.drawMultiInstanceMarker(false, x, y, width, height);
}
}
},
drawGateway: function(x, y, width, height) {
var rhombus = this.g.path( "M" + x + " " + (y + (height / 2)) +
"L" + (x + (width / 2)) + " " + (y + height) +
"L" + (x + width) + " " + (y + (height / 2)) +
"L" + (x + (width / 2)) + " " + y +
"z"
);
// white shaddow
this.drawShaddow(rhombus);
rhombus.attr("stroke-width", this.strokeWidth);
rhombus.attr("stroke", Color.SlateGrey);
rhombus.attr({fill: Color.white});
this.setContextToElement(rhombus);
return rhombus;
},
drawParallelGateway: function(x, y, width, height) {
this.g.setStart();
// rhombus
this.drawGateway(x, y, width, height);
// plus inside rhombus
var originalStroke = this.getStroke();
this.setStroke(GATEWAY_TYPE_STROKE);
var plus = this.g.path(
"M" + (x + 10) + " " + (y + height / 2) + "L" + (x + width - 10) + " " + (y + height / 2) + // horizontal
"M" + (x + width / 2) + " " + (y + height - 10) + "L" + (x + width / 2) + " " + (y + 10) // vertical
);
plus.attr({"stroke-width": this.getStroke(), "stroke": this.getPaint()});
this.setStroke(originalStroke);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "gateway");
},
drawExclusiveGateway: function(x, y, width, height) {
this.g.setStart();
// rhombus
var rhombus = this.drawGateway(x, y, width, height);
var quarterWidth = width / 4;
var quarterHeight = height / 4;
// X inside rhombus
var originalStroke = this.getStroke();
this.setStroke(GATEWAY_TYPE_STROKE);
var iks = this.g.path(
"M" + (x + quarterWidth + 3) + " " + (y + quarterHeight + 3) + "L" + (x + 3 * quarterWidth - 3) + " " + (y + 3 * quarterHeight - 3) +
"M" + (x + quarterWidth + 3) + " " + (y + 3 * quarterHeight - 3) + "L" + (x + 3 * quarterWidth - 3) + " " + (y + quarterHeight + 3)
);
iks.attr({"stroke-width": this.getStroke(), "stroke": this.getPaint()});
this.setStroke(originalStroke);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "gateway");
},
drawInclusiveGateway: function(x, y, width, height){
this.g.setStart();
// rhombus
this.drawGateway(x, y, width, height);
var diameter = width / 4;
// circle inside rhombus
var originalStroke = this.getStroke();
this.setStroke(GATEWAY_TYPE_STROKE);
var circle = this.g.ellipse(width/2 + x, height/2 + y, diameter, diameter);
circle.attr({"stroke-width": this.getStroke(), "stroke": this.getPaint()});
this.setStroke(originalStroke);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "gateway");
},
drawEventBasedGateway: function(x, y, width, height){
this.g.setStart();
// rhombus
this.drawGateway(x, y, width, height);
var diameter = width / 2;
// rombus inside rhombus
var originalStroke = this.getStroke();
this.setStroke(GATEWAY_TYPE_STROKE);
// draw GeneralPath (polygon)
var n=5;
var angle = 2*Math.PI/n;
var x1Points = [];
var y1Points = [];
for ( var index = 0; index < n; index++ ) {
var v = index*angle - Math.PI/2;
x1Points[index] = x + parseInt(Math.round(width/2)) + parseInt(Math.round((width/4)*Math.cos(v)));
y1Points[index] = y + parseInt(Math.round(height/2)) + parseInt(Math.round((height/4)*Math.sin(v)));
}
//g.drawPolygon(x1Points, y1Points, n);
var path = "";
for ( var index = 0; index < n; index++ ) {
if (index == 0)
path += "M";
else
path += "L";
path += x1Points[index] + "," + y1Points[index];
}
path += "z";
var polygone = this.g.path(path);
polygone.attr("stroke-width", this.strokeWidth);
polygone.attr("stroke", this.getPaint());
this.setStroke(originalStroke);
var set = this.g.setFinish();
this.addHandlers(set, x, y, width, height, "gateway");
},
/*
* drawMultiInstanceMarker
* drawHighLight
* highLightFlow
*/
drawMultiInstanceMarker: function(sequential, x, y, width, height) {
var rectangleWidth = MARKER_WIDTH;
var rectangleHeight = MARKER_WIDTH;
// anti smoothing
if (this.strokeWidth%2 == 1)
x += .5;//, y += .5;
var lineX = x + (width - rectangleWidth) / 2;
var lineY = y + height - rectangleHeight - 3;
var originalStroke = this.getStroke();
this.setStroke(MULTI_INSTANCE_STROKE);
if (sequential) {
var line = this.g.path(
"M" + lineX + " " + lineY + "L" + (lineX + rectangleWidth) + " " + lineY +
"M" + lineX + " " + (lineY + rectangleHeight / 2) + "L" + (lineX + rectangleWidth) + " " + (lineY + rectangleHeight / 2) +
"M" + lineX + " " + (lineY + rectangleHeight) + "L" + (lineX + rectangleWidth) + " " + (lineY + rectangleHeight)
).attr({"stroke-width": this.strokeWidth});
} else {
var line = this.g.path(
"M" + lineX + " " + lineY + "L" + lineX + " " + (lineY + rectangleHeight) +
"M" + (lineX + rectangleWidth / 2) + " " + lineY + "L" + (lineX + rectangleWidth / 2) + " " + (lineY + rectangleHeight) +
"M" + (lineX + rectangleWidth) + " " + lineY + "L" + (lineX + rectangleWidth) + " " + (lineY + rectangleHeight)
).attr({"stroke-width": this.strokeWidth});
}
this.setStroke(originalStroke);
},
drawHighLight: function(x, y, width, height){
var originalPaint = this.getPaint();
var originalStroke = this.getStroke();
this.setPaint(HIGHLIGHT_COLOR);
this.setStroke(THICK_TASK_BORDER_STROKE);
//var c = this.g.rect(x - width/2 - THICK_TASK_BORDER_STROKE, y - height/2 - THICK_TASK_BORDER_STROKE, width + THICK_TASK_BORDER_STROKE*2, height + THICK_TASK_BORDER_STROKE*2, 5);
var rect = this.g.rect(x - THICK_TASK_BORDER_STROKE, y - THICK_TASK_BORDER_STROKE, width + THICK_TASK_BORDER_STROKE*2, height + THICK_TASK_BORDER_STROKE*2, TASK_CORNER_ROUND);
rect.attr("stroke-width", this.strokeWidth);
rect.attr("stroke", this.getPaint());
this.setPaint(originalPaint);
this.setStroke(originalStroke);
},
highLightActivity: function(activityId){
var shape = this.g.getById(activityId);
if (!shape) {
console.error("Activity " + activityId + " not found");
return;
}
var contextObject = shape.data("contextObject");
if (contextObject)
console.log("--> highLightActivity: ["+contextObject.getProperty("type")+"], activityId: " + contextObject.getId());
else
console.log("--> highLightActivity: ", shape, shape.data("contextObject"));
shape.attr("stroke-width", THICK_TASK_BORDER_STROKE);
shape.attr("stroke", HIGHLIGHT_COLOR);
},
highLightFlow: function(flowId){
var shapeFlow = this.g.getById(flowId);
if (!shapeFlow) {
console.error("Flow " + flowId + " not found");
return;
}
var contextObject = shapeFlow.data("contextObject");
if (contextObject)
console.log("--> highLightFlow: ["+contextObject.id+"] " + contextObject.flow);
//console.log("--> highLightFlow: ", flow.flow, flow.data("set"));
var st = shapeFlow.data("set");
st.attr("stroke-width", SEQUENCEFLOW_HIGHLIGHT_STROKE);
st.attr("stroke", HIGHLIGHT_COLOR);
var withArrowHead = shapeFlow.data("withArrowHead");
if (withArrowHead)
st[1].attr("fill", HIGHLIGHT_COLOR);
st.forEach(function(el){
//console.log("---->", el);
//el.attr("")
});
},
_drawClock: function(cx, cy, width, height){
var circle = this.g.ellipse(cx, cy, 1, 1).attr({stroke:"none", fill: Color.get(232, 239, 241)});
//var c = this.g.ellipse(cx, cy, width, height).attr({stroke:"none", fill: Color.red});
//x = cx - width/2;
//y = cy - height/2;
var clock = this.g.path(
/* outer circle */ "M15.5,2.374 C8.251,2.375,2.376,8.251,2.374,15.5 C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374z" +
/* inner circle */ "M15.5,26.623 C8.909,26.615,4.385,22.09,4.375,15.5 C4.385,8.909,8.909,4.384,15.5,4.374c4.59,0.01,11.115,3.535,11.124,11.125C26.615,22.09,22.091,26.615,15.5,26.623z" +
/* 9 */ "M8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5z" +
/* 8 */ "M8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572z" +
/* 10 */ "M9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696z" +
/* 2 */ "M22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428z" +
/* 7 */ "M12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455z" +
/* 11 */ "M12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545z" +
/* 4 */ "M22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572z" +
/* 2 */ "M19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813z" +
/* 3 */ "M23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5z" +
/* arrows */ "M15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624z" +
/* 9 */ "M15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377z" +
/* 8 */ "M18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z" +
"");
clock.attr({fill: Color.black, stroke: "none"});
//clock.transform("t " + (cx-29.75/2) + " " + (cy-29.75/2));
//clock.transform("...s 0.85");
//clock.transform("...s " + .85 + " " + .85);
clock.transform("t " + (-2.374) + " " + (-2.374) );
clock.transform("...t -" + (15.5-2.374) + " -" + (15.5-2.374) );
clock.transform("...s " + 1*(width/35) + " " + 1*(height/35));
clock.transform("...T " + cx + " " + cy);
//clock.transform("t " + (cx-width/2) + " " + (cy-height/2));
//console.log(".getBBox(): ", clock.getBBox());
//console.log(".attr(): ", c.attrs);
circle.attr("rx", clock.getBBox().width/2);
circle.attr("ry", clock.getBBox().height/2);
//return circle
},
_drawPentagon: function(cx, cy, width, height, filled){
// draw GeneralPath (polygon)
var n=5;
var angle = 2*Math.PI/n;
var waypoints = [];
for ( var index = 0; index < n; index++ ) {
var v = index*angle - Math.PI/2;
var point = {};
point.x = -width*1.2/2 + parseInt(Math.round(width*1.2/2)) + parseInt(Math.round((width*1.2/4)*Math.cos(v)));
point.y = -height*1.2/2 + parseInt(Math.round(height*1.2/2)) + parseInt(Math.round((height*1.2/4)*Math.sin(v)));
waypoints[index] = point;
}
var polygone = new Polygone(waypoints, this.getStroke());
polygone.element = this.g.path(polygone.path);
if (filled)
polygone.element.attr("fill", Color.black);
else
polygone.element.attr("fill", Color.white);
polygone.element.transform("s " + 1*(width/35) + " " + 1*(height/35));
polygone.element.transform("...T " + cx + " " + cy);
},
//_drawMultilineText: function(text, x, y, boxWidth, boxHeight, textAnchor) {
_drawMultilineText: function(text, x, y, boxWidth, boxHeight, verticalAlign, horizontalAlign) {
if (!text || text == "")
return;
// Autostretch boxHeight if boxHeight is 0
if (boxHeight == 0)
verticalAlign = MULTILINE_VERTICAL_ALIGN_TOP;
//var TEXT_PADDING = 3;
var width = boxWidth;
if (boxHeight)
var height = boxHeight;
var layouts = [];
//var font = {font: "11px Arial", opacity: 1, "fill": LABEL_COLOR};
var font = this.getFont();
var measurer = new LineBreakMeasurer(this.g, x, y, text, font);
var lineHeight = measurer.rafaelTextObject.getBBox().height;
//console.log("text: ", text.replace(/\n/g, "?"));
if (height) {
var availableLinesCount = parseInt(height/lineHeight);
//console.log("availableLinesCount: " + availableLinesCount);
}
var i = 1;
while (measurer.getPosition() < measurer.text.getEndIndex()) {
var layout = measurer.nextLayout(width);
//console.log("LAYOUT: " + layout + ", getPosition: " + measurer.getPosition());
if (layout != null) {
// TODO: and check if measurer has next layout. If no then don't draw dots
if (!availableLinesCount || i < availableLinesCount) {
layouts.push(layout);
} else {
layouts.push(this.fitTextToWidth(layout + "...", boxWidth));
break;
}
}
i++;
};
//console.log(layouts);
measurer.rafaelTextObject.attr({"text": layouts.join("\n")});
if (horizontalAlign)
measurer.rafaelTextObject.attr({"text-anchor": horizontalAlign}); // end, middle, start
var bb = measurer.rafaelTextObject.getBBox();
// TODO: there is somethin wrong with wertical align. May be: measurer.rafaelTextObject.attr({"y": y + height/2 - bb.height/2})
measurer.rafaelTextObject.attr({"y": y + bb.height/2});
//var bb = measurer.rafaelTextObject.getBBox();
if (measurer.rafaelTextObject.attr("text-anchor") == MULTILINE_HORIZONTAL_ALIGN_MIDDLE )
measurer.rafaelTextObject.attr("x", x + boxWidth/2);
else if (measurer.rafaelTextObject.attr("text-anchor") == MULTILINE_HORIZONTAL_ALIGN_RIGHT )
measurer.rafaelTextObject.attr("x", x + boxWidth);
var boxStyle = {stroke: Color.LightSteelBlue2, "stroke-width": 1.0, "stroke-dasharray": "- "};
//var box = this.g.rect(x+.5, y + .5, width, height).attr(boxStyle);
var textAreaCX = x + boxWidth/2;
var height = boxHeight;
if (!height) height = bb.height;
var textAreaCY = y + height/2;
var dotLeftTop = this.g.ellipse(x, y, 3, 3).attr({"stroke-width": 0, fill: Color.LightSteelBlue, stroke: "none"}).hide();
var dotCenter = this.g.ellipse(textAreaCX, textAreaCY, 3, 3).attr({fill: Color.LightSteelBlue2, stroke: "none"}).hide();
/*
// real bbox
var bb = measurer.rafaelTextObject.getBBox();
var rect = paper.rect(bb.x+.5, bb.y + .5, bb.width, bb.height).attr({"stroke-width": 1});
*/
var rect = this.g.rect(x, y, boxWidth, height).attr({"stroke-width": 1}).attr(boxStyle).hide();
var debugSet = this.g.set();
debugSet.push(dotLeftTop, dotCenter, rect);
//debugSet.show();
},
drawTextAnnotation: function(text, x, y, width, height){
var lineLength = 18;
var path = [];
path.push(["M", x + lineLength, y]);
path.push(["L", x, y]);
path.push(["L", x, y + height]);
path.push(["L", x + lineLength, y + height]);
path.push(["L", x + lineLength, y + height -1]);
path.push(["L", x + 1, y + height -1]);
path.push(["L", x + 1, y + 1]);
path.push(["L", x + lineLength, y + 1]);
path.push(["z"]);
var textAreaLines = this.g.path(path);
var boxWidth = width - (2 * ANNOTATION_TEXT_PADDING);
var boxHeight = height - (2 * ANNOTATION_TEXT_PADDING);
var boxX = x + width/2 - boxWidth/2;
var boxY = y + height/2 - boxHeight/2;
// for debug
var rectStyle = {stroke: Color(112, 146, 190), "stroke-width": 1.0, "stroke-dasharray": "- "};
var r = this.g.rect(boxX, boxY, boxWidth, boxHeight).attr(rectStyle);
//
this.drawAnnotationText(text, boxX, boxY, boxWidth, boxHeight);
},
drawLabel111111111: function(text, x, y, width, height, labelAttrs){
var debug = false;
// text
if (text != null && text != undefined && text != "") {
var attr = LABEL_FONT;
//console.log("x", x, "y", y, "width", width, "height", height );
wrappedText = text;
if (labelAttrs && labelAttrs.wrapWidth) {
wrappedText = this.wrapTextToWidth(wrappedText, labelAttrs.wrapWidth);
}
var realWidth = this.getStringWidth(wrappedText, attr);
var realHeight = this.getStringHeight(wrappedText, attr);
var textAreaCX = x + width/2;
var textAreaCY = y + 3 + height + this.getStringHeight(wrappedText, attr)/2;
var textX = textAreaCX;
var textY = textAreaCY;
var textAttrs = {};
if (labelAttrs && labelAttrs.align) {
switch (labelAttrs.align) {
case "left":
textAttrs["text-anchor"] = "start";
textX = textX - realWidth/2;
break;
case "center":
textAttrs["text-anchor"] = "middle";
break;
case "right":
textAttrs["text-anchor"] = "end";
textX = textX + realWidth/2;
break;
}
}
if (labelAttrs && labelAttrs.wrapWidth) {
if (true) {
// Draw frameborder
var textAreaStyle = {stroke: Color.LightSteelBlue2, "stroke-width": 1.0, "stroke-dasharray": "- "};
var textAreaX = textAreaCX - realWidth/2;
var textAreaY = textAreaCY+.5 - realHeight/2;
var textArea = this.g.rect(textAreaX, textAreaY, realWidth, realHeight).attr(textAreaStyle);
var textAreaLines = this.g.path("M" + textAreaX + " " + textAreaY + "L" + (textAreaX+realWidth) + " " + (textAreaY+realHeight) + "M" + + (textAreaX+realWidth) + " " + textAreaY + "L" + textAreaX + " " + (textAreaY+realHeight));
textAreaLines.attr(textAreaStyle);
this.g.ellipse(textAreaCX, textAreaCY, 3, 3).attr({fill: Color.LightSteelBlue2, stroke: "none"});
}
}
var label = this.g.text(textX, textY, wrappedText).attr(attr).attr(textAttrs);
//label.id = Raphael.createUUID();
//console.log("label ", label.id, ", ", wrappedText);
if (this.fontSmoothing) {
label.attr({stroke: LABEL_COLOR, "stroke-width":.4});
}
// debug
if (debug) {
var imageAreaStyle = {stroke: Color.grey61, "stroke-width": 1.0, "stroke-dasharray": "- "};
var imageArea = this.g.rect(x+.5, y+.5, width, height).attr(imageAreaStyle);
var imageAreaLines = this.g.path("M" + x + " " + y + "L" + (x+width) + " " + (y+height) + "M" + + (x+width) + " " + y + "L" + x + " " + (y+height));
imageAreaLines.attr(imageAreaStyle);
var dotStyle = {fill: Color.Coral, stroke: "none"};
this.g.ellipse(x, y, 3, 3).attr(dotStyle);
this.g.ellipse(x+width, y, 2, 2).attr(dotStyle);
this.g.ellipse(x+width, y+height, 2, 2).attr(dotStyle);
this.g.ellipse(x, y+height, 2, 2).attr(dotStyle);
}
return label;
}
},
vvoid: function(){}
};
... ...
/**
* Class to generate an image based the diagram interchange information in a
* BPMN 2.0 process.
*
* @author (Javascript) Dmitry Farafonov
*/
var ProcessDiagramGenerator = {
options: {},
processDiagramCanvas: [],
activityDrawInstructions:{},
processDiagrams: {},
diagramBreadCrumbs: null,
init: function(){
// start event
this.activityDrawInstructions["startEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawNoneStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// start timer event
this.activityDrawInstructions["startTimerEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawTimerStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name"));
};
// start event
this.activityDrawInstructions["messageStartEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawMessageStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name"));
};
// start signal event
this.activityDrawInstructions["startSignalEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawSignalStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name"));
};
// start multiple event
this.activityDrawInstructions["startMultipleEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawMultipleStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name"));
};
// signal catch
this.activityDrawInstructions["intermediateSignalCatch"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// message catch
this.activityDrawInstructions["intermediateMessageCatch"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingMessageEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// multiple catch
this.activityDrawInstructions["intermediateMultipleCatch"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingMultipleEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// signal throw
this.activityDrawInstructions["intermediateSignalThrow"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawThrowingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// message throw
this.activityDrawInstructions["intermediateMessageThrow"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawThrowingMessageEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// multiple throw
this.activityDrawInstructions["intermediateMultipleThrow"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawThrowingMultipleEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// none throw
this.activityDrawInstructions["intermediateThrowEvent"] = function() {
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawThrowingNoneEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// end event
this.activityDrawInstructions["endEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawNoneEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// error end event
this.activityDrawInstructions["errorEndEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawErrorEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// message end event
this.activityDrawInstructions["messageEndEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawMessageEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// signal end event
this.activityDrawInstructions["signalEndEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawSignalEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// multiple end event
this.activityDrawInstructions["multipleEndEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawMultipleEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// terminate end event
this.activityDrawInstructions["terminateEndEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawTerminateEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// error start event
this.activityDrawInstructions["errorStartEvent"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawErrorStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// task
this.activityDrawInstructions["task"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
// TODO:
//console.error("task is not implemented yet");
/*
var activityImpl = this;
processDiagramCanvas.drawTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), thickBorder);
*/
};
// user task
this.activityDrawInstructions["userTask"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawUserTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// script task
this.activityDrawInstructions["scriptTask"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawScriptTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// service task
this.activityDrawInstructions["serviceTask"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawServiceTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// receive task
this.activityDrawInstructions["receiveTask"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawReceiveTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// send task
this.activityDrawInstructions["sendTask"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawSendTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// manual task
this.activityDrawInstructions["manualTask"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawManualTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// businessRuleTask task
this.activityDrawInstructions["businessRuleTask"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawBusinessRuleTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// exclusive gateway
this.activityDrawInstructions["exclusiveGateway"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawExclusiveGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// inclusive gateway
this.activityDrawInstructions["inclusiveGateway"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawInclusiveGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// parallel gateway
this.activityDrawInstructions["parallelGateway"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawParallelGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// eventBasedGateway
this.activityDrawInstructions["eventBasedGateway"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawEventBasedGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
// Boundary timer
this.activityDrawInstructions["boundaryTimer"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingTimerEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// Boundary catch error
this.activityDrawInstructions["boundaryError"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingErrorEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// Boundary signal event
this.activityDrawInstructions["boundarySignal"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// Boundary message event
this.activityDrawInstructions["boundaryMessage"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingMessageEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// timer catch event
this.activityDrawInstructions["intermediateTimer"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
var isInterrupting = null;
processDiagramCanvas.drawCatchingTimerEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name"));
};
// subprocess
this.activityDrawInstructions["subProcess"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
// TODO:
processDiagramCanvas.setConextObject(activityImpl);
var isExpanded = activityImpl.getProperty("isExpanded");
var isTriggeredByEvent = activityImpl.getProperty("triggeredByEvent");
if(isTriggeredByEvent == undefined) {
isTriggeredByEvent = true;
}
// TODO: check why isTriggeredByEvent = true when undefined
isTriggeredByEvent = false;
if (isExpanded != undefined && isExpanded == false) {
processDiagramCanvas.drawCollapsedSubProcess(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(),
activityImpl.getWidth(), activityImpl.getHeight(), isTriggeredByEvent);
} else {
processDiagramCanvas.drawExpandedSubProcess(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(),
activityImpl.getWidth(), activityImpl.getHeight(), isTriggeredByEvent);
}
//console.error("subProcess is not implemented yet");
};
// call activity
this.activityDrawInstructions["callActivity"] = function(){
var activityImpl = this.activity;
var processDiagramCanvas = this.processDiagramCanvas;
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawCollapsedCallActivity(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
$(document).ready(function(){
// Protect right click on SVG elements (and on canvas too)
document.body.oncontextmenu = function(event) {
if (window.event.srcElement.tagName == "shape" || window.event.srcElement.tagName == "DIV" && window.event.srcElement.parentElement.className == "diagram") {
// IE DIAGRAM CANVAS OR SHAPE DETECTED!
return false;
}
return (!Object.isSVGElement(window.event.srcElement));
};
});
},
getActivitiLabel:function(activityImpl){
/*
TODO: Label object should be in activityImpl and looks like:
{
x: 250,
y: 250,
width: 80,
height: 30
}
And then:
if (!activityImpl.label)
return null;
var label = activityImpl.label;
label.text = activityImpl.name;
return label;
*/
// But now default label for all events is:
return {
text: activityImpl.getProperty("name"),
x: activityImpl.getX() + .5 + activityImpl.getWidth()/2,
y: activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING,
width: 100,
height: 0
};
},
generateDiagram: function(processDefinitionDiagramLayout){
// Init canvas
var processDefinitionId = processDefinitionDiagramLayout.processDefinition.id;
//console.log("Init canvas ", processDefinitionId);
if (this.getProcessDiagram(processDefinitionId) != undefined) {
// TODO: may be reset canvas if exists.. Or just show
//console.log("ProcessDiagram '" + processDefinitionId + "' is already generated. Just show it.");
return;
}
var processDiagram = this.initProcessDiagramCanvas(processDefinitionDiagramLayout);
var processDiagramCanvas = processDiagram.diagramCanvas;
// Draw pool shape, if process is participant in collaboration
if(processDefinitionDiagramLayout.participantProcess != undefined) {
//console.log("Draw pool shape");
var pProc = processDefinitionDiagramLayout.participantProcess;
processDiagramCanvas.drawPoolOrLane(pProc.x, pProc.y, pProc.width, pProc.height, pProc.name);
}
var laneSets = processDefinitionDiagramLayout.laneSets;
var activities = processDefinitionDiagramLayout.activities;
var sequenceFlows = processDefinitionDiagramLayout.sequenceFlows;
pb1.set('value', 0);
var cnt = 0;
if (laneSets)
for(var i in laneSets) {
cnt += laneSets[i].lanes.length;
}
if (activities)
cnt += activities.length;
if (sequenceFlows)
cnt += sequenceFlows.length;
var step = (cnt>0)? 100/cnt : 0;
var progress = 0;
//console.log("progress bar step: ", step);
var task1 = new $.AsyncQueue();
// Draw lanes
task1.add(function (task1) {
if (!laneSets) laneSets = [];
//console.log("> draw lane sets, count:", laneSets.length)
});
for(var i in laneSets) {
var laneSet = laneSets[i];
//laneSet.id, laneSet.name
task1.add(laneSet.lanes,function (task1, lane) {
progress += step;
pb1.set('value', parseInt(progress));
//console.log("--> laneId: " + lane.name + ", name: " + lane.name);
processDiagramCanvas.drawPoolOrLane(lane.x, lane.y, lane.width, lane.height, lane.name);
});
}
// Draw activities
task1.add(function (task1) {
if (!activities) activities = [];
//console.log("> draw activities, count:", activities.length)
});
var activitiesLength = activities.length;
task1.add(activities,function (task1, activityJson) {
var activity = new ActivityImpl(activityJson);
activitiesLength --;
progress += step;
pb1.set('value', parseInt(progress));
//console.log(activitiesLength, "--> activityId: " + activity.getId() + ", name: " + activity.getProperty("name"));
ProcessDiagramGenerator.drawActivity(processDiagramCanvas, activity);
});
// Draw sequence-flows
task1.add(function (task1) {
if (!sequenceFlows) sequenceFlows = [];
//console.log("> draw sequence flows, count:", sequenceFlows.length)
});
var flowsLength = sequenceFlows.length;
task1.add(sequenceFlows,function (task1, flow) {
var waypoints = [];
for(var j in flow.xPointArray) {
waypoints[j] = {x: flow.xPointArray[j], y: flow.yPointArray[j]};
}
var isDefault = flow.isDefault;
var isConditional = flow.isConditional;
var isHighLighted = flow.isHighLighted;
// TODO: add source and destination for sequence flows in REST
// parse for test
var f = flow.flow;
var matches = f.match(/\((.*)\)--.*-->\((.*)\)/);
var sourceActivityId, destinationActivityId;
if (matches != null) {
sourceActivityId = matches[1];
destinationActivityId = matches[2];
}
flow.sourceActivityId = sourceActivityId;
flow.destinationActivityId = destinationActivityId;
//
flowsLength--;
progress += step;
pb1.set('value', parseInt(progress));
//console.log(flowsLength, "--> flow: " + flow.flow);
processDiagramCanvas.setConextObject(flow);
processDiagramCanvas.drawSequenceflow(waypoints, isConditional, isDefault, isHighLighted);
});
task1.onComplete(function(){
if (progress<100)
pb1.set('value', 100);
//console.log("COMPLETE!!!");
//console.timeEnd('generateDiagram');
});
task1.run();
},
getProcessDiagram: function (processDefinitionId) {
return this.processDiagrams[processDefinitionId];
},
initProcessDiagramCanvas: function (processDefinitionDiagramLayout) {
var minX = 0;
var maxX = 0;
var minY = 0;
var maxY = 0;
if(processDefinitionDiagramLayout.participantProcess != undefined) {
var pProc = processDefinitionDiagramLayout.participantProcess;
minX = pProc.x;
maxX = pProc.x + pProc.width;
minY = pProc.y;
maxY = pProc.y + pProc.height;
}
var activities = processDefinitionDiagramLayout.activities;
for(var i in activities) {
var activityJson = activities[i];
var activity = new ActivityImpl(activityJson);
// width
if (activity.getX() + activity.getWidth() > maxX) {
maxX = activity.getX() + activity.getWidth();
}
if (activity.getX() < minX) {
minX = activity.getX();
}
// height
if (activity.getY() + activity.getHeight() > maxY) {
maxY = activity.getY() + activity.getHeight();
}
if (activity.getY() < minY) {
minY = activity.getY();
}
}
var sequenceFlows = processDefinitionDiagramLayout.sequenceFlows;
for(var i in sequenceFlows) {
var flow = sequenceFlows[i];
var waypoints = [];
for(var j in flow.xPointArray) {
waypoints[j] = {x: flow.xPointArray[j], y: flow.yPointArray[j]};
// width
if (waypoints[j].x > maxX) {
maxX = waypoints[j].x;
}
if (waypoints[j].x < minX) {
minX = waypoints[j].x;
}
// height
if (waypoints[j].y > maxY) {
maxY = waypoints[j].y;
}
if (waypoints[j].y < minY) {
minY = waypoints[j].y;
}
}
}
var laneSets = processDefinitionDiagramLayout.laneSets;
for(var i in laneSets) {
var laneSet = laneSets[i];
//laneSet.id, laneSet.name
for(var j in laneSet.lanes) {
var lane = laneSet.lanes[j];
// width
if (lane.x + lane.width > maxX) {
maxX = lane.x + lane.width;
}
if (lane.x < minX) {
minX = lane.x;
}
// height
if (lane.y + lane.height > maxY) {
maxY = lane.y + lane.height;
}
if (lane.y < minY) {
minY = lane.y;
}
}
}
var diagramCanvas = new ProcessDiagramCanvas();
if (diagramCanvas) {
// create div in diagramHolder
var diagramHolder = document.getElementById(this.options.diagramHolderId);
if (!diagramHolder)
throw {msg: "Diagram holder not found", error: "diagramHolderNotFound"};
var div = document.createElement("DIV");
div.id = processDefinitionDiagramLayout.processDefinition.id;
div.className = "diagram";
diagramHolder.appendChild(div);
diagramCanvas.init(maxX + 20, maxY + 20, processDefinitionDiagramLayout.processDefinition.id);
this.processDiagrams[processDefinitionDiagramLayout.processDefinition.id] = {
processDefinitionDiagramLayout: processDefinitionDiagramLayout,
diagramCanvas: diagramCanvas
};
}
return this.getProcessDiagram(processDefinitionDiagramLayout.processDefinition.id);
//return new DefaultProcessDiagramCanvas(maxX + 10, maxY + 10, minX, minY);
},
drawActivity: function(processDiagramCanvas, activity, highLightedActivities) {
var type = activity.getProperty("type");
var drawInstruction = this.activityDrawInstructions[type];
if (drawInstruction != null) {
drawInstruction.apply({processDiagramCanvas:processDiagramCanvas, activity:activity});
} else {
//console.error("no drawInstruction for " + type + ": ", activity);
}
// Actually draw the markers
if (activity.getProperty("multiInstance") != undefined || activity.getProperty("collapsed") != undefined) {
//console.log(activity.getProperty("name"), activity.properties);
var multiInstanceSequential = (activity.getProperty("multiInstance") == "sequential");
var multiInstanceParallel = (activity.getProperty("multiInstance") == "parrallel");
var collapsed = activity.getProperty("collapsed");
processDiagramCanvas.drawActivityMarkers(activity.getX(), activity.getY(), activity.getWidth(), activity.getHeight(),
multiInstanceSequential, multiInstanceParallel, collapsed);
}
/*
processDiagramCanvas.drawActivityMarkers(activity.getX(), activity.getY(), activity.getWidth(), activity.getHeight(), multiInstanceSequential,
multiInstanceParallel, collapsed);
*/
// TODO: Draw highlighted activities if they are present
},
setHighLights: function(highLights){
if (highLights.processDefinitionId == undefined) {
//console.error("Process instance " + highLights.processInstanceId + " doesn't exist");
return;
}
var processDiagram = this.getProcessDiagram(highLights.processDefinitionId);
if (processDiagram == undefined) {
//console.error("Process diagram " + highLights.processDefinitionId + " not found");
return;
}
var processDiagramCanvas = processDiagram.diagramCanvas;
// TODO: remove highLightes from all activities before set new highLight
for (var i in highLights.activities) {
var activityId = highLights.activities[i];
processDiagramCanvas.highLightActivity(activityId);
}
// TODO: remove highLightes from all flows before set new highLight
for (var i in highLights.flows) {
var flowId = highLights.flows[i];
var object = processDiagramCanvas.g.getById(flowId);
var flow = object.data("contextObject");
flow.isHighLighted = true;
processDiagramCanvas.highLightFlow(flowId);
}
},
drawHighLights: function(processInstanceId) {
// Load highLights for the processInstanceId
/*
var url = Lang.sub(this.options.processInstanceHighLightsUrl, {processInstanceId: processInstanceId});
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
cache: false,
async: true,
}).done(function(data) {
var highLights = data;
if (!highLights) {
console.log("highLights not found");
return;
}
console.log("highLights[" + highLights.processDefinitionId + "][" + processInstanceId + "]: ", highLights);
ProcessDiagramGenerator.setHighLights(highLights);
}).fail(function(jqXHR, textStatus){
console.log('Get HighLights['+processDefinitionId+'] failure: ', textStatus, jqXHR);
});
*/
// 解决无流程实例的时候抛出异常问题。
var url = Lang.sub(ActivitiRest.options.processInstanceUrl, {processInstanceId: processInstanceId});
var _drawHighLights = this._drawHighLights;
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
cache: false,
async: true,
}).done(function(data) {
ActivitiRest.getHighLights(processInstanceId, _drawHighLights);
}).fail(function(jqXHR, textStatus){
console.log('Get HighLights['+processInstanceId+'] failure: ', textStatus, jqXHR);
});
//ActivitiRest.getHighLights(processInstanceId, this._drawHighLights);
},
_drawHighLights: function() {
var highLights = this.highLights;
ProcessDiagramGenerator.setHighLights(highLights);
},
// Load processDefinition
drawDiagram: function(processDefinitionId) {
// Hide all diagrams
var diagrams = $("#" + this.options.diagramHolderId + " div.diagram");
diagrams.addClass("hidden");
// If processDefinitionId doesn't contain ":" then it's a "processDefinitionKey", not an id.
// Get process definition by key
if (processDefinitionId.indexOf(":") < 0) {
ActivitiRest.getProcessDefinitionByKey(processDefinitionId, this._drawDiagram);
} else {
this._drawDiagram.apply({processDefinitionId: processDefinitionId});
}
},
_drawDiagram: function() {
var processDefinitionId = this.processDefinitionId;
ProcessDiagramGenerator.addBreadCrumbsItem(processDefinitionId);
// Check if processDefinition is already loaded and rendered
var processDiagram = ProcessDiagramGenerator.getProcessDiagram(processDefinitionId);
if (processDiagram != undefined && processDiagram != null) {
//console.log("Process diagram " + processDefinitionId + " is already loaded");
//return;
var diagram = document.getElementById(processDefinitionId);
$(diagram).removeClass("hidden");
// Regenerate image
var processDefinitionDiagramLayout = processDiagram.processDefinitionDiagramLayout;
ProcessDiagramGenerator.generateDiagram(processDefinitionDiagramLayout);
return;
}
//console.time('loadDiagram');
// Load processDefinition
ActivitiRest.getProcessDefinition(processDefinitionId, ProcessDiagramGenerator._generateDiagram);
},
_generateDiagram: function() {
var processDefinitionDiagramLayout = this.processDefinitionDiagramLayout;
//console.log("process-definition-diagram-layout["+processDefinitionDiagramLayout.processDefinition.id+"]: ", processDefinitionDiagramLayout);
//console.timeEnd('loadDiagram');
//console.time('generateDiagram');
pb1.set('value', 0);
ProcessDiagramGenerator.generateDiagram(processDefinitionDiagramLayout);
},
getProcessDefinitionByKey: function(processDefinitionKey) {
var url = Lang.sub(this.options.processDefinitionByKeyUrl, {processDefinitionKey: processDefinitionKey});
var processDefinition;
$.ajax({
url: url,
type: 'POST',
dataType: 'json',
cache: false,
async: false
}).done(function(data) {
//console.log("ajax returned data");
//console.log("ajax returned data:", data);
processDefinition = data;
if (!processDefinition) {
//console.error("Process definition '" + processDefinitionKey + "' not found");
}
}).fail(function(jqXHR, textStatus){
//console.error('Get diagram layout['+processDefinitionKey+'] failure: ', textStatus, jqXHR);
});
if (processDefinition) {
//console.log("Get process definition by key '" + processDefinitionKey + "': ", processDefinition.id);
return processDefinition;
} else {
return null;
}
},
addBreadCrumbsItem: function(processDefinitionId){
var TPL_UL_CONTAINER = '<ul></ul>',
TPL_LI_CONTAINER = '<li id="{id}", processDefinitionId="{processDefinitionId}"><span>{name}</span></li>';
if (!this.diagramBreadCrumbs)
this.diagramBreadCrumbs = $("#" + this.options.diagramBreadCrumbsId);
if (!this.diagramBreadCrumbs) return;
var ul = this.diagramBreadCrumbs.find("ul");
//console.log("ul: ", ul);
if (ul.size() == 0) {
ul = $(TPL_UL_CONTAINER);
this.diagramBreadCrumbs.append(ul);
}
var liListOld = ul.find("li");
//console.warn("liListOld", liListOld);
// TODO: if there is any items after current then remove that before adding new item (m.b. it is a duplicate)
var currentBreadCrumbsItemId = this.currentBreadCrumbsItemId;
found = false;
liListOld.each(
function(index, item) {
//console.warn("item:", $(this));
if (!found && currentBreadCrumbsItemId == $(this).attr("id")) {
found = true;
return;
}
if (found) {
//console.warn("remove ", $(this).attr("id"));
$(this).remove();
}
}
);
var liListNew = ul.find("li");
//console.log("liListNew size: ", liListNew.size());
var values = {
id: 'breadCrumbsItem_' + liListNew.size(),
processDefinitionId: processDefinitionId,
name: processDefinitionId
};
var tpl = Lang.sub(TPL_LI_CONTAINER, values);
//console.log("tpl: ", tpl);
ul.append(tpl);
var li = ul.find("#" + values.id);
//console.warn("li:", li);
$('#' + values.id).on('click', this._breadCrumbsItemClick);
ul.find("li").removeClass("selected");
li.attr("num", liListNew.size());
li.addClass("selected");
this.currentBreadCrumbsItemId = li.attr("id");
},
_breadCrumbsItemClick: function(){
var li = $(this),
id = li.attr("id"),
processDefinitionId = li.attr("processDefinitionId");
//console.warn("_breadCrumbsItemClick: ", id, ", processDefinitionId: ", processDefinitionId);
var ul = ProcessDiagramGenerator.diagramBreadCrumbs.one("ul");
ul.find("li").removeClass("selected");
li.addClass("selected");
ProcessDiagramGenerator.currentBreadCrumbsItemId = li.attr("id");
// Hide all diagrams
var diagrams = $("#"+ProcessDiagramGenerator.options.diagramHolderId+" div.diagram");
diagrams.addClass("hidden");
var processDiagram = ProcessDiagramGenerator.getProcessDiagram(processDefinitionId);
var diagram = document.getElementById(processDefinitionId);
if (!diagram) return;
$(diagram).removeClass("hidden");
// Regenerate image
var processDefinitionDiagramLayout = processDiagram.processDefinitionDiagramLayout;
ProcessDiagramGenerator.generateDiagram(processDefinitionDiagramLayout);
},
showFlowInfo: function(flow){
var diagramInfo = $("#" + this.options.diagramInfoId);
if (!diagramInfo) return;
var values = {
flow: flow.flow,
isDefault: (flow.isDefault)? "true":"",
isConditional: (flow.isConditional)? "true":"",
isHighLighted: (flow.isHighLighted)? "true":"",
sourceActivityId: flow.sourceActivityId,
destinationActivityId: flow.destinationActivityId
};
var TPL_FLOW_INFO = '<div>{flow}</div>'
+ '<div><b>sourceActivityId</b>: {sourceActivityId}</div>'
+ '<div><b>destinationActivityId</b>: {destinationActivityId}</div>'
+ '<div><b>isDefault</b>: {isDefault}</div>'
+ '<div><b>isConditional</b>: {isConditional}</div>'
+ '<div><b>isHighLighted</b>: {isHighLighted}</div>';
var tpl = Lang.sub(TPL_FLOW_INFO, values);
//console.log("info: ", tpl);
diagramInfo.html(tpl);
},
showActivityInfo: function(activity){
var diagramInfo = $("#" + this.options.diagramInfoId);
if (!diagramInfo) return;
var values = {
activityId: activity.getId(),
name: activity.getProperty("name"),
type: activity.getProperty("type")
};
var TPL_ACTIVITY_INFO = ''
+ '<div><b>activityId</b>: {activityId}</div>'
+ '<div><b>name</b>: {name}</div>'
+ '<div><b>type</b>: {type}</div>';
var TPL_CALLACTIVITY_INFO = ''
+ '<div><b>collapsed</b>: {collapsed}</div>'
+ '<div><b>processDefinitonKey</b>: {processDefinitonKey}</div>';
var template = TPL_ACTIVITY_INFO;
if (activity.getProperty("type") == "callActivity") {
values.collapsed = activity.getProperty("collapsed");
values.processDefinitonKey = activity.getProperty("processDefinitonKey");
template += TPL_CALLACTIVITY_INFO;
} else if (activity.getProperty("type") == "callActivity") {
}
var tpl = Lang.sub(template, values);
//console.log("info: ", tpl);
diagramInfo.html(tpl);
},
hideInfo: function(){
var diagramInfo = $("#" + this.options.diagramInfoId);
if (!diagramInfo) return;
diagramInfo.html("");
},
vvoid: function(){}
};
var Lang = {
SUBREGEX: /\{\s*([^\|\}]+?)\s*(?:\|([^\}]*))?\s*\}/g,
UNDEFINED: 'undefined',
isUndefined: function(o) {
return typeof o === Lang.UNDEFINED;
},
sub: function(s, o) {
return ((s.replace) ? s.replace(Lang.SUBREGEX, function(match, key) {
return (!Lang.isUndefined(o[key])) ? o[key] : match;
}) : s);
}
};
if (Lang.isUndefined(console)) {
console = { log: function() {}, warn: function() {}, error: function() {}};
}
ProcessDiagramGenerator.init();
\ No newline at end of file
... ...
/*
* This file is part of the jquery plugin "asyncQueue".
*
* (c) Sebastien Roch <roch.sebastien@gmail.com>
* @author (parallel) Dmitry Farafonov
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
(function($){
$.AsyncQueue = function() {
var that = this,
queue = [],
completeFunc,
failureFunc,
paused = false,
lastCallbackData,
_run,
_complete,
inQueue = 0,
defaultTimeOut = 10;
_run = function() {
var f = queue.shift();
if (f) {
inQueue++;
setTimeout(function(){
f.fn.apply(that, [that]);
if (!f.isParallel)
if (paused === false) {
_run();
}
inQueue --;
if (inQueue == 0 && queue.length == 0)
_complete();
}, f.timeOut);
if (f.isParallel)
if (paused === false) {
_run();
}
}
};
_complete = function(){
if (completeFunc)
completeFunc.apply(that, [that]);
};
this.onComplete = function(func) {
completeFunc = func;
};
this.onFailure = function(func) {
failureFunc = func;
};
this.add = function(func) {
// TODO: add callback for queue[i] complete
var obj = arguments[0];
if (obj && Object.prototype.toString.call(obj) === "[object Array]") {
var fn = arguments[1];
var timeOut = (typeof(arguments[2]) != "undefined")? arguments[2] : defaultTimeOut;
if (typeof(fn) == "function") {
for(var i = 0; i < obj.length; i++) {
var f = function(objx){
queue.push({isParallel: true, fn: function(){fn.apply(that, [that, objx]);}, timeOut: timeOut});
}(obj[i])
}
}
} else {
var fn = arguments[0];
var timeOut = (typeof(arguments[1]) != "undefined")? arguments[2] : defaultTimeOut;
queue.push({isParallel: false, fn: func, timeOut: timeOut});
}
return this;
};
this.addParallel = function(func, timeOut) {
// TODO: add callback for queue[i] complete
queue.push({isParallel: true, fn: func, timeOut: timeOut});
return this;
};
this.storeData = function(dataObject) {
lastCallbackData = dataObject;
return this;
};
this.lastCallbackData = function () {
return lastCallbackData;
};
this.run = function() {
paused = false;
_run();
};
this.pause = function () {
paused = true;
return this;
};
this.failure = function() {
paused = true;
if (failureFunc) {
var args = [that];
for(i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
failureFunc.apply(that, args);
}
};
this.size = function(){
return queue.length;
};
return this;
}
})(jQuery);
... ...
/*
* @ Dmitry Farafonov
*/
(function($){
$.ProgressBar = function(options) {
this.element = $(options.boundingBox);
if (options.on && options.on.complete){
this.onComplete = options.on.complete;
}
if (options.on && options.on.valueChange){
this.onValueChange = options.on.valueChange;
}
this._create();
if (options.label)
this.set("label", options.label);
if (options.value)
this.value(options.value);
if (options.max)
this.set("max", options.max);
};
$.ProgressBar.prototype = {
options: {
value: 0,
max: 100
},
min: 0,
_create: function() {
this.element
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.attr({
role: "progressbar",
"aria-valuemin": this.min,
"aria-valuemax": this.options.max,
"aria-valuenow": this._value()
});
this.valueDiv = $( "<div class='ui-progressbar-label'></div>" )
.appendTo( this.element );
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
.appendTo( this.element );
this.oldValue = this._value();
this._refreshValue();
},
_destroy: function() {
this.element
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.removeAttr( "role" )
.removeAttr( "aria-valuemin" )
.removeAttr( "aria-valuemax" )
.removeAttr( "aria-valuenow" );
this.valueDiv.remove();
},
value: function( newValue ) {
if ( newValue === undefined ) {
return this._value();
}
this._setOption( "value", newValue );
return this;
},
_setOption: function( key, value ) {
if ( key === "value" ) {
//var oldVal = this.options.value;
this.options.value = value;
this._refreshValue();
if (this.onValueChange)
this.onValueChange.apply(this, [{oldVal: this.oldValue, newVal: value}]);
if ( this._value() === this.options.max ) {
//this._trigger( "complete" );
if (this.onComplete)
this.onComplete.apply(this);
}
} else if (key === "label") {
$(this.element).find(".ui-progressbar-label").html(value);
} else if (key === "max") {
this.options.max = value;
}
//this._super( key, value );
},
_value: function() {
var val = this.options.value;
// normalize invalid value
if ( typeof val !== "number" ) {
val = 0;
}
return Math.min( this.options.max, Math.max( this.min, val ) );
},
_percentage: function() {
return 100 * this._value() / this.options.max;
},
_refreshValue: function() {
var value = this.value(),
percentage = this._percentage();
if ( this.oldValue !== value ) {
this.oldValue = value;
//this._trigger( "change" );
}
this.valueDiv
.toggle( value > this.min )
.toggleClass( "ui-corner-right", value === this.options.max )
.width( percentage.toFixed(0) + "%" );
this.element.attr( "aria-valuenow", value );
//$(this.element).find(".ui-progressbar-label").html(value + "%");
},
set: function(key, value){
this._setOption(key, value);
}
};
})( jQuery );
\ No newline at end of file
... ...
if (typeof(console) == "undefined") {
var console = {
info: function(){},
warn: function(){},
error: function(){},
log: function(){},
time: function(){},
timeEnd: function(){}
};
}
if(!Array.isArray) {
Array.isArray = function (vArg) {
return Object.prototype.toString.call(vArg) === "[object Array]";
};
}
if (!Object.isSVGElement) {
Object.isSVGElement = function(vArg) {
var str = Object.prototype.toString.call(vArg);
return (str.indexOf("[object SVG") == 0);
};
}
... ...
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël 2.1.1 - JavaScript Vector Library │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
// └────────────────────────────────────────────────────────────────────┘ \\
(function(a){var b="0.3.4",c="hasOwnProperty",d=/[\.\/]/,e="*",f=function(){},g=function(a,b){return a-b},h,i,j={n:{}},k=function(a,b){var c=j,d=i,e=Array.prototype.slice.call(arguments,2),f=k.listeners(a),l=0,m=!1,n,o=[],p={},q=[],r=h,s=[];h=a,i=0;for(var t=0,u=f.length;t<u;t++)"zIndex"in f[t]&&(o.push(f[t].zIndex),f[t].zIndex<0&&(p[f[t].zIndex]=f[t]));o.sort(g);while(o[l]<0){n=p[o[l++]],q.push(n.apply(b,e));if(i){i=d;return q}}for(t=0;t<u;t++){n=f[t];if("zIndex"in n)if(n.zIndex==o[l]){q.push(n.apply(b,e));if(i)break;do{l++,n=p[o[l]],n&&q.push(n.apply(b,e));if(i)break}while(n)}else p[n.zIndex]=n;else{q.push(n.apply(b,e));if(i)break}}i=d,h=r;return q.length?q:null};k.listeners=function(a){var b=a.split(d),c=j,f,g,h,i,k,l,m,n,o=[c],p=[];for(i=0,k=b.length;i<k;i++){n=[];for(l=0,m=o.length;l<m;l++){c=o[l].n,g=[c[b[i]],c[e]],h=2;while(h--)f=g[h],f&&(n.push(f),p=p.concat(f.f||[]))}o=n}return p},k.on=function(a,b){var c=a.split(d),e=j;for(var g=0,h=c.length;g<h;g++)e=e.n,!e[c[g]]&&(e[c[g]]={n:{}}),e=e[c[g]];e.f=e.f||[];for(g=0,h=e.f.length;g<h;g++)if(e.f[g]==b)return f;e.f.push(b);return function(a){+a==+a&&(b.zIndex=+a)}},k.stop=function(){i=1},k.nt=function(a){if(a)return(new RegExp("(?:\\.|\\/|^)"+a+"(?:\\.|\\/|$)")).test(h);return h},k.off=k.unbind=function(a,b){var f=a.split(d),g,h,i,k,l,m,n,o=[j];for(k=0,l=f.length;k<l;k++)for(m=0;m<o.length;m+=i.length-2){i=[m,1],g=o[m].n;if(f[k]!=e)g[f[k]]&&i.push(g[f[k]]);else for(h in g)g[c](h)&&i.push(g[h]);o.splice.apply(o,i)}for(k=0,l=o.length;k<l;k++){g=o[k];while(g.n){if(b){if(g.f){for(m=0,n=g.f.length;m<n;m++)if(g.f[m]==b){g.f.splice(m,1);break}!g.f.length&&delete g.f}for(h in g.n)if(g.n[c](h)&&g.n[h].f){var p=g.n[h].f;for(m=0,n=p.length;m<n;m++)if(p[m]==b){p.splice(m,1);break}!p.length&&delete g.n[h].f}}else{delete g.f;for(h in g.n)g.n[c](h)&&g.n[h].f&&delete g.n[h].f}g=g.n}}},k.once=function(a,b){var c=function(){var d=b.apply(this,arguments);k.unbind(a,c);return d};return k.on(a,c)},k.version=b,k.toString=function(){return"You are running Eve "+b},typeof module!="undefined"&&module.exports?module.exports=k:typeof define!="undefined"?define("eve",[],function(){return k}):a.eve=k})(this),function(){function cF(a){for(var b=0;b<cy.length;b++)cy[b].el.paper==a&&cy.splice(b--,1)}function cE(b,d,e,f,h,i){e=Q(e);var j,k,l,m=[],o,p,q,t=b.ms,u={},v={},w={};if(f)for(y=0,z=cy.length;y<z;y++){var x=cy[y];if(x.el.id==d.id&&x.anim==b){x.percent!=e?(cy.splice(y,1),l=1):k=x,d.attr(x.totalOrigin);break}}else f=+v;for(var y=0,z=b.percents.length;y<z;y++){if(b.percents[y]==e||b.percents[y]>f*b.top){e=b.percents[y],p=b.percents[y-1]||0,t=t/b.top*(e-p),o=b.percents[y+1],j=b.anim[e];break}f&&d.attr(b.anim[b.percents[y]])}if(!!j){if(!k){for(var A in j)if(j[g](A))if(U[g](A)||d.paper.customAttributes[g](A)){u[A]=d.attr(A),u[A]==null&&(u[A]=T[A]),v[A]=j[A];switch(U[A]){case C:w[A]=(v[A]-u[A])/t;break;case"colour":u[A]=a.getRGB(u[A]);var B=a.getRGB(v[A]);w[A]={r:(B.r-u[A].r)/t,g:(B.g-u[A].g)/t,b:(B.b-u[A].b)/t};break;case"path":var D=bR(u[A],v[A]),E=D[1];u[A]=D[0],w[A]=[];for(y=0,z=u[A].length;y<z;y++){w[A][y]=[0];for(var F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(E[y][F]-u[A][y][F])/t}break;case"transform":var H=d._,I=ca(H[A],v[A]);if(I){u[A]=I.from,v[A]=I.to,w[A]=[],w[A].real=!0;for(y=0,z=u[A].length;y<z;y++){w[A][y]=[u[A][y][0]];for(F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(v[A][y][F]-u[A][y][F])/t}}else{var J=d.matrix||new cb,K={_:{transform:H.transform},getBBox:function(){return d.getBBox(1)}};u[A]=[J.a,J.b,J.c,J.d,J.e,J.f],b$(K,v[A]),v[A]=K._.transform,w[A]=[(K.matrix.a-J.a)/t,(K.matrix.b-J.b)/t,(K.matrix.c-J.c)/t,(K.matrix.d-J.d)/t,(K.matrix.e-J.e)/t,(K.matrix.f-J.f)/t]}break;case"csv":var L=r(j[A])[s](c),M=r(u[A])[s](c);if(A=="clip-rect"){u[A]=M,w[A]=[],y=M.length;while(y--)w[A][y]=(L[y]-u[A][y])/t}v[A]=L;break;default:L=[][n](j[A]),M=[][n](u[A]),w[A]=[],y=d.paper.customAttributes[A].length;while(y--)w[A][y]=((L[y]||0)-(M[y]||0))/t}}var O=j.easing,P=a.easing_formulas[O];if(!P){P=r(O).match(N);if(P&&P.length==5){var R=P;P=function(a){return cC(a,+R[1],+R[2],+R[3],+R[4],t)}}else P=bf}q=j.start||b.start||+(new Date),x={anim:b,percent:e,timestamp:q,start:q+(b.del||0),status:0,initstatus:f||0,stop:!1,ms:t,easing:P,from:u,diff:w,to:v,el:d,callback:j.callback,prev:p,next:o,repeat:i||b.times,origin:d.attr(),totalOrigin:h},cy.push(x);if(f&&!k&&!l){x.stop=!0,x.start=new Date-t*f;if(cy.length==1)return cA()}l&&(x.start=new Date-x.ms*f),cy.length==1&&cz(cA)}else k.initstatus=f,k.start=new Date-k.ms*f;eve("raphael.anim.start."+d.id,d,b)}}function cD(a,b){var c=[],d={};this.ms=b,this.times=1;if(a){for(var e in a)a[g](e)&&(d[Q(e)]=a[e],c.push(Q(e)));c.sort(bd)}this.anim=d,this.top=c[c.length-1],this.percents=c}function cC(a,b,c,d,e,f){function o(a,b){var c,d,e,f,j,k;for(e=a,k=0;k<8;k++){f=m(e)-a;if(z(f)<b)return e;j=(3*i*e+2*h)*e+g;if(z(j)<1e-6)break;e=e-f/j}c=0,d=1,e=a;if(e<c)return c;if(e>d)return d;while(c<d){f=m(e);if(z(f-a)<b)return e;a>f?c=e:d=e,e=(d-c)/2+c}return e}function n(a,b){var c=o(a,b);return((l*c+k)*c+j)*c}function m(a){return((i*a+h)*a+g)*a}var g=3*b,h=3*(d-b)-g,i=1-g-h,j=3*c,k=3*(e-c)-j,l=1-j-k;return n(a,1/(200*f))}function cq(){return this.x+q+this.y+q+this.width+" × "+this.height}function cp(){return this.x+q+this.y}function cb(a,b,c,d,e,f){a!=null?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function bH(b,c,d){b=a._path2curve(b),c=a._path2curve(c);var e,f,g,h,i,j,k,l,m,n,o=d?0:[];for(var p=0,q=b.length;p<q;p++){var r=b[p];if(r[0]=="M")e=i=r[1],f=j=r[2];else{r[0]=="C"?(m=[e,f].concat(r.slice(1)),e=m[6],f=m[7]):(m=[e,f,e,f,i,j,i,j],e=i,f=j);for(var s=0,t=c.length;s<t;s++){var u=c[s];if(u[0]=="M")g=k=u[1],h=l=u[2];else{u[0]=="C"?(n=[g,h].concat(u.slice(1)),g=n[6],h=n[7]):(n=[g,h,g,h,k,l,k,l],g=k,h=l);var v=bG(m,n,d);if(d)o+=v;else{for(var w=0,x=v.length;w<x;w++)v[w].segment1=p,v[w].segment2=s,v[w].bez1=m,v[w].bez2=n;o=o.concat(v)}}}}}return o}function bG(b,c,d){var e=a.bezierBBox(b),f=a.bezierBBox(c);if(!a.isBBoxIntersect(e,f))return d?0:[];var g=bB.apply(0,b),h=bB.apply(0,c),i=~~(g/5),j=~~(h/5),k=[],l=[],m={},n=d?0:[];for(var o=0;o<i+1;o++){var p=a.findDotsAtSegment.apply(a,b.concat(o/i));k.push({x:p.x,y:p.y,t:o/i})}for(o=0;o<j+1;o++)p=a.findDotsAtSegment.apply(a,c.concat(o/j)),l.push({x:p.x,y:p.y,t:o/j});for(o=0;o<i;o++)for(var q=0;q<j;q++){var r=k[o],s=k[o+1],t=l[q],u=l[q+1],v=z(s.x-r.x)<.001?"y":"x",w=z(u.x-t.x)<.001?"y":"x",x=bD(r.x,r.y,s.x,s.y,t.x,t.y,u.x,u.y);if(x){if(m[x.x.toFixed(4)]==x.y.toFixed(4))continue;m[x.x.toFixed(4)]=x.y.toFixed(4);var y=r.t+z((x[v]-r[v])/(s[v]-r[v]))*(s.t-r.t),A=t.t+z((x[w]-t[w])/(u[w]-t[w]))*(u.t-t.t);y>=0&&y<=1&&A>=0&&A<=1&&(d?n++:n.push({x:x.x,y:x.y,t1:y,t2:A}))}}return n}function bF(a,b){return bG(a,b,1)}function bE(a,b){return bG(a,b)}function bD(a,b,c,d,e,f,g,h){if(!(x(a,c)<y(e,g)||y(a,c)>x(e,g)||x(b,d)<y(f,h)||y(b,d)>x(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(!k)return;var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(n<+y(a,c).toFixed(2)||n>+x(a,c).toFixed(2)||n<+y(e,g).toFixed(2)||n>+x(e,g).toFixed(2)||o<+y(b,d).toFixed(2)||o>+x(b,d).toFixed(2)||o<+y(f,h).toFixed(2)||o>+x(f,h).toFixed(2))return;return{x:l,y:m}}}function bC(a,b,c,d,e,f,g,h,i){if(!(i<0||bB(a,b,c,d,e,f,g,h)<i)){var j=1,k=j/2,l=j-k,m,n=.01;m=bB(a,b,c,d,e,f,g,h,l);while(z(m-i)>n)k/=2,l+=(m<i?1:-1)*k,m=bB(a,b,c,d,e,f,g,h,l);return l}}function bB(a,b,c,d,e,f,g,h,i){i==null&&(i=1),i=i>1?1:i<0?0:i;var j=i/2,k=12,l=[-0.1252,.1252,-0.3678,.3678,-0.5873,.5873,-0.7699,.7699,-0.9041,.9041,-0.9816,.9816],m=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],n=0;for(var o=0;o<k;o++){var p=j*l[o]+j,q=bA(p,a,c,e,g),r=bA(p,b,d,f,h),s=q*q+r*r;n+=m[o]*w.sqrt(s)}return j*n}function bA(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function by(a,b){var c=[];for(var d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function bx(){return this.hex}function bv(a,b,c){function d(){var e=Array.prototype.slice.call(arguments,0),f=e.join("␀"),h=d.cache=d.cache||{},i=d.count=d.count||[];if(h[g](f)){bu(i,f);return c?c(h[f]):h[f]}i.length>=1e3&&delete h[i.shift()],i.push(f),h[f]=a[m](b,e);return c?c(h[f]):h[f]}return d}function bu(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function bm(a){if(Object(a)!==a)return a;var b=new a.constructor;for(var c in a)a[g](c)&&(b[c]=bm(a[c]));return b}function a(c){if(a.is(c,"function"))return b?c():eve.on("raphael.DOMload",c);if(a.is(c,E))return a._engine.create[m](a,c.splice(0,3+a.is(c[0],C))).add(c);var d=Array.prototype.slice.call(arguments,0);if(a.is(d[d.length-1],"function")){var e=d.pop();return b?e.call(a._engine.create[m](a,d)):eve.on("raphael.DOMload",function(){e.call(a._engine.create[m](a,d))})}return a._engine.create[m](a,arguments)}a.version="2.1.0",a.eve=eve;var b,c=/[, ]+/,d={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},e=/\{(\d+)\}/g,f="prototype",g="hasOwnProperty",h={doc:document,win:window},i={was:Object.prototype[g].call(h.win,"Raphael"),is:h.win.Raphael},j=function(){this.ca=this.customAttributes={}},k,l="appendChild",m="apply",n="concat",o="createTouch"in h.doc,p="",q=" ",r=String,s="split",t="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[s](q),u={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},v=r.prototype.toLowerCase,w=Math,x=w.max,y=w.min,z=w.abs,A=w.pow,B=w.PI,C="number",D="string",E="array",F="toString",G="fill",H=Object.prototype.toString,I={},J="push",K=a._ISURL=/^url\(['"]?([^\)]+?)['"]?\)$/i,L=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,M={NaN:1,Infinity:1,"-Infinity":1},N=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,O=w.round,P="setAttribute",Q=parseFloat,R=parseInt,S=r.prototype.toUpperCase,T=a._availableAttrs={"arrow-end":"none","arrow-start":"none",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/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,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",transform:"",width:0,x:0,y:0},U=a._availableAnimAttrs={blur:C,"clip-rect":"csv",cx:C,cy:C,fill:"colour","fill-opacity":C,"font-size":C,height:C,opacity:C,path:"path",r:C,rx:C,ry:C,stroke:"colour","stroke-opacity":C,"stroke-width":C,transform:"transform",width:C,x:C,y:C},V=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]/g,W=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,X={hs:1,rg:1},Y=/,?([achlmqrstvxz]),?/gi,Z=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,$=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,_=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/ig,ba=a._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,bb={},bc=function(a,b){return a.key-b.key},bd=function(a,b){return Q(a)-Q(b)},be=function(){},bf=function(a){return a},bg=a._rectPath=function(a,b,c,d,e){if(e)return[["M",a+e,b],["l",c-e*2,0],["a",e,e,0,0,1,e,e],["l",0,d-e*2],["a",e,e,0,0,1,-e,e],["l",e*2-c,0],["a",e,e,0,0,1,-e,-e],["l",0,e*2-d],["a",e,e,0,0,1,e,-e],["z"]];return[["M",a,b],["l",c,0],["l",0,d],["l",-c,0],["z"]]},bh=function(a,b,c,d){d==null&&(d=c);return[["M",a,b],["m",0,-d],["a",c,d,0,1,1,0,2*d],["a",c,d,0,1,1,0,-2*d],["z"]]},bi=a._getPath={path:function(a){return a.attr("path")},circle:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.r)},ellipse:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.rx,b.ry)},rect:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height,b.r)},image:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height)},text:function(a){var b=a._getBBox();return bg(b.x,b.y,b.width,b.height)}},bj=a.mapPath=function(a,b){if(!b)return a;var c,d,e,f,g,h,i;a=bR(a);for(e=0,g=a.length;e<g;e++){i=a[e];for(f=1,h=i.length;f<h;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d}return a};a._g=h,a.type=h.win.SVGAngle||h.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(a.type=="VML"){var bk=h.doc.createElement("div"),bl;bk.innerHTML='<v:shape adj="1"/>',bl=bk.firstChild,bl.style.behavior="url(#default#VML)";if(!bl||typeof bl.adj!="object")return a.type=p;bk=null}a.svg=!(a.vml=a.type=="VML"),a._Paper=j,a.fn=k=j.prototype=a.prototype,a._id=0,a._oid=0,a.is=function(a,b){b=v.call(b);if(b=="finite")return!M[g](+a);if(b=="array")return a instanceof Array;return b=="null"&&a===null||b==typeof a&&a!==null||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||H.call(a).slice(8,-1).toLowerCase()==b},a.angle=function(b,c,d,e,f,g){if(f==null){var h=b-d,i=c-e;if(!h&&!i)return 0;return(180+w.atan2(-i,-h)*180/B+360)%360}return a.angle(b,c,f,g)-a.angle(d,e,f,g)},a.rad=function(a){return a%360*B/180},a.deg=function(a){return a*180/B%360},a.snapTo=function(b,c,d){d=a.is(d,"finite")?d:10;if(a.is(b,E)){var e=b.length;while(e--)if(z(b[e]-c)<=d)return b[e]}else{b=+b;var f=c%b;if(f<d)return c-f;if(f>b-d)return c-f+b}return c};var bn=a.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=w.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)});a.setWindow=function(b){eve("raphael.setWindow",a,h.win,b),h.win=b,h.doc=h.win.document,a._engine.initWin&&a._engine.initWin(h.win)};var bo=function(b){if(a.vml){var c=/^\s+|\s+$/g,d;try{var e=new ActiveXObject("htmlfile");e.write("<body>"),e.close(),d=e.body}catch(f){d=createPopup().document.body}var g=d.createTextRange();bo=bv(function(a){try{d.style.color=r(a).replace(c,p);var b=g.queryCommandValue("ForeColor");b=(b&255)<<16|b&65280|(b&16711680)>>>16;return"#"+("000000"+b.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=h.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",h.doc.body.appendChild(i),bo=bv(function(a){i.style.color=a;return h.doc.defaultView.getComputedStyle(i,p).getPropertyValue("color")})}return bo(b)},bp=function(){return"hsb("+[this.h,this.s,this.b]+")"},bq=function(){return"hsl("+[this.h,this.s,this.l]+")"},br=function(){return this.hex},bs=function(b,c,d){c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b&&(d=b.b,c=b.g,b=b.r);if(c==null&&a.is(b,D)){var e=a.getRGB(b);b=e.r,c=e.g,d=e.b}if(b>1||c>1||d>1)b/=255,c/=255,d/=255;return[b,c,d]},bt=function(b,c,d,e){b*=255,c*=255,d*=255;var f={r:b,g:c,b:d,hex:a.rgb(b,c,d),toString:br};a.is(e,"finite")&&(f.opacity=e);return f};a.color=function(b){var c;a.is(b,"object")&&"h"in b&&"s"in b&&"b"in b?(c=a.hsb2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):a.is(b,"object")&&"h"in b&&"s"in b&&"l"in b?(c=a.hsl2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):(a.is(b,"string")&&(b=a.getRGB(b)),a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b?(c=a.rgb2hsl(b),b.h=c.h,b.s=c.s,b.l=c.l,c=a.rgb2hsb(b),b.v=c.b):(b={hex:"none"},b.r=b.g=b.b=b.h=b.s=b.v=b.l=-1)),b.toString=br;return b},a.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h,d=a.o),a*=360;var e,f,g,h,i;a=a%360/60,i=c*b,h=i*(1-z(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.hsl2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"l"in a&&(c=a.l,b=a.s,a=a.h);if(a>1||b>1||c>1)a/=360,b/=100,c/=100;a*=360;var e,f,g,h,i;a=a%360/60,i=2*b*(c<.5?c:1-c),h=i*(1-z(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.rgb2hsb=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;f=x(a,b,c),g=f-y(a,b,c),d=g==0?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=(d+360)%6*60/360,e=g==0?0:g/f;return{h:d,s:e,b:f,toString:bp}},a.rgb2hsl=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;g=x(a,b,c),h=y(a,b,c),i=g-h,d=i==0?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=(d+360)%6*60/360,f=(g+h)/2,e=i==0?0:f<.5?i/(2*f):i/(2-2*f);return{h:d,s:e,l:f,toString:bq}},a._path2string=function(){return this.join(",").replace(Y,"$1")};var bw=a._preload=function(a,b){var c=h.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,h.doc.body.removeChild(this)},c.onerror=function(){h.doc.body.removeChild(this)},h.doc.body.appendChild(c),c.src=a};a.getRGB=bv(function(b){if(!b||!!((b=r(b)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx};if(b=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:bx};!X[g](b.toLowerCase().substring(0,2))&&b.charAt()!="#"&&(b=bo(b));var c,d,e,f,h,i,j,k=b.match(L);if(k){k[2]&&(f=R(k[2].substring(5),16),e=R(k[2].substring(3,5),16),d=R(k[2].substring(1,3),16)),k[3]&&(f=R((i=k[3].charAt(3))+i,16),e=R((i=k[3].charAt(2))+i,16),d=R((i=k[3].charAt(1))+i,16)),k[4]&&(j=k[4][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),k[1].toLowerCase().slice(0,4)=="rgba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100));if(k[5]){j=k[5][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsb2rgb(d,e,f,h)}if(k[6]){j=k[6][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsla"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsl2rgb(d,e,f,h)}k={r:d,g:e,b:f,toString:bx},k.hex="#"+(16777216|f|e<<8|d<<16).toString(16).slice(1),a.is(h,"finite")&&(k.opacity=h);return k}return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx}},a),a.hsb=bv(function(b,c,d){return a.hsb2rgb(b,c,d).hex}),a.hsl=bv(function(b,c,d){return a.hsl2rgb(b,c,d).hex}),a.rgb=bv(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)}),a.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b}));return c.hex},a.getColor.reset=function(){delete this.start},a.parsePathString=function(b){if(!b)return null;var c=bz(b);if(c.arr)return bJ(c.arr);var d={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},e=[];a.is(b,E)&&a.is(b[0],E)&&(e=bJ(b)),e.length||r(b).replace(Z,function(a,b,c){var f=[],g=b.toLowerCase();c.replace(_,function(a,b){b&&f.push(+b)}),g=="m"&&f.length>2&&(e.push([b][n](f.splice(0,2))),g="l",b=b=="m"?"l":"L");if(g=="r")e.push([b][n](f));else while(f.length>=d[g]){e.push([b][n](f.splice(0,d[g])));if(!d[g])break}}),e.toString=a._path2string,c.arr=bJ(e);return e},a.parseTransformString=bv(function(b){if(!b)return null;var c={r:3,s:4,t:2,m:6},d=[];a.is(b,E)&&a.is(b[0],E)&&(d=bJ(b)),d.length||r(b).replace($,function(a,b,c){var e=[],f=v.call(b);c.replace(_,function(a,b){b&&e.push(+b)}),d.push([b][n](e))}),d.toString=a._path2string;return d});var bz=function(a){var b=bz.ps=bz.ps||{};b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[g](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])});return b[a]};a.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=A(j,3),l=A(j,2),m=i*i,n=m*i,o=k*a+l*3*i*c+j*3*i*i*e+n*g,p=k*b+l*3*i*d+j*3*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,x=j*e+i*g,y=j*f+i*h,z=90-w.atan2(q-s,r-t)*180/B;(q>s||r<t)&&(z+=180);return{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:x,y:y},alpha:z}},a.bezierBBox=function(b,c,d,e,f,g,h,i){a.is(b,"array")||(b=[b,c,d,e,f,g,h,i]);var j=bQ.apply(null,b);return{x:j.min.x,y:j.min.y,x2:j.max.x,y2:j.max.y,width:j.max.x-j.min.x,height:j.max.y-j.min.y}},a.isPointInsideBBox=function(a,b,c){return b>=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2},a.isBBoxIntersect=function(b,c){var d=a.isPointInsideBBox;return d(c,b.x,b.y)||d(c,b.x2,b.y)||d(c,b.x,b.y2)||d(c,b.x2,b.y2)||d(b,c.x,c.y)||d(b,c.x2,c.y)||d(b,c.x,c.y2)||d(b,c.x2,c.y2)||(b.x<c.x2&&b.x>c.x||c.x<b.x2&&c.x>b.x)&&(b.y<c.y2&&b.y>c.y||c.y<b.y2&&c.y>b.y)},a.pathIntersection=function(a,b){return bH(a,b)},a.pathIntersectionNumber=function(a,b){return bH(a,b,1)},a.isPointInsidePath=function(b,c,d){var e=a.pathBBox(b);return a.isPointInsideBBox(e,c,d)&&bH(b,[["M",c,d],["H",e.x2+10]],1)%2==1},a._removedFactory=function(a){return function(){eve("raphael.log",null,"Raphaël: you are calling to method “"+a+"” of removed object",a)}};var bI=a.pathBBox=function(a){var b=bz(a);if(b.bbox)return bm(b.bbox);if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=bR(a);var c=0,d=0,e=[],f=[],g;for(var h=0,i=a.length;h<i;h++){g=a[h];if(g[0]=="M")c=g[1],d=g[2],e.push(c),f.push(d);else{var j=bQ(c,d,g[1],g[2],g[3],g[4],g[5],g[6]);e=e[n](j.min.x,j.max.x),f=f[n](j.min.y,j.max.y),c=g[5],d=g[6]}}var k=y[m](0,e),l=y[m](0,f),o=x[m](0,e),p=x[m](0,f),q={x:k,y:l,x2:o,y2:p,width:o-k,height:p-l};b.bbox=bm(q);return q},bJ=function(b){var c=bm(b);c.toString=a._path2string;return c},bK=a._pathToRelative=function(b){var c=bz(b);if(c.rel)return bJ(c.rel);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=b[0][1],f=b[0][2],g=e,h=f,i++,d.push(["M",e,f]));for(var j=i,k=b.length;j<k;j++){var l=d[j]=[],m=b[j];if(m[0]!=v.call(m[0])){l[0]=v.call(m[0]);switch(l[0]){case"a":l[1]=m[1],l[2]=m[2],l[3]=m[3],l[4]=m[4],l[5]=m[5],l[6]=+(m[6]-e).toFixed(3),l[7]=+(m[7]-f).toFixed(3);break;case"v":l[1]=+(m[1]-f).toFixed(3);break;case"m":g=m[1],h=m[2];default:for(var n=1,o=m.length;n<o;n++)l[n]=+(m[n]-(n%2?e:f)).toFixed(3)}}else{l=d[j]=[],m[0]=="m"&&(g=m[1]+e,h=m[2]+f);for(var p=0,q=m.length;p<q;p++)d[j][p]=m[p]}var r=d[j].length;switch(d[j][0]){case"z":e=g,f=h;break;case"h":e+=+d[j][r-1];break;case"v":f+=+d[j][r-1];break;default:e+=+d[j][r-2],f+=+d[j][r-1]}}d.toString=a._path2string,c.rel=bJ(d);return d},bL=a._pathToAbsolute=function(b){var c=bz(b);if(c.abs)return bJ(c.abs);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);if(!b||!b.length)return[["M",0,0]];var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=+b[0][1],f=+b[0][2],g=e,h=f,i++,d[0]=["M",e,f]);var j=b.length==3&&b[0][0]=="M"&&b[1][0].toUpperCase()=="R"&&b[2][0].toUpperCase()=="Z";for(var k,l,m=i,o=b.length;m<o;m++){d.push(k=[]),l=b[m];if(l[0]!=S.call(l[0])){k[0]=S.call(l[0]);switch(k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+e),k[7]=+(l[7]+f);break;case"V":k[1]=+l[1]+f;break;case"H":k[1]=+l[1]+e;break;case"R":var p=[e,f][n](l.slice(1));for(var q=2,r=p.length;q<r;q++)p[q]=+p[q]+e,p[++q]=+p[q]+f;d.pop(),d=d[n](by(p,j));break;case"M":g=+l[1]+e,h=+l[2]+f;default:for(q=1,r=l.length;q<r;q++)k[q]=+l[q]+(q%2?e:f)}}else if(l[0]=="R")p=[e,f][n](l.slice(1)),d.pop(),d=d[n](by(p,j)),k=["R"][n](l.slice(-2));else for(var s=0,t=l.length;s<t;s++)k[s]=l[s];switch(k[0]){case"Z":e=g,f=h;break;case"H":e=k[1];break;case"V":f=k[1];break;case"M":g=k[k.length-2],h=k[k.length-1];default:e=k[k.length-2],f=k[k.length-1]}}d.toString=a._path2string,c.abs=bJ(d);return d},bM=function(a,b,c,d){return[a,b,c,d,c,d]},bN=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},bO=function(a,b,c,d,e,f,g,h,i,j){var k=B*120/180,l=B/180*(+e||0),m=[],o,p=bv(function(a,b,c){var d=a*w.cos(c)-b*w.sin(c),e=a*w.sin(c)+b*w.cos(c);return{x:d,y:e}});if(!j){o=p(a,b,-l),a=o.x,b=o.y,o=p(h,i,-l),h=o.x,i=o.y;var q=w.cos(B/180*e),r=w.sin(B/180*e),t=(a-h)/2,u=(b-i)/2,v=t*t/(c*c)+u*u/(d*d);v>1&&(v=w.sqrt(v),c=v*c,d=v*d);var x=c*c,y=d*d,A=(f==g?-1:1)*w.sqrt(z((x*y-x*u*u-y*t*t)/(x*u*u+y*t*t))),C=A*c*u/d+(a+h)/2,D=A*-d*t/c+(b+i)/2,E=w.asin(((b-D)/d).toFixed(9)),F=w.asin(((i-D)/d).toFixed(9));E=a<C?B-E:E,F=h<C?B-F:F,E<0&&(E=B*2+E),F<0&&(F=B*2+F),g&&E>F&&(E=E-B*2),!g&&F>E&&(F=F-B*2)}else E=j[0],F=j[1],C=j[2],D=j[3];var G=F-E;if(z(G)>k){var H=F,I=h,J=i;F=E+k*(g&&F>E?1:-1),h=C+c*w.cos(F),i=D+d*w.sin(F),m=bO(h,i,c,d,e,0,g,I,J,[F,H,C,D])}G=F-E;var K=w.cos(E),L=w.sin(E),M=w.cos(F),N=w.sin(F),O=w.tan(G/4),P=4/3*c*O,Q=4/3*d*O,R=[a,b],S=[a+P*L,b-Q*K],T=[h+P*N,i-Q*M],U=[h,i];S[0]=2*R[0]-S[0],S[1]=2*R[1]-S[1];if(j)return[S,T,U][n](m);m=[S,T,U][n](m).join()[s](",");var V=[];for(var W=0,X=m.length;W<X;W++)V[W]=W%2?p(m[W-1],m[W],l).y:p(m[W],m[W+1],l).x;return V},bP=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:A(j,3)*a+A(j,2)*3*i*c+j*3*i*i*e+A(i,3)*g,y:A(j,3)*b+A(j,2)*3*i*d+j*3*i*i*f+A(i,3)*h}},bQ=bv(function(a,b,c,d,e,f,g,h){var i=e-2*c+a-(g-2*e+c),j=2*(c-a)-2*(e-c),k=a-c,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,o=[b,h],p=[a,g],q;z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y)),i=f-2*d+b-(h-2*f+d),j=2*(d-b)-2*(f-d),k=b-d,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y));return{min:{x:y[m](0,p),y:y[m](0,o)},max:{x:x[m](0,p),y:x[m](0,o)}}}),bR=a._path2curve=bv(function(a,b){var c=!b&&bz(a);if(!b&&c.curve)return bJ(c.curve);var d=bL(a),e=b&&bL(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][n](bO[m](0,[b.x,b.y][n](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x)),d=b.y+(b.y-(b.by||b.y)),a=["C",c,d][n](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.x)),b.qy=b.y+(b.y-(b.qy||b.y)),a=["C"][n](bN(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][n](bN(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][n](bM(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][n](bM(b.x,b.y,a[1],b.y));break;case"V":a=["C"][n](bM(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][n](bM(b.x,b.y,b.X,b.Y))}return a},i=function(a,b){if(a[b].length>7){a[b].shift();var c=a[b];while(c.length)a.splice(b++,0,["C"][n](c.splice(0,6)));a.splice(b,1),l=x(d.length,e&&e.length||0)}},j=function(a,b,c,f,g){a&&b&&a[g][0]=="M"&&b[g][0]!="M"&&(b.splice(g,0,["M",f.x,f.y]),c.bx=0,c.by=0,c.x=a[g][1],c.y=a[g][2],l=x(d.length,e&&e.length||0))};for(var k=0,l=x(d.length,e&&e.length||0);k<l;k++){d[k]=h(d[k],f),i(d,k),e&&(e[k]=h(e[k],g)),e&&i(e,k),j(d,e,f,g,k),j(e,d,g,f,k);var o=d[k],p=e&&e[k],q=o.length,r=e&&p.length;f.x=o[q-2],f.y=o[q-1],f.bx=Q(o[q-4])||f.x,f.by=Q(o[q-3])||f.y,g.bx=e&&(Q(p[r-4])||g.x),g.by=e&&(Q(p[r-3])||g.y),g.x=e&&p[r-2],g.y=e&&p[r-1]}e||(c.curve=bJ(d));return e?[d,e]:d},null,bJ),bS=a._parseDots=bv(function(b){var c=[];for(var d=0,e=b.length;d<e;d++){var f={},g=b[d].match(/^([^:]*):?([\d\.]*)/);f.color=a.getRGB(g[1]);if(f.color.error)return null;f.color=f.color.hex,g[2]&&(f.offset=g[2]+"%"),c.push(f)}for(d=1,e=c.length-1;d<e;d++)if(!c[d].offset){var h=Q(c[d-1].offset||0),i=0;for(var j=d+1;j<e;j++)if(c[j].offset){i=c[j].offset;break}i||(i=100,j=e),i=Q(i);var k=(i-h)/(j-d+1);for(;d<j;d++)h+=k,c[d].offset=h+"%"}return c}),bT=a._tear=function(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)},bU=a._tofront=function(a,b){b.top!==a&&(bT(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a)},bV=a._toback=function(a,b){b.bottom!==a&&(bT(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a)},bW=a._insertafter=function(a,b,c){bT(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},bX=a._insertbefore=function(a,b,c){bT(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},bY=a.toMatrix=function(a,b){var c=bI(a),d={_:{transform:p},getBBox:function(){return c}};b$(d,b);return d.matrix},bZ=a.transformPath=function(a,b){return bj(a,bY(a,b))},b$=a._extractTransform=function(b,c){if(c==null)return b._.transform;c=r(c).replace(/\.{3}|\u2026/g,b._.transform||p);var d=a.parseTransformString(c),e=0,f=0,g=0,h=1,i=1,j=b._,k=new cb;j.transform=d||[];if(d)for(var l=0,m=d.length;l<m;l++){var n=d[l],o=n.length,q=r(n[0]).toLowerCase(),s=n[0]!=q,t=s?k.invert():0,u,v,w,x,y;q=="t"&&o==3?s?(u=t.x(0,0),v=t.y(0,0),w=t.x(n[1],n[2]),x=t.y(n[1],n[2]),k.translate(w-u,x-v)):k.translate(n[1],n[2]):q=="r"?o==2?(y=y||b.getBBox(1),k.rotate(n[1],y.x+y.width/2,y.y+y.height/2),e+=n[1]):o==4&&(s?(w=t.x(n[2],n[3]),x=t.y(n[2],n[3]),k.rotate(n[1],w,x)):k.rotate(n[1],n[2],n[3]),e+=n[1]):q=="s"?o==2||o==3?(y=y||b.getBBox(1),k.scale(n[1],n[o-1],y.x+y.width/2,y.y+y.height/2),h*=n[1],i*=n[o-1]):o==5&&(s?(w=t.x(n[3],n[4]),x=t.y(n[3],n[4]),k.scale(n[1],n[2],w,x)):k.scale(n[1],n[2],n[3],n[4]),h*=n[1],i*=n[2]):q=="m"&&o==7&&k.add(n[1],n[2],n[3],n[4],n[5],n[6]),j.dirtyT=1,b.matrix=k}b.matrix=k,j.sx=h,j.sy=i,j.deg=e,j.dx=f=k.e,j.dy=g=k.f,h==1&&i==1&&!e&&j.bbox?(j.bbox.x+=+f,j.bbox.y+=+g):j.dirtyT=1},b_=function(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return a.length==4?[b,0,a[2],a[3]]:[b,0];case"s":return a.length==5?[b,1,1,a[3],a[4]]:a.length==3?[b,1,1]:[b,1]}},ca=a._equaliseTransform=function(b,c){c=r(c).replace(/\.{3}|\u2026/g,b),b=a.parseTransformString(b)||[],c=a.parseTransformString(c)||[];var d=x(b.length,c.length),e=[],f=[],g=0,h,i,j,k;for(;g<d;g++){j=b[g]||b_(c[g]),k=c[g]||b_(j);if(j[0]!=k[0]||j[0].toLowerCase()=="r"&&(j[2]!=k[2]||j[3]!=k[3])||j[0].toLowerCase()=="s"&&(j[3]!=k[3]||j[4]!=k[4]))return;e[g]=[],f[g]=[];for(h=0,i=x(j.length,k.length);h<i;h++)h in j&&(e[g][h]=j[h]),h in k&&(f[g][h]=k[h])}return{from:e,to:f}};a._getContainer=function(b,c,d,e){var f;f=e==null&&!a.is(b,"object")?h.doc.getElementById(b):b;if(f!=null){if(f.tagName)return c==null?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:c,height:d};return{container:1,x:b,y:c,width:d,height:e}}},a.pathToRelative=bK,a._engine={},a.path2curve=bR,a.matrix=function(a,b,c,d,e,f){return new cb(a,b,c,d,e,f)},function(b){function d(a){var b=w.sqrt(c(a));a[0]&&(a[0]/=b),a[1]&&(a[1]/=b)}function c(a){return a[0]*a[0]+a[1]*a[1]}b.add=function(a,b,c,d,e,f){var g=[[],[],[]],h=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],i=[[a,c,e],[b,d,f],[0,0,1]],j,k,l,m;a&&a instanceof cb&&(i=[[a.a,a.c,a.e],[a.b,a.d,a.f],[0,0,1]]);for(j=0;j<3;j++)for(k=0;k<3;k++){m=0;for(l=0;l<3;l++)m+=h[j][l]*i[l][k];g[j][k]=m}this.a=g[0][0],this.b=g[1][0],this.c=g[0][1],this.d=g[1][1],this.e=g[0][2],this.f=g[1][2]},b.invert=function(){var a=this,b=a.a*a.d-a.b*a.c;return new cb(a.d/b,-a.b/b,-a.c/b,a.a/b,(a.c*a.f-a.d*a.e)/b,(a.b*a.e-a.a*a.f)/b)},b.clone=function(){return new cb(this.a,this.b,this.c,this.d,this.e,this.f)},b.translate=function(a,b){this.add(1,0,0,1,a,b)},b.scale=function(a,b,c,d){b==null&&(b=a),(c||d)&&this.add(1,0,0,1,c,d),this.add(a,0,0,b,0,0),(c||d)&&this.add(1,0,0,1,-c,-d)},b.rotate=function(b,c,d){b=a.rad(b),c=c||0,d=d||0;var e=+w.cos(b).toFixed(9),f=+w.sin(b).toFixed(9);this.add(e,f,-f,e,c,d),this.add(1,0,0,1,-c,-d)},b.x=function(a,b){return a*this.a+b*this.c+this.e},b.y=function(a,b){return a*this.b+b*this.d+this.f},b.get=function(a){return+this[r.fromCharCode(97+a)].toFixed(4)},b.toString=function(){return a.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},b.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},b.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},b.split=function(){var b={};b.dx=this.e,b.dy=this.f;var e=[[this.a,this.c],[this.b,this.d]];b.scalex=w.sqrt(c(e[0])),d(e[0]),b.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*b.shear,e[1][1]-e[0][1]*b.shear],b.scaley=w.sqrt(c(e[1])),d(e[1]),b.shear/=b.scaley;var f=-e[0][1],g=e[1][1];g<0?(b.rotate=a.deg(w.acos(g)),f<0&&(b.rotate=360-b.rotate)):b.rotate=a.deg(w.asin(f)),b.isSimple=!+b.shear.toFixed(9)&&(b.scalex.toFixed(9)==b.scaley.toFixed(9)||!b.rotate),b.isSuperSimple=!+b.shear.toFixed(9)&&b.scalex.toFixed(9)==b.scaley.toFixed(9)&&!b.rotate,b.noRotation=!+b.shear.toFixed(9)&&!b.rotate;return b},b.toTransformString=function(a){var b=a||this[s]();if(b.isSimple){b.scalex=+b.scalex.toFixed(4),b.scaley=+b.scaley.toFixed(4),b.rotate=+b.rotate.toFixed(4);return(b.dx||b.dy?"t"+[b.dx,b.dy]:p)+(b.scalex!=1||b.scaley!=1?"s"+[b.scalex,b.scaley,0,0]:p)+(b.rotate?"r"+[b.rotate,0,0]:p)}return"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(cb.prototype);var cc=navigator.userAgent.match(/Version\/(.*?)\s/)||navigator.userAgent.match(/Chrome\/(\d+)/);navigator.vendor=="Apple Computer, Inc."&&(cc&&cc[1]<4||navigator.platform.slice(0,2)=="iP")||navigator.vendor=="Google Inc."&&cc&&cc[1]<8?k.safari=function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});setTimeout(function(){a.remove()})}:k.safari=be;var cd=function(){this.returnValue=!1},ce=function(){return this.originalEvent.preventDefault()},cf=function(){this.cancelBubble=!0},cg=function(){return this.originalEvent.stopPropagation()},ch=function(){if(h.doc.addEventListener)return function(a,b,c,d){var e=o&&u[b]?u[b]:b,f=function(e){var f=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,i=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,j=e.clientX+i,k=e.clientY+f;if(o&&u[g](b))for(var l=0,m=e.targetTouches&&e.targetTouches.length;l<m;l++)if(e.targetTouches[l].target==a){var n=e;e=e.targetTouches[l],e.originalEvent=n,e.preventDefault=ce,e.stopPropagation=cg;break}return c.call(d,e,j,k)};a.addEventListener(e,f,!1);return function(){a.removeEventListener(e,f,!1);return!0}};if(h.doc.attachEvent)return function(a,b,c,d){var e=function(a){a=a||h.win.event;var b=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f=a.clientX+e,g=a.clientY+b;a.preventDefault=a.preventDefault||cd,a.stopPropagation=a.stopPropagation||cf;return c.call(d,a,f,g)};a.attachEvent("on"+b,e);var f=function(){a.detachEvent("on"+b,e);return!0};return f}}(),ci=[],cj=function(a){var b=a.clientX,c=a.clientY,d=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f,g=ci.length;while(g--){f=ci[g];if(o){var i=a.touches.length,j;while(i--){j=a.touches[i];if(j.identifier==f.el._drag.id){b=j.clientX,c=j.clientY,(a.originalEvent?a.originalEvent:a).preventDefault();break}}}else a.preventDefault();var k=f.el.node,l,m=k.nextSibling,n=k.parentNode,p=k.style.display;h.win.opera&&n.removeChild(k),k.style.display="none",l=f.el.paper.getElementByPoint(b,c),k.style.display=p,h.win.opera&&(m?n.insertBefore(k,m):n.appendChild(k)),l&&eve("raphael.drag.over."+f.el.id,f.el,l),b+=e,c+=d,eve("raphael.drag.move."+f.el.id,f.move_scope||f.el,b-f.el._drag.x,c-f.el._drag.y,b,c,a)}},ck=function(b){a.unmousemove(cj).unmouseup(ck);var c=ci.length,d;while(c--)d=ci[c],d.el._drag={},eve("raphael.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,b);ci=[]},cl=a.el={};for(var cm=t.length;cm--;)(function(b){a[b]=cl[b]=function(c,d){a.is(c,"function")&&(this.events=this.events||[],this.events.push({name:b,f:c,unbind:ch(this.shape||this.node||h.doc,b,c,d||this)}));return this},a["un"+b]=cl["un"+b]=function(a){var c=this.events||[],d=c.length;while(d--)if(c[d].name==b&&c[d].f==a){c[d].unbind(),c.splice(d,1),!c.length&&delete this.events;return this}return this}})(t[cm]);cl.data=function(b,c){var d=bb[this.id]=bb[this.id]||{};if(arguments.length==1){if(a.is(b,"object")){for(var e in b)b[g](e)&&this.data(e,b[e]);return this}eve("raphael.data.get."+this.id,this,d[b],b);return d[b]}d[b]=c,eve("raphael.data.set."+this.id,this,c,b);return this},cl.removeData=function(a){a==null?bb[this.id]={}:bb[this.id]&&delete bb[this.id][a];return this},cl.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},cl.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var cn=[];cl.drag=function(b,c,d,e,f,g){function i(i){(i.originalEvent||i).preventDefault();var j=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,k=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft;this._drag.x=i.clientX+k,this._drag.y=i.clientY+j,this._drag.id=i.identifier,!ci.length&&a.mousemove(cj).mouseup(ck),ci.push({el:this,move_scope:e,start_scope:f,end_scope:g}),c&&eve.on("raphael.drag.start."+this.id,c),b&&eve.on("raphael.drag.move."+this.id,b),d&&eve.on("raphael.drag.end."+this.id,d),eve("raphael.drag.start."+this.id,f||e||this,i.clientX+k,i.clientY+j,i)}this._drag={},cn.push({el:this,start:i}),this.mousedown(i);return this},cl.onDragOver=function(a){a?eve.on("raphael.drag.over."+this.id,a):eve.unbind("raphael.drag.over."+this.id)},cl.undrag=function(){var b=cn.length;while(b--)cn[b].el==this&&(this.unmousedown(cn[b].start),cn.splice(b,1),eve.unbind("raphael.drag.*."+this.id));!cn.length&&a.unmousemove(cj).unmouseup(ck)},k.circle=function(b,c,d){var e=a._engine.circle(this,b||0,c||0,d||0);this.__set__&&this.__set__.push(e);return e},k.rect=function(b,c,d,e,f){var g=a._engine.rect(this,b||0,c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.ellipse=function(b,c,d,e){var f=a._engine.ellipse(this,b||0,c||0,d||0,e||0);this.__set__&&this.__set__.push(f);return f},k.path=function(b){b&&!a.is(b,D)&&!a.is(b[0],E)&&(b+=p);var c=a._engine.path(a.format[m](a,arguments),this);this.__set__&&this.__set__.push(c);return c},k.image=function(b,c,d,e,f){var g=a._engine.image(this,b||"about:blank",c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.text=function(b,c,d){var e=a._engine.text(this,b||0,c||0,r(d));this.__set__&&this.__set__.push(e);return e},k.set=function(b){!a.is(b,"array")&&(b=Array.prototype.splice.call(arguments,0,arguments.length));var c=new cG(b);this.__set__&&this.__set__.push(c);return c},k.setStart=function(a){this.__set__=a||this.set()},k.setFinish=function(a){var b=this.__set__;delete this.__set__;return b},k.setSize=function(b,c){return a._engine.setSize.call(this,b,c)},k.setViewBox=function(b,c,d,e,f){return a._engine.setViewBox.call(this,b,c,d,e,f)},k.top=k.bottom=null,k.raphael=a;var co=function(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.body,e=c.documentElement,f=e.clientTop||d.clientTop||0,g=e.clientLeft||d.clientLeft||0,i=b.top+(h.win.pageYOffset||e.scrollTop||d.scrollTop)-f,j=b.left+(h.win.pageXOffset||e.scrollLeft||d.scrollLeft)-g;return{y:i,x:j}};k.getElementByPoint=function(a,b){var c=this,d=c.canvas,e=h.doc.elementFromPoint(a,b);if(h.win.opera&&e.tagName=="svg"){var f=co(d),g=d.createSVGRect();g.x=a-f.x,g.y=b-f.y,g.width=g.height=1;var i=d.getIntersectionList(g,null);i.length&&(e=i[i.length-1])}if(!e)return null;while(e.parentNode&&e!=d.parentNode&&!e.raphael)e=e.parentNode;e==c.canvas.parentNode&&(e=d),e=e&&e.raphael?c.getById(e.raphaelid):null;return e},k.getById=function(a){var b=this.bottom;while(b){if(b.id==a)return b;b=b.next}return null},k.forEach=function(a,b){var c=this.bottom;while(c){if(a.call(b,c)===!1)return this;c=c.next}return this},k.getElementsByPoint=function(a,b){var c=this.set();this.forEach(function(d){d.isPointInside(a,b)&&c.push(d)});return c},cl.isPointInside=function(b,c){var d=this.realPath=this.realPath||bi[this.type](this);return a.isPointInsidePath(d,b,c)},cl.getBBox=function(a){if(this.removed)return{};var b=this._;if(a){if(b.dirty||!b.bboxwt)this.realPath=bi[this.type](this),b.bboxwt=bI(this.realPath),b.bboxwt.toString=cq,b.dirty=0;return bm(b.bboxwt)}if(b.dirty||b.dirtyT||!b.bbox){if(b.dirty||!this.realPath)b.bboxwt=0,this.realPath=bi[this.type](this);b.bbox=bI(bj(this.realPath,this.matrix)),b.bbox.toString=cq,b.dirty=b.dirtyT=0}return bm(b.bbox)},cl.getBBoxWOTransform=function(){return this.getBBox(1)},cl.clone=function(){if(this.removed)return null;var a=this.paper[this.type]().attr(this.attr());this.__set__&&this.__set__.push(a);return a},cl.glow=function(a){if(this.type=="text")return null;a=a||{};var b={width:(a.width||10)+(+this.attr("stroke-width")||1),fill:a.fill||!1,opacity:a.opacity||.5,offsetx:a.offsetx||0,offsety:a.offsety||0,color:a.color||"#000"},c=b.width/2,d=this.paper,e=d.set(),f=this.realPath||bi[this.type](this);f=this.matrix?bj(f,this.matrix):f;for(var g=1;g<c+1;g++)e.push(d.path(f).attr({stroke:b.color,fill:b.fill?b.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(b.width/c*g).toFixed(3),opacity:+(b.opacity/c).toFixed(3)}));return e.insertBefore(this).translate(b.offsetx,b.offsety)};var cr={},cs=function(b,c,d,e,f,g,h,i,j){return j==null?bB(b,c,d,e,f,g,h,i):a.findDotsAtSegment(b,c,d,e,f,g,h,i,bC(b,c,d,e,f,g,h,i,j))},ct=function(b,c){return function(d,e,f){d=bR(d);var g,h,i,j,k="",l={},m,n=0;for(var o=0,p=d.length;o<p;o++){i=d[o];if(i[0]=="M")g=+i[1],h=+i[2];else{j=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6]);if(n+j>e){if(c&&!l.start){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),k+=["C"+m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k,k=["M"+m.x,m.y+"C"+m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!b&&!c){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j,g=+i[5],h=+i[6]}k+=i.shift()+i}l.end=k,m=b?n:c?l:a.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},cu=ct(1),cv=ct(),cw=ct(0,1);a.getTotalLength=cu,a.getPointAtLength=cv,a.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return cw(a,b).end;var d=cw(a,c,1);return b?cw(d,b).end:d},cl.getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return cu(this.attrs.path)}},cl.getPointAtLength=function(a){if(this.type=="path")return cv(this.attrs.path,a)},cl.getSubpath=function(b,c){if(this.type=="path")return a.getSubpath(this.attrs.path,b,c)};var cx=a.easing_formulas={linear:function(a){return a},"<":function(a){return A(a,1.7)},">":function(a){return A(a,.48)},"<>":function(a){var b=.48-a/1.04,c=w.sqrt(.1734+b*b),d=c-b,e=A(z(d),1/3)*(d<0?-1:1),f=-c-b,g=A(z(f),1/3)*(f<0?-1:1),h=e+g+.5;return(1-h)*3*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==!!a)return a;return A(2,-10*a)*w.sin((a-.075)*2*B/.3)+1},bounce:function(a){var b=7.5625,c=2.75,d;a<1/c?d=b*a*a:a<2/c?(a-=1.5/c,d=b*a*a+.75):a<2.5/c?(a-=2.25/c,d=b*a*a+.9375):(a-=2.625/c,d=b*a*a+.984375);return d}};cx.easeIn=cx["ease-in"]=cx["<"],cx.easeOut=cx["ease-out"]=cx[">"],cx.easeInOut=cx["ease-in-out"]=cx["<>"],cx["back-in"]=cx.backIn,cx["back-out"]=cx.backOut;var cy=[],cz=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},cA=function(){var b=+(new Date),c=0;for(;c<cy.length;c++){var d=cy[c];if(d.el.removed||d.paused)continue;var e=b-d.start,f=d.ms,h=d.easing,i=d.from,j=d.diff,k=d.to,l=d.t,m=d.el,o={},p,r={},s;d.initstatus?(e=(d.initstatus*d.anim.top-d.prev)/(d.percent-d.prev)*f,d.status=d.initstatus,delete d.initstatus,d.stop&&cy.splice(c--,1)):d.status=(d.prev+(d.percent-d.prev)*(e/f))/d.anim.top;if(e<0)continue;if(e<f){var t=h(e/f);for(var u in i)if(i[g](u)){switch(U[u]){case C:p=+i[u]+t*f*j[u];break;case"colour":p="rgb("+[cB(O(i[u].r+t*f*j[u].r)),cB(O(i[u].g+t*f*j[u].g)),cB(O(i[u].b+t*f*j[u].b))].join(",")+")";break;case"path":p=[];for(var v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(var x=1,y=i[u][v].length;x<y;x++)p[v][x]=+i[u][v][x]+t*f*j[u][v][x];p[v]=p[v].join(q)}p=p.join(q);break;case"transform":if(j[u].real){p=[];for(v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(x=1,y=i[u][v].length;x<y;x++)p[v][x]=i[u][v][x]+t*f*j[u][v][x]}}else{var z=function(a){return+i[u][a]+t*f*j[u][a]};p=[["m",z(0),z(1),z(2),z(3),z(4),z(5)]]}break;case"csv":if(u=="clip-rect"){p=[],v=4;while(v--)p[v]=+i[u][v]+t*f*j[u][v]}break;default:var A=[][n](i[u]);p=[],v=m.paper.customAttributes[u].length;while(v--)p[v]=+A[v]+t*f*j[u][v]}o[u]=p}m.attr(o),function(a,b,c){setTimeout(function(){eve("raphael.anim.frame."+a,b,c)})}(m.id,m,d.anim)}else{(function(b,c,d){setTimeout(function(){eve("raphael.anim.frame."+c.id,c,d),eve("raphael.anim.finish."+c.id,c,d),a.is(b,"function")&&b.call(c)})})(d.callback,m,d.anim),m.attr(k),cy.splice(c--,1);if(d.repeat>1&&!d.next){for(s in k)k[g](s)&&(r[s]=d.totalOrigin[s]);d.el.attr(r),cE(d.anim,d.el,d.anim.percents[0],null,d.totalOrigin,d.repeat-1)}d.next&&!d.stop&&cE(d.anim,d.el,d.next,null,d.totalOrigin,d.repeat)}}a.svg&&m&&m.paper&&m.paper.safari(),cy.length&&cz(cA)},cB=function(a){return a>255?255:a<0?0:a};cl.animateWith=function(b,c,d,e,f,g){var h=this;if(h.removed){g&&g.call(h);return h}var i=d instanceof cD?d:a.animation(d,e,f,g),j,k;cE(i,h,i.percents[0],null,h.attr());for(var l=0,m=cy.length;l<m;l++)if(cy[l].anim==c&&cy[l].el==b){cy[m-1].start=cy[l].start;break}return h},cl.onAnimation=function(a){a?eve.on("raphael.anim.frame."+this.id,a):eve.unbind("raphael.anim.frame."+this.id);return this},cD.prototype.delay=function(a){var b=new cD(this.anim,this.ms);b.times=this.times,b.del=+a||0;return b},cD.prototype.repeat=function(a){var b=new cD(this.anim,this.ms);b.del=this.del,b.times=w.floor(x(a,0))||1;return b},a.animation=function(b,c,d,e){if(b instanceof cD)return b;if(a.is(d,"function")||!d)e=e||d||null,d=null;b=Object(b),c=+c||0;var f={},h,i;for(i in b)b[g](i)&&Q(i)!=i&&Q(i)+"%"!=i&&(h=!0,f[i]=b[i]);if(!h)return new cD(b,c);d&&(f.easing=d),e&&(f.callback=e);return new cD({100:f},c)},cl.animate=function(b,c,d,e){var f=this;if(f.removed){e&&e.call(f);return f}var g=b instanceof cD?b:a.animation(b,c,d,e);cE(g,f,g.percents[0],null,f.attr());return f},cl.setTime=function(a,b){a&&b!=null&&this.status(a,y(b,a.ms)/a.ms);return this},cl.status=function(a,b){var c=[],d=0,e,f;if(b!=null){cE(a,this,-1,y(b,1));return this}e=cy.length;for(;d<e;d++){f=cy[d];if(f.el.id==this.id&&(!a||f.anim==a)){if(a)return f.status;c.push({anim:f.anim,status:f.status})}}if(a)return 0;return c},cl.pause=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.pause."+this.id,this,cy[b].anim)!==!1&&(cy[b].paused=!0);return this},cl.resume=function(a){for(var b=0;b<cy.length;b++)if(cy[b].el.id==this.id&&(!a||cy[b].anim==a)){var c=cy[b];eve("raphael.anim.resume."+this.id,this,c.anim)!==!1&&(delete c.paused,this.status(c.anim,c.status))}return this},cl.stop=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.stop."+this.id,this,cy[b].anim)!==!1&&cy.splice(b--,1);return this},eve.on("raphael.remove",cF),eve.on("raphael.clear",cF),cl.toString=function(){return"Raphaël’s object"};var cG=function(a){this.items=[],this.length=0,this.type="set";if(a)for(var b=0,c=a.length;b<c;b++)a[b]&&(a[b].constructor==cl.constructor||a[b].constructor==cG)&&(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},cH=cG.prototype;cH.push=function(){var a,b;for(var c=0,d=arguments.length;c<d;c++)a=arguments[c],a&&(a.constructor==cl.constructor||a.constructor==cG)&&(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},cH.pop=function(){this.length&&delete this[this.length--];return this.items.pop()},cH.forEach=function(a,b){for(var c=0,d=this.items.length;c<d;c++)if(a.call(b,this.items[c],c)===!1)return this;return this};for(var cI in cl)cl[g](cI)&&(cH[cI]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a][m](c,b)})}}(cI));cH.attr=function(b,c){if(b&&a.is(b,E)&&a.is(b[0],"object"))for(var d=0,e=b.length;d<e;d++)this.items[d].attr(b[d]);else for(var f=0,g=this.items.length;f<g;f++)this.items[f].attr(b,c);return this},cH.clear=function(){while(this.length)this.pop()},cH.splice=function(a,b,c){a=a<0?x(this.length+a,0):a,b=x(0,y(this.length-a,b));var d=[],e=[],f=[],g;for(g=2;g<arguments.length;g++)f.push(arguments[g]);for(g=0;g<b;g++)e.push(this[a+g]);for(;g<this.length-a;g++)d.push(this[a+g]);var h=f.length;for(g=0;g<h+d.length;g++)this.items[a+g]=this[a+g]=g<h?f[g]:d[g-h];g=this.items.length=this.length-=b-h;while(this[g])delete this[g++];return new cG(e)},cH.exclude=function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]==a){this.splice(b,1);return!0}},cH.animate=function(b,c,d,e){(a.is(d,"function")||!d)&&(e=d||null);var f=this.items.length,g=f,h,i=this,j;if(!f)return this;e&&(j=function(){!--f&&e.call(i)}),d=a.is(d,D)?d:j;var k=a.animation(b,c,d,j);h=this.items[--g].animate(k);while(g--)this.items[g]&&!this.items[g].removed&&this.items[g].animateWith(h,k,k);return this},cH.insertAfter=function(a){var b=this.items.length;while(b--)this.items[b].insertAfter(a);return this},cH.getBBox=function(){var a=[],b=[],c=[],d=[];for(var e=this.items.length;e--;)if(!this.items[e].removed){var f=this.items[e].getBBox();a.push(f.x),b.push(f.y),c.push(f.x+f.width),d.push(f.y+f.height)}a=y[m](0,a),b=y[m](0,b),c=x[m](0,c),d=x[m](0,d);return{x:a,y:b,x2:c,y2:d,width:c-a,height:d-b}},cH.clone=function(a){a=new cG;for(var b=0,c=this.items.length;b<c;b++)a.push(this.items[b].clone());return a},cH.toString=function(){return"Raphaël‘s set"},a.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[g](d)&&(b.face[d]=a.face[d]);this.fonts[c]?this.fonts[c].push(b):this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=R(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[g](e)){var f=a.glyphs[e];b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d.replace(/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"};if(f.k)for(var h in f.k)f[g](h)&&(b.glyphs[e].k[h]=f.k[h])}}return a},k.getFont=function(b,c,d,e){e=e||"normal",d=d||"normal",c=+c||{normal:400,bold:700,lighter:300,bolder:800}[c]||400;if(!!a.fonts){var f=a.fonts[b];if(!f){var h=new RegExp("(^|\\s)"+b.replace(/[^\w\d\s+!~.:_-]/g,p)+"(\\s|$)","i");for(var i in a.fonts)if(a.fonts[g](i)&&h.test(i)){f=a.fonts[i];break}}var j;if(f)for(var k=0,l=f.length;k<l;k++){j=f[k];if(j.face["font-weight"]==c&&(j.face["font-style"]==d||!j.face["font-style"])&&j.face["font-stretch"]==e)break}return j}},k.print=function(b,d,e,f,g,h,i){h=h||"middle",i=x(y(i||0,1),-1);var j=r(e)[s](p),k=0,l=0,m=p,n;a.is(f,e)&&(f=this.getFont(f));if(f){n=(g||16)/f.face["units-per-em"];var o=f.face.bbox[s](c),q=+o[0],t=o[3]-o[1],u=0,v=+o[1]+(h=="baseline"?t+ +f.face.descent:t/2);for(var w=0,z=j.length;w<z;w++){if(j[w]=="\n")k=0,B=0,l=0,u+=t;else{var A=l&&f.glyphs[j[w-1]]||{},B=f.glyphs[j[w]];k+=l?(A.w||f.w)+(A.k&&A.k[j[w]]||0)+f.w*i:0,l=1}B&&B.d&&(m+=a.transformPath(B.d,["t",k*n,u*n,"s",n,n,q,v,"t",(b-q)/n,(d-v)/n]))}}return this.path(m).attr({fill:"#000",stroke:"none"})},k.add=function(b){if(a.is(b,"array")){var c=this.set(),e=0,f=b.length,h;for(;e<f;e++)h=b[e]||{},d[g](h.type)&&c.push(this[h.type]().attr(h))}return c},a.format=function(b,c){var d=a.is(c,E)?[0][n](c):arguments;b&&a.is(b,D)&&d.length-1&&(b=b.replace(e,function(a,b){return d[++b]==null?p:d[b]}));return b||p},a.fullfill=function(){var a=/\{([^\}]+)\}/g,b=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,c=function(a,c,d){var e=d;c.replace(b,function(a,b,c,d,f){b=b||d,e&&(b in e&&(e=e[b]),typeof e=="function"&&f&&(e=e()))}),e=(e==null||e==d?a:e)+"";return e};return function(b,d){return String(b).replace(a,function(a,b){return c(a,b,d)})}}(),a.ninja=function(){i.was?h.win.Raphael=i.is:delete Raphael;return a},a.st=cH,function(b,c,d){function e(){/in/.test(b.readyState)?setTimeout(e,9):a.eve("raphael.DOMload")}b.readyState==null&&b.addEventListener&&(b.addEventListener(c,d=function(){b.removeEventListener(c,d,!1),b.readyState="complete"},!1),b.readyState="loading"),e()}(document,"DOMContentLoaded"),i.was?h.win.Raphael=a:Raphael=a,eve.on("raphael.DOMload",function(){b=!0})}(),window.Raphael.svg&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=parseInt,f=Math,g=f.max,h=f.abs,i=f.pow,j=/[, ]+/,k=a.eve,l="",m=" ",n="http://www.w3.org/1999/xlink",o={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},p={};a.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var q=function(d,e){if(e){typeof d=="string"&&(d=q(d));for(var f in e)e[b](f)&&(f.substring(0,6)=="xlink:"?d.setAttributeNS(n,f.substring(6),c(e[f])):d.setAttribute(f,c(e[f])))}else d=a._g.doc.createElementNS("http://www.w3.org/2000/svg",d),d.style&&(d.style.webkitTapHighlightColor="rgba(0,0,0,0)");return d},r=function(b,e){var j="linear",k=b.id+e,m=.5,n=.5,o=b.node,p=b.paper,r=o.style,s=a._g.doc.getElementById(k);if(!s){e=c(e).replace(a._radial_gradient,function(a,b,c){j="radial";if(b&&c){m=d(b),n=d(c);var e=(n>.5)*2-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&n!=.5&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/);if(j=="linear"){var t=e.shift();t=-d(t);if(isNaN(t))return null;var u=[0,0,f.cos(a.rad(t)),f.sin(a.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=a._parseDots(e);if(!w)return null;k=k.replace(/[\(\)\s,\xb0#]/g,"_"),b.gradient&&k!=b.gradient.id&&(p.defs.removeChild(b.gradient),delete b.gradient);if(!b.gradient){s=q(j+"Gradient",{id:k}),b.gradient=s,q(s,j=="radial"?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:b.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;x<y;x++)s.appendChild(q("stop",{offset:w[x].offset?w[x].offset:x?"100%":"0%","stop-color":w[x].color||"#fff"}))}}q(o,{fill:"url(#"+k+")",opacity:1,"fill-opacity":1}),r.fill=l,r.opacity=1,r.fillOpacity=1;return 1},s=function(a){var b=a.getBBox(1);q(a.pattern,{patternTransform:a.matrix.invert()+" translate("+b.x+","+b.y+")"})},t=function(d,e,f){if(d.type=="path"){var g=c(e).toLowerCase().split("-"),h=d.paper,i=f?"end":"start",j=d.node,k=d.attrs,m=k["stroke-width"],n=g.length,r="classic",s,t,u,v,w,x=3,y=3,z=5;while(n--)switch(g[n]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":r=g[n];break;case"wide":y=5;break;case"narrow":y=2;break;case"long":x=5;break;case"short":x=2}r=="open"?(x+=2,y+=2,z+=2,u=1,v=f?4:1,w={fill:"none",stroke:k.stroke}):(v=u=x/2,w={fill:k.stroke,stroke:"none"}),d._.arrows?f?(d._.arrows.endPath&&p[d._.arrows.endPath]--,d._.arrows.endMarker&&p[d._.arrows.endMarker]--):(d._.arrows.startPath&&p[d._.arrows.startPath]--,d._.arrows.startMarker&&p[d._.arrows.startMarker]--):d._.arrows={};if(r!="none"){var A="raphael-marker-"+r,B="raphael-marker-"+i+r+x+y;a._g.doc.getElementById(A)?p[A]++:(h.defs.appendChild(q(q("path"),{"stroke-linecap":"round",d:o[r],id:A})),p[A]=1);var C=a._g.doc.getElementById(B),D;C?(p[B]++,D=C.getElementsByTagName("use")[0]):(C=q(q("marker"),{id:B,markerHeight:y,markerWidth:x,orient:"auto",refX:v,refY:y/2}),D=q(q("use"),{"xlink:href":"#"+A,transform:(f?"rotate(180 "+x/2+" "+y/2+") ":l)+"scale("+x/z+","+y/z+")","stroke-width":(1/((x/z+y/z)/2)).toFixed(4)}),C.appendChild(D),h.defs.appendChild(C),p[B]=1),q(D,w);var F=u*(r!="diamond"&&r!="oval");f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-F*m):(s=F*m,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),w={},w["marker-"+i]="url(#"+B+")";if(t||s)w.d=Raphael.getSubpath(k.path,s,t);q(j,w),d._.arrows[i+"Path"]=A,d._.arrows[i+"Marker"]=B,d._.arrows[i+"dx"]=F,d._.arrows[i+"Type"]=r,d._.arrows[i+"String"]=e}else f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-s):(s=0,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),d._.arrows[i+"Path"]&&q(j,{d:Raphael.getSubpath(k.path,s,t)}),delete d._.arrows[i+"Path"],delete d._.arrows[i+"Marker"],delete d._.arrows[i+"dx"],delete d._.arrows[i+"Type"],delete d._.arrows[i+"String"];for(w in p)if(p[b](w)&&!p[w]){var G=a._g.doc.getElementById(w);G&&G.parentNode.removeChild(G)}}},u={"":[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]},v=function(a,b,d){b=u[c(b).toLowerCase()];if(b){var e=a.attrs["stroke-width"]||"1",f={round:e,square:e,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],h=b.length;while(h--)g[h]=b[h]*e+(h%2?1:-1)*f;q(a.node,{"stroke-dasharray":g.join(",")})}};k.on("raphael.util.attr.blur",function(a){this.blur(a)}),k.on("raphael.util.attr.cursor",function(a){this.node.style.cursor=a});var w=function(d,f){var i=d.node,m=d.attrs,o=i.style.visibility;i.style.visibility="hidden";for(var p in f){k("raphael.util.attr."+p,d,f[p]);if(f[b](p)){if(!a._availableAttrs[b](p))continue;var u=f[p];m[p]=u;switch(p){case"blur":d.blur(u);break;case"href":case"title":case"target":var w=i.parentNode;if(w.tagName.toLowerCase()!="a"){var x=q("a");w.insertBefore(x,i),x.appendChild(i),w=x}p=="target"?w.setAttributeNS(n,"show",u=="blank"?"new":u):w.setAttributeNS(n,p,u);break;case"cursor":break;case"transform":d.transform(u);break;case"arrow-start":t(d,u);break;case"arrow-end":t(d,u,1);break;case"clip-rect":var z=c(u).split(j);if(z.length==4){d.clip&&d.clip.parentNode.parentNode.removeChild(d.clip.parentNode);var A=q("clipPath"),B=q("rect");A.id=a.createUUID(),q(B,{x:z[0],y:z[1],width:z[2],height:z[3]}),A.appendChild(B),d.paper.defs.appendChild(A),q(i,{"clip-path":"url(#"+A.id+")"}),d.clip=B}if(!u){var C=i.getAttribute("clip-path");if(C){var D=a._g.doc.getElementById(C.replace(/(^url\(#|\)$)/g,l));D&&D.parentNode.removeChild(D),q(i,{"clip-path":l}),delete d.clip}}break;case"path":d.type=="path"&&(q(i,{d:u?m.path=a._pathToAbsolute(u):"M0,0"}),d._.dirty=1,d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1)));break;case"width":i.setAttribute(p,u),d._.dirty=1;if(m.fx)p="x",u=m.x;else break;case"x":m.fx&&(u=-m.x-(m.width||0));case"rx":if(p=="rx"&&d.type=="rect")break;case"cx":i.setAttribute(p,u),d.pattern&&s(d),d._.dirty=1;break;case"height":i.setAttribute(p,u),d._.dirty=1;if(m.fy)p="y",u=m.y;else break;case"y":m.fy&&(u=-m.y-(m.height||0));case"ry":if(p=="ry"&&d.type=="rect")break;case"cy":i.setAttribute(p,u),d.pattern&&s(d),d._.dirty=1;break;case"r":d.type=="rect"?q(i,{rx:u,ry:u}):i.setAttribute(p,u),d._.dirty=1;break;case"src":d.type=="image"&&i.setAttributeNS(n,"href",u);break;case"stroke-width":if(d._.sx!=1||d._.sy!=1)u/=g(h(d._.sx),h(d._.sy))||1;d.paper._vbSize&&(u*=d.paper._vbSize),i.setAttribute(p,u),m["stroke-dasharray"]&&v(d,m["stroke-dasharray"],f),d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"stroke-dasharray":v(d,u,f);break;case"fill":var F=c(u).match(a._ISURL);if(F){A=q("pattern");var G=q("image");A.id=a.createUUID(),q(A,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),q(G,{x:0,y:0,"xlink:href":F[1]}),A.appendChild(G),function(b){a._preload(F[1],function(){var a=this.offsetWidth,c=this.offsetHeight;q(b,{width:a,height:c}),q(G,{width:a,height:c}),d.paper.safari()})}(A),d.paper.defs.appendChild(A),q(i,{fill:"url(#"+A.id+")"}),d.pattern=A,d.pattern&&s(d);break}var H=a.getRGB(u);if(!H.error)delete f.gradient,delete m.gradient,!a.is(m.opacity,"undefined")&&a.is(f.opacity,"undefined")&&q(i,{opacity:m.opacity}),!a.is(m["fill-opacity"],"undefined")&&a.is(f["fill-opacity"],"undefined")&&q(i,{"fill-opacity":m["fill-opacity"]});else if((d.type=="circle"||d.type=="ellipse"||c(u).charAt()!="r")&&r(d,u)){if("opacity"in m||"fill-opacity"in m){var I=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l));if(I){var J=I.getElementsByTagName("stop");q(J[J.length-1],{"stop-opacity":("opacity"in m?m.opacity:1)*("fill-opacity"in m?m["fill-opacity"]:1)})}}m.gradient=u,m.fill="none";break}H[b]("opacity")&&q(i,{"fill-opacity":H.opacity>1?H.opacity/100:H.opacity});case"stroke":H=a.getRGB(u),i.setAttribute(p,H.hex),p=="stroke"&&H[b]("opacity")&&q(i,{"stroke-opacity":H.opacity>1?H.opacity/100:H.opacity}),p=="stroke"&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":(d.type=="circle"||d.type=="ellipse"||c(u).charAt()!="r")&&r(d,u);break;case"opacity":m.gradient&&!m[b]("stroke-opacity")&&q(i,{"stroke-opacity":u>1?u/100:u});case"fill-opacity":if(m.gradient){I=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),I&&(J=I.getElementsByTagName("stop"),q(J[J.length-1],{"stop-opacity":u}));break};default:p=="font-size"&&(u=e(u,10)+"px");var K=p.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[K]=u,d._.dirty=1,i.setAttribute(p,u)}}}y(d,f),i.style.visibility=o},x=1.2,y=function(d,f){if(d.type=="text"&&!!(f[b]("text")||f[b]("font")||f[b]("font-size")||f[b]("x")||f[b]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(a._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10;if(f[b]("text")){g.text=f.text;while(h.firstChild)h.removeChild(h.firstChild);var j=c(f.text).split("\n"),k=[],m;for(var n=0,o=j.length;n<o;n++)m=q("tspan"),n&&q(m,{dy:i*x,x:g.x}),m.appendChild(a._g.doc.createTextNode(j[n])),h.appendChild(m),k[n]=m}else{k=h.getElementsByTagName("tspan");for(n=0,o=k.length;n<o;n++)n?q(k[n],{dy:i*x,x:g.x}):q(k[0],{dy:0})}q(h,{x:g.x,y:g.y}),d._.dirty=1;var p=d._getBBox(),r=g.y-(p.y+p.height/2);r&&a.is(r,"finite")&&q(k[0],{dy:r})}},z=function(b,c){var d=0,e=0;this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.matrix=a.matrix(),this.realPath=null,this.paper=c,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},A=a.el;z.prototype=A,A.constructor=z,a._engine.path=function(a,b){var c=q("path");b.canvas&&b.canvas.appendChild(c);var d=new z(c,b);d.type="path",w(d,{fill:"none",stroke:"#000",path:a});return d},A.rotate=function(a,b,e){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this.transform(this._.transform.concat([["r",a,b,e]]));return this},A.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3])),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]]));return this},A.translate=function(a,b){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this.transform(this._.transform.concat([["t",a,b]]));return this},A.transform=function(c){var d=this._;if(c==null)return d.transform;a._extractTransform(this,c),this.clip&&q(this.clip,{transform:this.matrix.invert()}),this.pattern&&s(this),this.node&&q(this.node,{transform:this.matrix});if(d.sx!=1||d.sy!=1){var e=this.attrs[b]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":e})}return this},A.hide=function(){!this.removed&&this.paper.safari(this.node.style.display="none");return this},A.show=function(){!this.removed&&this.paper.safari(this.node.style.display="");return this},A.remove=function(){if(!this.removed&&!!this.node.parentNode){var b=this.paper;b.__set__&&b.__set__.exclude(this),k.unbind("raphael.*.*."+this.id),this.gradient&&b.defs.removeChild(this.gradient),a._tear(this,b),this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.removeChild(this.node.parentNode):this.node.parentNode.removeChild(this.node);for(var c in this)this[c]=typeof this[c]=="function"?a._removedFactory(c):null;this.removed=!0}},A._getBBox=function(){if(this.node.style.display=="none"){this.show();var a=!0}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}a&&this.hide();return b},A.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;if(c=="transform")return this._.transform;var g=c.split(j),h={};for(var i=0,l=g.length;i<l;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return l-1?h:h[g[0]]}if(d==null&&a.is(c,"array")){h={};for(i=0,l=c.length;i<l;i++)h[c[i]]=this.attr(c[i]);return h}if(d!=null){var m={};m[c]=d}else c!=null&&a.is(c,"object")&&(m=c);for(var n in m)k("raphael.attr."+n+"."+this.id,this,m[n]);for(n in this.paper.customAttributes)if(this.paper.customAttributes[b](n)&&m[b](n)&&a.is(this.paper.customAttributes[n],"function")){var o=this.paper.customAttributes[n].apply(this,[].concat(m[n]));this.attrs[n]=m[n];for(var p in o)o[b](p)&&(m[p]=o[p])}w(this,m);return this},A.toFront=function(){if(this.removed)return this;this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.appendChild(this.node.parentNode):this.node.parentNode.appendChild(this.node);var b=this.paper;b.top!=this&&a._tofront(this,b);return this},A.toBack=function(){if(this.removed)return this;var b=this.node.parentNode;b.tagName.toLowerCase()=="a"?b.parentNode.insertBefore(this.node.parentNode,this.node.parentNode.parentNode.firstChild):b.firstChild!=this.node&&b.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper);var c=this.paper;return this},A.insertAfter=function(b){if(this.removed)return this;var c=b.node||b[b.length-1].node;c.nextSibling?c.parentNode.insertBefore(this.node,c.nextSibling):c.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},A.insertBefore=function(b){if(this.removed)return this;var c=b.node||b[0].node;c.parentNode.insertBefore(this.node,c),a._insertbefore(this,b,this.paper);return this},A.blur=function(b){var c=this;if(+b!==0){var d=q("filter"),e=q("feGaussianBlur");c.attrs.blur=b,d.id=a.createUUID(),q(e,{stdDeviation:+b||1.5}),d.appendChild(e),c.paper.defs.appendChild(d),c._blur=d,q(c.node,{filter:"url(#"+d.id+")"})}else c._blur&&(c._blur.parentNode.removeChild(c._blur),delete c._blur,delete c.attrs.blur),c.node.removeAttribute("filter")},a._engine.circle=function(a,b,c,d){var e=q("circle");a.canvas&&a.canvas.appendChild(e);var f=new z(e,a);f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",q(e,f.attrs);return f},a._engine.rect=function(a,b,c,d,e,f){var g=q("rect");a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},h.type="rect",q(g,h.attrs);return h},a._engine.ellipse=function(a,b,c,d,e){var f=q("ellipse");a.canvas&&a.canvas.appendChild(f);var g=new z(f,a);g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",q(f,g.attrs);return g},a._engine.image=function(a,b,c,d,e,f){var g=q("image");q(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(n,"href",b),a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:c,y:d,width:e,height:f,src:b},h.type="image";return h},a._engine.text=function(b,c,d,e){var f=q("text");b.canvas&&b.canvas.appendChild(f);var g=new z(f,b);g.attrs={x:c,y:d,"text-anchor":"middle",text:e,font:a._availableAttrs.font,stroke:"none",fill:"#000"},g.type="text",w(g,g.attrs);return g},a._engine.setSize=function(a,b){this.width=a||this.width,this.height=b||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox);return this},a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b&&b.container,d=b.x,e=b.y,f=b.width,g=b.height;if(!c)throw new Error("SVG container not found.");var h=q("svg"),i="overflow:hidden;",j;d=d||0,e=e||0,f=f||512,g=g||342,q(h,{height:g,version:1.1,width:f,xmlns:"http://www.w3.org/2000/svg"}),c==1?(h.style.cssText=i+"position:absolute;left:"+d+"px;top:"+e+"px",a._g.doc.body.appendChild(h),j=1):(h.style.cssText=i+"position:relative",c.firstChild?c.insertBefore(h,c.firstChild):c.appendChild(h)),c=new a._Paper,c.width=f,c.height=g,c.canvas=h,c.clear(),c._left=c._top=0,j&&(c.renderfix=function(){}),c.renderfix();return c},a._engine.setViewBox=function(a,b,c,d,e){k("raphael.setViewBox",this,this._viewBox,[a,b,c,d,e]);var f=g(c/this.width,d/this.height),h=this.top,i=e?"meet":"xMinYMin",j,l;a==null?(this._vbSize&&(f=1),delete this._vbSize,j="0 0 "+this.width+m+this.height):(this._vbSize=f,j=a+m+b+m+c+m+d),q(this.canvas,{viewBox:j,preserveAspectRatio:i});while(f&&h)l="stroke-width"in h.attrs?h.attrs["stroke-width"]:1,h.attr({"stroke-width":l}),h._.dirty=1,h._.dirtyT=1,h=h.prev;this._viewBox=[a,b,c,d,!!e];return this},a.prototype.renderfix=function(){var a=this.canvas,b=a.style,c;try{c=a.getScreenCTM()||a.createSVGMatrix()}catch(d){c=a.createSVGMatrix()}var e=-c.e%1,f=-c.f%1;if(e||f)e&&(this._left=(this._left+e)%1,b.left=this._left+"px"),f&&(this._top=(this._top+f)%1,b.top=this._top+"px")},a.prototype.clear=function(){a.eve("raphael.clear",this);var b=this.canvas;while(b.firstChild)b.removeChild(b.firstChild);this.bottom=this.top=null,(this.desc=q("desc")).appendChild(a._g.doc.createTextNode("Created with Raphaël "+a.version)),b.appendChild(this.desc),b.appendChild(this.defs=q("defs"))},a.prototype.remove=function(){k("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null};var B=a.st;for(var C in A)A[b](C)&&!B[b](C)&&(B[C]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(C))}(window.Raphael),window.Raphael.vml&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=Math,f=e.round,g=e.max,h=e.min,i=e.abs,j="fill",k=/[, ]+/,l=a.eve,m=" progid:DXImageTransform.Microsoft",n=" ",o="",p={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},q=/([clmz]),?([^clmz]*)/gi,r=/ progid:\S+Blur\([^\)]+\)/g,s=/-?[^,\s-]+/g,t="position:absolute;left:0;top:0;width:1px;height:1px",u=21600,v={path:1,rect:1,image:1},w={circle:1,ellipse:1},x=function(b){var d=/[ahqstv]/ig,e=a._pathToAbsolute;c(b).match(d)&&(e=a._path2curve),d=/[clmz]/g;if(e==a._pathToAbsolute&&!c(b).match(d)){var g=c(b).replace(q,function(a,b,c){var d=[],e=b.toLowerCase()=="m",g=p[b];c.replace(s,function(a){e&&d.length==2&&(g+=d+p[b=="m"?"l":"L"],d=[]),d.push(f(a*u))});return g+d});return g}var h=e(b),i,j;g=[];for(var k=0,l=h.length;k<l;k++){i=h[k],j=h[k][0].toLowerCase(),j=="z"&&(j="x");for(var m=1,r=i.length;m<r;m++)j+=f(i[m]*u)+(m!=r-1?",":o);g.push(j)}return g.join(n)},y=function(b,c,d){var e=a.matrix();e.rotate(-b,.5,.5);return{dx:e.x(c,d),dy:e.y(c,d)}},z=function(a,b,c,d,e,f){var g=a._,h=a.matrix,k=g.fillpos,l=a.node,m=l.style,o=1,p="",q,r=u/b,s=u/c;m.visibility="hidden";if(!!b&&!!c){l.coordsize=i(r)+n+i(s),m.rotation=f*(b*c<0?-1:1);if(f){var t=y(f,d,e);d=t.dx,e=t.dy}b<0&&(p+="x"),c<0&&(p+=" y")&&(o=-1),m.flip=p,l.coordorigin=d*-r+n+e*-s;if(k||g.fillsize){var v=l.getElementsByTagName(j);v=v&&v[0],l.removeChild(v),k&&(t=y(f,h.x(k[0],k[1]),h.y(k[0],k[1])),v.position=t.dx*o+n+t.dy*o),g.fillsize&&(v.size=g.fillsize[0]*i(b)+n+g.fillsize[1]*i(c)),l.appendChild(v)}m.visibility="visible"}};a.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var A=function(a,b,d){var e=c(b).toLowerCase().split("-"),f=d?"end":"start",g=e.length,h="classic",i="medium",j="medium";while(g--)switch(e[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":h=e[g];break;case"wide":case"narrow":j=e[g];break;case"long":case"short":i=e[g]}var k=a.node.getElementsByTagName("stroke")[0];k[f+"arrow"]=h,k[f+"arrowlength"]=i,k[f+"arrowwidth"]=j},B=function(e,i){e.attrs=e.attrs||{};var l=e.node,m=e.attrs,p=l.style,q,r=v[e.type]&&(i.x!=m.x||i.y!=m.y||i.width!=m.width||i.height!=m.height||i.cx!=m.cx||i.cy!=m.cy||i.rx!=m.rx||i.ry!=m.ry||i.r!=m.r),s=w[e.type]&&(m.cx!=i.cx||m.cy!=i.cy||m.r!=i.r||m.rx!=i.rx||m.ry!=i.ry),t=e;for(var y in i)i[b](y)&&(m[y]=i[y]);r&&(m.path=a._getPath[e.type](e),e._.dirty=1),i.href&&(l.href=i.href),i.title&&(l.title=i.title),i.target&&(l.target=i.target),i.cursor&&(p.cursor=i.cursor),"blur"in i&&e.blur(i.blur);if(i.path&&e.type=="path"||r)l.path=x(~c(m.path).toLowerCase().indexOf("r")?a._pathToAbsolute(m.path):m.path),e.type=="image"&&(e._.fillpos=[m.x,m.y],e._.fillsize=[m.width,m.height],z(e,1,1,0,0,0));"transform"in i&&e.transform(i.transform);if(s){var B=+m.cx,D=+m.cy,E=+m.rx||+m.r||0,G=+m.ry||+m.r||0;l.path=a.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((B-E)*u),f((D-G)*u),f((B+E)*u),f((D+G)*u),f(B*u))}if("clip-rect"in i){var H=c(i["clip-rect"]).split(k);if(H.length==4){H[2]=+H[2]+ +H[0],H[3]=+H[3]+ +H[1];var I=l.clipRect||a._g.doc.createElement("div"),J=I.style;J.clip=a.format("rect({1}px {2}px {3}px {0}px)",H),l.clipRect||(J.position="absolute",J.top=0,J.left=0,J.width=e.paper.width+"px",J.height=e.paper.height+"px",l.parentNode.insertBefore(I,l),I.appendChild(l),l.clipRect=I)}i["clip-rect"]||l.clipRect&&(l.clipRect.style.clip="auto")}if(e.textpath){var K=e.textpath.style;i.font&&(K.font=i.font),i["font-family"]&&(K.fontFamily='"'+i["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,o)+'"'),i["font-size"]&&(K.fontSize=i["font-size"]),i["font-weight"]&&(K.fontWeight=i["font-weight"]),i["font-style"]&&(K.fontStyle=i["font-style"])}"arrow-start"in i&&A(t,i["arrow-start"]),"arrow-end"in i&&A(t,i["arrow-end"],1);if(i.opacity!=null||i["stroke-width"]!=null||i.fill!=null||i.src!=null||i.stroke!=null||i["stroke-width"]!=null||i["stroke-opacity"]!=null||i["fill-opacity"]!=null||i["stroke-dasharray"]!=null||i["stroke-miterlimit"]!=null||i["stroke-linejoin"]!=null||i["stroke-linecap"]!=null){var L=l.getElementsByTagName(j),M=!1;L=L&&L[0],!L&&(M=L=F(j)),e.type=="image"&&i.src&&(L.src=i.src),i.fill&&(L.on=!0);if(L.on==null||i.fill=="none"||i.fill===null)L.on=!1;if(L.on&&i.fill){var N=c(i.fill).match(a._ISURL);if(N){L.parentNode==l&&l.removeChild(L),L.rotate=!0,L.src=N[1],L.type="tile";var O=e.getBBox(1);L.position=O.x+n+O.y,e._.fillpos=[O.x,O.y],a._preload(N[1],function(){e._.fillsize=[this.offsetWidth,this.offsetHeight]})}else L.color=a.getRGB(i.fill).hex,L.src=o,L.type="solid",a.getRGB(i.fill).error&&(t.type in{circle:1,ellipse:1}||c(i.fill).charAt()!="r")&&C(t,i.fill,L)&&(m.fill="none",m.gradient=i.fill,L.rotate=!1)}if("fill-opacity"in i||"opacity"in i){var P=((+m["fill-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+a.getRGB(i.fill).o+1||2)-1);P=h(g(P,0),1),L.opacity=P,L.src&&(L.color="none")}l.appendChild(L);var Q=l.getElementsByTagName("stroke")&&l.getElementsByTagName("stroke")[0],T=!1;!Q&&(T=Q=F("stroke"));if(i.stroke&&i.stroke!="none"||i["stroke-width"]||i["stroke-opacity"]!=null||i["stroke-dasharray"]||i["stroke-miterlimit"]||i["stroke-linejoin"]||i["stroke-linecap"])Q.on=!0;(i.stroke=="none"||i.stroke===null||Q.on==null||i.stroke==0||i["stroke-width"]==0)&&(Q.on=!1);var U=a.getRGB(i.stroke);Q.on&&i.stroke&&(Q.color=U.hex),P=((+m["stroke-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+U.o+1||2)-1);var V=(d(i["stroke-width"])||1)*.75;P=h(g(P,0),1),i["stroke-width"]==null&&(V=m["stroke-width"]),i["stroke-width"]&&(Q.weight=V),V&&V<1&&(P*=V)&&(Q.weight=1),Q.opacity=P,i["stroke-linejoin"]&&(Q.joinstyle=i["stroke-linejoin"]||"miter"),Q.miterlimit=i["stroke-miterlimit"]||8,i["stroke-linecap"]&&(Q.endcap=i["stroke-linecap"]=="butt"?"flat":i["stroke-linecap"]=="square"?"square":"round");if(i["stroke-dasharray"]){var W={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};Q.dashstyle=W[b](i["stroke-dasharray"])?W[i["stroke-dasharray"]]:o}T&&l.appendChild(Q)}if(t.type=="text"){t.paper.canvas.style.display=o;var X=t.paper.span,Y=100,Z=m.font&&m.font.match(/\d+(?:\.\d*)?(?=px)/);p=X.style,m.font&&(p.font=m.font),m["font-family"]&&(p.fontFamily=m["font-family"]),m["font-weight"]&&(p.fontWeight=m["font-weight"]),m["font-style"]&&(p.fontStyle=m["font-style"]),Z=d(m["font-size"]||Z&&Z[0])||10,p.fontSize=Z*Y+"px",t.textpath.string&&(X.innerHTML=c(t.textpath.string).replace(/</g,"&#60;").replace(/&/g,"&#38;").replace(/\n/g,"<br>"));var $=X.getBoundingClientRect();t.W=m.w=($.right-$.left)/Y,t.H=m.h=($.bottom-$.top)/Y,t.X=m.x,t.Y=m.y+t.H/2,("x"in i||"y"in i)&&(t.path.v=a.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));var _=["x","y","text","font","font-family","font-weight","font-style","font-size"];for(var ba=0,bb=_.length;ba<bb;ba++)if(_[ba]in i){t._.dirty=1;break}switch(m["text-anchor"]){case"start":t.textpath.style["v-text-align"]="left",t.bbx=t.W/2;break;case"end":t.textpath.style["v-text-align"]="right",t.bbx=-t.W/2;break;default:t.textpath.style["v-text-align"]="center",t.bbx=0}t.textpath.style["v-text-kern"]=!0}},C=function(b,f,g){b.attrs=b.attrs||{};var h=b.attrs,i=Math.pow,j,k,l="linear",m=".5 .5";b.attrs.gradient=f,f=c(f).replace(a._radial_gradient,function(a,b,c){l="radial",b&&c&&(b=d(b),c=d(c),i(b-.5,2)+i(c-.5,2)>.25&&(c=e.sqrt(.25-i(b-.5,2))*((c>.5)*2-1)+.5),m=b+n+c);return o}),f=f.split(/\s*\-\s*/);if(l=="linear"){var p=f.shift();p=-d(p);if(isNaN(p))return null}var q=a._parseDots(f);if(!q)return null;b=b.shape||b.node;if(q.length){b.removeChild(g),g.on=!0,g.method="none",g.color=q[0].color,g.color2=q[q.length-1].color;var r=[];for(var s=0,t=q.length;s<t;s++)q[s].offset&&r.push(q[s].offset+n+q[s].color);g.colors=r.length?r.join():"0% "+g.color,l=="radial"?(g.type="gradientTitle",g.focus="100%",g.focussize="0 0",g.focusposition=m,g.angle=0):(g.type="gradient",g.angle=(270-p)%360),b.appendChild(g)}return 1},D=function(b,c){this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=c,this.matrix=a.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},E=a.el;D.prototype=E,E.constructor=D,E.transform=function(b){if(b==null)return this._.transform;var d=this.paper._viewBoxShift,e=d?"s"+[d.scale,d.scale]+"-1-1t"+[d.dx,d.dy]:o,f;d&&(f=b=c(b).replace(/\.{3}|\u2026/g,this._.transform||o)),a._extractTransform(this,e+b);var g=this.matrix.clone(),h=this.skew,i=this.node,j,k=~c(this.attrs.fill).indexOf("-"),l=!c(this.attrs.fill).indexOf("url(");g.translate(-0.5,-0.5);if(l||k||this.type=="image"){h.matrix="1 0 0 1",h.offset="0 0",j=g.split();if(k&&j.noRotation||!j.isSimple){i.style.filter=g.toFilter();var m=this.getBBox(),p=this.getBBox(1),q=m.x-p.x,r=m.y-p.y;i.coordorigin=q*-u+n+r*-u,z(this,1,1,q,r,0)}else i.style.filter=o,z(this,j.scalex,j.scaley,j.dx,j.dy,j.rotate)}else i.style.filter=o,h.matrix=c(g),h.offset=g.offset();f&&(this._.transform=f);return this},E.rotate=function(a,b,e){if(this.removed)return this;if(a!=null){a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this._.dirtyT=1,this.transform(this._.transform.concat([["r",a,b,e]]));return this}},E.translate=function(a,b){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this._.bbox&&(this._.bbox.x+=a,this._.bbox.y+=b),this.transform(this._.transform.concat([["t",a,b]]));return this},E.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3]),isNaN(e)&&(e=null),isNaN(f)&&(f=null)),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]])),this._.dirtyT=1;return this},E.hide=function(){!this.removed&&(this.node.style.display="none");return this},E.show=function(){!this.removed&&(this.node.style.display=o);return this},E._getBBox=function(){if(this.removed)return{};return{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},E.remove=function(){if(!this.removed&&!!this.node.parentNode){this.paper.__set__&&this.paper.__set__.exclude(this),a.eve.unbind("raphael.*.*."+this.id),a._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;this.removed=!0}},E.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c==j&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;var g=c.split(k),h={};for(var i=0,m=g.length;i<m;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return m-1?h:h[g[0]]}if(this.attrs&&d==null&&a.is(c,"array")){h={};for(i=0,m=c.length;i<m;i++)h[c[i]]=this.attr(c[i]);return h}var n;d!=null&&(n={},n[c]=d),d==null&&a.is(c,"object")&&(n=c);for(var o in n)l("raphael.attr."+o+"."+this.id,this,n[o]);if(n){for(o in this.paper.customAttributes)if(this.paper.customAttributes[b](o)&&n[b](o)&&a.is(this.paper.customAttributes[o],"function")){var p=this.paper.customAttributes[o].apply(this,[].concat(n[o]));this.attrs[o]=n[o];for(var q in p)p[b](q)&&(n[q]=p[q])}n.text&&this.type=="text"&&(this.textpath.string=n.text),B(this,n)}return this},E.toFront=function(){!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&a._tofront(this,this.paper);return this},E.toBack=function(){if(this.removed)return this;this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper));return this},E.insertAfter=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[b.length-1]),b.node.nextSibling?b.node.parentNode.insertBefore(this.node,b.node.nextSibling):b.node.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},E.insertBefore=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[0]),b.node.parentNode.insertBefore(this.node,b.node),a._insertbefore(this,b,this.paper);return this},E.blur=function(b){var c=this.node.runtimeStyle,d=c.filter;d=d.replace(r,o),+b!==0?(this.attrs.blur=b,c.filter=d+n+m+".Blur(pixelradius="+(+b||1.5)+")",c.margin=a.format("-{0}px 0 0 -{0}px",f(+b||1.5))):(c.filter=d,c.margin=0,delete this.attrs.blur)},a._engine.path=function(a,b){var c=F("shape");c.style.cssText=t,c.coordsize=u+n+u,c.coordorigin=b.coordorigin;var d=new D(c,b),e={fill:"none",stroke:"#000"};a&&(e.path=a),d.type="path",d.path=[],d.Path=o,B(d,e),b.canvas.appendChild(c);var f=F("skew");f.on=!0,c.appendChild(f),d.skew=f,d.transform(o);return d},a._engine.rect=function(b,c,d,e,f,g){var h=a._rectPath(c,d,e,f,g),i=b.path(h),j=i.attrs;i.X=j.x=c,i.Y=j.y=d,i.W=j.width=e,i.H=j.height=f,j.r=g,j.path=h,i.type="rect";return i},a._engine.ellipse=function(a,b,c,d,e){var f=a.path(),g=f.attrs;f.X=b-d,f.Y=c-e,f.W=d*2,f.H=e*2,f.type="ellipse",B(f,{cx:b,cy:c,rx:d,ry:e});return f},a._engine.circle=function(a,b,c,d){var e=a.path(),f=e.attrs;e.X=b-d,e.Y=c-d,e.W=e.H=d*2,e.type="circle",B(e,{cx:b,cy:c,r:d});return e},a._engine.image=function(b,c,d,e,f,g){var h=a._rectPath(d,e,f,g),i=b.path(h).attr({stroke:"none"}),k=i.attrs,l=i.node,m=l.getElementsByTagName(j)[0];k.src=c,i.X=k.x=d,i.Y=k.y=e,i.W=k.width=f,i.H=k.height=g,k.path=h,i.type="image",m.parentNode==l&&l.removeChild(m),m.rotate=!0,m.src=c,m.type="tile",i._.fillpos=[d,e],i._.fillsize=[f,g],l.appendChild(m),z(i,1,1,0,0,0);return i},a._engine.text=function(b,d,e,g){var h=F("shape"),i=F("path"),j=F("textpath");d=d||0,e=e||0,g=g||"",i.v=a.format("m{0},{1}l{2},{1}",f(d*u),f(e*u),f(d*u)+1),i.textpathok=!0,j.string=c(g),j.on=!0,h.style.cssText=t,h.coordsize=u+n+u,h.coordorigin="0 0";var k=new D(h,b),l={fill:"#000",stroke:"none",font:a._availableAttrs.font,text:g};k.shape=h,k.path=i,k.textpath=j,k.type="text",k.attrs.text=c(g),k.attrs.x=d,k.attrs.y=e,k.attrs.w=1,k.attrs.h=1,B(k,l),h.appendChild(j),h.appendChild(i),b.canvas.appendChild(h);var m=F("skew");m.on=!0,h.appendChild(m),k.skew=m,k.transform(o);return k},a._engine.setSize=function(b,c){var d=this.canvas.style;this.width=b,this.height=c,b==+b&&(b+="px"),c==+c&&(c+="px"),d.width=b,d.height=c,d.clip="rect(0 "+b+" "+c+" 0)",this._viewBox&&a._engine.setViewBox.apply(this,this._viewBox);return this},a._engine.setViewBox=function(b,c,d,e,f){a.eve("raphael.setViewBox",this,this._viewBox,[b,c,d,e,f]);var h=this.width,i=this.height,j=1/g(d/h,e/i),k,l;f&&(k=i/e,l=h/d,d*k<h&&(b-=(h-d*k)/2/k),e*l<i&&(c-=(i-e*l)/2/l)),this._viewBox=[b,c,d,e,!!f],this._viewBoxShift={dx:-b,dy:-c,scale:j},this.forEach(function(a){a.transform("...")});return this};var F;a._engine.initWin=function(a){var b=a.document;b.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!b.namespaces.rvml&&b.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),F=function(a){return b.createElement("<rvml:"+a+' class="rvml">')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},a._engine.initWin(a._g.win),a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b.container,d=b.height,e,f=b.width,g=b.x,h=b.y;if(!c)throw new Error("VML container not found.");var i=new a._Paper,j=i.canvas=a._g.doc.createElement("div"),k=j.style;g=g||0,h=h||0,f=f||512,d=d||342,i.width=f,i.height=d,f==+f&&(f+="px"),d==+d&&(d+="px"),i.coordsize=u*1e3+n+u*1e3,i.coordorigin="0 0",i.span=a._g.doc.createElement("span"),i.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",j.appendChild(i.span),k.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",f,d),c==1?(a._g.doc.body.appendChild(j),k.left=g+"px",k.top=h+"px",k.position="absolute"):c.firstChild?c.insertBefore(j,c.firstChild):c.appendChild(j),i.renderfix=function(){};return i},a.prototype.clear=function(){a.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=a._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},a.prototype.remove=function(){a.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;return!0};var G=a.st;for(var H in E)E[b](H)&&!G[b](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}(window.Raphael)
\ No newline at end of file
... ...
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël 2.1.1 - JavaScript Vector Library │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
// └────────────────────────────────────────────────────────────────────┘ \\
(function(a){var b="0.3.4",c="hasOwnProperty",d=/[\.\/]/,e="*",f=function(){},g=function(a,b){return a-b},h,i,j={n:{}},k=function(a,b){var c=j,d=i,e=Array.prototype.slice.call(arguments,2),f=k.listeners(a),l=0,m=!1,n,o=[],p={},q=[],r=h,s=[];h=a,i=0;for(var t=0,u=f.length;t<u;t++)"zIndex"in f[t]&&(o.push(f[t].zIndex),f[t].zIndex<0&&(p[f[t].zIndex]=f[t]));o.sort(g);while(o[l]<0){n=p[o[l++]],q.push(n.apply(b,e));if(i){i=d;return q}}for(t=0;t<u;t++){n=f[t];if("zIndex"in n)if(n.zIndex==o[l]){q.push(n.apply(b,e));if(i)break;do{l++,n=p[o[l]],n&&q.push(n.apply(b,e));if(i)break}while(n)}else p[n.zIndex]=n;else{q.push(n.apply(b,e));if(i)break}}i=d,h=r;return q.length?q:null};k.listeners=function(a){var b=a.split(d),c=j,f,g,h,i,k,l,m,n,o=[c],p=[];for(i=0,k=b.length;i<k;i++){n=[];for(l=0,m=o.length;l<m;l++){c=o[l].n,g=[c[b[i]],c[e]],h=2;while(h--)f=g[h],f&&(n.push(f),p=p.concat(f.f||[]))}o=n}return p},k.on=function(a,b){var c=a.split(d),e=j;for(var g=0,h=c.length;g<h;g++)e=e.n,!e[c[g]]&&(e[c[g]]={n:{}}),e=e[c[g]];e.f=e.f||[];for(g=0,h=e.f.length;g<h;g++)if(e.f[g]==b)return f;e.f.push(b);return function(a){+a==+a&&(b.zIndex=+a)}},k.stop=function(){i=1},k.nt=function(a){if(a)return(new RegExp("(?:\\.|\\/|^)"+a+"(?:\\.|\\/|$)")).test(h);return h},k.off=k.unbind=function(a,b){var f=a.split(d),g,h,i,k,l,m,n,o=[j];for(k=0,l=f.length;k<l;k++)for(m=0;m<o.length;m+=i.length-2){i=[m,1],g=o[m].n;if(f[k]!=e)g[f[k]]&&i.push(g[f[k]]);else for(h in g)g[c](h)&&i.push(g[h]);o.splice.apply(o,i)}for(k=0,l=o.length;k<l;k++){g=o[k];while(g.n){if(b){if(g.f){for(m=0,n=g.f.length;m<n;m++)if(g.f[m]==b){g.f.splice(m,1);break}!g.f.length&&delete g.f}for(h in g.n)if(g.n[c](h)&&g.n[h].f){var p=g.n[h].f;for(m=0,n=p.length;m<n;m++)if(p[m]==b){p.splice(m,1);break}!p.length&&delete g.n[h].f}}else{delete g.f;for(h in g.n)g.n[c](h)&&g.n[h].f&&delete g.n[h].f}g=g.n}}},k.once=function(a,b){var c=function(){var d=b.apply(this,arguments);k.unbind(a,c);return d};return k.on(a,c)},k.version=b,k.toString=function(){return"You are running Eve "+b},typeof module!="undefined"&&module.exports?module.exports=k:typeof define!="undefined"?define("eve",[],function(){return k}):a.eve=k})(this),function(){function cF(a){for(var b=0;b<cy.length;b++)cy[b].el.paper==a&&cy.splice(b--,1)}function cE(b,d,e,f,h,i){e=Q(e);var j,k,l,m=[],o,p,q,t=b.ms,u={},v={},w={};if(f)for(y=0,z=cy.length;y<z;y++){var x=cy[y];if(x.el.id==d.id&&x.anim==b){x.percent!=e?(cy.splice(y,1),l=1):k=x,d.attr(x.totalOrigin);break}}else f=+v;for(var y=0,z=b.percents.length;y<z;y++){if(b.percents[y]==e||b.percents[y]>f*b.top){e=b.percents[y],p=b.percents[y-1]||0,t=t/b.top*(e-p),o=b.percents[y+1],j=b.anim[e];break}f&&d.attr(b.anim[b.percents[y]])}if(!!j){if(!k){for(var A in j)if(j[g](A))if(U[g](A)||d.paper.customAttributes[g](A)){u[A]=d.attr(A),u[A]==null&&(u[A]=T[A]),v[A]=j[A];switch(U[A]){case C:w[A]=(v[A]-u[A])/t;break;case"colour":u[A]=a.getRGB(u[A]);var B=a.getRGB(v[A]);w[A]={r:(B.r-u[A].r)/t,g:(B.g-u[A].g)/t,b:(B.b-u[A].b)/t};break;case"path":var D=bR(u[A],v[A]),E=D[1];u[A]=D[0],w[A]=[];for(y=0,z=u[A].length;y<z;y++){w[A][y]=[0];for(var F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(E[y][F]-u[A][y][F])/t}break;case"transform":var H=d._,I=ca(H[A],v[A]);if(I){u[A]=I.from,v[A]=I.to,w[A]=[],w[A].real=!0;for(y=0,z=u[A].length;y<z;y++){w[A][y]=[u[A][y][0]];for(F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(v[A][y][F]-u[A][y][F])/t}}else{var J=d.matrix||new cb,K={_:{transform:H.transform},getBBox:function(){return d.getBBox(1)}};u[A]=[J.a,J.b,J.c,J.d,J.e,J.f],b$(K,v[A]),v[A]=K._.transform,w[A]=[(K.matrix.a-J.a)/t,(K.matrix.b-J.b)/t,(K.matrix.c-J.c)/t,(K.matrix.d-J.d)/t,(K.matrix.e-J.e)/t,(K.matrix.f-J.f)/t]}break;case"csv":var L=r(j[A])[s](c),M=r(u[A])[s](c);if(A=="clip-rect"){u[A]=M,w[A]=[],y=M.length;while(y--)w[A][y]=(L[y]-u[A][y])/t}v[A]=L;break;default:L=[][n](j[A]),M=[][n](u[A]),w[A]=[],y=d.paper.customAttributes[A].length;while(y--)w[A][y]=((L[y]||0)-(M[y]||0))/t}}var O=j.easing,P=a.easing_formulas[O];if(!P){P=r(O).match(N);if(P&&P.length==5){var R=P;P=function(a){return cC(a,+R[1],+R[2],+R[3],+R[4],t)}}else P=bf}q=j.start||b.start||+(new Date),x={anim:b,percent:e,timestamp:q,start:q+(b.del||0),status:0,initstatus:f||0,stop:!1,ms:t,easing:P,from:u,diff:w,to:v,el:d,callback:j.callback,prev:p,next:o,repeat:i||b.times,origin:d.attr(),totalOrigin:h},cy.push(x);if(f&&!k&&!l){x.stop=!0,x.start=new Date-t*f;if(cy.length==1)return cA()}l&&(x.start=new Date-x.ms*f),cy.length==1&&cz(cA)}else k.initstatus=f,k.start=new Date-k.ms*f;eve("raphael.anim.start."+d.id,d,b)}}function cD(a,b){var c=[],d={};this.ms=b,this.times=1;if(a){for(var e in a)a[g](e)&&(d[Q(e)]=a[e],c.push(Q(e)));c.sort(bd)}this.anim=d,this.top=c[c.length-1],this.percents=c}function cC(a,b,c,d,e,f){function o(a,b){var c,d,e,f,j,k;for(e=a,k=0;k<8;k++){f=m(e)-a;if(z(f)<b)return e;j=(3*i*e+2*h)*e+g;if(z(j)<1e-6)break;e=e-f/j}c=0,d=1,e=a;if(e<c)return c;if(e>d)return d;while(c<d){f=m(e);if(z(f-a)<b)return e;a>f?c=e:d=e,e=(d-c)/2+c}return e}function n(a,b){var c=o(a,b);return((l*c+k)*c+j)*c}function m(a){return((i*a+h)*a+g)*a}var g=3*b,h=3*(d-b)-g,i=1-g-h,j=3*c,k=3*(e-c)-j,l=1-j-k;return n(a,1/(200*f))}function cq(){return this.x+q+this.y+q+this.width+" × "+this.height}function cp(){return this.x+q+this.y}function cb(a,b,c,d,e,f){a!=null?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function bH(b,c,d){b=a._path2curve(b),c=a._path2curve(c);var e,f,g,h,i,j,k,l,m,n,o=d?0:[];for(var p=0,q=b.length;p<q;p++){var r=b[p];if(r[0]=="M")e=i=r[1],f=j=r[2];else{r[0]=="C"?(m=[e,f].concat(r.slice(1)),e=m[6],f=m[7]):(m=[e,f,e,f,i,j,i,j],e=i,f=j);for(var s=0,t=c.length;s<t;s++){var u=c[s];if(u[0]=="M")g=k=u[1],h=l=u[2];else{u[0]=="C"?(n=[g,h].concat(u.slice(1)),g=n[6],h=n[7]):(n=[g,h,g,h,k,l,k,l],g=k,h=l);var v=bG(m,n,d);if(d)o+=v;else{for(var w=0,x=v.length;w<x;w++)v[w].segment1=p,v[w].segment2=s,v[w].bez1=m,v[w].bez2=n;o=o.concat(v)}}}}}return o}function bG(b,c,d){var e=a.bezierBBox(b),f=a.bezierBBox(c);if(!a.isBBoxIntersect(e,f))return d?0:[];var g=bB.apply(0,b),h=bB.apply(0,c),i=~~(g/5),j=~~(h/5),k=[],l=[],m={},n=d?0:[];for(var o=0;o<i+1;o++){var p=a.findDotsAtSegment.apply(a,b.concat(o/i));k.push({x:p.x,y:p.y,t:o/i})}for(o=0;o<j+1;o++)p=a.findDotsAtSegment.apply(a,c.concat(o/j)),l.push({x:p.x,y:p.y,t:o/j});for(o=0;o<i;o++)for(var q=0;q<j;q++){var r=k[o],s=k[o+1],t=l[q],u=l[q+1],v=z(s.x-r.x)<.001?"y":"x",w=z(u.x-t.x)<.001?"y":"x",x=bD(r.x,r.y,s.x,s.y,t.x,t.y,u.x,u.y);if(x){if(m[x.x.toFixed(4)]==x.y.toFixed(4))continue;m[x.x.toFixed(4)]=x.y.toFixed(4);var y=r.t+z((x[v]-r[v])/(s[v]-r[v]))*(s.t-r.t),A=t.t+z((x[w]-t[w])/(u[w]-t[w]))*(u.t-t.t);y>=0&&y<=1&&A>=0&&A<=1&&(d?n++:n.push({x:x.x,y:x.y,t1:y,t2:A}))}}return n}function bF(a,b){return bG(a,b,1)}function bE(a,b){return bG(a,b)}function bD(a,b,c,d,e,f,g,h){if(!(x(a,c)<y(e,g)||y(a,c)>x(e,g)||x(b,d)<y(f,h)||y(b,d)>x(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(!k)return;var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(n<+y(a,c).toFixed(2)||n>+x(a,c).toFixed(2)||n<+y(e,g).toFixed(2)||n>+x(e,g).toFixed(2)||o<+y(b,d).toFixed(2)||o>+x(b,d).toFixed(2)||o<+y(f,h).toFixed(2)||o>+x(f,h).toFixed(2))return;return{x:l,y:m}}}function bC(a,b,c,d,e,f,g,h,i){if(!(i<0||bB(a,b,c,d,e,f,g,h)<i)){var j=1,k=j/2,l=j-k,m,n=.01;m=bB(a,b,c,d,e,f,g,h,l);while(z(m-i)>n)k/=2,l+=(m<i?1:-1)*k,m=bB(a,b,c,d,e,f,g,h,l);return l}}function bB(a,b,c,d,e,f,g,h,i){i==null&&(i=1),i=i>1?1:i<0?0:i;var j=i/2,k=12,l=[-0.1252,.1252,-0.3678,.3678,-0.5873,.5873,-0.7699,.7699,-0.9041,.9041,-0.9816,.9816],m=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],n=0;for(var o=0;o<k;o++){var p=j*l[o]+j,q=bA(p,a,c,e,g),r=bA(p,b,d,f,h),s=q*q+r*r;n+=m[o]*w.sqrt(s)}return j*n}function bA(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function by(a,b){var c=[];for(var d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function bx(){return this.hex}function bv(a,b,c){function d(){var e=Array.prototype.slice.call(arguments,0),f=e.join("␀"),h=d.cache=d.cache||{},i=d.count=d.count||[];if(h[g](f)){bu(i,f);return c?c(h[f]):h[f]}i.length>=1e3&&delete h[i.shift()],i.push(f),h[f]=a[m](b,e);return c?c(h[f]):h[f]}return d}function bu(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function bm(a){if(Object(a)!==a)return a;var b=new a.constructor;for(var c in a)a[g](c)&&(b[c]=bm(a[c]));return b}function a(c){if(a.is(c,"function"))return b?c():eve.on("raphael.DOMload",c);if(a.is(c,E))return a._engine.create[m](a,c.splice(0,3+a.is(c[0],C))).add(c);var d=Array.prototype.slice.call(arguments,0);if(a.is(d[d.length-1],"function")){var e=d.pop();return b?e.call(a._engine.create[m](a,d)):eve.on("raphael.DOMload",function(){e.call(a._engine.create[m](a,d))})}return a._engine.create[m](a,arguments)}a.version="2.1.0",a.eve=eve;var b,c=/[, ]+/,d={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},e=/\{(\d+)\}/g,f="prototype",g="hasOwnProperty",h={doc:document,win:window},i={was:Object.prototype[g].call(h.win,"Raphael"),is:h.win.Raphael},j=function(){this.ca=this.customAttributes={}},k,l="appendChild",m="apply",n="concat",o="createTouch"in h.doc,p="",q=" ",r=String,s="split",t="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[s](q),u={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},v=r.prototype.toLowerCase,w=Math,x=w.max,y=w.min,z=w.abs,A=w.pow,B=w.PI,C="number",D="string",E="array",F="toString",G="fill",H=Object.prototype.toString,I={},J="push",K=a._ISURL=/^url\(['"]?([^\)]+?)['"]?\)$/i,L=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,M={NaN:1,Infinity:1,"-Infinity":1},N=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,O=w.round,P="setAttribute",Q=parseFloat,R=parseInt,S=r.prototype.toUpperCase,T=a._availableAttrs={"arrow-end":"none","arrow-start":"none",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/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,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",transform:"",width:0,x:0,y:0},U=a._availableAnimAttrs={blur:C,"clip-rect":"csv",cx:C,cy:C,fill:"colour","fill-opacity":C,"font-size":C,height:C,opacity:C,path:"path",r:C,rx:C,ry:C,stroke:"colour","stroke-opacity":C,"stroke-width":C,transform:"transform",width:C,x:C,y:C},V=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]/g,W=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,X={hs:1,rg:1},Y=/,?([achlmqrstvxz]),?/gi,Z=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,$=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,_=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/ig,ba=a._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,bb={},bc=function(a,b){return a.key-b.key},bd=function(a,b){return Q(a)-Q(b)},be=function(){},bf=function(a){return a},bg=a._rectPath=function(a,b,c,d,e){if(e)return[["M",a+e,b],["l",c-e*2,0],["a",e,e,0,0,1,e,e],["l",0,d-e*2],["a",e,e,0,0,1,-e,e],["l",e*2-c,0],["a",e,e,0,0,1,-e,-e],["l",0,e*2-d],["a",e,e,0,0,1,e,-e],["z"]];return[["M",a,b],["l",c,0],["l",0,d],["l",-c,0],["z"]]},bh=function(a,b,c,d){d==null&&(d=c);return[["M",a,b],["m",0,-d],["a",c,d,0,1,1,0,2*d],["a",c,d,0,1,1,0,-2*d],["z"]]},bi=a._getPath={path:function(a){return a.attr("path")},circle:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.r)},ellipse:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.rx,b.ry)},rect:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height,b.r)},image:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height)},text:function(a){var b=a._getBBox();return bg(b.x,b.y,b.width,b.height)}},bj=a.mapPath=function(a,b){if(!b)return a;var c,d,e,f,g,h,i;a=bR(a);for(e=0,g=a.length;e<g;e++){i=a[e];for(f=1,h=i.length;f<h;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d}return a};a._g=h,a.type=h.win.SVGAngle||h.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(a.type=="VML"){var bk=h.doc.createElement("div"),bl;bk.innerHTML='<v:shape adj="1"/>',bl=bk.firstChild,bl.style.behavior="url(#default#VML)";if(!bl||typeof bl.adj!="object")return a.type=p;bk=null}a.svg=!(a.vml=a.type=="VML"),a._Paper=j,a.fn=k=j.prototype=a.prototype,a._id=0,a._oid=0,a.is=function(a,b){b=v.call(b);if(b=="finite")return!M[g](+a);if(b=="array")return a instanceof Array;return b=="null"&&a===null||b==typeof a&&a!==null||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||H.call(a).slice(8,-1).toLowerCase()==b},a.angle=function(b,c,d,e,f,g){if(f==null){var h=b-d,i=c-e;if(!h&&!i)return 0;return(180+w.atan2(-i,-h)*180/B+360)%360}return a.angle(b,c,f,g)-a.angle(d,e,f,g)},a.rad=function(a){return a%360*B/180},a.deg=function(a){return a*180/B%360},a.snapTo=function(b,c,d){d=a.is(d,"finite")?d:10;if(a.is(b,E)){var e=b.length;while(e--)if(z(b[e]-c)<=d)return b[e]}else{b=+b;var f=c%b;if(f<d)return c-f;if(f>b-d)return c-f+b}return c};var bn=a.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=w.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)});a.setWindow=function(b){eve("raphael.setWindow",a,h.win,b),h.win=b,h.doc=h.win.document,a._engine.initWin&&a._engine.initWin(h.win)};var bo=function(b){if(a.vml){var c=/^\s+|\s+$/g,d;try{var e=new ActiveXObject("htmlfile");e.write("<body>"),e.close(),d=e.body}catch(f){d=createPopup().document.body}var g=d.createTextRange();bo=bv(function(a){try{d.style.color=r(a).replace(c,p);var b=g.queryCommandValue("ForeColor");b=(b&255)<<16|b&65280|(b&16711680)>>>16;return"#"+("000000"+b.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=h.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",h.doc.body.appendChild(i),bo=bv(function(a){i.style.color=a;return h.doc.defaultView.getComputedStyle(i,p).getPropertyValue("color")})}return bo(b)},bp=function(){return"hsb("+[this.h,this.s,this.b]+")"},bq=function(){return"hsl("+[this.h,this.s,this.l]+")"},br=function(){return this.hex},bs=function(b,c,d){c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b&&(d=b.b,c=b.g,b=b.r);if(c==null&&a.is(b,D)){var e=a.getRGB(b);b=e.r,c=e.g,d=e.b}if(b>1||c>1||d>1)b/=255,c/=255,d/=255;return[b,c,d]},bt=function(b,c,d,e){b*=255,c*=255,d*=255;var f={r:b,g:c,b:d,hex:a.rgb(b,c,d),toString:br};a.is(e,"finite")&&(f.opacity=e);return f};a.color=function(b){var c;a.is(b,"object")&&"h"in b&&"s"in b&&"b"in b?(c=a.hsb2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):a.is(b,"object")&&"h"in b&&"s"in b&&"l"in b?(c=a.hsl2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):(a.is(b,"string")&&(b=a.getRGB(b)),a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b?(c=a.rgb2hsl(b),b.h=c.h,b.s=c.s,b.l=c.l,c=a.rgb2hsb(b),b.v=c.b):(b={hex:"none"},b.r=b.g=b.b=b.h=b.s=b.v=b.l=-1)),b.toString=br;return b},a.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h,d=a.o),a*=360;var e,f,g,h,i;a=a%360/60,i=c*b,h=i*(1-z(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.hsl2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"l"in a&&(c=a.l,b=a.s,a=a.h);if(a>1||b>1||c>1)a/=360,b/=100,c/=100;a*=360;var e,f,g,h,i;a=a%360/60,i=2*b*(c<.5?c:1-c),h=i*(1-z(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.rgb2hsb=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;f=x(a,b,c),g=f-y(a,b,c),d=g==0?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=(d+360)%6*60/360,e=g==0?0:g/f;return{h:d,s:e,b:f,toString:bp}},a.rgb2hsl=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;g=x(a,b,c),h=y(a,b,c),i=g-h,d=i==0?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=(d+360)%6*60/360,f=(g+h)/2,e=i==0?0:f<.5?i/(2*f):i/(2-2*f);return{h:d,s:e,l:f,toString:bq}},a._path2string=function(){return this.join(",").replace(Y,"$1")};var bw=a._preload=function(a,b){var c=h.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,h.doc.body.removeChild(this)},c.onerror=function(){h.doc.body.removeChild(this)},h.doc.body.appendChild(c),c.src=a};a.getRGB=bv(function(b){if(!b||!!((b=r(b)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx};if(b=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:bx};!X[g](b.toLowerCase().substring(0,2))&&b.charAt()!="#"&&(b=bo(b));var c,d,e,f,h,i,j,k=b.match(L);if(k){k[2]&&(f=R(k[2].substring(5),16),e=R(k[2].substring(3,5),16),d=R(k[2].substring(1,3),16)),k[3]&&(f=R((i=k[3].charAt(3))+i,16),e=R((i=k[3].charAt(2))+i,16),d=R((i=k[3].charAt(1))+i,16)),k[4]&&(j=k[4][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),k[1].toLowerCase().slice(0,4)=="rgba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100));if(k[5]){j=k[5][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsb2rgb(d,e,f,h)}if(k[6]){j=k[6][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsla"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsl2rgb(d,e,f,h)}k={r:d,g:e,b:f,toString:bx},k.hex="#"+(16777216|f|e<<8|d<<16).toString(16).slice(1),a.is(h,"finite")&&(k.opacity=h);return k}return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx}},a),a.hsb=bv(function(b,c,d){return a.hsb2rgb(b,c,d).hex}),a.hsl=bv(function(b,c,d){return a.hsl2rgb(b,c,d).hex}),a.rgb=bv(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)}),a.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b}));return c.hex},a.getColor.reset=function(){delete this.start},a.parsePathString=function(b){if(!b)return null;var c=bz(b);if(c.arr)return bJ(c.arr);var d={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},e=[];a.is(b,E)&&a.is(b[0],E)&&(e=bJ(b)),e.length||r(b).replace(Z,function(a,b,c){var f=[],g=b.toLowerCase();c.replace(_,function(a,b){b&&f.push(+b)}),g=="m"&&f.length>2&&(e.push([b][n](f.splice(0,2))),g="l",b=b=="m"?"l":"L");if(g=="r")e.push([b][n](f));else while(f.length>=d[g]){e.push([b][n](f.splice(0,d[g])));if(!d[g])break}}),e.toString=a._path2string,c.arr=bJ(e);return e},a.parseTransformString=bv(function(b){if(!b)return null;var c={r:3,s:4,t:2,m:6},d=[];a.is(b,E)&&a.is(b[0],E)&&(d=bJ(b)),d.length||r(b).replace($,function(a,b,c){var e=[],f=v.call(b);c.replace(_,function(a,b){b&&e.push(+b)}),d.push([b][n](e))}),d.toString=a._path2string;return d});var bz=function(a){var b=bz.ps=bz.ps||{};b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[g](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])});return b[a]};a.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=A(j,3),l=A(j,2),m=i*i,n=m*i,o=k*a+l*3*i*c+j*3*i*i*e+n*g,p=k*b+l*3*i*d+j*3*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,x=j*e+i*g,y=j*f+i*h,z=90-w.atan2(q-s,r-t)*180/B;(q>s||r<t)&&(z+=180);return{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:x,y:y},alpha:z}},a.bezierBBox=function(b,c,d,e,f,g,h,i){a.is(b,"array")||(b=[b,c,d,e,f,g,h,i]);var j=bQ.apply(null,b);return{x:j.min.x,y:j.min.y,x2:j.max.x,y2:j.max.y,width:j.max.x-j.min.x,height:j.max.y-j.min.y}},a.isPointInsideBBox=function(a,b,c){return b>=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2},a.isBBoxIntersect=function(b,c){var d=a.isPointInsideBBox;return d(c,b.x,b.y)||d(c,b.x2,b.y)||d(c,b.x,b.y2)||d(c,b.x2,b.y2)||d(b,c.x,c.y)||d(b,c.x2,c.y)||d(b,c.x,c.y2)||d(b,c.x2,c.y2)||(b.x<c.x2&&b.x>c.x||c.x<b.x2&&c.x>b.x)&&(b.y<c.y2&&b.y>c.y||c.y<b.y2&&c.y>b.y)},a.pathIntersection=function(a,b){return bH(a,b)},a.pathIntersectionNumber=function(a,b){return bH(a,b,1)},a.isPointInsidePath=function(b,c,d){var e=a.pathBBox(b);return a.isPointInsideBBox(e,c,d)&&bH(b,[["M",c,d],["H",e.x2+10]],1)%2==1},a._removedFactory=function(a){return function(){eve("raphael.log",null,"Raphaël: you are calling to method “"+a+"” of removed object",a)}};var bI=a.pathBBox=function(a){var b=bz(a);if(b.bbox)return bm(b.bbox);if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=bR(a);var c=0,d=0,e=[],f=[],g;for(var h=0,i=a.length;h<i;h++){g=a[h];if(g[0]=="M")c=g[1],d=g[2],e.push(c),f.push(d);else{var j=bQ(c,d,g[1],g[2],g[3],g[4],g[5],g[6]);e=e[n](j.min.x,j.max.x),f=f[n](j.min.y,j.max.y),c=g[5],d=g[6]}}var k=y[m](0,e),l=y[m](0,f),o=x[m](0,e),p=x[m](0,f),q={x:k,y:l,x2:o,y2:p,width:o-k,height:p-l};b.bbox=bm(q);return q},bJ=function(b){var c=bm(b);c.toString=a._path2string;return c},bK=a._pathToRelative=function(b){var c=bz(b);if(c.rel)return bJ(c.rel);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=b[0][1],f=b[0][2],g=e,h=f,i++,d.push(["M",e,f]));for(var j=i,k=b.length;j<k;j++){var l=d[j]=[],m=b[j];if(m[0]!=v.call(m[0])){l[0]=v.call(m[0]);switch(l[0]){case"a":l[1]=m[1],l[2]=m[2],l[3]=m[3],l[4]=m[4],l[5]=m[5],l[6]=+(m[6]-e).toFixed(3),l[7]=+(m[7]-f).toFixed(3);break;case"v":l[1]=+(m[1]-f).toFixed(3);break;case"m":g=m[1],h=m[2];default:for(var n=1,o=m.length;n<o;n++)l[n]=+(m[n]-(n%2?e:f)).toFixed(3)}}else{l=d[j]=[],m[0]=="m"&&(g=m[1]+e,h=m[2]+f);for(var p=0,q=m.length;p<q;p++)d[j][p]=m[p]}var r=d[j].length;switch(d[j][0]){case"z":e=g,f=h;break;case"h":e+=+d[j][r-1];break;case"v":f+=+d[j][r-1];break;default:e+=+d[j][r-2],f+=+d[j][r-1]}}d.toString=a._path2string,c.rel=bJ(d);return d},bL=a._pathToAbsolute=function(b){var c=bz(b);if(c.abs)return bJ(c.abs);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);if(!b||!b.length)return[["M",0,0]];var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=+b[0][1],f=+b[0][2],g=e,h=f,i++,d[0]=["M",e,f]);var j=b.length==3&&b[0][0]=="M"&&b[1][0].toUpperCase()=="R"&&b[2][0].toUpperCase()=="Z";for(var k,l,m=i,o=b.length;m<o;m++){d.push(k=[]),l=b[m];if(l[0]!=S.call(l[0])){k[0]=S.call(l[0]);switch(k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+e),k[7]=+(l[7]+f);break;case"V":k[1]=+l[1]+f;break;case"H":k[1]=+l[1]+e;break;case"R":var p=[e,f][n](l.slice(1));for(var q=2,r=p.length;q<r;q++)p[q]=+p[q]+e,p[++q]=+p[q]+f;d.pop(),d=d[n](by(p,j));break;case"M":g=+l[1]+e,h=+l[2]+f;default:for(q=1,r=l.length;q<r;q++)k[q]=+l[q]+(q%2?e:f)}}else if(l[0]=="R")p=[e,f][n](l.slice(1)),d.pop(),d=d[n](by(p,j)),k=["R"][n](l.slice(-2));else for(var s=0,t=l.length;s<t;s++)k[s]=l[s];switch(k[0]){case"Z":e=g,f=h;break;case"H":e=k[1];break;case"V":f=k[1];break;case"M":g=k[k.length-2],h=k[k.length-1];default:e=k[k.length-2],f=k[k.length-1]}}d.toString=a._path2string,c.abs=bJ(d);return d},bM=function(a,b,c,d){return[a,b,c,d,c,d]},bN=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},bO=function(a,b,c,d,e,f,g,h,i,j){var k=B*120/180,l=B/180*(+e||0),m=[],o,p=bv(function(a,b,c){var d=a*w.cos(c)-b*w.sin(c),e=a*w.sin(c)+b*w.cos(c);return{x:d,y:e}});if(!j){o=p(a,b,-l),a=o.x,b=o.y,o=p(h,i,-l),h=o.x,i=o.y;var q=w.cos(B/180*e),r=w.sin(B/180*e),t=(a-h)/2,u=(b-i)/2,v=t*t/(c*c)+u*u/(d*d);v>1&&(v=w.sqrt(v),c=v*c,d=v*d);var x=c*c,y=d*d,A=(f==g?-1:1)*w.sqrt(z((x*y-x*u*u-y*t*t)/(x*u*u+y*t*t))),C=A*c*u/d+(a+h)/2,D=A*-d*t/c+(b+i)/2,E=w.asin(((b-D)/d).toFixed(9)),F=w.asin(((i-D)/d).toFixed(9));E=a<C?B-E:E,F=h<C?B-F:F,E<0&&(E=B*2+E),F<0&&(F=B*2+F),g&&E>F&&(E=E-B*2),!g&&F>E&&(F=F-B*2)}else E=j[0],F=j[1],C=j[2],D=j[3];var G=F-E;if(z(G)>k){var H=F,I=h,J=i;F=E+k*(g&&F>E?1:-1),h=C+c*w.cos(F),i=D+d*w.sin(F),m=bO(h,i,c,d,e,0,g,I,J,[F,H,C,D])}G=F-E;var K=w.cos(E),L=w.sin(E),M=w.cos(F),N=w.sin(F),O=w.tan(G/4),P=4/3*c*O,Q=4/3*d*O,R=[a,b],S=[a+P*L,b-Q*K],T=[h+P*N,i-Q*M],U=[h,i];S[0]=2*R[0]-S[0],S[1]=2*R[1]-S[1];if(j)return[S,T,U][n](m);m=[S,T,U][n](m).join()[s](",");var V=[];for(var W=0,X=m.length;W<X;W++)V[W]=W%2?p(m[W-1],m[W],l).y:p(m[W],m[W+1],l).x;return V},bP=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:A(j,3)*a+A(j,2)*3*i*c+j*3*i*i*e+A(i,3)*g,y:A(j,3)*b+A(j,2)*3*i*d+j*3*i*i*f+A(i,3)*h}},bQ=bv(function(a,b,c,d,e,f,g,h){var i=e-2*c+a-(g-2*e+c),j=2*(c-a)-2*(e-c),k=a-c,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,o=[b,h],p=[a,g],q;z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y)),i=f-2*d+b-(h-2*f+d),j=2*(d-b)-2*(f-d),k=b-d,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y));return{min:{x:y[m](0,p),y:y[m](0,o)},max:{x:x[m](0,p),y:x[m](0,o)}}}),bR=a._path2curve=bv(function(a,b){var c=!b&&bz(a);if(!b&&c.curve)return bJ(c.curve);var d=bL(a),e=b&&bL(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][n](bO[m](0,[b.x,b.y][n](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x)),d=b.y+(b.y-(b.by||b.y)),a=["C",c,d][n](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.x)),b.qy=b.y+(b.y-(b.qy||b.y)),a=["C"][n](bN(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][n](bN(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][n](bM(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][n](bM(b.x,b.y,a[1],b.y));break;case"V":a=["C"][n](bM(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][n](bM(b.x,b.y,b.X,b.Y))}return a},i=function(a,b){if(a[b].length>7){a[b].shift();var c=a[b];while(c.length)a.splice(b++,0,["C"][n](c.splice(0,6)));a.splice(b,1),l=x(d.length,e&&e.length||0)}},j=function(a,b,c,f,g){a&&b&&a[g][0]=="M"&&b[g][0]!="M"&&(b.splice(g,0,["M",f.x,f.y]),c.bx=0,c.by=0,c.x=a[g][1],c.y=a[g][2],l=x(d.length,e&&e.length||0))};for(var k=0,l=x(d.length,e&&e.length||0);k<l;k++){d[k]=h(d[k],f),i(d,k),e&&(e[k]=h(e[k],g)),e&&i(e,k),j(d,e,f,g,k),j(e,d,g,f,k);var o=d[k],p=e&&e[k],q=o.length,r=e&&p.length;f.x=o[q-2],f.y=o[q-1],f.bx=Q(o[q-4])||f.x,f.by=Q(o[q-3])||f.y,g.bx=e&&(Q(p[r-4])||g.x),g.by=e&&(Q(p[r-3])||g.y),g.x=e&&p[r-2],g.y=e&&p[r-1]}e||(c.curve=bJ(d));return e?[d,e]:d},null,bJ),bS=a._parseDots=bv(function(b){var c=[];for(var d=0,e=b.length;d<e;d++){var f={},g=b[d].match(/^([^:]*):?([\d\.]*)/);f.color=a.getRGB(g[1]);if(f.color.error)return null;f.color=f.color.hex,g[2]&&(f.offset=g[2]+"%"),c.push(f)}for(d=1,e=c.length-1;d<e;d++)if(!c[d].offset){var h=Q(c[d-1].offset||0),i=0;for(var j=d+1;j<e;j++)if(c[j].offset){i=c[j].offset;break}i||(i=100,j=e),i=Q(i);var k=(i-h)/(j-d+1);for(;d<j;d++)h+=k,c[d].offset=h+"%"}return c}),bT=a._tear=function(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)},bU=a._tofront=function(a,b){b.top!==a&&(bT(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a)},bV=a._toback=function(a,b){b.bottom!==a&&(bT(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a)},bW=a._insertafter=function(a,b,c){bT(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},bX=a._insertbefore=function(a,b,c){bT(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},bY=a.toMatrix=function(a,b){var c=bI(a),d={_:{transform:p},getBBox:function(){return c}};b$(d,b);return d.matrix},bZ=a.transformPath=function(a,b){return bj(a,bY(a,b))},b$=a._extractTransform=function(b,c){if(c==null)return b._.transform;c=r(c).replace(/\.{3}|\u2026/g,b._.transform||p);var d=a.parseTransformString(c),e=0,f=0,g=0,h=1,i=1,j=b._,k=new cb;j.transform=d||[];if(d)for(var l=0,m=d.length;l<m;l++){var n=d[l],o=n.length,q=r(n[0]).toLowerCase(),s=n[0]!=q,t=s?k.invert():0,u,v,w,x,y;q=="t"&&o==3?s?(u=t.x(0,0),v=t.y(0,0),w=t.x(n[1],n[2]),x=t.y(n[1],n[2]),k.translate(w-u,x-v)):k.translate(n[1],n[2]):q=="r"?o==2?(y=y||b.getBBox(1),k.rotate(n[1],y.x+y.width/2,y.y+y.height/2),e+=n[1]):o==4&&(s?(w=t.x(n[2],n[3]),x=t.y(n[2],n[3]),k.rotate(n[1],w,x)):k.rotate(n[1],n[2],n[3]),e+=n[1]):q=="s"?o==2||o==3?(y=y||b.getBBox(1),k.scale(n[1],n[o-1],y.x+y.width/2,y.y+y.height/2),h*=n[1],i*=n[o-1]):o==5&&(s?(w=t.x(n[3],n[4]),x=t.y(n[3],n[4]),k.scale(n[1],n[2],w,x)):k.scale(n[1],n[2],n[3],n[4]),h*=n[1],i*=n[2]):q=="m"&&o==7&&k.add(n[1],n[2],n[3],n[4],n[5],n[6]),j.dirtyT=1,b.matrix=k}b.matrix=k,j.sx=h,j.sy=i,j.deg=e,j.dx=f=k.e,j.dy=g=k.f,h==1&&i==1&&!e&&j.bbox?(j.bbox.x+=+f,j.bbox.y+=+g):j.dirtyT=1},b_=function(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return a.length==4?[b,0,a[2],a[3]]:[b,0];case"s":return a.length==5?[b,1,1,a[3],a[4]]:a.length==3?[b,1,1]:[b,1]}},ca=a._equaliseTransform=function(b,c){c=r(c).replace(/\.{3}|\u2026/g,b),b=a.parseTransformString(b)||[],c=a.parseTransformString(c)||[];var d=x(b.length,c.length),e=[],f=[],g=0,h,i,j,k;for(;g<d;g++){j=b[g]||b_(c[g]),k=c[g]||b_(j);if(j[0]!=k[0]||j[0].toLowerCase()=="r"&&(j[2]!=k[2]||j[3]!=k[3])||j[0].toLowerCase()=="s"&&(j[3]!=k[3]||j[4]!=k[4]))return;e[g]=[],f[g]=[];for(h=0,i=x(j.length,k.length);h<i;h++)h in j&&(e[g][h]=j[h]),h in k&&(f[g][h]=k[h])}return{from:e,to:f}};a._getContainer=function(b,c,d,e){var f;f=e==null&&!a.is(b,"object")?h.doc.getElementById(b):b;if(f!=null){if(f.tagName)return c==null?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:c,height:d};return{container:1,x:b,y:c,width:d,height:e}}},a.pathToRelative=bK,a._engine={},a.path2curve=bR,a.matrix=function(a,b,c,d,e,f){return new cb(a,b,c,d,e,f)},function(b){function d(a){var b=w.sqrt(c(a));a[0]&&(a[0]/=b),a[1]&&(a[1]/=b)}function c(a){return a[0]*a[0]+a[1]*a[1]}b.add=function(a,b,c,d,e,f){var g=[[],[],[]],h=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],i=[[a,c,e],[b,d,f],[0,0,1]],j,k,l,m;a&&a instanceof cb&&(i=[[a.a,a.c,a.e],[a.b,a.d,a.f],[0,0,1]]);for(j=0;j<3;j++)for(k=0;k<3;k++){m=0;for(l=0;l<3;l++)m+=h[j][l]*i[l][k];g[j][k]=m}this.a=g[0][0],this.b=g[1][0],this.c=g[0][1],this.d=g[1][1],this.e=g[0][2],this.f=g[1][2]},b.invert=function(){var a=this,b=a.a*a.d-a.b*a.c;return new cb(a.d/b,-a.b/b,-a.c/b,a.a/b,(a.c*a.f-a.d*a.e)/b,(a.b*a.e-a.a*a.f)/b)},b.clone=function(){return new cb(this.a,this.b,this.c,this.d,this.e,this.f)},b.translate=function(a,b){this.add(1,0,0,1,a,b)},b.scale=function(a,b,c,d){b==null&&(b=a),(c||d)&&this.add(1,0,0,1,c,d),this.add(a,0,0,b,0,0),(c||d)&&this.add(1,0,0,1,-c,-d)},b.rotate=function(b,c,d){b=a.rad(b),c=c||0,d=d||0;var e=+w.cos(b).toFixed(9),f=+w.sin(b).toFixed(9);this.add(e,f,-f,e,c,d),this.add(1,0,0,1,-c,-d)},b.x=function(a,b){return a*this.a+b*this.c+this.e},b.y=function(a,b){return a*this.b+b*this.d+this.f},b.get=function(a){return+this[r.fromCharCode(97+a)].toFixed(4)},b.toString=function(){return a.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},b.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},b.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},b.split=function(){var b={};b.dx=this.e,b.dy=this.f;var e=[[this.a,this.c],[this.b,this.d]];b.scalex=w.sqrt(c(e[0])),d(e[0]),b.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*b.shear,e[1][1]-e[0][1]*b.shear],b.scaley=w.sqrt(c(e[1])),d(e[1]),b.shear/=b.scaley;var f=-e[0][1],g=e[1][1];g<0?(b.rotate=a.deg(w.acos(g)),f<0&&(b.rotate=360-b.rotate)):b.rotate=a.deg(w.asin(f)),b.isSimple=!+b.shear.toFixed(9)&&(b.scalex.toFixed(9)==b.scaley.toFixed(9)||!b.rotate),b.isSuperSimple=!+b.shear.toFixed(9)&&b.scalex.toFixed(9)==b.scaley.toFixed(9)&&!b.rotate,b.noRotation=!+b.shear.toFixed(9)&&!b.rotate;return b},b.toTransformString=function(a){var b=a||this[s]();if(b.isSimple){b.scalex=+b.scalex.toFixed(4),b.scaley=+b.scaley.toFixed(4),b.rotate=+b.rotate.toFixed(4);return(b.dx||b.dy?"t"+[b.dx,b.dy]:p)+(b.scalex!=1||b.scaley!=1?"s"+[b.scalex,b.scaley,0,0]:p)+(b.rotate?"r"+[b.rotate,0,0]:p)}return"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(cb.prototype);var cc=navigator.userAgent.match(/Version\/(.*?)\s/)||navigator.userAgent.match(/Chrome\/(\d+)/);navigator.vendor=="Apple Computer, Inc."&&(cc&&cc[1]<4||navigator.platform.slice(0,2)=="iP")||navigator.vendor=="Google Inc."&&cc&&cc[1]<8?k.safari=function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});setTimeout(function(){a.remove()})}:k.safari=be;var cd=function(){this.returnValue=!1},ce=function(){return this.originalEvent.preventDefault()},cf=function(){this.cancelBubble=!0},cg=function(){return this.originalEvent.stopPropagation()},ch=function(){if(h.doc.addEventListener)return function(a,b,c,d){var e=o&&u[b]?u[b]:b,f=function(e){var f=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,i=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,j=e.clientX+i,k=e.clientY+f;if(o&&u[g](b))for(var l=0,m=e.targetTouches&&e.targetTouches.length;l<m;l++)if(e.targetTouches[l].target==a){var n=e;e=e.targetTouches[l],e.originalEvent=n,e.preventDefault=ce,e.stopPropagation=cg;break}return c.call(d,e,j,k)};a.addEventListener(e,f,!1);return function(){a.removeEventListener(e,f,!1);return!0}};if(h.doc.attachEvent)return function(a,b,c,d){var e=function(a){a=a||h.win.event;var b=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f=a.clientX+e,g=a.clientY+b;a.preventDefault=a.preventDefault||cd,a.stopPropagation=a.stopPropagation||cf;return c.call(d,a,f,g)};a.attachEvent("on"+b,e);var f=function(){a.detachEvent("on"+b,e);return!0};return f}}(),ci=[],cj=function(a){var b=a.clientX,c=a.clientY,d=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f,g=ci.length;while(g--){f=ci[g];if(o){var i=a.touches.length,j;while(i--){j=a.touches[i];if(j.identifier==f.el._drag.id){b=j.clientX,c=j.clientY,(a.originalEvent?a.originalEvent:a).preventDefault();break}}}else a.preventDefault();var k=f.el.node,l,m=k.nextSibling,n=k.parentNode,p=k.style.display;h.win.opera&&n.removeChild(k),k.style.display="none",l=f.el.paper.getElementByPoint(b,c),k.style.display=p,h.win.opera&&(m?n.insertBefore(k,m):n.appendChild(k)),l&&eve("raphael.drag.over."+f.el.id,f.el,l),b+=e,c+=d,eve("raphael.drag.move."+f.el.id,f.move_scope||f.el,b-f.el._drag.x,c-f.el._drag.y,b,c,a)}},ck=function(b){a.unmousemove(cj).unmouseup(ck);var c=ci.length,d;while(c--)d=ci[c],d.el._drag={},eve("raphael.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,b);ci=[]},cl=a.el={};for(var cm=t.length;cm--;)(function(b){a[b]=cl[b]=function(c,d){a.is(c,"function")&&(this.events=this.events||[],this.events.push({name:b,f:c,unbind:ch(this.shape||this.node||h.doc,b,c,d||this)}));return this},a["un"+b]=cl["un"+b]=function(a){var c=this.events||[],d=c.length;while(d--)if(c[d].name==b&&c[d].f==a){c[d].unbind(),c.splice(d,1),!c.length&&delete this.events;return this}return this}})(t[cm]);cl.data=function(b,c){var d=bb[this.id]=bb[this.id]||{};if(arguments.length==1){if(a.is(b,"object")){for(var e in b)b[g](e)&&this.data(e,b[e]);return this}eve("raphael.data.get."+this.id,this,d[b],b);return d[b]}d[b]=c,eve("raphael.data.set."+this.id,this,c,b);return this},cl.removeData=function(a){a==null?bb[this.id]={}:bb[this.id]&&delete bb[this.id][a];return this},cl.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},cl.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var cn=[];cl.drag=function(b,c,d,e,f,g){function i(i){(i.originalEvent||i).preventDefault();var j=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,k=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft;this._drag.x=i.clientX+k,this._drag.y=i.clientY+j,this._drag.id=i.identifier,!ci.length&&a.mousemove(cj).mouseup(ck),ci.push({el:this,move_scope:e,start_scope:f,end_scope:g}),c&&eve.on("raphael.drag.start."+this.id,c),b&&eve.on("raphael.drag.move."+this.id,b),d&&eve.on("raphael.drag.end."+this.id,d),eve("raphael.drag.start."+this.id,f||e||this,i.clientX+k,i.clientY+j,i)}this._drag={},cn.push({el:this,start:i}),this.mousedown(i);return this},cl.onDragOver=function(a){a?eve.on("raphael.drag.over."+this.id,a):eve.unbind("raphael.drag.over."+this.id)},cl.undrag=function(){var b=cn.length;while(b--)cn[b].el==this&&(this.unmousedown(cn[b].start),cn.splice(b,1),eve.unbind("raphael.drag.*."+this.id));!cn.length&&a.unmousemove(cj).unmouseup(ck)},k.circle=function(b,c,d){var e=a._engine.circle(this,b||0,c||0,d||0);this.__set__&&this.__set__.push(e);return e},k.rect=function(b,c,d,e,f){var g=a._engine.rect(this,b||0,c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.ellipse=function(b,c,d,e){var f=a._engine.ellipse(this,b||0,c||0,d||0,e||0);this.__set__&&this.__set__.push(f);return f},k.path=function(b){b&&!a.is(b,D)&&!a.is(b[0],E)&&(b+=p);var c=a._engine.path(a.format[m](a,arguments),this);this.__set__&&this.__set__.push(c);return c},k.image=function(b,c,d,e,f){var g=a._engine.image(this,b||"about:blank",c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.text=function(b,c,d){var e=a._engine.text(this,b||0,c||0,r(d));this.__set__&&this.__set__.push(e);return e},k.set=function(b){!a.is(b,"array")&&(b=Array.prototype.splice.call(arguments,0,arguments.length));var c=new cG(b);this.__set__&&this.__set__.push(c);return c},k.setStart=function(a){this.__set__=a||this.set()},k.setFinish=function(a){var b=this.__set__;delete this.__set__;return b},k.setSize=function(b,c){return a._engine.setSize.call(this,b,c)},k.setViewBox=function(b,c,d,e,f){return a._engine.setViewBox.call(this,b,c,d,e,f)},k.top=k.bottom=null,k.raphael=a;var co=function(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.body,e=c.documentElement,f=e.clientTop||d.clientTop||0,g=e.clientLeft||d.clientLeft||0,i=b.top+(h.win.pageYOffset||e.scrollTop||d.scrollTop)-f,j=b.left+(h.win.pageXOffset||e.scrollLeft||d.scrollLeft)-g;return{y:i,x:j}};k.getElementByPoint=function(a,b){var c=this,d=c.canvas,e=h.doc.elementFromPoint(a,b);if(h.win.opera&&e.tagName=="svg"){var f=co(d),g=d.createSVGRect();g.x=a-f.x,g.y=b-f.y,g.width=g.height=1;var i=d.getIntersectionList(g,null);i.length&&(e=i[i.length-1])}if(!e)return null;while(e.parentNode&&e!=d.parentNode&&!e.raphael)e=e.parentNode;e==c.canvas.parentNode&&(e=d),e=e&&e.raphael?c.getById(e.raphaelid):null;return e},k.getById=function(a){var b=this.bottom;while(b){if(b.id==a)return b;b=b.next}return null},k.forEach=function(a,b){var c=this.bottom;while(c){if(a.call(b,c)===!1)return this;c=c.next}return this},k.getElementsByPoint=function(a,b){var c=this.set();this.forEach(function(d){d.isPointInside(a,b)&&c.push(d)});return c},cl.isPointInside=function(b,c){var d=this.realPath=this.realPath||bi[this.type](this);return a.isPointInsidePath(d,b,c)},cl.getBBox=function(a){if(this.removed)return{};var b=this._;if(a){if(b.dirty||!b.bboxwt)this.realPath=bi[this.type](this),b.bboxwt=bI(this.realPath),b.bboxwt.toString=cq,b.dirty=0;return bm(b.bboxwt)}if(b.dirty||b.dirtyT||!b.bbox){if(b.dirty||!this.realPath)b.bboxwt=0,this.realPath=bi[this.type](this);b.bbox=bI(bj(this.realPath,this.matrix)),b.bbox.toString=cq,b.dirty=b.dirtyT=0}return bm(b.bbox)},cl.getBBoxWOTransform=function(){return this.getBBox(1)},cl.clone=function(){if(this.removed)return null;var a=this.paper[this.type]().attr(this.attr());this.__set__&&this.__set__.push(a);return a},cl.glow=function(a){if(this.type=="text")return null;a=a||{};var b={width:(a.width||10)+(+this.attr("stroke-width")||1),fill:a.fill||!1,opacity:a.opacity||.5,offsetx:a.offsetx||0,offsety:a.offsety||0,color:a.color||"#000"},c=b.width/2,d=this.paper,e=d.set(),f=this.realPath||bi[this.type](this);f=this.matrix?bj(f,this.matrix):f;for(var g=1;g<c+1;g++)e.push(d.path(f).attr({stroke:b.color,fill:b.fill?b.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(b.width/c*g).toFixed(3),opacity:+(b.opacity/c).toFixed(3)}));return e.insertBefore(this).translate(b.offsetx,b.offsety)};var cr={},cs=function(b,c,d,e,f,g,h,i,j){return j==null?bB(b,c,d,e,f,g,h,i):a.findDotsAtSegment(b,c,d,e,f,g,h,i,bC(b,c,d,e,f,g,h,i,j))},ct=function(b,c){return function(d,e,f){d=bR(d);var g,h,i,j,k="",l={},m,n=0;for(var o=0,p=d.length;o<p;o++){i=d[o];if(i[0]=="M")g=+i[1],h=+i[2];else{j=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6]);if(n+j>e){if(c&&!l.start){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),k+=["C"+m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k,k=["M"+m.x,m.y+"C"+m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!b&&!c){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j,g=+i[5],h=+i[6]}k+=i.shift()+i}l.end=k,m=b?n:c?l:a.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},cu=ct(1),cv=ct(),cw=ct(0,1);a.getTotalLength=cu,a.getPointAtLength=cv,a.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return cw(a,b).end;var d=cw(a,c,1);return b?cw(d,b).end:d},cl.getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return cu(this.attrs.path)}},cl.getPointAtLength=function(a){if(this.type=="path")return cv(this.attrs.path,a)},cl.getSubpath=function(b,c){if(this.type=="path")return a.getSubpath(this.attrs.path,b,c)};var cx=a.easing_formulas={linear:function(a){return a},"<":function(a){return A(a,1.7)},">":function(a){return A(a,.48)},"<>":function(a){var b=.48-a/1.04,c=w.sqrt(.1734+b*b),d=c-b,e=A(z(d),1/3)*(d<0?-1:1),f=-c-b,g=A(z(f),1/3)*(f<0?-1:1),h=e+g+.5;return(1-h)*3*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==!!a)return a;return A(2,-10*a)*w.sin((a-.075)*2*B/.3)+1},bounce:function(a){var b=7.5625,c=2.75,d;a<1/c?d=b*a*a:a<2/c?(a-=1.5/c,d=b*a*a+.75):a<2.5/c?(a-=2.25/c,d=b*a*a+.9375):(a-=2.625/c,d=b*a*a+.984375);return d}};cx.easeIn=cx["ease-in"]=cx["<"],cx.easeOut=cx["ease-out"]=cx[">"],cx.easeInOut=cx["ease-in-out"]=cx["<>"],cx["back-in"]=cx.backIn,cx["back-out"]=cx.backOut;var cy=[],cz=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},cA=function(){var b=+(new Date),c=0;for(;c<cy.length;c++){var d=cy[c];if(d.el.removed||d.paused)continue;var e=b-d.start,f=d.ms,h=d.easing,i=d.from,j=d.diff,k=d.to,l=d.t,m=d.el,o={},p,r={},s;d.initstatus?(e=(d.initstatus*d.anim.top-d.prev)/(d.percent-d.prev)*f,d.status=d.initstatus,delete d.initstatus,d.stop&&cy.splice(c--,1)):d.status=(d.prev+(d.percent-d.prev)*(e/f))/d.anim.top;if(e<0)continue;if(e<f){var t=h(e/f);for(var u in i)if(i[g](u)){switch(U[u]){case C:p=+i[u]+t*f*j[u];break;case"colour":p="rgb("+[cB(O(i[u].r+t*f*j[u].r)),cB(O(i[u].g+t*f*j[u].g)),cB(O(i[u].b+t*f*j[u].b))].join(",")+")";break;case"path":p=[];for(var v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(var x=1,y=i[u][v].length;x<y;x++)p[v][x]=+i[u][v][x]+t*f*j[u][v][x];p[v]=p[v].join(q)}p=p.join(q);break;case"transform":if(j[u].real){p=[];for(v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(x=1,y=i[u][v].length;x<y;x++)p[v][x]=i[u][v][x]+t*f*j[u][v][x]}}else{var z=function(a){return+i[u][a]+t*f*j[u][a]};p=[["m",z(0),z(1),z(2),z(3),z(4),z(5)]]}break;case"csv":if(u=="clip-rect"){p=[],v=4;while(v--)p[v]=+i[u][v]+t*f*j[u][v]}break;default:var A=[][n](i[u]);p=[],v=m.paper.customAttributes[u].length;while(v--)p[v]=+A[v]+t*f*j[u][v]}o[u]=p}m.attr(o),function(a,b,c){setTimeout(function(){eve("raphael.anim.frame."+a,b,c)})}(m.id,m,d.anim)}else{(function(b,c,d){setTimeout(function(){eve("raphael.anim.frame."+c.id,c,d),eve("raphael.anim.finish."+c.id,c,d),a.is(b,"function")&&b.call(c)})})(d.callback,m,d.anim),m.attr(k),cy.splice(c--,1);if(d.repeat>1&&!d.next){for(s in k)k[g](s)&&(r[s]=d.totalOrigin[s]);d.el.attr(r),cE(d.anim,d.el,d.anim.percents[0],null,d.totalOrigin,d.repeat-1)}d.next&&!d.stop&&cE(d.anim,d.el,d.next,null,d.totalOrigin,d.repeat)}}a.svg&&m&&m.paper&&m.paper.safari(),cy.length&&cz(cA)},cB=function(a){return a>255?255:a<0?0:a};cl.animateWith=function(b,c,d,e,f,g){var h=this;if(h.removed){g&&g.call(h);return h}var i=d instanceof cD?d:a.animation(d,e,f,g),j,k;cE(i,h,i.percents[0],null,h.attr());for(var l=0,m=cy.length;l<m;l++)if(cy[l].anim==c&&cy[l].el==b){cy[m-1].start=cy[l].start;break}return h},cl.onAnimation=function(a){a?eve.on("raphael.anim.frame."+this.id,a):eve.unbind("raphael.anim.frame."+this.id);return this},cD.prototype.delay=function(a){var b=new cD(this.anim,this.ms);b.times=this.times,b.del=+a||0;return b},cD.prototype.repeat=function(a){var b=new cD(this.anim,this.ms);b.del=this.del,b.times=w.floor(x(a,0))||1;return b},a.animation=function(b,c,d,e){if(b instanceof cD)return b;if(a.is(d,"function")||!d)e=e||d||null,d=null;b=Object(b),c=+c||0;var f={},h,i;for(i in b)b[g](i)&&Q(i)!=i&&Q(i)+"%"!=i&&(h=!0,f[i]=b[i]);if(!h)return new cD(b,c);d&&(f.easing=d),e&&(f.callback=e);return new cD({100:f},c)},cl.animate=function(b,c,d,e){var f=this;if(f.removed){e&&e.call(f);return f}var g=b instanceof cD?b:a.animation(b,c,d,e);cE(g,f,g.percents[0],null,f.attr());return f},cl.setTime=function(a,b){a&&b!=null&&this.status(a,y(b,a.ms)/a.ms);return this},cl.status=function(a,b){var c=[],d=0,e,f;if(b!=null){cE(a,this,-1,y(b,1));return this}e=cy.length;for(;d<e;d++){f=cy[d];if(f.el.id==this.id&&(!a||f.anim==a)){if(a)return f.status;c.push({anim:f.anim,status:f.status})}}if(a)return 0;return c},cl.pause=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.pause."+this.id,this,cy[b].anim)!==!1&&(cy[b].paused=!0);return this},cl.resume=function(a){for(var b=0;b<cy.length;b++)if(cy[b].el.id==this.id&&(!a||cy[b].anim==a)){var c=cy[b];eve("raphael.anim.resume."+this.id,this,c.anim)!==!1&&(delete c.paused,this.status(c.anim,c.status))}return this},cl.stop=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.stop."+this.id,this,cy[b].anim)!==!1&&cy.splice(b--,1);return this},eve.on("raphael.remove",cF),eve.on("raphael.clear",cF),cl.toString=function(){return"Raphaël’s object"};var cG=function(a){this.items=[],this.length=0,this.type="set";if(a)for(var b=0,c=a.length;b<c;b++)a[b]&&(a[b].constructor==cl.constructor||a[b].constructor==cG)&&(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},cH=cG.prototype;cH.push=function(){var a,b;for(var c=0,d=arguments.length;c<d;c++)a=arguments[c],a&&(a.constructor==cl.constructor||a.constructor==cG)&&(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},cH.pop=function(){this.length&&delete this[this.length--];return this.items.pop()},cH.forEach=function(a,b){for(var c=0,d=this.items.length;c<d;c++)if(a.call(b,this.items[c],c)===!1)return this;return this};for(var cI in cl)cl[g](cI)&&(cH[cI]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a][m](c,b)})}}(cI));cH.attr=function(b,c){if(b&&a.is(b,E)&&a.is(b[0],"object"))for(var d=0,e=b.length;d<e;d++)this.items[d].attr(b[d]);else for(var f=0,g=this.items.length;f<g;f++)this.items[f].attr(b,c);return this},cH.clear=function(){while(this.length)this.pop()},cH.splice=function(a,b,c){a=a<0?x(this.length+a,0):a,b=x(0,y(this.length-a,b));var d=[],e=[],f=[],g;for(g=2;g<arguments.length;g++)f.push(arguments[g]);for(g=0;g<b;g++)e.push(this[a+g]);for(;g<this.length-a;g++)d.push(this[a+g]);var h=f.length;for(g=0;g<h+d.length;g++)this.items[a+g]=this[a+g]=g<h?f[g]:d[g-h];g=this.items.length=this.length-=b-h;while(this[g])delete this[g++];return new cG(e)},cH.exclude=function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]==a){this.splice(b,1);return!0}},cH.animate=function(b,c,d,e){(a.is(d,"function")||!d)&&(e=d||null);var f=this.items.length,g=f,h,i=this,j;if(!f)return this;e&&(j=function(){!--f&&e.call(i)}),d=a.is(d,D)?d:j;var k=a.animation(b,c,d,j);h=this.items[--g].animate(k);while(g--)this.items[g]&&!this.items[g].removed&&this.items[g].animateWith(h,k,k);return this},cH.insertAfter=function(a){var b=this.items.length;while(b--)this.items[b].insertAfter(a);return this},cH.getBBox=function(){var a=[],b=[],c=[],d=[];for(var e=this.items.length;e--;)if(!this.items[e].removed){var f=this.items[e].getBBox();a.push(f.x),b.push(f.y),c.push(f.x+f.width),d.push(f.y+f.height)}a=y[m](0,a),b=y[m](0,b),c=x[m](0,c),d=x[m](0,d);return{x:a,y:b,x2:c,y2:d,width:c-a,height:d-b}},cH.clone=function(a){a=new cG;for(var b=0,c=this.items.length;b<c;b++)a.push(this.items[b].clone());return a},cH.toString=function(){return"Raphaël‘s set"},a.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[g](d)&&(b.face[d]=a.face[d]);this.fonts[c]?this.fonts[c].push(b):this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=R(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[g](e)){var f=a.glyphs[e];b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d.replace(/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"};if(f.k)for(var h in f.k)f[g](h)&&(b.glyphs[e].k[h]=f.k[h])}}return a},k.getFont=function(b,c,d,e){e=e||"normal",d=d||"normal",c=+c||{normal:400,bold:700,lighter:300,bolder:800}[c]||400;if(!!a.fonts){var f=a.fonts[b];if(!f){var h=new RegExp("(^|\\s)"+b.replace(/[^\w\d\s+!~.:_-]/g,p)+"(\\s|$)","i");for(var i in a.fonts)if(a.fonts[g](i)&&h.test(i)){f=a.fonts[i];break}}var j;if(f)for(var k=0,l=f.length;k<l;k++){j=f[k];if(j.face["font-weight"]==c&&(j.face["font-style"]==d||!j.face["font-style"])&&j.face["font-stretch"]==e)break}return j}},k.print=function(b,d,e,f,g,h,i){h=h||"middle",i=x(y(i||0,1),-1);var j=r(e)[s](p),k=0,l=0,m=p,n;a.is(f,e)&&(f=this.getFont(f));if(f){n=(g||16)/f.face["units-per-em"];var o=f.face.bbox[s](c),q=+o[0],t=o[3]-o[1],u=0,v=+o[1]+(h=="baseline"?t+ +f.face.descent:t/2);for(var w=0,z=j.length;w<z;w++){if(j[w]=="\n")k=0,B=0,l=0,u+=t;else{var A=l&&f.glyphs[j[w-1]]||{},B=f.glyphs[j[w]];k+=l?(A.w||f.w)+(A.k&&A.k[j[w]]||0)+f.w*i:0,l=1}B&&B.d&&(m+=a.transformPath(B.d,["t",k*n,u*n,"s",n,n,q,v,"t",(b-q)/n,(d-v)/n]))}}return this.path(m).attr({fill:"#000",stroke:"none"})},k.add=function(b){if(a.is(b,"array")){var c=this.set(),e=0,f=b.length,h;for(;e<f;e++)h=b[e]||{},d[g](h.type)&&c.push(this[h.type]().attr(h))}return c},a.format=function(b,c){var d=a.is(c,E)?[0][n](c):arguments;b&&a.is(b,D)&&d.length-1&&(b=b.replace(e,function(a,b){return d[++b]==null?p:d[b]}));return b||p},a.fullfill=function(){var a=/\{([^\}]+)\}/g,b=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,c=function(a,c,d){var e=d;c.replace(b,function(a,b,c,d,f){b=b||d,e&&(b in e&&(e=e[b]),typeof e=="function"&&f&&(e=e()))}),e=(e==null||e==d?a:e)+"";return e};return function(b,d){return String(b).replace(a,function(a,b){return c(a,b,d)})}}(),a.ninja=function(){i.was?h.win.Raphael=i.is:delete Raphael;return a},a.st=cH,function(b,c,d){function e(){/in/.test(b.readyState)?setTimeout(e,9):a.eve("raphael.DOMload")}b.readyState==null&&b.addEventListener&&(b.addEventListener(c,d=function(){b.removeEventListener(c,d,!1),b.readyState="complete"},!1),b.readyState="loading"),e()}(document,"DOMContentLoaded"),i.was?h.win.Raphael=a:Raphael=a,eve.on("raphael.DOMload",function(){b=!0})}(),window.Raphael.svg&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=parseInt,f=Math,g=f.max,h=f.abs,i=f.pow,j=/[, ]+/,k=a.eve,l="",m=" ",n="http://www.w3.org/1999/xlink",o={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},p={};a.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var q=function(d,e){if(e){typeof d=="string"&&(d=q(d));for(var f in e)e[b](f)&&(f.substring(0,6)=="xlink:"?d.setAttributeNS(n,f.substring(6),c(e[f])):d.setAttribute(f,c(e[f])))}else d=a._g.doc.createElementNS("http://www.w3.org/2000/svg",d),d.style&&(d.style.webkitTapHighlightColor="rgba(0,0,0,0)");return d},r=function(b,e){var j="linear",k=b.id+e,m=.5,n=.5,o=b.node,p=b.paper,r=o.style,s=a._g.doc.getElementById(k);if(!s){e=c(e).replace(a._radial_gradient,function(a,b,c){j="radial";if(b&&c){m=d(b),n=d(c);var e=(n>.5)*2-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&n!=.5&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/);if(j=="linear"){var t=e.shift();t=-d(t);if(isNaN(t))return null;var u=[0,0,f.cos(a.rad(t)),f.sin(a.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=a._parseDots(e);if(!w)return null;k=k.replace(/[\(\)\s,\xb0#]/g,"_"),b.gradient&&k!=b.gradient.id&&(p.defs.removeChild(b.gradient),delete b.gradient);if(!b.gradient){s=q(j+"Gradient",{id:k}),b.gradient=s,q(s,j=="radial"?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:b.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;x<y;x++)s.appendChild(q("stop",{offset:w[x].offset?w[x].offset:x?"100%":"0%","stop-color":w[x].color||"#fff"}))}}q(o,{fill:"url(#"+k+")",opacity:1,"fill-opacity":1}),r.fill=l,r.opacity=1,r.fillOpacity=1;return 1},s=function(a){var b=a.getBBox(1);q(a.pattern,{patternTransform:a.matrix.invert()+" translate("+b.x+","+b.y+")"})},t=function(d,e,f){if(d.type=="path"){var g=c(e).toLowerCase().split("-"),h=d.paper,i=f?"end":"start",j=d.node,k=d.attrs,m=k["stroke-width"],n=g.length,r="classic",s,t,u,v,w,x=3,y=3,z=5;while(n--)switch(g[n]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":r=g[n];break;case"wide":y=5;break;case"narrow":y=2;break;case"long":x=5;break;case"short":x=2}r=="open"?(x+=2,y+=2,z+=2,u=1,v=f?4:1,w={fill:"none",stroke:k.stroke}):(v=u=x/2,w={fill:k.stroke,stroke:"none"}),d._.arrows?f?(d._.arrows.endPath&&p[d._.arrows.endPath]--,d._.arrows.endMarker&&p[d._.arrows.endMarker]--):(d._.arrows.startPath&&p[d._.arrows.startPath]--,d._.arrows.startMarker&&p[d._.arrows.startMarker]--):d._.arrows={};if(r!="none"){var A="raphael-marker-"+r,B="raphael-marker-"+i+r+x+y;a._g.doc.getElementById(A)?p[A]++:(h.defs.appendChild(q(q("path"),{"stroke-linecap":"round",d:o[r],id:A})),p[A]=1);var C=a._g.doc.getElementById(B),D;C?(p[B]++,D=C.getElementsByTagName("use")[0]):(C=q(q("marker"),{id:B,markerHeight:y,markerWidth:x,orient:"auto",refX:v,refY:y/2}),D=q(q("use"),{"xlink:href":"#"+A,transform:(f?"rotate(180 "+x/2+" "+y/2+") ":l)+"scale("+x/z+","+y/z+")","stroke-width":(1/((x/z+y/z)/2)).toFixed(4)}),C.appendChild(D),h.defs.appendChild(C),p[B]=1),q(D,w);var F=u*(r!="diamond"&&r!="oval");f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-F*m):(s=F*m,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),w={},w["marker-"+i]="url(#"+B+")";if(t||s)w.d=Raphael.getSubpath(k.path,s,t);q(j,w),d._.arrows[i+"Path"]=A,d._.arrows[i+"Marker"]=B,d._.arrows[i+"dx"]=F,d._.arrows[i+"Type"]=r,d._.arrows[i+"String"]=e}else f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-s):(s=0,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),d._.arrows[i+"Path"]&&q(j,{d:Raphael.getSubpath(k.path,s,t)}),delete d._.arrows[i+"Path"],delete d._.arrows[i+"Marker"],delete d._.arrows[i+"dx"],delete d._.arrows[i+"Type"],delete d._.arrows[i+"String"];for(w in p)if(p[b](w)&&!p[w]){var G=a._g.doc.getElementById(w);G&&G.parentNode.removeChild(G)}}},u={"":[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]},v=function(a,b,d){b=u[c(b).toLowerCase()];if(b){var e=a.attrs["stroke-width"]||"1",f={round:e,square:e,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],h=b.length;while(h--)g[h]=b[h]*e+(h%2?1:-1)*f;q(a.node,{"stroke-dasharray":g.join(",")})}};k.on("raphael.util.attr.blur",function(a){this.blur(a)}),k.on("raphael.util.attr.cursor",function(a){this.node.style.cursor=a});var w=function(d,f){var i=d.node,m=d.attrs,o=i.style.visibility;i.style.visibility="hidden";for(var p in f){k("raphael.util.attr."+p,d,f[p]);if(f[b](p)){if(!a._availableAttrs[b](p))continue;var u=f[p];m[p]=u;switch(p){case"blur":d.blur(u);break;case"href":case"title":case"target":var w=i.parentNode;if(w.tagName.toLowerCase()!="a"){var x=q("a");w.insertBefore(x,i),x.appendChild(i),w=x}p=="target"?w.setAttributeNS(n,"show",u=="blank"?"new":u):w.setAttributeNS(n,p,u);break;case"cursor":break;case"transform":d.transform(u);break;case"arrow-start":t(d,u);break;case"arrow-end":t(d,u,1);break;case"clip-rect":var z=c(u).split(j);if(z.length==4){d.clip&&d.clip.parentNode.parentNode.removeChild(d.clip.parentNode);var A=q("clipPath"),B=q("rect");A.id=a.createUUID(),q(B,{x:z[0],y:z[1],width:z[2],height:z[3]}),A.appendChild(B),d.paper.defs.appendChild(A),q(i,{"clip-path":"url(#"+A.id+")"}),d.clip=B}if(!u){var C=i.getAttribute("clip-path");if(C){var D=a._g.doc.getElementById(C.replace(/(^url\(#|\)$)/g,l));D&&D.parentNode.removeChild(D),q(i,{"clip-path":l}),delete d.clip}}break;case"path":d.type=="path"&&(q(i,{d:u?m.path=a._pathToAbsolute(u):"M0,0"}),d._.dirty=1,d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1)));break;case"width":i.setAttribute(p,u),d._.dirty=1;if(m.fx)p="x",u=m.x;else break;case"x":m.fx&&(u=-m.x-(m.width||0));case"rx":if(p=="rx"&&d.type=="rect")break;case"cx":i.setAttribute(p,u),d.pattern&&s(d),d._.dirty=1;break;case"height":i.setAttribute(p,u),d._.dirty=1;if(m.fy)p="y",u=m.y;else break;case"y":m.fy&&(u=-m.y-(m.height||0));case"ry":if(p=="ry"&&d.type=="rect")break;case"cy":i.setAttribute(p,u),d.pattern&&s(d),d._.dirty=1;break;case"r":d.type=="rect"?q(i,{rx:u,ry:u}):i.setAttribute(p,u),d._.dirty=1;break;case"src":d.type=="image"&&i.setAttributeNS(n,"href",u);break;case"stroke-width":if(d._.sx!=1||d._.sy!=1)u/=g(h(d._.sx),h(d._.sy))||1;d.paper._vbSize&&(u*=d.paper._vbSize),i.setAttribute(p,u),m["stroke-dasharray"]&&v(d,m["stroke-dasharray"],f),d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"stroke-dasharray":v(d,u,f);break;case"fill":var F=c(u).match(a._ISURL);if(F){A=q("pattern");var G=q("image");A.id=a.createUUID(),q(A,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),q(G,{x:0,y:0,"xlink:href":F[1]}),A.appendChild(G),function(b){a._preload(F[1],function(){var a=this.offsetWidth,c=this.offsetHeight;q(b,{width:a,height:c}),q(G,{width:a,height:c}),d.paper.safari()})}(A),d.paper.defs.appendChild(A),q(i,{fill:"url(#"+A.id+")"}),d.pattern=A,d.pattern&&s(d);break}var H=a.getRGB(u);if(!H.error)delete f.gradient,delete m.gradient,!a.is(m.opacity,"undefined")&&a.is(f.opacity,"undefined")&&q(i,{opacity:m.opacity}),!a.is(m["fill-opacity"],"undefined")&&a.is(f["fill-opacity"],"undefined")&&q(i,{"fill-opacity":m["fill-opacity"]});else if((d.type=="circle"||d.type=="ellipse"||c(u).charAt()!="r")&&r(d,u)){if("opacity"in m||"fill-opacity"in m){var I=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l));if(I){var J=I.getElementsByTagName("stop");q(J[J.length-1],{"stop-opacity":("opacity"in m?m.opacity:1)*("fill-opacity"in m?m["fill-opacity"]:1)})}}m.gradient=u,m.fill="none";break}H[b]("opacity")&&q(i,{"fill-opacity":H.opacity>1?H.opacity/100:H.opacity});case"stroke":H=a.getRGB(u),i.setAttribute(p,H.hex),p=="stroke"&&H[b]("opacity")&&q(i,{"stroke-opacity":H.opacity>1?H.opacity/100:H.opacity}),p=="stroke"&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":(d.type=="circle"||d.type=="ellipse"||c(u).charAt()!="r")&&r(d,u);break;case"opacity":m.gradient&&!m[b]("stroke-opacity")&&q(i,{"stroke-opacity":u>1?u/100:u});case"fill-opacity":if(m.gradient){I=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),I&&(J=I.getElementsByTagName("stop"),q(J[J.length-1],{"stop-opacity":u}));break};default:p=="font-size"&&(u=e(u,10)+"px");var K=p.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[K]=u,d._.dirty=1,i.setAttribute(p,u)}}}y(d,f),i.style.visibility=o},x=1.2,y=function(d,f){if(d.type=="text"&&!!(f[b]("text")||f[b]("font")||f[b]("font-size")||f[b]("x")||f[b]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(a._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10;if(f[b]("text")){g.text=f.text;while(h.firstChild)h.removeChild(h.firstChild);var j=c(f.text).split("\n"),k=[],m;for(var n=0,o=j.length;n<o;n++)m=q("tspan"),n&&q(m,{dy:i*x,x:g.x}),m.appendChild(a._g.doc.createTextNode(j[n])),h.appendChild(m),k[n]=m}else{k=h.getElementsByTagName("tspan");for(n=0,o=k.length;n<o;n++)n?q(k[n],{dy:i*x,x:g.x}):q(k[0],{dy:0})}q(h,{x:g.x,y:g.y}),d._.dirty=1;var p=d._getBBox(),r=g.y-(p.y+p.height/2);r&&a.is(r,"finite")&&q(k[0],{dy:r})}},z=function(b,c){var d=0,e=0;this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.matrix=a.matrix(),this.realPath=null,this.paper=c,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},A=a.el;z.prototype=A,A.constructor=z,a._engine.path=function(a,b){var c=q("path");b.canvas&&b.canvas.appendChild(c);var d=new z(c,b);d.type="path",w(d,{fill:"none",stroke:"#000",path:a});return d},A.rotate=function(a,b,e){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this.transform(this._.transform.concat([["r",a,b,e]]));return this},A.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3])),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]]));return this},A.translate=function(a,b){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this.transform(this._.transform.concat([["t",a,b]]));return this},A.transform=function(c){var d=this._;if(c==null)return d.transform;a._extractTransform(this,c),this.clip&&q(this.clip,{transform:this.matrix.invert()}),this.pattern&&s(this),this.node&&q(this.node,{transform:this.matrix});if(d.sx!=1||d.sy!=1){var e=this.attrs[b]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":e})}return this},A.hide=function(){!this.removed&&this.paper.safari(this.node.style.display="none");return this},A.show=function(){!this.removed&&this.paper.safari(this.node.style.display="");return this},A.remove=function(){if(!this.removed&&!!this.node.parentNode){var b=this.paper;b.__set__&&b.__set__.exclude(this),k.unbind("raphael.*.*."+this.id),this.gradient&&b.defs.removeChild(this.gradient),a._tear(this,b),this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.removeChild(this.node.parentNode):this.node.parentNode.removeChild(this.node);for(var c in this)this[c]=typeof this[c]=="function"?a._removedFactory(c):null;this.removed=!0}},A._getBBox=function(){if(this.node.style.display=="none"){this.show();var a=!0}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}a&&this.hide();return b},A.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;if(c=="transform")return this._.transform;var g=c.split(j),h={};for(var i=0,l=g.length;i<l;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return l-1?h:h[g[0]]}if(d==null&&a.is(c,"array")){h={};for(i=0,l=c.length;i<l;i++)h[c[i]]=this.attr(c[i]);return h}if(d!=null){var m={};m[c]=d}else c!=null&&a.is(c,"object")&&(m=c);for(var n in m)k("raphael.attr."+n+"."+this.id,this,m[n]);for(n in this.paper.customAttributes)if(this.paper.customAttributes[b](n)&&m[b](n)&&a.is(this.paper.customAttributes[n],"function")){var o=this.paper.customAttributes[n].apply(this,[].concat(m[n]));this.attrs[n]=m[n];for(var p in o)o[b](p)&&(m[p]=o[p])}w(this,m);return this},A.toFront=function(){if(this.removed)return this;this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.appendChild(this.node.parentNode):this.node.parentNode.appendChild(this.node);var b=this.paper;b.top!=this&&a._tofront(this,b);return this},A.toBack=function(){if(this.removed)return this;var b=this.node.parentNode;b.tagName.toLowerCase()=="a"?b.parentNode.insertBefore(this.node.parentNode,this.node.parentNode.parentNode.firstChild):b.firstChild!=this.node&&b.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper);var c=this.paper;return this},A.insertAfter=function(b){if(this.removed)return this;var c=b.node||b[b.length-1].node;c.nextSibling?c.parentNode.insertBefore(this.node,c.nextSibling):c.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},A.insertBefore=function(b){if(this.removed)return this;var c=b.node||b[0].node;c.parentNode.insertBefore(this.node,c),a._insertbefore(this,b,this.paper);return this},A.blur=function(b){var c=this;if(+b!==0){var d=q("filter"),e=q("feGaussianBlur");c.attrs.blur=b,d.id=a.createUUID(),q(e,{stdDeviation:+b||1.5}),d.appendChild(e),c.paper.defs.appendChild(d),c._blur=d,q(c.node,{filter:"url(#"+d.id+")"})}else c._blur&&(c._blur.parentNode.removeChild(c._blur),delete c._blur,delete c.attrs.blur),c.node.removeAttribute("filter")},a._engine.circle=function(a,b,c,d){var e=q("circle");a.canvas&&a.canvas.appendChild(e);var f=new z(e,a);f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",q(e,f.attrs);return f},a._engine.rect=function(a,b,c,d,e,f){var g=q("rect");a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},h.type="rect",q(g,h.attrs);return h},a._engine.ellipse=function(a,b,c,d,e){var f=q("ellipse");a.canvas&&a.canvas.appendChild(f);var g=new z(f,a);g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",q(f,g.attrs);return g},a._engine.image=function(a,b,c,d,e,f){var g=q("image");q(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(n,"href",b),a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:c,y:d,width:e,height:f,src:b},h.type="image";return h},a._engine.text=function(b,c,d,e){var f=q("text");b.canvas&&b.canvas.appendChild(f);var g=new z(f,b);g.attrs={x:c,y:d,"text-anchor":"middle",text:e,font:a._availableAttrs.font,stroke:"none",fill:"#000"},g.type="text",w(g,g.attrs);return g},a._engine.setSize=function(a,b){this.width=a||this.width,this.height=b||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox);return this},a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b&&b.container,d=b.x,e=b.y,f=b.width,g=b.height;if(!c)throw new Error("SVG container not found.");var h=q("svg"),i="overflow:hidden;",j;d=d||0,e=e||0,f=f||512,g=g||342,q(h,{height:g,version:1.1,width:f,xmlns:"http://www.w3.org/2000/svg"}),c==1?(h.style.cssText=i+"position:absolute;left:"+d+"px;top:"+e+"px",a._g.doc.body.appendChild(h),j=1):(h.style.cssText=i+"position:relative",c.firstChild?c.insertBefore(h,c.firstChild):c.appendChild(h)),c=new a._Paper,c.width=f,c.height=g,c.canvas=h,c.clear(),c._left=c._top=0,j&&(c.renderfix=function(){}),c.renderfix();return c},a._engine.setViewBox=function(a,b,c,d,e){k("raphael.setViewBox",this,this._viewBox,[a,b,c,d,e]);var f=g(c/this.width,d/this.height),h=this.top,i=e?"meet":"xMinYMin",j,l;a==null?(this._vbSize&&(f=1),delete this._vbSize,j="0 0 "+this.width+m+this.height):(this._vbSize=f,j=a+m+b+m+c+m+d),q(this.canvas,{viewBox:j,preserveAspectRatio:i});while(f&&h)l="stroke-width"in h.attrs?h.attrs["stroke-width"]:1,h.attr({"stroke-width":l}),h._.dirty=1,h._.dirtyT=1,h=h.prev;this._viewBox=[a,b,c,d,!!e];return this},a.prototype.renderfix=function(){var a=this.canvas,b=a.style,c;try{c=a.getScreenCTM()||a.createSVGMatrix()}catch(d){c=a.createSVGMatrix()}var e=-c.e%1,f=-c.f%1;if(e||f)e&&(this._left=(this._left+e)%1,b.left=this._left+"px"),f&&(this._top=(this._top+f)%1,b.top=this._top+"px")},a.prototype.clear=function(){a.eve("raphael.clear",this);var b=this.canvas;while(b.firstChild)b.removeChild(b.firstChild);this.bottom=this.top=null,(this.desc=q("desc")).appendChild(a._g.doc.createTextNode("Created with Raphaël "+a.version)),b.appendChild(this.desc),b.appendChild(this.defs=q("defs"))},a.prototype.remove=function(){k("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null};var B=a.st;for(var C in A)A[b](C)&&!B[b](C)&&(B[C]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(C))}(window.Raphael),window.Raphael.vml&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=Math,f=e.round,g=e.max,h=e.min,i=e.abs,j="fill",k=/[, ]+/,l=a.eve,m=" progid:DXImageTransform.Microsoft",n=" ",o="",p={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},q=/([clmz]),?([^clmz]*)/gi,r=/ progid:\S+Blur\([^\)]+\)/g,s=/-?[^,\s-]+/g,t="position:absolute;left:0;top:0;width:1px;height:1px",u=21600,v={path:1,rect:1,image:1},w={circle:1,ellipse:1},x=function(b){var d=/[ahqstv]/ig,e=a._pathToAbsolute;c(b).match(d)&&(e=a._path2curve),d=/[clmz]/g;if(e==a._pathToAbsolute&&!c(b).match(d)){var g=c(b).replace(q,function(a,b,c){var d=[],e=b.toLowerCase()=="m",g=p[b];c.replace(s,function(a){e&&d.length==2&&(g+=d+p[b=="m"?"l":"L"],d=[]),d.push(f(a*u))});return g+d});return g}var h=e(b),i,j;g=[];for(var k=0,l=h.length;k<l;k++){i=h[k],j=h[k][0].toLowerCase(),j=="z"&&(j="x");for(var m=1,r=i.length;m<r;m++)j+=f(i[m]*u)+(m!=r-1?",":o);g.push(j)}return g.join(n)},y=function(b,c,d){var e=a.matrix();e.rotate(-b,.5,.5);return{dx:e.x(c,d),dy:e.y(c,d)}},z=function(a,b,c,d,e,f){var g=a._,h=a.matrix,k=g.fillpos,l=a.node,m=l.style,o=1,p="",q,r=u/b,s=u/c;m.visibility="hidden";if(!!b&&!!c){l.coordsize=i(r)+n+i(s),m.rotation=f*(b*c<0?-1:1);if(f){var t=y(f,d,e);d=t.dx,e=t.dy}b<0&&(p+="x"),c<0&&(p+=" y")&&(o=-1),m.flip=p,l.coordorigin=d*-r+n+e*-s;if(k||g.fillsize){var v=l.getElementsByTagName(j);v=v&&v[0],l.removeChild(v),k&&(t=y(f,h.x(k[0],k[1]),h.y(k[0],k[1])),v.position=t.dx*o+n+t.dy*o),g.fillsize&&(v.size=g.fillsize[0]*i(b)+n+g.fillsize[1]*i(c)),l.appendChild(v)}m.visibility="visible"}};a.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var A=function(a,b,d){var e=c(b).toLowerCase().split("-"),f=d?"end":"start",g=e.length,h="classic",i="medium",j="medium";while(g--)switch(e[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":h=e[g];break;case"wide":case"narrow":j=e[g];break;case"long":case"short":i=e[g]}var k=a.node.getElementsByTagName("stroke")[0];k[f+"arrow"]=h,k[f+"arrowlength"]=i,k[f+"arrowwidth"]=j},B=function(e,i){e.attrs=e.attrs||{};var l=e.node,m=e.attrs,p=l.style,q,r=v[e.type]&&(i.x!=m.x||i.y!=m.y||i.width!=m.width||i.height!=m.height||i.cx!=m.cx||i.cy!=m.cy||i.rx!=m.rx||i.ry!=m.ry||i.r!=m.r),s=w[e.type]&&(m.cx!=i.cx||m.cy!=i.cy||m.r!=i.r||m.rx!=i.rx||m.ry!=i.ry),t=e;for(var y in i)i[b](y)&&(m[y]=i[y]);r&&(m.path=a._getPath[e.type](e),e._.dirty=1),i.href&&(l.href=i.href),i.title&&(l.title=i.title),i.target&&(l.target=i.target),i.cursor&&(p.cursor=i.cursor),"blur"in i&&e.blur(i.blur);if(i.path&&e.type=="path"||r)l.path=x(~c(m.path).toLowerCase().indexOf("r")?a._pathToAbsolute(m.path):m.path),e.type=="image"&&(e._.fillpos=[m.x,m.y],e._.fillsize=[m.width,m.height],z(e,1,1,0,0,0));"transform"in i&&e.transform(i.transform);if(s){var B=+m.cx,D=+m.cy,E=+m.rx||+m.r||0,G=+m.ry||+m.r||0;l.path=a.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((B-E)*u),f((D-G)*u),f((B+E)*u),f((D+G)*u),f(B*u))}if("clip-rect"in i){var H=c(i["clip-rect"]).split(k);if(H.length==4){H[2]=+H[2]+ +H[0],H[3]=+H[3]+ +H[1];var I=l.clipRect||a._g.doc.createElement("div"),J=I.style;J.clip=a.format("rect({1}px {2}px {3}px {0}px)",H),l.clipRect||(J.position="absolute",J.top=0,J.left=0,J.width=e.paper.width+"px",J.height=e.paper.height+"px",l.parentNode.insertBefore(I,l),I.appendChild(l),l.clipRect=I)}i["clip-rect"]||l.clipRect&&(l.clipRect.style.clip="auto")}if(e.textpath){var K=e.textpath.style;i.font&&(K.font=i.font),i["font-family"]&&(K.fontFamily='"'+i["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,o)+'"'),i["font-size"]&&(K.fontSize=i["font-size"]),i["font-weight"]&&(K.fontWeight=i["font-weight"]),i["font-style"]&&(K.fontStyle=i["font-style"])}"arrow-start"in i&&A(t,i["arrow-start"]),"arrow-end"in i&&A(t,i["arrow-end"],1);if(i.opacity!=null||i["stroke-width"]!=null||i.fill!=null||i.src!=null||i.stroke!=null||i["stroke-width"]!=null||i["stroke-opacity"]!=null||i["fill-opacity"]!=null||i["stroke-dasharray"]!=null||i["stroke-miterlimit"]!=null||i["stroke-linejoin"]!=null||i["stroke-linecap"]!=null){var L=l.getElementsByTagName(j),M=!1;L=L&&L[0],!L&&(M=L=F(j)),e.type=="image"&&i.src&&(L.src=i.src),i.fill&&(L.on=!0);if(L.on==null||i.fill=="none"||i.fill===null)L.on=!1;if(L.on&&i.fill){var N=c(i.fill).match(a._ISURL);if(N){L.parentNode==l&&l.removeChild(L),L.rotate=!0,L.src=N[1],L.type="tile";var O=e.getBBox(1);L.position=O.x+n+O.y,e._.fillpos=[O.x,O.y],a._preload(N[1],function(){e._.fillsize=[this.offsetWidth,this.offsetHeight]})}else L.color=a.getRGB(i.fill).hex,L.src=o,L.type="solid",a.getRGB(i.fill).error&&(t.type in{circle:1,ellipse:1}||c(i.fill).charAt()!="r")&&C(t,i.fill,L)&&(m.fill="none",m.gradient=i.fill,L.rotate=!1)}if("fill-opacity"in i||"opacity"in i){var P=((+m["fill-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+a.getRGB(i.fill).o+1||2)-1);P=h(g(P,0),1),L.opacity=P,L.src&&(L.color="none")}l.appendChild(L);var Q=l.getElementsByTagName("stroke")&&l.getElementsByTagName("stroke")[0],T=!1;!Q&&(T=Q=F("stroke"));if(i.stroke&&i.stroke!="none"||i["stroke-width"]||i["stroke-opacity"]!=null||i["stroke-dasharray"]||i["stroke-miterlimit"]||i["stroke-linejoin"]||i["stroke-linecap"])Q.on=!0;(i.stroke=="none"||i.stroke===null||Q.on==null||i.stroke==0||i["stroke-width"]==0)&&(Q.on=!1);var U=a.getRGB(i.stroke);Q.on&&i.stroke&&(Q.color=U.hex),P=((+m["stroke-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+U.o+1||2)-1);var V=(d(i["stroke-width"])||1)*.75;P=h(g(P,0),1),i["stroke-width"]==null&&(V=m["stroke-width"]),i["stroke-width"]&&(Q.weight=V),V&&V<1&&(P*=V)&&(Q.weight=1),Q.opacity=P,i["stroke-linejoin"]&&(Q.joinstyle=i["stroke-linejoin"]||"miter"),Q.miterlimit=i["stroke-miterlimit"]||8,i["stroke-linecap"]&&(Q.endcap=i["stroke-linecap"]=="butt"?"flat":i["stroke-linecap"]=="square"?"square":"round");if(i["stroke-dasharray"]){var W={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};Q.dashstyle=W[b](i["stroke-dasharray"])?W[i["stroke-dasharray"]]:o}T&&l.appendChild(Q)}if(t.type=="text"){t.paper.canvas.style.display=o;var X=t.paper.span,Y=100,Z=m.font&&m.font.match(/\d+(?:\.\d*)?(?=px)/);p=X.style,m.font&&(p.font=m.font),m["font-family"]&&(p.fontFamily=m["font-family"]),m["font-weight"]&&(p.fontWeight=m["font-weight"]),m["font-style"]&&(p.fontStyle=m["font-style"]),Z=d(m["font-size"]||Z&&Z[0])||10,p.fontSize=Z*Y+"px",t.textpath.string&&(X.innerHTML=c(t.textpath.string).replace(/</g,"&#60;").replace(/&/g,"&#38;").replace(/\n/g,"<br>"));var $=X.getBoundingClientRect();t.W=m.w=($.right-$.left)/Y,t.H=m.h=($.bottom-$.top)/Y,t.X=m.x,t.Y=m.y+t.H/2,("x"in i||"y"in i)&&(t.path.v=a.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));var _=["x","y","text","font","font-family","font-weight","font-style","font-size"];for(var ba=0,bb=_.length;ba<bb;ba++)if(_[ba]in i){t._.dirty=1;break}switch(m["text-anchor"]){case"start":t.textpath.style["v-text-align"]="left",t.bbx=t.W/2;break;case"end":t.textpath.style["v-text-align"]="right",t.bbx=-t.W/2;break;default:t.textpath.style["v-text-align"]="center",t.bbx=0}t.textpath.style["v-text-kern"]=!0}},C=function(b,f,g){b.attrs=b.attrs||{};var h=b.attrs,i=Math.pow,j,k,l="linear",m=".5 .5";b.attrs.gradient=f,f=c(f).replace(a._radial_gradient,function(a,b,c){l="radial",b&&c&&(b=d(b),c=d(c),i(b-.5,2)+i(c-.5,2)>.25&&(c=e.sqrt(.25-i(b-.5,2))*((c>.5)*2-1)+.5),m=b+n+c);return o}),f=f.split(/\s*\-\s*/);if(l=="linear"){var p=f.shift();p=-d(p);if(isNaN(p))return null}var q=a._parseDots(f);if(!q)return null;b=b.shape||b.node;if(q.length){b.removeChild(g),g.on=!0,g.method="none",g.color=q[0].color,g.color2=q[q.length-1].color;var r=[];for(var s=0,t=q.length;s<t;s++)q[s].offset&&r.push(q[s].offset+n+q[s].color);g.colors=r.length?r.join():"0% "+g.color,l=="radial"?(g.type="gradientTitle",g.focus="100%",g.focussize="0 0",g.focusposition=m,g.angle=0):(g.type="gradient",g.angle=(270-p)%360),b.appendChild(g)}return 1},D=function(b,c){this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=c,this.matrix=a.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},E=a.el;D.prototype=E,E.constructor=D,E.transform=function(b){if(b==null)return this._.transform;var d=this.paper._viewBoxShift,e=d?"s"+[d.scale,d.scale]+"-1-1t"+[d.dx,d.dy]:o,f;d&&(f=b=c(b).replace(/\.{3}|\u2026/g,this._.transform||o)),a._extractTransform(this,e+b);var g=this.matrix.clone(),h=this.skew,i=this.node,j,k=~c(this.attrs.fill).indexOf("-"),l=!c(this.attrs.fill).indexOf("url(");g.translate(-0.5,-0.5);if(l||k||this.type=="image"){h.matrix="1 0 0 1",h.offset="0 0",j=g.split();if(k&&j.noRotation||!j.isSimple){i.style.filter=g.toFilter();var m=this.getBBox(),p=this.getBBox(1),q=m.x-p.x,r=m.y-p.y;i.coordorigin=q*-u+n+r*-u,z(this,1,1,q,r,0)}else i.style.filter=o,z(this,j.scalex,j.scaley,j.dx,j.dy,j.rotate)}else i.style.filter=o,h.matrix=c(g),h.offset=g.offset();f&&(this._.transform=f);return this},E.rotate=function(a,b,e){if(this.removed)return this;if(a!=null){a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this._.dirtyT=1,this.transform(this._.transform.concat([["r",a,b,e]]));return this}},E.translate=function(a,b){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this._.bbox&&(this._.bbox.x+=a,this._.bbox.y+=b),this.transform(this._.transform.concat([["t",a,b]]));return this},E.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3]),isNaN(e)&&(e=null),isNaN(f)&&(f=null)),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]])),this._.dirtyT=1;return this},E.hide=function(){!this.removed&&(this.node.style.display="none");return this},E.show=function(){!this.removed&&(this.node.style.display=o);return this},E._getBBox=function(){if(this.removed)return{};return{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},E.remove=function(){if(!this.removed&&!!this.node.parentNode){this.paper.__set__&&this.paper.__set__.exclude(this),a.eve.unbind("raphael.*.*."+this.id),a._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;this.removed=!0}},E.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c==j&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;var g=c.split(k),h={};for(var i=0,m=g.length;i<m;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return m-1?h:h[g[0]]}if(this.attrs&&d==null&&a.is(c,"array")){h={};for(i=0,m=c.length;i<m;i++)h[c[i]]=this.attr(c[i]);return h}var n;d!=null&&(n={},n[c]=d),d==null&&a.is(c,"object")&&(n=c);for(var o in n)l("raphael.attr."+o+"."+this.id,this,n[o]);if(n){for(o in this.paper.customAttributes)if(this.paper.customAttributes[b](o)&&n[b](o)&&a.is(this.paper.customAttributes[o],"function")){var p=this.paper.customAttributes[o].apply(this,[].concat(n[o]));this.attrs[o]=n[o];for(var q in p)p[b](q)&&(n[q]=p[q])}n.text&&this.type=="text"&&(this.textpath.string=n.text),B(this,n)}return this},E.toFront=function(){!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&a._tofront(this,this.paper);return this},E.toBack=function(){if(this.removed)return this;this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper));return this},E.insertAfter=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[b.length-1]),b.node.nextSibling?b.node.parentNode.insertBefore(this.node,b.node.nextSibling):b.node.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},E.insertBefore=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[0]),b.node.parentNode.insertBefore(this.node,b.node),a._insertbefore(this,b,this.paper);return this},E.blur=function(b){var c=this.node.runtimeStyle,d=c.filter;d=d.replace(r,o),+b!==0?(this.attrs.blur=b,c.filter=d+n+m+".Blur(pixelradius="+(+b||1.5)+")",c.margin=a.format("-{0}px 0 0 -{0}px",f(+b||1.5))):(c.filter=d,c.margin=0,delete this.attrs.blur)},a._engine.path=function(a,b){var c=F("shape");c.style.cssText=t,c.coordsize=u+n+u,c.coordorigin=b.coordorigin;var d=new D(c,b),e={fill:"none",stroke:"#000"};a&&(e.path=a),d.type="path",d.path=[],d.Path=o,B(d,e),b.canvas.appendChild(c);var f=F("skew");f.on=!0,c.appendChild(f),d.skew=f,d.transform(o);return d},a._engine.rect=function(b,c,d,e,f,g){var h=a._rectPath(c,d,e,f,g),i=b.path(h),j=i.attrs;i.X=j.x=c,i.Y=j.y=d,i.W=j.width=e,i.H=j.height=f,j.r=g,j.path=h,i.type="rect";return i},a._engine.ellipse=function(a,b,c,d,e){var f=a.path(),g=f.attrs;f.X=b-d,f.Y=c-e,f.W=d*2,f.H=e*2,f.type="ellipse",B(f,{cx:b,cy:c,rx:d,ry:e});return f},a._engine.circle=function(a,b,c,d){var e=a.path(),f=e.attrs;e.X=b-d,e.Y=c-d,e.W=e.H=d*2,e.type="circle",B(e,{cx:b,cy:c,r:d});return e},a._engine.image=function(b,c,d,e,f,g){var h=a._rectPath(d,e,f,g),i=b.path(h).attr({stroke:"none"}),k=i.attrs,l=i.node,m=l.getElementsByTagName(j)[0];k.src=c,i.X=k.x=d,i.Y=k.y=e,i.W=k.width=f,i.H=k.height=g,k.path=h,i.type="image",m.parentNode==l&&l.removeChild(m),m.rotate=!0,m.src=c,m.type="tile",i._.fillpos=[d,e],i._.fillsize=[f,g],l.appendChild(m),z(i,1,1,0,0,0);return i},a._engine.text=function(b,d,e,g){var h=F("shape"),i=F("path"),j=F("textpath");d=d||0,e=e||0,g=g||"",i.v=a.format("m{0},{1}l{2},{1}",f(d*u),f(e*u),f(d*u)+1),i.textpathok=!0,j.string=c(g),j.on=!0,h.style.cssText=t,h.coordsize=u+n+u,h.coordorigin="0 0";var k=new D(h,b),l={fill:"#000",stroke:"none",font:a._availableAttrs.font,text:g};k.shape=h,k.path=i,k.textpath=j,k.type="text",k.attrs.text=c(g),k.attrs.x=d,k.attrs.y=e,k.attrs.w=1,k.attrs.h=1,B(k,l),h.appendChild(j),h.appendChild(i),b.canvas.appendChild(h);var m=F("skew");m.on=!0,h.appendChild(m),k.skew=m,k.transform(o);return k},a._engine.setSize=function(b,c){var d=this.canvas.style;this.width=b,this.height=c,b==+b&&(b+="px"),c==+c&&(c+="px"),d.width=b,d.height=c,d.clip="rect(0 "+b+" "+c+" 0)",this._viewBox&&a._engine.setViewBox.apply(this,this._viewBox);return this},a._engine.setViewBox=function(b,c,d,e,f){a.eve("raphael.setViewBox",this,this._viewBox,[b,c,d,e,f]);var h=this.width,i=this.height,j=1/g(d/h,e/i),k,l;f&&(k=i/e,l=h/d,d*k<h&&(b-=(h-d*k)/2/k),e*l<i&&(c-=(i-e*l)/2/l)),this._viewBox=[b,c,d,e,!!f],this._viewBoxShift={dx:-b,dy:-c,scale:j},this.forEach(function(a){a.transform("...")});return this};var F;a._engine.initWin=function(a){var b=a.document;b.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!b.namespaces.rvml&&b.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),F=function(a){return b.createElement("<rvml:"+a+' class="rvml">')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},a._engine.initWin(a._g.win),a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b.container,d=b.height,e,f=b.width,g=b.x,h=b.y;if(!c)throw new Error("VML container not found.");var i=new a._Paper,j=i.canvas=a._g.doc.createElement("div"),k=j.style;g=g||0,h=h||0,f=f||512,d=d||342,i.width=f,i.height=d,f==+f&&(f+="px"),d==+d&&(d+="px"),i.coordsize=u*1e3+n+u*1e3,i.coordorigin="0 0",i.span=a._g.doc.createElement("span"),i.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",j.appendChild(i.span),k.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",f,d),c==1?(a._g.doc.body.appendChild(j),k.left=g+"px",k.top=h+"px",k.position="absolute"):c.firstChild?c.insertBefore(j,c.firstChild):c.appendChild(j),i.renderfix=function(){};return i},a.prototype.clear=function(){a.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=a._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},a.prototype.remove=function(){a.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;return!0};var G=a.st;for(var H in E)E[b](H)&&!G[b](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}(window.Raphael)
\ No newline at end of file
... ...
 window.onload = function () {
var paper = Raphael("holder");
//var curve = paper.ellipse(100, 100, 1, 1).attr({"stroke-width": 0, fill: Color.red});
var text = "Betty Botter bought some butter but, she said, the butter's bitter. If I put it in my batter, it will make my batter bitter. But a bit of better butter will make my batter better. So, she bought a bit of butter, better than her bitter butter, and she put it in her batter, and the batter was not bitter. It was better Betty Botter bought a bit better butter.";
var font = {font: "11px Arial", "font-style":"italic", opacity: 1, "fill": LABEL_COLOR, stroke: LABEL_COLOR, "stroke-width":.3};
var font = {font: "11px Arial", opacity: 1, "fill": LABEL_COLOR};
var boxWidth = 100
var AttributedStringIterator = function(text){
//this.text = this.rtrim(this.ltrim(text));
text = text.replace(/(\s)+/, " ");
this.text = this.rtrim(text);
/*
if (beginIndex < 0 || beginIndex > endIndex || endIndex > length()) {
throw new IllegalArgumentException("Invalid substring range");
}
*/
this.beginIndex = 0;
this.endIndex = this.text.length;
this.currentIndex = this.beginIndex;
//console.group("[AttributedStringIterator]");
var i = 0;
var string = this.text;
var fullPos = 0;
//console.log("string: \"" + string + "\", length: " + string.length);
this.startWordOffsets = [];
this.startWordOffsets.push(fullPos);
// TODO: remove i 1000
while (i<1000) {
var pos = string.search(/[ \t\n\f-\.\,]/);
if (pos == -1)
break;
// whitespace start
fullPos += pos;
string = string.substr(pos);
////console.log("fullPos: " + fullPos + ", pos: " + pos + ", string: ", string);
// remove whitespaces
var pos = string.search(/[^ \t\n\f-\.\,]/);
if (pos == -1)
break;
// whitespace end
fullPos += pos;
string = string.substr(pos);
////console.log("fullPos: " + fullPos);
this.startWordOffsets.push(fullPos);
i++;
}
//console.log("startWordOffsets: ", this.startWordOffsets);
//console.groupEnd();
};
AttributedStringIterator.prototype = {
getEndIndex: function(pos){
if (typeof(pos) == "undefined")
return this.endIndex;
var string = this.text.substr(pos, this.endIndex - pos);
var posEndOfLine = string.search(/[\n]/);
if (posEndOfLine == -1)
return this.endIndex;
else
return pos + posEndOfLine;
},
getBeginIndex: function(){
return this.beginIndex;
},
isWhitespace: function(pos){
var str = this.text[pos];
var whitespaceChars = " \t\n\f";
return (whitespaceChars.indexOf(str) != -1);
},
isNewLine: function(pos){
var str = this.text[pos];
var whitespaceChars = "\n";
return (whitespaceChars.indexOf(str) != -1);
},
preceding: function(pos){
//console.group("[AttributedStringIterator.preceding]");
for(var i in this.startWordOffsets) {
var startWordOffset = this.startWordOffsets[i];
if (pos < startWordOffset && i>0) {
//console.log("startWordOffset: " + this.startWordOffsets[i-1]);
//console.groupEnd();
return this.startWordOffsets[i-1];
}
}
//console.log("pos: " + pos);
//console.groupEnd();
return this.startWordOffsets[i];
},
following: function(pos){
//console.group("[AttributedStringIterator.following]");
for(var i in this.startWordOffsets) {
var startWordOffset = this.startWordOffsets[i];
if (pos < startWordOffset && i>0) {
//console.log("startWordOffset: " + this.startWordOffsets[i]);
//console.groupEnd();
return this.startWordOffsets[i];
}
}
//console.log("pos: " + pos);
//console.groupEnd();
return this.startWordOffsets[i];
},
ltrim: function(str){
var patt2=/^\s+/g;
return str.replace(patt2, "");
},
rtrim: function(str){
var patt2=/\s+$/g;
return str.replace(patt2, "");
},
getLayout: function(start, limit){
return this.text.substr(start, limit - start);
},
getCharAtPos: function(pos) {
return this.text[pos];
}
};
/*
var TextMeasurer = function(paper, text, fontAttrs){
this.text = text;
this.paper = paper;
this.fontAttrs = fontAttrs;
this.fStart = this.text.getBeginIndex();
};
TextMeasurer.prototype = {
getLineBreakIndex: function(start, maxAdvance){
var localStart = start - this.fStart;
},
getLayout: function(){
}
}
*/
var LineBreakMeasurer = function(paper, text, fontAttrs){
this.paper = paper;
this.text = new AttributedStringIterator(text);
this.fontAttrs = fontAttrs;
if (this.text.getEndIndex() - this.text.getBeginIndex() < 1) {
throw {message: "Text must contain at least one character.", code: "IllegalArgumentException"};
}
//this.measurer = new TextMeasurer(paper, this.text, this.fontAttrs);
this.limit = this.text.getEndIndex();
this.pos = this.start = this.text.getBeginIndex();
this.rafaelTextObject = this.paper.text(100, 100, this.text.text).attr(fontAttrs).attr("text-anchor", "start");
this.svgTextObject = this.rafaelTextObject[0];
};
LineBreakMeasurer.prototype = {
nextOffset: function(wrappingWidth, offsetLimit, requireNextWord) {
//console.group("[nextOffset]");
var nextOffset = this.pos;
if (this.pos < this.limit) {
if (offsetLimit <= this.pos) {
throw {message: "offsetLimit must be after current position", code: "IllegalArgumentException"};
}
var charAtMaxAdvance = this.getLineBreakIndex(this.pos, wrappingWidth);
//charAtMaxAdvance --;
//console.log("charAtMaxAdvance:", charAtMaxAdvance, ", [" + this.text.getCharAtPos(charAtMaxAdvance) + "]");
if (charAtMaxAdvance == this.limit) {
nextOffset = this.limit;
//console.log("charAtMaxAdvance == this.limit");
} else if (this.text.isNewLine(charAtMaxAdvance)) {
console.log("isNewLine");
nextOffset = charAtMaxAdvance+1;
} else if (this.text.isWhitespace(charAtMaxAdvance)) {
// TODO: find next noSpaceChar
//return nextOffset;
nextOffset = this.text.following(charAtMaxAdvance);
} else {
// Break is in a word; back up to previous break.
/*
var testPos = charAtMaxAdvance + 1;
if (testPos == this.limit) {
console.error("hbz...");
} else {
nextOffset = this.text.preceding(charAtMaxAdvance);
}
*/
nextOffset = this.text.preceding(charAtMaxAdvance);
if (nextOffset <= this.pos) {
nextOffset = Math.max(this.pos+1, charAtMaxAdvance);
}
}
}
if (nextOffset > offsetLimit) {
nextOffset = offsetLimit;
}
//console.log("nextOffset: " + nextOffset);
//console.groupEnd();
return nextOffset;
},
nextLayout: function(wrappingWidth) {
//console.groupCollapsed("[nextLayout]");
if (this.pos < this.limit) {
var requireNextWord = false;
var layoutLimit = this.nextOffset(wrappingWidth, this.limit, requireNextWord);
//console.log("layoutLimit:", layoutLimit);
if (layoutLimit == this.pos) {
//console.groupEnd();
return null;
}
var result = this.text.getLayout(this.pos, layoutLimit);
//console.log("layout: \"" + result + "\"");
// remove end of line
//var posEndOfLine = this.text.getEndIndex(this.pos);
//if (posEndOfLine < result.length)
// result = result.substr(0, posEndOfLine);
this.pos = layoutLimit;
//console.groupEnd();
return result;
} else {
//console.groupEnd();
return null;
}
},
getLineBreakIndex: function(pos, wrappingWidth) {
//console.group("[getLineBreakIndex]");
//console.log("pos:"+pos + ", text: \""+ this.text.text.replace(/\n/g, "_").substr(pos, 1) + "\"");
var bb = this.rafaelTextObject.getBBox();
var charNum = -1;
try {
var svgPoint = this.svgTextObject.getStartPositionOfChar(pos);
//var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.blue});
svgPoint.x = svgPoint.x + wrappingWidth;
//svgPoint.y = bb.y;
//console.log("svgPoint:", svgPoint);
//var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.red});
charNum = this.svgTextObject.getCharNumAtPosition(svgPoint);
} catch (e){
console.warn("getStartPositionOfChar error, pos:" + pos);
/*
var testPos = pos + 1;
if (testPos < this.limit) {
return testPos
}
*/
}
//console.log("charNum:", charNum);
if (charNum == -1) {
//console.groupEnd();
return this.text.getEndIndex(pos);
} else {
// When case there is new line between pos and charnum then use this new line
var newLineIndex = this.text.getEndIndex(pos);
if (newLineIndex < charNum ) {
console.log("newLineIndex <= charNum, newLineIndex:"+newLineIndex+", charNum:"+charNum, "\"" + this.text.text.substr(newLineIndex+1).replace(/\n/g, "↵") + "\"");
//console.groupEnd();
return newLineIndex;
}
//var charAtMaxAdvance = this.text.text.substring(charNum, charNum + 1);
var charAtMaxAdvance = this.text.getCharAtPos(charNum);
//console.log("!!charAtMaxAdvance: " + charAtMaxAdvance);
//console.groupEnd();
return charNum;
}
},
getPosition: function() {
return this.pos;
}
};
// ******
function drawMultilineText(text, x, y, boxWidth, boxHeight, options) {
var TEXT_PADDING = 3;
var width = boxWidth - (2 * TEXT_PADDING);
if (boxHeight)
var height = boxHeight - (2 * TEXT_PADDING);
var layouts = [];
var measurer = new LineBreakMeasurer(paper, text, font);
var lineHeight = measurer.rafaelTextObject.getBBox().height;
console.log("text: ", text.replace(/\n/g, "↵"));
if (height) {
var availableLinesCount = parseInt(height/lineHeight);
console.log("availableLinesCount: " + availableLinesCount);
}
var i = 1;
while (measurer.getPosition() < measurer.text.getEndIndex()) {
var layout = measurer.nextLayout(width);
//console.log("LAYOUT: " + layout + ", getPosition: " + measurer.getPosition());
if (layout != null) {
if (!availableLinesCount || i < availableLinesCount) {
layouts.push(layout);
} else {
layouts.push(fitTextToWidth(layout + "...", boxWidth));
break;
}
}
i++;
};
console.log(layouts);
measurer.rafaelTextObject.attr({"text": layouts.join("\n")});
//measurer.rafaelTextObject.attr({"text-anchor": "end"});
//measurer.rafaelTextObject.attr({"text-anchor": "middle"});
if (options)
measurer.rafaelTextObject.attr({"text-anchor": options["text-anchor"]});
var bb = measurer.rafaelTextObject.getBBox();
//measurer.rafaelTextObject.attr({"x": x + boxWidth/2});
if (options["vertical-align"] == "top")
measurer.rafaelTextObject.attr({"y": y + bb.height/2 + TEXT_PADDING});
else
measurer.rafaelTextObject.attr({"y": y + height/2});
//var bb = measurer.rafaelTextObject.getBBox();
if (measurer.rafaelTextObject.attr("text-anchor") == "middle" )
measurer.rafaelTextObject.attr("x", x + boxWidth/2 + TEXT_PADDING/2);
else if (measurer.rafaelTextObject.attr("text-anchor") == "end" )
measurer.rafaelTextObject.attr("x", x + boxWidth + TEXT_PADDING/2);
else
measurer.rafaelTextObject.attr("x", x + boxWidth/2 - bb.width/2 + TEXT_PADDING/2);
var boxStyle = {stroke: Color.LightSteelBlue2, "stroke-width": 1.0, "stroke-dasharray": "- "};
/*
var box = paper.rect(x+.0 + boxWidth/2 - bb.width/2+ TEXT_PADDING/2, y + .5 + boxHeight/2 - bb.height/2, width, height).attr(boxStyle);
box.attr("height", bb.height);
*/
//var box = paper.rect(bb.x - .5 + bb.width/2 + TEXT_PADDING, bb.y + bb.height/2, bb.width, bb.height).attr(boxStyle);
var textAreaCX = x + boxWidth/2;
var textAreaCY = y + height/2;
var dotLeftTop = paper.ellipse(x, y, 3, 3).attr({"stroke-width": 0, fill: Color.LightSteelBlue, stroke: "none"});
var dotCenter = paper.ellipse(textAreaCX, textAreaCY, 3, 3).attr({fill: Color.LightSteelBlue2, stroke: "none"});
/*
// real bbox
var bb = measurer.rafaelTextObject.getBBox();
var rect = paper.rect(bb.x+.5, bb.y + .5, bb.width, bb.height).attr({"stroke-width": 1});
*/
var boxStyle = {stroke: Color.LightSteelBlue2, "stroke-width": 1.0, "stroke-dasharray": "- "};
var rect = paper.rect(x+.5, y + .5, boxWidth, boxHeight).attr(boxStyle);
}
/*
for (var i=0; i<1; i++) {
var t = text;
//var t = "Высококвалифицирова";
var text = paper.text(300, 100, t).attr(font).attr("text-anchor", "start");
var bbText = text.getBBox();
paper.rect(300+.5, 100 + .5, bbText.width, bbText.height).attr({"stroke-width": 1});
console.log("t: ", t.replace(/\n/g, "↵"));
while (measurer.getPosition() < measurer.text.getEndIndex()) {
var layout = measurer.nextLayout(width);
//console.log("LAYOUT: " + layout + ", getPosition: " + measurer.getPosition());
if (layout != null)
layouts.push(layout);
};
measurer.rafaelTextObject.attr("text", layouts.join("\n"));
var bb = measurer.rafaelTextObject.getBBox();
var rect = paper.rect(bb.x+.5, bb.y + .5, bb.width, bb.height).attr({"stroke-width": 1});
lay.push(layouts);
console.log(layouts);
}
*/
var fitTextToWidth = function(original, width) {
var text = original;
// TODO: move attr on parameters
var attr = {font: "11px Arial", opacity: 0};
// remove length for "..."
var dots = paper.text(0, 0, "...").attr(attr).hide();
var dotsBB = dots.getBBox();
var maxWidth = width - dotsBB.width;
var textElement = paper.text(0, 0, text).attr(attr).hide();
var bb = textElement.getBBox();
// it's a little bit incorrect with "..."
while (bb.width > maxWidth && text.length > 0) {
text = text.substring(0, text.length - 1);
textElement.attr({"text": text});
bb = textElement.getBBox();
}
// remove element from paper
textElement.remove();
if (text != original) {
text = text + "...";
}
return text;
}
var x=100, y=90, height=20;
var options = {"text-anchor": "middle", "boxHeight": 150, "vertical-align": "top"};
var options = {"boxHeight": 150, "vertical-align": "top"};
drawMultilineText(text, x, y, 150, 100, options);
};
\ No newline at end of file
... ...
body { background: #fafafa; color: #708090; /* font: 300 100.1% "Helvetica Neue", Helvetica, "Arial Unicode MS", Arial, sans-serif; */ font-family: Verdana, sans-serif, Arial; font-size: 10px;}.wrapper{ height: 100%; position: relative; width: 100%;}/* #holder { height: 480px; width: 640px; b_ackground: #F8F8FF; -moz-border-radius: 10px; -webkit-border-radius: 10px; -webkit-box-shadow: 0 1px 3px #666; background: #DDD url(./images/bg.png); /* background: #DDD url(./images/checker-bg.png); * / b_order:0px solid #dedede; } */div.diagramHolder { float:left; }div.diagram{ border:1px solid #dedede; margin: 5px; padding: 5px; background: #FFF;}div.diagram.hidden{ display:none;}svg { background: #DDD url(./images/bg.png);} div.diagram-info { float:left; position: relative; padding: 5px;} /* Breadcrumbs */ #diagramBreadCrumbs { margin-left: 2px; margin-right: 2px; margin-top: 10px;}#diagramBreadCrumbs ul { list-style: none; background-color: white; border: 1px solid #DEDEDE; border-color: #C0C2C5; margin: 0; margin-bottom: 10px; margin-left: 0; -webkit-padding-start: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;}#diagramBreadCrumbs li { /*text-decoration: underline;*/ display: inline-block; vertical-align: middle; padding-left: .75em; padding-right: 0; cursor: pointer;}#diagramBreadCrumbs li.selected { color: #9370DB; color: #4876FF; color: #4F94CD; font-weight: bold;}#diagramBreadCrumbs li span { background: url(images/breadcrumbs.png) no-repeat 100% 50%; display: block; padding: .5em 15px .5em 0;} /* Progress bar */ .ui-progressbar { height: 25px; /*height:2em; text-align: left; overflow: hidden; */ background: white; border: 1px solid #949DAD; margin: 2px; overflow: hidden; padding: 1px; position: relative; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;}.ui-progressbar .ui-progressbar-value { m_argin: -1px; height:100%; background: #D4E4FF; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;}.ui-widget-header a { color: #222222/*{fcHeader}*/; } .ui-progressbar .ui-progressbar-label{ position: absolute; margin-top: 7px; border:0px solid red; width: 100%; text-align: center;}
\ No newline at end of file
... ...