@jhuix/showdowns
Version:
A lib that make markdown to html with some extensions of showdown.js.
7 lines (6 loc) • 30.2 kB
JavaScript
// flowchart.js, v1.12.3
// Copyright (c)2019 Adriano Raiano (adrai).
// Distributed under MIT license
// http://adrai.github.io/flowchart.js
!function(t,i){if("object"==typeof exports&&"object"==typeof module)module.exports=i(require("Raphael"));else if("function"==typeof define&&define.amd)define(["Raphael"],i);else{var e=i("object"==typeof exports?require("Raphael"):t.Raphael);for(var r in e)("object"==typeof exports?exports:t)[r]=e[r]}}(this,function(t){return function(t){function i(r){if(e[r])return e[r].exports;var s=e[r]={exports:{},id:r,loaded:!1};return t[r].call(s.exports,s,s.exports,i),s.loaded=!0,s.exports}var e={};return i.m=t,i.c=e,i.p="",i(0)}([function(t,i,e){e(9);var r=e(4);e(15);var s={parse:r};"undefined"!=typeof window&&(window.flowchart=s),t.exports=s},function(t,i){function e(t,i){if(!t||"function"==typeof t)return i;var r={};for(var s in i)r[s]=i[s];for(s in t)t[s]&&("object"==typeof r[s]?r[s]=e(r[s],t[s]):r[s]=t[s]);return r}function r(t,i){if("function"==typeof Object.create)t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});else{t.super_=i;var e=function(){};e.prototype=i.prototype,t.prototype=new e,t.prototype.constructor=t}}t.exports={defaults:e,inherits:r}},function(t,i,e){function r(t,i,e){this.chart=t,this.group=this.chart.paper.set(),this.symbol=e,this.connectedTo=[],this.symbolType=i.symbolType,this.flowstate=i.flowstate||"future",this.lineStyle=i.lineStyle||{},this.key=i.key||"",this.next_direction=i.next&&i.direction_next?i.direction_next:void 0,this.text=this.chart.paper.text(0,0,i.text),i.key&&(this.text.node.id=i.key+"t"),this.text.node.setAttribute("class",this.getAttr("class")+"t"),this.text.attr({"text-anchor":"start",x:this.getAttr("text-margin"),fill:this.getAttr("font-color"),"font-size":this.getAttr("font-size")});var r=this.getAttr("font"),s=this.getAttr("font-family"),o=this.getAttr("font-weight");r&&this.text.attr({font:r}),s&&this.text.attr({"font-family":s}),o&&this.text.attr({"font-weight":o}),i.link&&this.text.attr("href",i.link),i["function"]&&(this.text.attr({cursor:"pointer"}),this.text.node.addEventListener("click",function(t){window[i["function"]](t,i)},!1)),i.target&&this.text.attr("target",i.target);var n=this.getAttr("maxWidth");if(n){for(var h=i.text.split(" "),a="",l=0,p=h.length;p>l;l++){var y=h[l];this.text.attr("text",a+" "+y),a+=this.text.getBBox().width>n?"\n"+y:" "+y}this.text.attr("text",a.substring(1))}if(this.group.push(this.text),e){var x=this.getAttr("text-margin");e.attr({fill:this.getAttr("fill"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*x,height:this.text.getBBox().height+2*x}),e.node.setAttribute("class",this.getAttr("class")),i.link&&e.attr("href",i.link),i.target&&e.attr("target",i.target),i["function"]&&(e.node.addEventListener("click",function(t){window[i["function"]](t,i)},!1),e.attr({cursor:"pointer"})),i.key&&(e.node.id=i.key),this.group.push(e),e.insertBefore(this.text),this.text.attr({y:e.getBBox().height/2}),this.initialize()}}var s=e(3),o=s.drawLine,n=s.checkLineIntersection;r.prototype.getAttr=function(t){if(this.chart){var i,e=this.chart.options?this.chart.options[t]:void 0,r=this.chart.options.symbols?this.chart.options.symbols[this.symbolType][t]:void 0;return this.chart.options.flowstate&&this.chart.options.flowstate[this.flowstate]&&(i=this.chart.options.flowstate[this.flowstate][t]),i||r||e}},r.prototype.initialize=function(){this.group.transform("t"+this.getAttr("line-width")+","+this.getAttr("line-width")),this.width=this.group.getBBox().width,this.height=this.group.getBBox().height},r.prototype.getCenter=function(){return{x:this.getX()+this.width/2,y:this.getY()+this.height/2}},r.prototype.getX=function(){return this.group.getBBox().x},r.prototype.getY=function(){return this.group.getBBox().y},r.prototype.shiftX=function(t){this.group.transform("t"+(this.getX()+t)+","+this.getY())},r.prototype.setX=function(t){this.group.transform("t"+t+","+this.getY())},r.prototype.shiftY=function(t){this.group.transform("t"+this.getX()+","+(this.getY()+t))},r.prototype.setY=function(t){this.group.transform("t"+this.getX()+","+t)},r.prototype.getTop=function(){var t=this.getY(),i=this.getX()+this.width/2;return{x:i,y:t}},r.prototype.getBottom=function(){var t=this.getY()+this.height,i=this.getX()+this.width/2;return{x:i,y:t}},r.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX();return{x:i,y:t}},r.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.group.getBBox().width;return{x:i,y:t}},r.prototype.render=function(){if(this.next){var t=this,i=this.getAttr("line-length");if("right"===this.next_direction){var e=this.getRight();this.next.isPositioned||(this.next.setY(e.y-this.next.height/2),this.next.shiftX(this.group.getBBox().x+this.width+i),function o(){for(var e,r=!1,s=0,n=t.chart.symbols.length;n>s;s++){e=t.chart.symbols[s];var h=Math.abs(e.getCenter().x-t.next.getCenter().x);if(e.getCenter().y>t.next.getCenter().y&&h<=t.next.width/2){r=!0;break}}if(r){if("end"===t.next.symbolType)return;t.next.setX(e.getX()+e.width+i),o()}}(),this.next.isPositioned=!0,this.next.render())}else if("left"===this.next_direction){var r=this.getLeft();this.next.isPositioned||(this.next.setY(r.y-this.next.height/2),this.next.shiftX(-(this.group.getBBox().x+this.width+i)),function n(){for(var e,r=!1,s=0,o=t.chart.symbols.length;o>s;s++){e=t.chart.symbols[s];var h=Math.abs(e.getCenter().x-t.next.getCenter().x);if(e.getCenter().y>t.next.getCenter().y&&h<=t.next.width/2){r=!0;break}}if(r){if("end"===t.next.symbolType)return;t.next.setX(e.getX()+e.width+i),n()}}(),this.next.isPositioned=!0,this.next.render())}else{var s=this.getBottom();this.next.isPositioned||(this.next.shiftY(this.getY()+this.height+i),this.next.setX(s.x-this.next.width/2),this.next.isPositioned=!0,this.next.render())}}},r.prototype.renderLines=function(){this.next&&(this.next_direction?this.drawLineTo(this.next,this.getAttr("arrow-text")||"",this.next_direction):this.drawLineTo(this.next,this.getAttr("arrow-text")||""))},r.prototype.drawLineTo=function(t,i,e){this.connectedTo.indexOf(t)<0&&this.connectedTo.push(t);var r,s=this.getCenter().x,h=this.getCenter().y,a=this.getRight(),l=this.getBottom(),p=this.getTop(),y=this.getLeft(),x=t.getCenter().x,c=t.getCenter().y,g=t.getTop(),f=t.getRight(),d=t.getLeft(),m=s===x,u=h===c,b=c>h,_=h>c||this===t,v=s>x,w=x>s,k=0,B=this.getAttr("line-length"),A=this.getAttr("line-width");if(e&&"bottom"!==e||!m||!b)if(e&&"right"!==e||!u||!w)if(e&&"left"!==e||!u||!v)if(e&&"right"!==e||!m||!_)if(e&&"right"!==e||!m||!b)if(e&&"bottom"!==e||!v)if(e&&"bottom"!==e||!w||!b)if(e&&"bottom"!==e||!w)if(e&&"right"===e&&v)r=o(this.chart,a,[{x:a.x+B/2,y:a.y},{x:a.x+B/2,y:g.y-B/2},{x:g.x,y:g.y-B/2},{x:g.x,y:g.y}],i),this.rightStart=!0,t.topEnd=!0,k=a.x+B/2;else if(e&&"right"===e&&w)r=o(this.chart,a,[{x:g.x,y:a.y},{x:g.x,y:g.y}],i),this.rightStart=!0,t.topEnd=!0,k=a.x+B/2;else if(e&&"bottom"===e&&m&&_)r=o(this.chart,l,[{x:l.x,y:l.y+B/2},{x:a.x+B/2,y:l.y+B/2},{x:a.x+B/2,y:g.y-B/2},{x:g.x,y:g.y-B/2},{x:g.x,y:g.y}],i),this.bottomStart=!0,t.topEnd=!0,k=l.x+B/2;else if("left"===e&&m&&_){var O=y.x-B/2;d.x<y.x&&(O=d.x-B/2),r=o(this.chart,y,[{x:O,y:y.y},{x:O,y:g.y-B/2},{x:g.x,y:g.y-B/2},{x:g.x,y:g.y}],i),this.leftStart=!0,t.topEnd=!0,k=y.x}else"left"===e?(r=o(this.chart,y,[{x:g.x+(y.x-g.x)/2,y:y.y},{x:g.x+(y.x-g.x)/2,y:g.y-B/2},{x:g.x,y:g.y-B/2},{x:g.x,y:g.y}],i),this.leftStart=!0,t.topEnd=!0,k=y.x):"top"===e&&(r=o(this.chart,p,[{x:p.x,y:g.y-B/2},{x:g.x,y:g.y-B/2},{x:g.x,y:g.y}],i),this.topStart=!0,t.topEnd=!0,k=p.x);else r=o(this.chart,l,[{x:l.x,y:l.y+B/2},{x:l.x+(l.x-g.x)/2,y:l.y+B/2},{x:l.x+(l.x-g.x)/2,y:g.y-B/2},{x:g.x,y:g.y-B/2},{x:g.x,y:g.y}],i),this.bottomStart=!0,t.topEnd=!0,k=l.x+(l.x-g.x)/2;else r=o(this.chart,l,[{x:l.x,y:g.y-B/2},{x:g.x,y:g.y-B/2},{x:g.x,y:g.y}],i),this.bottomStart=!0,t.topEnd=!0,k=l.x,g.x>k&&(k=g.x);else r=this.leftEnd&&_?o(this.chart,l,[{x:l.x,y:l.y+B/2},{x:l.x+(l.x-g.x)/2,y:l.y+B/2},{x:l.x+(l.x-g.x)/2,y:g.y-B/2},{x:g.x,y:g.y-B/2},{x:g.x,y:g.y}],i):o(this.chart,l,[{x:l.x,y:g.y-B/2},{x:g.x,y:g.y-B/2},{x:g.x,y:g.y}],i),this.bottomStart=!0,t.topEnd=!0,k=l.x+(l.x-g.x)/2;else r=o(this.chart,a,[{x:a.x+B/2,y:a.y},{x:a.x+B/2,y:g.y-B/2},{x:g.x,y:g.y-B/2},{x:g.x,y:g.y}],i),this.rightStart=!0,t.topEnd=!0,k=a.x+B/2;else r=o(this.chart,a,[{x:a.x+B/2,y:a.y},{x:a.x+B/2,y:g.y-B/2},{x:g.x,y:g.y-B/2},{x:g.x,y:g.y}],i),this.rightStart=!0,t.topEnd=!0,k=a.x+B/2;else r=o(this.chart,y,f,i),this.leftStart=!0,t.rightEnd=!0,k=f.x;else r=o(this.chart,a,d,i),this.rightStart=!0,t.leftEnd=!0,k=d.x;else r=o(this.chart,l,g,i),this.bottomStart=!0,t.topEnd=!0,k=l.x;if(this.lineStyle[t.key]&&r&&r.attr(this.lineStyle[t.key]),r){for(var X=0,L=this.chart.lines.length;L>X;X++)for(var T=this.chart.lines[X],M=T.attr("path"),S=r.attr("path"),C=0,Y=M.length-1;Y>C;C++){var P=[];P.push(["M",M[C][1],M[C][2]]),P.push(["L",M[C+1][1],M[C+1][2]]);for(var j=P[0][1],E=P[0][2],z=P[1][1],F=P[1][2],R=0,$=S.length-1;$>R;R++){var N=[];N.push(["M",S[R][1],S[R][2]]),N.push(["L",S[R+1][1],S[R+1][2]]);var V=N[0][1],G=N[0][2],I=N[1][1],W=N[1][2],Q=n(j,E,z,F,V,G,I,W);if(Q.onLine1&&Q.onLine2){var q;G===W?V>I?(q=["L",Q.x+2*A,G],S.splice(R+1,0,q),q=["C",Q.x+2*A,G,Q.x,G-4*A,Q.x-2*A,G],S.splice(R+2,0,q),r.attr("path",S)):(q=["L",Q.x-2*A,G],S.splice(R+1,0,q),q=["C",Q.x-2*A,G,Q.x,G-4*A,Q.x+2*A,G],S.splice(R+2,0,q),r.attr("path",S)):G>W?(q=["L",V,Q.y+2*A],S.splice(R+1,0,q),q=["C",V,Q.y+2*A,V+4*A,Q.y,V,Q.y-2*A],S.splice(R+2,0,q),r.attr("path",S)):(q=["L",V,Q.y-2*A],S.splice(R+1,0,q),q=["C",V,Q.y-2*A,V+4*A,Q.y,V,Q.y+2*A],S.splice(R+2,0,q),r.attr("path",S)),R+=2}}}this.chart.lines.push(r),(void 0===this.chart.minXFromSymbols||this.chart.minXFromSymbols>y.x)&&(this.chart.minXFromSymbols=y.x)}(!this.chart.maxXFromLine||this.chart.maxXFromLine&&k>this.chart.maxXFromLine)&&(this.chart.maxXFromLine=k)},t.exports=r},function(t,i){function e(t,i,e){var r,s,o="M{0},{1}";for(r=2,s=2*e.length+2;s>r;r+=2)o+=" L{"+r+"},{"+(r+1)+"}";var n=[i.x,i.y];for(r=0,s=e.length;s>r;r++)n.push(e[r].x),n.push(e[r].y);var h=t.paper.path(o,n);h.attr("stroke",t.options["element-color"]),h.attr("stroke-width",t.options["line-width"]);var a=t.options.font,l=t.options["font-family"],p=t.options["font-weight"];return a&&h.attr({font:a}),l&&h.attr({"font-family":l}),p&&h.attr({"font-weight":p}),h}function r(t,i,e,r){var s,o;"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]);var n="M{0},{1}";for(s=2,o=2*e.length+2;o>s;s+=2)n+=" L{"+s+"},{"+(s+1)+"}";var h=[i.x,i.y];for(s=0,o=e.length;o>s;s++)h.push(e[s].x),h.push(e[s].y);var a=t.paper.path(n,h);a.attr({stroke:t.options["line-color"],"stroke-width":t.options["line-width"],"arrow-end":t.options["arrow-end"]});var l=t.options.font,p=t.options["font-family"],y=t.options["font-weight"];if(l&&a.attr({font:l}),p&&a.attr({"font-family":p}),y&&a.attr({"font-weight":y}),r){var x=!1,c=t.paper.text(0,0,r),g=!1,f=e[0];i.y===f.y&&(g=!0);var d=0,m=0;x?(d=i.x>f.x?i.x-(i.x-f.x)/2:f.x-(f.x-i.x)/2,m=i.y>f.y?i.y-(i.y-f.y)/2:f.y-(f.y-i.y)/2,g?(d-=c.getBBox().width/2,m-=t.options["text-margin"]):(d+=t.options["text-margin"],m-=c.getBBox().height/2)):(d=i.x,m=i.y,g?(d+=t.options["text-margin"]/2,m-=t.options["text-margin"]):(d+=t.options["text-margin"]/2,m+=t.options["text-margin"],i.y>f.y&&(m-=2*t.options["text-margin"]))),c.attr({"text-anchor":"start","font-size":t.options["font-size"],fill:t.options["font-color"],x:d,y:m}),l&&c.attr({font:l}),p&&c.attr({"font-family":p}),y&&c.attr({"font-weight":y})}return a}function s(t,i,e,r,s,o,n,h){var a,l,p,y,x,c={x:null,y:null,onLine1:!1,onLine2:!1};return a=(h-o)*(e-t)-(n-s)*(r-i),0===a?c:(l=i-o,p=t-s,y=(n-s)*l-(h-o)*p,x=(e-t)*l-(r-i)*p,l=y/a,p=x/a,c.x=t+l*(e-t),c.y=i+l*(r-i),l>0&&1>l&&(c.onLine1=!0),p>0&&1>p&&(c.onLine2=!0),c)}t.exports={drawPath:e,drawLine:r,checkLineIntersection:s}},function(t,i,e){function r(t){function i(t){var i=t.indexOf("(")+1,e=t.indexOf(")");return i>=0&&e>=0?t.substring(i,e):"{}"}function e(t){var i=t.indexOf("(")+1,e=t.indexOf(")");return i>=0&&e>=0?t.substring(i,e):""}function r(t){var i=t.indexOf("(")+1,e=t.indexOf(")");return i>=0&&e>=0?c.symbols[t.substring(0,i-1)]:c.symbols[t]}function x(t){var i="next",e=t.indexOf("(")+1,r=t.indexOf(")");return e>=0&&r>=0&&(i=E.substring(e,r),i.indexOf(",")<0&&"yes"!==i&&"no"!==i&&(i="next, "+i)),i}t=t||"",t=t.trim();for(var c={symbols:{},start:null,drawSVG:function(t,i){function e(t){if(c[t.key])return c[t.key];switch(t.symbolType){case"start":c[t.key]=new o(x,t);break;case"end":c[t.key]=new n(x,t);break;case"operation":c[t.key]=new h(x,t);break;case"inputoutput":c[t.key]=new a(x,t);break;case"subroutine":c[t.key]=new l(x,t);break;case"condition":c[t.key]=new p(x,t);break;case"parallel":c[t.key]=new y(x,t);break;default:return new Error("Wrong symbol type!")}return c[t.key]}var r=this;this.diagram&&this.diagram.clean();var x=new s(t,i);this.diagram=x;var c={};!function g(t,i,s){var o=e(t);return r.start===t?x.startWith(o):i&&s&&!i.pathOk&&(i instanceof p?(s.yes===t&&i.yes(o),s.no===t&&i.no(o)):i instanceof y?(s.path1===t&&i.path1(o),s.path2===t&&i.path2(o),s.path3===t&&i.path3(o)):i.then(o)),o.pathOk?o:(o instanceof p?(t.yes&&g(t.yes,o,t),t.no&&g(t.no,o,t)):o instanceof y?(t.path1&&g(t.path1,o,t),t.path2&&g(t.path2,o,t),t.path3&&g(t.path3,o,t)):t.next&&g(t.next,o,t),o)}(this.start),x.render()},clean:function(){this.diagram.clean()},options:function(){return this.diagram.options}},g=[],f=0,d=1,m=t.length;m>d;d++)if("\n"===t[d]&&"\\"!==t[d-1]){var u=t.substring(f,d);f=d+1,g.push(u.replace(/\\\n/g,"\n"))}f<t.length&&g.push(t.substr(f));for(var b=1,_=g.length;_>b;){var v=g[b];v.indexOf("->")<0&&v.indexOf("=>")<0&&v.indexOf("@>")<0?(g[b-1]+="\n"+v,g.splice(b,1),_--):b++}for(;g.length>0;){var w=g.splice(0,1)[0].trim();if(w.indexOf("=>")>=0){var k=w.split("=>"),B={key:k[0].replace(/\(.*\)/,""),symbolType:k[1],text:null,link:null,target:null,flowstate:null,"function":null,lineStyle:{},params:{}},A=k[0].match(/\((.*)\)/);if(A&&A.length>1)for(var O=A[1].split(","),X=0;X<O.length;X++){var L=O[X].split("=");2==L.length&&(B.params[L[0]]=L[1])}var T;if(B.symbolType.indexOf(": ")>=0&&(T=B.symbolType.split(": "),B.symbolType=T.shift(),B.text=T.join(": ")),B.text&&B.text.indexOf(":$")>=0?(T=B.text.split(":$"),B.text=T.shift(),B["function"]=T.join(":$")):B.symbolType.indexOf(":$")>=0?(T=B.symbolType.split(":$"),B.symbolType=T.shift(),B["function"]=T.join(":$")):B.text&&B.text.indexOf(":>")>=0?(T=B.text.split(":>"),B.text=T.shift(),B.link=T.join(":>")):B.symbolType.indexOf(":>")>=0&&(T=B.symbolType.split(":>"),B.symbolType=T.shift(),B.link=T.join(":>")),B.symbolType.indexOf("\n")>=0&&(B.symbolType=B.symbolType.split("\n")[0]),B.link){var M=B.link.indexOf("[")+1,S=B.link.indexOf("]");M>=0&&S>=0&&(B.target=B.link.substring(M,S),B.link=B.link.substring(0,M-1))}if(B.text&&B.text.indexOf("|")>=0){var C=B.text.split("|");B.flowstate=C.pop().trim(),B.text=C.join("|")}c.symbols[B.key]=B}else if(w.indexOf("->")>=0)for(var Y=w.split("->"),P=0,j=Y.length;j>P;P++){var E=Y[P],z=e(E);("true"===z||"false"===z)&&(E=E.replace("true","yes"),E=E.replace("false","no"));var F=r(E),R=x(E),$=null;if(R.indexOf(",")>=0){var N=R.split(",");R=N[0],$=N[1].trim()}if(c.start||(c.start=F),j>P+1){var V=Y[P+1];F[R]=r(V),F["direction_"+R]=$,$=null}}else if(w.indexOf("@>")>=0)for(var G=w.split("@>"),I=0,W=G.length;W>I;I++)if(I+1!==W){var Q=r(G[I]),q=r(G[I+1]);Q.lineStyle[q.key]=JSON.parse(i(G[I+1]))}}return c}var s=e(7),o=e(13),n=e(10),h=e(12),a=e(11),l=e(14),p=e(5),y=e(6);t.exports=r},function(t,i,e){function r(t,i){i=i||{},s.call(this,t,i),this.textMargin=this.getAttr("text-margin"),this.yes_direction="bottom",this.no_direction="right",this.params=i.params,i.yes&&i.direction_yes&&i.no&&!i.direction_no?"right"===i.direction_yes?(this.no_direction="bottom",this.yes_direction="right"):"top"===i.direction_yes?(this.no_direction="right",this.yes_direction="top"):(this.no_direction="right",this.yes_direction="bottom"):i.yes&&!i.direction_yes&&i.no&&i.direction_no?"right"===i.direction_no?(this.yes_direction="bottom",this.no_direction="right"):(this.yes_direction="right",this.no_direction="bottom"):i.yes&&i.direction_yes&&i.no&&i.direction_no&&i.direction_no!==i.direction_yes?"right"===i.direction_yes?(this.no_direction="bottom",this.yes_direction="right"):"top"===i.direction_yes?(this.no_direction="right",this.yes_direction="top"):(this.no_direction="right",this.yes_direction="bottom"):(this.yes_direction="bottom",this.no_direction="right"),this.yes_direction=this.yes_direction||"bottom",this.no_direction=this.no_direction||"right",this.text.attr({x:2*this.textMargin});var e=this.text.getBBox().width+3*this.textMargin;e+=e/2;var r=this.text.getBBox().height+2*this.textMargin;r+=r/2,r=Math.max(.5*e,r);var o=e/4,n=r/4;this.text.attr({x:o+this.textMargin/2});var a={x:o,y:n},l=[{x:o-e/4,y:n+r/4},{x:o-e/4+e/2,y:n+r/4+r/2},{x:o-e/4+e,y:n+r/4},{x:o-e/4+e/2,y:n+r/4-r/2},{x:o-e/4,y:n+r/4}],p=h(t,a,l);p.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),i.link&&p.attr("href",i.link),i.target&&p.attr("target",i.target),i.key&&(p.node.id=i.key),p.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:p.getBBox().height/2}),this.group.push(p),p.insertBefore(this.text),this.initialize()}var s=e(2),o=e(1).inherits,n=e(3),h=n.drawPath;o(r,s),r.prototype.render=function(){this.yes_direction&&(this[this.yes_direction+"_symbol"]=this.yes_symbol),this.no_direction&&(this[this.no_direction+"_symbol"]=this.no_symbol);var t=this.getAttr("line-length");if(this.bottom_symbol){var i=this.getBottom();this.bottom_symbol.isPositioned||(this.bottom_symbol.shiftY(this.getY()+this.height+t),this.bottom_symbol.setX(i.x-this.bottom_symbol.width/2),this.bottom_symbol.isPositioned=!0,this.bottom_symbol.render())}if(this.right_symbol){var e=this.getRight();if(!this.right_symbol.isPositioned){this.right_symbol.setY(e.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+t);var r=this;!function s(){for(var i,e=!1,o=0,n=r.chart.symbols.length;n>o;o++)if(i=r.chart.symbols[o],!r.params["align-next"]||"no"!==r.params["align-next"]){var h=Math.abs(i.getCenter().x-r.right_symbol.getCenter().x);if(i.getCenter().y>r.right_symbol.getCenter().y&&h<=r.right_symbol.width/2){e=!0;break}}if(e){if("end"===r.right_symbol.symbolType)return;r.right_symbol.setX(i.getX()+i.width+t),s()}}(),this.right_symbol.isPositioned=!0,this.right_symbol.render()}}},r.prototype.renderLines=function(){this.yes_symbol&&this.drawLineTo(this.yes_symbol,this.getAttr("yes-text"),this.yes_direction),this.no_symbol&&this.drawLineTo(this.no_symbol,this.getAttr("no-text"),this.no_direction)},t.exports=r},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0);i=i||{},s.call(this,t,i,e),this.textMargin=this.getAttr("text-margin"),this.path1_direction="bottom",this.path2_direction="right",this.path3_direction="top",this.params=i.params,"path1"===i.direction_next&&!i[i.direction_next]&&i.next&&(i[i.direction_next]=i.next),"path2"===i.direction_next&&!i[i.direction_next]&&i.next&&(i[i.direction_next]=i.next),"path3"===i.direction_next&&!i[i.direction_next]&&i.next&&(i[i.direction_next]=i.next),i.path1&&i.direction_path1&&i.path2&&!i.direction_path2&&i.path3&&!i.direction_path3?"right"===i.direction_path1?(this.path2_direction="bottom",this.path1_direction="right",this.path3_direction="top"):"top"===i.direction_path1?(this.path2_direction="right",this.path1_direction="top",this.path3_direction="bottom"):"left"===i.direction_path1?(this.path2_direction="right",this.path1_direction="left",this.path3_direction="bottom"):(this.path2_direction="right",this.path1_direction="bottom",this.path3_direction="top"):i.path1&&!i.direction_path1&&i.path2&&i.direction_path2&&i.path3&&!i.direction_path3?"right"===i.direction_path2?(this.path1_direction="bottom",this.path2_direction="right",this.path3_direction="top"):"left"===i.direction_path2?(this.path1_direction="bottom",this.path2_direction="left",this.path3_direction="right"):(this.path1_direction="right",this.path2_direction="bottom",this.path3_direction="top"):i.path1&&!i.direction_path1&&i.path2&&!i.direction_path2&&i.path3&&i.direction_path3?"right"===i.direction_path2?(this.path1_direction="bottom",this.path2_direction="top",this.path3_direction="right"):"left"===i.direction_path2?(this.path1_direction="bottom",this.path2_direction="right",this.path3_direction="left"):(this.path1_direction="right",this.path2_direction="bottom",this.path3_direction="top"):(this.path1_direction=i.direction_path1,this.path2_direction=i.direction_path2,this.path3_direction=i.direction_path3),this.path1_direction=this.path1_direction||"bottom",this.path2_direction=this.path2_direction||"right",this.path3_direction=this.path3_direction||"top",this.initialize()}var s=e(2),o=e(1).inherits;o(r,s),r.prototype.render=function(){this.path1_direction&&(this[this.path1_direction+"_symbol"]=this.path1_symbol),this.path2_direction&&(this[this.path2_direction+"_symbol"]=this.path2_symbol),this.path3_direction&&(this[this.path3_direction+"_symbol"]=this.path3_symbol);var t=this.getAttr("line-length");if(this.bottom_symbol){var i=this.getBottom();this.bottom_symbol.isPositioned||(this.bottom_symbol.shiftY(this.getY()+this.height+t),this.bottom_symbol.setX(i.x-this.bottom_symbol.width/2),this.bottom_symbol.isPositioned=!0,this.bottom_symbol.render())}if(this.top_symbol){var e=this.getTop();this.top_symbol.isPositioned||(this.top_symbol.shiftY(this.getY()-this.top_symbol.height-t),this.top_symbol.setX(e.x+this.top_symbol.width),this.top_symbol.isPositioned=!0,this.top_symbol.render())}var r=this;if(this.left_symbol){var s=this.getLeft();this.left_symbol.isPositioned||(this.left_symbol.setY(s.y-this.left_symbol.height/2),this.left_symbol.shiftX(-(this.group.getBBox().x+this.width+t)),function n(){for(var i,e=!1,s=0,o=r.chart.symbols.length;o>s;s++)if(i=r.chart.symbols[s],!r.params["align-next"]||"no"!==r.params["align-next"]){var h=Math.abs(i.getCenter().x-r.left_symbol.getCenter().x);if(i.getCenter().y>r.left_symbol.getCenter().y&&h<=r.left_symbol.width/2){e=!0;break}}if(e){if("end"===r.left_symbol.symbolType)return;r.left_symbol.setX(i.getX()+i.width+t),n()}}(),this.left_symbol.isPositioned=!0,this.left_symbol.render())}if(this.right_symbol){var o=this.getRight();this.right_symbol.isPositioned||(this.right_symbol.setY(o.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+t),function h(){for(var i,e=!1,s=0,o=r.chart.symbols.length;o>s;s++)if(i=r.chart.symbols[s],!r.params["align-next"]||"no"!==r.params["align-next"]){var n=Math.abs(i.getCenter().x-r.right_symbol.getCenter().x);if(i.getCenter().y>r.right_symbol.getCenter().y&&n<=r.right_symbol.width/2){e=!0;break}}if(e){if("end"===r.right_symbol.symbolType)return;r.right_symbol.setX(i.getX()+i.width+t),h()}}(),this.right_symbol.isPositioned=!0,this.right_symbol.render())}},r.prototype.renderLines=function(){this.path1_symbol&&this.drawLineTo(this.path1_symbol,"",this.path1_direction),this.path2_symbol&&this.drawLineTo(this.path2_symbol,"",this.path2_direction),this.path3_symbol&&this.drawLineTo(this.path3_symbol,"",this.path3_direction)},t.exports=r},function(t,i,e){function r(t,i){i=i||{},this.paper=new s(t),this.options=o(i,n),this.symbols=[],this.lines=[],this.start=null}var s=e(16),o=e(1).defaults,n=e(8),h=e(5),a=e(6);r.prototype.handle=function(t){this.symbols.indexOf(t)<=-1&&this.symbols.push(t);var i=this;return t instanceof h?(t.yes=function(e){return t.yes_symbol=e,t.no_symbol&&(t.pathOk=!0),i.handle(e)},t.no=function(e){return t.no_symbol=e,t.yes_symbol&&(t.pathOk=!0),i.handle(e)}):t instanceof a?(t.path1=function(e){return t.path1_symbol=e,t.path2_symbol&&(t.pathOk=!0),i.handle(e)},t.path2=function(e){return t.path2_symbol=e,t.path3_symbol&&(t.pathOk=!0),i.handle(e)},t.path3=function(e){return t.path3_symbol=e,t.path1_symbol&&(t.pathOk=!0),i.handle(e)}):t.then=function(e){return t.next=e,t.pathOk=!0,i.handle(e)},t},r.prototype.startWith=function(t){return this.start=t,this.handle(t)},r.prototype.render=function(){var t,i,e=0,r=0,s=0,o=0,n=0,h=0,a=0,l=0;for(s=0,o=this.symbols.length;o>s;s++)t=this.symbols[s],t.width>e&&(e=t.width),t.height>r&&(r=t.height);for(s=0,o=this.symbols.length;o>s;s++)t=this.symbols[s],t.shiftX(this.options.x+(e-t.width)/2+this.options["line-width"]),t.shiftY(this.options.y+(r-t.height)/2+this.options["line-width"]);for(this.start.render(),s=0,o=this.symbols.length;o>s;s++)t=this.symbols[s],t.renderLines();n=this.maxXFromLine;var p,y;for(s=0,o=this.symbols.length;o>s;s++)t=this.symbols[s],p=t.getX()+t.width,y=t.getY()+t.height,p>n&&(n=p),y>h&&(h=y);for(s=0,o=this.lines.length;o>s;s++){i=this.lines[s].getBBox(),p=i.x,y=i.y;var x=i.x2,c=i.y2;a>p&&(a=p),l>y&&(l=y),x>n&&(n=x),c>h&&(h=c)}var g=this.options.scale,f=this.options["line-width"];this.minXFromSymbols<a&&(a=this.minXFromSymbols),0>a&&(a-=f),0>l&&(l-=f);var d=n+f-a,m=h+f-l;this.paper.setSize(d*g,m*g),this.paper.setViewBox(a,l,d,m,!0)},r.prototype.clean=function(){if(this.paper){var t=this.paper.canvas;t.parentNode&&t.parentNode.removeChild(t)}},t.exports=r},function(t,i){t.exports={x:0,y:0,"line-width":3,"line-length":50,"text-margin":10,"font-size":14,"font-color":"black","line-color":"black","element-color":"black",fill:"white","yes-text":"yes","no-text":"no","arrow-end":"block","class":"flowchart",scale:1,symbols:{start:{},end:{},condition:{},inputoutput:{},operation:{},subroutine:{},parallel:{}}}},function(t,i){Array.prototype.indexOf||(Array.prototype.indexOf=function(t){"use strict";if(null===this)throw new TypeError;var i=Object(this),e=i.length>>>0;if(0===e)return-1;var r=0;if(arguments.length>0&&(r=Number(arguments[1]),r!=r?r=0:0!==r&&r!=1/0&&r!=-(1/0)&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=e)return-1;for(var s=r>=0?r:Math.max(e-Math.abs(r),0);e>s;s++)if(s in i&&i[s]===t)return s;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(t){"use strict";if(null===this)throw new TypeError;var i=Object(this),e=i.length>>>0;if(0===e)return-1;var r=e;arguments.length>1&&(r=Number(arguments[1]),r!=r?r=0:0!==r&&r!=1/0&&r!=-(1/0)&&(r=(r>0||-1)*Math.floor(Math.abs(r))));for(var s=r>=0?Math.min(r,e-1):e-Math.abs(r);s>=0;s--)if(s in i&&i[s]===t)return s;return-1}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")})},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0,20);i=i||{},i.text=i.text||"End",s.call(this,t,i,e)}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){function r(t,i){i=i||{},s.call(this,t,i),this.textMargin=this.getAttr("text-margin"),this.text.attr({x:3*this.textMargin});var e=this.text.getBBox().width+4*this.textMargin,r=this.text.getBBox().height+2*this.textMargin,o=this.textMargin,n=r/2,a={x:o,y:n},l=[{x:o-this.textMargin,y:r},{x:o-this.textMargin+e,y:r},{x:o-this.textMargin+e+2*this.textMargin,y:0},{x:o-this.textMargin+2*this.textMargin,y:0},{x:o,y:n}],p=h(t,a,l);p.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),i.link&&p.attr("href",i.link),i.target&&p.attr("target",i.target),i.key&&(p.node.id=i.key),p.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:p.getBBox().height/2}),this.group.push(p),p.insertBefore(this.text),this.initialize()}var s=e(2),o=e(1).inherits,n=e(3),h=n.drawPath;o(r,s),r.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.textMargin;return{x:i,y:t}},r.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.group.getBBox().width-this.textMargin;return{x:i,y:t}},t.exports=r},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0);i=i||{},s.call(this,t,i,e)}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0,20);i=i||{},i.text=i.text||"Start",s.call(this,t,i,e)}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0);i=i||{},s.call(this,t,i,e),e.attr({width:this.text.getBBox().width+4*this.getAttr("text-margin")}),this.text.attr({x:2*this.getAttr("text-margin")});var r=t.paper.rect(0,0,0,0);r.attr({x:this.getAttr("text-margin"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*this.getAttr("text-margin"),height:this.text.getBBox().height+2*this.getAttr("text-margin"),fill:this.getAttr("fill")}),i.key&&(r.node.id=i.key+"i");var o=this.getAttr("font"),n=this.getAttr("font-family"),h=this.getAttr("font-weight");o&&r.attr({font:o}),n&&r.attr({"font-family":n}),h&&r.attr({"font-weight":h}),i.link&&r.attr("href",i.link),i.target&&r.attr("target",i.target),this.group.push(r),r.insertBefore(this.text),this.initialize()}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){if("undefined"!=typeof jQuery){var r=e(4);!function(t){function i(t,i){return t==i||Array.isArray(i)&&(i.includes(t)||i.includes(Number(t)))}var e={init:function(i){return this.each(function(){var e=t(this);this.chart=r(e.text()),e.html(""),this.chart.drawSVG(this,i)})},setFlowStateByParam:function(t,e,r){return this.each(function(){var s=this.chart,o=["next","yes","no","path1","path2","path3"];for(var n in s.symbols)if(s.symbols.hasOwnProperty(n)){var h=s.symbols[n],a=h.params[t];if(i(a,e)){h.flowstate=r;for(var l=0;l<o.length;l++){var p=o[l];h[p]&&h[p].params&&h[p].params[t]&&i(h[p].params[t],e)&&(h.lineStyle[h[p].key]={stroke:s.options().flowstate[r].fill})}}}s.clean(),s.drawSVG(this)})},clearFlowState:function(){return this.each(function(){var t=this.chart;for(var i in t.symbols)if(t.symbols.hasOwnProperty(i)){var e=t.symbols[i];e.flowstate=""}t.clean(),t.drawSVG(this)})}};t.fn.flowChart=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.flowChart"):e.init.apply(this,arguments)}}(jQuery)}},function(i,e){i.exports=t}])});
//# sourceMappingURL=flowchart.min.js.map