diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..7cd53fdb --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +**/node_modules/ diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..f99a9bd9 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,16 @@ +{ + "extends": "defaults", + + "env": { + "browser": true, + "node": true + }, + + "globals": { + "$": true + }, + + "rules": { + "no-console": 0 + } +} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..ffde41b7 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [adrai] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.gitignore b/.gitignore index 29b32d94..6730a94f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ node_modules/**/* bin reports reports/**/* +package-lock.json diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..059c6268 --- /dev/null +++ b/.npmignore @@ -0,0 +1,13 @@ +example +imgs +site +release +bin +releasenotes.md +webpack.config.js +index.html +devserver.js +bower.json +.eslintignore +.eslintrc +.gitmodules \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 679b4dcb..00000000 --- a/Gruntfile.js +++ /dev/null @@ -1,246 +0,0 @@ -/*global module:false*/ -module.exports = function(grunt) { - - var component = require('./package.json'); - // before release: - // update component.js, package.json - // after release: - // add tag to repo: git tag v1.0.0 - // push tag: git push --tags - // to initialize all again - // http://twoguysarguing.wordpress.com/2010/11/14/tie-git-submodules-to-a-particular-commit-or-branch/ - // nav to site and do: git checkout gh-pages - - grunt.loadNpmTasks('grunt-rigger'); - grunt.loadNpmTasks('grunt-contrib'); - - // Project configuration. - grunt.initConfig({ - meta: { - version: component.version, - banner: '// ' + component.name + ', v<%= meta.version %>\n' + - '// Copyright (c)<%= grunt.template.today("yyyy") %> Adriano Raiano (adrai).\n' + - '// Distributed under MIT license\n' + - '// http://adrai.github.io/flowchart.js\n' - }, - - clean: ['bin'], - - jshint: { - options: { - scripturl: true, - laxcomma: true, - loopfunc: true, - curly: false, - eqeqeq: false, - immed: false, - latedef: true, - newcap: true, - noarg: true, - sub: true, - undef: true, - boss: true, - eqnull: true, - browser: true, - globals: { - jQuery: true, - $: true, - console: true, - ActiveXObject: true, - module: true - } - }, - files: [ 'bin/*.js' ] - }, - - rig: { - options: { - banner: '<%= meta.banner %>' - }, - build: { - src: ['src/flowchart.js'], - dest: 'bin/flowchart-latest.js' - }, - amd: { - src: ['src/amd.js'], - dest: 'bin/flowchart.amd-latest.js' - } - }, - - uglify: { - options: { - banner: '<%= meta.banner %>', - }, - // bin: { - // src: ['bin/flowchart-latest.js'], - // dest: 'bin/flowchart-<%= meta.version %>.min.js' - // }, - // release: { - // src: ['bin/flowchart-latest.js'], - // dest: 'release/flowchart-<%= meta.version %>.min.js', - // options: { - // sourceMap: true, - // sourceMapName: 'release/flowchart-<%= meta.version %>.min.map' - // } - // }, - // amd: { - // src: ['bin/flowchart.amd-latest.js'], - // dest: 'release/flowchart.amd-<%= meta.version %>.min.js', - // options: { - // sourceMap: true, - // sourceMapName: 'release/flowchart.amd-<%= meta.version %>.min.map' - // } - // } - release: { - src: ['bin/flowchart-latest.js'], - dest: 'release/flowchart.min.js', - options: { - sourceMap: true, - sourceMapName: 'release/flowchart.min.map' - } - }, - amd: { - src: ['bin/flowchart.amd-latest.js'], - dest: 'release/flowchart.amd.min.js', - options: { - sourceMap: true, - sourceMapName: 'release/flowchart.amd.min.map' - } - } - }, - - copy: { - js: { - // files: [ - // { expand: true, cwd: 'bin/', src: ['*.js'], dest: 'release/', - // rename: function(dest, src) { console.log(src + ' -> ' + dest); - // if (src == 'flowchart-latest.js') { - // dest += 'flowchart-' + component.version + '.js'; - // } - // if (src == 'flowchart.amd-latest.js') { - // dest += 'flowchart.amd-' + component.version + '.js'; - // } - // return dest; - // } - // }, - // { expand: true, cwd: 'bin/', src: ['flowchart-latest.js'], dest: 'site/'} - // //'bin/': ['bin/flowchart-latest.js', 'bin/flowchart.amd-latest.js'], - // //'release/': ['bin/flowchart-latest.js', 'bin/flowchart.amd-latest.js'] - // ] - files: [ - { expand: true, cwd: 'bin/', src: ['*.js'], dest: 'release/', - rename: function(dest, src) { console.log(src + ' -> ' + dest); - if (src == 'flowchart-latest.js') { - dest += 'flowchart.js'; - } - if (src == 'flowchart.amd-latest.js') { - dest += 'flowchart.amd.js'; - } - return dest; - } - }, - { expand: true, cwd: 'bin/', src: ['flowchart-latest.js'], dest: 'site/'} - //'bin/': ['bin/flowchart-latest.js', 'bin/flowchart.amd-latest.js'], - //'release/': ['bin/flowchart-latest.js', 'bin/flowchart.amd-latest.js'] - ] - } - }, - - compress: { - // zip: { - // options: { - // archive: 'release/flowchart-<%= meta.version %>.zip', - // mode: 'zip', - // level: 1 - // }, - // files: [ - // { - // expand: true, - // flatten: true, - // cwd: 'release/', - // src: [ - // 'flowchart-<%= meta.version %>.js', - // 'flowchart-<%= meta.version %>.min.js', - // 'flowchart-<%= meta.version %>.min.map' - // ], - // dest: 'flowchart-<%= meta.version %>/' - // } - // ] - // }, - 'zip-latest': { - options: { - archive: 'release/flowchart.zip', - mode: 'zip', - level: 1 - }, - files: [ - { - expand: true, - flatten: true, - cwd: 'release/', - src: [ - 'flowchart.js', - 'flowchart.min.js', - 'flowchart.min.map' - ], - dest: 'flowchart/' - } - ] - }, - // zipamd: { - // options: { - // archive: 'release/flowchart.amd-<%= meta.version %>.zip', - // mode: 'zip', - // level: 1 - // }, - // files: [ - // { - // expand: true, - // flatten: true, - // cwd: 'release/', - // src: [ - // 'flowchart.amd-<%= meta.version %>.js', - // 'flowchart.amd-<%= meta.version %>.min.js', - // 'flowchart.amd-<%= meta.version %>.min.map' - // ], - // dest: 'flowchart.amd-<%= meta.version %>/' - // } - // ] - // }, - 'zipamd-latest': { - options: { - archive: 'release/flowchart.amd.zip', - mode: 'zip', - level: 1 - }, - files: [ - { - expand: true, - flatten: true, - cwd: 'release/', - src: [ - 'flowchart.amd.js', - 'flowchart.amd.min.js', - 'flowchart.amd.min.map' - ], - dest: 'flowchart/' - } - ] - } - }, - - watch: { - lib: { - files: 'src/*.js', - tasks: 'rig:build' - } - } - - }); - - // Default task. - grunt.registerTask('default', ['clean', 'rig']); - grunt.registerTask('release', ['default', 'uglify', 'copy', 'compress']); - - -}; diff --git a/README.md b/README.md index 3a271099..03849acf 100644 --- a/README.md +++ b/README.md @@ -1,108 +1,274 @@ [![JS.ORG](https://img.shields.io/badge/js.org-flowchart-ffb400.svg?style=flat-square)](http://js.org) -#Example +# [flowchart.js](http://flowchart.js.org) -[example](https://github.com/adrai/flowchart.js/blob/master/example/index.html) +flowchart.js is a flowchart DSL and SVG render that runs in the browser and [terminal](https://github.com/francoislaberge/diagrams/#flowchart). -#Requirements -You will need [Raphaël](http://raphaeljs.com/) +Nodes and connections are defined separately so that nodes can be reused and connections can be quickly changed. +Fine grain changes to node and connection style can also be made right in the DSL. -#Usage +## Example -On your page you need to include raphael like so: +```flowchart +st=>start: Start:>http://www.google.com[blank] +e=>end:>http://www.google.com +getInfo=>input: Input Info +op1=>operation: My Operation +sub1=>subroutine: My Subroutine +cond=>condition: Yes +or No?:>http://www.google.com +io=>inputoutput: catch something... +printInfo=>output: Print info +para=>parallel: parallel tasks -```html - +st->getInfo->op1->cond +cond(yes)->io->printInfo->e +cond(no)->para +para(path1, bottom)->sub1(right)->op1 +para(path2, top)->op1 ``` -and then +![Example Flowchart](/imgs/example.svg) -```html -
Diagram will be placed here
- - -``` - - -#Contributors +## Browser Usage -via [GitHub](https://github.com/adrai/flowchart.js/graphs/contributors) +flowchart.js is on [CDNJS](https://cdnjs.com/libraries/flowchart), feel free to use it. -#Thanks +You will also need [Raphaël](http://www.raphaeljs.com/), which is also on [CDNJS](https://cdnjs.cloudflare.com/ajax/libs/raphael/2.3.0/raphael.min.js). -Many thanks to [js-sequence-diagrams](http://bramp.github.io/js-sequence-diagrams/) which greatly inspired this project, and forms the basis for the syntax. +The demo html page is at [example/index.html](example/index.html). + +## Node Syntax +`nodeName=>nodeType: nodeText[|flowstate][:>urlLink]` + +Items in `[]` are optional. + +_nodeName_ defines the nodes variable name within the flowchart document. + +_nodeType_ defines what type the node is. See **Node Types** for more information. + +_nodeText_ is the text that will be inserted into the node. Newlines are allowed and will be reflected in the rendered node text. + +_flowstate_ is optional and uses the `|` operator that specifies extra styling for the node. + +_urlLink_ is optional and uses the `:>` operator to specify the url to link to. + +## Node Types +Defines the shape that the node will take. + +### start +Used as the first node where flows start from. +Default text is `Start`. -#Licence +![start image](imgs/start.png "start image") -Copyright (c) 2015 Adriano Raiano +```flowchart +st=>start: start +``` + +### end +Used as the last node where a flow ends. +Default text is `End`. + +![end image](imgs/end.png "end image") + +```flowchart +e=>end: end +``` + +### operation +Indicates that an operation needs to happen in the flow. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +![operation image](imgs/operation.png "operation image") + +```flowchart +op1=>operation: operation +``` + +### inputoutput +Indicates that IO happens in a flow. + +![inputoutput image](imgs/inputoutput.png "inputoutput image") + +```flowchart +io=>inputoutput: inputoutput +``` -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +### input +Indicates that Input happens in a flow. + +![input image](imgs/input.png "input image") + +```flowchart +getInfo=>input: Input info +``` + +### output +Indicates that Output happens in a flow. + +![output image](imgs/output.png "output image") + +```flowchart +printInfo=>output: Print info +``` + +### subroutine +Indicates that a subroutine happens in the flow and that there should be another flowchart that documents this subroutine. + +![subroutine image](imgs/subroutine.png "subroutine image") + +```flowchart +sub1=>subroutine: subroutine +``` + +### condition +Allows for a conditional or logical statement to direct the flow into one of two paths. + +![condition image](imgs/condition.png "condition image") + +```flowchart +cond=>condition: condition +Yes or No? +``` + +### parallel +Allows for multiple flows to happen simultaneously. + +![parallel image](imgs/parallel.png "parallel image") + +```flowchart +para=>parallel: parallel +``` + +## Connections +Connections are defined in their own section below the node definitions. +The `->` operator specifies a connection from one node to another like `nodeVar1->nodeVar2->nodeVar3`. + +Not all nodes need to be specified in one string and can be separaged like so + +```flowchart +nodeVar1->nodeVar2 +nodeVar2->nodeVar3 +``` -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +Connection syntax is as follows: + +`[([, [[([, ]` + +Items in `[]` are optional. + +### Directions +The following directions are available and define the direction the connection will leave the node from. If there are more than one specifiers, it is always the last. All nodes have a default direction making this an optional specification. `` will be used to indicate that one of the following should be used in its place. + +* left +* right +* top +* bottom + +### Node Specific Specifiers by Type +Each node variables has optional specifiers, like direction, and some have special specifiers depending on the node type that are defined below. Specifiers are added after the variable name in `()` and separated with `,` like `nodeVar(spec1, spec2)`. + +### start +Optional direction + +`startVar()->nextNode` + +### end +No specifications because connections only go to the end node and do not leave from it. + +`previousNode->endVar` + +### operation +Optional direction + +`operationVar()->nextNode` + +### inputoutput +Optional direction + +`inputoutputVar()->nextNode` + +### subroutine +Optional direction + +`subroutineVar()->nextNode` + +### condition +Required logical specification of `yes` or `no` + +Optional direction + +```flowchart +conditionalVar(yes, )->nextNode1 +conditionalVar(no, )->nextNode2 +``` + +### parallel +Required path specification of `path1`, `path2`, or `path3` + +Optional direction + +```flowchart +parallelVar(path1, )->nextNode1 +parallelVar(path2, )->nextNode2 +parallelVar(path3, )->nextNode3 +``` + +## Links +A external link can be added to a node with the `:>` operator. + +The `st` node is linked to `http://www.google.com` and will open a new tab because `[blank]` is at the end of the URL. + +The `e` node is linked to `http://www.yahoo.com` and will cause the page to navigate to that page instead of opening a new tab. + +```flowchart +st=>start: Start:>http://www.google.com[blank] +e=>end: End:>http://www.yahoo.com +``` + +## Advice +Symbols that should possibly not be used in the text: `=>` and `->` and `:>` and `|` and `@>` and `:$` + +If you want to emphasize a specific path in your flowchart, you can additionally define it like this: + +``` +st@>op1({"stroke":"Red"})@>cond({"stroke":"Red","stroke-width":6,"arrow-end":"classic-wide-long"})@>c2({"stroke":"Red"})@>op2({"stroke":"Red"})@>e({"stroke":"Red"}) +``` + +## Custom names for branches + +``` +st=>start: Start:>http://www.google.com[blank] +e=>end:>http://www.google.com +op1=>operation: My Operation +sub1=>subroutine: My Subroutine +cond=>condition: linear or polynomial :>http://www.google.com +io=>inputoutput: catch something... +para=>parallel: 3 possibilities + +st->op1->cond +cond(true@linear)->io->e +cond(false@polynomial)->sub1(right) +sub1(right)->para +para(path1@an1, top)->cond +para(path2@an2, right)->op1 +para(path3@an3, bottom)->e +``` +
+ + Demonstration + + ![img](https://user-images.githubusercontent.com/1086194/137810516-0d7d7307-fc55-466f-b06d-a6ca9f6b8785.png) + +
+ +## Contributors + +via [GitHub](https://github.com/adrai/flowchart.js/graphs/contributors) + +## Thanks + +Many thanks to [js-sequence-diagrams](http://bramp.github.io/js-sequence-diagrams/) which greatly inspired this project, and forms the basis for the syntax. diff --git a/bower.json b/bower.json deleted file mode 100644 index 7f705cc5..00000000 --- a/bower.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "flowchart", - "version": "1.4.1", - "main": "./release/flowchart.min.js", - "dependencies": {}, - "ignore": [ - "src/", - "buildtasks/", - "example/", - ".gitignore", - "Gruntfile.js", - "package.json", - "**/*.zip" - ] -} diff --git a/devserver.js b/devserver.js new file mode 100644 index 00000000..c993de91 --- /dev/null +++ b/devserver.js @@ -0,0 +1,30 @@ +var path = require('path'); +var express = require('express'); +var webpack = require('webpack'); +var config = require('./webpack.config'); + +var port = 8000; +var app = express(); +var compiler = webpack(config); + +app.use(express.static(process.cwd())); + +app.use(require('webpack-dev-middleware')(compiler, { + noInfo: true, + publicPath: config.output.publicPath +})); + +app.use(require('webpack-hot-middleware')(compiler)); + +app.get('/', function (req, res) { + res.sendFile(path.join(__dirname, 'index.html')); +}); + +app.listen(port, '0.0.0.0', function (err) { + if (err) { + console.log(err); + return; + } + + console.log('Listening at http://0.0.0.0:%s', port); +}); diff --git a/example/index.html b/example/index.html index de9af51d..97ef5edc 100644 --- a/example/index.html +++ b/example/index.html @@ -4,13 +4,12 @@ flowchart.js · Playground - + - - +
+cond(no)->para +c2(true)->io->e +c2(false)->e + +para(path1, bottom)->sub1(left)->op1 +para(path2, right)->op2->e + +st@>op1({"stroke":"Red"})@>cond({"stroke":"Red","stroke-width":6,"arrow-end":"classic-wide-long"})@>c2({"stroke":"Red"})@>op2({"stroke":"Red"})@>e({"stroke":"Red"})
diff --git a/example/loadFile.html b/example/loadFile.html index 784f10d0..e44eb7a6 100644 --- a/example/loadFile.html +++ b/example/loadFile.html @@ -6,7 +6,7 @@ - + diff --git a/example/test.txt b/example/test.txt index b8a49a68..62be5261 100644 --- a/example/test.txt +++ b/example/test.txt @@ -1,6 +1,6 @@ st=>start: Start:>http://www.google.com[blank] e=>end:>http://www.google.com -op1=>operation: My Ooooperation +op1=>operation: My Ooooperation:$myFunction sub1=>subroutine: My Subroutine cond=>condition: Yes or No?:>http://www.google.com diff --git a/imgs/condition.png b/imgs/condition.png new file mode 100644 index 00000000..16d50c16 Binary files /dev/null and b/imgs/condition.png differ diff --git a/imgs/end.png b/imgs/end.png new file mode 100644 index 00000000..1e4f7419 Binary files /dev/null and b/imgs/end.png differ diff --git a/imgs/example.svg b/imgs/example.svg new file mode 100644 index 00000000..19096226 --- /dev/null +++ b/imgs/example.svg @@ -0,0 +1 @@ +Created with Raphaël 2.3.0StartInput InfoMy OperationYesor No?catch something...Print infoEndparallel tasksMy Subroutineyesno \ No newline at end of file diff --git a/imgs/input.png b/imgs/input.png new file mode 100644 index 00000000..0fb8d314 Binary files /dev/null and b/imgs/input.png differ diff --git a/imgs/inputoutput.png b/imgs/inputoutput.png new file mode 100644 index 00000000..ce6ee201 Binary files /dev/null and b/imgs/inputoutput.png differ diff --git a/imgs/operation.png b/imgs/operation.png new file mode 100644 index 00000000..bca72f4b Binary files /dev/null and b/imgs/operation.png differ diff --git a/imgs/output.png b/imgs/output.png new file mode 100644 index 00000000..d22a99a8 Binary files /dev/null and b/imgs/output.png differ diff --git a/imgs/parallel.png b/imgs/parallel.png new file mode 100644 index 00000000..e1a0fada Binary files /dev/null and b/imgs/parallel.png differ diff --git a/imgs/start.png b/imgs/start.png new file mode 100644 index 00000000..d3f16dce Binary files /dev/null and b/imgs/start.png differ diff --git a/imgs/subroutine.png b/imgs/subroutine.png new file mode 100644 index 00000000..ea4bbaf1 Binary files /dev/null and b/imgs/subroutine.png differ diff --git a/index.html b/index.html new file mode 100644 index 00000000..eb057b41 --- /dev/null +++ b/index.html @@ -0,0 +1,46 @@ + + + + Demo page + + + + + +
+ st=>start: Start|past:>http://www.google.com[blank] + e=>end: End:>http://www.google.com + op1=>operation: My Operation|past:$myFunction + op2=>operation: Stuff|current + sub1=>subroutine: My Subroutine|invalid + cond=>condition: Yes + or No?|approved:>http://www.google.com + c2=>condition: Good idea|rejected + io=>inputoutput: catch something...|request + para=>parallel: parallel tasks + in=>input: some in + out=>output: some out + + st->op1(right)->cond + cond(yes, right)->c2 + cond(no)->para + c2(true)->io->e + c2(false)->e + + para(path1, left)->sub1(top)->op1 + para(path2, right)->op2->e + para(path3, bottom)->in->out->e +
+ + + + + + + diff --git a/index.js b/index.js new file mode 100644 index 00000000..cd9ccc6a --- /dev/null +++ b/index.js @@ -0,0 +1,13 @@ +require('./src/flowchart.shim'); +var parse = require('./src/flowchart.parse'); +require('./src/jquery-plugin'); + +var FlowChart = { + parse: parse +}; + +if (typeof window !== 'undefined') { + window.flowchart = FlowChart; +} + +module.exports = FlowChart; diff --git a/license b/license index 5e119509..21422f42 100644 --- a/license +++ b/license @@ -1,4 +1,6 @@ -Copyright (c) 2015 Adriano Raiano +The MIT License (MIT) + +Copyright (c) 2023 Adriano Raiano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index da9df357..e29db883 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,35 @@ { "author": "adrai", - "name": "flowchart", - "version": "1.4.1", + "name": "flowchart.js", + "version": "1.18.0", + "main": "./index", "private": false, "engines": { - "node": "~v0.4.12" + "node": ">=4.0.0" }, - "dependencies": {}, + "dependencies": { + "raphael": "2.3.0" + }, + "types": "types/index.d.ts", "devDependencies": { - "grunt": ">=0.4.1", - "grunt-rigger": ">=0.5.0", - "grunt-contrib": ">=0.1.0", + "eslint": "^4.18.2", + "eslint-config-defaults": "^8.0.2", "express": ">= 0.0.1", - "async": ">= 0.1.18", + "jquery": "^3.4.0", "lodash": ">=0.2.1", - "zipstream": ">=0.2.1" + "moment": "^2.11.1", + "webpack": "^1.12.11", + "webpack-dev-middleware": "^1.4.0", + "webpack-hot-middleware": "^2.6.0" }, "scripts": { - "test": "" + "init": "git submodule init && git submodule update && git submodule status", + "start": "node devserver.js", + "lint": "eslint src", + "build:unminified": "NODE_ENV=production webpack -d --config webpack.config.js", + "build:minified": "NODE_ENV=production MINIFIED=1 webpack -d --config webpack.config.js", + "build": "npm run build:unminified && npm run build:minified && cp ./release/flowchart.js ./site/flowchart-latest.js", + "test": "npm run lint" }, "repository": { "type": "git", @@ -29,13 +41,5 @@ "script" ], "homepage": "http://flowchart.js.org/", - "license": "MIT", - "files": [ - "release/flowchart.js", - "release/flowchart.min.js", - "release/flowchart.min.map", - "release/flowchart.amd.js", - "release/flowchart.amd.min.js", - "release/flowchart.amd.min.map" - ] + "license": "MIT" } diff --git a/release/flowchart.amd.js b/release/flowchart.amd.js deleted file mode 100644 index ade0911b..00000000 --- a/release/flowchart.amd.js +++ /dev/null @@ -1,1427 +0,0 @@ -// flowchart, v1.4.1 -// Copyright (c)2015 Adriano Raiano (adrai). -// Distributed under MIT license -// http://adrai.github.io/flowchart.js -(function (root, factory) { - if (typeof exports === 'object') { - - module.exports = factory(); - - } else if (typeof define === 'function' && define.amd) { - - define([], factory); - - } -}(this, function () { - - // add indexOf to non ECMA-262 standard compliant browsers - if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { - "use strict"; - if (this === null) { - throw new TypeError(); - } - var t = Object(this); - var len = t.length >>> 0; - if (len === 0) { - return -1; - } - var n = 0; - if (arguments.length > 0) { - n = Number(arguments[1]); - if (n != n) { // shortcut for verifying if it's NaN - n = 0; - } else if (n !== 0 && n != Infinity && n != -Infinity) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - } - if (n >= len) { - return -1; - } - var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); - for (; k < len; k++) { - if (k in t && t[k] === searchElement) { - return k; - } - } - return -1; - }; - } - - // add lastIndexOf to non ECMA-262 standard compliant browsers - if (!Array.prototype.lastIndexOf) { - Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) { - "use strict"; - if (this === null) { - throw new TypeError(); - } - var t = Object(this); - var len = t.length >>> 0; - if (len === 0) { - return -1; - } - var n = len; - if (arguments.length > 1) { - n = Number(arguments[1]); - if (n != n) { - n = 0; - } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - } - var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n); - for (; k >= 0; k--) { - if (k in t && t[k] === searchElement) { - return k; - } - } - return -1; - }; - } - - if (!String.prototype.trim) { - String.prototype.trim = function() { - return this.replace(/^\s+|\s+$/g, ''); - }; - } - - var root = this, - flowchart = {}; - - // defaults - var o = { - 'x': 0, - 'y': 0, - 'line-width': 3, - 'line-length': 50, - 'text-margin': 10, - 'font-size': 14, - 'font-color': 'black', - // 'font': 'normal', - // 'font-family': 'calibri', - // 'font-weight': 'normal', - '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': {} - }//, - // 'flowstate' : { - // 'past' : { 'fill': '#CCCCCC', 'font-size': 12}, - // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'}, - // 'future' : { 'fill': '#FFFF99'}, - // 'invalid': {'fill': '#444444'} - // } - }; - function _defaults(options, defaultOptions) { - if (!options || typeof options === 'function') { - return defaultOptions; - } - - var merged = {}; - for (var attrname in defaultOptions) { - merged[attrname] = defaultOptions[attrname]; - } - - for (attrname in options) { - if (options[attrname]) { - if (typeof merged[attrname] === 'object') { - merged[attrname] = _defaults(merged[attrname], options[attrname]); - } else { - merged[attrname] = options[attrname]; - } - } - } - return merged; - } - - function _inherits(ctor, superCtor) { - if (typeof(Object.create) === 'function') { - // implementation from standard node.js 'util' module - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - } else { - // old school shim for old browsers - ctor.super_ = superCtor; - var TempCtor = function () {}; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - } - } - - // move dependent functions to a container so that - // they can be overriden easier in no jquery environment (node.js) - var f = { - defaults: _defaults, - inherits: _inherits - }; - function drawPath(chart, location, points) { - var i, len; - var path = 'M{0},{1}'; - for (i = 2, len = 2 * points.length + 2; i < len; i+=2) { - path += ' L{' + i + '},{' + (i + 1) + '}'; - } - var pathValues = [location.x, location.y]; - for (i = 0, len = points.length; i < len; i++) { - pathValues.push(points[i].x); - pathValues.push(points[i].y); - } - var symbol = chart.paper.path(path, pathValues); - symbol.attr('stroke', chart.options['element-color']); - symbol.attr('stroke-width', chart.options['line-width']); - - var font = chart.options['font']; - var fontF = chart.options['font-family']; - var fontW = chart.options['font-weight']; - - if (font) symbol.attr({ 'font': font }); - if (fontF) symbol.attr({ 'font-family': fontF }); - if (fontW) symbol.attr({ 'font-weight': fontW }); - - return symbol; - } - - function drawLine(chart, from, to, text) { - var i, len; - - if (Object.prototype.toString.call(to) !== '[object Array]') { - to = [to]; - } - - var path = 'M{0},{1}'; - for (i = 2, len = 2 * to.length + 2; i < len; i+=2) { - path += ' L{' + i + '},{' + (i + 1) + '}'; - } - var pathValues = [from.x, from.y]; - for (i = 0, len = to.length; i < len; i++) { - pathValues.push(to[i].x); - pathValues.push(to[i].y); - } - - var line = chart.paper.path(path, pathValues); - line.attr({ - stroke: chart.options['line-color'], - 'stroke-width': chart.options['line-width'], - 'arrow-end': chart.options['arrow-end'] - }); - - var font = chart.options['font']; - var fontF = chart.options['font-family']; - var fontW = chart.options['font-weight']; - - if (font) line.attr({ 'font': font }); - if (fontF) line.attr({ 'font-family': fontF }); - if (fontW) line.attr({ 'font-weight': fontW }); - - if (text) { - - var centerText = false; - - var textPath = chart.paper.text(0, 0, text); - - var isHorizontal = false; - var firstTo = to[0]; - - if (from.y === firstTo.y) { - isHorizontal = true; - } - - var x = 0, - y = 0; - - if (centerText) { - if (from.x > firstTo.x) { - x = from.x - (from.x - firstTo.x)/2; - } else { - x = firstTo.x - (firstTo.x - from.x)/2; - } - - if (from.y > firstTo.y) { - y = from.y - (from.y - firstTo.y)/2; - } else { - y = firstTo.y - (firstTo.y - from.y)/2; - } - - if (isHorizontal) { - x -= textPath.getBBox().width/2; - y -= chart.options['text-margin']; - } else { - x += chart.options['text-margin']; - y -= textPath.getBBox().height/2; - } - } else { - x = from.x; - y = from.y; - - if (isHorizontal) { - x += chart.options['text-margin']/2; - y -= chart.options['text-margin']; - } else { - x += chart.options['text-margin']/2; - y += chart.options['text-margin']; - } - } - - textPath.attr({ - 'text-anchor': 'start', - 'font-size': chart.options['font-size'], - 'fill': chart.options['font-color'], - x: x, - y: y - }); - - if (font) textPath.attr({ 'font': font }); - if (fontF) textPath.attr({ 'font-family': fontF }); - if (fontW) textPath.attr({ 'font-weight': fontW }); - } - - return line; - } - - function checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) { - // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point - var denominator, a, b, numerator1, numerator2, result = { - x: null, - y: null, - onLine1: false, - onLine2: false - }; - denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY)); - if (denominator === 0) { - return result; - } - a = line1StartY - line2StartY; - b = line1StartX - line2StartX; - numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b); - numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b); - a = numerator1 / denominator; - b = numerator2 / denominator; - - // if we cast these lines infinitely in both directions, they intersect here: - result.x = line1StartX + (a * (line1EndX - line1StartX)); - result.y = line1StartY + (a * (line1EndY - line1StartY)); - /* - // it is worth noting that this should be the same as: - x = line2StartX + (b * (line2EndX - line2StartX)); - y = line2StartX + (b * (line2EndY - line2StartY)); - */ - // if line1 is a segment and line2 is infinite, they intersect if: - if (a > 0 && a < 1) { - result.onLine1 = true; - } - // if line2 is a segment and line1 is infinite, they intersect if: - if (b > 0 && b < 1) { - result.onLine2 = true; - } - // if line1 and line2 are segments, they intersect if both of the above are true - return result; - } - function FlowChart(container, options) { - options = options || {}; - - this.paper = new Raphael(container); - - this.options = f.defaults(options, o); - - this.symbols = []; - this.lines = []; - this.start = null; - } - - FlowChart.prototype.handle = function(symbol) { - if (this.symbols.indexOf(symbol) <= -1) { - this.symbols.push(symbol); - } - - var flowChart = this; - - if (symbol instanceof(Condition)) { - symbol.yes = function(nextSymbol) { - symbol.yes_symbol = nextSymbol; - if(symbol.no_symbol) { - symbol.pathOk = true; - } - return flowChart.handle(nextSymbol); - }; - symbol.no = function(nextSymbol) { - symbol.no_symbol = nextSymbol; - if(symbol.yes_symbol) { - symbol.pathOk = true; - } - return flowChart.handle(nextSymbol); - }; - } else { - symbol.then = function(nextSymbol) { - symbol.next = nextSymbol; - symbol.pathOk = true; - return flowChart.handle(nextSymbol); - }; - } - - return symbol; - }; - - FlowChart.prototype.startWith = function(symbol) { - this.start = symbol; - return this.handle(symbol); - }; - - FlowChart.prototype.render = function() { - var maxWidth = 0, - maxHeight = 0, - i = 0, - len = 0, - maxX = 0, - maxY = 0, - symbol; - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - if (symbol.width > maxWidth) { - maxWidth = symbol.width; - } - if (symbol.height > maxHeight) { - maxHeight = symbol.height; - } - } - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']); - symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']); - } - - this.start.render(); - // for (i = 0, len = this.symbols.length; i < len; i++) { - // symbol = this.symbols[i]; - // symbol.render(); - // } - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - symbol.renderLines(); - } - - maxX = this.maxXFromLine; - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - var x = symbol.getX() + symbol.width; - var y = symbol.getY() + symbol.height; - if (x > maxX) { - maxX = x; - } - if (y > maxY) { - maxY = y; - } - } - - var scale = this.options['scale']; - var lineWidth = this.options['line-width']; - this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale)); - this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true); - }; - - FlowChart.prototype.clean = function() { - if (this.paper) { - var paperDom = this.paper.canvas; - paperDom.parentNode.removeChild(paperDom); - } - }; - function Symbol(chart, options, symbol) { - this.chart = chart; - this.group = this.chart.paper.set(); - this.symbol = symbol; - this.connectedTo = []; - this.symbolType = options.symbolType; - this.flowstate = (options.flowstate || 'future'); - - this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined; - - this.text = this.chart.paper.text(0, 0, options.text); - //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t - if (options.key) { this.text.node.id = options.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 font = this.getAttr('font'); - var fontF = this.getAttr('font-family'); - var fontW = this.getAttr('font-weight'); - - if (font) this.text.attr({ 'font': font }); - if (fontF) this.text.attr({ 'font-family': fontF }); - if (fontW) this.text.attr({ 'font-weight': fontW }); - - if (options.link) { this.text.attr('href', options.link); } - if (options.target) { this.text.attr('target', options.target); } - - var maxWidth = this.getAttr('maxWidth'); - if (maxWidth) { - // using this approach: http://stackoverflow.com/a/3153457/22466 - var words = options.text.split(' '); - var tempText = ""; - for (var i=0, ii=words.length; i maxWidth) { - tempText += "\n" + word; - } else { - tempText += " " + word; - } - } - this.text.attr("text", tempText.substring(1)); - } - - this.group.push(this.text); - - if (symbol) { - var tmpMargin = this.getAttr('text-margin'); - - symbol.attr({ - 'fill' : this.getAttr('fill'), - 'stroke' : this.getAttr('element-color'), - 'stroke-width' : this.getAttr('line-width'), - 'width' : this.text.getBBox().width + 2 * tmpMargin, - 'height' : this.text.getBBox().height + 2 * tmpMargin - }); - - symbol.node.setAttribute('class', this.getAttr('class')); - - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.text.attr({ - 'y': symbol.getBBox().height/2 - }); - - this.initialize(); - } - - } - - /* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */ - Symbol.prototype.getAttr = function(attName) { - if (!this.chart) { - return undefined; - } - var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined; - var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined; - var opt1; - if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) { - opt1 = this.chart.options.flowstate[this.flowstate][attName]; - } - return (opt1 || opt2 || opt3); - }; - - Symbol.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; - }; - - Symbol.prototype.getCenter = function() { - return {x: this.getX() + this.width/2, - y: this.getY() + this.height/2}; - }; - - Symbol.prototype.getX = function() { - return this.group.getBBox().x; - }; - - Symbol.prototype.getY = function() { - return this.group.getBBox().y; - }; - - Symbol.prototype.shiftX = function(x) { - this.group.transform('t' + (this.getX() + x) + ',' + this.getY()); - }; - - Symbol.prototype.setX = function(x) { - this.group.transform('t' + x + ',' + this.getY()); - }; - - Symbol.prototype.shiftY = function(y) { - this.group.transform('t' + this.getX() + ',' + (this.getY() + y)); - }; - - Symbol.prototype.setY = function(y) { - this.group.transform('t' + this.getX() + ',' + y); - }; - - Symbol.prototype.getTop = function() { - var y = this.getY(); - var x = this.getX() + this.width/2; - return {x: x, y: y}; - }; - - Symbol.prototype.getBottom = function() { - var y = this.getY() + this.height; - var x = this.getX() + this.width/2; - return {x: x, y: y}; - }; - - Symbol.prototype.getLeft = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX(); - return {x: x, y: y}; - }; - - Symbol.prototype.getRight = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.group.getBBox().width; - return {x: x, y: y}; - }; - - Symbol.prototype.render = function() { - if (this.next) { - - var lineLength = this.getAttr('line-length'); - - if (this.next_direction === 'right') { - - var rightPoint = this.getRight(); - var leftPoint = this.next.getLeft(); - - if (!this.next.isPositioned) { - - this.next.setY(rightPoint.y - this.next.height/2); - this.next.shiftX(this.group.getBBox().x + this.width + lineLength); - - var self = this; - (function shift() { - var hasSymbolUnder = false; - var symb; - for (var i = 0, len = self.chart.symbols.length; i < len; i++) { - symb = self.chart.symbols[i]; - - var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x); - if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) { - hasSymbolUnder = true; - break; - } - } - - if (hasSymbolUnder) { - self.next.setX(symb.getX() + symb.width + lineLength); - shift(); - } - })(); - - this.next.isPositioned = true; - - this.next.render(); - } - } else { - var bottomPoint = this.getBottom(); - var topPoint = this.next.getTop(); - - if (!this.next.isPositioned) { - this.next.shiftY(this.getY() + this.height + lineLength); - this.next.setX(bottomPoint.x - this.next.width/2); - this.next.isPositioned = true; - - this.next.render(); - } - } - } - }; - - Symbol.prototype.renderLines = function() { - if (this.next) { - if (this.next_direction) { - this.drawLineTo(this.next, '', this.next_direction); - } else { - this.drawLineTo(this.next); - } - } - }; - - Symbol.prototype.drawLineTo = function(symbol, text, origin) { - if (this.connectedTo.indexOf(symbol) < 0) { - this.connectedTo.push(symbol); - } - - var x = this.getCenter().x, - y = this.getCenter().y, - top = this.getTop(), - right = this.getRight(), - bottom = this.getBottom(), - left = this.getLeft(); - - var symbolX = symbol.getCenter().x, - symbolY = symbol.getCenter().y, - symbolTop = symbol.getTop(), - symbolRight = symbol.getRight(), - symbolBottom = symbol.getBottom(), - symbolLeft = symbol.getLeft(); - - var isOnSameColumn = x === symbolX, - isOnSameLine = y === symbolY, - isUnder = y < symbolY, - isUpper = y > symbolY, - isLeft = x > symbolX, - isRight = x < symbolX; - - var maxX = 0, - line, - lineLength = this.getAttr('line-length'), - lineWith = this.getAttr('line-width'); - - if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) { - line = drawLine(this.chart, bottom, symbolTop, text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x; - } else if ((!origin || origin === 'right') && isOnSameLine && isRight) { - line = drawLine(this.chart, right, symbolLeft, text); - this.rightStart = true; - symbol.leftEnd = true; - maxX = symbolLeft.x; - } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) { - line = drawLine(this.chart, left, symbolRight, text); - this.leftStart = true; - symbol.rightEnd = true; - maxX = symbolRight.x; - } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((!origin || origin === 'bottom') && isLeft) { - if (this.leftEnd && isUpper) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - } else { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - } - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + (bottom.x - symbolTop.x)/2; - } else if ((!origin || origin === 'bottom') && isRight) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + (bottom.x - symbolTop.x)/2; - } else if ((origin && origin === 'right') && isLeft) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((origin && origin === 'right') && isRight) { - line = drawLine(this.chart, right, [ - {x: symbolTop.x, y: right.y}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: right.x + lineLength/2, y: bottom.y + lineLength/2}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + lineLength/2; - } else if ((origin === 'left') && isOnSameColumn && isUpper) { - var diffX = left.x - lineLength/2; - if (symbolLeft.x < left.x) { - diffX = symbolLeft.x - lineLength/2; - } - line = drawLine(this.chart, left, [ - {x: diffX, y: left.y}, - {x: diffX, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.leftStart = true; - symbol.topEnd = true; - maxX = left.x; - } else if ((origin === 'left')) { - line = drawLine(this.chart, left, [ - {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: left.y}, - {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.leftStart = true; - symbol.topEnd = true; - maxX = left.x; - } - - if (line) { - var self = this; - for (var l = 0, llen = this.chart.lines.length; l < llen; l++) { - var otherLine = this.chart.lines[l]; - var i, - len, - intersections, - inter; - - var ePath = otherLine.attr('path'), - lPath = line.attr('path'); - - for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) { - var newPath = []; - newPath.push(['M', ePath[iP][1], ePath[iP][2]]); - newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]); - - var line1_from_x = newPath[0][1]; - var line1_from_y = newPath[0][2]; - var line1_to_x = newPath[1][1]; - var line1_to_y = newPath[1][2]; - - for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) { - var newLinePath = []; - newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]); - newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]); - - var line2_from_x = newLinePath[0][1]; - var line2_from_y = newLinePath[0][2]; - var line2_to_x = newLinePath[1][1]; - var line2_to_y = newLinePath[1][2]; - - var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y); - if (res.onLine1 && res.onLine2) { - - var newSegment; - if (line2_from_y === line2_to_y) { - if (line2_from_x > line2_to_x) { - newSegment = ['L', res.x + lineWith * 2, line2_from_y]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); - } else { - newSegment = ['L', res.x - lineWith * 2, line2_from_y]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); - } - } else { - if (line2_from_y > line2_to_y) { - newSegment = ['L', line2_from_x, res.y + lineWith * 2]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); - } else { - newSegment = ['L', line2_from_x, res.y - lineWith * 2]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); - } - } - - lP += 2; - len += 2; - } - } - } - } - - this.chart.lines.push(line); - } - - if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) { - this.chart.maxXFromLine = maxX; - } - }; - function Start(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0, 20); - options = options || {}; - options.text = options.text || 'Start'; - Symbol.call(this, chart, options, symbol); - } - f.inherits(Start, Symbol); - - - // Start.prototype.render = function() { - // if (this.next) { - // var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length']; - - // var bottomPoint = this.getBottom(); - // var topPoint = this.next.getTop(); - - // if (!this.next.isPositioned) { - // this.next.shiftY(this.getY() + this.height + lineLength); - // this.next.setX(bottomPoint.x - this.next.width/2); - // this.next.isPositioned = true; - - // this.next.render(); - // } - // } - // }; - - // Start.prototype.renderLines = function() { - // if (this.next) { - // this.drawLineTo(this.next); - // } - // }; - function End(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0, 20); - options = options || {}; - options.text = options.text || 'End'; - Symbol.call(this, chart, options, symbol); - } - f.inherits(End, Symbol); - function Operation(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0); - options = options || {}; - Symbol.call(this, chart, options, symbol); - } - f.inherits(Operation, Symbol); - function Subroutine(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0); - options = options || {}; - Symbol.call(this, chart, options, symbol); - - symbol.attr({ - width: this.text.getBBox().width + 4 * this.getAttr('text-margin') - }); - - this.text.attr({ - 'x': 2 * this.getAttr('text-margin') - }); - - var innerWrap = chart.paper.rect(0, 0, 0, 0); - innerWrap.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') - }); - if (options.key) { innerWrap.node.id = options.key + 'i'; } - - var font = this.getAttr('font'); - var fontF = this.getAttr('font-family'); - var fontW = this.getAttr('font-weight'); - - if (font) innerWrap.attr({ 'font': font }); - if (fontF) innerWrap.attr({ 'font-family': fontF }); - if (fontW) innerWrap.attr({ 'font-weight': fontW }); - - if (options.link) { innerWrap.attr('href', options.link); } - if (options.target) { innerWrap.attr('target', options.target); } - this.group.push(innerWrap); - innerWrap.insertBefore(this.text); - - this.initialize(); - } - f.inherits(Subroutine, Symbol); - function InputOutput(chart, options) { - options = options || {}; - Symbol.call(this, chart, options); - this.textMargin = this.getAttr('text-margin'); - - this.text.attr({ - x: this.textMargin * 3 - }); - - var width = this.text.getBBox().width + 4 * this.textMargin; - var height = this.text.getBBox().height + 2 * this.textMargin; - var startX = this.textMargin; - var startY = height/2; - - var start = {x: startX, y: startY}; - var points = [ - {x: startX - this.textMargin, y: height}, - {x: startX - this.textMargin + width, y: height}, - {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0}, - {x: startX - this.textMargin + 2 * this.textMargin, y: 0}, - {x: startX, y: startY} - ]; - - var symbol = drawPath(chart, start, points); - - symbol.attr({ - stroke: this.getAttr('element-color'), - 'stroke-width': this.getAttr('line-width'), - fill: this.getAttr('fill') - }); - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - symbol.node.setAttribute('class', this.getAttr('class')); - - this.text.attr({ - y: symbol.getBBox().height/2 - }); - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.initialize(); - } - f.inherits(InputOutput, Symbol); - - InputOutput.prototype.getLeft = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.textMargin; - return {x: x, y: y}; - }; - - InputOutput.prototype.getRight = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.group.getBBox().width - this.textMargin; - return {x: x, y: y}; - }; - function Condition(chart, options) { - options = options || {}; - Symbol.call(this, chart, options); - this.textMargin = this.getAttr('text-margin'); - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - if (options.yes && options['direction_yes'] && options.no && !options['direction_no']) { - if (options['direction_yes'] === 'right') { - this.no_direction = 'bottom'; - this.yes_direction = 'right'; - } else { - this.no_direction = 'right'; - this.yes_direction = 'bottom'; - } - } else if (options.yes && !options['direction_yes'] && options.no && options['direction_no']) { - if (options['direction_no'] === 'right') { - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - } else { - this.yes_direction = 'right'; - this.no_direction = 'bottom'; - } - } else { - 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: this.textMargin * 2 - }); - - var width = this.text.getBBox().width + 3 * this.textMargin; - width += width/2; - var height = this.text.getBBox().height + 2 * this.textMargin; - height += height/2; - height = Math.max(width * 0.5, height); - var startX = width/4; - var startY = height/4; - - this.text.attr({ - x: startX + this.textMargin/2 - }); - - var start = {x: startX, y: startY}; - var points = [ - {x: startX - width/4, y: startY + height/4}, - {x: startX - width/4 + width/2, y: startY + height/4 + height/2}, - {x: startX - width/4 + width, y: startY + height/4}, - {x: startX - width/4 + width/2, y: startY + height/4 - height/2}, - {x: startX - width/4, y: startY + height/4} - ]; - - var symbol = drawPath(chart, start, points); - - symbol.attr({ - stroke: this.getAttr('element-color'), - 'stroke-width': this.getAttr('line-width'), - fill: this.getAttr('fill') - }); - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - symbol.node.setAttribute('class', this.getAttr('class')); - - this.text.attr({ - y: symbol.getBBox().height/2 - }); - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.initialize(); - } - f.inherits(Condition, Symbol); - - Condition.prototype.render = function() { - - if (this.yes_direction) { - this[this.yes_direction + '_symbol'] = this.yes_symbol; - } - - if (this.no_direction) { - this[this.no_direction + '_symbol'] = this.no_symbol; - } - - var lineLength = this.getAttr('line-length'); - - if (this.bottom_symbol) { - var bottomPoint = this.getBottom(); - var topPoint = this.bottom_symbol.getTop(); - - if (!this.bottom_symbol.isPositioned) { - this.bottom_symbol.shiftY(this.getY() + this.height + lineLength); - this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2); - this.bottom_symbol.isPositioned = true; - - this.bottom_symbol.render(); - } - } - - if (this.right_symbol) { - var rightPoint = this.getRight(); - var leftPoint = this.right_symbol.getLeft(); - - if (!this.right_symbol.isPositioned) { - - this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2); - this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength); - - var self = this; - (function shift() { - var hasSymbolUnder = false; - var symb; - for (var i = 0, len = self.chart.symbols.length; i < len; i++) { - symb = self.chart.symbols[i]; - - var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x); - if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) { - hasSymbolUnder = true; - break; - } - } - - if (hasSymbolUnder) { - self.right_symbol.setX(symb.getX() + symb.width + lineLength); - shift(); - } - })(); - - this.right_symbol.isPositioned = true; - - this.right_symbol.render(); - } - } - }; - - Condition.prototype.renderLines = function() { - if (this.yes_symbol) { - this.drawLineTo(this.yes_symbol, this.getAttr('yes-text'), this.yes_direction); - } - - if (this.no_symbol) { - this.drawLineTo(this.no_symbol, this.getAttr('no-text'), this.no_direction); - } - }; - function parse(input) { - input = input || ''; - input = input.trim(); - - var chart = { - symbols: {}, - start: null, - drawSVG: function(container, options) { - var self = this; - - if (this.diagram) { - this.diagram.clean(); - } - - var diagram = new FlowChart(container, options); - this.diagram = diagram; - var dispSymbols = {}; - - function getDisplaySymbol(s) { - if (dispSymbols[s.key]) { - return dispSymbols[s.key]; - } - - switch (s.symbolType) { - case 'start': - dispSymbols[s.key] = new Start(diagram, s); - break; - case 'end': - dispSymbols[s.key] = new End(diagram, s); - break; - case 'operation': - dispSymbols[s.key] = new Operation(diagram, s); - break; - case 'inputoutput': - dispSymbols[s.key] = new InputOutput(diagram, s); - break; - case 'subroutine': - dispSymbols[s.key] = new Subroutine(diagram, s); - break; - case 'condition': - dispSymbols[s.key] = new Condition(diagram, s); - break; - default: - return new Error('Wrong symbol type!'); - } - - return dispSymbols[s.key]; - } - - (function constructChart(s, prevDisp, prev) { - var dispSymb = getDisplaySymbol(s); - - if (self.start === s) { - diagram.startWith(dispSymb); - } else if (prevDisp && prev && !prevDisp.pathOk) { - if (prevDisp instanceof(Condition)) { - if (prev.yes === s) { - prevDisp.yes(dispSymb); - } - if (prev.no === s) { - prevDisp.no(dispSymb); - } - } else { - prevDisp.then(dispSymb); - } - } - - if (dispSymb.pathOk) { - return dispSymb; - } - - if (dispSymb instanceof(Condition)) { - if (s.yes) { - constructChart(s.yes, dispSymb, s); - } - if (s.no) { - constructChart(s.no, dispSymb, s); - } - } else if (s.next) { - constructChart(s.next, dispSymb, s); - } - - return dispSymb; - })(this.start); - - diagram.render(); - }, - clean: function() { - this.diagram.clean(); - } - }; - - var lines = []; - var prevBreak = 0; - for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) { - if(input[i0] === '\n' && input[i0 - 1] !== '\\') { - var line0 = input.substring(prevBreak, i0); - prevBreak = i0 + 1; - lines.push(line0.replace(/\\\n/g, '\n')); - } - } - - if(prevBreak < input.length) { - lines.push(input.substr(prevBreak)); - } - - for (var l = 1, len = lines.length; l < len;) { - var currentLine = lines[l]; - - if (currentLine.indexOf(': ') < 0 && currentLine.indexOf('(') < 0 && currentLine.indexOf(')') < 0 && currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0) { - lines[l - 1] += '\n' + currentLine; - lines.splice(l, 1); - len--; - } else { - l++; - } - } - - function getSymbol(s) { - var startIndex = s.indexOf('(') + 1; - var endIndex = s.indexOf(')'); - if (startIndex >= 0 && endIndex >= 0) { - return chart.symbols[s.substring(0, startIndex - 1)]; - } - return chart.symbols[s]; - } - - function getNextPath(s) { - var next = 'next'; - var startIndex = s.indexOf('(') + 1; - var endIndex = s.indexOf(')'); - if (startIndex >= 0 && endIndex >= 0) { - next = flowSymb.substring(startIndex, endIndex); - if (next.indexOf(',') < 0) { - if (next !== 'yes' && next !== 'no') { - next = 'next, ' + next; - } - } - } - return next; - } - - while (lines.length > 0) { - var line = lines.splice(0, 1)[0]; - - if (line.indexOf('=>') >= 0) { - // definition - var parts = line.split('=>'); - var symbol = { - key: parts[0], - symbolType: parts[1], - text: null, - link: null, - target: null, - flowstate: null - }; - - var sub; - - if (symbol.symbolType.indexOf(': ') >= 0) { - sub = symbol.symbolType.split(': '); - symbol.symbolType = sub[0]; - symbol.text = sub[1]; - } - - if (symbol.text && symbol.text.indexOf(':>') >= 0) { - sub = symbol.text.split(':>'); - symbol.text = sub[0]; - symbol.link = sub[1]; - } else if (symbol.symbolType.indexOf(':>') >= 0) { - sub = symbol.symbolType.split(':>'); - symbol.symbolType = sub[0]; - symbol.link = sub[1]; - } - - if (symbol.symbolType.indexOf('\n') >= 0) { - symbol.symbolType = symbol.symbolType.split('\n')[0]; - } - - /* adding support for links */ - if (symbol.link) { - var startIndex = symbol.link.indexOf('[') + 1; - var endIndex = symbol.link.indexOf(']'); - if (startIndex >= 0 && endIndex >= 0) { - symbol.target = symbol.link.substring(startIndex, endIndex); - symbol.link = symbol.link.substring(0, startIndex - 1); - } - } - /* end of link support */ - - /* adding support for flowstates */ - if (symbol.text) { - if (symbol.text.indexOf('|') >= 0) { - var txtAndState = symbol.text.split('|'); - symbol.text = txtAndState[0]; - symbol.flowstate = txtAndState[1].trim(); - } - } - /* end of flowstate support */ - - chart.symbols[symbol.key] = symbol; - - } else if (line.indexOf('->') >= 0) { - // flow - var flowSymbols = line.split('->'); - for (var i = 0, lenS = flowSymbols.length; i < lenS; i++) { - var flowSymb = flowSymbols[i]; - - var realSymb = getSymbol(flowSymb); - var next = getNextPath(flowSymb); - - var direction = null; - if (next.indexOf(',') >= 0) { - var condOpt = next.split(','); - next = condOpt[0]; - direction = condOpt[1].trim(); - } - - if (!chart.start) { - chart.start = realSymb; - } - - if (i + 1 < lenS) { - var nextSymb = flowSymbols[i + 1]; - realSymb[next] = getSymbol(nextSymb); - realSymb['direction_' + next] = direction; - direction = null; - } - } - } - - } - return chart; - } - // public api interface - flowchart.parse = parse; - - return flowchart; - -})); \ No newline at end of file diff --git a/release/flowchart.amd.min.js b/release/flowchart.amd.min.js deleted file mode 100644 index ab85c786..00000000 --- a/release/flowchart.amd.min.js +++ /dev/null @@ -1,7 +0,0 @@ -// flowchart, v1.4.1 -// Copyright (c)2015 Adriano Raiano (adrai). -// Distributed under MIT license -// http://adrai.github.io/flowchart.js - -!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd&&define([],b)}(this,function(){function a(b,c){if(!b||"function"==typeof b)return c;var d={};for(var e in c)d[e]=c[e];for(e in b)b[e]&&("object"==typeof d[e]?d[e]=a(d[e],b[e]):d[e]=b[e]);return d}function b(a,b){if("function"==typeof Object.create)a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});else{a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}}function c(a,b,c){var d,e,f="M{0},{1}";for(d=2,e=2*c.length+2;e>d;d+=2)f+=" L{"+d+"},{"+(d+1)+"}";var g=[b.x,b.y];for(d=0,e=c.length;e>d;d++)g.push(c[d].x),g.push(c[d].y);var h=a.paper.path(f,g);h.attr("stroke",a.options["element-color"]),h.attr("stroke-width",a.options["line-width"]);var i=a.options.font,j=a.options["font-family"],k=a.options["font-weight"];return i&&h.attr({font:i}),j&&h.attr({"font-family":j}),k&&h.attr({"font-weight":k}),h}function d(a,b,c,d){var e,f;"[object Array]"!==Object.prototype.toString.call(c)&&(c=[c]);var g="M{0},{1}";for(e=2,f=2*c.length+2;f>e;e+=2)g+=" L{"+e+"},{"+(e+1)+"}";var h=[b.x,b.y];for(e=0,f=c.length;f>e;e++)h.push(c[e].x),h.push(c[e].y);var i=a.paper.path(g,h);i.attr({stroke:a.options["line-color"],"stroke-width":a.options["line-width"],"arrow-end":a.options["arrow-end"]});var j=a.options.font,k=a.options["font-family"],l=a.options["font-weight"];if(j&&i.attr({font:j}),k&&i.attr({"font-family":k}),l&&i.attr({"font-weight":l}),d){var m=!1,n=a.paper.text(0,0,d),o=!1,p=c[0];b.y===p.y&&(o=!0);var q=0,r=0;m?(q=b.x>p.x?b.x-(b.x-p.x)/2:p.x-(p.x-b.x)/2,r=b.y>p.y?b.y-(b.y-p.y)/2:p.y-(p.y-b.y)/2,o?(q-=n.getBBox().width/2,r-=a.options["text-margin"]):(q+=a.options["text-margin"],r-=n.getBBox().height/2)):(q=b.x,r=b.y,o?(q+=a.options["text-margin"]/2,r-=a.options["text-margin"]):(q+=a.options["text-margin"]/2,r+=a.options["text-margin"])),n.attr({"text-anchor":"start","font-size":a.options["font-size"],fill:a.options["font-color"],x:q,y:r}),j&&n.attr({font:j}),k&&n.attr({"font-family":k}),l&&n.attr({"font-weight":l})}return i}function e(a,b,c,d,e,f,g,h){var i,j,k,l,m,n={x:null,y:null,onLine1:!1,onLine2:!1};return i=(h-f)*(c-a)-(g-e)*(d-b),0===i?n:(j=b-f,k=a-e,l=(g-e)*j-(h-f)*k,m=(c-a)*j-(d-b)*k,j=l/i,k=m/i,n.x=a+j*(c-a),n.y=b+j*(d-b),j>0&&1>j&&(n.onLine1=!0),k>0&&1>k&&(n.onLine2=!0),n)}function f(a,b){b=b||{},this.paper=new Raphael(a),this.options=q.defaults(b,p),this.symbols=[],this.lines=[],this.start=null}function g(a,b,c){this.chart=a,this.group=this.chart.paper.set(),this.symbol=c,this.connectedTo=[],this.symbolType=b.symbolType,this.flowstate=b.flowstate||"future",this.next_direction=b.next&&b.direction_next?b.direction_next:void 0,this.text=this.chart.paper.text(0,0,b.text),b.key&&(this.text.node.id=b.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 d=this.getAttr("font"),e=this.getAttr("font-family"),f=this.getAttr("font-weight");d&&this.text.attr({font:d}),e&&this.text.attr({"font-family":e}),f&&this.text.attr({"font-weight":f}),b.link&&this.text.attr("href",b.link),b.target&&this.text.attr("target",b.target);var g=this.getAttr("maxWidth");if(g){for(var h=b.text.split(" "),i="",j=0,k=h.length;k>j;j++){var l=h[j];this.text.attr("text",i+" "+l),i+=this.text.getBBox().width>g?"\n"+l:" "+l}this.text.attr("text",i.substring(1))}if(this.group.push(this.text),c){var m=this.getAttr("text-margin");c.attr({fill:this.getAttr("fill"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*m,height:this.text.getBBox().height+2*m}),c.node.setAttribute("class",this.getAttr("class")),b.link&&c.attr("href",b.link),b.target&&c.attr("target",b.target),b.key&&(c.node.id=b.key),this.group.push(c),c.insertBefore(this.text),this.text.attr({y:c.getBBox().height/2}),this.initialize()}}function h(a,b){var c=a.paper.rect(0,0,0,0,20);b=b||{},b.text=b.text||"Start",g.call(this,a,b,c)}function i(a,b){var c=a.paper.rect(0,0,0,0,20);b=b||{},b.text=b.text||"End",g.call(this,a,b,c)}function j(a,b){var c=a.paper.rect(0,0,0,0);b=b||{},g.call(this,a,b,c)}function k(a,b){var c=a.paper.rect(0,0,0,0);b=b||{},g.call(this,a,b,c),c.attr({width:this.text.getBBox().width+4*this.getAttr("text-margin")}),this.text.attr({x:2*this.getAttr("text-margin")});var d=a.paper.rect(0,0,0,0);d.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")}),b.key&&(d.node.id=b.key+"i");var e=this.getAttr("font"),f=this.getAttr("font-family"),h=this.getAttr("font-weight");e&&d.attr({font:e}),f&&d.attr({"font-family":f}),h&&d.attr({"font-weight":h}),b.link&&d.attr("href",b.link),b.target&&d.attr("target",b.target),this.group.push(d),d.insertBefore(this.text),this.initialize()}function l(a,b){b=b||{},g.call(this,a,b),this.textMargin=this.getAttr("text-margin"),this.text.attr({x:3*this.textMargin});var d=this.text.getBBox().width+4*this.textMargin,e=this.text.getBBox().height+2*this.textMargin,f=this.textMargin,h=e/2,i={x:f,y:h},j=[{x:f-this.textMargin,y:e},{x:f-this.textMargin+d,y:e},{x:f-this.textMargin+d+2*this.textMargin,y:0},{x:f-this.textMargin+2*this.textMargin,y:0},{x:f,y:h}],k=c(a,i,j);k.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),b.link&&k.attr("href",b.link),b.target&&k.attr("target",b.target),b.key&&(k.node.id=b.key),k.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:k.getBBox().height/2}),this.group.push(k),k.insertBefore(this.text),this.initialize()}function m(a,b){b=b||{},g.call(this,a,b),this.textMargin=this.getAttr("text-margin"),this.yes_direction="bottom",this.no_direction="right",b.yes&&b.direction_yes&&b.no&&!b.direction_no?"right"===b.direction_yes?(this.no_direction="bottom",this.yes_direction="right"):(this.no_direction="right",this.yes_direction="bottom"):b.yes&&!b.direction_yes&&b.no&&b.direction_no?"right"===b.direction_no?(this.yes_direction="bottom",this.no_direction="right"):(this.yes_direction="right",this.no_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 d=this.text.getBBox().width+3*this.textMargin;d+=d/2;var e=this.text.getBBox().height+2*this.textMargin;e+=e/2,e=Math.max(.5*d,e);var f=d/4,h=e/4;this.text.attr({x:f+this.textMargin/2});var i={x:f,y:h},j=[{x:f-d/4,y:h+e/4},{x:f-d/4+d/2,y:h+e/4+e/2},{x:f-d/4+d,y:h+e/4},{x:f-d/4+d/2,y:h+e/4-e/2},{x:f-d/4,y:h+e/4}],k=c(a,i,j);k.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),b.link&&k.attr("href",b.link),b.target&&k.attr("target",b.target),b.key&&(k.node.id=b.key),k.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:k.getBBox().height/2}),this.group.push(k),k.insertBefore(this.text),this.initialize()}function n(a){function b(a){var b=a.indexOf("(")+1,c=a.indexOf(")");return b>=0&&c>=0?d.symbols[a.substring(0,b-1)]:d.symbols[a]}function c(a){var b="next",c=a.indexOf("(")+1,d=a.indexOf(")");return c>=0&&d>=0&&(b=D.substring(c,d),b.indexOf(",")<0&&"yes"!==b&&"no"!==b&&(b="next, "+b)),b}a=a||"",a=a.trim();for(var d={symbols:{},start:null,drawSVG:function(a,b){function c(a){if(g[a.key])return g[a.key];switch(a.symbolType){case"start":g[a.key]=new h(e,a);break;case"end":g[a.key]=new i(e,a);break;case"operation":g[a.key]=new j(e,a);break;case"inputoutput":g[a.key]=new l(e,a);break;case"subroutine":g[a.key]=new k(e,a);break;case"condition":g[a.key]=new m(e,a);break;default:return new Error("Wrong symbol type!")}return g[a.key]}var d=this;this.diagram&&this.diagram.clean();var e=new f(a,b);this.diagram=e;var g={};!function n(a,b,f){var g=c(a);return d.start===a?e.startWith(g):b&&f&&!b.pathOk&&(b instanceof m?(f.yes===a&&b.yes(g),f.no===a&&b.no(g)):b.then(g)),g.pathOk?g:(g instanceof m?(a.yes&&n(a.yes,g,a),a.no&&n(a.no,g,a)):a.next&&n(a.next,g,a),g)}(this.start),e.render()},clean:function(){this.diagram.clean()}},e=[],g=0,n=1,o=a.length;o>n;n++)if("\n"===a[n]&&"\\"!==a[n-1]){var p=a.substring(g,n);g=n+1,e.push(p.replace(/\\\n/g,"\n"))}gq;){var s=e[q];s.indexOf(": ")<0&&s.indexOf("(")<0&&s.indexOf(")")<0&&s.indexOf("->")<0&&s.indexOf("=>")<0?(e[q-1]+="\n"+s,e.splice(q,1),r--):q++}for(;e.length>0;){var t=e.splice(0,1)[0];if(t.indexOf("=>")>=0){var u,v=t.split("=>"),w={key:v[0],symbolType:v[1],text:null,link:null,target:null,flowstate:null};if(w.symbolType.indexOf(": ")>=0&&(u=w.symbolType.split(": "),w.symbolType=u[0],w.text=u[1]),w.text&&w.text.indexOf(":>")>=0?(u=w.text.split(":>"),w.text=u[0],w.link=u[1]):w.symbolType.indexOf(":>")>=0&&(u=w.symbolType.split(":>"),w.symbolType=u[0],w.link=u[1]),w.symbolType.indexOf("\n")>=0&&(w.symbolType=w.symbolType.split("\n")[0]),w.link){var x=w.link.indexOf("[")+1,y=w.link.indexOf("]");x>=0&&y>=0&&(w.target=w.link.substring(x,y),w.link=w.link.substring(0,x-1))}if(w.text&&w.text.indexOf("|")>=0){var z=w.text.split("|");w.text=z[0],w.flowstate=z[1].trim()}d.symbols[w.key]=w}else if(t.indexOf("->")>=0)for(var A=t.split("->"),B=0,C=A.length;C>B;B++){var D=A[B],E=b(D),F=c(D),G=null;if(F.indexOf(",")>=0){var H=F.split(",");F=H[0],G=H[1].trim()}if(d.start||(d.start=E),C>B+1){var I=A[B+1];E[F]=b(I),E["direction_"+F]=G,G=null}}}return d}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(a){"use strict";if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=c;arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));for(var e=d>=0?Math.min(d,c-1):c-Math.abs(d);e>=0;e--)if(e in b&&b[e]===a)return e;return-1}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var o={},p={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:{}}},q={defaults:a,inherits:b};return f.prototype.handle=function(a){this.symbols.indexOf(a)<=-1&&this.symbols.push(a);var b=this;return a instanceof m?(a.yes=function(c){return a.yes_symbol=c,a.no_symbol&&(a.pathOk=!0),b.handle(c)},a.no=function(c){return a.no_symbol=c,a.yes_symbol&&(a.pathOk=!0),b.handle(c)}):a.then=function(c){return a.next=c,a.pathOk=!0,b.handle(c)},a},f.prototype.startWith=function(a){return this.start=a,this.handle(a)},f.prototype.render=function(){var a,b=0,c=0,d=0,e=0,f=0,g=0;for(d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.width>b&&(b=a.width),a.height>c&&(c=a.height);for(d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.shiftX(this.options.x+(b-a.width)/2+this.options["line-width"]),a.shiftY(this.options.y+(c-a.height)/2+this.options["line-width"]);for(this.start.render(),d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.renderLines();for(f=this.maxXFromLine,d=0,e=this.symbols.length;e>d;d++){a=this.symbols[d];var h=a.getX()+a.width,i=a.getY()+a.height;h>f&&(f=h),i>g&&(g=i)}var j=this.options.scale,k=this.options["line-width"];this.paper.setSize(f*j+k*j,g*j+k*j),this.paper.setViewBox(0,0,f+k,g+k,!0)},f.prototype.clean=function(){if(this.paper){var a=this.paper.canvas;a.parentNode.removeChild(a)}},g.prototype.getAttr=function(a){if(!this.chart)return void 0;var b,c=this.chart.options?this.chart.options[a]:void 0,d=this.chart.options.symbols?this.chart.options.symbols[this.symbolType][a]:void 0;return this.chart.options.flowstate&&this.chart.options.flowstate[this.flowstate]&&(b=this.chart.options.flowstate[this.flowstate][a]),b||d||c},g.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},g.prototype.getCenter=function(){return{x:this.getX()+this.width/2,y:this.getY()+this.height/2}},g.prototype.getX=function(){return this.group.getBBox().x},g.prototype.getY=function(){return this.group.getBBox().y},g.prototype.shiftX=function(a){this.group.transform("t"+(this.getX()+a)+","+this.getY())},g.prototype.setX=function(a){this.group.transform("t"+a+","+this.getY())},g.prototype.shiftY=function(a){this.group.transform("t"+this.getX()+","+(this.getY()+a))},g.prototype.setY=function(a){this.group.transform("t"+this.getX()+","+a)},g.prototype.getTop=function(){var a=this.getY(),b=this.getX()+this.width/2;return{x:b,y:a}},g.prototype.getBottom=function(){var a=this.getY()+this.height,b=this.getX()+this.width/2;return{x:b,y:a}},g.prototype.getLeft=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX();return{x:b,y:a}},g.prototype.getRight=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.group.getBBox().width;return{x:b,y:a}},g.prototype.render=function(){if(this.next){var a=this.getAttr("line-length");if("right"===this.next_direction){var b=this.getRight();this.next.getLeft();if(!this.next.isPositioned){this.next.setY(b.y-this.next.height/2),this.next.shiftX(this.group.getBBox().x+this.width+a);var c=this;!function e(){for(var b,d=!1,f=0,g=c.chart.symbols.length;g>f;f++){b=c.chart.symbols[f];var h=Math.abs(b.getCenter().x-c.next.getCenter().x);if(b.getCenter().y>c.next.getCenter().y&&h<=c.next.width/2){d=!0;break}}d&&(c.next.setX(b.getX()+b.width+a),e())}(),this.next.isPositioned=!0,this.next.render()}}else{var d=this.getBottom();this.next.getTop();this.next.isPositioned||(this.next.shiftY(this.getY()+this.height+a),this.next.setX(d.x-this.next.width/2),this.next.isPositioned=!0,this.next.render())}}},g.prototype.renderLines=function(){this.next&&(this.next_direction?this.drawLineTo(this.next,"",this.next_direction):this.drawLineTo(this.next))},g.prototype.drawLineTo=function(a,b,c){this.connectedTo.indexOf(a)<0&&this.connectedTo.push(a);var f,g=this.getCenter().x,h=this.getCenter().y,i=(this.getTop(),this.getRight()),j=this.getBottom(),k=this.getLeft(),l=a.getCenter().x,m=a.getCenter().y,n=a.getTop(),o=a.getRight(),p=(a.getBottom(),a.getLeft()),q=g===l,r=h===m,s=m>h,t=h>m,u=g>l,v=l>g,w=0,x=this.getAttr("line-length"),y=this.getAttr("line-width");if(c&&"bottom"!==c||!q||!s)if(c&&"right"!==c||!r||!v)if(c&&"left"!==c||!r||!u)if(c&&"right"!==c||!q||!t)if(c&&"right"!==c||!q||!s)if(c&&"bottom"!==c||!u)if(c&&"bottom"!==c||!v)if(c&&"right"===c&&u)f=d(this.chart,i,[{x:i.x+x/2,y:i.y},{x:i.x+x/2,y:n.y-x/2},{x:n.x,y:n.y-x/2},{x:n.x,y:n.y}],b),this.rightStart=!0,a.topEnd=!0,w=i.x+x/2;else if(c&&"right"===c&&v)f=d(this.chart,i,[{x:n.x,y:i.y},{x:n.x,y:n.y}],b),this.rightStart=!0,a.topEnd=!0,w=i.x+x/2;else if(c&&"bottom"===c&&q&&t)f=d(this.chart,j,[{x:j.x,y:j.y+x/2},{x:i.x+x/2,y:j.y+x/2},{x:i.x+x/2,y:n.y-x/2},{x:n.x,y:n.y-x/2},{x:n.x,y:n.y}],b),this.bottomStart=!0,a.topEnd=!0,w=j.x+x/2;else if("left"===c&&q&&t){var z=k.x-x/2;p.xA;A++)for(var C,D=this.chart.lines[A],E=D.attr("path"),F=f.attr("path"),G=0,H=E.length-1;H>G;G++){var I=[];I.push(["M",E[G][1],E[G][2]]),I.push(["L",E[G+1][1],E[G+1][2]]);for(var J=I[0][1],K=I[0][2],L=I[1][1],M=I[1][2],N=0,O=F.length-1;O>N;N++){var P=[];P.push(["M",F[N][1],F[N][2]]),P.push(["L",F[N+1][1],F[N+1][2]]);var Q=P[0][1],R=P[0][2],S=P[1][1],T=P[1][2],U=e(J,K,L,M,Q,R,S,T);if(U.onLine1&&U.onLine2){var V;R===T?Q>S?(V=["L",U.x+2*y,R],F.splice(N+1,0,V),V=["C",U.x+2*y,R,U.x,R-4*y,U.x-2*y,R],F.splice(N+2,0,V),f.attr("path",F)):(V=["L",U.x-2*y,R],F.splice(N+1,0,V),V=["C",U.x-2*y,R,U.x,R-4*y,U.x+2*y,R],F.splice(N+2,0,V),f.attr("path",F)):R>T?(V=["L",Q,U.y+2*y],F.splice(N+1,0,V),V=["C",Q,U.y+2*y,Q+4*y,U.y,Q,U.y-2*y],F.splice(N+2,0,V),f.attr("path",F)):(V=["L",Q,U.y-2*y],F.splice(N+1,0,V),V=["C",Q,U.y-2*y,Q+4*y,U.y,Q,U.y+2*y],F.splice(N+2,0,V),f.attr("path",F)),N+=2,C+=2}}}this.chart.lines.push(f)}(!this.chart.maxXFromLine||this.chart.maxXFromLine&&w>this.chart.maxXFromLine)&&(this.chart.maxXFromLine=w)},q.inherits(h,g),q.inherits(i,g),q.inherits(j,g),q.inherits(k,g),q.inherits(l,g),l.prototype.getLeft=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.textMargin;return{x:b,y:a}},l.prototype.getRight=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.group.getBBox().width-this.textMargin;return{x:b,y:a}},q.inherits(m,g),m.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 a=this.getAttr("line-length");if(this.bottom_symbol){var b=this.getBottom();this.bottom_symbol.getTop();this.bottom_symbol.isPositioned||(this.bottom_symbol.shiftY(this.getY()+this.height+a),this.bottom_symbol.setX(b.x-this.bottom_symbol.width/2),this.bottom_symbol.isPositioned=!0,this.bottom_symbol.render())}if(this.right_symbol){var c=this.getRight();this.right_symbol.getLeft();if(!this.right_symbol.isPositioned){this.right_symbol.setY(c.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+a);var d=this;!function e(){for(var b,c=!1,f=0,g=d.chart.symbols.length;g>f;f++){b=d.chart.symbols[f];var h=Math.abs(b.getCenter().x-d.right_symbol.getCenter().x);if(b.getCenter().y>d.right_symbol.getCenter().y&&h<=d.right_symbol.width/2){c=!0;break}}c&&(d.right_symbol.setX(b.getX()+b.width+a),e())}(),this.right_symbol.isPositioned=!0,this.right_symbol.render()}}},m.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)},o.parse=n,o}); -//# sourceMappingURL=flowchart.amd.min.map \ No newline at end of file diff --git a/release/flowchart.amd.min.map b/release/flowchart.amd.min.map deleted file mode 100644 index 127a2674..00000000 --- a/release/flowchart.amd.min.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"flowchart.amd.min.js","sources":["../bin/flowchart.amd-latest.js"],"names":["root","factory","exports","module","define","amd","this","_defaults","options","defaultOptions","merged","attrname","_inherits","ctor","superCtor","Object","super_","prototype","create","constructor","value","enumerable","writable","configurable","TempCtor","drawPath","chart","location","points","i","len","path","length","pathValues","x","y","push","symbol","paper","attr","font","fontF","fontW","font-family","font-weight","drawLine","from","to","text","toString","call","line","stroke","stroke-width","arrow-end","centerText","textPath","isHorizontal","firstTo","getBBox","width","height","text-anchor","font-size","fill","checkLineIntersection","line1StartX","line1StartY","line1EndX","line1EndY","line2StartX","line2StartY","line2EndX","line2EndY","denominator","a","b","numerator1","numerator2","result","onLine1","onLine2","FlowChart","container","Raphael","f","defaults","o","symbols","lines","start","Symbol","group","set","connectedTo","symbolType","flowstate","next_direction","next","undefined","key","node","id","setAttribute","getAttr","link","target","maxWidth","words","split","tempText","ii","word","substring","tmpMargin","insertBefore","initialize","Start","rect","End","Operation","Subroutine","innerWrap","InputOutput","textMargin","startX","startY","Condition","yes_direction","no_direction","yes","no","Math","max","parse","input","getSymbol","s","startIndex","indexOf","endIndex","getNextPath","flowSymb","trim","drawSVG","getDisplaySymbol","dispSymbols","diagram","Error","self","clean","constructChart","prevDisp","prev","dispSymb","startWith","pathOk","then","render","prevBreak","i0","i0len","line0","replace","substr","l","currentLine","splice","sub","parts","txtAndState","flowSymbols","lenS","realSymb","direction","condOpt","nextSymb","Array","searchElement","TypeError","t","n","arguments","Number","Infinity","floor","abs","k","lastIndexOf","min","String","flowchart","line-width","line-length","text-margin","font-color","line-color","element-color","yes-text","no-text","class","scale","end","condition","inputoutput","operation","subroutine","inherits","handle","flowChart","nextSymbol","yes_symbol","no_symbol","maxHeight","maxX","maxY","shiftX","shiftY","renderLines","maxXFromLine","getX","getY","lineWidth","setSize","setViewBox","paperDom","canvas","parentNode","removeChild","attName","opt1","opt3","opt2","transform","getCenter","setX","setY","getTop","getBottom","getLeft","getRight","lineLength","rightPoint","isPositioned","shift","symb","hasSymbolUnder","diff","bottomPoint","drawLineTo","origin","right","bottom","left","symbolX","symbolY","symbolTop","symbolRight","symbolLeft","isOnSameColumn","isOnSameLine","isUnder","isUpper","isLeft","isRight","lineWith","rightStart","topEnd","bottomStart","diffX","leftStart","leftEnd","rightEnd","llen","otherLine","ePath","lPath","iP","lenP","newPath","line1_from_x","line1_from_y","line1_to_x","line1_to_y","lP","lenlP","newLinePath","line2_from_x","line2_from_y","line2_to_x","line2_to_y","res","newSegment","bottom_symbol","right_symbol"],"mappings":";;;;;CAIC,SAAUA,EAAMC,GACQ,gBAAZC,SAETC,OAAOD,QAAUD,IAEU,kBAAXG,SAAyBA,OAAOC,KAEhDD,UAAWH,IAGbK,KAAM,WA+GN,QAASC,GAAUC,EAASC,GAC1B,IAAKD,GAA8B,kBAAZA,GACrB,MAAOC,EAGT,IAAIC,KACJ,KAAK,GAAIC,KAAYF,GACnBC,EAAOC,GAAYF,EAAeE,EAGpC,KAAKA,IAAYH,GACXA,EAAQG,KACsB,gBAArBD,GAAOC,GAChBD,EAAOC,GAAYJ,EAAUG,EAAOC,GAAWH,EAAQG,IAEvDD,EAAOC,GAAYH,EAAQG,GAIjC,OAAOD,GAGT,QAASE,GAAUC,EAAMC,GACvB,GAA8B,kBAAnBC,QAAa,OAEtBF,EAAKG,OAASF,EACdD,EAAKI,UAAYF,OAAOG,OAAOJ,EAAUG,WACvCE,aACEC,MAAOP,EACPQ,YAAY,EACZC,UAAU,EACVC,cAAc,SAGb,CAELV,EAAKG,OAASF,CACd,IAAIU,GAAW,YACfA,GAASP,UAAYH,EAAUG,UAC/BJ,EAAKI,UAAY,GAAIO,GACrBX,EAAKI,UAAUE,YAAcN,GAUjC,QAASY,GAASC,EAAOC,EAAUC,GACjC,GAAIC,GAAGC,EACHC,EAAO,UACX,KAAKF,EAAI,EAAGC,EAAM,EAAIF,EAAOI,OAAS,EAAOF,EAAJ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AAKU,EAAKzB,OAASyB,EAAKzL,MAAQqL,GAClDG,QAIJ9O,KAAKgS,aAAanD,cAAe,EAEjC7O,KAAKgS,aAAaxI,YAKxB/B,EAAU9G,UAAUyM,YAAc,WAC5BpN,KAAK6M,YACP7M,KAAKmP,WAAWnP,KAAK6M,WAAY7M,KAAKkG,QAAQ,YAAalG,KAAK0H,eAG9D1H,KAAK8M,WACP9M,KAAKmP,WAAWnP,KAAK8M,UAAW9M,KAAKkG,QAAQ,WAAYlG,KAAK2H,eA8OlE8D,EAAUzD,MAAQA,EAEXyD"} \ No newline at end of file diff --git a/release/flowchart.amd.zip b/release/flowchart.amd.zip deleted file mode 100644 index bd4240c8..00000000 Binary files a/release/flowchart.amd.zip and /dev/null differ diff --git a/release/flowchart.js b/release/flowchart.js index dbaeb8ae..daa1ed35 100644 --- a/release/flowchart.js +++ b/release/flowchart.js @@ -1,1423 +1,1428 @@ -// flowchart, v1.4.1 -// Copyright (c)2015 Adriano Raiano (adrai). +// flowchart.js, v1.18.0 +// Copyright (c)2023 Adriano Raiano (adrai). // Distributed under MIT license // http://adrai.github.io/flowchart.js -(function() { - // add indexOf to non ECMA-262 standard compliant browsers - if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { - "use strict"; - if (this === null) { - throw new TypeError(); - } - var t = Object(this); - var len = t.length >>> 0; - if (len === 0) { - return -1; - } - var n = 0; - if (arguments.length > 0) { - n = Number(arguments[1]); - if (n != n) { // shortcut for verifying if it's NaN - n = 0; - } else if (n !== 0 && n != Infinity && n != -Infinity) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - } - if (n >= len) { - return -1; - } - var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); - for (; k < len; k++) { - if (k in t && t[k] === searchElement) { - return k; - } - } - return -1; - }; - } - - // add lastIndexOf to non ECMA-262 standard compliant browsers - if (!Array.prototype.lastIndexOf) { - Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) { - "use strict"; - if (this === null) { - throw new TypeError(); - } - var t = Object(this); - var len = t.length >>> 0; - if (len === 0) { - return -1; - } - var n = len; - if (arguments.length > 1) { - n = Number(arguments[1]); - if (n != n) { - n = 0; - } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - } - var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n); - for (; k >= 0; k--) { - if (k in t && t[k] === searchElement) { - return k; - } - } - return -1; - }; - } - - if (!String.prototype.trim) { - String.prototype.trim = function() { - return this.replace(/^\s+|\s+$/g, ''); - }; - } - - var root = this, - flowchart = {}; - - // Export the flowchart object for **CommonJS**. - // If we're not in CommonJS, add `flowchart` to the - // global object or to jquery. - if (typeof module !== 'undefined' && module.exports) { - module.exports = flowchart; - } else { - root.flowchart = root.flowchart || flowchart; - } - // defaults - var o = { - 'x': 0, - 'y': 0, - 'line-width': 3, - 'line-length': 50, - 'text-margin': 10, - 'font-size': 14, - 'font-color': 'black', - // 'font': 'normal', - // 'font-family': 'calibri', - // 'font-weight': 'normal', - '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': {} - }//, - // 'flowstate' : { - // 'past' : { 'fill': '#CCCCCC', 'font-size': 12}, - // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'}, - // 'future' : { 'fill': '#FFFF99'}, - // 'invalid': {'fill': '#444444'} - // } - }; - function _defaults(options, defaultOptions) { - if (!options || typeof options === 'function') { - return defaultOptions; - } - - var merged = {}; - for (var attrname in defaultOptions) { - merged[attrname] = defaultOptions[attrname]; - } - - for (attrname in options) { - if (options[attrname]) { - if (typeof merged[attrname] === 'object') { - merged[attrname] = _defaults(merged[attrname], options[attrname]); - } else { - merged[attrname] = options[attrname]; - } - } - } - return merged; - } - - function _inherits(ctor, superCtor) { - if (typeof(Object.create) === 'function') { - // implementation from standard node.js 'util' module - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - } else { - // old school shim for old browsers - ctor.super_ = superCtor; - var TempCtor = function () {}; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - } - } - - // move dependent functions to a container so that - // they can be overriden easier in no jquery environment (node.js) - var f = { - defaults: _defaults, - inherits: _inherits - }; - function drawPath(chart, location, points) { - var i, len; - var path = 'M{0},{1}'; - for (i = 2, len = 2 * points.length + 2; i < len; i+=2) { - path += ' L{' + i + '},{' + (i + 1) + '}'; +!function(root, factory) { + if ("object" == typeof exports && "object" == typeof module) module.exports = factory(require("Raphael")); else if ("function" == typeof define && define.amd) define([ "Raphael" ], factory); else { + var a = factory("object" == typeof exports ? require("Raphael") : root.Raphael); + for (var i in a) ("object" == typeof exports ? exports : root)[i] = a[i]; } - var pathValues = [location.x, location.y]; - for (i = 0, len = points.length; i < len; i++) { - pathValues.push(points[i].x); - pathValues.push(points[i].y); - } - var symbol = chart.paper.path(path, pathValues); - symbol.attr('stroke', chart.options['element-color']); - symbol.attr('stroke-width', chart.options['line-width']); - - var font = chart.options['font']; - var fontF = chart.options['font-family']; - var fontW = chart.options['font-weight']; - - if (font) symbol.attr({ 'font': font }); - if (fontF) symbol.attr({ 'font-family': fontF }); - if (fontW) symbol.attr({ 'font-weight': fontW }); - - return symbol; - } - - function drawLine(chart, from, to, text) { - var i, len; - - if (Object.prototype.toString.call(to) !== '[object Array]') { - to = [to]; - } - - var path = 'M{0},{1}'; - for (i = 2, len = 2 * to.length + 2; i < len; i+=2) { - path += ' L{' + i + '},{' + (i + 1) + '}'; - } - var pathValues = [from.x, from.y]; - for (i = 0, len = to.length; i < len; i++) { - pathValues.push(to[i].x); - pathValues.push(to[i].y); - } - - var line = chart.paper.path(path, pathValues); - line.attr({ - stroke: chart.options['line-color'], - 'stroke-width': chart.options['line-width'], - 'arrow-end': chart.options['arrow-end'] - }); - - var font = chart.options['font']; - var fontF = chart.options['font-family']; - var fontW = chart.options['font-weight']; - - if (font) line.attr({ 'font': font }); - if (fontF) line.attr({ 'font-family': fontF }); - if (fontW) line.attr({ 'font-weight': fontW }); - - if (text) { - - var centerText = false; - - var textPath = chart.paper.text(0, 0, text); - - var isHorizontal = false; - var firstTo = to[0]; - - if (from.y === firstTo.y) { - isHorizontal = true; - } - - var x = 0, - y = 0; - - if (centerText) { - if (from.x > firstTo.x) { - x = from.x - (from.x - firstTo.x)/2; - } else { - x = firstTo.x - (firstTo.x - from.x)/2; +}(this, function(__WEBPACK_EXTERNAL_MODULE_18__) { + /******/ + return function(modules) { + /******/ + /******/ + // The require function + /******/ + function __webpack_require__(moduleId) { + /******/ + /******/ + // Check if module is in cache + /******/ + if (installedModules[moduleId]) /******/ + return installedModules[moduleId].exports; + /******/ + /******/ + // Create a new module (and put it into the cache) + /******/ + var module = installedModules[moduleId] = { + /******/ + exports: {}, + /******/ + id: moduleId, + /******/ + loaded: !1 + }; + /******/ + /******/ + // Return the exports of the module + /******/ + /******/ + /******/ + // Execute the module function + /******/ + /******/ + /******/ + // Flag the module as loaded + /******/ + return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__), + module.loaded = !0, module.exports; } - - if (from.y > firstTo.y) { - y = from.y - (from.y - firstTo.y)/2; - } else { - y = firstTo.y - (firstTo.y - from.y)/2; + // webpackBootstrap + /******/ + // The module cache + /******/ + var installedModules = {}; + /******/ + /******/ + // Load entry module and return exports + /******/ + /******/ + /******/ + /******/ + // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ + // expose the module cache + /******/ + /******/ + /******/ + // __webpack_public_path__ + /******/ + return __webpack_require__.m = modules, __webpack_require__.c = installedModules, + __webpack_require__.p = "", __webpack_require__(0); + }([ /* 0 */ + /*!******************!*\ + !*** ./index.js ***! + \******************/ + /***/ + function(module, exports, __webpack_require__) { + __webpack_require__(/*! ./src/flowchart.shim */ 9); + var parse = __webpack_require__(/*! ./src/flowchart.parse */ 4); + __webpack_require__(/*! ./src/jquery-plugin */ 17); + var FlowChart = { + parse: parse + }; + "undefined" != typeof window && (window.flowchart = FlowChart), module.exports = FlowChart; + }, /* 1 */ + /*!**********************************!*\ + !*** ./src/flowchart.helpers.js ***! + \**********************************/ + /***/ + function(module, exports) { + function _defaults(options, defaultOptions) { + if (!options || "function" == typeof options) return defaultOptions; + var merged = {}; + for (var attrname in defaultOptions) merged[attrname] = defaultOptions[attrname]; + for (attrname in options) options[attrname] && ("object" == typeof merged[attrname] ? merged[attrname] = _defaults(merged[attrname], options[attrname]) : merged[attrname] = options[attrname]); + return merged; } - - if (isHorizontal) { - x -= textPath.getBBox().width/2; - y -= chart.options['text-margin']; - } else { - x += chart.options['text-margin']; - y -= textPath.getBBox().height/2; + function _inherits(ctor, superCtor) { + if ("function" == typeof Object.create) // implementation from standard node.js 'util' module + ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: !1, + writable: !0, + configurable: !0 + } + }); else { + // old school shim for old browsers + ctor.super_ = superCtor; + var TempCtor = function() {}; + TempCtor.prototype = superCtor.prototype, ctor.prototype = new TempCtor(), ctor.prototype.constructor = ctor; + } } - } else { - x = from.x; - y = from.y; - - if (isHorizontal) { - x += chart.options['text-margin']/2; - y -= chart.options['text-margin']; - } else { - x += chart.options['text-margin']/2; - y += chart.options['text-margin']; + // move dependent functions to a container so that + // they can be overriden easier in no jquery environment (node.js) + module.exports = { + defaults: _defaults, + inherits: _inherits + }; + }, /* 2 */ + /*!*********************************!*\ + !*** ./src/flowchart.symbol.js ***! + \*********************************/ + /***/ + function(module, exports, __webpack_require__) { + function Symbol(chart, options, symbol) { + this.chart = chart, this.group = this.chart.paper.set(), this.symbol = symbol, this.connectedTo = [], + this.symbolType = options.symbolType, this.flowstate = options.flowstate || "future", + this.lineStyle = options.lineStyle || {}, this.key = options.key || "", this.leftLines = [], + this.rightLines = [], this.topLines = [], this.bottomLines = [], this.params = options.params, + this.next_direction = options.next && options.direction_next ? options.direction_next : void 0, + this.text = this.chart.paper.text(0, 0, options.text), //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t + options.key && (this.text.node.id = options.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 font = this.getAttr("font"), fontF = this.getAttr("font-family"), fontW = this.getAttr("font-weight"); + font && this.text.attr({ + font: font + }), fontF && this.text.attr({ + "font-family": fontF + }), fontW && this.text.attr({ + "font-weight": fontW + }), options.link && this.text.attr("href", options.link), //ndrqu Add click function with event and options params + options.function && (this.text.attr({ + cursor: "pointer" + }), this.text.node.addEventListener("click", function(evt) { + window[options.function](evt, options); + }, !1)), options.target && this.text.attr("target", options.target); + var maxWidth = this.getAttr("maxWidth"); + if (maxWidth) { + for (var words = options.text.split(" "), tempText = "", i = 0, ii = words.length; i < ii; i++) { + var word = words[i]; + this.text.attr("text", tempText + " " + word), tempText += this.text.getBBox().width > maxWidth ? "\n" + word : " " + word; + } + this.text.attr("text", tempText.substring(1)); + } + if (this.group.push(this.text), symbol) { + var tmpMargin = this.getAttr("text-margin"); + symbol.attr({ + fill: this.getAttr("fill"), + stroke: this.getAttr("element-color"), + "stroke-width": this.getAttr("line-width"), + width: this.text.getBBox().width + 2 * tmpMargin, + height: this.text.getBBox().height + 2 * tmpMargin + }), symbol.node.setAttribute("class", this.getAttr("class")); + var roundness = this.getAttr("roundness"); + isNaN(roundness) || (symbol.node.setAttribute("ry", roundness), symbol.node.setAttribute("rx", roundness)), + options.link && symbol.attr("href", options.link), options.target && symbol.attr("target", options.target), + //ndrqu Add click function with event and options params + options.function && (symbol.node.addEventListener("click", function(evt) { + window[options.function](evt, options); + }, !1), symbol.attr({ + cursor: "pointer" + })), options.key && (symbol.node.id = options.key), this.group.push(symbol), symbol.insertBefore(this.text), + this.text.attr({ + y: symbol.getBBox().height / 2 + }), this.initialize(); + } } - } - - textPath.attr({ - 'text-anchor': 'start', - 'font-size': chart.options['font-size'], - 'fill': chart.options['font-color'], - x: x, - y: y - }); - - if (font) textPath.attr({ 'font': font }); - if (fontF) textPath.attr({ 'font-family': fontF }); - if (fontW) textPath.attr({ 'font-weight': fontW }); - } - - return line; - } - - function checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) { - // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point - var denominator, a, b, numerator1, numerator2, result = { - x: null, - y: null, - onLine1: false, - onLine2: false - }; - denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY)); - if (denominator === 0) { - return result; - } - a = line1StartY - line2StartY; - b = line1StartX - line2StartX; - numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b); - numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b); - a = numerator1 / denominator; - b = numerator2 / denominator; - - // if we cast these lines infinitely in both directions, they intersect here: - result.x = line1StartX + (a * (line1EndX - line1StartX)); - result.y = line1StartY + (a * (line1EndY - line1StartY)); - /* - // it is worth noting that this should be the same as: - x = line2StartX + (b * (line2EndX - line2StartX)); - y = line2StartX + (b * (line2EndY - line2StartY)); - */ - // if line1 is a segment and line2 is infinite, they intersect if: - if (a > 0 && a < 1) { - result.onLine1 = true; - } - // if line2 is a segment and line1 is infinite, they intersect if: - if (b > 0 && b < 1) { - result.onLine2 = true; - } - // if line1 and line2 are segments, they intersect if both of the above are true - return result; - } - function FlowChart(container, options) { - options = options || {}; - - this.paper = new Raphael(container); - - this.options = f.defaults(options, o); - - this.symbols = []; - this.lines = []; - this.start = null; - } - - FlowChart.prototype.handle = function(symbol) { - if (this.symbols.indexOf(symbol) <= -1) { - this.symbols.push(symbol); - } - - var flowChart = this; - - if (symbol instanceof(Condition)) { - symbol.yes = function(nextSymbol) { - symbol.yes_symbol = nextSymbol; - if(symbol.no_symbol) { - symbol.pathOk = true; + var drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3), drawLine = drawAPI.drawLine, checkLineIntersection = drawAPI.checkLineIntersection; + /* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */ + Symbol.prototype.getAttr = function(attName) { + if (this.chart) { + var opt1, opt3 = this.chart.options ? this.chart.options[attName] : void 0, opt2 = this.chart.options.symbols ? this.chart.options.symbols[this.symbolType][attName] : void 0; + return this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate] && (opt1 = this.chart.options.flowstate[this.flowstate][attName]), + opt1 || opt2 || opt3; + } + }, Symbol.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; + }, Symbol.prototype.getCenter = function() { + return { + x: this.getX() + this.width / 2, + y: this.getY() + this.height / 2 + }; + }, Symbol.prototype.getX = function() { + return this.group.getBBox().x; + }, Symbol.prototype.getY = function() { + return this.group.getBBox().y; + }, Symbol.prototype.shiftX = function(x) { + this.group.transform("t" + (this.getX() + x) + "," + this.getY()); + }, Symbol.prototype.setX = function(x) { + this.group.transform("t" + x + "," + this.getY()); + }, Symbol.prototype.shiftY = function(y) { + this.group.transform("t" + this.getX() + "," + (this.getY() + y)); + }, Symbol.prototype.setY = function(y) { + this.group.transform("t" + this.getX() + "," + y); + }, Symbol.prototype.getTop = function() { + var y = this.getY(), x = this.getX() + this.width / 2; + return { + x: x, + y: y + }; + }, Symbol.prototype.getBottom = function() { + var y = this.getY() + this.height, x = this.getX() + this.width / 2; + return { + x: x, + y: y + }; + }, Symbol.prototype.getLeft = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX(); + return { + x: x, + y: y + }; + }, Symbol.prototype.getRight = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX() + this.group.getBBox().width; + return { + x: x, + y: y + }; + }, Symbol.prototype.render = function() { + if (this.next) { + var self = this, lineLength = this.getAttr("line-length"); + if ("right" === this.next_direction) { + var rightPoint = this.getRight(); + this.next.isPositioned || (this.next.setY(rightPoint.y - this.next.height / 2), + this.next.shiftX(this.group.getBBox().x + this.width + lineLength), function shift() { + for (var symb, hasSymbolUnder = !1, i = 0, len = self.chart.symbols.length; i < len; i++) { + symb = self.chart.symbols[i]; + var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x); + if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width / 2) { + hasSymbolUnder = !0; + break; + } + } + if (hasSymbolUnder) { + if ("end" === self.next.symbolType) return; + self.next.setX(symb.getX() + symb.width + lineLength), shift(); + } + }(), this.next.isPositioned = !0, this.next.render()); + } else if ("left" === this.next_direction) { + var leftPoint = this.getLeft(); + this.next.isPositioned || (this.next.setY(leftPoint.y - this.next.height / 2), this.next.shiftX(-(this.group.getBBox().x + this.width + lineLength)), + function shift() { + for (var symb, hasSymbolUnder = !1, i = 0, len = self.chart.symbols.length; i < len; i++) { + symb = self.chart.symbols[i]; + var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x); + if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width / 2) { + hasSymbolUnder = !0; + break; + } + } + if (hasSymbolUnder) { + if ("end" === self.next.symbolType) return; + self.next.setX(symb.getX() + symb.width + lineLength), shift(); + } + }(), this.next.isPositioned = !0, this.next.render()); + } else { + var bottomPoint = this.getBottom(); + this.next.isPositioned || (this.next.shiftY(this.getY() + this.height + lineLength), + this.next.setX(bottomPoint.x - this.next.width / 2), this.next.isPositioned = !0, + this.next.render()); + } + } + }, Symbol.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") || "")); + }, Symbol.prototype.drawLineTo = function(symbol, text, origin) { + this.connectedTo.indexOf(symbol) < 0 && this.connectedTo.push(symbol); + var line, yOffset, x = this.getCenter().x, y = this.getCenter().y, right = this.getRight(), bottom = this.getBottom(), top = this.getTop(), left = this.getLeft(), symbolX = symbol.getCenter().x, symbolY = symbol.getCenter().y, symbolTop = symbol.getTop(), symbolRight = symbol.getRight(), symbolLeft = symbol.getLeft(), isOnSameColumn = x === symbolX, isOnSameLine = y === symbolY, isUnder = y < symbolY, isUpper = y > symbolY || this === symbol, isLeft = x > symbolX, isRight = x < symbolX, maxX = 0, lineLength = this.getAttr("line-length"), lineWith = this.getAttr("line-width"); + if (origin && "bottom" !== origin || !isOnSameColumn || !isUnder) if (origin && "right" !== origin || !isOnSameLine || !isRight) if (origin && "left" !== origin || !isOnSameLine || !isLeft) if (origin && "right" !== origin || !isOnSameColumn || !isUpper) if (origin && "right" !== origin || !isOnSameColumn || !isUnder) if (origin && "bottom" !== origin || !isLeft) if (origin && "bottom" !== origin || !isRight || !isUnder) if (origin && "bottom" !== origin || !isRight) if (origin && "right" === origin && isLeft) yOffset = 10 * Math.max(symbol.topLines.length, this.rightLines.length), + line = drawLine(this.chart, right, [ { + x: right.x + lineLength / 2, + y: right.y + }, { + x: right.x + lineLength / 2, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.rightLines.push(line), symbol.topLines.push(line), this.rightStart = !0, + symbol.topEnd = !0, maxX = right.x + lineLength / 2; else if (origin && "right" === origin && isRight) yOffset = 10 * Math.max(symbol.topLines.length, this.rightLines.length), + line = drawLine(this.chart, right, [ { + x: symbolTop.x, + y: right.y - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - yOffset + } ], text), this.rightLines.push(line), symbol.topLines.push(line), this.rightStart = !0, + symbol.topEnd = !0, maxX = right.x + lineLength / 2; else if (origin && "bottom" === origin && isOnSameColumn && isUpper) yOffset = 10 * Math.max(symbol.topLines.length, this.bottomLines.length), + line = drawLine(this.chart, bottom, [ { + x: bottom.x, + y: bottom.y + lineLength / 2 - yOffset + }, { + x: right.x + lineLength / 2, + y: bottom.y + lineLength / 2 - yOffset + }, { + x: right.x + lineLength / 2, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.bottomLines.push(line), symbol.topLines.push(line), this.bottomStart = !0, + symbol.topEnd = !0, maxX = bottom.x + lineLength / 2; else if ("left" === origin && isOnSameColumn && isUpper) { + var diffX = left.x - lineLength / 2; + symbolLeft.x < left.x && (diffX = symbolLeft.x - lineLength / 2), yOffset = 10 * Math.max(symbol.topLines.length, this.leftLines.length), + line = drawLine(this.chart, left, [ { + x: diffX, + y: left.y - yOffset + }, { + x: diffX, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.leftLines.push(line), symbol.topLines.push(line), this.leftStart = !0, + symbol.topEnd = !0, maxX = left.x; + } else "left" === origin ? (yOffset = 10 * Math.max(symbol.topLines.length, this.leftLines.length), + line = drawLine(this.chart, left, [ { + x: symbolTop.x + (left.x - symbolTop.x) / 2, + y: left.y + }, { + x: symbolTop.x + (left.x - symbolTop.x) / 2, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.leftLines.push(line), symbol.topLines.push(line), this.leftStart = !0, + symbol.topEnd = !0, maxX = left.x) : "top" === origin && (yOffset = 10 * Math.max(symbol.topLines.length, this.topLines.length), + line = drawLine(this.chart, top, [ { + x: top.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.topLines.push(line), symbol.topLines.push(line), this.topStart = !0, + symbol.topEnd = !0, maxX = top.x); else yOffset = 10 * Math.max(symbol.topLines.length, this.bottomLines.length), + line = drawLine(this.chart, bottom, [ { + x: bottom.x, + y: bottom.y + lineLength / 2 - yOffset + }, { + x: bottom.x + (bottom.x - symbolTop.x) / 2, + y: bottom.y + lineLength / 2 - yOffset + }, { + x: bottom.x + (bottom.x - symbolTop.x) / 2, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.bottomLines.push(line), symbol.topLines.push(line), this.bottomStart = !0, + symbol.topEnd = !0, maxX = bottom.x + (bottom.x - symbolTop.x) / 2; else yOffset = 10 * Math.max(symbol.topLines.length, this.bottomLines.length), + line = drawLine(this.chart, bottom, [ { + x: bottom.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.bottomLines.push(line), symbol.topLines.push(line), this.bottomStart = !0, + symbol.topEnd = !0, maxX = bottom.x, symbolTop.x > maxX && (maxX = symbolTop.x); else yOffset = 10 * Math.max(symbol.topLines.length, this.bottomLines.length), + line = this.leftEnd && isUpper ? drawLine(this.chart, bottom, [ { + x: bottom.x, + y: bottom.y + lineLength / 2 - yOffset + }, { + x: bottom.x + (bottom.x - symbolTop.x) / 2, + y: bottom.y + lineLength / 2 - yOffset + }, { + x: bottom.x + (bottom.x - symbolTop.x) / 2, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text) : drawLine(this.chart, bottom, [ { + x: bottom.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.bottomLines.push(line), symbol.topLines.push(line), this.bottomStart = !0, + symbol.topEnd = !0, maxX = bottom.x + (bottom.x - symbolTop.x) / 2; else yOffset = 10 * Math.max(symbol.topLines.length, this.rightLines.length), + line = drawLine(this.chart, right, [ { + x: right.x + lineLength / 2, + y: right.y - yOffset + }, { + x: right.x + lineLength / 2, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.rightLines.push(line), symbol.topLines.push(line), this.rightStart = !0, + symbol.topEnd = !0, maxX = right.x + lineLength / 2; else yOffset = 10 * Math.max(symbol.topLines.length, this.rightLines.length), + line = drawLine(this.chart, right, [ { + x: right.x + lineLength / 2, + y: right.y - yOffset + }, { + x: right.x + lineLength / 2, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.rightLines.push(line), symbol.topLines.push(line), this.rightStart = !0, + symbol.topEnd = !0, maxX = right.x + lineLength / 2; else 0 === symbol.rightLines.length && 0 === this.leftLines.length ? line = drawLine(this.chart, left, symbolRight, text) : (yOffset = 10 * Math.max(symbol.rightLines.length, this.leftLines.length), + line = drawLine(this.chart, right, [ { + x: right.x, + y: right.y - yOffset + }, { + x: right.x, + y: symbolRight.y - yOffset + }, { + x: symbolRight.x, + y: symbolRight.y - yOffset + }, { + x: symbolRight.x, + y: symbolRight.y + } ], text)), this.leftLines.push(line), symbol.rightLines.push(line), this.leftStart = !0, + symbol.rightEnd = !0, maxX = symbolRight.x; else 0 === symbol.leftLines.length && 0 === this.rightLines.length ? line = drawLine(this.chart, right, symbolLeft, text) : (yOffset = 10 * Math.max(symbol.leftLines.length, this.rightLines.length), + line = drawLine(this.chart, right, [ { + x: right.x, + y: right.y - yOffset + }, { + x: right.x, + y: symbolLeft.y - yOffset + }, { + x: symbolLeft.x, + y: symbolLeft.y - yOffset + }, { + x: symbolLeft.x, + y: symbolLeft.y + } ], text)), this.rightLines.push(line), symbol.leftLines.push(line), this.rightStart = !0, + symbol.leftEnd = !0, maxX = symbolLeft.x; else 0 === symbol.topLines.length && 0 === this.bottomLines.length ? line = drawLine(this.chart, bottom, symbolTop, text) : (yOffset = 10 * Math.max(symbol.topLines.length, this.bottomLines.length), + line = drawLine(this.chart, bottom, [ { + x: symbolTop.x, + y: symbolTop.y - yOffset + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text)), this.bottomLines.push(line), symbol.topLines.push(line), this.bottomStart = !0, + symbol.topEnd = !0, maxX = bottom.x; + if (//update line style + this.lineStyle[symbol.key] && line && line.attr(this.lineStyle[symbol.key]), line) { + for (var l = 0, llen = this.chart.lines.length; l < llen; l++) for (var otherLine = this.chart.lines[l], ePath = otherLine.attr("path"), lPath = line.attr("path"), iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) { + var newPath = []; + newPath.push([ "M", ePath[iP][1], ePath[iP][2] ]), newPath.push([ "L", ePath[iP + 1][1], ePath[iP + 1][2] ]); + for (var line1_from_x = newPath[0][1], line1_from_y = newPath[0][2], line1_to_x = newPath[1][1], line1_to_y = newPath[1][2], lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) { + var newLinePath = []; + newLinePath.push([ "M", lPath[lP][1], lPath[lP][2] ]), newLinePath.push([ "L", lPath[lP + 1][1], lPath[lP + 1][2] ]); + var line2_from_x = newLinePath[0][1], line2_from_y = newLinePath[0][2], line2_to_x = newLinePath[1][1], line2_to_y = newLinePath[1][2], res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y); + if (res.onLine1 && res.onLine2) { + var newSegment; + line2_from_y === line2_to_y ? line2_from_x > line2_to_x ? (newSegment = [ "L", res.x + 2 * lineWith, line2_from_y ], + lPath.splice(lP + 1, 0, newSegment), newSegment = [ "C", res.x + 2 * lineWith, line2_from_y, res.x, line2_from_y - 4 * lineWith, res.x - 2 * lineWith, line2_from_y ], + lPath.splice(lP + 2, 0, newSegment), line.attr("path", lPath)) : (newSegment = [ "L", res.x - 2 * lineWith, line2_from_y ], + lPath.splice(lP + 1, 0, newSegment), newSegment = [ "C", res.x - 2 * lineWith, line2_from_y, res.x, line2_from_y - 4 * lineWith, res.x + 2 * lineWith, line2_from_y ], + lPath.splice(lP + 2, 0, newSegment), line.attr("path", lPath)) : line2_from_y > line2_to_y ? (newSegment = [ "L", line2_from_x, res.y + 2 * lineWith ], + lPath.splice(lP + 1, 0, newSegment), newSegment = [ "C", line2_from_x, res.y + 2 * lineWith, line2_from_x + 4 * lineWith, res.y, line2_from_x, res.y - 2 * lineWith ], + lPath.splice(lP + 2, 0, newSegment), line.attr("path", lPath)) : (newSegment = [ "L", line2_from_x, res.y - 2 * lineWith ], + lPath.splice(lP + 1, 0, newSegment), newSegment = [ "C", line2_from_x, res.y - 2 * lineWith, line2_from_x + 4 * lineWith, res.y, line2_from_x, res.y + 2 * lineWith ], + lPath.splice(lP + 2, 0, newSegment), line.attr("path", lPath)), lP += 2; + } + } + } + this.chart.lines.push(line), (void 0 === this.chart.minXFromSymbols || this.chart.minXFromSymbols > left.x) && (this.chart.minXFromSymbols = left.x); + } + (!this.chart.maxXFromLine || this.chart.maxXFromLine && maxX > this.chart.maxXFromLine) && (this.chart.maxXFromLine = maxX); + }, module.exports = Symbol; + }, /* 3 */ + /*!************************************!*\ + !*** ./src/flowchart.functions.js ***! + \************************************/ + /***/ + function(module, exports) { + function drawPath(chart, location, points) { + var i, len, path = "M{0},{1}"; + for (i = 2, len = 2 * points.length + 2; i < len; i += 2) path += " L{" + i + "},{" + (i + 1) + "}"; + var pathValues = [ location.x, location.y ]; + for (i = 0, len = points.length; i < len; i++) pathValues.push(points[i].x), pathValues.push(points[i].y); + var symbol = chart.paper.path(path, pathValues); + symbol.attr("stroke", chart.options["element-color"]), symbol.attr("stroke-width", chart.options["line-width"]); + var font = chart.options.font, fontF = chart.options["font-family"], fontW = chart.options["font-weight"]; + return font && symbol.attr({ + font: font + }), fontF && symbol.attr({ + "font-family": fontF + }), fontW && symbol.attr({ + "font-weight": fontW + }), symbol; } - return flowChart.handle(nextSymbol); - }; - symbol.no = function(nextSymbol) { - symbol.no_symbol = nextSymbol; - if(symbol.yes_symbol) { - symbol.pathOk = true; + function drawLine(chart, from, to, text) { + var i, len; + "[object Array]" !== Object.prototype.toString.call(to) && (to = [ to ]); + var path = "M{0},{1}"; + for (i = 2, len = 2 * to.length + 2; i < len; i += 2) path += " L{" + i + "},{" + (i + 1) + "}"; + var pathValues = [ from.x, from.y ]; + for (i = 0, len = to.length; i < len; i++) pathValues.push(to[i].x), pathValues.push(to[i].y); + var line = chart.paper.path(path, pathValues); + line.attr({ + stroke: chart.options["line-color"], + "stroke-width": chart.options["line-width"], + "arrow-end": chart.options["arrow-end"] + }); + var font = chart.options.font, fontF = chart.options["font-family"], fontW = chart.options["font-weight"]; + if (font && line.attr({ + font: font + }), fontF && line.attr({ + "font-family": fontF + }), fontW && line.attr({ + "font-weight": fontW + }), text) { + var centerText = !1, textPath = chart.paper.text(0, 0, text), textAnchor = "start", isHorizontal = !1, firstTo = to[0]; + from.y === firstTo.y && (isHorizontal = !0); + var x = 0, y = 0; + centerText ? (x = from.x > firstTo.x ? from.x - (from.x - firstTo.x) / 2 : firstTo.x - (firstTo.x - from.x) / 2, + y = from.y > firstTo.y ? from.y - (from.y - firstTo.y) / 2 : firstTo.y - (firstTo.y - from.y) / 2, + isHorizontal ? (x -= textPath.getBBox().width / 2, y -= chart.options["text-margin"]) : (x += chart.options["text-margin"], + y -= textPath.getBBox().height / 2)) : (x = from.x, y = from.y, isHorizontal ? (from.x > firstTo.x ? (x -= chart.options["text-margin"] / 2, + textAnchor = "end") : x += chart.options["text-margin"] / 2, y -= chart.options["text-margin"]) : (x += chart.options["text-margin"] / 2, + y += chart.options["text-margin"], from.y > firstTo.y && (y -= 2 * chart.options["text-margin"]))), + textPath.attr({ + "text-anchor": textAnchor, + "font-size": chart.options["font-size"], + fill: chart.options["font-color"], + x: x, + y: y + }), font && textPath.attr({ + font: font + }), fontF && textPath.attr({ + "font-family": fontF + }), fontW && textPath.attr({ + "font-weight": fontW + }); + } + return line; } - return flowChart.handle(nextSymbol); - }; - } else { - symbol.then = function(nextSymbol) { - symbol.next = nextSymbol; - symbol.pathOk = true; - return flowChart.handle(nextSymbol); - }; - } - - return symbol; - }; - - FlowChart.prototype.startWith = function(symbol) { - this.start = symbol; - return this.handle(symbol); - }; - - FlowChart.prototype.render = function() { - var maxWidth = 0, - maxHeight = 0, - i = 0, - len = 0, - maxX = 0, - maxY = 0, - symbol; - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - if (symbol.width > maxWidth) { - maxWidth = symbol.width; - } - if (symbol.height > maxHeight) { - maxHeight = symbol.height; - } - } - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']); - symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']); - } - - this.start.render(); - // for (i = 0, len = this.symbols.length; i < len; i++) { - // symbol = this.symbols[i]; - // symbol.render(); - // } - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - symbol.renderLines(); - } - - maxX = this.maxXFromLine; - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - var x = symbol.getX() + symbol.width; - var y = symbol.getY() + symbol.height; - if (x > maxX) { - maxX = x; - } - if (y > maxY) { - maxY = y; - } - } - - var scale = this.options['scale']; - var lineWidth = this.options['line-width']; - this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale)); - this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true); - }; - - FlowChart.prototype.clean = function() { - if (this.paper) { - var paperDom = this.paper.canvas; - paperDom.parentNode.removeChild(paperDom); - } - }; - function Symbol(chart, options, symbol) { - this.chart = chart; - this.group = this.chart.paper.set(); - this.symbol = symbol; - this.connectedTo = []; - this.symbolType = options.symbolType; - this.flowstate = (options.flowstate || 'future'); - - this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined; - - this.text = this.chart.paper.text(0, 0, options.text); - //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t - if (options.key) { this.text.node.id = options.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 font = this.getAttr('font'); - var fontF = this.getAttr('font-family'); - var fontW = this.getAttr('font-weight'); - - if (font) this.text.attr({ 'font': font }); - if (fontF) this.text.attr({ 'font-family': fontF }); - if (fontW) this.text.attr({ 'font-weight': fontW }); - - if (options.link) { this.text.attr('href', options.link); } - if (options.target) { this.text.attr('target', options.target); } - - var maxWidth = this.getAttr('maxWidth'); - if (maxWidth) { - // using this approach: http://stackoverflow.com/a/3153457/22466 - var words = options.text.split(' '); - var tempText = ""; - for (var i=0, ii=words.length; i maxWidth) { - tempText += "\n" + word; - } else { - tempText += " " + word; + function checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) { + // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point + var denominator, a, b, numerator1, numerator2, result = { + x: null, + y: null, + onLine1: !1, + onLine2: !1 + }; + // if we cast these lines infinitely in both directions, they intersect here: + /* + // it is worth noting that this should be the same as: + x = line2StartX + (b * (line2EndX - line2StartX)); + y = line2StartX + (b * (line2EndY - line2StartY)); + */ + // if line1 is a segment and line2 is infinite, they intersect if: + // if line2 is a segment and line1 is infinite, they intersect if: + return denominator = (line2EndY - line2StartY) * (line1EndX - line1StartX) - (line2EndX - line2StartX) * (line1EndY - line1StartY), + 0 === denominator ? result : (a = line1StartY - line2StartY, b = line1StartX - line2StartX, + numerator1 = (line2EndX - line2StartX) * a - (line2EndY - line2StartY) * b, numerator2 = (line1EndX - line1StartX) * a - (line1EndY - line1StartY) * b, + a = numerator1 / denominator, b = numerator2 / denominator, result.x = line1StartX + a * (line1EndX - line1StartX), + result.y = line1StartY + a * (line1EndY - line1StartY), a > 0 && a < 1 && (result.onLine1 = !0), + b > 0 && b < 1 && (result.onLine2 = !0), result); } - } - this.text.attr("text", tempText.substring(1)); - } - - this.group.push(this.text); - - if (symbol) { - var tmpMargin = this.getAttr('text-margin'); - - symbol.attr({ - 'fill' : this.getAttr('fill'), - 'stroke' : this.getAttr('element-color'), - 'stroke-width' : this.getAttr('line-width'), - 'width' : this.text.getBBox().width + 2 * tmpMargin, - 'height' : this.text.getBBox().height + 2 * tmpMargin - }); - - symbol.node.setAttribute('class', this.getAttr('class')); - - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.text.attr({ - 'y': symbol.getBBox().height/2 - }); - - this.initialize(); - } - - } - - /* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */ - Symbol.prototype.getAttr = function(attName) { - if (!this.chart) { - return undefined; - } - var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined; - var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined; - var opt1; - if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) { - opt1 = this.chart.options.flowstate[this.flowstate][attName]; - } - return (opt1 || opt2 || opt3); - }; - - Symbol.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; - }; - - Symbol.prototype.getCenter = function() { - return {x: this.getX() + this.width/2, - y: this.getY() + this.height/2}; - }; - - Symbol.prototype.getX = function() { - return this.group.getBBox().x; - }; - - Symbol.prototype.getY = function() { - return this.group.getBBox().y; - }; - - Symbol.prototype.shiftX = function(x) { - this.group.transform('t' + (this.getX() + x) + ',' + this.getY()); - }; - - Symbol.prototype.setX = function(x) { - this.group.transform('t' + x + ',' + this.getY()); - }; - - Symbol.prototype.shiftY = function(y) { - this.group.transform('t' + this.getX() + ',' + (this.getY() + y)); - }; - - Symbol.prototype.setY = function(y) { - this.group.transform('t' + this.getX() + ',' + y); - }; - - Symbol.prototype.getTop = function() { - var y = this.getY(); - var x = this.getX() + this.width/2; - return {x: x, y: y}; - }; - - Symbol.prototype.getBottom = function() { - var y = this.getY() + this.height; - var x = this.getX() + this.width/2; - return {x: x, y: y}; - }; - - Symbol.prototype.getLeft = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX(); - return {x: x, y: y}; - }; - - Symbol.prototype.getRight = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.group.getBBox().width; - return {x: x, y: y}; - }; - - Symbol.prototype.render = function() { - if (this.next) { - - var lineLength = this.getAttr('line-length'); - - if (this.next_direction === 'right') { - - var rightPoint = this.getRight(); - var leftPoint = this.next.getLeft(); - - if (!this.next.isPositioned) { - - this.next.setY(rightPoint.y - this.next.height/2); - this.next.shiftX(this.group.getBBox().x + this.width + lineLength); - - var self = this; - (function shift() { - var hasSymbolUnder = false; - var symb; - for (var i = 0, len = self.chart.symbols.length; i < len; i++) { - symb = self.chart.symbols[i]; - - var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x); - if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) { - hasSymbolUnder = true; - break; - } + module.exports = { + drawPath: drawPath, + drawLine: drawLine, + checkLineIntersection: checkLineIntersection + }; + }, /* 4 */ + /*!********************************!*\ + !*** ./src/flowchart.parse.js ***! + \********************************/ + /***/ + function(module, exports, __webpack_require__) { + function parse(input) { + function getStyle(s) { + var startIndex = s.indexOf("(") + 1, endIndex = s.indexOf(")"); + return startIndex >= 0 && endIndex >= 0 ? s.substring(startIndex, endIndex) : "{}"; } - - if (hasSymbolUnder) { - self.next.setX(symb.getX() + symb.width + lineLength); - shift(); + function getSymbValue(s) { + var startIndex = s.indexOf("(") + 1, endIndex = s.indexOf(")"); + return startIndex >= 0 && endIndex >= 0 ? s.substring(startIndex, endIndex) : ""; } - })(); - - this.next.isPositioned = true; - - this.next.render(); - } - } else { - var bottomPoint = this.getBottom(); - var topPoint = this.next.getTop(); - - if (!this.next.isPositioned) { - this.next.shiftY(this.getY() + this.height + lineLength); - this.next.setX(bottomPoint.x - this.next.width/2); - this.next.isPositioned = true; - - this.next.render(); - } - } - } - }; - - Symbol.prototype.renderLines = function() { - if (this.next) { - if (this.next_direction) { - this.drawLineTo(this.next, '', this.next_direction); - } else { - this.drawLineTo(this.next); - } - } - }; - - Symbol.prototype.drawLineTo = function(symbol, text, origin) { - if (this.connectedTo.indexOf(symbol) < 0) { - this.connectedTo.push(symbol); - } - - var x = this.getCenter().x, - y = this.getCenter().y, - top = this.getTop(), - right = this.getRight(), - bottom = this.getBottom(), - left = this.getLeft(); - - var symbolX = symbol.getCenter().x, - symbolY = symbol.getCenter().y, - symbolTop = symbol.getTop(), - symbolRight = symbol.getRight(), - symbolBottom = symbol.getBottom(), - symbolLeft = symbol.getLeft(); - - var isOnSameColumn = x === symbolX, - isOnSameLine = y === symbolY, - isUnder = y < symbolY, - isUpper = y > symbolY, - isLeft = x > symbolX, - isRight = x < symbolX; - - var maxX = 0, - line, - lineLength = this.getAttr('line-length'), - lineWith = this.getAttr('line-width'); - - if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) { - line = drawLine(this.chart, bottom, symbolTop, text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x; - } else if ((!origin || origin === 'right') && isOnSameLine && isRight) { - line = drawLine(this.chart, right, symbolLeft, text); - this.rightStart = true; - symbol.leftEnd = true; - maxX = symbolLeft.x; - } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) { - line = drawLine(this.chart, left, symbolRight, text); - this.leftStart = true; - symbol.rightEnd = true; - maxX = symbolRight.x; - } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((!origin || origin === 'bottom') && isLeft) { - if (this.leftEnd && isUpper) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - } else { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - } - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + (bottom.x - symbolTop.x)/2; - } else if ((!origin || origin === 'bottom') && isRight) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + (bottom.x - symbolTop.x)/2; - } else if ((origin && origin === 'right') && isLeft) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((origin && origin === 'right') && isRight) { - line = drawLine(this.chart, right, [ - {x: symbolTop.x, y: right.y}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: right.x + lineLength/2, y: bottom.y + lineLength/2}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + lineLength/2; - } else if ((origin === 'left') && isOnSameColumn && isUpper) { - var diffX = left.x - lineLength/2; - if (symbolLeft.x < left.x) { - diffX = symbolLeft.x - lineLength/2; - } - line = drawLine(this.chart, left, [ - {x: diffX, y: left.y}, - {x: diffX, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.leftStart = true; - symbol.topEnd = true; - maxX = left.x; - } else if ((origin === 'left')) { - line = drawLine(this.chart, left, [ - {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: left.y}, - {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.leftStart = true; - symbol.topEnd = true; - maxX = left.x; - } - - if (line) { - var self = this; - for (var l = 0, llen = this.chart.lines.length; l < llen; l++) { - var otherLine = this.chart.lines[l]; - var i, - len, - intersections, - inter; - - var ePath = otherLine.attr('path'), - lPath = line.attr('path'); - - for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) { - var newPath = []; - newPath.push(['M', ePath[iP][1], ePath[iP][2]]); - newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]); - - var line1_from_x = newPath[0][1]; - var line1_from_y = newPath[0][2]; - var line1_to_x = newPath[1][1]; - var line1_to_y = newPath[1][2]; - - for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) { - var newLinePath = []; - newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]); - newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]); - - var line2_from_x = newLinePath[0][1]; - var line2_from_y = newLinePath[0][2]; - var line2_to_x = newLinePath[1][1]; - var line2_to_y = newLinePath[1][2]; - - var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y); - if (res.onLine1 && res.onLine2) { - - var newSegment; - if (line2_from_y === line2_to_y) { - if (line2_from_x > line2_to_x) { - newSegment = ['L', res.x + lineWith * 2, line2_from_y]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); - } else { - newSegment = ['L', res.x - lineWith * 2, line2_from_y]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); + function getSymbol(s) { + var startIndex = s.indexOf("(") + 1, endIndex = s.indexOf(")"); + return startIndex >= 0 && endIndex >= 0 ? chart.symbols[s.substring(0, startIndex - 1)] : chart.symbols[s]; + } + function getNextPath(s) { + var next = "next", startIndex = s.indexOf("(") + 1, endIndex = s.indexOf(")"); + return startIndex >= 0 && endIndex >= 0 && (next = flowSymb.substring(startIndex, endIndex), + next.indexOf(",") < 0 && "yes" !== next && "no" !== next && (next = "next, " + next)), + next; + } + function getAnnotation(s) { + var startIndex = s.indexOf("(") + 1, endIndex = s.indexOf(")"), tmp = s.substring(startIndex, endIndex); + tmp.indexOf(",") > 0 && (tmp = tmp.substring(0, tmp.indexOf(","))); + var tmp_split = tmp.split("@"); + if (tmp_split.length > 1) return startIndex >= 0 && endIndex >= 0 ? tmp_split[1] : ""; + } + input = input || "", input = input.trim(); + for (var chart = { + symbols: {}, + start: null, + drawSVG: function(container, options) { + function getDisplaySymbol(s) { + if (dispSymbols[s.key]) return dispSymbols[s.key]; + switch (s.symbolType) { + case "start": + dispSymbols[s.key] = new Start(diagram, s); + break; + + case "end": + dispSymbols[s.key] = new End(diagram, s); + break; + + case "operation": + dispSymbols[s.key] = new Operation(diagram, s); + break; + + case "inputoutput": + dispSymbols[s.key] = new InputOutput(diagram, s); + break; + + case "input": + dispSymbols[s.key] = new Input(diagram, s); + //tds + break; + + case "output": + dispSymbols[s.key] = new Output(diagram, s); + //tds + break; + + case "subroutine": + dispSymbols[s.key] = new Subroutine(diagram, s); + break; + + case "condition": + dispSymbols[s.key] = new Condition(diagram, s); + break; + + case "parallel": + dispSymbols[s.key] = new Parallel(diagram, s); + break; + + default: + return new Error("Wrong symbol type!"); + } + return dispSymbols[s.key]; + } + var self = this; + this.diagram && this.diagram.clean(); + var diagram = new FlowChart(container, options); + this.diagram = diagram; + var dispSymbols = {}; + !function constructChart(s, prevDisp, prev) { + var dispSymb = getDisplaySymbol(s); + return self.start === s ? diagram.startWith(dispSymb) : prevDisp && prev && !prevDisp.pathOk && (prevDisp instanceof Condition ? (prev.yes === s && prevDisp.yes(dispSymb), + prev.no === s && prevDisp.no(dispSymb)) : prevDisp instanceof Parallel ? (prev.path1 === s && prevDisp.path1(dispSymb), + prev.path2 === s && prevDisp.path2(dispSymb), prev.path3 === s && prevDisp.path3(dispSymb)) : prevDisp.then(dispSymb)), + dispSymb.pathOk ? dispSymb : (dispSymb instanceof Condition ? (s.yes && constructChart(s.yes, dispSymb, s), + s.no && constructChart(s.no, dispSymb, s)) : dispSymb instanceof Parallel ? (s.path1 && constructChart(s.path1, dispSymb, s), + s.path2 && constructChart(s.path2, dispSymb, s), s.path3 && constructChart(s.path3, dispSymb, s)) : s.next && constructChart(s.next, dispSymb, s), + dispSymb); + }(this.start), diagram.render(); + }, + clean: function() { + this.diagram.clean(); + }, + options: function() { + return this.diagram.options; } - } else { - if (line2_from_y > line2_to_y) { - newSegment = ['L', line2_from_x, res.y + lineWith * 2]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); - } else { - newSegment = ['L', line2_from_x, res.y - lineWith * 2]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); + }, lines = [], prevBreak = 0, i0 = 1, i0len = input.length; i0 < i0len; i0++) if ("\n" === input[i0] && "\\" !== input[i0 - 1]) { + var line0 = input.substring(prevBreak, i0); + prevBreak = i0 + 1, lines.push(line0.replace(/\\\n/g, "\n")); + } + prevBreak < input.length && lines.push(input.substr(prevBreak)); + for (var l = 1, len = lines.length; l < len; ) { + var currentLine = lines[l]; + currentLine.indexOf("->") < 0 && currentLine.indexOf("=>") < 0 && currentLine.indexOf("@>") < 0 ? (lines[l - 1] += "\n" + currentLine, + lines.splice(l, 1), len--) : l++; + } + for (;lines.length > 0; ) { + var line = lines.splice(0, 1)[0].trim(); + if (line.indexOf("=>") >= 0) { + // definition + var parts = line.split("=>"), symbol = { + key: parts[0].replace(/\(.*\)/, ""), + symbolType: parts[1], + text: null, + link: null, + target: null, + flowstate: null, + function: null, + lineStyle: {}, + params: {} + }, params = parts[0].match(/\((.*)\)/); + if (params && params.length > 1) for (var entries = params[1].split(","), i = 0; i < entries.length; i++) { + var entry = entries[i].split("="); + 2 == entry.length && (symbol.params[entry[0]] = entry[1]); + } + var sub; + /* adding support for links */ + if (symbol.symbolType.indexOf(": ") >= 0 && (sub = symbol.symbolType.split(": "), + symbol.symbolType = sub.shift(), symbol.text = sub.join(": ")), symbol.text && symbol.text.indexOf(":$") >= 0 ? (sub = symbol.text.split(":$"), + symbol.text = sub.shift(), symbol.function = sub.join(":$")) : symbol.symbolType.indexOf(":$") >= 0 ? (sub = symbol.symbolType.split(":$"), + symbol.symbolType = sub.shift(), symbol.function = sub.join(":$")) : symbol.text && symbol.text.indexOf(":>") >= 0 ? (sub = symbol.text.split(":>"), + symbol.text = sub.shift(), symbol.link = sub.join(":>")) : symbol.symbolType.indexOf(":>") >= 0 && (sub = symbol.symbolType.split(":>"), + symbol.symbolType = sub.shift(), symbol.link = sub.join(":>")), symbol.symbolType.indexOf("\n") >= 0 && (symbol.symbolType = symbol.symbolType.split("\n")[0]), + symbol.link) { + var startIndex = symbol.link.indexOf("[") + 1, endIndex = symbol.link.indexOf("]"); + startIndex >= 0 && endIndex >= 0 && (symbol.target = symbol.link.substring(startIndex, endIndex), + symbol.link = symbol.link.substring(0, startIndex - 1)); + } + /* end of link support */ + /* adding support for flowstates */ + if (symbol.text && symbol.text.indexOf("|") >= 0) { + var txtAndState = symbol.text.split("|"); + symbol.flowstate = txtAndState.pop().trim(), symbol.text = txtAndState.join("|"); + } + /* end of flowstate support */ + chart.symbols[symbol.key] = symbol; + } else if (line.indexOf("->") >= 0) { + var ann = getAnnotation(line); + ann && (line = line.replace("@" + ann, "")); + for (var flowSymbols = line.split("->"), iS = 0, lenS = flowSymbols.length; iS < lenS; iS++) { + var flowSymb = flowSymbols[iS], symbVal = getSymbValue(flowSymb); + "true" !== symbVal && "false" !== symbVal || (// map true or false to yes or no respectively + flowSymb = flowSymb.replace("true", "yes"), flowSymb = flowSymb.replace("false", "no")); + var next = getNextPath(flowSymb), realSymb = getSymbol(flowSymb), direction = null; + if (next.indexOf(",") >= 0) { + var condOpt = next.split(","); + next = condOpt[0], direction = condOpt[1].trim(); + } + if (ann && ("condition" === realSymb.symbolType ? "yes" === next || "true" === next ? realSymb.yes_annotation = ann : realSymb.no_annotation = ann : "parallel" === realSymb.symbolType && ("path1" === next ? realSymb.path1_annotation = ann : "path2" === next ? realSymb.path2_annotation = ann : "path3" === next && (realSymb.path3_annotation = ann)), + ann = null), chart.start || (chart.start = realSymb), iS + 1 < lenS) { + var nextSymb = flowSymbols[iS + 1]; + realSymb[next] = getSymbol(nextSymb), realSymb["direction_" + next] = direction, + direction = null; + } + } + } else if (line.indexOf("@>") >= 0) for (var lineStyleSymbols = line.split("@>"), iSS = 0, lenSS = lineStyleSymbols.length; iSS < lenSS; iSS++) if (iSS + 1 !== lenSS) { + var curSymb = getSymbol(lineStyleSymbols[iSS]), nextSymbol = getSymbol(lineStyleSymbols[iSS + 1]); + curSymb.lineStyle[nextSymbol.key] = JSON.parse(getStyle(lineStyleSymbols[iSS + 1])); } - } - - lP += 2; - len += 2; } - } + return chart; } - } - - this.chart.lines.push(line); - } - - if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) { - this.chart.maxXFromLine = maxX; - } - }; - function Start(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0, 20); - options = options || {}; - options.text = options.text || 'Start'; - Symbol.call(this, chart, options, symbol); - } - f.inherits(Start, Symbol); - - - // Start.prototype.render = function() { - // if (this.next) { - // var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length']; - - // var bottomPoint = this.getBottom(); - // var topPoint = this.next.getTop(); - - // if (!this.next.isPositioned) { - // this.next.shiftY(this.getY() + this.height + lineLength); - // this.next.setX(bottomPoint.x - this.next.width/2); - // this.next.isPositioned = true; - - // this.next.render(); - // } - // } - // }; - - // Start.prototype.renderLines = function() { - // if (this.next) { - // this.drawLineTo(this.next); - // } - // }; - function End(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0, 20); - options = options || {}; - options.text = options.text || 'End'; - Symbol.call(this, chart, options, symbol); - } - f.inherits(End, Symbol); - function Operation(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0); - options = options || {}; - Symbol.call(this, chart, options, symbol); - } - f.inherits(Operation, Symbol); - function Subroutine(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0); - options = options || {}; - Symbol.call(this, chart, options, symbol); - - symbol.attr({ - width: this.text.getBBox().width + 4 * this.getAttr('text-margin') - }); - - this.text.attr({ - 'x': 2 * this.getAttr('text-margin') - }); - - var innerWrap = chart.paper.rect(0, 0, 0, 0); - innerWrap.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') - }); - if (options.key) { innerWrap.node.id = options.key + 'i'; } - - var font = this.getAttr('font'); - var fontF = this.getAttr('font-family'); - var fontW = this.getAttr('font-weight'); - - if (font) innerWrap.attr({ 'font': font }); - if (fontF) innerWrap.attr({ 'font-family': fontF }); - if (fontW) innerWrap.attr({ 'font-weight': fontW }); - - if (options.link) { innerWrap.attr('href', options.link); } - if (options.target) { innerWrap.attr('target', options.target); } - this.group.push(innerWrap); - innerWrap.insertBefore(this.text); - - this.initialize(); - } - f.inherits(Subroutine, Symbol); - function InputOutput(chart, options) { - options = options || {}; - Symbol.call(this, chart, options); - this.textMargin = this.getAttr('text-margin'); - - this.text.attr({ - x: this.textMargin * 3 - }); - - var width = this.text.getBBox().width + 4 * this.textMargin; - var height = this.text.getBBox().height + 2 * this.textMargin; - var startX = this.textMargin; - var startY = height/2; - - var start = {x: startX, y: startY}; - var points = [ - {x: startX - this.textMargin, y: height}, - {x: startX - this.textMargin + width, y: height}, - {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0}, - {x: startX - this.textMargin + 2 * this.textMargin, y: 0}, - {x: startX, y: startY} - ]; - - var symbol = drawPath(chart, start, points); - - symbol.attr({ - stroke: this.getAttr('element-color'), - 'stroke-width': this.getAttr('line-width'), - fill: this.getAttr('fill') - }); - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - symbol.node.setAttribute('class', this.getAttr('class')); - - this.text.attr({ - y: symbol.getBBox().height/2 - }); - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.initialize(); - } - f.inherits(InputOutput, Symbol); - - InputOutput.prototype.getLeft = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.textMargin; - return {x: x, y: y}; - }; - - InputOutput.prototype.getRight = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.group.getBBox().width - this.textMargin; - return {x: x, y: y}; - }; - function Condition(chart, options) { - options = options || {}; - Symbol.call(this, chart, options); - this.textMargin = this.getAttr('text-margin'); - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - if (options.yes && options['direction_yes'] && options.no && !options['direction_no']) { - if (options['direction_yes'] === 'right') { - this.no_direction = 'bottom'; - this.yes_direction = 'right'; - } else { - this.no_direction = 'right'; - this.yes_direction = 'bottom'; - } - } else if (options.yes && !options['direction_yes'] && options.no && options['direction_no']) { - if (options['direction_no'] === 'right') { - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - } else { - this.yes_direction = 'right'; - this.no_direction = 'bottom'; - } - } else { - 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: this.textMargin * 2 - }); - - var width = this.text.getBBox().width + 3 * this.textMargin; - width += width/2; - var height = this.text.getBBox().height + 2 * this.textMargin; - height += height/2; - height = Math.max(width * 0.5, height); - var startX = width/4; - var startY = height/4; - - this.text.attr({ - x: startX + this.textMargin/2 - }); - - var start = {x: startX, y: startY}; - var points = [ - {x: startX - width/4, y: startY + height/4}, - {x: startX - width/4 + width/2, y: startY + height/4 + height/2}, - {x: startX - width/4 + width, y: startY + height/4}, - {x: startX - width/4 + width/2, y: startY + height/4 - height/2}, - {x: startX - width/4, y: startY + height/4} - ]; - - var symbol = drawPath(chart, start, points); - - symbol.attr({ - stroke: this.getAttr('element-color'), - 'stroke-width': this.getAttr('line-width'), - fill: this.getAttr('fill') - }); - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - symbol.node.setAttribute('class', this.getAttr('class')); - - this.text.attr({ - y: symbol.getBBox().height/2 - }); - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.initialize(); - } - f.inherits(Condition, Symbol); - - Condition.prototype.render = function() { - - if (this.yes_direction) { - this[this.yes_direction + '_symbol'] = this.yes_symbol; - } - - if (this.no_direction) { - this[this.no_direction + '_symbol'] = this.no_symbol; - } - - var lineLength = this.getAttr('line-length'); - - if (this.bottom_symbol) { - var bottomPoint = this.getBottom(); - var topPoint = this.bottom_symbol.getTop(); - - if (!this.bottom_symbol.isPositioned) { - this.bottom_symbol.shiftY(this.getY() + this.height + lineLength); - this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2); - this.bottom_symbol.isPositioned = true; - - this.bottom_symbol.render(); - } - } - - if (this.right_symbol) { - var rightPoint = this.getRight(); - var leftPoint = this.right_symbol.getLeft(); - - if (!this.right_symbol.isPositioned) { - - this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2); - this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength); - - var self = this; - (function shift() { - var hasSymbolUnder = false; - var symb; - for (var i = 0, len = self.chart.symbols.length; i < len; i++) { - symb = self.chart.symbols[i]; - - var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x); - if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) { - hasSymbolUnder = true; - break; - } - } - - if (hasSymbolUnder) { - self.right_symbol.setX(symb.getX() + symb.width + lineLength); - shift(); - } - })(); - - this.right_symbol.isPositioned = true; - - this.right_symbol.render(); - } - } - }; - - Condition.prototype.renderLines = function() { - if (this.yes_symbol) { - this.drawLineTo(this.yes_symbol, this.getAttr('yes-text'), this.yes_direction); - } - - if (this.no_symbol) { - this.drawLineTo(this.no_symbol, this.getAttr('no-text'), this.no_direction); - } - }; - function parse(input) { - input = input || ''; - input = input.trim(); - - var chart = { - symbols: {}, - start: null, - drawSVG: function(container, options) { - var self = this; - - if (this.diagram) { - this.diagram.clean(); + var FlowChart = __webpack_require__(/*! ./flowchart.chart */ 7), Start = __webpack_require__(/*! ./flowchart.symbol.start */ 15), End = __webpack_require__(/*! ./flowchart.symbol.end */ 10), Operation = __webpack_require__(/*! ./flowchart.symbol.operation */ 13), InputOutput = __webpack_require__(/*! ./flowchart.symbol.inputoutput */ 12), Input = __webpack_require__(/*! ./flowchart.symbol.input */ 11), Output = __webpack_require__(/*! ./flowchart.symbol.output */ 14), Subroutine = __webpack_require__(/*! ./flowchart.symbol.subroutine */ 16), Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5), Parallel = __webpack_require__(/*! ./flowchart.symbol.parallel */ 6); + module.exports = parse; + }, /* 5 */ + /*!*******************************************!*\ + !*** ./src/flowchart.symbol.condition.js ***! + \*******************************************/ + /***/ + function(module, exports, __webpack_require__) { + function Condition(chart, options) { + options = options || {}, Symbol.call(this, chart, options), this.yes_annotation = options.yes_annotation, + this.no_annotation = options.no_annotation, this.textMargin = this.getAttr("text-margin"), + this.yes_direction = options.direction_yes, this.no_direction = options.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 width = this.text.getBBox().width + 3 * this.textMargin; + width += width / 2; + var height = this.text.getBBox().height + 2 * this.textMargin; + height += height / 2, height = Math.max(.5 * width, height); + var startX = width / 4, startY = height / 4; + this.text.attr({ + x: startX + this.textMargin / 2 + }); + var start = { + x: startX, + y: startY + }, points = [ { + x: startX - width / 4, + y: startY + height / 4 + }, { + x: startX - width / 4 + width / 2, + y: startY + height / 4 + height / 2 + }, { + x: startX - width / 4 + width, + y: startY + height / 4 + }, { + x: startX - width / 4 + width / 2, + y: startY + height / 4 - height / 2 + }, { + x: startX - width / 4, + y: startY + height / 4 + } ], symbol = drawPath(chart, start, points); + symbol.attr({ + stroke: this.getAttr("element-color"), + "stroke-width": this.getAttr("line-width"), + fill: this.getAttr("fill") + }), options.link && symbol.attr("href", options.link), options.target && symbol.attr("target", options.target), + options.key && (symbol.node.id = options.key), symbol.node.setAttribute("class", this.getAttr("class")), + this.text.attr({ + y: symbol.getBBox().height / 2 + }), this.group.push(symbol), symbol.insertBefore(this.text), this.symbol = symbol, + this.initialize(); } - - var diagram = new FlowChart(container, options); - this.diagram = diagram; - var dispSymbols = {}; - - function getDisplaySymbol(s) { - if (dispSymbols[s.key]) { - return dispSymbols[s.key]; - } - - switch (s.symbolType) { - case 'start': - dispSymbols[s.key] = new Start(diagram, s); - break; - case 'end': - dispSymbols[s.key] = new End(diagram, s); - break; - case 'operation': - dispSymbols[s.key] = new Operation(diagram, s); - break; - case 'inputoutput': - dispSymbols[s.key] = new InputOutput(diagram, s); - break; - case 'subroutine': - dispSymbols[s.key] = new Subroutine(diagram, s); - break; - case 'condition': - dispSymbols[s.key] = new Condition(diagram, s); - break; - default: - return new Error('Wrong symbol type!'); - } - - return dispSymbols[s.key]; + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits, drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3), drawPath = drawAPI.drawPath; + inherits(Condition, Symbol), Condition.prototype.render = function() { + var self = this; + this.yes_direction && (this[this.yes_direction + "_symbol"] = this.yes_symbol), + this.no_direction && (this[this.no_direction + "_symbol"] = this.no_symbol); + var lineLength = this.getAttr("line-length"); + if (this.bottom_symbol) { + var bottomPoint = this.getBottom(); + this.bottom_symbol.isPositioned || (this.bottom_symbol.shiftY(this.getY() + this.height + lineLength), + this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width / 2), this.bottom_symbol.isPositioned = !0, + this.bottom_symbol.render()); + } + if (this.right_symbol) { + var rightPoint = this.getRight(); + this.right_symbol.isPositioned || (this.right_symbol.setY(rightPoint.y - this.right_symbol.height / 2), + this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength), function shift() { + for (var symb, hasSymbolUnder = !1, i = 0, len = self.chart.symbols.length; i < len; i++) if (symb = self.chart.symbols[i], + !self.params["align-next"] || "no" !== self.params["align-next"]) { + var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x); + if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width / 2) { + hasSymbolUnder = !0; + break; + } + } + if (hasSymbolUnder) { + if ("end" === self.right_symbol.symbolType) return; + self.right_symbol.setX(symb.getX() + symb.width + lineLength), shift(); + } + }(), this.right_symbol.isPositioned = !0, this.right_symbol.render()); + } + if (this.left_symbol) { + var leftPoint = this.getLeft(); + this.left_symbol.isPositioned || (this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2), + this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength)), function shift() { + for (var symb, hasSymbolUnder = !1, i = 0, len = self.chart.symbols.length; i < len; i++) if (symb = self.chart.symbols[i], + !self.params["align-next"] || "no" !== self.params["align-next"]) { + var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x); + if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) { + hasSymbolUnder = !0; + break; + } + } + if (hasSymbolUnder) { + if ("end" === self.left_symbol.symbolType) return; + self.left_symbol.setX(symb.getX() + symb.width + lineLength), shift(); + } + }(), this.left_symbol.isPositioned = !0, this.left_symbol.render()); + } + }, Condition.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); + }, module.exports = Condition; + }, /* 6 */ + /*!******************************************!*\ + !*** ./src/flowchart.symbol.parallel.js ***! + \******************************************/ + /***/ + function(module, exports, __webpack_require__) { + function Parallel(chart, options) { + var symbol = chart.paper.rect(0, 0, 0, 0); + options = options || {}, Symbol.call(this, chart, options, symbol), this.path1_annotation = options.path1_annotation || "", + this.path2_annotation = options.path2_annotation || "", this.path3_annotation = options.path3_annotation || "", + this.textMargin = this.getAttr("text-margin"), this.path1_direction = "bottom", + this.path2_direction = "right", this.path3_direction = "top", this.params = options.params, + "path1" === options.direction_next && !options[options.direction_next] && options.next && (options[options.direction_next] = options.next), + "path2" === options.direction_next && !options[options.direction_next] && options.next && (options[options.direction_next] = options.next), + "path3" === options.direction_next && !options[options.direction_next] && options.next && (options[options.direction_next] = options.next), + options.path1 && options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && !options.direction_path3 ? "right" === options.direction_path1 ? (this.path2_direction = "bottom", + this.path1_direction = "right", this.path3_direction = "top") : "top" === options.direction_path1 ? (this.path2_direction = "right", + this.path1_direction = "top", this.path3_direction = "bottom") : "left" === options.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") : options.path1 && !options.direction_path1 && options.path2 && options.direction_path2 && options.path3 && !options.direction_path3 ? "right" === options.direction_path2 ? (this.path1_direction = "bottom", + this.path2_direction = "right", this.path3_direction = "top") : "left" === options.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") : options.path1 && !options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && options.direction_path3 ? "right" === options.direction_path2 ? (this.path1_direction = "bottom", + this.path2_direction = "top", this.path3_direction = "right") : "left" === options.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 = options.direction_path1, + this.path2_direction = options.direction_path2, this.path3_direction = options.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(); } - - (function constructChart(s, prevDisp, prev) { - var dispSymb = getDisplaySymbol(s); - - if (self.start === s) { - diagram.startWith(dispSymb); - } else if (prevDisp && prev && !prevDisp.pathOk) { - if (prevDisp instanceof(Condition)) { - if (prev.yes === s) { - prevDisp.yes(dispSymb); - } - if (prev.no === s) { - prevDisp.no(dispSymb); - } - } else { - prevDisp.then(dispSymb); + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits; + inherits(Parallel, Symbol), Parallel.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 lineLength = this.getAttr("line-length"); + if (this.bottom_symbol) { + var bottomPoint = this.getBottom(); + this.bottom_symbol.isPositioned || (this.bottom_symbol.shiftY(this.getY() + this.height + lineLength), + this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width / 2), this.bottom_symbol.isPositioned = !0, + this.bottom_symbol.render()); } - } - - if (dispSymb.pathOk) { - return dispSymb; - } - - if (dispSymb instanceof(Condition)) { - if (s.yes) { - constructChart(s.yes, dispSymb, s); + if (this.top_symbol) { + var topPoint = this.getTop(); + this.top_symbol.isPositioned || (this.top_symbol.shiftY(this.getY() - this.top_symbol.height - lineLength), + this.top_symbol.setX(topPoint.x + this.top_symbol.width), this.top_symbol.isPositioned = !0, + this.top_symbol.render()); } - if (s.no) { - constructChart(s.no, dispSymb, s); + var self = this; + if (this.left_symbol) { + var leftPoint = this.getLeft(); + this.left_symbol.isPositioned || (this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2), + this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength)), function shift() { + for (var symb, hasSymbolUnder = !1, i = 0, len = self.chart.symbols.length; i < len; i++) if (symb = self.chart.symbols[i], + !self.params["align-next"] || "no" !== self.params["align-next"]) { + var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x); + if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) { + hasSymbolUnder = !0; + break; + } + } + if (hasSymbolUnder) { + if ("end" === self.left_symbol.symbolType) return; + self.left_symbol.setX(symb.getX() + symb.width + lineLength), shift(); + } + }(), this.left_symbol.isPositioned = !0, this.left_symbol.render()); } - } else if (s.next) { - constructChart(s.next, dispSymb, s); - } - - return dispSymb; - })(this.start); - - diagram.render(); - }, - clean: function() { - this.diagram.clean(); - } - }; - - var lines = []; - var prevBreak = 0; - for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) { - if(input[i0] === '\n' && input[i0 - 1] !== '\\') { - var line0 = input.substring(prevBreak, i0); - prevBreak = i0 + 1; - lines.push(line0.replace(/\\\n/g, '\n')); - } - } - - if(prevBreak < input.length) { - lines.push(input.substr(prevBreak)); - } - - for (var l = 1, len = lines.length; l < len;) { - var currentLine = lines[l]; - - if (currentLine.indexOf(': ') < 0 && currentLine.indexOf('(') < 0 && currentLine.indexOf(')') < 0 && currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0) { - lines[l - 1] += '\n' + currentLine; - lines.splice(l, 1); - len--; - } else { - l++; - } - } - - function getSymbol(s) { - var startIndex = s.indexOf('(') + 1; - var endIndex = s.indexOf(')'); - if (startIndex >= 0 && endIndex >= 0) { - return chart.symbols[s.substring(0, startIndex - 1)]; - } - return chart.symbols[s]; - } - - function getNextPath(s) { - var next = 'next'; - var startIndex = s.indexOf('(') + 1; - var endIndex = s.indexOf(')'); - if (startIndex >= 0 && endIndex >= 0) { - next = flowSymb.substring(startIndex, endIndex); - if (next.indexOf(',') < 0) { - if (next !== 'yes' && next !== 'no') { - next = 'next, ' + next; - } + if (this.right_symbol) { + var rightPoint = this.getRight(); + this.right_symbol.isPositioned || (this.right_symbol.setY(rightPoint.y - this.right_symbol.height / 2), + this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength), function shift() { + for (var symb, hasSymbolUnder = !1, i = 0, len = self.chart.symbols.length; i < len; i++) if (symb = self.chart.symbols[i], + !self.params["align-next"] || "no" !== self.params["align-next"]) { + var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x); + if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width / 2) { + hasSymbolUnder = !0; + break; + } + } + if (hasSymbolUnder) { + if ("end" === self.right_symbol.symbolType) return; + self.right_symbol.setX(symb.getX() + symb.width + lineLength), shift(); + } + }(), this.right_symbol.isPositioned = !0, this.right_symbol.render()); + } + }, Parallel.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); + }, module.exports = Parallel; + }, /* 7 */ + /*!********************************!*\ + !*** ./src/flowchart.chart.js ***! + \********************************/ + /***/ + function(module, exports, __webpack_require__) { + function FlowChart(container, options) { + options = options || {}, this.paper = new Raphael(container), this.options = defaults(options, defaultOptions), + this.symbols = [], this.lines = [], this.start = null; } - } - return next; - } - - while (lines.length > 0) { - var line = lines.splice(0, 1)[0]; - - if (line.indexOf('=>') >= 0) { - // definition - var parts = line.split('=>'); - var symbol = { - key: parts[0], - symbolType: parts[1], - text: null, - link: null, - target: null, - flowstate: null + var Raphael = __webpack_require__(/*! raphael */ 18), defaults = __webpack_require__(/*! ./flowchart.helpers */ 1).defaults, defaultOptions = __webpack_require__(/*! ./flowchart.defaults */ 8), Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5), Parallel = __webpack_require__(/*! ./flowchart.symbol.parallel */ 6); + FlowChart.prototype.handle = function(symbol) { + this.symbols.indexOf(symbol) <= -1 && this.symbols.push(symbol); + var flowChart = this; + return symbol instanceof Condition ? (symbol.yes = function(nextSymbol) { + return symbol.yes_symbol = nextSymbol, symbol.no_symbol && (symbol.pathOk = !0), + flowChart.handle(nextSymbol); + }, symbol.no = function(nextSymbol) { + return symbol.no_symbol = nextSymbol, symbol.yes_symbol && (symbol.pathOk = !0), + flowChart.handle(nextSymbol); + }) : symbol instanceof Parallel ? (symbol.path1 = function(nextSymbol) { + return symbol.path1_symbol = nextSymbol, symbol.path2_symbol && (symbol.pathOk = !0), + flowChart.handle(nextSymbol); + }, symbol.path2 = function(nextSymbol) { + return symbol.path2_symbol = nextSymbol, symbol.path3_symbol && (symbol.pathOk = !0), + flowChart.handle(nextSymbol); + }, symbol.path3 = function(nextSymbol) { + return symbol.path3_symbol = nextSymbol, symbol.path1_symbol && (symbol.pathOk = !0), + flowChart.handle(nextSymbol); + }) : symbol.then = function(nextSymbol) { + return symbol.next = nextSymbol, symbol.pathOk = !0, flowChart.handle(nextSymbol); + }, symbol; + }, FlowChart.prototype.startWith = function(symbol) { + return this.start = symbol, this.handle(symbol); + }, FlowChart.prototype.render = function() { + var symbol, line, maxWidth = 0, maxHeight = 0, i = 0, len = 0, maxX = 0, maxY = 0, minX = 0, minY = 0; + for (i = 0, len = this.symbols.length; i < len; i++) symbol = this.symbols[i], symbol.width > maxWidth && (maxWidth = symbol.width), + symbol.height > maxHeight && (maxHeight = symbol.height); + for (i = 0, len = this.symbols.length; i < len; i++) symbol = this.symbols[i], symbol.shiftX(this.options.x + (maxWidth - symbol.width) / 2 + this.options["line-width"]), + symbol.shiftY(this.options.y + (maxHeight - symbol.height) / 2 + this.options["line-width"]); + // for (i = 0, len = this.symbols.length; i < len; i++) { + // symbol = this.symbols[i]; + // symbol.render(); + // } + for (this.start.render(), i = 0, len = this.symbols.length; i < len; i++) symbol = this.symbols[i], + symbol.renderLines(); + maxX = this.maxXFromLine; + var x, y; + for (i = 0, len = this.symbols.length; i < len; i++) { + symbol = this.symbols[i]; + var leftX = symbol.getX(); + x = leftX + symbol.width, y = symbol.getY() + symbol.height, leftX < minX && (minX = leftX), + x > maxX && (maxX = x), y > maxY && (maxY = y); + } + for (i = 0, len = this.lines.length; i < len; i++) { + line = this.lines[i].getBBox(), x = line.x, y = line.y; + var x2 = line.x2, y2 = line.y2; + x < minX && (minX = x), y < minY && (minY = y), x2 > maxX && (maxX = x2), y2 > maxY && (maxY = y2); + } + var scale = this.options.scale, lineWidth = this.options["line-width"]; + this.minXFromSymbols < minX && (minX = this.minXFromSymbols), minX < 0 && (minX -= lineWidth), + minY < 0 && (minY -= lineWidth); + var width = maxX + lineWidth - minX, height = maxY + lineWidth - minY; + this.paper.setSize(width * scale, height * scale), this.paper.setViewBox(minX, minY, width, height, !0); + }, FlowChart.prototype.clean = function() { + if (this.paper) { + var paperDom = this.paper.canvas; + paperDom.parentNode && paperDom.parentNode.removeChild(paperDom); + } + }, module.exports = FlowChart; + }, /* 8 */ + /*!***********************************!*\ + !*** ./src/flowchart.defaults.js ***! + \***********************************/ + /***/ + function(module, exports) { + // defaults + module.exports = { + x: 0, + y: 0, + // 'roundness': 0, + "line-width": 3, + "line-length": 50, + "text-margin": 10, + "font-size": 14, + "font-color": "black", + // 'font': 'normal', + // 'font-family': 'calibri', + // 'font-weight': 'normal', + "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: {}, + //tds + output: {}, + //tds + operation: {}, + subroutine: {}, + parallel: {} + } }; - - var sub; - - if (symbol.symbolType.indexOf(': ') >= 0) { - sub = symbol.symbolType.split(': '); - symbol.symbolType = sub[0]; - symbol.text = sub[1]; + }, /* 9 */ + /*!*******************************!*\ + !*** ./src/flowchart.shim.js ***! + \*******************************/ + /***/ + function(module, exports) { + // add indexOf to non ECMA-262 standard compliant browsers + Array.prototype.indexOf || (Array.prototype.indexOf = function(searchElement) { + "use strict"; + if (null === this) throw new TypeError(); + var t = Object(this), len = t.length >>> 0; + if (0 === len) return -1; + var n = 0; + if (arguments.length > 0 && (n = Number(arguments[1]), n != n ? // shortcut for verifying if it's NaN + n = 0 : 0 !== n && n != 1 / 0 && n != -(1 / 0) && (n = (n > 0 || -1) * Math.floor(Math.abs(n)))), + n >= len) return -1; + for (var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); k < len; k++) if (k in t && t[k] === searchElement) return k; + return -1; + }), // add lastIndexOf to non ECMA-262 standard compliant browsers + Array.prototype.lastIndexOf || (Array.prototype.lastIndexOf = function(searchElement) { + "use strict"; + if (null === this) throw new TypeError(); + var t = Object(this), len = t.length >>> 0; + if (0 === len) return -1; + var n = len; + arguments.length > 1 && (n = Number(arguments[1]), n != n ? n = 0 : 0 !== n && n != 1 / 0 && n != -(1 / 0) && (n = (n > 0 || -1) * Math.floor(Math.abs(n)))); + for (var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n); k >= 0; k--) if (k in t && t[k] === searchElement) return k; + return -1; + }), String.prototype.trim || (String.prototype.trim = function() { + return this.replace(/^\s+|\s+$/g, ""); + }); + }, /* 10 */ + /*!*************************************!*\ + !*** ./src/flowchart.symbol.end.js ***! + \*************************************/ + /***/ + function(module, exports, __webpack_require__) { + function End(chart, options) { + var symbol = chart.paper.rect(0, 0, 0, 0, 20); + options = options || {}, options.text = options.text || "End", Symbol.call(this, chart, options, symbol); } - - if (symbol.text && symbol.text.indexOf(':>') >= 0) { - sub = symbol.text.split(':>'); - symbol.text = sub[0]; - symbol.link = sub[1]; - } else if (symbol.symbolType.indexOf(':>') >= 0) { - sub = symbol.symbolType.split(':>'); - symbol.symbolType = sub[0]; - symbol.link = sub[1]; + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits; + inherits(End, Symbol), module.exports = End; + }, /* 11 */ + /*!***************************************!*\ + !*** ./src/flowchart.symbol.input.js ***! + \***************************************/ + /***/ + function(module, exports, __webpack_require__) { + function Input(chart, options) { + options = options || {}, Symbol.call(this, chart, options), this.textMargin = this.getAttr("text-margin"), + this.text.attr({ + x: 3 * this.textMargin + }); + var width = this.text.getBBox().width + 4 * this.textMargin, height = this.text.getBBox().height + 2 * this.textMargin, startX = this.textMargin, startY = height / 2, start = { + x: startX, + y: startY + }, points = [ { + x: startX - this.textMargin + 2 * this.textMargin, + y: height + }, { + x: startX - this.textMargin + width, + y: height + }, { + x: startX - this.textMargin + width + 2 * this.textMargin, + y: 0 + }, { + x: startX - this.textMargin, + y: 0 + }, { + x: startX, + y: startY + } ], symbol = drawPath(chart, start, points); + symbol.attr({ + stroke: this.getAttr("element-color"), + "stroke-width": this.getAttr("line-width"), + fill: this.getAttr("fill") + }), options.link && symbol.attr("href", options.link), options.target && symbol.attr("target", options.target), + options.key && (symbol.node.id = options.key), symbol.node.setAttribute("class", this.getAttr("class")), + this.text.attr({ + y: symbol.getBBox().height / 2 + }), this.group.push(symbol), symbol.insertBefore(this.text), this.symbol = symbol, + this.initialize(); } - - if (symbol.symbolType.indexOf('\n') >= 0) { - symbol.symbolType = symbol.symbolType.split('\n')[0]; + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits, drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3), drawPath = drawAPI.drawPath; + inherits(Input, Symbol), Input.prototype.getLeft = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX() + this.textMargin; + return { + x: x, + y: y + }; + }, Input.prototype.getRight = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX() + this.group.getBBox().width - this.textMargin; + return { + x: x, + y: y + }; + }, module.exports = Input; + }, /* 12 */ + /*!*********************************************!*\ + !*** ./src/flowchart.symbol.inputoutput.js ***! + \*********************************************/ + /***/ + function(module, exports, __webpack_require__) { + function InputOutput(chart, options) { + options = options || {}, Symbol.call(this, chart, options), this.textMargin = this.getAttr("text-margin"), + this.text.attr({ + x: 3 * this.textMargin + }); + var width = this.text.getBBox().width + 4 * this.textMargin, height = this.text.getBBox().height + 2 * this.textMargin, startX = this.textMargin, startY = height / 2, start = { + x: startX, + y: startY + }, points = [ { + x: startX - this.textMargin, + y: height + }, { + x: startX - this.textMargin + width, + y: height + }, { + x: startX - this.textMargin + width + 2 * this.textMargin, + y: 0 + }, { + x: startX - this.textMargin + 2 * this.textMargin, + y: 0 + }, { + x: startX, + y: startY + } ], symbol = drawPath(chart, start, points); + symbol.attr({ + stroke: this.getAttr("element-color"), + "stroke-width": this.getAttr("line-width"), + fill: this.getAttr("fill") + }), options.link && symbol.attr("href", options.link), options.target && symbol.attr("target", options.target), + options.key && (symbol.node.id = options.key), symbol.node.setAttribute("class", this.getAttr("class")), + this.text.attr({ + y: symbol.getBBox().height / 2 + }), this.group.push(symbol), symbol.insertBefore(this.text), this.symbol = symbol, + this.initialize(); } - - /* adding support for links */ - if (symbol.link) { - var startIndex = symbol.link.indexOf('[') + 1; - var endIndex = symbol.link.indexOf(']'); - if (startIndex >= 0 && endIndex >= 0) { - symbol.target = symbol.link.substring(startIndex, endIndex); - symbol.link = symbol.link.substring(0, startIndex - 1); - } + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits, drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3), drawPath = drawAPI.drawPath; + inherits(InputOutput, Symbol), InputOutput.prototype.getLeft = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX() + this.textMargin; + return { + x: x, + y: y + }; + }, InputOutput.prototype.getRight = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX() + this.group.getBBox().width - this.textMargin; + return { + x: x, + y: y + }; + }, module.exports = InputOutput; + }, /* 13 */ + /*!*******************************************!*\ + !*** ./src/flowchart.symbol.operation.js ***! + \*******************************************/ + /***/ + function(module, exports, __webpack_require__) { + function Operation(chart, options) { + var symbol = chart.paper.rect(0, 0, 0, 0); + options = options || {}, Symbol.call(this, chart, options, symbol); } - /* end of link support */ - - /* adding support for flowstates */ - if (symbol.text) { - if (symbol.text.indexOf('|') >= 0) { - var txtAndState = symbol.text.split('|'); - symbol.text = txtAndState[0]; - symbol.flowstate = txtAndState[1].trim(); - } + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits; + inherits(Operation, Symbol), module.exports = Operation; + }, /* 14 */ + /*!****************************************!*\ + !*** ./src/flowchart.symbol.output.js ***! + \****************************************/ + /***/ + function(module, exports, __webpack_require__) { + function Output(chart, options) { + options = options || {}, Symbol.call(this, chart, options), this.textMargin = this.getAttr("text-margin"), + this.text.attr({ + x: 3 * this.textMargin + }); + var width = this.text.getBBox().width + 4 * this.textMargin, height = this.text.getBBox().height + 2 * this.textMargin, startX = this.textMargin, startY = height / 2, start = { + x: startX, + y: startY + }, points = [ { + x: startX - this.textMargin, + y: height + }, { + x: startX - this.textMargin + width + 2 * this.textMargin, + y: height + }, { + x: startX - this.textMargin + width, + y: 0 + }, { + x: startX - this.textMargin + 2 * this.textMargin, + y: 0 + }, { + x: startX, + y: startY + } ], symbol = drawPath(chart, start, points); + symbol.attr({ + stroke: this.getAttr("element-color"), + "stroke-width": this.getAttr("line-width"), + fill: this.getAttr("fill") + }), options.link && symbol.attr("href", options.link), options.target && symbol.attr("target", options.target), + options.key && (symbol.node.id = options.key), symbol.node.setAttribute("class", this.getAttr("class")), + this.text.attr({ + y: symbol.getBBox().height / 2 + }), this.group.push(symbol), symbol.insertBefore(this.text), this.symbol = symbol, + this.initialize(); } - /* end of flowstate support */ - - chart.symbols[symbol.key] = symbol; - - } else if (line.indexOf('->') >= 0) { - // flow - var flowSymbols = line.split('->'); - for (var i = 0, lenS = flowSymbols.length; i < lenS; i++) { - var flowSymb = flowSymbols[i]; - - var realSymb = getSymbol(flowSymb); - var next = getNextPath(flowSymb); - - var direction = null; - if (next.indexOf(',') >= 0) { - var condOpt = next.split(','); - next = condOpt[0]; - direction = condOpt[1].trim(); - } - - if (!chart.start) { - chart.start = realSymb; - } - - if (i + 1 < lenS) { - var nextSymb = flowSymbols[i + 1]; - realSymb[next] = getSymbol(nextSymb); - realSymb['direction_' + next] = direction; - direction = null; - } + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits, drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3), drawPath = drawAPI.drawPath; + inherits(Output, Symbol), Output.prototype.getLeft = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX() + this.textMargin; + return { + x: x, + y: y + }; + }, Output.prototype.getRight = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX() + this.group.getBBox().width - this.textMargin; + return { + x: x, + y: y + }; + }, module.exports = Output; + }, /* 15 */ + /*!***************************************!*\ + !*** ./src/flowchart.symbol.start.js ***! + \***************************************/ + /***/ + function(module, exports, __webpack_require__) { + function Start(chart, options) { + var symbol = chart.paper.rect(0, 0, 0, 0, 20); + options = options || {}, options.text = options.text || "Start", Symbol.call(this, chart, options, symbol); } - } - - } - return chart; - } - // public api interface - flowchart.parse = parse; - -})(); \ No newline at end of file + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits; + inherits(Start, Symbol), module.exports = Start; + }, /* 16 */ + /*!********************************************!*\ + !*** ./src/flowchart.symbol.subroutine.js ***! + \********************************************/ + /***/ + function(module, exports, __webpack_require__) { + function Subroutine(chart, options) { + var symbol = chart.paper.rect(0, 0, 0, 0); + options = options || {}, Symbol.call(this, chart, options, symbol), symbol.attr({ + width: this.text.getBBox().width + 4 * this.getAttr("text-margin") + }), this.text.attr({ + x: 2 * this.getAttr("text-margin") + }); + var innerWrap = chart.paper.rect(0, 0, 0, 0); + innerWrap.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") + }), options.key && (innerWrap.node.id = options.key + "i"); + var font = this.getAttr("font"), fontF = this.getAttr("font-family"), fontW = this.getAttr("font-weight"); + font && innerWrap.attr({ + font: font + }), fontF && innerWrap.attr({ + "font-family": fontF + }), fontW && innerWrap.attr({ + "font-weight": fontW + }), options.link && innerWrap.attr("href", options.link), options.target && innerWrap.attr("target", options.target), + this.group.push(innerWrap), innerWrap.insertBefore(this.text), this.initialize(); + } + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits; + inherits(Subroutine, Symbol), module.exports = Subroutine; + }, /* 17 */ + /*!******************************!*\ + !*** ./src/jquery-plugin.js ***! + \******************************/ + /***/ + function(module, exports, __webpack_require__) { + if ("undefined" != typeof jQuery) { + var parse = __webpack_require__(/*! ./flowchart.parse */ 4); + !function($) { + function paramFit(needle, haystack) { + return needle == haystack || Array.isArray(haystack) && (haystack.includes(needle) || haystack.includes(Number(needle))); + } + var methods = { + init: function(options) { + return this.each(function() { + var $this = $(this); + this.chart = parse($this.text()), $this.html(""), this.chart.drawSVG(this, options); + }); + }, + setFlowStateByParam: function(param, paramValue, newFlowState) { + return this.each(function() { + var chart = this.chart, nextSymbolKeys = [ "next", "yes", "no", "path1", "path2", "path3" ]; + for (var property in chart.symbols) if (chart.symbols.hasOwnProperty(property)) { + var symbol = chart.symbols[property], val = symbol.params[param]; + if (paramFit(val, paramValue)) { + symbol.flowstate = newFlowState; + for (var nski = 0; nski < nextSymbolKeys.length; nski++) { + var nextSymbolKey = nextSymbolKeys[nski]; + symbol[nextSymbolKey] && symbol[nextSymbolKey].params && symbol[nextSymbolKey].params[param] && paramFit(symbol[nextSymbolKey].params[param], paramValue) && (symbol.lineStyle[symbol[nextSymbolKey].key] = { + stroke: chart.options().flowstate[newFlowState].fill + }); + } + } + } + chart.clean(), chart.drawSVG(this); + }); + }, + clearFlowState: function() { + return this.each(function() { + var chart = this.chart; + for (var property in chart.symbols) if (chart.symbols.hasOwnProperty(property)) { + var node = chart.symbols[property]; + node.flowstate = ""; + } + chart.clean(), chart.drawSVG(this); + }); + } + }; + $.fn.flowChart = function(methodOrOptions) { + return methods[methodOrOptions] ? methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1)) : "object" != typeof methodOrOptions && methodOrOptions ? void $.error("Method " + methodOrOptions + " does not exist on jQuery.flowChart") : methods.init.apply(this, arguments); + }; + }(jQuery); + } + }, /* 18 */ + /*!**************************!*\ + !*** external "Raphael" ***! + \**************************/ + /***/ + function(module, exports) { + module.exports = __WEBPACK_EXTERNAL_MODULE_18__; + } ]); +}); +//# sourceMappingURL=flowchart.js.map \ No newline at end of file diff --git a/release/flowchart.js.map b/release/flowchart.js.map new file mode 100644 index 00000000..7f13ee1e --- /dev/null +++ b/release/flowchart.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///flowchart.js","webpack:///webpack/bootstrap 519494f9e366d139a59e","webpack:///./index.js","webpack:///./src/flowchart.helpers.js","webpack:///./src/flowchart.symbol.js","webpack:///./src/flowchart.functions.js","webpack:///./src/flowchart.parse.js","webpack:///./src/flowchart.symbol.condition.js","webpack:///./src/flowchart.symbol.parallel.js","webpack:///./src/flowchart.chart.js","webpack:///./src/flowchart.defaults.js","webpack:///./src/flowchart.shim.js","webpack:///./src/flowchart.symbol.end.js","webpack:///./src/flowchart.symbol.input.js","webpack:///./src/flowchart.symbol.inputoutput.js","webpack:///./src/flowchart.symbol.operation.js","webpack:///./src/flowchart.symbol.output.js","webpack:///./src/flowchart.symbol.start.js","webpack:///./src/flowchart.symbol.subroutine.js","webpack:///./src/jquery-plugin.js","webpack:///external \"Raphael\""],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE_18__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","parse","FlowChart","window","flowchart","_defaults","options","defaultOptions","merged","attrname","_inherits","ctor","superCtor","Object","super_","prototype","create","constructor","value","enumerable","writable","configurable","TempCtor","defaults","inherits","Symbol","chart","symbol","group","paper","set","connectedTo","symbolType","flowstate","lineStyle","key","leftLines","rightLines","topLines","bottomLines","params","next_direction","next","undefined","text","node","setAttribute","getAttr","attr","text-anchor","x","fill","font-size","font","fontF","fontW","font-family","font-weight","link","function","cursor","addEventListener","evt","target","maxWidth","words","split","tempText","ii","length","word","getBBox","width","substring","push","tmpMargin","stroke","stroke-width","height","roundness","isNaN","insertBefore","y","initialize","drawAPI","drawLine","checkLineIntersection","attName","opt1","opt3","opt2","symbols","transform","getCenter","getX","getY","shiftX","setX","shiftY","setY","getTop","getBottom","getLeft","getRight","render","self","lineLength","rightPoint","isPositioned","shift","symb","hasSymbolUnder","len","diff","Math","abs","leftPoint","bottomPoint","renderLines","drawLineTo","origin","indexOf","line","yOffset","right","bottom","top","left","symbolX","symbolY","symbolTop","symbolRight","symbolLeft","isOnSameColumn","isOnSameLine","isUnder","isUpper","isLeft","isRight","maxX","lineWith","max","rightStart","topEnd","bottomStart","diffX","leftStart","topStart","leftEnd","rightEnd","l","llen","lines","otherLine","ePath","lPath","iP","lenP","newPath","line1_from_x","line1_from_y","line1_to_x","line1_to_y","lP","lenlP","newLinePath","line2_from_x","line2_from_y","line2_to_x","line2_to_y","res","onLine1","onLine2","newSegment","splice","minXFromSymbols","maxXFromLine","drawPath","location","points","path","pathValues","from","to","toString","arrow-end","centerText","textPath","textAnchor","isHorizontal","firstTo","line1StartX","line1StartY","line1EndX","line1EndY","line2StartX","line2StartY","line2EndX","line2EndY","denominator","b","numerator1","numerator2","result","input","getStyle","s","startIndex","endIndex","getSymbValue","getSymbol","getNextPath","flowSymb","getAnnotation","tmp","tmp_split","trim","start","drawSVG","container","getDisplaySymbol","dispSymbols","Start","diagram","End","Operation","InputOutput","Input","Output","Subroutine","Condition","Parallel","Error","clean","constructChart","prevDisp","prev","dispSymb","startWith","pathOk","yes","no","path1","path2","path3","then","prevBreak","i0","i0len","line0","replace","substr","currentLine","parts","match","entries","entry","sub","join","txtAndState","pop","ann","flowSymbols","iS","lenS","symbVal","realSymb","direction","condOpt","yes_annotation","no_annotation","path1_annotation","path2_annotation","path3_annotation","nextSymb","lineStyleSymbols","iSS","lenSS","curSymb","nextSymbol","JSON","textMargin","yes_direction","direction_yes","no_direction","direction_no","startX","startY","yes_symbol","no_symbol","bottom_symbol","right_symbol","left_symbol","rect","path1_direction","path2_direction","path3_direction","direction_next","direction_path1","direction_path2","direction_path3","path1_symbol","path2_symbol","path3_symbol","top_symbol","topPoint","Raphael","handle","flowChart","maxHeight","maxY","minX","minY","leftX","x2","y2","scale","lineWidth","setSize","setViewBox","paperDom","canvas","parentNode","removeChild","line-width","line-length","text-margin","font-color","line-color","element-color","yes-text","no-text","class","end","condition","inputoutput","output","operation","subroutine","parallel","Array","searchElement","TypeError","t","n","arguments","Number","Infinity","floor","k","lastIndexOf","min","String","innerWrap","jQuery","$","paramFit","needle","haystack","isArray","includes","methods","init","each","$this","html","setFlowStateByParam","param","paramValue","newFlowState","nextSymbolKeys","property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,SAAAyV,YAAAzV,MAAAiE,SACA,IAAAjE,MAAAiE,QAAAyR,eAAAD,WAAA;gCACA,IAAAtU,OAAAnB,MAAAiE,QAAAwR;gCACAtU,KAAAZ,YAAA;;4BAIAP,MAAA+M,SACA/M,MAAAgM,QAAArO;;;;gBAKA8W,EAAAsB,GAAArE,YAAA,SAAAsE;oBACA,OAAAjB,QAAAiB,mBACAjB,QAAAiB,iBAAAC,MAAAtY,MAAA+V,MAAArU,UAAA6W,MAAA/X,KAAA4V,WAAA,MACA,mBAAAiC,0CAIAvB,EAAA0B,MAAA,YAAAH,kBAAA,yCAFAjB,QAAAC,KAAAiB,MAAAtY,MAAAoW;;cAMAS;;;;;;;InBo6EM,SAAUnX,QAAQD;QoBl/ExBC,OAAAD,UAAAQ","file":"flowchart.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Raphael\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Raphael\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"Raphael\")) : factory(root[\"Raphael\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_18__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Raphael\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Raphael\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"Raphael\")) : factory(root[\"Raphael\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_18__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/*!******************!*\\\n !*** ./index.js ***!\n \\******************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\t__webpack_require__(/*! ./src/flowchart.shim */ 9);\n\tvar parse = __webpack_require__(/*! ./src/flowchart.parse */ 4);\n\t__webpack_require__(/*! ./src/jquery-plugin */ 17);\n\t\n\tvar FlowChart = {\n\t\tparse: parse\n\t};\n\t\n\tif (typeof window !== 'undefined') {\n\t\twindow.flowchart = FlowChart;\n\t}\n\t\n\tmodule.exports = FlowChart;\n\n\n/***/ }),\n/* 1 */\n/*!**********************************!*\\\n !*** ./src/flowchart.helpers.js ***!\n \\**********************************/\n/***/ (function(module, exports) {\n\n\tfunction _defaults(options, defaultOptions) {\n\t if (!options || typeof options === 'function') {\n\t return defaultOptions;\n\t }\n\t\n\t var merged = {};\n\t for (var attrname in defaultOptions) {\n\t merged[attrname] = defaultOptions[attrname];\n\t }\n\t\n\t for (attrname in options) {\n\t if (options[attrname]) {\n\t if (typeof merged[attrname] === 'object') {\n\t merged[attrname] = _defaults(merged[attrname], options[attrname]);\n\t } else {\n\t merged[attrname] = options[attrname];\n\t }\n\t }\n\t }\n\t return merged;\n\t}\n\t\n\tfunction _inherits(ctor, superCtor) {\n\t if (typeof(Object.create) === 'function') {\n\t // implementation from standard node.js 'util' module\n\t ctor.super_ = superCtor;\n\t ctor.prototype = Object.create(superCtor.prototype, {\n\t constructor: {\n\t value: ctor,\n\t enumerable: false,\n\t writable: true,\n\t configurable: true\n\t }\n\t });\n\t } else {\n\t // old school shim for old browsers\n\t ctor.super_ = superCtor;\n\t var TempCtor = function () {};\n\t TempCtor.prototype = superCtor.prototype;\n\t ctor.prototype = new TempCtor();\n\t ctor.prototype.constructor = ctor;\n\t }\n\t}\n\t\n\t// move dependent functions to a container so that\n\t// they can be overriden easier in no jquery environment (node.js)\n\tmodule.exports = {\n\t defaults: _defaults,\n\t inherits: _inherits\n\t};\n\n\n/***/ }),\n/* 2 */\n/*!*********************************!*\\\n !*** ./src/flowchart.symbol.js ***!\n \\*********************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawLine = drawAPI.drawLine;\n\tvar checkLineIntersection = drawAPI.checkLineIntersection;\n\t\n\tfunction Symbol(chart, options, symbol) {\n\t this.chart = chart;\n\t this.group = this.chart.paper.set();\n\t this.symbol = symbol;\n\t this.connectedTo = [];\n\t this.symbolType = options.symbolType;\n\t this.flowstate = (options.flowstate || 'future');\n\t this.lineStyle = (options.lineStyle || {});\n\t this.key = (options.key || '');\n\t this.leftLines = [];\n\t this.rightLines = [];\n\t this.topLines = [];\n\t this.bottomLines = [];\n\t this.params = options.params;\n\t\n\t this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined;\n\t\n\t this.text = this.chart.paper.text(0, 0, options.text);\n\t //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t\n\t if (options.key) { this.text.node.id = options.key + 't'; }\n\t this.text.node.setAttribute('class', this.getAttr('class') + 't');\n\t\n\t this.text.attr({\n\t 'text-anchor': 'start',\n\t 'x' : this.getAttr('text-margin'),\n\t 'fill' : this.getAttr('font-color'),\n\t 'font-size' : this.getAttr('font-size')\n\t });\n\t\n\t var font = this.getAttr('font');\n\t var fontF = this.getAttr('font-family');\n\t var fontW = this.getAttr('font-weight');\n\t\n\t if (font) this.text.attr({ 'font': font });\n\t if (fontF) this.text.attr({ 'font-family': fontF });\n\t if (fontW) this.text.attr({ 'font-weight': fontW });\n\t\n\t if (options.link) { this.text.attr('href', options.link); }\n\t \n\t //ndrqu Add click function with event and options params\n\t if (options.function) { \n\t this.text.attr({ 'cursor' : 'pointer' });\n\t\n\t this.text.node.addEventListener(\"click\", function(evt) {\n\t window[options.function](evt,options);\n\t }, false);\n\t }\n\t\n\t if (options.target) { this.text.attr('target', options.target); }\n\t\n\t var maxWidth = this.getAttr('maxWidth');\n\t if (maxWidth) {\n\t // using this approach: http://stackoverflow.com/a/3153457/22466\n\t var words = options.text.split(' ');\n\t var tempText = \"\";\n\t for (var i=0, ii=words.length; i maxWidth) {\n\t tempText += \"\\n\" + word;\n\t } else {\n\t tempText += \" \" + word;\n\t }\n\t }\n\t this.text.attr(\"text\", tempText.substring(1));\n\t }\n\t\n\t this.group.push(this.text);\n\t\n\t if (symbol) {\n\t var tmpMargin = this.getAttr('text-margin');\n\t\n\t symbol.attr({\n\t 'fill' : this.getAttr('fill'),\n\t 'stroke' : this.getAttr('element-color'),\n\t 'stroke-width' : this.getAttr('line-width'),\n\t 'width' : this.text.getBBox().width + 2 * tmpMargin,\n\t 'height' : this.text.getBBox().height + 2 * tmpMargin\n\t });\n\t\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t var roundness = this.getAttr('roundness');\n\t if (!isNaN(roundness)) {\n\t symbol.node.setAttribute('ry', roundness);\n\t symbol.node.setAttribute('rx', roundness);\n\t }\n\t\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t\n\t //ndrqu Add click function with event and options params\n\t if (options.function) { \n\t symbol.node.addEventListener(\"click\", function(evt) {\n\t window[options.function](evt,options);\n\t }, false);\n\t symbol.attr({ 'cursor' : 'pointer' });\n\t }\n\t if (options.key) { symbol.node.id = options.key; }\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t\n\t this.text.attr({\n\t 'y': symbol.getBBox().height/2\n\t });\n\t\n\t this.initialize();\n\t }\n\t\n\t}\n\t\n\t/* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */\n\tSymbol.prototype.getAttr = function(attName) {\n\t if (!this.chart) {\n\t return undefined;\n\t }\n\t var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined;\n\t var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined;\n\t var opt1;\n\t if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) {\n\t opt1 = this.chart.options.flowstate[this.flowstate][attName];\n\t }\n\t return (opt1 || opt2 || opt3);\n\t};\n\t\n\tSymbol.prototype.initialize = function() {\n\t this.group.transform('t' + this.getAttr('line-width') + ',' + this.getAttr('line-width'));\n\t\n\t this.width = this.group.getBBox().width;\n\t this.height = this.group.getBBox().height;\n\t};\n\t\n\tSymbol.prototype.getCenter = function() {\n\t return {x: this.getX() + this.width/2,\n\t y: this.getY() + this.height/2};\n\t};\n\t\n\tSymbol.prototype.getX = function() {\n\t return this.group.getBBox().x;\n\t};\n\t\n\tSymbol.prototype.getY = function() {\n\t return this.group.getBBox().y;\n\t};\n\t\n\tSymbol.prototype.shiftX = function(x) {\n\t this.group.transform('t' + (this.getX() + x) + ',' + this.getY());\n\t};\n\t\n\tSymbol.prototype.setX = function(x) {\n\t this.group.transform('t' + x + ',' + this.getY());\n\t};\n\t\n\tSymbol.prototype.shiftY = function(y) {\n\t this.group.transform('t' + this.getX() + ',' + (this.getY() + y));\n\t};\n\t\n\tSymbol.prototype.setY = function(y) {\n\t this.group.transform('t' + this.getX() + ',' + y);\n\t};\n\t\n\tSymbol.prototype.getTop = function() {\n\t var y = this.getY();\n\t var x = this.getX() + this.width/2;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getBottom = function() {\n\t var y = this.getY() + this.height;\n\t var x = this.getX() + this.width/2;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX();\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.render = function() {\n\t if (this.next) {\n\t\n\t var self = this;\n\t var lineLength = this.getAttr('line-length');\n\t\n\t if (this.next_direction === 'right') {\n\t\n\t var rightPoint = this.getRight();\n\t\n\t if (!this.next.isPositioned) {\n\t this.next.setY(rightPoint.y - this.next.height/2);\n\t this.next.shiftX(this.group.getBBox().x + this.width + lineLength);\n\t\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n\t if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t if (self.next.symbolType === 'end') return;\n\t self.next.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.next.isPositioned = true;\n\t\n\t this.next.render();\n\t }\n\t } else if (this.next_direction === 'left') {\n\t\n\t var leftPoint = this.getLeft();\n\t\n\t if (!this.next.isPositioned) {\n\t this.next.setY(leftPoint.y - this.next.height/2);\n\t this.next.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n\t\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n\t if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t if (self.next.symbolType === 'end') return;\n\t self.next.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.next.isPositioned = true;\n\t\n\t this.next.render();\n\t }\n\t } else {\n\t var bottomPoint = this.getBottom();\n\t\n\t if (!this.next.isPositioned) {\n\t this.next.shiftY(this.getY() + this.height + lineLength);\n\t this.next.setX(bottomPoint.x - this.next.width/2);\n\t this.next.isPositioned = true;\n\t\n\t this.next.render();\n\t }\n\t }\n\t }\n\t};\n\t\n\tSymbol.prototype.renderLines = function() {\n\t if (this.next) {\n\t if (this.next_direction) {\n\t this.drawLineTo(this.next, this.getAttr('arrow-text') || '', this.next_direction);\n\t } else {\n\t this.drawLineTo(this.next, this.getAttr('arrow-text') || '');\n\t }\n\t }\n\t};\n\t\n\tSymbol.prototype.drawLineTo = function(symbol, text, origin) {\n\t if (this.connectedTo.indexOf(symbol) < 0) {\n\t this.connectedTo.push(symbol);\n\t }\n\t\n\t var x = this.getCenter().x,\n\t y = this.getCenter().y,\n\t right = this.getRight(),\n\t bottom = this.getBottom(),\n\t top = this.getTop(),\n\t left = this.getLeft();\n\t\n\t var symbolX = symbol.getCenter().x,\n\t symbolY = symbol.getCenter().y,\n\t symbolTop = symbol.getTop(),\n\t symbolRight = symbol.getRight(),\n\t symbolLeft = symbol.getLeft();\n\t\n\t var isOnSameColumn = x === symbolX,\n\t isOnSameLine = y === symbolY,\n\t isUnder = y < symbolY,\n\t isUpper = y > symbolY || this === symbol,\n\t isLeft = x > symbolX,\n\t isRight = x < symbolX;\n\t\n\t var maxX = 0,\n\t line,\n\t yOffset,\n\t lineLength = this.getAttr('line-length'),\n\t lineWith = this.getAttr('line-width');\n\t\n\t if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) {\n\t if (symbol.topLines.length === 0 && this.bottomLines.length === 0) {\n\t line = drawLine(this.chart, bottom, symbolTop, text);\n\t } else {\n\t yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n\t line = drawLine(this.chart, bottom, [\n\t {x: symbolTop.x, y: symbolTop.y - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t }\n\t this.bottomLines.push(line);\n\t symbol.topLines.push(line);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x;\n\t } else if ((!origin || origin === 'right') && isOnSameLine && isRight) {\n\t if (symbol.leftLines.length === 0 && this.rightLines.length === 0) {\n\t line = drawLine(this.chart, right, symbolLeft, text);\n\t } else {\n\t yOffset = Math.max(symbol.leftLines.length, this.rightLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: right.x, y: right.y - yOffset},\n\t {x: right.x, y: symbolLeft.y - yOffset},\n\t {x: symbolLeft.x, y: symbolLeft.y - yOffset},\n\t {x: symbolLeft.x, y: symbolLeft.y}\n\t ], text);\n\t }\n\t this.rightLines.push(line);\n\t symbol.leftLines.push(line);\n\t this.rightStart = true;\n\t symbol.leftEnd = true;\n\t maxX = symbolLeft.x;\n\t } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) {\n\t if (symbol.rightLines.length === 0 && this.leftLines.length === 0) {\n\t line = drawLine(this.chart, left, symbolRight, text);\n\t } else {\n\t yOffset = Math.max(symbol.rightLines.length, this.leftLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: right.x, y: right.y - yOffset},\n\t {x: right.x, y: symbolRight.y - yOffset},\n\t {x: symbolRight.x, y: symbolRight.y - yOffset},\n\t {x: symbolRight.x, y: symbolRight.y}\n\t ], text);\n\t }\n\t this.leftLines.push(line);\n\t symbol.rightLines.push(line);\n\t this.leftStart = true;\n\t symbol.rightEnd = true;\n\t maxX = symbolRight.x;\n\t } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) {\n\t yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y - yOffset},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightLines.push(line);\n\t symbol.topLines.push(line);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) {\n\t yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y - yOffset},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightLines.push(line);\n\t symbol.topLines.push(line);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((!origin || origin === 'bottom') && isLeft) {\n\t yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n\t if (this.leftEnd && isUpper) {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2 - yOffset},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t } else {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t }\n\t this.bottomLines.push(line);\n\t symbol.topLines.push(line);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n\t } else if ((!origin || origin === 'bottom') && isRight && isUnder) {\n\t yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.bottomLines.push(line);\n\t symbol.topLines.push(line);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x;\n\t if (symbolTop.x > maxX) maxX = symbolTop.x;\n\t } else if ((!origin || origin === 'bottom') && isRight) {\n\t yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2 - yOffset},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.bottomLines.push(line);\n\t symbol.topLines.push(line);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n\t } else if ((origin && origin === 'right') && isLeft) {\n\t yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightLines.push(line);\n\t symbol.topLines.push(line);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((origin && origin === 'right') && isRight) {\n\t yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: symbolTop.x, y: right.y - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - yOffset}\n\t ], text);\n\t this.rightLines.push(line);\n\t symbol.topLines.push(line);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) {\n\t yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n\t {x: right.x + lineLength/2, y: bottom.y + lineLength/2 - yOffset},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.bottomLines.push(line);\n\t symbol.topLines.push(line);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + lineLength/2;\n\t } else if ((origin === 'left') && isOnSameColumn && isUpper) {\n\t var diffX = left.x - lineLength/2;\n\t if (symbolLeft.x < left.x) {\n\t diffX = symbolLeft.x - lineLength/2;\n\t }\n\t yOffset = Math.max(symbol.topLines.length, this.leftLines.length) * 10;\n\t line = drawLine(this.chart, left, [\n\t {x: diffX, y: left.y - yOffset},\n\t {x: diffX, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.leftLines.push(line);\n\t symbol.topLines.push(line);\n\t this.leftStart = true;\n\t symbol.topEnd = true;\n\t maxX = left.x;\n\t } else if ((origin === 'left')) {\n\t yOffset = Math.max(symbol.topLines.length, this.leftLines.length) * 10;\n\t line = drawLine(this.chart, left, [\n\t {x: symbolTop.x + (left.x - symbolTop.x)/2, y: left.y},\n\t {x: symbolTop.x + (left.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.leftLines.push(line);\n\t symbol.topLines.push(line);\n\t this.leftStart = true;\n\t symbol.topEnd = true;\n\t maxX = left.x;\n\t } else if ((origin === 'top')) {\n\t yOffset = Math.max(symbol.topLines.length, this.topLines.length) * 10;\n\t line = drawLine(this.chart, top, [\n\t {x: top.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.topLines.push(line);\n\t symbol.topLines.push(line);\n\t this.topStart = true;\n\t symbol.topEnd = true;\n\t maxX = top.x;\n\t }\n\t\n\t //update line style\n\t if (this.lineStyle[symbol.key] && line){\n\t line.attr(this.lineStyle[symbol.key]);\n\t }\n\t\n\t if (line) {\n\t for (var l = 0, llen = this.chart.lines.length; l < llen; l++) {\n\t var otherLine = this.chart.lines[l];\n\t\n\t var ePath = otherLine.attr('path'),\n\t lPath = line.attr('path');\n\t\n\t for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) {\n\t var newPath = [];\n\t newPath.push(['M', ePath[iP][1], ePath[iP][2]]);\n\t newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]);\n\t\n\t var line1_from_x = newPath[0][1];\n\t var line1_from_y = newPath[0][2];\n\t var line1_to_x = newPath[1][1];\n\t var line1_to_y = newPath[1][2];\n\t\n\t for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) {\n\t var newLinePath = [];\n\t newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]);\n\t newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]);\n\t\n\t var line2_from_x = newLinePath[0][1];\n\t var line2_from_y = newLinePath[0][2];\n\t var line2_to_x = newLinePath[1][1];\n\t var line2_to_y = newLinePath[1][2];\n\t\n\t var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y);\n\t if (res.onLine1 && res.onLine2) {\n\t\n\t var newSegment;\n\t if (line2_from_y === line2_to_y) {\n\t if (line2_from_x > line2_to_x) {\n\t newSegment = ['L', res.x + lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t } else {\n\t newSegment = ['L', res.x - lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t }\n\t } else {\n\t if (line2_from_y > line2_to_y) {\n\t newSegment = ['L', line2_from_x, res.y + lineWith * 2];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t } else {\n\t newSegment = ['L', line2_from_x, res.y - lineWith * 2];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t }\n\t }\n\t\n\t lP += 2;\n\t }\n\t }\n\t }\n\t }\n\t\n\t this.chart.lines.push(line);\n\t if (this.chart.minXFromSymbols === undefined || this.chart.minXFromSymbols > left.x) {\n\t this.chart.minXFromSymbols = left.x;\n\t }\n\t }\n\t\n\t if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) {\n\t this.chart.maxXFromLine = maxX;\n\t }\n\t};\n\t\n\tmodule.exports = Symbol;\n\n\n/***/ }),\n/* 3 */\n/*!************************************!*\\\n !*** ./src/flowchart.functions.js ***!\n \\************************************/\n/***/ (function(module, exports) {\n\n\tfunction drawPath(chart, location, points) {\n\t var i, len;\n\t var path = 'M{0},{1}';\n\t for (i = 2, len = 2 * points.length + 2; i < len; i+=2) {\n\t path += ' L{' + i + '},{' + (i + 1) + '}';\n\t }\n\t var pathValues = [location.x, location.y];\n\t for (i = 0, len = points.length; i < len; i++) {\n\t pathValues.push(points[i].x);\n\t pathValues.push(points[i].y);\n\t }\n\t var symbol = chart.paper.path(path, pathValues);\n\t symbol.attr('stroke', chart.options['element-color']);\n\t symbol.attr('stroke-width', chart.options['line-width']);\n\t\n\t var font = chart.options.font;\n\t var fontF = chart.options['font-family'];\n\t var fontW = chart.options['font-weight'];\n\t\n\t if (font) symbol.attr({ 'font': font });\n\t if (fontF) symbol.attr({ 'font-family': fontF });\n\t if (fontW) symbol.attr({ 'font-weight': fontW });\n\t\n\t return symbol;\n\t}\n\t\n\tfunction drawLine(chart, from, to, text) {\n\t var i, len;\n\t\n\t if (Object.prototype.toString.call(to) !== '[object Array]') {\n\t to = [to];\n\t }\n\t\n\t var path = 'M{0},{1}';\n\t for (i = 2, len = 2 * to.length + 2; i < len; i+=2) {\n\t path += ' L{' + i + '},{' + (i + 1) + '}';\n\t }\n\t var pathValues = [from.x, from.y];\n\t for (i = 0, len = to.length; i < len; i++) {\n\t pathValues.push(to[i].x);\n\t pathValues.push(to[i].y);\n\t }\n\t\n\t var line = chart.paper.path(path, pathValues);\n\t line.attr({\n\t stroke: chart.options['line-color'],\n\t 'stroke-width': chart.options['line-width'],\n\t 'arrow-end': chart.options['arrow-end']\n\t });\n\t\n\t var font = chart.options.font;\n\t var fontF = chart.options['font-family'];\n\t var fontW = chart.options['font-weight'];\n\t\n\t if (font) line.attr({ 'font': font });\n\t if (fontF) line.attr({ 'font-family': fontF });\n\t if (fontW) line.attr({ 'font-weight': fontW });\n\t\n\t if (text) {\n\t\n\t var centerText = false;\n\t\n\t var textPath = chart.paper.text(0, 0, text);\n\t var textAnchor = 'start';\n\t\n\t var isHorizontal = false;\n\t var firstTo = to[0];\n\t\n\t if (from.y === firstTo.y) {\n\t isHorizontal = true;\n\t }\n\t\n\t var x = 0,\n\t y = 0;\n\t\n\t if (centerText) {\n\t if (from.x > firstTo.x) {\n\t x = from.x - (from.x - firstTo.x)/2;\n\t } else {\n\t x = firstTo.x - (firstTo.x - from.x)/2;\n\t }\n\t\n\t if (from.y > firstTo.y) {\n\t y = from.y - (from.y - firstTo.y)/2;\n\t } else {\n\t y = firstTo.y - (firstTo.y - from.y)/2;\n\t }\n\t\n\t if (isHorizontal) {\n\t x -= textPath.getBBox().width/2;\n\t y -= chart.options['text-margin'];\n\t } else {\n\t x += chart.options['text-margin'];\n\t y -= textPath.getBBox().height/2;\n\t }\n\t } else {\n\t x = from.x;\n\t y = from.y;\n\t\n\t if (isHorizontal) {\n\t if (from.x > firstTo.x) {\n\t x -= chart.options['text-margin']/2;\n\t textAnchor = 'end';\n\t } else {\n\t x += chart.options['text-margin']/2;\n\t }\n\t y -= chart.options['text-margin'];\n\t } else {\n\t x += chart.options['text-margin']/2;\n\t y += chart.options['text-margin'];\n\t if (from.y > firstTo.y) {\n\t y -= chart.options['text-margin']*2;\n\t }\n\t }\n\t }\n\t\n\t textPath.attr({\n\t 'text-anchor': textAnchor,\n\t 'font-size': chart.options['font-size'],\n\t 'fill': chart.options['font-color'],\n\t x: x,\n\t y: y\n\t });\n\t\n\t if (font) textPath.attr({ 'font': font });\n\t if (fontF) textPath.attr({ 'font-family': fontF });\n\t if (fontW) textPath.attr({ 'font-weight': fontW });\n\t }\n\t\n\t return line;\n\t}\n\t\n\tfunction checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) {\n\t // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point\n\t var denominator, a, b, numerator1, numerator2, result = {\n\t x: null,\n\t y: null,\n\t onLine1: false,\n\t onLine2: false\n\t };\n\t denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY));\n\t if (denominator === 0) {\n\t return result;\n\t }\n\t a = line1StartY - line2StartY;\n\t b = line1StartX - line2StartX;\n\t numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b);\n\t numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b);\n\t a = numerator1 / denominator;\n\t b = numerator2 / denominator;\n\t\n\t // if we cast these lines infinitely in both directions, they intersect here:\n\t result.x = line1StartX + (a * (line1EndX - line1StartX));\n\t result.y = line1StartY + (a * (line1EndY - line1StartY));\n\t /*\n\t // it is worth noting that this should be the same as:\n\t x = line2StartX + (b * (line2EndX - line2StartX));\n\t y = line2StartX + (b * (line2EndY - line2StartY));\n\t */\n\t // if line1 is a segment and line2 is infinite, they intersect if:\n\t if (a > 0 && a < 1) {\n\t result.onLine1 = true;\n\t }\n\t // if line2 is a segment and line1 is infinite, they intersect if:\n\t if (b > 0 && b < 1) {\n\t result.onLine2 = true;\n\t }\n\t // if line1 and line2 are segments, they intersect if both of the above are true\n\t return result;\n\t}\n\t\n\tmodule.exports = {\n\t\tdrawPath: drawPath,\n\t\tdrawLine: drawLine,\n\t\tcheckLineIntersection: checkLineIntersection\n\t};\n\n\n/***/ }),\n/* 4 */\n/*!********************************!*\\\n !*** ./src/flowchart.parse.js ***!\n \\********************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar FlowChart = __webpack_require__(/*! ./flowchart.chart */ 7);\n\tvar Start = __webpack_require__(/*! ./flowchart.symbol.start */ 15);\n\tvar End = __webpack_require__(/*! ./flowchart.symbol.end */ 10);\n\tvar Operation = __webpack_require__(/*! ./flowchart.symbol.operation */ 13);\n\tvar InputOutput = __webpack_require__(/*! ./flowchart.symbol.inputoutput */ 12);\n\tvar Input = __webpack_require__(/*! ./flowchart.symbol.input */ 11); //tds\n\tvar Output = __webpack_require__(/*! ./flowchart.symbol.output */ 14); //tds\n\tvar Subroutine = __webpack_require__(/*! ./flowchart.symbol.subroutine */ 16);\n\tvar Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5);\n\tvar Parallel = __webpack_require__(/*! ./flowchart.symbol.parallel */ 6);\n\t\n\t\n\tfunction parse(input) {\n\t input = input || '';\n\t input = input.trim();\n\t\n\t var chart = {\n\t symbols: {},\n\t start: null,\n\t drawSVG: function(container, options) {\n\t var self = this;\n\t\n\t if (this.diagram) {\n\t this.diagram.clean();\n\t }\n\t\n\t var diagram = new FlowChart(container, options);\n\t this.diagram = diagram;\n\t var dispSymbols = {};\n\t\n\t function getDisplaySymbol(s) {\n\t if (dispSymbols[s.key]) {\n\t return dispSymbols[s.key];\n\t }\n\t\n\t switch (s.symbolType) {\n\t case 'start':\n\t dispSymbols[s.key] = new Start(diagram, s);\n\t break;\n\t case 'end':\n\t dispSymbols[s.key] = new End(diagram, s);\n\t break;\n\t case 'operation':\n\t dispSymbols[s.key] = new Operation(diagram, s);\n\t break;\n\t case 'inputoutput':\n\t dispSymbols[s.key] = new InputOutput(diagram, s);\n\t break;\n\t case 'input':\n\t dispSymbols[s.key] = new Input(diagram, s); //tds\n\t break; \n\t case 'output':\n\t dispSymbols[s.key] = new Output(diagram, s); //tds\n\t break; \n\t case 'subroutine':\n\t dispSymbols[s.key] = new Subroutine(diagram, s);\n\t break;\n\t case 'condition':\n\t dispSymbols[s.key] = new Condition(diagram, s);\n\t break;\n\t case 'parallel':\n\t dispSymbols[s.key] = new Parallel(diagram, s);\n\t break;\n\t default:\n\t return new Error('Wrong symbol type!');\n\t }\n\t\n\t return dispSymbols[s.key];\n\t }\n\t\n\t (function constructChart(s, prevDisp, prev) {\n\t var dispSymb = getDisplaySymbol(s);\n\t\n\t if (self.start === s) {\n\t diagram.startWith(dispSymb);\n\t } else if (prevDisp && prev && !prevDisp.pathOk) {\n\t if (prevDisp instanceof(Condition)) {\n\t if (prev.yes === s) {\n\t prevDisp.yes(dispSymb);\n\t }\n\t if (prev.no === s) {\n\t prevDisp.no(dispSymb);\n\t }\n\t } else if (prevDisp instanceof(Parallel)) {\n\t if (prev.path1 === s) {\n\t prevDisp.path1(dispSymb);\n\t }\n\t if (prev.path2 === s) {\n\t prevDisp.path2(dispSymb);\n\t }\n\t if (prev.path3 === s) {\n\t prevDisp.path3(dispSymb);\n\t }\n\t } else {\n\t prevDisp.then(dispSymb);\n\t }\n\t }\n\t\n\t if (dispSymb.pathOk) {\n\t return dispSymb;\n\t }\n\t\n\t if (dispSymb instanceof(Condition)) {\n\t if (s.yes) {\n\t constructChart(s.yes, dispSymb, s);\n\t }\n\t if (s.no) {\n\t constructChart(s.no, dispSymb, s);\n\t }\n\t } else if (dispSymb instanceof(Parallel)) {\n\t if (s.path1) {\n\t constructChart(s.path1, dispSymb, s);\n\t }\n\t if (s.path2) {\n\t constructChart(s.path2, dispSymb, s);\n\t }\n\t if (s.path3) {\n\t constructChart(s.path3, dispSymb, s);\n\t }\n\t } else if (s.next) {\n\t constructChart(s.next, dispSymb, s);\n\t }\n\t\n\t return dispSymb;\n\t })(this.start);\n\t\n\t diagram.render();\n\t },\n\t clean: function() {\n\t this.diagram.clean();\n\t },\n\t options: function() {\n\t return this.diagram.options;\n\t }\n\t };\n\t\n\t var lines = [];\n\t var prevBreak = 0;\n\t for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) {\n\t if(input[i0] === '\\n' && input[i0 - 1] !== '\\\\') {\n\t var line0 = input.substring(prevBreak, i0);\n\t prevBreak = i0 + 1;\n\t lines.push(line0.replace(/\\\\\\n/g, '\\n'));\n\t }\n\t }\n\t\n\t if (prevBreak < input.length) {\n\t lines.push(input.substr(prevBreak));\n\t }\n\t\n\t for (var l = 1, len = lines.length; l < len;) {\n\t var currentLine = lines[l];\n\t\n\t if (currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0 && currentLine.indexOf('@>') < 0) {\n\t lines[l - 1] += '\\n' + currentLine;\n\t lines.splice(l, 1);\n\t len--;\n\t } else {\n\t l++;\n\t }\n\t }\n\t\n\t function getStyle(s){\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t return s.substring(startIndex,endIndex);\n\t }\n\t return '{}';\n\t }\n\t\n\t function getSymbValue(s){\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t return s.substring(startIndex,endIndex);\n\t }\n\t return '';\n\t }\n\t\n\t function getSymbol(s) {\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t return chart.symbols[s.substring(0, startIndex - 1)];\n\t }\n\t return chart.symbols[s];\n\t }\n\t\n\t function getNextPath(s) {\n\t var next = 'next';\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t next = flowSymb.substring(startIndex, endIndex);\n\t if (next.indexOf(',') < 0) {\n\t if (next !== 'yes' && next !== 'no') {\n\t next = 'next, ' + next;\n\t }\n\t }\n\t }\n\t return next;\n\t }\n\t \n\t function getAnnotation(s) {\n\t\tvar startIndex = s.indexOf(\"(\") + 1, endIndex = s.indexOf(\")\");\n\t\tvar tmp = s.substring(startIndex, endIndex);\n\t\tif(tmp.indexOf(\",\") > 0) { tmp = tmp.substring(0, tmp.indexOf(\",\")); }\n\t\tvar tmp_split = tmp.split(\"@\");\n\t\tif(tmp_split.length > 1)\n\t\t\treturn startIndex >= 0 && endIndex >= 0 ? tmp_split[1] : \"\";\n\t }\n\t\n\t while (lines.length > 0) {\n\t var line = lines.splice(0, 1)[0].trim();\n\t\n\t if (line.indexOf('=>') >= 0) {\n\t // definition\n\t var parts = line.split('=>');\n\t var symbol = {\n\t key: parts[0].replace(/\\(.*\\)/, ''),\n\t symbolType: parts[1],\n\t text: null,\n\t link: null,\n\t target: null,\n\t flowstate: null,\n\t function: null,\n\t lineStyle: {},\n\t params: {}\n\t };\n\t\n\t //parse parameters\n\t var params = parts[0].match(/\\((.*)\\)/);\n\t if (params && params.length > 1){\n\t var entries = params[1].split(',');\n\t for(var i = 0; i < entries.length; i++) {\n\t var entry = entries[i].split('=');\n\t if (entry.length == 2) {\n\t symbol.params[entry[0]] = entry[1];\n\t }\n\t }\n\t }\n\t\n\t var sub;\n\t\n\t if (symbol.symbolType.indexOf(': ') >= 0) {\n\t sub = symbol.symbolType.split(': ');\n\t symbol.symbolType = sub.shift();\n\t symbol.text = sub.join(': ');\n\t }\n\t\n\t if (symbol.text && symbol.text.indexOf(':$') >= 0) {\n\t sub = symbol.text.split(':$');\n\t symbol.text = sub.shift();\n\t symbol.function = sub.join(':$');\n\t } else if (symbol.symbolType.indexOf(':$') >= 0) {\n\t sub = symbol.symbolType.split(':$');\n\t symbol.symbolType = sub.shift();\n\t symbol.function = sub.join(':$');\n\t } else if (symbol.text && symbol.text.indexOf(':>') >= 0) {\n\t sub = symbol.text.split(':>');\n\t symbol.text = sub.shift();\n\t symbol.link = sub.join(':>');\n\t } else if (symbol.symbolType.indexOf(':>') >= 0) {\n\t sub = symbol.symbolType.split(':>');\n\t symbol.symbolType = sub.shift();\n\t symbol.link = sub.join(':>');\n\t }\n\t\n\t if (symbol.symbolType.indexOf('\\n') >= 0) {\n\t symbol.symbolType = symbol.symbolType.split('\\n')[0];\n\t }\n\t\n\t /* adding support for links */\n\t if (symbol.link) {\n\t var startIndex = symbol.link.indexOf('[') + 1;\n\t var endIndex = symbol.link.indexOf(']');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t symbol.target = symbol.link.substring(startIndex, endIndex);\n\t symbol.link = symbol.link.substring(0, startIndex - 1);\n\t }\n\t }\n\t /* end of link support */\n\t\n\t /* adding support for flowstates */\n\t if (symbol.text) {\n\t if (symbol.text.indexOf('|') >= 0) {\n\t var txtAndState = symbol.text.split('|');\n\t symbol.flowstate = txtAndState.pop().trim();\n\t symbol.text = txtAndState.join('|');\n\t }\n\t }\n\t /* end of flowstate support */\n\t\n\t chart.symbols[symbol.key] = symbol;\n\t\n\t } else if (line.indexOf('->') >= 0) {\n\t var ann = getAnnotation(line);\n\t if (ann) {\n\t line = line.replace('@' + ann, ''); \n\t }\n\t // flow\n\t var flowSymbols = line.split('->');\n\t for (var iS = 0, lenS = flowSymbols.length; iS < lenS; iS++) {\n\t var flowSymb = flowSymbols[iS];\n\t var symbVal = getSymbValue(flowSymb);\n\t\n\t if (symbVal === 'true' || symbVal === 'false') {\n\t // map true or false to yes or no respectively\n\t flowSymb = flowSymb.replace('true', 'yes');\n\t flowSymb = flowSymb.replace('false', 'no');\n\t }\n\t \n\t var next = getNextPath(flowSymb);\n\t var realSymb = getSymbol(flowSymb);\n\t\n\t var direction = null;\n\t if (next.indexOf(',') >= 0) {\n\t var condOpt = next.split(',');\n\t next = condOpt[0];\n\t direction = condOpt[1].trim();\n\t }\n\t\n\t if (ann) {\n\t if (realSymb.symbolType === 'condition') {\n\t if (next === \"yes\" || next === \"true\") {\n\t realSymb.yes_annotation = ann;\n\t } else {\n\t realSymb.no_annotation = ann;\n\t }\n\t } else if (realSymb.symbolType === 'parallel') {\n\t if (next === 'path1') {\n\t realSymb.path1_annotation = ann;\n\t } else if (next === 'path2') {\n\t realSymb.path2_annotation = ann;\n\t } else if (next === 'path3') {\n\t realSymb.path3_annotation = ann;\n\t }\n\t }\n\t ann = null;\n\t }\n\t\n\t if (!chart.start) {\n\t chart.start = realSymb;\n\t }\n\t\n\t if (iS + 1 < lenS) {\n\t var nextSymb = flowSymbols[iS + 1];\n\t realSymb[next] = getSymbol(nextSymb);\n\t realSymb['direction_' + next] = direction;\n\t direction = null;\n\t }\n\t }\n\t } else if (line.indexOf('@>') >= 0) {\n\t\n\t // line style\n\t var lineStyleSymbols = line.split('@>');\n\t for (var iSS = 0, lenSS = lineStyleSymbols.length; iSS < lenSS; iSS++) {\n\t if ((iSS + 1) !== lenSS) {\n\t var curSymb = getSymbol(lineStyleSymbols[iSS]);\n\t var nextSymbol = getSymbol(lineStyleSymbols[iSS+1]);\n\t\n\t curSymb['lineStyle'][nextSymbol.key] = JSON.parse(getStyle(lineStyleSymbols[iSS + 1]));\n\t }\n\t }\n\t }\n\t\n\t }\n\t return chart;\n\t}\n\t\n\tmodule.exports = parse;\n\n\n/***/ }),\n/* 5 */\n/*!*******************************************!*\\\n !*** ./src/flowchart.symbol.condition.js ***!\n \\*******************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction Condition(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.yes_annotation = options.yes_annotation;\n\t this.no_annotation = options.no_annotation;\n\t this.textMargin = this.getAttr('text-margin');\n\t this.yes_direction = options.direction_yes;\n\t this.no_direction = options.direction_no;\n\t if (!this.no_direction && this.yes_direction === 'right') {\n\t this.no_direction = 'bottom';\n\t } else if (!this.yes_direction && this.no_direction === 'bottom') {\n\t this.yes_direction = 'right'\n\t }\n\t this.yes_direction = this.yes_direction || 'bottom';\n\t this.no_direction = this.no_direction || 'right';\n\t\n\t this.text.attr({\n\t x: this.textMargin * 2\n\t });\n\t\n\t var width = this.text.getBBox().width + 3 * this.textMargin;\n\t width += width/2;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t height += height/2;\n\t height = Math.max(width * 0.5, height);\n\t var startX = width/4;\n\t var startY = height/4;\n\t\n\t this.text.attr({\n\t x: startX + this.textMargin/2\n\t });\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - width/4, y: startY + height/4},\n\t {x: startX - width/4 + width/2, y: startY + height/4 + height/2},\n\t {x: startX - width/4 + width, y: startY + height/4},\n\t {x: startX - width/4 + width/2, y: startY + height/4 - height/2},\n\t {x: startX - width/4, y: startY + height/4}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t this.symbol = symbol\n\t\n\t this.initialize();\n\t}\n\tinherits(Condition, Symbol);\n\t\n\tCondition.prototype.render = function() {\n\t var self = this;\n\t if (this.yes_direction) {\n\t this[this.yes_direction + '_symbol'] = this.yes_symbol;\n\t }\n\t\n\t if (this.no_direction) {\n\t this[this.no_direction + '_symbol'] = this.no_symbol;\n\t }\n\t\n\t var lineLength = this.getAttr('line-length');\n\t\n\t if (this.bottom_symbol) {\n\t var bottomPoint = this.getBottom();\n\t\n\t if (!this.bottom_symbol.isPositioned) {\n\t this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n\t this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2);\n\t this.bottom_symbol.isPositioned = true;\n\t\n\t this.bottom_symbol.render();\n\t }\n\t }\n\t\n\t if (this.right_symbol) {\n\t var rightPoint = this.getRight();\n\t\n\t if (!this.right_symbol.isPositioned) {\n\t\n\t this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2);\n\t this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n\t\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t if (!self.params['align-next'] || self.params['align-next'] !== 'no') { \n\t var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n\t if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t if (self.right_symbol.symbolType === 'end') return;\n\t self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.right_symbol.isPositioned = true;\n\t\n\t this.right_symbol.render();\n\t }\n\t }\n\t \n\t if (this.left_symbol) {\n\t var leftPoint = this.getLeft();\n\t \n\t if (!this.left_symbol.isPositioned) {\n\t this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2);\n\t this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n\t\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t \n\t if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n\t var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x);\n\t if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t }\n\t \n\t if (hasSymbolUnder) {\n\t if (self.left_symbol.symbolType === 'end') return;\n\t self.left_symbol.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t \n\t this.left_symbol.isPositioned = true;\n\t \n\t this.left_symbol.render();\n\t }\n\t }\n\t};\n\t\n\tCondition.prototype.renderLines = function() {\n\t if (this.yes_symbol) {\n\t this.drawLineTo(this.yes_symbol, this.yes_annotation ? this.yes_annotation : this.getAttr('yes-text'), this.yes_direction);\n\t }\n\t\n\t if (this.no_symbol) {\n\t this.drawLineTo(this.no_symbol, this.no_annotation ? this.no_annotation : this.getAttr('no-text'), this.no_direction);\n\t }\n\t};\n\t\n\tmodule.exports = Condition;\n\n\n/***/ }),\n/* 6 */\n/*!******************************************!*\\\n !*** ./src/flowchart.symbol.parallel.js ***!\n \\******************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Parallel(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0);\n\t options = options || {};\n\t Symbol.call(this, chart, options, symbol);\n\t this.path1_annotation = options.path1_annotation || '';\n\t this.path2_annotation = options.path2_annotation || '';\n\t this.path3_annotation = options.path3_annotation || '';\n\t this.textMargin = this.getAttr('text-margin');\n\t this.path1_direction = 'bottom';\n\t this.path2_direction = 'right';\n\t this.path3_direction = 'top';\n\t this.params = options.params;\n\t if (options.direction_next === 'path1' && !options[options.direction_next] && options.next) {\n\t options[options.direction_next] = options.next;\n\t }\n\t if (options.direction_next === 'path2' && !options[options.direction_next] && options.next) {\n\t options[options.direction_next] = options.next;\n\t }\n\t if (options.direction_next === 'path3' && !options[options.direction_next] && options.next) {\n\t options[options.direction_next] = options.next;\n\t }\n\t\n\t if (options.path1 && options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && !options.direction_path3) {\n\t if (options.direction_path1 === 'right') {\n\t this.path2_direction = 'bottom';\n\t this.path1_direction = 'right';\n\t this.path3_direction = 'top';\n\t } else if (options.direction_path1 === 'top') {\n\t this.path2_direction = 'right';\n\t this.path1_direction = 'top';\n\t this.path3_direction = 'bottom';\n\t } else if (options.direction_path1 === 'left') {\n\t this.path2_direction = 'right';\n\t this.path1_direction = 'left';\n\t this.path3_direction = 'bottom';\n\t } else {\n\t this.path2_direction = 'right';\n\t this.path1_direction = 'bottom';\n\t this.path3_direction = 'top';\n\t }\n\t } else if (options.path1 && !options.direction_path1 && options.path2 && options.direction_path2 && options.path3 && !options.direction_path3) {\n\t if (options.direction_path2 === 'right') {\n\t this.path1_direction = 'bottom';\n\t this.path2_direction = 'right';\n\t this.path3_direction = 'top';\n\t } else if (options.direction_path2 === 'left') {\n\t this.path1_direction = 'bottom';\n\t this.path2_direction = 'left';\n\t this.path3_direction = 'right';\n\t } else {\n\t this.path1_direction = 'right';\n\t this.path2_direction = 'bottom';\n\t this.path3_direction = 'top';\n\t }\n\t } else if (options.path1 && !options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && options.direction_path3) {\n\t if (options.direction_path2 === 'right') {\n\t this.path1_direction = 'bottom';\n\t this.path2_direction = 'top';\n\t this.path3_direction = 'right';\n\t } else if (options.direction_path2 === 'left') {\n\t this.path1_direction = 'bottom';\n\t this.path2_direction = 'right';\n\t this.path3_direction = 'left';\n\t } else {\n\t this.path1_direction = 'right';\n\t this.path2_direction = 'bottom';\n\t this.path3_direction = 'top';\n\t }\n\t } else {\n\t this.path1_direction = options.direction_path1;\n\t this.path2_direction = options.direction_path2;\n\t this.path3_direction = options.direction_path3;\n\t }\n\t\n\t this.path1_direction = this.path1_direction || 'bottom';\n\t this.path2_direction = this.path2_direction || 'right';\n\t this.path3_direction = this.path3_direction || 'top';\n\t\n\t this.initialize();\n\t}\n\tinherits(Parallel, Symbol);\n\t\n\tParallel.prototype.render = function() {\n\t if (this.path1_direction) {\n\t this[this.path1_direction + '_symbol'] = this.path1_symbol;\n\t }\n\t\n\t if (this.path2_direction) {\n\t this[this.path2_direction + '_symbol'] = this.path2_symbol;\n\t }\n\t\n\t if (this.path3_direction) {\n\t this[this.path3_direction + '_symbol'] = this.path3_symbol;\n\t }\n\t\n\t var lineLength = this.getAttr('line-length');\n\t\n\t if (this.bottom_symbol) {\n\t var bottomPoint = this.getBottom();\n\t\n\t if (!this.bottom_symbol.isPositioned) {\n\t this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n\t this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width / 2);\n\t this.bottom_symbol.isPositioned = true;\n\t\n\t this.bottom_symbol.render();\n\t }\n\t }\n\t\n\t if (this.top_symbol) {\n\t var topPoint = this.getTop();\n\t\n\t if (!this.top_symbol.isPositioned) {\n\t this.top_symbol.shiftY(this.getY() - this.top_symbol.height - lineLength);\n\t this.top_symbol.setX(topPoint.x + this.top_symbol.width);\n\t this.top_symbol.isPositioned = true;\n\t\n\t this.top_symbol.render();\n\t }\n\t }\n\t\n\t var self = this;\n\t\n\t if (this.left_symbol) {\n\t var leftPoint = this.getLeft();\n\t\n\t if (!this.left_symbol.isPositioned) {\n\t this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2);\n\t this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n\t var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x);\n\t if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t if (self.left_symbol.symbolType === 'end') return;\n\t self.left_symbol.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.left_symbol.isPositioned = true;\n\t\n\t this.left_symbol.render();\n\t }\n\t }\n\t\n\t if (this.right_symbol) {\n\t var rightPoint = this.getRight();\n\t\n\t if (!this.right_symbol.isPositioned) {\n\t this.right_symbol.setY(rightPoint.y - this.right_symbol.height / 2);\n\t this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n\t var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n\t if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width / 2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t if (self.right_symbol.symbolType === 'end') return;\n\t self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.right_symbol.isPositioned = true;\n\t\n\t this.right_symbol.render();\n\t }\n\t }\n\t};\n\t\n\tParallel.prototype.renderLines = function() {\n\t if (this.path1_symbol) {\n\t this.drawLineTo(this.path1_symbol, this.path1_annotation, this.path1_direction);\n\t }\n\t\n\t if (this.path2_symbol) {\n\t this.drawLineTo(this.path2_symbol, this.path2_annotation, this.path2_direction);\n\t }\n\t\n\t if (this.path3_symbol) {\n\t this.drawLineTo(this.path3_symbol, this.path3_annotation, this.path3_direction);\n\t }\n\t};\n\t\n\tmodule.exports = Parallel;\n\n/***/ }),\n/* 7 */\n/*!********************************!*\\\n !*** ./src/flowchart.chart.js ***!\n \\********************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Raphael = __webpack_require__(/*! raphael */ 18);\n\tvar defaults = __webpack_require__(/*! ./flowchart.helpers */ 1).defaults;\n\tvar defaultOptions = __webpack_require__(/*! ./flowchart.defaults */ 8);\n\tvar Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5);\n\tvar Parallel = __webpack_require__(/*! ./flowchart.symbol.parallel */ 6);\n\t\n\tfunction FlowChart(container, options) {\n\t options = options || {};\n\t\n\t this.paper = new Raphael(container);\n\t\n\t this.options = defaults(options, defaultOptions);\n\t\n\t this.symbols = [];\n\t this.lines = [];\n\t this.start = null;\n\t}\n\t\n\tFlowChart.prototype.handle = function(symbol) {\n\t if (this.symbols.indexOf(symbol) <= -1) {\n\t this.symbols.push(symbol);\n\t }\n\t\n\t var flowChart = this;\n\t\n\t if (symbol instanceof(Condition)) {\n\t symbol.yes = function(nextSymbol) {\n\t symbol.yes_symbol = nextSymbol;\n\t if(symbol.no_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t symbol.no = function(nextSymbol) {\n\t symbol.no_symbol = nextSymbol;\n\t if (symbol.yes_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t } else if (symbol instanceof(Parallel)) {\n\t symbol.path1 = function(nextSymbol) {\n\t symbol.path1_symbol = nextSymbol;\n\t if (symbol.path2_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t symbol.path2 = function(nextSymbol) {\n\t symbol.path2_symbol = nextSymbol;\n\t if (symbol.path3_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t symbol.path3 = function(nextSymbol) {\n\t symbol.path3_symbol = nextSymbol;\n\t if (symbol.path1_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t } else {\n\t symbol.then = function(nextSymbol) {\n\t symbol.next = nextSymbol;\n\t symbol.pathOk = true;\n\t return flowChart.handle(nextSymbol);\n\t };\n\t }\n\t\n\t return symbol;\n\t};\n\t\n\tFlowChart.prototype.startWith = function(symbol) {\n\t this.start = symbol;\n\t return this.handle(symbol);\n\t};\n\t\n\tFlowChart.prototype.render = function() {\n\t var maxWidth = 0,\n\t maxHeight = 0,\n\t i = 0,\n\t len = 0,\n\t maxX = 0,\n\t maxY = 0,\n\t minX = 0,\n\t minY = 0,\n\t symbol,\n\t line;\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t if (symbol.width > maxWidth) {\n\t maxWidth = symbol.width;\n\t }\n\t if (symbol.height > maxHeight) {\n\t maxHeight = symbol.height;\n\t }\n\t }\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']);\n\t symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']);\n\t }\n\t\n\t this.start.render();\n\t // for (i = 0, len = this.symbols.length; i < len; i++) {\n\t // symbol = this.symbols[i];\n\t // symbol.render();\n\t // }\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t symbol.renderLines();\n\t }\n\t\n\t maxX = this.maxXFromLine;\n\t\n\t var x;\n\t var y;\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t var leftX = symbol.getX()\n\t x = leftX + symbol.width;\n\t y = symbol.getY() + symbol.height;\n\t if (leftX < minX) {\n\t minX = leftX;\n\t }\n\t if (x > maxX) {\n\t maxX = x;\n\t }\n\t if (y > maxY) {\n\t maxY = y;\n\t }\n\t }\n\t\n\t for (i = 0, len = this.lines.length; i < len; i++) {\n\t line = this.lines[i].getBBox();\n\t x = line.x;\n\t y = line.y;\n\t var x2 = line.x2;\n\t var y2 = line.y2;\n\t if (x < minX) {\n\t minX = x;\n\t }\n\t if (y < minY) {\n\t minY = y;\n\t }\n\t if (x2 > maxX) {\n\t maxX = x2;\n\t }\n\t if (y2 > maxY) {\n\t maxY = y2;\n\t }\n\t }\n\t\n\t var scale = this.options['scale'];\n\t var lineWidth = this.options['line-width'];\n\t\n\t if (this.minXFromSymbols < minX) minX = this.minXFromSymbols;\n\t\n\t if (minX < 0) minX -= lineWidth;\n\t if (minY < 0) minY -= lineWidth;\n\t\n\t var width = maxX + lineWidth - minX;\n\t var height = maxY + lineWidth - minY;\n\t\n\t this.paper.setSize(width * scale, height * scale);\n\t this.paper.setViewBox(minX, minY, width, height, true);\n\t};\n\t\n\tFlowChart.prototype.clean = function() {\n\t if (this.paper) {\n\t var paperDom = this.paper.canvas;\n\t paperDom.parentNode && paperDom.parentNode.removeChild(paperDom);\n\t }\n\t};\n\t\n\tmodule.exports = FlowChart;\n\n/***/ }),\n/* 8 */\n/*!***********************************!*\\\n !*** ./src/flowchart.defaults.js ***!\n \\***********************************/\n/***/ (function(module, exports) {\n\n\t// defaults\n\tmodule.exports = {\n\t 'x': 0,\n\t 'y': 0,\n\t // 'roundness': 0,\n\t 'line-width': 3,\n\t 'line-length': 50,\n\t 'text-margin': 10,\n\t 'font-size': 14,\n\t 'font-color': 'black',\n\t // 'font': 'normal',\n\t // 'font-family': 'calibri',\n\t // 'font-weight': 'normal',\n\t 'line-color': 'black',\n\t 'element-color': 'black',\n\t 'fill': 'white',\n\t 'yes-text': 'yes',\n\t 'no-text': 'no',\n\t 'arrow-end': 'block',\n\t 'class': 'flowchart',\n\t 'scale': 1,\n\t 'symbols': {\n\t 'start': {},\n\t 'end': {},\n\t 'condition': {},\n\t 'inputoutput': {},\n\t 'input': {}, //tds\n\t 'output': {}, //tds \n\t 'operation': {},\n\t 'subroutine': {},\n\t 'parallel': {}\n\t } //,\n\t // 'flowstate' : {\n\t // 'past' : { 'fill': '#CCCCCC', 'font-size': 12},\n\t // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'},\n\t // 'future' : { 'fill': '#FFFF99'},\n\t // 'invalid': {'fill': '#444444'}\n\t // }\n\t};\n\n/***/ }),\n/* 9 */\n/*!*******************************!*\\\n !*** ./src/flowchart.shim.js ***!\n \\*******************************/\n/***/ (function(module, exports) {\n\n\t// add indexOf to non ECMA-262 standard compliant browsers\n\tif (!Array.prototype.indexOf) {\n\t Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {\n\t \"use strict\";\n\t if (this === null) {\n\t throw new TypeError();\n\t }\n\t var t = Object(this);\n\t var len = t.length >>> 0;\n\t if (len === 0) {\n\t return -1;\n\t }\n\t var n = 0;\n\t if (arguments.length > 0) {\n\t n = Number(arguments[1]);\n\t if (n != n) { // shortcut for verifying if it's NaN\n\t n = 0;\n\t } else if (n !== 0 && n != Infinity && n != -Infinity) {\n\t n = (n > 0 || -1) * Math.floor(Math.abs(n));\n\t }\n\t }\n\t if (n >= len) {\n\t return -1;\n\t }\n\t var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);\n\t for (; k < len; k++) {\n\t if (k in t && t[k] === searchElement) {\n\t return k;\n\t }\n\t }\n\t return -1;\n\t };\n\t}\n\t\n\t// add lastIndexOf to non ECMA-262 standard compliant browsers\n\tif (!Array.prototype.lastIndexOf) {\n\t Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {\n\t \"use strict\";\n\t if (this === null) {\n\t throw new TypeError();\n\t }\n\t var t = Object(this);\n\t var len = t.length >>> 0;\n\t if (len === 0) {\n\t return -1;\n\t }\n\t var n = len;\n\t if (arguments.length > 1) {\n\t n = Number(arguments[1]);\n\t if (n != n) {\n\t n = 0;\n\t } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) {\n\t n = (n > 0 || -1) * Math.floor(Math.abs(n));\n\t }\n\t }\n\t var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);\n\t for (; k >= 0; k--) {\n\t if (k in t && t[k] === searchElement) {\n\t return k;\n\t }\n\t }\n\t return -1;\n\t };\n\t}\n\t\n\tif (!String.prototype.trim) {\n\t String.prototype.trim = function() {\n\t return this.replace(/^\\s+|\\s+$/g, '');\n\t };\n\t}\n\n/***/ }),\n/* 10 */\n/*!*************************************!*\\\n !*** ./src/flowchart.symbol.end.js ***!\n \\*************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction End(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n\t options = options || {};\n\t options.text = options.text || 'End';\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(End, Symbol);\n\t\n\tmodule.exports = End;\n\n\n/***/ }),\n/* 11 */\n/*!***************************************!*\\\n !*** ./src/flowchart.symbol.input.js ***!\n \\***************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction Input(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.textMargin = this.getAttr('text-margin');\n\t\n\t this.text.attr({\n\t x: this.textMargin * 3\n\t });\n\t\n\t var width = this.text.getBBox().width + 4 * this.textMargin;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t var startX = this.textMargin;\n\t var startY = height/2;\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - this.textMargin + 2 * this.textMargin, y: height},\n\t {x: startX - this.textMargin + width, y: height},\n\t {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n\t {x: startX - this.textMargin, y: 0},\n\t {x: startX, y: startY}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t this.symbol = symbol\n\t\n\t this.initialize();\n\t}\n\tinherits(Input, Symbol);\n\t\n\tInput.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tInput.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width - this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tmodule.exports = Input;\n\t\n\t\n\n\n/***/ }),\n/* 12 */\n/*!*********************************************!*\\\n !*** ./src/flowchart.symbol.inputoutput.js ***!\n \\*********************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction InputOutput(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.textMargin = this.getAttr('text-margin');\n\t\n\t this.text.attr({\n\t x: this.textMargin * 3\n\t });\n\t\n\t var width = this.text.getBBox().width + 4 * this.textMargin;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t var startX = this.textMargin;\n\t var startY = height/2;\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - this.textMargin, y: height},\n\t {x: startX - this.textMargin + width, y: height},\n\t {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n\t {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n\t {x: startX, y: startY}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t this.symbol = symbol\n\t\n\t this.initialize();\n\t}\n\tinherits(InputOutput, Symbol);\n\t\n\tInputOutput.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tInputOutput.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width - this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tmodule.exports = InputOutput;\n\n\n/***/ }),\n/* 13 */\n/*!*******************************************!*\\\n !*** ./src/flowchart.symbol.operation.js ***!\n \\*******************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Operation(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0);\n\t options = options || {};\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(Operation, Symbol);\n\t\n\tmodule.exports = Operation;\n\n\n/***/ }),\n/* 14 */\n/*!****************************************!*\\\n !*** ./src/flowchart.symbol.output.js ***!\n \\****************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction Output(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.textMargin = this.getAttr('text-margin');\n\t\n\t this.text.attr({\n\t x: this.textMargin * 3\n\t });\n\t\n\t var width = this.text.getBBox().width + 4 * this.textMargin;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t var startX = this.textMargin;\n\t var startY = height/2;\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - this.textMargin, y: height},\n\t {x: startX - this.textMargin + width + 2 * this.textMargin, y: height},\n\t {x: startX - this.textMargin + width, y: 0},\n\t {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n\t {x: startX, y: startY}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t this.symbol = symbol\n\t\n\t this.initialize();\n\t}\n\tinherits(Output, Symbol);\n\t\n\tOutput.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tOutput.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width - this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tmodule.exports = Output;\n\t\n\t\n\t\n\t/*\n\t//var Symbol = require('./flowchart.symbol');\n\tvar inherits = require('./flowchart.helpers').inherits;\n\tvar drawAPI = require('./flowchart.functions');\n\tvar InputOutput = require('./flowchart.symbol.inputoutput');\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction Output(chart, options) {\n\t options = options || {};\n\t InputOutput.call(this, chart, options);\n\t\n\t var width = this.text.getBBox().width + 4 * this.textMargin;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t var startX = this.textMargin;\n\t var startY = height/2;\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - this.textMargin + 2 * this.textMargin, y: height},\n\t {x: startX - this.textMargin + width, y: height},\n\t {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n\t {x: startX - this.textMargin, y: 0},\n\t {x: startX, y: startY}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t \n\t if (this.symbol){\n\t this.group.remove(this.symbol); //tds\n\t this.symbol.parentNode.removeChild(this.symbol); //tds\n\t }\n\t this.symbol = symbol\n\t\n\t this.initialize();\n\t}\n\tinherits(Output, InputOutput);\n\t\n\tmodule.exports = Output;\n\t*/\n\n\n/***/ }),\n/* 15 */\n/*!***************************************!*\\\n !*** ./src/flowchart.symbol.start.js ***!\n \\***************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Start(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n\t options = options || {};\n\t options.text = options.text || 'Start';\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(Start, Symbol);\n\t\n\tmodule.exports = Start;\n\t\n\t// Start.prototype.render = function() {\n\t// if (this.next) {\n\t// var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length'];\n\t\n\t// var bottomPoint = this.getBottom();\n\t// var topPoint = this.next.getTop();\n\t\n\t// if (!this.next.isPositioned) {\n\t// this.next.shiftY(this.getY() + this.height + lineLength);\n\t// this.next.setX(bottomPoint.x - this.next.width/2);\n\t// this.next.isPositioned = true;\n\t\n\t// this.next.render();\n\t// }\n\t// }\n\t// };\n\t\n\t// Start.prototype.renderLines = function() {\n\t// if (this.next) {\n\t// this.drawLineTo(this.next);\n\t// }\n\t// };\n\n\n/***/ }),\n/* 16 */\n/*!********************************************!*\\\n !*** ./src/flowchart.symbol.subroutine.js ***!\n \\********************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Subroutine(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0);\n\t options = options || {};\n\t Symbol.call(this, chart, options, symbol);\n\t\n\t symbol.attr({\n\t width: this.text.getBBox().width + 4 * this.getAttr('text-margin')\n\t });\n\t\n\t this.text.attr({\n\t 'x': 2 * this.getAttr('text-margin')\n\t });\n\t\n\t var innerWrap = chart.paper.rect(0, 0, 0, 0);\n\t innerWrap.attr({\n\t x: this.getAttr('text-margin'),\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t width: this.text.getBBox().width + 2 * this.getAttr('text-margin'),\n\t height: this.text.getBBox().height + 2 * this.getAttr('text-margin'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.key) { innerWrap.node.id = options.key + 'i'; }\n\t\n\t var font = this.getAttr('font');\n\t var fontF = this.getAttr('font-family');\n\t var fontW = this.getAttr('font-weight');\n\t\n\t if (font) innerWrap.attr({ 'font': font });\n\t if (fontF) innerWrap.attr({ 'font-family': fontF });\n\t if (fontW) innerWrap.attr({ 'font-weight': fontW });\n\t\n\t if (options.link) { innerWrap.attr('href', options.link); }\n\t if (options.target) { innerWrap.attr('target', options.target); }\n\t this.group.push(innerWrap);\n\t innerWrap.insertBefore(this.text);\n\t\n\t this.initialize();\n\t}\n\tinherits(Subroutine, Symbol);\n\t\n\tmodule.exports = Subroutine;\n\n\n/***/ }),\n/* 17 */\n/*!******************************!*\\\n !*** ./src/jquery-plugin.js ***!\n \\******************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tif (typeof jQuery != 'undefined') {\n\t\tvar parse = __webpack_require__(/*! ./flowchart.parse */ 4);\n\t\n\t\t(function( $ ) {\n\t\t\tfunction paramFit(needle, haystack) {\n\t\t\t\treturn needle == haystack ||\n\t\t\t\t( Array.isArray(haystack) && (haystack.includes(needle) || haystack.includes(Number(needle)) ))\n\t\t\t}\n\t\t\tvar methods = {\n\t\t\t\tinit : function(options) {\n\t\t\t\t\treturn this.each(function() {\n\t\t\t\t\t\tvar $this = $(this);\n\t\t\t\t\t\tthis.chart = parse($this.text());\n\t\t\t\t\t\t$this.html('');\n\t\t\t\t\t\tthis.chart.drawSVG(this, options);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tsetFlowStateByParam : function(param, paramValue, newFlowState) {\n\t\t\t\t\treturn this.each(function() {\n\t\t\t\t\t\tvar chart = this.chart;\n\t\n\t\t\t\t\t\t// @todo this should be part of Symbol API\n\t\t\t\t\t\tvar nextSymbolKeys = ['next', 'yes', 'no', 'path1', 'path2', 'path3'];\n\t\n\t\t\t\t\t\tfor (var property in chart.symbols) {\n\t\t\t\t\t\t\tif (chart.symbols.hasOwnProperty(property)) {\n\t\t\t\t\t\t\t\tvar symbol = chart.symbols[property];\n\t\t\t\t\t\t\t\tvar val = symbol.params[param];\n\t\t\t\t\t\t\t\tif (paramFit(val, paramValue)) {\n\t\t\t\t\t\t\t\t\tsymbol.flowstate = newFlowState;\n\t\t\t\t\t\t\t\t\tfor (var nski = 0; nski < nextSymbolKeys.length; nski++) {\n\t\t\t\t\t\t\t\t\t\tvar nextSymbolKey = nextSymbolKeys[nski];\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey] &&\n\t\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey]['params'] &&\n\t\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey]['params'][param] &&\n\t\t\t\t\t\t\t\t\t\t\tparamFit(symbol[nextSymbolKey]['params'][param], paramValue)\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tsymbol.lineStyle[symbol[nextSymbolKey]['key']] = {stroke: chart.options()['flowstate'][newFlowState]['fill']};\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tchart.clean();\n\t\t\t\t\t\tchart.drawSVG(this);\n\t\t\t\t\t});\n\t\n\t\t\t\t},\n\t\t\t\tclearFlowState: function () {\n\t\t\t\t\treturn this.each(function() {\n\t\t\t\t\t\tvar chart = this.chart;\n\t\n\t\t\t\t\t\tfor (var property in chart.symbols) {\n\t\t\t\t\t\t\tif (chart.symbols.hasOwnProperty(property)) {\n\t\t\t\t\t\t\t\tvar node = chart.symbols[property];\n\t\t\t\t\t\t\t\tnode.flowstate = '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tchart.clean();\n\t\t\t\t\t\tchart.drawSVG(this);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t\t$.fn.flowChart = function(methodOrOptions) {\n\t\t\t\tif ( methods[methodOrOptions] ) {\n\t\t\t\t\treturn methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));\n\t\t\t\t} else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {\n\t\t\t\t\t// Default to \"init\"\n\t\t\t\t\treturn methods.init.apply( this, arguments );\n\t\t\t\t} else {\n\t\t\t\t\t$.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.flowChart' );\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t})(jQuery); // eslint-disable-line\n\t}\n\n\n/***/ }),\n/* 18 */\n/*!**************************!*\\\n !*** external \"Raphael\" ***!\n \\**************************/\n/***/ (function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_18__;\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// flowchart.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 519494f9e366d139a59e","require('./src/flowchart.shim');\nvar parse = require('./src/flowchart.parse');\nrequire('./src/jquery-plugin');\n\nvar FlowChart = {\n\tparse: parse\n};\n\nif (typeof window !== 'undefined') {\n\twindow.flowchart = FlowChart;\n}\n\nmodule.exports = FlowChart;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./index.js\n// module id = 0\n// module chunks = 0","function _defaults(options, defaultOptions) {\n if (!options || typeof options === 'function') {\n return defaultOptions;\n }\n\n var merged = {};\n for (var attrname in defaultOptions) {\n merged[attrname] = defaultOptions[attrname];\n }\n\n for (attrname in options) {\n if (options[attrname]) {\n if (typeof merged[attrname] === 'object') {\n merged[attrname] = _defaults(merged[attrname], options[attrname]);\n } else {\n merged[attrname] = options[attrname];\n }\n }\n }\n return merged;\n}\n\nfunction _inherits(ctor, superCtor) {\n if (typeof(Object.create) === 'function') {\n // implementation from standard node.js 'util' module\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n } else {\n // old school shim for old browsers\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n}\n\n// move dependent functions to a container so that\n// they can be overriden easier in no jquery environment (node.js)\nmodule.exports = {\n defaults: _defaults,\n inherits: _inherits\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.helpers.js\n// module id = 1\n// module chunks = 0","var drawAPI = require('./flowchart.functions');\nvar drawLine = drawAPI.drawLine;\nvar checkLineIntersection = drawAPI.checkLineIntersection;\n\nfunction Symbol(chart, options, symbol) {\n this.chart = chart;\n this.group = this.chart.paper.set();\n this.symbol = symbol;\n this.connectedTo = [];\n this.symbolType = options.symbolType;\n this.flowstate = (options.flowstate || 'future');\n this.lineStyle = (options.lineStyle || {});\n this.key = (options.key || '');\n this.leftLines = [];\n this.rightLines = [];\n this.topLines = [];\n this.bottomLines = [];\n this.params = options.params;\n\n this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined;\n\n this.text = this.chart.paper.text(0, 0, options.text);\n //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t\n if (options.key) { this.text.node.id = options.key + 't'; }\n this.text.node.setAttribute('class', this.getAttr('class') + 't');\n\n this.text.attr({\n 'text-anchor': 'start',\n 'x' : this.getAttr('text-margin'),\n 'fill' : this.getAttr('font-color'),\n 'font-size' : this.getAttr('font-size')\n });\n\n var font = this.getAttr('font');\n var fontF = this.getAttr('font-family');\n var fontW = this.getAttr('font-weight');\n\n if (font) this.text.attr({ 'font': font });\n if (fontF) this.text.attr({ 'font-family': fontF });\n if (fontW) this.text.attr({ 'font-weight': fontW });\n\n if (options.link) { this.text.attr('href', options.link); }\n \n //ndrqu Add click function with event and options params\n if (options.function) { \n this.text.attr({ 'cursor' : 'pointer' });\n\n this.text.node.addEventListener(\"click\", function(evt) {\n window[options.function](evt,options);\n }, false);\n }\n\n if (options.target) { this.text.attr('target', options.target); }\n\n var maxWidth = this.getAttr('maxWidth');\n if (maxWidth) {\n // using this approach: http://stackoverflow.com/a/3153457/22466\n var words = options.text.split(' ');\n var tempText = \"\";\n for (var i=0, ii=words.length; i maxWidth) {\n tempText += \"\\n\" + word;\n } else {\n tempText += \" \" + word;\n }\n }\n this.text.attr(\"text\", tempText.substring(1));\n }\n\n this.group.push(this.text);\n\n if (symbol) {\n var tmpMargin = this.getAttr('text-margin');\n\n symbol.attr({\n 'fill' : this.getAttr('fill'),\n 'stroke' : this.getAttr('element-color'),\n 'stroke-width' : this.getAttr('line-width'),\n 'width' : this.text.getBBox().width + 2 * tmpMargin,\n 'height' : this.text.getBBox().height + 2 * tmpMargin\n });\n\n symbol.node.setAttribute('class', this.getAttr('class'));\n var roundness = this.getAttr('roundness');\n if (!isNaN(roundness)) {\n symbol.node.setAttribute('ry', roundness);\n symbol.node.setAttribute('rx', roundness);\n }\n\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n\n //ndrqu Add click function with event and options params\n if (options.function) { \n symbol.node.addEventListener(\"click\", function(evt) {\n window[options.function](evt,options);\n }, false);\n symbol.attr({ 'cursor' : 'pointer' });\n }\n if (options.key) { symbol.node.id = options.key; }\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n\n this.text.attr({\n 'y': symbol.getBBox().height/2\n });\n\n this.initialize();\n }\n\n}\n\n/* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */\nSymbol.prototype.getAttr = function(attName) {\n if (!this.chart) {\n return undefined;\n }\n var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined;\n var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined;\n var opt1;\n if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) {\n opt1 = this.chart.options.flowstate[this.flowstate][attName];\n }\n return (opt1 || opt2 || opt3);\n};\n\nSymbol.prototype.initialize = function() {\n this.group.transform('t' + this.getAttr('line-width') + ',' + this.getAttr('line-width'));\n\n this.width = this.group.getBBox().width;\n this.height = this.group.getBBox().height;\n};\n\nSymbol.prototype.getCenter = function() {\n return {x: this.getX() + this.width/2,\n y: this.getY() + this.height/2};\n};\n\nSymbol.prototype.getX = function() {\n return this.group.getBBox().x;\n};\n\nSymbol.prototype.getY = function() {\n return this.group.getBBox().y;\n};\n\nSymbol.prototype.shiftX = function(x) {\n this.group.transform('t' + (this.getX() + x) + ',' + this.getY());\n};\n\nSymbol.prototype.setX = function(x) {\n this.group.transform('t' + x + ',' + this.getY());\n};\n\nSymbol.prototype.shiftY = function(y) {\n this.group.transform('t' + this.getX() + ',' + (this.getY() + y));\n};\n\nSymbol.prototype.setY = function(y) {\n this.group.transform('t' + this.getX() + ',' + y);\n};\n\nSymbol.prototype.getTop = function() {\n var y = this.getY();\n var x = this.getX() + this.width/2;\n return {x: x, y: y};\n};\n\nSymbol.prototype.getBottom = function() {\n var y = this.getY() + this.height;\n var x = this.getX() + this.width/2;\n return {x: x, y: y};\n};\n\nSymbol.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX();\n return {x: x, y: y};\n};\n\nSymbol.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width;\n return {x: x, y: y};\n};\n\nSymbol.prototype.render = function() {\n if (this.next) {\n\n var self = this;\n var lineLength = this.getAttr('line-length');\n\n if (this.next_direction === 'right') {\n\n var rightPoint = this.getRight();\n\n if (!this.next.isPositioned) {\n this.next.setY(rightPoint.y - this.next.height/2);\n this.next.shiftX(this.group.getBBox().x + this.width + lineLength);\n\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n hasSymbolUnder = true;\n break;\n }\n }\n\n if (hasSymbolUnder) {\n if (self.next.symbolType === 'end') return;\n self.next.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.next.isPositioned = true;\n\n this.next.render();\n }\n } else if (this.next_direction === 'left') {\n\n var leftPoint = this.getLeft();\n\n if (!this.next.isPositioned) {\n this.next.setY(leftPoint.y - this.next.height/2);\n this.next.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n hasSymbolUnder = true;\n break;\n }\n }\n\n if (hasSymbolUnder) {\n if (self.next.symbolType === 'end') return;\n self.next.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.next.isPositioned = true;\n\n this.next.render();\n }\n } else {\n var bottomPoint = this.getBottom();\n\n if (!this.next.isPositioned) {\n this.next.shiftY(this.getY() + this.height + lineLength);\n this.next.setX(bottomPoint.x - this.next.width/2);\n this.next.isPositioned = true;\n\n this.next.render();\n }\n }\n }\n};\n\nSymbol.prototype.renderLines = function() {\n if (this.next) {\n if (this.next_direction) {\n this.drawLineTo(this.next, this.getAttr('arrow-text') || '', this.next_direction);\n } else {\n this.drawLineTo(this.next, this.getAttr('arrow-text') || '');\n }\n }\n};\n\nSymbol.prototype.drawLineTo = function(symbol, text, origin) {\n if (this.connectedTo.indexOf(symbol) < 0) {\n this.connectedTo.push(symbol);\n }\n\n var x = this.getCenter().x,\n y = this.getCenter().y,\n right = this.getRight(),\n bottom = this.getBottom(),\n top = this.getTop(),\n left = this.getLeft();\n\n var symbolX = symbol.getCenter().x,\n symbolY = symbol.getCenter().y,\n symbolTop = symbol.getTop(),\n symbolRight = symbol.getRight(),\n symbolLeft = symbol.getLeft();\n\n var isOnSameColumn = x === symbolX,\n isOnSameLine = y === symbolY,\n isUnder = y < symbolY,\n isUpper = y > symbolY || this === symbol,\n isLeft = x > symbolX,\n isRight = x < symbolX;\n\n var maxX = 0,\n line,\n yOffset,\n lineLength = this.getAttr('line-length'),\n lineWith = this.getAttr('line-width');\n\n if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) {\n if (symbol.topLines.length === 0 && this.bottomLines.length === 0) {\n line = drawLine(this.chart, bottom, symbolTop, text);\n } else {\n yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n line = drawLine(this.chart, bottom, [\n {x: symbolTop.x, y: symbolTop.y - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n }\n this.bottomLines.push(line);\n symbol.topLines.push(line);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x;\n } else if ((!origin || origin === 'right') && isOnSameLine && isRight) {\n if (symbol.leftLines.length === 0 && this.rightLines.length === 0) {\n line = drawLine(this.chart, right, symbolLeft, text);\n } else {\n yOffset = Math.max(symbol.leftLines.length, this.rightLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: right.x, y: right.y - yOffset},\n {x: right.x, y: symbolLeft.y - yOffset},\n {x: symbolLeft.x, y: symbolLeft.y - yOffset},\n {x: symbolLeft.x, y: symbolLeft.y}\n ], text);\n }\n this.rightLines.push(line);\n symbol.leftLines.push(line);\n this.rightStart = true;\n symbol.leftEnd = true;\n maxX = symbolLeft.x;\n } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) {\n if (symbol.rightLines.length === 0 && this.leftLines.length === 0) {\n line = drawLine(this.chart, left, symbolRight, text);\n } else {\n yOffset = Math.max(symbol.rightLines.length, this.leftLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: right.x, y: right.y - yOffset},\n {x: right.x, y: symbolRight.y - yOffset},\n {x: symbolRight.x, y: symbolRight.y - yOffset},\n {x: symbolRight.x, y: symbolRight.y}\n ], text);\n }\n this.leftLines.push(line);\n symbol.rightLines.push(line);\n this.leftStart = true;\n symbol.rightEnd = true;\n maxX = symbolRight.x;\n } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) {\n yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y - yOffset},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightLines.push(line);\n symbol.topLines.push(line);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) {\n yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y - yOffset},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightLines.push(line);\n symbol.topLines.push(line);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((!origin || origin === 'bottom') && isLeft) {\n yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n if (this.leftEnd && isUpper) {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2 - yOffset},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n } else {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n }\n this.bottomLines.push(line);\n symbol.topLines.push(line);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n } else if ((!origin || origin === 'bottom') && isRight && isUnder) {\n yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.bottomLines.push(line);\n symbol.topLines.push(line);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x;\n if (symbolTop.x > maxX) maxX = symbolTop.x;\n } else if ((!origin || origin === 'bottom') && isRight) {\n yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2 - yOffset},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.bottomLines.push(line);\n symbol.topLines.push(line);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n } else if ((origin && origin === 'right') && isLeft) {\n yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightLines.push(line);\n symbol.topLines.push(line);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((origin && origin === 'right') && isRight) {\n yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: symbolTop.x, y: right.y - yOffset},\n {x: symbolTop.x, y: symbolTop.y - yOffset}\n ], text);\n this.rightLines.push(line);\n symbol.topLines.push(line);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) {\n yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n {x: right.x + lineLength/2, y: bottom.y + lineLength/2 - yOffset},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.bottomLines.push(line);\n symbol.topLines.push(line);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + lineLength/2;\n } else if ((origin === 'left') && isOnSameColumn && isUpper) {\n var diffX = left.x - lineLength/2;\n if (symbolLeft.x < left.x) {\n diffX = symbolLeft.x - lineLength/2;\n }\n yOffset = Math.max(symbol.topLines.length, this.leftLines.length) * 10;\n line = drawLine(this.chart, left, [\n {x: diffX, y: left.y - yOffset},\n {x: diffX, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.leftLines.push(line);\n symbol.topLines.push(line);\n this.leftStart = true;\n symbol.topEnd = true;\n maxX = left.x;\n } else if ((origin === 'left')) {\n yOffset = Math.max(symbol.topLines.length, this.leftLines.length) * 10;\n line = drawLine(this.chart, left, [\n {x: symbolTop.x + (left.x - symbolTop.x)/2, y: left.y},\n {x: symbolTop.x + (left.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.leftLines.push(line);\n symbol.topLines.push(line);\n this.leftStart = true;\n symbol.topEnd = true;\n maxX = left.x;\n } else if ((origin === 'top')) {\n yOffset = Math.max(symbol.topLines.length, this.topLines.length) * 10;\n line = drawLine(this.chart, top, [\n {x: top.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.topLines.push(line);\n symbol.topLines.push(line);\n this.topStart = true;\n symbol.topEnd = true;\n maxX = top.x;\n }\n\n //update line style\n if (this.lineStyle[symbol.key] && line){\n line.attr(this.lineStyle[symbol.key]);\n }\n\n if (line) {\n for (var l = 0, llen = this.chart.lines.length; l < llen; l++) {\n var otherLine = this.chart.lines[l];\n\n var ePath = otherLine.attr('path'),\n lPath = line.attr('path');\n\n for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) {\n var newPath = [];\n newPath.push(['M', ePath[iP][1], ePath[iP][2]]);\n newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]);\n\n var line1_from_x = newPath[0][1];\n var line1_from_y = newPath[0][2];\n var line1_to_x = newPath[1][1];\n var line1_to_y = newPath[1][2];\n\n for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) {\n var newLinePath = [];\n newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]);\n newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]);\n\n var line2_from_x = newLinePath[0][1];\n var line2_from_y = newLinePath[0][2];\n var line2_to_x = newLinePath[1][1];\n var line2_to_y = newLinePath[1][2];\n\n var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y);\n if (res.onLine1 && res.onLine2) {\n\n var newSegment;\n if (line2_from_y === line2_to_y) {\n if (line2_from_x > line2_to_x) {\n newSegment = ['L', res.x + lineWith * 2, line2_from_y];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n } else {\n newSegment = ['L', res.x - lineWith * 2, line2_from_y];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n }\n } else {\n if (line2_from_y > line2_to_y) {\n newSegment = ['L', line2_from_x, res.y + lineWith * 2];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n } else {\n newSegment = ['L', line2_from_x, res.y - lineWith * 2];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n }\n }\n\n lP += 2;\n }\n }\n }\n }\n\n this.chart.lines.push(line);\n if (this.chart.minXFromSymbols === undefined || this.chart.minXFromSymbols > left.x) {\n this.chart.minXFromSymbols = left.x;\n }\n }\n\n if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) {\n this.chart.maxXFromLine = maxX;\n }\n};\n\nmodule.exports = Symbol;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.js\n// module id = 2\n// module chunks = 0","function drawPath(chart, location, points) {\n var i, len;\n var path = 'M{0},{1}';\n for (i = 2, len = 2 * points.length + 2; i < len; i+=2) {\n path += ' L{' + i + '},{' + (i + 1) + '}';\n }\n var pathValues = [location.x, location.y];\n for (i = 0, len = points.length; i < len; i++) {\n pathValues.push(points[i].x);\n pathValues.push(points[i].y);\n }\n var symbol = chart.paper.path(path, pathValues);\n symbol.attr('stroke', chart.options['element-color']);\n symbol.attr('stroke-width', chart.options['line-width']);\n\n var font = chart.options.font;\n var fontF = chart.options['font-family'];\n var fontW = chart.options['font-weight'];\n\n if (font) symbol.attr({ 'font': font });\n if (fontF) symbol.attr({ 'font-family': fontF });\n if (fontW) symbol.attr({ 'font-weight': fontW });\n\n return symbol;\n}\n\nfunction drawLine(chart, from, to, text) {\n var i, len;\n\n if (Object.prototype.toString.call(to) !== '[object Array]') {\n to = [to];\n }\n\n var path = 'M{0},{1}';\n for (i = 2, len = 2 * to.length + 2; i < len; i+=2) {\n path += ' L{' + i + '},{' + (i + 1) + '}';\n }\n var pathValues = [from.x, from.y];\n for (i = 0, len = to.length; i < len; i++) {\n pathValues.push(to[i].x);\n pathValues.push(to[i].y);\n }\n\n var line = chart.paper.path(path, pathValues);\n line.attr({\n stroke: chart.options['line-color'],\n 'stroke-width': chart.options['line-width'],\n 'arrow-end': chart.options['arrow-end']\n });\n\n var font = chart.options.font;\n var fontF = chart.options['font-family'];\n var fontW = chart.options['font-weight'];\n\n if (font) line.attr({ 'font': font });\n if (fontF) line.attr({ 'font-family': fontF });\n if (fontW) line.attr({ 'font-weight': fontW });\n\n if (text) {\n\n var centerText = false;\n\n var textPath = chart.paper.text(0, 0, text);\n var textAnchor = 'start';\n\n var isHorizontal = false;\n var firstTo = to[0];\n\n if (from.y === firstTo.y) {\n isHorizontal = true;\n }\n\n var x = 0,\n y = 0;\n\n if (centerText) {\n if (from.x > firstTo.x) {\n x = from.x - (from.x - firstTo.x)/2;\n } else {\n x = firstTo.x - (firstTo.x - from.x)/2;\n }\n\n if (from.y > firstTo.y) {\n y = from.y - (from.y - firstTo.y)/2;\n } else {\n y = firstTo.y - (firstTo.y - from.y)/2;\n }\n\n if (isHorizontal) {\n x -= textPath.getBBox().width/2;\n y -= chart.options['text-margin'];\n } else {\n x += chart.options['text-margin'];\n y -= textPath.getBBox().height/2;\n }\n } else {\n x = from.x;\n y = from.y;\n\n if (isHorizontal) {\n if (from.x > firstTo.x) {\n x -= chart.options['text-margin']/2;\n textAnchor = 'end';\n } else {\n x += chart.options['text-margin']/2;\n }\n y -= chart.options['text-margin'];\n } else {\n x += chart.options['text-margin']/2;\n y += chart.options['text-margin'];\n if (from.y > firstTo.y) {\n y -= chart.options['text-margin']*2;\n }\n }\n }\n\n textPath.attr({\n 'text-anchor': textAnchor,\n 'font-size': chart.options['font-size'],\n 'fill': chart.options['font-color'],\n x: x,\n y: y\n });\n\n if (font) textPath.attr({ 'font': font });\n if (fontF) textPath.attr({ 'font-family': fontF });\n if (fontW) textPath.attr({ 'font-weight': fontW });\n }\n\n return line;\n}\n\nfunction checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) {\n // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point\n var denominator, a, b, numerator1, numerator2, result = {\n x: null,\n y: null,\n onLine1: false,\n onLine2: false\n };\n denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY));\n if (denominator === 0) {\n return result;\n }\n a = line1StartY - line2StartY;\n b = line1StartX - line2StartX;\n numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b);\n numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b);\n a = numerator1 / denominator;\n b = numerator2 / denominator;\n\n // if we cast these lines infinitely in both directions, they intersect here:\n result.x = line1StartX + (a * (line1EndX - line1StartX));\n result.y = line1StartY + (a * (line1EndY - line1StartY));\n /*\n // it is worth noting that this should be the same as:\n x = line2StartX + (b * (line2EndX - line2StartX));\n y = line2StartX + (b * (line2EndY - line2StartY));\n */\n // if line1 is a segment and line2 is infinite, they intersect if:\n if (a > 0 && a < 1) {\n result.onLine1 = true;\n }\n // if line2 is a segment and line1 is infinite, they intersect if:\n if (b > 0 && b < 1) {\n result.onLine2 = true;\n }\n // if line1 and line2 are segments, they intersect if both of the above are true\n return result;\n}\n\nmodule.exports = {\n\tdrawPath: drawPath,\n\tdrawLine: drawLine,\n\tcheckLineIntersection: checkLineIntersection\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.functions.js\n// module id = 3\n// module chunks = 0","var FlowChart = require('./flowchart.chart');\nvar Start = require('./flowchart.symbol.start');\nvar End = require('./flowchart.symbol.end');\nvar Operation = require('./flowchart.symbol.operation');\nvar InputOutput = require('./flowchart.symbol.inputoutput');\nvar Input = require('./flowchart.symbol.input'); //tds\nvar Output = require('./flowchart.symbol.output'); //tds\nvar Subroutine = require('./flowchart.symbol.subroutine');\nvar Condition = require('./flowchart.symbol.condition');\nvar Parallel = require('./flowchart.symbol.parallel');\n\n\nfunction parse(input) {\n input = input || '';\n input = input.trim();\n\n var chart = {\n symbols: {},\n start: null,\n drawSVG: function(container, options) {\n var self = this;\n\n if (this.diagram) {\n this.diagram.clean();\n }\n\n var diagram = new FlowChart(container, options);\n this.diagram = diagram;\n var dispSymbols = {};\n\n function getDisplaySymbol(s) {\n if (dispSymbols[s.key]) {\n return dispSymbols[s.key];\n }\n\n switch (s.symbolType) {\n case 'start':\n dispSymbols[s.key] = new Start(diagram, s);\n break;\n case 'end':\n dispSymbols[s.key] = new End(diagram, s);\n break;\n case 'operation':\n dispSymbols[s.key] = new Operation(diagram, s);\n break;\n case 'inputoutput':\n dispSymbols[s.key] = new InputOutput(diagram, s);\n break;\n case 'input':\n dispSymbols[s.key] = new Input(diagram, s); //tds\n break; \n case 'output':\n dispSymbols[s.key] = new Output(diagram, s); //tds\n break; \n case 'subroutine':\n dispSymbols[s.key] = new Subroutine(diagram, s);\n break;\n case 'condition':\n dispSymbols[s.key] = new Condition(diagram, s);\n break;\n case 'parallel':\n dispSymbols[s.key] = new Parallel(diagram, s);\n break;\n default:\n return new Error('Wrong symbol type!');\n }\n\n return dispSymbols[s.key];\n }\n\n (function constructChart(s, prevDisp, prev) {\n var dispSymb = getDisplaySymbol(s);\n\n if (self.start === s) {\n diagram.startWith(dispSymb);\n } else if (prevDisp && prev && !prevDisp.pathOk) {\n if (prevDisp instanceof(Condition)) {\n if (prev.yes === s) {\n prevDisp.yes(dispSymb);\n }\n if (prev.no === s) {\n prevDisp.no(dispSymb);\n }\n } else if (prevDisp instanceof(Parallel)) {\n if (prev.path1 === s) {\n prevDisp.path1(dispSymb);\n }\n if (prev.path2 === s) {\n prevDisp.path2(dispSymb);\n }\n if (prev.path3 === s) {\n prevDisp.path3(dispSymb);\n }\n } else {\n prevDisp.then(dispSymb);\n }\n }\n\n if (dispSymb.pathOk) {\n return dispSymb;\n }\n\n if (dispSymb instanceof(Condition)) {\n if (s.yes) {\n constructChart(s.yes, dispSymb, s);\n }\n if (s.no) {\n constructChart(s.no, dispSymb, s);\n }\n } else if (dispSymb instanceof(Parallel)) {\n if (s.path1) {\n constructChart(s.path1, dispSymb, s);\n }\n if (s.path2) {\n constructChart(s.path2, dispSymb, s);\n }\n if (s.path3) {\n constructChart(s.path3, dispSymb, s);\n }\n } else if (s.next) {\n constructChart(s.next, dispSymb, s);\n }\n\n return dispSymb;\n })(this.start);\n\n diagram.render();\n },\n clean: function() {\n this.diagram.clean();\n },\n options: function() {\n return this.diagram.options;\n }\n };\n\n var lines = [];\n var prevBreak = 0;\n for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) {\n if(input[i0] === '\\n' && input[i0 - 1] !== '\\\\') {\n var line0 = input.substring(prevBreak, i0);\n prevBreak = i0 + 1;\n lines.push(line0.replace(/\\\\\\n/g, '\\n'));\n }\n }\n\n if (prevBreak < input.length) {\n lines.push(input.substr(prevBreak));\n }\n\n for (var l = 1, len = lines.length; l < len;) {\n var currentLine = lines[l];\n\n if (currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0 && currentLine.indexOf('@>') < 0) {\n lines[l - 1] += '\\n' + currentLine;\n lines.splice(l, 1);\n len--;\n } else {\n l++;\n }\n }\n\n function getStyle(s){\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n return s.substring(startIndex,endIndex);\n }\n return '{}';\n }\n\n function getSymbValue(s){\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n return s.substring(startIndex,endIndex);\n }\n return '';\n }\n\n function getSymbol(s) {\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n return chart.symbols[s.substring(0, startIndex - 1)];\n }\n return chart.symbols[s];\n }\n\n function getNextPath(s) {\n var next = 'next';\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n next = flowSymb.substring(startIndex, endIndex);\n if (next.indexOf(',') < 0) {\n if (next !== 'yes' && next !== 'no') {\n next = 'next, ' + next;\n }\n }\n }\n return next;\n }\n \n function getAnnotation(s) {\n\tvar startIndex = s.indexOf(\"(\") + 1, endIndex = s.indexOf(\")\");\n\tvar tmp = s.substring(startIndex, endIndex);\n\tif(tmp.indexOf(\",\") > 0) { tmp = tmp.substring(0, tmp.indexOf(\",\")); }\n\tvar tmp_split = tmp.split(\"@\");\n\tif(tmp_split.length > 1)\n\t\treturn startIndex >= 0 && endIndex >= 0 ? tmp_split[1] : \"\";\n }\n\n while (lines.length > 0) {\n var line = lines.splice(0, 1)[0].trim();\n\n if (line.indexOf('=>') >= 0) {\n // definition\n var parts = line.split('=>');\n var symbol = {\n key: parts[0].replace(/\\(.*\\)/, ''),\n symbolType: parts[1],\n text: null,\n link: null,\n target: null,\n flowstate: null,\n function: null,\n lineStyle: {},\n params: {}\n };\n\n //parse parameters\n var params = parts[0].match(/\\((.*)\\)/);\n if (params && params.length > 1){\n var entries = params[1].split(',');\n for(var i = 0; i < entries.length; i++) {\n var entry = entries[i].split('=');\n if (entry.length == 2) {\n symbol.params[entry[0]] = entry[1];\n }\n }\n }\n\n var sub;\n\n if (symbol.symbolType.indexOf(': ') >= 0) {\n sub = symbol.symbolType.split(': ');\n symbol.symbolType = sub.shift();\n symbol.text = sub.join(': ');\n }\n\n if (symbol.text && symbol.text.indexOf(':$') >= 0) {\n sub = symbol.text.split(':$');\n symbol.text = sub.shift();\n symbol.function = sub.join(':$');\n } else if (symbol.symbolType.indexOf(':$') >= 0) {\n sub = symbol.symbolType.split(':$');\n symbol.symbolType = sub.shift();\n symbol.function = sub.join(':$');\n } else if (symbol.text && symbol.text.indexOf(':>') >= 0) {\n sub = symbol.text.split(':>');\n symbol.text = sub.shift();\n symbol.link = sub.join(':>');\n } else if (symbol.symbolType.indexOf(':>') >= 0) {\n sub = symbol.symbolType.split(':>');\n symbol.symbolType = sub.shift();\n symbol.link = sub.join(':>');\n }\n\n if (symbol.symbolType.indexOf('\\n') >= 0) {\n symbol.symbolType = symbol.symbolType.split('\\n')[0];\n }\n\n /* adding support for links */\n if (symbol.link) {\n var startIndex = symbol.link.indexOf('[') + 1;\n var endIndex = symbol.link.indexOf(']');\n if (startIndex >= 0 && endIndex >= 0) {\n symbol.target = symbol.link.substring(startIndex, endIndex);\n symbol.link = symbol.link.substring(0, startIndex - 1);\n }\n }\n /* end of link support */\n\n /* adding support for flowstates */\n if (symbol.text) {\n if (symbol.text.indexOf('|') >= 0) {\n var txtAndState = symbol.text.split('|');\n symbol.flowstate = txtAndState.pop().trim();\n symbol.text = txtAndState.join('|');\n }\n }\n /* end of flowstate support */\n\n chart.symbols[symbol.key] = symbol;\n\n } else if (line.indexOf('->') >= 0) {\n var ann = getAnnotation(line);\n if (ann) {\n line = line.replace('@' + ann, ''); \n }\n // flow\n var flowSymbols = line.split('->');\n for (var iS = 0, lenS = flowSymbols.length; iS < lenS; iS++) {\n var flowSymb = flowSymbols[iS];\n var symbVal = getSymbValue(flowSymb);\n\n if (symbVal === 'true' || symbVal === 'false') {\n // map true or false to yes or no respectively\n flowSymb = flowSymb.replace('true', 'yes');\n flowSymb = flowSymb.replace('false', 'no');\n }\n \n var next = getNextPath(flowSymb);\n var realSymb = getSymbol(flowSymb);\n\n var direction = null;\n if (next.indexOf(',') >= 0) {\n var condOpt = next.split(',');\n next = condOpt[0];\n direction = condOpt[1].trim();\n }\n\n if (ann) {\n if (realSymb.symbolType === 'condition') {\n if (next === \"yes\" || next === \"true\") {\n realSymb.yes_annotation = ann;\n } else {\n realSymb.no_annotation = ann;\n }\n } else if (realSymb.symbolType === 'parallel') {\n if (next === 'path1') {\n realSymb.path1_annotation = ann;\n } else if (next === 'path2') {\n realSymb.path2_annotation = ann;\n } else if (next === 'path3') {\n realSymb.path3_annotation = ann;\n }\n }\n ann = null;\n }\n\n if (!chart.start) {\n chart.start = realSymb;\n }\n\n if (iS + 1 < lenS) {\n var nextSymb = flowSymbols[iS + 1];\n realSymb[next] = getSymbol(nextSymb);\n realSymb['direction_' + next] = direction;\n direction = null;\n }\n }\n } else if (line.indexOf('@>') >= 0) {\n\n // line style\n var lineStyleSymbols = line.split('@>');\n for (var iSS = 0, lenSS = lineStyleSymbols.length; iSS < lenSS; iSS++) {\n if ((iSS + 1) !== lenSS) {\n var curSymb = getSymbol(lineStyleSymbols[iSS]);\n var nextSymbol = getSymbol(lineStyleSymbols[iSS+1]);\n\n curSymb['lineStyle'][nextSymbol.key] = JSON.parse(getStyle(lineStyleSymbols[iSS + 1]));\n }\n }\n }\n\n }\n return chart;\n}\n\nmodule.exports = parse;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.parse.js\n// module id = 4\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction Condition(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.yes_annotation = options.yes_annotation;\n this.no_annotation = options.no_annotation;\n this.textMargin = this.getAttr('text-margin');\n this.yes_direction = options.direction_yes;\n this.no_direction = options.direction_no;\n if (!this.no_direction && this.yes_direction === 'right') {\n this.no_direction = 'bottom';\n } else if (!this.yes_direction && this.no_direction === 'bottom') {\n this.yes_direction = 'right'\n }\n this.yes_direction = this.yes_direction || 'bottom';\n this.no_direction = this.no_direction || 'right';\n\n this.text.attr({\n x: this.textMargin * 2\n });\n\n var width = this.text.getBBox().width + 3 * this.textMargin;\n width += width/2;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n height += height/2;\n height = Math.max(width * 0.5, height);\n var startX = width/4;\n var startY = height/4;\n\n this.text.attr({\n x: startX + this.textMargin/2\n });\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - width/4, y: startY + height/4},\n {x: startX - width/4 + width/2, y: startY + height/4 + height/2},\n {x: startX - width/4 + width, y: startY + height/4},\n {x: startX - width/4 + width/2, y: startY + height/4 - height/2},\n {x: startX - width/4, y: startY + height/4}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n this.symbol = symbol\n\n this.initialize();\n}\ninherits(Condition, Symbol);\n\nCondition.prototype.render = function() {\n var self = this;\n if (this.yes_direction) {\n this[this.yes_direction + '_symbol'] = this.yes_symbol;\n }\n\n if (this.no_direction) {\n this[this.no_direction + '_symbol'] = this.no_symbol;\n }\n\n var lineLength = this.getAttr('line-length');\n\n if (this.bottom_symbol) {\n var bottomPoint = this.getBottom();\n\n if (!this.bottom_symbol.isPositioned) {\n this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2);\n this.bottom_symbol.isPositioned = true;\n\n this.bottom_symbol.render();\n }\n }\n\n if (this.right_symbol) {\n var rightPoint = this.getRight();\n\n if (!this.right_symbol.isPositioned) {\n\n this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2);\n this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n if (!self.params['align-next'] || self.params['align-next'] !== 'no') { \n var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) {\n hasSymbolUnder = true;\n break;\n }\n }\n }\n\n if (hasSymbolUnder) {\n if (self.right_symbol.symbolType === 'end') return;\n self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.right_symbol.isPositioned = true;\n\n this.right_symbol.render();\n }\n }\n \n if (this.left_symbol) {\n var leftPoint = this.getLeft();\n \n if (!this.left_symbol.isPositioned) {\n this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2);\n this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n \n if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x);\n if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) {\n hasSymbolUnder = true;\n break;\n }\n }\n }\n \n if (hasSymbolUnder) {\n if (self.left_symbol.symbolType === 'end') return;\n self.left_symbol.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n \n this.left_symbol.isPositioned = true;\n \n this.left_symbol.render();\n }\n }\n};\n\nCondition.prototype.renderLines = function() {\n if (this.yes_symbol) {\n this.drawLineTo(this.yes_symbol, this.yes_annotation ? this.yes_annotation : this.getAttr('yes-text'), this.yes_direction);\n }\n\n if (this.no_symbol) {\n this.drawLineTo(this.no_symbol, this.no_annotation ? this.no_annotation : this.getAttr('no-text'), this.no_direction);\n }\n};\n\nmodule.exports = Condition;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.condition.js\n// module id = 5\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Parallel(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0);\n options = options || {};\n Symbol.call(this, chart, options, symbol);\n this.path1_annotation = options.path1_annotation || '';\n this.path2_annotation = options.path2_annotation || '';\n this.path3_annotation = options.path3_annotation || '';\n this.textMargin = this.getAttr('text-margin');\n this.path1_direction = 'bottom';\n this.path2_direction = 'right';\n this.path3_direction = 'top';\n this.params = options.params;\n if (options.direction_next === 'path1' && !options[options.direction_next] && options.next) {\n options[options.direction_next] = options.next;\n }\n if (options.direction_next === 'path2' && !options[options.direction_next] && options.next) {\n options[options.direction_next] = options.next;\n }\n if (options.direction_next === 'path3' && !options[options.direction_next] && options.next) {\n options[options.direction_next] = options.next;\n }\n\n if (options.path1 && options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && !options.direction_path3) {\n if (options.direction_path1 === 'right') {\n this.path2_direction = 'bottom';\n this.path1_direction = 'right';\n this.path3_direction = 'top';\n } else if (options.direction_path1 === 'top') {\n this.path2_direction = 'right';\n this.path1_direction = 'top';\n this.path3_direction = 'bottom';\n } else if (options.direction_path1 === 'left') {\n this.path2_direction = 'right';\n this.path1_direction = 'left';\n this.path3_direction = 'bottom';\n } else {\n this.path2_direction = 'right';\n this.path1_direction = 'bottom';\n this.path3_direction = 'top';\n }\n } else if (options.path1 && !options.direction_path1 && options.path2 && options.direction_path2 && options.path3 && !options.direction_path3) {\n if (options.direction_path2 === 'right') {\n this.path1_direction = 'bottom';\n this.path2_direction = 'right';\n this.path3_direction = 'top';\n } else if (options.direction_path2 === 'left') {\n this.path1_direction = 'bottom';\n this.path2_direction = 'left';\n this.path3_direction = 'right';\n } else {\n this.path1_direction = 'right';\n this.path2_direction = 'bottom';\n this.path3_direction = 'top';\n }\n } else if (options.path1 && !options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && options.direction_path3) {\n if (options.direction_path2 === 'right') {\n this.path1_direction = 'bottom';\n this.path2_direction = 'top';\n this.path3_direction = 'right';\n } else if (options.direction_path2 === 'left') {\n this.path1_direction = 'bottom';\n this.path2_direction = 'right';\n this.path3_direction = 'left';\n } else {\n this.path1_direction = 'right';\n this.path2_direction = 'bottom';\n this.path3_direction = 'top';\n }\n } else {\n this.path1_direction = options.direction_path1;\n this.path2_direction = options.direction_path2;\n this.path3_direction = options.direction_path3;\n }\n\n this.path1_direction = this.path1_direction || 'bottom';\n this.path2_direction = this.path2_direction || 'right';\n this.path3_direction = this.path3_direction || 'top';\n\n this.initialize();\n}\ninherits(Parallel, Symbol);\n\nParallel.prototype.render = function() {\n if (this.path1_direction) {\n this[this.path1_direction + '_symbol'] = this.path1_symbol;\n }\n\n if (this.path2_direction) {\n this[this.path2_direction + '_symbol'] = this.path2_symbol;\n }\n\n if (this.path3_direction) {\n this[this.path3_direction + '_symbol'] = this.path3_symbol;\n }\n\n var lineLength = this.getAttr('line-length');\n\n if (this.bottom_symbol) {\n var bottomPoint = this.getBottom();\n\n if (!this.bottom_symbol.isPositioned) {\n this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width / 2);\n this.bottom_symbol.isPositioned = true;\n\n this.bottom_symbol.render();\n }\n }\n\n if (this.top_symbol) {\n var topPoint = this.getTop();\n\n if (!this.top_symbol.isPositioned) {\n this.top_symbol.shiftY(this.getY() - this.top_symbol.height - lineLength);\n this.top_symbol.setX(topPoint.x + this.top_symbol.width);\n this.top_symbol.isPositioned = true;\n\n this.top_symbol.render();\n }\n }\n\n var self = this;\n\n if (this.left_symbol) {\n var leftPoint = this.getLeft();\n\n if (!this.left_symbol.isPositioned) {\n this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2);\n this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x);\n if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) {\n hasSymbolUnder = true;\n break;\n }\n }\n }\n\n if (hasSymbolUnder) {\n if (self.left_symbol.symbolType === 'end') return;\n self.left_symbol.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.left_symbol.isPositioned = true;\n\n this.left_symbol.render();\n }\n }\n\n if (this.right_symbol) {\n var rightPoint = this.getRight();\n\n if (!this.right_symbol.isPositioned) {\n this.right_symbol.setY(rightPoint.y - this.right_symbol.height / 2);\n this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width / 2) {\n hasSymbolUnder = true;\n break;\n }\n }\n }\n\n if (hasSymbolUnder) {\n if (self.right_symbol.symbolType === 'end') return;\n self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.right_symbol.isPositioned = true;\n\n this.right_symbol.render();\n }\n }\n};\n\nParallel.prototype.renderLines = function() {\n if (this.path1_symbol) {\n this.drawLineTo(this.path1_symbol, this.path1_annotation, this.path1_direction);\n }\n\n if (this.path2_symbol) {\n this.drawLineTo(this.path2_symbol, this.path2_annotation, this.path2_direction);\n }\n\n if (this.path3_symbol) {\n this.drawLineTo(this.path3_symbol, this.path3_annotation, this.path3_direction);\n }\n};\n\nmodule.exports = Parallel;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.parallel.js\n// module id = 6\n// module chunks = 0","var Raphael = require('raphael');\nvar defaults = require('./flowchart.helpers').defaults;\nvar defaultOptions = require('./flowchart.defaults');\nvar Condition = require('./flowchart.symbol.condition');\nvar Parallel = require('./flowchart.symbol.parallel');\n\nfunction FlowChart(container, options) {\n options = options || {};\n\n this.paper = new Raphael(container);\n\n this.options = defaults(options, defaultOptions);\n\n this.symbols = [];\n this.lines = [];\n this.start = null;\n}\n\nFlowChart.prototype.handle = function(symbol) {\n if (this.symbols.indexOf(symbol) <= -1) {\n this.symbols.push(symbol);\n }\n\n var flowChart = this;\n\n if (symbol instanceof(Condition)) {\n symbol.yes = function(nextSymbol) {\n symbol.yes_symbol = nextSymbol;\n if(symbol.no_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n symbol.no = function(nextSymbol) {\n symbol.no_symbol = nextSymbol;\n if (symbol.yes_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n } else if (symbol instanceof(Parallel)) {\n symbol.path1 = function(nextSymbol) {\n symbol.path1_symbol = nextSymbol;\n if (symbol.path2_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n symbol.path2 = function(nextSymbol) {\n symbol.path2_symbol = nextSymbol;\n if (symbol.path3_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n symbol.path3 = function(nextSymbol) {\n symbol.path3_symbol = nextSymbol;\n if (symbol.path1_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n } else {\n symbol.then = function(nextSymbol) {\n symbol.next = nextSymbol;\n symbol.pathOk = true;\n return flowChart.handle(nextSymbol);\n };\n }\n\n return symbol;\n};\n\nFlowChart.prototype.startWith = function(symbol) {\n this.start = symbol;\n return this.handle(symbol);\n};\n\nFlowChart.prototype.render = function() {\n var maxWidth = 0,\n maxHeight = 0,\n i = 0,\n len = 0,\n maxX = 0,\n maxY = 0,\n minX = 0,\n minY = 0,\n symbol,\n line;\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n if (symbol.width > maxWidth) {\n maxWidth = symbol.width;\n }\n if (symbol.height > maxHeight) {\n maxHeight = symbol.height;\n }\n }\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']);\n symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']);\n }\n\n this.start.render();\n // for (i = 0, len = this.symbols.length; i < len; i++) {\n // symbol = this.symbols[i];\n // symbol.render();\n // }\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n symbol.renderLines();\n }\n\n maxX = this.maxXFromLine;\n\n var x;\n var y;\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n var leftX = symbol.getX()\n x = leftX + symbol.width;\n y = symbol.getY() + symbol.height;\n if (leftX < minX) {\n minX = leftX;\n }\n if (x > maxX) {\n maxX = x;\n }\n if (y > maxY) {\n maxY = y;\n }\n }\n\n for (i = 0, len = this.lines.length; i < len; i++) {\n line = this.lines[i].getBBox();\n x = line.x;\n y = line.y;\n var x2 = line.x2;\n var y2 = line.y2;\n if (x < minX) {\n minX = x;\n }\n if (y < minY) {\n minY = y;\n }\n if (x2 > maxX) {\n maxX = x2;\n }\n if (y2 > maxY) {\n maxY = y2;\n }\n }\n\n var scale = this.options['scale'];\n var lineWidth = this.options['line-width'];\n\n if (this.minXFromSymbols < minX) minX = this.minXFromSymbols;\n\n if (minX < 0) minX -= lineWidth;\n if (minY < 0) minY -= lineWidth;\n\n var width = maxX + lineWidth - minX;\n var height = maxY + lineWidth - minY;\n\n this.paper.setSize(width * scale, height * scale);\n this.paper.setViewBox(minX, minY, width, height, true);\n};\n\nFlowChart.prototype.clean = function() {\n if (this.paper) {\n var paperDom = this.paper.canvas;\n paperDom.parentNode && paperDom.parentNode.removeChild(paperDom);\n }\n};\n\nmodule.exports = FlowChart;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.chart.js\n// module id = 7\n// module chunks = 0","// defaults\nmodule.exports = {\n 'x': 0,\n 'y': 0,\n // 'roundness': 0,\n 'line-width': 3,\n 'line-length': 50,\n 'text-margin': 10,\n 'font-size': 14,\n 'font-color': 'black',\n // 'font': 'normal',\n // 'font-family': 'calibri',\n // 'font-weight': 'normal',\n 'line-color': 'black',\n 'element-color': 'black',\n 'fill': 'white',\n 'yes-text': 'yes',\n 'no-text': 'no',\n 'arrow-end': 'block',\n 'class': 'flowchart',\n 'scale': 1,\n 'symbols': {\n 'start': {},\n 'end': {},\n 'condition': {},\n 'inputoutput': {},\n 'input': {}, //tds\n 'output': {}, //tds \n 'operation': {},\n 'subroutine': {},\n 'parallel': {}\n } //,\n // 'flowstate' : {\n // 'past' : { 'fill': '#CCCCCC', 'font-size': 12},\n // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'},\n // 'future' : { 'fill': '#FFFF99'},\n // 'invalid': {'fill': '#444444'}\n // }\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.defaults.js\n// module id = 8\n// module chunks = 0","// add indexOf to non ECMA-262 standard compliant browsers\nif (!Array.prototype.indexOf) {\n Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {\n \"use strict\";\n if (this === null) {\n throw new TypeError();\n }\n var t = Object(this);\n var len = t.length >>> 0;\n if (len === 0) {\n return -1;\n }\n var n = 0;\n if (arguments.length > 0) {\n n = Number(arguments[1]);\n if (n != n) { // shortcut for verifying if it's NaN\n n = 0;\n } else if (n !== 0 && n != Infinity && n != -Infinity) {\n n = (n > 0 || -1) * Math.floor(Math.abs(n));\n }\n }\n if (n >= len) {\n return -1;\n }\n var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);\n for (; k < len; k++) {\n if (k in t && t[k] === searchElement) {\n return k;\n }\n }\n return -1;\n };\n}\n\n// add lastIndexOf to non ECMA-262 standard compliant browsers\nif (!Array.prototype.lastIndexOf) {\n Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {\n \"use strict\";\n if (this === null) {\n throw new TypeError();\n }\n var t = Object(this);\n var len = t.length >>> 0;\n if (len === 0) {\n return -1;\n }\n var n = len;\n if (arguments.length > 1) {\n n = Number(arguments[1]);\n if (n != n) {\n n = 0;\n } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) {\n n = (n > 0 || -1) * Math.floor(Math.abs(n));\n }\n }\n var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);\n for (; k >= 0; k--) {\n if (k in t && t[k] === searchElement) {\n return k;\n }\n }\n return -1;\n };\n}\n\nif (!String.prototype.trim) {\n String.prototype.trim = function() {\n return this.replace(/^\\s+|\\s+$/g, '');\n };\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.shim.js\n// module id = 9\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction End(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n options = options || {};\n options.text = options.text || 'End';\n Symbol.call(this, chart, options, symbol);\n}\ninherits(End, Symbol);\n\nmodule.exports = End;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.end.js\n// module id = 10\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction Input(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.textMargin = this.getAttr('text-margin');\n\n this.text.attr({\n x: this.textMargin * 3\n });\n\n var width = this.text.getBBox().width + 4 * this.textMargin;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n var startX = this.textMargin;\n var startY = height/2;\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - this.textMargin + 2 * this.textMargin, y: height},\n {x: startX - this.textMargin + width, y: height},\n {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n {x: startX - this.textMargin, y: 0},\n {x: startX, y: startY}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n this.symbol = symbol\n\n this.initialize();\n}\ninherits(Input, Symbol);\n\nInput.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.textMargin;\n return {x: x, y: y};\n};\n\nInput.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width - this.textMargin;\n return {x: x, y: y};\n};\n\nmodule.exports = Input;\n\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.input.js\n// module id = 11\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction InputOutput(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.textMargin = this.getAttr('text-margin');\n\n this.text.attr({\n x: this.textMargin * 3\n });\n\n var width = this.text.getBBox().width + 4 * this.textMargin;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n var startX = this.textMargin;\n var startY = height/2;\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - this.textMargin, y: height},\n {x: startX - this.textMargin + width, y: height},\n {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n {x: startX, y: startY}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n this.symbol = symbol\n\n this.initialize();\n}\ninherits(InputOutput, Symbol);\n\nInputOutput.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.textMargin;\n return {x: x, y: y};\n};\n\nInputOutput.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width - this.textMargin;\n return {x: x, y: y};\n};\n\nmodule.exports = InputOutput;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.inputoutput.js\n// module id = 12\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Operation(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0);\n options = options || {};\n Symbol.call(this, chart, options, symbol);\n}\ninherits(Operation, Symbol);\n\nmodule.exports = Operation;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.operation.js\n// module id = 13\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction Output(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.textMargin = this.getAttr('text-margin');\n\n this.text.attr({\n x: this.textMargin * 3\n });\n\n var width = this.text.getBBox().width + 4 * this.textMargin;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n var startX = this.textMargin;\n var startY = height/2;\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - this.textMargin, y: height},\n {x: startX - this.textMargin + width + 2 * this.textMargin, y: height},\n {x: startX - this.textMargin + width, y: 0},\n {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n {x: startX, y: startY}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n this.symbol = symbol\n\n this.initialize();\n}\ninherits(Output, Symbol);\n\nOutput.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.textMargin;\n return {x: x, y: y};\n};\n\nOutput.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width - this.textMargin;\n return {x: x, y: y};\n};\n\nmodule.exports = Output;\n\n\n\n/*\n//var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar InputOutput = require('./flowchart.symbol.inputoutput');\nvar drawPath = drawAPI.drawPath;\n\nfunction Output(chart, options) {\n options = options || {};\n InputOutput.call(this, chart, options);\n\n var width = this.text.getBBox().width + 4 * this.textMargin;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n var startX = this.textMargin;\n var startY = height/2;\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - this.textMargin + 2 * this.textMargin, y: height},\n {x: startX - this.textMargin + width, y: height},\n {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n {x: startX - this.textMargin, y: 0},\n {x: startX, y: startY}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n \n if (this.symbol){\n this.group.remove(this.symbol); //tds\n this.symbol.parentNode.removeChild(this.symbol); //tds\n }\n this.symbol = symbol\n\n this.initialize();\n}\ninherits(Output, InputOutput);\n\nmodule.exports = Output;\n*/\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.output.js\n// module id = 14\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Start(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n options = options || {};\n options.text = options.text || 'Start';\n Symbol.call(this, chart, options, symbol);\n}\ninherits(Start, Symbol);\n\nmodule.exports = Start;\n\n// Start.prototype.render = function() {\n// if (this.next) {\n// var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length'];\n\n// var bottomPoint = this.getBottom();\n// var topPoint = this.next.getTop();\n\n// if (!this.next.isPositioned) {\n// this.next.shiftY(this.getY() + this.height + lineLength);\n// this.next.setX(bottomPoint.x - this.next.width/2);\n// this.next.isPositioned = true;\n\n// this.next.render();\n// }\n// }\n// };\n\n// Start.prototype.renderLines = function() {\n// if (this.next) {\n// this.drawLineTo(this.next);\n// }\n// };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.start.js\n// module id = 15\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Subroutine(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0);\n options = options || {};\n Symbol.call(this, chart, options, symbol);\n\n symbol.attr({\n width: this.text.getBBox().width + 4 * this.getAttr('text-margin')\n });\n\n this.text.attr({\n 'x': 2 * this.getAttr('text-margin')\n });\n\n var innerWrap = chart.paper.rect(0, 0, 0, 0);\n innerWrap.attr({\n x: this.getAttr('text-margin'),\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n width: this.text.getBBox().width + 2 * this.getAttr('text-margin'),\n height: this.text.getBBox().height + 2 * this.getAttr('text-margin'),\n fill: this.getAttr('fill')\n });\n if (options.key) { innerWrap.node.id = options.key + 'i'; }\n\n var font = this.getAttr('font');\n var fontF = this.getAttr('font-family');\n var fontW = this.getAttr('font-weight');\n\n if (font) innerWrap.attr({ 'font': font });\n if (fontF) innerWrap.attr({ 'font-family': fontF });\n if (fontW) innerWrap.attr({ 'font-weight': fontW });\n\n if (options.link) { innerWrap.attr('href', options.link); }\n if (options.target) { innerWrap.attr('target', options.target); }\n this.group.push(innerWrap);\n innerWrap.insertBefore(this.text);\n\n this.initialize();\n}\ninherits(Subroutine, Symbol);\n\nmodule.exports = Subroutine;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.subroutine.js\n// module id = 16\n// module chunks = 0","if (typeof jQuery != 'undefined') {\n\tvar parse = require('./flowchart.parse');\n\n\t(function( $ ) {\n\t\tfunction paramFit(needle, haystack) {\n\t\t\treturn needle == haystack ||\n\t\t\t( Array.isArray(haystack) && (haystack.includes(needle) || haystack.includes(Number(needle)) ))\n\t\t}\n\t\tvar methods = {\n\t\t\tinit : function(options) {\n\t\t\t\treturn this.each(function() {\n\t\t\t\t\tvar $this = $(this);\n\t\t\t\t\tthis.chart = parse($this.text());\n\t\t\t\t\t$this.html('');\n\t\t\t\t\tthis.chart.drawSVG(this, options);\n\t\t\t\t});\n\t\t\t},\n\t\t\tsetFlowStateByParam : function(param, paramValue, newFlowState) {\n\t\t\t\treturn this.each(function() {\n\t\t\t\t\tvar chart = this.chart;\n\n\t\t\t\t\t// @todo this should be part of Symbol API\n\t\t\t\t\tvar nextSymbolKeys = ['next', 'yes', 'no', 'path1', 'path2', 'path3'];\n\n\t\t\t\t\tfor (var property in chart.symbols) {\n\t\t\t\t\t\tif (chart.symbols.hasOwnProperty(property)) {\n\t\t\t\t\t\t\tvar symbol = chart.symbols[property];\n\t\t\t\t\t\t\tvar val = symbol.params[param];\n\t\t\t\t\t\t\tif (paramFit(val, paramValue)) {\n\t\t\t\t\t\t\t\tsymbol.flowstate = newFlowState;\n\t\t\t\t\t\t\t\tfor (var nski = 0; nski < nextSymbolKeys.length; nski++) {\n\t\t\t\t\t\t\t\t\tvar nextSymbolKey = nextSymbolKeys[nski];\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey] &&\n\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey]['params'] &&\n\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey]['params'][param] &&\n\t\t\t\t\t\t\t\t\t\tparamFit(symbol[nextSymbolKey]['params'][param], paramValue)\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tsymbol.lineStyle[symbol[nextSymbolKey]['key']] = {stroke: chart.options()['flowstate'][newFlowState]['fill']};\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tchart.clean();\n\t\t\t\t\tchart.drawSVG(this);\n\t\t\t\t});\n\n\t\t\t},\n\t\t\tclearFlowState: function () {\n\t\t\t\treturn this.each(function() {\n\t\t\t\t\tvar chart = this.chart;\n\n\t\t\t\t\tfor (var property in chart.symbols) {\n\t\t\t\t\t\tif (chart.symbols.hasOwnProperty(property)) {\n\t\t\t\t\t\t\tvar node = chart.symbols[property];\n\t\t\t\t\t\t\tnode.flowstate = '';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tchart.clean();\n\t\t\t\t\tchart.drawSVG(this);\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$.fn.flowChart = function(methodOrOptions) {\n\t\t\tif ( methods[methodOrOptions] ) {\n\t\t\t\treturn methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));\n\t\t\t} else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {\n\t\t\t\t// Default to \"init\"\n\t\t\t\treturn methods.init.apply( this, arguments );\n\t\t\t} else {\n\t\t\t\t$.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.flowChart' );\n\t\t\t}\n\t\t};\n\n\t})(jQuery); // eslint-disable-line\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/jquery-plugin.js\n// module id = 17\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_18__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"Raphael\"\n// module id = 18\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/release/flowchart.min.js b/release/flowchart.min.js index 4040d63f..db7b2990 100644 --- a/release/flowchart.min.js +++ b/release/flowchart.min.js @@ -1,7 +1,8 @@ -// flowchart, v1.4.1 -// Copyright (c)2015 Adriano Raiano (adrai). +// flowchart.js, v1.18.0 +// Copyright (c)2023 Adriano Raiano (adrai). // Distributed under MIT license // http://adrai.github.io/flowchart.js -!function(){function a(b,c){if(!b||"function"==typeof b)return c;var d={};for(var e in c)d[e]=c[e];for(e in b)b[e]&&("object"==typeof d[e]?d[e]=a(d[e],b[e]):d[e]=b[e]);return d}function b(a,b){if("function"==typeof Object.create)a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});else{a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}}function c(a,b,c){var d,e,f="M{0},{1}";for(d=2,e=2*c.length+2;e>d;d+=2)f+=" L{"+d+"},{"+(d+1)+"}";var g=[b.x,b.y];for(d=0,e=c.length;e>d;d++)g.push(c[d].x),g.push(c[d].y);var h=a.paper.path(f,g);h.attr("stroke",a.options["element-color"]),h.attr("stroke-width",a.options["line-width"]);var i=a.options.font,j=a.options["font-family"],k=a.options["font-weight"];return i&&h.attr({font:i}),j&&h.attr({"font-family":j}),k&&h.attr({"font-weight":k}),h}function d(a,b,c,d){var e,f;"[object Array]"!==Object.prototype.toString.call(c)&&(c=[c]);var g="M{0},{1}";for(e=2,f=2*c.length+2;f>e;e+=2)g+=" L{"+e+"},{"+(e+1)+"}";var h=[b.x,b.y];for(e=0,f=c.length;f>e;e++)h.push(c[e].x),h.push(c[e].y);var i=a.paper.path(g,h);i.attr({stroke:a.options["line-color"],"stroke-width":a.options["line-width"],"arrow-end":a.options["arrow-end"]});var j=a.options.font,k=a.options["font-family"],l=a.options["font-weight"];if(j&&i.attr({font:j}),k&&i.attr({"font-family":k}),l&&i.attr({"font-weight":l}),d){var m=!1,n=a.paper.text(0,0,d),o=!1,p=c[0];b.y===p.y&&(o=!0);var q=0,r=0;m?(q=b.x>p.x?b.x-(b.x-p.x)/2:p.x-(p.x-b.x)/2,r=b.y>p.y?b.y-(b.y-p.y)/2:p.y-(p.y-b.y)/2,o?(q-=n.getBBox().width/2,r-=a.options["text-margin"]):(q+=a.options["text-margin"],r-=n.getBBox().height/2)):(q=b.x,r=b.y,o?(q+=a.options["text-margin"]/2,r-=a.options["text-margin"]):(q+=a.options["text-margin"]/2,r+=a.options["text-margin"])),n.attr({"text-anchor":"start","font-size":a.options["font-size"],fill:a.options["font-color"],x:q,y:r}),j&&n.attr({font:j}),k&&n.attr({"font-family":k}),l&&n.attr({"font-weight":l})}return i}function e(a,b,c,d,e,f,g,h){var i,j,k,l,m,n={x:null,y:null,onLine1:!1,onLine2:!1};return i=(h-f)*(c-a)-(g-e)*(d-b),0===i?n:(j=b-f,k=a-e,l=(g-e)*j-(h-f)*k,m=(c-a)*j-(d-b)*k,j=l/i,k=m/i,n.x=a+j*(c-a),n.y=b+j*(d-b),j>0&&1>j&&(n.onLine1=!0),k>0&&1>k&&(n.onLine2=!0),n)}function f(a,b){b=b||{},this.paper=new Raphael(a),this.options=r.defaults(b,q),this.symbols=[],this.lines=[],this.start=null}function g(a,b,c){this.chart=a,this.group=this.chart.paper.set(),this.symbol=c,this.connectedTo=[],this.symbolType=b.symbolType,this.flowstate=b.flowstate||"future",this.next_direction=b.next&&b.direction_next?b.direction_next:void 0,this.text=this.chart.paper.text(0,0,b.text),b.key&&(this.text.node.id=b.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 d=this.getAttr("font"),e=this.getAttr("font-family"),f=this.getAttr("font-weight");d&&this.text.attr({font:d}),e&&this.text.attr({"font-family":e}),f&&this.text.attr({"font-weight":f}),b.link&&this.text.attr("href",b.link),b.target&&this.text.attr("target",b.target);var g=this.getAttr("maxWidth");if(g){for(var h=b.text.split(" "),i="",j=0,k=h.length;k>j;j++){var l=h[j];this.text.attr("text",i+" "+l),i+=this.text.getBBox().width>g?"\n"+l:" "+l}this.text.attr("text",i.substring(1))}if(this.group.push(this.text),c){var m=this.getAttr("text-margin");c.attr({fill:this.getAttr("fill"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*m,height:this.text.getBBox().height+2*m}),c.node.setAttribute("class",this.getAttr("class")),b.link&&c.attr("href",b.link),b.target&&c.attr("target",b.target),b.key&&(c.node.id=b.key),this.group.push(c),c.insertBefore(this.text),this.text.attr({y:c.getBBox().height/2}),this.initialize()}}function h(a,b){var c=a.paper.rect(0,0,0,0,20);b=b||{},b.text=b.text||"Start",g.call(this,a,b,c)}function i(a,b){var c=a.paper.rect(0,0,0,0,20);b=b||{},b.text=b.text||"End",g.call(this,a,b,c)}function j(a,b){var c=a.paper.rect(0,0,0,0);b=b||{},g.call(this,a,b,c)}function k(a,b){var c=a.paper.rect(0,0,0,0);b=b||{},g.call(this,a,b,c),c.attr({width:this.text.getBBox().width+4*this.getAttr("text-margin")}),this.text.attr({x:2*this.getAttr("text-margin")});var d=a.paper.rect(0,0,0,0);d.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")}),b.key&&(d.node.id=b.key+"i");var e=this.getAttr("font"),f=this.getAttr("font-family"),h=this.getAttr("font-weight");e&&d.attr({font:e}),f&&d.attr({"font-family":f}),h&&d.attr({"font-weight":h}),b.link&&d.attr("href",b.link),b.target&&d.attr("target",b.target),this.group.push(d),d.insertBefore(this.text),this.initialize()}function l(a,b){b=b||{},g.call(this,a,b),this.textMargin=this.getAttr("text-margin"),this.text.attr({x:3*this.textMargin});var d=this.text.getBBox().width+4*this.textMargin,e=this.text.getBBox().height+2*this.textMargin,f=this.textMargin,h=e/2,i={x:f,y:h},j=[{x:f-this.textMargin,y:e},{x:f-this.textMargin+d,y:e},{x:f-this.textMargin+d+2*this.textMargin,y:0},{x:f-this.textMargin+2*this.textMargin,y:0},{x:f,y:h}],k=c(a,i,j);k.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),b.link&&k.attr("href",b.link),b.target&&k.attr("target",b.target),b.key&&(k.node.id=b.key),k.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:k.getBBox().height/2}),this.group.push(k),k.insertBefore(this.text),this.initialize()}function m(a,b){b=b||{},g.call(this,a,b),this.textMargin=this.getAttr("text-margin"),this.yes_direction="bottom",this.no_direction="right",b.yes&&b.direction_yes&&b.no&&!b.direction_no?"right"===b.direction_yes?(this.no_direction="bottom",this.yes_direction="right"):(this.no_direction="right",this.yes_direction="bottom"):b.yes&&!b.direction_yes&&b.no&&b.direction_no?"right"===b.direction_no?(this.yes_direction="bottom",this.no_direction="right"):(this.yes_direction="right",this.no_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 d=this.text.getBBox().width+3*this.textMargin;d+=d/2;var e=this.text.getBBox().height+2*this.textMargin;e+=e/2,e=Math.max(.5*d,e);var f=d/4,h=e/4;this.text.attr({x:f+this.textMargin/2});var i={x:f,y:h},j=[{x:f-d/4,y:h+e/4},{x:f-d/4+d/2,y:h+e/4+e/2},{x:f-d/4+d,y:h+e/4},{x:f-d/4+d/2,y:h+e/4-e/2},{x:f-d/4,y:h+e/4}],k=c(a,i,j);k.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),b.link&&k.attr("href",b.link),b.target&&k.attr("target",b.target),b.key&&(k.node.id=b.key),k.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:k.getBBox().height/2}),this.group.push(k),k.insertBefore(this.text),this.initialize()}function n(a){function b(a){var b=a.indexOf("(")+1,c=a.indexOf(")");return b>=0&&c>=0?d.symbols[a.substring(0,b-1)]:d.symbols[a]}function c(a){var b="next",c=a.indexOf("(")+1,d=a.indexOf(")");return c>=0&&d>=0&&(b=D.substring(c,d),b.indexOf(",")<0&&"yes"!==b&&"no"!==b&&(b="next, "+b)),b}a=a||"",a=a.trim();for(var d={symbols:{},start:null,drawSVG:function(a,b){function c(a){if(g[a.key])return g[a.key];switch(a.symbolType){case"start":g[a.key]=new h(e,a);break;case"end":g[a.key]=new i(e,a);break;case"operation":g[a.key]=new j(e,a);break;case"inputoutput":g[a.key]=new l(e,a);break;case"subroutine":g[a.key]=new k(e,a);break;case"condition":g[a.key]=new m(e,a);break;default:return new Error("Wrong symbol type!")}return g[a.key]}var d=this;this.diagram&&this.diagram.clean();var e=new f(a,b);this.diagram=e;var g={};!function n(a,b,f){var g=c(a);return d.start===a?e.startWith(g):b&&f&&!b.pathOk&&(b instanceof m?(f.yes===a&&b.yes(g),f.no===a&&b.no(g)):b.then(g)),g.pathOk?g:(g instanceof m?(a.yes&&n(a.yes,g,a),a.no&&n(a.no,g,a)):a.next&&n(a.next,g,a),g)}(this.start),e.render()},clean:function(){this.diagram.clean()}},e=[],g=0,n=1,o=a.length;o>n;n++)if("\n"===a[n]&&"\\"!==a[n-1]){var p=a.substring(g,n);g=n+1,e.push(p.replace(/\\\n/g,"\n"))}gq;){var s=e[q];s.indexOf(": ")<0&&s.indexOf("(")<0&&s.indexOf(")")<0&&s.indexOf("->")<0&&s.indexOf("=>")<0?(e[q-1]+="\n"+s,e.splice(q,1),r--):q++}for(;e.length>0;){var t=e.splice(0,1)[0];if(t.indexOf("=>")>=0){var u,v=t.split("=>"),w={key:v[0],symbolType:v[1],text:null,link:null,target:null,flowstate:null};if(w.symbolType.indexOf(": ")>=0&&(u=w.symbolType.split(": "),w.symbolType=u[0],w.text=u[1]),w.text&&w.text.indexOf(":>")>=0?(u=w.text.split(":>"),w.text=u[0],w.link=u[1]):w.symbolType.indexOf(":>")>=0&&(u=w.symbolType.split(":>"),w.symbolType=u[0],w.link=u[1]),w.symbolType.indexOf("\n")>=0&&(w.symbolType=w.symbolType.split("\n")[0]),w.link){var x=w.link.indexOf("[")+1,y=w.link.indexOf("]");x>=0&&y>=0&&(w.target=w.link.substring(x,y),w.link=w.link.substring(0,x-1))}if(w.text&&w.text.indexOf("|")>=0){var z=w.text.split("|");w.text=z[0],w.flowstate=z[1].trim()}d.symbols[w.key]=w}else if(t.indexOf("->")>=0)for(var A=t.split("->"),B=0,C=A.length;C>B;B++){var D=A[B],E=b(D),F=c(D),G=null;if(F.indexOf(",")>=0){var H=F.split(",");F=H[0],G=H[1].trim()}if(d.start||(d.start=E),C>B+1){var I=A[B+1];E[F]=b(I),E["direction_"+F]=G,G=null}}}return d}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(a){"use strict";if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=c;arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));for(var e=d>=0?Math.min(d,c-1):c-Math.abs(d);e>=0;e--)if(e in b&&b[e]===a)return e;return-1}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var o=this,p={};"undefined"!=typeof module&&module.exports?module.exports=p:o.flowchart=o.flowchart||p;var q={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:{}}},r={defaults:a,inherits:b};f.prototype.handle=function(a){this.symbols.indexOf(a)<=-1&&this.symbols.push(a);var b=this;return a instanceof m?(a.yes=function(c){return a.yes_symbol=c,a.no_symbol&&(a.pathOk=!0),b.handle(c)},a.no=function(c){return a.no_symbol=c,a.yes_symbol&&(a.pathOk=!0),b.handle(c)}):a.then=function(c){return a.next=c,a.pathOk=!0,b.handle(c)},a},f.prototype.startWith=function(a){return this.start=a,this.handle(a)},f.prototype.render=function(){var a,b=0,c=0,d=0,e=0,f=0,g=0;for(d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.width>b&&(b=a.width),a.height>c&&(c=a.height);for(d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.shiftX(this.options.x+(b-a.width)/2+this.options["line-width"]),a.shiftY(this.options.y+(c-a.height)/2+this.options["line-width"]);for(this.start.render(),d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.renderLines();for(f=this.maxXFromLine,d=0,e=this.symbols.length;e>d;d++){a=this.symbols[d];var h=a.getX()+a.width,i=a.getY()+a.height;h>f&&(f=h),i>g&&(g=i)}var j=this.options.scale,k=this.options["line-width"];this.paper.setSize(f*j+k*j,g*j+k*j),this.paper.setViewBox(0,0,f+k,g+k,!0)},f.prototype.clean=function(){if(this.paper){var a=this.paper.canvas;a.parentNode.removeChild(a)}},g.prototype.getAttr=function(a){if(!this.chart)return void 0;var b,c=this.chart.options?this.chart.options[a]:void 0,d=this.chart.options.symbols?this.chart.options.symbols[this.symbolType][a]:void 0;return this.chart.options.flowstate&&this.chart.options.flowstate[this.flowstate]&&(b=this.chart.options.flowstate[this.flowstate][a]),b||d||c},g.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},g.prototype.getCenter=function(){return{x:this.getX()+this.width/2,y:this.getY()+this.height/2}},g.prototype.getX=function(){return this.group.getBBox().x},g.prototype.getY=function(){return this.group.getBBox().y},g.prototype.shiftX=function(a){this.group.transform("t"+(this.getX()+a)+","+this.getY())},g.prototype.setX=function(a){this.group.transform("t"+a+","+this.getY())},g.prototype.shiftY=function(a){this.group.transform("t"+this.getX()+","+(this.getY()+a))},g.prototype.setY=function(a){this.group.transform("t"+this.getX()+","+a)},g.prototype.getTop=function(){var a=this.getY(),b=this.getX()+this.width/2;return{x:b,y:a}},g.prototype.getBottom=function(){var a=this.getY()+this.height,b=this.getX()+this.width/2;return{x:b,y:a}},g.prototype.getLeft=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX();return{x:b,y:a}},g.prototype.getRight=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.group.getBBox().width;return{x:b,y:a}},g.prototype.render=function(){if(this.next){var a=this.getAttr("line-length");if("right"===this.next_direction){var b=this.getRight();this.next.getLeft();if(!this.next.isPositioned){this.next.setY(b.y-this.next.height/2),this.next.shiftX(this.group.getBBox().x+this.width+a);var c=this;!function e(){for(var b,d=!1,f=0,g=c.chart.symbols.length;g>f;f++){b=c.chart.symbols[f];var h=Math.abs(b.getCenter().x-c.next.getCenter().x);if(b.getCenter().y>c.next.getCenter().y&&h<=c.next.width/2){d=!0;break}}d&&(c.next.setX(b.getX()+b.width+a),e())}(),this.next.isPositioned=!0,this.next.render()}}else{var d=this.getBottom();this.next.getTop();this.next.isPositioned||(this.next.shiftY(this.getY()+this.height+a),this.next.setX(d.x-this.next.width/2),this.next.isPositioned=!0,this.next.render())}}},g.prototype.renderLines=function(){this.next&&(this.next_direction?this.drawLineTo(this.next,"",this.next_direction):this.drawLineTo(this.next))},g.prototype.drawLineTo=function(a,b,c){this.connectedTo.indexOf(a)<0&&this.connectedTo.push(a);var f,g=this.getCenter().x,h=this.getCenter().y,i=(this.getTop(),this.getRight()),j=this.getBottom(),k=this.getLeft(),l=a.getCenter().x,m=a.getCenter().y,n=a.getTop(),o=a.getRight(),p=(a.getBottom(),a.getLeft()),q=g===l,r=h===m,s=m>h,t=h>m,u=g>l,v=l>g,w=0,x=this.getAttr("line-length"),y=this.getAttr("line-width");if(c&&"bottom"!==c||!q||!s)if(c&&"right"!==c||!r||!v)if(c&&"left"!==c||!r||!u)if(c&&"right"!==c||!q||!t)if(c&&"right"!==c||!q||!s)if(c&&"bottom"!==c||!u)if(c&&"bottom"!==c||!v)if(c&&"right"===c&&u)f=d(this.chart,i,[{x:i.x+x/2,y:i.y},{x:i.x+x/2,y:n.y-x/2},{x:n.x,y:n.y-x/2},{x:n.x,y:n.y}],b),this.rightStart=!0,a.topEnd=!0,w=i.x+x/2;else if(c&&"right"===c&&v)f=d(this.chart,i,[{x:n.x,y:i.y},{x:n.x,y:n.y}],b),this.rightStart=!0,a.topEnd=!0,w=i.x+x/2;else if(c&&"bottom"===c&&q&&t)f=d(this.chart,j,[{x:j.x,y:j.y+x/2},{x:i.x+x/2,y:j.y+x/2},{x:i.x+x/2,y:n.y-x/2},{x:n.x,y:n.y-x/2},{x:n.x,y:n.y}],b),this.bottomStart=!0,a.topEnd=!0,w=j.x+x/2;else if("left"===c&&q&&t){var z=k.x-x/2;p.xA;A++)for(var C,D=this.chart.lines[A],E=D.attr("path"),F=f.attr("path"),G=0,H=E.length-1;H>G;G++){var I=[];I.push(["M",E[G][1],E[G][2]]),I.push(["L",E[G+1][1],E[G+1][2]]);for(var J=I[0][1],K=I[0][2],L=I[1][1],M=I[1][2],N=0,O=F.length-1;O>N;N++){var P=[];P.push(["M",F[N][1],F[N][2]]),P.push(["L",F[N+1][1],F[N+1][2]]);var Q=P[0][1],R=P[0][2],S=P[1][1],T=P[1][2],U=e(J,K,L,M,Q,R,S,T);if(U.onLine1&&U.onLine2){var V;R===T?Q>S?(V=["L",U.x+2*y,R],F.splice(N+1,0,V),V=["C",U.x+2*y,R,U.x,R-4*y,U.x-2*y,R],F.splice(N+2,0,V),f.attr("path",F)):(V=["L",U.x-2*y,R],F.splice(N+1,0,V),V=["C",U.x-2*y,R,U.x,R-4*y,U.x+2*y,R],F.splice(N+2,0,V),f.attr("path",F)):R>T?(V=["L",Q,U.y+2*y],F.splice(N+1,0,V),V=["C",Q,U.y+2*y,Q+4*y,U.y,Q,U.y-2*y],F.splice(N+2,0,V),f.attr("path",F)):(V=["L",Q,U.y-2*y],F.splice(N+1,0,V),V=["C",Q,U.y-2*y,Q+4*y,U.y,Q,U.y+2*y],F.splice(N+2,0,V),f.attr("path",F)),N+=2,C+=2}}}this.chart.lines.push(f)}(!this.chart.maxXFromLine||this.chart.maxXFromLine&&w>this.chart.maxXFromLine)&&(this.chart.maxXFromLine=w)},r.inherits(h,g),r.inherits(i,g),r.inherits(j,g),r.inherits(k,g),r.inherits(l,g),l.prototype.getLeft=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.textMargin;return{x:b,y:a}},l.prototype.getRight=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.group.getBBox().width-this.textMargin;return{x:b,y:a}},r.inherits(m,g),m.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 a=this.getAttr("line-length");if(this.bottom_symbol){var b=this.getBottom();this.bottom_symbol.getTop();this.bottom_symbol.isPositioned||(this.bottom_symbol.shiftY(this.getY()+this.height+a),this.bottom_symbol.setX(b.x-this.bottom_symbol.width/2),this.bottom_symbol.isPositioned=!0,this.bottom_symbol.render())}if(this.right_symbol){var c=this.getRight();this.right_symbol.getLeft();if(!this.right_symbol.isPositioned){this.right_symbol.setY(c.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+a);var d=this;!function e(){for(var b,c=!1,f=0,g=d.chart.symbols.length;g>f;f++){b=d.chart.symbols[f];var h=Math.abs(b.getCenter().x-d.right_symbol.getCenter().x);if(b.getCenter().y>d.right_symbol.getCenter().y&&h<=d.right_symbol.width/2){c=!0;break}}c&&(d.right_symbol.setX(b.getX()+b.width+a),e())}(),this.right_symbol.isPositioned=!0,this.right_symbol.render()}}},m.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)},p.parse=n}(); -//# sourceMappingURL=flowchart.min.map \ No newline at end of file +!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 s in e)("object"==typeof exports?exports:t)[s]=e[s]}}(this,function(t){return function(t){function i(s){if(e[s])return e[s].exports;var n=e[s]={exports:{},id:s,loaded:!1};return t[s].call(n.exports,n,n.exports,i),n.loaded=!0,n.exports}var e={};return i.m=t,i.c=e,i.p="",i(0)}([function(t,i,e){e(9);var s=e(4);e(17);var n={parse:s};"undefined"!=typeof window&&(window.flowchart=n),t.exports=n},function(t,i){function e(t,i){if(!t||"function"==typeof t)return i;var s={};for(var n in i)s[n]=i[n];for(n in t)t[n]&&("object"==typeof s[n]?s[n]=e(s[n],t[n]):s[n]=t[n]);return s}function s(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:s}},function(t,i,e){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;lr?"\n"+x:" "+x}this.text.attr("text",a.substring(1))}if(this.group.push(this.text),e){var y=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*y,height:this.text.getBBox().height+2*y}),e.node.setAttribute("class",this.getAttr("class"));var g=this.getAttr("roundness");isNaN(g)||(e.node.setAttribute("ry",g),e.node.setAttribute("rx",g)),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 n=e(3),h=n.drawLine,r=n.checkLineIntersection;s.prototype.getAttr=function(t){if(this.chart){var i,e=this.chart.options?this.chart.options[t]:void 0,s=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||s||e}},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(),i=this.getX()+this.width/2;return{x:i,y:t}},s.prototype.getBottom=function(){var t=this.getY()+this.height,i=this.getX()+this.width/2;return{x:i,y:t}},s.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX();return{x:i,y:t}},s.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.group.getBBox().width;return{x:i,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;ht.next.getCenter().y&&o<=t.next.width/2){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;ht.next.getCenter().y&&o<=t.next.width/2){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,i,e){this.connectedTo.indexOf(t)<0&&this.connectedTo.push(t);var s,n,o=this.getCenter().x,a=this.getCenter().y,l=this.getRight(),p=this.getBottom(),x=this.getTop(),y=this.getLeft(),g=t.getCenter().x,f=t.getCenter().y,c=t.getTop(),d=t.getRight(),m=t.getLeft(),u=o===g,b=a===f,_=af||this===t,w=o>g,L=ok&&(k=c.x);else n=10*Math.max(t.topLines.length,this.bottomLines.length),s=this.leftEnd&&v?h(this.chart,p,[{x:p.x,y:p.y+B/2-n},{x:p.x+(p.x-c.x)/2,y:p.y+B/2-n},{x:p.x+(p.x-c.x)/2,y:c.y-B/2-n},{x:c.x,y:c.y-B/2-n},{x:c.x,y:c.y}],i):h(this.chart,p,[{x:p.x,y:c.y-B/2-n},{x:c.x,y:c.y-B/2-n},{x:c.x,y:c.y}],i),this.bottomLines.push(s),t.topLines.push(s),this.bottomStart=!0,t.topEnd=!0,k=p.x+(p.x-c.x)/2;else n=10*Math.max(t.topLines.length,this.rightLines.length),s=h(this.chart,l,[{x:l.x+B/2,y:l.y-n},{x:l.x+B/2,y:c.y-B/2-n},{x:c.x,y:c.y-B/2-n},{x:c.x,y:c.y}],i),this.rightLines.push(s),t.topLines.push(s),this.rightStart=!0,t.topEnd=!0,k=l.x+B/2;else n=10*Math.max(t.topLines.length,this.rightLines.length),s=h(this.chart,l,[{x:l.x+B/2,y:l.y-n},{x:l.x+B/2,y:c.y-B/2-n},{x:c.x,y:c.y-B/2-n},{x:c.x,y:c.y}],i),this.rightLines.push(s),t.topLines.push(s),this.rightStart=!0,t.topEnd=!0,k=l.x+B/2;else 0===t.rightLines.length&&0===this.leftLines.length?s=h(this.chart,y,d,i):(n=10*Math.max(t.rightLines.length,this.leftLines.length),s=h(this.chart,l,[{x:l.x,y:l.y-n},{x:l.x,y:d.y-n},{x:d.x,y:d.y-n},{x:d.x,y:d.y}],i)),this.leftLines.push(s),t.rightLines.push(s),this.leftStart=!0,t.rightEnd=!0,k=d.x;else 0===t.leftLines.length&&0===this.rightLines.length?s=h(this.chart,l,m,i):(n=10*Math.max(t.leftLines.length,this.rightLines.length),s=h(this.chart,l,[{x:l.x,y:l.y-n},{x:l.x,y:m.y-n},{x:m.x,y:m.y-n},{x:m.x,y:m.y}],i)),this.rightLines.push(s),t.leftLines.push(s),this.rightStart=!0,t.leftEnd=!0,k=m.x;else 0===t.topLines.length&&0===this.bottomLines.length?s=h(this.chart,p,c,i):(n=10*Math.max(t.topLines.length,this.bottomLines.length),s=h(this.chart,p,[{x:c.x,y:c.y-n},{x:c.x,y:c.y}],i)),this.bottomLines.push(s),t.topLines.push(s),this.bottomStart=!0,t.topEnd=!0,k=p.x;if(this.lineStyle[t.key]&&s&&s.attr(this.lineStyle[t.key]),s){for(var O=0,X=this.chart.lines.length;OW?(J=["L",q.x+2*M,I],C.splice(N+1,0,J),J=["C",q.x+2*M,I,q.x,I-4*M,q.x-2*M,I],C.splice(N+2,0,J),s.attr("path",C)):(J=["L",q.x-2*M,I],C.splice(N+1,0,J),J=["C",q.x-2*M,I,q.x,I-4*M,q.x+2*M,I],C.splice(N+2,0,J),s.attr("path",C)):I>Q?(J=["L",G,q.y+2*M],C.splice(N+1,0,J),J=["C",G,q.y+2*M,G+4*M,q.y,G,q.y-2*M],C.splice(N+2,0,J),s.attr("path",C)):(J=["L",G,q.y-2*M],C.splice(N+1,0,J),J=["C",G,q.y-2*M,G+4*M,q.y,G,q.y+2*M],C.splice(N+2,0,J),s.attr("path",C)),N+=2}}}this.chart.lines.push(s),(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=s},function(t,i){function e(t,i,e){var s,n,h="M{0},{1}";for(s=2,n=2*e.length+2;sd.x?i.x-(i.x-d.x)/2:d.x-(d.x-i.x)/2,u=i.y>d.y?i.y-(i.y-d.y)/2:d.y-(d.y-i.y)/2,c?(m-=g.getBBox().width/2,u-=t.options["text-margin"]):(m+=t.options["text-margin"],u-=g.getBBox().height/2)):(m=i.x,u=i.y,c?(i.x>d.x?(m-=t.options["text-margin"]/2,f="end"):m+=t.options["text-margin"]/2,u-=t.options["text-margin"]):(m+=t.options["text-margin"]/2,u+=t.options["text-margin"],i.y>d.y&&(u-=2*t.options["text-margin"]))),g.attr({"text-anchor":f,"font-size":t.options["font-size"],fill:t.options["font-color"],x:m,y:u}),l&&g.attr({font:l}),p&&g.attr({"font-family":p}),x&&g.attr({"font-weight":x})}return a}function n(t,i,e,s,n,h,r,o){var a,l,p,x,y,g={x:null,y:null,onLine1:!1,onLine2:!1};return a=(o-h)*(e-t)-(r-n)*(s-i),0===a?g:(l=i-h,p=t-n,x=(r-n)*l-(o-h)*p,y=(e-t)*l-(s-i)*p,l=x/a,p=y/a,g.x=t+l*(e-t),g.y=i+l*(s-i),l>0&&l<1&&(g.onLine1=!0),p>0&&p<1&&(g.onLine2=!0),g)}t.exports={drawPath:e,drawLine:s,checkLineIntersection:n}},function(t,i,e){function s(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 s(t){var i=t.indexOf("(")+1,e=t.indexOf(")");return i>=0&&e>=0?d.symbols[t.substring(0,i-1)]:d.symbols[t]}function f(t){var i="next",e=t.indexOf("(")+1,s=t.indexOf(")");return e>=0&&s>=0&&(i=N.substring(e,s),i.indexOf(",")<0&&"yes"!==i&&"no"!==i&&(i="next, "+i)),i}function c(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 i>=0&&e>=0?n[1]:""}t=t||"",t=t.trim();for(var d={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 h(f,t);break;case"end":c[t.key]=new r(f,t);break;case"operation":c[t.key]=new o(f,t);break;case"inputoutput":c[t.key]=new a(f,t);break;case"input":c[t.key]=new l(f,t);break;case"output":c[t.key]=new p(f,t);break;case"subroutine":c[t.key]=new x(f,t);break;case"condition":c[t.key]=new y(f,t);break;case"parallel":c[t.key]=new g(f,t);break;default:return new Error("Wrong symbol type!")}return c[t.key]}var s=this;this.diagram&&this.diagram.clean();var f=new n(t,i);this.diagram=f;var c={};!function t(i,n,h){var r=e(i);return s.start===i?f.startWith(r):n&&h&&!n.pathOk&&(n instanceof y?(h.yes===i&&n.yes(r),h.no===i&&n.no(r)):n instanceof g?(h.path1===i&&n.path1(r),h.path2===i&&n.path2(r),h.path3===i&&n.path3(r)):n.then(r)),r.pathOk?r:(r instanceof y?(i.yes&&t(i.yes,r,i),i.no&&t(i.no,r,i)):r instanceof g?(i.path1&&t(i.path1,r,i),i.path2&&t(i.path2,r,i),i.path3&&t(i.path3,r,i)):i.next&&t(i.next,r,i),r)}(this.start),f.render()},clean:function(){this.diagram.clean()},options:function(){return this.diagram.options}},m=[],u=0,b=1,_=t.length;b<_;b++)if("\n"===t[b]&&"\\"!==t[b-1]){var v=t.substring(u,b);u=b+1,m.push(v.replace(/\\\n/g,"\n"))}u")<0&&k.indexOf("=>")<0&&k.indexOf("@>")<0?(m[w-1]+="\n"+k,m.splice(w,1),L--):w++}for(;m.length>0;){var B=m.splice(0,1)[0].trim();if(B.indexOf("=>")>=0){var M=B.split("=>"),A={key:M[0].replace(/\(.*\)/,""),symbolType:M[1],text:null,link:null,target:null,flowstate:null,function:null,lineStyle:{},params:{}},O=M[0].match(/\((.*)\)/);if(O&&O.length>1)for(var X=O[1].split(","),T=0;T=0&&(C=A.symbolType.split(": "),A.symbolType=C.shift(),A.text=C.join(": ")),A.text&&A.text.indexOf(":$")>=0?(C=A.text.split(":$"),A.text=C.shift(),A.function=C.join(":$")):A.symbolType.indexOf(":$")>=0?(C=A.symbolType.split(":$"),A.symbolType=C.shift(),A.function=C.join(":$")):A.text&&A.text.indexOf(":>")>=0?(C=A.text.split(":>"),A.text=C.shift(),A.link=C.join(":>")):A.symbolType.indexOf(":>")>=0&&(C=A.symbolType.split(":>"),A.symbolType=C.shift(),A.link=C.join(":>")),A.symbolType.indexOf("\n")>=0&&(A.symbolType=A.symbolType.split("\n")[0]),A.link){var Y=A.link.indexOf("[")+1,P=A.link.indexOf("]");Y>=0&&P>=0&&(A.target=A.link.substring(Y,P),A.link=A.link.substring(0,Y-1))}if(A.text&&A.text.indexOf("|")>=0){var j=A.text.split("|");A.flowstate=j.pop().trim(),A.text=j.join("|")}d.symbols[A.key]=A}else if(B.indexOf("->")>=0){var E=c(B);E&&(B=B.replace("@"+E,""));for(var z=B.split("->"),R=0,F=z.length;R=0){var W=V.split(",");V=W[0],I=W[1].trim()}if(E&&("condition"===G.symbolType?"yes"===V||"true"===V?G.yes_annotation=E:G.no_annotation=E:"parallel"===G.symbolType&&("path1"===V?G.path1_annotation=E:"path2"===V?G.path2_annotation=E:"path3"===V&&(G.path3_annotation=E)),E=null),d.start||(d.start=G),R+1")>=0)for(var q=B.split("@>"),J=0,D=q.length;Jt.right_symbol.getCenter().y&&o<=t.right_symbol.width/2){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;ht.left_symbol.getCenter().y&&o<=t.left_symbol.width/2){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)},t.exports=s},function(t,i,e){function s(t,i){var e=t.paper.rect(0,0,0,0);i=i||{},n.call(this,t,i,e),this.path1_annotation=i.path1_annotation||"",this.path2_annotation=i.path2_annotation||"",this.path3_annotation=i.path3_annotation||"",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 n=e(2),h=e(1).inherits;h(s,n),s.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;hs.left_symbol.getCenter().y&&o<=s.left_symbol.width/2){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;hs.right_symbol.getCenter().y&&o<=s.right_symbol.width/2){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())}},s.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)},t.exports=s},function(t,i,e){function s(t,i){i=i||{},this.paper=new n(t),this.options=h(i,r),this.symbols=[],this.lines=[],this.start=null}var n=e(18),h=e(1).defaults,r=e(8),o=e(5),a=e(6);s.prototype.handle=function(t){this.symbols.indexOf(t)<=-1&&this.symbols.push(t);var i=this;return t instanceof o?(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},s.prototype.startWith=function(t){return this.start=t,this.handle(t)},s.prototype.render=function(){var t,i,e=0,s=0,n=0,h=0,r=0,o=0,a=0,l=0;for(n=0,h=this.symbols.length;ne&&(e=t.width),t.height>s&&(s=t.height);for(n=0,h=this.symbols.length;nr&&(r=p),x>o&&(o=x)}for(n=0,h=this.lines.length;nr&&(r=g),f>o&&(o=f)}var c=this.options.scale,d=this.options["line-width"];this.minXFromSymbols>>0;if(0===e)return-1;var s=0;if(arguments.length>0&&(s=Number(arguments[1]),s!=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=s>=0?s:Math.max(e-Math.abs(s),0);n>>0;if(0===e)return-1;var s=e;arguments.length>1&&(s=Number(arguments[1]),s!=s?s=0:0!==s&&s!=1/0&&s!=-(1/0)&&(s=(s>0||-1)*Math.floor(Math.abs(s))));for(var n=s>=0?Math.min(s,e-1):e-Math.abs(s);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,"")})},function(t,i,e){function s(t,i){var e=t.paper.rect(0,0,0,0,20);i=i||{},i.text=i.text||"End",n.call(this,t,i,e)}var n=e(2),h=e(1).inherits;h(s,n),t.exports=s},function(t,i,e){function s(t,i){i=i||{},n.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,s=this.text.getBBox().height+2*this.textMargin,h=this.textMargin,r=s/2,a={x:h,y:r},l=[{x:h-this.textMargin+2*this.textMargin,y:s},{x:h-this.textMargin+e,y:s},{x:h-this.textMargin+e+2*this.textMargin,y:0},{x:h-this.textMargin,y:0},{x:h,y:r}],p=o(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.symbol=p,this.initialize()}var n=e(2),h=e(1).inherits,r=e(3),o=r.drawPath;h(s,n),s.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.textMargin;return{x:i,y:t}},s.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=s},function(t,i,e){function s(t,i){i=i||{},n.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,s=this.text.getBBox().height+2*this.textMargin,h=this.textMargin,r=s/2,a={x:h,y:r},l=[{x:h-this.textMargin,y:s},{x:h-this.textMargin+e,y:s},{x:h-this.textMargin+e+2*this.textMargin,y:0},{x:h-this.textMargin+2*this.textMargin,y:0},{x:h,y:r}],p=o(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.symbol=p,this.initialize()}var n=e(2),h=e(1).inherits,r=e(3),o=r.drawPath;h(s,n),s.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.textMargin;return{x:i,y:t}},s.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=s},function(t,i,e){function s(t,i){var e=t.paper.rect(0,0,0,0);i=i||{},n.call(this,t,i,e)}var n=e(2),h=e(1).inherits; +h(s,n),t.exports=s},function(t,i,e){function s(t,i){i=i||{},n.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,s=this.text.getBBox().height+2*this.textMargin,h=this.textMargin,r=s/2,a={x:h,y:r},l=[{x:h-this.textMargin,y:s},{x:h-this.textMargin+e+2*this.textMargin,y:s},{x:h-this.textMargin+e,y:0},{x:h-this.textMargin+2*this.textMargin,y:0},{x:h,y:r}],p=o(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.symbol=p,this.initialize()}var n=e(2),h=e(1).inherits,r=e(3),o=r.drawPath;h(s,n),s.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.textMargin;return{x:i,y:t}},s.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=s},function(t,i,e){function s(t,i){var e=t.paper.rect(0,0,0,0,20);i=i||{},i.text=i.text||"Start",n.call(this,t,i,e)}var n=e(2),h=e(1).inherits;h(s,n),t.exports=s},function(t,i,e){function s(t,i){var e=t.paper.rect(0,0,0,0);i=i||{},n.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 s=t.paper.rect(0,0,0,0);s.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&&(s.node.id=i.key+"i");var h=this.getAttr("font"),r=this.getAttr("font-family"),o=this.getAttr("font-weight");h&&s.attr({font:h}),r&&s.attr({"font-family":r}),o&&s.attr({"font-weight":o}),i.link&&s.attr("href",i.link),i.target&&s.attr("target",i.target),this.group.push(s),s.insertBefore(this.text),this.initialize()}var n=e(2),h=e(1).inherits;h(s,n),t.exports=s},function(t,i,e){if("undefined"!=typeof jQuery){var s=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=s(e.text()),e.html(""),this.chart.drawSVG(this,i)})},setFlowStateByParam:function(t,e,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],a=o.params[t];if(i(a,e)){o.flowstate=s;for(var l=0;l maxWidth) {\n\t tempText += \"\\n\" + word;\n\t } else {\n\t tempText += \" \" + word;\n\t }\n\t }\n\t this.text.attr(\"text\", tempText.substring(1));\n\t }\n\t\n\t this.group.push(this.text);\n\t\n\t if (symbol) {\n\t var tmpMargin = this.getAttr('text-margin');\n\t\n\t symbol.attr({\n\t 'fill' : this.getAttr('fill'),\n\t 'stroke' : this.getAttr('element-color'),\n\t 'stroke-width' : this.getAttr('line-width'),\n\t 'width' : this.text.getBBox().width + 2 * tmpMargin,\n\t 'height' : this.text.getBBox().height + 2 * tmpMargin\n\t });\n\t\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t var roundness = this.getAttr('roundness');\n\t if (!isNaN(roundness)) {\n\t symbol.node.setAttribute('ry', roundness);\n\t symbol.node.setAttribute('rx', roundness);\n\t }\n\t\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t\n\t //ndrqu Add click function with event and options params\n\t if (options.function) { \n\t symbol.node.addEventListener(\"click\", function(evt) {\n\t window[options.function](evt,options);\n\t }, false);\n\t symbol.attr({ 'cursor' : 'pointer' });\n\t }\n\t if (options.key) { symbol.node.id = options.key; }\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t\n\t this.text.attr({\n\t 'y': symbol.getBBox().height/2\n\t });\n\t\n\t this.initialize();\n\t }\n\t\n\t}\n\t\n\t/* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */\n\tSymbol.prototype.getAttr = function(attName) {\n\t if (!this.chart) {\n\t return undefined;\n\t }\n\t var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined;\n\t var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined;\n\t var opt1;\n\t if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) {\n\t opt1 = this.chart.options.flowstate[this.flowstate][attName];\n\t }\n\t return (opt1 || opt2 || opt3);\n\t};\n\t\n\tSymbol.prototype.initialize = function() {\n\t this.group.transform('t' + this.getAttr('line-width') + ',' + this.getAttr('line-width'));\n\t\n\t this.width = this.group.getBBox().width;\n\t this.height = this.group.getBBox().height;\n\t};\n\t\n\tSymbol.prototype.getCenter = function() {\n\t return {x: this.getX() + this.width/2,\n\t y: this.getY() + this.height/2};\n\t};\n\t\n\tSymbol.prototype.getX = function() {\n\t return this.group.getBBox().x;\n\t};\n\t\n\tSymbol.prototype.getY = function() {\n\t return this.group.getBBox().y;\n\t};\n\t\n\tSymbol.prototype.shiftX = function(x) {\n\t this.group.transform('t' + (this.getX() + x) + ',' + this.getY());\n\t};\n\t\n\tSymbol.prototype.setX = function(x) {\n\t this.group.transform('t' + x + ',' + this.getY());\n\t};\n\t\n\tSymbol.prototype.shiftY = function(y) {\n\t this.group.transform('t' + this.getX() + ',' + (this.getY() + y));\n\t};\n\t\n\tSymbol.prototype.setY = function(y) {\n\t this.group.transform('t' + this.getX() + ',' + y);\n\t};\n\t\n\tSymbol.prototype.getTop = function() {\n\t var y = this.getY();\n\t var x = this.getX() + this.width/2;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getBottom = function() {\n\t var y = this.getY() + this.height;\n\t var x = this.getX() + this.width/2;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX();\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.render = function() {\n\t if (this.next) {\n\t\n\t var self = this;\n\t var lineLength = this.getAttr('line-length');\n\t\n\t if (this.next_direction === 'right') {\n\t\n\t var rightPoint = this.getRight();\n\t\n\t if (!this.next.isPositioned) {\n\t this.next.setY(rightPoint.y - this.next.height/2);\n\t this.next.shiftX(this.group.getBBox().x + this.width + lineLength);\n\t\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n\t if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t if (self.next.symbolType === 'end') return;\n\t self.next.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.next.isPositioned = true;\n\t\n\t this.next.render();\n\t }\n\t } else if (this.next_direction === 'left') {\n\t\n\t var leftPoint = this.getLeft();\n\t\n\t if (!this.next.isPositioned) {\n\t this.next.setY(leftPoint.y - this.next.height/2);\n\t this.next.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n\t\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n\t if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t if (self.next.symbolType === 'end') return;\n\t self.next.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.next.isPositioned = true;\n\t\n\t this.next.render();\n\t }\n\t } else {\n\t var bottomPoint = this.getBottom();\n\t\n\t if (!this.next.isPositioned) {\n\t this.next.shiftY(this.getY() + this.height + lineLength);\n\t this.next.setX(bottomPoint.x - this.next.width/2);\n\t this.next.isPositioned = true;\n\t\n\t this.next.render();\n\t }\n\t }\n\t }\n\t};\n\t\n\tSymbol.prototype.renderLines = function() {\n\t if (this.next) {\n\t if (this.next_direction) {\n\t this.drawLineTo(this.next, this.getAttr('arrow-text') || '', this.next_direction);\n\t } else {\n\t this.drawLineTo(this.next, this.getAttr('arrow-text') || '');\n\t }\n\t }\n\t};\n\t\n\tSymbol.prototype.drawLineTo = function(symbol, text, origin) {\n\t if (this.connectedTo.indexOf(symbol) < 0) {\n\t this.connectedTo.push(symbol);\n\t }\n\t\n\t var x = this.getCenter().x,\n\t y = this.getCenter().y,\n\t right = this.getRight(),\n\t bottom = this.getBottom(),\n\t top = this.getTop(),\n\t left = this.getLeft();\n\t\n\t var symbolX = symbol.getCenter().x,\n\t symbolY = symbol.getCenter().y,\n\t symbolTop = symbol.getTop(),\n\t symbolRight = symbol.getRight(),\n\t symbolLeft = symbol.getLeft();\n\t\n\t var isOnSameColumn = x === symbolX,\n\t isOnSameLine = y === symbolY,\n\t isUnder = y < symbolY,\n\t isUpper = y > symbolY || this === symbol,\n\t isLeft = x > symbolX,\n\t isRight = x < symbolX;\n\t\n\t var maxX = 0,\n\t line,\n\t yOffset,\n\t lineLength = this.getAttr('line-length'),\n\t lineWith = this.getAttr('line-width');\n\t\n\t if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) {\n\t if (symbol.topLines.length === 0 && this.bottomLines.length === 0) {\n\t line = drawLine(this.chart, bottom, symbolTop, text);\n\t } else {\n\t yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n\t line = drawLine(this.chart, bottom, [\n\t {x: symbolTop.x, y: symbolTop.y - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t }\n\t this.bottomLines.push(line);\n\t symbol.topLines.push(line);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x;\n\t } else if ((!origin || origin === 'right') && isOnSameLine && isRight) {\n\t if (symbol.leftLines.length === 0 && this.rightLines.length === 0) {\n\t line = drawLine(this.chart, right, symbolLeft, text);\n\t } else {\n\t yOffset = Math.max(symbol.leftLines.length, this.rightLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: right.x, y: right.y - yOffset},\n\t {x: right.x, y: symbolLeft.y - yOffset},\n\t {x: symbolLeft.x, y: symbolLeft.y - yOffset},\n\t {x: symbolLeft.x, y: symbolLeft.y}\n\t ], text);\n\t }\n\t this.rightLines.push(line);\n\t symbol.leftLines.push(line);\n\t this.rightStart = true;\n\t symbol.leftEnd = true;\n\t maxX = symbolLeft.x;\n\t } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) {\n\t if (symbol.rightLines.length === 0 && this.leftLines.length === 0) {\n\t line = drawLine(this.chart, left, symbolRight, text);\n\t } else {\n\t yOffset = Math.max(symbol.rightLines.length, this.leftLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: right.x, y: right.y - yOffset},\n\t {x: right.x, y: symbolRight.y - yOffset},\n\t {x: symbolRight.x, y: symbolRight.y - yOffset},\n\t {x: symbolRight.x, y: symbolRight.y}\n\t ], text);\n\t }\n\t this.leftLines.push(line);\n\t symbol.rightLines.push(line);\n\t this.leftStart = true;\n\t symbol.rightEnd = true;\n\t maxX = symbolRight.x;\n\t } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) {\n\t yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y - yOffset},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightLines.push(line);\n\t symbol.topLines.push(line);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) {\n\t yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y - yOffset},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightLines.push(line);\n\t symbol.topLines.push(line);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((!origin || origin === 'bottom') && isLeft) {\n\t yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n\t if (this.leftEnd && isUpper) {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2 - yOffset},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t } else {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t }\n\t this.bottomLines.push(line);\n\t symbol.topLines.push(line);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n\t } else if ((!origin || origin === 'bottom') && isRight && isUnder) {\n\t yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.bottomLines.push(line);\n\t symbol.topLines.push(line);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x;\n\t if (symbolTop.x > maxX) maxX = symbolTop.x;\n\t } else if ((!origin || origin === 'bottom') && isRight) {\n\t yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2 - yOffset},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.bottomLines.push(line);\n\t symbol.topLines.push(line);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n\t } else if ((origin && origin === 'right') && isLeft) {\n\t yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightLines.push(line);\n\t symbol.topLines.push(line);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((origin && origin === 'right') && isRight) {\n\t yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n\t line = drawLine(this.chart, right, [\n\t {x: symbolTop.x, y: right.y - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - yOffset}\n\t ], text);\n\t this.rightLines.push(line);\n\t symbol.topLines.push(line);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) {\n\t yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n\t {x: right.x + lineLength/2, y: bottom.y + lineLength/2 - yOffset},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.bottomLines.push(line);\n\t symbol.topLines.push(line);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + lineLength/2;\n\t } else if ((origin === 'left') && isOnSameColumn && isUpper) {\n\t var diffX = left.x - lineLength/2;\n\t if (symbolLeft.x < left.x) {\n\t diffX = symbolLeft.x - lineLength/2;\n\t }\n\t yOffset = Math.max(symbol.topLines.length, this.leftLines.length) * 10;\n\t line = drawLine(this.chart, left, [\n\t {x: diffX, y: left.y - yOffset},\n\t {x: diffX, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.leftLines.push(line);\n\t symbol.topLines.push(line);\n\t this.leftStart = true;\n\t symbol.topEnd = true;\n\t maxX = left.x;\n\t } else if ((origin === 'left')) {\n\t yOffset = Math.max(symbol.topLines.length, this.leftLines.length) * 10;\n\t line = drawLine(this.chart, left, [\n\t {x: symbolTop.x + (left.x - symbolTop.x)/2, y: left.y},\n\t {x: symbolTop.x + (left.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.leftLines.push(line);\n\t symbol.topLines.push(line);\n\t this.leftStart = true;\n\t symbol.topEnd = true;\n\t maxX = left.x;\n\t } else if ((origin === 'top')) {\n\t yOffset = Math.max(symbol.topLines.length, this.topLines.length) * 10;\n\t line = drawLine(this.chart, top, [\n\t {x: top.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.topLines.push(line);\n\t symbol.topLines.push(line);\n\t this.topStart = true;\n\t symbol.topEnd = true;\n\t maxX = top.x;\n\t }\n\t\n\t //update line style\n\t if (this.lineStyle[symbol.key] && line){\n\t line.attr(this.lineStyle[symbol.key]);\n\t }\n\t\n\t if (line) {\n\t for (var l = 0, llen = this.chart.lines.length; l < llen; l++) {\n\t var otherLine = this.chart.lines[l];\n\t\n\t var ePath = otherLine.attr('path'),\n\t lPath = line.attr('path');\n\t\n\t for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) {\n\t var newPath = [];\n\t newPath.push(['M', ePath[iP][1], ePath[iP][2]]);\n\t newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]);\n\t\n\t var line1_from_x = newPath[0][1];\n\t var line1_from_y = newPath[0][2];\n\t var line1_to_x = newPath[1][1];\n\t var line1_to_y = newPath[1][2];\n\t\n\t for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) {\n\t var newLinePath = [];\n\t newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]);\n\t newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]);\n\t\n\t var line2_from_x = newLinePath[0][1];\n\t var line2_from_y = newLinePath[0][2];\n\t var line2_to_x = newLinePath[1][1];\n\t var line2_to_y = newLinePath[1][2];\n\t\n\t var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y);\n\t if (res.onLine1 && res.onLine2) {\n\t\n\t var newSegment;\n\t if (line2_from_y === line2_to_y) {\n\t if (line2_from_x > line2_to_x) {\n\t newSegment = ['L', res.x + lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t } else {\n\t newSegment = ['L', res.x - lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t }\n\t } else {\n\t if (line2_from_y > line2_to_y) {\n\t newSegment = ['L', line2_from_x, res.y + lineWith * 2];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t } else {\n\t newSegment = ['L', line2_from_x, res.y - lineWith * 2];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t }\n\t }\n\t\n\t lP += 2;\n\t }\n\t }\n\t }\n\t }\n\t\n\t this.chart.lines.push(line);\n\t if (this.chart.minXFromSymbols === undefined || this.chart.minXFromSymbols > left.x) {\n\t this.chart.minXFromSymbols = left.x;\n\t }\n\t }\n\t\n\t if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) {\n\t this.chart.maxXFromLine = maxX;\n\t }\n\t};\n\t\n\tmodule.exports = Symbol;\n\n\n/***/ }),\n/* 3 */\n/*!************************************!*\\\n !*** ./src/flowchart.functions.js ***!\n \\************************************/\n/***/ (function(module, exports) {\n\n\tfunction drawPath(chart, location, points) {\n\t var i, len;\n\t var path = 'M{0},{1}';\n\t for (i = 2, len = 2 * points.length + 2; i < len; i+=2) {\n\t path += ' L{' + i + '},{' + (i + 1) + '}';\n\t }\n\t var pathValues = [location.x, location.y];\n\t for (i = 0, len = points.length; i < len; i++) {\n\t pathValues.push(points[i].x);\n\t pathValues.push(points[i].y);\n\t }\n\t var symbol = chart.paper.path(path, pathValues);\n\t symbol.attr('stroke', chart.options['element-color']);\n\t symbol.attr('stroke-width', chart.options['line-width']);\n\t\n\t var font = chart.options.font;\n\t var fontF = chart.options['font-family'];\n\t var fontW = chart.options['font-weight'];\n\t\n\t if (font) symbol.attr({ 'font': font });\n\t if (fontF) symbol.attr({ 'font-family': fontF });\n\t if (fontW) symbol.attr({ 'font-weight': fontW });\n\t\n\t return symbol;\n\t}\n\t\n\tfunction drawLine(chart, from, to, text) {\n\t var i, len;\n\t\n\t if (Object.prototype.toString.call(to) !== '[object Array]') {\n\t to = [to];\n\t }\n\t\n\t var path = 'M{0},{1}';\n\t for (i = 2, len = 2 * to.length + 2; i < len; i+=2) {\n\t path += ' L{' + i + '},{' + (i + 1) + '}';\n\t }\n\t var pathValues = [from.x, from.y];\n\t for (i = 0, len = to.length; i < len; i++) {\n\t pathValues.push(to[i].x);\n\t pathValues.push(to[i].y);\n\t }\n\t\n\t var line = chart.paper.path(path, pathValues);\n\t line.attr({\n\t stroke: chart.options['line-color'],\n\t 'stroke-width': chart.options['line-width'],\n\t 'arrow-end': chart.options['arrow-end']\n\t });\n\t\n\t var font = chart.options.font;\n\t var fontF = chart.options['font-family'];\n\t var fontW = chart.options['font-weight'];\n\t\n\t if (font) line.attr({ 'font': font });\n\t if (fontF) line.attr({ 'font-family': fontF });\n\t if (fontW) line.attr({ 'font-weight': fontW });\n\t\n\t if (text) {\n\t\n\t var centerText = false;\n\t\n\t var textPath = chart.paper.text(0, 0, text);\n\t var textAnchor = 'start';\n\t\n\t var isHorizontal = false;\n\t var firstTo = to[0];\n\t\n\t if (from.y === firstTo.y) {\n\t isHorizontal = true;\n\t }\n\t\n\t var x = 0,\n\t y = 0;\n\t\n\t if (centerText) {\n\t if (from.x > firstTo.x) {\n\t x = from.x - (from.x - firstTo.x)/2;\n\t } else {\n\t x = firstTo.x - (firstTo.x - from.x)/2;\n\t }\n\t\n\t if (from.y > firstTo.y) {\n\t y = from.y - (from.y - firstTo.y)/2;\n\t } else {\n\t y = firstTo.y - (firstTo.y - from.y)/2;\n\t }\n\t\n\t if (isHorizontal) {\n\t x -= textPath.getBBox().width/2;\n\t y -= chart.options['text-margin'];\n\t } else {\n\t x += chart.options['text-margin'];\n\t y -= textPath.getBBox().height/2;\n\t }\n\t } else {\n\t x = from.x;\n\t y = from.y;\n\t\n\t if (isHorizontal) {\n\t if (from.x > firstTo.x) {\n\t x -= chart.options['text-margin']/2;\n\t textAnchor = 'end';\n\t } else {\n\t x += chart.options['text-margin']/2;\n\t }\n\t y -= chart.options['text-margin'];\n\t } else {\n\t x += chart.options['text-margin']/2;\n\t y += chart.options['text-margin'];\n\t if (from.y > firstTo.y) {\n\t y -= chart.options['text-margin']*2;\n\t }\n\t }\n\t }\n\t\n\t textPath.attr({\n\t 'text-anchor': textAnchor,\n\t 'font-size': chart.options['font-size'],\n\t 'fill': chart.options['font-color'],\n\t x: x,\n\t y: y\n\t });\n\t\n\t if (font) textPath.attr({ 'font': font });\n\t if (fontF) textPath.attr({ 'font-family': fontF });\n\t if (fontW) textPath.attr({ 'font-weight': fontW });\n\t }\n\t\n\t return line;\n\t}\n\t\n\tfunction checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) {\n\t // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point\n\t var denominator, a, b, numerator1, numerator2, result = {\n\t x: null,\n\t y: null,\n\t onLine1: false,\n\t onLine2: false\n\t };\n\t denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY));\n\t if (denominator === 0) {\n\t return result;\n\t }\n\t a = line1StartY - line2StartY;\n\t b = line1StartX - line2StartX;\n\t numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b);\n\t numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b);\n\t a = numerator1 / denominator;\n\t b = numerator2 / denominator;\n\t\n\t // if we cast these lines infinitely in both directions, they intersect here:\n\t result.x = line1StartX + (a * (line1EndX - line1StartX));\n\t result.y = line1StartY + (a * (line1EndY - line1StartY));\n\t /*\n\t // it is worth noting that this should be the same as:\n\t x = line2StartX + (b * (line2EndX - line2StartX));\n\t y = line2StartX + (b * (line2EndY - line2StartY));\n\t */\n\t // if line1 is a segment and line2 is infinite, they intersect if:\n\t if (a > 0 && a < 1) {\n\t result.onLine1 = true;\n\t }\n\t // if line2 is a segment and line1 is infinite, they intersect if:\n\t if (b > 0 && b < 1) {\n\t result.onLine2 = true;\n\t }\n\t // if line1 and line2 are segments, they intersect if both of the above are true\n\t return result;\n\t}\n\t\n\tmodule.exports = {\n\t\tdrawPath: drawPath,\n\t\tdrawLine: drawLine,\n\t\tcheckLineIntersection: checkLineIntersection\n\t};\n\n\n/***/ }),\n/* 4 */\n/*!********************************!*\\\n !*** ./src/flowchart.parse.js ***!\n \\********************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar FlowChart = __webpack_require__(/*! ./flowchart.chart */ 7);\n\tvar Start = __webpack_require__(/*! ./flowchart.symbol.start */ 15);\n\tvar End = __webpack_require__(/*! ./flowchart.symbol.end */ 10);\n\tvar Operation = __webpack_require__(/*! ./flowchart.symbol.operation */ 13);\n\tvar InputOutput = __webpack_require__(/*! ./flowchart.symbol.inputoutput */ 12);\n\tvar Input = __webpack_require__(/*! ./flowchart.symbol.input */ 11); //tds\n\tvar Output = __webpack_require__(/*! ./flowchart.symbol.output */ 14); //tds\n\tvar Subroutine = __webpack_require__(/*! ./flowchart.symbol.subroutine */ 16);\n\tvar Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5);\n\tvar Parallel = __webpack_require__(/*! ./flowchart.symbol.parallel */ 6);\n\t\n\t\n\tfunction parse(input) {\n\t input = input || '';\n\t input = input.trim();\n\t\n\t var chart = {\n\t symbols: {},\n\t start: null,\n\t drawSVG: function(container, options) {\n\t var self = this;\n\t\n\t if (this.diagram) {\n\t this.diagram.clean();\n\t }\n\t\n\t var diagram = new FlowChart(container, options);\n\t this.diagram = diagram;\n\t var dispSymbols = {};\n\t\n\t function getDisplaySymbol(s) {\n\t if (dispSymbols[s.key]) {\n\t return dispSymbols[s.key];\n\t }\n\t\n\t switch (s.symbolType) {\n\t case 'start':\n\t dispSymbols[s.key] = new Start(diagram, s);\n\t break;\n\t case 'end':\n\t dispSymbols[s.key] = new End(diagram, s);\n\t break;\n\t case 'operation':\n\t dispSymbols[s.key] = new Operation(diagram, s);\n\t break;\n\t case 'inputoutput':\n\t dispSymbols[s.key] = new InputOutput(diagram, s);\n\t break;\n\t case 'input':\n\t dispSymbols[s.key] = new Input(diagram, s); //tds\n\t break; \n\t case 'output':\n\t dispSymbols[s.key] = new Output(diagram, s); //tds\n\t break; \n\t case 'subroutine':\n\t dispSymbols[s.key] = new Subroutine(diagram, s);\n\t break;\n\t case 'condition':\n\t dispSymbols[s.key] = new Condition(diagram, s);\n\t break;\n\t case 'parallel':\n\t dispSymbols[s.key] = new Parallel(diagram, s);\n\t break;\n\t default:\n\t return new Error('Wrong symbol type!');\n\t }\n\t\n\t return dispSymbols[s.key];\n\t }\n\t\n\t (function constructChart(s, prevDisp, prev) {\n\t var dispSymb = getDisplaySymbol(s);\n\t\n\t if (self.start === s) {\n\t diagram.startWith(dispSymb);\n\t } else if (prevDisp && prev && !prevDisp.pathOk) {\n\t if (prevDisp instanceof(Condition)) {\n\t if (prev.yes === s) {\n\t prevDisp.yes(dispSymb);\n\t }\n\t if (prev.no === s) {\n\t prevDisp.no(dispSymb);\n\t }\n\t } else if (prevDisp instanceof(Parallel)) {\n\t if (prev.path1 === s) {\n\t prevDisp.path1(dispSymb);\n\t }\n\t if (prev.path2 === s) {\n\t prevDisp.path2(dispSymb);\n\t }\n\t if (prev.path3 === s) {\n\t prevDisp.path3(dispSymb);\n\t }\n\t } else {\n\t prevDisp.then(dispSymb);\n\t }\n\t }\n\t\n\t if (dispSymb.pathOk) {\n\t return dispSymb;\n\t }\n\t\n\t if (dispSymb instanceof(Condition)) {\n\t if (s.yes) {\n\t constructChart(s.yes, dispSymb, s);\n\t }\n\t if (s.no) {\n\t constructChart(s.no, dispSymb, s);\n\t }\n\t } else if (dispSymb instanceof(Parallel)) {\n\t if (s.path1) {\n\t constructChart(s.path1, dispSymb, s);\n\t }\n\t if (s.path2) {\n\t constructChart(s.path2, dispSymb, s);\n\t }\n\t if (s.path3) {\n\t constructChart(s.path3, dispSymb, s);\n\t }\n\t } else if (s.next) {\n\t constructChart(s.next, dispSymb, s);\n\t }\n\t\n\t return dispSymb;\n\t })(this.start);\n\t\n\t diagram.render();\n\t },\n\t clean: function() {\n\t this.diagram.clean();\n\t },\n\t options: function() {\n\t return this.diagram.options;\n\t }\n\t };\n\t\n\t var lines = [];\n\t var prevBreak = 0;\n\t for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) {\n\t if(input[i0] === '\\n' && input[i0 - 1] !== '\\\\') {\n\t var line0 = input.substring(prevBreak, i0);\n\t prevBreak = i0 + 1;\n\t lines.push(line0.replace(/\\\\\\n/g, '\\n'));\n\t }\n\t }\n\t\n\t if (prevBreak < input.length) {\n\t lines.push(input.substr(prevBreak));\n\t }\n\t\n\t for (var l = 1, len = lines.length; l < len;) {\n\t var currentLine = lines[l];\n\t\n\t if (currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0 && currentLine.indexOf('@>') < 0) {\n\t lines[l - 1] += '\\n' + currentLine;\n\t lines.splice(l, 1);\n\t len--;\n\t } else {\n\t l++;\n\t }\n\t }\n\t\n\t function getStyle(s){\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t return s.substring(startIndex,endIndex);\n\t }\n\t return '{}';\n\t }\n\t\n\t function getSymbValue(s){\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t return s.substring(startIndex,endIndex);\n\t }\n\t return '';\n\t }\n\t\n\t function getSymbol(s) {\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t return chart.symbols[s.substring(0, startIndex - 1)];\n\t }\n\t return chart.symbols[s];\n\t }\n\t\n\t function getNextPath(s) {\n\t var next = 'next';\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t next = flowSymb.substring(startIndex, endIndex);\n\t if (next.indexOf(',') < 0) {\n\t if (next !== 'yes' && next !== 'no') {\n\t next = 'next, ' + next;\n\t }\n\t }\n\t }\n\t return next;\n\t }\n\t \n\t function getAnnotation(s) {\n\t\tvar startIndex = s.indexOf(\"(\") + 1, endIndex = s.indexOf(\")\");\n\t\tvar tmp = s.substring(startIndex, endIndex);\n\t\tif(tmp.indexOf(\",\") > 0) { tmp = tmp.substring(0, tmp.indexOf(\",\")); }\n\t\tvar tmp_split = tmp.split(\"@\");\n\t\tif(tmp_split.length > 1)\n\t\t\treturn startIndex >= 0 && endIndex >= 0 ? tmp_split[1] : \"\";\n\t }\n\t\n\t while (lines.length > 0) {\n\t var line = lines.splice(0, 1)[0].trim();\n\t\n\t if (line.indexOf('=>') >= 0) {\n\t // definition\n\t var parts = line.split('=>');\n\t var symbol = {\n\t key: parts[0].replace(/\\(.*\\)/, ''),\n\t symbolType: parts[1],\n\t text: null,\n\t link: null,\n\t target: null,\n\t flowstate: null,\n\t function: null,\n\t lineStyle: {},\n\t params: {}\n\t };\n\t\n\t //parse parameters\n\t var params = parts[0].match(/\\((.*)\\)/);\n\t if (params && params.length > 1){\n\t var entries = params[1].split(',');\n\t for(var i = 0; i < entries.length; i++) {\n\t var entry = entries[i].split('=');\n\t if (entry.length == 2) {\n\t symbol.params[entry[0]] = entry[1];\n\t }\n\t }\n\t }\n\t\n\t var sub;\n\t\n\t if (symbol.symbolType.indexOf(': ') >= 0) {\n\t sub = symbol.symbolType.split(': ');\n\t symbol.symbolType = sub.shift();\n\t symbol.text = sub.join(': ');\n\t }\n\t\n\t if (symbol.text && symbol.text.indexOf(':$') >= 0) {\n\t sub = symbol.text.split(':$');\n\t symbol.text = sub.shift();\n\t symbol.function = sub.join(':$');\n\t } else if (symbol.symbolType.indexOf(':$') >= 0) {\n\t sub = symbol.symbolType.split(':$');\n\t symbol.symbolType = sub.shift();\n\t symbol.function = sub.join(':$');\n\t } else if (symbol.text && symbol.text.indexOf(':>') >= 0) {\n\t sub = symbol.text.split(':>');\n\t symbol.text = sub.shift();\n\t symbol.link = sub.join(':>');\n\t } else if (symbol.symbolType.indexOf(':>') >= 0) {\n\t sub = symbol.symbolType.split(':>');\n\t symbol.symbolType = sub.shift();\n\t symbol.link = sub.join(':>');\n\t }\n\t\n\t if (symbol.symbolType.indexOf('\\n') >= 0) {\n\t symbol.symbolType = symbol.symbolType.split('\\n')[0];\n\t }\n\t\n\t /* adding support for links */\n\t if (symbol.link) {\n\t var startIndex = symbol.link.indexOf('[') + 1;\n\t var endIndex = symbol.link.indexOf(']');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t symbol.target = symbol.link.substring(startIndex, endIndex);\n\t symbol.link = symbol.link.substring(0, startIndex - 1);\n\t }\n\t }\n\t /* end of link support */\n\t\n\t /* adding support for flowstates */\n\t if (symbol.text) {\n\t if (symbol.text.indexOf('|') >= 0) {\n\t var txtAndState = symbol.text.split('|');\n\t symbol.flowstate = txtAndState.pop().trim();\n\t symbol.text = txtAndState.join('|');\n\t }\n\t }\n\t /* end of flowstate support */\n\t\n\t chart.symbols[symbol.key] = symbol;\n\t\n\t } else if (line.indexOf('->') >= 0) {\n\t var ann = getAnnotation(line);\n\t if (ann) {\n\t line = line.replace('@' + ann, ''); \n\t }\n\t // flow\n\t var flowSymbols = line.split('->');\n\t for (var iS = 0, lenS = flowSymbols.length; iS < lenS; iS++) {\n\t var flowSymb = flowSymbols[iS];\n\t var symbVal = getSymbValue(flowSymb);\n\t\n\t if (symbVal === 'true' || symbVal === 'false') {\n\t // map true or false to yes or no respectively\n\t flowSymb = flowSymb.replace('true', 'yes');\n\t flowSymb = flowSymb.replace('false', 'no');\n\t }\n\t \n\t var next = getNextPath(flowSymb);\n\t var realSymb = getSymbol(flowSymb);\n\t\n\t var direction = null;\n\t if (next.indexOf(',') >= 0) {\n\t var condOpt = next.split(',');\n\t next = condOpt[0];\n\t direction = condOpt[1].trim();\n\t }\n\t\n\t if (ann) {\n\t if (realSymb.symbolType === 'condition') {\n\t if (next === \"yes\" || next === \"true\") {\n\t realSymb.yes_annotation = ann;\n\t } else {\n\t realSymb.no_annotation = ann;\n\t }\n\t } else if (realSymb.symbolType === 'parallel') {\n\t if (next === 'path1') {\n\t realSymb.path1_annotation = ann;\n\t } else if (next === 'path2') {\n\t realSymb.path2_annotation = ann;\n\t } else if (next === 'path3') {\n\t realSymb.path3_annotation = ann;\n\t }\n\t }\n\t ann = null;\n\t }\n\t\n\t if (!chart.start) {\n\t chart.start = realSymb;\n\t }\n\t\n\t if (iS + 1 < lenS) {\n\t var nextSymb = flowSymbols[iS + 1];\n\t realSymb[next] = getSymbol(nextSymb);\n\t realSymb['direction_' + next] = direction;\n\t direction = null;\n\t }\n\t }\n\t } else if (line.indexOf('@>') >= 0) {\n\t\n\t // line style\n\t var lineStyleSymbols = line.split('@>');\n\t for (var iSS = 0, lenSS = lineStyleSymbols.length; iSS < lenSS; iSS++) {\n\t if ((iSS + 1) !== lenSS) {\n\t var curSymb = getSymbol(lineStyleSymbols[iSS]);\n\t var nextSymbol = getSymbol(lineStyleSymbols[iSS+1]);\n\t\n\t curSymb['lineStyle'][nextSymbol.key] = JSON.parse(getStyle(lineStyleSymbols[iSS + 1]));\n\t }\n\t }\n\t }\n\t\n\t }\n\t return chart;\n\t}\n\t\n\tmodule.exports = parse;\n\n\n/***/ }),\n/* 5 */\n/*!*******************************************!*\\\n !*** ./src/flowchart.symbol.condition.js ***!\n \\*******************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction Condition(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.yes_annotation = options.yes_annotation;\n\t this.no_annotation = options.no_annotation;\n\t this.textMargin = this.getAttr('text-margin');\n\t this.yes_direction = options.direction_yes;\n\t this.no_direction = options.direction_no;\n\t if (!this.no_direction && this.yes_direction === 'right') {\n\t this.no_direction = 'bottom';\n\t } else if (!this.yes_direction && this.no_direction === 'bottom') {\n\t this.yes_direction = 'right'\n\t }\n\t this.yes_direction = this.yes_direction || 'bottom';\n\t this.no_direction = this.no_direction || 'right';\n\t\n\t this.text.attr({\n\t x: this.textMargin * 2\n\t });\n\t\n\t var width = this.text.getBBox().width + 3 * this.textMargin;\n\t width += width/2;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t height += height/2;\n\t height = Math.max(width * 0.5, height);\n\t var startX = width/4;\n\t var startY = height/4;\n\t\n\t this.text.attr({\n\t x: startX + this.textMargin/2\n\t });\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - width/4, y: startY + height/4},\n\t {x: startX - width/4 + width/2, y: startY + height/4 + height/2},\n\t {x: startX - width/4 + width, y: startY + height/4},\n\t {x: startX - width/4 + width/2, y: startY + height/4 - height/2},\n\t {x: startX - width/4, y: startY + height/4}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t this.symbol = symbol\n\t\n\t this.initialize();\n\t}\n\tinherits(Condition, Symbol);\n\t\n\tCondition.prototype.render = function() {\n\t var self = this;\n\t if (this.yes_direction) {\n\t this[this.yes_direction + '_symbol'] = this.yes_symbol;\n\t }\n\t\n\t if (this.no_direction) {\n\t this[this.no_direction + '_symbol'] = this.no_symbol;\n\t }\n\t\n\t var lineLength = this.getAttr('line-length');\n\t\n\t if (this.bottom_symbol) {\n\t var bottomPoint = this.getBottom();\n\t\n\t if (!this.bottom_symbol.isPositioned) {\n\t this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n\t this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2);\n\t this.bottom_symbol.isPositioned = true;\n\t\n\t this.bottom_symbol.render();\n\t }\n\t }\n\t\n\t if (this.right_symbol) {\n\t var rightPoint = this.getRight();\n\t\n\t if (!this.right_symbol.isPositioned) {\n\t\n\t this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2);\n\t this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n\t\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t if (!self.params['align-next'] || self.params['align-next'] !== 'no') { \n\t var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n\t if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t if (self.right_symbol.symbolType === 'end') return;\n\t self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.right_symbol.isPositioned = true;\n\t\n\t this.right_symbol.render();\n\t }\n\t }\n\t \n\t if (this.left_symbol) {\n\t var leftPoint = this.getLeft();\n\t \n\t if (!this.left_symbol.isPositioned) {\n\t this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2);\n\t this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n\t\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t \n\t if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n\t var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x);\n\t if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t }\n\t \n\t if (hasSymbolUnder) {\n\t if (self.left_symbol.symbolType === 'end') return;\n\t self.left_symbol.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t \n\t this.left_symbol.isPositioned = true;\n\t \n\t this.left_symbol.render();\n\t }\n\t }\n\t};\n\t\n\tCondition.prototype.renderLines = function() {\n\t if (this.yes_symbol) {\n\t this.drawLineTo(this.yes_symbol, this.yes_annotation ? this.yes_annotation : this.getAttr('yes-text'), this.yes_direction);\n\t }\n\t\n\t if (this.no_symbol) {\n\t this.drawLineTo(this.no_symbol, this.no_annotation ? this.no_annotation : this.getAttr('no-text'), this.no_direction);\n\t }\n\t};\n\t\n\tmodule.exports = Condition;\n\n\n/***/ }),\n/* 6 */\n/*!******************************************!*\\\n !*** ./src/flowchart.symbol.parallel.js ***!\n \\******************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Parallel(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0);\n\t options = options || {};\n\t Symbol.call(this, chart, options, symbol);\n\t this.path1_annotation = options.path1_annotation || '';\n\t this.path2_annotation = options.path2_annotation || '';\n\t this.path3_annotation = options.path3_annotation || '';\n\t this.textMargin = this.getAttr('text-margin');\n\t this.path1_direction = 'bottom';\n\t this.path2_direction = 'right';\n\t this.path3_direction = 'top';\n\t this.params = options.params;\n\t if (options.direction_next === 'path1' && !options[options.direction_next] && options.next) {\n\t options[options.direction_next] = options.next;\n\t }\n\t if (options.direction_next === 'path2' && !options[options.direction_next] && options.next) {\n\t options[options.direction_next] = options.next;\n\t }\n\t if (options.direction_next === 'path3' && !options[options.direction_next] && options.next) {\n\t options[options.direction_next] = options.next;\n\t }\n\t\n\t if (options.path1 && options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && !options.direction_path3) {\n\t if (options.direction_path1 === 'right') {\n\t this.path2_direction = 'bottom';\n\t this.path1_direction = 'right';\n\t this.path3_direction = 'top';\n\t } else if (options.direction_path1 === 'top') {\n\t this.path2_direction = 'right';\n\t this.path1_direction = 'top';\n\t this.path3_direction = 'bottom';\n\t } else if (options.direction_path1 === 'left') {\n\t this.path2_direction = 'right';\n\t this.path1_direction = 'left';\n\t this.path3_direction = 'bottom';\n\t } else {\n\t this.path2_direction = 'right';\n\t this.path1_direction = 'bottom';\n\t this.path3_direction = 'top';\n\t }\n\t } else if (options.path1 && !options.direction_path1 && options.path2 && options.direction_path2 && options.path3 && !options.direction_path3) {\n\t if (options.direction_path2 === 'right') {\n\t this.path1_direction = 'bottom';\n\t this.path2_direction = 'right';\n\t this.path3_direction = 'top';\n\t } else if (options.direction_path2 === 'left') {\n\t this.path1_direction = 'bottom';\n\t this.path2_direction = 'left';\n\t this.path3_direction = 'right';\n\t } else {\n\t this.path1_direction = 'right';\n\t this.path2_direction = 'bottom';\n\t this.path3_direction = 'top';\n\t }\n\t } else if (options.path1 && !options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && options.direction_path3) {\n\t if (options.direction_path2 === 'right') {\n\t this.path1_direction = 'bottom';\n\t this.path2_direction = 'top';\n\t this.path3_direction = 'right';\n\t } else if (options.direction_path2 === 'left') {\n\t this.path1_direction = 'bottom';\n\t this.path2_direction = 'right';\n\t this.path3_direction = 'left';\n\t } else {\n\t this.path1_direction = 'right';\n\t this.path2_direction = 'bottom';\n\t this.path3_direction = 'top';\n\t }\n\t } else {\n\t this.path1_direction = options.direction_path1;\n\t this.path2_direction = options.direction_path2;\n\t this.path3_direction = options.direction_path3;\n\t }\n\t\n\t this.path1_direction = this.path1_direction || 'bottom';\n\t this.path2_direction = this.path2_direction || 'right';\n\t this.path3_direction = this.path3_direction || 'top';\n\t\n\t this.initialize();\n\t}\n\tinherits(Parallel, Symbol);\n\t\n\tParallel.prototype.render = function() {\n\t if (this.path1_direction) {\n\t this[this.path1_direction + '_symbol'] = this.path1_symbol;\n\t }\n\t\n\t if (this.path2_direction) {\n\t this[this.path2_direction + '_symbol'] = this.path2_symbol;\n\t }\n\t\n\t if (this.path3_direction) {\n\t this[this.path3_direction + '_symbol'] = this.path3_symbol;\n\t }\n\t\n\t var lineLength = this.getAttr('line-length');\n\t\n\t if (this.bottom_symbol) {\n\t var bottomPoint = this.getBottom();\n\t\n\t if (!this.bottom_symbol.isPositioned) {\n\t this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n\t this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width / 2);\n\t this.bottom_symbol.isPositioned = true;\n\t\n\t this.bottom_symbol.render();\n\t }\n\t }\n\t\n\t if (this.top_symbol) {\n\t var topPoint = this.getTop();\n\t\n\t if (!this.top_symbol.isPositioned) {\n\t this.top_symbol.shiftY(this.getY() - this.top_symbol.height - lineLength);\n\t this.top_symbol.setX(topPoint.x + this.top_symbol.width);\n\t this.top_symbol.isPositioned = true;\n\t\n\t this.top_symbol.render();\n\t }\n\t }\n\t\n\t var self = this;\n\t\n\t if (this.left_symbol) {\n\t var leftPoint = this.getLeft();\n\t\n\t if (!this.left_symbol.isPositioned) {\n\t this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2);\n\t this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n\t var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x);\n\t if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t if (self.left_symbol.symbolType === 'end') return;\n\t self.left_symbol.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.left_symbol.isPositioned = true;\n\t\n\t this.left_symbol.render();\n\t }\n\t }\n\t\n\t if (this.right_symbol) {\n\t var rightPoint = this.getRight();\n\t\n\t if (!this.right_symbol.isPositioned) {\n\t this.right_symbol.setY(rightPoint.y - this.right_symbol.height / 2);\n\t this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n\t var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n\t if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width / 2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t if (self.right_symbol.symbolType === 'end') return;\n\t self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.right_symbol.isPositioned = true;\n\t\n\t this.right_symbol.render();\n\t }\n\t }\n\t};\n\t\n\tParallel.prototype.renderLines = function() {\n\t if (this.path1_symbol) {\n\t this.drawLineTo(this.path1_symbol, this.path1_annotation, this.path1_direction);\n\t }\n\t\n\t if (this.path2_symbol) {\n\t this.drawLineTo(this.path2_symbol, this.path2_annotation, this.path2_direction);\n\t }\n\t\n\t if (this.path3_symbol) {\n\t this.drawLineTo(this.path3_symbol, this.path3_annotation, this.path3_direction);\n\t }\n\t};\n\t\n\tmodule.exports = Parallel;\n\n/***/ }),\n/* 7 */\n/*!********************************!*\\\n !*** ./src/flowchart.chart.js ***!\n \\********************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Raphael = __webpack_require__(/*! raphael */ 18);\n\tvar defaults = __webpack_require__(/*! ./flowchart.helpers */ 1).defaults;\n\tvar defaultOptions = __webpack_require__(/*! ./flowchart.defaults */ 8);\n\tvar Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5);\n\tvar Parallel = __webpack_require__(/*! ./flowchart.symbol.parallel */ 6);\n\t\n\tfunction FlowChart(container, options) {\n\t options = options || {};\n\t\n\t this.paper = new Raphael(container);\n\t\n\t this.options = defaults(options, defaultOptions);\n\t\n\t this.symbols = [];\n\t this.lines = [];\n\t this.start = null;\n\t}\n\t\n\tFlowChart.prototype.handle = function(symbol) {\n\t if (this.symbols.indexOf(symbol) <= -1) {\n\t this.symbols.push(symbol);\n\t }\n\t\n\t var flowChart = this;\n\t\n\t if (symbol instanceof(Condition)) {\n\t symbol.yes = function(nextSymbol) {\n\t symbol.yes_symbol = nextSymbol;\n\t if(symbol.no_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t symbol.no = function(nextSymbol) {\n\t symbol.no_symbol = nextSymbol;\n\t if (symbol.yes_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t } else if (symbol instanceof(Parallel)) {\n\t symbol.path1 = function(nextSymbol) {\n\t symbol.path1_symbol = nextSymbol;\n\t if (symbol.path2_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t symbol.path2 = function(nextSymbol) {\n\t symbol.path2_symbol = nextSymbol;\n\t if (symbol.path3_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t symbol.path3 = function(nextSymbol) {\n\t symbol.path3_symbol = nextSymbol;\n\t if (symbol.path1_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t } else {\n\t symbol.then = function(nextSymbol) {\n\t symbol.next = nextSymbol;\n\t symbol.pathOk = true;\n\t return flowChart.handle(nextSymbol);\n\t };\n\t }\n\t\n\t return symbol;\n\t};\n\t\n\tFlowChart.prototype.startWith = function(symbol) {\n\t this.start = symbol;\n\t return this.handle(symbol);\n\t};\n\t\n\tFlowChart.prototype.render = function() {\n\t var maxWidth = 0,\n\t maxHeight = 0,\n\t i = 0,\n\t len = 0,\n\t maxX = 0,\n\t maxY = 0,\n\t minX = 0,\n\t minY = 0,\n\t symbol,\n\t line;\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t if (symbol.width > maxWidth) {\n\t maxWidth = symbol.width;\n\t }\n\t if (symbol.height > maxHeight) {\n\t maxHeight = symbol.height;\n\t }\n\t }\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']);\n\t symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']);\n\t }\n\t\n\t this.start.render();\n\t // for (i = 0, len = this.symbols.length; i < len; i++) {\n\t // symbol = this.symbols[i];\n\t // symbol.render();\n\t // }\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t symbol.renderLines();\n\t }\n\t\n\t maxX = this.maxXFromLine;\n\t\n\t var x;\n\t var y;\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t var leftX = symbol.getX()\n\t x = leftX + symbol.width;\n\t y = symbol.getY() + symbol.height;\n\t if (leftX < minX) {\n\t minX = leftX;\n\t }\n\t if (x > maxX) {\n\t maxX = x;\n\t }\n\t if (y > maxY) {\n\t maxY = y;\n\t }\n\t }\n\t\n\t for (i = 0, len = this.lines.length; i < len; i++) {\n\t line = this.lines[i].getBBox();\n\t x = line.x;\n\t y = line.y;\n\t var x2 = line.x2;\n\t var y2 = line.y2;\n\t if (x < minX) {\n\t minX = x;\n\t }\n\t if (y < minY) {\n\t minY = y;\n\t }\n\t if (x2 > maxX) {\n\t maxX = x2;\n\t }\n\t if (y2 > maxY) {\n\t maxY = y2;\n\t }\n\t }\n\t\n\t var scale = this.options['scale'];\n\t var lineWidth = this.options['line-width'];\n\t\n\t if (this.minXFromSymbols < minX) minX = this.minXFromSymbols;\n\t\n\t if (minX < 0) minX -= lineWidth;\n\t if (minY < 0) minY -= lineWidth;\n\t\n\t var width = maxX + lineWidth - minX;\n\t var height = maxY + lineWidth - minY;\n\t\n\t this.paper.setSize(width * scale, height * scale);\n\t this.paper.setViewBox(minX, minY, width, height, true);\n\t};\n\t\n\tFlowChart.prototype.clean = function() {\n\t if (this.paper) {\n\t var paperDom = this.paper.canvas;\n\t paperDom.parentNode && paperDom.parentNode.removeChild(paperDom);\n\t }\n\t};\n\t\n\tmodule.exports = FlowChart;\n\n/***/ }),\n/* 8 */\n/*!***********************************!*\\\n !*** ./src/flowchart.defaults.js ***!\n \\***********************************/\n/***/ (function(module, exports) {\n\n\t// defaults\n\tmodule.exports = {\n\t 'x': 0,\n\t 'y': 0,\n\t // 'roundness': 0,\n\t 'line-width': 3,\n\t 'line-length': 50,\n\t 'text-margin': 10,\n\t 'font-size': 14,\n\t 'font-color': 'black',\n\t // 'font': 'normal',\n\t // 'font-family': 'calibri',\n\t // 'font-weight': 'normal',\n\t 'line-color': 'black',\n\t 'element-color': 'black',\n\t 'fill': 'white',\n\t 'yes-text': 'yes',\n\t 'no-text': 'no',\n\t 'arrow-end': 'block',\n\t 'class': 'flowchart',\n\t 'scale': 1,\n\t 'symbols': {\n\t 'start': {},\n\t 'end': {},\n\t 'condition': {},\n\t 'inputoutput': {},\n\t 'input': {}, //tds\n\t 'output': {}, //tds \n\t 'operation': {},\n\t 'subroutine': {},\n\t 'parallel': {}\n\t } //,\n\t // 'flowstate' : {\n\t // 'past' : { 'fill': '#CCCCCC', 'font-size': 12},\n\t // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'},\n\t // 'future' : { 'fill': '#FFFF99'},\n\t // 'invalid': {'fill': '#444444'}\n\t // }\n\t};\n\n/***/ }),\n/* 9 */\n/*!*******************************!*\\\n !*** ./src/flowchart.shim.js ***!\n \\*******************************/\n/***/ (function(module, exports) {\n\n\t// add indexOf to non ECMA-262 standard compliant browsers\n\tif (!Array.prototype.indexOf) {\n\t Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {\n\t \"use strict\";\n\t if (this === null) {\n\t throw new TypeError();\n\t }\n\t var t = Object(this);\n\t var len = t.length >>> 0;\n\t if (len === 0) {\n\t return -1;\n\t }\n\t var n = 0;\n\t if (arguments.length > 0) {\n\t n = Number(arguments[1]);\n\t if (n != n) { // shortcut for verifying if it's NaN\n\t n = 0;\n\t } else if (n !== 0 && n != Infinity && n != -Infinity) {\n\t n = (n > 0 || -1) * Math.floor(Math.abs(n));\n\t }\n\t }\n\t if (n >= len) {\n\t return -1;\n\t }\n\t var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);\n\t for (; k < len; k++) {\n\t if (k in t && t[k] === searchElement) {\n\t return k;\n\t }\n\t }\n\t return -1;\n\t };\n\t}\n\t\n\t// add lastIndexOf to non ECMA-262 standard compliant browsers\n\tif (!Array.prototype.lastIndexOf) {\n\t Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {\n\t \"use strict\";\n\t if (this === null) {\n\t throw new TypeError();\n\t }\n\t var t = Object(this);\n\t var len = t.length >>> 0;\n\t if (len === 0) {\n\t return -1;\n\t }\n\t var n = len;\n\t if (arguments.length > 1) {\n\t n = Number(arguments[1]);\n\t if (n != n) {\n\t n = 0;\n\t } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) {\n\t n = (n > 0 || -1) * Math.floor(Math.abs(n));\n\t }\n\t }\n\t var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);\n\t for (; k >= 0; k--) {\n\t if (k in t && t[k] === searchElement) {\n\t return k;\n\t }\n\t }\n\t return -1;\n\t };\n\t}\n\t\n\tif (!String.prototype.trim) {\n\t String.prototype.trim = function() {\n\t return this.replace(/^\\s+|\\s+$/g, '');\n\t };\n\t}\n\n/***/ }),\n/* 10 */\n/*!*************************************!*\\\n !*** ./src/flowchart.symbol.end.js ***!\n \\*************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction End(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n\t options = options || {};\n\t options.text = options.text || 'End';\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(End, Symbol);\n\t\n\tmodule.exports = End;\n\n\n/***/ }),\n/* 11 */\n/*!***************************************!*\\\n !*** ./src/flowchart.symbol.input.js ***!\n \\***************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction Input(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.textMargin = this.getAttr('text-margin');\n\t\n\t this.text.attr({\n\t x: this.textMargin * 3\n\t });\n\t\n\t var width = this.text.getBBox().width + 4 * this.textMargin;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t var startX = this.textMargin;\n\t var startY = height/2;\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - this.textMargin + 2 * this.textMargin, y: height},\n\t {x: startX - this.textMargin + width, y: height},\n\t {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n\t {x: startX - this.textMargin, y: 0},\n\t {x: startX, y: startY}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t this.symbol = symbol\n\t\n\t this.initialize();\n\t}\n\tinherits(Input, Symbol);\n\t\n\tInput.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tInput.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width - this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tmodule.exports = Input;\n\t\n\t\n\n\n/***/ }),\n/* 12 */\n/*!*********************************************!*\\\n !*** ./src/flowchart.symbol.inputoutput.js ***!\n \\*********************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction InputOutput(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.textMargin = this.getAttr('text-margin');\n\t\n\t this.text.attr({\n\t x: this.textMargin * 3\n\t });\n\t\n\t var width = this.text.getBBox().width + 4 * this.textMargin;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t var startX = this.textMargin;\n\t var startY = height/2;\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - this.textMargin, y: height},\n\t {x: startX - this.textMargin + width, y: height},\n\t {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n\t {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n\t {x: startX, y: startY}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t this.symbol = symbol\n\t\n\t this.initialize();\n\t}\n\tinherits(InputOutput, Symbol);\n\t\n\tInputOutput.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tInputOutput.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width - this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tmodule.exports = InputOutput;\n\n\n/***/ }),\n/* 13 */\n/*!*******************************************!*\\\n !*** ./src/flowchart.symbol.operation.js ***!\n \\*******************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Operation(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0);\n\t options = options || {};\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(Operation, Symbol);\n\t\n\tmodule.exports = Operation;\n\n\n/***/ }),\n/* 14 */\n/*!****************************************!*\\\n !*** ./src/flowchart.symbol.output.js ***!\n \\****************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction Output(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.textMargin = this.getAttr('text-margin');\n\t\n\t this.text.attr({\n\t x: this.textMargin * 3\n\t });\n\t\n\t var width = this.text.getBBox().width + 4 * this.textMargin;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t var startX = this.textMargin;\n\t var startY = height/2;\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - this.textMargin, y: height},\n\t {x: startX - this.textMargin + width + 2 * this.textMargin, y: height},\n\t {x: startX - this.textMargin + width, y: 0},\n\t {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n\t {x: startX, y: startY}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t this.symbol = symbol\n\t\n\t this.initialize();\n\t}\n\tinherits(Output, Symbol);\n\t\n\tOutput.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tOutput.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width - this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tmodule.exports = Output;\n\t\n\t\n\t\n\t/*\n\t//var Symbol = require('./flowchart.symbol');\n\tvar inherits = require('./flowchart.helpers').inherits;\n\tvar drawAPI = require('./flowchart.functions');\n\tvar InputOutput = require('./flowchart.symbol.inputoutput');\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction Output(chart, options) {\n\t options = options || {};\n\t InputOutput.call(this, chart, options);\n\t\n\t var width = this.text.getBBox().width + 4 * this.textMargin;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t var startX = this.textMargin;\n\t var startY = height/2;\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - this.textMargin + 2 * this.textMargin, y: height},\n\t {x: startX - this.textMargin + width, y: height},\n\t {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n\t {x: startX - this.textMargin, y: 0},\n\t {x: startX, y: startY}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t \n\t if (this.symbol){\n\t this.group.remove(this.symbol); //tds\n\t this.symbol.parentNode.removeChild(this.symbol); //tds\n\t }\n\t this.symbol = symbol\n\t\n\t this.initialize();\n\t}\n\tinherits(Output, InputOutput);\n\t\n\tmodule.exports = Output;\n\t*/\n\n\n/***/ }),\n/* 15 */\n/*!***************************************!*\\\n !*** ./src/flowchart.symbol.start.js ***!\n \\***************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Start(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n\t options = options || {};\n\t options.text = options.text || 'Start';\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(Start, Symbol);\n\t\n\tmodule.exports = Start;\n\t\n\t// Start.prototype.render = function() {\n\t// if (this.next) {\n\t// var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length'];\n\t\n\t// var bottomPoint = this.getBottom();\n\t// var topPoint = this.next.getTop();\n\t\n\t// if (!this.next.isPositioned) {\n\t// this.next.shiftY(this.getY() + this.height + lineLength);\n\t// this.next.setX(bottomPoint.x - this.next.width/2);\n\t// this.next.isPositioned = true;\n\t\n\t// this.next.render();\n\t// }\n\t// }\n\t// };\n\t\n\t// Start.prototype.renderLines = function() {\n\t// if (this.next) {\n\t// this.drawLineTo(this.next);\n\t// }\n\t// };\n\n\n/***/ }),\n/* 16 */\n/*!********************************************!*\\\n !*** ./src/flowchart.symbol.subroutine.js ***!\n \\********************************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Subroutine(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0);\n\t options = options || {};\n\t Symbol.call(this, chart, options, symbol);\n\t\n\t symbol.attr({\n\t width: this.text.getBBox().width + 4 * this.getAttr('text-margin')\n\t });\n\t\n\t this.text.attr({\n\t 'x': 2 * this.getAttr('text-margin')\n\t });\n\t\n\t var innerWrap = chart.paper.rect(0, 0, 0, 0);\n\t innerWrap.attr({\n\t x: this.getAttr('text-margin'),\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t width: this.text.getBBox().width + 2 * this.getAttr('text-margin'),\n\t height: this.text.getBBox().height + 2 * this.getAttr('text-margin'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.key) { innerWrap.node.id = options.key + 'i'; }\n\t\n\t var font = this.getAttr('font');\n\t var fontF = this.getAttr('font-family');\n\t var fontW = this.getAttr('font-weight');\n\t\n\t if (font) innerWrap.attr({ 'font': font });\n\t if (fontF) innerWrap.attr({ 'font-family': fontF });\n\t if (fontW) innerWrap.attr({ 'font-weight': fontW });\n\t\n\t if (options.link) { innerWrap.attr('href', options.link); }\n\t if (options.target) { innerWrap.attr('target', options.target); }\n\t this.group.push(innerWrap);\n\t innerWrap.insertBefore(this.text);\n\t\n\t this.initialize();\n\t}\n\tinherits(Subroutine, Symbol);\n\t\n\tmodule.exports = Subroutine;\n\n\n/***/ }),\n/* 17 */\n/*!******************************!*\\\n !*** ./src/jquery-plugin.js ***!\n \\******************************/\n/***/ (function(module, exports, __webpack_require__) {\n\n\tif (typeof jQuery != 'undefined') {\n\t\tvar parse = __webpack_require__(/*! ./flowchart.parse */ 4);\n\t\n\t\t(function( $ ) {\n\t\t\tfunction paramFit(needle, haystack) {\n\t\t\t\treturn needle == haystack ||\n\t\t\t\t( Array.isArray(haystack) && (haystack.includes(needle) || haystack.includes(Number(needle)) ))\n\t\t\t}\n\t\t\tvar methods = {\n\t\t\t\tinit : function(options) {\n\t\t\t\t\treturn this.each(function() {\n\t\t\t\t\t\tvar $this = $(this);\n\t\t\t\t\t\tthis.chart = parse($this.text());\n\t\t\t\t\t\t$this.html('');\n\t\t\t\t\t\tthis.chart.drawSVG(this, options);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tsetFlowStateByParam : function(param, paramValue, newFlowState) {\n\t\t\t\t\treturn this.each(function() {\n\t\t\t\t\t\tvar chart = this.chart;\n\t\n\t\t\t\t\t\t// @todo this should be part of Symbol API\n\t\t\t\t\t\tvar nextSymbolKeys = ['next', 'yes', 'no', 'path1', 'path2', 'path3'];\n\t\n\t\t\t\t\t\tfor (var property in chart.symbols) {\n\t\t\t\t\t\t\tif (chart.symbols.hasOwnProperty(property)) {\n\t\t\t\t\t\t\t\tvar symbol = chart.symbols[property];\n\t\t\t\t\t\t\t\tvar val = symbol.params[param];\n\t\t\t\t\t\t\t\tif (paramFit(val, paramValue)) {\n\t\t\t\t\t\t\t\t\tsymbol.flowstate = newFlowState;\n\t\t\t\t\t\t\t\t\tfor (var nski = 0; nski < nextSymbolKeys.length; nski++) {\n\t\t\t\t\t\t\t\t\t\tvar nextSymbolKey = nextSymbolKeys[nski];\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey] &&\n\t\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey]['params'] &&\n\t\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey]['params'][param] &&\n\t\t\t\t\t\t\t\t\t\t\tparamFit(symbol[nextSymbolKey]['params'][param], paramValue)\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tsymbol.lineStyle[symbol[nextSymbolKey]['key']] = {stroke: chart.options()['flowstate'][newFlowState]['fill']};\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tchart.clean();\n\t\t\t\t\t\tchart.drawSVG(this);\n\t\t\t\t\t});\n\t\n\t\t\t\t},\n\t\t\t\tclearFlowState: function () {\n\t\t\t\t\treturn this.each(function() {\n\t\t\t\t\t\tvar chart = this.chart;\n\t\n\t\t\t\t\t\tfor (var property in chart.symbols) {\n\t\t\t\t\t\t\tif (chart.symbols.hasOwnProperty(property)) {\n\t\t\t\t\t\t\t\tvar node = chart.symbols[property];\n\t\t\t\t\t\t\t\tnode.flowstate = '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tchart.clean();\n\t\t\t\t\t\tchart.drawSVG(this);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t\t$.fn.flowChart = function(methodOrOptions) {\n\t\t\t\tif ( methods[methodOrOptions] ) {\n\t\t\t\t\treturn methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));\n\t\t\t\t} else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {\n\t\t\t\t\t// Default to \"init\"\n\t\t\t\t\treturn methods.init.apply( this, arguments );\n\t\t\t\t} else {\n\t\t\t\t\t$.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.flowChart' );\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t})(jQuery); // eslint-disable-line\n\t}\n\n\n/***/ }),\n/* 18 */\n/*!**************************!*\\\n !*** external \"Raphael\" ***!\n \\**************************/\n/***/ (function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_18__;\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// flowchart.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 0c167881307e9f1b2ebf","require('./src/flowchart.shim');\nvar parse = require('./src/flowchart.parse');\nrequire('./src/jquery-plugin');\n\nvar FlowChart = {\n\tparse: parse\n};\n\nif (typeof window !== 'undefined') {\n\twindow.flowchart = FlowChart;\n}\n\nmodule.exports = FlowChart;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./index.js\n// module id = 0\n// module chunks = 0","function _defaults(options, defaultOptions) {\n if (!options || typeof options === 'function') {\n return defaultOptions;\n }\n\n var merged = {};\n for (var attrname in defaultOptions) {\n merged[attrname] = defaultOptions[attrname];\n }\n\n for (attrname in options) {\n if (options[attrname]) {\n if (typeof merged[attrname] === 'object') {\n merged[attrname] = _defaults(merged[attrname], options[attrname]);\n } else {\n merged[attrname] = options[attrname];\n }\n }\n }\n return merged;\n}\n\nfunction _inherits(ctor, superCtor) {\n if (typeof(Object.create) === 'function') {\n // implementation from standard node.js 'util' module\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n } else {\n // old school shim for old browsers\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n}\n\n// move dependent functions to a container so that\n// they can be overriden easier in no jquery environment (node.js)\nmodule.exports = {\n defaults: _defaults,\n inherits: _inherits\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.helpers.js\n// module id = 1\n// module chunks = 0","var drawAPI = require('./flowchart.functions');\nvar drawLine = drawAPI.drawLine;\nvar checkLineIntersection = drawAPI.checkLineIntersection;\n\nfunction Symbol(chart, options, symbol) {\n this.chart = chart;\n this.group = this.chart.paper.set();\n this.symbol = symbol;\n this.connectedTo = [];\n this.symbolType = options.symbolType;\n this.flowstate = (options.flowstate || 'future');\n this.lineStyle = (options.lineStyle || {});\n this.key = (options.key || '');\n this.leftLines = [];\n this.rightLines = [];\n this.topLines = [];\n this.bottomLines = [];\n this.params = options.params;\n\n this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined;\n\n this.text = this.chart.paper.text(0, 0, options.text);\n //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t\n if (options.key) { this.text.node.id = options.key + 't'; }\n this.text.node.setAttribute('class', this.getAttr('class') + 't');\n\n this.text.attr({\n 'text-anchor': 'start',\n 'x' : this.getAttr('text-margin'),\n 'fill' : this.getAttr('font-color'),\n 'font-size' : this.getAttr('font-size')\n });\n\n var font = this.getAttr('font');\n var fontF = this.getAttr('font-family');\n var fontW = this.getAttr('font-weight');\n\n if (font) this.text.attr({ 'font': font });\n if (fontF) this.text.attr({ 'font-family': fontF });\n if (fontW) this.text.attr({ 'font-weight': fontW });\n\n if (options.link) { this.text.attr('href', options.link); }\n \n //ndrqu Add click function with event and options params\n if (options.function) { \n this.text.attr({ 'cursor' : 'pointer' });\n\n this.text.node.addEventListener(\"click\", function(evt) {\n window[options.function](evt,options);\n }, false);\n }\n\n if (options.target) { this.text.attr('target', options.target); }\n\n var maxWidth = this.getAttr('maxWidth');\n if (maxWidth) {\n // using this approach: http://stackoverflow.com/a/3153457/22466\n var words = options.text.split(' ');\n var tempText = \"\";\n for (var i=0, ii=words.length; i maxWidth) {\n tempText += \"\\n\" + word;\n } else {\n tempText += \" \" + word;\n }\n }\n this.text.attr(\"text\", tempText.substring(1));\n }\n\n this.group.push(this.text);\n\n if (symbol) {\n var tmpMargin = this.getAttr('text-margin');\n\n symbol.attr({\n 'fill' : this.getAttr('fill'),\n 'stroke' : this.getAttr('element-color'),\n 'stroke-width' : this.getAttr('line-width'),\n 'width' : this.text.getBBox().width + 2 * tmpMargin,\n 'height' : this.text.getBBox().height + 2 * tmpMargin\n });\n\n symbol.node.setAttribute('class', this.getAttr('class'));\n var roundness = this.getAttr('roundness');\n if (!isNaN(roundness)) {\n symbol.node.setAttribute('ry', roundness);\n symbol.node.setAttribute('rx', roundness);\n }\n\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n\n //ndrqu Add click function with event and options params\n if (options.function) { \n symbol.node.addEventListener(\"click\", function(evt) {\n window[options.function](evt,options);\n }, false);\n symbol.attr({ 'cursor' : 'pointer' });\n }\n if (options.key) { symbol.node.id = options.key; }\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n\n this.text.attr({\n 'y': symbol.getBBox().height/2\n });\n\n this.initialize();\n }\n\n}\n\n/* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */\nSymbol.prototype.getAttr = function(attName) {\n if (!this.chart) {\n return undefined;\n }\n var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined;\n var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined;\n var opt1;\n if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) {\n opt1 = this.chart.options.flowstate[this.flowstate][attName];\n }\n return (opt1 || opt2 || opt3);\n};\n\nSymbol.prototype.initialize = function() {\n this.group.transform('t' + this.getAttr('line-width') + ',' + this.getAttr('line-width'));\n\n this.width = this.group.getBBox().width;\n this.height = this.group.getBBox().height;\n};\n\nSymbol.prototype.getCenter = function() {\n return {x: this.getX() + this.width/2,\n y: this.getY() + this.height/2};\n};\n\nSymbol.prototype.getX = function() {\n return this.group.getBBox().x;\n};\n\nSymbol.prototype.getY = function() {\n return this.group.getBBox().y;\n};\n\nSymbol.prototype.shiftX = function(x) {\n this.group.transform('t' + (this.getX() + x) + ',' + this.getY());\n};\n\nSymbol.prototype.setX = function(x) {\n this.group.transform('t' + x + ',' + this.getY());\n};\n\nSymbol.prototype.shiftY = function(y) {\n this.group.transform('t' + this.getX() + ',' + (this.getY() + y));\n};\n\nSymbol.prototype.setY = function(y) {\n this.group.transform('t' + this.getX() + ',' + y);\n};\n\nSymbol.prototype.getTop = function() {\n var y = this.getY();\n var x = this.getX() + this.width/2;\n return {x: x, y: y};\n};\n\nSymbol.prototype.getBottom = function() {\n var y = this.getY() + this.height;\n var x = this.getX() + this.width/2;\n return {x: x, y: y};\n};\n\nSymbol.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX();\n return {x: x, y: y};\n};\n\nSymbol.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width;\n return {x: x, y: y};\n};\n\nSymbol.prototype.render = function() {\n if (this.next) {\n\n var self = this;\n var lineLength = this.getAttr('line-length');\n\n if (this.next_direction === 'right') {\n\n var rightPoint = this.getRight();\n\n if (!this.next.isPositioned) {\n this.next.setY(rightPoint.y - this.next.height/2);\n this.next.shiftX(this.group.getBBox().x + this.width + lineLength);\n\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n hasSymbolUnder = true;\n break;\n }\n }\n\n if (hasSymbolUnder) {\n if (self.next.symbolType === 'end') return;\n self.next.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.next.isPositioned = true;\n\n this.next.render();\n }\n } else if (this.next_direction === 'left') {\n\n var leftPoint = this.getLeft();\n\n if (!this.next.isPositioned) {\n this.next.setY(leftPoint.y - this.next.height/2);\n this.next.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n hasSymbolUnder = true;\n break;\n }\n }\n\n if (hasSymbolUnder) {\n if (self.next.symbolType === 'end') return;\n self.next.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.next.isPositioned = true;\n\n this.next.render();\n }\n } else {\n var bottomPoint = this.getBottom();\n\n if (!this.next.isPositioned) {\n this.next.shiftY(this.getY() + this.height + lineLength);\n this.next.setX(bottomPoint.x - this.next.width/2);\n this.next.isPositioned = true;\n\n this.next.render();\n }\n }\n }\n};\n\nSymbol.prototype.renderLines = function() {\n if (this.next) {\n if (this.next_direction) {\n this.drawLineTo(this.next, this.getAttr('arrow-text') || '', this.next_direction);\n } else {\n this.drawLineTo(this.next, this.getAttr('arrow-text') || '');\n }\n }\n};\n\nSymbol.prototype.drawLineTo = function(symbol, text, origin) {\n if (this.connectedTo.indexOf(symbol) < 0) {\n this.connectedTo.push(symbol);\n }\n\n var x = this.getCenter().x,\n y = this.getCenter().y,\n right = this.getRight(),\n bottom = this.getBottom(),\n top = this.getTop(),\n left = this.getLeft();\n\n var symbolX = symbol.getCenter().x,\n symbolY = symbol.getCenter().y,\n symbolTop = symbol.getTop(),\n symbolRight = symbol.getRight(),\n symbolLeft = symbol.getLeft();\n\n var isOnSameColumn = x === symbolX,\n isOnSameLine = y === symbolY,\n isUnder = y < symbolY,\n isUpper = y > symbolY || this === symbol,\n isLeft = x > symbolX,\n isRight = x < symbolX;\n\n var maxX = 0,\n line,\n yOffset,\n lineLength = this.getAttr('line-length'),\n lineWith = this.getAttr('line-width');\n\n if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) {\n if (symbol.topLines.length === 0 && this.bottomLines.length === 0) {\n line = drawLine(this.chart, bottom, symbolTop, text);\n } else {\n yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n line = drawLine(this.chart, bottom, [\n {x: symbolTop.x, y: symbolTop.y - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n }\n this.bottomLines.push(line);\n symbol.topLines.push(line);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x;\n } else if ((!origin || origin === 'right') && isOnSameLine && isRight) {\n if (symbol.leftLines.length === 0 && this.rightLines.length === 0) {\n line = drawLine(this.chart, right, symbolLeft, text);\n } else {\n yOffset = Math.max(symbol.leftLines.length, this.rightLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: right.x, y: right.y - yOffset},\n {x: right.x, y: symbolLeft.y - yOffset},\n {x: symbolLeft.x, y: symbolLeft.y - yOffset},\n {x: symbolLeft.x, y: symbolLeft.y}\n ], text);\n }\n this.rightLines.push(line);\n symbol.leftLines.push(line);\n this.rightStart = true;\n symbol.leftEnd = true;\n maxX = symbolLeft.x;\n } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) {\n if (symbol.rightLines.length === 0 && this.leftLines.length === 0) {\n line = drawLine(this.chart, left, symbolRight, text);\n } else {\n yOffset = Math.max(symbol.rightLines.length, this.leftLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: right.x, y: right.y - yOffset},\n {x: right.x, y: symbolRight.y - yOffset},\n {x: symbolRight.x, y: symbolRight.y - yOffset},\n {x: symbolRight.x, y: symbolRight.y}\n ], text);\n }\n this.leftLines.push(line);\n symbol.rightLines.push(line);\n this.leftStart = true;\n symbol.rightEnd = true;\n maxX = symbolRight.x;\n } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) {\n yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y - yOffset},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightLines.push(line);\n symbol.topLines.push(line);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) {\n yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y - yOffset},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightLines.push(line);\n symbol.topLines.push(line);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((!origin || origin === 'bottom') && isLeft) {\n yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n if (this.leftEnd && isUpper) {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2 - yOffset},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n } else {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n }\n this.bottomLines.push(line);\n symbol.topLines.push(line);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n } else if ((!origin || origin === 'bottom') && isRight && isUnder) {\n yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.bottomLines.push(line);\n symbol.topLines.push(line);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x;\n if (symbolTop.x > maxX) maxX = symbolTop.x;\n } else if ((!origin || origin === 'bottom') && isRight) {\n yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2 - yOffset},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.bottomLines.push(line);\n symbol.topLines.push(line);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n } else if ((origin && origin === 'right') && isLeft) {\n yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightLines.push(line);\n symbol.topLines.push(line);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((origin && origin === 'right') && isRight) {\n yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10;\n line = drawLine(this.chart, right, [\n {x: symbolTop.x, y: right.y - yOffset},\n {x: symbolTop.x, y: symbolTop.y - yOffset}\n ], text);\n this.rightLines.push(line);\n symbol.topLines.push(line);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) {\n yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10;\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2 - yOffset},\n {x: right.x + lineLength/2, y: bottom.y + lineLength/2 - yOffset},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.bottomLines.push(line);\n symbol.topLines.push(line);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + lineLength/2;\n } else if ((origin === 'left') && isOnSameColumn && isUpper) {\n var diffX = left.x - lineLength/2;\n if (symbolLeft.x < left.x) {\n diffX = symbolLeft.x - lineLength/2;\n }\n yOffset = Math.max(symbol.topLines.length, this.leftLines.length) * 10;\n line = drawLine(this.chart, left, [\n {x: diffX, y: left.y - yOffset},\n {x: diffX, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.leftLines.push(line);\n symbol.topLines.push(line);\n this.leftStart = true;\n symbol.topEnd = true;\n maxX = left.x;\n } else if ((origin === 'left')) {\n yOffset = Math.max(symbol.topLines.length, this.leftLines.length) * 10;\n line = drawLine(this.chart, left, [\n {x: symbolTop.x + (left.x - symbolTop.x)/2, y: left.y},\n {x: symbolTop.x + (left.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.leftLines.push(line);\n symbol.topLines.push(line);\n this.leftStart = true;\n symbol.topEnd = true;\n maxX = left.x;\n } else if ((origin === 'top')) {\n yOffset = Math.max(symbol.topLines.length, this.topLines.length) * 10;\n line = drawLine(this.chart, top, [\n {x: top.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.topLines.push(line);\n symbol.topLines.push(line);\n this.topStart = true;\n symbol.topEnd = true;\n maxX = top.x;\n }\n\n //update line style\n if (this.lineStyle[symbol.key] && line){\n line.attr(this.lineStyle[symbol.key]);\n }\n\n if (line) {\n for (var l = 0, llen = this.chart.lines.length; l < llen; l++) {\n var otherLine = this.chart.lines[l];\n\n var ePath = otherLine.attr('path'),\n lPath = line.attr('path');\n\n for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) {\n var newPath = [];\n newPath.push(['M', ePath[iP][1], ePath[iP][2]]);\n newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]);\n\n var line1_from_x = newPath[0][1];\n var line1_from_y = newPath[0][2];\n var line1_to_x = newPath[1][1];\n var line1_to_y = newPath[1][2];\n\n for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) {\n var newLinePath = [];\n newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]);\n newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]);\n\n var line2_from_x = newLinePath[0][1];\n var line2_from_y = newLinePath[0][2];\n var line2_to_x = newLinePath[1][1];\n var line2_to_y = newLinePath[1][2];\n\n var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y);\n if (res.onLine1 && res.onLine2) {\n\n var newSegment;\n if (line2_from_y === line2_to_y) {\n if (line2_from_x > line2_to_x) {\n newSegment = ['L', res.x + lineWith * 2, line2_from_y];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n } else {\n newSegment = ['L', res.x - lineWith * 2, line2_from_y];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n }\n } else {\n if (line2_from_y > line2_to_y) {\n newSegment = ['L', line2_from_x, res.y + lineWith * 2];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n } else {\n newSegment = ['L', line2_from_x, res.y - lineWith * 2];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n }\n }\n\n lP += 2;\n }\n }\n }\n }\n\n this.chart.lines.push(line);\n if (this.chart.minXFromSymbols === undefined || this.chart.minXFromSymbols > left.x) {\n this.chart.minXFromSymbols = left.x;\n }\n }\n\n if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) {\n this.chart.maxXFromLine = maxX;\n }\n};\n\nmodule.exports = Symbol;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.js\n// module id = 2\n// module chunks = 0","function drawPath(chart, location, points) {\n var i, len;\n var path = 'M{0},{1}';\n for (i = 2, len = 2 * points.length + 2; i < len; i+=2) {\n path += ' L{' + i + '},{' + (i + 1) + '}';\n }\n var pathValues = [location.x, location.y];\n for (i = 0, len = points.length; i < len; i++) {\n pathValues.push(points[i].x);\n pathValues.push(points[i].y);\n }\n var symbol = chart.paper.path(path, pathValues);\n symbol.attr('stroke', chart.options['element-color']);\n symbol.attr('stroke-width', chart.options['line-width']);\n\n var font = chart.options.font;\n var fontF = chart.options['font-family'];\n var fontW = chart.options['font-weight'];\n\n if (font) symbol.attr({ 'font': font });\n if (fontF) symbol.attr({ 'font-family': fontF });\n if (fontW) symbol.attr({ 'font-weight': fontW });\n\n return symbol;\n}\n\nfunction drawLine(chart, from, to, text) {\n var i, len;\n\n if (Object.prototype.toString.call(to) !== '[object Array]') {\n to = [to];\n }\n\n var path = 'M{0},{1}';\n for (i = 2, len = 2 * to.length + 2; i < len; i+=2) {\n path += ' L{' + i + '},{' + (i + 1) + '}';\n }\n var pathValues = [from.x, from.y];\n for (i = 0, len = to.length; i < len; i++) {\n pathValues.push(to[i].x);\n pathValues.push(to[i].y);\n }\n\n var line = chart.paper.path(path, pathValues);\n line.attr({\n stroke: chart.options['line-color'],\n 'stroke-width': chart.options['line-width'],\n 'arrow-end': chart.options['arrow-end']\n });\n\n var font = chart.options.font;\n var fontF = chart.options['font-family'];\n var fontW = chart.options['font-weight'];\n\n if (font) line.attr({ 'font': font });\n if (fontF) line.attr({ 'font-family': fontF });\n if (fontW) line.attr({ 'font-weight': fontW });\n\n if (text) {\n\n var centerText = false;\n\n var textPath = chart.paper.text(0, 0, text);\n var textAnchor = 'start';\n\n var isHorizontal = false;\n var firstTo = to[0];\n\n if (from.y === firstTo.y) {\n isHorizontal = true;\n }\n\n var x = 0,\n y = 0;\n\n if (centerText) {\n if (from.x > firstTo.x) {\n x = from.x - (from.x - firstTo.x)/2;\n } else {\n x = firstTo.x - (firstTo.x - from.x)/2;\n }\n\n if (from.y > firstTo.y) {\n y = from.y - (from.y - firstTo.y)/2;\n } else {\n y = firstTo.y - (firstTo.y - from.y)/2;\n }\n\n if (isHorizontal) {\n x -= textPath.getBBox().width/2;\n y -= chart.options['text-margin'];\n } else {\n x += chart.options['text-margin'];\n y -= textPath.getBBox().height/2;\n }\n } else {\n x = from.x;\n y = from.y;\n\n if (isHorizontal) {\n if (from.x > firstTo.x) {\n x -= chart.options['text-margin']/2;\n textAnchor = 'end';\n } else {\n x += chart.options['text-margin']/2;\n }\n y -= chart.options['text-margin'];\n } else {\n x += chart.options['text-margin']/2;\n y += chart.options['text-margin'];\n if (from.y > firstTo.y) {\n y -= chart.options['text-margin']*2;\n }\n }\n }\n\n textPath.attr({\n 'text-anchor': textAnchor,\n 'font-size': chart.options['font-size'],\n 'fill': chart.options['font-color'],\n x: x,\n y: y\n });\n\n if (font) textPath.attr({ 'font': font });\n if (fontF) textPath.attr({ 'font-family': fontF });\n if (fontW) textPath.attr({ 'font-weight': fontW });\n }\n\n return line;\n}\n\nfunction checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) {\n // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point\n var denominator, a, b, numerator1, numerator2, result = {\n x: null,\n y: null,\n onLine1: false,\n onLine2: false\n };\n denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY));\n if (denominator === 0) {\n return result;\n }\n a = line1StartY - line2StartY;\n b = line1StartX - line2StartX;\n numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b);\n numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b);\n a = numerator1 / denominator;\n b = numerator2 / denominator;\n\n // if we cast these lines infinitely in both directions, they intersect here:\n result.x = line1StartX + (a * (line1EndX - line1StartX));\n result.y = line1StartY + (a * (line1EndY - line1StartY));\n /*\n // it is worth noting that this should be the same as:\n x = line2StartX + (b * (line2EndX - line2StartX));\n y = line2StartX + (b * (line2EndY - line2StartY));\n */\n // if line1 is a segment and line2 is infinite, they intersect if:\n if (a > 0 && a < 1) {\n result.onLine1 = true;\n }\n // if line2 is a segment and line1 is infinite, they intersect if:\n if (b > 0 && b < 1) {\n result.onLine2 = true;\n }\n // if line1 and line2 are segments, they intersect if both of the above are true\n return result;\n}\n\nmodule.exports = {\n\tdrawPath: drawPath,\n\tdrawLine: drawLine,\n\tcheckLineIntersection: checkLineIntersection\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.functions.js\n// module id = 3\n// module chunks = 0","var FlowChart = require('./flowchart.chart');\nvar Start = require('./flowchart.symbol.start');\nvar End = require('./flowchart.symbol.end');\nvar Operation = require('./flowchart.symbol.operation');\nvar InputOutput = require('./flowchart.symbol.inputoutput');\nvar Input = require('./flowchart.symbol.input'); //tds\nvar Output = require('./flowchart.symbol.output'); //tds\nvar Subroutine = require('./flowchart.symbol.subroutine');\nvar Condition = require('./flowchart.symbol.condition');\nvar Parallel = require('./flowchart.symbol.parallel');\n\n\nfunction parse(input) {\n input = input || '';\n input = input.trim();\n\n var chart = {\n symbols: {},\n start: null,\n drawSVG: function(container, options) {\n var self = this;\n\n if (this.diagram) {\n this.diagram.clean();\n }\n\n var diagram = new FlowChart(container, options);\n this.diagram = diagram;\n var dispSymbols = {};\n\n function getDisplaySymbol(s) {\n if (dispSymbols[s.key]) {\n return dispSymbols[s.key];\n }\n\n switch (s.symbolType) {\n case 'start':\n dispSymbols[s.key] = new Start(diagram, s);\n break;\n case 'end':\n dispSymbols[s.key] = new End(diagram, s);\n break;\n case 'operation':\n dispSymbols[s.key] = new Operation(diagram, s);\n break;\n case 'inputoutput':\n dispSymbols[s.key] = new InputOutput(diagram, s);\n break;\n case 'input':\n dispSymbols[s.key] = new Input(diagram, s); //tds\n break; \n case 'output':\n dispSymbols[s.key] = new Output(diagram, s); //tds\n break; \n case 'subroutine':\n dispSymbols[s.key] = new Subroutine(diagram, s);\n break;\n case 'condition':\n dispSymbols[s.key] = new Condition(diagram, s);\n break;\n case 'parallel':\n dispSymbols[s.key] = new Parallel(diagram, s);\n break;\n default:\n return new Error('Wrong symbol type!');\n }\n\n return dispSymbols[s.key];\n }\n\n (function constructChart(s, prevDisp, prev) {\n var dispSymb = getDisplaySymbol(s);\n\n if (self.start === s) {\n diagram.startWith(dispSymb);\n } else if (prevDisp && prev && !prevDisp.pathOk) {\n if (prevDisp instanceof(Condition)) {\n if (prev.yes === s) {\n prevDisp.yes(dispSymb);\n }\n if (prev.no === s) {\n prevDisp.no(dispSymb);\n }\n } else if (prevDisp instanceof(Parallel)) {\n if (prev.path1 === s) {\n prevDisp.path1(dispSymb);\n }\n if (prev.path2 === s) {\n prevDisp.path2(dispSymb);\n }\n if (prev.path3 === s) {\n prevDisp.path3(dispSymb);\n }\n } else {\n prevDisp.then(dispSymb);\n }\n }\n\n if (dispSymb.pathOk) {\n return dispSymb;\n }\n\n if (dispSymb instanceof(Condition)) {\n if (s.yes) {\n constructChart(s.yes, dispSymb, s);\n }\n if (s.no) {\n constructChart(s.no, dispSymb, s);\n }\n } else if (dispSymb instanceof(Parallel)) {\n if (s.path1) {\n constructChart(s.path1, dispSymb, s);\n }\n if (s.path2) {\n constructChart(s.path2, dispSymb, s);\n }\n if (s.path3) {\n constructChart(s.path3, dispSymb, s);\n }\n } else if (s.next) {\n constructChart(s.next, dispSymb, s);\n }\n\n return dispSymb;\n })(this.start);\n\n diagram.render();\n },\n clean: function() {\n this.diagram.clean();\n },\n options: function() {\n return this.diagram.options;\n }\n };\n\n var lines = [];\n var prevBreak = 0;\n for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) {\n if(input[i0] === '\\n' && input[i0 - 1] !== '\\\\') {\n var line0 = input.substring(prevBreak, i0);\n prevBreak = i0 + 1;\n lines.push(line0.replace(/\\\\\\n/g, '\\n'));\n }\n }\n\n if (prevBreak < input.length) {\n lines.push(input.substr(prevBreak));\n }\n\n for (var l = 1, len = lines.length; l < len;) {\n var currentLine = lines[l];\n\n if (currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0 && currentLine.indexOf('@>') < 0) {\n lines[l - 1] += '\\n' + currentLine;\n lines.splice(l, 1);\n len--;\n } else {\n l++;\n }\n }\n\n function getStyle(s){\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n return s.substring(startIndex,endIndex);\n }\n return '{}';\n }\n\n function getSymbValue(s){\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n return s.substring(startIndex,endIndex);\n }\n return '';\n }\n\n function getSymbol(s) {\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n return chart.symbols[s.substring(0, startIndex - 1)];\n }\n return chart.symbols[s];\n }\n\n function getNextPath(s) {\n var next = 'next';\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n next = flowSymb.substring(startIndex, endIndex);\n if (next.indexOf(',') < 0) {\n if (next !== 'yes' && next !== 'no') {\n next = 'next, ' + next;\n }\n }\n }\n return next;\n }\n \n function getAnnotation(s) {\n\tvar startIndex = s.indexOf(\"(\") + 1, endIndex = s.indexOf(\")\");\n\tvar tmp = s.substring(startIndex, endIndex);\n\tif(tmp.indexOf(\",\") > 0) { tmp = tmp.substring(0, tmp.indexOf(\",\")); }\n\tvar tmp_split = tmp.split(\"@\");\n\tif(tmp_split.length > 1)\n\t\treturn startIndex >= 0 && endIndex >= 0 ? tmp_split[1] : \"\";\n }\n\n while (lines.length > 0) {\n var line = lines.splice(0, 1)[0].trim();\n\n if (line.indexOf('=>') >= 0) {\n // definition\n var parts = line.split('=>');\n var symbol = {\n key: parts[0].replace(/\\(.*\\)/, ''),\n symbolType: parts[1],\n text: null,\n link: null,\n target: null,\n flowstate: null,\n function: null,\n lineStyle: {},\n params: {}\n };\n\n //parse parameters\n var params = parts[0].match(/\\((.*)\\)/);\n if (params && params.length > 1){\n var entries = params[1].split(',');\n for(var i = 0; i < entries.length; i++) {\n var entry = entries[i].split('=');\n if (entry.length == 2) {\n symbol.params[entry[0]] = entry[1];\n }\n }\n }\n\n var sub;\n\n if (symbol.symbolType.indexOf(': ') >= 0) {\n sub = symbol.symbolType.split(': ');\n symbol.symbolType = sub.shift();\n symbol.text = sub.join(': ');\n }\n\n if (symbol.text && symbol.text.indexOf(':$') >= 0) {\n sub = symbol.text.split(':$');\n symbol.text = sub.shift();\n symbol.function = sub.join(':$');\n } else if (symbol.symbolType.indexOf(':$') >= 0) {\n sub = symbol.symbolType.split(':$');\n symbol.symbolType = sub.shift();\n symbol.function = sub.join(':$');\n } else if (symbol.text && symbol.text.indexOf(':>') >= 0) {\n sub = symbol.text.split(':>');\n symbol.text = sub.shift();\n symbol.link = sub.join(':>');\n } else if (symbol.symbolType.indexOf(':>') >= 0) {\n sub = symbol.symbolType.split(':>');\n symbol.symbolType = sub.shift();\n symbol.link = sub.join(':>');\n }\n\n if (symbol.symbolType.indexOf('\\n') >= 0) {\n symbol.symbolType = symbol.symbolType.split('\\n')[0];\n }\n\n /* adding support for links */\n if (symbol.link) {\n var startIndex = symbol.link.indexOf('[') + 1;\n var endIndex = symbol.link.indexOf(']');\n if (startIndex >= 0 && endIndex >= 0) {\n symbol.target = symbol.link.substring(startIndex, endIndex);\n symbol.link = symbol.link.substring(0, startIndex - 1);\n }\n }\n /* end of link support */\n\n /* adding support for flowstates */\n if (symbol.text) {\n if (symbol.text.indexOf('|') >= 0) {\n var txtAndState = symbol.text.split('|');\n symbol.flowstate = txtAndState.pop().trim();\n symbol.text = txtAndState.join('|');\n }\n }\n /* end of flowstate support */\n\n chart.symbols[symbol.key] = symbol;\n\n } else if (line.indexOf('->') >= 0) {\n var ann = getAnnotation(line);\n if (ann) {\n line = line.replace('@' + ann, ''); \n }\n // flow\n var flowSymbols = line.split('->');\n for (var iS = 0, lenS = flowSymbols.length; iS < lenS; iS++) {\n var flowSymb = flowSymbols[iS];\n var symbVal = getSymbValue(flowSymb);\n\n if (symbVal === 'true' || symbVal === 'false') {\n // map true or false to yes or no respectively\n flowSymb = flowSymb.replace('true', 'yes');\n flowSymb = flowSymb.replace('false', 'no');\n }\n \n var next = getNextPath(flowSymb);\n var realSymb = getSymbol(flowSymb);\n\n var direction = null;\n if (next.indexOf(',') >= 0) {\n var condOpt = next.split(',');\n next = condOpt[0];\n direction = condOpt[1].trim();\n }\n\n if (ann) {\n if (realSymb.symbolType === 'condition') {\n if (next === \"yes\" || next === \"true\") {\n realSymb.yes_annotation = ann;\n } else {\n realSymb.no_annotation = ann;\n }\n } else if (realSymb.symbolType === 'parallel') {\n if (next === 'path1') {\n realSymb.path1_annotation = ann;\n } else if (next === 'path2') {\n realSymb.path2_annotation = ann;\n } else if (next === 'path3') {\n realSymb.path3_annotation = ann;\n }\n }\n ann = null;\n }\n\n if (!chart.start) {\n chart.start = realSymb;\n }\n\n if (iS + 1 < lenS) {\n var nextSymb = flowSymbols[iS + 1];\n realSymb[next] = getSymbol(nextSymb);\n realSymb['direction_' + next] = direction;\n direction = null;\n }\n }\n } else if (line.indexOf('@>') >= 0) {\n\n // line style\n var lineStyleSymbols = line.split('@>');\n for (var iSS = 0, lenSS = lineStyleSymbols.length; iSS < lenSS; iSS++) {\n if ((iSS + 1) !== lenSS) {\n var curSymb = getSymbol(lineStyleSymbols[iSS]);\n var nextSymbol = getSymbol(lineStyleSymbols[iSS+1]);\n\n curSymb['lineStyle'][nextSymbol.key] = JSON.parse(getStyle(lineStyleSymbols[iSS + 1]));\n }\n }\n }\n\n }\n return chart;\n}\n\nmodule.exports = parse;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.parse.js\n// module id = 4\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction Condition(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.yes_annotation = options.yes_annotation;\n this.no_annotation = options.no_annotation;\n this.textMargin = this.getAttr('text-margin');\n this.yes_direction = options.direction_yes;\n this.no_direction = options.direction_no;\n if (!this.no_direction && this.yes_direction === 'right') {\n this.no_direction = 'bottom';\n } else if (!this.yes_direction && this.no_direction === 'bottom') {\n this.yes_direction = 'right'\n }\n this.yes_direction = this.yes_direction || 'bottom';\n this.no_direction = this.no_direction || 'right';\n\n this.text.attr({\n x: this.textMargin * 2\n });\n\n var width = this.text.getBBox().width + 3 * this.textMargin;\n width += width/2;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n height += height/2;\n height = Math.max(width * 0.5, height);\n var startX = width/4;\n var startY = height/4;\n\n this.text.attr({\n x: startX + this.textMargin/2\n });\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - width/4, y: startY + height/4},\n {x: startX - width/4 + width/2, y: startY + height/4 + height/2},\n {x: startX - width/4 + width, y: startY + height/4},\n {x: startX - width/4 + width/2, y: startY + height/4 - height/2},\n {x: startX - width/4, y: startY + height/4}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n this.symbol = symbol\n\n this.initialize();\n}\ninherits(Condition, Symbol);\n\nCondition.prototype.render = function() {\n var self = this;\n if (this.yes_direction) {\n this[this.yes_direction + '_symbol'] = this.yes_symbol;\n }\n\n if (this.no_direction) {\n this[this.no_direction + '_symbol'] = this.no_symbol;\n }\n\n var lineLength = this.getAttr('line-length');\n\n if (this.bottom_symbol) {\n var bottomPoint = this.getBottom();\n\n if (!this.bottom_symbol.isPositioned) {\n this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2);\n this.bottom_symbol.isPositioned = true;\n\n this.bottom_symbol.render();\n }\n }\n\n if (this.right_symbol) {\n var rightPoint = this.getRight();\n\n if (!this.right_symbol.isPositioned) {\n\n this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2);\n this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n if (!self.params['align-next'] || self.params['align-next'] !== 'no') { \n var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) {\n hasSymbolUnder = true;\n break;\n }\n }\n }\n\n if (hasSymbolUnder) {\n if (self.right_symbol.symbolType === 'end') return;\n self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.right_symbol.isPositioned = true;\n\n this.right_symbol.render();\n }\n }\n \n if (this.left_symbol) {\n var leftPoint = this.getLeft();\n \n if (!this.left_symbol.isPositioned) {\n this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2);\n this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n \n if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x);\n if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) {\n hasSymbolUnder = true;\n break;\n }\n }\n }\n \n if (hasSymbolUnder) {\n if (self.left_symbol.symbolType === 'end') return;\n self.left_symbol.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n \n this.left_symbol.isPositioned = true;\n \n this.left_symbol.render();\n }\n }\n};\n\nCondition.prototype.renderLines = function() {\n if (this.yes_symbol) {\n this.drawLineTo(this.yes_symbol, this.yes_annotation ? this.yes_annotation : this.getAttr('yes-text'), this.yes_direction);\n }\n\n if (this.no_symbol) {\n this.drawLineTo(this.no_symbol, this.no_annotation ? this.no_annotation : this.getAttr('no-text'), this.no_direction);\n }\n};\n\nmodule.exports = Condition;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.condition.js\n// module id = 5\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Parallel(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0);\n options = options || {};\n Symbol.call(this, chart, options, symbol);\n this.path1_annotation = options.path1_annotation || '';\n this.path2_annotation = options.path2_annotation || '';\n this.path3_annotation = options.path3_annotation || '';\n this.textMargin = this.getAttr('text-margin');\n this.path1_direction = 'bottom';\n this.path2_direction = 'right';\n this.path3_direction = 'top';\n this.params = options.params;\n if (options.direction_next === 'path1' && !options[options.direction_next] && options.next) {\n options[options.direction_next] = options.next;\n }\n if (options.direction_next === 'path2' && !options[options.direction_next] && options.next) {\n options[options.direction_next] = options.next;\n }\n if (options.direction_next === 'path3' && !options[options.direction_next] && options.next) {\n options[options.direction_next] = options.next;\n }\n\n if (options.path1 && options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && !options.direction_path3) {\n if (options.direction_path1 === 'right') {\n this.path2_direction = 'bottom';\n this.path1_direction = 'right';\n this.path3_direction = 'top';\n } else if (options.direction_path1 === 'top') {\n this.path2_direction = 'right';\n this.path1_direction = 'top';\n this.path3_direction = 'bottom';\n } else if (options.direction_path1 === 'left') {\n this.path2_direction = 'right';\n this.path1_direction = 'left';\n this.path3_direction = 'bottom';\n } else {\n this.path2_direction = 'right';\n this.path1_direction = 'bottom';\n this.path3_direction = 'top';\n }\n } else if (options.path1 && !options.direction_path1 && options.path2 && options.direction_path2 && options.path3 && !options.direction_path3) {\n if (options.direction_path2 === 'right') {\n this.path1_direction = 'bottom';\n this.path2_direction = 'right';\n this.path3_direction = 'top';\n } else if (options.direction_path2 === 'left') {\n this.path1_direction = 'bottom';\n this.path2_direction = 'left';\n this.path3_direction = 'right';\n } else {\n this.path1_direction = 'right';\n this.path2_direction = 'bottom';\n this.path3_direction = 'top';\n }\n } else if (options.path1 && !options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && options.direction_path3) {\n if (options.direction_path2 === 'right') {\n this.path1_direction = 'bottom';\n this.path2_direction = 'top';\n this.path3_direction = 'right';\n } else if (options.direction_path2 === 'left') {\n this.path1_direction = 'bottom';\n this.path2_direction = 'right';\n this.path3_direction = 'left';\n } else {\n this.path1_direction = 'right';\n this.path2_direction = 'bottom';\n this.path3_direction = 'top';\n }\n } else {\n this.path1_direction = options.direction_path1;\n this.path2_direction = options.direction_path2;\n this.path3_direction = options.direction_path3;\n }\n\n this.path1_direction = this.path1_direction || 'bottom';\n this.path2_direction = this.path2_direction || 'right';\n this.path3_direction = this.path3_direction || 'top';\n\n this.initialize();\n}\ninherits(Parallel, Symbol);\n\nParallel.prototype.render = function() {\n if (this.path1_direction) {\n this[this.path1_direction + '_symbol'] = this.path1_symbol;\n }\n\n if (this.path2_direction) {\n this[this.path2_direction + '_symbol'] = this.path2_symbol;\n }\n\n if (this.path3_direction) {\n this[this.path3_direction + '_symbol'] = this.path3_symbol;\n }\n\n var lineLength = this.getAttr('line-length');\n\n if (this.bottom_symbol) {\n var bottomPoint = this.getBottom();\n\n if (!this.bottom_symbol.isPositioned) {\n this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width / 2);\n this.bottom_symbol.isPositioned = true;\n\n this.bottom_symbol.render();\n }\n }\n\n if (this.top_symbol) {\n var topPoint = this.getTop();\n\n if (!this.top_symbol.isPositioned) {\n this.top_symbol.shiftY(this.getY() - this.top_symbol.height - lineLength);\n this.top_symbol.setX(topPoint.x + this.top_symbol.width);\n this.top_symbol.isPositioned = true;\n\n this.top_symbol.render();\n }\n }\n\n var self = this;\n\n if (this.left_symbol) {\n var leftPoint = this.getLeft();\n\n if (!this.left_symbol.isPositioned) {\n this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2);\n this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength));\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x);\n if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) {\n hasSymbolUnder = true;\n break;\n }\n }\n }\n\n if (hasSymbolUnder) {\n if (self.left_symbol.symbolType === 'end') return;\n self.left_symbol.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.left_symbol.isPositioned = true;\n\n this.left_symbol.render();\n }\n }\n\n if (this.right_symbol) {\n var rightPoint = this.getRight();\n\n if (!this.right_symbol.isPositioned) {\n this.right_symbol.setY(rightPoint.y - this.right_symbol.height / 2);\n this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n if (!self.params['align-next'] || self.params['align-next'] !== 'no') {\n var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width / 2) {\n hasSymbolUnder = true;\n break;\n }\n }\n }\n\n if (hasSymbolUnder) {\n if (self.right_symbol.symbolType === 'end') return;\n self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.right_symbol.isPositioned = true;\n\n this.right_symbol.render();\n }\n }\n};\n\nParallel.prototype.renderLines = function() {\n if (this.path1_symbol) {\n this.drawLineTo(this.path1_symbol, this.path1_annotation, this.path1_direction);\n }\n\n if (this.path2_symbol) {\n this.drawLineTo(this.path2_symbol, this.path2_annotation, this.path2_direction);\n }\n\n if (this.path3_symbol) {\n this.drawLineTo(this.path3_symbol, this.path3_annotation, this.path3_direction);\n }\n};\n\nmodule.exports = Parallel;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.parallel.js\n// module id = 6\n// module chunks = 0","var Raphael = require('raphael');\nvar defaults = require('./flowchart.helpers').defaults;\nvar defaultOptions = require('./flowchart.defaults');\nvar Condition = require('./flowchart.symbol.condition');\nvar Parallel = require('./flowchart.symbol.parallel');\n\nfunction FlowChart(container, options) {\n options = options || {};\n\n this.paper = new Raphael(container);\n\n this.options = defaults(options, defaultOptions);\n\n this.symbols = [];\n this.lines = [];\n this.start = null;\n}\n\nFlowChart.prototype.handle = function(symbol) {\n if (this.symbols.indexOf(symbol) <= -1) {\n this.symbols.push(symbol);\n }\n\n var flowChart = this;\n\n if (symbol instanceof(Condition)) {\n symbol.yes = function(nextSymbol) {\n symbol.yes_symbol = nextSymbol;\n if(symbol.no_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n symbol.no = function(nextSymbol) {\n symbol.no_symbol = nextSymbol;\n if (symbol.yes_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n } else if (symbol instanceof(Parallel)) {\n symbol.path1 = function(nextSymbol) {\n symbol.path1_symbol = nextSymbol;\n if (symbol.path2_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n symbol.path2 = function(nextSymbol) {\n symbol.path2_symbol = nextSymbol;\n if (symbol.path3_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n symbol.path3 = function(nextSymbol) {\n symbol.path3_symbol = nextSymbol;\n if (symbol.path1_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n } else {\n symbol.then = function(nextSymbol) {\n symbol.next = nextSymbol;\n symbol.pathOk = true;\n return flowChart.handle(nextSymbol);\n };\n }\n\n return symbol;\n};\n\nFlowChart.prototype.startWith = function(symbol) {\n this.start = symbol;\n return this.handle(symbol);\n};\n\nFlowChart.prototype.render = function() {\n var maxWidth = 0,\n maxHeight = 0,\n i = 0,\n len = 0,\n maxX = 0,\n maxY = 0,\n minX = 0,\n minY = 0,\n symbol,\n line;\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n if (symbol.width > maxWidth) {\n maxWidth = symbol.width;\n }\n if (symbol.height > maxHeight) {\n maxHeight = symbol.height;\n }\n }\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']);\n symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']);\n }\n\n this.start.render();\n // for (i = 0, len = this.symbols.length; i < len; i++) {\n // symbol = this.symbols[i];\n // symbol.render();\n // }\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n symbol.renderLines();\n }\n\n maxX = this.maxXFromLine;\n\n var x;\n var y;\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n var leftX = symbol.getX()\n x = leftX + symbol.width;\n y = symbol.getY() + symbol.height;\n if (leftX < minX) {\n minX = leftX;\n }\n if (x > maxX) {\n maxX = x;\n }\n if (y > maxY) {\n maxY = y;\n }\n }\n\n for (i = 0, len = this.lines.length; i < len; i++) {\n line = this.lines[i].getBBox();\n x = line.x;\n y = line.y;\n var x2 = line.x2;\n var y2 = line.y2;\n if (x < minX) {\n minX = x;\n }\n if (y < minY) {\n minY = y;\n }\n if (x2 > maxX) {\n maxX = x2;\n }\n if (y2 > maxY) {\n maxY = y2;\n }\n }\n\n var scale = this.options['scale'];\n var lineWidth = this.options['line-width'];\n\n if (this.minXFromSymbols < minX) minX = this.minXFromSymbols;\n\n if (minX < 0) minX -= lineWidth;\n if (minY < 0) minY -= lineWidth;\n\n var width = maxX + lineWidth - minX;\n var height = maxY + lineWidth - minY;\n\n this.paper.setSize(width * scale, height * scale);\n this.paper.setViewBox(minX, minY, width, height, true);\n};\n\nFlowChart.prototype.clean = function() {\n if (this.paper) {\n var paperDom = this.paper.canvas;\n paperDom.parentNode && paperDom.parentNode.removeChild(paperDom);\n }\n};\n\nmodule.exports = FlowChart;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.chart.js\n// module id = 7\n// module chunks = 0","// defaults\nmodule.exports = {\n 'x': 0,\n 'y': 0,\n // 'roundness': 0,\n 'line-width': 3,\n 'line-length': 50,\n 'text-margin': 10,\n 'font-size': 14,\n 'font-color': 'black',\n // 'font': 'normal',\n // 'font-family': 'calibri',\n // 'font-weight': 'normal',\n 'line-color': 'black',\n 'element-color': 'black',\n 'fill': 'white',\n 'yes-text': 'yes',\n 'no-text': 'no',\n 'arrow-end': 'block',\n 'class': 'flowchart',\n 'scale': 1,\n 'symbols': {\n 'start': {},\n 'end': {},\n 'condition': {},\n 'inputoutput': {},\n 'input': {}, //tds\n 'output': {}, //tds \n 'operation': {},\n 'subroutine': {},\n 'parallel': {}\n } //,\n // 'flowstate' : {\n // 'past' : { 'fill': '#CCCCCC', 'font-size': 12},\n // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'},\n // 'future' : { 'fill': '#FFFF99'},\n // 'invalid': {'fill': '#444444'}\n // }\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.defaults.js\n// module id = 8\n// module chunks = 0","// add indexOf to non ECMA-262 standard compliant browsers\nif (!Array.prototype.indexOf) {\n Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {\n \"use strict\";\n if (this === null) {\n throw new TypeError();\n }\n var t = Object(this);\n var len = t.length >>> 0;\n if (len === 0) {\n return -1;\n }\n var n = 0;\n if (arguments.length > 0) {\n n = Number(arguments[1]);\n if (n != n) { // shortcut for verifying if it's NaN\n n = 0;\n } else if (n !== 0 && n != Infinity && n != -Infinity) {\n n = (n > 0 || -1) * Math.floor(Math.abs(n));\n }\n }\n if (n >= len) {\n return -1;\n }\n var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);\n for (; k < len; k++) {\n if (k in t && t[k] === searchElement) {\n return k;\n }\n }\n return -1;\n };\n}\n\n// add lastIndexOf to non ECMA-262 standard compliant browsers\nif (!Array.prototype.lastIndexOf) {\n Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {\n \"use strict\";\n if (this === null) {\n throw new TypeError();\n }\n var t = Object(this);\n var len = t.length >>> 0;\n if (len === 0) {\n return -1;\n }\n var n = len;\n if (arguments.length > 1) {\n n = Number(arguments[1]);\n if (n != n) {\n n = 0;\n } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) {\n n = (n > 0 || -1) * Math.floor(Math.abs(n));\n }\n }\n var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);\n for (; k >= 0; k--) {\n if (k in t && t[k] === searchElement) {\n return k;\n }\n }\n return -1;\n };\n}\n\nif (!String.prototype.trim) {\n String.prototype.trim = function() {\n return this.replace(/^\\s+|\\s+$/g, '');\n };\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.shim.js\n// module id = 9\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction End(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n options = options || {};\n options.text = options.text || 'End';\n Symbol.call(this, chart, options, symbol);\n}\ninherits(End, Symbol);\n\nmodule.exports = End;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.end.js\n// module id = 10\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction Input(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.textMargin = this.getAttr('text-margin');\n\n this.text.attr({\n x: this.textMargin * 3\n });\n\n var width = this.text.getBBox().width + 4 * this.textMargin;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n var startX = this.textMargin;\n var startY = height/2;\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - this.textMargin + 2 * this.textMargin, y: height},\n {x: startX - this.textMargin + width, y: height},\n {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n {x: startX - this.textMargin, y: 0},\n {x: startX, y: startY}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n this.symbol = symbol\n\n this.initialize();\n}\ninherits(Input, Symbol);\n\nInput.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.textMargin;\n return {x: x, y: y};\n};\n\nInput.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width - this.textMargin;\n return {x: x, y: y};\n};\n\nmodule.exports = Input;\n\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.input.js\n// module id = 11\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction InputOutput(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.textMargin = this.getAttr('text-margin');\n\n this.text.attr({\n x: this.textMargin * 3\n });\n\n var width = this.text.getBBox().width + 4 * this.textMargin;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n var startX = this.textMargin;\n var startY = height/2;\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - this.textMargin, y: height},\n {x: startX - this.textMargin + width, y: height},\n {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n {x: startX, y: startY}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n this.symbol = symbol\n\n this.initialize();\n}\ninherits(InputOutput, Symbol);\n\nInputOutput.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.textMargin;\n return {x: x, y: y};\n};\n\nInputOutput.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width - this.textMargin;\n return {x: x, y: y};\n};\n\nmodule.exports = InputOutput;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.inputoutput.js\n// module id = 12\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Operation(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0);\n options = options || {};\n Symbol.call(this, chart, options, symbol);\n}\ninherits(Operation, Symbol);\n\nmodule.exports = Operation;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.operation.js\n// module id = 13\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction Output(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.textMargin = this.getAttr('text-margin');\n\n this.text.attr({\n x: this.textMargin * 3\n });\n\n var width = this.text.getBBox().width + 4 * this.textMargin;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n var startX = this.textMargin;\n var startY = height/2;\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - this.textMargin, y: height},\n {x: startX - this.textMargin + width + 2 * this.textMargin, y: height},\n {x: startX - this.textMargin + width, y: 0},\n {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n {x: startX, y: startY}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n this.symbol = symbol\n\n this.initialize();\n}\ninherits(Output, Symbol);\n\nOutput.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.textMargin;\n return {x: x, y: y};\n};\n\nOutput.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width - this.textMargin;\n return {x: x, y: y};\n};\n\nmodule.exports = Output;\n\n\n\n/*\n//var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar InputOutput = require('./flowchart.symbol.inputoutput');\nvar drawPath = drawAPI.drawPath;\n\nfunction Output(chart, options) {\n options = options || {};\n InputOutput.call(this, chart, options);\n\n var width = this.text.getBBox().width + 4 * this.textMargin;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n var startX = this.textMargin;\n var startY = height/2;\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - this.textMargin + 2 * this.textMargin, y: height},\n {x: startX - this.textMargin + width, y: height},\n {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n {x: startX - this.textMargin, y: 0},\n {x: startX, y: startY}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n \n if (this.symbol){\n this.group.remove(this.symbol); //tds\n this.symbol.parentNode.removeChild(this.symbol); //tds\n }\n this.symbol = symbol\n\n this.initialize();\n}\ninherits(Output, InputOutput);\n\nmodule.exports = Output;\n*/\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.output.js\n// module id = 14\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Start(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n options = options || {};\n options.text = options.text || 'Start';\n Symbol.call(this, chart, options, symbol);\n}\ninherits(Start, Symbol);\n\nmodule.exports = Start;\n\n// Start.prototype.render = function() {\n// if (this.next) {\n// var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length'];\n\n// var bottomPoint = this.getBottom();\n// var topPoint = this.next.getTop();\n\n// if (!this.next.isPositioned) {\n// this.next.shiftY(this.getY() + this.height + lineLength);\n// this.next.setX(bottomPoint.x - this.next.width/2);\n// this.next.isPositioned = true;\n\n// this.next.render();\n// }\n// }\n// };\n\n// Start.prototype.renderLines = function() {\n// if (this.next) {\n// this.drawLineTo(this.next);\n// }\n// };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.start.js\n// module id = 15\n// module chunks = 0","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Subroutine(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0);\n options = options || {};\n Symbol.call(this, chart, options, symbol);\n\n symbol.attr({\n width: this.text.getBBox().width + 4 * this.getAttr('text-margin')\n });\n\n this.text.attr({\n 'x': 2 * this.getAttr('text-margin')\n });\n\n var innerWrap = chart.paper.rect(0, 0, 0, 0);\n innerWrap.attr({\n x: this.getAttr('text-margin'),\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n width: this.text.getBBox().width + 2 * this.getAttr('text-margin'),\n height: this.text.getBBox().height + 2 * this.getAttr('text-margin'),\n fill: this.getAttr('fill')\n });\n if (options.key) { innerWrap.node.id = options.key + 'i'; }\n\n var font = this.getAttr('font');\n var fontF = this.getAttr('font-family');\n var fontW = this.getAttr('font-weight');\n\n if (font) innerWrap.attr({ 'font': font });\n if (fontF) innerWrap.attr({ 'font-family': fontF });\n if (fontW) innerWrap.attr({ 'font-weight': fontW });\n\n if (options.link) { innerWrap.attr('href', options.link); }\n if (options.target) { innerWrap.attr('target', options.target); }\n this.group.push(innerWrap);\n innerWrap.insertBefore(this.text);\n\n this.initialize();\n}\ninherits(Subroutine, Symbol);\n\nmodule.exports = Subroutine;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/flowchart.symbol.subroutine.js\n// module id = 16\n// module chunks = 0","if (typeof jQuery != 'undefined') {\n\tvar parse = require('./flowchart.parse');\n\n\t(function( $ ) {\n\t\tfunction paramFit(needle, haystack) {\n\t\t\treturn needle == haystack ||\n\t\t\t( Array.isArray(haystack) && (haystack.includes(needle) || haystack.includes(Number(needle)) ))\n\t\t}\n\t\tvar methods = {\n\t\t\tinit : function(options) {\n\t\t\t\treturn this.each(function() {\n\t\t\t\t\tvar $this = $(this);\n\t\t\t\t\tthis.chart = parse($this.text());\n\t\t\t\t\t$this.html('');\n\t\t\t\t\tthis.chart.drawSVG(this, options);\n\t\t\t\t});\n\t\t\t},\n\t\t\tsetFlowStateByParam : function(param, paramValue, newFlowState) {\n\t\t\t\treturn this.each(function() {\n\t\t\t\t\tvar chart = this.chart;\n\n\t\t\t\t\t// @todo this should be part of Symbol API\n\t\t\t\t\tvar nextSymbolKeys = ['next', 'yes', 'no', 'path1', 'path2', 'path3'];\n\n\t\t\t\t\tfor (var property in chart.symbols) {\n\t\t\t\t\t\tif (chart.symbols.hasOwnProperty(property)) {\n\t\t\t\t\t\t\tvar symbol = chart.symbols[property];\n\t\t\t\t\t\t\tvar val = symbol.params[param];\n\t\t\t\t\t\t\tif (paramFit(val, paramValue)) {\n\t\t\t\t\t\t\t\tsymbol.flowstate = newFlowState;\n\t\t\t\t\t\t\t\tfor (var nski = 0; nski < nextSymbolKeys.length; nski++) {\n\t\t\t\t\t\t\t\t\tvar nextSymbolKey = nextSymbolKeys[nski];\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey] &&\n\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey]['params'] &&\n\t\t\t\t\t\t\t\t\t\tsymbol[nextSymbolKey]['params'][param] &&\n\t\t\t\t\t\t\t\t\t\tparamFit(symbol[nextSymbolKey]['params'][param], paramValue)\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tsymbol.lineStyle[symbol[nextSymbolKey]['key']] = {stroke: chart.options()['flowstate'][newFlowState]['fill']};\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tchart.clean();\n\t\t\t\t\tchart.drawSVG(this);\n\t\t\t\t});\n\n\t\t\t},\n\t\t\tclearFlowState: function () {\n\t\t\t\treturn this.each(function() {\n\t\t\t\t\tvar chart = this.chart;\n\n\t\t\t\t\tfor (var property in chart.symbols) {\n\t\t\t\t\t\tif (chart.symbols.hasOwnProperty(property)) {\n\t\t\t\t\t\t\tvar node = chart.symbols[property];\n\t\t\t\t\t\t\tnode.flowstate = '';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tchart.clean();\n\t\t\t\t\tchart.drawSVG(this);\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t$.fn.flowChart = function(methodOrOptions) {\n\t\t\tif ( methods[methodOrOptions] ) {\n\t\t\t\treturn methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));\n\t\t\t} else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {\n\t\t\t\t// Default to \"init\"\n\t\t\t\treturn methods.init.apply( this, arguments );\n\t\t\t} else {\n\t\t\t\t$.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.flowChart' );\n\t\t\t}\n\t\t};\n\n\t})(jQuery); // eslint-disable-line\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/jquery-plugin.js\n// module id = 17\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_18__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"Raphael\"\n// module id = 18\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/release/flowchart.min.map b/release/flowchart.min.map deleted file mode 100644 index a29df8e7..00000000 --- a/release/flowchart.min.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"flowchart.min.js","sources":["../bin/flowchart-latest.js"],"names":["_defaults","options","defaultOptions","merged","attrname","_inherits","ctor","superCtor","Object","super_","prototype","create","constructor","value","enumerable","writable","configurable","TempCtor","drawPath","chart","location","points","i","len","path","length","pathValues","x","y","push","symbol","paper","attr","font","fontF","fontW","font-family","font-weight","drawLine","from","to","text","toString","call","line","stroke","stroke-width","arrow-end","centerText","textPath","isHorizontal","firstTo","getBBox","width","height","text-anchor","font-size","fill","checkLineIntersection","line1StartX","line1StartY","line1EndX","line1EndY","line2StartX","line2StartY","line2EndX","line2EndY","denominator","a","b","numerator1","numerator2","result","onLine1","onLine2","FlowChart","container","this","Raphael","f","defaults","o","symbols","lines","start","Symbol","group","set","connectedTo","symbolType","flowstate","next_direction","next","undefined","key","node","id","setAttribute","getAttr","link","target","maxWidth","words","split","tempText","ii","word","substring","tmpMargin","insertBefore","initialize","Start","rect","End","Operation","Subroutine","innerWrap","InputOutput","textMargin","startX","startY","Condition","yes_direction","no_direction","yes","no","Math","max","parse","input","getSymbol","s","startIndex","indexOf","endIndex","getNextPath","flowSymb","trim","drawSVG","getDisplaySymbol","dispSymbols","diagram","Error","self","clean","constructChart","prevDisp","prev","dispSymb","startWith","pathOk","then","render","prevBreak","i0","i0len","line0","replace","substr","l","currentLine","splice","sub","parts","txtAndState","flowSymbols","lenS","realSymb","direction","condOpt","nextSymb","Array","searchElement","TypeError","t","n","arguments","Number","Infinity","floor","abs","k","lastIndexOf","min","String","root","flowchart","module","exports","line-width","line-length","text-margin","font-color","line-color","element-color","yes-text","no-text","class","scale","end","condition","inputoutput","operation","subroutine","inherits","handle","flowChart","nextSymbol","yes_symbol","no_symbol","maxHeight","maxX","maxY","shiftX","shiftY","renderLines","maxXFromLine","getX","getY","lineWidth","setSize","setViewBox","paperDom","canvas","parentNode","removeChild","attName","opt1","opt3","opt2","transform","getCenter","setX","setY","getTop","getBottom","getLeft","getRight","lineLength","rightPoint","isPositioned","shift","symb","hasSymbolUnder","diff","bottomPoint","drawLineTo","origin","right","bottom","left","symbolX","symbolY","symbolTop","symbolRight","symbolLeft","isOnSameColumn","isOnSameLine","isUnder","isUpper","isLeft","isRight","lineWith","rightStart","topEnd","bottomStart","diffX","leftStart","leftEnd","rightEnd","llen","otherLine","ePath","lPath","iP","lenP","newPath","line1_from_x","line1_from_y","line1_to_x","line1_to_y","lP","lenlP","newLinePath","line2_from_x","line2_from_y","line2_to_x","line2_to_y","res","newSegment","bottom_symbol","right_symbol"],"mappings":";;;;;CAIA,WAuHE,QAASA,GAAUC,EAASC,GAC1B,IAAKD,GAA8B,kBAAZA,GACrB,MAAOC,EAGT,IAAIC,KACJ,KAAK,GAAIC,KAAYF,GACnBC,EAAOC,GAAYF,EAAeE,EAGpC,KAAKA,IAAYH,GACXA,EAAQG,KACsB,gBAArBD,GAAOC,GAChBD,EAAOC,GAAYJ,EAAUG,EAAOC,GAAWH,EAAQG,IAEvDD,EAAOC,GAAYH,EAAQG,GAIjC,OAAOD,GAGT,QAASE,GAAUC,EAAMC,GACvB,GAA8B,kBAAnBC,QAAa,OAEtBF,EAAKG,OAASF,EACdD,EAAKI,UAAYF,OAAOG,OAAOJ,EAAUG,WACvCE,aACEC,MAAOP,EACPQ,YAAY,EACZC,UAAU,EACVC,cAAc,SAGb,CAELV,EAAKG,OAASF,CACd,IAAIU,GAAW,YACfA,GAASP,UAAYH,EAAUG,UAC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,YAAY5M,EAAIoH,EAAKoJ,aAAa5D,YAAY5M,EACvE,IAAIuN,EAAKX,YAAY3M,EAAImH,EAAKoJ,aAAa5D,YAAY3M,GAAKwN,GAAQrG,EAAKoJ,aAAa9O,MAAM,EAAG,CAC7F8L,GAAiB,CACjB,QAIAA,IACFpG,EAAKoJ,aAAa3D,KAAKU,EAAKzB,OAASyB,EAAK7L,MAAQyL,GAClDG,QAIJpK,KAAKsN,aAAanD,cAAe,EAEjCnK,KAAKsN,aAAa3I,YAKxB/B,EAAU/G,UAAU6M,YAAc,WAC5B1I,KAAKmI,YACPnI,KAAKyK,WAAWzK,KAAKmI,WAAYnI,KAAKqB,QAAQ,YAAarB,KAAK6C,eAG9D7C,KAAKoI,WACPpI,KAAKyK,WAAWzK,KAAKoI,UAAWpI,KAAKqB,QAAQ,WAAYrB,KAAK8C,eA8OlE+D,EAAU1D,MAAQA"} \ No newline at end of file diff --git a/release/flowchart.zip b/release/flowchart.zip deleted file mode 100644 index 0778d4d1..00000000 Binary files a/release/flowchart.zip and /dev/null differ diff --git a/releasenotes.md b/releasenotes.md index 38210b81..b23ca65d 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,3 +1,127 @@ +### v1.18.0 + +- introduce input and output [#251](https://github.com/adrai/flowchart.js/pull/251) + +### v1.17.1 + +- fix start and end roundness introduced in [#227](https://github.com/adrai/flowchart.js/pull/227) + +### v1.17.0 + +- Styling to allow rounded corners [#227](https://github.com/adrai/flowchart.js/pull/227) + +### v1.16.0 + +- Custom annotations for parallel [#225](https://github.com/adrai/flowchart.js/issues/225) + +### v1.15.0 + +- Introduce types [#214](https://github.com/adrai/flowchart.js/pull/214) thanks to [Mister-Hope](https://github.com/Mister-Hope) + +### v1.14.3 + +- Removed types introduced in [#212](https://github.com/adrai/flowchart.js/pull/212) again + +### v1.14.2 + +- Basic types [#212](https://github.com/adrai/flowchart.js/pull/212) thanks to [DerMolly](https://github.com/DerMolly) + +### v1.14.1 + +- Corrected condition behavior and fixed layout [#211](https://github.com/adrai/flowchart.js/pull/211) thanks to [AlexanderMisel](https://github.com/AlexanderMisel) + +### v1.14.0 + +- Custom annotations [#209](https://github.com/adrai/flowchart.js/pull/209) thanks to [serpent-charmer](https://github.com/serpent-charmer) + + +### v1.13.0 + +- Provide low cost means of lines not colliding until they converge [#191](https://github.com/adrai/flowchart.js/pull/191) thanks to [robertleeplummerjr](https://github.com/robertleeplummerjr) +- update raphael dependency + + +### v1.12.3 + +- Cleaning error fix, Linestyle parsing cycle fix, Dynamic flowState update [#188](https://github.com/adrai/flowchart.js/pull/188) thanks to [murich](https://github.com/murich) + + +### v1.12.2 + +- shrink npm package + + +### v1.12.1 + +- Fix params bug [#173](https://github.com/adrai/flowchart.js/pull/173) thanks to [leo108](https://github.com/leo108) + + +### v1.12.0 + +- onclick function binding to chart nodes [#172](https://github.com/adrai/flowchart.js/pull/172) thanks to [ndrqu](https://github.com/ndrqu) + + +### v1.11.3 + +- try to optimize horizontal rendering for end symbols [#155](https://github.com/adrai/flowchart.js/issues/155) + +### v1.11.2 + +- try to optimize left handling [#152](https://github.com/adrai/flowchart.js/issues/152) + +### v1.11.1 + +- fix direction issue for condition [#151](https://github.com/adrai/flowchart.js/issues/151) + +### v1.11.0 + +- Add parallel component [#145](https://github.com/adrai/flowchart.js/pull/145) thanks to [sudhakar-sekar](https://github.com/sudhakar-sekar) + +### v1.9.0 + +- Add arrow-text attribute to symbols [#141](https://github.com/adrai/flowchart.js/pull/141) thanks to [josephtocci](https://github.com/josephtocci) + +### v1.8.0 + +- Allow Conditional to support 'true' or 'false' along with 'yes' and 'no' [#128](https://github.com/adrai/flowchart.js/pull/128) thanks to [bhedge](https://github.com/bhedge) + +### v1.7.0 + +- add parameter to disable vertical alignment of condition symbol [#115](https://github.com/adrai/flowchart.js/pull/115) thanks to [bertrandmartel](https://github.com/bertrandmartel) +- add line style flow support [#113](https://github.com/adrai/flowchart.js/pull/115) thanks to [bertrandmartel](https://github.com/bertrandmartel) + +### v1.6.6 + +- Fix disruptive space char when parsing [#105](https://github.com/adrai/flowchart.js/pull/105) + +### v1.6.5 + +- set proper engine version in package.json + +### v1.6.4 + +- raphael now is an npm dependency (not the git reference anymore) + +### v1.6.3 + +- Allow going to same symbol thanks to [nonylene](https://github.com/nonylene) [#83](https://github.com/adrai/flowchart.js/pull/83) + +### v1.6.2 + +- Fixed not calculate viewBox and size properly thanks to [jackycute](https://github.com/jackycute) [#74](https://github.com/adrai/flowchart.js/issues/#74) + +### v1.6.1 + +- Fixed lines are not included in the calculation of viewBox and size thanks to [jackycute](https://github.com/jackycute) [#72](https://github.com/adrai/flowchart.js/issues/#72) [#67](https://github.com/adrai/flowchart.js/issues/#67) + +### v1.6.0 + +- changed build to use only webpack thanks to [sergeyt](https://github.com/sergeyt) [#70](https://github.com/adrai/flowchart.js/issues/70) + +### v1.4.2 + +- optimized handling of special characters thanks to the advice of [Badhumvee](https://github.com/Badhumvee) + ### v1.4.0 - Support scale option [#52](https://github.com/adrai/flowchart.js/pull/52) thanks to [hikarock](https://github.com/hikarock) diff --git a/site b/site index e5992caa..63921d93 160000 --- a/site +++ b/site @@ -1 +1 @@ -Subproject commit e5992caac6049101e6934ceab5b6d7a65483a823 +Subproject commit 63921d93a0b949df86d73f669155e188704b75b5 diff --git a/src/amd.js b/src/amd.js deleted file mode 100644 index ab2c5b1d..00000000 --- a/src/amd.js +++ /dev/null @@ -1,34 +0,0 @@ -(function (root, factory) { - if (typeof exports === 'object') { - - module.exports = factory(); - - } else if (typeof define === 'function' && define.amd) { - - define([], factory); - - } -}(this, function () { - - //= flowchart.shim.js - - var root = this, - flowchart = {}; - - //= flowchart.defaults.js - //= flowchart.helpers.js - //= flowchart.functions.js - //= flowchart.chart.js - //= flowchart.symbol.js - //= flowchart.symbol.start.js - //= flowchart.symbol.end.js - //= flowchart.symbol.operation.js - //= flowchart.symbol.subroutine.js - //= flowchart.symbol.inputoutput.js - //= flowchart.symbol.condition.js - //= flowchart.parse.js - //= flowchart.api.js - - return flowchart; - -})); \ No newline at end of file diff --git a/src/flowchart.api.js b/src/flowchart.api.js deleted file mode 100644 index 81fc25e6..00000000 --- a/src/flowchart.api.js +++ /dev/null @@ -1,2 +0,0 @@ -// public api interface -flowchart.parse = parse; \ No newline at end of file diff --git a/src/flowchart.chart.js b/src/flowchart.chart.js index deb61e29..db00d821 100644 --- a/src/flowchart.chart.js +++ b/src/flowchart.chart.js @@ -1,9 +1,15 @@ +var Raphael = require('raphael'); +var defaults = require('./flowchart.helpers').defaults; +var defaultOptions = require('./flowchart.defaults'); +var Condition = require('./flowchart.symbol.condition'); +var Parallel = require('./flowchart.symbol.parallel'); + function FlowChart(container, options) { options = options || {}; this.paper = new Raphael(container); - this.options = f.defaults(options, o); + this.options = defaults(options, defaultOptions); this.symbols = []; this.lines = []; @@ -27,7 +33,29 @@ FlowChart.prototype.handle = function(symbol) { }; symbol.no = function(nextSymbol) { symbol.no_symbol = nextSymbol; - if(symbol.yes_symbol) { + if (symbol.yes_symbol) { + symbol.pathOk = true; + } + return flowChart.handle(nextSymbol); + }; + } else if (symbol instanceof(Parallel)) { + symbol.path1 = function(nextSymbol) { + symbol.path1_symbol = nextSymbol; + if (symbol.path2_symbol) { + symbol.pathOk = true; + } + return flowChart.handle(nextSymbol); + }; + symbol.path2 = function(nextSymbol) { + symbol.path2_symbol = nextSymbol; + if (symbol.path3_symbol) { + symbol.pathOk = true; + } + return flowChart.handle(nextSymbol); + }; + symbol.path3 = function(nextSymbol) { + symbol.path3_symbol = nextSymbol; + if (symbol.path1_symbol) { symbol.pathOk = true; } return flowChart.handle(nextSymbol); @@ -50,12 +78,15 @@ FlowChart.prototype.startWith = function(symbol) { FlowChart.prototype.render = function() { var maxWidth = 0, - maxHeight = 0, - i = 0, - len = 0, - maxX = 0, - maxY = 0, - symbol; + maxHeight = 0, + i = 0, + len = 0, + maxX = 0, + maxY = 0, + minX = 0, + minY = 0, + symbol, + line; for (i = 0, len = this.symbols.length; i < len; i++) { symbol = this.symbols[i]; @@ -86,10 +117,17 @@ FlowChart.prototype.render = function() { maxX = this.maxXFromLine; + var x; + var y; + for (i = 0, len = this.symbols.length; i < len; i++) { symbol = this.symbols[i]; - var x = symbol.getX() + symbol.width; - var y = symbol.getY() + symbol.height; + var leftX = symbol.getX() + x = leftX + symbol.width; + y = symbol.getY() + symbol.height; + if (leftX < minX) { + minX = leftX; + } if (x > maxX) { maxX = x; } @@ -98,15 +136,46 @@ FlowChart.prototype.render = function() { } } + for (i = 0, len = this.lines.length; i < len; i++) { + line = this.lines[i].getBBox(); + x = line.x; + y = line.y; + var x2 = line.x2; + var y2 = line.y2; + if (x < minX) { + minX = x; + } + if (y < minY) { + minY = y; + } + if (x2 > maxX) { + maxX = x2; + } + if (y2 > maxY) { + maxY = y2; + } + } + var scale = this.options['scale']; var lineWidth = this.options['line-width']; - this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale)); - this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true); + + if (this.minXFromSymbols < minX) minX = this.minXFromSymbols; + + if (minX < 0) minX -= lineWidth; + if (minY < 0) minY -= lineWidth; + + var width = maxX + lineWidth - minX; + var height = maxY + lineWidth - minY; + + this.paper.setSize(width * scale, height * scale); + this.paper.setViewBox(minX, minY, width, height, true); }; FlowChart.prototype.clean = function() { if (this.paper) { var paperDom = this.paper.canvas; - paperDom.parentNode.removeChild(paperDom); + paperDom.parentNode && paperDom.parentNode.removeChild(paperDom); } }; + +module.exports = FlowChart; \ No newline at end of file diff --git a/src/flowchart.defaults.js b/src/flowchart.defaults.js index 93611489..e10dac07 100644 --- a/src/flowchart.defaults.js +++ b/src/flowchart.defaults.js @@ -1,7 +1,8 @@ // defaults -var o = { +module.exports = { 'x': 0, 'y': 0, + // 'roundness': 0, 'line-width': 3, 'line-length': 50, 'text-margin': 10, @@ -23,13 +24,16 @@ var o = { 'end': {}, 'condition': {}, 'inputoutput': {}, + 'input': {}, //tds + 'output': {}, //tds 'operation': {}, - 'subroutine': {} - }//, + 'subroutine': {}, + 'parallel': {} + } //, // 'flowstate' : { // 'past' : { 'fill': '#CCCCCC', 'font-size': 12}, // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'}, // 'future' : { 'fill': '#FFFF99'}, // 'invalid': {'fill': '#444444'} // } -}; +}; \ No newline at end of file diff --git a/src/flowchart.exports.js b/src/flowchart.exports.js deleted file mode 100644 index 49a23cf1..00000000 --- a/src/flowchart.exports.js +++ /dev/null @@ -1,8 +0,0 @@ -// Export the flowchart object for **CommonJS**. -// If we're not in CommonJS, add `flowchart` to the -// global object or to jquery. -if (typeof module !== 'undefined' && module.exports) { - module.exports = flowchart; -} else { - root.flowchart = root.flowchart || flowchart; -} \ No newline at end of file diff --git a/src/flowchart.functions.js b/src/flowchart.functions.js index b76b0aa8..073f0d37 100644 --- a/src/flowchart.functions.js +++ b/src/flowchart.functions.js @@ -13,7 +13,7 @@ function drawPath(chart, location, points) { symbol.attr('stroke', chart.options['element-color']); symbol.attr('stroke-width', chart.options['line-width']); - var font = chart.options['font']; + var font = chart.options.font; var fontF = chart.options['font-family']; var fontW = chart.options['font-weight']; @@ -48,7 +48,7 @@ function drawLine(chart, from, to, text) { 'arrow-end': chart.options['arrow-end'] }); - var font = chart.options['font']; + var font = chart.options.font; var fontF = chart.options['font-family']; var fontW = chart.options['font-weight']; @@ -61,6 +61,7 @@ function drawLine(chart, from, to, text) { var centerText = false; var textPath = chart.paper.text(0, 0, text); + var textAnchor = 'start'; var isHorizontal = false; var firstTo = to[0]; @@ -97,16 +98,24 @@ function drawLine(chart, from, to, text) { y = from.y; if (isHorizontal) { - x += chart.options['text-margin']/2; + if (from.x > firstTo.x) { + x -= chart.options['text-margin']/2; + textAnchor = 'end'; + } else { + x += chart.options['text-margin']/2; + } y -= chart.options['text-margin']; } else { x += chart.options['text-margin']/2; y += chart.options['text-margin']; + if (from.y > firstTo.y) { + y -= chart.options['text-margin']*2; + } } } textPath.attr({ - 'text-anchor': 'start', + 'text-anchor': textAnchor, 'font-size': chart.options['font-size'], 'fill': chart.options['font-color'], x: x, @@ -158,4 +167,10 @@ function checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, l } // if line1 and line2 are segments, they intersect if both of the above are true return result; -} \ No newline at end of file +} + +module.exports = { + drawPath: drawPath, + drawLine: drawLine, + checkLineIntersection: checkLineIntersection +}; diff --git a/src/flowchart.helpers.js b/src/flowchart.helpers.js index b8b770c5..acb17cba 100644 --- a/src/flowchart.helpers.js +++ b/src/flowchart.helpers.js @@ -44,7 +44,7 @@ function _inherits(ctor, superCtor) { // move dependent functions to a container so that // they can be overriden easier in no jquery environment (node.js) -var f = { +module.exports = { defaults: _defaults, inherits: _inherits -}; \ No newline at end of file +}; diff --git a/src/flowchart.js b/src/flowchart.js deleted file mode 100644 index 91db07e7..00000000 --- a/src/flowchart.js +++ /dev/null @@ -1,23 +0,0 @@ -(function() { - - //= flowchart.shim.js - - var root = this, - flowchart = {}; - - //= flowchart.exports.js - //= flowchart.defaults.js - //= flowchart.helpers.js - //= flowchart.functions.js - //= flowchart.chart.js - //= flowchart.symbol.js - //= flowchart.symbol.start.js - //= flowchart.symbol.end.js - //= flowchart.symbol.operation.js - //= flowchart.symbol.subroutine.js - //= flowchart.symbol.inputoutput.js - //= flowchart.symbol.condition.js - //= flowchart.parse.js - //= flowchart.api.js - -})(); \ No newline at end of file diff --git a/src/flowchart.parse.js b/src/flowchart.parse.js index 8145cb96..03e941fa 100644 --- a/src/flowchart.parse.js +++ b/src/flowchart.parse.js @@ -1,3 +1,15 @@ +var FlowChart = require('./flowchart.chart'); +var Start = require('./flowchart.symbol.start'); +var End = require('./flowchart.symbol.end'); +var Operation = require('./flowchart.symbol.operation'); +var InputOutput = require('./flowchart.symbol.inputoutput'); +var Input = require('./flowchart.symbol.input'); //tds +var Output = require('./flowchart.symbol.output'); //tds +var Subroutine = require('./flowchart.symbol.subroutine'); +var Condition = require('./flowchart.symbol.condition'); +var Parallel = require('./flowchart.symbol.parallel'); + + function parse(input) { input = input || ''; input = input.trim(); @@ -34,12 +46,21 @@ function parse(input) { case 'inputoutput': dispSymbols[s.key] = new InputOutput(diagram, s); break; + case 'input': + dispSymbols[s.key] = new Input(diagram, s); //tds + break; + case 'output': + dispSymbols[s.key] = new Output(diagram, s); //tds + break; case 'subroutine': dispSymbols[s.key] = new Subroutine(diagram, s); break; case 'condition': dispSymbols[s.key] = new Condition(diagram, s); break; + case 'parallel': + dispSymbols[s.key] = new Parallel(diagram, s); + break; default: return new Error('Wrong symbol type!'); } @@ -60,6 +81,16 @@ function parse(input) { if (prev.no === s) { prevDisp.no(dispSymb); } + } else if (prevDisp instanceof(Parallel)) { + if (prev.path1 === s) { + prevDisp.path1(dispSymb); + } + if (prev.path2 === s) { + prevDisp.path2(dispSymb); + } + if (prev.path3 === s) { + prevDisp.path3(dispSymb); + } } else { prevDisp.then(dispSymb); } @@ -76,6 +107,16 @@ function parse(input) { if (s.no) { constructChart(s.no, dispSymb, s); } + } else if (dispSymb instanceof(Parallel)) { + if (s.path1) { + constructChart(s.path1, dispSymb, s); + } + if (s.path2) { + constructChart(s.path2, dispSymb, s); + } + if (s.path3) { + constructChart(s.path3, dispSymb, s); + } } else if (s.next) { constructChart(s.next, dispSymb, s); } @@ -87,6 +128,9 @@ function parse(input) { }, clean: function() { this.diagram.clean(); + }, + options: function() { + return this.diagram.options; } }; @@ -100,14 +144,14 @@ function parse(input) { } } - if(prevBreak < input.length) { + if (prevBreak < input.length) { lines.push(input.substr(prevBreak)); } for (var l = 1, len = lines.length; l < len;) { var currentLine = lines[l]; - if (currentLine.indexOf(': ') < 0 && currentLine.indexOf('(') < 0 && currentLine.indexOf(')') < 0 && currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0) { + if (currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0 && currentLine.indexOf('@>') < 0) { lines[l - 1] += '\n' + currentLine; lines.splice(l, 1); len--; @@ -116,6 +160,24 @@ function parse(input) { } } + function getStyle(s){ + var startIndex = s.indexOf('(') + 1; + var endIndex = s.indexOf(')'); + if (startIndex >= 0 && endIndex >= 0) { + return s.substring(startIndex,endIndex); + } + return '{}'; + } + + function getSymbValue(s){ + var startIndex = s.indexOf('(') + 1; + var endIndex = s.indexOf(')'); + if (startIndex >= 0 && endIndex >= 0) { + return s.substring(startIndex,endIndex); + } + return ''; + } + function getSymbol(s) { var startIndex = s.indexOf('(') + 1; var endIndex = s.indexOf(')'); @@ -139,38 +201,70 @@ function parse(input) { } return next; } + + function getAnnotation(s) { + var startIndex = s.indexOf("(") + 1, endIndex = s.indexOf(")"); + var tmp = s.substring(startIndex, endIndex); + if(tmp.indexOf(",") > 0) { tmp = tmp.substring(0, tmp.indexOf(",")); } + var tmp_split = tmp.split("@"); + if(tmp_split.length > 1) + return startIndex >= 0 && endIndex >= 0 ? tmp_split[1] : ""; + } while (lines.length > 0) { - var line = lines.splice(0, 1)[0]; + var line = lines.splice(0, 1)[0].trim(); if (line.indexOf('=>') >= 0) { // definition var parts = line.split('=>'); var symbol = { - key: parts[0], + key: parts[0].replace(/\(.*\)/, ''), symbolType: parts[1], text: null, link: null, target: null, - flowstate: null + flowstate: null, + function: null, + lineStyle: {}, + params: {} }; + //parse parameters + var params = parts[0].match(/\((.*)\)/); + if (params && params.length > 1){ + var entries = params[1].split(','); + for(var i = 0; i < entries.length; i++) { + var entry = entries[i].split('='); + if (entry.length == 2) { + symbol.params[entry[0]] = entry[1]; + } + } + } + var sub; if (symbol.symbolType.indexOf(': ') >= 0) { sub = symbol.symbolType.split(': '); - symbol.symbolType = sub[0]; - symbol.text = sub[1]; + symbol.symbolType = sub.shift(); + symbol.text = sub.join(': '); } - if (symbol.text && symbol.text.indexOf(':>') >= 0) { + if (symbol.text && symbol.text.indexOf(':$') >= 0) { + sub = symbol.text.split(':$'); + symbol.text = sub.shift(); + symbol.function = sub.join(':$'); + } else if (symbol.symbolType.indexOf(':$') >= 0) { + sub = symbol.symbolType.split(':$'); + symbol.symbolType = sub.shift(); + symbol.function = sub.join(':$'); + } else if (symbol.text && symbol.text.indexOf(':>') >= 0) { sub = symbol.text.split(':>'); - symbol.text = sub[0]; - symbol.link = sub[1]; + symbol.text = sub.shift(); + symbol.link = sub.join(':>'); } else if (symbol.symbolType.indexOf(':>') >= 0) { sub = symbol.symbolType.split(':>'); - symbol.symbolType = sub[0]; - symbol.link = sub[1]; + symbol.symbolType = sub.shift(); + symbol.link = sub.join(':>'); } if (symbol.symbolType.indexOf('\n') >= 0) { @@ -192,8 +286,8 @@ function parse(input) { if (symbol.text) { if (symbol.text.indexOf('|') >= 0) { var txtAndState = symbol.text.split('|'); - symbol.text = txtAndState[0]; - symbol.flowstate = txtAndState[1].trim(); + symbol.flowstate = txtAndState.pop().trim(); + symbol.text = txtAndState.join('|'); } } /* end of flowstate support */ @@ -201,13 +295,24 @@ function parse(input) { chart.symbols[symbol.key] = symbol; } else if (line.indexOf('->') >= 0) { + var ann = getAnnotation(line); + if (ann) { + line = line.replace('@' + ann, ''); + } // flow var flowSymbols = line.split('->'); - for (var i = 0, lenS = flowSymbols.length; i < lenS; i++) { - var flowSymb = flowSymbols[i]; - - var realSymb = getSymbol(flowSymb); + for (var iS = 0, lenS = flowSymbols.length; iS < lenS; iS++) { + var flowSymb = flowSymbols[iS]; + var symbVal = getSymbValue(flowSymb); + + if (symbVal === 'true' || symbVal === 'false') { + // map true or false to yes or no respectively + flowSymb = flowSymb.replace('true', 'yes'); + flowSymb = flowSymb.replace('false', 'no'); + } + var next = getNextPath(flowSymb); + var realSymb = getSymbol(flowSymb); var direction = null; if (next.indexOf(',') >= 0) { @@ -216,19 +321,52 @@ function parse(input) { direction = condOpt[1].trim(); } + if (ann) { + if (realSymb.symbolType === 'condition') { + if (next === "yes" || next === "true") { + realSymb.yes_annotation = ann; + } else { + realSymb.no_annotation = ann; + } + } else if (realSymb.symbolType === 'parallel') { + if (next === 'path1') { + realSymb.path1_annotation = ann; + } else if (next === 'path2') { + realSymb.path2_annotation = ann; + } else if (next === 'path3') { + realSymb.path3_annotation = ann; + } + } + ann = null; + } + if (!chart.start) { chart.start = realSymb; } - if (i + 1 < lenS) { - var nextSymb = flowSymbols[i + 1]; + if (iS + 1 < lenS) { + var nextSymb = flowSymbols[iS + 1]; realSymb[next] = getSymbol(nextSymb); realSymb['direction_' + next] = direction; direction = null; } } + } else if (line.indexOf('@>') >= 0) { + + // line style + var lineStyleSymbols = line.split('@>'); + for (var iSS = 0, lenSS = lineStyleSymbols.length; iSS < lenSS; iSS++) { + if ((iSS + 1) !== lenSS) { + var curSymb = getSymbol(lineStyleSymbols[iSS]); + var nextSymbol = getSymbol(lineStyleSymbols[iSS+1]); + + curSymb['lineStyle'][nextSymbol.key] = JSON.parse(getStyle(lineStyleSymbols[iSS + 1])); + } + } } } return chart; } + +module.exports = parse; diff --git a/src/flowchart.symbol.condition.js b/src/flowchart.symbol.condition.js index 3c776478..e9459492 100644 --- a/src/flowchart.symbol.condition.js +++ b/src/flowchart.symbol.condition.js @@ -1,30 +1,21 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; +var drawAPI = require('./flowchart.functions'); +var drawPath = drawAPI.drawPath; + function Condition(chart, options) { options = options || {}; Symbol.call(this, chart, options); + this.yes_annotation = options.yes_annotation; + this.no_annotation = options.no_annotation; this.textMargin = this.getAttr('text-margin'); - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - if (options.yes && options['direction_yes'] && options.no && !options['direction_no']) { - if (options['direction_yes'] === 'right') { - this.no_direction = 'bottom'; - this.yes_direction = 'right'; - } else { - this.no_direction = 'right'; - this.yes_direction = 'bottom'; - } - } else if (options.yes && !options['direction_yes'] && options.no && options['direction_no']) { - if (options['direction_no'] === 'right') { - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - } else { - this.yes_direction = 'right'; - this.no_direction = 'bottom'; - } - } else { - this.yes_direction = 'bottom'; - this.no_direction = 'right'; + this.yes_direction = options.direction_yes; + this.no_direction = options.direction_no; + if (!this.no_direction && this.yes_direction === 'right') { + this.no_direction = 'bottom'; + } else if (!this.yes_direction && this.no_direction === 'bottom') { + this.yes_direction = 'right' } - this.yes_direction = this.yes_direction || 'bottom'; this.no_direction = this.no_direction || 'right'; @@ -71,13 +62,14 @@ function Condition(chart, options) { this.group.push(symbol); symbol.insertBefore(this.text); + this.symbol = symbol this.initialize(); } -f.inherits(Condition, Symbol); +inherits(Condition, Symbol); Condition.prototype.render = function() { - + var self = this; if (this.yes_direction) { this[this.yes_direction + '_symbol'] = this.yes_symbol; } @@ -90,7 +82,6 @@ Condition.prototype.render = function() { if (this.bottom_symbol) { var bottomPoint = this.getBottom(); - var topPoint = this.bottom_symbol.getTop(); if (!this.bottom_symbol.isPositioned) { this.bottom_symbol.shiftY(this.getY() + this.height + lineLength); @@ -103,28 +94,29 @@ Condition.prototype.render = function() { if (this.right_symbol) { var rightPoint = this.getRight(); - var leftPoint = this.right_symbol.getLeft(); if (!this.right_symbol.isPositioned) { this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2); this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength); - var self = this; (function shift() { var hasSymbolUnder = false; var symb; for (var i = 0, len = self.chart.symbols.length; i < len; i++) { symb = self.chart.symbols[i]; - var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x); - if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) { - hasSymbolUnder = true; - break; + if (!self.params['align-next'] || self.params['align-next'] !== 'no') { + var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x); + if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) { + hasSymbolUnder = true; + break; + } } } if (hasSymbolUnder) { + if (self.right_symbol.symbolType === 'end') return; self.right_symbol.setX(symb.getX() + symb.width + lineLength); shift(); } @@ -135,14 +127,51 @@ Condition.prototype.render = function() { this.right_symbol.render(); } } + + if (this.left_symbol) { + var leftPoint = this.getLeft(); + + if (!this.left_symbol.isPositioned) { + this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2); + this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength)); + + (function shift() { + var hasSymbolUnder = false; + var symb; + for (var i = 0, len = self.chart.symbols.length; i < len; i++) { + symb = self.chart.symbols[i]; + + if (!self.params['align-next'] || self.params['align-next'] !== 'no') { + var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x); + if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) { + hasSymbolUnder = true; + break; + } + } + } + + if (hasSymbolUnder) { + if (self.left_symbol.symbolType === 'end') return; + self.left_symbol.setX(symb.getX() + symb.width + lineLength); + shift(); + } + })(); + + this.left_symbol.isPositioned = true; + + this.left_symbol.render(); + } + } }; Condition.prototype.renderLines = function() { if (this.yes_symbol) { - this.drawLineTo(this.yes_symbol, this.getAttr('yes-text'), this.yes_direction); + this.drawLineTo(this.yes_symbol, this.yes_annotation ? this.yes_annotation : this.getAttr('yes-text'), this.yes_direction); } if (this.no_symbol) { - this.drawLineTo(this.no_symbol, this.getAttr('no-text'), this.no_direction); + this.drawLineTo(this.no_symbol, this.no_annotation ? this.no_annotation : this.getAttr('no-text'), this.no_direction); } }; + +module.exports = Condition; diff --git a/src/flowchart.symbol.end.js b/src/flowchart.symbol.end.js index 1da193db..4d8ee581 100644 --- a/src/flowchart.symbol.end.js +++ b/src/flowchart.symbol.end.js @@ -1,7 +1,12 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; + function End(chart, options) { var symbol = chart.paper.rect(0, 0, 0, 0, 20); options = options || {}; options.text = options.text || 'End'; Symbol.call(this, chart, options, symbol); } -f.inherits(End, Symbol); \ No newline at end of file +inherits(End, Symbol); + +module.exports = End; diff --git a/src/flowchart.symbol.input.js b/src/flowchart.symbol.input.js new file mode 100644 index 00000000..6f5823dc --- /dev/null +++ b/src/flowchart.symbol.input.js @@ -0,0 +1,67 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; +var drawAPI = require('./flowchart.functions'); +var drawPath = drawAPI.drawPath; + +function Input(chart, options) { + options = options || {}; + Symbol.call(this, chart, options); + this.textMargin = this.getAttr('text-margin'); + + this.text.attr({ + x: this.textMargin * 3 + }); + + var width = this.text.getBBox().width + 4 * this.textMargin; + var height = this.text.getBBox().height + 2 * this.textMargin; + var startX = this.textMargin; + var startY = height/2; + + var start = {x: startX, y: startY}; + var points = [ + {x: startX - this.textMargin + 2 * this.textMargin, y: height}, + {x: startX - this.textMargin + width, y: height}, + {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0}, + {x: startX - this.textMargin, y: 0}, + {x: startX, y: startY} + ]; + + var symbol = drawPath(chart, start, points); + + symbol.attr({ + stroke: this.getAttr('element-color'), + 'stroke-width': this.getAttr('line-width'), + fill: this.getAttr('fill') + }); + if (options.link) { symbol.attr('href', options.link); } + if (options.target) { symbol.attr('target', options.target); } + if (options.key) { symbol.node.id = options.key; } + symbol.node.setAttribute('class', this.getAttr('class')); + + this.text.attr({ + y: symbol.getBBox().height/2 + }); + + this.group.push(symbol); + symbol.insertBefore(this.text); + this.symbol = symbol + + this.initialize(); +} +inherits(Input, Symbol); + +Input.prototype.getLeft = function() { + var y = this.getY() + this.group.getBBox().height/2; + var x = this.getX() + this.textMargin; + return {x: x, y: y}; +}; + +Input.prototype.getRight = function() { + var y = this.getY() + this.group.getBBox().height/2; + var x = this.getX() + this.group.getBBox().width - this.textMargin; + return {x: x, y: y}; +}; + +module.exports = Input; + + diff --git a/src/flowchart.symbol.inputoutput.js b/src/flowchart.symbol.inputoutput.js index cca3230b..cd8573d3 100644 --- a/src/flowchart.symbol.inputoutput.js +++ b/src/flowchart.symbol.inputoutput.js @@ -1,8 +1,13 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; +var drawAPI = require('./flowchart.functions'); +var drawPath = drawAPI.drawPath; + function InputOutput(chart, options) { options = options || {}; Symbol.call(this, chart, options); this.textMargin = this.getAttr('text-margin'); - + this.text.attr({ x: this.textMargin * 3 }); @@ -39,10 +44,11 @@ function InputOutput(chart, options) { this.group.push(symbol); symbol.insertBefore(this.text); + this.symbol = symbol this.initialize(); } -f.inherits(InputOutput, Symbol); +inherits(InputOutput, Symbol); InputOutput.prototype.getLeft = function() { var y = this.getY() + this.group.getBBox().height/2; @@ -55,3 +61,5 @@ InputOutput.prototype.getRight = function() { var x = this.getX() + this.group.getBBox().width - this.textMargin; return {x: x, y: y}; }; + +module.exports = InputOutput; diff --git a/src/flowchart.symbol.js b/src/flowchart.symbol.js index 507331df..7a01be98 100644 --- a/src/flowchart.symbol.js +++ b/src/flowchart.symbol.js @@ -1,3 +1,7 @@ +var drawAPI = require('./flowchart.functions'); +var drawLine = drawAPI.drawLine; +var checkLineIntersection = drawAPI.checkLineIntersection; + function Symbol(chart, options, symbol) { this.chart = chart; this.group = this.chart.paper.set(); @@ -5,14 +9,21 @@ function Symbol(chart, options, symbol) { this.connectedTo = []; this.symbolType = options.symbolType; this.flowstate = (options.flowstate || 'future'); + this.lineStyle = (options.lineStyle || {}); + this.key = (options.key || ''); + this.leftLines = []; + this.rightLines = []; + this.topLines = []; + this.bottomLines = []; + this.params = options.params; this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined; - + this.text = this.chart.paper.text(0, 0, options.text); //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t if (options.key) { this.text.node.id = options.key + 't'; } this.text.node.setAttribute('class', this.getAttr('class') + 't'); - + this.text.attr({ 'text-anchor': 'start', 'x' : this.getAttr('text-margin'), @@ -29,6 +40,16 @@ function Symbol(chart, options, symbol) { if (fontW) this.text.attr({ 'font-weight': fontW }); if (options.link) { this.text.attr('href', options.link); } + + //ndrqu Add click function with event and options params + if (options.function) { + this.text.attr({ 'cursor' : 'pointer' }); + + this.text.node.addEventListener("click", function(evt) { + window[options.function](evt,options); + }, false); + } + if (options.target) { this.text.attr('target', options.target); } var maxWidth = this.getAttr('maxWidth'); @@ -47,12 +68,12 @@ function Symbol(chart, options, symbol) { } this.text.attr("text", tempText.substring(1)); } - + this.group.push(this.text); if (symbol) { var tmpMargin = this.getAttr('text-margin'); - + symbol.attr({ 'fill' : this.getAttr('fill'), 'stroke' : this.getAttr('element-color'), @@ -62,9 +83,22 @@ function Symbol(chart, options, symbol) { }); symbol.node.setAttribute('class', this.getAttr('class')); + var roundness = this.getAttr('roundness'); + if (!isNaN(roundness)) { + symbol.node.setAttribute('ry', roundness); + symbol.node.setAttribute('rx', roundness); + } if (options.link) { symbol.attr('href', options.link); } if (options.target) { symbol.attr('target', options.target); } + + //ndrqu Add click function with event and options params + if (options.function) { + symbol.node.addEventListener("click", function(evt) { + window[options.function](evt,options); + }, false); + symbol.attr({ 'cursor' : 'pointer' }); + } if (options.key) { symbol.node.id = options.key; } this.group.push(symbol); @@ -156,19 +190,17 @@ Symbol.prototype.getRight = function() { Symbol.prototype.render = function() { if (this.next) { + var self = this; var lineLength = this.getAttr('line-length'); if (this.next_direction === 'right') { var rightPoint = this.getRight(); - var leftPoint = this.next.getLeft(); if (!this.next.isPositioned) { - this.next.setY(rightPoint.y - this.next.height/2); this.next.shiftX(this.group.getBBox().x + this.width + lineLength); - var self = this; (function shift() { var hasSymbolUnder = false; var symb; @@ -183,6 +215,39 @@ Symbol.prototype.render = function() { } if (hasSymbolUnder) { + if (self.next.symbolType === 'end') return; + self.next.setX(symb.getX() + symb.width + lineLength); + shift(); + } + })(); + + this.next.isPositioned = true; + + this.next.render(); + } + } else if (this.next_direction === 'left') { + + var leftPoint = this.getLeft(); + + if (!this.next.isPositioned) { + this.next.setY(leftPoint.y - this.next.height/2); + this.next.shiftX(-(this.group.getBBox().x + this.width + lineLength)); + + (function shift() { + var hasSymbolUnder = false; + var symb; + for (var i = 0, len = self.chart.symbols.length; i < len; i++) { + symb = self.chart.symbols[i]; + + var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x); + if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) { + hasSymbolUnder = true; + break; + } + } + + if (hasSymbolUnder) { + if (self.next.symbolType === 'end') return; self.next.setX(symb.getX() + symb.width + lineLength); shift(); } @@ -194,7 +259,6 @@ Symbol.prototype.render = function() { } } else { var bottomPoint = this.getBottom(); - var topPoint = this.next.getTop(); if (!this.next.isPositioned) { this.next.shiftY(this.getY() + this.height + lineLength); @@ -210,9 +274,9 @@ Symbol.prototype.render = function() { Symbol.prototype.renderLines = function() { if (this.next) { if (this.next_direction) { - this.drawLineTo(this.next, '', this.next_direction); + this.drawLineTo(this.next, this.getAttr('arrow-text') || '', this.next_direction); } else { - this.drawLineTo(this.next); + this.drawLineTo(this.next, this.getAttr('arrow-text') || ''); } } }; @@ -224,121 +288,189 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) { var x = this.getCenter().x, y = this.getCenter().y, - top = this.getTop(), right = this.getRight(), bottom = this.getBottom(), + top = this.getTop(), left = this.getLeft(); var symbolX = symbol.getCenter().x, symbolY = symbol.getCenter().y, symbolTop = symbol.getTop(), symbolRight = symbol.getRight(), - symbolBottom = symbol.getBottom(), symbolLeft = symbol.getLeft(); var isOnSameColumn = x === symbolX, isOnSameLine = y === symbolY, isUnder = y < symbolY, - isUpper = y > symbolY, + isUpper = y > symbolY || this === symbol, isLeft = x > symbolX, isRight = x < symbolX; var maxX = 0, line, + yOffset, lineLength = this.getAttr('line-length'), lineWith = this.getAttr('line-width'); if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) { - line = drawLine(this.chart, bottom, symbolTop, text); + if (symbol.topLines.length === 0 && this.bottomLines.length === 0) { + line = drawLine(this.chart, bottom, symbolTop, text); + } else { + yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10; + line = drawLine(this.chart, bottom, [ + {x: symbolTop.x, y: symbolTop.y - yOffset}, + {x: symbolTop.x, y: symbolTop.y} + ], text); + } + this.bottomLines.push(line); + symbol.topLines.push(line); this.bottomStart = true; symbol.topEnd = true; maxX = bottom.x; } else if ((!origin || origin === 'right') && isOnSameLine && isRight) { - line = drawLine(this.chart, right, symbolLeft, text); + if (symbol.leftLines.length === 0 && this.rightLines.length === 0) { + line = drawLine(this.chart, right, symbolLeft, text); + } else { + yOffset = Math.max(symbol.leftLines.length, this.rightLines.length) * 10; + line = drawLine(this.chart, right, [ + {x: right.x, y: right.y - yOffset}, + {x: right.x, y: symbolLeft.y - yOffset}, + {x: symbolLeft.x, y: symbolLeft.y - yOffset}, + {x: symbolLeft.x, y: symbolLeft.y} + ], text); + } + this.rightLines.push(line); + symbol.leftLines.push(line); this.rightStart = true; symbol.leftEnd = true; maxX = symbolLeft.x; } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) { - line = drawLine(this.chart, left, symbolRight, text); + if (symbol.rightLines.length === 0 && this.leftLines.length === 0) { + line = drawLine(this.chart, left, symbolRight, text); + } else { + yOffset = Math.max(symbol.rightLines.length, this.leftLines.length) * 10; + line = drawLine(this.chart, right, [ + {x: right.x, y: right.y - yOffset}, + {x: right.x, y: symbolRight.y - yOffset}, + {x: symbolRight.x, y: symbolRight.y - yOffset}, + {x: symbolRight.x, y: symbolRight.y} + ], text); + } + this.leftLines.push(line); + symbol.rightLines.push(line); this.leftStart = true; symbol.rightEnd = true; maxX = symbolRight.x; } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) { + yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10; line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, + {x: right.x + lineLength/2, y: right.y - yOffset}, + {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset}, {x: symbolTop.x, y: symbolTop.y} ], text); + this.rightLines.push(line); + symbol.topLines.push(line); this.rightStart = true; symbol.topEnd = true; maxX = right.x + lineLength/2; } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) { + yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10; line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, + {x: right.x + lineLength/2, y: right.y - yOffset}, + {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset}, {x: symbolTop.x, y: symbolTop.y} ], text); + this.rightLines.push(line); + symbol.topLines.push(line); this.rightStart = true; symbol.topEnd = true; maxX = right.x + lineLength/2; } else if ((!origin || origin === 'bottom') && isLeft) { + yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10; if (this.leftEnd && isUpper) { line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, + {x: bottom.x, y: bottom.y + lineLength/2 - yOffset}, + {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2 - yOffset}, + {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset}, {x: symbolTop.x, y: symbolTop.y} ], text); } else { line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, + {x: bottom.x, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset}, {x: symbolTop.x, y: symbolTop.y} ], text); } + this.bottomLines.push(line); + symbol.topLines.push(line); this.bottomStart = true; symbol.topEnd = true; maxX = bottom.x + (bottom.x - symbolTop.x)/2; + } else if ((!origin || origin === 'bottom') && isRight && isUnder) { + yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10; + line = drawLine(this.chart, bottom, [ + {x: bottom.x, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y} + ], text); + this.bottomLines.push(line); + symbol.topLines.push(line); + this.bottomStart = true; + symbol.topEnd = true; + maxX = bottom.x; + if (symbolTop.x > maxX) maxX = symbolTop.x; } else if ((!origin || origin === 'bottom') && isRight) { + yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10; line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, + {x: bottom.x, y: bottom.y + lineLength/2 - yOffset}, + {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2 - yOffset}, + {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset}, {x: symbolTop.x, y: symbolTop.y} ], text); + this.bottomLines.push(line); + symbol.topLines.push(line); this.bottomStart = true; symbol.topEnd = true; maxX = bottom.x + (bottom.x - symbolTop.x)/2; } else if ((origin && origin === 'right') && isLeft) { + yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10; line = drawLine(this.chart, right, [ {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, + {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset}, {x: symbolTop.x, y: symbolTop.y} ], text); + this.rightLines.push(line); + symbol.topLines.push(line); this.rightStart = true; symbol.topEnd = true; maxX = right.x + lineLength/2; } else if ((origin && origin === 'right') && isRight) { + yOffset = Math.max(symbol.topLines.length, this.rightLines.length) * 10; line = drawLine(this.chart, right, [ - {x: symbolTop.x, y: right.y}, - {x: symbolTop.x, y: symbolTop.y} + {x: symbolTop.x, y: right.y - yOffset}, + {x: symbolTop.x, y: symbolTop.y - yOffset} ], text); + this.rightLines.push(line); + symbol.topLines.push(line); this.rightStart = true; symbol.topEnd = true; maxX = right.x + lineLength/2; } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) { + yOffset = Math.max(symbol.topLines.length, this.bottomLines.length) * 10; line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: right.x + lineLength/2, y: bottom.y + lineLength/2}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, + {x: bottom.x, y: bottom.y + lineLength/2 - yOffset}, + {x: right.x + lineLength/2, y: bottom.y + lineLength/2 - yOffset}, + {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset}, {x: symbolTop.x, y: symbolTop.y} ], text); + this.bottomLines.push(line); + symbol.topLines.push(line); this.bottomStart = true; symbol.topEnd = true; maxX = bottom.x + lineLength/2; @@ -347,35 +479,53 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) { if (symbolLeft.x < left.x) { diffX = symbolLeft.x - lineLength/2; } + yOffset = Math.max(symbol.topLines.length, this.leftLines.length) * 10; line = drawLine(this.chart, left, [ - {x: diffX, y: left.y}, - {x: diffX, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, + {x: diffX, y: left.y - yOffset}, + {x: diffX, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset}, {x: symbolTop.x, y: symbolTop.y} ], text); + this.leftLines.push(line); + symbol.topLines.push(line); this.leftStart = true; symbol.topEnd = true; maxX = left.x; } else if ((origin === 'left')) { + yOffset = Math.max(symbol.topLines.length, this.leftLines.length) * 10; line = drawLine(this.chart, left, [ - {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: left.y}, - {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, + {x: symbolTop.x + (left.x - symbolTop.x)/2, y: left.y}, + {x: symbolTop.x + (left.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset}, {x: symbolTop.x, y: symbolTop.y} ], text); + this.leftLines.push(line); + symbol.topLines.push(line); this.leftStart = true; symbol.topEnd = true; maxX = left.x; + } else if ((origin === 'top')) { + yOffset = Math.max(symbol.topLines.length, this.topLines.length) * 10; + line = drawLine(this.chart, top, [ + {x: top.x, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y - lineLength/2 - yOffset}, + {x: symbolTop.x, y: symbolTop.y} + ], text); + this.topLines.push(line); + symbol.topLines.push(line); + this.topStart = true; + symbol.topEnd = true; + maxX = top.x; + } + + //update line style + if (this.lineStyle[symbol.key] && line){ + line.attr(this.lineStyle[symbol.key]); } if (line) { - var self = this; for (var l = 0, llen = this.chart.lines.length; l < llen; l++) { var otherLine = this.chart.lines[l]; - var i, - len, - intersections, - inter; var ePath = otherLine.attr('path'), lPath = line.attr('path'); @@ -435,16 +585,20 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) { } lP += 2; - len += 2; } } } } this.chart.lines.push(line); + if (this.chart.minXFromSymbols === undefined || this.chart.minXFromSymbols > left.x) { + this.chart.minXFromSymbols = left.x; + } } if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) { this.chart.maxXFromLine = maxX; } }; + +module.exports = Symbol; diff --git a/src/flowchart.symbol.operation.js b/src/flowchart.symbol.operation.js index 1e938eda..ad3c108e 100644 --- a/src/flowchart.symbol.operation.js +++ b/src/flowchart.symbol.operation.js @@ -1,6 +1,11 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; + function Operation(chart, options) { var symbol = chart.paper.rect(0, 0, 0, 0); options = options || {}; Symbol.call(this, chart, options, symbol); } -f.inherits(Operation, Symbol); \ No newline at end of file +inherits(Operation, Symbol); + +module.exports = Operation; diff --git a/src/flowchart.symbol.output.js b/src/flowchart.symbol.output.js new file mode 100644 index 00000000..363dac0b --- /dev/null +++ b/src/flowchart.symbol.output.js @@ -0,0 +1,124 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; +var drawAPI = require('./flowchart.functions'); +var drawPath = drawAPI.drawPath; + +function Output(chart, options) { + options = options || {}; + Symbol.call(this, chart, options); + this.textMargin = this.getAttr('text-margin'); + + this.text.attr({ + x: this.textMargin * 3 + }); + + var width = this.text.getBBox().width + 4 * this.textMargin; + var height = this.text.getBBox().height + 2 * this.textMargin; + var startX = this.textMargin; + var startY = height/2; + + var start = {x: startX, y: startY}; + var points = [ + {x: startX - this.textMargin, y: height}, + {x: startX - this.textMargin + width + 2 * this.textMargin, y: height}, + {x: startX - this.textMargin + width, y: 0}, + {x: startX - this.textMargin + 2 * this.textMargin, y: 0}, + {x: startX, y: startY} + ]; + + var symbol = drawPath(chart, start, points); + + symbol.attr({ + stroke: this.getAttr('element-color'), + 'stroke-width': this.getAttr('line-width'), + fill: this.getAttr('fill') + }); + if (options.link) { symbol.attr('href', options.link); } + if (options.target) { symbol.attr('target', options.target); } + if (options.key) { symbol.node.id = options.key; } + symbol.node.setAttribute('class', this.getAttr('class')); + + this.text.attr({ + y: symbol.getBBox().height/2 + }); + + this.group.push(symbol); + symbol.insertBefore(this.text); + this.symbol = symbol + + this.initialize(); +} +inherits(Output, Symbol); + +Output.prototype.getLeft = function() { + var y = this.getY() + this.group.getBBox().height/2; + var x = this.getX() + this.textMargin; + return {x: x, y: y}; +}; + +Output.prototype.getRight = function() { + var y = this.getY() + this.group.getBBox().height/2; + var x = this.getX() + this.group.getBBox().width - this.textMargin; + return {x: x, y: y}; +}; + +module.exports = Output; + + + +/* +//var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; +var drawAPI = require('./flowchart.functions'); +var InputOutput = require('./flowchart.symbol.inputoutput'); +var drawPath = drawAPI.drawPath; + +function Output(chart, options) { + options = options || {}; + InputOutput.call(this, chart, options); + + var width = this.text.getBBox().width + 4 * this.textMargin; + var height = this.text.getBBox().height + 2 * this.textMargin; + var startX = this.textMargin; + var startY = height/2; + + var start = {x: startX, y: startY}; + var points = [ + {x: startX - this.textMargin + 2 * this.textMargin, y: height}, + {x: startX - this.textMargin + width, y: height}, + {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0}, + {x: startX - this.textMargin, y: 0}, + {x: startX, y: startY} + ]; + + var symbol = drawPath(chart, start, points); + + symbol.attr({ + stroke: this.getAttr('element-color'), + 'stroke-width': this.getAttr('line-width'), + fill: this.getAttr('fill') + }); + if (options.link) { symbol.attr('href', options.link); } + if (options.target) { symbol.attr('target', options.target); } + if (options.key) { symbol.node.id = options.key; } + symbol.node.setAttribute('class', this.getAttr('class')); + + this.text.attr({ + y: symbol.getBBox().height/2 + }); + + this.group.push(symbol); + symbol.insertBefore(this.text); + + if (this.symbol){ + this.group.remove(this.symbol); //tds + this.symbol.parentNode.removeChild(this.symbol); //tds + } + this.symbol = symbol + + this.initialize(); +} +inherits(Output, InputOutput); + +module.exports = Output; +*/ diff --git a/src/flowchart.symbol.parallel.js b/src/flowchart.symbol.parallel.js new file mode 100644 index 00000000..bf7ae0c2 --- /dev/null +++ b/src/flowchart.symbol.parallel.js @@ -0,0 +1,210 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; + +function Parallel(chart, options) { + var symbol = chart.paper.rect(0, 0, 0, 0); + options = options || {}; + Symbol.call(this, chart, options, symbol); + this.path1_annotation = options.path1_annotation || ''; + this.path2_annotation = options.path2_annotation || ''; + this.path3_annotation = options.path3_annotation || ''; + this.textMargin = this.getAttr('text-margin'); + this.path1_direction = 'bottom'; + this.path2_direction = 'right'; + this.path3_direction = 'top'; + this.params = options.params; + if (options.direction_next === 'path1' && !options[options.direction_next] && options.next) { + options[options.direction_next] = options.next; + } + if (options.direction_next === 'path2' && !options[options.direction_next] && options.next) { + options[options.direction_next] = options.next; + } + if (options.direction_next === 'path3' && !options[options.direction_next] && options.next) { + options[options.direction_next] = options.next; + } + + if (options.path1 && options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && !options.direction_path3) { + if (options.direction_path1 === 'right') { + this.path2_direction = 'bottom'; + this.path1_direction = 'right'; + this.path3_direction = 'top'; + } else if (options.direction_path1 === 'top') { + this.path2_direction = 'right'; + this.path1_direction = 'top'; + this.path3_direction = 'bottom'; + } else if (options.direction_path1 === 'left') { + this.path2_direction = 'right'; + this.path1_direction = 'left'; + this.path3_direction = 'bottom'; + } else { + this.path2_direction = 'right'; + this.path1_direction = 'bottom'; + this.path3_direction = 'top'; + } + } else if (options.path1 && !options.direction_path1 && options.path2 && options.direction_path2 && options.path3 && !options.direction_path3) { + if (options.direction_path2 === 'right') { + this.path1_direction = 'bottom'; + this.path2_direction = 'right'; + this.path3_direction = 'top'; + } else if (options.direction_path2 === 'left') { + this.path1_direction = 'bottom'; + this.path2_direction = 'left'; + this.path3_direction = 'right'; + } else { + this.path1_direction = 'right'; + this.path2_direction = 'bottom'; + this.path3_direction = 'top'; + } + } else if (options.path1 && !options.direction_path1 && options.path2 && !options.direction_path2 && options.path3 && options.direction_path3) { + if (options.direction_path2 === 'right') { + this.path1_direction = 'bottom'; + this.path2_direction = 'top'; + this.path3_direction = 'right'; + } else if (options.direction_path2 === 'left') { + this.path1_direction = 'bottom'; + this.path2_direction = 'right'; + this.path3_direction = 'left'; + } else { + this.path1_direction = 'right'; + this.path2_direction = 'bottom'; + this.path3_direction = 'top'; + } + } else { + this.path1_direction = options.direction_path1; + this.path2_direction = options.direction_path2; + this.path3_direction = options.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(); +} +inherits(Parallel, Symbol); + +Parallel.prototype.render = function() { + if (this.path1_direction) { + this[this.path1_direction + '_symbol'] = this.path1_symbol; + } + + if (this.path2_direction) { + this[this.path2_direction + '_symbol'] = this.path2_symbol; + } + + if (this.path3_direction) { + this[this.path3_direction + '_symbol'] = this.path3_symbol; + } + + var lineLength = this.getAttr('line-length'); + + if (this.bottom_symbol) { + var bottomPoint = this.getBottom(); + + if (!this.bottom_symbol.isPositioned) { + this.bottom_symbol.shiftY(this.getY() + this.height + lineLength); + this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width / 2); + this.bottom_symbol.isPositioned = true; + + this.bottom_symbol.render(); + } + } + + if (this.top_symbol) { + var topPoint = this.getTop(); + + if (!this.top_symbol.isPositioned) { + this.top_symbol.shiftY(this.getY() - this.top_symbol.height - lineLength); + this.top_symbol.setX(topPoint.x + this.top_symbol.width); + this.top_symbol.isPositioned = true; + + this.top_symbol.render(); + } + } + + var self = this; + + if (this.left_symbol) { + var leftPoint = this.getLeft(); + + if (!this.left_symbol.isPositioned) { + this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2); + this.left_symbol.shiftX(-(this.group.getBBox().x + this.width + lineLength)); + (function shift() { + var hasSymbolUnder = false; + var symb; + for (var i = 0, len = self.chart.symbols.length; i < len; i++) { + symb = self.chart.symbols[i]; + + if (!self.params['align-next'] || self.params['align-next'] !== 'no') { + var diff = Math.abs(symb.getCenter().x - self.left_symbol.getCenter().x); + if (symb.getCenter().y > self.left_symbol.getCenter().y && diff <= self.left_symbol.width / 2) { + hasSymbolUnder = true; + break; + } + } + } + + if (hasSymbolUnder) { + if (self.left_symbol.symbolType === 'end') return; + self.left_symbol.setX(symb.getX() + symb.width + lineLength); + shift(); + } + })(); + + this.left_symbol.isPositioned = true; + + this.left_symbol.render(); + } + } + + if (this.right_symbol) { + var rightPoint = this.getRight(); + + if (!this.right_symbol.isPositioned) { + this.right_symbol.setY(rightPoint.y - this.right_symbol.height / 2); + this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength); + (function shift() { + var hasSymbolUnder = false; + var symb; + for (var i = 0, len = self.chart.symbols.length; i < len; i++) { + symb = self.chart.symbols[i]; + + if (!self.params['align-next'] || self.params['align-next'] !== 'no') { + var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x); + if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width / 2) { + hasSymbolUnder = true; + break; + } + } + } + + if (hasSymbolUnder) { + if (self.right_symbol.symbolType === 'end') return; + self.right_symbol.setX(symb.getX() + symb.width + lineLength); + shift(); + } + })(); + + this.right_symbol.isPositioned = true; + + this.right_symbol.render(); + } + } +}; + +Parallel.prototype.renderLines = function() { + if (this.path1_symbol) { + this.drawLineTo(this.path1_symbol, this.path1_annotation, this.path1_direction); + } + + if (this.path2_symbol) { + this.drawLineTo(this.path2_symbol, this.path2_annotation, this.path2_direction); + } + + if (this.path3_symbol) { + this.drawLineTo(this.path3_symbol, this.path3_annotation, this.path3_direction); + } +}; + +module.exports = Parallel; \ No newline at end of file diff --git a/src/flowchart.symbol.start.js b/src/flowchart.symbol.start.js index f594080d..881d4d5a 100644 --- a/src/flowchart.symbol.start.js +++ b/src/flowchart.symbol.start.js @@ -1,11 +1,15 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; + function Start(chart, options) { var symbol = chart.paper.rect(0, 0, 0, 0, 20); options = options || {}; options.text = options.text || 'Start'; Symbol.call(this, chart, options, symbol); } -f.inherits(Start, Symbol); +inherits(Start, Symbol); +module.exports = Start; // Start.prototype.render = function() { // if (this.next) { @@ -28,4 +32,4 @@ f.inherits(Start, Symbol); // if (this.next) { // this.drawLineTo(this.next); // } -// }; \ No newline at end of file +// }; diff --git a/src/flowchart.symbol.subroutine.js b/src/flowchart.symbol.subroutine.js index c8fd7411..fdbf6535 100644 --- a/src/flowchart.symbol.subroutine.js +++ b/src/flowchart.symbol.subroutine.js @@ -1,3 +1,6 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; + function Subroutine(chart, options) { var symbol = chart.paper.rect(0, 0, 0, 0); options = options || {}; @@ -37,4 +40,6 @@ function Subroutine(chart, options) { this.initialize(); } -f.inherits(Subroutine, Symbol); +inherits(Subroutine, Symbol); + +module.exports = Subroutine; diff --git a/src/jquery-plugin.js b/src/jquery-plugin.js new file mode 100644 index 00000000..71d8066f --- /dev/null +++ b/src/jquery-plugin.js @@ -0,0 +1,80 @@ +if (typeof jQuery != 'undefined') { + var parse = require('./flowchart.parse'); + + (function( $ ) { + function paramFit(needle, haystack) { + return needle == haystack || + ( Array.isArray(haystack) && (haystack.includes(needle) || haystack.includes(Number(needle)) )) + } + var methods = { + init : function(options) { + return this.each(function() { + var $this = $(this); + this.chart = parse($this.text()); + $this.html(''); + this.chart.drawSVG(this, options); + }); + }, + setFlowStateByParam : function(param, paramValue, newFlowState) { + return this.each(function() { + var chart = this.chart; + + // @todo this should be part of Symbol API + var nextSymbolKeys = ['next', 'yes', 'no', 'path1', 'path2', 'path3']; + + for (var property in chart.symbols) { + if (chart.symbols.hasOwnProperty(property)) { + var symbol = chart.symbols[property]; + var val = symbol.params[param]; + if (paramFit(val, paramValue)) { + symbol.flowstate = newFlowState; + for (var nski = 0; nski < nextSymbolKeys.length; nski++) { + var nextSymbolKey = nextSymbolKeys[nski]; + if ( + symbol[nextSymbolKey] && + symbol[nextSymbolKey]['params'] && + symbol[nextSymbolKey]['params'][param] && + paramFit(symbol[nextSymbolKey]['params'][param], paramValue) + ) { + symbol.lineStyle[symbol[nextSymbolKey]['key']] = {stroke: chart.options()['flowstate'][newFlowState]['fill']}; + } + } + } + } + } + + chart.clean(); + chart.drawSVG(this); + }); + + }, + clearFlowState: function () { + return this.each(function() { + var chart = this.chart; + + for (var property in chart.symbols) { + if (chart.symbols.hasOwnProperty(property)) { + var node = chart.symbols[property]; + node.flowstate = ''; + } + } + + chart.clean(); + chart.drawSVG(this); + }); + } + }; + + $.fn.flowChart = function(methodOrOptions) { + if ( methods[methodOrOptions] ) { + return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 )); + } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) { + // Default to "init" + return methods.init.apply( this, arguments ); + } else { + $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.flowChart' ); + } + }; + + })(jQuery); // eslint-disable-line +} diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 00000000..76af8008 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,43 @@ +declare module "flowchart.js" { + namespace FlowChart { + interface SVGOptions { + x: number; + y: number; + "line-width": number; + "line-length": number; + "text-margin": number; + "font-size": number; + "font-color": string; + "line-color": string; + "element-color": string; + fill: string; + roundness?: number; + "yes-text": string; + "no-text": string; + "arrow-end": string; + scale: number; + class: string; + [props: string]: any; + } + + interface DrawOptions extends Partial { + /** Stymbol Styles */ + symbols?: Record>; + /** FlowState config */ + flowstate?: Record>; + } + + interface Instance { + clean: () => void; + drawSVG: (container: HTMLElement | string, options?: DrawOptions) => void; + } + } + + interface FlowChart { + parse: (code: string) => FlowChart.Instance; + } + + const FlowChart: FlowChart; + + export = FlowChart; +} diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 00000000..4bdc0add --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,86 @@ +var path = require('path'); +var webpack = require('webpack'); +var moment = require('moment'); + +var component = require('./package.json'); +var banner = + '// ' + component.name + ', v' + component.version + '\n' + + '// Copyright (c)' + moment().format('YYYY') + ' Adriano Raiano (adrai).\n' + + '// Distributed under MIT license\n' + + '// http://adrai.github.io/flowchart.js\n'; + +var NODE_ENV = process.env.NODE_ENV || 'development'; +var defines = new webpack.DefinePlugin({ + 'process.env': { + 'NODE_ENV': JSON.stringify(NODE_ENV) + } +}); + +var config = { + devtool: 'source-map', // always build source map + entry: [ + 'webpack-hot-middleware/client', + './index' + ], + output: { + path: path.join(__dirname, 'release'), + filename: component.name + '.js', + publicPath: '/release/' + }, + plugins: [ + new webpack.HotModuleReplacementPlugin(), + new webpack.NoErrorsPlugin(), + defines + ], + resolve: { + extensions: ['', '.js'], + modulesDirectories: ['src', 'node_modules'], + alias: { + 'dev/raphael.core.js': './dev/raphael.core.js', + 'raphael.core': './raphael.core.js', + 'raphael.svg': './dev/raphael.svg.js', + 'raphael.vml': './dev/raphael.vml.js' + } + } +}; + +if (NODE_ENV === 'production') { + var minified = process.env.MINIFIED == '1'; + var withoutJs = component.name; + withoutJs = withoutJs.replace('.js', ''); + var filename = minified ? withoutJs + '.min.js' : withoutJs + '.js'; + var uglifyOptions = { + sourceMap: true, + compressor: { + warnings: false, + dead_code: true + }, + output: { + preamble: banner, + comments: false + } + }; + if (!minified) { + uglifyOptions.beautify = true; + uglifyOptions.mangle = false; + uglifyOptions.output.comments = 'all'; + } + config.entry = './index'; + config.externals = { + raphael: 'Raphael' + }; + config.output = { + devtoolLineToLine: true, + sourceMapFilename: filename + '.map', + path: path.join(__dirname, 'release'), + filename: filename, + libraryTarget: 'umd' + }; + config.plugins = [ + new webpack.optimize.OccurenceOrderPlugin(), + defines, + new webpack.optimize.UglifyJsPlugin(uglifyOptions) + ]; +} + +module.exports = config;