(function(){var a=function(){var ac=function(){var ah={};this.bind=function(ak,al){var ai=function(an,am){B(ah,an,am)};if(ak.constructor==Array){for(var aj=0;aj=0){delete (ah[ai]);ah.splice(ai,1);return true}}}return false};var c=function(ai,ah){return s(ai,function(aj,ak){S[ak]=ah;if(b.CurrentLibrary.isDragSupported(aj)){b.CurrentLibrary.setDraggable(aj,ah)}})};var aa=function(ah,ai){D(q(ah,"id"),function(aj){aj.canvas.style.display=ai})};var w=function(ah){return s(ah,function(aj,ai){var ak=S[ai]==null?I:S[ai];ak=!ak;S[ai]=ak;b.CurrentLibrary.setDraggable(aj,ak);return ak})};var e=function(ah){D(ah,function(aj){var ai=("none"==aj.canvas.style.display);aj.canvas.style.display=ai?"block":"none"})};var m=function(am){var ak=am.timestamp,ah=am.recalc,al=am.offset,ai=am.elId;if(!ah){if(ak&&ak===k[ai]){return}}if(ah||al==null){var aj=U(ai);y[ai]=h(aj);F[ai]=d(aj);k[ai]=ak}else{F[ai]=al}};var Z=function(aj,ah,ai){aj=aj||function(){};ah=ah||function(){};return function(){var ak=null;try{ak=ah.apply(this,arguments)}catch(al){n("jsPlumb function failed : "+al)}if(ai==null||(ak!==ai)){try{aj.apply(this,arguments)}catch(al){n("wrapped function failed : "+al)}}return ak}};var M=function(al){var aj=this;this.x=al.x||0;this.y=al.y||0;var ai=al.orientation||[0,0];var ak=null,ah=null;this.offsets=al.offsets||[0,0];aj.timestamp=null;this.compute=function(ar){var ax=ar.xy,an=ar.wh,at=ar.element,au=ar.timestamp;if(au&&au===aj.timestamp){return ah}ah=[ax[0]+(aj.x*an[0])+aj.offsets[0],ax[1]+(aj.y*an[1])+aj.offsets[1]];var ao=at?at.container:null;var av={left:0,top:0};if(ao!=null){var am=U(ao);var ap=d(am);var aq=b.CurrentLibrary.getScrollLeft(am);var aw=b.CurrentLibrary.getScrollTop(am);av.left=ap.left-aq;av.top=ap.top-aw;ah[0]=ah[0]-av.left;ah[1]=ah[1]-av.top}aj.timestamp=au;return ah};this.getOrientation=function(){return ai};this.equals=function(am){if(!am){return false}var an=am.getOrientation();var ap=this.getOrientation();return this.x==am.x&&this.y==am.y&&this.offsets[0]==am.offsets[0]&&this.offsets[1]==am.offsets[1]&&ap[0]==an[0]&&ap[1]==an[1]};this.getCurrentLocation=function(){return ah}};var r=function(an){var al=an.reference;var am=an.referenceCanvas;var aj=h(U(am));var ai=0,ao=0;var ah=null;var ak=null;this.compute=function(au){var ar=au.xy,aq=au.element;var ap=[ar[0]+(aj[0]/2),ar[1]+(aj[1]/2)];if(aq.container!=null){var at=d(aq.container);ap[0]=ap[0]-at.left;ap[1]=ap[1]-at.top}ak=ap;return ap};this.getOrientation=function(){if(ah){return ah}else{var ap=al.getOrientation();return[Math.abs(ap[0])*ai*-1,Math.abs(ap[1])*ao*-1]}};this.over=function(ap){ah=ap.getOrientation()};this.out=function(){ah=null};this.getCurrentLocation=function(){return ak}};var K=function(aj,ai){this.isSelective=true;this.isDynamic=true;var aq=aj||[];var ao=function(ar){return ar.constructor==M?ar:b.makeAnchor(ar)};for(var an=0;an0?aq[0]:null;var am=aq.length>0?0:-1;this.locked=false;var ap=this;var al=function(au,ar,aA,az,at){var aw=az[0]+(au.x*at[0]),av=az[1]+(au.y*at[1]);return Math.sqrt(Math.pow(ar-aw,2)+Math.pow(aA-av,2))};var ah=ai||function(aC,at,au,av,ar){var ax=au[0]+(av[0]/2),aw=au[1]+(av[1]/2);var az=-1,aB=Infinity;for(var ay=0;ayax){ax=aF}}var aK=this.connector.compute(az,aM,this.endpoints[aQ].anchor,this.endpoints[aw].anchor,this.paintStyle.lineWidth,ax);b.sizeCanvas(aj,aK[0],aK[1],aK[2],aK[3]);var aD=function(aR,aU){aR.save();b.extend(aR,aU);if(aU.gradient&&!R){var aT=at.connector.createGradient(aK,aR,(aE==this.sourceId));for(var aS=0;aS=0){au.connections.splice(aH,1);if(!aK){var aJ=aI.endpoints[0]==au?aI.endpoints[1]:aI.endpoints[0];aJ.detach(aI,true)}O(aI.canvas,aI.container);v(u,aI.scope,aI);if(!aK){N(aI)}}};this.detachAll=function(){while(au.connections.length>0){au.detach(au.connections[0])}};this.detachFrom=function(aI){var aJ=[];for(var aH=0;aH=0){au.connections.splice(aH,1)}};this.getElement=function(){return at};this.getUuid=function(){return ap};this.makeInPlaceCopy=function(){var aH=new ab({anchor:au.anchor,source:at,style:an,endpoint:ar});return aH};this.isConnectedTo=function(aJ){var aI=false;if(aJ){for(var aH=0;aH=aA)};this.setDragAllowedWhenFull=function(aH){au.dragAllowedWhenFull=aH};this.equals=function(aH){return this.anchor.equals(aH.anchor)};this.paint=function(aK){aK=aK||{};var aO=aK.timestamp;if(!aO||au.timestamp!==aO){var aN=aK.anchorPoint,aJ=aK.canvas,aL=aK.connectorPaintStyle;if(aN==null){var aT=aK.offset||F[am];var aH=aK.dimensions||y[am];if(aT==null||aH==null){m({elId:am,timestamp:aO});aT=F[am];aH=y[am]}var aI={xy:[aT.left,aT.top],wh:aH,element:au,timestamp:aO};if(au.anchor.isDynamic){if(au.connections.length>0){var aQ=au.connections[0];var aS=aQ.endpoints[0]==au?1:0;var aM=aS==0?aQ.sourceId:aQ.targetId;var aP=F[aM],aR=y[aM];aI.txy=[aP.left,aP.top];aI.twh=aR;aI.tElement=aQ.endpoints[aS]}}aN=au.anchor.compute(aI)}ar.paint(aN,au.anchor.getOrientation(),aJ||au.canvas,an,aL||an);au.timestamp=aO}};this.removeConnection=this.detach;if(aG.isSource&&b.CurrentLibrary.isDragSupported(at)){var az=null,av=null,ay=null,ah=false,ai=null;var ak=function(){ay=aD();if(au.isFull()&&!au.dragAllowedWhenFull){return false}m({elId:am});aj=au.makeInPlaceCopy();aj.paint();az=document.createElement("div");var aJ=U(az);A(az,au.container);var aK=ag(aJ);m({elId:aK});Q(U(au.canvas),"dragId",aK);Q(U(au.canvas),"elId",am);var aI=new r({reference:au.anchor,referenceCanvas:au.canvas});aE=new ab({style:{fillStyle:"rgba(0,0,0,0)"},endpoint:ar,anchor:aI,source:aJ});if(ay==null){au.anchor.locked=true;ay=new p({sourceEndpoint:au,targetEndpoint:aE,source:U(at),target:U(az),anchors:[au.anchor,aI],paintStyle:aG.connectorStyle,connector:aG.connector,overlays:au.connectorOverlays})}else{ah=true;al(U(aj.canvas));var aH=ay.sourceId==am?0:1;ay.floatingAnchorIndex=aH;au.detachFromConnection(ay);if(aH==0){ai=[ay.source,ay.sourceId];ay.source=U(az);ay.sourceId=aK}else{ai=[ay.target,ay.targetId];ay.target=U(az);ay.targetId=aK}ay.endpoints[aH==0?1:0].anchor.locked=true;ay.suspendedEndpoint=ay.endpoints[aH];ay.endpoints[aH]=aE}J[aK]=ay;aE.addConnection(ay);B(T,aK,aE)};var aB=aG.dragOptions||{};var aw=b.extend({},b.CurrentLibrary.defaultDragOptions);aB=b.extend(aw,aB);aB.scope=aB.scope||au.scope;var ax=b.CurrentLibrary.dragEvents.start;var aF=b.CurrentLibrary.dragEvents.stop;var ao=b.CurrentLibrary.dragEvents.drag;aB[ax]=Z(aB[ax],ak);aB[ao]=Z(aB[ao],function(){var aH=b.CurrentLibrary.getUIPosition(arguments);b.CurrentLibrary.setOffset(az,aH);ae(U(az),aH)});aB[aF]=Z(aB[aF],function(){v(T,av,aE);z([az,aE.canvas],at);O(aj.canvas,at);var aH=ay.floatingAnchorIndex==null?1:ay.floatingAnchorIndex;ay.endpoints[aH==0?1:0].anchor.locked=false;if(ay.endpoints[aH]==aE){if(ah&&ay.suspendedEndpoint){if(aH==0){ay.source=ai[0];ay.sourceId=ai[1]}else{ay.target=ai[0];ay.targetId=ai[1]}ay.endpoints[aH]=ay.suspendedEndpoint;if(aq){ay.floatingAnchorIndex=null;ay.suspendedEndpoint.addConnection(ay);b.repaint(ai[1])}else{ay.endpoints[aH==0?1:0].detach(ay)}}else{O(ay.canvas,au.container);au.detachFromConnection(ay)}}au.anchor.locked=false;au.paint();ay.repaint();ay=null;delete aj;delete T[aE.elementId];delete aE});var aC=U(au.canvas);b.CurrentLibrary.initDraggable(aC,aB)}var al=function(aK){if(aG.isTarget&&b.CurrentLibrary.isDropSupported(at)){var aH=aG.dropOptions||l.Defaults.DropOptions||b.Defaults.DropOptions;aH=b.extend({},aH);aH.scope=aH.scope||au.scope;var aN=null;var aL=b.CurrentLibrary.dragEvents.drop;var aM=b.CurrentLibrary.dragEvents.over;var aI=b.CurrentLibrary.dragEvents.out;var aJ=function(){var aP=U(b.CurrentLibrary.getDragObject(arguments));var aV=q(aP,"dragId");var aR=q(aP,"elId");var aT=J[aV];var aO=aT.floatingAnchorIndex==null?1:aT.floatingAnchorIndex,aS=aO==0?1:0;if(!au.isFull()&&!(aO==0&&!au.isSource)&&!(aO==1&&!au.isTarget)){if(aO==0){aT.source=at;aT.sourceId=am}else{aT.target=at;aT.targetId=am}aT.endpoints[aO].detachFromConnection(aT);if(aT.suspendedEndpoint){aT.suspendedEndpoint.detachFromConnection(aT)}aT.endpoints[aO]=au;au.addConnection(aT);if(!aT.suspendedEndpoint){B(u,aT.scope,aT);x(at,aG.draggable,{})}else{var aU=aT.suspendedEndpoint.getElement(),aQ=aT.suspendedEndpoint.elementId;l.fireUpdate("jsPlumbConnectionDetached",{source:aO==0?aU:aT.source,target:aO==1?aU:aT.target,sourceId:aO==0?aQ:aT.sourceId,targetId:aO==1?aQ:aT.targetId,sourceEndpoint:aO==0?aT.suspendedEndpoint:aT.endpoints[0],targetEndpoint:aO==1?aT.suspendedEndpoint:aT.endpoints[1]})}b.repaint(aR);l.fireUpdate("jsPlumbConnection",{source:aT.source,target:aT.target,sourceId:aT.sourceId,targetId:aT.targetId,sourceEndpoint:aT.endpoints[0],targetEndpoint:aT.endpoints[1]})}delete J[aV]};aH[aL]=Z(aH[aL],aJ);aH[aM]=Z(aH[aM],function(){var aP=b.CurrentLibrary.getDragObject(arguments);var aR=q(U(aP),"dragId");var aQ=J[aR];var aO=aQ.floatingAnchorIndex==null?1:aQ.floatingAnchorIndex;aQ.endpoints[aO].anchor.over(au.anchor)});aH[aI]=Z(aH[aI],function(){var aP=b.CurrentLibrary.getDragObject(arguments);var aR=q(U(aP),"dragId");var aQ=J[aR];var aO=aQ.floatingAnchorIndex==null?1:aQ.floatingAnchorIndex;aQ.endpoints[aO].anchor.out()});b.CurrentLibrary.initDroppable(aK,aH)}};al(U(au.canvas));return au};this.Defaults={Anchor:null,Anchors:[null,null],BackgroundPaintStyle:null,Connector:null,Container:null,DragOptions:{},DropOptions:{},Endpoint:null,Endpoints:[null,null],EndpointStyle:{fillStyle:null},EndpointStyles:[null,null],LabelStyle:{fillStyle:"rgba(0,0,0,0)",color:"black"},LogEnabled:true,MaxConnections:null,PaintStyle:{lineWidth:10,strokeStyle:"red"},Scope:"_jsPlumb_DefaultScope"};this.logEnabled=this.Defaults.LogEnabled;this.connectorClass="_jsPlumb_connector";this.endpointClass="_jsPlumb_endpoint";this.overlayClass="_jsPlumb_overlay";this.Anchors={};this.Connectors={};this.Endpoints={};this.Overlays={};this.addEndpoint=function(am,an){an=b.extend({},an);an.endpoint=an.endpoint||l.Defaults.Endpoint||b.Defaults.Endpoint;an.endpointStyle=an.endpointStyle||l.Defaults.EndpointStyle||b.Defaults.EndpointStyle;var ak=U(am),ao=q(ak,"id");an.source=ak;m({elId:ao});var al=new ab(an);B(T,ao,al);var ah=F[ao],aj=y[ao];var ai=al.anchor.compute({xy:[ah.left,ah.top],wh:aj,element:al});al.paint({anchorLoc:ai});return al};this.addEndpoints=function(ak,ah){var aj=[];for(var ai=0;ai0?P(at,ar)!=-1:true};for(var al in u){if(aj(ao,al)){ah[al]=[];for(var ak=0;ak=4){ai.orientation=[arguments[2],arguments[3]]}if(arguments.length==6){ai.offsets=[arguments[4],arguments[5]]}}var an=new M(ai);an.clone=function(){return new M(ai)};return an};this.makeAnchors=function(ai){var aj=[];for(var ah=0;ah0?1:-1;var v=Math.abs(w*Math.sin(f));if(g>c){v=v*-1}var r=Math.abs(w*Math.cos(f));if(h>d){r=r*-1}return{x:u.x+(t*r),y:u.y+(t*v)}};this.perpendicularToPathAt=function(u,v,A){var w=q.pointAlongPathFrom(u,A);var t=q.gradientAtPoint(w.location);var s=Math.atan(-1/t);var z=v/2*Math.sin(s);var r=v/2*Math.cos(s);return[{x:w.x+r,y:w.y+z},{x:w.x-r,y:w.y-z}]};this.createGradient=function(s,r){return r.createLinearGradient(s[4],s[5],s[6],s[7])}};jsPlumb.Connectors.Bezier=function(c){var q=this;this.majorAnchor=c||150;this.minorAnchor=10;var k=null;this._findControlPoint=function(A,r,v,y,s){var x=y.getOrientation(),z=s.getOrientation();var u=x[0]!=z[0]||x[1]==z[1];var t=[];var B=q.majorAnchor,w=q.minorAnchor;if(!u){if(x[0]==0){t.push(r[0]n){n=w}if(z<0){f+=z;var A=Math.abs(z);n+=A;p[0]+=A;l+=A;d+=A;o[0]+=A}var I=Math.min(g,_ty);var G=Math.min(p[1],o[1]);var v=Math.min(I,G);var B=Math.max(g,_ty);var y=Math.max(p[1],o[1]);var t=Math.max(B,y);if(t>h){h=t}if(v<0){e+=v;var x=Math.abs(v);h+=x;p[1]+=x;g+=x;_ty+=x;o[1]+=x}if(F&&nm){m=p}}return m};this.draw=function(n,m){var p=h(m);if(p.width){var o=n.pointOnPath(d.location);if(d.labelStyle.font){m.font=d.labelStyle.font}if(d.labelStyle.fillStyle){m.fillStyle=d.labelStyle.fillStyle}else{m.fillStyle="rgba(0,0,0,0)"}m.fillRect(o.x-(p.width/2),o.y-(p.height/2),p.width,p.height);if(d.labelStyle.color){m.fillStyle=d.labelStyle.color}m.textBaseline="middle";m.textAlign="center";for(i=0;i0){m.strokeStyle=d.labelStyle.borderStyle||"black";m.strokeRect(o.x-(p.width/2),o.y-(p.height/2),p.width,p.height)}}}};jsPlumb.Overlays.Image=function(e){var l=this;this.location=e.location||0.5;this.img=new Image();var m=null;var f=null;var d,c;var k=e.events||{};var h=function(){if(l.ready){window.clearInterval(f);m=document.createElement("img");m.src=l.img.src;m.style.position="absolute";m.style.display="none";m.className="_jsPlumb_overlay";document.body.appendChild(m);for(var n in k){jsPlumb.CurrentLibrary.bind(m,n,k[n])}if(d&&c){g(d,c);c=null;d=null}}};this.img.onload=function(){l.ready=true};this.img.src=e.src||e.url;f=window.setInterval(h,250);this.computeMaxSize=function(o,n){return[l.img.width,l.img.height]};var g=function(q,p){var s=q.pointOnPath(l.location);var r=jsPlumb.CurrentLibrary.getElementObject(p.canvas);var n=jsPlumb.CurrentLibrary.getOffset(r);var t={left:n.left+s.x-(l.img.width/2),top:n.top+s.y-(l.img.height/2)};jsPlumb.CurrentLibrary.setOffset(m,t);m.style.display="block"};this.draw=function(o,n){if(l.ready){g(o,n)}else{d=o;c=n}}}})();(function(){var d=new Class({Extends:Fx.Morph,onStep:null,initialize:function(m,l){this.parent(m,l);if(l.onStep){this.onStep=l.onStep}},step:function(){this.parent();if(this.onStep){try{this.onStep()}catch(l){}}}});var b={};var h={};var g={};var k={};var e=function(m,o,n){if(o){var p=o.get("id");if(p){var l=h[p];if(l){if(l[n]){l[n](m,o)}}}}};var f=function(m,o){if(m){var n=m.get("id");if(n){var l=h[n];if(l){if(l.hoverClass){if(o){m.addClass(l.hoverClass)}else{m.removeClass(l.hoverClass)}}}}}};var c=function(p,n,o){var m=p[n];if(!m){m=[];p[n]=m}m.push(o)};var a=function(l){return $(l)};jsPlumb.CurrentLibrary={addClass:function(m,l){m.addClass(l)},animate:function(p,o,n){var l=new d(p,n);l.start(o)},appendElement:function(m,l){a(l).grab(m)},bind:function(l,m,n){l=a(l);l.addEvent(m,n)},dragEvents:{start:"onStart",stop:"onComplete",drag:"onDrag",step:"onStep",over:"onEnter",out:"onLeave",drop:"onDrop",complete:"onComplete"},extend:function(m,l){return $extend(m,l)},getAttribute:function(l,m){return l.get(m)},getDragObject:function(l){return l[0]},getElementObject:a,getOffset:function(l){var m=l.getPosition();return{left:m.x,top:m.y}},getScrollLeft:function(l){return null},getScrollTop:function(l){return null},getSize:function(m){var l=m.getSize();return[l.x,l.y]},getUIPosition:function(l){var m=l[0];return{left:m.offsetLeft,top:m.offsetTop}},initDraggable:function(m,u){var l=jsPlumb.getId(m);var p=k[l];if(!p){var n=0,o=null;var r=jsPlumb.Defaults.DragOptions.zIndex||2000;u.onStart=jsPlumb.wrap(u.onStart,function(){n=this.element.getStyle("z-index");this.element.setStyle("z-index",r);if(jsPlumb.Defaults.DragOptions.cursor){o=this.element.getStyle("cursor");this.element.setStyle("cursor",jsPlumb.Defaults.DragOptions.cursor)}});u.onComplete=jsPlumb.wrap(u.onComplete,function(){this.element.setStyle("z-index",n);if(o){this.element.setStyle("cursor",o)}});var t=u.scope||jsPlumb.Defaults.Scope;var q=function(v){return v.get("id")!=m.get("id")};var s=b[t]?b[t].filter(q):[];u.droppables=s;u.onLeave=jsPlumb.wrap(u.onLeave,function(v,w){if(w){f(w,false);e(v,w,"onLeave")}});u.onEnter=jsPlumb.wrap(u.onEnter,function(v,w){if(w){f(w,true);e(v,w,"onEnter")}});u.onDrop=function(v,w){if(w){f(w,false);e(v,w,"onDrop")}};p=new Drag.Move(m,u);c(g,t,p);c(k,m.get("id"),p);if(u.disabled){p.detach()}}return p},initDroppable:function(p,m){var o=m.scope||jsPlumb.Defaults.Scope;c(b,o,p);var r=jsPlumb.getId(p);h[r]=m;var q=function(s){return s.element!=p};var l=g[o]?g[o].filter(q):[];for(var n=0;n0?1:-1}}var h={subtract:function(x,w){return{x:x.x-w.x,y:x.y-w.y}},dotProduct:function(x,w){return(x.x*w.x)+(x.y*w.y)},square:function(w){return Math.sqrt((w.x*w.x)+(w.y*w.y))},scale:function(w,x){return{x:w.x*x,y:w.y*x}}};var o=64,r=Math.pow(2,-o-1),d=3,a=5;var p=function(E,x){var B=new Array(a);var D=e(E,x);var A=q(D,a,B,0);var F=h.subtract(E,x[0]),C=h.square(F),G=0;for(var z=0;z=o){H[0]=(F[0].x+F[a].x)/2;return 1}if(n(F,y)){H[0]=f(F,y);return 1}break}t(F,y,0.5,C,D);B=q(C,y,G,z+1);E=q(D,y,x,z+1);for(A=0;AJ){J=I}else{if(I0?1:-1,E=null;while(z