@jhuix/showdowns 0.6.19 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -232,6 +232,10 @@ Table header can be eliminated.
232
232
 
233
233
  [Container](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#container)
234
234
 
235
+ [CSS defined](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#css-defined)
236
+
237
+ [Inline Image](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#inline-image)
238
+
235
239
  [Table of Contents](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#table-of-contents)
236
240
 
237
241
  [LaTeX math and AsciiMath](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#latex-math-and-asciimath)
@@ -262,6 +266,10 @@ Table header can be eliminated.
262
266
 
263
267
  [Plotly](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#plotly)
264
268
 
269
+ [AntV Infographic](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#antv-infographic)
270
+
271
+ [ZenUML](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#zenuml)
272
+
265
273
  See more information, refer to the following document:
266
274
 
267
275
  [Extensions Examples](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md)
@@ -552,6 +560,7 @@ Default extensions is described below:
552
560
 
553
561
  defaultExtensions = {
554
562
  'showdown-toc': showdownToc(options.toc),
563
+ 'showdown-image': showdownImage(),
555
564
  'showdown-align': showdownAlign(),
556
565
  'showdown-footnotes': showdownFootnotes(),
557
566
  'showdown-container': showdownContainer(),
@@ -570,6 +579,7 @@ Default async extensions is described below:
570
579
 
571
580
  defaultAsyncExtensions = {
572
581
  'showdown-toc': getExtension('showdown-toc', showdownToc),
582
+ 'showdown-image': showdownAsyncImage(),
573
583
  'showdown-plantuml': showdownPlantuml(plantumlOptions),
574
584
  'showdown-mermaid': showdownMermaid(mermaidOptions),
575
585
  'showdown-mathjax': showdownMathJax(mathjaxOptions),
@@ -584,6 +594,7 @@ Default async extensions is described below:
584
594
  'showdown-abc': showdownAbc(),
585
595
  'showdown-echarts': showdownEcharts(),
586
596
  'showdown-gnuplot': showdownShiki(gnuplotOptions),
597
+ 'showdown-antv': showdownAntV(),
587
598
  'showdown-sequence': getExtension('showdown-sequence', showdownSequence),
588
599
  'showdown-shiki': showdownShiki(shikiOptions),
589
600
  'showdow-css': showdownCss(),
@@ -607,8 +618,28 @@ Default: null
607
618
 
608
619
  Output showdown.convertor native object in current showdowns Instance.
609
620
 
621
+ #### eventBus
622
+
623
+ Type: EventBus
624
+
625
+ Default: EventBus
626
+
627
+ A internal event bus object, its method is as follows:
628
+
629
+ - on(event: string, callback: (...args: any[]) => any) -- Register event method
630
+ - off(event: string, callback: (...args: any[]) => any) -- Close event method
631
+ - emit(event: string, ...data: ...any[]) => number -- Emit event method
632
+
610
633
  ### Methods
611
634
 
635
+ #### onEvent
636
+
637
+ Type: {event: string, callback: (...args: any[]) => any} => void
638
+
639
+ Register event to showdowns engine. Currently supporting the following events:
640
+
641
+ - 'resetImagePath': (id: string, src: string, callback: (imagePath: string) => void) -- Reset image path event for inline image
642
+
612
643
  #### setFlavor
613
644
 
614
645
  Type: {name: string} => void
@@ -748,15 +779,21 @@ A function to init that be created showdown.convertor instance or update default
748
779
  #### makeHtml
749
780
 
750
781
  Type: interface script {
751
- outer?:[
752
- {name:string, src:string, module?:boolean|'import'|'link'}
753
- ],
782
+ outer?:[{
783
+ name:string,
784
+ src:string,
785
+ module?:boolean|'import'|'link'
786
+ }],
754
787
  id?:string,
755
788
  code?:string,
756
789
  module?:boolean,
757
- inner?:[
758
- {id:string, code:string, module?:boolean}
759
- ]
790
+ host?:string | HTMLElement
791
+ inner?:[{
792
+ id:string,
793
+ code:string,
794
+ module?:boolean,
795
+ host?:string | HTMLElement
796
+ }]
760
797
  }
761
798
 
762
799
  Type: interface csslink {
@@ -764,12 +801,7 @@ Type: interface csslink {
764
801
  link: string
765
802
  }
766
803
 
767
- Type: ({type:'zip', content: string, output: 'dom'} | string,
768
- (csstypes?: {
769
- hasKatex: boolean;
770
- hasRailroad: boolean;
771
- hasSequence: boolean
772
- }) => void) => Promise\<{html: string | HTMLElement[], scripts: script[], cssLinks: csslink[]}>
804
+ Type: ({type:'zip', content: string, output: 'dom'} | string) => Promise\<{html: string | HTMLElement[], scripts: script[], cssLinks: csslink[]}>
773
805
 
774
806
  A async function to make markdown to html that showdown.convertor converte it in current showdowns instance.
775
807
 
package/demo/index.html CHANGED
@@ -15,9 +15,8 @@
15
15
 
16
16
  html {
17
17
  box-sizing: border-box;
18
- font-size: 62.5%;
19
- line-height: 1.5;
20
18
  height: 100%;
19
+ text-rendering: optimizelegibility;
21
20
  }
22
21
 
23
22
  *,
@@ -33,7 +32,6 @@
33
32
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji,
34
33
  Segoe UI Emoji;
35
34
  -webkit-font-smoothing: antialiased;
36
- font-size: 1.5rem;
37
35
  }
38
36
 
39
37
  code {
@@ -1,7 +1,2 @@
1
- // flowchart.js, v1.12.3
2
- // Copyright (c)2019 Adriano Raiano (adrai).
3
- // Distributed under MIT license
4
- // http://adrai.github.io/flowchart.js
5
-
6
- !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}])});
7
- //# sourceMappingURL=flowchart.min.js.map
1
+ !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(require("raphael")):"function"==typeof define&&define.amd?define(["raphael"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).Raphael)}(this,function(t){"use strict";var i,e,s,n,h,r,o,a,l,p,x,g,y,f,c,d,u,m,b,_,v,w,L,k,B,M,A,O,X,T,S;function C(){if(s)return e;return s=1,e={defaults:function t(i,e){if(!i||"function"==typeof i)return e;var s={};for(var n in e)s[n]=e[n];for(n in i)i[n]&&(s[n]="object"==typeof s[n]?t(s[n],i[n]):i[n]);return s},inherits:function(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}}},e}function Y(){if(o)return r;return o=1,r={drawPath:function(t,i,e){var s,n,h="M{0},{1}";for(s=2,n=2*e.length+2;n>s;s+=2)h+=" L{"+s+"},{"+(s+1)+"}";var r=[i.x,i.y];for(s=0,n=e.length;n>s;s++)r.push(e[s].x),r.push(e[s].y);var o=t.paper.path(h,r);o.attr("stroke",t.options["element-color"]),o.attr("stroke-width",t.options["line-width"]);var a=t.options.font,l=t.options["font-family"],p=t.options["font-weight"];return a&&o.attr({font:a}),l&&o.attr({"font-family":l}),p&&o.attr({"font-weight":p}),o},drawLine:function(t,i,e,s){var n,h;"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]);var r="M{0},{1}";for(n=2,h=2*e.length+2;h>n;n+=2)r+=" L{"+n+"},{"+(n+1)+"}";var o=[i.x,i.y];for(n=0,h=e.length;h>n;n++)o.push(e[n].x),o.push(e[n].y);var a=t.paper.path(r,o);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"],x=t.options["font-weight"];if(l&&a.attr({font:l}),p&&a.attr({"font-family":p}),x&&a.attr({"font-weight":x}),s){var g=t.paper.text(0,0,s),y="start",f=!1,c=e[0];i.y===c.y&&(f=!0);var d=0,u=0;d=i.x,u=i.y,f?(i.x>c.x?(d-=t.options["text-margin"]/2,y="end"):d+=t.options["text-margin"]/2,u-=t.options["text-margin"]):(d+=t.options["text-margin"]/2,u+=t.options["text-margin"],i.y>c.y&&(u-=2*t.options["text-margin"])),g.attr({"text-anchor":y,"font-size":t.options["font-size"],fill:t.options["font-color"],x:d,y:u}),l&&g.attr({font:l}),p&&g.attr({"font-family":p}),x&&g.attr({"font-weight":x})}return a},checkLineIntersection:function(t,i,e,s,n,h,r,o){var a,l,p,x,g={x:null,y:null,onLine1:!1,onLine2:!1};return 0===(a=(o-h)*(e-t)-(r-n)*(s-i))||(x=(r-n)*(l=i-h)-(o-h)*(p=t-n),p=((e-t)*l-(s-i)*p)/a,g.x=t+(l=x/a)*(e-t),g.y=i+l*(s-i),l>0&&1>l&&(g.onLine1=!0),p>0&&1>p&&(g.onLine2=!0)),g}}}function P(){if(l)return a;l=1;var t=Y(),i=t.drawLine,e=t.checkLineIntersection;function s(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.leftLines=[],this.rightLines=[],this.topLines=[],this.bottomLines=[],this.params=i.params,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 s=this.getAttr("font"),n=this.getAttr("font-family"),h=this.getAttr("font-weight");s&&this.text.attr({font:s}),n&&this.text.attr({"font-family":n}),h&&this.text.attr({"font-weight":h}),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 r=this.getAttr("maxWidth");if(r){for(var o=i.text.split(" "),a="",l=0,p=o.length;p>l;l++){var x=o[l];this.text.attr("text",a+" "+x),this.text.getBBox().width>r?a+="\n"+x:a+=" "+x}this.text.attr("text",a.substring(1))}if(this.group.push(this.text),e){var g=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*g,height:this.text.getBBox().height+2*g}),e.node.setAttribute("class",this.getAttr("class"));var y=this.getAttr("roundness");isNaN(y)||(e.node.setAttribute("ry",y),e.node.setAttribute("rx",y)),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()}}return s.prototype.getAttr=function(t){var i;if(this.chart)return this.chart.options.flowstate&&this.chart.options.flowstate[this.flowstate]&&(i=this.chart.options.flowstate[this.flowstate][t]),i||(this.chart.options.symbols?this.chart.options.symbols[this.symbolType][t]:void 0)||(this.chart.options?this.chart.options[t]:void 0)},s.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},s.prototype.getCenter=function(){return{x:this.getX()+this.width/2,y:this.getY()+this.height/2}},s.prototype.getX=function(){return this.group.getBBox().x},s.prototype.getY=function(){return this.group.getBBox().y},s.prototype.shiftX=function(t){this.group.transform("t"+(this.getX()+t)+","+this.getY())},s.prototype.setX=function(t){this.group.transform("t"+t+","+this.getY())},s.prototype.shiftY=function(t){this.group.transform("t"+this.getX()+","+(this.getY()+t))},s.prototype.setY=function(t){this.group.transform("t"+this.getX()+","+t)},s.prototype.getTop=function(){var t=this.getY();return{x:this.getX()+this.width/2,y:t}},s.prototype.getBottom=function(){var t=this.getY()+this.height;return{x:this.getX()+this.width/2,y:t}},s.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2;return{x:this.getX(),y:t}},s.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2;return{x:this.getX()+this.group.getBBox().width,y:t}},s.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 e(){for(var s,n=!1,h=0,r=t.chart.symbols.length;r>h;h++){var o=Math.abs((s=t.chart.symbols[h]).getCenter().x-t.next.getCenter().x);if(s.getCenter().y>t.next.getCenter().y&&t.next.width/2>=o){n=!0;break}}if(n){if("end"===t.next.symbolType)return;t.next.setX(s.getX()+s.width+i),e()}}(),this.next.isPositioned=!0,this.next.render())}else if("left"===this.next_direction){var s=this.getLeft();this.next.isPositioned||(this.next.setY(s.y-this.next.height/2),this.next.shiftX(-(this.group.getBBox().x+this.width+i)),function e(){for(var s,n=!1,h=0,r=t.chart.symbols.length;r>h;h++){var o=Math.abs((s=t.chart.symbols[h]).getCenter().x-t.next.getCenter().x);if(s.getCenter().y>t.next.getCenter().y&&t.next.width/2>=o){n=!0;break}}if(n){if("end"===t.next.symbolType)return;t.next.setX(s.getX()+s.width+i),e()}}(),this.next.isPositioned=!0,this.next.render())}else{var n=this.getBottom();this.next.isPositioned||(this.next.shiftY(this.getY()+this.height+i),this.next.setX(n.x-this.next.width/2),this.next.isPositioned=!0,this.next.render())}}},s.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")||""))},s.prototype.drawLineTo=function(t,s,n){0>this.connectedTo.indexOf(t)&&this.connectedTo.push(t);var h,r,o=this.getCenter().x,a=this.getCenter().y,l=this.getRight(),p=this.getBottom(),x=this.getTop(),g=this.getLeft(),y=t.getCenter().x,f=t.getCenter().y,c=t.getTop(),d=t.getRight(),u=t.getLeft(),m=o===y,b=a===f,_=f>a,v=a>f||this===t,w=o>y,L=y>o,k=0,B=this.getAttr("line-length"),M=this.getAttr("line-width");if(n&&"bottom"!==n||!m||!_)if(n&&"right"!==n||!b||!L)if(n&&"left"!==n||!b||!w)if(n&&"right"!==n||!m||!v)if(n&&"right"!==n||!m||!_)if(n&&"bottom"!==n||!w)if(n&&"bottom"!==n||!L||!_)if(n&&"bottom"!==n||!L)if(n&&"right"===n&&w)h=i(this.chart,l,[{x:l.x+B/2,y:l.y},{x:l.x+B/2,y:c.y-B/2-(r=10*Math.max(t.topLines.length,this.rightLines.length))},{x:c.x,y:c.y-B/2-r},{x:c.x,y:c.y}],s),this.rightLines.push(h),t.topLines.push(h),this.rightStart=!0,t.topEnd=!0,k=l.x+B/2;else if(n&&"right"===n&&L)h=i(this.chart,l,[{x:c.x,y:l.y-(r=10*Math.max(t.topLines.length,this.rightLines.length))},{x:c.x,y:c.y-r}],s),this.rightLines.push(h),t.topLines.push(h),this.rightStart=!0,t.topEnd=!0,k=l.x+B/2;else if(n&&"bottom"===n&&m&&v)h=i(this.chart,p,[{x:p.x,y:p.y+B/2-(r=10*Math.max(t.topLines.length,this.bottomLines.length))},{x:l.x+B/2,y:p.y+B/2-r},{x:l.x+B/2,y:c.y-B/2-r},{x:c.x,y:c.y-B/2-r},{x:c.x,y:c.y}],s),this.bottomLines.push(h),t.topLines.push(h),this.bottomStart=!0,t.topEnd=!0,k=p.x+B/2;else if("left"===n&&m&&v){var A=g.x-B/2;g.x>u.x&&(A=u.x-B/2),h=i(this.chart,g,[{x:A,y:g.y-(r=10*Math.max(t.topLines.length,this.leftLines.length))},{x:A,y:c.y-B/2-r},{x:c.x,y:c.y-B/2-r},{x:c.x,y:c.y}],s),this.leftLines.push(h),t.topLines.push(h),this.leftStart=!0,t.topEnd=!0,k=g.x}else"left"===n?(h=i(this.chart,g,[{x:c.x+(g.x-c.x)/2,y:g.y},{x:c.x+(g.x-c.x)/2,y:c.y-B/2-(r=10*Math.max(t.topLines.length,this.leftLines.length))},{x:c.x,y:c.y-B/2-r},{x:c.x,y:c.y}],s),this.leftLines.push(h),t.topLines.push(h),this.leftStart=!0,t.topEnd=!0,k=g.x):"top"===n&&(h=i(this.chart,x,[{x:x.x,y:c.y-B/2-(r=10*Math.max(t.topLines.length,this.topLines.length))},{x:c.x,y:c.y-B/2-r},{x:c.x,y:c.y}],s),this.topLines.push(h),t.topLines.push(h),this.topStart=!0,t.topEnd=!0,k=x.x);else h=i(this.chart,p,[{x:p.x,y:p.y+B/2-(r=10*Math.max(t.topLines.length,this.bottomLines.length))},{x:p.x+(p.x-c.x)/2,y:p.y+B/2-r},{x:p.x+(p.x-c.x)/2,y:c.y-B/2-r},{x:c.x,y:c.y-B/2-r},{x:c.x,y:c.y}],s),this.bottomLines.push(h),t.topLines.push(h),this.bottomStart=!0,t.topEnd=!0,k=p.x+(p.x-c.x)/2;else h=i(this.chart,p,[{x:p.x,y:c.y-B/2-(r=10*Math.max(t.topLines.length,this.bottomLines.length))},{x:c.x,y:c.y-B/2-r},{x:c.x,y:c.y}],s),this.bottomLines.push(h),t.topLines.push(h),this.bottomStart=!0,t.topEnd=!0,c.x>(k=p.x)&&(k=c.x);else r=10*Math.max(t.topLines.length,this.bottomLines.length),h=i(this.chart,p,this.leftEnd&&v?[{x:p.x,y:p.y+B/2-r},{x:p.x+(p.x-c.x)/2,y:p.y+B/2-r},{x:p.x+(p.x-c.x)/2,y:c.y-B/2-r},{x:c.x,y:c.y-B/2-r},{x:c.x,y:c.y}]:[{x:p.x,y:c.y-B/2-r},{x:c.x,y:c.y-B/2-r},{x:c.x,y:c.y}],s),this.bottomLines.push(h),t.topLines.push(h),this.bottomStart=!0,t.topEnd=!0,k=p.x+(p.x-c.x)/2;else h=i(this.chart,l,[{x:l.x+B/2,y:l.y-(r=10*Math.max(t.topLines.length,this.rightLines.length))},{x:l.x+B/2,y:c.y-B/2-r},{x:c.x,y:c.y-B/2-r},{x:c.x,y:c.y}],s),this.rightLines.push(h),t.topLines.push(h),this.rightStart=!0,t.topEnd=!0,k=l.x+B/2;else h=i(this.chart,l,[{x:l.x+B/2,y:l.y-(r=10*Math.max(t.topLines.length,this.rightLines.length))},{x:l.x+B/2,y:c.y-B/2-r},{x:c.x,y:c.y-B/2-r},{x:c.x,y:c.y}],s),this.rightLines.push(h),t.topLines.push(h),this.rightStart=!0,t.topEnd=!0,k=l.x+B/2;else h=0===t.rightLines.length&&0===this.leftLines.length?i(this.chart,g,d,s):i(this.chart,l,[{x:l.x,y:l.y-(r=10*Math.max(t.rightLines.length,this.leftLines.length))},{x:l.x,y:d.y-r},{x:d.x,y:d.y-r},{x:d.x,y:d.y}],s),this.leftLines.push(h),t.rightLines.push(h),this.leftStart=!0,t.rightEnd=!0,k=d.x;else h=i(this.chart,l,0===t.leftLines.length&&0===this.rightLines.length?u:[{x:l.x,y:l.y-(r=10*Math.max(t.leftLines.length,this.rightLines.length))},{x:l.x,y:u.y-r},{x:u.x,y:u.y-r},{x:u.x,y:u.y}],s),this.rightLines.push(h),t.leftLines.push(h),this.rightStart=!0,t.leftEnd=!0,k=u.x;else h=i(this.chart,p,0===t.topLines.length&&0===this.bottomLines.length?c:[{x:c.x,y:c.y-(r=10*Math.max(t.topLines.length,this.bottomLines.length))},{x:c.x,y:c.y}],s),this.bottomLines.push(h),t.topLines.push(h),this.bottomStart=!0,t.topEnd=!0,k=p.x;if(this.lineStyle[t.key]&&h&&h.attr(this.lineStyle[t.key]),h){for(var O=0,X=this.chart.lines.length;X>O;O++)for(var T=this.chart.lines[O].attr("path"),S=h.attr("path"),C=0,Y=T.length-1;Y>C;C++){var P=[];P.push(["M",T[C][1],T[C][2]]),P.push(["L",T[C+1][1],T[C+1][2]]);for(var E=P[0][1],j=P[0][2],z=P[1][1],F=P[1][2],R=0,N=S.length-1;N>R;R++){var $=[];$.push(["M",S[R][1],S[R][2]]),$.push(["L",S[R+1][1],S[R+1][2]]);var V=$[0][1],G=$[0][2],I=$[1][1],W=$[1][2],Q=e(E,j,z,F,V,G,I,W);if(Q.onLine1&&Q.onLine2)G===W?V>I?(S.splice(R+1,0,["L",Q.x+2*M,G]),S.splice(R+2,0,["C",Q.x+2*M,G,Q.x,G-4*M,Q.x-2*M,G]),h.attr("path",S)):(S.splice(R+1,0,["L",Q.x-2*M,G]),S.splice(R+2,0,["C",Q.x-2*M,G,Q.x,G-4*M,Q.x+2*M,G]),h.attr("path",S)):G>W?(S.splice(R+1,0,["L",V,Q.y+2*M]),S.splice(R+2,0,["C",V,Q.y+2*M,V+4*M,Q.y,V,Q.y-2*M]),h.attr("path",S)):(S.splice(R+1,0,["L",V,Q.y-2*M]),S.splice(R+2,0,["C",V,Q.y-2*M,V+4*M,Q.y,V,Q.y+2*M]),h.attr("path",S)),R+=2}}this.chart.lines.push(h),(void 0===this.chart.minXFromSymbols||this.chart.minXFromSymbols>g.x)&&(this.chart.minXFromSymbols=g.x)}(!this.chart.maxXFromLine||this.chart.maxXFromLine&&k>this.chart.maxXFromLine)&&(this.chart.maxXFromLine=k)},a=s}function E(){if(x)return p;x=1;var t=P(),i=C().inherits,e=Y().drawPath;function s(i,s){t.call(this,i,s=s||{}),this.yes_annotation=s.yes_annotation,this.no_annotation=s.no_annotation,this.textMargin=this.getAttr("text-margin"),this.yes_direction=s.direction_yes,this.no_direction=s.direction_no,this.no_direction||"right"!==this.yes_direction?this.yes_direction||"bottom"!==this.no_direction||(this.yes_direction="right"):this.no_direction="bottom",this.yes_direction=this.yes_direction||"bottom",this.no_direction=this.no_direction||"right",this.text.attr({x:2*this.textMargin});var n=this.text.getBBox().width+3*this.textMargin;n+=n/2;var h=this.text.getBBox().height+2*this.textMargin,r=n/4,o=(h=Math.max(.5*n,h+=h/2))/4;this.text.attr({x:r+this.textMargin/2});var a=e(i,{x:r,y:o},[{x:r-n/4,y:o+h/4},{x:r-n/4+n/2,y:o+h/4+h/2},{x:r-n/4+n,y:o+h/4},{x:r-n/4+n/2,y:o+h/4-h/2},{x:r-n/4,y:o+h/4}]);a.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),s.link&&a.attr("href",s.link),s.target&&a.attr("target",s.target),s.key&&(a.node.id=s.key),a.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:a.getBBox().height/2}),this.group.push(a),a.insertBefore(this.text),this.symbol=a,this.initialize()}return i(s,t),s.prototype.render=function(){var t=this;this.yes_direction&&(this[this.yes_direction+"_symbol"]=this.yes_symbol),this.no_direction&&(this[this.no_direction+"_symbol"]=this.no_symbol);var i=this.getAttr("line-length");if(this.bottom_symbol){var e=this.getBottom();this.bottom_symbol.isPositioned||(this.bottom_symbol.shiftY(this.getY()+this.height+i),this.bottom_symbol.setX(e.x-this.bottom_symbol.width/2),this.bottom_symbol.isPositioned=!0,this.bottom_symbol.render())}if(this.right_symbol){var s=this.getRight();this.right_symbol.isPositioned||(this.right_symbol.setY(s.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+i),function e(){for(var s,n=!1,h=0,r=t.chart.symbols.length;r>h;h++)if(s=t.chart.symbols[h],!t.params["align-next"]||"no"!==t.params["align-next"]){var o=Math.abs(s.getCenter().x-t.right_symbol.getCenter().x);if(s.getCenter().y>t.right_symbol.getCenter().y&&t.right_symbol.width/2>=o){n=!0;break}}if(n){if("end"===t.right_symbol.symbolType)return;t.right_symbol.setX(s.getX()+s.width+i),e()}}(),this.right_symbol.isPositioned=!0,this.right_symbol.render())}if(this.left_symbol){var n=this.getLeft();this.left_symbol.isPositioned||(this.left_symbol.setY(n.y-this.left_symbol.height/2),this.left_symbol.shiftX(-(this.group.getBBox().x+this.width+i)),function e(){for(var s,n=!1,h=0,r=t.chart.symbols.length;r>h;h++)if(s=t.chart.symbols[h],!t.params["align-next"]||"no"!==t.params["align-next"]){var o=Math.abs(s.getCenter().x-t.left_symbol.getCenter().x);if(s.getCenter().y>t.left_symbol.getCenter().y&&t.left_symbol.width/2>=o){n=!0;break}}if(n){if("end"===t.left_symbol.symbolType)return;t.left_symbol.setX(s.getX()+s.width+i),e()}}(),this.left_symbol.isPositioned=!0,this.left_symbol.render())}},s.prototype.renderLines=function(){this.yes_symbol&&this.drawLineTo(this.yes_symbol,this.yes_annotation?this.yes_annotation:this.getAttr("yes-text"),this.yes_direction),this.no_symbol&&this.drawLineTo(this.no_symbol,this.no_annotation?this.no_annotation:this.getAttr("no-text"),this.no_direction)},p=s}function j(){if(y)return g;y=1;var t=P();function i(i,e){var s=i.paper.rect(0,0,0,0);t.call(this,i,e=e||{},s),this.path1_annotation=e.path1_annotation||"",this.path2_annotation=e.path2_annotation||"",this.path3_annotation=e.path3_annotation||"",this.textMargin=this.getAttr("text-margin"),this.path1_direction="bottom",this.path2_direction="right",this.path3_direction="top",this.params=e.params,"path1"===e.direction_next&&!e[e.direction_next]&&e.next&&(e[e.direction_next]=e.next),"path2"===e.direction_next&&!e[e.direction_next]&&e.next&&(e[e.direction_next]=e.next),"path3"===e.direction_next&&!e[e.direction_next]&&e.next&&(e[e.direction_next]=e.next),e.path1&&e.direction_path1&&e.path2&&!e.direction_path2&&e.path3&&!e.direction_path3?"right"===e.direction_path1?(this.path2_direction="bottom",this.path1_direction="right",this.path3_direction="top"):"top"===e.direction_path1?(this.path2_direction="right",this.path1_direction="top",this.path3_direction="bottom"):"left"===e.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"):e.path1&&!e.direction_path1&&e.path2&&e.direction_path2&&e.path3&&!e.direction_path3?"right"===e.direction_path2?(this.path1_direction="bottom",this.path2_direction="right",this.path3_direction="top"):"left"===e.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"):e.path1&&!e.direction_path1&&e.path2&&!e.direction_path2&&e.path3&&e.direction_path3?"right"===e.direction_path2?(this.path1_direction="bottom",this.path2_direction="top",this.path3_direction="right"):"left"===e.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=e.direction_path1,this.path2_direction=e.direction_path2,this.path3_direction=e.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()}return(0,C().inherits)(i,t),i.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 s=this;if(this.left_symbol){var n=this.getLeft();this.left_symbol.isPositioned||(this.left_symbol.setY(n.y-this.left_symbol.height/2),this.left_symbol.shiftX(-(this.group.getBBox().x+this.width+t)),function i(){for(var e,n=!1,h=0,r=s.chart.symbols.length;r>h;h++)if(e=s.chart.symbols[h],!s.params["align-next"]||"no"!==s.params["align-next"]){var o=Math.abs(e.getCenter().x-s.left_symbol.getCenter().x);if(e.getCenter().y>s.left_symbol.getCenter().y&&s.left_symbol.width/2>=o){n=!0;break}}if(n){if("end"===s.left_symbol.symbolType)return;s.left_symbol.setX(e.getX()+e.width+t),i()}}(),this.left_symbol.isPositioned=!0,this.left_symbol.render())}if(this.right_symbol){var h=this.getRight();this.right_symbol.isPositioned||(this.right_symbol.setY(h.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+t),function i(){for(var e,n=!1,h=0,r=s.chart.symbols.length;r>h;h++)if(e=s.chart.symbols[h],!s.params["align-next"]||"no"!==s.params["align-next"]){var o=Math.abs(e.getCenter().x-s.right_symbol.getCenter().x);if(e.getCenter().y>s.right_symbol.getCenter().y&&s.right_symbol.width/2>=o){n=!0;break}}if(n){if("end"===s.right_symbol.symbolType)return;s.right_symbol.setX(e.getX()+e.width+t),i()}}(),this.right_symbol.isPositioned=!0,this.right_symbol.render())}},i.prototype.renderLines=function(){this.path1_symbol&&this.drawLineTo(this.path1_symbol,this.path1_annotation,this.path1_direction),this.path2_symbol&&this.drawLineTo(this.path2_symbol,this.path2_annotation,this.path2_direction),this.path3_symbol&&this.drawLineTo(this.path3_symbol,this.path3_annotation,this.path3_direction)},g=i}function z(){if(c)return f;c=1;var i=t,e=C().defaults,s=h?n:(h=1,n={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:{},input:{},output:{},operation:{},subroutine:{},parallel:{}}}),r=E(),o=j();function a(t,n){n=n||{},this.paper=new i(t),this.options=e(n,s),this.symbols=[],this.lines=[],this.start=null}return a.prototype.handle=function(t){this.symbols.indexOf(t)>-1||this.symbols.push(t);var i=this;return t instanceof r?(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 o?(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},a.prototype.startWith=function(t){return this.start=t,this.handle(t)},a.prototype.render=function(){var t,i,e,s,n=0,h=0,r=0,o=0,a=0,l=0,p=0,x=0;for(r=0,o=this.symbols.length;o>r;r++)(t=this.symbols[r]).width>n&&(n=t.width),t.height>h&&(h=t.height);for(r=0,o=this.symbols.length;o>r;r++)(t=this.symbols[r]).shiftX(this.options.x+(n-t.width)/2+this.options["line-width"]),t.shiftY(this.options.y+(h-t.height)/2+this.options["line-width"]);for(this.start.render(),r=0,o=this.symbols.length;o>r;r++)(t=this.symbols[r]).renderLines();for(a=this.maxXFromLine,r=0,o=this.symbols.length;o>r;r++){var g=(t=this.symbols[r]).getX();p>g&&(p=g),(e=g+t.width)>a&&(a=e),(s=t.getY()+t.height)>l&&(l=s)}for(r=0,o=this.lines.length;o>r;r++){var y=(i=this.lines[r].getBBox()).x2,f=i.y2;p>(e=i.x)&&(p=e),x>(s=i.y)&&(x=s),y>a&&(a=y),f>l&&(l=f)}var c=this.options.scale,d=this.options["line-width"];p>this.minXFromSymbols&&(p=this.minXFromSymbols),0>p&&(p-=d),0>x&&(x-=d);var u=a+d-p,m=l+d-x;this.paper.setSize(u*c,m*c),this.paper.setViewBox(p,x,u,m,!0)},a.prototype.clean=function(){if(this.paper){var t=this.paper.canvas;t.parentNode&&t.parentNode.removeChild(t)}},f=a}function F(){if(S)return T;S=1;var t=z(),i=function(){if(u)return d;u=1;var t=P();function i(i,e){var s=i.paper.rect(0,0,0,0,20);(e=e||{}).text=e.text||"Start",t.call(this,i,e,s)}return(0,C().inherits)(i,t),d=i}(),e=function(){if(b)return m;b=1;var t=P();function i(i,e){var s=i.paper.rect(0,0,0,0,20);(e=e||{}).text=e.text||"End",t.call(this,i,e,s)}return(0,C().inherits)(i,t),m=i}(),s=function(){if(v)return _;v=1;var t=P();function i(i,e){var s=i.paper.rect(0,0,0,0);t.call(this,i,e=e||{},s)}return(0,C().inherits)(i,t),_=i}(),n=function(){if(L)return w;L=1;var t=P(),i=C().inherits,e=Y().drawPath;function s(i,s){t.call(this,i,s=s||{}),this.textMargin=this.getAttr("text-margin"),this.text.attr({x:3*this.textMargin});var n=this.text.getBBox().width+4*this.textMargin,h=this.text.getBBox().height+2*this.textMargin,r=this.textMargin,o=h/2,a=e(i,{x:r,y:o},[{x:r-this.textMargin,y:h},{x:r-this.textMargin+n,y:h},{x:r-this.textMargin+n+2*this.textMargin,y:0},{x:r-this.textMargin+2*this.textMargin,y:0},{x:r,y:o}]);a.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),s.link&&a.attr("href",s.link),s.target&&a.attr("target",s.target),s.key&&(a.node.id=s.key),a.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:a.getBBox().height/2}),this.group.push(a),a.insertBefore(this.text),this.symbol=a,this.initialize()}return i(s,t),s.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2;return{x:this.getX()+this.textMargin,y:t}},s.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2;return{x:this.getX()+this.group.getBBox().width-this.textMargin,y:t}},w=s}(),h=function(){if(B)return k;B=1;var t=P(),i=C().inherits,e=Y().drawPath;function s(i,s){t.call(this,i,s=s||{}),this.textMargin=this.getAttr("text-margin"),this.text.attr({x:3*this.textMargin});var n=this.text.getBBox().width+4*this.textMargin,h=this.text.getBBox().height+2*this.textMargin,r=this.textMargin,o=h/2,a=e(i,{x:r,y:o},[{x:r-this.textMargin+2*this.textMargin,y:h},{x:r-this.textMargin+n,y:h},{x:r-this.textMargin+n+2*this.textMargin,y:0},{x:r-this.textMargin,y:0},{x:r,y:o}]);a.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),s.link&&a.attr("href",s.link),s.target&&a.attr("target",s.target),s.key&&(a.node.id=s.key),a.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:a.getBBox().height/2}),this.group.push(a),a.insertBefore(this.text),this.symbol=a,this.initialize()}return i(s,t),s.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2;return{x:this.getX()+this.textMargin,y:t}},s.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2;return{x:this.getX()+this.group.getBBox().width-this.textMargin,y:t}},k=s}(),r=function(){if(A)return M;A=1;var t=P(),i=C().inherits,e=Y().drawPath;function s(i,s){t.call(this,i,s=s||{}),this.textMargin=this.getAttr("text-margin"),this.text.attr({x:3*this.textMargin});var n=this.text.getBBox().width+4*this.textMargin,h=this.text.getBBox().height+2*this.textMargin,r=this.textMargin,o=h/2,a=e(i,{x:r,y:o},[{x:r-this.textMargin,y:h},{x:r-this.textMargin+n+2*this.textMargin,y:h},{x:r-this.textMargin+n,y:0},{x:r-this.textMargin+2*this.textMargin,y:0},{x:r,y:o}]);a.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),s.link&&a.attr("href",s.link),s.target&&a.attr("target",s.target),s.key&&(a.node.id=s.key),a.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:a.getBBox().height/2}),this.group.push(a),a.insertBefore(this.text),this.symbol=a,this.initialize()}return i(s,t),s.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2;return{x:this.getX()+this.textMargin,y:t}},s.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2;return{x:this.getX()+this.group.getBBox().width-this.textMargin,y:t}},M=s}(),o=function(){if(X)return O;X=1;var t=P();function i(i,e){var s=i.paper.rect(0,0,0,0);t.call(this,i,e=e||{},s),s.attr({width:this.text.getBBox().width+4*this.getAttr("text-margin")}),this.text.attr({x:2*this.getAttr("text-margin")});var n=i.paper.rect(0,0,0,0);n.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")}),e.key&&(n.node.id=e.key+"i");var h=this.getAttr("font"),r=this.getAttr("font-family"),o=this.getAttr("font-weight");h&&n.attr({font:h}),r&&n.attr({"font-family":r}),o&&n.attr({"font-weight":o}),e.link&&n.attr("href",e.link),e.target&&n.attr("target",e.target),this.group.push(n),n.insertBefore(this.text),this.initialize()}return(0,C().inherits)(i,t),O=i}(),a=E(),l=j();return T=function(p){p=(p=p||"").trim();for(var x={symbols:{},start:null,drawSVG:function(p,x){var g=this;this.diagram&&this.diagram.clean();var y=new t(p,x);this.diagram=y;var f={};!function t(p,x,c){var d=function(t){if(f[t.key])return f[t.key];switch(t.symbolType){case"start":f[t.key]=new i(y,t);break;case"end":f[t.key]=new e(y,t);break;case"operation":f[t.key]=new s(y,t);break;case"inputoutput":f[t.key]=new n(y,t);break;case"input":f[t.key]=new h(y,t);break;case"output":f[t.key]=new r(y,t);break;case"subroutine":f[t.key]=new o(y,t);break;case"condition":f[t.key]=new a(y,t);break;case"parallel":f[t.key]=new l(y,t);break;default:return Error("Wrong symbol type!")}return f[t.key]}(p);return g.start===p?y.startWith(d):x&&c&&!x.pathOk&&(x instanceof a?(c.yes===p&&x.yes(d),c.no===p&&x.no(d)):x instanceof l?(c.path1===p&&x.path1(d),c.path2===p&&x.path2(d),c.path3===p&&x.path3(d)):x.then(d)),d.pathOk||(d instanceof a?(p.yes&&t(p.yes,d,p),p.no&&t(p.no,d,p)):d instanceof l?(p.path1&&t(p.path1,d,p),p.path2&&t(p.path2,d,p),p.path3&&t(p.path3,d,p)):p.next&&t(p.next,d,p)),d}(this.start),y.render()},clean:function(){this.diagram.clean()},options:function(){return this.diagram.options}},g=[],y=0,f=1,c=p.length;c>f;f++)if("\n"===p[f]&&"\\"!==p[f-1]){var d=p.substring(y,f);y=f+1,g.push(d.replace(/\\\n/g,"\n"))}p.length>y&&g.push(p.substr(y));for(var u=1,m=g.length;m>u;){var b=g[u];0>b.indexOf("->")&&0>b.indexOf("=>")&&0>b.indexOf("@>")?(g[u-1]+="\n"+b,g.splice(u,1),m--):u++}function _(t){var i=t.indexOf("(")+1,e=t.indexOf(")");return 0>i||0>e?"{}":t.substring(i,e)}function v(t){var i=t.indexOf("(")+1,e=t.indexOf(")");return 0>i||0>e?"":t.substring(i,e)}function w(t){var i=t.indexOf("(")+1,e=t.indexOf(")");return 0>i||0>e?x.symbols[t]:x.symbols[t.substring(0,i-1)]}function L(t){var i="next",e=t.indexOf("(")+1,s=t.indexOf(")");return 0>e||0>s||0>(i=E.substring(e,s)).indexOf(",")&&"yes"!==i&&"no"!==i&&(i="next, "+i),i}function k(t){var i=t.indexOf("(")+1,e=t.indexOf(")"),s=t.substring(i,e);s.indexOf(",")>0&&(s=s.substring(0,s.indexOf(",")));var n=s.split("@");if(n.length>1)return 0>i||0>e?"":n[1]}for(;g.length>0;){var B=g.splice(0,1)[0].trim();if(B.indexOf("=>")<0)if(B.indexOf("->")<0){if(B.indexOf("@>")>=0)for(var M=B.split("@>"),A=0,O=M.length;O>A;A++)if(A+1!==O){var X=w(M[A]),T=w(M[A+1]);X.lineStyle[T.key]=JSON.parse(_(M[A+1]))}}else{var S=k(B);S&&(B=B.replace("@"+S,""));for(var C=B.split("->"),Y=0,P=C.length;P>Y;Y++){var E=C[Y],j=v(E);"true"!==j&&"false"!==j||(E=(E=E.replace("true","yes")).replace("false","no"));var z=L(E),F=w(E),R=null;if(z.indexOf(",")>=0){var N=z.split(",");z=N[0],R=N[1].trim()}if(S&&("condition"===F.symbolType?"yes"===z||"true"===z?F.yes_annotation=S:F.no_annotation=S:"parallel"===F.symbolType&&("path1"===z?F.path1_annotation=S:"path2"===z?F.path2_annotation=S:"path3"===z&&(F.path3_annotation=S)),S=null),x.start||(x.start=F),P>Y+1)F[z]=w(C[Y+1]),F["direction_"+z]=R,R=null}}else{var $,V=B.split("=>"),G={key:V[0].replace(/\(.*\)/,""),symbolType:V[1],text:null,link:null,target:null,flowstate:null,function:null,lineStyle:{},params:{}},I=V[0].match(/\((.*)\)/);if(I&&I.length>1)for(var W=I[1].split(","),Q=0;W.length>Q;Q++){var q=W[Q].split("=");2==q.length&&(G.params[q[0]]=q[1])}if(0>G.symbolType.indexOf(": ")||($=G.symbolType.split(": "),G.symbolType=$.shift(),G.text=$.join(": ")),G.text&&G.text.indexOf(":$")>=0?($=G.text.split(":$"),G.text=$.shift(),G.function=$.join(":$")):0>G.symbolType.indexOf(":$")?G.text&&G.text.indexOf(":>")>=0?($=G.text.split(":>"),G.text=$.shift(),G.link=$.join(":>")):0>G.symbolType.indexOf(":>")||($=G.symbolType.split(":>"),G.symbolType=$.shift(),G.link=$.join(":>")):($=G.symbolType.split(":$"),G.symbolType=$.shift(),G.function=$.join(":$")),0>G.symbolType.indexOf("\n")||(G.symbolType=G.symbolType.split("\n")[0]),G.link){var J=G.link.indexOf("[")+1,D=G.link.indexOf("]");0>J||0>D||(G.target=G.link.substring(J,D),G.link=G.link.substring(0,J-1))}if(G.text&&G.text.indexOf("|")>=0){var H=G.text.split("|");G.flowstate=H.pop().trim(),G.text=H.join("|")}x.symbols[G.key]=G}}return x}}var R,N,$,V={};!function(){if($)return N;$=1,i||(i=1,Array.prototype.indexOf||(Array.prototype.indexOf=function(t){if(null===this)throw new TypeError;var i=Object(this),e=i.length>>>0;if(0===e)return-1;var s=0;if(arguments.length>0&&((s=Number(arguments[1]))!=s?s=0:0!==s&&s!=1/0&&s!=-1/0&&(s=(s>0||-1)*Math.floor(Math.abs(s)))),s>=e)return-1;for(var n=0>s?Math.max(e-Math.abs(s),0):s;e>n;n++)if(n in i&&i[n]===t)return n;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(t){if(null===this)throw new TypeError;var i=Object(this),e=i.length>>>0;if(0===e)return-1;var s=e;arguments.length>1&&((s=Number(arguments[1]))!=s?s=0:0!==s&&s!=1/0&&s!=-1/0&&(s=(s>0||-1)*Math.floor(Math.abs(s))));for(var n=0>s?e-Math.abs(s):Math.min(s,e-1);n>=0;n--)if(n in i&&i[n]===t)return n;return-1}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}));var t=F();!function(){if(R)return V;if(R=1,"undefined"!=typeof jQuery){var t=F();!function(i){function e(t,i){return t==i||Array.isArray(i)&&(i.includes(t)||i.includes(Number(t)))}var s={init:function(e){return this.each(function(){var s=i(this);this.chart=t(s.text()),s.html(""),this.chart.drawSVG(this,e)})},setFlowStateByParam:function(t,i,s){return this.each(function(){var n=this.chart,h=["next","yes","no","path1","path2","path3"];for(var r in n.symbols)if(n.symbols.hasOwnProperty(r)){var o=n.symbols[r];if(e(o.params[t],i)){o.flowstate=s;for(var a=0;h.length>a;a++){var l=h[a];o[l]&&o[l].params&&o[l].params[t]&&e(o[l].params[t],i)&&(o.lineStyle[o[l].key]={stroke:n.options().flowstate[s].fill})}}}n.clean(),n.drawSVG(this)})},clearFlowState:function(){return this.each(function(){var t=this.chart;for(var i in t.symbols)t.symbols.hasOwnProperty(i)&&(t.symbols[i].flowstate="");t.clean(),t.drawSVG(this)})}};i.fn.flowChart=function(t){return s[t]?s[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void i.error("Method "+t+" does not exist on jQuery.flowChart"):s.init.apply(this,arguments)}}(jQuery)}}();var e={parse:t};"undefined"!=typeof window&&(window.flowchart=e),N=e}()});
2
+ //# sourceMappingURL=flowchart.min.js.map