var ProtoJS={Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf("Opera")===-1),Opera:navigator.userAgent.indexOf("Opera")>-1,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")===-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)}};if(typeof console=="undefined"){console={log:function(){}}}ProtoJS.Event={observe:function(b,a,c){if(b.addEventListener){b.addEventListener(a,c,false)}else{b.attachEvent("on"+a,c)}return b}};ProtoJS.mix=function(b,a,d){d=d||false;for(var c in b){if(d||!a[c]){a[c]=b[c]}else{console.log("ProtoJS: Found an implementation for "+c)}}};ProtoJS.Object={isArray:function(a){a=a||this;return a!=null&&typeof a=="object"&&"splice" in a&&"join" in a},isHash:function(a){a=a||this;return a instanceof Hash},isFunction:function(a){a=a||this;return typeof a=="function"},isString:function(a){a=a||this;return typeof a=="string"},isNumber:function(a){a=a||this;return typeof a=="number"},isUndefined:function(a){return typeof a=="undefined"}};ProtoJS.mix(ProtoJS.Object,Object);ProtoJS.String={contains:function(a){return this.indexOf(a)>-1},trim:function(a){if(typeof this.replace=="function"){a=this}return a.replace(/^\s*/,"").replace(/\s*$/,"")},isArray:function(){return false},isHash:function(){return false},isFunction:function(){return false},isString:function(){return true},isNumber:function(){return false}};ProtoJS.mix(ProtoJS.String,String.prototype);ProtoJS.Number={isArray:function(){return false},isHash:function(){return false},isFunction:function(){return false},isString:function(){return false},isNumber:function(){return true}};ProtoJS.mix(ProtoJS.Number,Number.prototype);(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(h){var g=this.prototype;a=true;var f=new this();a=false;f.isArray=function(){return false};f.isHash=function(){return false};f.isFunction=function(){return false};f.isNumber=function(){return false};f.isString=function(){return false};function c(k,l){return function(){var n=this._super;this._super=g[k];var m=l.apply(this,arguments);this._super=n;return m}}for(var e in h){f[e]=typeof h[e]=="function"&&typeof g[e]=="function"&&b.test(h[e])?c(e,h[e]):h[e]}if(ProtoJS.Browser.IE&&h.toString){f.toString=c("toString",h.toString)}function d(){if(!a&&this.init){this.init.apply(this,arguments)}}function d(){if(!a&&this.init){this.init.apply(this,arguments)}}d.prototype=f;d.constructor=d;d.extend=arguments.callee;return d}})();ProtoJS.Array={compare:function(a){if(this.length!=a.length){return false}for(var b=0;b<a.length;b++){if(this[b].compare){if(!this[b].compare(a[b])){return false}}if(this[b]!==a[b]){return false}}return true},has:function(a){return this.indexOf(a)>-1},unique:function unique(){var a=this.dup();this.clear();a.iterate(function(b){if(!this.has(b)){this.push(b)}}.scope(this));return this},iterate:function(c,b){for(var a=0,d=this.length;a<d;a++){c.call(b,this[a],a)}},dup:function(){return[].concat(this)},clear:function(){this.length=0;return this},remove:function(){var b=$A(arguments);var a=this.dup();this.clear();a.iterate(function(c){if(!b.has(c)){this.push(c)}}.scope(this));return this},isArray:function(){return true},isHash:function(){return false},isFunction:function(){return false},isString:function(){return false},isNumber:function(){return false}};ProtoJS.mix(ProtoJS.Array,Array.prototype);function $A(a){var c=a.length||0;var b=new Array(c);while(c--){b[c]=a[c]}return b}var Hash=Class.extend({init:function init(a){this.hash=a||{}},set:function(a,b){this.hash[a]=b},get:function(a){return this.hash[a]},keys:function keys(){var a=[];this.iterate(function(b,c){a.push(b)});return a},values:function values(){var a=[];this.iterate(function(b,c){a.push(c)});return a},hasKey:function has(a){return this.keys().has(a)},hasValue:function has(a){return this.values().has(a)},iterate:function each(c,b){for(var a in this.hash){c.call(b,a,this.hash[a])}},isArray:function(){return false},isHash:function(){return true},isFunction:function(){return false},isString:function(){return false},isNumber:function(){return false}});var $H=function(a){return new Hash(a)};ProtoJS.Function={after:function(){var c=this;var a=$A(arguments);var b=a.shift();return window.setTimeout(function(){return c.apply(c,a)},b)},scope:function scope(a){var b=this;return function(){return b.apply(a,arguments)}},isArray:function(){return false},isHash:function(){return false},isFunction:function(){return true},isString:function(){return false},isNumber:function(){return false}};ProtoJS.mix(ProtoJS.Function,Function.prototype);ProtoJS.Ajax=Class.extend({init:function(){this.xmlhttp=null;if(window.XMLHttpRequest){this.xmlhttp=new XMLHttpRequest()}else{if(window.ActiveXObject){this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}else{alert("Your browser does not support XMLHTTP!")}}},fetch:function(a,b){if(a.substring(0,4)=="http"){return this.fetchUsingXDR(a,b)}this.xmlhttp.open("GET",a,typeof b=="function");if(b){this.xmlhttp.onreadystatechange=function(){b.call(this,this.xmlhttp)}.scope(this)}this.xmlhttp.send(null);return this.xmlhttp.responseText},fetchUsingXDR:function(a,d){ProtoJS.XDR.push(d);var b=document.createElement("script");var c=a.contains("?")?"&":"?";b.src=a+c+"f=ProtoJS.XDR["+(ProtoJS.XDR.length-1)+"]";b.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(b)}});ProtoJS.XDR=[];ProtoJS.version="0.1-7";if(!document.createElement("canvas").getContext){(function(){var ac=Math;var n=ac.round;var l=ac.sin;var B=ac.cos;var I=ac.abs;var O=ac.sqrt;var d=10;var f=d/2;var A=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];function z(){return this.context_||(this.context_=new E(this))}var u=Array.prototype.slice;function g(p,Z,ah){var m=u.call(arguments,2);return function(){return p.apply(Z,m.concat(u.call(arguments)))}}function ag(m){return String(m).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function aa(Z,p,m){if(!Z.namespaces[p]){Z.namespaces.add(p,m,"#default#VML")}}function S(p){aa(p,"g_vml_","urn:schemas-microsoft-com:vml");aa(p,"g_o_","urn:schemas-microsoft-com:office:office");if(!p.styleSheets.ex_canvas_){var m=p.createStyleSheet();m.owningElement.id="ex_canvas_";m.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}S(document);var e={init:function(m){var p=m||document;p.createElement("canvas");p.attachEvent("onreadystatechange",g(this.init_,this,p))},init_:function(Z){var p=Z.getElementsByTagName("canvas");for(var m=0;m<p.length;m++){this.initElement(p[m])}},initElement:function(p){if(!p.getContext){p.getContext=z;S(p.ownerDocument);p.innerHTML="";p.attachEvent("onpropertychange",y);p.attachEvent("onresize",X);var m=p.attributes;if(m.width&&m.width.specified){p.style.width=m.width.nodeValue+"px"}else{p.width=p.clientWidth}if(m.height&&m.height.specified){p.style.height=m.height.nodeValue+"px"}else{p.height=p.clientHeight}}return p}};function y(p){var m=p.srcElement;switch(p.propertyName){case"width":m.getContext().clearRect();m.style.width=m.attributes.width.nodeValue+"px";m.firstChild.style.width=m.clientWidth+"px";break;case"height":m.getContext().clearRect();m.style.height=m.attributes.height.nodeValue+"px";m.firstChild.style.height=m.clientHeight+"px";break}}function X(p){var m=p.srcElement;if(m.firstChild){m.firstChild.style.width=m.clientWidth+"px";m.firstChild.style.height=m.clientHeight+"px"}}e.init();var k=[];for(var af=0;af<16;af++){for(var ae=0;ae<16;ae++){k[af*16+ae]=af.toString(16)+ae.toString(16)}}function C(){return[[1,0,0],[0,1,0],[0,0,1]]}function K(ah,Z){var p=C();for(var m=0;m<3;m++){for(var ak=0;ak<3;ak++){var ai=0;for(var aj=0;aj<3;aj++){ai+=ah[m][aj]*Z[aj][ak]}p[m][ak]=ai}}return p}function w(p,m){m.fillStyle=p.fillStyle;m.lineCap=p.lineCap;m.lineJoin=p.lineJoin;m.lineWidth=p.lineWidth;m.miterLimit=p.miterLimit;m.shadowBlur=p.shadowBlur;m.shadowColor=p.shadowColor;m.shadowOffsetX=p.shadowOffsetX;m.shadowOffsetY=p.shadowOffsetY;m.strokeStyle=p.strokeStyle;m.globalAlpha=p.globalAlpha;m.font=p.font;m.textAlign=p.textAlign;m.textBaseline=p.textBaseline;m.arcScaleX_=p.arcScaleX_;m.arcScaleY_=p.arcScaleY_;m.lineScale_=p.lineScale_}var b={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"};function N(p){var ah=p.indexOf("(",3);var m=p.indexOf(")",ah+1);var Z=p.substring(ah+1,m).split(",");if(Z.length!=4||p.charAt(3)!="a"){Z[3]=1}return Z}function c(m){return parseFloat(m)/100}function r(p,Z,m){return Math.min(m,Math.max(Z,p))}function J(aj){var m,al,am,ak,an,ai;ak=parseFloat(aj[0])/360%360;if(ak<0){ak++}an=r(c(aj[1]),0,1);ai=r(c(aj[2]),0,1);if(an==0){m=al=am=ai}else{var Z=ai<0.5?ai*(1+an):ai+an-ai*an;var ah=2*ai-Z;m=a(ah,Z,ak+1/3);al=a(ah,Z,ak);am=a(ah,Z,ak-1/3)}return"#"+k[Math.floor(m*255)]+k[Math.floor(al*255)]+k[Math.floor(am*255)]}function a(p,m,Z){if(Z<0){Z++}if(Z>1){Z--}if(6*Z<1){return p+(m-p)*6*Z}else{if(2*Z<1){return m}else{if(3*Z<2){return p+(m-p)*(2/3-Z)*6}else{return p}}}}var D={};function G(m){if(m in D){return D[m]}var ai,ah=1;m=String(m);if(m.charAt(0)=="#"){ai=m}else{if(/^rgb/.test(m)){var Z=N(m);var ai="#",aj;for(var p=0;p<3;p++){if(Z[p].indexOf("%")!=-1){aj=Math.floor(c(Z[p])*255)}else{aj=+Z[p]}ai+=k[r(aj,0,255)]}ah=+Z[3]}else{if(/^hsl/.test(m)){var Z=N(m);ai=J(Z);ah=Z[3]}else{ai=b[m]||m}}}return D[m]={color:ai,alpha:ah}}var o={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"};var M={};function F(m){if(M[m]){return M[m]}var ah=document.createElement("div");var Z=ah.style;try{Z.font=m}catch(p){}return M[m]={style:Z.fontStyle||o.style,variant:Z.fontVariant||o.variant,weight:Z.fontWeight||o.weight,size:Z.fontSize||o.size,family:Z.fontFamily||o.family}}function v(ah,Z){var m={};for(var ak in ah){m[ak]=ah[ak]}var aj=parseFloat(Z.currentStyle.fontSize),ai=parseFloat(ah.size);if(typeof ah.size=="number"){m.size=ah.size}else{if(ah.size.indexOf("px")!=-1){m.size=ai}else{if(ah.size.indexOf("em")!=-1){m.size=aj*ai}else{if(ah.size.indexOf("%")!=-1){m.size=(aj/100)*ai}else{if(ah.size.indexOf("pt")!=-1){m.size=ai/0.75}else{m.size=aj}}}}}m.size*=0.981;return m}function ad(m){return m.style+" "+m.variant+" "+m.weight+" "+m.size+"px "+m.family}var s={butt:"flat",round:"round"};function T(m){return s[m]||"square"}function E(m){this.m_=C();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=d*1;this.globalAlpha=1;this.font="10px sans-serif";this.textAlign="left";this.textBaseline="alphabetic";this.canvas=m;var Z="width:"+m.clientWidth+"px;height:"+m.clientHeight+"px;overflow:hidden;position:absolute";var p=m.ownerDocument.createElement("div");p.style.cssText=Z;m.appendChild(p);var ah=p.cloneNode(false);ah.style.backgroundColor="red";ah.style.filter="alpha(opacity=0)";m.appendChild(ah);this.element_=p;this.arcScaleX_=1;this.arcScaleY_=1;this.lineScale_=1}var q=E.prototype;q.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);this.textMeasureEl_=null}this.element_.innerHTML=""};q.beginPath=function(){this.currentPath_=[]};q.moveTo=function(Z,m){var ah=W(this,Z,m);this.currentPath_.push({type:"moveTo",x:ah.x,y:ah.y});this.currentX_=ah.x;this.currentY_=ah.y};q.lineTo=function(Z,m){var ah=W(this,Z,m);this.currentPath_.push({type:"lineTo",x:ah.x,y:ah.y});this.currentX_=ah.x;this.currentY_=ah.y};q.bezierCurveTo=function(ah,Z,an,am,al,aj){var m=W(this,al,aj);var ak=W(this,ah,Z);var ai=W(this,an,am);L(this,ak,ai,m)};function L(m,ai,ah,Z){m.currentPath_.push({type:"bezierCurveTo",cp1x:ai.x,cp1y:ai.y,cp2x:ah.x,cp2y:ah.y,x:Z.x,y:Z.y});m.currentX_=Z.x;m.currentY_=Z.y}q.quadraticCurveTo=function(al,ah,Z,m){var ak=W(this,al,ah);var aj=W(this,Z,m);var am={x:this.currentX_+2/3*(ak.x-this.currentX_),y:this.currentY_+2/3*(ak.y-this.currentY_)};var ai={x:am.x+(aj.x-this.currentX_)/3,y:am.y+(aj.y-this.currentY_)/3};L(this,am,ai,aj)};q.arc=function(ao,am,an,aj,Z,ah){an*=d;var at=ah?"at":"wa";var ap=ao+B(aj)*an-f;var ar=am+l(aj)*an-f;var m=ao+B(Z)*an-f;var aq=am+l(Z)*an-f;if(ap==m&&!ah){ap+=0.125}var ai=W(this,ao,am);var al=W(this,ap,ar);var ak=W(this,m,aq);this.currentPath_.push({type:at,x:ai.x,y:ai.y,radius:an,xStart:al.x,yStart:al.y,xEnd:ak.x,yEnd:ak.y})};q.rect=function(Z,p,m,ah){this.moveTo(Z,p);this.lineTo(Z+m,p);this.lineTo(Z+m,p+ah);this.lineTo(Z,p+ah);this.closePath()};q.strokeRect=function(Z,p,m,ah){var ai=this.currentPath_;this.beginPath();this.moveTo(Z,p);this.lineTo(Z+m,p);this.lineTo(Z+m,p+ah);this.lineTo(Z,p+ah);this.closePath();this.stroke();this.currentPath_=ai};q.fillRect=function(Z,p,m,ah){var ai=this.currentPath_;this.beginPath();this.moveTo(Z,p);this.lineTo(Z+m,p);this.lineTo(Z+m,p+ah);this.lineTo(Z,p+ah);this.closePath();this.fill();this.currentPath_=ai};q.createLinearGradient=function(p,ah,m,Z){var ai=new V("gradient");ai.x0_=p;ai.y0_=ah;ai.x1_=m;ai.y1_=Z;return ai};q.createRadialGradient=function(ah,aj,Z,p,ai,m){var ak=new V("gradientradial");ak.x0_=ah;ak.y0_=aj;ak.r0_=Z;ak.x1_=p;ak.y1_=ai;ak.r1_=m;return ak};q.drawImage=function(au,Z){var am,ak,ao,aB,ar,ap,aw,aD;var an=au.runtimeStyle.width;var at=au.runtimeStyle.height;au.runtimeStyle.width="auto";au.runtimeStyle.height="auto";var al=au.width;var az=au.height;au.runtimeStyle.width=an;au.runtimeStyle.height=at;if(arguments.length==3){am=arguments[1];ak=arguments[2];ar=ap=0;aw=ao=al;aD=aB=az}else{if(arguments.length==5){am=arguments[1];ak=arguments[2];ao=arguments[3];aB=arguments[4];ar=ap=0;aw=al;aD=az}else{if(arguments.length==9){ar=arguments[1];ap=arguments[2];aw=arguments[3];aD=arguments[4];am=arguments[5];ak=arguments[6];ao=arguments[7];aB=arguments[8]}else{throw Error("Invalid number of arguments")}}}var aC=W(this,am,ak);var ah=aw/2;var p=aD/2;var aA=[];var m=10;var aj=10;aA.push(" <g_vml_:group",' coordsize="',d*m,",",d*aj,'"',' coordorigin="0,0"',' style="width:',m,"px;height:",aj,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var ai=[];ai.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",n(aC.x/d),",","Dy=",n(aC.y/d),"");var ay=aC;var ax=W(this,am+ao,ak);var av=W(this,am,ak+aB);var aq=W(this,am+ao,ak+aB);ay.x=ac.max(ay.x,ax.x,av.x,aq.x);ay.y=ac.max(ay.y,ax.y,av.y,aq.y);aA.push("padding:0 ",n(ay.x/d),"px ",n(ay.y/d),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",ai.join(""),", sizingmethod='clip');")}else{aA.push("top:",n(aC.y/d),"px;left:",n(aC.x/d),"px;")}aA.push(' ">','<g_vml_:image src="',au.src,'"',' style="width:',d*ao,"px;"," height:",d*aB,'px"',' cropleft="',ar/al,'"',' croptop="',ap/az,'"',' cropright="',(al-ar-aw)/al,'"',' cropbottom="',(az-ap-aD)/az,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",aA.join(""))};q.stroke=function(an){var al=[];var ah=false;var Z=10;var ao=10;al.push("<g_vml_:shape",' filled="',!!an,'"',' style="position:absolute;width:',Z,"px;height:",ao,'px;"',' coordorigin="0,0"',' coordsize="',d*Z,",",d*ao,'"',' stroked="',!an,'"',' path="');var ap=false;var ai={x:null,y:null};var am={x:null,y:null};for(var aj=0;aj<this.currentPath_.length;aj++){var m=this.currentPath_[aj];var ak;switch(m.type){case"moveTo":ak=m;al.push(" m ",n(m.x),",",n(m.y));break;case"lineTo":al.push(" l ",n(m.x),",",n(m.y));break;case"close":al.push(" x ");m=null;break;case"bezierCurveTo":al.push(" c ",n(m.cp1x),",",n(m.cp1y),",",n(m.cp2x),",",n(m.cp2y),",",n(m.x),",",n(m.y));break;case"at":case"wa":al.push(" ",m.type," ",n(m.x-this.arcScaleX_*m.radius),",",n(m.y-this.arcScaleY_*m.radius)," ",n(m.x+this.arcScaleX_*m.radius),",",n(m.y+this.arcScaleY_*m.radius)," ",n(m.xStart),",",n(m.yStart)," ",n(m.xEnd),",",n(m.yEnd));break}if(m){if(ai.x==null||m.x<ai.x){ai.x=m.x}if(am.x==null||m.x>am.x){am.x=m.x}if(ai.y==null||m.y<ai.y){ai.y=m.y}if(am.y==null||m.y>am.y){am.y=m.y}}}al.push(' ">');if(!an){x(this,al)}else{H(this,al,ai,am)}al.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",al.join(""))};function x(Z,aj){var p=G(Z.strokeStyle);var ah=p.color;var ai=p.alpha*Z.globalAlpha;var m=Z.lineScale_*Z.lineWidth;if(m<1){ai*=m}aj.push("<g_vml_:stroke",' opacity="',ai,'"',' joinstyle="',Z.lineJoin,'"',' miterlimit="',Z.miterLimit,'"',' endcap="',T(Z.lineCap),'"',' weight="',m,'px"',' color="',ah,'" />')}function H(at,ak,aM,au){var al=at.fillStyle;var aD=at.arcScaleX_;var aC=at.arcScaleY_;var m=au.x-aM.x;var Z=au.y-aM.y;if(al instanceof V){var ap=0;var aH={x:0,y:0};var az=0;var ao=1;if(al.type_=="gradient"){var an=al.x0_/aD;var p=al.y0_/aC;var am=al.x1_/aD;var aO=al.y1_/aC;var aL=W(at,an,p);var aK=W(at,am,aO);var ai=aK.x-aL.x;var ah=aK.y-aL.y;ap=Math.atan2(ai,ah)*180/Math.PI;if(ap<0){ap+=360}if(ap<0.000001){ap=0}}else{var aL=W(at,al.x0_,al.y0_);aH={x:(aL.x-aM.x)/m,y:(aL.y-aM.y)/Z};m/=aD*d;Z/=aC*d;var aF=ac.max(m,Z);az=2*al.r0_/aF;ao=2*al.r1_/aF-az}var ax=al.colors_;ax.sort(function(aQ,aP){return aQ.offset-aP.offset});var ar=ax.length;var aw=ax[0].color;var av=ax[ar-1].color;var aB=ax[0].alpha*at.globalAlpha;var aA=ax[ar-1].alpha*at.globalAlpha;var aG=[];for(var aJ=0;aJ<ar;aJ++){var aq=ax[aJ];aG.push(aq.offset*ao+az+" "+aq.color)}ak.push('<g_vml_:fill type="',al.type_,'"',' method="none" focus="100%"',' color="',aw,'"',' color2="',av,'"',' colors="',aG.join(","),'"',' opacity="',aA,'"',' g_o_:opacity2="',aB,'"',' angle="',ap,'"',' focusposition="',aH.x,",",aH.y,'" />')}else{if(al instanceof U){if(m&&Z){var aj=-aM.x;var aE=-aM.y;ak.push("<g_vml_:fill",' position="',aj/m*aD*aD,",",aE/Z*aC*aC,'"',' type="tile"',' src="',al.src_,'" />')}}else{var aN=G(at.fillStyle);var ay=aN.color;var aI=aN.alpha*at.globalAlpha;ak.push('<g_vml_:fill color="',ay,'" opacity="',aI,'" />')}}}q.fill=function(){this.stroke(true)};q.closePath=function(){this.currentPath_.push({type:"close"})};function W(Z,ai,ah){var p=Z.m_;return{x:d*(ai*p[0][0]+ah*p[1][0]+p[2][0])-f,y:d*(ai*p[0][1]+ah*p[1][1]+p[2][1])-f}}q.save=function(){var m={};w(this,m);this.aStack_.push(m);this.mStack_.push(this.m_);this.m_=K(C(),this.m_)};q.restore=function(){if(this.aStack_.length){w(this.aStack_.pop(),this);this.m_=this.mStack_.pop()}};function h(p){return isFinite(p[0][0])&&isFinite(p[0][1])&&isFinite(p[1][0])&&isFinite(p[1][1])&&isFinite(p[2][0])&&isFinite(p[2][1])}function ab(Z,p,ah){if(!h(p)){return}Z.m_=p;if(ah){var ai=p[0][0]*p[1][1]-p[0][1]*p[1][0];Z.lineScale_=O(I(ai))}}q.translate=function(Z,p){var m=[[1,0,0],[0,1,0],[Z,p,1]];ab(this,K(m,this.m_),false)};q.rotate=function(p){var ah=B(p);var Z=l(p);var m=[[ah,Z,0],[-Z,ah,0],[0,0,1]];ab(this,K(m,this.m_),false)};q.scale=function(Z,p){this.arcScaleX_*=Z;this.arcScaleY_*=p;var m=[[Z,0,0],[0,p,0],[0,0,1]];ab(this,K(m,this.m_),true)};q.transform=function(ai,ah,ak,aj,p,m){var Z=[[ai,ah,0],[ak,aj,0],[p,m,1]];ab(this,K(Z,this.m_),true)};q.setTransform=function(aj,ai,al,ak,ah,Z){var p=[[aj,ai,0],[al,ak,0],[ah,Z,1]];ab(this,p,true)};q.drawText_=function(ap,an,am,at,al){var ar=this.m_,aw=1000,Z=0,av=aw,ak={x:0,y:0},aj=[];var p=v(F(this.font),this.element_);var ah=ad(p);var ax=this.element_.currentStyle;var ai=this.textAlign.toLowerCase();switch(ai){case"left":case"center":case"right":break;case"end":ai=ax.direction=="ltr"?"right":"left";break;case"start":ai=ax.direction=="rtl"?"right":"left";break;default:ai="left"}switch(this.textBaseline){case"hanging":case"top":ak.y=p.size/1.75;break;case"middle":break;default:case null:case"alphabetic":case"ideographic":case"bottom":ak.y=-p.size/2.25;break}switch(ai){case"right":Z=aw;av=0.05;break;case"center":Z=av=aw/2;break}var au=W(this,an+ak.x,am+ak.y);aj.push('<g_vml_:line from="',-Z,' 0" to="',av,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!al,'" stroked="',!!al,'" style="position:absolute;width:1px;height:1px;">');if(al){x(this,aj)}else{H(this,aj,{x:-Z,y:0},{x:av,y:p.size})}var aq=ar[0][0].toFixed(3)+","+ar[1][0].toFixed(3)+","+ar[0][1].toFixed(3)+","+ar[1][1].toFixed(3)+",0,0";var ao=n(au.x/d)+","+n(au.y/d);aj.push('<g_vml_:skew on="t" matrix="',aq,'" ',' offset="',ao,'" origin="',Z,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',ag(ap),'" style="v-text-align:',ai,";font:",ag(ah),'" /></g_vml_:line>');this.element_.insertAdjacentHTML("beforeEnd",aj.join(""))};q.fillText=function(Z,m,ah,p){this.drawText_(Z,m,ah,p,false)};q.strokeText=function(Z,m,ah,p){this.drawText_(Z,m,ah,p,true)};q.measureText=function(Z){if(!this.textMeasureEl_){var m='<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>';this.element_.insertAdjacentHTML("beforeEnd",m);this.textMeasureEl_=this.element_.lastChild}var p=this.element_.ownerDocument;this.textMeasureEl_.innerHTML="";this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(p.createTextNode(Z));return{width:this.textMeasureEl_.offsetWidth}};q.clip=function(){};q.arcTo=function(){};q.createPattern=function(p,m){return new U(p,m)};function V(m){this.type_=m;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[]}V.prototype.addColorStop=function(p,m){m=G(m);this.colors_.push({offset:p,color:m.color,alpha:m.alpha})};function U(p,m){R(p);switch(m){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=m;break;default:P("SYNTAX_ERR")}this.src_=p.src;this.width_=p.width;this.height_=p.height}function P(m){throw new Q(m)}function R(m){if(!m||m.nodeType!=1||m.tagName!="IMG"){P("TYPE_MISMATCH_ERR")}if(m.readyState!="complete"){P("INVALID_STATE_ERR")}}function Q(m){this.code=this[m];this.message=m+": DOM Exception "+this.code}var Y=Q.prototype=new Error;Y.INDEX_SIZE_ERR=1;Y.DOMSTRING_SIZE_ERR=2;Y.HIERARCHY_REQUEST_ERR=3;Y.WRONG_DOCUMENT_ERR=4;Y.INVALID_CHARACTER_ERR=5;Y.NO_DATA_ALLOWED_ERR=6;Y.NO_MODIFICATION_ALLOWED_ERR=7;Y.NOT_FOUND_ERR=8;Y.NOT_SUPPORTED_ERR=9;Y.INUSE_ATTRIBUTE_ERR=10;Y.INVALID_STATE_ERR=11;Y.SYNTAX_ERR=12;Y.INVALID_MODIFICATION_ERR=13;Y.NAMESPACE_ERR=14;Y.INVALID_ACCESS_ERR=15;Y.VALIDATION_ERR=16;Y.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=e;CanvasRenderingContext2D=E;CanvasGradient=V;CanvasPattern=U;DOMException=Q})()}var CanvasTextFunctions={};CanvasTextFunctions.letters={" ":{width:16,points:[]},"!":{width:10,points:[[5,21],[5,7],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]]},'"':{width:16,points:[[4,21],[4,14],[-1,-1],[12,21],[12,14]]},"#":{width:21,points:[[11,25],[4,-7],[-1,-1],[17,25],[10,-7],[-1,-1],[4,12],[18,12],[-1,-1],[3,6],[17,6]]},"$":{width:20,points:[[8,25],[8,-4],[-1,-1],[12,25],[12,-4],[-1,-1],[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},"%":{width:24,points:[[21,21],[3,0],[-1,-1],[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],[10,20],[13,19],[16,19],[19,20],[21,21],[-1,-1],[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]]},"&":{width:26,points:[[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]]},"'":{width:10,points:[[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]]},"(":{width:14,points:[[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]]},")":{width:14,points:[[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]]},"*":{width:16,points:[[8,21],[8,9],[-1,-1],[3,18],[13,12],[-1,-1],[13,18],[3,12]]},"+":{width:26,points:[[13,18],[13,0],[-1,-1],[4,9],[22,9]]},",":{width:10,points:[[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]]},"-":{width:26,points:[[4,9],[22,9]]},".":{width:10,points:[[5,2],[4,1],[5,0],[6,1],[5,2]]},"/":{width:22,points:[[20,25],[2,-7]]},"0":{width:20,points:[[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]]},"1":{width:20,points:[[6,17],[8,18],[11,21],[11,0]]},"2":{width:20,points:[[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]]},"3":{width:20,points:[[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]]},"4":{width:20,points:[[13,21],[3,7],[18,7],[-1,-1],[13,21],[13,0]]},"5":{width:20,points:[[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]]},"6":{width:20,points:[[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]]},"7":{width:20,points:[[17,21],[7,0],[-1,-1],[3,21],[17,21]]},"8":{width:20,points:[[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]]},"9":{width:20,points:[[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]]},":":{width:10,points:[[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]]},",":{width:10,points:[[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]]},"<":{width:24,points:[[20,18],[4,9],[20,0]]},"=":{width:26,points:[[4,12],[22,12],[-1,-1],[4,6],[22,6]]},">":{width:24,points:[[4,18],[20,9],[4,0]]},"?":{width:18,points:[[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]]},"@":{width:27,points:[[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]]},A:{width:18,points:[[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]]},B:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]]},C:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]]},D:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]]},E:{width:19,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]]},F:{width:18,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]]},G:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]]},H:{width:22,points:[[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]]},I:{width:8,points:[[4,21],[4,0]]},J:{width:16,points:[[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]]},K:{width:21,points:[[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]]},L:{width:17,points:[[4,21],[4,0],[-1,-1],[4,0],[16,0]]},M:{width:24,points:[[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]]},N:{width:22,points:[[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]]},O:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]]},P:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]]},Q:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]]},R:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]]},S:{width:20,points:[[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},T:{width:16,points:[[8,21],[8,0],[-1,-1],[1,21],[15,21]]},U:{width:22,points:[[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]]},V:{width:18,points:[[1,21],[9,0],[-1,-1],[17,21],[9,0]]},W:{width:24,points:[[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]]},X:{width:20,points:[[3,21],[17,0],[-1,-1],[17,21],[3,0]]},Y:{width:18,points:[[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]]},Z:{width:20,points:[[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]]},"[":{width:14,points:[[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]]},"\\":{width:14,points:[[0,21],[14,-3]]},"]":{width:14,points:[[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]]},"^":{width:16,points:[[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]]},_:{width:16,points:[[0,-2],[16,-2]]},"`":{width:10,points:[[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]]},a:{width:19,points:[[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},b:{width:19,points:[[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},c:{width:18,points:[[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},d:{width:19,points:[[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},e:{width:18,points:[[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},f:{width:12,points:[[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]]},g:{width:19,points:[[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},h:{width:19,points:[[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},i:{width:8,points:[[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]]},j:{width:10,points:[[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]]},k:{width:17,points:[[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]]},l:{width:8,points:[[4,21],[4,0]]},m:{width:30,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]]},n:{width:19,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},o:{width:19,points:[[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]]},p:{width:19,points:[[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},q:{width:19,points:[[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},r:{width:13,points:[[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]]},s:{width:17,points:[[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]]},t:{width:12,points:[[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]]},u:{width:19,points:[[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]]},v:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0]]},w:{width:22,points:[[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]]},x:{width:17,points:[[3,14],[14,0],[-1,-1],[14,14],[3,0]]},y:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]]},z:{width:17,points:[[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]]},"{":{width:14,points:[[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]]},"|":{width:8,points:[[4,25],[4,-7]]},"}":{width:14,points:[[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]]},"~":{width:24,points:[[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]]}};CanvasTextFunctions.letter=function(a){return CanvasTextFunctions.letters[a]};CanvasTextFunctions.ascent=function(a,b){return b};CanvasTextFunctions.descent=function(a,b){return 7*b/25};CanvasTextFunctions.measure=function(b,d,f){var e=0;var a=f.length;for(i=0;i<a;i++){var g=CanvasTextFunctions.letter(f.charAt(i));if(g){e+=g.width*d/25}}return e};CanvasTextFunctions.italics={};CanvasTextFunctions.makeItalic=function(g,h,f){if(!CanvasTextFunctions.italics[g]){var d=[];for(var e=0;e<h.points.length;e++){var b=h.points[e];if(b[0]!=-1&&b[1]!=-1){d[e]=[b[0]+(b[1]/3),b[1]]}else{d[e]=[-1,-1]}}CanvasTextFunctions.italics[g]={width:h.width,points:d}}return CanvasTextFunctions.italics[g]};CanvasTextFunctions.draw=function(q,d,r,p,m,l){var n=0;var h=l.length;var f=r/25;q.save();q.lineCap="round";q.lineWidth=2*f;for(i=0;i<h;i++){var g=l.charAt(i);var k=CanvasTextFunctions.letter(g);if(!k){continue}if(d.toLowerCase().indexOf("italic")>-1){k=CanvasTextFunctions.makeItalic(g,k,r)}q.beginPath();var e=1;var b=0;for(j=0;j<k.points.length;j++){var o=k.points[j];if(o[0]==-1&&o[1]==-1){e=1;continue}if(e){q.moveTo(p+o[0]*f,m-o[1]*f);e=false}else{q.lineTo(p+o[0]*f,m-o[1]*f)}}q.stroke();p+=k.width*f}q.restore();return n};CanvasTextFunctions.enable=function(a){a.drawText=function(c,d,b,f,e){return CanvasTextFunctions.draw(a,c,d,b,f,e)};a.measureText=function(b,c,d){return CanvasTextFunctions.measure(b,c,d)};a.fontAscent=function(b,c){return CanvasTextFunctions.ascent(b,c)};a.fontDescent=function(b,c){return CanvasTextFunctions.descent(b,c)};a.drawTextRight=function(d,e,b,g,f){var c=CanvasTextFunctions.measure(d,e,f);return CanvasTextFunctions.draw(a,d,e,b-c,g,f)};a.drawTextCenter=function(d,e,b,g,f){var c=CanvasTextFunctions.measure(d,e,f);return CanvasTextFunctions.draw(a,d,e,b-c/2,g,f)}};var ADL={};ADL.Boolean=Class.extend({value:null,init:function(a){this.value=a=="true"?true:false},toString:function(){return this.value?"true":"false"}});ADL.Integer=Class.extend({value:null,init:function(a){this.value=a},toString:function(){return this.value}});ADL.String=Class.extend({value:null,init:function(a){this.value=a},toString:function(){return'"'+this.value+'"'}});ADL.Annotation=Class.extend({data:null,init:function(a){this.data=a},toString:function(){return"[@"+this.data+"]"}});ADL.Multiplicity=Class.extend({low:null,high:null,init:function(a,b){this.low=a;this.high=b},toString:function(){return"["+this.low+(this.high?".."+this.high:"")+"]"}});ADL.Reference=Class.extend({constructName:null,multiplicity:null,init:function(a,b){this.constructName=a;this.multiplicity=b},toString:function(){return this.constructName+(this.multiplicity?this.multiplicity.toString():"")}});ADL.Modifier=Class.extend({key:null,value:null,init:function(a,b){this.key=a;this.value=b},toString:function(){return"+"+this.key+(this.value?"="+this.value.toString():"")}});ADL.Construct=Class.extend({init:function(b,a){this.annotation=null;this.type=b;this.name=a;this.value=null;this.supers=new Array();this.modifiers=new Hash();this.children=new Array()},toString:function(c){c=c||"";var a=new Array();this.modifiers.iterate(function(d,e){a.push(e.toString())});var b=new Array();this.children.iterate(function(d){b.push(d.toString("  "+c))});return(this.annotation?c+this.annotation.toString()+"\n":"")+c+this.type+" "+this.name+(this.supers.length>0?" : "+this.supers.join(" : "):"")+(a.length>0?" "+a.join(" "):"")+(this.value?" = "+this.value:"")+(b.length>0?" {\n"+b.join("\n")+"\n"+c+"}":";")},accept:function(b,a){return b.visit(this,a)},childrenAccept:function(b,a){this.children.iterate(function(c){b.visit(c,a)});return a}});ADL.include=function(b){var a=new ProtoJS.Ajax().fetch(b.value+".adl");return new ADL.Parser().parse(a).getChildren()};ADL.createConstruct=function(a,g,d,f,b,h,e){var k=new ADL.Construct(g,d);if(a){k.annotation=a}if(f){k.supers=f}if(Object.isArray(b)){b.iterate(function(c){k.modifiers.set(c.key,c)})}if(h){k.value=h}if(Object.isArray(e)){k.children=e}return k};ADL.AST=Class.extend({root:ADL.createConstruct("","root",""),init:function(a){this.root.children=a},getRoot:function(){return this.root},getChildren:function(){return this.root.children}});ADL.ast=null;ADL.Parser=Class.extend({parse:function(f){var h=0;var c=new Array();var a=new Array();ADL.ast=null;try{if((h=__parse(f,c,a))>0){var b;var g="";for(b=0;b<h;b++){g+="Parse error: "+f.substr(c[b],30)+'. Expecting "'+a[b].join()+"\n"}this.errors=g;return null}}catch(d){this.errors="Semantic error: "+d;return null}this.errors="";return ADL.ast}});function makeList(){var b=new Array();if(arguments){for(var a=0;a<arguments.length;a++){if(Object.isArray(arguments[a])){for(var c=0;c<arguments[a].length;c++){if(arguments[a][c]){b.push(arguments[a][c])}}}else{if(arguments[a]){b.push(arguments[a])}}}}return b}var _dbg_withtrace=false;var _dbg_string=new String();function __dbg_print(a){_dbg_string+=a+"\n"}function __lex(d){var c=0;var a=-1;var b=0;var f=0;var e=d.offset+1;do{e--;c=0;a=-2;f=e;if(d.src.length<=f){return 49}do{switch(c){case 0:if((d.src.charCodeAt(e)>=9&&d.src.charCodeAt(e)<=10)||d.src.charCodeAt(e)==13||d.src.charCodeAt(e)==32){c=1}else{if(d.src.charCodeAt(e)==40){c=2}else{if(d.src.charCodeAt(e)==41){c=3}else{if(d.src.charCodeAt(e)==42){c=4}else{if(d.src.charCodeAt(e)==43){c=5}else{if(d.src.charCodeAt(e)==44){c=6}else{if(d.src.charCodeAt(e)==45){c=7}else{if(d.src.charCodeAt(e)==46){c=8}else{if(d.src.charCodeAt(e)==47){c=9}else{if(d.src.charCodeAt(e)==48){c=10}else{if(d.src.charCodeAt(e)==58){c=11}else{if(d.src.charCodeAt(e)==59){c=12}else{if(d.src.charCodeAt(e)==60){c=13}else{if(d.src.charCodeAt(e)==61){c=14}else{if(d.src.charCodeAt(e)==62){c=15}else{if((d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=101)||(d.src.charCodeAt(e)>=103&&d.src.charCodeAt(e)<=115)||(d.src.charCodeAt(e)>=117&&d.src.charCodeAt(e)<=122)){c=16}else{if(d.src.charCodeAt(e)==91){c=17}else{if(d.src.charCodeAt(e)==93){c=18}else{if(d.src.charCodeAt(e)==123){c=19}else{if(d.src.charCodeAt(e)==124){c=20}else{if(d.src.charCodeAt(e)==125){c=21}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=8)||(d.src.charCodeAt(e)>=11&&d.src.charCodeAt(e)<=12)||(d.src.charCodeAt(e)>=14&&d.src.charCodeAt(e)<=31)||(d.src.charCodeAt(e)>=36&&d.src.charCodeAt(e)<=39)||(d.src.charCodeAt(e)>=63&&d.src.charCodeAt(e)<=64)||d.src.charCodeAt(e)==92||d.src.charCodeAt(e)==94||d.src.charCodeAt(e)==96||(d.src.charCodeAt(e)>=126&&d.src.charCodeAt(e)<=254)){c=30}else{if((d.src.charCodeAt(e)>=49&&d.src.charCodeAt(e)<=57)){c=32}else{if(d.src.charCodeAt(e)==33){c=35}else{if(d.src.charCodeAt(e)==34){c=39}else{if(d.src.charCodeAt(e)==35){c=41}else{if(d.src.charCodeAt(e)==116){c=61}else{if(d.src.charCodeAt(e)==102){c=64}else{c=-1}}}}}}}}}}}}}}}}}}}}}}}}}}}}break;case 1:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=1;b=e;break;case 2:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=6;b=e;break;case 3:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=7;b=e;break;case 4:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=22;b=e;break;case 5:if(d.src.charCodeAt(e)==48){c=37}else{if((d.src.charCodeAt(e)>=49&&d.src.charCodeAt(e)<=57)){c=40}else{if(d.src.charCodeAt(e)==47){c=42}else{c=-1}}}a=17;b=e;break;case 6:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=16;b=e;break;case 7:if(d.src.charCodeAt(e)==48){c=37}else{if((d.src.charCodeAt(e)>=49&&d.src.charCodeAt(e)<=57)){c=40}else{if(d.src.charCodeAt(e)==47){c=42}else{c=-1}}}a=18;b=e;break;case 8:if(d.src.charCodeAt(e)==46){c=24}else{if(d.src.charCodeAt(e)==47){c=42}else{c=-1}}a=15;b=e;break;case 9:if(d.src.charCodeAt(e)==47){c=44}else{c=-1}a=23;b=e;break;case 10:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=3;b=e;break;case 11:if(d.src.charCodeAt(e)==58){c=25}else{if(d.src.charCodeAt(e)==61){c=26}else{if(d.src.charCodeAt(e)==47){c=42}else{c=-1}}}a=13;b=e;break;case 12:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=12;b=e;break;case 13:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=26;b=e;break;case 14:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=19;b=e;break;case 15:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=27;b=e;break;case 16:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==47){c=42}else{c=-1}}a=29;b=e;break;case 17:if(d.src.charCodeAt(e)==47){c=42}else{if(d.src.charCodeAt(e)==64){c=45}else{c=-1}}a=10;b=e;break;case 18:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=11;b=e;break;case 19:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=8;b=e;break;case 20:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=24;b=e;break;case 21:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}a=9;b=e;break;case 22:c=-1;a=20;b=e;break;case 23:c=-1;a=4;b=e;break;case 24:c=-1;a=25;b=e;break;case 25:c=-1;a=14;b=e;break;case 26:c=-1;a=21;b=e;break;case 27:c=-1;a=5;b=e;break;case 28:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=122)){c=33}else{c=-1}a=2;b=e;break;case 29:c=-1;a=28;b=e;break;case 30:if(d.src.charCodeAt(e)==47){c=42}else{c=-1}break;case 31:c=-1;a=1;b=e;break;case 32:if((d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)){c=40}else{if(d.src.charCodeAt(e)==47){c=42}else{c=-1}}a=3;b=e;break;case 33:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=122)){c=33}else{c=-1}a=29;b=e;break;case 34:if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=46}else{if(d.src.charCodeAt(e)==42){c=49}else{c=-1}}a=4;b=e;break;case 35:if(d.src.charCodeAt(e)==61){c=22}else{if(d.src.charCodeAt(e)==47){c=42}else{c=-1}}break;case 36:if(d.src.charCodeAt(e)==34){c=23}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=254)){c=63}else{c=-1}}a=1;b=e;break;case 37:c=-1;a=3;b=e;break;case 38:if(d.src.charCodeAt(e)==101){c=28}else{if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=100)||(d.src.charCodeAt(e)>=102&&d.src.charCodeAt(e)<=122)){c=33}else{c=-1}}a=29;b=e;break;case 39:if(d.src.charCodeAt(e)==34){c=23}else{if(d.src.charCodeAt(e)==47){c=59}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=254)){c=63}else{c=-1}}}break;case 40:if((d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)){c=40}else{c=-1}a=3;b=e;break;case 41:if(d.src.charCodeAt(e)==47){c=42}else{if(d.src.charCodeAt(e)==105){c=43}else{c=-1}}break;case 42:if(d.src.charCodeAt(e)==42){c=46}else{c=-1}break;case 43:if(d.src.charCodeAt(e)==110){c=48}else{c=-1}break;case 44:if(d.src.charCodeAt(e)==10){c=31}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=9)||(d.src.charCodeAt(e)>=11&&d.src.charCodeAt(e)<=254)){c=44}else{c=-1}}break;case 45:if(d.src.charCodeAt(e)==93){c=27}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=92)||(d.src.charCodeAt(e)>=94&&d.src.charCodeAt(e)<=254)){c=45}else{c=-1}}break;case 46:if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=46}else{if(d.src.charCodeAt(e)==42){c=49}else{c=-1}}break;case 47:if(d.src.charCodeAt(e)==34){c=34}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=47}else{if(d.src.charCodeAt(e)==42){c=50}else{c=-1}}}break;case 48:if(d.src.charCodeAt(e)==99){c=51}else{c=-1}break;case 49:if(d.src.charCodeAt(e)==47){c=31}else{if(d.src.charCodeAt(e)==42){c=49}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=254)){c=52}else{c=-1}}}break;case 50:if(d.src.charCodeAt(e)==47){c=36}else{if(d.src.charCodeAt(e)==42){c=50}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=254)){c=53}else{if(d.src.charCodeAt(e)==34){c=58}else{c=-1}}}}break;case 51:if(d.src.charCodeAt(e)==108){c=54}else{c=-1}break;case 52:if(d.src.charCodeAt(e)==42){c=49}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=52}else{c=-1}}break;case 53:if(d.src.charCodeAt(e)==42){c=50}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=53}else{if(d.src.charCodeAt(e)==34){c=58}else{c=-1}}}break;case 54:if(d.src.charCodeAt(e)==117){c=55}else{c=-1}break;case 55:if(d.src.charCodeAt(e)==100){c=56}else{c=-1}break;case 56:if(d.src.charCodeAt(e)==101){c=29}else{c=-1}break;case 57:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=116)||(d.src.charCodeAt(e)>=118&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==117){c=38}else{c=-1}}a=29;b=e;break;case 58:if(d.src.charCodeAt(e)==42){c=49}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=52}else{c=-1}}a=4;b=e;break;case 59:if(d.src.charCodeAt(e)==34){c=23}else{if(d.src.charCodeAt(e)==42){c=47}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=63}else{c=-1}}}break;case 60:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=114)||(d.src.charCodeAt(e)>=116&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==115){c=38}else{c=-1}}a=29;b=e;break;case 61:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=113)||(d.src.charCodeAt(e)>=115&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==47){c=42}else{if(d.src.charCodeAt(e)==114){c=57}else{c=-1}}}a=29;b=e;break;case 62:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=107)||(d.src.charCodeAt(e)>=109&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==108){c=60}else{c=-1}}a=29;b=e;break;case 63:if(d.src.charCodeAt(e)==34){c=23}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=254)){c=63}else{c=-1}}break;case 64:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=98&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==47){c=42}else{if(d.src.charCodeAt(e)==97){c=62}else{c=-1}}}a=29;b=e;break}e++}while(c>-1)}while(1>-1&&a==1);if(a>-1){d.att=d.src.substr(f,b-f);d.offset=b;switch(a){case 2:d.att=new ADL.Boolean(d.att);break;case 3:d.att=new ADL.Integer(d.att);break;case 4:d.att=new ADL.String(d.att.substr(1,d.att.length-2));break;case 5:d.att=new ADL.Annotation(d.att.substr(2,d.att.length-3));break}}else{d.att=new String();a=-1}return a}function __parse(a,r,s){var b=new Array();var n=new Array();var e=0;var q;var f;var g;var v;var h=new Function("","var offset; var src; var att;");var o=new h();var l=new Array(new Array(0,1),new Array(31,1),new Array(30,2),new Array(30,0),new Array(32,1),new Array(32,1),new Array(33,8),new Array(34,2),new Array(35,1),new Array(35,0),new Array(43,3),new Array(44,1),new Array(42,3),new Array(42,1),new Array(42,0),new Array(38,1),new Array(38,2),new Array(37,1),new Array(37,2),new Array(39,2),new Array(39,0),new Array(45,3),new Array(46,3),new Array(46,5),new Array(46,0),new Array(36,2),new Array(36,0),new Array(47,2),new Array(47,4),new Array(40,2),new Array(40,0),new Array(48,1),new Array(48,1),new Array(48,1),new Array(41,3),new Array(41,1));var d=new Array(new Array(49,-3,28,-3,5,-3,29,-3,17,-3),new Array(49,0),new Array(28,7,5,8,49,-1,17,-9,29,-9),new Array(49,-2,28,-2,5,-2,29,-2,17,-2,9,-2),new Array(49,-4,28,-4,5,-4,29,-4,17,-4,9,-4),new Array(49,-5,28,-5,5,-5,29,-5,17,-5,9,-5),new Array(29,-26,17,-26),new Array(4,10),new Array(17,-8,29,-8),new Array(29,13,17,14),new Array(49,-7,28,-7,5,-7,29,-7,17,-7,9,-7),new Array(29,-25,17,-25,21,-25,8,-25,12,-25),new Array(29,16),new Array(26,18,29,-17,10,-17,17,-17,21,-17,8,-17,12,-17,13,-17),new Array(29,19),new Array(17,-20,21,-20,8,-20,12,-20,13,-20),new Array(26,18,13,-15,17,-15,21,-15,8,-15,12,-15),new Array(29,-18,10,-18,17,-18,21,-18,8,-18,12,-18,13,-18),new Array(29,24,27,-14,16,-14),new Array(19,25,29,-27,17,-27,21,-27,8,-27,12,-27),new Array(13,28,21,-26,8,-26,12,-26,17,-26),new Array(13,-16,17,-16,21,-16,8,-16,12,-16),new Array(16,29,27,30),new Array(27,-13,16,-13),new Array(27,-11,16,-11),new Array(4,32,3,33,2,34),new Array(17,-19,21,-19,8,-19,12,-19,13,-19),new Array(21,36,17,14,8,-30,12,-30),new Array(29,13),new Array(29,24),new Array(29,-10,13,-10,17,-10,21,-10,8,-10,12,-10,10,-10),new Array(29,-28,17,-28,21,-28,8,-28,12,-28),new Array(29,-31,17,-31,21,-31,8,-31,12,-31),new Array(29,-32,17,-32,21,-32,8,-32,12,-32),new Array(29,-33,17,-33,21,-33,8,-33,12,-33),new Array(8,40,12,41),new Array(4,32,3,33,2,34),new Array(10,44,17,-24,21,-24,8,-24,12,-24,13,-24),new Array(27,-12,16,-12),new Array(49,-6,28,-6,5,-6,29,-6,17,-6,9,-6),new Array(9,-3,28,-3,5,-3,29,-3,17,-3),new Array(49,-35,28,-35,5,-35,29,-35,17,-35,9,-35),new Array(8,-29,12,-29),new Array(17,-21,21,-21,8,-21,12,-21,13,-21),new Array(3,46),new Array(9,47,28,7,5,8,17,-9,29,-9),new Array(11,48,25,49),new Array(49,-34,28,-34,5,-34,29,-34,17,-34,9,-34),new Array(17,-22,21,-22,8,-22,12,-22,13,-22),new Array(3,50),new Array(11,51),new Array(17,-23,21,-23,8,-23,12,-23,13,-23));var k=new Array(new Array(31,1,30,2),new Array(),new Array(32,3,33,4,34,5,35,6),new Array(),new Array(),new Array(),new Array(36,9),new Array(),new Array(),new Array(47,11,37,12),new Array(),new Array(),new Array(38,15),new Array(43,17),new Array(),new Array(39,20),new Array(43,21),new Array(),new Array(42,22,44,23),new Array(),new Array(45,26,36,27),new Array(),new Array(),new Array(),new Array(),new Array(48,31),new Array(),new Array(47,11,40,35),new Array(37,37),new Array(44,38),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(41,39),new Array(48,42),new Array(46,43),new Array(),new Array(),new Array(30,45),new Array(),new Array(),new Array(),new Array(),new Array(32,3,33,4,34,5,35,6),new Array(),new Array(),new Array(),new Array(),new Array(),new Array());var p=new Array("Program'","WHITESPACE","Boolean","Integer","String","Annotation","(",")","{","}","[","]",";",":","::",".",",","+","-","=","!=",":=","*","/","|","..","<",">","IncludeDirective","Identifier","Statements","Program","Statement","Construct","Directive","Annotations","Modifiers","Type","Name","Supers","Value","Children","GenericArguments","Generic","GenericArgument","Super","Multiplicity","Modifier","Constant","$");o.offset=0;o.src=a;o.att=new String();if(!r){r=new Array()}if(!s){s=new Array()}b.push(0);n.push(0);g=__lex(o);while(true){q=53;for(var m=0;m<d[b[b.length-1]].length;m+=2){if(d[b[b.length-1]][m]==g){q=d[b[b.length-1]][m+1];break}}if(_dbg_withtrace&&b.length>0){__dbg_print("\nState "+b[b.length-1]+"\n\tLookahead: "+p[g]+' ("'+o.att+'")\n\tAction: '+q+'\n\tSource: "'+o.src.substr(o.offset,30)+((o.offset+30<o.src.length)?"...":"")+'"\n\tStack: '+b.join()+"\n\tValue stack: "+n.join()+"\n")}if(q==53){if(_dbg_withtrace){__dbg_print("Error detected: There is no reduce or shift on the symbol "+p[g])}e++;r.push(o.offset-o.att.length);s.push(new Array());for(var m=0;m<d[b[b.length-1]].length;m+=2){s[s.length-1].push(p[d[b[b.length-1]][m]])}var c=new Array();var u=new Array();for(var m=0;m<b.length;m++){c[m]=b[m];u[m]=n[m]}while(q==53&&g!=49){if(_dbg_withtrace){__dbg_print("\tError recovery\nCurrent lookahead: "+p[g]+" ("+o.att+")\nAction: "+q+"\n\n")}if(g==-1){o.offset++}while(q==53&&b.length>0){b.pop();n.pop();if(b.length==0){break}q=53;for(var m=0;m<d[b[b.length-1]].length;m+=2){if(d[b[b.length-1]][m]==g){q=d[b[b.length-1]][m+1];break}}}if(q!=53){break}for(var m=0;m<c.length;m++){b.push(c[m]);n.push(u[m])}g=__lex(o)}if(q==53){if(_dbg_withtrace){__dbg_print("\tError recovery failed, terminating parse process...")}break}if(_dbg_withtrace){__dbg_print("\tError recovery succeeded, continuing")}}if(q>0){if(_dbg_withtrace){__dbg_print("Shifting symbol: "+p[g]+" ("+o.att+")")}b.push(q);n.push(o.att);g=__lex(o);if(_dbg_withtrace){__dbg_print("\tNew lookahead symbol: "+p[g]+" ("+o.att+")")}}else{q*=-1;if(_dbg_withtrace){__dbg_print("Reducing by producution: "+q)}v=void (0);if(_dbg_withtrace){__dbg_print("\tPerforming semantic action...")}switch(q){case 0:v=n[n.length-1];break;case 1:ADL.ast=new ADL.AST(n[n.length-1]);break;case 2:v=makeList(n[n.length-2],n[n.length-1]);break;case 3:v=n[n.length-0];break;case 4:v=n[n.length-1];break;case 5:v=n[n.length-1];break;case 6:v=ADL.createConstruct(n[n.length-8],n[n.length-6],n[n.length-5],n[n.length-4],makeList(n[n.length-7],n[n.length-3]),n[n.length-2],n[n.length-1]);break;case 7:v=ADL.include(n[n.length-1]);break;case 8:v=n[n.length-1];break;case 9:v=n[n.length-0];break;case 10:if(n[n.length-2]){v=n[n.length-3]+n[n.length-2].join(",")+n[n.length-1]}else{throw ("Missing GenericArguments")}break;case 11:v=n[n.length-1];break;case 12:v=makeList(n[n.length-3],n[n.length-1]);break;case 13:v=makeList(n[n.length-1]);break;case 14:v=n[n.length-0];break;case 15:v=n[n.length-1];break;case 16:v=n[n.length-2]+n[n.length-1];break;case 17:v=n[n.length-1];break;case 18:v=n[n.length-2]+n[n.length-1];break;case 19:v=makeList(n[n.length-2],n[n.length-1]);break;case 20:v=n[n.length-0];break;case 21:v=new ADL.Reference(n[n.length-2],n[n.length-1]);break;case 22:v=new ADL.Multiplicity(n[n.length-2]);break;case 23:v=new ADL.Multiplicity(n[n.length-4],n[n.length-2]);break;case 24:v=n[n.length-0];break;case 25:v=makeList(n[n.length-2],n[n.length-1]);break;case 26:v=n[n.length-0];break;case 27:v=new ADL.Modifier(n[n.length-1]);break;case 28:v=new ADL.Modifier(n[n.length-3],n[n.length-1]);break;case 29:v=n[n.length-1];break;case 30:v=n[n.length-0];break;case 31:v=n[n.length-1];break;case 32:v=n[n.length-1];break;case 33:v=n[n.length-1];break;case 34:v=n[n.length-2];break;case 35:v=null;break}if(_dbg_withtrace){__dbg_print("\tPopping "+l[q][1]+" off the stack...")}for(var m=0;m<l[q][1];m++){b.pop();n.pop()}f=-1;for(var m=0;m<k[b[b.length-1]].length;m+=2){if(k[b[b.length-1]][m]==l[q][0]){f=k[b[b.length-1]][m+1];break}}if(q==0){break}if(_dbg_withtrace){__dbg_print("\tPushing non-terminal "+p[l[q][0]])}b.push(f);n.push(v)}if(_dbg_withtrace){alert(_dbg_string);_dbg_string=new String()}}if(_dbg_withtrace){__dbg_print("\nParse complete.");alert(_dbg_string)}return e}ADL.version="0.3-13";function tabberObj(b){var a;this.div=null;this.classMain="tabber";this.classMainLive="tabberlive";this.classTab="tabbertab";this.classTabDefault="tabbertabdefault";this.classNav="tabbernav";this.classTabHide="tabbertabhide";this.classNavActive="tabberactive";this.titleElements=["h2","h3","h4","h5","h6"];this.titleElementsStripHTML=true;this.removeTitle=true;this.addLinkId=false;this.linkIdFormat="<tabberid>nav<tabnumberone>";for(a in b){this[a]=b[a]}this.REclassMain=new RegExp("\\b"+this.classMain+"\\b","gi");this.REclassMainLive=new RegExp("\\b"+this.classMainLive+"\\b","gi");this.REclassTab=new RegExp("\\b"+this.classTab+"\\b","gi");this.REclassTabDefault=new RegExp("\\b"+this.classTabDefault+"\\b","gi");this.REclassTabHide=new RegExp("\\b"+this.classTabHide+"\\b","gi");this.tabs=new Array();if(this.div){this.init(this.div);this.div=null}}tabberObj.prototype.init=function(f){var k,d,b,m,g=0,n,a,l,c,h;if(!document.getElementsByTagName){return false}if(f.id){this.id=f.id}this.tabs.length=0;k=f.childNodes;for(d=0;d<k.length;d++){if(k[d].className&&k[d].className.match(this.REclassTab)){m=new Object();m.div=k[d];this.tabs[this.tabs.length]=m;if(k[d].className.match(this.REclassTabDefault)){g=this.tabs.length-1}}}n=document.createElement("ul");n.className=this.classNav;for(d=0;d<this.tabs.length;d++){m=this.tabs[d];m.headingText=m.div.title;if(this.removeTitle){m.div.title=""}if(!m.headingText){for(b=0;b<this.titleElements.length;b++){h=m.div.getElementsByTagName(this.titleElements[b])[0];if(h){m.headingText=h.innerHTML;if(this.titleElementsStripHTML){m.headingText.replace(/<br>/gi," ");m.headingText=m.headingText.replace(/<[^>]+>/g,"")}break}}}if(!m.headingText){m.headingText=d+1}a=document.createElement("li");m.li=a;l=document.createElement("a");l.appendChild(document.createTextNode(m.headingText));l.href="javascript:void(null);";l.title=m.headingText;l.onclick=this.navClick;l.tabber=this;l.tabberIndex=d;if(this.addLinkId&&this.linkIdFormat){c=this.linkIdFormat;c=c.replace(/<tabberid>/gi,this.id);c=c.replace(/<tabnumberzero>/gi,d);c=c.replace(/<tabnumberone>/gi,d+1);c=c.replace(/<tabtitle>/gi,m.headingText.replace(/[^a-zA-Z0-9\-]/gi,""));l.id=c}a.appendChild(l);n.appendChild(a)}f.insertBefore(n,f.firstChild);f.className=f.className.replace(this.REclassMain,this.classMainLive);this.tabShow(g);if(typeof this.onLoad=="function"){this.onLoad({tabber:this})}return this};tabberObj.prototype.navClick=function(g){var d,b,c,f,e;b=this;if(!b.tabber){return false}c=b.tabber;f=b.tabberIndex;b.blur();if(typeof c.onClick=="function"){e={tabber:c,index:f,event:g};if(!g){e.event=window.event}d=c.onClick(e);if(d===false){return false}}c.tabShow(f);return false};tabberObj.prototype.tabHideAll=function(){var a;for(a=0;a<this.tabs.length;a++){this.tabHide(a)}};tabberObj.prototype.tabHide=function(a){var b;if(!this.tabs[a]){return false}b=this.tabs[a].div;if(!b.className.match(this.REclassTabHide)){b.className+=" "+this.classTabHide}this.navClearActive(a);return this};tabberObj.prototype.tabShow=function(a){var b;if(!this.tabs[a]){return false}this.tabHideAll();b=this.tabs[a].div;b.className=b.className.replace(this.REclassTabHide,"");this.navSetActive(a);if(typeof this.onTabDisplay=="function"){this.onTabDisplay({tabber:this,index:a})}return this};tabberObj.prototype.navSetActive=function(a){this.tabs[a].li.className=this.classNavActive;return this};tabberObj.prototype.navClearActive=function(a){this.tabs[a].li.className="";return this};function tabberAutomatic(d){var a,c,b;if(!d){d={}}a=new tabberObj(d);c=document.getElementsByTagName("div");for(b=0;b<c.length;b++){if(c[b].className&&c[b].className.match(a.REclassMain)){d.div=c[b];c[b].tabber=new tabberObj(d)}}return this}function tabberAutomaticOnLoad(b){var a;if(!b){b={}}a=window.onload;if(typeof window.onload!="function"){window.onload=function(){tabberAutomatic(b)}}else{window.onload=function(){a();tabberAutomatic(b)}}}if(typeof tabberOptions=="undefined"){tabberAutomaticOnLoad()}else{if(!tabberOptions.manualStartup){tabberAutomaticOnLoad(tabberOptions)}}if(!window.Node){window.Node=new Object();Node.ELEMENT_NODE=1;Node.ATTRIBUTE_NODE=2;Node.TEXT_NODE=3;Node.CDATA_SECTION_NODE=4;Node.ENTITY_REFERENCE_NODE=5;Node.ENTITY_NODE=6;Node.PROCESSING_INSTRUCTION_NODE=7;Node.COMMENT_NODE=8;Node.DOCUMENT_NODE=9;Node.DOCUMENT_TYPE_NODE=10;Node.DOCUMENT_FRAGMENT_NODE=11;Node.NOTATION_NODE=12}if(typeof decomposeVersion!="function"){function decomposeVersion(b){var a=b.match(/([0-9]+)\.([0-9]+)(-([0-9]+))?/);return{major:parseInt(a[1]),minor:parseInt(a[2]),build:parseInt(a[4])||0}}}if(typeof iRequire!="function"){function iRequire(d,a,c){var b=decomposeVersion(d.version);a=decomposeVersion(a);if((b.major<a.major)||(b.major==a.major&&b.minor<a.minor)||(b.major==a.major&&b.minor==a.minor&&b.build<a.build)){return false}if(c){c=decomposeVersion(c);if((b.major>c.major)||(b.major==c.major&&b.minor>c.minor)||(b.major==c.major&&b.minor==c.minor&&b.build>c.build)){return false}}return true}}if(!iRequire(ADL,"0.1-4")){alert("Canvas2D requires at least ADL version 0.1-4. Current ADL version = "+ADL.version)}if(!document.createElement("canvas").getContext&&!G_vmlCanvasManager.initElement){alert("You browser doesn't support the Canvas element. If you're using IE, ExplorerCanvas is required.")}else{if(typeof CanvasTextFunctions=="undefined"){alert("Canvas2D requires the CanvasText implementation.")}}function unless(b,a){if(!b){a()}}function max(d,c){return d<c?c:d}function min(d,c){return d<c?d:c}if(!Array.indexOf){Array.prototype.indexOf=function(b){for(var a=0;a<this.length;a++){if(this[a]==b){return a}}return -1}}Array.prototype.contains=function(a){return this.indexOf(a)>-1};function getFontSize(a){var b=null;b=toPx(a,"px");if(b==null){b=toPx(a,"pt");if(b==null){b=toPx(a,"em");if(b==null){b=toPx(a,"pct");if(b!=null){return b}}else{return b}}else{return b}}else{return b}throw ("cannot get size from font specifier: "+a)}function toPx(b,e){if(!b){console.log("Common::toPx: require a valid font. Got: '"+b+"'");return}var d=[{pt:5.5,px:6,em:0.375,pct:37.5},{pt:6,px:8,em:0.5,pct:50},{pt:7,px:9,em:0.55,pct:55},{pt:7.5,px:10,em:0.625,pct:62.5},{pt:8,px:11,em:0.7,pct:70},{pt:9,px:12,em:0.75,pct:75},{pt:10,px:13,em:0.8,pct:80},{pt:10.5,px:14,em:0.875,pct:87.5},{pt:11,px:15,em:0.95,pct:95},{pt:12,px:16,em:1,pct:100},{pt:13,px:17,em:1.05,pct:105},{pt:13.5,px:18,em:1.125,pct:112.5},{pt:14,px:19,em:1.2,pct:120},{pt:14.5,px:20,em:1.25,pct:125},{pt:15,px:21,em:1.3,pct:130},{pt:16,px:22,em:1.4,pct:140},{pt:17,px:23,em:1.45,pct:145},{pt:18,px:24,em:1.5,pct:150},{pt:20,px:26,em:1.6,pct:160},{pt:22,px:29,em:1.8,pct:180},{pt:24,px:32,em:2,pct:200},{pt:26,px:35,em:2.2,pct:220},{pt:27,px:36,em:2.25,pct:225},{pt:28,px:37,em:2.3,pct:230},{pt:29,px:38,em:2.35,pct:235},{pt:30,px:40,em:2.45,pct:245},{pt:32,px:42,em:2.55,pct:255},{pt:34,px:45,em:2.75,pct:275},{pt:36,px:48,em:3,pct:300}];var a=b.match("(\\d+)"+e+"\\s*/");if(a==null){a=b.match("(\\d+)"+e+"\\s*");if(a!=null){a=a[1]}}else{a=a[1]}if(a!=null){for(var c=0;c<d.length;c++){if(d[c][e]==a){return d[c]["px"]}}}return null}function Timer(){this.now=new Date().getTime();this.stop=function(){return new Date().getTime()-this.now}}var Canvas2D={shapes:$H(),libraries:$H(),extensions:[],activate:function activate(d){var a=document.getElementById(d);if(a){var c=new Canvas2D.Manager();var a=c.setupBook(d);var b=a.addSheet();c.startAll();return b}throw (d+" does not reference a known id on the document.")},registerShape:function registerShape(b){b.prototype.__CLASS__=b;b.prototype.getClass=function a(){return this.__CLASS__};Canvas2D.Shape.manifestHandling.iterate(function(c,d){b[c]=d});b.getTypes().iterate(function(c){Canvas2D.shapes.set(c,b)});b.getLibraries().iterate(function(c){if(!Canvas2D.libraries.get(c)){Canvas2D.libraries.set(c,[])}Canvas2D.libraries.get(c).push(b)})},getBook:function(a){return Canvas2D.KickStarter.manager.getBook(a)}};Canvas2D.Factory={extensions:{all:{}}};Canvas2D.Factory.extensions.all.ShortHands={clear:function clear(){this.clearRect(0,0,this.canvas.width,this.canvas.height)},fillTextCenter:function fillTextCenter(d,a,e,c){var b=this.measureText(d)/2;this.fillText(d,a-b,e,c)},fillTextRight:function fillTextRight(d,a,e,c){var b=this.measureText(d);this.fillText(d,a-b,e,c)},strokeTextCenter:function strokeTextCenter(d,a,e,c){var b=this.measureText(d)/2;this.strokeText(d,a-b,e,c)},strokeTextRight:function strokeTextRight(d,a,e,c){var b=this.measureText(d);this.strokeText(d,a-b,e,c)},fillStrokeRect:function fillStrokeRect(d,c,b,a){this.fillRect(d,c,b,a);this.strokeRect(d,c,b,a)}};Canvas2D.Factory.extensions.all.EventHandling={on:function on(b,a){if(!this.eventHandlers){this.eventHandlers=[]}if(!this.eventHandlers[b]){this.eventHandlers[b]=[]}this.eventHandlers[b].push(a)},fireEvent:function fireEvent(a,b){if(!this.eventHandlers){return}if(this.eventHandlers[a]){this.eventHandlers[a].iterate(function(c){c(b)})}}};Canvas2D.Factory.extensions.all.ExtendedCanvasSupport={__extend__:function __extend__(a){var c=["useCrispLines","textDecoration","lineStyle"];var b=a.save;a.save=function(){var e={};var f=this;c.iterate(function(g){e[g]=f[g]});if(!this.savedValues){this.savedValues=[]}this.savedValues.push(e);b.apply(this)};var d=a.restore;a.restore=function(){if(!this.savedValues){return}var e=this.savedValues.pop();var f=this;c.iterate(function(g){f[g]=e[g]});d.apply(this)};return a}};Canvas2D.Factory.extensions.all.DashedLineSupport={__extend__:function __extend__(a){["_setCurrentXY","_plotPixel","_drawLine"].iterate(function(b){a[b]=Canvas2D.Factory.extensions.all.DashedLineSupport[b]});a.nativeMoveTo=a.moveTo;a.moveTo=function(b,c){a.nativeMoveTo.apply(this,arguments);this._setCurrentXY(b,c)};a.nativeLineTo=a.lineTo;a.lineTo=function(b,c){if(this.lineStyle=="dashed"){this._drawLine(this.currentX,this.currentY,b,c)}else{this.nativeLineTo.apply(this,arguments)}this._setCurrentXY(b,c)};return a},_setCurrentXY:function _setCurrentXY(a,b){if(!this.currentX){this.currentX=0}if(!this.currentY){this.currentY=0}this.currentX=a;this.currentY=b},_plotPixel:function _plotPixel(a,e,d){var b=this.strokeStyle;this.beginPath();this.strokeStyle=d;this.fillStyle=d;this.moveTo(a,e);this.nativeLineTo(a+1,e+1);this.stroke();this.closePath();this.strokeStyle=b},_drawLine:function _drawLine(g,s,e,q){g=Math.floor(g);e=Math.floor(e);s=Math.floor(s-1);q=Math.floor(q-1);this.stroke();var n=this.strokeStyle;var d=this.lineStyle;var o=Math.abs(q-s)>Math.abs(e-g);if(o){t=s;s=g;g=t;t=q;q=e;e=t}var l=Math.abs(e-g);var k=Math.abs(q-s);var m=0;var u=k;var f;var a;var r=g;var p=s;if(g<e){f=1}else{f=-1}if(s<q){a=1}else{a=-1}if(o){this._plotPixel(p,r,n)}else{this._plotPixel(r,p,n)}var b=0;while(r!=e){r=r+f;m=m+u;if(2*m>=l){p=p+a;m=m-l}var h=(d!="dashed"||++b%15)<10?n:"white";if(o){this._plotPixel(p,r,h)}else{this._plotPixel(r,p,h)}}}};Canvas2D.Factory.extensions.all.CrispLineSupport={__extend__:function __extend__(a){["strokeRect","moveTo","lineTo","rect"].iterate(function(b){var c=a[b];a[b]=function(d,k,e,g){if(!this.useCrispLines){return c.apply(this,arguments)}var f=Canvas2D.Factory.extensions.all.CrispLineSupport.makeCrisp(d,k,e,g,this.lineWidth);return c.apply(this,[f.x,f.y,f.w,f.h])}});return a},makeCrisp:function makeCrisp(m,k,a,f,e){var c=m;var l=k;var b=a;var g=f;var n=a;var d=f;if(e%2){c=Math.floor(m)+0.5;l=Math.floor(k)+0.5;if(typeof b!="undefined"){b=Math.floor(a)+0.5;g=Math.floor(f)+0.5}if(a%1!=0){n=Math.floor(a)}if(f%1!=0){d=Math.floor(f)}}else{c=Math.floor(m);l=Math.floor(k);if(typeof b!="undefined"){b=Math.floor(a);g=Math.floor(f)}if(a%1!=0){n=Math.floor(a)+0.5}if(f%1!=0){d=Math.floor(f)+0.5}}return{x:c,y:l,x1:c,y1:l,w:n,h:d,x2:b,y2:g}}};Canvas2D.Factory.extensions.all.TextDecorationSupport={decorateText:function decorateText(c,a,d,b){if(!this.textDecoration){return}this.save();this.useCrispLines=true;this.strokeStyle="black";this.textDecoration.toLowerCase().split(" ").iterate(function(f){var e=null;switch(f){case"underline":e=this.underlineText;break;case"overline":e=this.overlineText;break;case"line-through":e=this.linethroughText;break}if(e){this.beginPath();var g=this.measureText(c);if(g>b){g=b}e.call(this,c,a,d,g);this.stroke();this.closePath()}}.scope(this));this.restore()},underlineText:function underlineText(c,a,d,b){this.moveTo(a,d+3);this.lineTo(a+b,d+3)},overlineText:function overlineText(c,a,d,b){this.moveTo(a,d-getFontSize(this.font));this.lineTo(a+b,d-getFontSize(this.font))},linethroughText:function linethroughText(c,a,d,b){this.moveTo(a,d-(getFontSize(this.font)/2)+2);this.lineTo(a+b,d-(getFontSize(this.font)/2)+2)}};Canvas2D.Factory.extensions.all.MouseEvents={setupMouseEventHandlers:function setupMouseEventHandlers(){ProtoJS.Event.observe(this.canvas,"mousedown",this.handleMouseDown.scope(this));ProtoJS.Event.observe(this.canvas,"mouseup",this.handleMouseUp.scope(this));ProtoJS.Event.observe(document,"mousemove",this.handleMouseMove.scope(this));ProtoJS.Event.observe(this.canvas,"dblclick",this.handleDoubleClick.scope(this))},getLeft:function getLeft(){var a=this.canvas;var b=0;while(a!=null){b+=a.offsetLeft;a=a.offsetParent}return b},getTop:function getTop(){var a=this.canvas;var b=0;while(a!=null){b+=a.offsetTop;a=a.offsetParent}return b},getXY:function getXY(b){var a,c;if(ProtoJS.Browser.IE){a=event.clientX+document.body.scrollLeft;c=event.clientY+document.body.scrollTop}else{a=b.pageX;c=b.pageY}return{x:a-this.getLeft(),y:c-this.getTop()}},handleMouseDown:function handleMouseDown(a){this.mousepressed=true;var b=this.getXY(a);this.fireEvent("mousedown",b);this.mousePos=b},handleMouseUp:function handleMouseUp(a){this.mousepressed=false;var b=this.getXY(a);this.fireEvent("mouseup",b);this.mousePos=b},handleMouseMove:function handleMouseMove(b){if(this.mousepressed){this.handleMouseDrag(b)}var c=this.getXY(b);if(c){var a=this.mouseOver;this.mouseOver=(c.x>=0&&c.x<=this.canvas.width)&&(c.y>=0&&c.y<=this.canvas.height);if(this.mouseOver&&!a){this.fireEvent("mouseEnter")}if(!this.mouseOver&&a){this.fireEvent("mouseLeave")}}},handleMouseDrag:function handleMouseDrag(a){var b=this.getXY(a);this.fireEvent("mousedrag",{x:b.x,y:b.y,dx:b.x-this.mousePos.x,dy:b.y-this.mousePos.y});this.mousePos=b},handleDoubleClick:function handleDoubleClick(a){var b=this.getXY(a);this.fireEvent("dblclick",b);this.mousePos=b}};Canvas2D.Factory.extensions.TouchEvents={setupTouchEventHandlers:function setupTouchEventHandlers(){ProtoJS.Event.observe(this.canvas,"touchstart",this.handleTouchStart.scope(this));ProtoJS.Event.observe(this.canvas,"touchmove",this.handleTouchMove.scope(this));ProtoJS.Event.observe(this.canvas,"touchend",this.handleTouchEnd.scope(this))},handleTouchStart:function handleTouchStart(a){if(a.touches.length==1){this.handleMouseDown(a.touches[0]);a.preventDefault()}},handleTouchMove:function handleTouchMove(a){if(a.touches.length==1){this.handleMouseDrag(a.touches[0]);a.preventDefault()}},handleTouchEnd:function handleTouchEnd(a){this.handleMouseUp(a);a.preventDefault()}};Canvas2D.Factory.extensions.all.TextSupport={adjustToAlignment:function adjustToAlignment(a,b){switch(this.textAlign){case"center":a-=this.measureText(b)/2;break;case"right":a-=this.measureText(b);break}return a},getFontSize:function(){return getFontSize(this.font||Canvas2D.Sheet.Defaults.font)}};Canvas2D.Factory.extensions.CanvasText={fillText:function fillText(c,a,d,b){this.strokeText(c,a,d,b)},strokeText:function strokeText(c,a,d,b){this.beginPath();this.save();this.strokeStyle=this.fillStyle;a=this.adjustToAlignment(a,c);CanvasTextFunctions.draw(this,this.font,getFontSize(this.font),a,d,c);this.decorateText(c,a,d,b);this.restore();this.closePath()},measureText:function measureText(a){return CanvasTextFunctions.measure(this.font,getFontSize(this.font),a)}};Canvas2D.Factory.extensions.HTML5CanvasText={__extend__:function __extend__(d){var g=d.measureText;d.measureText=function c(h){return g.apply(this,arguments).width};var f=d.fillText;d.fillText=function e(l,h,m,k){k=k||this.measureText(l);f.apply(this,arguments);h=this.adjustToAlignment(h,l);this.decorateText(l,h,m,k)};var b=d.strokeText;d.strokeText=function a(l,h,m,k){k=k||this.measureText(l);b.apply(this,arguments);h=this.adjustToAlignment(h,l);this.decorateText(l,h,m,k)};return d}};Canvas2D.Factory.extensions.GeckoCanvasText={fillText:function fillText(c,a,d,b){a=this.adjustToAlignment(a,c);this._drawText(c,a,d,true);this.decorateText(c,a,d,b)},strokeText:function strokeText(c,a,d,b){a=this.adjustToAlignment(a,c);this._drawText(c,a,d,false);this.decorateText(c,a,d,b)},measureText:function measureText(b){this.save();this.mozTextStyle=this.font;var a=this.mozMeasureText(b);this.restore();return a},_drawText:function _drawText(c,a,d,b){this.save();this.beginPath();this.translate(a,d);this.mozTextStyle=this.font;this.mozPathText(c);if(b){this.fill()}else{this.stroke()}this.closePath();this.restore()}};Canvas2D.Factory.setup=function(b){if(!Canvas2D.initialized){Canvas2D.initialized=true;if(!window.CanvasRenderingContext2D){window.CanvasRenderingContext2D=document.createElement("canvas").getContext("2d").__proto__}else{window.CanvasRenderingContext2D=CanvasRenderingContext2D.prototype}}unless(b&&b.nodeType&&b.nodeType==1,function(){throw ("CanvasBase:initialize: expected HTMLElement")});try{var a=b.getContext("2d")}catch(c){throw ("Canvas2D: element is no HTML5 Canvas.")}if(a.strokeText&&a.fillText&&a.measureText){a=Canvas2D.Factory.extensions.HTML5CanvasText.__extend__(a)}else{if(a.mozMeasureText&&a.mozPathText){ProtoJS.mix(Canvas2D.Factory.extensions.GeckoCanvasText,a,true)}else{ProtoJS.mix(Canvas2D.Factory.extensions.CanvasText,a,true);if(ProtoJS.Browser.IE){Canvas2D.Book.prototype.addWaterMark=function(){}}}}if(ProtoJS.Browser.MobileSafari){ProtoJS.mix(Canvas2D.Factory.extensions.TouchEvents,a,true);a.setupTouchEventHandlers()}$H(Canvas2D.Factory.extensions.all).values().iterate(function(d){if(d.__extend__){a=d.__extend__(a)}else{ProtoJS.mix(d,a,true)}});$H(Canvas2D.Defaults.Canvas).iterate(function(d,e){a[d]=e});a.setupMouseEventHandlers();return a};ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D);Canvas2D.KeyboardDriver=Class.extend({init:function initialize(){this.currentKeysDown=[];ProtoJS.Event.observe(document,"keydown",this.handleKeyDownEvent.scope(this));ProtoJS.Event.observe(document,"keyup",this.handleKeyUpEvent.scope(this))},handleKeyDownEvent:function(b){var a=(b||window.event).keyCode;this.currentKeysDown.push(a);this.fireEvent("keydown",a)},handleKeyUpEvent:function handleKeyUpEvent(b){var a=(b||window.event).keyCode;this.currentKeysDown=this.currentKeysDown.remove(a);this.fireEvent("keyup",a)},getCurrentKeysDown:function getCurrentKeysDown(){return this.currentKeysDown},keyDown:function keyDown(a){return this.currentKeysDown.contains(a)}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.KeyboardDriver.prototype);Canvas2D.Keyboard=new Canvas2D.KeyboardDriver();Canvas2D.ImageManager={};Canvas2D.ImageManager.work=0;Canvas2D.ImageManager.load=function(c,b){var a=new Image();Canvas2D.ImageManager.work++;a.onload=function(){Canvas2D.ImageManager.work--;b()};a.src=c;return a};Canvas2D.ImageManager.isReady=function(){return Canvas2D.ImageManager.work==0};Canvas2D.Manager=Class.extend({init:function(){this.plugins=[];this.books=$H()},setupBook:function(a){return this.addBook(new Canvas2D.Book(a))},addBook:function(a){unless(a instanceof Canvas2D.Book,function(){throw ("Manager::addBook: book must be instance of Canvas2D.Book")});this.books.set(a.name,a);return a},getBook:function(a){return this.books.get(a)},startAll:function(){if(Canvas2D.ImageManager.isReady()){this.plugins.iterate(function(a){a.start()});this.books.values().iterate(function(a){a.start()})}else{this.startAll.scope(this).after(10)}}});Canvas2D.ADLVisitor=Class.extend({init:function(){this.errors=[]},visit:function(a,c){var d=a.type.toLowerCase();if(d=="root"){a.childrenAccept(this,c);return c}else{if(Canvas2D.shapes.get(d)){var b=Canvas2D.shapes.get(d).from(a,c);if(b){if(b.errors){b.errors.iterate(function(h){this.errors.push(h)}.scope(this))}else{if(b.warnings){b.warnings.iterate(function(h){this.errors.push(h)}.scope(this))}var f,e;if(a.annotation&&c.at){var g=a.annotation.data.split(",");f=parseInt(g[0]);e=parseInt(g[1]);c.at(f,e).add(b)}else{c.add(b)}a.childrenAccept(this,b)}}return a}else{this.errors.push("Unknown Construct Type: "+a.type);return c}}}});Canvas2D.Book=Class.extend({init:function(a){unless(a&&a.nodeType&&a.nodeType==Node.ELEMENT_NODE,function(){a=document.getElementById(a)});this.canvas=Canvas2D.Factory.setup(a);this.sheets=[];this.currentSheet=0;this.canvas.on("mousedown",function(c){this.fireEvent("mousedown");var b;if(b=this.getCurrentSheet()){b.handleMouseDown(c)}}.scope(this));this.canvas.on("mouseup",function(c){this.fireEvent("mouseup");var b;if(b=this.getCurrentSheet()){b.handleMouseUp(c)}}.scope(this));this.canvas.on("mousedrag",function(c){this.fireEvent("mousedrag");var b;if(b=this.getCurrentSheet()){b.handleMouseDrag(c)}}.scope(this));this.console=document.getElementById(a.id+"Console");this.source=document.getElementById(a.id+"Source");this.generated=document.getElementById(a.id+"Generated");this.name=a.id;this.setupExtensions();this.setupPlugins()},add:function(a){return this.addSheet(a)},addSheet:function(a){unless(a instanceof Canvas2D.Sheet,function(){a=new Canvas2D.Sheet({book:this})}.scope(this));a.setCanvas(this.canvas);a.on("change",this.rePublish.scope(this));a.on("newShape",this.log.scope(this));this.sheets.push(a);return a},setupExtensions:function(){this.extensions=new Hash();Canvas2D.extensions.iterate(function(a){this.extensions.set(a.name,a)}.scope(this))},setupPlugins:function(){this.plugins={};$H(Canvas2D.Book.plugins).iterate(function(a,c){var b=new (c)(this);this.plugins[a]=b;if(c.exposes){c.exposes.iterate(function(d){this[d]=function(g,f,e){this.plugins[a][d](g,f,e)}}.scope(this))}}.scope(this))},log:function(a){if(this.console){this.console.value="["+(new Date).toLocaleString()+"] "+a+"\n"+this.console.value}},getCurrentSheet:function(){return this.sheets[this.currentSheet]},clear:function(){this.sheets.length=0},start:function(){this.stop();this.rePublish();this.publish()},stop:function(){if(this.nextPublish){window.clearTimeout(this.nextPublish)}},freeze:function(){this.wait=true},thaw:function(){this.wait=false},load:function(c){var d=new ADL.Parser();var a;this.errors="";if((a=d.parse(c))){this.clear();this.freeze();var b=new Canvas2D.ADLVisitor();a.getRoot().accept(b,this);this.thaw();this.rePublish();if(b.errors.length>0){this.errors="ADLVisitor reported errors:";b.errors.iterate(function(e){this.log(e);this.errors+="\n   - "+e}.scope(this))}this.fireEvent("sourceLoaded");return true}else{this.log(d.errors);this.errors=d.errors;this.fireEvent("sourceLoaded");return false}},toADL:function(){var a="";this.sheets.iterate(function(b){a+=b.toADL()+"\n"});return a},rePublish:function(){this.rePublishNeeded=true},publish:function(){if(this.rePublishNeeded&&!this.wait){this.publishOnce();this.rePublishNeeded=false;this.afterPublish()}this.nextPublish=this.publish.scope(this).after(10)},publishOnce:function(){var a=new Timer();this.canvas.clear();if(this.getCurrentSheet()){this.beforeRender();this.getCurrentSheet().render();this.afterRender()}this.log("Canvas2D::publish: RenderTime: "+a.stop()+"ms")},afterPublish:function afterPublish(){$H(this.plugins).iterate(function(a,b){if(b.afterPublish){b.afterPublish(this)}}.scope(this))},beforeRender:function beforeRender(){$H(this.plugins).iterate(function(a,b){if(b.beforeRender){b.beforeRender(this)}}.scope(this))},afterRender:function afterRender(){$H(this.plugins).iterate(function(a){if(a.afterRender){a.afterRender(this)}}.scope(this));this.updateExternalSource()},updateExternalSource:function updateExternalSource(){if(this.getCurrentSheet()){var a=this.getCurrentSheet().toADL();if(this.generated&&a!=this.generated.value){this.generated.value=a}this.fireEvent("sourceUpdated",a)}}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.Book.prototype);Canvas2D.Book.plugins={};Canvas2D.ShapeCounter={};Canvas2D.Shape=Class.extend({init:function initialize(b){b=b||{};if(!b.name){b.name=this.getPropertyDefault("name")||"__shape__";if(!Canvas2D.ShapeCounter[b.name]){Canvas2D.ShapeCounter[b.name]=0}b.name+=Canvas2D.ShapeCounter[b.name]++}b=this.preprocess(b);this.setProperties(b);this.getPropertyList().iterate(function a(e){var d=e.substr(0,1).toUpperCase()+e.substr(1);var c="get"+d;if(typeof this[c]=="undefined"){this[c]=function(){return this.getProperty(e)}}}.scope(this));this.postInitialize()},setParent:function setParent(a){this.parent=a},getParent:function getParent(){return this.parent},prepare:function prepare(a){},setProperties:function setProperties(b){this.getPropertyList().iterate(function a(c){this[c]=b[c]!=null?b[c]:null}.scope(this))},setProperty:function setProperty(b,a){this[b]=a!=null?a:null;this.fireEvent("change")},getProperty:function getProperty(c){if(typeof this[c]=="undefined"){var b=c.substr(0,1).toUpperCase()+c.substr(1);var a="get"+b;return this[a]()}else{return this[c]!=null?this[c]:this.getPropertyDefault(c)}},getPropertyDefault:function getPropertyDefault(c){var a=null;this.getClassHierarchy().reverse().iterate(function b(d){if(a==null&&typeof d.Defaults[c]!="undefined"){a=d.Defaults[c]}});return a},toADL:function(a){return this.constructToString(this.asConstruct(),a)},asConstruct:function(){var a={__SHAPE__:this,annotation:{data:null},type:this.getType(),name:this.getName(),supers:[],modifiers:{},children:[],addModifiers:function(b){b.iterate(function(c){if(this.__SHAPE__.getProperty(c)){this.addModifier(c,this.__SHAPE__.getProperty(c))}}.scope(this))},addModifier:function(b,c){if(this.__SHAPE__.getPropertyDefault(b)!=c){this.modifiers[b]='"'+c+'"'}}};a.addModifiers(["label","labelPos","labelColor"]);return a},constructToString:function(a,e){if(a==null){return""}var b="";if(a.annotation&&a.annotation.data){b+=e+"[@"+a.annotation.data+"]\n"}b+=e+a.type+" "+a.name;a.supers.iterate(function(g){b+=" : "+g});$H(a.modifiers).iterate(function f(g,h){if(typeof h!="function"){b+=" +"+g;if(h){b+="="+h}}});if(a.children.length>0){b+=" {\n";var c=this;a.children.iterate(function d(g){b+=c.constructToString(g,e+"  ")+"\n"});b+=e+"}"}else{b+=";"}return b},delayRender:function(){return false},drawLabel:function(a,c,b){if(this.getLabel()&&this.getHeight()!=null&&this.getCenter()){c+=this.getCenter().left;switch(this.getLabelPos()){case"top":b+=-5;break;case"top-inner":b+=+16;break;case"bottom":b+=this.getHeight()+11;break;case"bottom-inner":b+=this.getHeight()-8;break;case"center":default:b+=this.getCenter().top+2.5}a.save();a.fillStyle=this.getLabelColor();a.textAlign=this.getLabelAlign();a.font=this.getLabelFont();a.useCrispLines=this.getLabelUseCrispLines();a.fillText(this.getLabel(),c,b);a.restore()}},render:function(a,c,b){this.prepare(a);a.save();this.draw(a,c,b);this.drawLabel(a,c,b);a.restore()},getType:function(){throw ("Missing getType. Did you register the shape?")},getClasSHierarchy:function(){throw ("Missing getClassHierarchy. Did you register the shape?")},preprocess:function preprocess(a){return a},postInitialize:function postInitialize(){},draw:function draw(a,c,b){},hit:function hit(a,b){return false},hitArea:function hitArea(b,c,a,d){return false},getCenter:function getCenter(){return null},getPort:function getPort(a){return null}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.Shape.prototype);Canvas2D.Shape.MANIFEST={name:"shape",properties:["name","label","labelPos","labelColor","labelAlign","labelFont","labelUseCrispLines","useCrispLines","topDown"]};Canvas2D.Shape.manifestHandling=$H({getManifest:function getManifest(){return this.MANIFEST||this.__CLASS__.MANIFEST},getType:function getType(){return this.getManifest().name},getTypes:function getTypes(){return[this.getType()].concat(this.getAliasses())},getPropertyPath:function getPropertyPath(){return this.getManifest().propertyPath||[]},getClassHierarchy:function getClassHierarchy(){var a=[Canvas2D.Shape].concat(this.getPropertyPath());a.push(this.getClass());return a},getLocalProperties:function getLocalProperties(){return this.getManifest().properties||[]},getPropertyList:function getPropertyList(){if(!this.allPropertiesCache){this.allPropertiesCache=[];this.getClassHierarchy().iterate(function a(b){this.allPropertiesCache=this.allPropertiesCache.concat(b.getLocalProperties())}.scope(this))}return this.allPropertiesCache},getAliasses:function getAliasses(){return this.getManifest().aliasses||[]},getLibraries:function getLibraries(){return this.getManifest().libraries||[]}});Canvas2D.Shape.manifestHandling.iterate(function(a,b){Canvas2D.Shape.prototype[a]=b;Canvas2D.Shape[a]=b});Canvas2D.Sheet=Class.extend({init:function init(a){a=a||{};this.book=a.book;this.name=a.name||"default";this.style=a.style||"static";this.clear();this.dirty=false;if(a.canvas){this.setCanvas(a.canvas)}Canvas2D.Keyboard.on("keyup",this.handleKeyDown.scope(this))},setCanvas:function setCanvas(a){this.canvas=a;this.wireCanvasDelegation();this.setupProperties()},getHeight:function getHeight(){return this.canvas.canvas.height},wireCanvasDelegation:function wireCanvasDelegation(){if(!this.canvas){return}Canvas2D.Sheet.Operations.iterate(function(a){if(a=="restore"){this[a]=function(){this.canvas[a].apply(this.canvas,arguments);this.transferBackProperties();return}.scope(this)}else{this[a]=function(){this.transferProperties();return this.canvas[a].apply(this.canvas,arguments)}.scope(this)}}.scope(this))},setupProperties:function setupProperties(){Canvas2D.Sheet.Properties.iterate(function(a){this[a]=Canvas2D.Sheet.Defaults[a]||this.canvas[a]}.scope(this))},transferProperties:function(){Canvas2D.Sheet.Properties.iterate(function(a){this.canvas[a]=this[a]}.scope(this))},transferBackProperties:function(){Canvas2D.Sheet.Properties.iterate(function(a){this[a]=this.canvas[a]}.scope(this))},makeDirty:function(){this.dirty=true;this.fireEvent("change")},isDirty:function(){return this.dirty},clear:function(){this.positions=[];this.shapesMap={};this.positionsMap={};this.selectedShapes=[];this.fireEvent("change")},makeDynamic:function(){this.style="dynamic"},makeStatic:function(){this.style="static"},isDynamic:function(){return this.style=="dynamic"},isStatic:function(){return !this.isDynamic()},freeze:function(){this.fireEvent("freeze")},thaw:function(){this.fireEvent("thaw")},at:function(b,a){this.newTop=a;this.newLeft=b;return this},put:function(a){return this.add(a)},add:function(b){var d=b.getName().replace(/<.*$/,"");if(this.shapesMap[d]){var c=this.book?this.book:console;c.log("WARNING: Shape with name '"+d+"' already exists. Skipping.");return null}var a=new Canvas2D.Position(b,this.newLeft,this.newTop);b.on("change",this.makeDirty.scope(this));a.on("change",this.makeDirty.scope(this));this.newLeft=null;this.newTop=null;this.positions.push(a);this.shapesMap[d]=b;this.positionsMap[b.getName()]=a;this.fireEvent("newShape","added new shape"+(a.getLeft()!=null?"@"+a.getLeft()+","+a.getTop():""));this.makeDirty();return b},getPosition:function getPosition(a){return this.positionsMap[a.getName()]},hit:function(b,d){for(var c=this.positions.length-1;c>=0;c--){var a=this.positions[c];if(a.hit(b,d)){if(Canvas2D.Keyboard.keyDown(91)||Canvas2D.Keyboard.keyDown(17)){if(this.selectedShapes.contains(a)){this.selectedShapes.remove(a)}else{this.selectedShapes.push(a)}}else{if(!this.selectedShapes.contains(a)){this.selectedShapes=[a]}else{return}}this.fireEvent("shapeSelected",a);return}}this.selectedShapes=[]},hitArea:function(f,e,c,b){var a=(Canvas2D.Keyboard.keyDown(91)||Canvas2D.Keyboard.keyDown(17))?this.selectedShapes:[];for(var d=this.positions.length-1;d>=0;d--){if(this.positions[d].hitArea(f,e,c,b)){a.push(this.positions[d]);this.fireEvent("shapeSelected",this.positions[d])}}this.selectedShapes=a.unique()},handleMouseDown:function(a){if(!this.isDynamic()){return}this.hit(a.x,a.y);this.currentPos=a;this.makeDirty()},handleMouseUp:function(a){if(!this.isDynamic()){return}this.selectedShapes.iterate(function(b){this.fireEvent("shapesMoved","Shape moved to "+b.left+", "+b.top)}.scope(this));this.showSelection=false;this.makeDirty()},handleMouseDrag:function(a){if(!this.isDynamic()){return}if(!this.showSelection&&this.selectedShapes.length>0){this.moveCurrentSelection(a.dx,a.dy)}else{if(!this.currentPos){this.currentPos=a}this.showSelection=true;this.hitArea(this.currentPos.x,this.currentPos.y,a.x,a.y);this.selectionPos=a}this.makeDirty()},selectAllShapes:function(){this.selectedShapes=[];this.positions.iterate(function(a){this.selectedShapes.push(a)}.scope(this));this.makeDirty()},moveCurrentSelection:function(b,a){this.selectedShapes.iterate(function(c){c.move(b,a)}.scope(this))},handleKeyDown:function(a){if(Canvas2D.Keyboard.keyDown(16)){switch(a){case 37:this.moveCurrentSelection(-5,0);break;case 38:this.moveCurrentSelection(0,-5);break;case 39:this.moveCurrentSelection(5,0);break;case 40:this.moveCurrentSelection(0,5);break}}if((Canvas2D.Keyboard.keyDown(91)||Canvas2D.Keyboard.keyDown(17))&&a==65&&this.canvas.mouseOver){this.selectAllShapes()}},addSelectionOverlay:function(){if(this.showSelection){var c=this.selectionPos;var b=c.x-this.currentPos.x;var a=c.y-this.currentPos.y;this.canvas.fillStyle="rgba( 0, 0, 255, 0.1 )";this.canvas.fillRect(c.x<=this.currentPos.x?c.x:this.currentPos.x,c.y<=this.currentPos.y?c.y:this.currentPos.y,Math.abs(b),Math.abs(a))}},addSelectionMarkers:function(){this.selectedShapes.iterate(function(a){var b=a.getBox();this.canvas.fillStyle="rgba( 200, 200, 255, 1 )";[[b.left,b.top],[b.right,b.top],[b.left,b.bottom],[b.right,b.bottom]].iterate(function(c){this.canvas.beginPath();this.canvas.arc(c[0],c[1],5,0,Math.PI*2,true);this.canvas.fill()}.scope(this))}.scope(this))},render:function(){var a=[];this.positions.iterate(function(b){if(b.delayRender()){a.push(b)}else{b.render(this)}}.scope(this));a.iterate(function(b){b.render(this)}.scope(this));this.addSelectionOverlay();this.addSelectionMarkers()},toADL:function(){var a="";a+="Sheet "+this.name;a+=" +"+this.style+" {\n";this.positions.iterate(function(b){var c=b.toADL("  ");if(c){a+=c+"\n"}});a+="}";return a}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.Sheet.prototype);Canvas2D.Sheet.Properties=["globalAlpha","globalCompositeOperation","strokeStyle","fillStyle","lineWidth","lineCap","lineJoin","miterLimit","shadowOffsetX","shadowOffsetY","shadowBlur","shadowColor","font","textAlign","textBaseline","lineStyle","useCrispLines","textDecoration"];Canvas2D.Sheet.Operations=["save","restore","scale","rotate","translate","transform","setTransform","createRadialGradient","createPattern","clearRect","fillRect","strokeRect","beginPath","closePath","moveTo","lineTo","quadraticCurveTo","bezierCurveTo","arcTo","rect","arc","fill","stroke","clip","isPointInPath","fillText","fillText","strokeText","strokeText","measureText","drawImage","createImageData","getImageData","putImageData","getFontSize","fillStrokeRect"];Canvas2D.Sheet.from=function(a,c){var d="static";var b=a.modifiers.get("style");if(b){d=b.value.value.toLowerCase()}a.modifiers.iterate(function(e,f){if(e.toLowerCase()=="static"||e.toLowerCase()=="dynamic"){d=e.toLowerCase()}});return new Canvas2D.Sheet({book:c,name:a.name,style:d})};Canvas2D.Sheet.MANIFEST={name:"sheet",properties:[],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Sheet);Canvas2D.Position=Class.extend({init:function(a,c,b){this.shape=a;this.left=c||null;this.top=b||null},toADL:function(a){var b="";if(this.left!=null&&this.top!=null){b=a+"[@"+this.left+","+this.top+"]\n"}return b+this.shape.toADL(a)},getLeft:function(){return this.left},getTop:function(){return this.top},getWidth:function(){return this.shape.getWidth()},getHeight:function(){return this.shape.getHeight()},getCenter:function(){var a=this.shape.getCenter();a.left+=this.left;a.top+=this.top;return a},getBox:function(){return{left:this.left,right:this.left+this.shape.getWidth(),top:this.top,bottom:this.top+this.shape.getHeight()}},getPort:function(a){var a=this.shape.getPort(a);a.left+=this.left;a.top+=this.top;return a},render:function(a){this.shape.render(a,this.left,this.top)},move:function(a,b){this.left+=a;this.top+=b;this.fireEvent("change","from "+this.left-a+","+this.top-b+" to "+this.left+","+this.top)},getName:function(){return this.shape.getName()},hit:function(a,d){var c=a-this.left;var b=d-this.top;if(c<0||b<0){return false}return this.shape.hit(c,b)},hitArea:function(g,f,c,b){var h=g-this.left;var e=f-this.top;var a=c-this.left;var d=b-this.top;return this.shape.hitArea(min(h,a),min(e,d),max(h,a),max(e,d))},delayRender:function(){return this.shape.delayRender()}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.Position.prototype);Canvas2D.Connector=Canvas2D.Shape.extend({preprocess:function preprocess(a){a=this._super(a);if(a.from==a.to){a.routing="recursive"}return a},getFrom:function getFrom(a){return a?a.getPosition(this.from):this.from},getTo:function getTo(a){return a?a.getPosition(this.to):this.to},delayRender:function delayRender(){return true},isValid:function isValid(){return this.to!=null&&this.from!=null},draw:function draw(a,c,b){if(!this.isValid()){return}a.save();a.useCrispLines=this.getUseCrispLines();a.strokeStyle=this.getLineColor();a.lineWidth=this.getLineWidth();a.lineStyle=this.getLineStyle();a.beginPath();switch(this.getRouting()){case"custom":this._custom(a);break;case"recursive":this._recursive(a);break;case"vertical":this._vertical(a);break;case"horizontal":this._horizontal(a);break;case"direct":default:this._direct(a)}a.stroke();a.closePath();this.addLabels(a);a.restore()},_custom:function _custom(h){var g=this.getFrom(h);var f=this.getTo(h);var a=g.getPort(this.getRouteBegin());var d=f.getPort(this.getRouteEnd());if(this.getRouteStyle()=="straight"){if(this.getRouteBegin()=="e"||this.getRouteBegin()=="w"){var k=a.top-((a.top-d.top)/2);a.top=k;d.top=k}else{var m=a.left-((a.left-d.left)/2);a.left=m;d.left=m}}var e={e:{left:+5,top:-5,align:"left"},n:{left:+5,top:-5,align:"left"},w:{left:-5,top:-5,align:"right"},s:{left:+5,top:+10,align:"left"}};var b;if(this.getRouteBegin()){b=this.getRouteBegin().substring(0,1);this.beginLabelPos={left:a.left+e[b].left,top:a.top+e[b].top};this.beginLabelAlign=e[b].align}else{console.log("WARNING: missing routeBegin on "+this.name)}if(this.getRouteEnd()){b=this.getRouteEnd().substring(0,1);this.endLabelPos={left:d.left+e[b].left,top:d.top+e[b].top};this.endLabelAlign=e[b].align}else{console.log("WARNING: missing routeBegin on "+this.name)}d=this._draw_end_connector(h,d);a=this._draw_start_connector(h,a);switch(this.getRouteStyle()){case"corner":this._draw_corner(h,a,d);break;case"tree":this._draw_tree(h,a,d);break;case"recursive":this._draw_recursive(h,a,d);break;default:var c=a.left-((a.left-d.left)/2);var n=a.top-((a.top-d.top)/2);if(a.top==d.top){n-=5}this.centerLabelPos={left:c,top:n}}h.lineTo(d.left,d.top)},addLabels:function addLabels(a){if(this.getBeginLabel()&&this.getBeginLabelPos()){this.addLabel(a,this.getBeginLabel(),this.getBeginLabelPos(),this.getBeginLabelAlign())}if(this.getEndLabel()&&this.getEndLabelPos()){this.addLabel(a,this.getEndLabel(),this.getEndLabelPos(),this.getEndLabelAlign())}if(this.getCenterLabel()&&this.getCenterLabelPos()){this.addLabel(a,this.getCenterLabel(),this.getCenterLabelPos(),"center")}},addLabel:function addLabel(b,a,d,c){b.save();b.textAlign=c||"left";b.font=this.getLabelFont();b.fillText(a,d.left,d.top);b.restore()},getBeginLabelPos:function getBeginLabelPos(){return this.beginLabelPos},getEndLabelPos:function getEndLabelPos(){return this.endLabelPos},getCenterLabelPos:function getCenterLabelPos(){return this.centerLabelPos},getBeginLabelAlign:function getBeginLabelAlign(){return this.beginLabelAlign||"left"},getEndLabelAlign:function getEndLabelAlign(){return this.endLabelAlign||"left"},_draw_corner:function _draw_corner(c,d,a){var b=this.getRouteBegin().substring(0,1);if(b=="n"||b=="s"){c.lineTo(d.left,a.top);this.centerLabelPos={left:d.left,top:a.top+(b=="n"?-5:10)}}else{c.lineTo(a.left,d.top);this.centerLabelPos={left:a.left,top:d.top+(b=="e"?-5:10)}}c.lineTo(a.left,a.top)},_draw_tree:function _draw_tree(d,f,b){var e=this.getRouteBegin().substring(0,1);var c=b.left-f.left;var a=b.top-f.top;if(e=="n"||e=="s"){d.lineTo(f.left,f.top+a/2);d.lineTo(b.left,f.top+a/2);this.centerLabelPos={left:f.left-((f.left-b.left)/2),top:f.top+(a/2)+10}}else{d.lineTo(f.left+c/2,f.top);d.lineTo(f.left+c/2,b.top);this.centerLabelPos={left:f.left+(c/2),top:f.top-((f.top-b.top)/2)-5}}},_draw_recursive:function _draw_recursive(n,c,h){var l=30;var g=c.left;var p=c.top;var f=h.left;var o=h.top;var a={e:[[g+l,p],[g+l,o-l],[f,o-l]],n:[[g,p-l],[f-l,p-l],[f-l,o]],w:[[g-l,p],[g-l,o+l],[f,o+l]],s:[[g,p+l],[f+l,p+l],[f+l,o]]};var b=this.getRouteBegin().substring(0,1);var m=a[b];n.lineTo(m[0][0],m[0][1]);n.lineTo(m[1][0],m[1][1]);n.lineTo(m[2][0],m[2][1]);var k={e:{left:0,top:-5},n:{left:0,top:-5},w:{left:0,top:+10},s:{left:0,top:+10}};this.centerLabelPos={left:m[1][0]+k[b].left,top:m[1][1]+k[b].top}},_draw_start_connector:function draw_start_connector(d,e){var b=null;var c=this.getRouteBegin();if(this.getBegin()){var a=this.getBegin();b=a[c]?a[c]:a[c.substring(0,1)]}return this._draw_connector(d,b,e.left,e.top)},_draw_end_connector:function draw_start_connector(d,e){var b=null;var c=this.getRouteEnd();if(this.getEnd()){var a=this.getEnd();b=a[c]?a[c]:a[c.substring(0,1)]}return this._draw_connector(d,b,e.left,e.top)},_draw_connector:function _draw_connector(c,b,e,d){c.moveTo(e,d);if(b){var a=c.lineStyle;c.lineStyle="solid";c.stroke();c.beginPath();c.moveTo(e,d);b.lines.iterate(function(f){if(f=="fill"){c.fillStyle="rgba( 0, 0, 0, 1 )";c.fill()}else{c.lineTo(e+f[0],d+f[1])}});c.stroke();c.beginPath();c.lineStyle=a;c.moveTo(e+b.end[0],d+b.end[1]);return{left:e+b.end[0],top:d+b.end[1]}}return{left:e,top:d}},_direct:function _direct(d){var h=this.getFrom(d).getCenter();var g=this.getTo(d).getCenter();var c={"-1":{"-1":["nw","se"],"0":["n","s"],"1":["ne","sw"]},"0":{"-1":["w","e"],"0":["n","s"],"1":["e","w"]},"1":{"-1":["sw","ne"],"0":["s","n"],"1":["se","nw"]}};var a=100;var f=g.top-h.top;f=Math.round(f/a)*a;if(f!=0){f/=Math.abs(f)}var e=g.left-h.left;e=Math.round(e/a)*a;if(e!=0){e/=Math.abs(e)}var b=c[f][e];this.routeStyle="direct";this.routeBegin=b[0];this.routeEnd=b[1];this._custom(d)},_recursive:function _recursive(b){this.routeStyle="recursive";this.routeBegin=this.routeBegin||"ene";var a={nnw:"wnw",ene:"nne",wsw:"ssw",sse:"ese"};this.routeEnd=a[this.routeBegin];this._custom(b)},_vertical:function _vertical(b){var f=this.getFrom(b);var e=this.getTo(b);var a=f.getBox().top<e.getBox().top;var d=a?e.getBox().top-f.getBox().bottom:f.getBox().top-e.getBox().bottom;var c=a?e.getCenter().top-f.getBox().bottom:f.getCenter().top-e.getBox().bottom;if(d>=Canvas2D.Connector.Defaults.minTreeDist){this.routeStyle="tree";this.routeBegin=a?"s":"n";this.routeEnd=a?"n":"s"}else{if(c>=Canvas2D.Connector.Defaults.minCornerDist){this.routeStyle="corner";this.routeBegin=a?"s":"n";this.routeEnd=f.getPort(this.routeBegin).left<e.getPort("w").left?"w":"e"}else{this.routeStyle="straight";this.routeBegin=f.getPort("e").left<e.getPort("w").left?"e":"w";this.routeEnd=this.routeBegin=="e"?"w":"e"}}this._custom(b)},_horizontal:function _horizontal(b){var f=this.getFrom(b);var e=this.getTo(b);var a=f.getBox().left<e.getBox().left;var d=a?e.getBox().left-f.getBox().right:f.getBox().left-e.getBox().right;var c=a?e.getCenter().left-f.getBox().right:f.getCenter().left-e.getBox().right;if(d>=Canvas2D.Connector.Defaults.minTreeDist){this.routeStyle="tree";this.routeBegin=a?"e":"w";this.routeEnd=a?"w":"e"}else{if(c>=Canvas2D.Connector.Defaults.minCornerDist){this.routeStyle="corner";this.routeBegin=a?"e":"w";this.routeEnd=f.getPort(this.routeBegin).top<e.getPort("n").top?"n":"s"}else{this.routeStyle="straight";this.routeBegin=f.getPort("s").top<e.getPort("n").top?"s":"n";this.routeEnd=this.routeBegin=="n"?"s":"n"}}this._custom(b)},initialBranchLength:function initialBranchLength(b,a){return(a-b)/2},hit:function hit(a,b){return false},asConstruct:function asConstruct(){var a=this._super();if(this.getFrom()&&this.getTo()){a.modifiers[this.getFrom().getName()+"-"+this.getTo().getName()]=null}a.modifiers[this.getRouting()]=null;if(this.getRouting()=="custom"){a.annotation.data=this.getRouteStyle()+":"+this.getRouteBegin()+"-"+this.getRouteEnd()}a.addModifiers(["lineColor","lineStyle","lineWidth","begin","end","beginLabel","centerLabel","endLabel"]);if(this.getRouting()=="recursive"&&this.getRouteBegin()!="ene"){a.addModifiers(["routeBegin"])}return a}});Canvas2D.Connector.from=function from(b,c){var d={name:b.name};b.modifiers.iterate(function(g,h){if(h.value==null){if(g.contains("-")){var k=g.split("-");d.from=c.shapesMap[k[0]];d.to=c.shapesMap[k[1]]}else{d.routing=g;if(g=="custom"&&b.annotation&&b.annotation.data&&b.annotation.data.contains(":")&&b.annotation.data.contains("-")){var k=b.annotation.data.split(":");d.routeStyle=k[0];var f=k[1].split("-");d.routeBegin=f[0];d.routeEnd=f[1]}}}else{d[g]=(g=="from"||g=="to")?c.shapesMap[h.value.value]:h.value.value;if(g=="begin"||g=="end"){d[g]=Canvas2D.CustomConnectors[d[g]]}}});errors=[];warnings=[];if(!d.from){errors.push("Missing FROM connection-end on "+b.name)}if(!d.to){errors.push("Missing TO connection-end on "+b.name)}if(!["vertical","horizontal","direct","custom"].has(d.routing)){warnings.push("unknown routing: "+d.routing+", defaulting to direct.")}var a={};if(warnings.length>0){a.warnings=warnings}if(errors.length>0){a.errors=errors}else{var e=new Canvas2D.Connector(d);e.warnings=a.warnings;a=e}return a};Canvas2D.Connector.MANIFEST={name:"connector",aliasses:["link"],properties:["lineColor","lineStyle","lineWidth","from","to","begin","end","routing","routeStyle","routeBegin","routeEnd","beginLabel","centerLabel","endLabel"],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Connector);Canvas2D.CustomConnectors={};Canvas2D.registerConnector=function registerConnector(b,a){Canvas2D.CustomConnectors[b]=a};Canvas2D.Line=Canvas2D.Shape.extend({getWidth:function(){return this.getDx()},getHeight:function(){return this.getDy()},draw:function(a,c,b){a.beginPath();a.strokeStyle=this.getColor();a.lineWidth=this.getLineWidth();a.lineStyle=this.getLineStyle();a.moveTo(c,b);a.lineTo(c+this.getDx(),b+this.getDy());a.stroke();a.lineStyle="solid";a.closePath()},hit:function(a,b){return(this.getWidth()>=a&&this.getHeight()>=b)},hitArea:function(d,c,b,a){return !(0>b||this.getWidth()<d||0>a||this.getHeight()<c)},getCenter:function(){return{left:this.getWidth()/2,top:this.getHeight()/2}},getPort:function(a){switch(a){case"n":case"north":return{top:0,left:this.getWidth()/2};break;case"s":case"south":return{top:this.getHeight(),left:this.getWidth()/2};break;case"e":case"east":return{top:this.getHeight()/2,left:this.getWidth()};break;case"w":case"west":return{top:this.getHeight()/2,left:0};break}},getGeo:function(){return this.getWidth()&&this.getHeight()?this.getWidth()+"x"+this.getHeight():null},asConstruct:function(){var a=this._super();a.addModifiers(["geo","color"]);return a}});Canvas2D.Line.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){e=(e.value?e.value.value:"");if(d=="dx"||d=="dy"||d=="lineWidth"){e=parseInt(e)}else{if(e==""){e=d;d="color"}}c[d]=e});return new Canvas2D.Line(c)};Canvas2D.Line.MANIFEST={name:"line",properties:["color","dx","dy","lineWidth","lineStyle"],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Line);Canvas2D.LinePath=Canvas2D.Shape.extend({getWidth:function(){return this.dx},getHeight:function(){return this.dy},getStart:function(){return this.start},getMoves:function(){return this.moves},preprocess:function(d){if(d.start){var e=d.start.split(",");d.start={left:parseInt(e[0]),top:parseInt(e[1])}}else{d.start={left:0,top:0}}if(d.moves){var b=[];var c=max(0,d.start.left);var a=max(0,d.start.top);d.moves.split(";").iterate(function(f){var g=f.split(",");b.push({dx:parseInt(g[0]),dy:parseInt(g[1])});c=max(c,c+parseInt(g[0]));a=max(a,a+parseInt(g[1]))});d.moves=b;d.dx=c;d.dy=a}return d},draw:function(a,c,b){a.beginPath();a.strokeStyle=this.getColor();a.lineWidth=this.getLineWidth();a.lineStyle=this.getLineStyle();c+=this.start.left;b+=this.start.top;a.moveTo(c,b);this.getMoves().iterate(function(d){c=c+d.dx;b=b+d.dy;a.lineTo(c,b)});a.stroke();a.closePath()},hit:function(a,b){return(this.getWidth()>=a&&this.getHeight()>=b)},hitArea:function(d,c,b,a){return !(0>b||this.getWidth()<d||0>a||this.getHeight()<c)},getCenter:function(){return{left:this.getWidth()/2,top:this.getHeight()/2}},getPort:function(a){switch(a){case"n":case"north":return{top:0,left:this.getWidth()/2};break;case"s":case"south":return{top:this.getHeight(),left:this.getWidth()/2};break;case"e":case"east":return{top:this.getHeight()/2,left:this.getWidth()};break;case"w":case"west":return{top:this.getHeight()/2,left:0};break}},getGeo:function(){return this.getWidth()&&this.getHeight()?this.getWidth()+"x"+this.getHeight():null},asConstruct:function(){var a=this._super();a.addModifiers(["geo","color"]);return a}});Canvas2D.LinePath.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){e=(e.value?e.value.value:"");if(d=="dx"||d=="dy"||d=="lineWidth"){e=parseInt(e)}else{if(e==""){e=d;d="color"}}c[d]=e});return new Canvas2D.LinePath(c)};Canvas2D.LinePath.MANIFEST={name:"linepath",properties:["dx","dy","start","moves","color","lineWidth","lineStyle"],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.LinePath);Canvas2D.Alias=Canvas2D.Shape.extend({});Canvas2D.Alias.mapper={sheet:function(a){return function(b,d){var c=Canvas2D.Sheet.from(b,d);return c}},connector:function(a){return function(c,e){var b=new ADL.Modifier("routing",new ADL.String("vertical"));c.modifiers.set(b.key,b);var d=Canvas2D.Connector.from(c,e);return d}},image:function(a){var b=a.modifiers;return function(c,e){b.iterate(function(f,g){c.modifiers.set(f,g)});var d=Canvas2D.Image.from(c,e);return d}}};Canvas2D.Alias.from=function(a,b){Canvas2D.registerShape({prototype:{},MANIFEST:{name:a.name,libraries:["Aliasses"]},from:Canvas2D.Alias.mapper[a.supers[0]](a,b)})};Canvas2D.Alias.MANIFEST={name:"alias",aliasses:["shape"],libraries:[]};Canvas2D.registerShape(Canvas2D.Alias);Canvas2D.CompositeShape=Canvas2D.Shape.extend({hasChildren:function hasChildren(){return this.getChildren().length>0},hit:function(a,b){return(this.getWidth()>=a&&this.getHeight()>=b)},hitArea:function(d,c,b,a){return !(0>b||this.getWidth()<d||0>a||this.getHeight()<c)},getWidth:function getWidth(a){if(this.grows&&this.getParent().composition.widthGrows()&&!a){return this.getParent().getWidth(a)}if(this.hasChildren()){return max(this.composition.getWidth(),this.width)}return this.width},getHeight:function getHeight(a){if(this.grows&&this.getParent().composition.heightGrows()&&!a){return this.getParent().getHeight(a)}if(this.hasChildren()){return max(this.composition.getHeight(),this.height)}return this.height},getChildren:function getChildren(){if(!this.children){this.children=[]}return this.children},preprocess:function preprocess(b){b.composition=b.composition||"vertical-stack";var a=[];if(b.composition.contains(":")){a=b.composition.split(":");b.composition=a.shift()}b.composition=new Canvas2D.Compositors[b.composition](a,this);return b},draw:function(a,c,b){this.getChildren().iterate(function(f){var e=this.composition.getPosition(f,this.getChildren());f.render(a,c+e.left,b+e.top)}.scope(this))},prepare:function(a){this._super();if(this.hasChildren()){this.prepareChildren(a);this.composition.prepare()}},prepareChildren:function prepareChildren(a){this.getChildren().iterate(function(b){b.prepare(a)})},add:function add(a){a.topDown=true;this.getChildren().push(a);a.setParent(this)},asConstruct:function(){var a=this._super();return a}});Canvas2D.CompositeShape.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){e=(e.value?e.value.value:"");if(""+e==""){e=d;d="composition"}c[d]=e});return new Canvas2D.CompositeShape(c)};Canvas2D.CompositeShape.MANIFEST={name:"compositeShape",aliasses:["group"],properties:["width","height","grows","composition","padding"]};Canvas2D.registerShape(Canvas2D.CompositeShape);Canvas2D.Compositors={"vertical-stack":Class.extend({init:function init(b,a){this.align=b.contains("left")?"left":b.contains("right")?"right":"center";this.shape=a},prepare:function prepare(){this.left=0;this.top=0},getPadding:function getPadding(){return parseInt(this.shape.padding?this.shape.padding:0)},getPosition:function(d){var a=this.getPadding();var b=this.shape.getWidth();if(this.align=="center"){a=(b-d.getWidth())/2}else{if(this.align=="right"){a=b-d.getWidth()-this.getPadding()}}var c=this.top;this.top+=d.getHeight();return{left:this.left+a,top:c+this.getPadding()}},getWidth:function getWidth(){var a=0;this.shape.getChildren().iterate(function(b){a=max(b.getWidth(b.grows),a)});return a+this.getPadding()*2},getHeight:function getHeight(){var a=0;this.shape.getChildren().iterate(function(b){a+=b.getHeight(b.grows)});return a+this.getPadding()*2},heightGrows:function heightGrows(){return false},widthGrows:function widthGrows(){return true}}),"horizontal-stack":Class.extend({init:function init(b,a){this.align=b.contains("top")?"top":b.contains("bottom")?"bottom":"center";this.shape=a},prepare:function prepare(){this.left=0;this.top=0},getPosition:function(d){var b=0;var a=this.shape.getHeight();if(this.align=="center"){b=(a-d.getHeight())/2}else{if(this.align=="bottom"){b=a-d.getHeight()}}var c=this.left;this.left+=d.getWidth();return{left:c,top:this.top+b}},getWidth:function getWidth(){var a=0;this.shape.getChildren().iterate(function(b){a+=b.getWidth(b.grows)});return a},getHeight:function getHeight(){var a=0;this.shape.getChildren().iterate(function(b){a=max(b.getHeight(b.grows),a)});return a},heightGrows:function heightGrows(){return true},widthGrows:function widthGrows(){return false}})};Canvas2D.Rectangle=Canvas2D.CompositeShape.extend({draw:function draw(b,e,d){b.useCrispLines=this.getUseCrispLines();b.lineWidth=this.getLineWidth();b.strokeStyle=this.getLineColor();b.fillStyle=this.getFillColor();var c=this.getWidth();var a=this.getHeight();if(this.getRoundCorners()){this._drawRoundCorners(b,e,d,c,a)}else{this._drawStraightCorners(b,e,d,c,a)}this._super(b,e,d)},_drawRoundCorners:function _drawRoundCorners(b,e,d,c,a){b.beginPath();b.moveTo(e+20,d);b.lineTo(e+c-20,d);b.arcTo(e+c+0.5,d+0.5,e+c+0.5,d+20,20);b.lineTo(e+c,d+a-20);b.arcTo(e+c+0.5,d+a+0.5,e+c-20,d+a+0.5,20);b.lineTo(e+20,d+a);b.arcTo(e+0.5,d+a+0.5,e+0.5,d+a-20+0.5,20);b.lineTo(e,d+20);b.arcTo(e+0.5,d+0.5,e+20.5,d+0.5,20);b.closePath();b.fill();b.stroke()},_drawStraightCorners:function _drawStraightCorners(b,e,d,c,a){b.fillRect(e,d,c,a);b.strokeRect(e,d,c,a)},getCenter:function(){return{left:this.getWidth()/2,top:this.getHeight()/2}},getPort:function(b){var a={nw:{left:0,top:0},nnw:{left:0.25,top:0},n:{left:0.5,top:0},nne:{left:0.75,top:0},ne:{left:1,top:0},ene:{left:1,top:0.25},e:{left:1,top:0.5},ese:{left:1,top:0.75},se:{left:1,top:1},sse:{left:0.75,top:1},s:{left:0.5,top:1},ssw:{left:0.25,top:1},sw:{left:0,top:1},wsw:{left:0,top:0.75},w:{left:0,top:0.5},wnw:{left:0,top:0.25}};if(!a[b]){return{left:0,top:0}}return{left:a[b].left*this.getWidth(),top:a[b].top*this.getHeight()}},getGeo:function(){return this.getWidth()&&this.getHeight()?this.getWidth()+"x"+this.getHeight():null},asConstruct:function(){var a=this._super();a.addModifiers(["geo","lineColor","roundCorners"]);return a}});Canvas2D.Rectangle.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){e=(e.value?e.value.value:"");if(d=="width"||d=="height"){e=parseInt(e)}if(d=="geo"){c.width=parseInt(e.split("x")[0]);c.height=parseInt(e.split("x")[1])}if(""+e==""){if(d=="roundCorners"){e=true}else{e=d;d="lineColor"}}c[d]=e});return new Canvas2D.Rectangle(c)};Canvas2D.Rectangle.MANIFEST={name:"rectangle",aliasses:["box"],properties:["lineWidth","lineColor","fillColor","roundCorners"],propertyPath:[Canvas2D.CompositeShape],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Rectangle);Canvas2D.Text=Canvas2D.Rectangle.extend({prepare:function(a){a.useCrispLines=this.getUseCrispLines();a.strokeStyle=this.getColor();a.fillStyle=this.getColor();a.font=this.getFont();a.textAlign=this.getTextAlign();a.textDecoration=this.getTextDecoration();this.width=a.measureText(this.getText());this.height=a.getFontSize()},draw:function(a,c,b){if(this.getTopDown()){b+=this.getHeight()}a.fillText(this.getText(),c,b)},asConstruct:function(){var a=this._super();a.addModifiers(["color"]);return a}});Canvas2D.Text.from=function(a,c){var b={name:a.name,text:a.value.value};a.modifiers.iterate(function(d,e){e=(typeof e.value!="undefined"?e.value.value:"");b[d]=e});return new Canvas2D.Text(b)};Canvas2D.Text.MANIFEST={name:"text",properties:["text","color","font","textAlign","textDecoration"],propertyPath:[Canvas2D.Rectangle],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Text);Canvas2D.Image=Canvas2D.Rectangle.extend({getSource:function(){return this.src},getImage:function(){return this.image},postInitialize:function(){if(this.getSource()){this.image=Canvas2D.ImageManager.load(this.getSource(),this.updateSize.scope(this))}},updateSize:function(){this.width=this.image.width;this.height=this.image.height},draw:function(a,c,b){a.drawImage(this.getImage(),c,b)},asConstruct:function(){var a=this._super();a.addModifiers(["source"]);return a}});Canvas2D.Image.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){c[d]=e.value.value});return new Canvas2D.Image(c)};Canvas2D.Image.MANIFEST={name:"image",aliasses:["pic","picture"],properties:["src"],propertyPath:[Canvas2D.Rectangle],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Image);Canvas2D.Arrow=Canvas2D.Rectangle.extend({draw:function(a,c,b){a.useCrispLines=this.getUseCrispLines();a.lineWidth=this.getLineWidth();a.strokeStyle=this.getLineColor();a.fillStyle=this.getFillColor();a.fillRect(c,b,this.getWidth()-this.getArrowHeadWidth(),this.getHeight());a.strokeRect(c,b,this.getWidth()-this.getArrowHeadWidth(),this.getHeight());a.beginPath();a.moveTo(c+this.getWidth()-this.getArrowHeadWidth(),b);a.lineTo(c+this.getWidth()-this.getArrowHeadWidth(),b+(this.getHeight()/2)-(this.getArrowHeadHeight()/2));a.lineTo(c+this.getWidth(),b+(this.getHeight()/2));a.lineTo(c+this.getWidth()-this.getArrowHeadWidth(),b+(this.getHeight()/2)+(this.getArrowHeadHeight()/2));a.closePath();a.stroke();a.fill()},hit:function(a,b){return(this.getWidth()>=a&&this.getHeight()>=b)},hitArea:function(d,c,b,a){return !(0>b||this.getWidth()<d||0>a||this.getHeight()<c)},getCenter:function(){return{left:this.getWidth()/2,top:this.getHeight()/2}},getPort:function(a){switch(a){case"n":case"north":return{top:0,left:this.getWidth()/2};break;case"s":case"south":return{top:this.getHeight(),left:this.getWidth()/2};break;case"e":case"east":return{top:this.getHeight()/2,left:this.getWidth()};break;case"w":case"west":return{top:this.getHeight()/2,left:0};break}}});Canvas2D.Arrow.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){e=(e.value?e.value.value:"");if(d=="width"||d=="height"){e=parseInt(e)}if(d=="geo"){c.width=parseInt(e.split("x")[0]);c.height=parseInt(e.split("x")[1])}if(""+e==""){e=d;d="lineColor"}c[d]=e});return new Canvas2D.Arrow(c)};Canvas2D.Arrow.MANIFEST={name:"arrow",aliasses:["pointer"],properties:["width","height","arrowHeadWidth","arrowHeadHeight"],propertyPath:[Canvas2D.Rectangle],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Arrow);Canvas2D.Book.plugins.TabbedCanvas=Class.extend({init:function(a){this.book=a},makeTab:function(c,b,f){var e=document.createElement("div");e.className="tabbertab";e.style.height=(4+parseInt(b))+"px";var d=document.createElement("h2");var a=document.createTextNode(c);d.appendChild(a);e.appendChild(d);e.appendChild(f);return e},getAboutTab:function(){var d=this.book.canvas.canvas.width;var a=this.book.canvas.canvas.height;var c=document.createElement("div");c.className="Canvas2D-about";c.style.height=a+"px";c.style.width=(parseInt(d)-4)+"px";var b="";Canvas2D.extensions.iterate(function(e){b+="\n<hr>\n";b+="<b>Library: "+e.name+" "+e.version+"</b> by "+e.author+"<br>"+e.info});c.innerHTML='<span class="Canvas2D-about-text"><b>Canvas2D '+Canvas2D.version+'</b><br>Copyright &copy 2009, <a href="http://christophe.vg" target="_blank">Christophe VG</a> & <a href="http://thesoftwarefactory.be" target="_blank">The Software Factory</a><br>Visit <a href="http://thesoftwarefactory.be/wiki/Canvas2D" target="_blank">http://thesoftwarefactory.be/wiki/Canvas2D</a> for more info. Licensed under the <a href="http://thesoftwarefactory.be/wiki/BSD_License" target="_blank">BSD License</a>.'+b+"</span>";return this.makeTab("About",a,c)},getConsoleTab:function(){var b=this.book.canvas.canvas.width;var a=this.book.canvas.canvas.height;this.book.console=document.createElement("textarea");this.book.console.className="Canvas2D-console";this.book.console.style.height=a+"px";this.book.console.style.width=(parseInt(b)-4)+"px";return this.makeTab("Console",a,this.book.console)},getSourceTab:function(){var c=this.book.canvas.canvas.width;var a=this.book.canvas.canvas.height;var b=this.book.generated?this.book.generated.value:"";this.book.generated=document.createElement("textarea");this.book.generated.value=b;this.book.generated.className="Canvas2D-source";this.book.generated.style.height=a+"px";this.book.generated.style.width=(parseInt(c)-4)+"px";return this.makeTab("Source",a,this.book.generated)},applyTabber:function(){var d=this.book.canvas.canvas;this.tabber=document.createElement("div");this.tabber.className="tabber";this.tabber.style.width=(parseInt(d.width)+17)+"px";this.tabber.style.height=(parseInt(d.height)+37)+"px";d.parentNode.replaceChild(this.tabber,d);var b=document.createElement("div");b.className="tabbertab";var a=document.createElement("h2");var c=document.createTextNode("Diagram");a.appendChild(c);b.appendChild(a);b.appendChild(d);this.tabber.appendChild(b)},makeTabbed:function(a){if(!this.tabber){this.applyTabber()}if(!Object.isArray(a)){return}if(a.contains("console")){this.tabber.appendChild(this.getConsoleTab())}if(a.contains("source")){this.tabber.appendChild(this.getSourceTab())}if(a.contains("about")){this.tabber.appendChild(this.getAboutTab())}tabberAutomatic()}});Canvas2D.Book.plugins.TabbedCanvas.exposes=["makeTabbed"];Canvas2D.Book.plugins.AutoLayout=Class.extend({init:function(a){this.book=a;this.active=false},autoLayout:function autoLayout(a){this.strategy=a;this.strategy.start();this.active=true;this.book.rePublish()},beforeRender:function beforeRender(d){if(!this.active){return}var b=[];var a=$H();var e=0;d.getCurrentSheet().positions.iterate(function(c){if(!(c.shape instanceof Canvas2D.Connector)){b.push({position:c,x:c.left+c.shape.getWidth()/2,y:c.top+c.shape.getHeight()/2,s:c.shape.getWidth()>c.shape.getHeight()?c.shape.getWidth():c.shape.getHeight(),f1:0,f2:0,c:[]});a.set(c.shape.getName(),parseInt(e++))}});d.getCurrentSheet().positions.iterate(function(g){if(g.shape instanceof Canvas2D.Connector){var f=a.get(g.shape.getFrom(d.getCurrentSheet()).getName());var c=a.get(g.shape.getTo(d.getCurrentSheet()).getName());b[f].c.push(c);b[c].c.push(f)}});b=this.strategy.layout(b);if(b){b.iterate(function(c){c.position.left=c.x-c.position.shape.getWidth()/2;c.position.top=c.y-c.position.shape.getHeight()/2})}else{this.active=false}},afterPublish:function afterPublish(a){if(this.active){a.rePublish()}}});Canvas2D.Book.plugins.AutoLayout.exposes=["autoLayout"];var ForceLayoutStrategy=Class.extend({init:function initialize(a){this.max_repulsive_force_distance=a.max_repulsive_force_distance||50;this.k=a.k||20;this.c=a.c||0.05;this.max_movement=a.max_movement||10;this.max_iterations=a.max_iterations||1000;this.render=a.render||function(){};this.canContinue=a.canContinue||function(){return false}},getIterations:function getIterations(){return this.iteration},start:function start(){this.iteration=0},layout:function layout(a){this.elements=a;if(this.canContinue()){if(this.iteration<=this.max_iterations){this._layout();return this.elements}}return null},_layout:function layout(){this.iteration++;if(this.canContinue()){if(this.iteration<=this.max_iterations){this._layout_iteration()}else{console.log("max iterations ("+this.max_iterations+") reached.")}}},_layout_iteration:function _layout_iteration(){for(var d=0;d<this.elements.length;d++){this.elements[d].f1=0;this.elements[d].f2=0}for(var d=0;d<this.elements.length;d++){for(var e=0;e<this.elements.length;e++){if(d!==e){this._layout_repulsive(d,e)}}}for(var d=0;d<this.elements.length;d++){for(var e=0;e<this.elements.length;e++){if(d!==e&&this.elements[e].c.indexOf(d)>-1){this._layout_attractive(d,e)}}}for(var d=0;d<this.elements.length;d++){var c=this.c*this.elements[d].f1;var b=this.c*this.elements[d].f2;var a=this.max_movement;if(c>a){c=a}if(c<a*-1){c=a*-1}if(b>a){b=a}if(b<a*-1){b=a*-1}this.elements[d].x+=c;this.elements[d].y+=b}},_layout_repulsive:function _layout_repulsive(e,h){var b=this.elements[h].x-this.elements[e].x;var a=this.elements[h].y-this.elements[e].y;var f=b*b+a*a;if(f<0.01){b=Math.random()+0.1;a=Math.random()+0.1;f=b*b+a*a}var g=Math.sqrt(f);if(g<this.max_repulsive_force_distance){var c=this.k*this.k/g;this.elements[h].f1+=c*b/g;this.elements[h].f2+=c*a/g;this.elements[e].f1-=c*b/g;this.elements[e].f2-=c*a/g}},_layout_attractive:function _layout_attractive(e,k){var b=this.elements[k].x-this.elements[e].x;var a=this.elements[k].y-this.elements[e].y;var f=b*b+a*a;if(f<0.01){b=Math.random()+0.1;a=Math.random()+0.1;f=b*b+a*a}var h=Math.sqrt(f);if(h>this.max_repulsive_force_distance){h=this.max_repulsive_force_distance;f=h*h}var c=(f-this.k*this.k)/this.k;var g=this.elements[e].s;if(g<1){g=1}c*=Math.log(g)*0.5+1;this.elements[k].f1-=c*b/h;this.elements[k].f2-=c*a/h;this.elements[e].f1+=c*b/h;this.elements[e].f2+=c*a/h}});Canvas2D.Book.plugins.Watermark=Class.extend({afterPublish:function afterPublish(a){a.canvas.save();a.canvas.fillStyle="rgba(125,125,125,1)";a.canvas.textDecoration="none";a.canvas.rotate(Math.PI/2);var b="";a.extensions.iterate(function(c,d){b+=" + "+c});a.canvas.font="6pt Sans-Serif";a.canvas.textAlign="left";a.canvas.useCrispLines=false;a.canvas.lineStyle="solid";a.canvas.fillText("Canvas2D"+b+" / Christophe VG",3,(a.canvas.canvas.width*-1)+7+(ProtoJS.Browser.IE?4:0));a.canvas.restore()}});Canvas2D.KickStart={};Canvas2D.KickStart.Starter=Class.extend({init:function(){this.manager=new Canvas2D.Manager()},getTag:function(){return"Canvas2D"},makeInstance:function(a){return this.manager.setupBook(a)},start:function(){var m=document.getElementsByTagName("canvas");for(var k=0;k<m.length;k++){var d=m[k];var f=d.className;if(f.contains(this.getTag())){var b=d.id;var g=this.makeInstance(d);if(f.contains("Tabbed")){var l=[];if(f.contains("withSource")){l.push("source")}if(f.contains("withConsole")){l.push("console")}if(f.contains("withAbout")){l.push("about")}g.makeTabbed(l)}var e=document.getElementById(b+"Source");if(e){var a;try{a=e.firstChild.nodeValue}catch(h){a=e.value}g.load(a)}}}this.fireEvent("ready");this.manager.startAll()}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.KickStart.Starter.prototype);Canvas2D.KickStarter=new Canvas2D.KickStart.Starter();ProtoJS.Event.observe(window,"load",function(){Canvas2D.KickStarter.start()});Canvas2D.KickStarter.on("ready",function(){Canvas2D.fireEvent("ready")});Canvas2D.Defaults={};Canvas2D.Defaults.Canvas={lineWidth:1,useCrispLines:true,lineStyle:"solid",strokeStyle:"black",fillStyle:"black",font:"10pt Sans-Serif",textAlign:"left",textBaseline:"alphabetic",textDecoration:"none"};Canvas2D.Sheet.Defaults={lineWidth:1,lineStyle:"solid",strokeStyle:"black",fillStyle:"black",font:"10pt Sans-Serif",textAlign:"left",textBaseline:"alphabetic",textDecoration:"none",shadowColor:"rgba(0,0,0,0.0)"};Canvas2D.Shape.Defaults={useCrispLines:true,label:"",labelFont:"7pt Sans-Serif",labelAlign:"center",labelPos:"center",labelColor:"black",labelUseCrispLines:false};Canvas2D.Rectangle.Defaults={useCrispLines:true,lineWidth:1,lineColor:"rgba(0,0,0,100)",fillColor:"rgba(255,255,255,0)",labelPos:"center",labelColor:"black",width:50,height:50};Canvas2D.Connector.Defaults={useCrispLines:true,lineWidth:1,lineColor:"black",lineStyle:"solid",begin:null,end:null,minTreeDist:30,minCornerDist:15};Canvas2D.Text.Defaults={useCrispLines:false,color:"black",font:"10pt Sans-Serif",textAlign:"left",textDecoration:"none"};Canvas2D.Line.Defaults={lineWidth:1,lineStyle:"solid",labelPos:"center",labelColor:"black",color:"black",dx:50,dy:50};Canvas2D.LinePath.Defaults={lineWidth:1,lineStyle:"solid",labelPos:"center",labelColor:"black",color:"black"};Canvas2D.Image.Defaults={};Canvas2D.Arrow.Defaults={};Canvas2D.CompositeShape.Defaults={};Canvas2D.version="0.3-46";var UMLCANVAS_VERSION="0.4-7";if(typeof decomposeVersion!="function"){function decomposeVersion(b){var a=b.match(/([0-9]+)\.([0-9]+)(-([0-9]+))?/);return{major:parseInt(a[1]),minor:parseInt(a[2]),build:parseInt(a[4])||0}}}if(typeof iRequire!="function"){function iRequire(d,a,c){var b=decomposeVersion(d.version);a=decomposeVersion(a);if((b.major<a.major)||(b.major==a.major&&b.minor<a.minor)||(b.major==a.major&&b.minor==a.minor&&b.build<a.build)){return false}if(c){c=decomposeVersion(c);if((b.major>c.major)||(b.major==c.major&&b.minor>c.minor)||(b.major==c.major&&b.minor==c.minor&&b.build>c.build)){return false}}return true}}if(!iRequire(Canvas2D,"0.2-5")){alert("UmlCanvas requires at least Canvas2D version 0.2-5. Current Canvas2D is "+Canvas2D.version)}var UmlCanvasBase=Class.extend({init:function init(){this.plugins={}},getModel:function getModel(a){return UmlCanvas.KickStarter.manager.getModel(a)}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,UmlCanvasBase);var UmlCanvas=new UmlCanvasBase();UmlCanvas.version=UMLCANVAS_VERSION;UmlCanvas.activate=function activate(e){var c=document.getElementById(e);if(c){var d=new UmlCanvas.Manager();var b=d.setupModel(e);var a=b.addDiagram();d.startAll();return a}throw (e+" does not reference a known id on the document.")};ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,UmlCanvas);Canvas2D.extensions.push({name:"UmlCanvas",version:UMLCANVAS_VERSION,author:'<a href="http://christophe.vg">Christophe VG</a>',info:'Visit <a href="http://thesoftwarefactory.be/wiki/UmlCanvas">http://thesoftwarefactory.be/wiki/UmlCanvas</a> for more info.'});UmlCanvas.Common={extractVisibility:function(a){var b=a.modifiers.get("visibility");if(b&&b.value){return b.value.value}if(a.modifiers.get("public")){return"public"}if(a.modifiers.get("private")){return"private"}if(a.modifiers.get("protected")){return"protected"}if(a.modifiers.get("package")){return"package"}return null},extractStatic:function(a){return a.modifiers.get("static")},extractAbstract:function(b){var a=b.modifiers.get("abstract");if(a&&a.value){return a.value.value}else{if(a){return true}}return false},determineVisibility:function(a){switch(a){case"__HIDE__":return"";case"protected":return"#";case"private":return"-";case"package":return"~"}return"+"}};UmlCanvas.Manager=Canvas2D.Manager.extend({setupModel:function setupModel(a){return this.addBook(new UmlCanvas.Model(a))},getModel:function getModel(a){return this.getBook(a||"")}});UmlCanvas.Model=Canvas2D.Book.extend({init:function(a){this._super(a);this.uc_plugins={}},getName:function getName(){return this.name},addPlugin:function addPlugin(a){this.uc_plugins[a.getName()]=a},getPlugin:function getPlugin(a){return this.uc_plugins[a]},activatePlugins:function activatePlugins(){$H(this.uc_plugins).iterate(function(a,b){b.activate()}.scope(this))},addDiagram:function(a){unless(a instanceof UmlCanvas.Diagram,function(){a=new UmlCanvas.Diagram()});return this.addSheet(a)},getWidth:function getWidth(){return parseInt(this.canvas.canvas.width)},getHeight:function getHeight(){return parseInt(this.canvas.canvas.height)},getLeft:function getLeft(){return this.canvas.getLeft()},getTop:function getTop(){return this.canvas.getTop()},setSize:function setSize(b,a){this.canvas.canvas.width=b;this.canvas.canvas.height=a;this.rePublish()}});UmlCanvas.Diagram=Canvas2D.Sheet.extend({init:function(a){this._super(a);this.on("shapeSelected",this.handleElementSelected.scope(this));this.on("shapeChanged",this.handleElementChanged.scope(this))},handleElementSelected:function(a){if(a instanceof UmlCanvas.Interface){this.canvas.fireEvent("interfaceSelected",a.props)}else{if(a instanceof UmlCanvas.Class){this.canvas.fireEvent("classSelected",a.props)}}},handleElementChanged:function(a){if(a instanceof UmlCanvas.Interface){this.canvas.fireEvent("interfaceChanged",a.props)}else{if(a instanceof UmlCanvas.Class){this.canvas.fireEvent("classChanged",a.props)}}},addClass:function(a){return this.add(a)},getDiagramClass:function(a){return this.shapesMap[a.replace(/<.*$/,"")]},addRelation:function(a){return this.add(a)},toADL:function(){var a="";a+="Diagram "+this.name;a+=" +"+this.style+" {\n";this.positions.iterate(function(b){var c=b.toADL("  ");if(c){a+=c+"\n"}});a+="}";return a},asConstruct:function(){var a=this._super();this.shapes.iterate(function(b){a.push(b.asConstruct())});return a}});UmlCanvas.Diagram.from=function(a,d){var e="static";var b=a.modifiers.get("style");if(b){e=b.value.value.toLowerCase()}a.modifiers.iterate(function(f,g){if(f.toLowerCase()=="static"||f.toLowerCase()=="dynamic"){e=f.toLowerCase()}});var c=new UmlCanvas.Diagram({book:d,name:a.name,style:e});d.addDiagram(c);return c};UmlCanvas.Diagram.MANIFEST={name:"diagram",propertyPath:[Canvas2D.Sheet],libraries:["UmlCanvas","Diagram"]};Canvas2D.registerShape(UmlCanvas.Diagram);UmlCanvas.Class=Canvas2D.Rectangle.extend({addSuper:function(a){if(!this.supers){this.supers=[]}this.supers.push(a)},postInitialize:function(a){this.attributes=new Array();this.operations=new Array();this.markUnprepared();this.config=UmlCanvas.Class.Defaults},prepare:function(c){if(this.prepared){return}var a=[this.getName(),"<<"+this.getStereotype()+">>"];this.attributes.iterate(function(g){a.push(g.toString())});this.operations.iterate(function(g){a.push(g.toString())});var d=0;c.font=this.getFont();a.iterate(function(g){var h=c.measureText(g);d=h>=d?h:d}.scope(this));this.width=(2*this.config.padding)+d;this.width=this.width<this.getMinimumWidth()?this.getMinimumWidth():this.width;var e=parseInt(this.getFont())+this.config.lineSpacing;var b=this.attributes.length>0?(this.attributes.length*e)+(2*this.config.compartmentSpacing):0;var f=this.operations.length>0?(this.operations.length*e)+(2*this.config.compartmentSpacing):0;this.height=b+f+2*e+(2*this.config.padding);this.prepared=true},markUnprepared:function(){this.prepared=false;this.fireEvent("changed")},add:function add(a){},addAttribute:function(a){if(!(a instanceof UmlCanvas.Attribute)){a=new UmlCanvas.Attribute(a)}this.attributes.push(a);this.markUnprepared();return a},addOperation:function(a){if(!(a instanceof UmlCanvas.Operation)){a=new UmlCanvas.Operation(a)}this.operations.push(a);this.markUnprepared();return a},draw:function(c,g,f){this.prepare(c);c.useCrispLines=this.config.useCrispLines;c.fillStyle=this.config.backgroundColor;c.strokeStyle=this.config.lineColor;c.lineWidth=this.config.lineWidth;var d=parseInt(this.getFont())+this.config.lineSpacing;var a=(this.config.padding+d*2+this.config.compartmentSpacing);c.fillStrokeRect(g,f,this.getWidth(),a);var e=0;if(this.attributes.length>0){e=(this.config.compartmentSpacing+(d*this.attributes.length)+this.config.compartmentSpacing);c.fillStrokeRect(g,f+a,this.getWidth(),e)}var h=0;if(this.operations.length>0){h=(this.config.compartmentSpacing+(d*this.operations.length)+this.config.padding);c.fillStrokeRect(g,f+a+e,this.getWidth(),h)}c.useCrispLines=this.getUseCrispLines();c.fillStyle=this.getFontColor();c.font=this.getFontForClassName();c.textAlign="center";if(this.getStereotype()){c.fillText("<<"+this.getStereotype()+">>",g+(this.getWidth()/2),f+(this.config.padding+parseInt(this.getFont())))}c.fillText(this.getName(),g+(this.getWidth()/2),f+(this.config.padding+parseInt(this.getFont())+(this.getStereotype()?d:0)));c.textAlign="left";c.font=this.getFont();for(var b=0;b<this.attributes.length;b++){c.strokeStyle=this.getFontColor();c.textDecoration=this.attributes[b].isStatic()?this.config.decorationStatic:this.config.decoration;c.fillText(this.attributes[b].toString(),g+this.config.padding,f+a+(d*(b+1)))}for(var b=0;b<this.operations.length;b++){c.font=this.getFontForOperationName(this.operations[b]);c.strokeStyle=this.getFontColor();c.textDecoration=this.operations[b].isStatic()?this.config.decorationStatic:this.config.decoration;c.fillText(this.operations[b].toString(),g+this.config.padding,f+a+e+(d*(b+1)))}},getFontForClassName:function(){return this.getIsAbstract()?this.config.fontAbstract:this.getFont()},getFontForOperationName:function(a){return a.isAbstract()?this.config.fontAbstract:this.getFont()},asConstruct:function asConstruct(){var a=this._super();delete a.modifiers.geo;delete a.modifiers[this.getFontColor()];if(this.getMinimumWidth()){a.modifiers.minimumSize=this.getMinimumWidth()}if(this.getSupers()){var b=[];this.getSupers().iterate(function(c){b.push(c.getName())});a.supers=b}if(this.getStereotype()){a.modifiers.stereotype='"'+this.getStereotype()+'"'}if(this.getIsAbstract()){a.modifiers["abstract"]=null}this.attributes.iterate(function(c){a.children.push(c.asConstruct())});this.operations.iterate(function(c){a.children.push(c.asConstruct())});return a}});UmlCanvas.Class.from=function(a,d){var e={};e.name=a.name;var g=a.modifiers.get("minimumWidth");if(g){e.minimumWidth=parseInt(g.value.value)}var b=a.modifiers.get("stereotype");if(b&&b.value){e.stereotype=b.value.value}e.isAbstract=UmlCanvas.Common.extractAbstract(a);var f=new UmlCanvas.Class(e);var h=[];var c=[];if(a.supers&&a.supers.length>0){a.supers.iterate(function(l){var m=d.getDiagramClass(l.constructName);if(m){f.addSuper(m);var k;if(m instanceof UmlCanvas.Interface){k=new UmlCanvas.Realization({from:m,to:f})}else{k=new UmlCanvas.Inheritance({from:m,to:f})}d.addRelation(k)}else{c.push("unknown superclass: "+l.constructName+", referenced by "+a.name)}})}if(h.length>0){return{errors:h,warnings:c}}else{f.warnings=c.length>0?c:null;return f}};UmlCanvas.Class.MANIFEST={name:"class",properties:["stereotype","isAbstract","supers","font","fontColor","minimumWidth"],propertyPath:[Canvas2D.CompositeShape,Canvas2D.Rectangle],libraries:["UmlCanvas","Class Diagram","Element"]};Canvas2D.registerShape(UmlCanvas.Class);UmlCanvas.Attribute=Class.extend({init:function(a){this.visibility=a.visibility;this.ztatic=a.isStatic;this.name=a.name;this.type=a.type;this.stereotype=a.stereotype;this.derived=a.derived},setParent:function setParent(){},getName:function(){return this.name},getType:function(){return this.type},getVisibility:function(){return this.visibility},getStereotype:function(){return this.stereotype},isStatic:function(){return this.ztatic},isDerived:function(){return this.derived},toString:function(){return(this.getStereotype()?"<<"+this.getStereotype()+">> ":"")+UmlCanvas.Common.determineVisibility(this.visibility)+(this.isDerived()?"/":"")+this.name+(this.type?" : "+this.type.toString():"")},asConstruct:function(){var a={};if(this.getVisibility()){a[this.getVisibility()]=null}if(this.isStatic()){a["static"]=null}if(this.getStereotype()){a.stereotype='"'+this.getStereotype()+'"'}if(this.isDerived()){a.derived=null}return{type:"Attribute",name:this.getName(),supers:this.getType()?[this.getType()]:[],modifiers:a,children:[]}}});UmlCanvas.Attribute.from=function(a,d){var f={name:a.name,type:a.supers[0]?a.supers[0].toString():null};var b=UmlCanvas.Common.extractVisibility(a);if(b){f.visibility=b}f.isStatic=UmlCanvas.Common.extractStatic(a);var c=a.modifiers.get("stereotype");if(c&&c.value){f.stereotype=c.value.value}var e=a.modifiers.get("derived");if(e&&e.value){f.derived=e.value.value}else{if(e){f.derived=true}}return d.addAttribute(f)};UmlCanvas.Attribute.MANIFEST={name:"attribute",aliasses:["property","literal"]};Canvas2D.registerShape(UmlCanvas.Attribute);UmlCanvas.Operation=Class.extend({init:function(a){this.visibility=a.visibility;this.ztatic=a.isStatic;this.name=a.name;this.returnType=a.returnType;this.stereotype=a.stereotype;this.parameters=[];if(a.arguments){for(var b=0;b<a.arguments.length;b++){this.addParameter(a.arguments[b])}}this.abztract=a.isAbstract},setParent:function setParent(){},getName:function(){return this.name},getReturnType:function(){return this.returnType},getVisibility:function(){return this.visibility},isStatic:function(){return this.ztatic},isAbstract:function(){return this.abztract},getStereotype:function(){return this.stereotype},addParameter:function(a){this.parameters.push(new UmlCanvas.Parameter(a))},toString:function(){var a=[];this.parameters.iterate(function(b){if(b.type){a.push(b.type.toString())}});return(this.getStereotype()?"<<"+this.getStereotype()+">> ":"")+UmlCanvas.Common.determineVisibility(this.visibility)+this.name+"("+a.join(", ")+")"+(this.returnType?" : "+this.returnType.toString():"")},asConstruct:function(){var b=[];this.parameters.iterate(function(c){b.push(c.asConstruct())});var a={};if(this.getVisibility()){a[this.getVisibility()]=null}if(this.isAbstract()){a["abstract"]=null}if(this.isStatic()){a["static"]=null}if(this.getStereotype()){a.stereotype='"'+this.getStereotype()+'"'}return{type:"Operation",name:this.getName(),supers:this.getReturnType()?[this.getReturnType()]:[],modifiers:a,children:b}}});UmlCanvas.Operation.from=function(a,d){var e={name:a.name};if(a.supers[0]){e.returnType=a.supers[0].toString()}var b=UmlCanvas.Common.extractVisibility(a);if(b){e.visibility=b}e.isStatic=UmlCanvas.Common.extractStatic(a);e.isAbstract=UmlCanvas.Common.extractAbstract(a);var c=a.modifiers.get("stereotype");if(c&&c.value){e.stereotype=c.value.value}return d.addOperation(e)};UmlCanvas.Operation.MANIFEST={name:"operation",aliasses:["method"]};Canvas2D.registerShape(UmlCanvas.Operation);UmlCanvas.Parameter=Class.extend({name:null,type:null,init:function(a){this.name=a.name;this.type=a.type},setparent:function setParent(){},getName:function(){return this.name},getType:function(){return this.type},toString:function(){return this.name+" : "+this.type},asConstruct:function(){return{type:"Argument",name:this.getName(),supers:this.getType()?[this.getType()]:[],modifiers:{},children:[]}}});UmlCanvas.Parameter.from=function(a,b){return b.addParameter(new UmlCanvas.Parameter({name:a.name,type:a.supers[0]||null}))};UmlCanvas.Parameter.MANIFEST={name:"parameter",aliasses:["argument"]};Canvas2D.registerShape(UmlCanvas.Parameter);UmlCanvas.ConnectorHeads={Triangle:{n:{lines:[[-5,-10],[+5,-10],[0,0]],end:[0,-10]},e:{lines:[[+10,+5],[+10,-5],[0,0]],end:[10,0]},s:{lines:[[+5,+10],[-5,+10],[0,0]],end:[0,10]},w:{lines:[[-10,-5],[-10,+5],[0,0]],end:[-10,0]}},Arrow:{n:{lines:[[-5,-10],[0,0],[+5,-10]],end:[0,0]},e:{lines:[[+10,+5],[0,0],[+10,-5]],end:[0,0]},s:{lines:[[+5,+10],[0,0],[-5,+10]],end:[0,0]},w:{lines:[[-10,-5],[0,0],[-10,+5]],end:[0,0]}},Diamond:{n:{lines:[[-5,-5],[0,-10],[+5,-5],[0,0]],end:[0,-10]},e:{lines:[[+5,+5],[+10,0],[+5,-5],[0,0]],end:[10,0]},s:{lines:[[+5,+5],[0,+10],[-5,+5],[0,0]],end:[0,10]},w:{lines:[[-5,-5],[-10,0],[-5,+5],[0,0]],end:[-10,0]}},FullDiamond:{n:{lines:[[-5,-5],[0,-10],[+5,-5],[0,0],"fill"],end:[0,-10]},e:{lines:[[+5,+5],[+10,0],[+5,-5],[0,0],"fill"],end:[10,0]},s:{lines:[[+5,+5],[0,+10],[-5,+5],[0,0],"fill"],end:[0,10]},w:{lines:[[-5,-5],[-10,0],[-5,+5],[0,0],"fill"],end:[-10,0]}}};UmlCanvas.Association=Canvas2D.Connector.extend({preprocess:function(a){a=this._super(a);this.srcName=a.sname;this.dstName=a.dname;if(a.kind&&a.kind=="aggregation"){a.begin=UmlCanvas.ConnectorHeads.Diamond}else{if(a.kind&&a.kind=="composition"){a.begin=UmlCanvas.ConnectorHeads.FullDiamond}else{if(a.navigability&&(a.navigability=="bi"||a.navigability=="source")){a.begin=UmlCanvas.ConnectorHeads.Arrow}}}if(a.navigability&&(a.navigability=="bi"||a.navigability=="destination")){a.end=UmlCanvas.ConnectorHeads.Arrow}a.routing=a.routing||"horizontal";if(a.sname){a.beginLabel=a.sname==a.from.name?"":UmlCanvas.Common.determineVisibility(a.srcVisibility)+a.sname}if(a.srcMultiplicity){a.beginLabel+=" ["+a.srcMultiplicity+"]"}if(a.dname){a.endLabel=a.dname==a.to.name?"":UmlCanvas.Common.determineVisibility(a.dstVisibility)+a.dname}if(a.dstMultiplicity){a.endLabel+=" ["+a.dstMultiplicity+"]"}if(a.name){a.centerLabel=(a.stereotype?"<<"+a.stereotype+">> ":"")+(a.derived?"/":"")+(a.name.substring(0,1)=="_"?"":a.name)}return a},_determineChildModifiers:function _determineChildModifiers(a){var b=[];var c=a?this.end:this.begin;if(c==UmlCanvas.ConnectorHeads.Diamond){b.shared=null}else{if(c==UmlCanvas.ConnectorHeads.FullDiamond){b.composite=null}else{if(c==UmlCanvas.ConnectorHeads.Arrow){b.navigable=null}}}var d=a?this.dstMultiplicity:this.srcMultiplicity;if(d){b.multiplicity='"'+d+'"'}var e=a?this.dstVisibility:this.srcVisibility;if(e){b.visibility='"'+e+'"'}return b},isDerived:function(){return this.derived},asConstruct:function(){var a=this._super();if(this.getRouting()=="recursive"&&this.getRouteBegin()!="ene"){a.annotation.data="recursive:"+this.getRouteBegin()+"-"+this.getRouteEnd()}if(this.getRouting()!="vertical"&&this.getRouting()!="custom"&&this.getRouting()!="recursive"){a.annotation.data=this.getRouting()}if(this.isDerived()){a.modifiers.derived=null}if(this.getStereotype()){a.modifiers.stereotype='"'+this.getStereotype()+'"'}a.children.push({modifiers:this._determineChildModifiers(),supers:[this.from.getName()],children:[],type:"role",name:this.srcName});a.children.push({modifiers:this._determineChildModifiers(true),supers:[this.to.getName()],children:[],type:"role",name:this.dstName});a.modifiers=[];return a}});UmlCanvas.Association.getNames=function(){return["association","relation"]};UmlCanvas.Association.from=function(o,e){var h={name:o.name};var g,f;var l=[];if(o.children&&o.children.length>1){child0=o.children[0];g=o.children[1]}else{l.push("association "+o.name+" needs two roles");return{errors:l}}h.kind="association";var m,n;if(g.modifiers.get("composition")||g.modifiers.get("composite")||g.modifiers.get("aggregation")||g.modifiers.get("shared")){m=g;n=child0}else{m=child0;n=g}if(m.modifiers.get("composition")||m.modifiers.get("composite")){h.kind="composition"}if(m.modifiers.get("aggregation")||m.modifiers.get("shared")){h.kind="aggregation"}if(m.modifiers.get("navigable")&&n.modifiers.get("navigable")){h.navigability="bi"}else{if(m.modifiers.get("navigable")){h.navigability="source"}else{if(n.modifiers.get("navigable")){h.navigability="destination"}}}h.routing="vertical";if(o.annotation){if(o.annotation.data.contains(":")&&o.annotation.data.contains("-")){var d=o.annotation.data.split(":");h.routing="custom";h.routeStyle=d[0];var k=d[1].split("-");h.routeBegin=k[0];h.routeEnd=k[1]}else{h.routing=o.annotation.data}}h.sname=m.name;h.dname=n.name;if(m.modifiers.get("multiplicity")&&m.modifiers.get("multiplicity").value){h.srcMultiplicity=m.modifiers.get("multiplicity").value.value}if(n.modifiers.get("multiplicity")&&n.modifiers.get("multiplicity").value){h.dstMultiplicity=n.modifiers.get("multiplicity").value.value}var b=UmlCanvas.Common.extractVisibility(m);if(b){h.srcVisibility=b}b=UmlCanvas.Common.extractVisibility(n);if(b){h.dstVisibility=b}h.from=e.getDiagramClass(m.supers[0].constructName);h.to=e.getDiagramClass(n.supers[0].constructName);if(!h.from){l.push("Unknown FROM property "+m.supers[0].constructName+"  on "+o.name)}if(!h.to){l.push("Unknown TO property "+n.supers[0].constructName+"  on "+o.name)}var c=o.modifiers.get("stereotype");if(c&&c.value){h.stereotype=c.value.value}var a=o.modifiers.get("derived");if(a&&a.value){h.derived=a.value.value}else{if(a){h.derived=true}}if(l.length>0){return{errors:l}}else{return new UmlCanvas.Association(h)}};UmlCanvas.Association.MANIFEST={name:"association",properties:["kind","navigability","derived","stereotype","srcMultiplicity","dstMultiplicity","srcVisibility","dstVisibility"],propertyPath:[Canvas2D.Connector],libraries:["UmlCanvas","Class Diagram","Relationship"]};Canvas2D.registerShape(UmlCanvas.Association);UmlCanvas.Role=Class.extend({setparent:function setParent(){}});UmlCanvas.Role.from=function(a,b){return null};UmlCanvas.Role.MANIFEST={name:"role"};Canvas2D.registerShape(UmlCanvas.Role);UmlCanvas.Dependency=Canvas2D.Connector.extend({preprocess:function(a){a.end=UmlCanvas.ConnectorHeads.Arrow;a.lineStyle="dashed";a.routing=a.routing||"horizontal";this.srcName=a.sname;this.dstName=a.dname;if(a.name){a.centerLabel=(a.stereotype?"<<"+a.stereotype+">> ":"")+(a.name.substring(0,1)=="_"?"":a.name)}return a},asConstruct:function(){var a=this._super();a.modifiers=[];if(this.getRouting()!="horizontal"&&this.getRouting()!="custom"){a.annotation.data=this.getRouting()}if(this.getStereotype()){a.modifiers.stereotype='"'+this.getStereotype()+'"'}a.children.push({supers:[this.from.getName()],children:[],type:"client",name:this.srcName});a.children.push({supers:[this.to.getName()],children:[],type:"supplier",name:this.dstName});return a}});UmlCanvas.Dependency.from=function(a,e){var f={name:a.name};var c,g;if(a.children&&a.children.length>0&&a.children[0].type=="client"){c=a.children[0];g=a.children[1]}else{c=a.children[1];g=a.children[0]}errors=[];if(!c){errors.push("missing dependency client")}if(!g){errors.push("missing dependency supplier")}if(errors.length>0){return{errors:errors}}f.routing="horizontal";if(a.annotation){if(a.annotation.data.contains(":")&&a.annotation.data.contains("-")){var h=a.annotation.data.split(":");f.routing="custom";f.routeStyle=h[0];var b=h[1].split("-");f.routeBegin=b[0];f.routeEnd=b[1]}else{f.routing=a.annotation.data}}f.sname=c.name;f.dname=g.name;f.from=e.getDiagramClass(c.supers[0].constructName);f.to=e.getDiagramClass(g.supers[0].constructName);if(!f.from){errors.push("Unknown FROM property "+c.supers[0].constructName+"  on "+a.name)}if(!f.to){errors.push("Unknown TO property "+g.supers[0].constructName+"  on "+a.name)}var d=a.modifiers.get("stereotype");if(d&&d.value){f.stereotype=d.value.value}if(errors.length>0){return{errors:errors}}else{return new UmlCanvas.Dependency(f)}};UmlCanvas.Dependency.MANIFEST={name:"dependency",properties:["client","supplier","stereotype"],propertyPath:[Canvas2D.Connector],libraries:["UmlCanvas","Class Diagram","Relationship"]};Canvas2D.registerShape(UmlCanvas.Dependency);UmlCanvas.Client=Class.extend({});UmlCanvas.Supplier=Class.extend({});UmlCanvas.Client.from=function(a,b){return null};UmlCanvas.Supplier.from=function(a,b){return null};UmlCanvas.Client.MANIFEST={name:"client"};UmlCanvas.Supplier.MANIFEST={name:"supplier"};Canvas2D.registerShape(UmlCanvas.Client);Canvas2D.registerShape(UmlCanvas.Supplier);UmlCanvas.Interface=UmlCanvas.Class.extend({preprocess:function(a){a=this._super(a);if(a.stereotype){a.stereotype="interface "+a.stereotype}else{a.stereotype="interface"}a.isAbstract=true;return a},getFontForClassName:function(){return this.getFont()},getFontForOperationName:function(a){return this.getFont()},asConstruct:function(){var a=this._super();delete a.modifiers["abstract"];delete a.modifiers.stereotype;return a}});UmlCanvas.Interface.from=function(a,c){var d={};d.name=a.name;var f=a.modifiers.get("minimumWidth");if(f){d.minimumWidth=parseInt(f.value.value)}var b=a.modifiers.get("stereotype");if(b){d.stereotype=b.value.value}var e=new UmlCanvas.Interface(d);if(a.supers&&a.supers.length>0){a.supers.iterate(function(g){var h=c.getDiagramClass(g.constructName);e.addSuper(h);c.addRelation(new UmlCanvas.Inheritance({from:h,to:e}))})}return e};UmlCanvas.Interface.MANIFEST={name:"interface",propertyPath:[Canvas2D.CompositeShape,Canvas2D.Rectangle,UmlCanvas.Class],libraries:["UmlCanvas","Class Diagram","Element"]};Canvas2D.registerShape(UmlCanvas.Interface);UmlCanvas.Inheritance=Canvas2D.Connector.extend({preprocess:function(a){a.begin=UmlCanvas.ConnectorHeads.Triangle;a.routing=a.routing||"vertical";return a},initialBranchLength:function(b,a){return 25},asConstruct:function asConstruct(){return null}});UmlCanvas.Inheritance.MANIFEST={name:"inheritance",propertyPath:[Canvas2D.Connector],libraries:["UmlCanvas","Class Diagram","Relationship"]};Canvas2D.registerShape(UmlCanvas.Inheritance);UmlCanvas.Realization=Canvas2D.Connector.extend({preprocess:function(a){a.begin=UmlCanvas.ConnectorHeads.Triangle;a.lineStyle="dashed";a.routing=a.routing||"vertical";return a},initialBranchLength:function(b,a){return 25},asConstruct:function asConstruct(){return null}});UmlCanvas.Realization.MANIFEST={name:"realization",propertyPath:[Canvas2D.Connector],libraries:["UmlCanvas","Class Diagram","Relationship"]};Canvas2D.registerShape(UmlCanvas.Realization);UmlCanvas.Enumeration=UmlCanvas.Class.extend({preprocess:function(a){a=this._super(a);if(a.stereotype){a.stereotype="enumeration "+a.stereotype}else{a.stereotype="enumeration"}a.isAbstract=true;return a},addOperation:function(a){return null},getFontForClassName:function(){return this.getFont()},asConstruct:function(){var a=this._super();delete a.modifiers.isAbstract;delete a.modifiers.stereotype;return a}});UmlCanvas.Enumeration.from=function(a,c){var d={};d.name=a.name;var f=a.modifiers.get("minimumWidth");if(f){d.minimumWidth=parseInt(f.value.value)}var b=a.modifiers.get("stereotype");if(b){d.stereotype=b.value.value}var e=new UmlCanvas.Enumeration(d);if(a.supers&&a.supers.length>0){a.supers.iterate(function(h){var k=c.getDiagramClass(h.constructName);if(k){e.addSuper(k);var g;if(k instanceof UmlCanvas.Interface){g=new UmlCanvas.Realization({from:k,to:e})}else{g=new UmlCanvas.Inheritance({from:k,to:e})}c.addRelation(g)}else{warnings.push("unknown superclass: "+h.constructName+", referenced by "+a.name)}})}return e};UmlCanvas.Enumeration.MANIFEST={name:"enumeration",propertyPath:[Canvas2D.CompositeShape,Canvas2D.Rectangle,UmlCanvas.Class],libraries:["UmlCanvas","Class Diagram","Element"]};Canvas2D.registerShape(UmlCanvas.Enumeration);UmlCanvas.Note=Canvas2D.Rectangle.extend({prepare:function(a){if(this.prepared){return}if(!this.width){this.width=this.getBoxWidth(a)}if(!this.height){this.height=this.getBoxHeight(a)}this.prepared=true},postInitialize:function(a){this.config=UmlCanvas.Note.Defaults},draw:function(a,c,b){this.prepare(a);this.renderTextBox(a,c,b);this.renderText(a,c,b)},renderTextBox:function renderTextBox(a,c,b){a.fillStyle=this.config.backgroundColor;a.strokeStyle=this.config.lineColor;a.lineWidth=this.config.lineWidth;a.useCrispLines=this.config.useCrispLines;a.fillStrokeRect(c,b,this.getWidth(),this.getHeight())},renderText:function renderText(d,f,e){d.useCrispLines=false;d.font=this.config.font;d.fillStyle=this.config.fontColor;d.textAlign="left";d.lineStyle="solid";var b=this.getLines();for(var c=1,a=b.length;c<=a;++c){e+=this.config.padding;d.fillText(b[c-1],f+this.config.padding,e+(parseInt(this.config.font)*c))}},getBoxWidth:function getBoxWidth(a){var b=this.getWidth()+(this.config.padding*2);this.getLines().iterate(function(c){var d=a.measureText(c)+(this.config.padding*2);if(d>b){b=d}}.scope(this));return b},getBoxHeight:function getBoxHeight(a){var c=this.getHeight()+(this.config.padding*2);var b=this.getLines().length*(parseInt(this.config.font)+this.config.padding)+this.config.padding;return(c>b)?c:b},getLines:function getLines(){return this.getText().split("\\n")},asConstruct:function(){var a=this._super();delete a.modifiers.geo;a.modifiers.width='"'+this.getWidth()+'"';a.modifiers.height='"'+this.getHeight()+'"';if(this.getText()){a.modifiers.text='"'+this.getText()+'"'}if(this.getLinkedTo()){a.modifiers.linkedTo='"'+this.getLinkedTo()+'"'}return a}});UmlCanvas.Note.from=function(c,d){var f={};f.name=c.name;var h=c.modifiers.get("text");if(h&&h.value){f.text=h.value.value}var e=c.modifiers.get("width");if(e&&e.value){f.width=parseInt(e.value.value)}var b=c.modifiers.get("height");if(b&&b.value){f.height=parseInt(b.value.value)}var a=c.modifiers.get("linkedTo");if(a&&a.value){f.linkedTo=a.value.value}var g=new UmlCanvas.Note(f);if(a&&a.value){a.value.value.split(",").iterate(function(k){var l=d.getDiagramClass(k);d.addRelation(new UmlCanvas.NoteLink({note:g,element:l}))})}return g};UmlCanvas.Note.MANIFEST={name:"note",properties:["text","width","height","linkedTo"],propertyPath:[Canvas2D.CompositeShape,Canvas2D.Rectangle],libraries:["UmlCanvas","Class Diagram","Element"]};Canvas2D.registerShape(UmlCanvas.Note);UmlCanvas.NoteLink=Canvas2D.Connector.extend({preprocess:function(a){a.routing=a.routing||"horizontal";a.lineStyle=a.lineStyle||"dashed";a.from=a.note;a.to=a.element;return a},asConstruct:function asConstruct(){return null}});UmlCanvas.NoteLink.MANIFEST={name:"notelink",propertyPath:[Canvas2D.Connector],libraries:["UmlCanvas","Class Diagram","Relationship"]};Canvas2D.registerShape(UmlCanvas.NoteLink);UmlCanvas.State=Canvas2D.Rectangle.extend({preprocess:function preprocess(a){a.label=a.name;return a},getHeight:function(){return this.getProperty("height")},getWidth:function(){return this.getProperty("width")}});UmlCanvas.State.from=function(b,c){var e={};e.name=b.name;var d=b.modifiers.get("width");if(d&&d.value){e.width=d.value.value}var a=b.modifiers.get("height");if(a&&a.value){e.height=a.value.value}var f=b.modifiers.get("geo");if(f&&f.value){e.width=parseInt(f.value.value.split("x")[0]);e.height=parseInt(f.value.value.split("x")[1])}return new UmlCanvas.State(e)};UmlCanvas.State.MANIFEST={name:"state",propertyPath:[Canvas2D.CompositeShape,Canvas2D.Rectangle],libraries:["UmlCanvas","State Diagram","Element"]};Canvas2D.registerShape(UmlCanvas.State);UmlCanvas.Transition=Canvas2D.Connector.extend({preprocess:function(a){a.end=UmlCanvas.ConnectorHeads.Arrow;a.routing=a.routing||"horizontal";return a}});UmlCanvas.Transition.from=function(a,c){var d=[];d.routing="horizontal";if(a.annotation){if(a.annotation.data.contains(":")&&a.annotation.data.contains("-")){var e=a.annotation.data.split(":");d.routing="custom";d.routeStyle=e[0];var b=e[1].split("-");d.routeBegin=b[0];d.routeEnd=b[1]}else{d.routing=a.annotation.data}}d.from=c.getDiagramClass(a.name.split("-")[0]);d.to=c.getDiagramClass(a.name.split("-")[1]);var f=[];if(!d.from){f.push("Unknown FROM property "+client.supers[0].constructName+"  on "+a.name)}if(!d.to){f.push("Unknown TO property "+supplier.supers[0].constructName+"  on "+a.name)}if(f.length>0){return{errors:f}}else{return new UmlCanvas.Transition(d)}};UmlCanvas.Transition.MANIFEST={name:"transition",propertyPath:[Canvas2D.Connector],libraries:["UmlCanvas","Class Diagram","Relationship"]};Canvas2D.registerShape(UmlCanvas.Transition);UmlCanvas.Widget=Class.extend({init:function initialize(a){this.model=a;this.setupConsole();this.setupSource();this.setupGeneratedSource();this.setupErrors();this.setupAbout();this.setupEditor()},getName:function getName(){return this.model.getName()},getElement:function getElement(a){return document.getElementById("UC_"+a+"_for_"+this.getName())},setupConsole:function setupConsole(){this.console=this.getElement("console");if(this.console){this.model.console=this.console;this.model.log("Widget: attached console : "+this.console.id)}},setupSource:function setupSource(){this.source=document.getElementById(this.getName()+"Source")||this.getElement("source");if(this.source){this.model.log("Widget: attached source : "+this.source.id)}},setupGeneratedSource:function setupGeneratedSource(){this.generated=document.getElementById(this.id+"Generated")||this.getElement("generated");if(this.generated){this.model.log("Widget: attached generated : "+this.generated.id)}},setupEditor:function setupEditor(){this.editor=this.getElement("editor");if(this.editor){this.editor.onkeydown=this.handleInput.scope(this);this.model.on("sourceUpdated",function(a){if(!this.updatingCanvas&&!this.updatedCanvas){this.setSource(a)}this.updatedCanvas=false}.scope(this));this.updatingCanvas=false;this.autoSave();this.model.log("Widget: attached editor : "+this.editor.id)}this.load()},setupErrors:function setupErrors(){this.errors=this.getElement("errors");if(this.errors){this.model.log("Widget: attached errors : "+this.errors.id)}},showErrors:function showErrors(a){if(!this.errors){return}this.errors.value=a},setupAbout:function setupAbout(){this.about=this.getElement("about");if(this.about){var a="";Canvas2D.extensions.iterate(function(b){a+="\n<hr>\n";a+="<b>Library: "+b.name+" "+b.version+"</b> by "+b.author+"<br>"+b.info});this.about.innerHTML="<b>Canvas2D "+Canvas2D.version+'</b><br>Copyright &copy 2009, <a href="http://christophe.vg" target="_blank">Christophe VG</a> & <a href="http://thesoftwarefactory.be" target="_blank">The Software Factory</a><br>Visit <a href="http://thesoftwarefactory.be/wiki/Canvas2D" target="_blank">http://thesoftwarefactory.be/wiki/Canvas2D</a> for more info. Licensed under the <a href="http://thesoftwarefactory.be/wiki/BSD_License" target="_blank">BSD License</a>.'+a}},updateCanvas:function updateCanvas(){var a=this.getEditorSource();if(a&&this.isInputDirty()){if(a.replace(/^\s+|\s+$/g,"")!=""){this.updatingCanvas=true;this.load(a);this.showErrors(this.model.errors);if(this.model.errors==""){this.updatedCanvas=true;this.updatingCanvas=false}}this.handleInput()}},autoSave:function autoSave(){this.updateCanvas();setTimeout(this.autoSave.scope(this),100)},handleInput:function handleInput(){this.oldValue=this.editor.value},isInputDirty:function isInputDirty(){return this.oldValue!=this.editor.value},setSource:function setSource(a){this.editor.value=a;this.handleInput()},load:function load(a){a=a||this.getSource();if(a!=""){this.model.load(a)}},getSource:function getSource(){return this.getEditorSource()||this.getLocalSource()||""},getEditorSource:function getEditorSource(){return this.editor?this.editor.value:null},getLocalSource:function getLocalSource(){return this.source?(this.source.value||this.source.innerHTML):null}});UmlCanvas.Widget.setup=function UmlCanvas_Widget_setup(a){a.Widget=new UmlCanvas.Widget(a)};UmlCanvas.KickStart={plugins:{}};UmlCanvas.KickStart.Starter=Canvas2D.KickStart.Starter.extend({init:function init(){this.manager=new UmlCanvas.Manager();this.pluginManagerRepository=new UmlCanvas.KickStart.PluginManagerRepository();this.setupPluginsFactories()},setupPluginsFactories:function setupPluginsFactories(){$H(UmlCanvas.KickStart.plugins).iterate(function(a,b){if(b.Manager){this.pluginManagerRepository.setManager(a,new b.Manager())}}.scope(this))},getTag:function getTag(){return"UmlCanvas"},makeInstance:function makeInstance(b){var a=this.manager.setupModel(b);UmlCanvas.Widget.setup(a);this.pluginManagerRepository.getManagers().iterate(function(c){if(c.needsPlugin(a)){a.addPlugin(c.setup(a))}}.scope(this));a.activatePlugins();return a}});ProtoJS.Event.observe(window,"load",function(){with(UmlCanvas.KickStarter=new UmlCanvas.KickStart.Starter()){on("ready",function(){UmlCanvas.fireEvent("ready")});start()}});UmlCanvas.KickStart.PluginManagerRepository=Class.extend({init:function(){this.managers={}},setManager:function setManager(b,a){this.managers[b]=a},getManager:function getManager(a){return this.managers[a]},getManagers:function getManagers(){return $H(this.managers).values()}});UmlCanvas.Plugin=Class.extend({getName:function getName(){throw ("Plugin must implement getName().")},activate:function activate(){throw ("Plugin must implement activate().")}});UmlCanvas.PluginManager=Class.extend({getPluginClass:function getPluginClass(){throw ("PluginManager must implement getPluginClass().")},setup:function setup(a){throw ("PluginManager must implement setup().")},needsPlugin:function needsPlugin(){return false},setup:function setup(a){return new (this.getPluginClass())(a)}});UmlCanvas.KickStart.plugins.Inspector=UmlCanvas.Plugin.extend({init:function init(a){this.model=a;this.initSheets()},getName:function getName(){return"inspector"},initSheets:function initSheets(){this.sheets={};this.sheetPositions=[];this.source=document.createElement("textarea");this.addSheet(0,"source",this.source);this.console=document.createElement("textarea");this.addSheet(1,"console",this.console);this.addSheet(2,"about")},activate:function activate(){this.insertInspector();this.wireActivation()},getElement:function getElement(a){return document.getElementById("UC_inspector_"+a+"_for_"+this.model.getName())},getSheet:function getSheet(a){return this.sheets[a]},addSheet:function addSheet(b,a,d){var c=new UmlCanvas.KickStart.plugins.Inspector.Sheet(a,d);this.sheetPositions.splice(b,0,c);this.sheets[c.getLabel()]=c},removeSheet:function removeSheet(a){this.sheetPositions.splice(this.sheetPositions.indexOf(this.getSheet(a)),1);delete this.sheets[a]},getDefaultTab:function getDefaultTab(){return this.defaultTab||"source"},setDefaultTab:function setDefaultTab(a){this.defaultTab=a||"source"},insertInspector:function insertInspector(){this.insertInspectorHTML();this.wireResizeAndDragHandling();this.setupSheets();this.gotoTab(this.getDefaultTab());this.resizeTo(0,0);this.moveTo(this.model.getLeft(),this.model.getTop());this.shownBefore=false;UmlCanvas.Widget.setup(this.model)},insertInspectorHTML:function insertInspectorHTML(){this.inspector=document.createElement("DIV");this.inspector.id="UC_inspector_for_"+this.model.getName();this.inspector.className="UC_inspector";this.inspector.innerHTML='<table class="UC_inspector_header" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="UC_inspector_close" onclick="this.parentNode.parentNode.parentNode.parentNode.style.display=\'none\';"></td><td><h1 id="UC_inspector_header_for_'+this.model.getName()+'">UmlCanvas Inspector</h1></td><td class="UC_inspector_corner"></td></tr></table><div id="UC_inspector_tabs_for_'+this.model.getName()+'" class="UC_inspector_tabs"></div><div id="UC_inspector_content_for_'+this.model.getName()+'"class="UC_inspector_content"></div><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="UC_inspector_status">'+UmlCanvas.version+'</td><td id="UC_inspector_resize_for_'+this.model.getName()+'"class="UC_inspector_resize"></td></tr></table>';document.body.appendChild(this.inspector)},setupSheets:function setupSheets(){this.tabs=this.getElement("tabs");this.content=this.getElement("content");this.sheetPositions.iterate(function(a){var b=document.createElement("A");b.id="UC_inspector_tab_"+a.getLabel()+"_for_"+this.model.getName();b.href="javascript:";b.className="UC_inspector_tab";b.onclick=function(c){return function(){this.gotoTab(c)}.scope(this)}.scope(this)(a.getLabel());b.appendChild(document.createTextNode(a.getLabel()));this.tabs.appendChild(b);this.content.appendChild(a.getElement(this.model.getName()))}.scope(this))},gotoTab:function gotoTab(a){if(this.currentTab){this.currentTab.className="UC_inspector_tab"}if(this.currentSheet){this.currentSheet.className="UC_inspector_tab_content"}this.currentTab=this.getElement("tab_"+a);this.currentSheet=document.getElementById("UC_"+a+"_for_"+this.model.getName());if(this.currentTab){this.currentTab.className="UC_inspector_tab_selected"}if(this.currentSheet){this.currentSheet.className="UC_inspector_tab_content_selected"}},wireResizeAndDragHandling:function wireResizeAndDragHandling(){ProtoJS.Event.observe(this.getElement("resize"),"mousedown",function(a){this.resizing=true;this.handleMouseDown(a)}.scope(this));ProtoJS.Event.observe(this.getElement("header"),"mousedown",function(a){this.handleMouseDown(a);this.dragging=true}.scope(this));ProtoJS.Event.observe(document,"mouseup",this.handleMouseUp.scope(this));ProtoJS.Event.observe(document,"mousemove",this.handleMouseMove.scope(this))},handleMouseDown:function handleMouseDown(a){if(a.preventDefault){a.preventDefault()}a.returnValue=false;this.currentPos=this.getXY(a)},handleMouseMove:function handleMouseMove(a){if(this.resizing||this.dragging){var b=this.getXY(a);if(this.resizing){this.resizeBy(b.x-this.currentPos.x,b.y-this.currentPos.y)}else{if(this.dragging){this.moveBy(b.x-this.currentPos.x,b.y-this.currentPos.y)}}this.currentPos=b}},handleMouseUp:function handleMouseMove(a){this.resizing=false;this.dragging=false},getXY:function getXY(b){var a,c;if(ProtoJS.Browser.IE){a=event.clientX+document.body.scrollLeft;c=event.clientY+document.body.scrollTop}else{a=b.pageX;c=b.pageY}return{x:a,y:c}},resizeBy:function resizeBy(b,a){this.resizeTo(parseInt(this.inspector.style.width)+b,parseInt(this.inspector.style.height)+a)},resizeTo:function resizeTo(a,c){this.inspector.style.width=(a>=300?a:300)+"px";this.inspector.style.height=(c>=150?c:150)+"px";var b=ProtoJS.Browser.IE?0:10;this.content.style.width=(parseInt(this.inspector.style.width)-b)+"px";this.content.style.height=(parseInt(this.inspector.style.height)-73)+"px";if(ProtoJS.Browser.IE){this.console.style.height=this.content.style.height}this.fireEvent("changeContentSize",{w:parseInt(this.content.style.width),h:parseInt(this.content.style.height)})},moveBy:function moveBy(b,a){this.moveTo(parseInt(this.inspector.style.left)+b,parseInt(this.inspector.style.top)+a)},moveTo:function resizeTo(a,b){this.inspector.style.left=(a>=0?a:0)+"px";this.inspector.style.top=(b>=0?b:0)+"px"},getWidth:function getWidth(){return parseInt(this.inspector.style.width)},getHeight:function getHeight(){return parseInt(this.inspector.style.height)},show:function show(){if(!this.shownBefore){this.resizeTo(this.model.getWidth(),this.model.getHeight());this.shownBefore=true}this.inspector.style.display="block"},hide:function hide(){this.inspector.style.display="none"},wireActivation:function wireActivation(){if(UmlCanvas.Config.Inspector.wireActivation){Canvas2D.Keyboard.on("keyup",function(a){if(this.model.canvas.mouseOver&&a=="73"){this.show()}}.scope(this))}}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,UmlCanvas.KickStart.plugins.Inspector.prototype);UmlCanvas.KickStart.plugins.Inspector.Manager=UmlCanvas.PluginManager.extend({needsPlugin:function needsPlugin(a){return !a.canvas.canvas.className.contains("withoutInspector")},getPluginClass:function getPluginClass(){return UmlCanvas.KickStart.plugins.Inspector}});UmlCanvas.KickStart.plugins.Inspector.Sheet=Class.extend({init:function init(a,b){this.label=a;if(b){this.element=b}else{this.element=document.createElement("div")}},getLabel:function getLabel(){return this.label},setLabel:function setLabel(a){this.label=a},getElement:function getElement(a){this.element.id="UC_"+this.getLabel()+"_for_"+a;this.element.className="UC_inspector_tab_content";this.element.style.resize="none";return this.element}});UmlCanvas.KickStart.plugins.HuC=UmlCanvas.Plugin.extend({init:function init(a){this.model=a;this.initSheets();this.setupSource()},getName:function getName(){return"huc"},activate:function activate(){},initSheets:function initSheets(){if(inspector=this.getInspector()){with(inspector){addSheet(0,"edit",this.createEditorSheet());addSheet(1,"properties",this.createPropertiesSheet());removeSheet("source");on("changeContentSize",this.handleInspectorResize.scope(this))}inspector.setDefaultTab("edit")}},handleInspectorResize:function handleInspectorResize(a){if(a.h>24+75){this.editor.style.height=(a.h-24-75)+"px"}},getElement:function getElement(a){return this.model.Widget.getElement(a)},getEditor:function getEditor(){return this.editor},createEditorSheet:function createEditorSheet(){var a=document.createElement("div");a.style.overflow="hidden";a.appendChild(this.createEditorToolbar());a.appendChild(this.createEditorTextPane());a.appendChild(this.createErrorTextPane());return a},createPropertiesSheet:function createPropertiesSheet(){var a=document.createElement("div");this.propertiesForm=document.createElement("form");this.propertiesForm.id="UC_propertiesForm_for_"+this.model.getName();var b=document.createElement("table");b.className="UC_inspector_properties";this.setupProperties();this.propertyFields={};this.props.iterate(function(l){var c=document.createElement("tbody");var g=document.createElement("tr");var e=document.createElement("th");var k=document.createElement("td");var f=document.createElement("span");var d=document.createElement("td");var h;if("string"==l.type&&100<l.maxlength){h=document.createElement("textarea")}else{if("string"==l.type||"integer"==l.type){h=document.createElement("input");h.name="text"}else{if("author"==l.id){h=document.createElement("a");h.href="http://hosted.umlcanvas.org";h.target="_blank"}}}e.innerHTML=l.label;h.id="UC_"+l.id+"_for_"+this.model.getName();ProtoJS.Event.observe(h,"blur",function(){this.validateField(h,l);this.updateDiagram()}.scope(this));f.className="invalid";f.id="UC_"+l.id+"_error_for_"+this.model.getName();k.appendChild(h);g.appendChild(e);g.appendChild(k);d.appendChild(f);g.appendChild(d);c.appendChild(g);b.appendChild(c);this.propertyFields[l.id]=h}.scope(this));this.propertiesForm.appendChild(b);a.appendChild(this.createEditorToolbar());a.appendChild(this.propertiesForm);return a},setupProperties:function setupProperties(){this.props=[{id:"name",label:"Name",type:"string",minlength:1,maxlength:25},{id:"descr",label:"Description",type:"string",minlength:1,maxlength:1000},{id:"width",label:"Width",type:"integer",minlength:2,maxlength:3},{id:"height",label:"Height",type:"integer",minlength:2,maxlength:3},{id:"notes",label:"Notes",type:"string",minlength:0,maxlength:1000},{id:"author",label:"Author",type:"link",minlength:0,maxlength:1000}]},validateFields:function validateFields(){var a=true;this.props.iterate(function(b){a=this.validateField(this.getElement(b.id),b)&&a}.scope(this));return a},validateField:function validateField(c,d){var b=true;var a=this.getElement(d.id+"_error");if(d.type!="link"){c.style.backgroundColor="#FFF";a.innerHTML="";if("integer"==d.type){if(isNaN(parseInt(c.value,10))){c.value=0}else{c.value=parseInt(c.value,10)}}if(c.value.length>d.maxlength){c.value=c.value.substring(0,d.maxlength)}if(c.value.length<d.minlength){c.style.backgroundColor="#faa";a.innerHTML="minimal length: "+d.minlength;b=false}}return b},createEditorToolbar:function createEditorToolbar(){var a=new UmlCanvas.KickStart.plugins.HuC.Toolbar();a.addAction(UmlCanvas.Config.Inspector.Icons.save,"Save",function(){return function(){if(this.validateFields()){this.saveDiagram({id:this.model.getName(),src:this.getEditor().value,name:this.getElement("name").value,descr:this.getElement("descr").value,width:this.getElement("width").value,height:this.getElement("height").value,notes:this.getElement("notes").value})}else{this.getInspector().gotoTab("properties")}}.scope(this)}.scope(this)());a.addAction(UmlCanvas.Config.Inspector.Icons.reload,"Reload",function(){return function(){if(confirm("Do you want to reload this diagram? \n\nIf you reload this diagram, all changes made after your last save action will be lost.")){this.loadDiagram()}}.scope(this)}.scope(this)());return a.getToolbar()},createEditorTextPane:function createEditorTextPane(){this.editor=document.createElement("textarea");this.editor.id="UC_editor_for_"+this.model.getName();this.editor.style.resize="none";this.editor.style.border="0px solid white";return this.editor},createErrorTextPane:function createErrorTextPane(){var a=document.createElement("textarea");a.id="UC_errors_for_"+this.model.getName();a.style.resize="none";a.style.height="75px";return a},getInspector:function getInspector(){return this.model.getPlugin("inspector")},setupSource:function setupSource(){if(this.model.Widget.getSource()==""){this.loadDiagram()}},getCanvasElement:function getCanvasElement(){return this.model},decodeHTMLSpecialCharacters:function decodeHTMLSpecialCharacters(a){return a.replace(/&quot;/g,'"')},loadDiagram:function loadDiagram(){if(this.model.getName()==""){return this.loadProperties()}this.load(this.model.getName())},load:function load(b){var a=UmlCanvas.Config.HuC.repository_url+b+":json";new ProtoJS.Ajax().fetch(a,function(c){this.model.load(this.decodeHTMLSpecialCharacters(c.src));this.loadProperties(c);this.updateDiagram()}.scope(this))},loadProperties:function loadProperties(a){if(!this.propertiesForm){return}a=a||{width:this.getCanvasElement().getWidth(),height:this.getCanvasElement().getHeight()};this.propertiesForm.reset();$H(a).iterate(function(b){if(this.propertyFields[b]!=null){if("author"==b){this.propertyFields[b].innerHTML=a[b];this.propertyFields[b].href=UmlCanvas.Config.HuC.repository_url+"~"+a[b]}this.propertyFields[b].value=a[b]}}.scope(this))},updateDiagram:function updateDiagram(){if(!this.propertyFields){return}this.getCanvasElement().setSize(this.propertyFields.width.value,this.propertyFields.height.value)},saveDiagram:function saveDiagram(d){var c=document.getElementById("submitForm");if(!c){c=document.createElement("form");c.id="submitForm";c.method="post";c.action=UmlCanvas.Config.HuC.repository_submit_url;c.target="formresult";this.submitFields={};for(var b in d){var a=document.createElement("input");this.submitFields[b]=a;a.type="hidden";a.name=b;c.appendChild(a)}document.body.appendChild(c)}for(var b in d){this.submitFields[b].value=d[b]}window.open("","formresult");c.submit()}});UmlCanvas.KickStart.plugins.HuC.Toolbar=Class.extend({init:function init(){this.toolbar=document.createElement("div");this.toolbar.className="UC_toolbar"},getToolbar:function getToolbar(){return this.toolbar},addAction:function addAction(d,b,c){var a=document.createElement("img");a.src=d;a.alt=b;a.onclick=c;this.toolbar.appendChild(a)}});UmlCanvas.KickStart.plugins.HuC.Manager=UmlCanvas.PluginManager.extend({needsPlugin:function needsPlugin(a){return a.getPlugin("inspector")!=null},getPluginClass:function getPluginClass(){return UmlCanvas.KickStart.plugins.HuC}});UmlCanvas.Defaults={};UmlCanvas.Class.Defaults={name:"newClass",stereotype:"",supers:[],useCrispLines:true,font:"7pt Verdana",fontColor:"black",fontAbstract:"italic 7pt Verdana",abstractColor:"black",decoration:"none",decorationStatic:"underline",lineWidth:1,lineColor:"rgba(255,0,0,1)",backgroundColor:"rgba(255,255,200,1)",padding:5,lineSpacing:5,compartmentSpacing:3};UmlCanvas.Interface.Defaults={name:"newInterface"};UmlCanvas.Enumeration.Defaults={name:"newEnumeration"};UmlCanvas.Association.Defaults={name:"newAssociation"};UmlCanvas.Dependency.Defaults={name:"newDependency"};UmlCanvas.Inheritance.Defaults={name:"newInheritance"};UmlCanvas.Realization.Defaults={name:"newRealization"};UmlCanvas.Note.Defaults={name:"NewName",text:"New Note",width:100,height:40,padding:5,font:"7pt Verdana",fontColor:"black",lineColor:"grey",backgroundColor:"rgba(240,240,240,1)",lineWidth:1,useCrispLines:true};UmlCanvas.NoteLink.Defaults={};UmlCanvas.State.Defaults={name:"newState",roundCorners:true,lineColor:"rgb(250,125,0)",fillColor:"rgb(255,240,175)",labelColor:"rgb(250,125,0)",labelPos:"top-inner",width:100,height:50};UmlCanvas.Transition.Defaults={name:"NewTransition",lineColor:"rgb(250,125,0)"};UmlCanvas.Config={};UmlCanvas.Config.Inspector={wireActivation:true};UmlCanvas.Config.Inspector.Icons={save:"http://static.thesoftwarefactory.be/images/icons/disk-black.png",reload:"http://static.thesoftwarefactory.be/images/icons/arrow-circle-315.png",left:"http://static.thesoftwarefactory.be/images/inspector/left.png",right:"http://static.thesoftwarefactory.be/images/inspector/right.png"};UmlCanvas.Config.HuC={repository_url:"http://hosted.umlcanvas.org/",repository_submit_url:"http://hosted.umlcanvas.org/submit/index.php"};var headID=document.getElementsByTagName("head")[0];var cssNode=document.createElement("link");cssNode.type="text/css";cssNode.rel="stylesheet";cssNode.href="http://static.thesoftwarefactory.be/css/inspector.css";cssNode.media="screen";headID.appendChild(cssNode);