(function(){var t=!!document.createElement("canvas").getContext,d=!!window.SVGAngle||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),a=!(t|d);var n=function(C,D,A,G){var F=function(J,I){if(J===I){return true}else{if(typeof J=="object"&&typeof I=="object"){var K=true;for(var H in J){if(!F(J[H],I[H])){K=false;break}}for(var H in I){if(!F(I[H],J[H])){K=false;break}}return K}}};for(var E=+A||0,B=C.length;E-1){B.splice(A,1)}return A!=-1};if(!window.console){window.console={time:function(){},timeEnd:function(){},group:function(){},groupEnd:function(){},log:function(){}}}var i=function(D,B,C){var A=D[B];if(A==null){A=[],D[B]=A}A.push(C);return A},r=null,c=function(A,B){return l.CurrentLibrary.getAttribute(x(A),B)},e=function(B,C,A){l.CurrentLibrary.setAttribute(x(B),C,A)},u=function(B,A){l.CurrentLibrary.addClass(x(B),A)},h=function(B,A){return l.CurrentLibrary.hasClass(x(B),A)},k=function(B,A){l.CurrentLibrary.removeClass(x(B),A)},x=function(A){return l.CurrentLibrary.getElementObject(A)},p=function(A){return l.CurrentLibrary.getOffset(x(A))},b=function(A){return l.CurrentLibrary.getSize(x(A))},w=true,m=function(){if(w&&typeof console!="undefined"){try{var B=arguments[arguments.length-1];console.log(B)}catch(A){}}},z=function(A){if(w&&typeof console!="undefined"){console.group(A)}},f=function(A){if(w&&typeof console!="undefined"){console.groupEnd(A)}},y=function(A){if(w&&typeof console!="undefined"){console.time(A)}},q=function(A){if(w&&typeof console!="undefined"){console.timeEnd(A)}};EventGenerator=function(){var C={},B=this;var A=["ready"];this.bind=function(D,E){i(C,D,E)};this.fire=function(F,G,D){if(C[F]){for(var E=0;E=0){delete (aZ[a0]);aZ.splice(a0,1);return true}}}return false},aO=function(a0,aZ){return am(a0,function(a1,a2){aR[a2]=aZ;if(l.CurrentLibrary.isDragSupported(a1)){l.CurrentLibrary.setDraggable(a1,aZ)}})},aC=function(a1,a2,aZ){a2=a2==="block";var a0=null;if(aZ){if(a2){a0=function(a4){a4.setVisible(true,true,true)}}else{a0=function(a4){a4.setVisible(false,true,true)}}}var a3=c(a1,"id");I(a3,function(a5){if(a2&&aZ){var a4=a5.sourceId===a3?1:0;if(a5.endpoints[a4].isVisible()){a5.setVisible(true)}}else{a5.setVisible(a2)}},a0)},aM=function(aZ){return am(aZ,function(a1,a0){var a2=aR[a0]==null?false:aR[a0];a2=!a2;aR[a0]=a2;l.CurrentLibrary.setDraggable(a1,a2);return a2})},at=function(aZ,a1){var a0=null;if(a1){a0=function(a2){var a3=a2.isVisible();a2.setVisible(!a3)}}I(aZ,function(a3){var a2=a3.isVisible();a3.setVisible(!a2)},a0)},K=function(a4){var a2=a4.timestamp,aZ=a4.recalc,a3=a4.offset,a0=a4.elId;if(!aZ){if(a2&&a2===aV[a0]){return U[a0]}}if(aZ||!a3){var a1=x(a0);if(a1!=null){Q[a0]=b(a1);U[a0]=p(a1);aV[a0]=a2}}else{U[a0]=a3;if(Q[a0]==null){var a1=x(a0);if(a1!=null){Q[a0]=b(a1)}}}if(U[a0]&&!U[a0].right){U[a0].right=U[a0].left+Q[a0][0];U[a0].bottom=U[a0].top+Q[a0][1];U[a0].width=Q[a0][0];U[a0].height=Q[a0][1];U[a0].centerx=U[a0].left+(U[a0].width/2);U[a0].centery=U[a0].top+(U[a0].height/2)}return U[a0]},ap=function(aZ){var a0=U[aZ];if(!a0){a0=K(aZ)}return{o:a0,s:Q[aZ]}},A=function(aZ,a0){var a1=x(aZ);var a2=c(a1,"id");if(!a2||a2=="undefined"){if(arguments.length==2&&arguments[1]!=undefined){a2=a0}else{a2="jsPlumb_"+W()}e(a1,"id",a2)}return a2},Y=function(a1,aZ,a0){a1=a1||function(){};aZ=aZ||function(){};return function(){var a2=null;try{a2=aZ.apply(this,arguments)}catch(a3){m(aS,"jsPlumb function failed : "+a3)}if(a0==null||(a2!==a0)){try{a1.apply(this,arguments)}catch(a3){m(aS,"wrapped function failed : "+a3)}}return a2}};this.connectorClass="_jsPlumb_connector";this.endpointClass="_jsPlumb_endpoint";this.overlayClass="_jsPlumb_overlay";this.Anchors={};this.Connectors={canvas:{},svg:{},vml:{}};this.Endpoints={canvas:{},svg:{},vml:{}};this.Overlays={canvas:{},svg:{},vml:{}};this.addClass=function(a0,aZ){return l.CurrentLibrary.addClass(a0,aZ)};this.removeClass=function(a0,aZ){return l.CurrentLibrary.removeClass(a0,aZ)};this.hasClass=function(a0,aZ){return l.CurrentLibrary.hasClass(a0,aZ)};this.addEndpoint=function(a1,a2,bb){bb=bb||{};var a0=l.extend({},bb);l.extend(a0,a2);a0.endpoint=a0.endpoint||aS.Defaults.Endpoint||l.Defaults.Endpoint;a0.paintStyle=a0.paintStyle||aS.Defaults.EndpointStyle||l.Defaults.EndpointStyle;a1=an(a1);var a3=[],a6=a1.length&&a1.constructor!=String?a1:[a1];for(var a4=0;a40){try{for(var a0=0;a00?n(bc,bb)!=-1:true},a3=a6.length>1?{}:[],a9=function(bc,bd){if(a6.length>1){var bb=a3[bc];if(bb==null){bb=[];a3[bc]=bb}bb.push(bd)}else{a3.push(bd)}};for(var a2 in ay){if(a0(a6,a2)){for(var a1=0;a1=4)?[a4[2],a4[3]]:[0,0],offsets:(a4.length==6)?[a4[4],a4[5]]:[0,0],elementId:a1};a2=new N(a3);a2.clone=function(){return new N(a3)}}}}}if(!a2.id){a2.id="anchor_"+W()}return a2};this.makeAnchors=function(a2,a0,aZ){var a3=[];for(var a1=0;a10?a9[0]:null,a4=a9.length>0?0:-1,a8=this,a3=function(bc,ba,bg,bf,bb){var be=bf[0]+(bc.x*bb[0]),bd=bf[1]+(bc.y*bb[1]);return Math.sqrt(Math.pow(ba-be,2)+Math.pow(bg-bd,2))},aZ=a0||function(bk,bb,bc,bd,ba){var bf=bc[0]+(bd[0]/2),be=bc[1]+(bd[1]/2);var bh=-1,bj=Infinity;for(var bg=0;bg=a2.left)||(a5.left<=a2.right&&a5.right>=a2.right)||(a5.left<=a2.left&&a5.right>=a2.right)||(a2.left<=a5.left&&a2.right>=a5.right)),ba=((a5.top<=a2.top&&a5.bottom>=a2.top)||(a5.top<=a2.bottom&&a5.bottom>=a2.bottom)||(a5.top<=a2.top&&a5.bottom>=a2.bottom)||(a2.top<=a5.top&&a2.bottom>=a5.bottom));if(!(a4||ba)){var a7=null,a1=false,aZ=false,a6=null;if(a2.left>a5.left&&a2.top>a5.top){a7=["right","top"]}else{if(a2.left>a5.left&&a5.top>a2.top){a7=["top","left"]}else{if(a2.lefta5.top){a7=["left","top"]}}}}return{orientation:H.DIAGONAL,a:a7,theta:a0,theta2:a3}}else{if(a4){return{orientation:H.HORIZONTAL,a:a5.topaZ[0]?1:-1},O=function(aZ){return function(a1,a0){var a2=true;if(aZ){if(a1[0][0]a0[0][1]}}else{if(a1[0][0]>a0[0][0]){a2=true}else{a2=a1[0][1]>a0[0][1]}}return a2===false?-1:1}},D=function(a0,aZ){var a2=a0[0][0]<0?-Math.PI-a0[0][0]:Math.PI-a0[0][0],a1=aZ[0][0]<0?-Math.PI-aZ[0][0]:Math.PI-aZ[0][0];if(a2>a1){return 1}else{return a0[0][1]>aZ[0][1]?1:-1}},aA={top:aF,right:O(true),bottom:O(true),left:D},Z=function(aZ,a0){return aZ.sort(a0)},X=function(a0,aZ){var a2=Q[a0],a3=U[a0],a1=function(a9,bg,a5,a8,be,bd){if(a8.length>0){var bc=Z(a8,aA[a9]),ba=a9==="right"||a9==="top",a4=aD(a9,bg,a5,bc,be,bd,ba);var bh=function(bk,bj){var bi=aT([bj[0],bj[1]],bk.canvas);V[bk.id]=[bi[0],bi[1],bj[2],bj[3]]};for(var a6=0;a6-1){a5.splice(a6,1)}else{R(aZ,a7.elementId,a7)}};this.clearFor=function(a6){delete aZ[a6];aZ[a6]=[]};var a3=function(bq,bd,bl,ba,bg,bh,bj,bf,bs,bi,a9,bp){var bn=-1,a8=-1,bb=ba.endpoints[bj],bk=bb.id,be=[1,0][bj],a6=[[bd,bl],ba,bg,bh,bk],a7=bq[bs],br=bb._continuousAnchorEdge?bq[bb._continuousAnchorEdge]:null;if(br){var bo=g(br,function(bt){return bt[4]==bk});if(bo!=-1){br.splice(bo,1);for(var bm=0;bm=0?ba.overlays[bl]:null};this.hideOverlay=function(bm){var bl=ba.getOverlay(bm);if(bl){bl.hide()}};this.showOverlay=function(bm){var bl=ba.getOverlay(bm);if(bl){bl.show()}};this.removeAllOverlays=function(){ba.overlays.splice(0,ba.overlays.length);ba.repaint()};this.removeOverlay=function(bm){var bl=bh(bm);if(bl!=-1){var bn=ba.overlays[bl];bn.cleanup();ba.overlays.splice(bl,1)}};this.removeOverlays=function(){for(var bl=0;bl0){bg.connections[0].setHover(bs,false)}else{bg.setHover(bs)}};this.endpoint.bind("click",function(bs){bg.fire("click",bg,bs)});this.endpoint.bind("dblclick",function(bs){bg.fire("dblclick",bg,bs)});this.endpoint.bind("mouseenter",function(bs,bt){if(!bg.isHover()){br(true);bg.fire("mouseenter",bg,bt)}});this.endpoint.bind("mouseexit",function(bs,bt){if(bg.isHover()){br(false);bg.fire("mouseexit",bg,bt)}});this.setPaintStyle(bq.paintStyle||bq.style||aS.Defaults.EndpointStyle||l.Defaults.EndpointStyle,true);this.setHoverPaintStyle(bq.hoverPaintStyle||aS.Defaults.EndpointHoverStyle||l.Defaults.EndpointHoverStyle,true);this.paintStyleInUse=this.paintStyle;this.connectorStyle=bq.connectorStyle;this.connectorHoverStyle=bq.connectorHoverStyle;this.connectorOverlays=bq.connectorOverlays;this.connector=bq.connector;this.connectorTooltip=bq.connectorTooltip;this.parent=bq.parent;this.isSource=bq.isSource||false;this.isTarget=bq.isTarget||false;var bl=bq.maxConnections||aS.Defaults.MaxConnections;this.getAttachedElements=function(){return bg.connections};this.canvas=this.endpoint.canvas;this.connections=bq.connections||[];this.scope=bq.scope||F;this.timestamp=null;bg.isReattach=bq.reattach||false;bg.connectionsDetachable=aS.Defaults.ConnectionsDetachable;if(bq.connectionsDetachable===false||bq.detachable===false){bg.connectionsDetachable=false}var bb=bq.dragAllowedWhenFull||true;this.computeAnchor=function(bs){return bg.anchor.compute(bs)};this.addConnection=function(bs){bg.connections.push(bs)};this.detach=function(bs,bw,bt,bA){var bz=n(bg.connections,bs),by=false;bA=(bA!==false);if(bz>=0){if(bt||bs._forceDetach||bs.isDetachable()||bs.isDetachAllowed(bs)){var bB=bs.endpoints[0]==bg?bs.endpoints[1]:bs.endpoints[0];if(bt||bs._forceDetach||(bg.isDetachAllowed(bs))){bg.connections.splice(bz,1);if(!bw){bB.detach(bs,true,bt);if(bs.endpointsToDeleteOnDetach){for(var bx=0;bx0){bg.detach(bg.connections[0],false,true,bs)}};this.detachFrom=function(bu,bt){var bv=[];for(var bs=0;bs=0){bg.connections.splice(bs,1)}};this.getElement=function(){return bf};this.setElement=function(bu){var bw=A(bu);R(au,a7,bg);bf=x(bu);a7=A(bf);bg.elementId=a7;var bv=af({source:bw}),bt=a1.getParent(bg.canvas);a1.removeElement(bg.canvas,bt);a1.appendElement(bg.canvas,bv);for(var bs=0;bs0){var bC=bc(bu.elementWithPrecedence),bE=bC.endpoints[0]==bg?1:0,bw=bE==0?bC.sourceId:bC.targetId,bB=U[bw],bD=Q[bw];bt.txy=[bB.left,bB.top];bt.twh=bD;bt.tElement=bC.endpoints[bE]}bx=bg.anchor.compute(bt)}var bA=bd.compute(bx,bg.anchor.getOrientation(bd),bg.paintStyleInUse,bv||bg.paintStyleInUse);bd.paint(bA,bg.paintStyleInUse,bg.anchor);bg.timestamp=bz}};this.repaint=this.paint;this.removeConnection=this.detach;if(l.CurrentLibrary.isDragSupported(bf)){var bk={id:null,element:null},bj=null,a0=false,a3=null,aZ=aI(bk);var a5=function(){bj=bg.connectorSelector();var bs=true;if(bj==null&&!bq.isSource){bs=false}if(bq.isSource&&bg.isFull()&&!bb){bs=false}if(bj!=null&&!bj.isDetachable()){bs=false}if(bs===false){if(l.CurrentLibrary.stopDrag){l.CurrentLibrary.stopDrag()}aZ.stopDrag();return false}if(bj&&!bg.isFull()&&bq.isSource){bj=null}K({elId:a7});a4=bg.makeInPlaceCopy();a4.paint();G(bk,bg.parent);var by=x(a4.canvas),bw=l.CurrentLibrary.getOffset(by),bt=aT([bw.left,bw.top],a4.canvas);l.CurrentLibrary.setOffset(bk.element,{left:bt[0],top:bt[1]});e(x(bg.canvas),"dragId",bk.id);e(x(bg.canvas),"elId",a7);bo=ac(bg.paintStyle,bg.anchor,bd,bg.canvas,bk.element);if(bj==null){bg.anchor.locked=true;bg.setHover(false,false);bj=P({sourceEndpoint:bg,targetEndpoint:bo,source:bg.endpointWillMoveTo||x(bf),target:bk.element,anchors:[bg.anchor,bo.anchor],paintStyle:bq.connectorStyle,hoverPaintStyle:bq.connectorHoverStyle,connector:bq.connector,overlays:bq.connectorOverlays})}else{a0=true;bj.connector.setHover(false,false);a6(x(a4.canvas),false,true);var bv=bj.endpoints[0].id==bg.id?0:1;bj.floatingAnchorIndex=bv;bg.detachFromConnection(bj);var bz=x(bg.canvas),bx=l.CurrentLibrary.getDragScope(bz);e(bz,"originalScope",bx);var bu=l.CurrentLibrary.getDropScope(bz);l.CurrentLibrary.setDragScope(bz,bu);if(bv==0){a3=[bj.source,bj.sourceId,bn,bx];bj.source=bk.element;bj.sourceId=bk.id}else{a3=[bj.target,bj.targetId,bn,bx];bj.target=bk.element;bj.targetId=bk.id}bj.endpoints[bv==0?1:0].anchor.locked=true;bj.suspendedEndpoint=bj.endpoints[bv];bj.suspendedEndpoint.setHover(false);bj.endpoints[bv]=bo}aL[bk.id]=bj;bo.addConnection(bj);J(au,bk.id,bo);aS.currentlyDragging=true};var a1=l.CurrentLibrary,bm=bq.dragOptions||{},bh=l.extend({},a1.defaultDragOptions),bi=a1.dragEvents.start,bp=a1.dragEvents.stop,a9=a1.dragEvents.drag;bm=l.extend(bh,bm);bm.scope=bm.scope||bg.scope;bm[bi]=Y(bm[bi],a5);bm[a9]=Y(bm[a9],aZ);bm[bp]=Y(bm[bp],function(){aS.currentlyDragging=false;R(au,bk.id,bo);ax([bk.element[0],bo.canvas],bf);ad(a4.canvas,bf);aS.anchorManager.clearFor(bk.id);var bs=bj.floatingAnchorIndex==null?1:bj.floatingAnchorIndex;bj.endpoints[bs==0?1:0].anchor.locked=false;if(bj.endpoints[bs]==bo){if(a0&&bj.suspendedEndpoint){if(bs==0){bj.source=a3[0];bj.sourceId=a3[1]}else{bj.target=a3[0];bj.targetId=a3[1]}l.CurrentLibrary.setDragScope(a3[2],a3[3]);bj.endpoints[bs]=bj.suspendedEndpoint;if(bg.isReattach||bj._forceDetach||!bj.endpoints[bs==0?1:0].detach(bj)){bj.setHover(false);bj.floatingAnchorIndex=null;bj.suspendedEndpoint.addConnection(bj);l.repaint(a3[1])}bj._forceDetach=null}else{ax(bj.connector.getDisplayElements(),bg.parent);bg.detachFromConnection(bj)}}bg.anchor.locked=false;bg.paint({recalc:false});bj.setHover(false,false);bj=null;a4=null;delete au[bo.elementId];bo.anchor=null;bo=null;aS.currentlyDragging=false});var bn=x(bg.canvas);l.CurrentLibrary.initDraggable(bn,bm,true)}var a6=function(bw,bz,bu){if((bq.isTarget||bz)&&l.CurrentLibrary.isDropSupported(bf)){var bs=bq.dropOptions||aS.Defaults.DropOptions||l.Defaults.DropOptions;bs=l.extend({},bs);bs.scope=bs.scope||bg.scope;var bx=l.CurrentLibrary.dragEvents.drop,by=l.CurrentLibrary.dragEvents.over,bt=l.CurrentLibrary.dragEvents.out,bv=function(){var bJ=x(l.CurrentLibrary.getDragObject(arguments)),bA=c(bJ,"dragId"),bC=c(bJ,"elId"),bI=c(bJ,"originalScope"),bF=aL[bA],bG=bF.floatingAnchorIndex==null?1:bF.floatingAnchorIndex,bH=bG==0?1:0;if(bI){l.CurrentLibrary.setDragScope(bJ,bI)}if(!bg.isFull()&&!(bG==0&&!bg.isSource)&&!(bG==1&&!bg.isTarget)){var bD=true;if(bF.suspendedEndpoint&&bF.suspendedEndpoint.id!=bg.id){if(!bF.isDetachAllowed(bF)||!bF.endpoints[bG].isDetachAllowed(bF)||!bF.suspendedEndpoint.isDetachAllowed(bF)||!aS.checkCondition("beforeDetach",bF)){bD=false}}if(bG==0){bF.source=bf;bF.sourceId=a7}else{bF.target=bf;bF.targetId=a7}bD=bD&&bg.isDropAllowed(bF.sourceId,bF.targetId,bF.scope);if(bD){bF.endpoints[bG].detachFromConnection(bF);if(bF.suspendedEndpoint){bF.suspendedEndpoint.detachFromConnection(bF)}bF.endpoints[bG]=bg;bg.addConnection(bF);if(!bF.suspendedEndpoint){aH(bf,bq.draggable,{})}else{var bE=bF.suspendedEndpoint.getElement(),bB=bF.suspendedEndpoint.elementId;aE({source:bG==0?bE:bF.source,target:bG==1?bE:bF.target,sourceId:bG==0?bB:bF.sourceId,targetId:bG==1?bB:bF.targetId,sourceEndpoint:bG==0?bF.suspendedEndpoint:bF.endpoints[0],targetEndpoint:bG==1?bF.suspendedEndpoint:bF.endpoints[1],connection:bF},true)}aX(bF)}else{if(bF.suspendedEndpoint){bF.endpoints[bG]=bF.suspendedEndpoint;bF.setHover(false);bF._forceDetach=true;if(bG==0){bF.source=bF.suspendedEndpoint.element;bF.sourceId=bF.suspendedEndpoint.elementId}else{bF.target=bF.suspendedEndpoint.element;bF.targetId=bF.suspendedEndpoint.elementId}bF.suspendedEndpoint.addConnection(bF);bF.endpoints[0].repaint();bF.repaint();l.repaint(bF.source.elementId);bF._forceDetach=false}}bF.floatingAnchorIndex=null}aS.currentlyDragging=false;delete aL[bA]};bs[bx]=Y(bs[bx],bv);bs[by]=Y(bs[by],function(){var bB=l.CurrentLibrary.getDragObject(arguments),bD=c(x(bB),"dragId"),bC=aL[bD];if(bC!=null){var bA=bC.floatingAnchorIndex==null?1:bC.floatingAnchorIndex;bC.endpoints[bA].anchor.over(bg.anchor)}});bs[bt]=Y(bs[bt],function(){var bB=l.CurrentLibrary.getDragObject(arguments),bD=c(x(bB),"dragId"),bC=aL[bD];if(bC!=null){var bA=bC.floatingAnchorIndex==null?1:bC.floatingAnchorIndex;bC.endpoints[bA].anchor.out()}});l.CurrentLibrary.initDroppable(bw,bs,true,bu)}};a6(x(bg.canvas),true,!(bq._transient||bg.anchor.isFloating));return bg}};var l=window.jsPlumb=new s();l.getInstance=function(B){var A=new s(B);A.init();return A};l.util={convertStyle:function(B,A){if("transparent"===B){return B}var G=B,F=function(H){return H.length==1?"0"+H:H},C=function(H){return F(Number(H).toString(16))},D=/(rgb[a]?\()(.*)(\))/;if(B.match(D)){var E=B.match(D)[2].split(",");G="#"+C(E[0])+C(E[1])+C(E[2]);if(!A&&E.length==4){G=G+C(E[3])}}return G},gradient:function(B,A){B=B.constructor==Array?B:[B.x,B.y];A=A.constructor==Array?A:[A.x,A.y];return(A[1]-B[1])/(A[0]-B[0])},normal:function(B,A){return -1/l.util.gradient(B,A)},segment:function(B,A){B=B.constructor==Array?B:[B.x,B.y];A=A.constructor==Array?A:[A.x,A.y];if(A[0]>B[0]){return(A[1]>B[1])?2:1}else{return(A[1]>B[1])?3:4}},segmentMultipliers:[null,[1,-1],[1,1],[-1,1],[-1,-1]],inverseSegmentMultipliers:[null,[-1,-1],[-1,1],[1,1],[1,-1]],pointOnLine:function(A,E,B){var D=l.util.gradient(A,E),I=l.util.segment(A,E),H=B>0?l.util.segmentMultipliers[I]:l.util.inverseSegmentMultipliers[I],C=Math.atan(D),F=Math.abs(B*Math.sin(C))*H[1],G=Math.abs(B*Math.cos(C))*H[0];return{x:A.x+G,y:A.y+F}},perpendicularLineTo:function(C,D,E){var B=l.util.gradient(C,D),F=Math.atan(-1/B),G=E/2*Math.sin(F),A=E/2*Math.cos(F);return[{x:D.x+A,y:D.y+G},{x:D.x-A,y:D.y-G}]}};var o=function(A,F,C,B,E,D){return function(H){H=H||{};var G=l.makeAnchor([A,F,C,B,0,0],H.elementId,H.jsPlumbInstance);G.type=E;if(D){D(G,H)}return G}};l.Anchors.TopCenter=o(0.5,0,0,-1,"TopCenter");l.Anchors.BottomCenter=o(0.5,1,0,1,"BottomCenter");l.Anchors.LeftMiddle=o(0,0.5,-1,0,"LeftMiddle");l.Anchors.RightMiddle=o(1,0.5,1,0,"RightMiddle");l.Anchors.Center=o(0.5,0.5,0,0,"Center");l.Anchors.TopRight=o(1,0,0,-1,"TopRight");l.Anchors.BottomRight=o(1,1,0,1,"BottomRight");l.Anchors.TopLeft=o(0,0,0,-1,"TopLeft");l.Anchors.BottomLeft=o(0,1,0,1,"BottomLeft");l.Defaults.DynamicAnchors=function(A){return l.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"],A.elementId,A.jsPlumbInstance)};l.Anchors.AutoDefault=function(B){var A=l.makeDynamicAnchor(l.Defaults.DynamicAnchors(B));A.type="AutoDefault";return A};l.Anchors.Assign=o(0,0,0,0,"Assign",function(B,C){var A=C.position||"Fixed";B.positionFinder=A.constructor==String?l.AnchorPositionFinders[A]:A;B.constructorParams=C});l.Anchors.Continuous=function(A){return A.jsPlumbInstance.continuousAnchorFactory.get(A)};l.AnchorPositionFinders={Fixed:function(D,B,C,A){return[(D.left-B.left)/C[0],(D.top-B.top)/C[1]]},Grid:function(A,J,E,B){var I=A.left-J.left,H=A.top-J.top,G=E[0]/(B.constructorParams.grid[0]),F=E[1]/(B.constructorParams.grid[1]),D=Math.floor(I/G),C=Math.floor(H/F);return[((D*G)+(G/2))/E[0],((C*F)+(F/2))/E[1]]}}})();(function(){jsPlumb.DOMElementComponent=function(b){jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.mousemove=this.dblclick=this.click=this.mousedown=this.mouseup=function(c){}};jsPlumb.Connectors.Straight=function(){this.type="Straight";var q=this,h=null,d,i,o,m,k,e,p,g,f,c,b,n,l;this.compute=function(z,I,r,v,E,s,C,u){var H=Math.abs(z[0]-I[0]),B=Math.abs(z[1]-I[1]),A=0.45*H,t=0.45*B;H*=1.9;B*=1.9;var F=Math.min(z[0],I[0])-A;var D=Math.min(z[1],I[1])-t;var G=Math.max(2*C,u);if(Hm){m=w}if(z<0){e+=z;var B=Math.abs(z);m+=B;o[0]+=B;k+=B;c+=B;n[0]+=B}var J=Math.min(g,b),H=Math.min(o[1],n[1]),v=Math.min(J,H),A=Math.max(g,b),y=Math.max(o[1],n[1]),s=Math.max(A,y);if(s>h){h=s}if(v<0){d+=v;var x=Math.abs(v);h+=x;o[1]+=x;g+=x;b+=x;n[1]+=x}if(F&&m=s){q=t;r=(s-l[t][0])/b[t];break}}return{segment:i[q],proportion:r,index:q}};this.compute=function(T,v,L,z,S,r,q,I){i=[];n=0;b=[];e=v[0]t[0]?t[0]+((1-x)*r)-y:t[2]+(x*r)+y,y:q==0?t[3]:t[3]>t[1]?t[1]+((1-x)*r)-y:t[3]+(x*r)+y,segmentInfo:v};return w}};jsPlumb.Endpoints.Dot=function(c){this.type="Dot";var b=this;c=c||{};this.radius=c.radius||10;this.defaultOffset=0.5*this.radius;this.defaultInnerRadius=this.radius/3;this.compute=function(h,e,k,g){var f=k.radius||b.radius,d=h[0]-f,i=h[1]-f;return[d,i,f*2,f*2,f]}};jsPlumb.Endpoints.Rectangle=function(c){this.type="Rectangle";var b=this;c=c||{};this.width=c.width||20;this.height=c.height||20;this.compute=function(i,f,l,h){var g=l.width||b.width,e=l.height||b.height,d=i[0]-(g/2),k=i[1]-(e/2);return[d,k,g,e]}};jsPlumb.Endpoints.Image=function(f){this.type="Image";jsPlumb.DOMElementComponent.apply(this,arguments);var k=this,e=false,d=f.width,c=f.height,h=null,b=f.endpoint;this.img=new Image();k.ready=false;this.img.onload=function(){k.ready=true;d=d||k.img.width;c=c||k.img.height;if(h){h(this)}};b.setImage=function(l,n){var m=l.constructor==String?l:l.src;h=n;k.img.src=l};b.setImage(f.src||f.url,f.onload);this.compute=function(n,l,o,m){k.anchorPoint=n;if(k.ready){return[n[0]-d/2,n[1]-c/2,d,c]}else{return[0,0,0,0]}};k.canvas=document.createElement("img"),e=false;k.canvas.style.margin=0;k.canvas.style.padding=0;k.canvas.style.outline=0;k.canvas.style.position="absolute";var g=f.cssClass?" "+f.cssClass:"";k.canvas.className=jsPlumb.endpointClass+g;if(d){k.canvas.setAttribute("width",d)}if(c){k.canvas.setAttribute("height",c)}jsPlumb.appendElement(k.canvas,f.parent);k.attachListeners(k.canvas,k);var i=function(o,n,m){if(!e){k.canvas.setAttribute("src",k.img.src);e=true}var l=k.anchorPoint[0]-(d/2),p=k.anchorPoint[1]-(c/2);jsPlumb.sizeCanvas(k.canvas,l,p,d,c)};this.paint=function(n,m,l){if(k.ready){i(n,m,l)}else{window.setTimeout(function(){k.paint(n,m,l)},200)}}};jsPlumb.Endpoints.Blank=function(c){var b=this;this.type="Blank";jsPlumb.DOMElementComponent.apply(this,arguments);this.compute=function(f,d,g,e){return[f[0],f[1],10,0]};b.canvas=document.createElement("div");b.canvas.style.display="block";b.canvas.style.width="1px";b.canvas.style.height="1px";b.canvas.style.background="transparent";b.canvas.style.position="absolute";b.canvas.className=b._jsPlumb.endpointClass;jsPlumb.appendElement(b.canvas,c.parent);this.paint=function(g,f,e){jsPlumb.sizeCanvas(b.canvas,g[0],g[1],g[2],g[3])}};jsPlumb.Endpoints.Triangle=function(b){this.type="Triangle";b=b||{};b.width=b.width||55;b.height=b.height||55;this.width=b.width;this.height=b.height;this.compute=function(h,e,k,g){var f=k.width||self.width,d=k.height||self.height,c=h[0]-(f/2),i=h[1]-(d/2);return[c,i,f,d]}};var a=function(d){var c=true,b=this;this.isAppendedAtTopLevel=true;this.connection=d.connection;this.loc=d.location==null?0.5:d.location;this.setVisible=function(e){c=e;b.connection.repaint()};this.isVisible=function(){return c};this.hide=function(){b.setVisible(false)};this.show=function(){b.setVisible(true)};this.incrementLocation=function(e){b.loc+=e;b.connection.repaint()};this.setLocation=function(e){b.loc=e;b.connection.repaint()};this.getLocation=function(){return b.loc}};jsPlumb.Overlays.Arrow=function(f){this.type="Arrow";a.apply(this,arguments);this.isAppendedAtTopLevel=false;f=f||{};var c=this;this.length=f.length||20;this.width=f.width||20;this.id=f.id;var e=(f.direction||1)<0?-1:1,d=f.paintStyle||{lineWidth:1},b=f.foldback||0.623;this.computeMaxSize=function(){return c.width*1.5};this.cleanup=function(){};this.draw=function(h,w,r){var l,s,g,m,k;if(c.loc==1){l=h.pointOnPath(c.loc);s=h.pointAlongPathFrom(c.loc,-1);g=jsPlumb.util.pointOnLine(l,s,c.length)}else{if(c.loc==0){g=h.pointOnPath(c.loc);s=h.pointAlongPathFrom(c.loc,1);l=jsPlumb.util.pointOnLine(g,s,c.length)}else{l=h.pointAlongPathFrom(c.loc,e*c.length/2),s=h.pointOnPath(c.loc),g=jsPlumb.util.pointOnLine(l,s,c.length)}}m=jsPlumb.util.perpendicularLineTo(l,g,c.width);k=jsPlumb.util.pointOnLine(l,g,b*c.length);var v=Math.min(l.x,m[0].x,m[1].x),p=Math.max(l.x,m[0].x,m[1].x),u=Math.min(l.y,m[0].y,m[1].y),o=Math.max(l.y,m[0].y,m[1].y);var n={hxy:l,tail:m,cxy:k},q=d.strokeStyle||w.strokeStyle,t=d.fillStyle||w.strokeStyle,i=d.lineWidth||w.lineWidth;c.paint(h,n,i,q,t,r);return[v,p,u,o]}};jsPlumb.Overlays.PlainArrow=function(c){c=c||{};var b=jsPlumb.extend(c,{foldback:1});jsPlumb.Overlays.Arrow.call(this,b);this.type="PlainArrow"};jsPlumb.Overlays.Diamond=function(d){d=d||{};var b=d.length||40,c=jsPlumb.extend(d,{length:b/2,foldback:2});jsPlumb.Overlays.Arrow.call(this,c);this.type="Diamond"};jsPlumb.Overlays.Label=function(h){this.type="Label";jsPlumb.DOMElementComponent.apply(this,arguments);a.apply(this,arguments);this.labelStyle=h.labelStyle||jsPlumb.Defaults.LabelStyle;this.id=h.id;this.cachedDimensions=null;var d=h.label||"",b=this,e=false,i=document.createElement("div"),f=null;i.style.position="absolute";var c=h._jsPlumb.overlayClass+" "+(b.labelStyle.cssClass?b.labelStyle.cssClass:h.cssClass?h.cssClass:"");i.className=c;jsPlumb.appendElement(i,h.connection.parent);jsPlumb.getId(i);b.attachListeners(i,b);b.canvas=i;var g=b.setVisible;b.setVisible=function(k){g(k);i.style.display=k?"block":"none"};this.getElement=function(){return i};this.cleanup=function(){if(i!=null){jsPlumb.CurrentLibrary.removeElement(i)}};this.setLabel=function(k){d=k;f=null;b.connection.repaint()};this.getLabel=function(){return d};this.paint=function(k,m,l){if(!e){k.appendDisplayElement(i);b.attachListeners(i,k);e=true}i.style.left=(l[0]+m.minx)+"px";i.style.top=(l[1]+m.miny)+"px"};this.getTextDimensions=function(l){if(typeof d=="function"){var k=d(b);i.innerHTML=k.replace(/\r\n/g,"
")}else{if(f==null){f=d;i.innerHTML=f.replace(/\r\n/g,"
")}}var n=jsPlumb.CurrentLibrary.getElementObject(i),m=jsPlumb.CurrentLibrary.getSize(n);return{width:m[0],height:m[1]}};this.computeMaxSize=function(k){var l=b.getTextDimensions(k);return l.width?Math.max(l.width,l.height)*1.5:0};this.draw=function(m,o,n){var q=b.getTextDimensions(m);if(q.width!=null){var p=m.pointOnPath(b.loc),l=p.x-(q.width/2),k=p.y-(q.height/2);b.paint(m,{minx:l,miny:k,td:q,cxy:p},n);return[l,l+q.width,k,k+q.height]}else{return[0,0,0,0]}};this.reattachListeners=function(){if(i){b.reattachListenersForElement(i,b)}}};jsPlumb.Overlays.GuideLines=function(){var b=this;b.length=50;b.lineWidth=5;this.type="GuideLines";a.apply(this,arguments);jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.draw=function(d,k,i){var h=d.pointAlongPathFrom(b.loc,b.length/2),g=d.pointOnPath(b.loc),f=jsPlumb.util.pointOnLine(h,g,b.length),e=jsPlumb.util.perpendicularLineTo(h,f,40),c=jsPlumb.util.perpendicularLineTo(f,h,20);b.paint(d,[h,f,e,c],b.lineWidth,"red",null,i);return[Math.min(h.x,f.x),Math.min(h.y,f.y),Math.max(h.x,f.x),Math.max(h.y,f.y)]};this.computeMaxSize=function(){return 50};this.cleanup=function(){}}})();(function(){var c=function(e,g,d,f){this.m=(f-g)/(d-e);this.b=-1*((this.m*e)-g);this.rectIntersect=function(q,p,s,o){var n=[];var k=(p-this.b)/this.m;if(k>=q&&k<=(q+s)){n.push([k,(this.m*k)+this.b])}var t=(this.m*(q+s))+this.b;if(t>=p&&t<=(p+o)){n.push([(t-this.b)/this.m,t])}var k=((p+o)-this.b)/this.m;if(k>=q&&k<=(q+s)){n.push([k,(this.m*k)+this.b])}var t=(this.m*q)+this.b;if(t>=p&&t<=(p+o)){n.push([(t-this.b)/this.m,t])}if(n.length==2){var m=(n[0][0]+n[1][0])/2,l=(n[0][1]+n[1][1])/2;n.push([m,l]);var i=m<=q+(s/2)?-1:1,r=l<=p+(o/2)?-1:1;n.push([i,r]);return n}return null}},a=function(e,g,d,f){if(e<=d&&f<=g){return 1}else{if(e<=d&&g<=f){return 2}else{if(d<=e&&f>=g){return 3}}}return 4},b=function(g,f,i,e,h,m,l,d,k){if(d<=k){return[g,f]}if(i==1){if(e[3]<=0&&h[3]>=1){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]>=1&&h[2]<=0){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(-1*m),f+(-1*l)]}}}else{if(i==2){if(e[3]>=1&&h[3]<=0){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]>=1&&h[2]<=0){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(1*m),f+(-1*l)]}}}else{if(i==3){if(e[3]>=1&&h[3]<=0){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]<=0&&h[2]>=1){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(-1*m),f+(-1*l)]}}}else{if(i==4){if(e[3]<=0&&h[3]>=1){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]<=0&&h[2]>=1){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(1*m),f+(-1*l)]}}}}}}};jsPlumb.Connectors.StateMachine=function(l){var s=this,n=null,o,m,g,e,p=[],d=l.curviness||10,k=l.margin||5,q=l.proximityLimit||80,f=l.orientation&&l.orientation=="clockwise",i=l.loopbackRadius||25,h=false;this.type="StateMachine";l=l||{};this.compute=function(ab,F,U,G,aa,u,t,S){var O=Math.abs(ab[0]-F[0]),W=Math.abs(ab[1]-F[1]),Q=0.45*O,Z=0.45*W;O*=1.9;W*=1.9;t=t||1;var M=Math.min(ab[0],F[0])-Q,K=Math.min(ab[1],F[1])-Z;if(U.elementId!=G.elementId){h=false;o=ab[0]0&&v<1){v=1-v}var w=(v*2*Math.PI)+(Math.PI/2),u=n[4]+(n[6]*Math.cos(w)),t=n[5]+(n[6]*Math.sin(w));return{x:u,y:t}}else{return jsBezier.pointOnCurve(r(),v)}};this.gradientAtPoint=function(t){if(h){return Math.atan(t*2*Math.PI)}else{return jsBezier.gradientAtPoint(r(),t)}};this.pointAlongPathFrom=function(v,z){if(h){if(v>0&&v<1){v=1-v}var w=2*Math.PI*n[6],y=z/w*2*Math.PI,x=(v*2*Math.PI)-y+(Math.PI/2),u=n[4]+(n[6]*Math.cos(x)),t=n[5]+(n[6]*Math.sin(x));return{x:u,y:t}}return jsBezier.pointAlongCurveFrom(r(),v,z)}};jsPlumb.Connectors.canvas.StateMachine=function(f){f=f||{};var d=this,g=f.drawGuideline||true,e=f.avoidSelector;jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.CanvasConnector.apply(this,arguments);this._paint=function(l){if(l.length==10){d.ctx.beginPath();d.ctx.moveTo(l[4],l[5]);d.ctx.quadraticCurveTo(l[8],l[9],l[6],l[7]);d.ctx.stroke()}else{d.ctx.save();d.ctx.beginPath();var k=0,i=2*Math.PI,h=l[7];d.ctx.arc(l[4],l[5],l[6],0,i,h);d.ctx.stroke();d.ctx.closePath();d.ctx.restore()}};this.createGradient=function(i,h){return h.createLinearGradient(i[4],i[5],i[6],i[7])}};jsPlumb.Connectors.svg.StateMachine=function(){var d=this;jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.SvgConnector.apply(this,arguments);this.getPath=function(e){if(e.length==10){return"M "+e[4]+" "+e[5]+" C "+e[8]+" "+e[9]+" "+e[8]+" "+e[9]+" "+e[6]+" "+e[7]}else{return"M"+(e[8]+4)+" "+e[9]+" A "+e[6]+" "+e[6]+" 0 1,0 "+(e[8]-4)+" "+e[9]}}};jsPlumb.Connectors.vml.StateMachine=function(){jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.VmlConnector.apply(this,arguments);var d=jsPlumb.vml.convertValue;this.getPath=function(k){if(k.length==10){return"m"+d(k[4])+","+d(k[5])+" c"+d(k[8])+","+d(k[9])+","+d(k[8])+","+d(k[9])+","+d(k[6])+","+d(k[7])+" e"}else{var h=d(k[8]-k[6]),g=d(k[9]-(2*k[6])),f=h+d(2*k[6]),e=g+d(2*k[6]),l=h+","+g+","+f+","+e;var i="ar "+l+","+d(k[8])+","+d(k[9])+","+d(k[8])+","+d(k[9])+" e";return i}}}})();(function(){var h={"stroke-linejoin":"joinstyle",joinstyle:"joinstyle",endcap:"endcap",miterlimit:"miterlimit"};if(document.createStyleSheet){document.createStyleSheet().addRule(".jsplumb_vml","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:textbox","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:oval","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:rect","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:stroke","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:shape","behavior:url(#default#VML);position:absolute;");document.namespaces.add("jsplumb","urn:schemas-microsoft-com:vml")}jsPlumb.vml={};var b=1000,c=function(p,q){for(var n in q){p[n]=q[n]}},m=function(n,q,r){r=r||{};var p=document.createElement("jsplumb:"+n);p.className=(r["class"]?r["class"]+" ":"")+"jsplumb_vml";l(p,q);c(p,r);return p},l=function(p,n){p.style.left=n[0]+"px";p.style.top=n[1]+"px";p.style.width=n[2]+"px";p.style.height=n[3]+"px";p.style.position="absolute"},g=jsPlumb.vml.convertValue=function(n){return Math.floor(n*b)},d=function(q,o,p,n){if("transparent"===o){n.setOpacity(p,"0.0")}else{n.setOpacity(p,"1.0")}},f=function(r,n,u){var q={};if(n.strokeStyle){q.stroked="true";var v=jsPlumb.util.convertStyle(n.strokeStyle,true);q.strokecolor=v;d(q,v,"stroke",u);q.strokeweight=n.lineWidth+"px"}else{q.stroked="false"}if(n.fillStyle){q.filled="true";var o=jsPlumb.util.convertStyle(n.fillStyle,true);q.fillcolor=o;d(q,o,"fill",u)}else{q.filled="false"}if(n.dashstyle){if(u.strokeNode==null){u.strokeNode=m("stroke",[0,0,0,0],{dashstyle:n.dashstyle});r.appendChild(u.strokeNode)}else{u.strokeNode.dashstyle=n.dashstyle}}else{if(n["stroke-dasharray"]&&n.lineWidth){var w=n["stroke-dasharray"].indexOf(",")==-1?" ":",",s=n["stroke-dasharray"].split(w),p="";for(var t=0;t0&&B>0&&t=t&&v[2]<=B&&v[3]>=B)){return true}}var z=p.canvas.getContext("2d").getImageData(parseInt(t),parseInt(B),1,1);return z.data[0]!=0||z.data[1]!=0||z.data[2]!=0||z.data[3]!=0}return false};var o=false,n=false,s=null,r=false,q=function(u,t){return u!=null&&i(u,t)};this.mousemove=function(w){var y=m(w),v=f(w),u=document.elementFromPoint(v[0],v[1]),x=q(u,"_jsPlumb_overlay");var t=d==null&&(q(u,"_jsPlumb_endpoint")||q(u,"_jsPlumb_connector"));if(!o&&t&&p._over(w)){o=true;p.fire("mouseenter",p,w);return true}else{if(o&&(!p._over(w)||!t)&&!x){o=false;p.fire("mouseexit",p,w)}}p.fire("mousemove",p,w)};this.click=function(t){if(o&&p._over(t)&&!r){p.fire("click",p,t)}r=false};this.dblclick=function(t){if(o&&p._over(t)&&!r){p.fire("dblclick",p,t)}r=false};this.mousedown=function(t){if(p._over(t)&&!n){n=true;s=l(a(p.canvas));p.fire("mousedown",p,t)}};this.mouseup=function(t){n=false;p.fire("mouseup",p,t)}};var c=function(o){var n=document.createElement("canvas");jsPlumb.appendElement(n,o.parent);n.style.position="absolute";if(o["class"]){n.className=o["class"]}o._jsPlumb.getId(n,o.uuid);if(o.tooltip){n.setAttribute("label",o.tooltip)}return n};var h=jsPlumb.CanvasConnector=function(r){k.apply(this,arguments);var n=function(v,t){o.ctx.save();jsPlumb.extend(o.ctx,t);if(t.gradient){var u=o.createGradient(v,o.ctx);for(var s=0;sq?q=s:sl.location){l.location=0}return i(m,l.location)},nearestPointOnCurve:function(m,l){var n=h(m,l);return{point:a(l,l.length-1,n.location,null,null),location:n.location}},pointOnCurve:c,pointAlongCurveFrom:function(m,l,n){return k(m,l,n).point},perpendicularToCurveAt:function(m,l,n,o){l=k(m,l,null==o?0:o);m=i(m,l.location);o=Math.atan(-1/m);m=n/2*Math.sin(o);n=n/2*Math.cos(o);return[{x:l.point.x+n,y:l.point.y+m},{x:l.point.x-n,y:l.point.y-m}]}}})();