UNPKG

1.01 MBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory();
4 else if(typeof define === 'function' && define.amd)
5 define([], factory);
6 else if(typeof exports === 'object')
7 exports["mermaid"] = factory();
8 else
9 root["mermaid"] = factory();
10})(typeof self !== "undefined" ? self : this, function() {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId]) {
20/******/ return installedModules[moduleId].exports;
21/******/ }
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ i: moduleId,
25/******/ l: false,
26/******/ exports: {}
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.l = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // define getter function for harmony exports
47/******/ __webpack_require__.d = function(exports, name, getter) {
48/******/ if(!__webpack_require__.o(exports, name)) {
49/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50/******/ }
51/******/ };
52/******/
53/******/ // define __esModule on exports
54/******/ __webpack_require__.r = function(exports) {
55/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57/******/ }
58/******/ Object.defineProperty(exports, '__esModule', { value: true });
59/******/ };
60/******/
61/******/ // create a fake namespace object
62/******/ // mode & 1: value is a module id, require it
63/******/ // mode & 2: merge all properties of value into the ns
64/******/ // mode & 4: return value when already ns object
65/******/ // mode & 8|1: behave like require
66/******/ __webpack_require__.t = function(value, mode) {
67/******/ if(mode & 1) value = __webpack_require__(value);
68/******/ if(mode & 8) return value;
69/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70/******/ var ns = Object.create(null);
71/******/ __webpack_require__.r(ns);
72/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74/******/ return ns;
75/******/ };
76/******/
77/******/ // getDefaultExport function for compatibility with non-harmony modules
78/******/ __webpack_require__.n = function(module) {
79/******/ var getter = module && module.__esModule ?
80/******/ function getDefault() { return module['default']; } :
81/******/ function getModuleExports() { return module; };
82/******/ __webpack_require__.d(getter, 'a', getter);
83/******/ return getter;
84/******/ };
85/******/
86/******/ // Object.prototype.hasOwnProperty.call
87/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88/******/
89/******/ // __webpack_public_path__
90/******/ __webpack_require__.p = "";
91/******/
92/******/
93/******/ // Load entry module and return exports
94/******/ return __webpack_require__(__webpack_require__.s = "./src/mermaid.js");
95/******/ })
96/************************************************************************/
97/******/ ({
98
99/***/ "./node_modules/node-libs-browser/mock/empty.js":
100/*!******************************************************!*\
101 !*** ./node_modules/node-libs-browser/mock/empty.js ***!
102 \******************************************************/
103/*! no static exports found */
104/***/ (function(module, exports) {
105
106
107
108/***/ }),
109
110/***/ "./node_modules/path-browserify/index.js":
111/*!***********************************************!*\
112 !*** ./node_modules/path-browserify/index.js ***!
113 \***********************************************/
114/*! no static exports found */
115/***/ (function(module, exports, __webpack_require__) {
116
117/* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
118// backported and transplited with Babel, with backwards-compat fixes
119
120// Copyright Joyent, Inc. and other Node contributors.
121//
122// Permission is hereby granted, free of charge, to any person obtaining a
123// copy of this software and associated documentation files (the
124// "Software"), to deal in the Software without restriction, including
125// without limitation the rights to use, copy, modify, merge, publish,
126// distribute, sublicense, and/or sell copies of the Software, and to permit
127// persons to whom the Software is furnished to do so, subject to the
128// following conditions:
129//
130// The above copyright notice and this permission notice shall be included
131// in all copies or substantial portions of the Software.
132//
133// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
134// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
135// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
136// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
137// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
138// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
139// USE OR OTHER DEALINGS IN THE SOFTWARE.
140
141// resolves . and .. elements in a path array with directory names there
142// must be no slashes, empty elements, or device names (c:\) in the array
143// (so also no leading and trailing slashes - it does not distinguish
144// relative and absolute paths)
145function normalizeArray(parts, allowAboveRoot) {
146 // if the path tries to go above the root, `up` ends up > 0
147 var up = 0;
148 for (var i = parts.length - 1; i >= 0; i--) {
149 var last = parts[i];
150 if (last === '.') {
151 parts.splice(i, 1);
152 } else if (last === '..') {
153 parts.splice(i, 1);
154 up++;
155 } else if (up) {
156 parts.splice(i, 1);
157 up--;
158 }
159 }
160
161 // if the path is allowed to go above the root, restore leading ..s
162 if (allowAboveRoot) {
163 for (; up--; up) {
164 parts.unshift('..');
165 }
166 }
167
168 return parts;
169}
170
171// path.resolve([from ...], to)
172// posix version
173exports.resolve = function() {
174 var resolvedPath = '',
175 resolvedAbsolute = false;
176
177 for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
178 var path = (i >= 0) ? arguments[i] : process.cwd();
179
180 // Skip empty and invalid entries
181 if (typeof path !== 'string') {
182 throw new TypeError('Arguments to path.resolve must be strings');
183 } else if (!path) {
184 continue;
185 }
186
187 resolvedPath = path + '/' + resolvedPath;
188 resolvedAbsolute = path.charAt(0) === '/';
189 }
190
191 // At this point the path should be resolved to a full absolute path, but
192 // handle relative paths to be safe (might happen when process.cwd() fails)
193
194 // Normalize the path
195 resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
196 return !!p;
197 }), !resolvedAbsolute).join('/');
198
199 return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
200};
201
202// path.normalize(path)
203// posix version
204exports.normalize = function(path) {
205 var isAbsolute = exports.isAbsolute(path),
206 trailingSlash = substr(path, -1) === '/';
207
208 // Normalize the path
209 path = normalizeArray(filter(path.split('/'), function(p) {
210 return !!p;
211 }), !isAbsolute).join('/');
212
213 if (!path && !isAbsolute) {
214 path = '.';
215 }
216 if (path && trailingSlash) {
217 path += '/';
218 }
219
220 return (isAbsolute ? '/' : '') + path;
221};
222
223// posix version
224exports.isAbsolute = function(path) {
225 return path.charAt(0) === '/';
226};
227
228// posix version
229exports.join = function() {
230 var paths = Array.prototype.slice.call(arguments, 0);
231 return exports.normalize(filter(paths, function(p, index) {
232 if (typeof p !== 'string') {
233 throw new TypeError('Arguments to path.join must be strings');
234 }
235 return p;
236 }).join('/'));
237};
238
239
240// path.relative(from, to)
241// posix version
242exports.relative = function(from, to) {
243 from = exports.resolve(from).substr(1);
244 to = exports.resolve(to).substr(1);
245
246 function trim(arr) {
247 var start = 0;
248 for (; start < arr.length; start++) {
249 if (arr[start] !== '') break;
250 }
251
252 var end = arr.length - 1;
253 for (; end >= 0; end--) {
254 if (arr[end] !== '') break;
255 }
256
257 if (start > end) return [];
258 return arr.slice(start, end - start + 1);
259 }
260
261 var fromParts = trim(from.split('/'));
262 var toParts = trim(to.split('/'));
263
264 var length = Math.min(fromParts.length, toParts.length);
265 var samePartsLength = length;
266 for (var i = 0; i < length; i++) {
267 if (fromParts[i] !== toParts[i]) {
268 samePartsLength = i;
269 break;
270 }
271 }
272
273 var outputParts = [];
274 for (var i = samePartsLength; i < fromParts.length; i++) {
275 outputParts.push('..');
276 }
277
278 outputParts = outputParts.concat(toParts.slice(samePartsLength));
279
280 return outputParts.join('/');
281};
282
283exports.sep = '/';
284exports.delimiter = ':';
285
286exports.dirname = function (path) {
287 if (typeof path !== 'string') path = path + '';
288 if (path.length === 0) return '.';
289 var code = path.charCodeAt(0);
290 var hasRoot = code === 47 /*/*/;
291 var end = -1;
292 var matchedSlash = true;
293 for (var i = path.length - 1; i >= 1; --i) {
294 code = path.charCodeAt(i);
295 if (code === 47 /*/*/) {
296 if (!matchedSlash) {
297 end = i;
298 break;
299 }
300 } else {
301 // We saw the first non-path separator
302 matchedSlash = false;
303 }
304 }
305
306 if (end === -1) return hasRoot ? '/' : '.';
307 if (hasRoot && end === 1) {
308 // return '//';
309 // Backwards-compat fix:
310 return '/';
311 }
312 return path.slice(0, end);
313};
314
315function basename(path) {
316 if (typeof path !== 'string') path = path + '';
317
318 var start = 0;
319 var end = -1;
320 var matchedSlash = true;
321 var i;
322
323 for (i = path.length - 1; i >= 0; --i) {
324 if (path.charCodeAt(i) === 47 /*/*/) {
325 // If we reached a path separator that was not part of a set of path
326 // separators at the end of the string, stop now
327 if (!matchedSlash) {
328 start = i + 1;
329 break;
330 }
331 } else if (end === -1) {
332 // We saw the first non-path separator, mark this as the end of our
333 // path component
334 matchedSlash = false;
335 end = i + 1;
336 }
337 }
338
339 if (end === -1) return '';
340 return path.slice(start, end);
341}
342
343// Uses a mixed approach for backwards-compatibility, as ext behavior changed
344// in new Node.js versions, so only basename() above is backported here
345exports.basename = function (path, ext) {
346 var f = basename(path);
347 if (ext && f.substr(-1 * ext.length) === ext) {
348 f = f.substr(0, f.length - ext.length);
349 }
350 return f;
351};
352
353exports.extname = function (path) {
354 if (typeof path !== 'string') path = path + '';
355 var startDot = -1;
356 var startPart = 0;
357 var end = -1;
358 var matchedSlash = true;
359 // Track the state of characters (if any) we see before our first dot and
360 // after any path separator we find
361 var preDotState = 0;
362 for (var i = path.length - 1; i >= 0; --i) {
363 var code = path.charCodeAt(i);
364 if (code === 47 /*/*/) {
365 // If we reached a path separator that was not part of a set of path
366 // separators at the end of the string, stop now
367 if (!matchedSlash) {
368 startPart = i + 1;
369 break;
370 }
371 continue;
372 }
373 if (end === -1) {
374 // We saw the first non-path separator, mark this as the end of our
375 // extension
376 matchedSlash = false;
377 end = i + 1;
378 }
379 if (code === 46 /*.*/) {
380 // If this is our first dot, mark it as the start of our extension
381 if (startDot === -1)
382 startDot = i;
383 else if (preDotState !== 1)
384 preDotState = 1;
385 } else if (startDot !== -1) {
386 // We saw a non-dot and non-path separator before our dot, so we should
387 // have a good chance at having a non-empty extension
388 preDotState = -1;
389 }
390 }
391
392 if (startDot === -1 || end === -1 ||
393 // We saw a non-dot character immediately before the dot
394 preDotState === 0 ||
395 // The (right-most) trimmed path component is exactly '..'
396 preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
397 return '';
398 }
399 return path.slice(startDot, end);
400};
401
402function filter (xs, f) {
403 if (xs.filter) return xs.filter(f);
404 var res = [];
405 for (var i = 0; i < xs.length; i++) {
406 if (f(xs[i], i, xs)) res.push(xs[i]);
407 }
408 return res;
409}
410
411// String.prototype.substr - negative index don't work in IE8
412var substr = 'ab'.substr(-1) === 'b'
413 ? function (str, start, len) { return str.substr(start, len) }
414 : function (str, start, len) {
415 if (start < 0) start = str.length + start;
416 return str.substr(start, len);
417 }
418;
419
420/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
421
422/***/ }),
423
424/***/ "./node_modules/process/browser.js":
425/*!*****************************************!*\
426 !*** ./node_modules/process/browser.js ***!
427 \*****************************************/
428/*! no static exports found */
429/***/ (function(module, exports) {
430
431// shim for using process in browser
432var process = module.exports = {};
433
434// cached from whatever global is present so that test runners that stub it
435// don't break things. But we need to wrap it in a try catch in case it is
436// wrapped in strict mode code which doesn't define any globals. It's inside a
437// function because try/catches deoptimize in certain engines.
438
439var cachedSetTimeout;
440var cachedClearTimeout;
441
442function defaultSetTimout() {
443 throw new Error('setTimeout has not been defined');
444}
445function defaultClearTimeout () {
446 throw new Error('clearTimeout has not been defined');
447}
448(function () {
449 try {
450 if (typeof setTimeout === 'function') {
451 cachedSetTimeout = setTimeout;
452 } else {
453 cachedSetTimeout = defaultSetTimout;
454 }
455 } catch (e) {
456 cachedSetTimeout = defaultSetTimout;
457 }
458 try {
459 if (typeof clearTimeout === 'function') {
460 cachedClearTimeout = clearTimeout;
461 } else {
462 cachedClearTimeout = defaultClearTimeout;
463 }
464 } catch (e) {
465 cachedClearTimeout = defaultClearTimeout;
466 }
467} ())
468function runTimeout(fun) {
469 if (cachedSetTimeout === setTimeout) {
470 //normal enviroments in sane situations
471 return setTimeout(fun, 0);
472 }
473 // if setTimeout wasn't available but was latter defined
474 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
475 cachedSetTimeout = setTimeout;
476 return setTimeout(fun, 0);
477 }
478 try {
479 // when when somebody has screwed with setTimeout but no I.E. maddness
480 return cachedSetTimeout(fun, 0);
481 } catch(e){
482 try {
483 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
484 return cachedSetTimeout.call(null, fun, 0);
485 } catch(e){
486 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
487 return cachedSetTimeout.call(this, fun, 0);
488 }
489 }
490
491
492}
493function runClearTimeout(marker) {
494 if (cachedClearTimeout === clearTimeout) {
495 //normal enviroments in sane situations
496 return clearTimeout(marker);
497 }
498 // if clearTimeout wasn't available but was latter defined
499 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
500 cachedClearTimeout = clearTimeout;
501 return clearTimeout(marker);
502 }
503 try {
504 // when when somebody has screwed with setTimeout but no I.E. maddness
505 return cachedClearTimeout(marker);
506 } catch (e){
507 try {
508 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
509 return cachedClearTimeout.call(null, marker);
510 } catch (e){
511 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
512 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
513 return cachedClearTimeout.call(this, marker);
514 }
515 }
516
517
518
519}
520var queue = [];
521var draining = false;
522var currentQueue;
523var queueIndex = -1;
524
525function cleanUpNextTick() {
526 if (!draining || !currentQueue) {
527 return;
528 }
529 draining = false;
530 if (currentQueue.length) {
531 queue = currentQueue.concat(queue);
532 } else {
533 queueIndex = -1;
534 }
535 if (queue.length) {
536 drainQueue();
537 }
538}
539
540function drainQueue() {
541 if (draining) {
542 return;
543 }
544 var timeout = runTimeout(cleanUpNextTick);
545 draining = true;
546
547 var len = queue.length;
548 while(len) {
549 currentQueue = queue;
550 queue = [];
551 while (++queueIndex < len) {
552 if (currentQueue) {
553 currentQueue[queueIndex].run();
554 }
555 }
556 queueIndex = -1;
557 len = queue.length;
558 }
559 currentQueue = null;
560 draining = false;
561 runClearTimeout(timeout);
562}
563
564process.nextTick = function (fun) {
565 var args = new Array(arguments.length - 1);
566 if (arguments.length > 1) {
567 for (var i = 1; i < arguments.length; i++) {
568 args[i - 1] = arguments[i];
569 }
570 }
571 queue.push(new Item(fun, args));
572 if (queue.length === 1 && !draining) {
573 runTimeout(drainQueue);
574 }
575};
576
577// v8 likes predictible objects
578function Item(fun, array) {
579 this.fun = fun;
580 this.array = array;
581}
582Item.prototype.run = function () {
583 this.fun.apply(null, this.array);
584};
585process.title = 'browser';
586process.browser = true;
587process.env = {};
588process.argv = [];
589process.version = ''; // empty string to avoid regexp issues
590process.versions = {};
591
592function noop() {}
593
594process.on = noop;
595process.addListener = noop;
596process.once = noop;
597process.off = noop;
598process.removeListener = noop;
599process.removeAllListeners = noop;
600process.emit = noop;
601process.prependListener = noop;
602process.prependOnceListener = noop;
603
604process.listeners = function (name) { return [] }
605
606process.binding = function (name) {
607 throw new Error('process.binding is not supported');
608};
609
610process.cwd = function () { return '/' };
611process.chdir = function (dir) {
612 throw new Error('process.chdir is not supported');
613};
614process.umask = function() { return 0; };
615
616
617/***/ }),
618
619/***/ "./node_modules/webpack/buildin/module.js":
620/*!***********************************!*\
621 !*** (webpack)/buildin/module.js ***!
622 \***********************************/
623/*! no static exports found */
624/***/ (function(module, exports) {
625
626module.exports = function(module) {
627 if (!module.webpackPolyfill) {
628 module.deprecate = function() {};
629 module.paths = [];
630 // module.parent = undefined by default
631 if (!module.children) module.children = [];
632 Object.defineProperty(module, "loaded", {
633 enumerable: true,
634 get: function() {
635 return module.l;
636 }
637 });
638 Object.defineProperty(module, "id", {
639 enumerable: true,
640 get: function() {
641 return module.i;
642 }
643 });
644 module.webpackPolyfill = 1;
645 }
646 return module;
647};
648
649
650/***/ }),
651
652/***/ "./package.json":
653/*!**********************!*\
654 !*** ./package.json ***!
655 \**********************/
656/*! exports provided: name, version, description, main, keywords, scripts, repository, author, license, standard, dependencies, devDependencies, files, yarn-upgrade-all, sideEffects, husky, default */
657/***/ (function(module) {
658
659module.exports = JSON.parse("{\"name\":\"mermaid\",\"version\":\"8.7.0\",\"description\":\"Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.\",\"main\":\"dist/mermaid.core.js\",\"keywords\":[\"diagram\",\"markdown\",\"flowchart\",\"sequence diagram\",\"gantt\",\"class diagram\",\"git graph\"],\"scripts\":{\"build:development\":\"webpack --progress --colors\",\"build:production\":\"yarn build:development -p --config webpack.config.prod.babel.js\",\"build\":\"yarn build:development && yarn build:production\",\"postbuild\":\"documentation build src/mermaidAPI.js src/config.js --shallow -f md --markdown-toc false -o docs/Setup.md\",\"build:watch\":\"yarn build --watch\",\"minify\":\"minify ./dist/mermaid.js > ./dist/mermaid.min.js\",\"release\":\"yarn build\",\"lint\":\"eslint src\",\"e2e:depr\":\"yarn lint && jest e2e --config e2e/jest.config.js\",\"cypress\":\"percy exec -- cypress run\",\"e2e\":\"start-server-and-test dev http://localhost:9000/ cypress\",\"e2e-upd\":\"yarn lint && jest e2e -u --config e2e/jest.config.js\",\"dev\":\"webpack-dev-server --config webpack.config.e2e.js\",\"test\":\"yarn lint && jest src/.*\",\"test:watch\":\"jest --watch src\",\"prepublishOnly\":\"yarn build && yarn test && yarn e2e\",\"prepare\":\"yarn build\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/knsv/mermaid\"},\"author\":\"Knut Sveidqvist\",\"license\":\"MIT\",\"standard\":{\"ignore\":[\"**/parser/*.js\",\"dist/**/*.js\",\"cypress/**/*.js\"],\"globals\":[\"page\"]},\"dependencies\":{\"@braintree/sanitize-url\":\"^3.1.0\",\"babel-eslint\":\"^10.1.0\",\"d3\":\"^5.7.0\",\"dagre\":\"^0.8.4\",\"dagre-d3\":\"^0.6.4\",\"entity-decode\":\"^2.0.2\",\"graphlib\":\"^2.1.7\",\"he\":\"^1.2.0\",\"khroma\":\"^1.1.0\",\"minify\":\"^4.1.1\",\"moment-mini\":\"^2.22.1\",\"stylis\":\"^3.5.2\"},\"devDependencies\":{\"@babel/core\":\"^7.2.2\",\"@babel/preset-env\":\"^7.8.4\",\"@babel/register\":\"^7.0.0\",\"@percy/cypress\":\"*\",\"babel-core\":\"7.0.0-bridge.0\",\"babel-jest\":\"^24.9.0\",\"babel-loader\":\"^8.0.4\",\"coveralls\":\"^3.0.2\",\"css-loader\":\"^2.0.1\",\"css-to-string-loader\":\"^0.1.3\",\"cypress\":\"4.0.1\",\"documentation\":\"^12.0.1\",\"eslint\":\"^6.3.0\",\"eslint-config-prettier\":\"^6.3.0\",\"eslint-plugin-prettier\":\"^3.1.0\",\"husky\":\"^1.2.1\",\"identity-obj-proxy\":\"^3.0.0\",\"jest\":\"^24.9.0\",\"jison\":\"^0.4.18\",\"moment\":\"^2.23.0\",\"node-sass\":\"^4.12.0\",\"prettier\":\"^1.18.2\",\"puppeteer\":\"^1.17.0\",\"sass-loader\":\"^7.1.0\",\"start-server-and-test\":\"^1.10.6\",\"terser-webpack-plugin\":\"^2.2.2\",\"webpack\":\"^4.41.2\",\"webpack-bundle-analyzer\":\"^3.7.0\",\"webpack-cli\":\"^3.1.2\",\"webpack-dev-server\":\"^3.4.1\",\"webpack-node-externals\":\"^1.7.2\",\"yarn-upgrade-all\":\"^0.5.0\"},\"files\":[\"dist\"],\"yarn-upgrade-all\":{\"ignore\":[\"babel-core\"]},\"sideEffects\":[\"**/*.css\",\"**/*.scss\"],\"husky\":{\"hooks\":{\"pre-push\":\"yarn test\"}}}");
660
661/***/ }),
662
663/***/ "./src/config.js":
664/*!***********************!*\
665 !*** ./src/config.js ***!
666 \***********************/
667/*! exports provided: defaultConfig, updateCurrentConfig, setSiteConfig, updateSiteConfig, getSiteConfig, setConfig, getConfig, sanitize, addDirective, reset */
668/***/ (function(module, __webpack_exports__, __webpack_require__) {
669
670"use strict";
671__webpack_require__.r(__webpack_exports__);
672/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultConfig", function() { return defaultConfig; });
673/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateCurrentConfig", function() { return updateCurrentConfig; });
674/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setSiteConfig", function() { return setSiteConfig; });
675/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateSiteConfig", function() { return updateSiteConfig; });
676/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSiteConfig", function() { return getSiteConfig; });
677/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConfig", function() { return setConfig; });
678/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getConfig", function() { return getConfig; });
679/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sanitize", function() { return sanitize; });
680/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addDirective", function() { return addDirective; });
681/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reset", function() { return reset; });
682/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
683/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
684/* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
685/* harmony import */ var _defaultConfig__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./defaultConfig */ "./src/defaultConfig.js");
686
687
688
689 // debugger;
690
691var defaultConfig = Object.freeze(_defaultConfig__WEBPACK_IMPORTED_MODULE_3__["default"]);
692var siteConfig = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, defaultConfig);
693var directives = [];
694var currentConfig = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, defaultConfig);
695var updateCurrentConfig = function updateCurrentConfig(siteCfg, _directives) {
696 var cfg = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, siteCfg); // Apply directives
697
698 var themeVariables = {};
699
700 for (var i = 0; i < _directives.length; i++) {
701 var d = _directives[i];
702 sanitize(d);
703 cfg = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])(cfg, d);
704
705 if (d.theme) {
706 cfg.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][cfg.theme].getThemeVariables(d.themeVariables);
707 }
708 }
709
710 if (cfg.theme && _themes__WEBPACK_IMPORTED_MODULE_2__["default"][cfg.theme]) {
711 var tVars = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, cfg.themeVariables);
712 tVars = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])(tVars, themeVariables);
713 var variables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][cfg.theme].getThemeVariables(tVars);
714 cfg.themeVariables = variables;
715 }
716
717 currentConfig = cfg;
718 return cfg;
719};
720/**
721 *## setSiteConfig
722 *| Function | Description | Type | Values |
723 *| --------- | ------------------- | ------- | ------------------ |
724 *| setSiteConfig|Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array|
725 ***Notes:**
726 *Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls to reset() will reset
727 *the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) will reset siteConfig and currentConfig
728 *to the defaultConfig
729 *Note: currentConfig is set in this function
730 **Default value: At default, will mirror Global Config**
731 * @param conf - the base currentConfig to use as siteConfig
732 * @returns {*} - the siteConfig
733 */
734
735var setSiteConfig = function setSiteConfig(conf) {
736 console.warn('Setting site config');
737 siteConfig = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, defaultConfig);
738 siteConfig = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])(siteConfig, conf);
739
740 if (conf.theme) {
741 siteConfig.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][conf.theme].getThemeVariables(conf.themeVariables);
742 }
743
744 currentConfig = updateCurrentConfig(siteConfig, directives);
745 return siteConfig;
746};
747var updateSiteConfig = function updateSiteConfig(conf) {
748 siteConfig = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])(siteConfig, conf);
749 updateCurrentConfig(siteConfig, directives);
750 return siteConfig;
751};
752/**
753 *## getSiteConfig
754 *| Function | Description | Type | Values |
755 *| --------- | ------------------- | ------- | ------------------ |
756 *| setSiteConfig|Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig|
757 ***Notes**:
758 *Returns **any** values in siteConfig.
759 * @returns {*}
760 */
761
762var getSiteConfig = function getSiteConfig() {
763 return Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, siteConfig);
764};
765/**
766 *## setConfig
767 *| Function | Description | Type | Values |
768 *| --------- | ------------------- | ------- | ------------------ |
769 *| setSiteConfig|Sets the siteConfig to desired values | Put Request| Any Values, except ones in secure array|
770 ***Notes**:
771 *Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure keys. Any
772 *values found in conf with key found in siteConfig.secure will be replaced with the corresponding
773 *siteConfig value.
774 * @param conf - the potential currentConfig
775 * @returns {*} - the currentConfig merged with the sanitized conf
776 */
777
778var setConfig = function setConfig(conf) {
779 // sanitize(conf);
780 // Object.keys(conf).forEach(key => {
781 // const manipulator = manipulators[key];
782 // conf[key] = manipulator ? manipulator(conf[key]) : conf[key];
783 // });
784 Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])(currentConfig, conf);
785 return getConfig();
786};
787/**
788 * ## getConfig
789 *| Function | Description | Type | Return Values |
790 *| --------- | ------------------- | ------- | ------------------ |
791 *| getConfig |Obtains the currentConfig | Get Request | Any Values from currentConfig|
792 ***Notes**:
793 *Returns **any** the currentConfig
794 * @returns {*} - the currentConfig
795 */
796
797var getConfig = function getConfig() {
798 return Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, currentConfig);
799};
800/**
801 *## sanitize
802 *| Function | Description | Type | Values |
803 *| --------- | ------------------- | ------- | ------------------ |
804 *| sanitize |Sets the siteConfig to desired values. | Put Request |None|
805 *Ensures options parameter does not attempt to override siteConfig secure keys
806 *Note: modifies options in-place
807 * @param options - the potential setConfig parameter
808 */
809
810var sanitize = function sanitize(options) {
811 Object.keys(siteConfig.secure).forEach(function (key) {
812 if (typeof options[siteConfig.secure[key]] !== 'undefined') {
813 // DO NOT attempt to print options[siteConfig.secure[key]] within `${}` as a malicious script
814 // can exploit the logger's attempt to stringify the value and execute arbitrary code
815 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].debug("Denied attempt to modify a secure key ".concat(siteConfig.secure[key]), options[siteConfig.secure[key]]);
816 delete options[siteConfig.secure[key]];
817 }
818 });
819};
820var addDirective = function addDirective(directive) {
821 directives.push(directive);
822 updateCurrentConfig(siteConfig, directives);
823};
824/**
825 *## reset
826 *| Function | Description | Type | Required | Values |
827 *| --------- | ------------------- | ------- | -------- | ------------------ |
828 *| reset|Resets currentConfig to conf| Put Request | Required | None|
829 *
830 *| Parameter | Description |Type | Required | Values|
831 *| --- | --- | --- | --- | --- |
832 *| conf| base set of values, which currentConfig coul be **reset** to.| Dictionary | Required | Any Values, with respect to the secure Array|
833 *
834 **Notes :
835 (default: current siteConfig ) (optional, default `getSiteConfig()`)
836 * @param conf the base currentConfig to reset to (default: current siteConfig ) (optional, default `getSiteConfig()`)
837 */
838
839var reset = function reset() {
840 // Replace current config with siteConfig
841 directives = [];
842 updateCurrentConfig(siteConfig, directives);
843};
844
845/***/ }),
846
847/***/ "./src/dagre-wrapper/clusters.js":
848/*!***************************************!*\
849 !*** ./src/dagre-wrapper/clusters.js ***!
850 \***************************************/
851/*! exports provided: insertCluster, getClusterTitleWidth, clear, positionCluster */
852/***/ (function(module, __webpack_exports__, __webpack_require__) {
853
854"use strict";
855__webpack_require__.r(__webpack_exports__);
856/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertCluster", function() { return insertCluster; });
857/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClusterTitleWidth", function() { return getClusterTitleWidth; });
858/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
859/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionCluster", function() { return positionCluster; });
860/* harmony import */ var _intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect/intersect-rect */ "./src/dagre-wrapper/intersect/intersect-rect.js");
861/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
862/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
863/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! d3 */ "d3");
864/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_3__);
865/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../config */ "./src/config.js");
866
867 // eslint-disable-line
868
869
870
871
872
873var rect = function rect(parent, node) {
874 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].trace('Creating subgraph rect for ', node.id, node); // Add outer g element
875
876 var shapeSvg = parent.insert('g').attr('class', 'cluster').attr('id', node.id); // add the rect
877
878 var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect
879
880 var label = shapeSvg.insert('g').attr('class', 'cluster-label');
881 var text = label.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label
882
883 var bbox = text.getBBox();
884
885 if (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels) {
886 var div = text.children[0];
887 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_3__["select"])(text);
888 bbox = div.getBoundingClientRect();
889 dv.attr('width', bbox.width);
890 dv.attr('height', bbox.height);
891 }
892
893 var padding = 0 * node.padding;
894 var halfPadding = padding / 2;
895 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].trace('Data ', node, JSON.stringify(node)); // center the rect around its coordinate
896
897 rect.attr('rx', node.rx).attr('ry', node.ry).attr('x', node.x - node.width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding).attr('width', node.width + padding).attr('height', node.height + padding); // Center the label
898
899 label.attr('transform', 'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2 - node.padding / 3 + 3) + ')');
900 var rectBox = rect.node().getBBox();
901 node.width = rectBox.width;
902 node.height = rectBox.height;
903
904 node.intersect = function (point) {
905 return Object(_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point);
906 };
907
908 return shapeSvg;
909};
910/**
911 * Non visiable cluster where the note is group with its
912 */
913
914
915var noteGroup = function noteGroup(parent, node) {
916 // Add outer g element
917 var shapeSvg = parent.insert('g').attr('class', 'note-cluster').attr('id', node.id); // add the rect
918
919 var rect = shapeSvg.insert('rect', ':first-child');
920 var padding = 0 * node.padding;
921 var halfPadding = padding / 2; // center the rect around its coordinate
922
923 rect.attr('rx', node.rx).attr('ry', node.ry).attr('x', node.x - node.width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding).attr('width', node.width + padding).attr('height', node.height + padding).attr('fill', 'none');
924 var rectBox = rect.node().getBBox();
925 node.width = rectBox.width;
926 node.height = rectBox.height;
927
928 node.intersect = function (point) {
929 return Object(_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point);
930 };
931
932 return shapeSvg;
933};
934
935var roundedWithTitle = function roundedWithTitle(parent, node) {
936 // Add outer g element
937 var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect
938
939 var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect
940
941 var label = shapeSvg.insert('g').attr('class', 'cluster-label');
942 var innerRect = shapeSvg.append('rect');
943 var text = label.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label
944
945 var bbox = text.getBBox();
946
947 if (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels) {
948 var div = text.children[0];
949 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_3__["select"])(text);
950 bbox = div.getBoundingClientRect();
951 dv.attr('width', bbox.width);
952 dv.attr('height', bbox.height);
953 }
954
955 bbox = text.getBBox();
956 var padding = 0 * node.padding;
957 var halfPadding = padding / 2; // center the rect around its coordinate
958
959 rect.attr('class', 'outer').attr('x', node.x - node.width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding).attr('width', node.width + padding).attr('height', node.height + padding);
960 innerRect.attr('class', 'inner').attr('x', node.x - node.width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding + bbox.height - 1).attr('width', node.width + padding).attr('height', node.height + padding - bbox.height - 3); // Center the label
961
962 label.attr('transform', 'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2 - node.padding / 3 + (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels ? 5 : 3)) + ')');
963 var rectBox = rect.node().getBBox();
964 node.width = rectBox.width;
965 node.height = rectBox.height;
966
967 node.intersect = function (point) {
968 return Object(_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point);
969 };
970
971 return shapeSvg;
972};
973
974var divider = function divider(parent, node) {
975 // Add outer g element
976 var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect
977
978 var rect = shapeSvg.insert('rect', ':first-child');
979 var padding = 0 * node.padding;
980 var halfPadding = padding / 2; // center the rect around its coordinate
981
982 rect.attr('class', 'divider').attr('x', node.x - node.width / 2 - halfPadding).attr('y', node.y - node.height / 2).attr('width', node.width + padding).attr('height', node.height + padding);
983 var rectBox = rect.node().getBBox();
984 node.width = rectBox.width;
985 node.height = rectBox.height;
986
987 node.intersect = function (point) {
988 return Object(_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point);
989 };
990
991 return shapeSvg;
992};
993
994var shapes = {
995 rect: rect,
996 roundedWithTitle: roundedWithTitle,
997 noteGroup: noteGroup,
998 divider: divider
999};
1000var clusterElems = {};
1001var insertCluster = function insertCluster(elem, node) {
1002 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].trace('Inserting cluster');
1003 var shape = node.shape || 'rect';
1004 clusterElems[node.id] = shapes[shape](elem, node);
1005};
1006var getClusterTitleWidth = function getClusterTitleWidth(elem, node) {
1007 var label = Object(_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true);
1008 elem.node().appendChild(label);
1009 var width = label.getBBox().width;
1010 elem.node().removeChild(label);
1011 return width;
1012};
1013var clear = function clear() {
1014 clusterElems = {};
1015};
1016var positionCluster = function positionCluster(node) {
1017 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Position cluster');
1018 var el = clusterElems[node.id];
1019 el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');
1020};
1021
1022/***/ }),
1023
1024/***/ "./src/dagre-wrapper/createLabel.js":
1025/*!******************************************!*\
1026 !*** ./src/dagre-wrapper/createLabel.js ***!
1027 \******************************************/
1028/*! exports provided: default */
1029/***/ (function(module, __webpack_exports__, __webpack_require__) {
1030
1031"use strict";
1032__webpack_require__.r(__webpack_exports__);
1033/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
1034/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
1035/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
1036/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config */ "./src/config.js");
1037
1038 // eslint-disable-line
1039// let vertexNode;
1040// if (getConfig().flowchart.htmlLabels) {
1041// // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
1042// const node = {
1043// label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, s => `<i class='${s.replace(':', ' ')}'></i>`)
1044// };
1045// vertexNode = addHtmlLabel(svg, node).node();
1046// vertexNode.parentNode.removeChild(vertexNode);
1047// } else {
1048// const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
1049// svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
1050// const rows = vertexText.split(common.lineBreakRegex);
1051// for (let j = 0; j < rows.length; j++) {
1052// const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
1053// tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
1054// tspan.setAttribute('dy', '1em');
1055// tspan.setAttribute('x', '1');
1056// tspan.textContent = rows[j];
1057// svgLabel.appendChild(tspan);
1058// }
1059// vertexNode = svgLabel;
1060// }
1061
1062
1063
1064function applyStyle(dom, styleFn) {
1065 if (styleFn) {
1066 dom.attr('style', styleFn);
1067 }
1068}
1069
1070function addHtmlLabel(node) {
1071 // var fo = root.append('foreignObject').attr('width', '100000');
1072 // var div = fo.append('xhtml:div');
1073 // div.attr('xmlns', 'http://www.w3.org/1999/xhtml');
1074 // var label = node.label;
1075 // switch (typeof label) {
1076 // case 'function':
1077 // div.insert(label);
1078 // break;
1079 // case 'object':
1080 // // Currently we assume this is a DOM object.
1081 // div.insert(function() {
1082 // return label;
1083 // });
1084 // break;
1085 // default:
1086 // div.html(label);
1087 // }
1088 // applyStyle(div, node.labelStyle);
1089 // div.style('display', 'inline-block');
1090 // // Fix for firefox
1091 // div.style('white-space', 'nowrap');
1092 // var client = div.node().getBoundingClientRect();
1093 // fo.attr('width', client.width).attr('height', client.height);
1094 var fo = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject'));
1095 var div = fo.append('xhtml:div');
1096 var label = node.label;
1097 var labelClass = node.isNode ? 'nodeLabel' : 'edgeLabel';
1098 div.html('<span class="' + labelClass + '">' + label + '</span>');
1099 applyStyle(div, node.labelStyle);
1100 div.style('display', 'inline-block'); // Fix for firefox
1101
1102 div.style('white-space', 'nowrap');
1103 div.attr('xmlns', 'http://www.w3.org/1999/xhtml');
1104 return fo.node();
1105}
1106
1107var createLabel = function createLabel(_vertexText, style, isTitle, isNode) {
1108 var vertexText = _vertexText || '';
1109
1110 if (Object(_config__WEBPACK_IMPORTED_MODULE_2__["getConfig"])().flowchart.htmlLabels) {
1111 // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
1112 vertexText = vertexText.replace(/\\n|\n/g, '<br />');
1113 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('vertexText' + vertexText);
1114 var node = {
1115 isNode: isNode,
1116 label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
1117 return "<i class='".concat(s.replace(':', ' '), "'></i>");
1118 })
1119 };
1120 var vertexNode = addHtmlLabel(node); // vertexNode.parentNode.removeChild(vertexNode);
1121
1122 return vertexNode;
1123 } else {
1124 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
1125 svgLabel.setAttribute('style', style.replace('color:', 'fill:'));
1126 var rows = [];
1127
1128 if (typeof vertexText === 'string') {
1129 rows = vertexText.split(/\\n|\n|<br\s*\/?>/gi);
1130 } else if (Array.isArray(vertexText)) {
1131 rows = vertexText;
1132 } else {
1133 rows = [];
1134 }
1135
1136 for (var j = 0; j < rows.length; j++) {
1137 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
1138 tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
1139 tspan.setAttribute('dy', '1em');
1140 tspan.setAttribute('x', '0');
1141
1142 if (isTitle) {
1143 tspan.setAttribute('class', 'title-row');
1144 } else {
1145 tspan.setAttribute('class', 'row');
1146 }
1147
1148 tspan.textContent = rows[j].trim();
1149 svgLabel.appendChild(tspan);
1150 }
1151
1152 return svgLabel;
1153 }
1154};
1155
1156/* harmony default export */ __webpack_exports__["default"] = (createLabel);
1157
1158/***/ }),
1159
1160/***/ "./src/dagre-wrapper/edges.js":
1161/*!************************************!*\
1162 !*** ./src/dagre-wrapper/edges.js ***!
1163 \************************************/
1164/*! exports provided: clear, insertEdgeLabel, positionEdgeLabel, intersection, insertEdge */
1165/***/ (function(module, __webpack_exports__, __webpack_require__) {
1166
1167"use strict";
1168__webpack_require__.r(__webpack_exports__);
1169/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
1170/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertEdgeLabel", function() { return insertEdgeLabel; });
1171/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionEdgeLabel", function() { return positionEdgeLabel; });
1172/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return intersection; });
1173/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertEdge", function() { return insertEdge; });
1174/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
1175/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
1176/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! d3 */ "d3");
1177/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_2__);
1178/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../config */ "./src/config.js");
1179/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils.js");
1180 // eslint-disable-line
1181
1182
1183
1184
1185 // import { calcLabelPosition } from '../utils';
1186
1187var edgeLabels = {};
1188var clear = function clear() {
1189 edgeLabels = {};
1190};
1191var insertEdgeLabel = function insertEdgeLabel(elem, edge) {
1192 // Create the actual text element
1193 var labelElement = Object(_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.label, edge.labelStyle); // Create outer g, edgeLabel, this will be positioned after graph layout
1194
1195 var edgeLabel = elem.insert('g').attr('class', 'edgeLabel'); // Create inner g, label, this will be positioned now for centering the text
1196
1197 var label = edgeLabel.insert('g').attr('class', 'label');
1198 label.node().appendChild(labelElement); // Center the label
1199
1200 var bbox = labelElement.getBBox();
1201
1202 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().flowchart.htmlLabels) {
1203 var div = labelElement.children[0];
1204 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_2__["select"])(labelElement);
1205 bbox = div.getBoundingClientRect();
1206 dv.attr('width', bbox.width);
1207 dv.attr('height', bbox.height);
1208 }
1209
1210 label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')'); // Make element accessible by id for positioning
1211
1212 edgeLabels[edge.id] = edgeLabel; // Update the abstract data of the edge with the new information about its width and height
1213
1214 edge.width = bbox.width;
1215 edge.height = bbox.height;
1216};
1217var positionEdgeLabel = function positionEdgeLabel(edge, points) {
1218 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Moving label', edge.id, edge.label, edgeLabels[edge.id]);
1219
1220 if (edge.label) {
1221 var el = edgeLabels[edge.id];
1222 var x = edge.x;
1223 var y = edge.y;
1224
1225 if (points) {
1226 // debugger;
1227 var pos = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calcLabelPosition(points);
1228 x = pos.x;
1229 y = pos.y;
1230 }
1231
1232 el.attr('transform', 'translate(' + x + ', ' + y + ')');
1233 }
1234}; // const getRelationType = function(type) {
1235// switch (type) {
1236// case stateDb.relationType.AGGREGATION:
1237// return 'aggregation';
1238// case stateDb.relationType.EXTENSION:
1239// return 'extension';
1240// case stateDb.relationType.COMPOSITION:
1241// return 'composition';
1242// case stateDb.relationType.DEPENDENCY:
1243// return 'dependency';
1244// }
1245// };
1246
1247var outsideNode = function outsideNode(node, point) {
1248 // logger.warn('Checking bounds ', node, point);
1249 var x = node.x;
1250 var y = node.y;
1251 var dx = Math.abs(point.x - x);
1252 var dy = Math.abs(point.y - y);
1253 var w = node.width / 2;
1254 var h = node.height / 2;
1255
1256 if (dx >= w || dy >= h) {
1257 return true;
1258 }
1259
1260 return false;
1261};
1262
1263var intersection = function intersection(node, outsidePoint, insidePoint) {
1264 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('intersection calc o:', outsidePoint, ' i:', insidePoint, node);
1265 var x = node.x;
1266 var y = node.y;
1267 var dx = Math.abs(x - insidePoint.x);
1268 var w = node.width / 2;
1269 var r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
1270 var h = node.height / 2;
1271 var edges = {
1272 x1: x - w,
1273 x2: x + w,
1274 y1: y - h,
1275 y2: y + h
1276 };
1277
1278 if (outsidePoint.x === edges.x1 || outsidePoint.x === edges.x2 || outsidePoint.y === edges.y1 || outsidePoint.y === edges.y2) {
1279 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('calc equals on edge');
1280 return outsidePoint;
1281 }
1282
1283 var Q = Math.abs(outsidePoint.y - insidePoint.y);
1284 var R = Math.abs(outsidePoint.x - insidePoint.x); // log.warn();
1285
1286 if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
1287 // eslint-disable-line
1288 // Intersection is top or bottom of rect.
1289 // let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
1290 var q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
1291 r = R * q / Q;
1292 var res = {
1293 x: insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - r,
1294 y: outsidePoint.y + q
1295 };
1296 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn("topp/bott calc, Q ".concat(Q, ", q ").concat(q, ", R ").concat(R, ", r ").concat(r), res);
1297 return res;
1298 } else {
1299 // Intersection onn sides of rect
1300 // q = (Q * r) / R;
1301 // q = 2;
1302 // r = (R * q) / Q;
1303 if (insidePoint.x < outsidePoint.x) {
1304 r = outsidePoint.x - w - x;
1305 } else {
1306 // r = outsidePoint.x - w - x;
1307 r = x - w - outsidePoint.x;
1308 }
1309
1310 var _q = _q = Q * r / R;
1311
1312 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn("sides calc, Q ".concat(Q, ", q ").concat(_q, ", R ").concat(R, ", r ").concat(r), {
1313 x: insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x + dx - w,
1314 y: insidePoint.y < outsidePoint.y ? insidePoint.y + _q : insidePoint.y - _q
1315 });
1316 return {
1317 x: insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x + dx - w,
1318 y: insidePoint.y < outsidePoint.y ? insidePoint.y + _q : insidePoint.y - _q
1319 };
1320 }
1321}; //(edgePaths, e, edge, clusterDb, diagramtype, graph)
1322
1323var insertEdge = function insertEdge(elem, e, edge, clusterDb, diagramType, graph) {
1324 var points = edge.points;
1325 var pointsHasChanged = false;
1326 var tail = graph.node(e.v);
1327 var head = graph.node(e.w);
1328
1329 if (head.intersect && tail.intersect) {
1330 points = points.slice(1, edge.points.length - 1);
1331 points.unshift(tail.intersect(points[0]));
1332 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Last point', points[points.length - 1], head, head.intersect(points[points.length - 1]));
1333 points.push(head.intersect(points[points.length - 1]));
1334 }
1335
1336 if (edge.toCluster) {
1337 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('edge', edge);
1338 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('to cluster', clusterDb[edge.toCluster]);
1339 points = [];
1340 var lastPointOutside;
1341 var isInside = false;
1342 edge.points.forEach(function (point) {
1343 var node = clusterDb[edge.toCluster].node;
1344
1345 if (!outsideNode(node, point) && !isInside) {
1346 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('inside', edge.toCluster, point, lastPointOutside); // First point inside the rect
1347
1348 var inter = intersection(node, lastPointOutside, point);
1349 var pointPresent = false;
1350 points.forEach(function (p) {
1351 pointPresent = pointPresent || p.x === inter.x && p.y === inter.y;
1352 }); // if (!pointPresent) {
1353
1354 if (!points.find(function (e) {
1355 return e.x === inter.x && e.y === inter.y;
1356 })) {
1357 points.push(inter);
1358 } else {
1359 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('no intersect', inter, points);
1360 }
1361
1362 isInside = true;
1363 } else {
1364 if (!isInside) points.push(point);
1365 }
1366
1367 lastPointOutside = point;
1368 });
1369 pointsHasChanged = true;
1370 }
1371
1372 if (edge.fromCluster) {
1373 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('edge', edge);
1374 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('from cluster', clusterDb[edge.fromCluster]);
1375 var updatedPoints = [];
1376
1377 var _lastPointOutside;
1378
1379 var _isInside = false;
1380
1381 for (var i = points.length - 1; i >= 0; i--) {
1382 var point = points[i];
1383 var node = clusterDb[edge.fromCluster].node;
1384
1385 if (!outsideNode(node, point) && !_isInside) {
1386 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('inside', edge.fromCluster, point, node); // First point inside the rect
1387
1388 var insterection = intersection(node, _lastPointOutside, point); // logger.trace('intersect', intersection(node, lastPointOutside, point));
1389
1390 updatedPoints.unshift(insterection); // points.push(insterection);
1391
1392 _isInside = true;
1393 } else {
1394 // at the outside
1395 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Outside point', point);
1396 if (!_isInside) updatedPoints.unshift(point);
1397 }
1398
1399 _lastPointOutside = point;
1400 }
1401
1402 points = updatedPoints;
1403 pointsHasChanged = true;
1404 } // The data for our line
1405
1406
1407 var lineData = points.filter(function (p) {
1408 return !Number.isNaN(p.y);
1409 }); // This is the accessor function we talked about above
1410
1411 var lineFunction = Object(d3__WEBPACK_IMPORTED_MODULE_2__["line"])().x(function (d) {
1412 return d.x;
1413 }).y(function (d) {
1414 return d.y;
1415 }).curve(d3__WEBPACK_IMPORTED_MODULE_2__["curveBasis"]); // Contruct stroke classes based on properties
1416
1417 var strokeClasses;
1418
1419 switch (edge.thickness) {
1420 case 'normal':
1421 strokeClasses = 'edge-thickness-normal';
1422 break;
1423
1424 case 'thick':
1425 strokeClasses = 'edge-thickness-thick';
1426 break;
1427
1428 default:
1429 strokeClasses = '';
1430 }
1431
1432 switch (edge.pattern) {
1433 case 'solid':
1434 strokeClasses += ' edge-pattern-solid';
1435 break;
1436
1437 case 'dotted':
1438 strokeClasses += ' edge-pattern-dotted';
1439 break;
1440
1441 case 'dashed':
1442 strokeClasses += ' edge-pattern-dashed';
1443 break;
1444 }
1445
1446 var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', edge.id).attr('class', ' ' + strokeClasses + (edge.classes ? ' ' + edge.classes : '')); // DEBUG code, adds a red circle at each edge coordinate
1447 // edge.points.forEach(point => {
1448 // elem
1449 // .append('circle')
1450 // .style('stroke', 'red')
1451 // .style('fill', 'red')
1452 // .attr('r', 1)
1453 // .attr('cx', point.x)
1454 // .attr('cy', point.y);
1455 // });
1456
1457 var url = '';
1458
1459 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().state.arrowMarkerAbsolute) {
1460 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
1461 url = url.replace(/\(/g, '\\(');
1462 url = url.replace(/\)/g, '\\)');
1463 }
1464
1465 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('arrowTypeStart', edge.arrowTypeStart);
1466 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('arrowTypeEnd', edge.arrowTypeEnd);
1467
1468 switch (edge.arrowTypeStart) {
1469 case 'arrow_cross':
1470 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-crossStart' + ')');
1471 break;
1472
1473 case 'arrow_point':
1474 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-pointStart' + ')');
1475 break;
1476
1477 case 'arrow_barb':
1478 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-barbStart' + ')');
1479 break;
1480
1481 case 'arrow_circle':
1482 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-circleStart' + ')');
1483 break;
1484
1485 case 'aggregation':
1486 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-aggregationStart' + ')');
1487 break;
1488
1489 case 'extension':
1490 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-extensionStart' + ')');
1491 break;
1492
1493 case 'composition':
1494 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-compositionStart' + ')');
1495 break;
1496
1497 case 'dependency':
1498 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-dependencyStart' + ')');
1499 break;
1500
1501 default:
1502 }
1503
1504 switch (edge.arrowTypeEnd) {
1505 case 'arrow_cross':
1506 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-crossEnd' + ')');
1507 break;
1508
1509 case 'arrow_point':
1510 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-pointEnd' + ')');
1511 break;
1512
1513 case 'arrow_barb':
1514 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-barbEnd' + ')');
1515 break;
1516
1517 case 'arrow_circle':
1518 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-circleEnd' + ')');
1519 break;
1520
1521 case 'aggregation':
1522 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-aggregationEnd' + ')');
1523 break;
1524
1525 case 'extension':
1526 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-extensionEnd' + ')');
1527 break;
1528
1529 case 'composition':
1530 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-compositionEnd' + ')');
1531 break;
1532
1533 case 'dependency':
1534 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-dependencyEnd' + ')');
1535 break;
1536
1537 default:
1538 }
1539
1540 if (pointsHasChanged) {
1541 return points;
1542 }
1543};
1544
1545/***/ }),
1546
1547/***/ "./src/dagre-wrapper/index.js":
1548/*!************************************!*\
1549 !*** ./src/dagre-wrapper/index.js ***!
1550 \************************************/
1551/*! exports provided: render */
1552/***/ (function(module, __webpack_exports__, __webpack_require__) {
1553
1554"use strict";
1555__webpack_require__.r(__webpack_exports__);
1556/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
1557/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dagre */ "dagre");
1558/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_0__);
1559/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphlib */ "graphlib");
1560/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_1__);
1561/* harmony import */ var _markers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./markers */ "./src/dagre-wrapper/markers.js");
1562/* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js");
1563/* harmony import */ var _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./mermaid-graphlib */ "./src/dagre-wrapper/mermaid-graphlib.js");
1564/* harmony import */ var _nodes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./nodes */ "./src/dagre-wrapper/nodes.js");
1565/* harmony import */ var _clusters__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./clusters */ "./src/dagre-wrapper/clusters.js");
1566/* harmony import */ var _edges__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./edges */ "./src/dagre-wrapper/edges.js");
1567/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578var recursiveRender = function recursiveRender(_elem, graph, diagramtype, parentCluster) {
1579 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Graph in recursive render:', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph), parentCluster);
1580 var dir = graph.graph().rankdir;
1581 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].warn('Dir in recursive render - dir:', dir);
1582
1583 var elem = _elem.insert('g').attr('class', 'root'); // eslint-disable-line
1584
1585
1586 if (!graph.nodes()) {
1587 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('No nodes found for', graph);
1588 } else {
1589 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Recursive render', graph.nodes());
1590 }
1591
1592 if (graph.edges().length > 0) {
1593 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Recursive edges', graph.edge(graph.edges()[0]));
1594 }
1595
1596 var clusters = elem.insert('g').attr('class', 'clusters'); // eslint-disable-line
1597
1598 var edgePaths = elem.insert('g').attr('class', 'edgePaths');
1599 var edgeLabels = elem.insert('g').attr('class', 'edgeLabels');
1600 var nodes = elem.insert('g').attr('class', 'nodes'); // Insert nodes, this will insert them into the dom and each node will get a size. The size is updated
1601 // to the abstract node and is later used by dagre for the layout
1602
1603 graph.nodes().forEach(function (v) {
1604 var node = graph.node(v);
1605
1606 if (typeof parentCluster !== 'undefined') {
1607 var data = JSON.parse(JSON.stringify(parentCluster.clusterData)); // data.clusterPositioning = true;
1608
1609 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Setting data for cluster', data);
1610 graph.setNode(parentCluster.id, data);
1611 graph.setParent(v, parentCluster.id, data);
1612 }
1613
1614 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('(Insert) Node ' + v + ': ' + JSON.stringify(graph.node(v)));
1615
1616 if (node && node.clusterNode) {
1617 // const children = graph.children(v);
1618 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Cluster identified', v, node, graph.node(v));
1619 var newEl = recursiveRender(nodes, node.graph, diagramtype, graph.node(v));
1620 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_3__["updateNodeBounds"])(node, newEl);
1621 Object(_nodes__WEBPACK_IMPORTED_MODULE_5__["setNodeElem"])(newEl, node);
1622 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].warn('Recursive render complete', newEl, node);
1623 } else {
1624 if (graph.children(v).length > 0) {
1625 // This is a cluster but not to be rendered recusively
1626 // Render as before
1627 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Cluster - the non recursive path', v, node.id, node, graph);
1628 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info(Object(_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["findNonClusterChild"])(node.id, graph));
1629 _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["clusterDb"][node.id] = {
1630 id: Object(_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["findNonClusterChild"])(node.id, graph),
1631 node: node
1632 }; // insertCluster(clusters, graph.node(v));
1633 } else {
1634 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Node - the non recursive path', v, node.id, node);
1635 Object(_nodes__WEBPACK_IMPORTED_MODULE_5__["insertNode"])(nodes, graph.node(v), dir);
1636 }
1637 }
1638 }); // Insert labels, this will insert them into the dom so that the width can be calculated
1639 // Also figure out which edges point to/from clusters and adjust them accordingly
1640 // Edges from/to clusters really points to the first child in the cluster.
1641 // TODO: pick optimal child in the cluster to us as link anchor
1642
1643 graph.edges().forEach(function (e) {
1644 var edge = graph.edge(e.v, e.w, e.name);
1645 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
1646 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Edge ' + e.v + ' -> ' + e.w + ': ', e, ' ', JSON.stringify(graph.edge(e))); // Check if link is either from or to a cluster
1647
1648 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Fix', _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["clusterDb"], 'ids:', e.v, e.w, 'Translateing: ', _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["clusterDb"][e.v], _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["clusterDb"][e.w]);
1649 Object(_edges__WEBPACK_IMPORTED_MODULE_7__["insertEdgeLabel"])(edgeLabels, edge);
1650 });
1651 graph.edges().forEach(function (e) {
1652 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
1653 });
1654 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('#############################################');
1655 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('### Layout ###');
1656 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('#############################################');
1657 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info(graph);
1658 dagre__WEBPACK_IMPORTED_MODULE_0___default.a.layout(graph);
1659 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Graph after layout:', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph)); // Move the nodes to the correct place
1660
1661 graph.nodes().forEach(function (v) {
1662 var node = graph.node(v);
1663 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Position ' + v + ': ' + JSON.stringify(graph.node(v)));
1664 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Position ' + v + ': (' + node.x, ',' + node.y, ') width: ', node.width, ' height: ', node.height);
1665
1666 if (node && node.clusterNode) {
1667 // clusterDb[node.id].node = node;
1668 Object(_nodes__WEBPACK_IMPORTED_MODULE_5__["positionNode"])(node);
1669 } else {
1670 // Non cluster node
1671 if (graph.children(v).length > 0) {
1672 // A cluster in the non-recurive way
1673 // positionCluster(node);
1674 Object(_clusters__WEBPACK_IMPORTED_MODULE_6__["insertCluster"])(clusters, node);
1675 _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["clusterDb"][node.id].node = node;
1676 } else {
1677 Object(_nodes__WEBPACK_IMPORTED_MODULE_5__["positionNode"])(node);
1678 }
1679 }
1680 }); // Move the edge labels to the correct place after layout
1681
1682 graph.edges().forEach(function (e) {
1683 var edge = graph.edge(e);
1684 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(edge), edge);
1685 var updatedPath = Object(_edges__WEBPACK_IMPORTED_MODULE_7__["insertEdge"])(edgePaths, e, edge, _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["clusterDb"], diagramtype, graph);
1686 Object(_edges__WEBPACK_IMPORTED_MODULE_7__["positionEdgeLabel"])(edge, updatedPath);
1687 });
1688 return elem;
1689};
1690
1691var render = function render(elem, graph, markers, diagramtype, id) {
1692 Object(_markers__WEBPACK_IMPORTED_MODULE_2__["default"])(elem, markers, diagramtype, id);
1693 Object(_nodes__WEBPACK_IMPORTED_MODULE_5__["clear"])();
1694 Object(_edges__WEBPACK_IMPORTED_MODULE_7__["clear"])();
1695 Object(_clusters__WEBPACK_IMPORTED_MODULE_6__["clear"])();
1696 Object(_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["clear"])();
1697 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].warn('Graph before:', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph));
1698 Object(_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["adjustClustersAndEdges"])(graph);
1699 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].warn('Graph after:', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph));
1700 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].warn('Graph ever after:', graph.graph());
1701 recursiveRender(elem, graph, diagramtype);
1702}; // const shapeDefinitions = {};
1703// export const addShape = ({ shapeType: fun }) => {
1704// shapeDefinitions[shapeType] = fun;
1705// };
1706// const arrowDefinitions = {};
1707// export const addArrow = ({ arrowType: fun }) => {
1708// arrowDefinitions[arrowType] = fun;
1709// };
1710
1711/***/ }),
1712
1713/***/ "./src/dagre-wrapper/intersect/index.js":
1714/*!**********************************************!*\
1715 !*** ./src/dagre-wrapper/intersect/index.js ***!
1716 \**********************************************/
1717/*! exports provided: default */
1718/***/ (function(module, __webpack_exports__, __webpack_require__) {
1719
1720"use strict";
1721__webpack_require__.r(__webpack_exports__);
1722/* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-node.js */ "./src/dagre-wrapper/intersect/intersect-node.js");
1723/* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_intersect_node_js__WEBPACK_IMPORTED_MODULE_0__);
1724/* harmony import */ var _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./intersect-circle.js */ "./src/dagre-wrapper/intersect/intersect-circle.js");
1725/* harmony import */ var _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intersect-ellipse.js */ "./src/dagre-wrapper/intersect/intersect-ellipse.js");
1726/* harmony import */ var _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intersect-polygon.js */ "./src/dagre-wrapper/intersect/intersect-polygon.js");
1727/* harmony import */ var _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./intersect-rect.js */ "./src/dagre-wrapper/intersect/intersect-rect.js");
1728/*
1729 * Borrowed with love from from dagrge-d3. Many thanks to cpettitt!
1730 */
1731
1732
1733
1734
1735
1736/* harmony default export */ __webpack_exports__["default"] = ({
1737 node: _intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default.a,
1738 circle: _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__["default"],
1739 ellipse: _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__["default"],
1740 polygon: _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__["default"],
1741 rect: _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__["default"]
1742});
1743
1744/***/ }),
1745
1746/***/ "./src/dagre-wrapper/intersect/intersect-circle.js":
1747/*!*********************************************************!*\
1748 !*** ./src/dagre-wrapper/intersect/intersect-circle.js ***!
1749 \*********************************************************/
1750/*! exports provided: default */
1751/***/ (function(module, __webpack_exports__, __webpack_require__) {
1752
1753"use strict";
1754__webpack_require__.r(__webpack_exports__);
1755/* harmony import */ var _intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-ellipse */ "./src/dagre-wrapper/intersect/intersect-ellipse.js");
1756
1757
1758function intersectCircle(node, rx, point) {
1759 return Object(_intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__["default"])(node, rx, rx, point);
1760}
1761
1762/* harmony default export */ __webpack_exports__["default"] = (intersectCircle);
1763
1764/***/ }),
1765
1766/***/ "./src/dagre-wrapper/intersect/intersect-ellipse.js":
1767/*!**********************************************************!*\
1768 !*** ./src/dagre-wrapper/intersect/intersect-ellipse.js ***!
1769 \**********************************************************/
1770/*! exports provided: default */
1771/***/ (function(module, __webpack_exports__, __webpack_require__) {
1772
1773"use strict";
1774__webpack_require__.r(__webpack_exports__);
1775function intersectEllipse(node, rx, ry, point) {
1776 // Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html
1777 var cx = node.x;
1778 var cy = node.y;
1779 var px = cx - point.x;
1780 var py = cy - point.y;
1781 var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
1782 var dx = Math.abs(rx * ry * px / det);
1783
1784 if (point.x < cx) {
1785 dx = -dx;
1786 }
1787
1788 var dy = Math.abs(rx * ry * py / det);
1789
1790 if (point.y < cy) {
1791 dy = -dy;
1792 }
1793
1794 return {
1795 x: cx + dx,
1796 y: cy + dy
1797 };
1798}
1799
1800/* harmony default export */ __webpack_exports__["default"] = (intersectEllipse);
1801
1802/***/ }),
1803
1804/***/ "./src/dagre-wrapper/intersect/intersect-line.js":
1805/*!*******************************************************!*\
1806 !*** ./src/dagre-wrapper/intersect/intersect-line.js ***!
1807 \*******************************************************/
1808/*! exports provided: default */
1809/***/ (function(module, __webpack_exports__, __webpack_require__) {
1810
1811"use strict";
1812__webpack_require__.r(__webpack_exports__);
1813/*
1814 * Returns the point at which two lines, p and q, intersect or returns
1815 * undefined if they do not intersect.
1816 */
1817function intersectLine(p1, p2, q1, q2) {
1818 // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
1819 // p7 and p473.
1820 var a1, a2, b1, b2, c1, c2;
1821 var r1, r2, r3, r4;
1822 var denom, offset, num;
1823 var x, y; // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +
1824 // b1 y + c1 = 0.
1825
1826 a1 = p2.y - p1.y;
1827 b1 = p1.x - p2.x;
1828 c1 = p2.x * p1.y - p1.x * p2.y; // Compute r3 and r4.
1829
1830 r3 = a1 * q1.x + b1 * q1.y + c1;
1831 r4 = a1 * q2.x + b1 * q2.y + c1; // Check signs of r3 and r4. If both point 3 and point 4 lie on
1832 // same side of line 1, the line segments do not intersect.
1833
1834 if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
1835 return;
1836 } // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0
1837
1838
1839 a2 = q2.y - q1.y;
1840 b2 = q1.x - q2.x;
1841 c2 = q2.x * q1.y - q1.x * q2.y; // Compute r1 and r2
1842
1843 r1 = a2 * p1.x + b2 * p1.y + c2;
1844 r2 = a2 * p2.x + b2 * p2.y + c2; // Check signs of r1 and r2. If both point 1 and point 2 lie
1845 // on same side of second line segment, the line segments do
1846 // not intersect.
1847
1848 if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
1849 return;
1850 } // Line segments intersect: compute intersection point.
1851
1852
1853 denom = a1 * b2 - a2 * b1;
1854
1855 if (denom === 0) {
1856 return;
1857 }
1858
1859 offset = Math.abs(denom / 2); // The denom/2 is to get rounding instead of truncating. It
1860 // is added or subtracted to the numerator, depending upon the
1861 // sign of the numerator.
1862
1863 num = b1 * c2 - b2 * c1;
1864 x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
1865 num = a2 * c1 - a1 * c2;
1866 y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
1867 return {
1868 x: x,
1869 y: y
1870 };
1871}
1872
1873function sameSign(r1, r2) {
1874 return r1 * r2 > 0;
1875}
1876
1877/* harmony default export */ __webpack_exports__["default"] = (intersectLine);
1878
1879/***/ }),
1880
1881/***/ "./src/dagre-wrapper/intersect/intersect-node.js":
1882/*!*******************************************************!*\
1883 !*** ./src/dagre-wrapper/intersect/intersect-node.js ***!
1884 \*******************************************************/
1885/*! no static exports found */
1886/***/ (function(module, exports) {
1887
1888module.exports = intersectNode;
1889
1890function intersectNode(node, point) {
1891 // console.info('Intersect Node');
1892 return node.intersect(point);
1893}
1894
1895/***/ }),
1896
1897/***/ "./src/dagre-wrapper/intersect/intersect-polygon.js":
1898/*!**********************************************************!*\
1899 !*** ./src/dagre-wrapper/intersect/intersect-polygon.js ***!
1900 \**********************************************************/
1901/*! exports provided: default */
1902/***/ (function(module, __webpack_exports__, __webpack_require__) {
1903
1904"use strict";
1905__webpack_require__.r(__webpack_exports__);
1906/* harmony import */ var _intersect_line__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-line */ "./src/dagre-wrapper/intersect/intersect-line.js");
1907/* eslint "no-console": off */
1908
1909/* harmony default export */ __webpack_exports__["default"] = (intersectPolygon);
1910/*
1911 * Returns the point ({x, y}) at which the point argument intersects with the
1912 * node argument assuming that it has the shape specified by polygon.
1913 */
1914
1915function intersectPolygon(node, polyPoints, point) {
1916 var x1 = node.x;
1917 var y1 = node.y;
1918 var intersections = [];
1919 var minX = Number.POSITIVE_INFINITY;
1920 var minY = Number.POSITIVE_INFINITY;
1921
1922 if (typeof polyPoints.forEach === 'function') {
1923 polyPoints.forEach(function (entry) {
1924 minX = Math.min(minX, entry.x);
1925 minY = Math.min(minY, entry.y);
1926 });
1927 } else {
1928 minX = Math.min(minX, polyPoints.x);
1929 minY = Math.min(minY, polyPoints.y);
1930 }
1931
1932 var left = x1 - node.width / 2 - minX;
1933 var top = y1 - node.height / 2 - minY;
1934
1935 for (var i = 0; i < polyPoints.length; i++) {
1936 var p1 = polyPoints[i];
1937 var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
1938 var intersect = Object(_intersect_line__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point, {
1939 x: left + p1.x,
1940 y: top + p1.y
1941 }, {
1942 x: left + p2.x,
1943 y: top + p2.y
1944 });
1945
1946 if (intersect) {
1947 intersections.push(intersect);
1948 }
1949 }
1950
1951 if (!intersections.length) {
1952 // console.log('NO INTERSECTION FOUND, RETURN NODE CENTER', node);
1953 return node;
1954 }
1955
1956 if (intersections.length > 1) {
1957 // More intersections, find the one nearest to edge end point
1958 intersections.sort(function (p, q) {
1959 var pdx = p.x - point.x;
1960 var pdy = p.y - point.y;
1961 var distp = Math.sqrt(pdx * pdx + pdy * pdy);
1962 var qdx = q.x - point.x;
1963 var qdy = q.y - point.y;
1964 var distq = Math.sqrt(qdx * qdx + qdy * qdy);
1965 return distp < distq ? -1 : distp === distq ? 0 : 1;
1966 });
1967 }
1968
1969 return intersections[0];
1970}
1971
1972/***/ }),
1973
1974/***/ "./src/dagre-wrapper/intersect/intersect-rect.js":
1975/*!*******************************************************!*\
1976 !*** ./src/dagre-wrapper/intersect/intersect-rect.js ***!
1977 \*******************************************************/
1978/*! exports provided: default */
1979/***/ (function(module, __webpack_exports__, __webpack_require__) {
1980
1981"use strict";
1982__webpack_require__.r(__webpack_exports__);
1983var intersectRect = function intersectRect(node, point) {
1984 var x = node.x;
1985 var y = node.y; // Rectangle intersection algorithm from:
1986 // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
1987
1988 var dx = point.x - x;
1989 var dy = point.y - y;
1990 var w = node.width / 2;
1991 var h = node.height / 2;
1992 var sx, sy;
1993
1994 if (Math.abs(dy) * w > Math.abs(dx) * h) {
1995 // Intersection is top or bottom of rect.
1996 if (dy < 0) {
1997 h = -h;
1998 }
1999
2000 sx = dy === 0 ? 0 : h * dx / dy;
2001 sy = h;
2002 } else {
2003 // Intersection is left or right of rect.
2004 if (dx < 0) {
2005 w = -w;
2006 }
2007
2008 sx = w;
2009 sy = dx === 0 ? 0 : w * dy / dx;
2010 }
2011
2012 return {
2013 x: x + sx,
2014 y: y + sy
2015 };
2016};
2017
2018/* harmony default export */ __webpack_exports__["default"] = (intersectRect);
2019
2020/***/ }),
2021
2022/***/ "./src/dagre-wrapper/markers.js":
2023/*!**************************************!*\
2024 !*** ./src/dagre-wrapper/markers.js ***!
2025 \**************************************/
2026/*! exports provided: default */
2027/***/ (function(module, __webpack_exports__, __webpack_require__) {
2028
2029"use strict";
2030__webpack_require__.r(__webpack_exports__);
2031/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
2032/**
2033 * Setup arrow head and define the marker. The result is appended to the svg.
2034 */
2035 // Only add the number of markers that the diagram needs
2036
2037var insertMarkers = function insertMarkers(elem, markerArray, type, id) {
2038 markerArray.forEach(function (markerName) {
2039 markers[markerName](elem, type, id);
2040 });
2041};
2042
2043var extension = function extension(elem, type, id) {
2044 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Making markers for ', id);
2045 elem.append('defs').append('marker').attr('id', type + '-extensionStart').attr('class', 'marker extension ' + type).attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 1,7 L18,13 V 1 Z');
2046 elem.append('defs').append('marker').attr('id', type + '-extensionEnd').attr('class', 'marker extension ' + type).attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 1,1 V 13 L18,7 Z'); // this is actual shape for arrowhead
2047};
2048
2049var composition = function composition(elem, type) {
2050 elem.append('defs').append('marker').attr('id', type + '-compositionStart').attr('class', 'marker composition ' + type).attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
2051 elem.append('defs').append('marker').attr('id', type + '-compositionEnd').attr('class', 'marker composition ' + type).attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
2052};
2053
2054var aggregation = function aggregation(elem, type) {
2055 elem.append('defs').append('marker').attr('id', type + '-aggregationStart').attr('class', 'marker aggregation ' + type).attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
2056 elem.append('defs').append('marker').attr('id', type + '-aggregationEnd').attr('class', 'marker aggregation ' + type).attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
2057};
2058
2059var dependency = function dependency(elem, type) {
2060 elem.append('defs').append('marker').attr('id', type + '-dependencyStart').attr('class', 'marker dependency ' + type).attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 5,7 L9,13 L1,7 L9,1 Z');
2061 elem.append('defs').append('marker').attr('id', type + '-dependencyEnd').attr('class', 'marker dependency ' + type).attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L14,7 L9,1 Z');
2062};
2063
2064var point = function point(elem, type) {
2065 elem.append('marker').attr('id', type + '-pointEnd').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 12).attr('markerHeight', 12).attr('orient', 'auto').append('path').attr('d', 'M 0 0 L 10 5 L 0 10 z').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
2066 elem.append('marker').attr('id', type + '-pointStart').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', 0).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 12).attr('markerHeight', 12).attr('orient', 'auto').append('path').attr('d', 'M 0 5 L 10 10 L 10 0 z').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
2067};
2068
2069var circle = function circle(elem, type) {
2070 elem.append('marker').attr('id', type + '-circleEnd').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', 11).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('circle').attr('cx', '5').attr('cy', '5').attr('r', '5').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
2071 elem.append('marker').attr('id', type + '-circleStart').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', -1).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('circle').attr('cx', '5').attr('cy', '5').attr('r', '5').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
2072};
2073
2074var cross = function cross(elem, type) {
2075 elem.append('marker').attr('id', type + '-crossEnd').attr('class', 'marker cross ' + type).attr('viewBox', '0 0 11 11').attr('refX', 12).attr('refY', 5.2).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('path') // .attr('stroke', 'black')
2076 .attr('d', 'M 1,1 l 9,9 M 10,1 l -9,9').attr('class', 'arrowMarkerPath').style('stroke-width', 2).style('stroke-dasharray', '1,0');
2077 elem.append('marker').attr('id', type + '-crossStart').attr('class', 'marker cross ' + type).attr('viewBox', '0 0 11 11').attr('refX', -1).attr('refY', 5.2).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('path') // .attr('stroke', 'black')
2078 .attr('d', 'M 1,1 l 9,9 M 10,1 l -9,9').attr('class', 'arrowMarkerPath').style('stroke-width', 2).style('stroke-dasharray', '1,0');
2079};
2080
2081var barb = function barb(elem, type) {
2082 elem.append('defs').append('marker').attr('id', type + '-barbEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 14).attr('markerUnits', 'strokeWidth').attr('orient', 'auto').append('path').attr('d', 'M 19,7 L9,13 L14,7 L9,1 Z');
2083}; // TODO rename the class diagram markers to something shape descriptive and semanitc free
2084
2085
2086var markers = {
2087 extension: extension,
2088 composition: composition,
2089 aggregation: aggregation,
2090 dependency: dependency,
2091 point: point,
2092 circle: circle,
2093 cross: cross,
2094 barb: barb
2095};
2096/* harmony default export */ __webpack_exports__["default"] = (insertMarkers);
2097
2098/***/ }),
2099
2100/***/ "./src/dagre-wrapper/mermaid-graphlib.js":
2101/*!***********************************************!*\
2102 !*** ./src/dagre-wrapper/mermaid-graphlib.js ***!
2103 \***********************************************/
2104/*! exports provided: clusterDb, clear, extractDecendants, validate, findNonClusterChild, adjustClustersAndEdges, extractor */
2105/***/ (function(module, __webpack_exports__, __webpack_require__) {
2106
2107"use strict";
2108__webpack_require__.r(__webpack_exports__);
2109/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clusterDb", function() { return clusterDb; });
2110/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
2111/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractDecendants", function() { return extractDecendants; });
2112/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validate", function() { return validate; });
2113/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findNonClusterChild", function() { return findNonClusterChild; });
2114/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "adjustClustersAndEdges", function() { return adjustClustersAndEdges; });
2115/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractor", function() { return extractor; });
2116/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
2117/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphlib */ "graphlib");
2118/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_1__);
2119/**
2120 * Decorates with functions required by mermaids dagre-wrapper.
2121 */
2122
2123
2124var clusterDb = {};
2125var decendants = {};
2126var parents = {};
2127var clear = function clear() {
2128 decendants = {};
2129 parents = {};
2130 clusterDb = {};
2131};
2132
2133var isDecendant = function isDecendant(id, ancenstorId) {
2134 // if (id === ancenstorId) return true;
2135 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('In isDecendant', ancenstorId, ' ', id, ' = ', decendants[ancenstorId].indexOf(id) >= 0);
2136 if (decendants[ancenstorId].indexOf(id) >= 0) return true;
2137 return false;
2138};
2139
2140var edgeInCluster = function edgeInCluster(edge, clusterId) {
2141 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Decendants of ', clusterId, ' is ', decendants[clusterId]);
2142 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Edge is ', edge); // Edges to/from the cluster is not in the cluster, they are in the parent
2143
2144 if (edge.v === clusterId) return false;
2145 if (edge.w === clusterId) return false;
2146
2147 if (!decendants[clusterId]) {
2148 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Tilt, ', clusterId, ',not in decendants');
2149 return false;
2150 }
2151
2152 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Here ');
2153 if (decendants[clusterId].indexOf(edge.v) >= 0) return true;
2154 if (isDecendant(edge.v, clusterId)) return true;
2155 if (isDecendant(edge.w, clusterId)) return true;
2156 if (decendants[clusterId].indexOf(edge.w) >= 0) return true;
2157 return false;
2158};
2159
2160var copy = function copy(clusterId, graph, newGraph, rootId) {
2161 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Copying children of ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);
2162 var nodes = graph.children(clusterId) || []; // Include cluster node if it is not the root
2163
2164 if (clusterId !== rootId) {
2165 nodes.push(clusterId);
2166 }
2167
2168 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Copying (nodes) clusterId', clusterId, 'nodes', nodes);
2169 nodes.forEach(function (node) {
2170 if (graph.children(node).length > 0) {
2171 copy(node, graph, newGraph, rootId);
2172 } else {
2173 var data = graph.node(node);
2174 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('cp ', node, ' to ', rootId, ' with parent ', clusterId); //,node, data, ' parent is ', clusterId);
2175
2176 newGraph.setNode(node, data);
2177 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Setting parent', node, graph.parent(node));
2178
2179 if (rootId !== graph.parent(node)) {
2180 newGraph.setParent(node, graph.parent(node));
2181 }
2182
2183 if (clusterId !== rootId && node !== clusterId) {
2184 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Setting parent', node, clusterId);
2185 newGraph.setParent(node, clusterId);
2186 } else {
2187 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('In copy ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);
2188 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Not Setting parent for node=', node, 'cluster!==rootId', clusterId !== rootId, 'node!==clusterId', node !== clusterId);
2189 }
2190
2191 var edges = graph.edges(node);
2192 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Copying Edges', edges);
2193 edges.forEach(function (edge) {
2194 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Edge', edge);
2195 var data = graph.edge(edge.v, edge.w, edge.name);
2196 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Edge data', data, rootId);
2197
2198 try {
2199 // Do not copy edges in and out of the root cluster, they belong to the parent graph
2200 if (edgeInCluster(edge, rootId)) {
2201 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Copying as ', edge.v, edge.w, data, edge.name);
2202 newGraph.setEdge(edge.v, edge.w, data, edge.name);
2203 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('newGraph edges ', newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
2204 } else {
2205 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Skipping copy of edge ', edge.v, '-->', edge.w, ' rootId: ', rootId, ' clusterId:', clusterId);
2206 }
2207 } catch (e) {
2208 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].error(e);
2209 }
2210 });
2211 }
2212
2213 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Removing node', node);
2214 graph.removeNode(node);
2215 });
2216};
2217
2218var extractDecendants = function extractDecendants(id, graph) {
2219 // log.debug('Extracting ', id);
2220 var children = graph.children(id);
2221 var res = [].concat(children);
2222
2223 for (var i = 0; i < children.length; i++) {
2224 parents[children[i]] = id;
2225 res = res.concat(extractDecendants(children[i], graph));
2226 }
2227
2228 return res;
2229};
2230/**
2231 * Validates the graph, checking that all parent child relation points to existing nodes and that
2232 * edges between nodes also ia correct. When not correct the function logs the discrepancies.
2233 * @param {graphlib graph} g
2234 */
2235
2236var validate = function validate(graph) {
2237 var edges = graph.edges();
2238 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Edges: ', edges);
2239
2240 for (var i = 0; i < edges.length; i++) {
2241 if (graph.children(edges[i].v).length > 0) {
2242 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('The node ', edges[i].v, ' is part of and edge even though it has children');
2243 return false;
2244 }
2245
2246 if (graph.children(edges[i].w).length > 0) {
2247 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('The node ', edges[i].w, ' is part of and edge even though it has children');
2248 return false;
2249 }
2250 }
2251
2252 return true;
2253};
2254/**
2255 * Finds a child that is not a cluster. When faking a edge between a node and a cluster.
2256 * @param {Finds a } id
2257 * @param {*} graph
2258 */
2259
2260var findNonClusterChild = function findNonClusterChild(id, graph) {
2261 // const node = graph.node(id);
2262 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Searching', id); // const children = graph.children(id).reverse();
2263
2264 var children = graph.children(id); //.reverse();
2265
2266 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Searching children of id ', id, children);
2267
2268 if (children.length < 1) {
2269 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('This is a valid node', id);
2270 return id;
2271 }
2272
2273 for (var i = 0; i < children.length; i++) {
2274 var _id = findNonClusterChild(children[i], graph);
2275
2276 if (_id) {
2277 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Found replacement for', id, ' => ', _id);
2278 return _id;
2279 }
2280 }
2281};
2282
2283var getAnchorId = function getAnchorId(id) {
2284 if (!clusterDb[id]) {
2285 return id;
2286 } // If the cluster has no external connections
2287
2288
2289 if (!clusterDb[id].externalConnections) {
2290 return id;
2291 } // Return the replacement node
2292
2293
2294 if (clusterDb[id]) {
2295 return clusterDb[id].id;
2296 }
2297
2298 return id;
2299};
2300
2301var adjustClustersAndEdges = function adjustClustersAndEdges(graph, depth) {
2302 if (!graph || depth > 10) {
2303 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Opting out, no graph ');
2304 return;
2305 } else {
2306 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Opting in, graph ');
2307 } // Go through the nodes and for each cluster found, save a replacment node, this can be used when
2308 // faking a link to a cluster
2309
2310
2311 graph.nodes().forEach(function (id) {
2312 var children = graph.children(id);
2313
2314 if (children.length > 0) {
2315 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Cluster identified', id, ' Replacement id in edges: ', findNonClusterChild(id, graph));
2316 decendants[id] = extractDecendants(id, graph);
2317 clusterDb[id] = {
2318 id: findNonClusterChild(id, graph),
2319 clusterData: graph.node(id)
2320 };
2321 }
2322 }); // Check incoming and outgoing edges for each cluster
2323
2324 graph.nodes().forEach(function (id) {
2325 var children = graph.children(id);
2326 var edges = graph.edges();
2327
2328 if (children.length > 0) {
2329 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Cluster identified', id, decendants);
2330 edges.forEach(function (edge) {
2331 // log.debug('Edge, decendants: ', edge, decendants[id]);
2332 // Check if any edge leaves the cluster (not the actual cluster, thats a link from the box)
2333 if (edge.v !== id && edge.w !== id) {
2334 // Any edge where either the one of the nodes is decending to the cluster but not the other
2335 // if (decendants[id].indexOf(edge.v) < 0 && decendants[id].indexOf(edge.w) < 0) {
2336 var d1 = isDecendant(edge.v, id);
2337 var d2 = isDecendant(edge.w, id); // d1 xor d2 - if either d1 is true and d2 is false or the other way around
2338
2339 if (d1 ^ d2) {
2340 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Edge: ', edge, ' leaves cluster ', id);
2341 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Decendants of ', id, ': ', decendants[id]);
2342 clusterDb[id].externalConnections = true;
2343 }
2344 }
2345 });
2346 }
2347 });
2348 extractor(graph, 0); // For clusters with incoming and/or outgoing edges translate those edges to a real node
2349 // in the cluster inorder to fake the edge
2350
2351 graph.edges().forEach(function (e) {
2352 var edge = graph.edge(e);
2353 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
2354 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
2355 var v = e.v;
2356 var w = e.w; // Check if link is either from or to a cluster
2357
2358 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Fix', clusterDb, 'ids:', e.v, e.w, 'Translateing: ', clusterDb[e.v], clusterDb[e.w]);
2359
2360 if (clusterDb[e.v] || clusterDb[e.w]) {
2361 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Fixing and trixing - removing', e.v, e.w, e.name);
2362 v = getAnchorId(e.v);
2363 w = getAnchorId(e.w);
2364 graph.removeEdge(e.v, e.w, e.name);
2365 if (v !== e.v) edge.fromCluster = e.v;
2366 if (w !== e.w) edge.toCluster = e.w;
2367 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Replacing with', v, w, e.name);
2368 graph.setEdge(v, w, edge, e.name);
2369 }
2370 });
2371 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Adjusted Graph', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph));
2372 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace(clusterDb); // Remove references to extracted cluster
2373 // graph.edges().forEach(edge => {
2374 // if (isDecendant(edge.v, clusterId) || isDecendant(edge.w, clusterId)) {
2375 // graph.removeEdge(edge);
2376 // }
2377 // });
2378};
2379var extractor = function extractor(graph, depth) {
2380 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('extractor - ', depth, graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph), graph.children('D'));
2381
2382 if (depth > 10) {
2383 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].error('Bailing out');
2384 return;
2385 } // For clusters without incoming and/or outgoing edges, create a new cluster-node
2386 // containing the nodes and edges in the custer in a new graph
2387 // for (let i = 0;)
2388
2389
2390 var nodes = graph.nodes();
2391 var hasChildren = false;
2392
2393 for (var i = 0; i < nodes.length; i++) {
2394 var node = nodes[i];
2395 var children = graph.children(node);
2396 hasChildren = hasChildren || children.length > 0;
2397 }
2398
2399 if (!hasChildren) {
2400 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Done, no node has children', graph.nodes());
2401 return;
2402 } // const clusters = Object.keys(clusterDb);
2403 // clusters.forEach(clusterId => {
2404
2405
2406 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Nodes = ', nodes, depth);
2407
2408 for (var _i = 0; _i < nodes.length; _i++) {
2409 var _node = nodes[_i];
2410 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Extracting node', _node, clusterDb, clusterDb[_node] && !clusterDb[_node].externalConnections, !graph.parent(_node), graph.node(_node), graph.children('D'), ' Depth ', depth); // Note that the node might have been removed after the Object.keys call so better check
2411 // that it still is in the game
2412
2413 if (!clusterDb[_node]) {
2414 // Skip if the node is not a cluster
2415 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Not a cluster', _node, depth); // break;
2416 } else if (!clusterDb[_node].externalConnections && !graph.parent(_node) && graph.children(_node) && graph.children(_node).length > 0) {
2417 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Cluster without external connections, without a parent and with children', _node, depth);
2418 var graphSettings = graph.graph();
2419 var clusterGraph = new graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.Graph({
2420 multigraph: true,
2421 compound: true
2422 }).setGraph({
2423 rankdir: graphSettings.rankdir === 'TB' ? 'LR' : 'TB',
2424 // Todo: set proper spacing
2425 nodesep: 50,
2426 ranksep: 50,
2427 marginx: 8,
2428 marginy: 8
2429 }).setDefaultEdgeLabel(function () {
2430 return {};
2431 });
2432 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Old graph before copy', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph));
2433 copy(_node, graph, clusterGraph, _node);
2434 graph.setNode(_node, {
2435 clusterNode: true,
2436 id: _node,
2437 clusterData: clusterDb[_node].clusterData,
2438 labelText: clusterDb[_node].labelText,
2439 graph: clusterGraph
2440 });
2441 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('New graph after copy', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(clusterGraph));
2442 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Old graph after copy', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph));
2443 } else {
2444 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Cluster ** ', _node, ' **not meeting the criteria !externalConnections:', !clusterDb[_node].externalConnections, ' no parent: ', !graph.parent(_node), ' children ', graph.children(_node) && graph.children(_node).length > 0, graph.children('D'), depth);
2445 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(clusterDb);
2446 }
2447 }
2448
2449 nodes = graph.nodes();
2450 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('New list of nodes', nodes);
2451
2452 for (var _i2 = 0; _i2 < nodes.length; _i2++) {
2453 var _node2 = nodes[_i2];
2454 var data = graph.node(_node2);
2455 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(' Now next leveö', _node2, data);
2456
2457 if (data.clusterNode) {
2458 extractor(data.graph, depth + 1);
2459 }
2460 }
2461};
2462
2463/***/ }),
2464
2465/***/ "./src/dagre-wrapper/nodes.js":
2466/*!************************************!*\
2467 !*** ./src/dagre-wrapper/nodes.js ***!
2468 \************************************/
2469/*! exports provided: insertNode, setNodeElem, clear, positionNode */
2470/***/ (function(module, __webpack_exports__, __webpack_require__) {
2471
2472"use strict";
2473__webpack_require__.r(__webpack_exports__);
2474/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertNode", function() { return insertNode; });
2475/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setNodeElem", function() { return setNodeElem; });
2476/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
2477/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionNode", function() { return positionNode; });
2478/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
2479/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
2480/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
2481/* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js");
2482/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../config */ "./src/config.js");
2483/* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./intersect/index.js */ "./src/dagre-wrapper/intersect/index.js");
2484/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
2485/* harmony import */ var _shapes_note__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./shapes/note */ "./src/dagre-wrapper/shapes/note.js");
2486
2487 // eslint-disable-line
2488
2489
2490
2491
2492
2493
2494
2495var question = function question(parent, node) {
2496 var _labelHelper = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2497 shapeSvg = _labelHelper.shapeSvg,
2498 bbox = _labelHelper.bbox;
2499
2500 var w = bbox.width + node.padding;
2501 var h = bbox.height + node.padding;
2502 var s = w + h;
2503 var points = [{
2504 x: s / 2,
2505 y: 0
2506 }, {
2507 x: s,
2508 y: -s / 2
2509 }, {
2510 x: s / 2,
2511 y: -s
2512 }, {
2513 x: 0,
2514 y: -s / 2
2515 }];
2516 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Question main (Circle)');
2517 var questionElem = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, s, s, points);
2518 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, questionElem);
2519
2520 node.intersect = function (point) {
2521 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].warn('Intersect called');
2522 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, points, point);
2523 };
2524
2525 return shapeSvg;
2526};
2527
2528var hexagon = function hexagon(parent, node) {
2529 var _labelHelper2 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2530 shapeSvg = _labelHelper2.shapeSvg,
2531 bbox = _labelHelper2.bbox;
2532
2533 var f = 4;
2534 var h = bbox.height + node.padding;
2535 var m = h / f;
2536 var w = bbox.width + 2 * m + node.padding;
2537 var points = [{
2538 x: m,
2539 y: 0
2540 }, {
2541 x: w - m,
2542 y: 0
2543 }, {
2544 x: w,
2545 y: -h / 2
2546 }, {
2547 x: w - m,
2548 y: -h
2549 }, {
2550 x: m,
2551 y: -h
2552 }, {
2553 x: 0,
2554 y: -h / 2
2555 }];
2556 var hex = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2557 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, hex);
2558
2559 node.intersect = function (point) {
2560 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2561 };
2562
2563 return shapeSvg;
2564};
2565
2566var rect_left_inv_arrow = function rect_left_inv_arrow(parent, node) {
2567 var _labelHelper3 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2568 shapeSvg = _labelHelper3.shapeSvg,
2569 bbox = _labelHelper3.bbox;
2570
2571 var w = bbox.width + node.padding;
2572 var h = bbox.height + node.padding;
2573 var points = [{
2574 x: -h / 2,
2575 y: 0
2576 }, {
2577 x: w,
2578 y: 0
2579 }, {
2580 x: w,
2581 y: -h
2582 }, {
2583 x: -h / 2,
2584 y: -h
2585 }, {
2586 x: 0,
2587 y: -h / 2
2588 }];
2589 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2590 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2591
2592 node.intersect = function (point) {
2593 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2594 };
2595
2596 return shapeSvg;
2597};
2598
2599var lean_right = function lean_right(parent, node) {
2600 var _labelHelper4 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2601 shapeSvg = _labelHelper4.shapeSvg,
2602 bbox = _labelHelper4.bbox;
2603
2604 var w = bbox.width + node.padding;
2605 var h = bbox.height + node.padding;
2606 var points = [{
2607 x: -2 * h / 6,
2608 y: 0
2609 }, {
2610 x: w - h / 6,
2611 y: 0
2612 }, {
2613 x: w + 2 * h / 6,
2614 y: -h
2615 }, {
2616 x: h / 6,
2617 y: -h
2618 }];
2619 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2620 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2621
2622 node.intersect = function (point) {
2623 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2624 };
2625
2626 return shapeSvg;
2627};
2628
2629var lean_left = function lean_left(parent, node) {
2630 var _labelHelper5 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2631 shapeSvg = _labelHelper5.shapeSvg,
2632 bbox = _labelHelper5.bbox;
2633
2634 var w = bbox.width + node.padding;
2635 var h = bbox.height + node.padding;
2636 var points = [{
2637 x: 2 * h / 6,
2638 y: 0
2639 }, {
2640 x: w + h / 6,
2641 y: 0
2642 }, {
2643 x: w - 2 * h / 6,
2644 y: -h
2645 }, {
2646 x: -h / 6,
2647 y: -h
2648 }];
2649 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2650 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2651
2652 node.intersect = function (point) {
2653 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2654 };
2655
2656 return shapeSvg;
2657};
2658
2659var trapezoid = function trapezoid(parent, node) {
2660 var _labelHelper6 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2661 shapeSvg = _labelHelper6.shapeSvg,
2662 bbox = _labelHelper6.bbox;
2663
2664 var w = bbox.width + node.padding;
2665 var h = bbox.height + node.padding;
2666 var points = [{
2667 x: -2 * h / 6,
2668 y: 0
2669 }, {
2670 x: w + 2 * h / 6,
2671 y: 0
2672 }, {
2673 x: w - h / 6,
2674 y: -h
2675 }, {
2676 x: h / 6,
2677 y: -h
2678 }];
2679 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2680 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2681
2682 node.intersect = function (point) {
2683 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2684 };
2685
2686 return shapeSvg;
2687};
2688
2689var inv_trapezoid = function inv_trapezoid(parent, node) {
2690 var _labelHelper7 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2691 shapeSvg = _labelHelper7.shapeSvg,
2692 bbox = _labelHelper7.bbox;
2693
2694 var w = bbox.width + node.padding;
2695 var h = bbox.height + node.padding;
2696 var points = [{
2697 x: h / 6,
2698 y: 0
2699 }, {
2700 x: w - h / 6,
2701 y: 0
2702 }, {
2703 x: w + 2 * h / 6,
2704 y: -h
2705 }, {
2706 x: -2 * h / 6,
2707 y: -h
2708 }];
2709 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2710 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2711
2712 node.intersect = function (point) {
2713 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2714 };
2715
2716 return shapeSvg;
2717};
2718
2719var rect_right_inv_arrow = function rect_right_inv_arrow(parent, node) {
2720 var _labelHelper8 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2721 shapeSvg = _labelHelper8.shapeSvg,
2722 bbox = _labelHelper8.bbox;
2723
2724 var w = bbox.width + node.padding;
2725 var h = bbox.height + node.padding;
2726 var points = [{
2727 x: 0,
2728 y: 0
2729 }, {
2730 x: w + h / 2,
2731 y: 0
2732 }, {
2733 x: w,
2734 y: -h / 2
2735 }, {
2736 x: w + h / 2,
2737 y: -h
2738 }, {
2739 x: 0,
2740 y: -h
2741 }];
2742 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2743 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2744
2745 node.intersect = function (point) {
2746 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2747 };
2748
2749 return shapeSvg;
2750};
2751
2752var cylinder = function cylinder(parent, node) {
2753 var _labelHelper9 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2754 shapeSvg = _labelHelper9.shapeSvg,
2755 bbox = _labelHelper9.bbox;
2756
2757 var w = bbox.width + node.padding;
2758 var rx = w / 2;
2759 var ry = rx / (2.5 + w / 50);
2760 var h = bbox.height + ry + node.padding;
2761 var shape = 'M 0,' + ry + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 a ' + rx + ',' + ry + ' 0,0,0 ' + -w + ' 0 l 0,' + h + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 l 0,' + -h;
2762 var el = shapeSvg.attr('label-offset-y', ry).insert('path', ':first-child').attr('d', shape).attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');
2763 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2764
2765 node.intersect = function (point) {
2766 var pos = _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
2767 var x = pos.x - node.x;
2768
2769 if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
2770 // ellipsis equation: x*x / a*a + y*y / b*b = 1
2771 // solve for y to get adjustion value for pos.y
2772 var y = ry * ry * (1 - x * x / (rx * rx));
2773 if (y != 0) y = Math.sqrt(y);
2774 y = ry - y;
2775 if (point.y - node.y > 0) y = -y;
2776 pos.y += y;
2777 }
2778
2779 return pos;
2780 };
2781
2782 return shapeSvg;
2783};
2784
2785var rect = function rect(parent, node) {
2786 var _labelHelper10 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, 'node ' + node.classes, true),
2787 shapeSvg = _labelHelper10.shapeSvg,
2788 bbox = _labelHelper10.bbox,
2789 halfPadding = _labelHelper10.halfPadding;
2790
2791 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].trace('Classes = ', node.classes); // add the rect
2792
2793 var rect = shapeSvg.insert('rect', ':first-child');
2794 rect.attr('class', 'basic label-container').attr('rx', node.rx).attr('ry', node.ry).attr('x', -bbox.width / 2 - halfPadding).attr('y', -bbox.height / 2 - halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
2795 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, rect);
2796
2797 node.intersect = function (point) {
2798 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
2799 };
2800
2801 return shapeSvg;
2802};
2803
2804var rectWithTitle = function rectWithTitle(parent, node) {
2805 // const { shapeSvg, bbox, halfPadding } = labelHelper(parent, node, 'node ' + node.classes);
2806 var classes;
2807
2808 if (!node.classes) {
2809 classes = 'node default';
2810 } else {
2811 classes = 'node ' + node.classes;
2812 } // Add outer g element
2813
2814
2815 var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.id); // Create the title label and insert it after the rect
2816
2817 var rect = shapeSvg.insert('rect', ':first-child'); // const innerRect = shapeSvg.insert('rect');
2818
2819 var innerLine = shapeSvg.insert('line');
2820 var label = shapeSvg.insert('g').attr('class', 'label');
2821 var text2 = node.labelText.flat();
2822 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Label text', text2[0]);
2823 var text = label.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(text2[0], node.labelStyle, true, true));
2824 var bbox;
2825
2826 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().flowchart.htmlLabels) {
2827 var div = text.children[0];
2828 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(text);
2829 bbox = div.getBoundingClientRect();
2830 dv.attr('width', bbox.width);
2831 dv.attr('height', bbox.height);
2832 }
2833
2834 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Text 2', text2);
2835 var textRows = text2.slice(1, text2.length);
2836 var titleBox = text.getBBox();
2837 var descr = label.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(textRows.join('<br/>'), node.labelStyle, true, true));
2838
2839 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().flowchart.htmlLabels) {
2840 var _div = descr.children[0];
2841
2842 var _dv = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(descr);
2843
2844 bbox = _div.getBoundingClientRect();
2845
2846 _dv.attr('width', bbox.width);
2847
2848 _dv.attr('height', bbox.height);
2849 } // bbox = label.getBBox();
2850 // logger.info(descr);
2851
2852
2853 var halfPadding = node.padding / 2;
2854 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(descr).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 +
2855 bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ', ' + (titleBox.height + halfPadding + 5) + ')');
2856 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(text).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 +
2857 bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ', ' + 0 + ')'); // Get the size of the label
2858 // Bounding box for title and text
2859
2860 bbox = label.node().getBBox(); // Center the label
2861
2862 label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')');
2863 rect.attr('class', 'outer title-state').attr('x', -bbox.width / 2 - halfPadding).attr('y', -bbox.height / 2 - halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
2864 innerLine.attr('class', 'divider').attr('x1', -bbox.width / 2 - halfPadding).attr('x2', bbox.width / 2 + halfPadding).attr('y1', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr('y2', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
2865 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, rect);
2866
2867 node.intersect = function (point) {
2868 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
2869 };
2870
2871 return shapeSvg;
2872};
2873
2874var stadium = function stadium(parent, node) {
2875 var _labelHelper11 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2876 shapeSvg = _labelHelper11.shapeSvg,
2877 bbox = _labelHelper11.bbox;
2878
2879 var h = bbox.height + node.padding;
2880 var w = bbox.width + h / 4 + node.padding; // add the rect
2881
2882 var rect = shapeSvg.insert('rect', ':first-child').attr('rx', h / 2).attr('ry', h / 2).attr('x', -w / 2).attr('y', -h / 2).attr('width', w).attr('height', h);
2883 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, rect);
2884
2885 node.intersect = function (point) {
2886 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
2887 };
2888
2889 return shapeSvg;
2890};
2891
2892var circle = function circle(parent, node) {
2893 var _labelHelper12 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2894 shapeSvg = _labelHelper12.shapeSvg,
2895 bbox = _labelHelper12.bbox,
2896 halfPadding = _labelHelper12.halfPadding;
2897
2898 var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate
2899
2900 circle.attr('rx', node.rx).attr('ry', node.ry).attr('r', bbox.width / 2 + halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
2901 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Circle main');
2902 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, circle);
2903
2904 node.intersect = function (point) {
2905 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Circle intersect', node, bbox.width / 2 + halfPadding, point);
2906 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].circle(node, bbox.width / 2 + halfPadding, point);
2907 };
2908
2909 return shapeSvg;
2910};
2911
2912var subroutine = function subroutine(parent, node) {
2913 var _labelHelper13 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2914 shapeSvg = _labelHelper13.shapeSvg,
2915 bbox = _labelHelper13.bbox;
2916
2917 var w = bbox.width + node.padding;
2918 var h = bbox.height + node.padding;
2919 var points = [{
2920 x: 0,
2921 y: 0
2922 }, {
2923 x: w,
2924 y: 0
2925 }, {
2926 x: w,
2927 y: -h
2928 }, {
2929 x: 0,
2930 y: -h
2931 }, {
2932 x: 0,
2933 y: 0
2934 }, {
2935 x: -8,
2936 y: 0
2937 }, {
2938 x: w + 8,
2939 y: 0
2940 }, {
2941 x: w + 8,
2942 y: -h
2943 }, {
2944 x: -8,
2945 y: -h
2946 }, {
2947 x: -8,
2948 y: 0
2949 }];
2950 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2951 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2952
2953 node.intersect = function (point) {
2954 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2955 };
2956
2957 return shapeSvg;
2958};
2959
2960var start = function start(parent, node) {
2961 var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.id);
2962 var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate
2963
2964 circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
2965 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, circle);
2966
2967 node.intersect = function (point) {
2968 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].circle(node, 7, point);
2969 };
2970
2971 return shapeSvg;
2972};
2973
2974var forkJoin = function forkJoin(parent, node, dir) {
2975 var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.id);
2976 var width = 70;
2977 var height = 10;
2978
2979 if (dir === 'LR') {
2980 width = 10;
2981 height = 70;
2982 }
2983
2984 var shape = shapeSvg.append('rect').style('stroke', 'black').style('fill', 'black').attr('x', -1 * width / 2).attr('y', -1 * height / 2).attr('width', width).attr('height', height).attr('class', 'fork-join');
2985 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, shape);
2986 node.height = node.height + node.padding / 2;
2987 node.width = node.width + node.padding / 2;
2988
2989 node.intersect = function (point) {
2990 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
2991 };
2992
2993 return shapeSvg;
2994};
2995
2996var end = function end(parent, node) {
2997 var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.id);
2998 var innerCircle = shapeSvg.insert('circle', ':first-child');
2999 var circle = shapeSvg.insert('circle', ':first-child');
3000 circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
3001 innerCircle.attr('class', 'state-end').attr('r', 5).attr('width', 10).attr('height', 10);
3002 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, circle);
3003
3004 node.intersect = function (point) {
3005 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].circle(node, 7, point);
3006 };
3007
3008 return shapeSvg;
3009};
3010
3011var class_box = function class_box(parent, node) {
3012 var halfPadding = node.padding / 2;
3013 var rowPadding = 4;
3014 var lineHeight = 8;
3015 var classes;
3016
3017 if (!node.classes) {
3018 classes = 'node default';
3019 } else {
3020 classes = 'node ' + node.classes;
3021 } // Add outer g element
3022
3023
3024 var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.id); // Create the title label and insert it after the rect
3025
3026 var rect = shapeSvg.insert('rect', ':first-child');
3027 var topLine = shapeSvg.insert('line');
3028 var bottomLine = shapeSvg.insert('line');
3029 var maxWidth = 0;
3030 var maxHeight = rowPadding;
3031 var labelContainer = shapeSvg.insert('g').attr('class', 'label');
3032 var verticalPos = 0;
3033 var hasInterface = node.classData.annotations && node.classData.annotations[0]; // 1. Create the labels
3034
3035 var interfaceLabel = labelContainer.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(node.classData.annotations[0], node.labelStyle, true, true));
3036 var interfaceBBox = interfaceLabel.getBBox();
3037
3038 if (node.classData.annotations[0]) {
3039 maxHeight += interfaceBBox.height + rowPadding;
3040 maxWidth += interfaceBBox.width;
3041 }
3042
3043 var classTitleLabel = labelContainer.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(node.labelText, node.labelStyle, true, true));
3044 var classTitleBBox = classTitleLabel.getBBox();
3045 maxHeight += classTitleBBox.height + rowPadding;
3046
3047 if (classTitleBBox.width > maxWidth) {
3048 maxWidth = classTitleBBox.width;
3049 }
3050
3051 var classAttributes = [];
3052 node.classData.members.forEach(function (str) {
3053 var lbl = labelContainer.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(str, node.labelStyle, true, true));
3054 var bbox = lbl.getBBox();
3055
3056 if (bbox.width > maxWidth) {
3057 maxWidth = bbox.width;
3058 }
3059
3060 maxHeight += bbox.height + rowPadding;
3061 classAttributes.push(lbl);
3062 });
3063 var classMethods = [];
3064 node.classData.methods.forEach(function (str) {
3065 var lbl = labelContainer.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(str, node.labelStyle, true, true));
3066 var bbox = lbl.getBBox();
3067
3068 if (bbox.width > maxWidth) {
3069 maxWidth = bbox.width;
3070 }
3071
3072 maxHeight += bbox.height + rowPadding;
3073 classMethods.push(lbl);
3074 });
3075 maxHeight += lineHeight; // 2. Position the labels
3076 // position the interface label
3077
3078 if (hasInterface) {
3079 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(interfaceLabel).attr('transform', 'translate( ' + -(maxWidth + node.padding - interfaceBBox.width / 2) / 2 + ', ' + -1 * maxHeight / 2 + ')');
3080 verticalPos = interfaceBBox.height + rowPadding;
3081 } // Positin the class title label
3082
3083
3084 var diffX = (maxWidth - classTitleBBox.width) / 2;
3085 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(classTitleLabel).attr('transform', 'translate( ' + (-1 * maxWidth / 2 + diffX) + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')');
3086 verticalPos += classTitleBBox.height + rowPadding;
3087 topLine.attr('class', 'divider').attr('x1', -maxWidth / 2 - halfPadding).attr('x2', maxWidth / 2 + halfPadding).attr('y1', -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr('y2', -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
3088 verticalPos += lineHeight;
3089 classAttributes.forEach(function (lbl) {
3090 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ')');
3091 verticalPos += classTitleBBox.height + rowPadding;
3092 });
3093 bottomLine.attr('class', 'divider').attr('x1', -maxWidth / 2 - halfPadding).attr('x2', maxWidth / 2 + halfPadding).attr('y1', -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr('y2', -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
3094 verticalPos += lineHeight;
3095 classMethods.forEach(function (lbl) {
3096 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')');
3097 verticalPos += classTitleBBox.height + rowPadding;
3098 }); //
3099
3100 var bbox;
3101
3102 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().flowchart.htmlLabels) {
3103 var div = interfaceLabel.children[0];
3104 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(interfaceLabel);
3105 bbox = div.getBoundingClientRect();
3106 dv.attr('width', bbox.width);
3107 dv.attr('height', bbox.height);
3108 } // bbox = labelContainer.getBBox();
3109 // logger.info('Text 2', text2);
3110 // const textRows = text2.slice(1, text2.length);
3111 // let titleBox = text.getBBox();
3112 // const descr = label
3113 // .node()
3114 // .appendChild(createLabel(textRows.join('<br/>'), node.labelStyle, true, true));
3115 // if (getConfig().flowchart.htmlLabels) {
3116 // const div = descr.children[0];
3117 // const dv = select(descr);
3118 // bbox = div.getBoundingClientRect();
3119 // dv.attr('width', bbox.width);
3120 // dv.attr('height', bbox.height);
3121 // }
3122 // // bbox = label.getBBox();
3123 // // logger.info(descr);
3124 // select(descr).attr(
3125 // 'transform',
3126 // 'translate( ' +
3127 // // (titleBox.width - bbox.width) / 2 +
3128 // (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) +
3129 // ', ' +
3130 // (titleBox.height + halfPadding + 5) +
3131 // ')'
3132 // );
3133 // select(text).attr(
3134 // 'transform',
3135 // 'translate( ' +
3136 // // (titleBox.width - bbox.width) / 2 +
3137 // (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) +
3138 // ', ' +
3139 // 0 +
3140 // ')'
3141 // );
3142 // // Get the size of the label
3143 // // Bounding box for title and text
3144 // bbox = label.node().getBBox();
3145 // // Center the label
3146 // label.attr(
3147 // 'transform',
3148 // 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')'
3149 // );
3150
3151
3152 rect.attr('class', 'outer title-state').attr('x', -maxWidth / 2 - halfPadding).attr('y', -(maxHeight / 2) - halfPadding).attr('width', maxWidth + node.padding).attr('height', maxHeight + node.padding); // innerLine
3153 // .attr('class', 'divider')
3154 // .attr('x1', -bbox.width / 2 - halfPadding)
3155 // .attr('x2', bbox.width / 2 + halfPadding)
3156 // .attr('y1', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding)
3157 // .attr('y2', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
3158
3159 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, rect);
3160
3161 node.intersect = function (point) {
3162 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
3163 };
3164
3165 return shapeSvg;
3166};
3167
3168var shapes = {
3169 question: question,
3170 rect: rect,
3171 rectWithTitle: rectWithTitle,
3172 circle: circle,
3173 stadium: stadium,
3174 hexagon: hexagon,
3175 rect_left_inv_arrow: rect_left_inv_arrow,
3176 lean_right: lean_right,
3177 lean_left: lean_left,
3178 trapezoid: trapezoid,
3179 inv_trapezoid: inv_trapezoid,
3180 rect_right_inv_arrow: rect_right_inv_arrow,
3181 cylinder: cylinder,
3182 start: start,
3183 end: end,
3184 note: _shapes_note__WEBPACK_IMPORTED_MODULE_6__["default"],
3185 subroutine: subroutine,
3186 fork: forkJoin,
3187 join: forkJoin,
3188 class_box: class_box
3189};
3190var nodeElems = {};
3191var insertNode = function insertNode(elem, node, dir) {
3192 nodeElems[node.id] = shapes[node.shape](elem, node, dir);
3193};
3194var setNodeElem = function setNodeElem(elem, node) {
3195 nodeElems[node.id] = elem;
3196};
3197var clear = function clear() {
3198 nodeElems = {};
3199};
3200var positionNode = function positionNode(node) {
3201 var el = nodeElems[node.id];
3202 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].trace('Transforming node', node, 'translate(' + (node.x - node.width / 2 - 5) + ', ' + (node.y - node.height / 2 - 5) + ')');
3203 var padding = 8;
3204
3205 if (node.clusterNode) {
3206 el.attr('transform', 'translate(' + (node.x - node.width / 2 - padding) + ', ' + (node.y - node.height / 2 - padding) + ')');
3207 } else {
3208 el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');
3209 }
3210};
3211
3212/***/ }),
3213
3214/***/ "./src/dagre-wrapper/shapes/note.js":
3215/*!******************************************!*\
3216 !*** ./src/dagre-wrapper/shapes/note.js ***!
3217 \******************************************/
3218/*! exports provided: default */
3219/***/ (function(module, __webpack_exports__, __webpack_require__) {
3220
3221"use strict";
3222__webpack_require__.r(__webpack_exports__);
3223/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./src/dagre-wrapper/shapes/util.js");
3224/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
3225/* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../intersect/index.js */ "./src/dagre-wrapper/intersect/index.js");
3226
3227 // eslint-disable-line
3228
3229
3230
3231var note = function note(parent, node) {
3232 var _labelHelper = Object(_util__WEBPACK_IMPORTED_MODULE_0__["labelHelper"])(parent, node, 'node ' + node.classes, true),
3233 shapeSvg = _labelHelper.shapeSvg,
3234 bbox = _labelHelper.bbox,
3235 halfPadding = _labelHelper.halfPadding;
3236
3237 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Classes = ', node.classes); // add the rect
3238
3239 var rect = shapeSvg.insert('rect', ':first-child');
3240 rect.attr('rx', node.rx).attr('ry', node.ry).attr('x', -bbox.width / 2 - halfPadding).attr('y', -bbox.height / 2 - halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
3241 Object(_util__WEBPACK_IMPORTED_MODULE_0__["updateNodeBounds"])(node, rect);
3242
3243 node.intersect = function (point) {
3244 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__["default"].rect(node, point);
3245 };
3246
3247 return shapeSvg;
3248};
3249
3250/* harmony default export */ __webpack_exports__["default"] = (note);
3251
3252/***/ }),
3253
3254/***/ "./src/dagre-wrapper/shapes/util.js":
3255/*!******************************************!*\
3256 !*** ./src/dagre-wrapper/shapes/util.js ***!
3257 \******************************************/
3258/*! exports provided: labelHelper, updateNodeBounds, insertPolygonShape */
3259/***/ (function(module, __webpack_exports__, __webpack_require__) {
3260
3261"use strict";
3262__webpack_require__.r(__webpack_exports__);
3263/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "labelHelper", function() { return labelHelper; });
3264/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateNodeBounds", function() { return updateNodeBounds; });
3265/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertPolygonShape", function() { return insertPolygonShape; });
3266/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../createLabel */ "./src/dagre-wrapper/createLabel.js");
3267/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
3268/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! d3 */ "d3");
3269/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_2__);
3270
3271
3272
3273var labelHelper = function labelHelper(parent, node, _classes, isNode) {
3274 var classes;
3275
3276 if (!_classes) {
3277 classes = 'node default';
3278 } else {
3279 classes = _classes;
3280 } // Add outer g element
3281
3282
3283 var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.id); // Create the label and insert it after the rect
3284
3285 var label = shapeSvg.insert('g').attr('class', 'label');
3286 var text = label.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_0__["default"])(node.labelText, node.labelStyle, false, isNode)); // Get the size of the label
3287
3288 var bbox = text.getBBox();
3289
3290 if (Object(_config__WEBPACK_IMPORTED_MODULE_1__["getConfig"])().flowchart.htmlLabels) {
3291 var div = text.children[0];
3292 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_2__["select"])(text);
3293 bbox = div.getBoundingClientRect();
3294 dv.attr('width', bbox.width);
3295 dv.attr('height', bbox.height);
3296 }
3297
3298 var halfPadding = node.padding / 2; // Center the label
3299
3300 label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')');
3301 return {
3302 shapeSvg: shapeSvg,
3303 bbox: bbox,
3304 halfPadding: halfPadding,
3305 label: label
3306 };
3307};
3308var updateNodeBounds = function updateNodeBounds(node, element) {
3309 var bbox = element.node().getBBox();
3310 node.width = bbox.width;
3311 node.height = bbox.height;
3312};
3313function insertPolygonShape(parent, w, h, points) {
3314 return parent.insert('polygon', ':first-child').attr('points', points.map(function (d) {
3315 return d.x + ',' + d.y;
3316 }).join(' ')).attr('class', 'label-container').attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');
3317}
3318
3319/***/ }),
3320
3321/***/ "./src/defaultConfig.js":
3322/*!******************************!*\
3323 !*** ./src/defaultConfig.js ***!
3324 \******************************/
3325/*! exports provided: default */
3326/***/ (function(module, __webpack_exports__, __webpack_require__) {
3327
3328"use strict";
3329__webpack_require__.r(__webpack_exports__);
3330/* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
3331
3332/**
3333 * **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more[[click here](8.6.0_docs.md)].**
3334 *
3335 * ## **What follows are config instructions for older versions**
3336 * These are the default options which can be overridden with the initialization call like so:
3337 * **Example 1:**
3338 * <pre>
3339 * mermaid.initialize({
3340 * flowchart:{
3341 * htmlLabels: false
3342 * }
3343 * });
3344 * </pre>
3345 *
3346 * **Example 2:**
3347 * <pre>
3348 * &lt;script>
3349 * var config = {
3350 * startOnLoad:true,
3351 * flowchart:{
3352 * useMaxWidth:true,
3353 * htmlLabels:true,
3354 * curve:'cardinal',
3355 * },
3356 *
3357 * securityLevel:'loose',
3358 * };
3359 * mermaid.initialize(config);
3360 * &lt;/script>
3361 * </pre>
3362 * A summary of all options and their defaults is found [here](#mermaidapi-configuration-defaults). A description of each option follows below.
3363 *
3364 * @name Configuration
3365 */
3366
3367var config = {
3368 /** theme , the CSS style sheet
3369 *
3370 * theme , the CSS style sheet
3371 *
3372 *| Parameter | Description |Type | Required | Values|
3373 *| --- | --- | --- | --- | --- |
3374 *| Theme |Built in Themes| String | Optional | Values include, default, forest, dark, neutral, null|
3375 *
3376 ***Notes:**To disable any pre-defined mermaid theme, use "null".
3377 * <pre>
3378 * "theme": "forest",
3379 * "themeCSS": ".node rect { fill: red; }"
3380 * </pre>
3381 */
3382 theme: 'default',
3383 themeVariables: _themes__WEBPACK_IMPORTED_MODULE_0__["default"]['default'].getThemeVariables(),
3384 themeCSS: undefined,
3385
3386 /* **maxTextSize** - The maximum allowed size of the users text diamgram */
3387 maxTextSize: 50000,
3388
3389 /**
3390 *| Parameter | Description |Type | Required | Values|
3391 *| --- | --- | --- | --- | --- |
3392 *|fontFamily | specifies the font to be used in the rendered diagrams| String | Required | Verdana, Arial, Trebuchet MS,|
3393 *
3394 ***notes: Default value is \\"trebuchet ms\\".
3395 */
3396 fontFamily: '"trebuchet ms", verdana, arial;',
3397
3398 /**
3399 *| Parameter | Description |Type | Required | Values|
3400 *| --- | --- | --- | --- | --- |
3401 *| logLevel |This option decides the amount of logging to be used.| String | Required | 1, 2, 3, 4, 5 |
3402 *
3403 *
3404 ***Notes:**
3405 *- debug: 1.
3406 *- info: 2.
3407 *- warn: 3.
3408 *- error: 4.
3409 *- fatal: 5(default).
3410 */
3411 logLevel: 5,
3412
3413 /**
3414 *| Parameter | Description |Type | Required | Values|
3415 *| --- | --- | --- | --- | --- |
3416 *| securitylevel | Level of trust for parsed diagram|String | Required | Strict, Loose, antiscript |
3417 *
3418 ***Notes:
3419 *- **strict**: (**default**) tags in text are encoded, click functionality is disabeled
3420 *- **loose**: tags in text are allowed, click functionality is enabled
3421 *- **antiscript**: html tags in text are allowed, (only script element is removed), click functionality is enabled
3422 */
3423 securityLevel: 'strict',
3424
3425 /**
3426 *| Parameter | Description |Type | Required | Values|
3427 *| --- | --- | --- | --- | --- |
3428 *| startOnLoad| Dictates whether mermaind starts on Page load | Boolean | Required | True, False |
3429 *
3430 ***Notes:**
3431 ***Default value: true**
3432 */
3433 startOnLoad: true,
3434
3435 /**
3436 *| Parameter | Description |Type | Required |Values|
3437 *| --- | --- | --- | --- | --- |
3438 *| arrowMarkerAbsolute | Controls whether or arrow markers in html code are absolute paths or anchors | Boolean | Required | True, False |
3439 *
3440 *
3441 *## Notes**: This matters if you are using base tag settings.
3442 ***Default value: false**.
3443 */
3444 arrowMarkerAbsolute: false,
3445
3446 /**
3447 * This option controls which currentConfig keys are considered _secure_ and can only be changed via
3448 * call to mermaidAPI.initialize. Calls to mermaidAPI.reinitialize cannot make changes to
3449 * the `secure` keys in the current currentConfig. This prevents malicious graph directives from
3450 * overriding a site's default security.
3451 */
3452 secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize'],
3453
3454 /**
3455 * The object containing configurations specific for flowcharts
3456 */
3457 flowchart: {
3458 /**
3459 *| Parameter | Description |Type | Required | Values|
3460 *| --- | --- | --- | --- | --- |
3461 *| diagramPadding | amount of padding around the diagram as a whole | Integer | Required | Any Positive Value |
3462 *
3463 ***Notes:**The amount of padding around the diagram as a whole so that embedded diagrams have margins, expressed in pixels
3464 ***Default value: 8**.
3465 */
3466 diagramPadding: 8,
3467
3468 /**
3469 *| Parameter | Description |Type | Required | Values|
3470 *| --- | --- | --- | --- | --- |
3471 *| htmlLabels | Flag for setting whether or not a html tag should be used for rendering labels on the edges. | Boolean| Required | True, False|
3472 *
3473 ***Notes: Default value: true**.
3474 */
3475 htmlLabels: true,
3476
3477 /**
3478 *| Parameter | Description |Type | Required | Values|
3479 *| --- | --- | --- | --- | --- |
3480 *| nodeSpacing | Defines the spacing between nodes on the same level | Integer| Required | Any positive Numbers |
3481 *
3482 ***Notes:
3483 *Pertains to horizontal spacing for TB (top to bottom) or BT (bottom to top) graphs, and the vertical spacing for LR as well as RL graphs.**
3484 ***Default value 50**.
3485 */
3486 nodeSpacing: 50,
3487
3488 /**
3489 *| Parameter | Description |Type | Required | Values|
3490 *| --- | --- | --- | --- | --- |
3491 *| rankSpacing | Defines the spacing between nodes on different levels | Integer | Required| Any Positive Numbers |
3492 *
3493 ***Notes: pertains to vertical spacing for TB (top to bottom) or BT (bottom to top), and the horizontal spacing for LR as well as RL graphs.
3494 ***Default value 50**.
3495 */
3496 rankSpacing: 50,
3497
3498 /**
3499 *| Parameter | Description |Type | Required | Values|
3500 *| --- | --- | --- | --- | --- |
3501 *| curve | Defines how mermaid renders curves for flowcharts. | String | Required | Basis, Linear, Cardinal|
3502 *
3503 ***Notes:
3504 *Default Vaue: Linear**
3505 */
3506 curve: 'linear',
3507 // Only used in new experimental rendering
3508 // repreesents the padding between the labels and the shape
3509 padding: 15
3510 },
3511
3512 /**
3513 * The object containing configurations specific for sequence diagrams
3514 */
3515 sequence: {
3516 /**
3517 * widt of the activation rect
3518 * **Default value 10**.
3519 */
3520 activationWidth: 10,
3521
3522 /**
3523 *| Parameter | Description |Type | Required | Values|
3524 *| --- | --- | --- | --- | --- |
3525 *| diagramMarginX | margin to the right and left of the sequence diagram | Integer | Required | Any Positive Values |
3526 *
3527 ***Notes:**
3528 ***Default value 50**.
3529 */
3530 diagramMarginX: 50,
3531
3532 /**
3533 *| Parameter | Description |Type | Required | Values|
3534 *| --- | --- | --- | --- | --- |
3535 *| diagramMarginY | Margin to the over and under the sequence diagram | Integer | Required | Any Positive Values|
3536 *
3537 ***Notes:**
3538 ***Default value 10**.
3539 */
3540 diagramMarginY: 10,
3541
3542 /**
3543 *| Parameter | Description |Type | Required | Values|
3544 *| --- | --- | --- | --- | --- |
3545 *| actorMargin | Margin between actors. | Integer | Required | Any Positive Value |
3546 *
3547 ***Notes:**
3548 ***Default value 50**.
3549 */
3550 actorMargin: 50,
3551
3552 /**
3553 *| Parameter | Description |Type | Required | Values|
3554 *| --- | --- | --- | --- | --- |
3555 *| width | Width of actor boxes | Integer | Required | Any Positive Value |
3556 *
3557 ***Notes:**
3558 ***Default value 150**.
3559 */
3560 width: 150,
3561
3562 /**
3563 *| Parameter | Description |Type | Required | Values|
3564 *| --- | --- | --- | --- | --- |
3565 *| height | Height of actor boxes | Integer | Required | Any Positive Value|
3566 *
3567 ***Notes:**
3568 ***Default value 65**..
3569 */
3570 height: 65,
3571
3572 /**
3573 *| Parameter | Description |Type | Required | Values|
3574 *| --- | --- | --- | --- | --- |
3575 *| boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
3576 *
3577 ***Notes:**
3578 *
3579 ***Default value 10**.
3580 */
3581 boxMargin: 10,
3582
3583 /**
3584 *| Parameter | Description |Type | Required | Values|
3585 *| --- | --- | --- | --- | --- |
3586 *| boxTextMargin| margin around the text in loop/alt/opt boxes | Integer | Required| Any Positive Value|
3587 *
3588 ***Notes:**
3589 *
3590 ***Default value 5**.
3591 */
3592 boxTextMargin: 5,
3593
3594 /**
3595 *| Parameter | Description |Type | Required | Values|
3596 *| --- | --- | --- | --- | --- |
3597 *| noteMargin | margin around notes. | Integer | Required | Any Positive Value |
3598 *
3599 ***Notes:**
3600 *
3601 ***Default value 10**.
3602 */
3603 noteMargin: 10,
3604
3605 /**
3606 *| Parameter | Description |Type | Required | Values|
3607 *| --- | --- | --- | --- | --- |
3608 *| messageMargin | Space between messages. | Integer | Required | Any Positive Value |
3609 *
3610 ***Notes:**
3611 *
3612 *Space between messages.
3613 ***Default value 35**.
3614 */
3615 messageMargin: 35,
3616
3617 /**
3618 *| Parameter | Description |Type | Required | Values|
3619 *| --- | --- | --- | --- | --- |
3620 *| messageAlign | Multiline message alignment | Integer | Required | left, center, right |
3621 *
3622 ***Notes:**center **default**
3623 */
3624 messageAlign: 'center',
3625
3626 /**
3627 *| Parameter | Description |Type | Required | Values|
3628 *| --- | --- | --- | --- | --- |
3629 *| mirrorActors | mirror actors under diagram. | Boolean| Required | True, False |
3630 *
3631 ***Notes:**
3632 *
3633 ***Default value true**.
3634 */
3635 mirrorActors: true,
3636
3637 /**
3638 *| Parameter | Description |Type | Required | Values|
3639 *| --- | --- | --- | --- | --- |
3640 *| bottomMarginAdj | Prolongs the edge of the diagram downwards. | Integer | Required | Any Positive Value |
3641 *
3642 ***Notes:**Depending on css styling this might need adjustment.
3643 ***Default value 1**.
3644 */
3645 bottomMarginAdj: 1,
3646
3647 /**
3648 *| Parameter | Description |Type | Required | Values|
3649 *| --- | --- | --- | --- | --- |
3650 *| useMaxWidth | See Notes | Boolean | Required | True, False |
3651 *
3652 ***Notes:**
3653 *when this flag is set to true, the height and width is set to 100% and is then scaling with the
3654 *available space. If set to false, the absolute space required is used.
3655 ***Default value: True**.
3656 */
3657 useMaxWidth: true,
3658
3659 /**
3660 *| Parameter | Description |Type | Required | Values|
3661 *| --- | --- | --- | --- | --- |
3662 *| rightAngles | display curve arrows as right angles| Boolean | Required | True, False |
3663 *
3664 ***Notes:**
3665 *
3666 *This will display arrows that start and begin at the same node as right angles, rather than a curve
3667 ***Default value false**.
3668 */
3669 rightAngles: false,
3670
3671 /**
3672 *| Parameter | Description |Type | Required | Values|
3673 *| --- | --- | --- | --- | --- |
3674 *| showSequenceNumbers | This will show the node numbers | Boolean | Required | True, False |
3675 *
3676 ***Notes:**
3677 ***Default value false**.
3678 */
3679 showSequenceNumbers: false,
3680
3681 /**
3682 *| Parameter | Description |Type | Required | Values|
3683 *| --- | --- | --- | --- | --- |
3684 *| actorFontSize| This sets the font size of the actor's description | Integer | Require | Any Positive Value |
3685 *
3686 ***Notes:**
3687 ***Default value 14**..
3688 */
3689 actorFontSize: 14,
3690
3691 /**
3692 *| Parameter | Description |Type | Required | Values|
3693 *| --- | --- | --- | --- | --- |
3694 *| actorFontFamily |This sets the font family of the actor's description | 3 | 4 | Open-Sans, Sans-Serif |
3695 *
3696 ***Notes:**
3697 ***Default value "Open-Sans", "sans-serif"**.
3698 */
3699 actorFontFamily: '"Open-Sans", "sans-serif"',
3700
3701 /**
3702 * This sets the font weight of the actor's description
3703 * **Default value 400.
3704 */
3705 actorFontWeight: 400,
3706
3707 /**
3708 *| Parameter | Description |Type | Required | Values|
3709 *| --- | --- | --- | --- | --- |
3710 *| noteFontSize |This sets the font size of actor-attached notes. | Integer | Required | Any Positive Value |
3711 *
3712 ***Notes:**
3713 ***Default value 14**..
3714 */
3715 noteFontSize: 14,
3716
3717 /**
3718 *| Parameter | Description |Type | Required | Values|
3719 *| --- | --- | --- | --- | --- |
3720 *| noteFontFamily| This sets the font family of actor-attached notes. | String | Required | trebuchet ms, verdana, arial |
3721 *
3722 ***Notes:**
3723 ***Default value: trebuchet ms **.
3724 */
3725 noteFontFamily: '"trebuchet ms", verdana, arial',
3726
3727 /**
3728 * This sets the font weight of the note's description
3729 * **Default value 400.
3730 */
3731 noteFontWeight: 400,
3732
3733 /**
3734 *| Parameter | Description |Type | Required | Values|
3735 *| --- | --- | --- | --- | --- |
3736 *| noteAlign | This sets the text alignment of actor-attached notes. | string | required | left, center, right|
3737 *
3738 ***Notes:**
3739 ***Default value center**.
3740 */
3741 noteAlign: 'center',
3742
3743 /**
3744 *| Parameter | Description |Type | Required | Values|
3745 *| --- | --- | --- | --- | --- |
3746 *| messageFontSize | This sets the font size of actor messages. | Integer | Required | Any Positive Number |
3747 *
3748 ***Notes:**
3749 ***Default value 16**.
3750 */
3751 messageFontSize: 16,
3752
3753 /**
3754 *| Parameter | Description |Type | Required | Values|
3755 *| --- | --- | --- | --- | --- |
3756 *| messageFontFamily | This sets the font family of actor messages. | String| Required | trebuchet ms", verdana, aria |
3757 *
3758 ***Notes:**
3759 ***Default value:"trebuchet ms**.
3760 */
3761 messageFontFamily: '"trebuchet ms", verdana, arial',
3762
3763 /**
3764 * This sets the font weight of the message's description
3765 * **Default value 400.
3766 */
3767 messageFontWeight: 400,
3768
3769 /**
3770 * This sets the auto-wrap state for the diagram
3771 * **Default value false.
3772 */
3773 wrap: false,
3774
3775 /**
3776 * This sets the auto-wrap padding for the diagram (sides only)
3777 * **Default value 10.
3778 */
3779 wrapPadding: 10,
3780
3781 /**
3782 * This sets the width of the loop-box (loop, alt, opt, par)
3783 * **Default value 50.
3784 */
3785 labelBoxWidth: 50,
3786
3787 /**
3788 * This sets the height of the loop-box (loop, alt, opt, par)
3789 * **Default value 20.
3790 */
3791 labelBoxHeight: 20,
3792 messageFont: function messageFont() {
3793 return {
3794 fontFamily: this.messageFontFamily,
3795 fontSize: this.messageFontSize,
3796 fontWeight: this.messageFontWeight
3797 };
3798 },
3799 noteFont: function noteFont() {
3800 return {
3801 fontFamily: this.noteFontFamily,
3802 fontSize: this.noteFontSize,
3803 fontWeight: this.noteFontWeight
3804 };
3805 },
3806 actorFont: function actorFont() {
3807 return {
3808 fontFamily: this.actorFontFamily,
3809 fontSize: this.actorFontSize,
3810 fontWeight: this.actorFontWeight
3811 };
3812 }
3813 },
3814
3815 /**
3816 * The object containing configurations specific for gantt diagrams*
3817 */
3818 gantt: {
3819 /**
3820 *### titleTopMargin
3821 *
3822 *| Parameter | Description |Type | Required | Values|
3823 *| --- | --- | --- | --- | --- |
3824 *| titleTopMargin | Margin top for the text over the gantt diagram | Integer | Required | Any Positive Value |
3825 *
3826 ***Notes:**
3827 ***Default value 25**.
3828 */
3829 titleTopMargin: 25,
3830
3831 /**
3832 *| Parameter | Description |Type | Required | Values|
3833 *| --- | --- | --- | --- | --- |
3834 *| barHeight | The height of the bars in the graph | Integer | Required | Any Positive Value |
3835 *
3836 ***Notes:**
3837 ***Default value 20**.
3838 */
3839 barHeight: 20,
3840
3841 /**
3842 *| Parameter | Description |Type | Required | Values|
3843 *| --- | --- | --- | --- | --- |
3844 *| barGap | The margin between the different activities in the gantt diagram. | Integer | Optional |Any Positive Value |
3845 *
3846 ***Notes:**
3847 ***Default value 4**.
3848 */
3849 barGap: 4,
3850
3851 /**
3852 *| Parameter | Description |Type | Required | Values|
3853 *| --- | --- | --- | --- | --- |
3854 *| topPadding | Margin between title and gantt diagram and between axis and gantt diagram. | Integer | Required | Any Positive Value |
3855 *
3856 ***Notes:**
3857 ***Default value 50**.
3858 */
3859 topPadding: 50,
3860
3861 /**
3862 *| Parameter | Description |Type | Required | Values|
3863 *| --- | --- | --- | --- | --- |
3864 *| leftPadding | The space allocated for the section name to the left of the activities. | Integer| Required | Any Positive Value |
3865 *
3866 ***Notes:**
3867 ***Default value 75**.
3868 */
3869 leftPadding: 75,
3870
3871 /**
3872 *| Parameter | Description |Type | Required | Values|
3873 *| --- | --- | --- | --- | --- |
3874 *| gridLineStartPadding | Vertical starting position of the grid lines. | Integer | Required | Any Positive Value |
3875 *
3876 ***Notes:**
3877 ***Default value 35**.
3878 */
3879 gridLineStartPadding: 35,
3880
3881 /**
3882 *| Parameter | Description |Type | Required | Values|
3883 *| --- | --- | --- | --- | --- |
3884 *| fontSize | Font size| Integer | Required | Any Positive Value |
3885 *
3886 ***Notes:**
3887 ***Default value 11**.
3888 */
3889 fontSize: 11,
3890
3891 /**
3892 *| Parameter | Description |Type | Required | Values|
3893 *| --- | --- | --- | --- | --- |
3894 *| fontFamily | font Family | string | required |"Open-Sans", "sans-serif" |
3895 *
3896 ***Notes:**
3897 *
3898 ***Default value '"Open-Sans", "sans-serif"'**.
3899 */
3900 fontFamily: '"Open-Sans", "sans-serif"',
3901
3902 /**
3903 *| Parameter | Description |Type | Required | Values|
3904 *| --- | --- | --- | --- | --- |
3905 *| numberSectionStyles | The number of alternating section styles | Integer | 4 | Any Positive Value |
3906 *
3907 ***Notes:**
3908 ***Default value 4**.
3909 */
3910 numberSectionStyles: 4,
3911
3912 /**
3913 *| Parameter | Description |Type | Required | Values|
3914 *| --- | --- | --- | --- | --- |
3915 *| axisFormat | Datetime format of the axis. | 3 | Required | Date in yy-mm-dd |
3916 *
3917 ***Notes:**
3918 *
3919 * This might need adjustment to match your locale and preferences
3920 ***Default value '%Y-%m-%d'**.
3921 */
3922 axisFormat: '%Y-%m-%d'
3923 },
3924
3925 /**
3926 * The object containing configurations specific for journey diagrams
3927 */
3928 journey: {
3929 /**
3930 *| Parameter | Description |Type | Required | Values|
3931 *| --- | --- | --- | --- | --- |
3932 *| diagramMarginX | margin to the right and left of the sequence diagram | Integer | Required | Any Positive Value |
3933 *
3934 ***Notes:**
3935 ***Default value 50**.
3936 */
3937 diagramMarginX: 50,
3938
3939 /**
3940 *| Parameter | Description |Type | Required | Values|
3941 *| --- | --- | --- | --- | --- |
3942 *| diagramMarginY | margin to the over and under the sequence diagram. | Integer | Required | Any Positive Value|
3943 *
3944 ***Notes:**
3945 ***Default value 10**..
3946 */
3947 diagramMarginY: 10,
3948
3949 /**
3950 *| Parameter | Description |Type | Required | Values|
3951 *| --- | --- | --- | --- | --- |
3952 *| actorMargin | Margin between actors. | Integer | Required | Any Positive Value|
3953 *
3954 ***Notes:**
3955 ***Default value 50**.
3956 */
3957 actorMargin: 50,
3958
3959 /**
3960 *| Parameter | Description |Type | Required | Values|
3961 *| --- | --- | --- | --- | --- |
3962 *| width | Width of actor boxes | Integer | Required | Any Positive Value |
3963 *
3964 ***Notes:**
3965 ***Default value 150**.
3966 */
3967 width: 150,
3968
3969 /**
3970 *| Parameter | Description |Type | Required | Values|
3971 *| --- | --- | --- | --- | --- |
3972 *| height | Height of actor boxes | Integer | Required | Any Positive Value |
3973 *
3974 ***Notes:**
3975 ***Default value 65**.
3976 */
3977 height: 65,
3978
3979 /**
3980 *| Parameter | Description |Type | Required | Values|
3981 *| --- | --- | --- | --- | --- |
3982 *| boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
3983 *
3984 ***Notes:**
3985 ***Default value 10**.
3986 */
3987 boxMargin: 10,
3988
3989 /**
3990 *| Parameter | Description |Type | Required | Values|
3991 *| --- | --- | --- | --- | --- |
3992 *| boxTextMargin | margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value |
3993 *
3994 ***Notes:**
3995 */
3996 boxTextMargin: 5,
3997
3998 /**
3999 *| Parameter | Description |Type | Required | Values|
4000 *| --- | --- | --- | --- | --- |
4001 *| noteMargin | margin around notes. | Integer | Required | Any Positive Value |
4002 *
4003 ***Notes:**
4004 ***Default value 10**.
4005 */
4006 noteMargin: 10,
4007
4008 /**
4009 *| Parameter | Description |Type | Required | Values|
4010 *| --- | --- | --- | --- | --- |
4011 *| messageMargin |Space between messages. | Integer | Required | Any Positive Value |
4012 *
4013 ***Notes:**
4014 *
4015 *Space between messages.
4016 ***Default value 35**.
4017 */
4018 messageMargin: 35,
4019
4020 /**
4021 *| Parameter | Description |Type | Required | Values|
4022 *| --- | --- | --- | --- | --- |
4023 *| messageAlign |Multiline message alignment | 3 | 4 | left, center, right |
4024 *
4025 ***Notes:**default:center**
4026 */
4027 messageAlign: 'center',
4028
4029 /**
4030 *| Parameter | Description |Type | Required | Values|
4031 *| --- | --- | --- | --- | --- |
4032 *| bottomMarginAdj | Prolongs the edge of the diagram downwards. | Integer | 4 | Any Positive Value |
4033 *
4034 ***Notes:**Depending on css styling this might need adjustment.
4035 ***Default value 1**.
4036 */
4037 bottomMarginAdj: 1,
4038
4039 /**
4040 *| Parameter | Description |Type | Required | Values|
4041 *| --- | --- | --- | --- | --- |
4042 *| useMaxWidth | See notes | Boolean | 4 | True, False |
4043 *
4044 ***Notes:**when this flag is set the height and width is set to 100% and is then scaling with the
4045 *available space if not the absolute space required is used.
4046 *
4047 ***Default value true**.
4048 */
4049 useMaxWidth: true,
4050
4051 /**
4052 *| Parameter | Description |Type | Required | Values|
4053 *| --- | --- | --- | --- | --- |
4054 *| rightAngles | Curved Arrows become Right Angles, | 3 | 4 | True, False |
4055 *
4056 ***Notes:**This will display arrows that start and begin at the same node as right angles, rather than a curves
4057 ***Default value false**.
4058 */
4059 rightAngles: false
4060 },
4061 class: {
4062 arrowMarkerAbsolute: false
4063 },
4064 git: {
4065 arrowMarkerAbsolute: false
4066 },
4067 state: {
4068 dividerMargin: 10,
4069 sizeUnit: 5,
4070 padding: 8,
4071 textHeight: 10,
4072 titleShift: -15,
4073 noteMargin: 10,
4074 forkWidth: 70,
4075 forkHeight: 7,
4076 // Used
4077 miniPadding: 2,
4078 // Font size factor, this is used to guess the width of the edges labels before rendering by dagre
4079 // layout. This might need updating if/when switching font
4080 fontSizeFactor: 5.02,
4081 fontSize: 24,
4082 labelHeight: 16,
4083 edgeLengthFactor: '20',
4084 compositTitleSize: 35,
4085 radius: 5
4086 },
4087
4088 /**
4089 * The object containing configurations specific for entity relationship diagrams
4090 */
4091 er: {
4092 /**
4093 *| Parameter | Description |Type | Required | Values|
4094 *| --- | --- | --- | --- | --- |
4095 *| diagramPadding | amount of padding around the diagram as a whole | Integer | Required | Any Positive Value |
4096 *
4097 ***Notes:**The amount of padding around the diagram as a whole so that embedded diagrams have margins, expressed in pixels
4098 ***Default value: 20**.
4099 */
4100 diagramPadding: 20,
4101
4102 /**
4103 *| Parameter | Description |Type | Required | Values|
4104 *| --- | --- | --- | --- | --- |
4105 *| layoutDirection | Directional bias for layout of entities. | String | Required | "TB", "BT","LR","RL" |
4106 *
4107 ***Notes:**
4108 *'TB' for Top-Bottom, 'BT'for Bottom-Top, 'LR' for Left-Right, or 'RL' for Right to Left.
4109 * T = top, B = bottom, L = left, and R = right.
4110 ***Default value: TB **.
4111 */
4112 layoutDirection: 'TB',
4113
4114 /**
4115 *| Parameter | Description |Type | Required | Values|
4116 *| --- | --- | --- | --- | --- |
4117 *| minEntityWidth | The mimimum width of an entity box, | Integer | Required| Any Positive Value |
4118 *
4119 ***Notes:**expressed in pixels
4120 ***Default value: 100**.
4121 */
4122 minEntityWidth: 100,
4123
4124 /**
4125 *| Parameter | Description |Type | Required | Values|
4126 *| --- | --- | --- | --- | --- |
4127 *| minEntityHeight| The minimum height of an entity box, | Integer | 4 | Any Positive Value |
4128 *
4129 ***Notes:**expressed in pixels
4130 ***Default value: 75 **
4131 */
4132 minEntityHeight: 75,
4133
4134 /**
4135 *| Parameter | Description |Type | Required | Values|
4136 *| --- | --- | --- | --- | --- |
4137 *| entityPadding|minimum internal padding betweentext in box and box borders| Integer | 4 | Any Positive Value |
4138 *
4139 ***Notes:**The minimum internal padding betweentext in an entity box and the enclosing box borders, expressed in pixels.
4140 ***Default value: 15 **
4141 */
4142 entityPadding: 15,
4143
4144 /**
4145 *| Parameter | Description |Type | Required | Values|
4146 *| --- | --- | --- | --- | --- |
4147 *| stroke | Stroke color of box edges and lines | String | 4 | Any recognized color |
4148 ***Default value: gray **
4149 */
4150 stroke: 'gray',
4151
4152 /**
4153 *| Parameter | Description |Type | Required | Values|
4154 *| --- | --- | --- | --- | --- |
4155 *| fill | Fill color of entity boxes | String | 4 | Any recognized color |
4156 *
4157 ***Notes:**
4158 ***Default value:'honeydew'**
4159 */
4160 fill: 'honeydew',
4161
4162 /**
4163 *| Parameter | Description |Type | Required | Values|
4164 *| --- | --- | --- | --- | --- |
4165 *| fontSize| Font Size in pixels| Integer | | Any Positive Value |
4166 *
4167 ***Notes:**Font size (expressed as an integer representing a number of pixels)
4168 ***Default value: 12 **
4169 */
4170 fontSize: 12,
4171
4172 /**
4173 *| Parameter | Description |Type | Required | Values|
4174 *| --- | --- | --- | --- | --- |
4175 *| useMaxWidth | See Notes | Boolean | Required | true, false |
4176 *
4177 ***Notes:**
4178 *When this flag is set to true, the diagram width is locked to 100% and
4179 *scaled based on available space. If set to false, the diagram reserves its
4180 *absolute width.
4181 ***Default value: true**.
4182 */
4183 useMaxWidth: true
4184 }
4185};
4186config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
4187config.git.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
4188/* harmony default export */ __webpack_exports__["default"] = (config);
4189
4190/***/ }),
4191
4192/***/ "./src/diagrams/class/classDb.js":
4193/*!***************************************!*\
4194 !*** ./src/diagrams/class/classDb.js ***!
4195 \***************************************/
4196/*! exports provided: parseDirective, addClass, lookUpDomId, clear, getClass, getClasses, getRelations, addRelation, addAnnotation, addMember, addMembers, cleanupLabel, setCssClass, setLink, setClickEvent, bindFunctions, lineType, relationType, default */
4197/***/ (function(module, __webpack_exports__, __webpack_require__) {
4198
4199"use strict";
4200__webpack_require__.r(__webpack_exports__);
4201/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
4202/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addClass", function() { return addClass; });
4203/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lookUpDomId", function() { return lookUpDomId; });
4204/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
4205/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClass", function() { return getClass; });
4206/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClasses", function() { return getClasses; });
4207/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRelations", function() { return getRelations; });
4208/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addRelation", function() { return addRelation; });
4209/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addAnnotation", function() { return addAnnotation; });
4210/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addMember", function() { return addMember; });
4211/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addMembers", function() { return addMembers; });
4212/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cleanupLabel", function() { return cleanupLabel; });
4213/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setCssClass", function() { return setCssClass; });
4214/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLink", function() { return setLink; });
4215/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setClickEvent", function() { return setClickEvent; });
4216/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindFunctions", function() { return bindFunctions; });
4217/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lineType", function() { return lineType; });
4218/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "relationType", function() { return relationType; });
4219/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
4220/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
4221/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
4222/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
4223/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
4224/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
4225/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
4226
4227
4228
4229
4230
4231
4232var MERMAID_DOM_ID_PREFIX = 'classid-';
4233var config = _config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]();
4234var relations = [];
4235var classes = {};
4236var classCounter = 0;
4237var funs = [];
4238var parseDirective = function parseDirective(statement, context, type) {
4239 _mermaidAPI__WEBPACK_IMPORTED_MODULE_5__["default"].parseDirective(this, statement, context, type);
4240};
4241
4242var splitClassNameAndType = function splitClassNameAndType(id) {
4243 var genericType = '';
4244 var className = id;
4245
4246 if (id.indexOf('~') > 0) {
4247 var split = id.split('~');
4248 className = split[0];
4249 genericType = split[1];
4250 }
4251
4252 return {
4253 className: className,
4254 type: genericType
4255 };
4256};
4257/**
4258 * Function called by parser when a node definition has been found.
4259 * @param id
4260 * @public
4261 */
4262
4263
4264var addClass = function addClass(id) {
4265 var classId = splitClassNameAndType(id); // Only add class if not exists
4266
4267 if (typeof classes[classId.className] !== 'undefined') return;
4268 classes[classId.className] = {
4269 id: classId.className,
4270 type: classId.type,
4271 cssClasses: [],
4272 methods: [],
4273 members: [],
4274 annotations: [],
4275 domId: MERMAID_DOM_ID_PREFIX + classId.className + '-' + classCounter
4276 };
4277 classCounter++;
4278};
4279/**
4280 * Function to lookup domId from id in the graph definition.
4281 * @param id
4282 * @public
4283 */
4284
4285var lookUpDomId = function lookUpDomId(id) {
4286 var classKeys = Object.keys(classes);
4287
4288 for (var i = 0; i < classKeys.length; i++) {
4289 if (classes[classKeys[i]].id === id) {
4290 return classes[classKeys[i]].domId;
4291 }
4292 }
4293};
4294var clear = function clear() {
4295 relations = [];
4296 classes = {};
4297 funs = [];
4298 funs.push(setupToolTips);
4299};
4300var getClass = function getClass(id) {
4301 return classes[id];
4302};
4303var getClasses = function getClasses() {
4304 return classes;
4305};
4306var getRelations = function getRelations() {
4307 return relations;
4308};
4309var addRelation = function addRelation(relation) {
4310 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].debug('Adding relation: ' + JSON.stringify(relation));
4311 addClass(relation.id1);
4312 addClass(relation.id2);
4313 relation.id1 = splitClassNameAndType(relation.id1).className;
4314 relation.id2 = splitClassNameAndType(relation.id2).className;
4315 relations.push(relation);
4316};
4317/**
4318 * Adds an annotation to the specified class
4319 * Annotations mark special properties of the given type (like 'interface' or 'service')
4320 * @param className The class name
4321 * @param annotation The name of the annotation without any brackets
4322 * @public
4323 */
4324
4325var addAnnotation = function addAnnotation(className, annotation) {
4326 var validatedClassName = splitClassNameAndType(className).className;
4327 classes[validatedClassName].annotations.push(annotation);
4328};
4329/**
4330 * Adds a member to the specified class
4331 * @param className The class name
4332 * @param member The full name of the member.
4333 * If the member is enclosed in <<brackets>> it is treated as an annotation
4334 * If the member is ending with a closing bracket ) it is treated as a method
4335 * Otherwise the member will be treated as a normal property
4336 * @public
4337 */
4338
4339var addMember = function addMember(className, member) {
4340 var validatedClassName = splitClassNameAndType(className).className;
4341 var theClass = classes[validatedClassName];
4342
4343 if (typeof member === 'string') {
4344 // Member can contain white spaces, we trim them out
4345 var memberString = member.trim();
4346
4347 if (memberString.startsWith('<<') && memberString.endsWith('>>')) {
4348 // Remove leading and trailing brackets
4349 theClass.annotations.push(memberString.substring(2, memberString.length - 2));
4350 } else if (memberString.indexOf(')') > 0) {
4351 theClass.methods.push(memberString);
4352 } else if (memberString) {
4353 theClass.members.push(memberString);
4354 }
4355 }
4356};
4357var addMembers = function addMembers(className, members) {
4358 if (Array.isArray(members)) {
4359 members.reverse();
4360 members.forEach(function (member) {
4361 return addMember(className, member);
4362 });
4363 }
4364};
4365var cleanupLabel = function cleanupLabel(label) {
4366 if (label.substring(0, 1) === ':') {
4367 return label.substr(1).trim();
4368 } else {
4369 return label.trim();
4370 }
4371};
4372/**
4373 * Called by parser when a special node is found, e.g. a clickable element.
4374 * @param ids Comma separated list of ids
4375 * @param className Class to add
4376 */
4377
4378var setCssClass = function setCssClass(ids, className) {
4379 ids.split(',').forEach(function (_id) {
4380 var id = _id;
4381 if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
4382
4383 if (typeof classes[id] !== 'undefined') {
4384 classes[id].cssClasses.push(className);
4385 }
4386 });
4387};
4388/**
4389 * Called by parser when a link is found. Adds the URL to the vertex data.
4390 * @param ids Comma separated list of ids
4391 * @param linkStr URL to create a link for
4392 * @param tooltip Tooltip for the clickable element
4393 */
4394
4395var setLink = function setLink(ids, linkStr, tooltip) {
4396 ids.split(',').forEach(function (_id) {
4397 var id = _id;
4398 if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
4399
4400 if (typeof classes[id] !== 'undefined') {
4401 classes[id].link = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].formatUrl(linkStr, config);
4402
4403 if (tooltip) {
4404 classes[id].tooltip = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(tooltip, config);
4405 }
4406 }
4407 });
4408 setCssClass(ids, 'clickable');
4409};
4410/**
4411 * Called by parser when a click definition is found. Registers an event handler.
4412 * @param ids Comma separated list of ids
4413 * @param functionName Function to be called on click
4414 * @param tooltip Tooltip for the clickable element
4415 */
4416
4417var setClickEvent = function setClickEvent(ids, functionName, tooltip) {
4418 ids.split(',').forEach(function (id) {
4419 setClickFunc(id, functionName, tooltip);
4420 });
4421 setCssClass(ids, 'clickable');
4422};
4423
4424var setClickFunc = function setClickFunc(domId, functionName, tooltip) {
4425 var id = domId;
4426 var elemId = lookUpDomId(id);
4427
4428 if (config.securityLevel !== 'loose') {
4429 return;
4430 }
4431
4432 if (typeof functionName === 'undefined') {
4433 return;
4434 }
4435
4436 if (typeof classes[id] !== 'undefined') {
4437 if (tooltip) {
4438 classes[id].tooltip = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(tooltip, config);
4439 }
4440
4441 funs.push(function () {
4442 var elem = document.querySelector("[id=\"".concat(elemId, "\"]"));
4443
4444 if (elem !== null) {
4445 elem.addEventListener('click', function () {
4446 _utils__WEBPACK_IMPORTED_MODULE_4__["default"].runFunc(functionName, elemId);
4447 }, false);
4448 }
4449 });
4450 }
4451};
4452
4453var bindFunctions = function bindFunctions(element) {
4454 funs.forEach(function (fun) {
4455 fun(element);
4456 });
4457};
4458var lineType = {
4459 LINE: 0,
4460 DOTTED_LINE: 1
4461};
4462var relationType = {
4463 AGGREGATION: 0,
4464 EXTENSION: 1,
4465 COMPOSITION: 2,
4466 DEPENDENCY: 3
4467};
4468
4469var setupToolTips = function setupToolTips(element) {
4470 var tooltipElem = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('.mermaidTooltip');
4471
4472 if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
4473 tooltipElem = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
4474 }
4475
4476 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(element).select('svg');
4477 var nodes = svg.selectAll('g.node');
4478 nodes.on('mouseover', function () {
4479 var el = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(this);
4480 var title = el.attr('title'); // Dont try to draw a tooltip if no data is provided
4481
4482 if (title === null) {
4483 return;
4484 }
4485
4486 var rect = this.getBoundingClientRect();
4487 tooltipElem.transition().duration(200).style('opacity', '.9');
4488 tooltipElem.html(el.attr('title')).style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px').style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
4489 el.classed('hover', true);
4490 }).on('mouseout', function () {
4491 tooltipElem.transition().duration(500).style('opacity', 0);
4492 var el = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(this);
4493 el.classed('hover', false);
4494 });
4495};
4496
4497funs.push(setupToolTips);
4498/* harmony default export */ __webpack_exports__["default"] = ({
4499 parseDirective: parseDirective,
4500 getConfig: function getConfig() {
4501 return _config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]().class;
4502 },
4503 addClass: addClass,
4504 bindFunctions: bindFunctions,
4505 clear: clear,
4506 getClass: getClass,
4507 getClasses: getClasses,
4508 addAnnotation: addAnnotation,
4509 getRelations: getRelations,
4510 addRelation: addRelation,
4511 addMember: addMember,
4512 addMembers: addMembers,
4513 cleanupLabel: cleanupLabel,
4514 lineType: lineType,
4515 relationType: relationType,
4516 setClickEvent: setClickEvent,
4517 setCssClass: setCssClass,
4518 setLink: setLink,
4519 lookUpDomId: lookUpDomId
4520});
4521
4522/***/ }),
4523
4524/***/ "./src/diagrams/class/classRenderer-v2.js":
4525/*!************************************************!*\
4526 !*** ./src/diagrams/class/classRenderer-v2.js ***!
4527 \************************************************/
4528/*! exports provided: addClasses, addRelations, setConf, drawOld, draw, default */
4529/***/ (function(module, __webpack_exports__, __webpack_require__) {
4530
4531"use strict";
4532__webpack_require__.r(__webpack_exports__);
4533/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addClasses", function() { return addClasses; });
4534/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addRelations", function() { return addRelations; });
4535/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
4536/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawOld", function() { return drawOld; });
4537/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
4538/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
4539/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
4540/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
4541/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
4542/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
4543/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
4544/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
4545/* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
4546/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
4547/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__);
4548/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/class/svgDraw.js");
4549/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../config */ "./src/config.js");
4550/* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
4551/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
4552/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
4553
4554
4555
4556
4557
4558
4559
4560
4561 // import addHtmlLabel from 'dagre-d3/lib/label/add-html-label.js';
4562
4563
4564
4565
4566_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].yy = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"];
4567var idCache = {};
4568var padding = 20;
4569var conf = {
4570 dividerMargin: 10,
4571 padding: 5,
4572 textHeight: 10
4573};
4574/**
4575 * Function that adds the vertices found during parsing to the graph to be rendered.
4576 * @param vert Object containing the vertices.
4577 * @param g The graph that is to be drawn.
4578 */
4579
4580var addClasses = function addClasses(classes, g) {
4581 // const svg = select(`[id="${svgId}"]`);
4582 var keys = Object.keys(classes);
4583 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('keys:', keys);
4584 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info(classes); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
4585
4586 keys.forEach(function (id) {
4587 var vertex = classes[id];
4588 /**
4589 * Variable for storing the classes for the vertex
4590 * @type {string}
4591 */
4592
4593 var classStr = 'default'; // if (vertex.classes.length > 0) {
4594 // classStr = vertex.classes.join(' ');
4595 // }
4596
4597 var styles = {
4598 labelStyle: ''
4599 }; //getStylesFromArray(vertex.styles);
4600 // Use vertex id as text in the box if no text is provided by the graph definition
4601
4602 var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
4603 // let vertexNode;
4604 // if (getConfig().flowchart.htmlLabels) {
4605 // const node = {
4606 // label: vertexText.replace(
4607 // /fa[lrsb]?:fa-[\w-]+/g,
4608 // s => `<i class='${s.replace(':', ' ')}'></i>`
4609 // )
4610 // };
4611 // vertexNode = addHtmlLabel(svg, node).node();
4612 // vertexNode.parentNode.removeChild(vertexNode);
4613 // } else {
4614 // const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
4615 // svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
4616 // const rows = vertexText.split(common.lineBreakRegex);
4617 // for (let j = 0; j < rows.length; j++) {
4618 // const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
4619 // tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
4620 // tspan.setAttribute('dy', '1em');
4621 // tspan.setAttribute('x', '1');
4622 // tspan.textContent = rows[j];
4623 // svgLabel.appendChild(tspan);
4624 // }
4625 // vertexNode = svgLabel;
4626 // }
4627
4628 var radious = 0;
4629 var _shape = ''; // Set the shape based parameters
4630
4631 switch (vertex.type) {
4632 case 'class':
4633 _shape = 'class_box';
4634 break;
4635
4636 default:
4637 _shape = 'class_box';
4638 } // Add the node
4639
4640
4641 g.setNode(vertex.id, {
4642 labelStyle: styles.labelStyle,
4643 shape: _shape,
4644 labelText: vertexText,
4645 classData: vertex,
4646 rx: radious,
4647 ry: radious,
4648 class: classStr,
4649 style: styles.style,
4650 id: vertex.id,
4651 width: vertex.type === 'group' ? 500 : undefined,
4652 type: vertex.type,
4653 padding: Object(_config__WEBPACK_IMPORTED_MODULE_7__["getConfig"])().flowchart.padding
4654 });
4655 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('setNode', {
4656 labelStyle: styles.labelStyle,
4657 shape: _shape,
4658 labelText: vertexText,
4659 rx: radious,
4660 ry: radious,
4661 class: classStr,
4662 style: styles.style,
4663 id: vertex.id,
4664 width: vertex.type === 'group' ? 500 : undefined,
4665 type: vertex.type,
4666 padding: Object(_config__WEBPACK_IMPORTED_MODULE_7__["getConfig"])().flowchart.padding
4667 });
4668 });
4669};
4670/**
4671 * Add edges to graph based on parsed graph defninition
4672 * @param {Object} edges The edges to add to the graph
4673 * @param {Object} g The graph object
4674 */
4675
4676var addRelations = function addRelations(relations, g) {
4677 var cnt = 0;
4678 var defaultStyle;
4679 var defaultLabelStyle; // if (typeof relations.defaultStyle !== 'undefined') {
4680 // const defaultStyles = getStylesFromArray(relations.defaultStyle);
4681 // defaultStyle = defaultStyles.style;
4682 // defaultLabelStyle = defaultStyles.labelStyle;
4683 // }
4684
4685 relations.forEach(function (edge) {
4686 cnt++;
4687 var edgeData = {}; //Set relationship style and line type
4688
4689 edgeData.classes = 'relation';
4690 edgeData.pattern = edge.relation.lineType == 1 ? 'dashed' : 'solid';
4691 edgeData.id = 'id' + cnt; // Set link type for rendering
4692
4693 if (edge.type === 'arrow_open') {
4694 edgeData.arrowhead = 'none';
4695 } else {
4696 edgeData.arrowhead = 'normal';
4697 }
4698
4699 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info(edgeData, edge); //Set relation arrow types
4700
4701 edgeData.arrowTypeStart = getArrowMarker(edge.relation.type1);
4702 edgeData.arrowTypeEnd = getArrowMarker(edge.relation.type2);
4703 var style = '';
4704 var labelStyle = '';
4705
4706 if (typeof edge.style !== 'undefined') {
4707 var styles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(edge.style);
4708 style = styles.style;
4709 labelStyle = styles.labelStyle;
4710 } else {
4711 style = 'fill:none';
4712
4713 if (typeof defaultStyle !== 'undefined') {
4714 style = defaultStyle;
4715 }
4716
4717 if (typeof defaultLabelStyle !== 'undefined') {
4718 labelStyle = defaultLabelStyle;
4719 }
4720 }
4721
4722 edgeData.style = style;
4723 edgeData.labelStyle = labelStyle;
4724
4725 if (typeof edge.interpolate !== 'undefined') {
4726 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_0__["curveLinear"]);
4727 } else if (typeof relations.defaultInterpolate !== 'undefined') {
4728 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(relations.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_0__["curveLinear"]);
4729 } else {
4730 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(conf.curve, d3__WEBPACK_IMPORTED_MODULE_0__["curveLinear"]);
4731 }
4732
4733 edge.text = edge.title;
4734
4735 if (typeof edge.text === 'undefined') {
4736 if (typeof edge.style !== 'undefined') {
4737 edgeData.arrowheadStyle = 'fill: #333';
4738 }
4739 } else {
4740 edgeData.arrowheadStyle = 'fill: #333';
4741 edgeData.labelpos = 'c';
4742
4743 if (Object(_config__WEBPACK_IMPORTED_MODULE_7__["getConfig"])().flowchart.htmlLabels && false) {
4744 // eslint-disable-line
4745 edgeData.labelType = 'html';
4746 edgeData.label = '<span class="edgeLabel">' + edge.text + '</span>';
4747 } else {
4748 edgeData.labelType = 'text';
4749 edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_10__["default"].lineBreakRegex, '\n');
4750
4751 if (typeof edge.style === 'undefined') {
4752 edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
4753 }
4754
4755 edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
4756 }
4757 } // Add the edge to the graph
4758
4759
4760 g.setEdge(edge.id1, edge.id2, edgeData, cnt);
4761 });
4762}; // Todo optimize
4763
4764var getGraphId = function getGraphId(label) {
4765 var keys = Object.keys(idCache);
4766
4767 for (var i = 0; i < keys.length; i++) {
4768 if (idCache[keys[i]].label === label) {
4769 return keys[i];
4770 }
4771 }
4772
4773 return undefined;
4774};
4775
4776var setConf = function setConf(cnf) {
4777 var keys = Object.keys(cnf);
4778 keys.forEach(function (key) {
4779 conf[key] = cnf[key];
4780 });
4781};
4782/**
4783 * Draws a flowchart in the tag with id: id based on the graph definition in text.
4784 * @param text
4785 * @param id
4786 */
4787
4788var drawOld = function drawOld(text, id) {
4789 idCache = {};
4790 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].yy.clear();
4791 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].parse(text);
4792 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
4793
4794 var diagram = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id='".concat(id, "']")); // insertMarkers(diagram);
4795 // Layout graph, Create a new directed graph
4796
4797 var g = new graphlib__WEBPACK_IMPORTED_MODULE_2___default.a.Graph({
4798 multigraph: true
4799 }); // Set an object for the graph label
4800
4801 g.setGraph({
4802 isMultiGraph: true
4803 }); // Default to assigning a new object as a label for each new edge.
4804
4805 g.setDefaultEdgeLabel(function () {
4806 return {};
4807 });
4808 var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
4809 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('classes:');
4810 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info(classes);
4811 var keys = Object.keys(classes);
4812
4813 for (var i = 0; i < keys.length; i++) {
4814 var classDef = classes[keys[i]];
4815 var node = _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawClass(diagram, classDef, conf);
4816 idCache[node.id] = node; // Add nodes to the graph. The first argument is the node id. The second is
4817 // metadata about the node. In this case we're going to add labels to each of
4818 // our nodes.
4819
4820 g.setNode(node.id, node);
4821 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Org height: ' + node.height);
4822 }
4823
4824 var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
4825 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('relations:', relations);
4826 relations.forEach(function (relation) {
4827 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation));
4828 g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), {
4829 relation: relation
4830 }, relation.title || 'DEFAULT');
4831 });
4832 dagre__WEBPACK_IMPORTED_MODULE_1___default.a.layout(g);
4833 g.nodes().forEach(function (v) {
4834 if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
4835 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
4836 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + Object(_classDb__WEBPACK_IMPORTED_MODULE_4__["lookUpDomId"])(v)).attr('transform', 'translate(' + (g.node(v).x - g.node(v).width / 2) + ',' + (g.node(v).y - g.node(v).height / 2) + ' )');
4837 }
4838 });
4839 g.edges().forEach(function (e) {
4840 if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
4841 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
4842 _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawEdge(diagram, g.edge(e), g.edge(e).relation, conf);
4843 }
4844 });
4845 var svgBounds = diagram.node().getBBox();
4846 var width = svgBounds.width + padding * 2;
4847 var height = svgBounds.height + padding * 2;
4848
4849 if (conf.useMaxWidth) {
4850 diagram.attr('width', '100%');
4851 diagram.attr('style', "max-width: ".concat(width, "px;"));
4852 } else {
4853 diagram.attr('height', height);
4854 diagram.attr('width', width);
4855 } // Ensure the viewBox includes the whole svgBounds area with extra space for padding
4856
4857
4858 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
4859 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug("viewBox ".concat(vBox));
4860 diagram.attr('viewBox', vBox);
4861};
4862var draw = function draw(text, id) {
4863 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Drawing class');
4864 _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].clear(); // const parser = classDb.parser;
4865 // parser.yy = classDb;
4866 // Parse the graph definition
4867 // try {
4868
4869 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].parse(text); // } catch (err) {
4870 // logger.debug('Parsing failed');
4871 // }
4872 // Fetch the default direction, use TD if none was found
4873
4874 var dir = 'TD';
4875 var conf = Object(_config__WEBPACK_IMPORTED_MODULE_7__["getConfig"])().flowchart;
4876 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('config:', conf);
4877 var nodeSpacing = conf.nodeSpacing || 50;
4878 var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
4879
4880 var g = new graphlib__WEBPACK_IMPORTED_MODULE_2___default.a.Graph({
4881 multigraph: true,
4882 compound: true
4883 }).setGraph({
4884 rankdir: dir,
4885 nodesep: nodeSpacing,
4886 ranksep: rankSpacing,
4887 marginx: 8,
4888 marginy: 8
4889 }).setDefaultEdgeLabel(function () {
4890 return {};
4891 }); // let subG;
4892 // const subGraphs = flowDb.getSubGraphs();
4893 // logger.info('Subgraphs - ', subGraphs);
4894 // for (let i = subGraphs.length - 1; i >= 0; i--) {
4895 // subG = subGraphs[i];
4896 // logger.info('Subgraph - ', subG);
4897 // flowDb.addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
4898 // }
4899 // Fetch the verices/nodes and edges/links from the parsed graph definition
4900
4901 var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
4902 var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
4903 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info(relations); // let i = 0;
4904 // for (i = subGraphs.length - 1; i >= 0; i--) {
4905 // subG = subGraphs[i];
4906 // selectAll('cluster').append('text');
4907 // for (let j = 0; j < subG.nodes.length; j++) {
4908 // g.setParent(subG.nodes[j], subG.id);
4909 // }
4910 // }
4911
4912 addClasses(classes, g, id);
4913 addRelations(relations, g); // Add custom shapes
4914 // flowChartShapes.addToRenderV2(addShape);
4915 // Set up an SVG group so that we can translate the final graph.
4916
4917 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id=\"".concat(id, "\"]")); // Run the renderer. This is what draws the final graph.
4918
4919 var element = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + id + ' g');
4920 Object(_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_8__["render"])(element, g, ['aggregation', 'extension', 'composition', 'dependency'], 'classDiagram', id); // element.selectAll('g.node').attr('title', function() {
4921 // return flowDb.getTooltip(this.id);
4922 // });
4923
4924 var padding = 8;
4925 var svgBounds = svg.node().getBBox();
4926 var width = svgBounds.width + padding * 2;
4927 var height = svgBounds.height + padding * 2;
4928 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug("new ViewBox 0 0 ".concat(width, " ").concat(height), "translate(".concat(padding - g._label.marginx, ", ").concat(padding - g._label.marginy, ")"));
4929
4930 if (conf.useMaxWidth) {
4931 svg.attr('width', '100%');
4932 svg.attr('style', "max-width: ".concat(width, "px;"));
4933 } else {
4934 svg.attr('height', height);
4935 svg.attr('width', width);
4936 }
4937
4938 svg.attr('viewBox', "0 0 ".concat(width, " ").concat(height));
4939 svg.select('g').attr('transform', "translate(".concat(padding - g._label.marginx, ", ").concat(padding - svgBounds.y, ")")); // Index nodes
4940 // flowDb.indexNodes('subGraph' + i);
4941 // Add label rects for non html labels
4942
4943 if (!conf.htmlLabels) {
4944 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
4945
4946 for (var k = 0; k < labels.length; k++) {
4947 var label = labels[k]; // Get dimensions of label
4948
4949 var dim = label.getBBox();
4950 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
4951 rect.setAttribute('rx', 0);
4952 rect.setAttribute('ry', 0);
4953 rect.setAttribute('width', dim.width);
4954 rect.setAttribute('height', dim.height);
4955 rect.setAttribute('style', 'fill:#e8e8e8;');
4956 label.insertBefore(rect, label.firstChild);
4957 }
4958 } // If node has a link, wrap it in an anchor SVG object.
4959 // const keys = Object.keys(classes);
4960 // keys.forEach(function(key) {
4961 // const vertex = classes[key];
4962 // if (vertex.link) {
4963 // const node = select('#' + id + ' [id="' + key + '"]');
4964 // if (node) {
4965 // const link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
4966 // link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
4967 // link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
4968 // link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
4969 // const linkNode = node.insert(function() {
4970 // return link;
4971 // }, ':first-child');
4972 // const shape = node.select('.label-container');
4973 // if (shape) {
4974 // linkNode.append(function() {
4975 // return shape.node();
4976 // });
4977 // }
4978 // const label = node.select('.label');
4979 // if (label) {
4980 // linkNode.append(function() {
4981 // return label.node();
4982 // });
4983 // }
4984 // }
4985 // }
4986 // });
4987
4988};
4989/* harmony default export */ __webpack_exports__["default"] = ({
4990 setConf: setConf,
4991 draw: draw
4992});
4993
4994function getArrowMarker(type) {
4995 var marker;
4996
4997 switch (type) {
4998 case 0:
4999 marker = 'aggregation';
5000 break;
5001
5002 case 1:
5003 marker = 'extension';
5004 break;
5005
5006 case 2:
5007 marker = 'composition';
5008 break;
5009
5010 case 3:
5011 marker = 'dependency';
5012 break;
5013
5014 default:
5015 marker = 'none';
5016 }
5017
5018 return marker;
5019}
5020
5021/***/ }),
5022
5023/***/ "./src/diagrams/class/classRenderer.js":
5024/*!*********************************************!*\
5025 !*** ./src/diagrams/class/classRenderer.js ***!
5026 \*********************************************/
5027/*! exports provided: setConf, draw, default */
5028/***/ (function(module, __webpack_exports__, __webpack_require__) {
5029
5030"use strict";
5031__webpack_require__.r(__webpack_exports__);
5032/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
5033/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
5034/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
5035/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
5036/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
5037/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
5038/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
5039/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
5040/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
5041/* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
5042/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
5043/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__);
5044/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/class/svgDraw.js");
5045
5046
5047
5048
5049
5050
5051
5052_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].yy = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"];
5053var idCache = {};
5054var padding = 20;
5055var conf = {
5056 dividerMargin: 10,
5057 padding: 5,
5058 textHeight: 10
5059}; // Todo optimize
5060
5061var getGraphId = function getGraphId(label) {
5062 var keys = Object.keys(idCache);
5063
5064 for (var i = 0; i < keys.length; i++) {
5065 if (idCache[keys[i]].label === label) {
5066 return keys[i];
5067 }
5068 }
5069
5070 return undefined;
5071};
5072/**
5073 * Setup arrow head and define the marker. The result is appended to the svg.
5074 */
5075
5076
5077var insertMarkers = function insertMarkers(elem) {
5078 elem.append('defs').append('marker').attr('id', 'extensionStart').attr('class', 'extension').attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 1,7 L18,13 V 1 Z');
5079 elem.append('defs').append('marker').attr('id', 'extensionEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 1,1 V 13 L18,7 Z'); // this is actual shape for arrowhead
5080
5081 elem.append('defs').append('marker').attr('id', 'compositionStart').attr('class', 'extension').attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
5082 elem.append('defs').append('marker').attr('id', 'compositionEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
5083 elem.append('defs').append('marker').attr('id', 'aggregationStart').attr('class', 'extension').attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
5084 elem.append('defs').append('marker').attr('id', 'aggregationEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
5085 elem.append('defs').append('marker').attr('id', 'dependencyStart').attr('class', 'extension').attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 5,7 L9,13 L1,7 L9,1 Z');
5086 elem.append('defs').append('marker').attr('id', 'dependencyEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L14,7 L9,1 Z');
5087};
5088
5089var setConf = function setConf(cnf) {
5090 var keys = Object.keys(cnf);
5091 keys.forEach(function (key) {
5092 conf[key] = cnf[key];
5093 });
5094};
5095/**
5096 * Draws a flowchart in the tag with id: id based on the graph definition in text.
5097 * @param text
5098 * @param id
5099 */
5100
5101var draw = function draw(text, id) {
5102 idCache = {};
5103 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].yy.clear();
5104 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].parse(text);
5105 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
5106
5107 var diagram = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id='".concat(id, "']"));
5108 insertMarkers(diagram); // Layout graph, Create a new directed graph
5109
5110 var g = new graphlib__WEBPACK_IMPORTED_MODULE_2___default.a.Graph({
5111 multigraph: true
5112 }); // Set an object for the graph label
5113
5114 g.setGraph({
5115 isMultiGraph: true
5116 }); // Default to assigning a new object as a label for each new edge.
5117
5118 g.setDefaultEdgeLabel(function () {
5119 return {};
5120 });
5121 var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
5122 var keys = Object.keys(classes);
5123
5124 for (var i = 0; i < keys.length; i++) {
5125 var classDef = classes[keys[i]];
5126 var node = _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawClass(diagram, classDef, conf);
5127 idCache[node.id] = node; // Add nodes to the graph. The first argument is the node id. The second is
5128 // metadata about the node. In this case we're going to add labels to each of
5129 // our nodes.
5130
5131 g.setNode(node.id, node);
5132 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Org height: ' + node.height);
5133 }
5134
5135 var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
5136 relations.forEach(function (relation) {
5137 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation));
5138 g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), {
5139 relation: relation
5140 }, relation.title || 'DEFAULT');
5141 });
5142 dagre__WEBPACK_IMPORTED_MODULE_1___default.a.layout(g);
5143 g.nodes().forEach(function (v) {
5144 if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
5145 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
5146 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + Object(_classDb__WEBPACK_IMPORTED_MODULE_4__["lookUpDomId"])(v)).attr('transform', 'translate(' + (g.node(v).x - g.node(v).width / 2) + ',' + (g.node(v).y - g.node(v).height / 2) + ' )');
5147 }
5148 });
5149 g.edges().forEach(function (e) {
5150 if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
5151 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
5152 _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawEdge(diagram, g.edge(e), g.edge(e).relation, conf);
5153 }
5154 });
5155 var svgBounds = diagram.node().getBBox();
5156 var width = svgBounds.width + padding * 2;
5157 var height = svgBounds.height + padding * 2;
5158
5159 if (conf.useMaxWidth) {
5160 diagram.attr('width', '100%');
5161 diagram.attr('style', "max-width: ".concat(width, "px;"));
5162 } else {
5163 diagram.attr('height', height);
5164 diagram.attr('width', width);
5165 } // Ensure the viewBox includes the whole svgBounds area with extra space for padding
5166
5167
5168 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
5169 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug("viewBox ".concat(vBox));
5170 diagram.attr('viewBox', vBox);
5171};
5172/* harmony default export */ __webpack_exports__["default"] = ({
5173 setConf: setConf,
5174 draw: draw
5175});
5176
5177/***/ }),
5178
5179/***/ "./src/diagrams/class/parser/classDiagram.jison":
5180/*!******************************************************!*\
5181 !*** ./src/diagrams/class/parser/classDiagram.jison ***!
5182 \******************************************************/
5183/*! no static exports found */
5184/***/ (function(module, exports, __webpack_require__) {
5185
5186/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
5187/*
5188 Returns a Parser object of the following structure:
5189
5190 Parser: {
5191 yy: {}
5192 }
5193
5194 Parser.prototype: {
5195 yy: {},
5196 trace: function(),
5197 symbols_: {associative list: name ==> number},
5198 terminals_: {associative list: number ==> name},
5199 productions_: [...],
5200 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
5201 table: [...],
5202 defaultActions: {...},
5203 parseError: function(str, hash),
5204 parse: function(input),
5205
5206 lexer: {
5207 EOF: 1,
5208 parseError: function(str, hash),
5209 setInput: function(input),
5210 input: function(),
5211 unput: function(str),
5212 more: function(),
5213 less: function(n),
5214 pastInput: function(),
5215 upcomingInput: function(),
5216 showPosition: function(),
5217 test_match: function(regex_match_array, rule_index),
5218 next: function(),
5219 lex: function(),
5220 begin: function(condition),
5221 popState: function(),
5222 _currentRules: function(),
5223 topState: function(),
5224 pushState: function(condition),
5225
5226 options: {
5227 ranges: boolean (optional: true ==> token location info will include a .range[] member)
5228 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
5229 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
5230 },
5231
5232 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
5233 rules: [...],
5234 conditions: {associative list: name ==> set},
5235 }
5236 }
5237
5238
5239 token location info (@$, _$, etc.): {
5240 first_line: n,
5241 last_line: n,
5242 first_column: n,
5243 last_column: n,
5244 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
5245 }
5246
5247
5248 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
5249 text: (matched text)
5250 token: (the produced terminal token, if any)
5251 line: (yylineno)
5252 }
5253 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
5254 loc: (yylloc)
5255 expected: (string describing the set of expected tokens)
5256 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
5257 }
5258*/
5259var parser = (function(){
5260var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,7],$V1=[1,6],$V2=[1,14],$V3=[1,25],$V4=[1,28],$V5=[1,26],$V6=[1,27],$V7=[1,29],$V8=[1,30],$V9=[1,31],$Va=[1,33],$Vb=[1,34],$Vc=[1,35],$Vd=[10,19],$Ve=[1,47],$Vf=[1,48],$Vg=[1,49],$Vh=[1,50],$Vi=[1,51],$Vj=[1,52],$Vk=[10,19,25,32,33,41,44,45,46,47,48,49],$Vl=[10,19,23,25,32,33,37,41,44,45,46,47,48,49,66,67,68],$Vm=[10,13,17,19],$Vn=[41,66,67,68],$Vo=[41,48,49,66,67,68],$Vp=[41,44,45,46,47,66,67,68],$Vq=[10,19,25],$Vr=[1,81];
5261var parser = {trace: function trace () { },
5262yy: {},
5263symbols_: {"error":2,"start":3,"mermaidDoc":4,"directive":5,"graphConfig":6,"openDirective":7,"typeDirective":8,"closeDirective":9,"NEWLINE":10,":":11,"argDirective":12,"open_directive":13,"type_directive":14,"arg_directive":15,"close_directive":16,"CLASS_DIAGRAM":17,"statements":18,"EOF":19,"statement":20,"className":21,"alphaNumToken":22,"GENERICTYPE":23,"relationStatement":24,"LABEL":25,"classStatement":26,"methodStatement":27,"annotationStatement":28,"clickStatement":29,"cssClassStatement":30,"CLASS":31,"STYLE_SEPARATOR":32,"STRUCT_START":33,"members":34,"STRUCT_STOP":35,"ANNOTATION_START":36,"ANNOTATION_END":37,"MEMBER":38,"SEPARATOR":39,"relation":40,"STR":41,"relationType":42,"lineType":43,"AGGREGATION":44,"EXTENSION":45,"COMPOSITION":46,"DEPENDENCY":47,"LINE":48,"DOTTED_LINE":49,"CALLBACK":50,"LINK":51,"CSSCLASS":52,"commentToken":53,"textToken":54,"graphCodeTokens":55,"textNoTagsToken":56,"TAGSTART":57,"TAGEND":58,"==":59,"--":60,"PCT":61,"DEFAULT":62,"SPACE":63,"MINUS":64,"keywords":65,"UNICODE_TEXT":66,"NUM":67,"ALPHA":68,"$accept":0,"$end":1},
5264terminals_: {2:"error",10:"NEWLINE",11:":",13:"open_directive",14:"type_directive",15:"arg_directive",16:"close_directive",17:"CLASS_DIAGRAM",19:"EOF",23:"GENERICTYPE",25:"LABEL",31:"CLASS",32:"STYLE_SEPARATOR",33:"STRUCT_START",35:"STRUCT_STOP",36:"ANNOTATION_START",37:"ANNOTATION_END",38:"MEMBER",39:"SEPARATOR",41:"STR",44:"AGGREGATION",45:"EXTENSION",46:"COMPOSITION",47:"DEPENDENCY",48:"LINE",49:"DOTTED_LINE",50:"CALLBACK",51:"LINK",52:"CSSCLASS",55:"graphCodeTokens",57:"TAGSTART",58:"TAGEND",59:"==",60:"--",61:"PCT",62:"DEFAULT",63:"SPACE",64:"MINUS",65:"keywords",66:"UNICODE_TEXT",67:"NUM",68:"ALPHA"},
5265productions_: [0,[3,1],[3,2],[4,1],[5,4],[5,6],[7,1],[8,1],[12,1],[9,1],[6,4],[18,1],[18,2],[18,3],[21,1],[21,2],[21,3],[21,2],[20,1],[20,2],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[26,2],[26,4],[26,5],[26,7],[28,4],[34,1],[34,2],[27,1],[27,2],[27,1],[27,1],[24,3],[24,4],[24,4],[24,5],[40,3],[40,2],[40,2],[40,1],[42,1],[42,1],[42,1],[42,1],[43,1],[43,1],[29,3],[29,4],[29,3],[29,4],[30,3],[53,1],[53,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[56,1],[56,1],[56,1],[56,1],[22,1],[22,1],[22,1]],
5266performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
5267/* this == yyval */
5268
5269var $0 = $$.length - 1;
5270switch (yystate) {
5271case 6:
5272 yy.parseDirective('%%{', 'open_directive');
5273break;
5274case 7:
5275 yy.parseDirective($$[$0], 'type_directive');
5276break;
5277case 8:
5278 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
5279break;
5280case 9:
5281 yy.parseDirective('}%%', 'close_directive', 'class');
5282break;
5283case 14:
5284 this.$=$$[$0];
5285break;
5286case 15:
5287 this.$=$$[$0-1]+$$[$0];
5288break;
5289case 16:
5290 this.$=$$[$0-2]+'~'+$$[$0-1]+$$[$0];
5291break;
5292case 17:
5293 this.$=$$[$0-1]+'~'+$$[$0];
5294break;
5295case 18:
5296 yy.addRelation($$[$0]);
5297break;
5298case 19:
5299 $$[$0-1].title = yy.cleanupLabel($$[$0]); yy.addRelation($$[$0-1]);
5300break;
5301case 26:
5302yy.addClass($$[$0]);
5303break;
5304case 27:
5305yy.addClass($$[$0-2]);yy.setCssClass($$[$0-2], $$[$0]);
5306break;
5307case 28:
5308/*console.log($$[$0-3],JSON.stringify($$[$0-1]));*/yy.addClass($$[$0-3]);yy.addMembers($$[$0-3],$$[$0-1]);
5309break;
5310case 29:
5311yy.addClass($$[$0-5]);yy.setCssClass($$[$0-5], $$[$0-3]);yy.addMembers($$[$0-5],$$[$0-1]);
5312break;
5313case 30:
5314 yy.addAnnotation($$[$0],$$[$0-2]);
5315break;
5316case 31:
5317 this.$ = [$$[$0]];
5318break;
5319case 32:
5320 $$[$0].push($$[$0-1]);this.$=$$[$0];
5321break;
5322case 33:
5323/*console.log('Rel found',$$[$0]);*/
5324break;
5325case 34:
5326yy.addMember($$[$0-1],yy.cleanupLabel($$[$0]));
5327break;
5328case 35:
5329/*console.warn('Member',$$[$0]);*/
5330break;
5331case 36:
5332/*console.log('sep found',$$[$0]);*/
5333break;
5334case 37:
5335 this.$ = {'id1':$$[$0-2],'id2':$$[$0], relation:$$[$0-1], relationTitle1:'none', relationTitle2:'none'};
5336break;
5337case 38:
5338 this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-1], relationTitle1:$$[$0-2], relationTitle2:'none'}
5339break;
5340case 39:
5341 this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-2], relationTitle1:'none', relationTitle2:$$[$0-1]};
5342break;
5343case 40:
5344 this.$ = {id1:$$[$0-4], id2:$$[$0], relation:$$[$0-2], relationTitle1:$$[$0-3], relationTitle2:$$[$0-1]}
5345break;
5346case 41:
5347 this.$={type1:$$[$0-2],type2:$$[$0],lineType:$$[$0-1]};
5348break;
5349case 42:
5350 this.$={type1:'none',type2:$$[$0],lineType:$$[$0-1]};
5351break;
5352case 43:
5353 this.$={type1:$$[$0-1],type2:'none',lineType:$$[$0]};
5354break;
5355case 44:
5356 this.$={type1:'none',type2:'none',lineType:$$[$0]};
5357break;
5358case 45:
5359 this.$=yy.relationType.AGGREGATION;
5360break;
5361case 46:
5362 this.$=yy.relationType.EXTENSION;
5363break;
5364case 47:
5365 this.$=yy.relationType.COMPOSITION;
5366break;
5367case 48:
5368 this.$=yy.relationType.DEPENDENCY;
5369break;
5370case 49:
5371this.$=yy.lineType.LINE;
5372break;
5373case 50:
5374this.$=yy.lineType.DOTTED_LINE;
5375break;
5376case 51:
5377this.$ = $$[$0-2];yy.setClickEvent($$[$0-1], $$[$0], undefined);
5378break;
5379case 52:
5380this.$ = $$[$0-3];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
5381break;
5382case 53:
5383this.$ = $$[$0-2];yy.setLink($$[$0-1], $$[$0], undefined);
5384break;
5385case 54:
5386this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1], $$[$0]);
5387break;
5388case 55:
5389yy.setCssClass($$[$0-1], $$[$0]);
5390break;
5391}
5392},
5393table: [{3:1,4:2,5:3,6:4,7:5,13:$V0,17:$V1},{1:[3]},{1:[2,1]},{3:8,4:2,5:3,6:4,7:5,13:$V0,17:$V1},{1:[2,3]},{8:9,14:[1,10]},{10:[1,11]},{14:[2,6]},{1:[2,2]},{9:12,11:[1,13],16:$V2},o([11,16],[2,7]),{5:23,7:5,13:$V0,18:15,20:16,21:24,22:32,24:17,26:18,27:19,28:20,29:21,30:22,31:$V3,36:$V4,38:$V5,39:$V6,50:$V7,51:$V8,52:$V9,66:$Va,67:$Vb,68:$Vc},{10:[1,36]},{12:37,15:[1,38]},{10:[2,9]},{19:[1,39]},{10:[1,40],19:[2,11]},o($Vd,[2,18],{25:[1,41]}),o($Vd,[2,20]),o($Vd,[2,21]),o($Vd,[2,22]),o($Vd,[2,23]),o($Vd,[2,24]),o($Vd,[2,25]),o($Vd,[2,33],{40:42,42:45,43:46,25:[1,44],41:[1,43],44:$Ve,45:$Vf,46:$Vg,47:$Vh,48:$Vi,49:$Vj}),{21:53,22:32,66:$Va,67:$Vb,68:$Vc},o($Vd,[2,35]),o($Vd,[2,36]),{22:54,66:$Va,67:$Vb,68:$Vc},{21:55,22:32,66:$Va,67:$Vb,68:$Vc},{21:56,22:32,66:$Va,67:$Vb,68:$Vc},{41:[1,57]},o($Vk,[2,14],{22:32,21:58,23:[1,59],66:$Va,67:$Vb,68:$Vc}),o($Vl,[2,69]),o($Vl,[2,70]),o($Vl,[2,71]),o($Vm,[2,4]),{9:60,16:$V2},{16:[2,8]},{1:[2,10]},{5:23,7:5,13:$V0,18:61,19:[2,12],20:16,21:24,22:32,24:17,26:18,27:19,28:20,29:21,30:22,31:$V3,36:$V4,38:$V5,39:$V6,50:$V7,51:$V8,52:$V9,66:$Va,67:$Vb,68:$Vc},o($Vd,[2,19]),{21:62,22:32,41:[1,63],66:$Va,67:$Vb,68:$Vc},{40:64,42:45,43:46,44:$Ve,45:$Vf,46:$Vg,47:$Vh,48:$Vi,49:$Vj},o($Vd,[2,34]),{43:65,48:$Vi,49:$Vj},o($Vn,[2,44],{42:66,44:$Ve,45:$Vf,46:$Vg,47:$Vh}),o($Vo,[2,45]),o($Vo,[2,46]),o($Vo,[2,47]),o($Vo,[2,48]),o($Vp,[2,49]),o($Vp,[2,50]),o($Vd,[2,26],{32:[1,67],33:[1,68]}),{37:[1,69]},{41:[1,70]},{41:[1,71]},{22:72,66:$Va,67:$Vb,68:$Vc},o($Vk,[2,15]),o($Vk,[2,17],{22:32,21:73,66:$Va,67:$Vb,68:$Vc}),{10:[1,74]},{19:[2,13]},o($Vq,[2,37]),{21:75,22:32,66:$Va,67:$Vb,68:$Vc},{21:76,22:32,41:[1,77],66:$Va,67:$Vb,68:$Vc},o($Vn,[2,43],{42:78,44:$Ve,45:$Vf,46:$Vg,47:$Vh}),o($Vn,[2,42]),{22:79,66:$Va,67:$Vb,68:$Vc},{34:80,38:$Vr},{21:82,22:32,66:$Va,67:$Vb,68:$Vc},o($Vd,[2,51],{41:[1,83]}),o($Vd,[2,53],{41:[1,84]}),o($Vd,[2,55]),o($Vk,[2,16]),o($Vm,[2,5]),o($Vq,[2,39]),o($Vq,[2,38]),{21:85,22:32,66:$Va,67:$Vb,68:$Vc},o($Vn,[2,41]),o($Vd,[2,27],{33:[1,86]}),{35:[1,87]},{34:88,35:[2,31],38:$Vr},o($Vd,[2,30]),o($Vd,[2,52]),o($Vd,[2,54]),o($Vq,[2,40]),{34:89,38:$Vr},o($Vd,[2,28]),{35:[2,32]},{35:[1,90]},o($Vd,[2,29])],
5394defaultActions: {2:[2,1],4:[2,3],7:[2,6],8:[2,2],14:[2,9],38:[2,8],39:[2,10],61:[2,13],88:[2,32]},
5395parseError: function parseError (str, hash) {
5396 if (hash.recoverable) {
5397 this.trace(str);
5398 } else {
5399 var error = new Error(str);
5400 error.hash = hash;
5401 throw error;
5402 }
5403},
5404parse: function parse(input) {
5405 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
5406 var args = lstack.slice.call(arguments, 1);
5407 var lexer = Object.create(this.lexer);
5408 var sharedState = { yy: {} };
5409 for (var k in this.yy) {
5410 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
5411 sharedState.yy[k] = this.yy[k];
5412 }
5413 }
5414 lexer.setInput(input, sharedState.yy);
5415 sharedState.yy.lexer = lexer;
5416 sharedState.yy.parser = this;
5417 if (typeof lexer.yylloc == 'undefined') {
5418 lexer.yylloc = {};
5419 }
5420 var yyloc = lexer.yylloc;
5421 lstack.push(yyloc);
5422 var ranges = lexer.options && lexer.options.ranges;
5423 if (typeof sharedState.yy.parseError === 'function') {
5424 this.parseError = sharedState.yy.parseError;
5425 } else {
5426 this.parseError = Object.getPrototypeOf(this).parseError;
5427 }
5428 function popStack(n) {
5429 stack.length = stack.length - 2 * n;
5430 vstack.length = vstack.length - n;
5431 lstack.length = lstack.length - n;
5432 }
5433 function lex() {
5434 var token;
5435 token = tstack.pop() || lexer.lex() || EOF;
5436 if (typeof token !== 'number') {
5437 if (token instanceof Array) {
5438 tstack = token;
5439 token = tstack.pop();
5440 }
5441 token = self.symbols_[token] || token;
5442 }
5443 return token;
5444 }
5445 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
5446 while (true) {
5447 state = stack[stack.length - 1];
5448 if (this.defaultActions[state]) {
5449 action = this.defaultActions[state];
5450 } else {
5451 if (symbol === null || typeof symbol == 'undefined') {
5452 symbol = lex();
5453 }
5454 action = table[state] && table[state][symbol];
5455 }
5456 if (typeof action === 'undefined' || !action.length || !action[0]) {
5457 var errStr = '';
5458 expected = [];
5459 for (p in table[state]) {
5460 if (this.terminals_[p] && p > TERROR) {
5461 expected.push('\'' + this.terminals_[p] + '\'');
5462 }
5463 }
5464 if (lexer.showPosition) {
5465 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
5466 } else {
5467 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
5468 }
5469 this.parseError(errStr, {
5470 text: lexer.match,
5471 token: this.terminals_[symbol] || symbol,
5472 line: lexer.yylineno,
5473 loc: yyloc,
5474 expected: expected
5475 });
5476 }
5477 if (action[0] instanceof Array && action.length > 1) {
5478 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
5479 }
5480 switch (action[0]) {
5481 case 1:
5482 stack.push(symbol);
5483 vstack.push(lexer.yytext);
5484 lstack.push(lexer.yylloc);
5485 stack.push(action[1]);
5486 symbol = null;
5487 if (!preErrorSymbol) {
5488 yyleng = lexer.yyleng;
5489 yytext = lexer.yytext;
5490 yylineno = lexer.yylineno;
5491 yyloc = lexer.yylloc;
5492 if (recovering > 0) {
5493 recovering--;
5494 }
5495 } else {
5496 symbol = preErrorSymbol;
5497 preErrorSymbol = null;
5498 }
5499 break;
5500 case 2:
5501 len = this.productions_[action[1]][1];
5502 yyval.$ = vstack[vstack.length - len];
5503 yyval._$ = {
5504 first_line: lstack[lstack.length - (len || 1)].first_line,
5505 last_line: lstack[lstack.length - 1].last_line,
5506 first_column: lstack[lstack.length - (len || 1)].first_column,
5507 last_column: lstack[lstack.length - 1].last_column
5508 };
5509 if (ranges) {
5510 yyval._$.range = [
5511 lstack[lstack.length - (len || 1)].range[0],
5512 lstack[lstack.length - 1].range[1]
5513 ];
5514 }
5515 r = this.performAction.apply(yyval, [
5516 yytext,
5517 yyleng,
5518 yylineno,
5519 sharedState.yy,
5520 action[1],
5521 vstack,
5522 lstack
5523 ].concat(args));
5524 if (typeof r !== 'undefined') {
5525 return r;
5526 }
5527 if (len) {
5528 stack = stack.slice(0, -1 * len * 2);
5529 vstack = vstack.slice(0, -1 * len);
5530 lstack = lstack.slice(0, -1 * len);
5531 }
5532 stack.push(this.productions_[action[1]][0]);
5533 vstack.push(yyval.$);
5534 lstack.push(yyval._$);
5535 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
5536 stack.push(newState);
5537 break;
5538 case 3:
5539 return true;
5540 }
5541 }
5542 return true;
5543}};
5544
5545/* generated by jison-lex 0.3.4 */
5546var lexer = (function(){
5547var lexer = ({
5548
5549EOF:1,
5550
5551parseError:function parseError(str, hash) {
5552 if (this.yy.parser) {
5553 this.yy.parser.parseError(str, hash);
5554 } else {
5555 throw new Error(str);
5556 }
5557 },
5558
5559// resets the lexer, sets new input
5560setInput:function (input, yy) {
5561 this.yy = yy || this.yy || {};
5562 this._input = input;
5563 this._more = this._backtrack = this.done = false;
5564 this.yylineno = this.yyleng = 0;
5565 this.yytext = this.matched = this.match = '';
5566 this.conditionStack = ['INITIAL'];
5567 this.yylloc = {
5568 first_line: 1,
5569 first_column: 0,
5570 last_line: 1,
5571 last_column: 0
5572 };
5573 if (this.options.ranges) {
5574 this.yylloc.range = [0,0];
5575 }
5576 this.offset = 0;
5577 return this;
5578 },
5579
5580// consumes and returns one char from the input
5581input:function () {
5582 var ch = this._input[0];
5583 this.yytext += ch;
5584 this.yyleng++;
5585 this.offset++;
5586 this.match += ch;
5587 this.matched += ch;
5588 var lines = ch.match(/(?:\r\n?|\n).*/g);
5589 if (lines) {
5590 this.yylineno++;
5591 this.yylloc.last_line++;
5592 } else {
5593 this.yylloc.last_column++;
5594 }
5595 if (this.options.ranges) {
5596 this.yylloc.range[1]++;
5597 }
5598
5599 this._input = this._input.slice(1);
5600 return ch;
5601 },
5602
5603// unshifts one char (or a string) into the input
5604unput:function (ch) {
5605 var len = ch.length;
5606 var lines = ch.split(/(?:\r\n?|\n)/g);
5607
5608 this._input = ch + this._input;
5609 this.yytext = this.yytext.substr(0, this.yytext.length - len);
5610 //this.yyleng -= len;
5611 this.offset -= len;
5612 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
5613 this.match = this.match.substr(0, this.match.length - 1);
5614 this.matched = this.matched.substr(0, this.matched.length - 1);
5615
5616 if (lines.length - 1) {
5617 this.yylineno -= lines.length - 1;
5618 }
5619 var r = this.yylloc.range;
5620
5621 this.yylloc = {
5622 first_line: this.yylloc.first_line,
5623 last_line: this.yylineno + 1,
5624 first_column: this.yylloc.first_column,
5625 last_column: lines ?
5626 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
5627 + oldLines[oldLines.length - lines.length].length - lines[0].length :
5628 this.yylloc.first_column - len
5629 };
5630
5631 if (this.options.ranges) {
5632 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
5633 }
5634 this.yyleng = this.yytext.length;
5635 return this;
5636 },
5637
5638// When called from action, caches matched text and appends it on next action
5639more:function () {
5640 this._more = true;
5641 return this;
5642 },
5643
5644// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
5645reject:function () {
5646 if (this.options.backtrack_lexer) {
5647 this._backtrack = true;
5648 } else {
5649 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
5650 text: "",
5651 token: null,
5652 line: this.yylineno
5653 });
5654
5655 }
5656 return this;
5657 },
5658
5659// retain first n characters of the match
5660less:function (n) {
5661 this.unput(this.match.slice(n));
5662 },
5663
5664// displays already matched input, i.e. for error messages
5665pastInput:function () {
5666 var past = this.matched.substr(0, this.matched.length - this.match.length);
5667 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
5668 },
5669
5670// displays upcoming input, i.e. for error messages
5671upcomingInput:function () {
5672 var next = this.match;
5673 if (next.length < 20) {
5674 next += this._input.substr(0, 20-next.length);
5675 }
5676 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
5677 },
5678
5679// displays the character position where the lexing error occurred, i.e. for error messages
5680showPosition:function () {
5681 var pre = this.pastInput();
5682 var c = new Array(pre.length + 1).join("-");
5683 return pre + this.upcomingInput() + "\n" + c + "^";
5684 },
5685
5686// test the lexed token: return FALSE when not a match, otherwise return token
5687test_match:function(match, indexed_rule) {
5688 var token,
5689 lines,
5690 backup;
5691
5692 if (this.options.backtrack_lexer) {
5693 // save context
5694 backup = {
5695 yylineno: this.yylineno,
5696 yylloc: {
5697 first_line: this.yylloc.first_line,
5698 last_line: this.last_line,
5699 first_column: this.yylloc.first_column,
5700 last_column: this.yylloc.last_column
5701 },
5702 yytext: this.yytext,
5703 match: this.match,
5704 matches: this.matches,
5705 matched: this.matched,
5706 yyleng: this.yyleng,
5707 offset: this.offset,
5708 _more: this._more,
5709 _input: this._input,
5710 yy: this.yy,
5711 conditionStack: this.conditionStack.slice(0),
5712 done: this.done
5713 };
5714 if (this.options.ranges) {
5715 backup.yylloc.range = this.yylloc.range.slice(0);
5716 }
5717 }
5718
5719 lines = match[0].match(/(?:\r\n?|\n).*/g);
5720 if (lines) {
5721 this.yylineno += lines.length;
5722 }
5723 this.yylloc = {
5724 first_line: this.yylloc.last_line,
5725 last_line: this.yylineno + 1,
5726 first_column: this.yylloc.last_column,
5727 last_column: lines ?
5728 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
5729 this.yylloc.last_column + match[0].length
5730 };
5731 this.yytext += match[0];
5732 this.match += match[0];
5733 this.matches = match;
5734 this.yyleng = this.yytext.length;
5735 if (this.options.ranges) {
5736 this.yylloc.range = [this.offset, this.offset += this.yyleng];
5737 }
5738 this._more = false;
5739 this._backtrack = false;
5740 this._input = this._input.slice(match[0].length);
5741 this.matched += match[0];
5742 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
5743 if (this.done && this._input) {
5744 this.done = false;
5745 }
5746 if (token) {
5747 return token;
5748 } else if (this._backtrack) {
5749 // recover context
5750 for (var k in backup) {
5751 this[k] = backup[k];
5752 }
5753 return false; // rule action called reject() implying the next rule should be tested instead.
5754 }
5755 return false;
5756 },
5757
5758// return next match in input
5759next:function () {
5760 if (this.done) {
5761 return this.EOF;
5762 }
5763 if (!this._input) {
5764 this.done = true;
5765 }
5766
5767 var token,
5768 match,
5769 tempMatch,
5770 index;
5771 if (!this._more) {
5772 this.yytext = '';
5773 this.match = '';
5774 }
5775 var rules = this._currentRules();
5776 for (var i = 0; i < rules.length; i++) {
5777 tempMatch = this._input.match(this.rules[rules[i]]);
5778 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
5779 match = tempMatch;
5780 index = i;
5781 if (this.options.backtrack_lexer) {
5782 token = this.test_match(tempMatch, rules[i]);
5783 if (token !== false) {
5784 return token;
5785 } else if (this._backtrack) {
5786 match = false;
5787 continue; // rule action called reject() implying a rule MISmatch.
5788 } else {
5789 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
5790 return false;
5791 }
5792 } else if (!this.options.flex) {
5793 break;
5794 }
5795 }
5796 }
5797 if (match) {
5798 token = this.test_match(match, rules[index]);
5799 if (token !== false) {
5800 return token;
5801 }
5802 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
5803 return false;
5804 }
5805 if (this._input === "") {
5806 return this.EOF;
5807 } else {
5808 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
5809 text: "",
5810 token: null,
5811 line: this.yylineno
5812 });
5813 }
5814 },
5815
5816// return next match that has a token
5817lex:function lex () {
5818 var r = this.next();
5819 if (r) {
5820 return r;
5821 } else {
5822 return this.lex();
5823 }
5824 },
5825
5826// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
5827begin:function begin (condition) {
5828 this.conditionStack.push(condition);
5829 },
5830
5831// pop the previously active lexer condition state off the condition stack
5832popState:function popState () {
5833 var n = this.conditionStack.length - 1;
5834 if (n > 0) {
5835 return this.conditionStack.pop();
5836 } else {
5837 return this.conditionStack[0];
5838 }
5839 },
5840
5841// produce the lexer rule set which is active for the currently active lexer condition state
5842_currentRules:function _currentRules () {
5843 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
5844 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
5845 } else {
5846 return this.conditions["INITIAL"].rules;
5847 }
5848 },
5849
5850// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
5851topState:function topState (n) {
5852 n = this.conditionStack.length - 1 - Math.abs(n || 0);
5853 if (n >= 0) {
5854 return this.conditionStack[n];
5855 } else {
5856 return "INITIAL";
5857 }
5858 },
5859
5860// alias for begin(condition)
5861pushState:function pushState (condition) {
5862 this.begin(condition);
5863 },
5864
5865// return the number of states currently on the stack
5866stateStackSize:function stateStackSize() {
5867 return this.conditionStack.length;
5868 },
5869options: {},
5870performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
5871var YYSTATE=YY_START;
5872switch($avoiding_name_collisions) {
5873case 0: this.begin('open_directive'); return 13;
5874break;
5875case 1: this.begin('type_directive'); return 14;
5876break;
5877case 2: this.popState(); this.begin('arg_directive'); return 11;
5878break;
5879case 3: this.popState(); this.popState(); return 16;
5880break;
5881case 4:return 15;
5882break;
5883case 5:/* skip comments */
5884break;
5885case 6:/* skip comments */
5886break;
5887case 7:return 10;
5888break;
5889case 8:/* skip whitespace */
5890break;
5891case 9:return 17;
5892break;
5893case 10:return 17;
5894break;
5895case 11: this.begin("struct"); /*console.log('Starting struct');*/ return 33;
5896break;
5897case 12:return "EOF_IN_STRUCT";
5898break;
5899case 13:return "OPEN_IN_STRUCT";
5900break;
5901case 14: /*console.log('Ending struct');*/this.popState(); return 35;
5902break;
5903case 15:/* nothing */
5904break;
5905case 16: /*console.log('lex-member: ' + yy_.yytext);*/ return "MEMBER";
5906break;
5907case 17:return 31;
5908break;
5909case 18:return 52;
5910break;
5911case 19:return 50;
5912break;
5913case 20:return 51;
5914break;
5915case 21:return 36;
5916break;
5917case 22:return 37;
5918break;
5919case 23:this.begin("generic");
5920break;
5921case 24:this.popState();
5922break;
5923case 25:return "GENERICTYPE";
5924break;
5925case 26:this.begin("string");
5926break;
5927case 27:this.popState();
5928break;
5929case 28:return "STR";
5930break;
5931case 29:return 45;
5932break;
5933case 30:return 45;
5934break;
5935case 31:return 47;
5936break;
5937case 32:return 47;
5938break;
5939case 33:return 46;
5940break;
5941case 34:return 44;
5942break;
5943case 35:return 48;
5944break;
5945case 36:return 49;
5946break;
5947case 37:return 25;
5948break;
5949case 38:return 32;
5950break;
5951case 39:return 64;
5952break;
5953case 40:return 'DOT';
5954break;
5955case 41:return 'PLUS';
5956break;
5957case 42:return 61;
5958break;
5959case 43:return 'EQUALS';
5960break;
5961case 44:return 'EQUALS';
5962break;
5963case 45:return 68;
5964break;
5965case 46:return 'PUNCTUATION';
5966break;
5967case 47:return 67;
5968break;
5969case 48:return 66;
5970break;
5971case 49:return 63;
5972break;
5973case 50:return 19;
5974break;
5975}
5976},
5977rules: [/^(?:%%\{)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:[{])/,/^(?:$)/,/^(?:[{])/,/^(?:[}])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:class\b)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:[~])/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:$)/],
5978conditions: {"string":{"rules":[27,28],"inclusive":false},"generic":{"rules":[24,25],"inclusive":false},"struct":{"rules":[12,13,14,15,16],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,17,18,19,20,21,22,23,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"inclusive":true}}
5979});
5980return lexer;
5981})();
5982parser.lexer = lexer;
5983function Parser () {
5984 this.yy = {};
5985}
5986Parser.prototype = parser;parser.Parser = Parser;
5987return new Parser;
5988})();
5989
5990
5991if (true) {
5992exports.parser = parser;
5993exports.Parser = parser.Parser;
5994exports.parse = function () { return parser.parse.apply(parser, arguments); };
5995exports.main = function commonjsMain (args) {
5996 if (!args[1]) {
5997 console.log('Usage: '+args[0]+' FILE');
5998 process.exit(1);
5999 }
6000 var source = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
6001 return exports.parser.parse(source);
6002};
6003if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
6004 exports.main(process.argv.slice(1));
6005}
6006}
6007/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
6008
6009/***/ }),
6010
6011/***/ "./src/diagrams/class/styles.js":
6012/*!**************************************!*\
6013 !*** ./src/diagrams/class/styles.js ***!
6014 \**************************************/
6015/*! exports provided: default */
6016/***/ (function(module, __webpack_exports__, __webpack_require__) {
6017
6018"use strict";
6019__webpack_require__.r(__webpack_exports__);
6020var getStyles = function getStyles(options) {
6021 return "g.classGroup text {\n fill: ".concat(options.nodeBorder, ";\n fill: ").concat(options.classText, ";\n stroke: none;\n font-family: ").concat(options.fontFamily, ";\n font-size: 10px;\n\n .title {\n font-weight: bolder;\n }\n}\n.node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1px;\n }\n\n\n.divider {\n stroke: ").concat(options.nodeBorder, ";\n stroke: 1;\n}\n\ng.clickable {\n cursor: pointer;\n}\n\ng.classGroup rect {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n}\n\ng.classGroup line {\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1;\n}\n\n.classLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ").concat(options.mainBkg, ";\n opacity: 0.5;\n}\n\n.classLabel .label {\n fill: ").concat(options.nodeBorder, ";\n font-size: 10px;\n}\n\n.relation {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1;\n fill: none;\n}\n\n.dashed-line{\n stroke-dasharray: 3;\n}\n\n#compositionStart, .composition {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#compositionEnd, .composition {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#extensionStart, .extension {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#extensionEnd, .extension {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#aggregationStart, .aggregation {\n fill: ").concat(options.mainBkg, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#aggregationEnd, .aggregation {\n fill: ").concat(options.mainBkg, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n");
6022};
6023
6024/* harmony default export */ __webpack_exports__["default"] = (getStyles);
6025
6026/***/ }),
6027
6028/***/ "./src/diagrams/class/svgDraw.js":
6029/*!***************************************!*\
6030 !*** ./src/diagrams/class/svgDraw.js ***!
6031 \***************************************/
6032/*! exports provided: drawEdge, drawClass, parseMember, default */
6033/***/ (function(module, __webpack_exports__, __webpack_require__) {
6034
6035"use strict";
6036__webpack_require__.r(__webpack_exports__);
6037/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawEdge", function() { return drawEdge; });
6038/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawClass", function() { return drawClass; });
6039/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseMember", function() { return parseMember; });
6040/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
6041/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
6042/* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
6043/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
6044/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
6045
6046
6047
6048
6049var edgeCount = 0;
6050var drawEdge = function drawEdge(elem, path, relation, conf) {
6051 var getRelationType = function getRelationType(type) {
6052 switch (type) {
6053 case _classDb__WEBPACK_IMPORTED_MODULE_1__["relationType"].AGGREGATION:
6054 return 'aggregation';
6055
6056 case _classDb__WEBPACK_IMPORTED_MODULE_1__["relationType"].EXTENSION:
6057 return 'extension';
6058
6059 case _classDb__WEBPACK_IMPORTED_MODULE_1__["relationType"].COMPOSITION:
6060 return 'composition';
6061
6062 case _classDb__WEBPACK_IMPORTED_MODULE_1__["relationType"].DEPENDENCY:
6063 return 'dependency';
6064 }
6065 };
6066
6067 path.points = path.points.filter(function (p) {
6068 return !Number.isNaN(p.y);
6069 }); // The data for our line
6070
6071 var lineData = path.points; // This is the accessor function we talked about above
6072
6073 var lineFunction = Object(d3__WEBPACK_IMPORTED_MODULE_0__["line"])().x(function (d) {
6074 return d.x;
6075 }).y(function (d) {
6076 return d.y;
6077 }).curve(d3__WEBPACK_IMPORTED_MODULE_0__["curveBasis"]);
6078 var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', 'edge' + edgeCount).attr('class', 'relation');
6079 var url = '';
6080
6081 if (conf.arrowMarkerAbsolute) {
6082 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
6083 url = url.replace(/\(/g, '\\(');
6084 url = url.replace(/\)/g, '\\)');
6085 }
6086
6087 if (relation.relation.lineType == 1) {
6088 svgPath.attr('class', 'relation dashed-line');
6089 }
6090
6091 if (relation.relation.type1 !== 'none') {
6092 svgPath.attr('marker-start', 'url(' + url + '#' + getRelationType(relation.relation.type1) + 'Start' + ')');
6093 }
6094
6095 if (relation.relation.type2 !== 'none') {
6096 svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(relation.relation.type2) + 'End' + ')');
6097 }
6098
6099 var x, y;
6100 var l = path.points.length; // Calculate Label position
6101
6102 var labelPosition = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcLabelPosition(path.points);
6103 x = labelPosition.x;
6104 y = labelPosition.y;
6105 var p1_card_x, p1_card_y;
6106 var p2_card_x, p2_card_y;
6107
6108 if (l % 2 !== 0 && l > 1) {
6109 var cardinality_1_point = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcCardinalityPosition(relation.relation.type1 !== 'none', path.points, path.points[0]);
6110 var cardinality_2_point = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcCardinalityPosition(relation.relation.type2 !== 'none', path.points, path.points[l - 1]);
6111 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('cardinality_1_point ' + JSON.stringify(cardinality_1_point));
6112 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('cardinality_2_point ' + JSON.stringify(cardinality_2_point));
6113 p1_card_x = cardinality_1_point.x;
6114 p1_card_y = cardinality_1_point.y;
6115 p2_card_x = cardinality_2_point.x;
6116 p2_card_y = cardinality_2_point.y;
6117 }
6118
6119 if (typeof relation.title !== 'undefined') {
6120 var g = elem.append('g').attr('class', 'classLabel');
6121 var label = g.append('text').attr('class', 'label').attr('x', x).attr('y', y).attr('fill', 'red').attr('text-anchor', 'middle').text(relation.title);
6122 window.label = label;
6123 var bounds = label.node().getBBox();
6124 g.insert('rect', ':first-child').attr('class', 'box').attr('x', bounds.x - conf.padding / 2).attr('y', bounds.y - conf.padding / 2).attr('width', bounds.width + conf.padding).attr('height', bounds.height + conf.padding);
6125 }
6126
6127 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Rendering relation ' + JSON.stringify(relation));
6128
6129 if (typeof relation.relationTitle1 !== 'undefined' && relation.relationTitle1 !== 'none') {
6130 var _g = elem.append('g').attr('class', 'cardinality');
6131
6132 _g.append('text').attr('class', 'type1').attr('x', p1_card_x).attr('y', p1_card_y).attr('fill', 'black').attr('font-size', '6').text(relation.relationTitle1);
6133 }
6134
6135 if (typeof relation.relationTitle2 !== 'undefined' && relation.relationTitle2 !== 'none') {
6136 var _g2 = elem.append('g').attr('class', 'cardinality');
6137
6138 _g2.append('text').attr('class', 'type2').attr('x', p2_card_x).attr('y', p2_card_y).attr('fill', 'black').attr('font-size', '6').text(relation.relationTitle2);
6139 }
6140
6141 edgeCount++;
6142};
6143var drawClass = function drawClass(elem, classDef, conf) {
6144 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Rendering class ' + classDef);
6145 var id = classDef.id;
6146 var classInfo = {
6147 id: id,
6148 label: classDef.id,
6149 width: 0,
6150 height: 0
6151 }; // add class group
6152
6153 var g = elem.append('g').attr('id', Object(_classDb__WEBPACK_IMPORTED_MODULE_1__["lookUpDomId"])(id)).attr('class', 'classGroup'); // add title
6154
6155 var title;
6156
6157 if (classDef.link) {
6158 title = g.append('svg:a').attr('xlink:href', classDef.link).attr('target', '_blank').append('text').attr('y', conf.textHeight + conf.padding).attr('x', 0);
6159 } else {
6160 title = g.append('text').attr('y', conf.textHeight + conf.padding).attr('x', 0);
6161 } // add annotations
6162
6163
6164 var isFirst = true;
6165 classDef.annotations.forEach(function (member) {
6166 var titleText2 = title.append('tspan').text('«' + member + '»');
6167 if (!isFirst) titleText2.attr('dy', conf.textHeight);
6168 isFirst = false;
6169 });
6170 var classTitleString = classDef.id;
6171
6172 if (classDef.type !== undefined && classDef.type !== '') {
6173 classTitleString += '<' + classDef.type + '>';
6174 }
6175
6176 var classTitle = title.append('tspan').text(classTitleString).attr('class', 'title'); // If class has annotations the title needs to have an offset of the text height
6177
6178 if (!isFirst) classTitle.attr('dy', conf.textHeight);
6179 var titleHeight = title.node().getBBox().height;
6180 var membersLine = g.append('line') // text label for the x axis
6181 .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin / 2).attr('y2', conf.padding + titleHeight + conf.dividerMargin / 2);
6182 var members = g.append('text') // text label for the x axis
6183 .attr('x', conf.padding).attr('y', titleHeight + conf.dividerMargin + conf.textHeight).attr('fill', 'white').attr('class', 'classText');
6184 isFirst = true;
6185 classDef.members.forEach(function (member) {
6186 addTspan(members, member, isFirst, conf);
6187 isFirst = false;
6188 });
6189 var membersBox = members.node().getBBox();
6190 var methodsLine = g.append('line') // text label for the x axis
6191 .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr('y2', conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
6192 var methods = g.append('text') // text label for the x axis
6193 .attr('x', conf.padding).attr('y', titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr('fill', 'white').attr('class', 'classText');
6194 isFirst = true;
6195 classDef.methods.forEach(function (method) {
6196 addTspan(methods, method, isFirst, conf);
6197 isFirst = false;
6198 });
6199 var classBox = g.node().getBBox();
6200 var cssClassStr = ' ';
6201
6202 if (classDef.cssClasses.length > 0) {
6203 cssClassStr = cssClassStr + classDef.cssClasses.join(' ');
6204 }
6205
6206 var rect = g.insert('rect', ':first-child').attr('x', 0).attr('y', 0).attr('width', classBox.width + 2 * conf.padding).attr('height', classBox.height + conf.padding + 0.5 * conf.dividerMargin).attr('class', cssClassStr);
6207 var rectWidth = rect.node().getBBox().width; // Center title
6208 // We subtract the width of each text element from the class box width and divide it by 2
6209
6210 title.node().childNodes.forEach(function (x) {
6211 x.setAttribute('x', (rectWidth - x.getBBox().width) / 2);
6212 });
6213
6214 if (classDef.tooltip) {
6215 title.insert('title').text(classDef.tooltip);
6216 }
6217
6218 membersLine.attr('x2', rectWidth);
6219 methodsLine.attr('x2', rectWidth);
6220 classInfo.width = rectWidth;
6221 classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
6222 return classInfo;
6223};
6224var parseMember = function parseMember(text) {
6225 var fieldRegEx = /(\+|-|~|#)?(\w+)(~\w+~|\[\])?\s+(\w+)/;
6226 var methodRegEx = /^([+|\-|~|#])?(\w+) *\( *(.*)\) *(\*|\$)? *(\w*[~|[\]]*\s*\w*~?)$/;
6227 var fieldMatch = text.match(fieldRegEx);
6228 var methodMatch = text.match(methodRegEx);
6229
6230 if (fieldMatch && !methodMatch) {
6231 return buildFieldDisplay(fieldMatch);
6232 } else if (methodMatch) {
6233 return buildMethodDisplay(methodMatch);
6234 } else {
6235 return buildLegacyDisplay(text);
6236 }
6237};
6238
6239var buildFieldDisplay = function buildFieldDisplay(parsedText) {
6240 var displayText = '';
6241
6242 try {
6243 var visibility = parsedText[1] ? parsedText[1].trim() : '';
6244 var fieldType = parsedText[2] ? parsedText[2].trim() : '';
6245 var genericType = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : '';
6246 var fieldName = parsedText[4] ? parsedText[4].trim() : '';
6247 displayText = visibility + fieldType + genericType + ' ' + fieldName;
6248 } catch (err) {
6249 displayText = parsedText;
6250 }
6251
6252 return {
6253 displayText: displayText,
6254 cssStyle: ''
6255 };
6256};
6257
6258var buildMethodDisplay = function buildMethodDisplay(parsedText) {
6259 var cssStyle = '';
6260 var displayText = '';
6261
6262 try {
6263 var visibility = parsedText[1] ? parsedText[1].trim() : '';
6264 var methodName = parsedText[2] ? parsedText[2].trim() : '';
6265 var parameters = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : '';
6266 var classifier = parsedText[4] ? parsedText[4].trim() : '';
6267 var returnType = parsedText[5] ? ' : ' + parseGenericTypes(parsedText[5]).trim() : '';
6268 displayText = visibility + methodName + '(' + parameters + ')' + returnType;
6269 cssStyle = parseClassifier(classifier);
6270 } catch (err) {
6271 displayText = parsedText;
6272 }
6273
6274 return {
6275 displayText: displayText,
6276 cssStyle: cssStyle
6277 };
6278};
6279
6280var buildLegacyDisplay = function buildLegacyDisplay(text) {
6281 // if for some reason we dont have any match, use old format to parse text
6282 var displayText = '';
6283 var cssStyle = '';
6284 var memberText = '';
6285 var returnType = '';
6286 var methodStart = text.indexOf('(');
6287 var methodEnd = text.indexOf(')');
6288
6289 if (methodStart > 1 && methodEnd > methodStart && methodEnd <= text.length) {
6290 var visibility = '';
6291 var methodName = '';
6292 var firstChar = text.substring(0, 1);
6293
6294 if (firstChar.match(/\w/)) {
6295 methodName = text.substring(0, methodStart).trim();
6296 } else {
6297 if (firstChar.match(/\+|-|~|#/)) {
6298 visibility = firstChar;
6299 }
6300
6301 methodName = text.substring(1, methodStart).trim();
6302 }
6303
6304 var parameters = text.substring(methodStart + 1, methodEnd);
6305 var classifier = text.substring(methodEnd + 1, 1);
6306 cssStyle = parseClassifier(classifier);
6307 displayText = visibility + methodName + '(' + parseGenericTypes(parameters.trim()) + ')';
6308
6309 if (methodEnd < memberText.length) {
6310 returnType = text.substring(methodEnd + 2).trim();
6311
6312 if (returnType !== '') {
6313 returnType = ' : ' + parseGenericTypes(returnType);
6314 }
6315 }
6316 } else {
6317 // finally - if all else fails, just send the text back as written (other than parsing for generic types)
6318 displayText = parseGenericTypes(text);
6319 }
6320
6321 return {
6322 displayText: displayText,
6323 cssStyle: cssStyle
6324 };
6325};
6326
6327var addTspan = function addTspan(textEl, txt, isFirst, conf) {
6328 var member = parseMember(txt);
6329 var tSpan = textEl.append('tspan').attr('x', conf.padding).text(member.displayText);
6330
6331 if (member.cssStyle !== '') {
6332 tSpan.attr('style', member.cssStyle);
6333 }
6334
6335 if (!isFirst) {
6336 tSpan.attr('dy', conf.textHeight);
6337 }
6338};
6339
6340var parseGenericTypes = function parseGenericTypes(text) {
6341 var cleanedText = text;
6342
6343 if (text.indexOf('~') != -1) {
6344 cleanedText = cleanedText.replace('~', '<');
6345 cleanedText = cleanedText.replace('~', '>');
6346 return parseGenericTypes(cleanedText);
6347 } else {
6348 return cleanedText;
6349 }
6350};
6351
6352var parseClassifier = function parseClassifier(classifier) {
6353 switch (classifier) {
6354 case '*':
6355 return 'font-style:italic;';
6356
6357 case '$':
6358 return 'text-decoration:underline;';
6359
6360 default:
6361 return '';
6362 }
6363};
6364
6365/* harmony default export */ __webpack_exports__["default"] = ({
6366 drawClass: drawClass,
6367 drawEdge: drawEdge,
6368 parseMember: parseMember
6369});
6370
6371/***/ }),
6372
6373/***/ "./src/diagrams/common/common.js":
6374/*!***************************************!*\
6375 !*** ./src/diagrams/common/common.js ***!
6376 \***************************************/
6377/*! exports provided: getRows, removeScript, sanitizeText, lineBreakRegex, hasBreaks, splitBreaks, default */
6378/***/ (function(module, __webpack_exports__, __webpack_require__) {
6379
6380"use strict";
6381__webpack_require__.r(__webpack_exports__);
6382/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRows", function() { return getRows; });
6383/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeScript", function() { return removeScript; });
6384/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sanitizeText", function() { return sanitizeText; });
6385/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lineBreakRegex", function() { return lineBreakRegex; });
6386/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasBreaks", function() { return hasBreaks; });
6387/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "splitBreaks", function() { return splitBreaks; });
6388var getRows = function getRows(s) {
6389 if (!s) return 1;
6390 var str = breakToPlaceholder(s);
6391 str = str.replace(/\\n/g, '#br#');
6392 return str.split('#br#');
6393};
6394var removeScript = function removeScript(txt) {
6395 var rs = '';
6396 var idx = 0;
6397
6398 while (idx >= 0) {
6399 idx = txt.indexOf('<script');
6400
6401 if (idx >= 0) {
6402 rs += txt.substr(0, idx);
6403 txt = txt.substr(idx + 1);
6404 idx = txt.indexOf('</script>');
6405
6406 if (idx >= 0) {
6407 idx += 9;
6408 txt = txt.substr(idx);
6409 }
6410 } else {
6411 rs += txt;
6412 idx = -1;
6413 break;
6414 }
6415 }
6416
6417 return rs;
6418};
6419var sanitizeText = function sanitizeText(text, config) {
6420 var txt = text;
6421 var htmlLabels = true;
6422
6423 if (config.flowchart && (config.flowchart.htmlLabels === false || config.flowchart.htmlLabels === 'false')) {
6424 htmlLabels = false;
6425 }
6426
6427 if (htmlLabels) {
6428 var level = config.securityLevel;
6429
6430 if (level === 'antiscript') {
6431 txt = removeScript(txt);
6432 } else if (level !== 'loose') {
6433 // eslint-disable-line
6434 txt = breakToPlaceholder(txt);
6435 txt = txt.replace(/</g, '&lt;').replace(/>/g, '&gt;');
6436 txt = txt.replace(/=/g, '&equals;');
6437 txt = placeholderToBreak(txt);
6438 }
6439 }
6440
6441 return txt;
6442};
6443var lineBreakRegex = /<br\s*\/?>/gi;
6444var hasBreaks = function hasBreaks(text) {
6445 return /<br\s*[/]?>/gi.test(text);
6446};
6447var splitBreaks = function splitBreaks(text) {
6448 return text.split(/<br\s*[/]?>/gi);
6449};
6450
6451var breakToPlaceholder = function breakToPlaceholder(s) {
6452 return s.replace(lineBreakRegex, '#br#');
6453};
6454
6455var placeholderToBreak = function placeholderToBreak(s) {
6456 return s.replace(/#br#/g, '<br/>');
6457};
6458
6459/* harmony default export */ __webpack_exports__["default"] = ({
6460 getRows: getRows,
6461 sanitizeText: sanitizeText,
6462 hasBreaks: hasBreaks,
6463 splitBreaks: splitBreaks,
6464 lineBreakRegex: lineBreakRegex,
6465 removeScript: removeScript
6466});
6467
6468/***/ }),
6469
6470/***/ "./src/diagrams/er/erDb.js":
6471/*!*********************************!*\
6472 !*** ./src/diagrams/er/erDb.js ***!
6473 \*********************************/
6474/*! exports provided: parseDirective, default */
6475/***/ (function(module, __webpack_exports__, __webpack_require__) {
6476
6477"use strict";
6478__webpack_require__.r(__webpack_exports__);
6479/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
6480/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
6481/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
6482/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
6483/**
6484 *
6485 */
6486
6487
6488
6489var entities = {};
6490var relationships = [];
6491var title = '';
6492var Cardinality = {
6493 ZERO_OR_ONE: 'ZERO_OR_ONE',
6494 ZERO_OR_MORE: 'ZERO_OR_MORE',
6495 ONE_OR_MORE: 'ONE_OR_MORE',
6496 ONLY_ONE: 'ONLY_ONE'
6497};
6498var Identification = {
6499 NON_IDENTIFYING: 'NON_IDENTIFYING',
6500 IDENTIFYING: 'IDENTIFYING'
6501};
6502var parseDirective = function parseDirective(statement, context, type) {
6503 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].parseDirective(this, statement, context, type);
6504};
6505
6506var addEntity = function addEntity(name) {
6507 if (typeof entities[name] === 'undefined') {
6508 entities[name] = name;
6509 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Added new entity :', name);
6510 }
6511};
6512
6513var getEntities = function getEntities() {
6514 return entities;
6515};
6516/**
6517 * Add a relationship
6518 * @param entA The first entity in the relationship
6519 * @param rolA The role played by the first entity in relation to the second
6520 * @param entB The second entity in the relationship
6521 * @param rSpec The details of the relationship between the two entities
6522 */
6523
6524
6525var addRelationship = function addRelationship(entA, rolA, entB, rSpec) {
6526 var rel = {
6527 entityA: entA,
6528 roleA: rolA,
6529 entityB: entB,
6530 relSpec: rSpec
6531 };
6532 relationships.push(rel);
6533 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Added new relationship :', rel);
6534};
6535
6536var getRelationships = function getRelationships() {
6537 return relationships;
6538}; // Keep this - TODO: revisit...allow the diagram to have a title
6539
6540
6541var setTitle = function setTitle(txt) {
6542 title = txt;
6543};
6544
6545var getTitle = function getTitle() {
6546 return title;
6547};
6548
6549var clear = function clear() {
6550 entities = {};
6551 relationships = [];
6552 title = '';
6553};
6554
6555/* harmony default export */ __webpack_exports__["default"] = ({
6556 Cardinality: Cardinality,
6557 Identification: Identification,
6558 parseDirective: parseDirective,
6559 getConfig: function getConfig() {
6560 return _config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]().er;
6561 },
6562 addEntity: addEntity,
6563 getEntities: getEntities,
6564 addRelationship: addRelationship,
6565 getRelationships: getRelationships,
6566 clear: clear,
6567 setTitle: setTitle,
6568 getTitle: getTitle
6569});
6570
6571/***/ }),
6572
6573/***/ "./src/diagrams/er/erMarkers.js":
6574/*!**************************************!*\
6575 !*** ./src/diagrams/er/erMarkers.js ***!
6576 \**************************************/
6577/*! exports provided: default */
6578/***/ (function(module, __webpack_exports__, __webpack_require__) {
6579
6580"use strict";
6581__webpack_require__.r(__webpack_exports__);
6582var ERMarkers = {
6583 ONLY_ONE_START: 'ONLY_ONE_START',
6584 ONLY_ONE_END: 'ONLY_ONE_END',
6585 ZERO_OR_ONE_START: 'ZERO_OR_ONE_START',
6586 ZERO_OR_ONE_END: 'ZERO_OR_ONE_END',
6587 ONE_OR_MORE_START: 'ONE_OR_MORE_START',
6588 ONE_OR_MORE_END: 'ONE_OR_MORE_END',
6589 ZERO_OR_MORE_START: 'ZERO_OR_MORE_START',
6590 ZERO_OR_MORE_END: 'ZERO_OR_MORE_END'
6591};
6592/**
6593 * Put the markers into the svg DOM for later use with edge paths
6594 */
6595
6596var insertMarkers = function insertMarkers(elem, conf) {
6597 var marker;
6598 elem.append('defs').append('marker').attr('id', ERMarkers.ONLY_ONE_START).attr('refX', 0).attr('refY', 9).attr('markerWidth', 18).attr('markerHeight', 18).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M9,0 L9,18 M15,0 L15,18');
6599 elem.append('defs').append('marker').attr('id', ERMarkers.ONLY_ONE_END).attr('refX', 18).attr('refY', 9).attr('markerWidth', 18).attr('markerHeight', 18).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M3,0 L3,18 M9,0 L9,18');
6600 marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_ONE_START).attr('refX', 0).attr('refY', 9).attr('markerWidth', 30).attr('markerHeight', 18).attr('orient', 'auto');
6601 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 21).attr('cy', 9).attr('r', 6);
6602 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M9,0 L9,18');
6603 marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_ONE_END).attr('refX', 30).attr('refY', 9).attr('markerWidth', 30).attr('markerHeight', 18).attr('orient', 'auto');
6604 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 9).attr('cy', 9).attr('r', 6);
6605 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,0 L21,18');
6606 elem.append('defs').append('marker').attr('id', ERMarkers.ONE_OR_MORE_START).attr('refX', 18).attr('refY', 18).attr('markerWidth', 45).attr('markerHeight', 36).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27');
6607 elem.append('defs').append('marker').attr('id', ERMarkers.ONE_OR_MORE_END).attr('refX', 27).attr('refY', 18).attr('markerWidth', 45).attr('markerHeight', 36).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18');
6608 marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_MORE_START).attr('refX', 18).attr('refY', 18).attr('markerWidth', 57).attr('markerHeight', 36).attr('orient', 'auto');
6609 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 48).attr('cy', 18).attr('r', 6);
6610 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M0,18 Q18,0 36,18 Q18,36 0,18');
6611 marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_MORE_END).attr('refX', 39).attr('refY', 18).attr('markerWidth', 57).attr('markerHeight', 36).attr('orient', 'auto');
6612 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 9).attr('cy', 18).attr('r', 6);
6613 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,18 Q39,0 57,18 Q39,36 21,18');
6614 return;
6615};
6616
6617/* harmony default export */ __webpack_exports__["default"] = ({
6618 ERMarkers: ERMarkers,
6619 insertMarkers: insertMarkers
6620});
6621
6622/***/ }),
6623
6624/***/ "./src/diagrams/er/erRenderer.js":
6625/*!***************************************!*\
6626 !*** ./src/diagrams/er/erRenderer.js ***!
6627 \***************************************/
6628/*! exports provided: setConf, draw, default */
6629/***/ (function(module, __webpack_exports__, __webpack_require__) {
6630
6631"use strict";
6632__webpack_require__.r(__webpack_exports__);
6633/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
6634/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
6635/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
6636/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
6637/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
6638/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
6639/* harmony import */ var _erDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./erDb */ "./src/diagrams/er/erDb.js");
6640/* harmony import */ var _parser_erDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/erDiagram */ "./src/diagrams/er/parser/erDiagram.jison");
6641/* harmony import */ var _parser_erDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_erDiagram__WEBPACK_IMPORTED_MODULE_3__);
6642/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! dagre */ "dagre");
6643/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_4__);
6644/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../config */ "./src/config.js");
6645/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
6646/* harmony import */ var _erMarkers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./erMarkers */ "./src/diagrams/er/erMarkers.js");
6647
6648
6649
6650
6651
6652
6653
6654
6655var conf = {};
6656/**
6657 * Allows the top-level API module to inject config specific to this renderer,
6658 * storing it in the local conf object. Note that generic config still needs to be
6659 * retrieved using getConfig() imported from the config module
6660 */
6661
6662var setConf = function setConf(cnf) {
6663 var keys = Object.keys(cnf);
6664
6665 for (var i = 0; i < keys.length; i++) {
6666 conf[keys[i]] = cnf[keys[i]];
6667 }
6668};
6669/**
6670 * Use D3 to construct the svg elements for the entities
6671 * @param svgNode the svg node that contains the diagram
6672 * @param entities The entities to be drawn
6673 * @param graph The graph that contains the vertex and edge definitions post-layout
6674 * @return The first entity that was inserted
6675 */
6676
6677var drawEntities = function drawEntities(svgNode, entities, graph) {
6678 var keys = Object.keys(entities);
6679 var firstOne;
6680 keys.forEach(function (id) {
6681 // Create a group for each entity
6682 var groupNode = svgNode.append('g').attr('id', id);
6683 firstOne = firstOne === undefined ? id : firstOne; // Label the entity - this is done first so that we can get the bounding box
6684 // which then determines the size of the rectangle
6685
6686 var textId = 'entity-' + id;
6687 var textNode = groupNode.append('text').attr('class', 'er entityLabel').attr('id', textId).attr('x', 0).attr('y', 0).attr('dominant-baseline', 'middle').attr('text-anchor', 'middle').attr('style', 'font-family: ' + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().fontFamily + '; font-size: ' + conf.fontSize + 'px').text(id); // Calculate the width and height of the entity
6688
6689 var textBBox = textNode.node().getBBox();
6690 var entityWidth = Math.max(conf.minEntityWidth, textBBox.width + conf.entityPadding * 2);
6691 var entityHeight = Math.max(conf.minEntityHeight, textBBox.height + conf.entityPadding * 2); // Make sure the text gets centred relative to the entity box
6692
6693 textNode.attr('transform', 'translate(' + entityWidth / 2 + ',' + entityHeight / 2 + ')'); // Draw the rectangle - insert it before the text so that the text is not obscured
6694
6695 var rectNode = groupNode.insert('rect', '#' + textId).attr('class', 'er entityBox').attr('fill', conf.fill).attr('fill-opacity', '100%').attr('stroke', conf.stroke).attr('x', 0).attr('y', 0).attr('width', entityWidth).attr('height', entityHeight);
6696 var rectBBox = rectNode.node().getBBox(); // Add the entity to the graph
6697
6698 graph.setNode(id, {
6699 width: rectBBox.width,
6700 height: rectBBox.height,
6701 shape: 'rect',
6702 id: id
6703 });
6704 });
6705 return firstOne;
6706}; // drawEntities
6707
6708
6709var adjustEntities = function adjustEntities(svgNode, graph) {
6710 graph.nodes().forEach(function (v) {
6711 if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
6712 svgNode.select('#' + v).attr('transform', 'translate(' + (graph.node(v).x - graph.node(v).width / 2) + ',' + (graph.node(v).y - graph.node(v).height / 2) + ' )');
6713 }
6714 });
6715 return;
6716};
6717
6718var getEdgeName = function getEdgeName(rel) {
6719 return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, '');
6720};
6721/**
6722 * Add each relationship to the graph
6723 * @param relationships the relationships to be added
6724 * @param g the graph
6725 * @return {Array} The array of relationships
6726 */
6727
6728
6729var addRelationships = function addRelationships(relationships, g) {
6730 relationships.forEach(function (r) {
6731 g.setEdge(r.entityA, r.entityB, {
6732 relationship: r
6733 }, getEdgeName(r));
6734 });
6735 return relationships;
6736}; // addRelationships
6737
6738
6739var relCnt = 0;
6740/**
6741 * Draw a relationship using edge information from the graph
6742 * @param svg the svg node
6743 * @param rel the relationship to draw in the svg
6744 * @param g the graph containing the edge information
6745 * @param insert the insertion point in the svg DOM (because relationships have markers that need to sit 'behind' opaque entity boxes)
6746 */
6747
6748var drawRelationshipFromLayout = function drawRelationshipFromLayout(svg, rel, g, insert) {
6749 relCnt++; // Find the edge relating to this relationship
6750
6751 var edge = g.edge(rel.entityA, rel.entityB, getEdgeName(rel)); // Get a function that will generate the line path
6752
6753 var lineFunction = Object(d3__WEBPACK_IMPORTED_MODULE_1__["line"])().x(function (d) {
6754 return d.x;
6755 }).y(function (d) {
6756 return d.y;
6757 }).curve(d3__WEBPACK_IMPORTED_MODULE_1__["curveBasis"]); // Insert the line at the right place
6758
6759 var svgPath = svg.insert('path', '#' + insert).attr('class', 'er relationshipLine').attr('d', lineFunction(edge.points)).attr('stroke', conf.stroke).attr('fill', 'none'); // ...and with dashes if necessary
6760
6761 if (rel.relSpec.relType === _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Identification.NON_IDENTIFYING) {
6762 svgPath.attr('stroke-dasharray', '8,8');
6763 } // TODO: Understand this better
6764
6765
6766 var url = '';
6767
6768 if (conf.arrowMarkerAbsolute) {
6769 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
6770 url = url.replace(/\(/g, '\\(');
6771 url = url.replace(/\)/g, '\\)');
6772 } // Decide which start and end markers it needs. It may be possible to be more concise here
6773 // by reversing a start marker to make an end marker...but this will do for now
6774 // Note that the 'A' entity's marker is at the end of the relationship and the 'B' entity's marker is at the start
6775
6776
6777 switch (rel.relSpec.cardA) {
6778 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ZERO_OR_ONE:
6779 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ZERO_OR_ONE_END + ')');
6780 break;
6781
6782 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ZERO_OR_MORE:
6783 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ZERO_OR_MORE_END + ')');
6784 break;
6785
6786 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ONE_OR_MORE:
6787 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ONE_OR_MORE_END + ')');
6788 break;
6789
6790 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ONLY_ONE:
6791 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ONLY_ONE_END + ')');
6792 break;
6793 }
6794
6795 switch (rel.relSpec.cardB) {
6796 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ZERO_OR_ONE:
6797 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ZERO_OR_ONE_START + ')');
6798 break;
6799
6800 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ZERO_OR_MORE:
6801 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ZERO_OR_MORE_START + ')');
6802 break;
6803
6804 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ONE_OR_MORE:
6805 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ONE_OR_MORE_START + ')');
6806 break;
6807
6808 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ONLY_ONE:
6809 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ONLY_ONE_START + ')');
6810 break;
6811 } // Now label the relationship
6812 // Find the half-way point
6813
6814
6815 var len = svgPath.node().getTotalLength();
6816 var labelPoint = svgPath.node().getPointAtLength(len * 0.5); // Append a text node containing the label
6817
6818 var labelId = 'rel' + relCnt;
6819 var labelNode = svg.append('text').attr('class', 'er relationshipLabel').attr('id', labelId).attr('x', labelPoint.x).attr('y', labelPoint.y).attr('text-anchor', 'middle').attr('dominant-baseline', 'middle').attr('style', 'font-family: ' + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().fontFamily + '; font-size: ' + conf.fontSize + 'px').text(rel.roleA); // Figure out how big the opaque 'container' rectangle needs to be
6820
6821 var labelBBox = labelNode.node().getBBox(); // Insert the opaque rectangle before the text label
6822
6823 svg.insert('rect', '#' + labelId).attr('class', 'er relationshipLabelBox').attr('x', labelPoint.x - labelBBox.width / 2).attr('y', labelPoint.y - labelBBox.height / 2).attr('width', labelBBox.width).attr('height', labelBBox.height).attr('fill', 'white').attr('fill-opacity', '85%');
6824 return;
6825};
6826/**
6827 * Draw en E-R diagram in the tag with id: id based on the text definition of the diagram
6828 * @param text the text of the diagram
6829 * @param id the unique id of the DOM node that contains the diagram
6830 */
6831
6832
6833var draw = function draw(text, id) {
6834 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Drawing ER diagram');
6835 _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
6836 var parser = _parser_erDiagram__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
6837 parser.yy = _erDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the text to populate erDb
6838
6839 try {
6840 parser.parse(text);
6841 } catch (err) {
6842 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].debug('Parsing failed');
6843 } // Get a reference to the svg node that contains the text
6844
6845
6846 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id='".concat(id, "']")); // Add cardinality marker definitions to the svg
6847
6848 _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].insertMarkers(svg, conf); // Now we have to construct the diagram in a specific way:
6849 // ---
6850 // 1. Create all the entities in the svg node at 0,0, but with the correct dimensions (allowing for text content)
6851 // 2. Make sure they are all added to the graph
6852 // 3. Add all the edges (relationships) to the graph aswell
6853 // 4. Let dagre do its magic to layout the graph. This assigns:
6854 // - the centre co-ordinates for each node, bearing in mind the dimensions and edge relationships
6855 // - the path co-ordinates for each edge
6856 // But it has no impact on the svg child nodes - the diagram remains with every entity rooted at 0,0
6857 // 5. Now assign a transform to each entity in the svg node so that it gets drawn in the correct place, as determined by
6858 // its centre point, which is obtained from the graph, and it's width and height
6859 // 6. And finally, create all the edges in the svg node using information from the graph
6860 // ---
6861 // Create the graph
6862
6863 var g; // TODO: Explore directed vs undirected graphs, and how the layout is affected
6864 // An E-R diagram could be said to be undirected, but there is merit in setting
6865 // the direction from parent to child in a one-to-many as this influences graphlib to
6866 // put the parent above the child (does it?), which is intuitive. Most relationships
6867 // in ER diagrams are one-to-many.
6868
6869 g = new graphlib__WEBPACK_IMPORTED_MODULE_0___default.a.Graph({
6870 multigraph: true,
6871 directed: true,
6872 compound: false
6873 }).setGraph({
6874 rankdir: conf.layoutDirection,
6875 marginx: 20,
6876 marginy: 20,
6877 nodesep: 100,
6878 edgesep: 100,
6879 ranksep: 100
6880 }).setDefaultEdgeLabel(function () {
6881 return {};
6882 }); // Draw the entities (at 0,0), returning the first svg node that got
6883 // inserted - this represents the insertion point for relationship paths
6884
6885 var firstEntity = drawEntities(svg, _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].getEntities(), g); // TODO: externalise the addition of entities to the graph - it's a bit 'buried' in the above
6886 // Add all the relationships to the graph
6887
6888 var relationships = addRelationships(_erDb__WEBPACK_IMPORTED_MODULE_2__["default"].getRelationships(), g);
6889 dagre__WEBPACK_IMPORTED_MODULE_4___default.a.layout(g); // Node and edge positions will be updated
6890 // Adjust the positions of the entities so that they adhere to the layout
6891
6892 adjustEntities(svg, g); // Draw the relationships
6893
6894 relationships.forEach(function (rel) {
6895 drawRelationshipFromLayout(svg, rel, g, firstEntity);
6896 });
6897 var padding = conf.diagramPadding;
6898 var svgBounds = svg.node().getBBox();
6899 var width = svgBounds.width + padding * 2;
6900 var height = svgBounds.height + padding * 2;
6901
6902 if (conf.useMaxWidth) {
6903 svg.attr('width', '100%');
6904 svg.attr('style', "max-width: ".concat(width, "px;"));
6905 } else {
6906 svg.attr('height', height);
6907 svg.attr('width', width);
6908 }
6909
6910 svg.attr('viewBox', "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height));
6911}; // draw
6912
6913/* harmony default export */ __webpack_exports__["default"] = ({
6914 setConf: setConf,
6915 draw: draw
6916});
6917
6918/***/ }),
6919
6920/***/ "./src/diagrams/er/parser/erDiagram.jison":
6921/*!************************************************!*\
6922 !*** ./src/diagrams/er/parser/erDiagram.jison ***!
6923 \************************************************/
6924/*! no static exports found */
6925/***/ (function(module, exports, __webpack_require__) {
6926
6927/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
6928/*
6929 Returns a Parser object of the following structure:
6930
6931 Parser: {
6932 yy: {}
6933 }
6934
6935 Parser.prototype: {
6936 yy: {},
6937 trace: function(),
6938 symbols_: {associative list: name ==> number},
6939 terminals_: {associative list: number ==> name},
6940 productions_: [...],
6941 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
6942 table: [...],
6943 defaultActions: {...},
6944 parseError: function(str, hash),
6945 parse: function(input),
6946
6947 lexer: {
6948 EOF: 1,
6949 parseError: function(str, hash),
6950 setInput: function(input),
6951 input: function(),
6952 unput: function(str),
6953 more: function(),
6954 less: function(n),
6955 pastInput: function(),
6956 upcomingInput: function(),
6957 showPosition: function(),
6958 test_match: function(regex_match_array, rule_index),
6959 next: function(),
6960 lex: function(),
6961 begin: function(condition),
6962 popState: function(),
6963 _currentRules: function(),
6964 topState: function(),
6965 pushState: function(condition),
6966
6967 options: {
6968 ranges: boolean (optional: true ==> token location info will include a .range[] member)
6969 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
6970 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
6971 },
6972
6973 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
6974 rules: [...],
6975 conditions: {associative list: name ==> set},
6976 }
6977 }
6978
6979
6980 token location info (@$, _$, etc.): {
6981 first_line: n,
6982 last_line: n,
6983 first_column: n,
6984 last_column: n,
6985 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
6986 }
6987
6988
6989 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
6990 text: (matched text)
6991 token: (the produced terminal token, if any)
6992 line: (yylineno)
6993 }
6994 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
6995 loc: (yylloc)
6996 expected: (string describing the set of expected tokens)
6997 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
6998 }
6999*/
7000var parser = (function(){
7001var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,5],$V2=[6,9,11,20,30],$V3=[1,17],$V4=[1,20],$V5=[1,24],$V6=[1,25],$V7=[1,26],$V8=[1,27],$V9=[20,27,28],$Va=[4,6,9,11,20,30],$Vb=[23,24,25,26];
7002var parser = {trace: function trace () { },
7003yy: {},
7004symbols_: {"error":2,"start":3,"ER_DIAGRAM":4,"document":5,"EOF":6,"directive":7,"line":8,"SPACE":9,"statement":10,"NEWLINE":11,"openDirective":12,"typeDirective":13,"closeDirective":14,":":15,"argDirective":16,"entityName":17,"relSpec":18,"role":19,"ALPHANUM":20,"cardinality":21,"relType":22,"ZERO_OR_ONE":23,"ZERO_OR_MORE":24,"ONE_OR_MORE":25,"ONLY_ONE":26,"NON_IDENTIFYING":27,"IDENTIFYING":28,"WORD":29,"open_directive":30,"type_directive":31,"arg_directive":32,"close_directive":33,"$accept":0,"$end":1},
7005terminals_: {2:"error",4:"ER_DIAGRAM",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",20:"ALPHANUM",23:"ZERO_OR_ONE",24:"ZERO_OR_MORE",25:"ONE_OR_MORE",26:"ONLY_ONE",27:"NON_IDENTIFYING",28:"IDENTIFYING",29:"WORD",30:"open_directive",31:"type_directive",32:"arg_directive",33:"close_directive"},
7006productions_: [0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,5],[17,1],[18,3],[21,1],[21,1],[21,1],[21,1],[22,1],[22,1],[19,1],[19,1],[12,1],[13,1],[16,1],[14,1]],
7007performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
7008/* this == yyval */
7009
7010var $0 = $$.length - 1;
7011switch (yystate) {
7012case 1:
7013 /*console.log('finished parsing');*/
7014break;
7015case 3:
7016 this.$ = []
7017break;
7018case 4:
7019$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
7020break;
7021case 5: case 6:
7022 this.$ = $$[$0]
7023break;
7024case 7: case 8:
7025 this.$=[];
7026break;
7027case 12:
7028
7029 yy.addEntity($$[$0-4]);
7030 yy.addEntity($$[$0-2]);
7031 yy.addRelationship($$[$0-4], $$[$0], $$[$0-2], $$[$0-3]);
7032 /*console.log($$[$0-4] + $$[$0-3] + $$[$0-2] + ':' + $$[$0]);*/
7033
7034break;
7035case 13:
7036 this.$ = $$[$0]; /*console.log('Entity: ' + $$[$0]);*/
7037break;
7038case 14:
7039
7040 this.$ = { cardA: $$[$0], relType: $$[$0-1], cardB: $$[$0-2] };
7041 /*console.log('relSpec: ' + $$[$0] + $$[$0-1] + $$[$0-2]);*/
7042
7043break;
7044case 15:
7045 this.$ = yy.Cardinality.ZERO_OR_ONE;
7046break;
7047case 16:
7048 this.$ = yy.Cardinality.ZERO_OR_MORE;
7049break;
7050case 17:
7051 this.$ = yy.Cardinality.ONE_OR_MORE;
7052break;
7053case 18:
7054 this.$ = yy.Cardinality.ONLY_ONE;
7055break;
7056case 19:
7057 this.$ = yy.Identification.NON_IDENTIFYING;
7058break;
7059case 20:
7060 this.$ = yy.Identification.IDENTIFYING;
7061break;
7062case 21:
7063 this.$ = $$[$0].replace(/"/g, '');
7064break;
7065case 22:
7066 this.$ = $$[$0];
7067break;
7068case 23:
7069 yy.parseDirective('%%{', 'open_directive');
7070break;
7071case 24:
7072 yy.parseDirective($$[$0], 'type_directive');
7073break;
7074case 25:
7075 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
7076break;
7077case 26:
7078 yy.parseDirective('}%%', 'close_directive', 'er');
7079break;
7080}
7081},
7082table: [{3:1,4:$V0,7:3,12:4,30:$V1},{1:[3]},o($V2,[2,3],{5:6}),{3:7,4:$V0,7:3,12:4,30:$V1},{13:8,31:[1,9]},{31:[2,23]},{6:[1,10],7:15,8:11,9:[1,12],10:13,11:[1,14],12:4,17:16,20:$V3,30:$V1},{1:[2,2]},{14:18,15:[1,19],33:$V4},o([15,33],[2,24]),o($V2,[2,8],{1:[2,1]}),o($V2,[2,4]),{7:15,10:21,12:4,17:16,20:$V3,30:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,11]),{18:22,21:23,23:$V5,24:$V6,25:$V7,26:$V8},o([15,23,24,25,26],[2,13]),{11:[1,28]},{16:29,32:[1,30]},{11:[2,26]},o($V2,[2,5]),{17:31,20:$V3},{22:32,27:[1,33],28:[1,34]},o($V9,[2,15]),o($V9,[2,16]),o($V9,[2,17]),o($V9,[2,18]),o($Va,[2,9]),{14:35,33:$V4},{33:[2,25]},{15:[1,36]},{21:37,23:$V5,24:$V6,25:$V7,26:$V8},o($Vb,[2,19]),o($Vb,[2,20]),{11:[1,38]},{19:39,20:[1,41],29:[1,40]},{20:[2,14]},o($Va,[2,10]),o($V2,[2,12]),o($V2,[2,21]),o($V2,[2,22])],
7083defaultActions: {5:[2,23],7:[2,2],20:[2,26],30:[2,25],37:[2,14]},
7084parseError: function parseError (str, hash) {
7085 if (hash.recoverable) {
7086 this.trace(str);
7087 } else {
7088 var error = new Error(str);
7089 error.hash = hash;
7090 throw error;
7091 }
7092},
7093parse: function parse(input) {
7094 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
7095 var args = lstack.slice.call(arguments, 1);
7096 var lexer = Object.create(this.lexer);
7097 var sharedState = { yy: {} };
7098 for (var k in this.yy) {
7099 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
7100 sharedState.yy[k] = this.yy[k];
7101 }
7102 }
7103 lexer.setInput(input, sharedState.yy);
7104 sharedState.yy.lexer = lexer;
7105 sharedState.yy.parser = this;
7106 if (typeof lexer.yylloc == 'undefined') {
7107 lexer.yylloc = {};
7108 }
7109 var yyloc = lexer.yylloc;
7110 lstack.push(yyloc);
7111 var ranges = lexer.options && lexer.options.ranges;
7112 if (typeof sharedState.yy.parseError === 'function') {
7113 this.parseError = sharedState.yy.parseError;
7114 } else {
7115 this.parseError = Object.getPrototypeOf(this).parseError;
7116 }
7117 function popStack(n) {
7118 stack.length = stack.length - 2 * n;
7119 vstack.length = vstack.length - n;
7120 lstack.length = lstack.length - n;
7121 }
7122 function lex() {
7123 var token;
7124 token = tstack.pop() || lexer.lex() || EOF;
7125 if (typeof token !== 'number') {
7126 if (token instanceof Array) {
7127 tstack = token;
7128 token = tstack.pop();
7129 }
7130 token = self.symbols_[token] || token;
7131 }
7132 return token;
7133 }
7134 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
7135 while (true) {
7136 state = stack[stack.length - 1];
7137 if (this.defaultActions[state]) {
7138 action = this.defaultActions[state];
7139 } else {
7140 if (symbol === null || typeof symbol == 'undefined') {
7141 symbol = lex();
7142 }
7143 action = table[state] && table[state][symbol];
7144 }
7145 if (typeof action === 'undefined' || !action.length || !action[0]) {
7146 var errStr = '';
7147 expected = [];
7148 for (p in table[state]) {
7149 if (this.terminals_[p] && p > TERROR) {
7150 expected.push('\'' + this.terminals_[p] + '\'');
7151 }
7152 }
7153 if (lexer.showPosition) {
7154 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
7155 } else {
7156 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
7157 }
7158 this.parseError(errStr, {
7159 text: lexer.match,
7160 token: this.terminals_[symbol] || symbol,
7161 line: lexer.yylineno,
7162 loc: yyloc,
7163 expected: expected
7164 });
7165 }
7166 if (action[0] instanceof Array && action.length > 1) {
7167 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
7168 }
7169 switch (action[0]) {
7170 case 1:
7171 stack.push(symbol);
7172 vstack.push(lexer.yytext);
7173 lstack.push(lexer.yylloc);
7174 stack.push(action[1]);
7175 symbol = null;
7176 if (!preErrorSymbol) {
7177 yyleng = lexer.yyleng;
7178 yytext = lexer.yytext;
7179 yylineno = lexer.yylineno;
7180 yyloc = lexer.yylloc;
7181 if (recovering > 0) {
7182 recovering--;
7183 }
7184 } else {
7185 symbol = preErrorSymbol;
7186 preErrorSymbol = null;
7187 }
7188 break;
7189 case 2:
7190 len = this.productions_[action[1]][1];
7191 yyval.$ = vstack[vstack.length - len];
7192 yyval._$ = {
7193 first_line: lstack[lstack.length - (len || 1)].first_line,
7194 last_line: lstack[lstack.length - 1].last_line,
7195 first_column: lstack[lstack.length - (len || 1)].first_column,
7196 last_column: lstack[lstack.length - 1].last_column
7197 };
7198 if (ranges) {
7199 yyval._$.range = [
7200 lstack[lstack.length - (len || 1)].range[0],
7201 lstack[lstack.length - 1].range[1]
7202 ];
7203 }
7204 r = this.performAction.apply(yyval, [
7205 yytext,
7206 yyleng,
7207 yylineno,
7208 sharedState.yy,
7209 action[1],
7210 vstack,
7211 lstack
7212 ].concat(args));
7213 if (typeof r !== 'undefined') {
7214 return r;
7215 }
7216 if (len) {
7217 stack = stack.slice(0, -1 * len * 2);
7218 vstack = vstack.slice(0, -1 * len);
7219 lstack = lstack.slice(0, -1 * len);
7220 }
7221 stack.push(this.productions_[action[1]][0]);
7222 vstack.push(yyval.$);
7223 lstack.push(yyval._$);
7224 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
7225 stack.push(newState);
7226 break;
7227 case 3:
7228 return true;
7229 }
7230 }
7231 return true;
7232}};
7233
7234/* generated by jison-lex 0.3.4 */
7235var lexer = (function(){
7236var lexer = ({
7237
7238EOF:1,
7239
7240parseError:function parseError(str, hash) {
7241 if (this.yy.parser) {
7242 this.yy.parser.parseError(str, hash);
7243 } else {
7244 throw new Error(str);
7245 }
7246 },
7247
7248// resets the lexer, sets new input
7249setInput:function (input, yy) {
7250 this.yy = yy || this.yy || {};
7251 this._input = input;
7252 this._more = this._backtrack = this.done = false;
7253 this.yylineno = this.yyleng = 0;
7254 this.yytext = this.matched = this.match = '';
7255 this.conditionStack = ['INITIAL'];
7256 this.yylloc = {
7257 first_line: 1,
7258 first_column: 0,
7259 last_line: 1,
7260 last_column: 0
7261 };
7262 if (this.options.ranges) {
7263 this.yylloc.range = [0,0];
7264 }
7265 this.offset = 0;
7266 return this;
7267 },
7268
7269// consumes and returns one char from the input
7270input:function () {
7271 var ch = this._input[0];
7272 this.yytext += ch;
7273 this.yyleng++;
7274 this.offset++;
7275 this.match += ch;
7276 this.matched += ch;
7277 var lines = ch.match(/(?:\r\n?|\n).*/g);
7278 if (lines) {
7279 this.yylineno++;
7280 this.yylloc.last_line++;
7281 } else {
7282 this.yylloc.last_column++;
7283 }
7284 if (this.options.ranges) {
7285 this.yylloc.range[1]++;
7286 }
7287
7288 this._input = this._input.slice(1);
7289 return ch;
7290 },
7291
7292// unshifts one char (or a string) into the input
7293unput:function (ch) {
7294 var len = ch.length;
7295 var lines = ch.split(/(?:\r\n?|\n)/g);
7296
7297 this._input = ch + this._input;
7298 this.yytext = this.yytext.substr(0, this.yytext.length - len);
7299 //this.yyleng -= len;
7300 this.offset -= len;
7301 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
7302 this.match = this.match.substr(0, this.match.length - 1);
7303 this.matched = this.matched.substr(0, this.matched.length - 1);
7304
7305 if (lines.length - 1) {
7306 this.yylineno -= lines.length - 1;
7307 }
7308 var r = this.yylloc.range;
7309
7310 this.yylloc = {
7311 first_line: this.yylloc.first_line,
7312 last_line: this.yylineno + 1,
7313 first_column: this.yylloc.first_column,
7314 last_column: lines ?
7315 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
7316 + oldLines[oldLines.length - lines.length].length - lines[0].length :
7317 this.yylloc.first_column - len
7318 };
7319
7320 if (this.options.ranges) {
7321 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
7322 }
7323 this.yyleng = this.yytext.length;
7324 return this;
7325 },
7326
7327// When called from action, caches matched text and appends it on next action
7328more:function () {
7329 this._more = true;
7330 return this;
7331 },
7332
7333// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
7334reject:function () {
7335 if (this.options.backtrack_lexer) {
7336 this._backtrack = true;
7337 } else {
7338 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
7339 text: "",
7340 token: null,
7341 line: this.yylineno
7342 });
7343
7344 }
7345 return this;
7346 },
7347
7348// retain first n characters of the match
7349less:function (n) {
7350 this.unput(this.match.slice(n));
7351 },
7352
7353// displays already matched input, i.e. for error messages
7354pastInput:function () {
7355 var past = this.matched.substr(0, this.matched.length - this.match.length);
7356 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
7357 },
7358
7359// displays upcoming input, i.e. for error messages
7360upcomingInput:function () {
7361 var next = this.match;
7362 if (next.length < 20) {
7363 next += this._input.substr(0, 20-next.length);
7364 }
7365 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
7366 },
7367
7368// displays the character position where the lexing error occurred, i.e. for error messages
7369showPosition:function () {
7370 var pre = this.pastInput();
7371 var c = new Array(pre.length + 1).join("-");
7372 return pre + this.upcomingInput() + "\n" + c + "^";
7373 },
7374
7375// test the lexed token: return FALSE when not a match, otherwise return token
7376test_match:function(match, indexed_rule) {
7377 var token,
7378 lines,
7379 backup;
7380
7381 if (this.options.backtrack_lexer) {
7382 // save context
7383 backup = {
7384 yylineno: this.yylineno,
7385 yylloc: {
7386 first_line: this.yylloc.first_line,
7387 last_line: this.last_line,
7388 first_column: this.yylloc.first_column,
7389 last_column: this.yylloc.last_column
7390 },
7391 yytext: this.yytext,
7392 match: this.match,
7393 matches: this.matches,
7394 matched: this.matched,
7395 yyleng: this.yyleng,
7396 offset: this.offset,
7397 _more: this._more,
7398 _input: this._input,
7399 yy: this.yy,
7400 conditionStack: this.conditionStack.slice(0),
7401 done: this.done
7402 };
7403 if (this.options.ranges) {
7404 backup.yylloc.range = this.yylloc.range.slice(0);
7405 }
7406 }
7407
7408 lines = match[0].match(/(?:\r\n?|\n).*/g);
7409 if (lines) {
7410 this.yylineno += lines.length;
7411 }
7412 this.yylloc = {
7413 first_line: this.yylloc.last_line,
7414 last_line: this.yylineno + 1,
7415 first_column: this.yylloc.last_column,
7416 last_column: lines ?
7417 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
7418 this.yylloc.last_column + match[0].length
7419 };
7420 this.yytext += match[0];
7421 this.match += match[0];
7422 this.matches = match;
7423 this.yyleng = this.yytext.length;
7424 if (this.options.ranges) {
7425 this.yylloc.range = [this.offset, this.offset += this.yyleng];
7426 }
7427 this._more = false;
7428 this._backtrack = false;
7429 this._input = this._input.slice(match[0].length);
7430 this.matched += match[0];
7431 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
7432 if (this.done && this._input) {
7433 this.done = false;
7434 }
7435 if (token) {
7436 return token;
7437 } else if (this._backtrack) {
7438 // recover context
7439 for (var k in backup) {
7440 this[k] = backup[k];
7441 }
7442 return false; // rule action called reject() implying the next rule should be tested instead.
7443 }
7444 return false;
7445 },
7446
7447// return next match in input
7448next:function () {
7449 if (this.done) {
7450 return this.EOF;
7451 }
7452 if (!this._input) {
7453 this.done = true;
7454 }
7455
7456 var token,
7457 match,
7458 tempMatch,
7459 index;
7460 if (!this._more) {
7461 this.yytext = '';
7462 this.match = '';
7463 }
7464 var rules = this._currentRules();
7465 for (var i = 0; i < rules.length; i++) {
7466 tempMatch = this._input.match(this.rules[rules[i]]);
7467 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
7468 match = tempMatch;
7469 index = i;
7470 if (this.options.backtrack_lexer) {
7471 token = this.test_match(tempMatch, rules[i]);
7472 if (token !== false) {
7473 return token;
7474 } else if (this._backtrack) {
7475 match = false;
7476 continue; // rule action called reject() implying a rule MISmatch.
7477 } else {
7478 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
7479 return false;
7480 }
7481 } else if (!this.options.flex) {
7482 break;
7483 }
7484 }
7485 }
7486 if (match) {
7487 token = this.test_match(match, rules[index]);
7488 if (token !== false) {
7489 return token;
7490 }
7491 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
7492 return false;
7493 }
7494 if (this._input === "") {
7495 return this.EOF;
7496 } else {
7497 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
7498 text: "",
7499 token: null,
7500 line: this.yylineno
7501 });
7502 }
7503 },
7504
7505// return next match that has a token
7506lex:function lex () {
7507 var r = this.next();
7508 if (r) {
7509 return r;
7510 } else {
7511 return this.lex();
7512 }
7513 },
7514
7515// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
7516begin:function begin (condition) {
7517 this.conditionStack.push(condition);
7518 },
7519
7520// pop the previously active lexer condition state off the condition stack
7521popState:function popState () {
7522 var n = this.conditionStack.length - 1;
7523 if (n > 0) {
7524 return this.conditionStack.pop();
7525 } else {
7526 return this.conditionStack[0];
7527 }
7528 },
7529
7530// produce the lexer rule set which is active for the currently active lexer condition state
7531_currentRules:function _currentRules () {
7532 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
7533 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
7534 } else {
7535 return this.conditions["INITIAL"].rules;
7536 }
7537 },
7538
7539// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
7540topState:function topState (n) {
7541 n = this.conditionStack.length - 1 - Math.abs(n || 0);
7542 if (n >= 0) {
7543 return this.conditionStack[n];
7544 } else {
7545 return "INITIAL";
7546 }
7547 },
7548
7549// alias for begin(condition)
7550pushState:function pushState (condition) {
7551 this.begin(condition);
7552 },
7553
7554// return the number of states currently on the stack
7555stateStackSize:function stateStackSize() {
7556 return this.conditionStack.length;
7557 },
7558options: {"case-insensitive":true},
7559performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
7560var YYSTATE=YY_START;
7561switch($avoiding_name_collisions) {
7562case 0: this.begin('open_directive'); return 30;
7563break;
7564case 1: this.begin('type_directive'); return 31;
7565break;
7566case 2: this.popState(); this.begin('arg_directive'); return 15;
7567break;
7568case 3: this.popState(); this.popState(); return 33;
7569break;
7570case 4:return 32;
7571break;
7572case 5:/* skip comments */
7573break;
7574case 6:/* skip comments */
7575break;
7576case 7:return 11;
7577break;
7578case 8:/* skip whitespace */
7579break;
7580case 9:return 9;
7581break;
7582case 10:return 29;
7583break;
7584case 11:return 4;
7585break;
7586case 12:return 23;
7587break;
7588case 13:return 24;
7589break;
7590case 14:return 25;
7591break;
7592case 15:return 26;
7593break;
7594case 16:return 23;
7595break;
7596case 17:return 24;
7597break;
7598case 18:return 25;
7599break;
7600case 19:return 27;
7601break;
7602case 20:return 28;
7603break;
7604case 21:return 27;
7605break;
7606case 22:return 27;
7607break;
7608case 23:return 20;
7609break;
7610case 24:return yy_.yytext[0];
7611break;
7612case 25:return 6;
7613break;
7614}
7615},
7616rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\|o\b)/i,/^(?:\}o\b)/i,/^(?:\}\|)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:[A-Za-z][A-Za-z0-9\-]*)/i,/^(?:.)/i,/^(?:$)/i],
7617conditions: {"open_directive":{"rules":[1],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],"inclusive":true}}
7618});
7619return lexer;
7620})();
7621parser.lexer = lexer;
7622function Parser () {
7623 this.yy = {};
7624}
7625Parser.prototype = parser;parser.Parser = Parser;
7626return new Parser;
7627})();
7628
7629
7630if (true) {
7631exports.parser = parser;
7632exports.Parser = parser.Parser;
7633exports.parse = function () { return parser.parse.apply(parser, arguments); };
7634exports.main = function commonjsMain (args) {
7635 if (!args[1]) {
7636 console.log('Usage: '+args[0]+' FILE');
7637 process.exit(1);
7638 }
7639 var source = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
7640 return exports.parser.parse(source);
7641};
7642if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
7643 exports.main(process.argv.slice(1));
7644}
7645}
7646/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
7647
7648/***/ }),
7649
7650/***/ "./src/diagrams/er/styles.js":
7651/*!***********************************!*\
7652 !*** ./src/diagrams/er/styles.js ***!
7653 \***********************************/
7654/*! exports provided: default */
7655/***/ (function(module, __webpack_exports__, __webpack_require__) {
7656
7657"use strict";
7658__webpack_require__.r(__webpack_exports__);
7659var getStyles = function getStyles(options) {
7660 return "\n .entityBox {\n fill: ".concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n }\n\n .relationshipLabelBox {\n fill: ").concat(options.tertiaryColor, ";\n opacity: 0.7;\n background-color: ").concat(options.tertiaryColor, ";\n rect {\n opacity: 0.5;\n }\n }\n\n .relationshipLine {\n stroke: ").concat(options.lineColor, ";\n }\n");
7661};
7662
7663/* harmony default export */ __webpack_exports__["default"] = (getStyles);
7664
7665/***/ }),
7666
7667/***/ "./src/diagrams/flowchart/flowChartShapes.js":
7668/*!***************************************************!*\
7669 !*** ./src/diagrams/flowchart/flowChartShapes.js ***!
7670 \***************************************************/
7671/*! exports provided: addToRender, addToRenderV2, default */
7672/***/ (function(module, __webpack_exports__, __webpack_require__) {
7673
7674"use strict";
7675__webpack_require__.r(__webpack_exports__);
7676/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addToRender", function() { return addToRender; });
7677/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addToRenderV2", function() { return addToRenderV2; });
7678/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dagre-d3 */ "dagre-d3");
7679/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dagre_d3__WEBPACK_IMPORTED_MODULE_0__);
7680
7681
7682function question(parent, bbox, node) {
7683 var w = bbox.width;
7684 var h = bbox.height;
7685 var s = (w + h) * 0.9;
7686 var points = [{
7687 x: s / 2,
7688 y: 0
7689 }, {
7690 x: s,
7691 y: -s / 2
7692 }, {
7693 x: s / 2,
7694 y: -s
7695 }, {
7696 x: 0,
7697 y: -s / 2
7698 }];
7699 var shapeSvg = insertPolygonShape(parent, s, s, points);
7700
7701 node.intersect = function (point) {
7702 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
7703 };
7704
7705 return shapeSvg;
7706}
7707
7708function hexagon(parent, bbox, node) {
7709 var f = 4;
7710 var h = bbox.height;
7711 var m = h / f;
7712 var w = bbox.width + 2 * m;
7713 var points = [{
7714 x: m,
7715 y: 0
7716 }, {
7717 x: w - m,
7718 y: 0
7719 }, {
7720 x: w,
7721 y: -h / 2
7722 }, {
7723 x: w - m,
7724 y: -h
7725 }, {
7726 x: m,
7727 y: -h
7728 }, {
7729 x: 0,
7730 y: -h / 2
7731 }];
7732 var shapeSvg = insertPolygonShape(parent, w, h, points);
7733
7734 node.intersect = function (point) {
7735 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
7736 };
7737
7738 return shapeSvg;
7739}
7740
7741function rect_left_inv_arrow(parent, bbox, node) {
7742 var w = bbox.width;
7743 var h = bbox.height;
7744 var points = [{
7745 x: -h / 2,
7746 y: 0
7747 }, {
7748 x: w,
7749 y: 0
7750 }, {
7751 x: w,
7752 y: -h
7753 }, {
7754 x: -h / 2,
7755 y: -h
7756 }, {
7757 x: 0,
7758 y: -h / 2
7759 }];
7760 var shapeSvg = insertPolygonShape(parent, w, h, points);
7761
7762 node.intersect = function (point) {
7763 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
7764 };
7765
7766 return shapeSvg;
7767}
7768
7769function lean_right(parent, bbox, node) {
7770 var w = bbox.width;
7771 var h = bbox.height;
7772 var points = [{
7773 x: -2 * h / 6,
7774 y: 0
7775 }, {
7776 x: w - h / 6,
7777 y: 0
7778 }, {
7779 x: w + 2 * h / 6,
7780 y: -h
7781 }, {
7782 x: h / 6,
7783 y: -h
7784 }];
7785 var shapeSvg = insertPolygonShape(parent, w, h, points);
7786
7787 node.intersect = function (point) {
7788 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
7789 };
7790
7791 return shapeSvg;
7792}
7793
7794function lean_left(parent, bbox, node) {
7795 var w = bbox.width;
7796 var h = bbox.height;
7797 var points = [{
7798 x: 2 * h / 6,
7799 y: 0
7800 }, {
7801 x: w + h / 6,
7802 y: 0
7803 }, {
7804 x: w - 2 * h / 6,
7805 y: -h
7806 }, {
7807 x: -h / 6,
7808 y: -h
7809 }];
7810 var shapeSvg = insertPolygonShape(parent, w, h, points);
7811
7812 node.intersect = function (point) {
7813 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
7814 };
7815
7816 return shapeSvg;
7817}
7818
7819function trapezoid(parent, bbox, node) {
7820 var w = bbox.width;
7821 var h = bbox.height;
7822 var points = [{
7823 x: -2 * h / 6,
7824 y: 0
7825 }, {
7826 x: w + 2 * h / 6,
7827 y: 0
7828 }, {
7829 x: w - h / 6,
7830 y: -h
7831 }, {
7832 x: h / 6,
7833 y: -h
7834 }];
7835 var shapeSvg = insertPolygonShape(parent, w, h, points);
7836
7837 node.intersect = function (point) {
7838 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
7839 };
7840
7841 return shapeSvg;
7842}
7843
7844function inv_trapezoid(parent, bbox, node) {
7845 var w = bbox.width;
7846 var h = bbox.height;
7847 var points = [{
7848 x: h / 6,
7849 y: 0
7850 }, {
7851 x: w - h / 6,
7852 y: 0
7853 }, {
7854 x: w + 2 * h / 6,
7855 y: -h
7856 }, {
7857 x: -2 * h / 6,
7858 y: -h
7859 }];
7860 var shapeSvg = insertPolygonShape(parent, w, h, points);
7861
7862 node.intersect = function (point) {
7863 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
7864 };
7865
7866 return shapeSvg;
7867}
7868
7869function rect_right_inv_arrow(parent, bbox, node) {
7870 var w = bbox.width;
7871 var h = bbox.height;
7872 var points = [{
7873 x: 0,
7874 y: 0
7875 }, {
7876 x: w + h / 2,
7877 y: 0
7878 }, {
7879 x: w,
7880 y: -h / 2
7881 }, {
7882 x: w + h / 2,
7883 y: -h
7884 }, {
7885 x: 0,
7886 y: -h
7887 }];
7888 var shapeSvg = insertPolygonShape(parent, w, h, points);
7889
7890 node.intersect = function (point) {
7891 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
7892 };
7893
7894 return shapeSvg;
7895}
7896
7897function stadium(parent, bbox, node) {
7898 var h = bbox.height;
7899 var w = bbox.width + h / 4;
7900 var shapeSvg = parent.insert('rect', ':first-child').attr('rx', h / 2).attr('ry', h / 2).attr('x', -w / 2).attr('y', -h / 2).attr('width', w).attr('height', h);
7901
7902 node.intersect = function (point) {
7903 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.rect(node, point);
7904 };
7905
7906 return shapeSvg;
7907}
7908
7909function subroutine(parent, bbox, node) {
7910 var w = bbox.width;
7911 var h = bbox.height;
7912 var points = [{
7913 x: 0,
7914 y: 0
7915 }, {
7916 x: w,
7917 y: 0
7918 }, {
7919 x: w,
7920 y: -h
7921 }, {
7922 x: 0,
7923 y: -h
7924 }, {
7925 x: 0,
7926 y: 0
7927 }, {
7928 x: -8,
7929 y: 0
7930 }, {
7931 x: w + 8,
7932 y: 0
7933 }, {
7934 x: w + 8,
7935 y: -h
7936 }, {
7937 x: -8,
7938 y: -h
7939 }, {
7940 x: -8,
7941 y: 0
7942 }];
7943 var shapeSvg = insertPolygonShape(parent, w, h, points);
7944
7945 node.intersect = function (point) {
7946 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
7947 };
7948
7949 return shapeSvg;
7950}
7951
7952function cylinder(parent, bbox, node) {
7953 var w = bbox.width;
7954 var rx = w / 2;
7955 var ry = rx / (2.5 + w / 50);
7956 var h = bbox.height + ry;
7957 var shape = 'M 0,' + ry + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 a ' + rx + ',' + ry + ' 0,0,0 ' + -w + ' 0 l 0,' + h + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 l 0,' + -h;
7958 var shapeSvg = parent.attr('label-offset-y', ry).insert('path', ':first-child').attr('d', shape).attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');
7959
7960 node.intersect = function (point) {
7961 var pos = dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.rect(node, point);
7962 var x = pos.x - node.x;
7963
7964 if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
7965 // ellipsis equation: x*x / a*a + y*y / b*b = 1
7966 // solve for y to get adjustion value for pos.y
7967 var y = ry * ry * (1 - x * x / (rx * rx));
7968 if (y != 0) y = Math.sqrt(y);
7969 y = ry - y;
7970 if (point.y - node.y > 0) y = -y;
7971 pos.y += y;
7972 }
7973
7974 return pos;
7975 };
7976
7977 return shapeSvg;
7978}
7979
7980function addToRender(render) {
7981 render.shapes().question = question;
7982 render.shapes().hexagon = hexagon;
7983 render.shapes().stadium = stadium;
7984 render.shapes().subroutine = subroutine;
7985 render.shapes().cylinder = cylinder; // Add custom shape for box with inverted arrow on left side
7986
7987 render.shapes().rect_left_inv_arrow = rect_left_inv_arrow; // Add custom shape for box with inverted arrow on left side
7988
7989 render.shapes().lean_right = lean_right; // Add custom shape for box with inverted arrow on left side
7990
7991 render.shapes().lean_left = lean_left; // Add custom shape for box with inverted arrow on left side
7992
7993 render.shapes().trapezoid = trapezoid; // Add custom shape for box with inverted arrow on left side
7994
7995 render.shapes().inv_trapezoid = inv_trapezoid; // Add custom shape for box with inverted arrow on right side
7996
7997 render.shapes().rect_right_inv_arrow = rect_right_inv_arrow;
7998}
7999function addToRenderV2(addShape) {
8000 addShape({
8001 question: question
8002 });
8003 addShape({
8004 hexagon: hexagon
8005 });
8006 addShape({
8007 stadium: stadium
8008 });
8009 addShape({
8010 subroutine: subroutine
8011 });
8012 addShape({
8013 cylinder: cylinder
8014 }); // Add custom shape for box with inverted arrow on left side
8015
8016 addShape({
8017 rect_left_inv_arrow: rect_left_inv_arrow
8018 }); // Add custom shape for box with inverted arrow on left side
8019
8020 addShape({
8021 lean_right: lean_right
8022 }); // Add custom shape for box with inverted arrow on left side
8023
8024 addShape({
8025 lean_left: lean_left
8026 }); // Add custom shape for box with inverted arrow on left side
8027
8028 addShape({
8029 trapezoid: trapezoid
8030 }); // Add custom shape for box with inverted arrow on left side
8031
8032 addShape({
8033 inv_trapezoid: inv_trapezoid
8034 }); // Add custom shape for box with inverted arrow on right side
8035
8036 addShape({
8037 rect_right_inv_arrow: rect_right_inv_arrow
8038 });
8039}
8040
8041function insertPolygonShape(parent, w, h, points) {
8042 return parent.insert('polygon', ':first-child').attr('points', points.map(function (d) {
8043 return d.x + ',' + d.y;
8044 }).join(' ')).attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');
8045}
8046
8047/* harmony default export */ __webpack_exports__["default"] = ({
8048 addToRender: addToRender,
8049 addToRenderV2: addToRenderV2
8050});
8051
8052/***/ }),
8053
8054/***/ "./src/diagrams/flowchart/flowDb.js":
8055/*!******************************************!*\
8056 !*** ./src/diagrams/flowchart/flowDb.js ***!
8057 \******************************************/
8058/*! exports provided: parseDirective, addVertex, addSingleLink, addLink, updateLinkInterpolate, updateLink, addClass, setDirection, setClass, setLink, getTooltip, setClickEvent, bindFunctions, getDirection, getVertices, getEdges, getClasses, clear, defaultStyle, addSubGraph, getDepthFirstPos, indexNodes, getSubGraphs, firstGraph, default */
8059/***/ (function(module, __webpack_exports__, __webpack_require__) {
8060
8061"use strict";
8062__webpack_require__.r(__webpack_exports__);
8063/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
8064/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addVertex", function() { return addVertex; });
8065/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSingleLink", function() { return addSingleLink; });
8066/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addLink", function() { return addLink; });
8067/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateLinkInterpolate", function() { return updateLinkInterpolate; });
8068/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateLink", function() { return updateLink; });
8069/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addClass", function() { return addClass; });
8070/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setDirection", function() { return setDirection; });
8071/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setClass", function() { return setClass; });
8072/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLink", function() { return setLink; });
8073/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTooltip", function() { return getTooltip; });
8074/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setClickEvent", function() { return setClickEvent; });
8075/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindFunctions", function() { return bindFunctions; });
8076/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDirection", function() { return getDirection; });
8077/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getVertices", function() { return getVertices; });
8078/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getEdges", function() { return getEdges; });
8079/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClasses", function() { return getClasses; });
8080/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
8081/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultStyle", function() { return defaultStyle; });
8082/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSubGraph", function() { return addSubGraph; });
8083/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDepthFirstPos", function() { return getDepthFirstPos; });
8084/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "indexNodes", function() { return indexNodes; });
8085/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSubGraphs", function() { return getSubGraphs; });
8086/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "firstGraph", function() { return firstGraph; });
8087/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
8088/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
8089/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
8090/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
8091/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
8092/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
8093function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
8094
8095
8096
8097
8098
8099 // const MERMAID_DOM_ID_PREFIX = 'mermaid-dom-id-';
8100
8101var MERMAID_DOM_ID_PREFIX = '';
8102var config = _config__WEBPACK_IMPORTED_MODULE_2__["defaultConfig"];
8103var vertices = {};
8104var edges = [];
8105var classes = [];
8106var subGraphs = [];
8107var subGraphLookup = {};
8108var tooltips = {};
8109var subCount = 0;
8110var firstGraphFlag = true;
8111var direction; // Functions to be run after graph rendering
8112
8113var funs = [];
8114var parseDirective = function parseDirective(statement, context, type) {
8115 _mermaidAPI__WEBPACK_IMPORTED_MODULE_4__["default"].parseDirective(this, statement, context, type);
8116};
8117/**
8118 * Function called by parser when a node definition has been found
8119 * @param id
8120 * @param text
8121 * @param type
8122 * @param style
8123 * @param classes
8124 */
8125
8126var addVertex = function addVertex(_id, text, type, style, classes) {
8127 var txt;
8128 var id = _id;
8129
8130 if (typeof id === 'undefined') {
8131 return;
8132 }
8133
8134 if (id.trim().length === 0) {
8135 return;
8136 }
8137
8138 if (id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
8139
8140 if (typeof vertices[id] === 'undefined') {
8141 vertices[id] = {
8142 id: id,
8143 styles: [],
8144 classes: []
8145 };
8146 }
8147
8148 if (typeof text !== 'undefined') {
8149 config = _config__WEBPACK_IMPORTED_MODULE_2__["defaultConfig"];
8150 txt = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(text.trim(), config); // strip quotes if string starts and ends with a quote
8151
8152 if (txt[0] === '"' && txt[txt.length - 1] === '"') {
8153 txt = txt.substring(1, txt.length - 1);
8154 }
8155
8156 vertices[id].text = txt;
8157 } else {
8158 if (typeof vertices[id].text === 'undefined') {
8159 vertices[id].text = _id;
8160 }
8161 }
8162
8163 if (typeof type !== 'undefined') {
8164 vertices[id].type = type;
8165 }
8166
8167 if (typeof style !== 'undefined') {
8168 if (style !== null) {
8169 style.forEach(function (s) {
8170 vertices[id].styles.push(s);
8171 });
8172 }
8173 }
8174
8175 if (typeof classes !== 'undefined') {
8176 if (classes !== null) {
8177 classes.forEach(function (s) {
8178 vertices[id].classes.push(s);
8179 });
8180 }
8181 }
8182};
8183/**
8184 * Function called by parser when a link/edge definition has been found
8185 * @param start
8186 * @param end
8187 * @param type
8188 * @param linktext
8189 */
8190
8191var addSingleLink = function addSingleLink(_start, _end, type, linktext) {
8192 var start = _start;
8193 var end = _end;
8194 if (start[0].match(/\d/)) start = MERMAID_DOM_ID_PREFIX + start;
8195 if (end[0].match(/\d/)) end = MERMAID_DOM_ID_PREFIX + end; // logger.info('Got edge...', start, end);
8196
8197 var edge = {
8198 start: start,
8199 end: end,
8200 type: undefined,
8201 text: ''
8202 };
8203 linktext = type.text;
8204
8205 if (typeof linktext !== 'undefined') {
8206 edge.text = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(linktext.trim(), config); // strip quotes if string starts and exnds with a quote
8207
8208 if (edge.text[0] === '"' && edge.text[edge.text.length - 1] === '"') {
8209 edge.text = edge.text.substring(1, edge.text.length - 1);
8210 }
8211 }
8212
8213 if (typeof type !== 'undefined') {
8214 edge.type = type.type;
8215 edge.stroke = type.stroke;
8216 }
8217
8218 edges.push(edge);
8219};
8220var addLink = function addLink(_start, _end, type, linktext) {
8221 var i, j;
8222
8223 for (i = 0; i < _start.length; i++) {
8224 for (j = 0; j < _end.length; j++) {
8225 addSingleLink(_start[i], _end[j], type, linktext);
8226 }
8227 }
8228};
8229/**
8230 * Updates a link's line interpolation algorithm
8231 * @param pos
8232 * @param interpolate
8233 */
8234
8235var updateLinkInterpolate = function updateLinkInterpolate(positions, interp) {
8236 positions.forEach(function (pos) {
8237 if (pos === 'default') {
8238 edges.defaultInterpolate = interp;
8239 } else {
8240 edges[pos].interpolate = interp;
8241 }
8242 });
8243};
8244/**
8245 * Updates a link with a style
8246 * @param pos
8247 * @param style
8248 */
8249
8250var updateLink = function updateLink(positions, style) {
8251 positions.forEach(function (pos) {
8252 if (pos === 'default') {
8253 edges.defaultStyle = style;
8254 } else {
8255 if (_utils__WEBPACK_IMPORTED_MODULE_1__["default"].isSubstringInArray('fill', style) === -1) {
8256 style.push('fill:none');
8257 }
8258
8259 edges[pos].style = style;
8260 }
8261 });
8262};
8263var addClass = function addClass(id, style) {
8264 if (typeof classes[id] === 'undefined') {
8265 classes[id] = {
8266 id: id,
8267 styles: [],
8268 textStyles: []
8269 };
8270 }
8271
8272 if (typeof style !== 'undefined') {
8273 if (style !== null) {
8274 style.forEach(function (s) {
8275 if (s.match('color')) {
8276 var newStyle1 = s.replace('fill', 'bgFill');
8277 var newStyle2 = newStyle1.replace('color', 'fill');
8278 classes[id].textStyles.push(newStyle2);
8279 }
8280
8281 classes[id].styles.push(s);
8282 });
8283 }
8284 }
8285};
8286/**
8287 * Called by parser when a graph definition is found, stores the direction of the chart.
8288 * @param dir
8289 */
8290
8291var setDirection = function setDirection(dir) {
8292 direction = dir;
8293
8294 if (direction.match(/.*</)) {
8295 direction = 'RL';
8296 }
8297
8298 if (direction.match(/.*\^/)) {
8299 direction = 'BT';
8300 }
8301
8302 if (direction.match(/.*>/)) {
8303 direction = 'LR';
8304 }
8305
8306 if (direction.match(/.*v/)) {
8307 direction = 'TB';
8308 }
8309};
8310/**
8311 * Called by parser when a special node is found, e.g. a clickable element.
8312 * @param ids Comma separated list of ids
8313 * @param className Class to add
8314 */
8315
8316var setClass = function setClass(ids, className) {
8317 ids.split(',').forEach(function (_id) {
8318 var id = _id;
8319 if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
8320
8321 if (typeof vertices[id] !== 'undefined') {
8322 vertices[id].classes.push(className);
8323 }
8324
8325 if (typeof subGraphLookup[id] !== 'undefined') {
8326 subGraphLookup[id].classes.push(className);
8327 }
8328 });
8329};
8330
8331var setTooltip = function setTooltip(ids, tooltip) {
8332 ids.split(',').forEach(function (id) {
8333 if (typeof tooltip !== 'undefined') {
8334 tooltips[id] = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(tooltip, config);
8335 }
8336 });
8337};
8338
8339var setClickFun = function setClickFun(_id, functionName) {
8340 var id = _id;
8341 if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
8342
8343 if (_config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]().securityLevel !== 'loose') {
8344 return;
8345 }
8346
8347 if (typeof functionName === 'undefined') {
8348 return;
8349 }
8350
8351 if (typeof vertices[id] !== 'undefined') {
8352 funs.push(function () {
8353 var elem = document.querySelector("[id=\"".concat(id, "\"]"));
8354
8355 if (elem !== null) {
8356 elem.addEventListener('click', function () {
8357 _utils__WEBPACK_IMPORTED_MODULE_1__["default"].runFunc(functionName, id);
8358 }, false);
8359 }
8360 });
8361 }
8362};
8363/**
8364 * Called by parser when a link is found. Adds the URL to the vertex data.
8365 * @param ids Comma separated list of ids
8366 * @param linkStr URL to create a link for
8367 * @param tooltip Tooltip for the clickable element
8368 */
8369
8370
8371var setLink = function setLink(ids, linkStr, tooltip, target) {
8372 ids.split(',').forEach(function (_id) {
8373 var id = _id;
8374 if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
8375
8376 if (typeof vertices[id] !== 'undefined') {
8377 vertices[id].link = _utils__WEBPACK_IMPORTED_MODULE_1__["default"].formatUrl(linkStr, config);
8378 vertices[id].linkTarget = target;
8379 }
8380 });
8381 setTooltip(ids, tooltip);
8382 setClass(ids, 'clickable');
8383};
8384var getTooltip = function getTooltip(id) {
8385 return tooltips[id];
8386};
8387/**
8388 * Called by parser when a click definition is found. Registers an event handler.
8389 * @param ids Comma separated list of ids
8390 * @param functionName Function to be called on click
8391 * @param tooltip Tooltip for the clickable element
8392 */
8393
8394var setClickEvent = function setClickEvent(ids, functionName, tooltip) {
8395 ids.split(',').forEach(function (id) {
8396 setClickFun(id, functionName);
8397 });
8398 setTooltip(ids, tooltip);
8399 setClass(ids, 'clickable');
8400};
8401var bindFunctions = function bindFunctions(element) {
8402 funs.forEach(function (fun) {
8403 fun(element);
8404 });
8405};
8406var getDirection = function getDirection() {
8407 return direction.trim();
8408};
8409/**
8410 * Retrieval function for fetching the found nodes after parsing has completed.
8411 * @returns {{}|*|vertices}
8412 */
8413
8414var getVertices = function getVertices() {
8415 return vertices;
8416};
8417/**
8418 * Retrieval function for fetching the found links after parsing has completed.
8419 * @returns {{}|*|edges}
8420 */
8421
8422var getEdges = function getEdges() {
8423 return edges;
8424};
8425/**
8426 * Retrieval function for fetching the found class definitions after parsing has completed.
8427 * @returns {{}|*|classes}
8428 */
8429
8430var getClasses = function getClasses() {
8431 return classes;
8432};
8433
8434var setupToolTips = function setupToolTips(element) {
8435 var tooltipElem = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('.mermaidTooltip');
8436
8437 if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
8438 tooltipElem = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
8439 }
8440
8441 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(element).select('svg');
8442 var nodes = svg.selectAll('g.node');
8443 nodes.on('mouseover', function () {
8444 var el = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(this);
8445 var title = el.attr('title'); // Dont try to draw a tooltip if no data is provided
8446
8447 if (title === null) {
8448 return;
8449 }
8450
8451 var rect = this.getBoundingClientRect();
8452 tooltipElem.transition().duration(200).style('opacity', '.9');
8453 tooltipElem.html(el.attr('title')).style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px').style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
8454 el.classed('hover', true);
8455 }).on('mouseout', function () {
8456 tooltipElem.transition().duration(500).style('opacity', 0);
8457 var el = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(this);
8458 el.classed('hover', false);
8459 });
8460};
8461
8462funs.push(setupToolTips);
8463/**
8464 * Clears the internal graph db so that a new graph can be parsed.
8465 */
8466
8467var clear = function clear() {
8468 vertices = {};
8469 classes = {};
8470 edges = [];
8471 funs = [];
8472 funs.push(setupToolTips);
8473 subGraphs = [];
8474 subGraphLookup = {};
8475 subCount = 0;
8476 tooltips = [];
8477 firstGraphFlag = true;
8478};
8479/**
8480 *
8481 * @returns {string}
8482 */
8483
8484var defaultStyle = function defaultStyle() {
8485 return 'fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;';
8486};
8487/**
8488 * Clears the internal graph db so that a new graph can be parsed.
8489 */
8490
8491var addSubGraph = function addSubGraph(_id, list, _title) {
8492 var id = _id.trim();
8493
8494 var title = _title;
8495
8496 if (_id === _title && _title.match(/\s/)) {
8497 id = undefined;
8498 }
8499
8500 function uniq(a) {
8501 var prims = {
8502 boolean: {},
8503 number: {},
8504 string: {}
8505 };
8506 var objs = [];
8507 return a.filter(function (item) {
8508 var type = _typeof(item);
8509
8510 if (item.trim() === '') {
8511 return false;
8512 }
8513
8514 if (type in prims) {
8515 return prims[type].hasOwnProperty(item) ? false : prims[type][item] = true; // eslint-disable-line
8516 } else {
8517 return objs.indexOf(item) >= 0 ? false : objs.push(item);
8518 }
8519 });
8520 }
8521
8522 var nodeList = [];
8523 nodeList = uniq(nodeList.concat.apply(nodeList, list));
8524
8525 for (var i = 0; i < nodeList.length; i++) {
8526 if (nodeList[i][0].match(/\d/)) nodeList[i] = MERMAID_DOM_ID_PREFIX + nodeList[i];
8527 }
8528
8529 id = id || 'subGraph' + subCount;
8530 if (id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
8531 title = title || '';
8532 title = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(title, config);
8533 subCount = subCount + 1;
8534 var subGraph = {
8535 id: id,
8536 nodes: nodeList,
8537 title: title.trim(),
8538 classes: []
8539 };
8540 subGraphs.push(subGraph);
8541 subGraphLookup[id] = subGraph;
8542 return id;
8543};
8544
8545var getPosForId = function getPosForId(id) {
8546 for (var i = 0; i < subGraphs.length; i++) {
8547 if (subGraphs[i].id === id) {
8548 return i;
8549 }
8550 }
8551
8552 return -1;
8553};
8554
8555var secCount = -1;
8556var posCrossRef = [];
8557
8558var indexNodes2 = function indexNodes2(id, pos) {
8559 var nodes = subGraphs[pos].nodes;
8560 secCount = secCount + 1;
8561
8562 if (secCount > 2000) {
8563 return;
8564 }
8565
8566 posCrossRef[secCount] = pos; // Check if match
8567
8568 if (subGraphs[pos].id === id) {
8569 return {
8570 result: true,
8571 count: 0
8572 };
8573 }
8574
8575 var count = 0;
8576 var posCount = 1;
8577
8578 while (count < nodes.length) {
8579 var childPos = getPosForId(nodes[count]); // Ignore regular nodes (pos will be -1)
8580
8581 if (childPos >= 0) {
8582 var res = indexNodes2(id, childPos);
8583
8584 if (res.result) {
8585 return {
8586 result: true,
8587 count: posCount + res.count
8588 };
8589 } else {
8590 posCount = posCount + res.count;
8591 }
8592 }
8593
8594 count = count + 1;
8595 }
8596
8597 return {
8598 result: false,
8599 count: posCount
8600 };
8601};
8602
8603var getDepthFirstPos = function getDepthFirstPos(pos) {
8604 return posCrossRef[pos];
8605};
8606var indexNodes = function indexNodes() {
8607 secCount = -1;
8608
8609 if (subGraphs.length > 0) {
8610 indexNodes2('none', subGraphs.length - 1, 0);
8611 }
8612};
8613var getSubGraphs = function getSubGraphs() {
8614 return subGraphs;
8615};
8616var firstGraph = function firstGraph() {
8617 if (firstGraphFlag) {
8618 firstGraphFlag = false;
8619 return true;
8620 }
8621
8622 return false;
8623};
8624
8625var destructStartLink = function destructStartLink(_str) {
8626 var str = _str.trim();
8627
8628 switch (str) {
8629 case '<--':
8630 return {
8631 type: 'arrow_point',
8632 stroke: 'normal'
8633 };
8634
8635 case 'x--':
8636 return {
8637 type: 'arrow_cross',
8638 stroke: 'normal'
8639 };
8640
8641 case 'o--':
8642 return {
8643 type: 'arrow_circle',
8644 stroke: 'normal'
8645 };
8646
8647 case '<-.':
8648 return {
8649 type: 'arrow_point',
8650 stroke: 'dotted'
8651 };
8652
8653 case 'x-.':
8654 return {
8655 type: 'arrow_cross',
8656 stroke: 'dotted'
8657 };
8658
8659 case 'o-.':
8660 return {
8661 type: 'arrow_circle',
8662 stroke: 'dotted'
8663 };
8664
8665 case '<==':
8666 return {
8667 type: 'arrow_point',
8668 stroke: 'thick'
8669 };
8670
8671 case 'x==':
8672 return {
8673 type: 'arrow_cross',
8674 stroke: 'thick'
8675 };
8676
8677 case 'o==':
8678 return {
8679 type: 'arrow_circle',
8680 stroke: 'thick'
8681 };
8682
8683 case '--':
8684 return {
8685 type: 'arrow_open',
8686 stroke: 'normal'
8687 };
8688
8689 case '==':
8690 return {
8691 type: 'arrow_open',
8692 stroke: 'thick'
8693 };
8694
8695 case '-.':
8696 return {
8697 type: 'arrow_open',
8698 stroke: 'dotted'
8699 };
8700 }
8701};
8702
8703var destructEndLink = function destructEndLink(_str) {
8704 var str = _str.trim();
8705
8706 switch (str) {
8707 case '--x':
8708 return {
8709 type: 'arrow_cross',
8710 stroke: 'normal'
8711 };
8712
8713 case '-->':
8714 return {
8715 type: 'arrow_point',
8716 stroke: 'normal'
8717 };
8718
8719 case '<-->':
8720 return {
8721 type: 'double_arrow_point',
8722 stroke: 'normal'
8723 };
8724
8725 case 'x--x':
8726 return {
8727 type: 'double_arrow_cross',
8728 stroke: 'normal'
8729 };
8730
8731 case 'o--o':
8732 return {
8733 type: 'double_arrow_circle',
8734 stroke: 'normal'
8735 };
8736
8737 case 'o.-o':
8738 return {
8739 type: 'double_arrow_circle',
8740 stroke: 'dotted'
8741 };
8742
8743 case '<==>':
8744 return {
8745 type: 'double_arrow_point',
8746 stroke: 'thick'
8747 };
8748
8749 case 'o==o':
8750 return {
8751 type: 'double_arrow_circle',
8752 stroke: 'thick'
8753 };
8754
8755 case 'x==x':
8756 return {
8757 type: 'double_arrow_cross',
8758 stroke: 'thick'
8759 };
8760
8761 case 'x.-x':
8762 return {
8763 type: 'double_arrow_cross',
8764 stroke: 'dotted'
8765 };
8766
8767 case 'x-.-x':
8768 return {
8769 type: 'double_arrow_cross',
8770 stroke: 'dotted'
8771 };
8772
8773 case '<.->':
8774 return {
8775 type: 'double_arrow_point',
8776 stroke: 'dotted'
8777 };
8778
8779 case '<-.->':
8780 return {
8781 type: 'double_arrow_point',
8782 stroke: 'dotted'
8783 };
8784
8785 case 'o-.-o':
8786 return {
8787 type: 'double_arrow_circle',
8788 stroke: 'dotted'
8789 };
8790
8791 case '--o':
8792 return {
8793 type: 'arrow_circle',
8794 stroke: 'normal'
8795 };
8796
8797 case '---':
8798 return {
8799 type: 'arrow_open',
8800 stroke: 'normal'
8801 };
8802
8803 case '-.-x':
8804 return {
8805 type: 'arrow_cross',
8806 stroke: 'dotted'
8807 };
8808
8809 case '-.->':
8810 return {
8811 type: 'arrow_point',
8812 stroke: 'dotted'
8813 };
8814
8815 case '-.-o':
8816 return {
8817 type: 'arrow_circle',
8818 stroke: 'dotted'
8819 };
8820
8821 case '-.-':
8822 return {
8823 type: 'arrow_open',
8824 stroke: 'dotted'
8825 };
8826
8827 case '.-x':
8828 return {
8829 type: 'arrow_cross',
8830 stroke: 'dotted'
8831 };
8832
8833 case '.->':
8834 return {
8835 type: 'arrow_point',
8836 stroke: 'dotted'
8837 };
8838
8839 case '.-o':
8840 return {
8841 type: 'arrow_circle',
8842 stroke: 'dotted'
8843 };
8844
8845 case '.-':
8846 return {
8847 type: 'arrow_open',
8848 stroke: 'dotted'
8849 };
8850
8851 case '==x':
8852 return {
8853 type: 'arrow_cross',
8854 stroke: 'thick'
8855 };
8856
8857 case '==>':
8858 return {
8859 type: 'arrow_point',
8860 stroke: 'thick'
8861 };
8862
8863 case '==o':
8864 return {
8865 type: 'arrow_circle',
8866 stroke: 'thick'
8867 };
8868
8869 case '===':
8870 return {
8871 type: 'arrow_open',
8872 stroke: 'thick'
8873 };
8874 }
8875};
8876
8877var destructLink = function destructLink(_str, _startStr) {
8878 var info = destructEndLink(_str);
8879 var startInfo;
8880
8881 if (_startStr) {
8882 startInfo = destructStartLink(_startStr);
8883
8884 if (startInfo.stroke !== info.stroke) {
8885 return {
8886 type: 'INVALID',
8887 stroke: 'INVALID'
8888 };
8889 }
8890
8891 if (startInfo.type === 'arrow_open') {
8892 // -- xyz --> - take arrow type form ending
8893 startInfo.type = info.type;
8894 } else {
8895 // x-- xyz --> - not supported
8896 if (startInfo.type !== info.type) return {
8897 type: 'INVALID',
8898 stroke: 'INVALID'
8899 };
8900 startInfo.type = 'double_' + startInfo.type;
8901 }
8902
8903 if (startInfo.type === 'double_arrow') {
8904 startInfo.type = 'double_arrow_point';
8905 }
8906
8907 return startInfo;
8908 }
8909
8910 return info;
8911};
8912
8913/* harmony default export */ __webpack_exports__["default"] = ({
8914 parseDirective: parseDirective,
8915 defaultConfig: function defaultConfig() {
8916 return _config__WEBPACK_IMPORTED_MODULE_2__["defaultConfig"].flowchart;
8917 },
8918 addVertex: addVertex,
8919 addLink: addLink,
8920 updateLinkInterpolate: updateLinkInterpolate,
8921 updateLink: updateLink,
8922 addClass: addClass,
8923 setDirection: setDirection,
8924 setClass: setClass,
8925 getTooltip: getTooltip,
8926 setClickEvent: setClickEvent,
8927 setLink: setLink,
8928 bindFunctions: bindFunctions,
8929 getDirection: getDirection,
8930 getVertices: getVertices,
8931 getEdges: getEdges,
8932 getClasses: getClasses,
8933 clear: clear,
8934 defaultStyle: defaultStyle,
8935 addSubGraph: addSubGraph,
8936 getDepthFirstPos: getDepthFirstPos,
8937 indexNodes: indexNodes,
8938 getSubGraphs: getSubGraphs,
8939 destructLink: destructLink,
8940 lex: {
8941 firstGraph: firstGraph
8942 }
8943});
8944
8945/***/ }),
8946
8947/***/ "./src/diagrams/flowchart/flowRenderer-v2.js":
8948/*!***************************************************!*\
8949 !*** ./src/diagrams/flowchart/flowRenderer-v2.js ***!
8950 \***************************************************/
8951/*! exports provided: setConf, addVertices, addEdges, getClasses, draw, default */
8952/***/ (function(module, __webpack_exports__, __webpack_require__) {
8953
8954"use strict";
8955__webpack_require__.r(__webpack_exports__);
8956/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
8957/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addVertices", function() { return addVertices; });
8958/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addEdges", function() { return addEdges; });
8959/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClasses", function() { return getClasses; });
8960/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
8961/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
8962/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
8963/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
8964/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
8965/* harmony import */ var _flowDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./flowDb */ "./src/diagrams/flowchart/flowDb.js");
8966/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
8967/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_flow__WEBPACK_IMPORTED_MODULE_3__);
8968/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
8969/* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
8970/* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! dagre-d3/lib/label/add-html-label.js */ "dagre-d3/lib/label/add-html-label.js");
8971/* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_6__);
8972/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
8973/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
8974/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985var conf = {};
8986var setConf = function setConf(cnf) {
8987 var keys = Object.keys(cnf);
8988
8989 for (var i = 0; i < keys.length; i++) {
8990 conf[keys[i]] = cnf[keys[i]];
8991 }
8992};
8993/**
8994 * Function that adds the vertices found during parsing to the graph to be rendered.
8995 * @param vert Object containing the vertices.
8996 * @param g The graph that is to be drawn.
8997 */
8998
8999var addVertices = function addVertices(vert, g, svgId) {
9000 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(svgId, "\"]"));
9001 var keys = Object.keys(vert); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
9002
9003 keys.forEach(function (id) {
9004 var vertex = vert[id];
9005 /**
9006 * Variable for storing the classes for the vertex
9007 * @type {string}
9008 */
9009
9010 var classStr = 'default';
9011
9012 if (vertex.classes.length > 0) {
9013 classStr = vertex.classes.join(' ');
9014 }
9015
9016 var styles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(vertex.styles); // Use vertex id as text in the box if no text is provided by the graph definition
9017
9018 var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
9019
9020 var vertexNode;
9021
9022 if (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels) {
9023 // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
9024 var node = {
9025 label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
9026 return "<i class='".concat(s.replace(':', ' '), "'></i>");
9027 })
9028 };
9029 vertexNode = dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_6___default()(svg, node).node();
9030 vertexNode.parentNode.removeChild(vertexNode);
9031 } else {
9032 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
9033 svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
9034 var rows = vertexText.split(_common_common__WEBPACK_IMPORTED_MODULE_8__["default"].lineBreakRegex);
9035
9036 for (var j = 0; j < rows.length; j++) {
9037 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
9038 tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
9039 tspan.setAttribute('dy', '1em');
9040 tspan.setAttribute('x', '1');
9041 tspan.textContent = rows[j];
9042 svgLabel.appendChild(tspan);
9043 }
9044
9045 vertexNode = svgLabel;
9046 }
9047
9048 var radious = 0;
9049 var _shape = ''; // Set the shape based parameters
9050
9051 switch (vertex.type) {
9052 case 'round':
9053 radious = 5;
9054 _shape = 'rect';
9055 break;
9056
9057 case 'square':
9058 _shape = 'rect';
9059 break;
9060
9061 case 'diamond':
9062 _shape = 'question';
9063 break;
9064
9065 case 'hexagon':
9066 _shape = 'hexagon';
9067 break;
9068
9069 case 'odd':
9070 _shape = 'rect_left_inv_arrow';
9071 break;
9072
9073 case 'lean_right':
9074 _shape = 'lean_right';
9075 break;
9076
9077 case 'lean_left':
9078 _shape = 'lean_left';
9079 break;
9080
9081 case 'trapezoid':
9082 _shape = 'trapezoid';
9083 break;
9084
9085 case 'inv_trapezoid':
9086 _shape = 'inv_trapezoid';
9087 break;
9088
9089 case 'odd_right':
9090 _shape = 'rect_left_inv_arrow';
9091 break;
9092
9093 case 'circle':
9094 _shape = 'circle';
9095 break;
9096
9097 case 'ellipse':
9098 _shape = 'ellipse';
9099 break;
9100
9101 case 'stadium':
9102 _shape = 'stadium';
9103 break;
9104
9105 case 'subroutine':
9106 _shape = 'subroutine';
9107 break;
9108
9109 case 'cylinder':
9110 _shape = 'cylinder';
9111 break;
9112
9113 case 'group':
9114 _shape = 'rect';
9115 break;
9116
9117 default:
9118 _shape = 'rect';
9119 } // Add the node
9120
9121
9122 g.setNode(vertex.id, {
9123 labelStyle: styles.labelStyle,
9124 shape: _shape,
9125 labelText: vertexText,
9126 rx: radious,
9127 ry: radious,
9128 class: classStr,
9129 style: styles.style,
9130 id: vertex.id,
9131 width: vertex.type === 'group' ? 500 : undefined,
9132 type: vertex.type,
9133 padding: Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.padding
9134 });
9135 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('setNode', {
9136 labelStyle: styles.labelStyle,
9137 shape: _shape,
9138 labelText: vertexText,
9139 rx: radious,
9140 ry: radious,
9141 class: classStr,
9142 style: styles.style,
9143 id: vertex.id,
9144 width: vertex.type === 'group' ? 500 : undefined,
9145 type: vertex.type,
9146 padding: Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.padding
9147 });
9148 });
9149};
9150/**
9151 * Add edges to graph based on parsed graph defninition
9152 * @param {Object} edges The edges to add to the graph
9153 * @param {Object} g The graph object
9154 */
9155
9156var addEdges = function addEdges(edges, g) {
9157 var cnt = 0;
9158 var defaultStyle;
9159 var defaultLabelStyle;
9160
9161 if (typeof edges.defaultStyle !== 'undefined') {
9162 var defaultStyles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(edges.defaultStyle);
9163 defaultStyle = defaultStyles.style;
9164 defaultLabelStyle = defaultStyles.labelStyle;
9165 }
9166
9167 edges.forEach(function (edge) {
9168 cnt++; // Identify Link
9169
9170 var linkId = 'L-' + edge.start + '-' + edge.end;
9171 var linkNameStart = 'LS-' + edge.start;
9172 var linkNameEnd = 'LE-' + edge.end;
9173 var edgeData = {}; //edgeData.id = 'id' + cnt;
9174 // Set link type for rendering
9175
9176 if (edge.type === 'arrow_open') {
9177 edgeData.arrowhead = 'none';
9178 } else {
9179 edgeData.arrowhead = 'normal';
9180 } // Check of arrow types, placed here in order not to break old rendering
9181
9182
9183 edgeData.arrowTypeStart = 'arrow_open';
9184 edgeData.arrowTypeEnd = 'arrow_open';
9185 /* eslint-disable no-fallthrough */
9186
9187 switch (edge.type) {
9188 case 'double_arrow_cross':
9189 edgeData.arrowTypeStart = 'arrow_cross';
9190
9191 case 'arrow_cross':
9192 edgeData.arrowTypeEnd = 'arrow_cross';
9193 break;
9194
9195 case 'double_arrow_point':
9196 edgeData.arrowTypeStart = 'arrow_point';
9197
9198 case 'arrow_point':
9199 edgeData.arrowTypeEnd = 'arrow_point';
9200 break;
9201
9202 case 'double_arrow_circle':
9203 edgeData.arrowTypeStart = 'arrow_circle';
9204
9205 case 'arrow_circle':
9206 edgeData.arrowTypeEnd = 'arrow_circle';
9207 break;
9208 } // logger.info('apa', edgeData, edge);
9209 // edgeData.arrowTypeStart = edge.arrowTypeStart;
9210 // edgeData.arrowTypeStart = edge.arrowTypeStart;
9211 // edgeData.arrowType = edgeData.arrowTypeEnd;
9212 // logger.info('apa', edgeData, edge);
9213
9214
9215 var style = '';
9216 var labelStyle = '';
9217
9218 if (typeof edge.style !== 'undefined') {
9219 var styles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(edge.style);
9220 style = styles.style;
9221 labelStyle = styles.labelStyle;
9222 } else {
9223 switch (edge.stroke) {
9224 case 'normal':
9225 style = 'fill:none';
9226
9227 if (typeof defaultStyle !== 'undefined') {
9228 style = defaultStyle;
9229 }
9230
9231 if (typeof defaultLabelStyle !== 'undefined') {
9232 labelStyle = defaultLabelStyle;
9233 }
9234
9235 edgeData.thickness = 'normal';
9236 edgeData.pattern = 'solid';
9237 break;
9238
9239 case 'dotted':
9240 edgeData.thickness = 'normal';
9241 edgeData.pattern = 'dotted';
9242 break;
9243
9244 case 'thick':
9245 edgeData.thickness = 'thick';
9246 edgeData.pattern = 'solid';
9247 break;
9248 }
9249 }
9250
9251 edgeData.style = style;
9252 edgeData.labelStyle = labelStyle;
9253
9254 if (typeof edge.interpolate !== 'undefined') {
9255 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
9256 } else if (typeof edges.defaultInterpolate !== 'undefined') {
9257 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
9258 } else {
9259 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(conf.curve, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
9260 }
9261
9262 if (typeof edge.text === 'undefined') {
9263 if (typeof edge.style !== 'undefined') {
9264 edgeData.arrowheadStyle = 'fill: #333';
9265 }
9266 } else {
9267 edgeData.arrowheadStyle = 'fill: #333';
9268 edgeData.labelpos = 'c';
9269
9270 if (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels && false) {
9271 // eslint-disable-line
9272 edgeData.labelType = 'html';
9273 edgeData.label = "<span id=\"L-".concat(linkId, "\" class=\"edgeLabel L-").concat(linkNameStart, "' L-").concat(linkNameEnd, "\">").concat(edge.text, "</span>");
9274 } else {
9275 edgeData.labelType = 'text';
9276 edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_8__["default"].lineBreakRegex, '\n');
9277
9278 if (typeof edge.style === 'undefined') {
9279 edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
9280 }
9281
9282 edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
9283 }
9284 }
9285
9286 edgeData.id = linkId;
9287 edgeData.classes = 'flowchart-link ' + linkNameStart + ' ' + linkNameEnd; // Add the edge to the graph
9288
9289 g.setEdge(edge.start, edge.end, edgeData, cnt);
9290 });
9291};
9292/**
9293 * Returns the all the styles from classDef statements in the graph definition.
9294 * @returns {object} classDef styles
9295 */
9296
9297var getClasses = function getClasses(text) {
9298 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Extracting classes');
9299 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
9300 var parser = _parser_flow__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
9301 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"];
9302
9303 try {
9304 // Parse the graph definition
9305 parser.parse(text);
9306 } catch (e) {
9307 return;
9308 }
9309
9310 return _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getClasses();
9311};
9312/**
9313 * Draws a flowchart in the tag with id: id based on the graph definition in text.
9314 * @param text
9315 * @param id
9316 */
9317
9318var draw = function draw(text, id) {
9319 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Drawing flowchart');
9320 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
9321 var parser = _parser_flow__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
9322 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the graph definition
9323 // try {
9324
9325 parser.parse(text); // } catch (err) {
9326 // logger.debug('Parsing failed');
9327 // }
9328 // Fetch the default direction, use TD if none was found
9329
9330 var dir = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getDirection();
9331
9332 if (typeof dir === 'undefined') {
9333 dir = 'TD';
9334 }
9335
9336 var conf = Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart;
9337 var nodeSpacing = conf.nodeSpacing || 50;
9338 var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
9339
9340 var g = new graphlib__WEBPACK_IMPORTED_MODULE_0___default.a.Graph({
9341 multigraph: true,
9342 compound: true
9343 }).setGraph({
9344 rankdir: dir,
9345 nodesep: nodeSpacing,
9346 ranksep: rankSpacing,
9347 marginx: 8,
9348 marginy: 8
9349 }).setDefaultEdgeLabel(function () {
9350 return {};
9351 });
9352 var subG;
9353 var subGraphs = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getSubGraphs();
9354 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Subgraphs - ', subGraphs);
9355
9356 for (var _i = subGraphs.length - 1; _i >= 0; _i--) {
9357 subG = subGraphs[_i];
9358 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Subgraph - ', subG);
9359 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
9360 } // Fetch the verices/nodes and edges/links from the parsed graph definition
9361
9362
9363 var vert = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getVertices();
9364 var edges = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getEdges();
9365 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info(edges);
9366 var i = 0;
9367
9368 for (i = subGraphs.length - 1; i >= 0; i--) {
9369 subG = subGraphs[i];
9370 Object(d3__WEBPACK_IMPORTED_MODULE_1__["selectAll"])('cluster').append('text');
9371
9372 for (var j = 0; j < subG.nodes.length; j++) {
9373 g.setParent(subG.nodes[j], subG.id);
9374 }
9375 }
9376
9377 addVertices(vert, g, id);
9378 addEdges(edges, g); // Add custom shapes
9379 // flowChartShapes.addToRenderV2(addShape);
9380 // Set up an SVG group so that we can translate the final graph.
9381
9382 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(id, "\"]")); // Run the renderer. This is what draws the final graph.
9383
9384 var element = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#' + id + ' g');
9385 Object(_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_5__["render"])(element, g, ['point', 'circle', 'cross'], 'flowchart', id); // dagre.layout(g);
9386
9387 element.selectAll('g.node').attr('title', function () {
9388 return _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getTooltip(this.id);
9389 });
9390 var padding = conf.diagramPadding;
9391 var svgBounds = svg.node().getBBox();
9392 var width = svgBounds.width + padding * 2;
9393 var height = svgBounds.height + padding * 2;
9394 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].debug("new ViewBox 0 0 ".concat(width, " ").concat(height), "translate(".concat(padding - g._label.marginx, ", ").concat(padding - g._label.marginy, ")"));
9395
9396 if (conf.useMaxWidth) {
9397 svg.attr('width', '100%');
9398 svg.attr('style', "max-width: ".concat(width, "px;"));
9399 } else {
9400 svg.attr('height', height);
9401 svg.attr('width', width);
9402 }
9403
9404 svg.attr('viewBox', "0 0 ".concat(width, " ").concat(height));
9405 svg.select('g').attr('transform', "translate(".concat(padding - g._label.marginx, ", ").concat(padding - svgBounds.y, ")")); // Index nodes
9406
9407 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].indexNodes('subGraph' + i); // // reposition labels
9408 // for (i = 0; i < subGraphs.length; i++) {
9409 // subG = subGraphs[i];
9410 // if (subG.title !== 'undefined') {
9411 // const clusterRects = document.querySelectorAll('#' + id + ' [id="' + subG.id + '"] rect');
9412 // const clusterEl = document.querySelectorAll('#' + id + ' [id="' + subG.id + '"]');
9413 // const xPos = clusterRects[0].x.baseVal.value;
9414 // const yPos = clusterRects[0].y.baseVal.value;
9415 // const width = clusterRects[0].width.baseVal.value;
9416 // const cluster = d3.select(clusterEl[0]);
9417 // const te = cluster.select('.label');
9418 // te.attr('transform', `translate(${xPos + width / 2}, ${yPos + 14})`);
9419 // te.attr('id', id + 'Text');
9420 // for (let j = 0; j < subG.classes.length; j++) {
9421 // clusterEl[0].classList.add(subG.classes[j]);
9422 // }
9423 // }
9424 // }
9425 // Add label rects for non html labels
9426
9427 if (!conf.htmlLabels) {
9428 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
9429
9430 for (var k = 0; k < labels.length; k++) {
9431 var label = labels[k]; // Get dimensions of label
9432
9433 var dim = label.getBBox();
9434 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
9435 rect.setAttribute('rx', 0);
9436 rect.setAttribute('ry', 0);
9437 rect.setAttribute('width', dim.width);
9438 rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
9439
9440 label.insertBefore(rect, label.firstChild);
9441 }
9442 } // If node has a link, wrap it in an anchor SVG object.
9443
9444
9445 var keys = Object.keys(vert);
9446 keys.forEach(function (key) {
9447 var vertex = vert[key];
9448
9449 if (vertex.link) {
9450 var node = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#' + id + ' [id="' + key + '"]');
9451
9452 if (node) {
9453 var link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
9454 link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
9455 link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
9456 link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
9457
9458 if (vertex.linkTarget) {
9459 link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
9460 }
9461
9462 var linkNode = node.insert(function () {
9463 return link;
9464 }, ':first-child');
9465 var shape = node.select('.label-container');
9466
9467 if (shape) {
9468 linkNode.append(function () {
9469 return shape.node();
9470 });
9471 }
9472
9473 var _label = node.select('.label');
9474
9475 if (_label) {
9476 linkNode.append(function () {
9477 return _label.node();
9478 });
9479 }
9480 }
9481 }
9482 });
9483};
9484/* harmony default export */ __webpack_exports__["default"] = ({
9485 setConf: setConf,
9486 addVertices: addVertices,
9487 addEdges: addEdges,
9488 getClasses: getClasses,
9489 draw: draw
9490});
9491
9492/***/ }),
9493
9494/***/ "./src/diagrams/flowchart/flowRenderer.js":
9495/*!************************************************!*\
9496 !*** ./src/diagrams/flowchart/flowRenderer.js ***!
9497 \************************************************/
9498/*! exports provided: setConf, addVertices, addEdges, getClasses, draw, default */
9499/***/ (function(module, __webpack_exports__, __webpack_require__) {
9500
9501"use strict";
9502__webpack_require__.r(__webpack_exports__);
9503/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
9504/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addVertices", function() { return addVertices; });
9505/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addEdges", function() { return addEdges; });
9506/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClasses", function() { return getClasses; });
9507/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
9508/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
9509/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
9510/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
9511/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
9512/* harmony import */ var _flowDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./flowDb */ "./src/diagrams/flowchart/flowDb.js");
9513/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
9514/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_flow__WEBPACK_IMPORTED_MODULE_3__);
9515/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
9516/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! dagre-d3 */ "dagre-d3");
9517/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(dagre_d3__WEBPACK_IMPORTED_MODULE_5__);
9518/* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! dagre-d3/lib/label/add-html-label.js */ "dagre-d3/lib/label/add-html-label.js");
9519/* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_6__);
9520/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
9521/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
9522/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
9523/* harmony import */ var _flowChartShapes__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./flowChartShapes */ "./src/diagrams/flowchart/flowChartShapes.js");
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535var conf = {};
9536var setConf = function setConf(cnf) {
9537 var keys = Object.keys(cnf);
9538
9539 for (var i = 0; i < keys.length; i++) {
9540 conf[keys[i]] = cnf[keys[i]];
9541 }
9542};
9543/**
9544 * Function that adds the vertices found in the graph definition to the graph to be rendered.
9545 * @param vert Object containing the vertices.
9546 * @param g The graph that is to be drawn.
9547 */
9548
9549var addVertices = function addVertices(vert, g, svgId) {
9550 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(svgId, "\"]"));
9551 var keys = Object.keys(vert); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
9552
9553 keys.forEach(function (id) {
9554 var vertex = vert[id];
9555 /**
9556 * Variable for storing the classes for the vertex
9557 * @type {string}
9558 */
9559
9560 var classStr = 'default';
9561
9562 if (vertex.classes.length > 0) {
9563 classStr = vertex.classes.join(' ');
9564 }
9565
9566 var styles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(vertex.styles); // Use vertex id as text in the box if no text is provided by the graph definition
9567
9568 var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
9569
9570 var vertexNode;
9571
9572 if (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels) {
9573 // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
9574 var node = {
9575 label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
9576 return "<i class='".concat(s.replace(':', ' '), "'></i>");
9577 })
9578 };
9579 vertexNode = dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_6___default()(svg, node).node();
9580 vertexNode.parentNode.removeChild(vertexNode);
9581 } else {
9582 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
9583 svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
9584 var rows = vertexText.split(_common_common__WEBPACK_IMPORTED_MODULE_8__["default"].lineBreakRegex);
9585
9586 for (var j = 0; j < rows.length; j++) {
9587 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
9588 tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
9589 tspan.setAttribute('dy', '1em');
9590 tspan.setAttribute('x', '1');
9591 tspan.textContent = rows[j];
9592 svgLabel.appendChild(tspan);
9593 }
9594
9595 vertexNode = svgLabel;
9596 }
9597
9598 var radious = 0;
9599 var _shape = ''; // Set the shape based parameters
9600
9601 switch (vertex.type) {
9602 case 'round':
9603 radious = 5;
9604 _shape = 'rect';
9605 break;
9606
9607 case 'square':
9608 _shape = 'rect';
9609 break;
9610
9611 case 'diamond':
9612 _shape = 'question';
9613 break;
9614
9615 case 'hexagon':
9616 _shape = 'hexagon';
9617 break;
9618
9619 case 'odd':
9620 _shape = 'rect_left_inv_arrow';
9621 break;
9622
9623 case 'lean_right':
9624 _shape = 'lean_right';
9625 break;
9626
9627 case 'lean_left':
9628 _shape = 'lean_left';
9629 break;
9630
9631 case 'trapezoid':
9632 _shape = 'trapezoid';
9633 break;
9634
9635 case 'inv_trapezoid':
9636 _shape = 'inv_trapezoid';
9637 break;
9638
9639 case 'odd_right':
9640 _shape = 'rect_left_inv_arrow';
9641 break;
9642
9643 case 'circle':
9644 _shape = 'circle';
9645 break;
9646
9647 case 'ellipse':
9648 _shape = 'ellipse';
9649 break;
9650
9651 case 'stadium':
9652 _shape = 'stadium';
9653 break;
9654
9655 case 'subroutine':
9656 _shape = 'subroutine';
9657 break;
9658
9659 case 'cylinder':
9660 _shape = 'cylinder';
9661 break;
9662
9663 case 'group':
9664 _shape = 'rect';
9665 break;
9666
9667 default:
9668 _shape = 'rect';
9669 } // Add the node
9670
9671
9672 g.setNode(vertex.id, {
9673 labelType: 'svg',
9674 labelStyle: styles.labelStyle,
9675 shape: _shape,
9676 label: vertexNode,
9677 rx: radious,
9678 ry: radious,
9679 class: classStr,
9680 style: styles.style,
9681 id: vertex.id
9682 });
9683 });
9684};
9685/**
9686 * Add edges to graph based on parsed graph defninition
9687 * @param {Object} edges The edges to add to the graph
9688 * @param {Object} g The graph object
9689 */
9690
9691var addEdges = function addEdges(edges, g) {
9692 var cnt = 0;
9693 var defaultStyle;
9694 var defaultLabelStyle;
9695
9696 if (typeof edges.defaultStyle !== 'undefined') {
9697 var defaultStyles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(edges.defaultStyle);
9698 defaultStyle = defaultStyles.style;
9699 defaultLabelStyle = defaultStyles.labelStyle;
9700 }
9701
9702 edges.forEach(function (edge) {
9703 cnt++; // Identify Link
9704
9705 var linkId = 'L-' + edge.start + '-' + edge.end;
9706 var linkNameStart = 'LS-' + edge.start;
9707 var linkNameEnd = 'LE-' + edge.end;
9708 var edgeData = {}; // Set link type for rendering
9709
9710 if (edge.type === 'arrow_open') {
9711 edgeData.arrowhead = 'none';
9712 } else {
9713 edgeData.arrowhead = 'normal';
9714 }
9715
9716 var style = '';
9717 var labelStyle = '';
9718
9719 if (typeof edge.style !== 'undefined') {
9720 var styles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(edge.style);
9721 style = styles.style;
9722 labelStyle = styles.labelStyle;
9723 } else {
9724 switch (edge.stroke) {
9725 case 'normal':
9726 style = 'fill:none';
9727
9728 if (typeof defaultStyle !== 'undefined') {
9729 style = defaultStyle;
9730 }
9731
9732 if (typeof defaultLabelStyle !== 'undefined') {
9733 labelStyle = defaultLabelStyle;
9734 }
9735
9736 break;
9737
9738 case 'dotted':
9739 style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';
9740 break;
9741
9742 case 'thick':
9743 style = ' stroke-width: 3.5px;fill:none';
9744 break;
9745 }
9746 }
9747
9748 edgeData.style = style;
9749 edgeData.labelStyle = labelStyle;
9750
9751 if (typeof edge.interpolate !== 'undefined') {
9752 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
9753 } else if (typeof edges.defaultInterpolate !== 'undefined') {
9754 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
9755 } else {
9756 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(conf.curve, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
9757 }
9758
9759 if (typeof edge.text === 'undefined') {
9760 if (typeof edge.style !== 'undefined') {
9761 edgeData.arrowheadStyle = 'fill: #333';
9762 }
9763 } else {
9764 edgeData.arrowheadStyle = 'fill: #333';
9765 edgeData.labelpos = 'c';
9766
9767 if (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels) {
9768 edgeData.labelType = 'html';
9769 edgeData.label = "<span id=\"L-".concat(linkId, "\" class=\"edgeLabel L-").concat(linkNameStart, "' L-").concat(linkNameEnd, "\">").concat(edge.text, "</span>");
9770 } else {
9771 edgeData.labelType = 'text';
9772 edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_8__["default"].lineBreakRegex, '\n');
9773
9774 if (typeof edge.style === 'undefined') {
9775 edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
9776 }
9777
9778 edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
9779 }
9780 }
9781
9782 edgeData.id = linkId;
9783 edgeData.class = linkNameStart + ' ' + linkNameEnd; // Add the edge to the graph
9784
9785 g.setEdge(edge.start, edge.end, edgeData, cnt);
9786 });
9787};
9788/**
9789 * Returns the all the styles from classDef statements in the graph definition.
9790 * @returns {object} classDef styles
9791 */
9792
9793var getClasses = function getClasses(text) {
9794 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Extracting classes');
9795 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
9796
9797 try {
9798 var parser = _parser_flow__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
9799 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the graph definition
9800
9801 parser.parse(text);
9802 return _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getClasses();
9803 } catch (e) {
9804 return;
9805 }
9806};
9807/**
9808 * Draws a flowchart in the tag with id: id based on the graph definition in text.
9809 * @param text
9810 * @param id
9811 */
9812
9813var draw = function draw(text, id) {
9814 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Drawing flowchart');
9815 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
9816 var parser = _parser_flow__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
9817 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the graph definition
9818 // try {
9819
9820 parser.parse(text); // } catch (err) {
9821 // logger.debug('Parsing failed');
9822 // }
9823 // Fetch the default direction, use TD if none was found
9824
9825 var dir = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getDirection();
9826
9827 if (typeof dir === 'undefined') {
9828 dir = 'TD';
9829 }
9830
9831 var conf = Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart;
9832 var nodeSpacing = conf.nodeSpacing || 50;
9833 var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
9834
9835 var g = new graphlib__WEBPACK_IMPORTED_MODULE_0___default.a.Graph({
9836 multigraph: true,
9837 compound: true
9838 }).setGraph({
9839 rankdir: dir,
9840 nodesep: nodeSpacing,
9841 ranksep: rankSpacing,
9842 marginx: 8,
9843 marginy: 8
9844 }).setDefaultEdgeLabel(function () {
9845 return {};
9846 });
9847 var subG;
9848 var subGraphs = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getSubGraphs();
9849
9850 for (var _i = subGraphs.length - 1; _i >= 0; _i--) {
9851 subG = subGraphs[_i];
9852 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
9853 } // Fetch the verices/nodes and edges/links from the parsed graph definition
9854
9855
9856 var vert = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getVertices();
9857 var edges = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getEdges();
9858 var i = 0;
9859
9860 for (i = subGraphs.length - 1; i >= 0; i--) {
9861 subG = subGraphs[i];
9862 Object(d3__WEBPACK_IMPORTED_MODULE_1__["selectAll"])('cluster').append('text');
9863
9864 for (var j = 0; j < subG.nodes.length; j++) {
9865 g.setParent(subG.nodes[j], subG.id);
9866 }
9867 }
9868
9869 addVertices(vert, g, id);
9870 addEdges(edges, g); // Create the renderer
9871
9872 var Render = dagre_d3__WEBPACK_IMPORTED_MODULE_5___default.a.render;
9873 var render = new Render(); // Add custom shapes
9874
9875 _flowChartShapes__WEBPACK_IMPORTED_MODULE_10__["default"].addToRender(render); // Add our custom arrow - an empty arrowhead
9876
9877 render.arrows().none = function normal(parent, id, edge, type) {
9878 var marker = parent.append('marker').attr('id', id).attr('viewBox', '0 0 10 10').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'strokeWidth').attr('markerWidth', 8).attr('markerHeight', 6).attr('orient', 'auto');
9879 var path = marker.append('path').attr('d', 'M 0 0 L 0 0 L 0 0 z');
9880 dagre_d3__WEBPACK_IMPORTED_MODULE_5___default.a.util.applyStyle(path, edge[type + 'Style']);
9881 }; // Override normal arrowhead defined in d3. Remove style & add class to allow css styling.
9882
9883
9884 render.arrows().normal = function normal(parent, id) {
9885 var marker = parent.append('marker').attr('id', id).attr('viewBox', '0 0 10 10').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'strokeWidth').attr('markerWidth', 8).attr('markerHeight', 6).attr('orient', 'auto');
9886 marker.append('path').attr('d', 'M 0 0 L 10 5 L 0 10 z').attr('class', 'arrowheadPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
9887 }; // Set up an SVG group so that we can translate the final graph.
9888
9889
9890 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(id, "\"]")); // Run the renderer. This is what draws the final graph.
9891
9892 var element = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#' + id + ' g');
9893 render(element, g);
9894 element.selectAll('g.node').attr('title', function () {
9895 return _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getTooltip(this.id);
9896 });
9897 var padding = conf.diagramPadding;
9898 var svgBounds = svg.node().getBBox();
9899 var width = svgBounds.width + padding * 2;
9900 var height = svgBounds.height + padding * 2;
9901
9902 if (conf.useMaxWidth) {
9903 svg.attr('width', '100%');
9904 svg.attr('style', "max-width: ".concat(width, "px;"));
9905 } else {
9906 svg.attr('height', height);
9907 svg.attr('width', width);
9908 } // Ensure the viewBox includes the whole svgBounds area with extra space for padding
9909
9910
9911 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
9912 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].debug("viewBox ".concat(vBox));
9913 svg.attr('viewBox', vBox); // Index nodes
9914
9915 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].indexNodes('subGraph' + i); // reposition labels
9916
9917 for (i = 0; i < subGraphs.length; i++) {
9918 subG = subGraphs[i];
9919
9920 if (subG.title !== 'undefined') {
9921 var clusterRects = document.querySelectorAll('#' + id + ' [id="' + subG.id + '"] rect');
9922 var clusterEl = document.querySelectorAll('#' + id + ' [id="' + subG.id + '"]');
9923 var xPos = clusterRects[0].x.baseVal.value;
9924 var yPos = clusterRects[0].y.baseVal.value;
9925 var _width = clusterRects[0].width.baseVal.value;
9926 var cluster = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])(clusterEl[0]);
9927 var te = cluster.select('.label');
9928 te.attr('transform', "translate(".concat(xPos + _width / 2, ", ").concat(yPos + 14, ")"));
9929 te.attr('id', id + 'Text');
9930
9931 for (var _j = 0; _j < subG.classes.length; _j++) {
9932 clusterEl[0].classList.add(subG.classes[_j]);
9933 }
9934 }
9935 } // Add label rects for non html labels
9936
9937
9938 if (!conf.htmlLabels || true) {
9939 // eslint-disable-line
9940 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
9941
9942 for (var k = 0; k < labels.length; k++) {
9943 var label = labels[k]; // Get dimensions of label
9944
9945 var dim = label.getBBox();
9946 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
9947 rect.setAttribute('rx', 0);
9948 rect.setAttribute('ry', 0);
9949 rect.setAttribute('width', dim.width);
9950 rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
9951
9952 label.insertBefore(rect, label.firstChild);
9953 }
9954 } // If node has a link, wrap it in an anchor SVG object.
9955
9956
9957 var keys = Object.keys(vert);
9958 keys.forEach(function (key) {
9959 var vertex = vert[key];
9960
9961 if (vertex.link) {
9962 var node = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#' + id + ' [id="' + key + '"]');
9963
9964 if (node) {
9965 var link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
9966 link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
9967 link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
9968 link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
9969
9970 if (vertex.linkTarget) {
9971 link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
9972 }
9973
9974 var linkNode = node.insert(function () {
9975 return link;
9976 }, ':first-child');
9977 var shape = node.select('.label-container');
9978
9979 if (shape) {
9980 linkNode.append(function () {
9981 return shape.node();
9982 });
9983 }
9984
9985 var _label = node.select('.label');
9986
9987 if (_label) {
9988 linkNode.append(function () {
9989 return _label.node();
9990 });
9991 }
9992 }
9993 }
9994 });
9995};
9996/* harmony default export */ __webpack_exports__["default"] = ({
9997 setConf: setConf,
9998 addVertices: addVertices,
9999 addEdges: addEdges,
10000 getClasses: getClasses,
10001 draw: draw
10002});
10003
10004/***/ }),
10005
10006/***/ "./src/diagrams/flowchart/parser/flow.jison":
10007/*!**************************************************!*\
10008 !*** ./src/diagrams/flowchart/parser/flow.jison ***!
10009 \**************************************************/
10010/*! no static exports found */
10011/***/ (function(module, exports, __webpack_require__) {
10012
10013/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
10014/*
10015 Returns a Parser object of the following structure:
10016
10017 Parser: {
10018 yy: {}
10019 }
10020
10021 Parser.prototype: {
10022 yy: {},
10023 trace: function(),
10024 symbols_: {associative list: name ==> number},
10025 terminals_: {associative list: number ==> name},
10026 productions_: [...],
10027 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
10028 table: [...],
10029 defaultActions: {...},
10030 parseError: function(str, hash),
10031 parse: function(input),
10032
10033 lexer: {
10034 EOF: 1,
10035 parseError: function(str, hash),
10036 setInput: function(input),
10037 input: function(),
10038 unput: function(str),
10039 more: function(),
10040 less: function(n),
10041 pastInput: function(),
10042 upcomingInput: function(),
10043 showPosition: function(),
10044 test_match: function(regex_match_array, rule_index),
10045 next: function(),
10046 lex: function(),
10047 begin: function(condition),
10048 popState: function(),
10049 _currentRules: function(),
10050 topState: function(),
10051 pushState: function(condition),
10052
10053 options: {
10054 ranges: boolean (optional: true ==> token location info will include a .range[] member)
10055 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
10056 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
10057 },
10058
10059 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
10060 rules: [...],
10061 conditions: {associative list: name ==> set},
10062 }
10063 }
10064
10065
10066 token location info (@$, _$, etc.): {
10067 first_line: n,
10068 last_line: n,
10069 first_column: n,
10070 last_column: n,
10071 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
10072 }
10073
10074
10075 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
10076 text: (matched text)
10077 token: (the produced terminal token, if any)
10078 line: (yylineno)
10079 }
10080 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
10081 loc: (yylloc)
10082 expected: (string describing the set of expected tokens)
10083 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
10084 }
10085*/
10086var parser = (function(){
10087var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,9],$V1=[1,7],$V2=[1,6],$V3=[1,8],$V4=[1,20,21,22,23,38,46,75,76,77,78,79,80,91,92,95,96,97,99,100,106,107,108,109,110,111],$V5=[2,10],$V6=[1,20],$V7=[1,21],$V8=[1,22],$V9=[1,23],$Va=[1,30],$Vb=[1,54],$Vc=[1,32],$Vd=[1,33],$Ve=[1,34],$Vf=[1,35],$Vg=[1,36],$Vh=[1,48],$Vi=[1,43],$Vj=[1,45],$Vk=[1,40],$Vl=[1,44],$Vm=[1,47],$Vn=[1,51],$Vo=[1,52],$Vp=[1,53],$Vq=[1,42],$Vr=[1,46],$Vs=[1,49],$Vt=[1,50],$Vu=[1,41],$Vv=[1,57],$Vw=[1,62],$Vx=[1,20,21,22,23,38,42,46,75,76,77,78,79,80,91,92,95,96,97,99,100,106,107,108,109,110,111],$Vy=[1,66],$Vz=[1,65],$VA=[1,67],$VB=[20,21,23,69,70],$VC=[20,21,22,23,69,70],$VD=[20,21,22,23,47,69,70],$VE=[20,21,22,23,40,46,47,49,51,53,55,57,59,61,62,64,69,70,80,91,92,95,96,97,99,100,106,107,108,109,110,111],$VF=[20,21,23],$VG=[20,21,23,46,69,70,80,91,92,95,96,97,99,100,106,107,108,109,110,111],$VH=[1,12,20,21,22,23,24,38,42,46,75,76,77,78,79,80,91,92,95,96,97,99,100,106,107,108,109,110,111],$VI=[46,80,91,92,95,96,97,99,100,106,107,108,109,110,111],$VJ=[1,115],$VK=[1,136],$VL=[1,137],$VM=[1,138],$VN=[1,139],$VO=[1,119],$VP=[1,110],$VQ=[1,111],$VR=[1,107],$VS=[1,131],$VT=[1,132],$VU=[1,133],$VV=[1,134],$VW=[1,135],$VX=[1,140],$VY=[1,141],$VZ=[1,113],$V_=[1,121],$V$=[1,124],$V01=[1,122],$V11=[1,123],$V21=[1,116],$V31=[1,129],$V41=[1,128],$V51=[1,112],$V61=[1,109],$V71=[1,118],$V81=[1,120],$V91=[1,125],$Va1=[1,126],$Vb1=[1,127],$Vc1=[1,130],$Vd1=[20,21,22,23,38,42,46,75,76,77,78,79,80,91,92,95,96,97,99,100,106,107,108,109,110,111],$Ve1=[1,144],$Vf1=[1,148],$Vg1=[1,150],$Vh1=[1,151],$Vi1=[12,21,22,24],$Vj1=[20,21,22,23,24,26,38,40,41,42,46,50,52,54,56,58,60,61,63,65,69,70,71,75,76,77,78,79,80,81,84,91,92,95,96,97,99,100,101,102,106,107,108,109,110,111],$Vk1=[20,21,22,23,26,46,80,91,92,95,96,97,99,100,106,107,108,109,110,111],$Vl1=[22,92],$Vm1=[1,220],$Vn1=[1,224],$Vo1=[1,221],$Vp1=[1,218],$Vq1=[1,215],$Vr1=[1,216],$Vs1=[1,217],$Vt1=[1,219],$Vu1=[1,222],$Vv1=[1,223],$Vw1=[1,225],$Vx1=[1,241],$Vy1=[20,21,23,92],$Vz1=[20,21,22,23,75,88,91,92,95,96,97,98,99,100,101];
10088var parser = {trace: function trace () { },
10089yy: {},
10090symbols_: {"error":2,"start":3,"mermaidDoc":4,"directive":5,"openDirective":6,"typeDirective":7,"closeDirective":8,"separator":9,":":10,"argDirective":11,"open_directive":12,"type_directive":13,"arg_directive":14,"close_directive":15,"graphConfig":16,"document":17,"line":18,"statement":19,"SEMI":20,"NEWLINE":21,"SPACE":22,"EOF":23,"GRAPH":24,"NODIR":25,"DIR":26,"FirstStmtSeperator":27,"ending":28,"endToken":29,"spaceList":30,"spaceListNewline":31,"verticeStatement":32,"styleStatement":33,"linkStyleStatement":34,"classDefStatement":35,"classStatement":36,"clickStatement":37,"subgraph":38,"text":39,"SQS":40,"SQE":41,"end":42,"link":43,"node":44,"vertex":45,"AMP":46,"STYLE_SEPARATOR":47,"idString":48,"PS":49,"PE":50,"(-":51,"-)":52,"STADIUMSTART":53,"STADIUMEND":54,"SUBROUTINESTART":55,"SUBROUTINEEND":56,"CYLINDERSTART":57,"CYLINDEREND":58,"DIAMOND_START":59,"DIAMOND_STOP":60,"TAGEND":61,"TRAPSTART":62,"TRAPEND":63,"INVTRAPSTART":64,"INVTRAPEND":65,"linkStatement":66,"arrowText":67,"TESTSTR":68,"START_LINK":69,"LINK":70,"PIPE":71,"textToken":72,"STR":73,"keywords":74,"STYLE":75,"LINKSTYLE":76,"CLASSDEF":77,"CLASS":78,"CLICK":79,"DOWN":80,"UP":81,"textNoTags":82,"textNoTagsToken":83,"DEFAULT":84,"stylesOpt":85,"alphaNum":86,"LINK_TARGET":87,"HEX":88,"numList":89,"INTERPOLATE":90,"NUM":91,"COMMA":92,"style":93,"styleComponent":94,"ALPHA":95,"COLON":96,"MINUS":97,"UNIT":98,"BRKT":99,"DOT":100,"PCT":101,"TAGSTART":102,"alphaNumToken":103,"idStringToken":104,"alphaNumStatement":105,"PUNCTUATION":106,"UNICODE_TEXT":107,"PLUS":108,"EQUALS":109,"MULT":110,"UNDERSCORE":111,"graphCodeTokens":112,"ARROW_CROSS":113,"ARROW_POINT":114,"ARROW_CIRCLE":115,"ARROW_OPEN":116,"QUOTE":117,"$accept":0,"$end":1},
10091terminals_: {2:"error",10:":",12:"open_directive",13:"type_directive",14:"arg_directive",15:"close_directive",20:"SEMI",21:"NEWLINE",22:"SPACE",23:"EOF",24:"GRAPH",25:"NODIR",26:"DIR",38:"subgraph",40:"SQS",41:"SQE",42:"end",46:"AMP",47:"STYLE_SEPARATOR",49:"PS",50:"PE",51:"(-",52:"-)",53:"STADIUMSTART",54:"STADIUMEND",55:"SUBROUTINESTART",56:"SUBROUTINEEND",57:"CYLINDERSTART",58:"CYLINDEREND",59:"DIAMOND_START",60:"DIAMOND_STOP",61:"TAGEND",62:"TRAPSTART",63:"TRAPEND",64:"INVTRAPSTART",65:"INVTRAPEND",68:"TESTSTR",69:"START_LINK",70:"LINK",71:"PIPE",73:"STR",75:"STYLE",76:"LINKSTYLE",77:"CLASSDEF",78:"CLASS",79:"CLICK",80:"DOWN",81:"UP",84:"DEFAULT",87:"LINK_TARGET",88:"HEX",90:"INTERPOLATE",91:"NUM",92:"COMMA",95:"ALPHA",96:"COLON",97:"MINUS",98:"UNIT",99:"BRKT",100:"DOT",101:"PCT",102:"TAGSTART",106:"PUNCTUATION",107:"UNICODE_TEXT",108:"PLUS",109:"EQUALS",110:"MULT",111:"UNDERSCORE",113:"ARROW_CROSS",114:"ARROW_POINT",115:"ARROW_CIRCLE",116:"ARROW_OPEN",117:"QUOTE"},
10092productions_: [0,[3,1],[3,2],[5,4],[5,6],[6,1],[7,1],[11,1],[8,1],[4,2],[17,0],[17,2],[18,1],[18,1],[18,1],[18,1],[18,1],[16,2],[16,2],[16,2],[16,3],[28,2],[28,1],[29,1],[29,1],[29,1],[27,1],[27,1],[27,2],[31,2],[31,2],[31,1],[31,1],[30,2],[30,1],[19,2],[19,2],[19,2],[19,2],[19,2],[19,2],[19,9],[19,6],[19,4],[9,1],[9,1],[9,1],[32,3],[32,4],[32,2],[32,1],[44,1],[44,5],[44,3],[45,4],[45,6],[45,4],[45,4],[45,4],[45,4],[45,4],[45,4],[45,6],[45,4],[45,4],[45,4],[45,4],[45,4],[45,1],[43,2],[43,3],[43,3],[43,1],[43,3],[66,1],[67,3],[39,1],[39,2],[39,1],[74,1],[74,1],[74,1],[74,1],[74,1],[74,1],[74,1],[74,1],[74,1],[74,1],[74,1],[82,1],[82,2],[35,5],[35,5],[36,5],[37,5],[37,7],[37,5],[37,7],[37,7],[37,9],[33,5],[33,5],[34,5],[34,5],[34,9],[34,9],[34,7],[34,7],[89,1],[89,3],[85,1],[85,3],[93,1],[93,2],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[72,1],[72,1],[72,1],[72,1],[72,1],[72,1],[83,1],[83,1],[83,1],[83,1],[48,1],[48,2],[86,1],[86,2],[105,1],[105,1],[105,1],[105,1],[103,1],[103,1],[103,1],[103,1],[103,1],[103,1],[103,1],[103,1],[103,1],[103,1],[103,1],[103,1],[103,1],[104,1],[104,1],[104,1],[104,1],[104,1],[104,1],[104,1],[104,1],[104,1],[104,1],[104,1],[104,1],[104,1],[104,1],[104,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1]],
10093performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
10094/* this == yyval */
10095
10096var $0 = $$.length - 1;
10097switch (yystate) {
10098case 5:
10099 yy.parseDirective('%%{', 'open_directive');
10100break;
10101case 6:
10102 yy.parseDirective($$[$0], 'type_directive');
10103break;
10104case 7:
10105 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
10106break;
10107case 8:
10108 yy.parseDirective('}%%', 'close_directive', 'flowchart');
10109break;
10110case 10:
10111 this.$ = [];
10112break;
10113case 11:
10114
10115 if($$[$0] !== []){
10116 $$[$0-1].push($$[$0]);
10117 }
10118 this.$=$$[$0-1];
10119break;
10120case 12: case 76: case 78: case 90: case 138: case 140: case 141:
10121this.$=$$[$0];
10122break;
10123case 19:
10124 yy.setDirection('TB');this.$ = 'TB';
10125break;
10126case 20:
10127 yy.setDirection($$[$0-1]);this.$ = $$[$0-1];
10128break;
10129case 35:
10130 /* console.warn('finat vs', $$[$0-1].nodes); */ this.$=$$[$0-1].nodes
10131break;
10132case 36: case 37: case 38: case 39: case 40:
10133this.$=[];
10134break;
10135case 41:
10136this.$=yy.addSubGraph($$[$0-6],$$[$0-1],$$[$0-4]);
10137break;
10138case 42:
10139this.$=yy.addSubGraph($$[$0-3],$$[$0-1],$$[$0-3]);
10140break;
10141case 43:
10142this.$=yy.addSubGraph(undefined,$$[$0-1],undefined);
10143break;
10144case 47:
10145 /* console.warn('vs',$$[$0-2].stmt,$$[$0]); */ yy.addLink($$[$0-2].stmt,$$[$0],$$[$0-1]); this.$ = { stmt: $$[$0], nodes: $$[$0].concat($$[$0-2].nodes) }
10146break;
10147case 48:
10148 /* console.warn('vs',$$[$0-3].stmt,$$[$0-1]); */ yy.addLink($$[$0-3].stmt,$$[$0-1],$$[$0-2]); this.$ = { stmt: $$[$0-1], nodes: $$[$0-1].concat($$[$0-3].nodes) }
10149break;
10150case 49:
10151/*console.warn('noda', $$[$0-1]);*/ this.$ = {stmt: $$[$0-1], nodes:$$[$0-1] }
10152break;
10153case 50:
10154 /*console.warn('noda', $$[$0]);*/ this.$ = {stmt: $$[$0], nodes:$$[$0] }
10155break;
10156case 51:
10157 /* console.warn('nod', $$[$0]); */ this.$ = [$$[$0]];
10158break;
10159case 52:
10160 this.$ = $$[$0-4].concat($$[$0]); /* console.warn('pip', $$[$0-4][0], $$[$0], this.$); */
10161break;
10162case 53:
10163this.$ = [$$[$0-2]];yy.setClass($$[$0-2],$$[$0])
10164break;
10165case 54:
10166this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'square');
10167break;
10168case 55:
10169this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'circle');
10170break;
10171case 56:
10172this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'ellipse');
10173break;
10174case 57:
10175this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'stadium');
10176break;
10177case 58:
10178this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'subroutine');
10179break;
10180case 59:
10181this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'cylinder');
10182break;
10183case 60:
10184this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'round');
10185break;
10186case 61:
10187this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'diamond');
10188break;
10189case 62:
10190this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'hexagon');
10191break;
10192case 63:
10193this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'odd');
10194break;
10195case 64:
10196this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'trapezoid');
10197break;
10198case 65:
10199this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'inv_trapezoid');
10200break;
10201case 66:
10202this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_right');
10203break;
10204case 67:
10205this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_left');
10206break;
10207case 68:
10208 /*console.warn('h: ', $$[$0]);*/this.$ = $$[$0];yy.addVertex($$[$0]);
10209break;
10210case 69:
10211$$[$0-1].text = $$[$0];this.$ = $$[$0-1];
10212break;
10213case 70: case 71:
10214$$[$0-2].text = $$[$0-1];this.$ = $$[$0-2];
10215break;
10216case 72:
10217this.$ = $$[$0];
10218break;
10219case 73:
10220var inf = yy.destructLink($$[$0], $$[$0-2]); this.$ = {"type":inf.type,"stroke":inf.stroke,"text":$$[$0-1]};
10221break;
10222case 74:
10223var inf = yy.destructLink($$[$0]);this.$ = {"type":inf.type,"stroke":inf.stroke};
10224break;
10225case 75:
10226this.$ = $$[$0-1];
10227break;
10228case 77: case 91: case 139:
10229this.$=$$[$0-1]+''+$$[$0];
10230break;
10231case 92: case 93:
10232this.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]);
10233break;
10234case 94:
10235this.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]);
10236break;
10237case 95:
10238this.$ = $$[$0-4];yy.setClickEvent($$[$0-2], $$[$0], undefined);
10239break;
10240case 96:
10241this.$ = $$[$0-6];yy.setClickEvent($$[$0-4], $$[$0-2], $$[$0]) ;
10242break;
10243case 97:
10244this.$ = $$[$0-4];yy.setLink($$[$0-2], $$[$0], undefined, undefined);
10245break;
10246case 98:
10247this.$ = $$[$0-6];yy.setLink($$[$0-4], $$[$0-2], $$[$0], undefined );
10248break;
10249case 99:
10250this.$ = $$[$0-6];yy.setLink($$[$0-4], $$[$0-2], undefined, $$[$0] );
10251break;
10252case 100:
10253this.$ = $$[$0-8];yy.setLink($$[$0-6], $$[$0-4], $$[$0-2], $$[$0] );
10254break;
10255case 101:
10256this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]);
10257break;
10258case 102: case 104:
10259this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]);
10260break;
10261case 103:
10262this.$ = $$[$0-4];yy.updateLink([$$[$0-2]],$$[$0]);
10263break;
10264case 105:
10265this.$ = $$[$0-8];yy.updateLinkInterpolate([$$[$0-6]],$$[$0-2]);yy.updateLink([$$[$0-6]],$$[$0]);
10266break;
10267case 106:
10268this.$ = $$[$0-8];yy.updateLinkInterpolate($$[$0-6],$$[$0-2]);yy.updateLink($$[$0-6],$$[$0]);
10269break;
10270case 107:
10271this.$ = $$[$0-6];yy.updateLinkInterpolate([$$[$0-4]],$$[$0]);
10272break;
10273case 108:
10274this.$ = $$[$0-6];yy.updateLinkInterpolate($$[$0-4],$$[$0]);
10275break;
10276case 109: case 111:
10277this.$ = [$$[$0]]
10278break;
10279case 110: case 112:
10280$$[$0-2].push($$[$0]);this.$ = $$[$0-2];
10281break;
10282case 114:
10283this.$ = $$[$0-1] + $$[$0];
10284break;
10285case 136:
10286this.$=$$[$0]
10287break;
10288case 137:
10289this.$=$$[$0-1]+''+$$[$0]
10290break;
10291case 142:
10292this.$='v';
10293break;
10294case 143:
10295this.$='-';
10296break;
10297}
10298},
10299table: [{3:1,4:2,5:3,6:5,12:$V0,16:4,21:$V1,22:$V2,24:$V3},{1:[3]},{1:[2,1]},{3:10,4:2,5:3,6:5,12:$V0,16:4,21:$V1,22:$V2,24:$V3},o($V4,$V5,{17:11}),{7:12,13:[1,13]},{16:14,21:$V1,22:$V2,24:$V3},{16:15,21:$V1,22:$V2,24:$V3},{25:[1,16],26:[1,17]},{13:[2,5]},{1:[2,2]},{1:[2,9],18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,44:31,45:37,46:$Vb,48:38,75:$Vc,76:$Vd,77:$Ve,78:$Vf,79:$Vg,80:$Vh,91:$Vi,92:$Vj,95:$Vk,96:$Vl,97:$Vm,99:$Vn,100:$Vo,104:39,106:$Vp,107:$Vq,108:$Vr,109:$Vs,110:$Vt,111:$Vu},{8:55,10:[1,56],15:$Vv},o([10,15],[2,6]),o($V4,[2,17]),o($V4,[2,18]),o($V4,[2,19]),{20:[1,59],21:[1,60],22:$Vw,27:58,30:61},o($Vx,[2,11]),o($Vx,[2,12]),o($Vx,[2,13]),o($Vx,[2,14]),o($Vx,[2,15]),o($Vx,[2,16]),{9:63,20:$Vy,21:$Vz,23:$VA,43:64,66:68,69:[1,69],70:[1,70]},{9:71,20:$Vy,21:$Vz,23:$VA},{9:72,20:$Vy,21:$Vz,23:$VA},{9:73,20:$Vy,21:$Vz,23:$VA},{9:74,20:$Vy,21:$Vz,23:$VA},{9:75,20:$Vy,21:$Vz,23:$VA},{9:77,20:$Vy,21:$Vz,22:[1,76],23:$VA},o($VB,[2,50],{30:78,22:$Vw}),{22:[1,79]},{22:[1,80]},{22:[1,81]},{22:[1,82]},{22:[1,83]},o($VC,[2,51],{47:[1,84]}),o($VD,[2,68],{104:95,40:[1,85],46:$Vb,49:[1,86],51:[1,87],53:[1,88],55:[1,89],57:[1,90],59:[1,91],61:[1,92],62:[1,93],64:[1,94],80:$Vh,91:$Vi,92:$Vj,95:$Vk,96:$Vl,97:$Vm,99:$Vn,100:$Vo,106:$Vp,107:$Vq,108:$Vr,109:$Vs,110:$Vt,111:$Vu}),o($VE,[2,136]),o($VE,[2,157]),o($VE,[2,158]),o($VE,[2,159]),o($VE,[2,160]),o($VE,[2,161]),o($VE,[2,162]),o($VE,[2,163]),o($VE,[2,164]),o($VE,[2,165]),o($VE,[2,166]),o($VE,[2,167]),o($VE,[2,168]),o($VE,[2,169]),o($VE,[2,170]),o($VE,[2,171]),{9:96,20:$Vy,21:$Vz,23:$VA},{11:97,14:[1,98]},o($VF,[2,8]),o($V4,[2,20]),o($V4,[2,26]),o($V4,[2,27]),{21:[1,99]},o($VG,[2,34],{30:100,22:$Vw}),o($Vx,[2,35]),{44:101,45:37,46:$Vb,48:38,80:$Vh,91:$Vi,92:$Vj,95:$Vk,96:$Vl,97:$Vm,99:$Vn,100:$Vo,104:39,106:$Vp,107:$Vq,108:$Vr,109:$Vs,110:$Vt,111:$Vu},o($VH,[2,44]),o($VH,[2,45]),o($VH,[2,46]),o($VI,[2,72],{67:102,68:[1,103],71:[1,104]}),{22:$VJ,24:$VK,26:$VL,38:$VM,39:105,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},o([46,68,71,80,91,92,95,96,97,99,100,106,107,108,109,110,111],[2,74]),o($Vx,[2,36]),o($Vx,[2,37]),o($Vx,[2,38]),o($Vx,[2,39]),o($Vx,[2,40]),{22:$VJ,24:$VK,26:$VL,38:$VM,39:142,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},o($Vd1,$V5,{17:143}),o($VB,[2,49],{46:$Ve1}),{26:$Vf1,46:$VO,80:$Vg1,86:145,88:[1,146],91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:147,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{84:[1,152],89:153,91:[1,154]},{26:$Vf1,46:$VO,80:$Vg1,84:[1,155],86:156,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:147,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{26:$Vf1,46:$VO,80:$Vg1,86:157,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:147,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{26:$Vf1,46:$VO,80:$Vg1,86:158,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:147,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{46:$Vb,48:159,80:$Vh,91:$Vi,92:$Vj,95:$Vk,96:$Vl,97:$Vm,99:$Vn,100:$Vo,104:39,106:$Vp,107:$Vq,108:$Vr,109:$Vs,110:$Vt,111:$Vu},{22:$VJ,24:$VK,26:$VL,38:$VM,39:160,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,39:162,42:$VN,46:$VO,49:[1,161],61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,39:163,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,39:164,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,39:165,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,39:166,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,39:167,42:$VN,46:$VO,59:[1,168],61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,39:169,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,39:170,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,39:171,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},o($VE,[2,137]),o($Vi1,[2,3]),{8:172,15:$Vv},{15:[2,7]},o($V4,[2,28]),o($VG,[2,33]),o($VB,[2,47],{30:173,22:$Vw}),o($VI,[2,69],{22:[1,174]}),{22:[1,175]},{22:$VJ,24:$VK,26:$VL,38:$VM,39:176,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,61:$VP,69:$VQ,70:[1,177],72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},o($Vj1,[2,76]),o($Vj1,[2,78]),o($Vj1,[2,126]),o($Vj1,[2,127]),o($Vj1,[2,128]),o($Vj1,[2,129]),o($Vj1,[2,130]),o($Vj1,[2,131]),o($Vj1,[2,132]),o($Vj1,[2,133]),o($Vj1,[2,134]),o($Vj1,[2,135]),o($Vj1,[2,144]),o($Vj1,[2,145]),o($Vj1,[2,146]),o($Vj1,[2,147]),o($Vj1,[2,148]),o($Vj1,[2,149]),o($Vj1,[2,150]),o($Vj1,[2,151]),o($Vj1,[2,152]),o($Vj1,[2,153]),o($Vj1,[2,154]),o($Vj1,[2,155]),o($Vj1,[2,156]),o($Vj1,[2,79]),o($Vj1,[2,80]),o($Vj1,[2,81]),o($Vj1,[2,82]),o($Vj1,[2,83]),o($Vj1,[2,84]),o($Vj1,[2,85]),o($Vj1,[2,86]),o($Vj1,[2,87]),o($Vj1,[2,88]),o($Vj1,[2,89]),{9:180,20:$Vy,21:$Vz,22:$VJ,23:$VA,24:$VK,26:$VL,38:$VM,40:[1,179],42:$VN,46:$VO,61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,42:[1,181],44:31,45:37,46:$Vb,48:38,75:$Vc,76:$Vd,77:$Ve,78:$Vf,79:$Vg,80:$Vh,91:$Vi,92:$Vj,95:$Vk,96:$Vl,97:$Vm,99:$Vn,100:$Vo,104:39,106:$Vp,107:$Vq,108:$Vr,109:$Vs,110:$Vt,111:$Vu},{22:$Vw,30:182},{22:[1,183],26:$Vf1,46:$VO,80:$Vg1,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:184,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:[1,185]},o($Vk1,[2,138]),o($Vk1,[2,140]),o($Vk1,[2,141]),o($Vk1,[2,142]),o($Vk1,[2,143]),{22:[1,186]},{22:[1,187],92:[1,188]},o($Vl1,[2,109]),{22:[1,189]},{22:[1,190],26:$Vf1,46:$VO,80:$Vg1,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:184,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:[1,191],26:$Vf1,46:$VO,80:$Vg1,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:184,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:[1,192],26:$Vf1,46:$VO,80:$Vg1,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:184,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},o($VC,[2,53],{104:95,46:$Vb,80:$Vh,91:$Vi,92:$Vj,95:$Vk,96:$Vl,97:$Vm,99:$Vn,100:$Vo,106:$Vp,107:$Vq,108:$Vr,109:$Vs,110:$Vt,111:$Vu}),{22:$VJ,24:$VK,26:$VL,38:$VM,41:[1,193],42:$VN,46:$VO,61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,39:194,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,50:[1,195],61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,52:[1,196],61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,54:[1,197],61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,56:[1,198],61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,58:[1,199],61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,60:[1,200],61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,39:201,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,41:[1,202],42:$VN,46:$VO,61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,61:$VP,63:[1,203],65:[1,204],69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,61:$VP,63:[1,206],65:[1,205],69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{9:207,20:$Vy,21:$Vz,23:$VA},o($VB,[2,48],{46:$Ve1}),o($VI,[2,71]),o($VI,[2,70]),{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,61:$VP,69:$VQ,71:[1,208],72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},o($VI,[2,73]),o($Vj1,[2,77]),{22:$VJ,24:$VK,26:$VL,38:$VM,39:209,42:$VN,46:$VO,61:$VP,69:$VQ,72:106,73:$VR,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},o($Vd1,$V5,{17:210}),o($Vx,[2,43]),{45:211,46:$Vb,48:38,80:$Vh,91:$Vi,92:$Vj,95:$Vk,96:$Vl,97:$Vm,99:$Vn,100:$Vo,104:39,106:$Vp,107:$Vq,108:$Vr,109:$Vs,110:$Vt,111:$Vu},{22:$Vm1,75:$Vn1,85:212,88:$Vo1,91:$Vp1,93:213,94:214,95:$Vq1,96:$Vr1,97:$Vs1,98:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1},o($Vk1,[2,139]),{22:$Vm1,75:$Vn1,85:226,88:$Vo1,91:$Vp1,93:213,94:214,95:$Vq1,96:$Vr1,97:$Vs1,98:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1},{22:$Vm1,75:$Vn1,85:227,88:$Vo1,90:[1,228],91:$Vp1,93:213,94:214,95:$Vq1,96:$Vr1,97:$Vs1,98:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1},{22:$Vm1,75:$Vn1,85:229,88:$Vo1,90:[1,230],91:$Vp1,93:213,94:214,95:$Vq1,96:$Vr1,97:$Vs1,98:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1},{91:[1,231]},{22:$Vm1,75:$Vn1,85:232,88:$Vo1,91:$Vp1,93:213,94:214,95:$Vq1,96:$Vr1,97:$Vs1,98:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1},{22:$Vm1,75:$Vn1,85:233,88:$Vo1,91:$Vp1,93:213,94:214,95:$Vq1,96:$Vr1,97:$Vs1,98:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1},{26:$Vf1,46:$VO,80:$Vg1,86:234,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:147,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{26:$Vf1,46:$VO,73:[1,236],80:$Vg1,86:235,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:147,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},o($VD,[2,54]),{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,50:[1,237],61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},o($VD,[2,60]),o($VD,[2,56]),o($VD,[2,57]),o($VD,[2,58]),o($VD,[2,59]),o($VD,[2,61]),{22:$VJ,24:$VK,26:$VL,38:$VM,42:$VN,46:$VO,60:[1,238],61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},o($VD,[2,63]),o($VD,[2,64]),o($VD,[2,66]),o($VD,[2,65]),o($VD,[2,67]),o($Vi1,[2,4]),o([22,46,80,91,92,95,96,97,99,100,106,107,108,109,110,111],[2,75]),{22:$VJ,24:$VK,26:$VL,38:$VM,41:[1,239],42:$VN,46:$VO,61:$VP,69:$VQ,72:178,74:117,75:$VS,76:$VT,77:$VU,78:$VV,79:$VW,80:$VX,81:$VY,83:108,84:$VZ,91:$V_,92:$V$,95:$V01,96:$V11,97:$V21,99:$V31,100:$V41,101:$V51,102:$V61,103:114,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,42:[1,240],44:31,45:37,46:$Vb,48:38,75:$Vc,76:$Vd,77:$Ve,78:$Vf,79:$Vg,80:$Vh,91:$Vi,92:$Vj,95:$Vk,96:$Vl,97:$Vm,99:$Vn,100:$Vo,104:39,106:$Vp,107:$Vq,108:$Vr,109:$Vs,110:$Vt,111:$Vu},o($VC,[2,52]),o($VF,[2,101],{92:$Vx1}),o($Vy1,[2,111],{94:242,22:$Vm1,75:$Vn1,88:$Vo1,91:$Vp1,95:$Vq1,96:$Vr1,97:$Vs1,98:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1}),o($Vz1,[2,113]),o($Vz1,[2,115]),o($Vz1,[2,116]),o($Vz1,[2,117]),o($Vz1,[2,118]),o($Vz1,[2,119]),o($Vz1,[2,120]),o($Vz1,[2,121]),o($Vz1,[2,122]),o($Vz1,[2,123]),o($Vz1,[2,124]),o($Vz1,[2,125]),o($VF,[2,102],{92:$Vx1}),o($VF,[2,103],{92:$Vx1}),{22:[1,243]},o($VF,[2,104],{92:$Vx1}),{22:[1,244]},o($Vl1,[2,110]),o($VF,[2,92],{92:$Vx1}),o($VF,[2,93],{92:$Vx1}),o($VF,[2,94],{103:149,105:184,26:$Vf1,46:$VO,80:$Vg1,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1}),o($VF,[2,95],{103:149,105:184,22:[1,245],26:$Vf1,46:$VO,80:$Vg1,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1}),o($VF,[2,97],{22:[1,246]}),{50:[1,247]},{60:[1,248]},{9:249,20:$Vy,21:$Vz,23:$VA},o($Vx,[2,42]),{22:$Vm1,75:$Vn1,88:$Vo1,91:$Vp1,93:250,94:214,95:$Vq1,96:$Vr1,97:$Vs1,98:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1},o($Vz1,[2,114]),{26:$Vf1,46:$VO,80:$Vg1,86:251,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:147,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{26:$Vf1,46:$VO,80:$Vg1,86:252,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,103:149,105:147,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1},{73:[1,253]},{73:[1,254],87:[1,255]},o($VD,[2,55]),o($VD,[2,62]),o($Vd1,$V5,{17:256}),o($Vy1,[2,112],{94:242,22:$Vm1,75:$Vn1,88:$Vo1,91:$Vp1,95:$Vq1,96:$Vr1,97:$Vs1,98:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1}),o($VF,[2,107],{103:149,105:184,22:[1,257],26:$Vf1,46:$VO,80:$Vg1,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1}),o($VF,[2,108],{103:149,105:184,22:[1,258],26:$Vf1,46:$VO,80:$Vg1,91:$V_,92:$V$,95:$V01,96:$V11,97:$Vh1,99:$V31,100:$V41,106:$V71,107:$V81,108:$V91,109:$Va1,110:$Vb1,111:$Vc1}),o($VF,[2,96]),o($VF,[2,98],{22:[1,259]}),o($VF,[2,99]),{18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,42:[1,260],44:31,45:37,46:$Vb,48:38,75:$Vc,76:$Vd,77:$Ve,78:$Vf,79:$Vg,80:$Vh,91:$Vi,92:$Vj,95:$Vk,96:$Vl,97:$Vm,99:$Vn,100:$Vo,104:39,106:$Vp,107:$Vq,108:$Vr,109:$Vs,110:$Vt,111:$Vu},{22:$Vm1,75:$Vn1,85:261,88:$Vo1,91:$Vp1,93:213,94:214,95:$Vq1,96:$Vr1,97:$Vs1,98:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1},{22:$Vm1,75:$Vn1,85:262,88:$Vo1,91:$Vp1,93:213,94:214,95:$Vq1,96:$Vr1,97:$Vs1,98:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1},{87:[1,263]},o($Vx,[2,41]),o($VF,[2,105],{92:$Vx1}),o($VF,[2,106],{92:$Vx1}),o($VF,[2,100])],
10300defaultActions: {2:[2,1],9:[2,5],10:[2,2],98:[2,7]},
10301parseError: function parseError (str, hash) {
10302 if (hash.recoverable) {
10303 this.trace(str);
10304 } else {
10305 var error = new Error(str);
10306 error.hash = hash;
10307 throw error;
10308 }
10309},
10310parse: function parse(input) {
10311 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
10312 var args = lstack.slice.call(arguments, 1);
10313 var lexer = Object.create(this.lexer);
10314 var sharedState = { yy: {} };
10315 for (var k in this.yy) {
10316 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
10317 sharedState.yy[k] = this.yy[k];
10318 }
10319 }
10320 lexer.setInput(input, sharedState.yy);
10321 sharedState.yy.lexer = lexer;
10322 sharedState.yy.parser = this;
10323 if (typeof lexer.yylloc == 'undefined') {
10324 lexer.yylloc = {};
10325 }
10326 var yyloc = lexer.yylloc;
10327 lstack.push(yyloc);
10328 var ranges = lexer.options && lexer.options.ranges;
10329 if (typeof sharedState.yy.parseError === 'function') {
10330 this.parseError = sharedState.yy.parseError;
10331 } else {
10332 this.parseError = Object.getPrototypeOf(this).parseError;
10333 }
10334 function popStack(n) {
10335 stack.length = stack.length - 2 * n;
10336 vstack.length = vstack.length - n;
10337 lstack.length = lstack.length - n;
10338 }
10339 function lex() {
10340 var token;
10341 token = tstack.pop() || lexer.lex() || EOF;
10342 if (typeof token !== 'number') {
10343 if (token instanceof Array) {
10344 tstack = token;
10345 token = tstack.pop();
10346 }
10347 token = self.symbols_[token] || token;
10348 }
10349 return token;
10350 }
10351 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
10352 while (true) {
10353 state = stack[stack.length - 1];
10354 if (this.defaultActions[state]) {
10355 action = this.defaultActions[state];
10356 } else {
10357 if (symbol === null || typeof symbol == 'undefined') {
10358 symbol = lex();
10359 }
10360 action = table[state] && table[state][symbol];
10361 }
10362 if (typeof action === 'undefined' || !action.length || !action[0]) {
10363 var errStr = '';
10364 expected = [];
10365 for (p in table[state]) {
10366 if (this.terminals_[p] && p > TERROR) {
10367 expected.push('\'' + this.terminals_[p] + '\'');
10368 }
10369 }
10370 if (lexer.showPosition) {
10371 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
10372 } else {
10373 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
10374 }
10375 this.parseError(errStr, {
10376 text: lexer.match,
10377 token: this.terminals_[symbol] || symbol,
10378 line: lexer.yylineno,
10379 loc: yyloc,
10380 expected: expected
10381 });
10382 }
10383 if (action[0] instanceof Array && action.length > 1) {
10384 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
10385 }
10386 switch (action[0]) {
10387 case 1:
10388 stack.push(symbol);
10389 vstack.push(lexer.yytext);
10390 lstack.push(lexer.yylloc);
10391 stack.push(action[1]);
10392 symbol = null;
10393 if (!preErrorSymbol) {
10394 yyleng = lexer.yyleng;
10395 yytext = lexer.yytext;
10396 yylineno = lexer.yylineno;
10397 yyloc = lexer.yylloc;
10398 if (recovering > 0) {
10399 recovering--;
10400 }
10401 } else {
10402 symbol = preErrorSymbol;
10403 preErrorSymbol = null;
10404 }
10405 break;
10406 case 2:
10407 len = this.productions_[action[1]][1];
10408 yyval.$ = vstack[vstack.length - len];
10409 yyval._$ = {
10410 first_line: lstack[lstack.length - (len || 1)].first_line,
10411 last_line: lstack[lstack.length - 1].last_line,
10412 first_column: lstack[lstack.length - (len || 1)].first_column,
10413 last_column: lstack[lstack.length - 1].last_column
10414 };
10415 if (ranges) {
10416 yyval._$.range = [
10417 lstack[lstack.length - (len || 1)].range[0],
10418 lstack[lstack.length - 1].range[1]
10419 ];
10420 }
10421 r = this.performAction.apply(yyval, [
10422 yytext,
10423 yyleng,
10424 yylineno,
10425 sharedState.yy,
10426 action[1],
10427 vstack,
10428 lstack
10429 ].concat(args));
10430 if (typeof r !== 'undefined') {
10431 return r;
10432 }
10433 if (len) {
10434 stack = stack.slice(0, -1 * len * 2);
10435 vstack = vstack.slice(0, -1 * len);
10436 lstack = lstack.slice(0, -1 * len);
10437 }
10438 stack.push(this.productions_[action[1]][0]);
10439 vstack.push(yyval.$);
10440 lstack.push(yyval._$);
10441 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
10442 stack.push(newState);
10443 break;
10444 case 3:
10445 return true;
10446 }
10447 }
10448 return true;
10449}};
10450
10451/* generated by jison-lex 0.3.4 */
10452var lexer = (function(){
10453var lexer = ({
10454
10455EOF:1,
10456
10457parseError:function parseError(str, hash) {
10458 if (this.yy.parser) {
10459 this.yy.parser.parseError(str, hash);
10460 } else {
10461 throw new Error(str);
10462 }
10463 },
10464
10465// resets the lexer, sets new input
10466setInput:function (input, yy) {
10467 this.yy = yy || this.yy || {};
10468 this._input = input;
10469 this._more = this._backtrack = this.done = false;
10470 this.yylineno = this.yyleng = 0;
10471 this.yytext = this.matched = this.match = '';
10472 this.conditionStack = ['INITIAL'];
10473 this.yylloc = {
10474 first_line: 1,
10475 first_column: 0,
10476 last_line: 1,
10477 last_column: 0
10478 };
10479 if (this.options.ranges) {
10480 this.yylloc.range = [0,0];
10481 }
10482 this.offset = 0;
10483 return this;
10484 },
10485
10486// consumes and returns one char from the input
10487input:function () {
10488 var ch = this._input[0];
10489 this.yytext += ch;
10490 this.yyleng++;
10491 this.offset++;
10492 this.match += ch;
10493 this.matched += ch;
10494 var lines = ch.match(/(?:\r\n?|\n).*/g);
10495 if (lines) {
10496 this.yylineno++;
10497 this.yylloc.last_line++;
10498 } else {
10499 this.yylloc.last_column++;
10500 }
10501 if (this.options.ranges) {
10502 this.yylloc.range[1]++;
10503 }
10504
10505 this._input = this._input.slice(1);
10506 return ch;
10507 },
10508
10509// unshifts one char (or a string) into the input
10510unput:function (ch) {
10511 var len = ch.length;
10512 var lines = ch.split(/(?:\r\n?|\n)/g);
10513
10514 this._input = ch + this._input;
10515 this.yytext = this.yytext.substr(0, this.yytext.length - len);
10516 //this.yyleng -= len;
10517 this.offset -= len;
10518 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
10519 this.match = this.match.substr(0, this.match.length - 1);
10520 this.matched = this.matched.substr(0, this.matched.length - 1);
10521
10522 if (lines.length - 1) {
10523 this.yylineno -= lines.length - 1;
10524 }
10525 var r = this.yylloc.range;
10526
10527 this.yylloc = {
10528 first_line: this.yylloc.first_line,
10529 last_line: this.yylineno + 1,
10530 first_column: this.yylloc.first_column,
10531 last_column: lines ?
10532 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
10533 + oldLines[oldLines.length - lines.length].length - lines[0].length :
10534 this.yylloc.first_column - len
10535 };
10536
10537 if (this.options.ranges) {
10538 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
10539 }
10540 this.yyleng = this.yytext.length;
10541 return this;
10542 },
10543
10544// When called from action, caches matched text and appends it on next action
10545more:function () {
10546 this._more = true;
10547 return this;
10548 },
10549
10550// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
10551reject:function () {
10552 if (this.options.backtrack_lexer) {
10553 this._backtrack = true;
10554 } else {
10555 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
10556 text: "",
10557 token: null,
10558 line: this.yylineno
10559 });
10560
10561 }
10562 return this;
10563 },
10564
10565// retain first n characters of the match
10566less:function (n) {
10567 this.unput(this.match.slice(n));
10568 },
10569
10570// displays already matched input, i.e. for error messages
10571pastInput:function () {
10572 var past = this.matched.substr(0, this.matched.length - this.match.length);
10573 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
10574 },
10575
10576// displays upcoming input, i.e. for error messages
10577upcomingInput:function () {
10578 var next = this.match;
10579 if (next.length < 20) {
10580 next += this._input.substr(0, 20-next.length);
10581 }
10582 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
10583 },
10584
10585// displays the character position where the lexing error occurred, i.e. for error messages
10586showPosition:function () {
10587 var pre = this.pastInput();
10588 var c = new Array(pre.length + 1).join("-");
10589 return pre + this.upcomingInput() + "\n" + c + "^";
10590 },
10591
10592// test the lexed token: return FALSE when not a match, otherwise return token
10593test_match:function(match, indexed_rule) {
10594 var token,
10595 lines,
10596 backup;
10597
10598 if (this.options.backtrack_lexer) {
10599 // save context
10600 backup = {
10601 yylineno: this.yylineno,
10602 yylloc: {
10603 first_line: this.yylloc.first_line,
10604 last_line: this.last_line,
10605 first_column: this.yylloc.first_column,
10606 last_column: this.yylloc.last_column
10607 },
10608 yytext: this.yytext,
10609 match: this.match,
10610 matches: this.matches,
10611 matched: this.matched,
10612 yyleng: this.yyleng,
10613 offset: this.offset,
10614 _more: this._more,
10615 _input: this._input,
10616 yy: this.yy,
10617 conditionStack: this.conditionStack.slice(0),
10618 done: this.done
10619 };
10620 if (this.options.ranges) {
10621 backup.yylloc.range = this.yylloc.range.slice(0);
10622 }
10623 }
10624
10625 lines = match[0].match(/(?:\r\n?|\n).*/g);
10626 if (lines) {
10627 this.yylineno += lines.length;
10628 }
10629 this.yylloc = {
10630 first_line: this.yylloc.last_line,
10631 last_line: this.yylineno + 1,
10632 first_column: this.yylloc.last_column,
10633 last_column: lines ?
10634 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
10635 this.yylloc.last_column + match[0].length
10636 };
10637 this.yytext += match[0];
10638 this.match += match[0];
10639 this.matches = match;
10640 this.yyleng = this.yytext.length;
10641 if (this.options.ranges) {
10642 this.yylloc.range = [this.offset, this.offset += this.yyleng];
10643 }
10644 this._more = false;
10645 this._backtrack = false;
10646 this._input = this._input.slice(match[0].length);
10647 this.matched += match[0];
10648 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
10649 if (this.done && this._input) {
10650 this.done = false;
10651 }
10652 if (token) {
10653 return token;
10654 } else if (this._backtrack) {
10655 // recover context
10656 for (var k in backup) {
10657 this[k] = backup[k];
10658 }
10659 return false; // rule action called reject() implying the next rule should be tested instead.
10660 }
10661 return false;
10662 },
10663
10664// return next match in input
10665next:function () {
10666 if (this.done) {
10667 return this.EOF;
10668 }
10669 if (!this._input) {
10670 this.done = true;
10671 }
10672
10673 var token,
10674 match,
10675 tempMatch,
10676 index;
10677 if (!this._more) {
10678 this.yytext = '';
10679 this.match = '';
10680 }
10681 var rules = this._currentRules();
10682 for (var i = 0; i < rules.length; i++) {
10683 tempMatch = this._input.match(this.rules[rules[i]]);
10684 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
10685 match = tempMatch;
10686 index = i;
10687 if (this.options.backtrack_lexer) {
10688 token = this.test_match(tempMatch, rules[i]);
10689 if (token !== false) {
10690 return token;
10691 } else if (this._backtrack) {
10692 match = false;
10693 continue; // rule action called reject() implying a rule MISmatch.
10694 } else {
10695 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
10696 return false;
10697 }
10698 } else if (!this.options.flex) {
10699 break;
10700 }
10701 }
10702 }
10703 if (match) {
10704 token = this.test_match(match, rules[index]);
10705 if (token !== false) {
10706 return token;
10707 }
10708 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
10709 return false;
10710 }
10711 if (this._input === "") {
10712 return this.EOF;
10713 } else {
10714 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
10715 text: "",
10716 token: null,
10717 line: this.yylineno
10718 });
10719 }
10720 },
10721
10722// return next match that has a token
10723lex:function lex () {
10724 var r = this.next();
10725 if (r) {
10726 return r;
10727 } else {
10728 return this.lex();
10729 }
10730 },
10731
10732// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
10733begin:function begin (condition) {
10734 this.conditionStack.push(condition);
10735 },
10736
10737// pop the previously active lexer condition state off the condition stack
10738popState:function popState () {
10739 var n = this.conditionStack.length - 1;
10740 if (n > 0) {
10741 return this.conditionStack.pop();
10742 } else {
10743 return this.conditionStack[0];
10744 }
10745 },
10746
10747// produce the lexer rule set which is active for the currently active lexer condition state
10748_currentRules:function _currentRules () {
10749 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
10750 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
10751 } else {
10752 return this.conditions["INITIAL"].rules;
10753 }
10754 },
10755
10756// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
10757topState:function topState (n) {
10758 n = this.conditionStack.length - 1 - Math.abs(n || 0);
10759 if (n >= 0) {
10760 return this.conditionStack[n];
10761 } else {
10762 return "INITIAL";
10763 }
10764 },
10765
10766// alias for begin(condition)
10767pushState:function pushState (condition) {
10768 this.begin(condition);
10769 },
10770
10771// return the number of states currently on the stack
10772stateStackSize:function stateStackSize() {
10773 return this.conditionStack.length;
10774 },
10775options: {},
10776performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
10777var YYSTATE=YY_START;
10778switch($avoiding_name_collisions) {
10779case 0: this.begin('open_directive'); return 12;
10780break;
10781case 1: this.begin('type_directive'); return 13;
10782break;
10783case 2: this.popState(); this.begin('arg_directive'); return 10;
10784break;
10785case 3: this.popState(); this.popState(); return 15;
10786break;
10787case 4:return 14;
10788break;
10789case 5:/* skip comments */
10790break;
10791case 6:/* skip comments */
10792break;
10793case 7:this.begin("string");
10794break;
10795case 8:this.popState();
10796break;
10797case 9:return "STR";
10798break;
10799case 10:return 75;
10800break;
10801case 11:return 84;
10802break;
10803case 12:return 76;
10804break;
10805case 13:return 90;
10806break;
10807case 14:return 77;
10808break;
10809case 15:return 78;
10810break;
10811case 16:return 79;
10812break;
10813case 17:if(yy.lex.firstGraph()){this.begin("dir");} return 24;
10814break;
10815case 18:if(yy.lex.firstGraph()){this.begin("dir");} return 24;
10816break;
10817case 19:return 38;
10818break;
10819case 20:return 42;
10820break;
10821case 21:return 87;
10822break;
10823case 22:return 87;
10824break;
10825case 23:return 87;
10826break;
10827case 24:return 87;
10828break;
10829case 25: this.popState(); return 25;
10830break;
10831case 26: this.popState(); return 26;
10832break;
10833case 27: this.popState(); return 26;
10834break;
10835case 28: this.popState(); return 26;
10836break;
10837case 29: this.popState(); return 26;
10838break;
10839case 30: this.popState(); return 26;
10840break;
10841case 31: this.popState(); return 26;
10842break;
10843case 32: this.popState(); return 26;
10844break;
10845case 33: this.popState(); return 26;
10846break;
10847case 34: this.popState(); return 26;
10848break;
10849case 35: this.popState(); return 26;
10850break;
10851case 36: return 91;
10852break;
10853case 37:return 99;
10854break;
10855case 38:return 47;
10856break;
10857case 39:return 96;
10858break;
10859case 40:return 46;
10860break;
10861case 41:return 20;
10862break;
10863case 42:return 92;
10864break;
10865case 43:return 110;
10866break;
10867case 44:return 70;
10868break;
10869case 45:return 70;
10870break;
10871case 46:return 70;
10872break;
10873case 47:return 70;
10874break;
10875case 48:return 70;
10876break;
10877case 49:return 70;
10878break;
10879case 50:return 70;
10880break;
10881case 51:return 70;
10882break;
10883case 52:return 70;
10884break;
10885case 53:return 70;
10886break;
10887case 54:return 70;
10888break;
10889case 55:return 70;
10890break;
10891case 56:return 70;
10892break;
10893case 57:return 70;
10894break;
10895case 58:return 70;
10896break;
10897case 59:return 70;
10898break;
10899case 60:return 70;
10900break;
10901case 61:return 70;
10902break;
10903case 62:return 70;
10904break;
10905case 63:return 70;
10906break;
10907case 64:return 70;
10908break;
10909case 65:return 70;
10910break;
10911case 66:return 70;
10912break;
10913case 67:return 70;
10914break;
10915case 68:return 70;
10916break;
10917case 69:return 70;
10918break;
10919case 70:return 70;
10920break;
10921case 71:return 70;
10922break;
10923case 72:return 69;
10924break;
10925case 73:return 69;
10926break;
10927case 74:return 69;
10928break;
10929case 75:return 69;
10930break;
10931case 76:return 69;
10932break;
10933case 77:return 69;
10934break;
10935case 78:return 69;
10936break;
10937case 79:return 69;
10938break;
10939case 80:return 69;
10940break;
10941case 81:return 69;
10942break;
10943case 82:return 69;
10944break;
10945case 83:return 69;
10946break;
10947case 84:return 51;
10948break;
10949case 85:return 52;
10950break;
10951case 86:return 53;
10952break;
10953case 87:return 54;
10954break;
10955case 88:return 55;
10956break;
10957case 89:return 56;
10958break;
10959case 90:return 57;
10960break;
10961case 91:return 58;
10962break;
10963case 92:return 97;
10964break;
10965case 93:return 100;
10966break;
10967case 94:return 111;
10968break;
10969case 95:return 108;
10970break;
10971case 96:return 101;
10972break;
10973case 97:return 109;
10974break;
10975case 98:return 109;
10976break;
10977case 99:return 102;
10978break;
10979case 100:return 61;
10980break;
10981case 101:return 81;
10982break;
10983case 102:return 'SEP';
10984break;
10985case 103:return 80;
10986break;
10987case 104:return 95;
10988break;
10989case 105:return 63;
10990break;
10991case 106:return 62;
10992break;
10993case 107:return 65;
10994break;
10995case 108:return 64;
10996break;
10997case 109:return 106;
10998break;
10999case 110:return 107;
11000break;
11001case 111:return 71;
11002break;
11003case 112:return 49;
11004break;
11005case 113:return 50;
11006break;
11007case 114:return 40;
11008break;
11009case 115:return 41;
11010break;
11011case 116:return 59
11012break;
11013case 117:return 60
11014break;
11015case 118:return 117;
11016break;
11017case 119:return 21;
11018break;
11019case 120:return 22;
11020break;
11021case 121:return 23;
11022break;
11023}
11024},
11025rules: [/^(?:%%\{)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)[^\n]*)/,/^(?:[^\}]%%[^\n]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:click\b)/,/^(?:graph\b)/,/^(?:flowchart\b)/,/^(?:subgraph\b)/,/^(?:end\b\s*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:(\r?\n)*\s*\n)/,/^(?:\s*LR\b)/,/^(?:\s*RL\b)/,/^(?:\s*TB\b)/,/^(?:\s*BT\b)/,/^(?:\s*TD\b)/,/^(?:\s*BR\b)/,/^(?:\s*<)/,/^(?:\s*>)/,/^(?:\s*\^)/,/^(?:\s*v\b)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*--[x]\s*)/,/^(?:\s*-->\s*)/,/^(?:\s*<-->\s*)/,/^(?:\s*[x]--[x]\s*)/,/^(?:\s*[o]--[o]\s*)/,/^(?:\s*[o]\.-[o]\s*)/,/^(?:\s*<==>\s*)/,/^(?:\s*[o]==[o]\s*)/,/^(?:\s*[x]==[x]\s*)/,/^(?:\s*[x].-[x]\s*)/,/^(?:\s*[x]-\.-[x]\s*)/,/^(?:\s*<\.->\s*)/,/^(?:\s*<-\.->\s*)/,/^(?:\s*[o]-\.-[o]\s*)/,/^(?:\s*--[o]\s*)/,/^(?:\s*---\s*)/,/^(?:\s*-\.-[x]\s*)/,/^(?:\s*-\.->\s*)/,/^(?:\s*-\.-[o]\s*)/,/^(?:\s*-\.-\s*)/,/^(?:\s*.-[x]\s*)/,/^(?:\s*\.->\s*)/,/^(?:\s*\.-[o]\s*)/,/^(?:\s*\.-\s*)/,/^(?:\s*==[x]\s*)/,/^(?:\s*==>\s*)/,/^(?:\s*==[o]\s*)/,/^(?:\s*==[\=]\s*)/,/^(?:\s*<--\s*)/,/^(?:\s*[x]--\s*)/,/^(?:\s*[o]--\s*)/,/^(?:\s*<-\.\s*)/,/^(?:\s*[x]-\.\s*)/,/^(?:\s*[o]-\.\s*)/,/^(?:\s*<==\s*)/,/^(?:\s*[x]==\s*)/,/^(?:\s*[o]==\s*)/,/^(?:\s*--\s*)/,/^(?:\s*-\.\s*)/,/^(?:\s*==\s*)/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\[)/,/^(?:\]\))/,/^(?:\[\[)/,/^(?:\]\])/,/^(?:\[\()/,/^(?:\)\])/,/^(?:-)/,/^(?:\.)/,/^(?:[\_])/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:[A-Za-z]+)/,/^(?:\\\])/,/^(?:\[\/)/,/^(?:\/\])/,/^(?:\[\\)/,/^(?:[!"#$%&'*+,-.`?\\_/])/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],
11026conditions: {"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"vertex":{"rules":[],"inclusive":false},"dir":{"rules":[25,26,27,28,29,30,31,32,33,34,35],"inclusive":false},"string":{"rules":[8,9],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121],"inclusive":true}}
11027});
11028return lexer;
11029})();
11030parser.lexer = lexer;
11031function Parser () {
11032 this.yy = {};
11033}
11034Parser.prototype = parser;parser.Parser = Parser;
11035return new Parser;
11036})();
11037
11038
11039if (true) {
11040exports.parser = parser;
11041exports.Parser = parser.Parser;
11042exports.parse = function () { return parser.parse.apply(parser, arguments); };
11043exports.main = function commonjsMain (args) {
11044 if (!args[1]) {
11045 console.log('Usage: '+args[0]+' FILE');
11046 process.exit(1);
11047 }
11048 var source = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
11049 return exports.parser.parse(source);
11050};
11051if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
11052 exports.main(process.argv.slice(1));
11053}
11054}
11055/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
11056
11057/***/ }),
11058
11059/***/ "./src/diagrams/flowchart/styles.js":
11060/*!******************************************!*\
11061 !*** ./src/diagrams/flowchart/styles.js ***!
11062 \******************************************/
11063/*! exports provided: default */
11064/***/ (function(module, __webpack_exports__, __webpack_require__) {
11065
11066"use strict";
11067__webpack_require__.r(__webpack_exports__);
11068var getStyles = function getStyles(options) {
11069 return ".label {\n font-family: ".concat(options.fontFamily, ";\n color: ").concat(options.nodeTextColor || options.textColor, ";\n }\n\n .label text {\n fill: ").concat(options.nodeTextColor || options.textColor, ";\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ").concat(options.arrowheadColor, ";\n }\n\n .edgePath .path {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1.5px;\n }\n\n .flowchart-link {\n stroke: ").concat(options.lineColor, ";\n fill: none;\n }\n\n .edgeLabel {\n background-color: ").concat(options.edgeLabelBackground, ";\n rect {\n opacity: 0.5;\n background-color: ").concat(options.edgeLabelBackground, ";\n fill: ").concat(options.edgeLabelBackground, ";\n }\n text-align: center;\n }\n\n .cluster rect {\n fill: ").concat(options.clusterBkg, ";\n stroke: ").concat(options.clusterBorder, ";\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ").concat(options.titleColor, ";\n }\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ").concat(options.fontFamily, ";\n font-size: 12px;\n background: ").concat(options.tertiaryColor, ";\n border: 1px solid ").concat(options.border2, ";\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n");
11070};
11071
11072/* harmony default export */ __webpack_exports__["default"] = (getStyles);
11073
11074/***/ }),
11075
11076/***/ "./src/diagrams/gantt/ganttDb.js":
11077/*!***************************************!*\
11078 !*** ./src/diagrams/gantt/ganttDb.js ***!
11079 \***************************************/
11080/*! exports provided: parseDirective, clear, setAxisFormat, getAxisFormat, setTodayMarker, getTodayMarker, setDateFormat, enableInclusiveEndDates, endDatesAreInclusive, getDateFormat, setExcludes, getExcludes, setTitle, getTitle, addSection, getSections, getTasks, addTask, findTaskById, addTaskOrg, setLink, setClass, setClickEvent, bindFunctions, default */
11081/***/ (function(module, __webpack_exports__, __webpack_require__) {
11082
11083"use strict";
11084__webpack_require__.r(__webpack_exports__);
11085/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
11086/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
11087/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setAxisFormat", function() { return setAxisFormat; });
11088/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAxisFormat", function() { return getAxisFormat; });
11089/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTodayMarker", function() { return setTodayMarker; });
11090/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTodayMarker", function() { return getTodayMarker; });
11091/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setDateFormat", function() { return setDateFormat; });
11092/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableInclusiveEndDates", function() { return enableInclusiveEndDates; });
11093/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "endDatesAreInclusive", function() { return endDatesAreInclusive; });
11094/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDateFormat", function() { return getDateFormat; });
11095/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setExcludes", function() { return setExcludes; });
11096/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getExcludes", function() { return getExcludes; });
11097/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTitle", function() { return setTitle; });
11098/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTitle", function() { return getTitle; });
11099/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSection", function() { return addSection; });
11100/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSections", function() { return getSections; });
11101/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTasks", function() { return getTasks; });
11102/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTask", function() { return addTask; });
11103/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findTaskById", function() { return findTaskById; });
11104/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTaskOrg", function() { return addTaskOrg; });
11105/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLink", function() { return setLink; });
11106/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setClass", function() { return setClass; });
11107/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setClickEvent", function() { return setClickEvent; });
11108/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindFunctions", function() { return bindFunctions; });
11109/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
11110/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
11111/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
11112/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__);
11113/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
11114/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
11115/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
11116/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
11117function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
11118
11119function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
11120
11121function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
11122
11123function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
11124
11125
11126
11127
11128
11129
11130
11131var dateFormat = '';
11132var axisFormat = '';
11133var todayMarker = '';
11134var excludes = [];
11135var title = '';
11136var sections = [];
11137var tasks = [];
11138var currentSection = '';
11139var tags = ['active', 'done', 'crit', 'milestone'];
11140var funs = [];
11141var inclusiveEndDates = false; // The serial order of the task in the script
11142
11143var lastOrder = 0;
11144var parseDirective = function parseDirective(statement, context, type) {
11145 _mermaidAPI__WEBPACK_IMPORTED_MODULE_5__["default"].parseDirective(this, statement, context, type);
11146};
11147var clear = function clear() {
11148 sections = [];
11149 tasks = [];
11150 currentSection = '';
11151 funs = [];
11152 title = '';
11153 taskCnt = 0;
11154 lastTask = undefined;
11155 lastTaskID = undefined;
11156 rawTasks = [];
11157 dateFormat = '';
11158 axisFormat = '';
11159 todayMarker = '';
11160 excludes = [];
11161 inclusiveEndDates = false;
11162 lastOrder = 0;
11163};
11164var setAxisFormat = function setAxisFormat(txt) {
11165 axisFormat = txt;
11166};
11167var getAxisFormat = function getAxisFormat() {
11168 return axisFormat;
11169};
11170var setTodayMarker = function setTodayMarker(txt) {
11171 todayMarker = txt;
11172};
11173var getTodayMarker = function getTodayMarker() {
11174 return todayMarker;
11175};
11176var setDateFormat = function setDateFormat(txt) {
11177 dateFormat = txt;
11178};
11179var enableInclusiveEndDates = function enableInclusiveEndDates() {
11180 inclusiveEndDates = true;
11181};
11182var endDatesAreInclusive = function endDatesAreInclusive() {
11183 return inclusiveEndDates;
11184};
11185var getDateFormat = function getDateFormat() {
11186 return dateFormat;
11187};
11188var setExcludes = function setExcludes(txt) {
11189 excludes = txt.toLowerCase().split(/[\s,]+/);
11190};
11191var getExcludes = function getExcludes() {
11192 return excludes;
11193};
11194var setTitle = function setTitle(txt) {
11195 title = txt;
11196};
11197var getTitle = function getTitle() {
11198 return title;
11199};
11200var addSection = function addSection(txt) {
11201 currentSection = txt;
11202 sections.push(txt);
11203};
11204var getSections = function getSections() {
11205 return sections;
11206};
11207var getTasks = function getTasks() {
11208 var allItemsPricessed = compileTasks();
11209 var maxDepth = 10;
11210 var iterationCount = 0;
11211
11212 while (!allItemsPricessed && iterationCount < maxDepth) {
11213 allItemsPricessed = compileTasks();
11214 iterationCount++;
11215 }
11216
11217 tasks = rawTasks;
11218 return tasks;
11219};
11220
11221var isInvalidDate = function isInvalidDate(date, dateFormat, excludes) {
11222 if (date.isoWeekday() >= 6 && excludes.indexOf('weekends') >= 0) {
11223 return true;
11224 }
11225
11226 if (excludes.indexOf(date.format('dddd').toLowerCase()) >= 0) {
11227 return true;
11228 }
11229
11230 return excludes.indexOf(date.format(dateFormat.trim())) >= 0;
11231};
11232
11233var checkTaskDates = function checkTaskDates(task, dateFormat, excludes) {
11234 if (!excludes.length || task.manualEndTime) return;
11235 var startTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(task.startTime, dateFormat, true);
11236 startTime.add(1, 'd');
11237 var endTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(task.endTime, dateFormat, true);
11238 var renderEndTime = fixTaskDates(startTime, endTime, dateFormat, excludes);
11239 task.endTime = endTime.toDate();
11240 task.renderEndTime = renderEndTime;
11241};
11242
11243var fixTaskDates = function fixTaskDates(startTime, endTime, dateFormat, excludes) {
11244 var invalid = false;
11245 var renderEndTime = null;
11246
11247 while (startTime <= endTime) {
11248 if (!invalid) {
11249 renderEndTime = endTime.toDate();
11250 }
11251
11252 invalid = isInvalidDate(startTime, dateFormat, excludes);
11253
11254 if (invalid) {
11255 endTime.add(1, 'd');
11256 }
11257
11258 startTime.add(1, 'd');
11259 }
11260
11261 return renderEndTime;
11262};
11263
11264var getStartDate = function getStartDate(prevTime, dateFormat, str) {
11265 str = str.trim(); // Test for after
11266
11267 var re = /^after\s+([\d\w- ]+)/;
11268 var afterStatement = re.exec(str.trim());
11269
11270 if (afterStatement !== null) {
11271 // check all after ids and take the latest
11272 var latestEndingTask = null;
11273 afterStatement[1].split(' ').forEach(function (id) {
11274 var task = findTaskById(id);
11275
11276 if (typeof task !== 'undefined') {
11277 if (!latestEndingTask) {
11278 latestEndingTask = task;
11279 } else {
11280 if (task.endTime > latestEndingTask.endTime) {
11281 latestEndingTask = task;
11282 }
11283 }
11284 }
11285 });
11286
11287 if (!latestEndingTask) {
11288 var dt = new Date();
11289 dt.setHours(0, 0, 0, 0);
11290 return dt;
11291 } else {
11292 return latestEndingTask.endTime;
11293 }
11294 } // Check for actual date set
11295
11296
11297 var mDate = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(str, dateFormat.trim(), true);
11298
11299 if (mDate.isValid()) {
11300 return mDate.toDate();
11301 } else {
11302 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Invalid date:' + str);
11303 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('With date format:' + dateFormat.trim());
11304 } // Default date - now
11305
11306
11307 return new Date();
11308};
11309
11310var durationToDate = function durationToDate(durationStatement, relativeTime) {
11311 if (durationStatement !== null) {
11312 switch (durationStatement[2]) {
11313 case 's':
11314 relativeTime.add(durationStatement[1], 'seconds');
11315 break;
11316
11317 case 'm':
11318 relativeTime.add(durationStatement[1], 'minutes');
11319 break;
11320
11321 case 'h':
11322 relativeTime.add(durationStatement[1], 'hours');
11323 break;
11324
11325 case 'd':
11326 relativeTime.add(durationStatement[1], 'days');
11327 break;
11328
11329 case 'w':
11330 relativeTime.add(durationStatement[1], 'weeks');
11331 break;
11332 }
11333 } // Default date - now
11334
11335
11336 return relativeTime.toDate();
11337};
11338
11339var getEndDate = function getEndDate(prevTime, dateFormat, str, inclusive) {
11340 inclusive = inclusive || false;
11341 str = str.trim(); // Check for actual date
11342
11343 var mDate = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(str, dateFormat.trim(), true);
11344
11345 if (mDate.isValid()) {
11346 if (inclusive) {
11347 mDate.add(1, 'd');
11348 }
11349
11350 return mDate.toDate();
11351 }
11352
11353 return durationToDate(/^([\d]+)([wdhms])/.exec(str.trim()), moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(prevTime));
11354};
11355
11356var taskCnt = 0;
11357
11358var parseId = function parseId(idStr) {
11359 if (typeof idStr === 'undefined') {
11360 taskCnt = taskCnt + 1;
11361 return 'task' + taskCnt;
11362 }
11363
11364 return idStr;
11365}; // id, startDate, endDate
11366// id, startDate, length
11367// id, after x, endDate
11368// id, after x, length
11369// startDate, endDate
11370// startDate, length
11371// after x, endDate
11372// after x, length
11373// endDate
11374// length
11375
11376
11377var compileData = function compileData(prevTask, dataStr) {
11378 var ds;
11379
11380 if (dataStr.substr(0, 1) === ':') {
11381 ds = dataStr.substr(1, dataStr.length);
11382 } else {
11383 ds = dataStr;
11384 }
11385
11386 var data = ds.split(',');
11387 var task = {}; // Get tags like active, done, crit and milestone
11388
11389 getTaskTags(data, task, tags);
11390
11391 for (var i = 0; i < data.length; i++) {
11392 data[i] = data[i].trim();
11393 }
11394
11395 var endTimeData = '';
11396
11397 switch (data.length) {
11398 case 1:
11399 task.id = parseId();
11400 task.startTime = prevTask.endTime;
11401 endTimeData = data[0];
11402 break;
11403
11404 case 2:
11405 task.id = parseId();
11406 task.startTime = getStartDate(undefined, dateFormat, data[0]);
11407 endTimeData = data[1];
11408 break;
11409
11410 case 3:
11411 task.id = parseId(data[0]);
11412 task.startTime = getStartDate(undefined, dateFormat, data[1]);
11413 endTimeData = data[2];
11414 break;
11415
11416 default:
11417 }
11418
11419 if (endTimeData) {
11420 task.endTime = getEndDate(task.startTime, dateFormat, endTimeData, inclusiveEndDates);
11421 task.manualEndTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(endTimeData, 'YYYY-MM-DD', true).isValid();
11422 checkTaskDates(task, dateFormat, excludes);
11423 }
11424
11425 return task;
11426};
11427
11428var parseData = function parseData(prevTaskId, dataStr) {
11429 var ds;
11430
11431 if (dataStr.substr(0, 1) === ':') {
11432 ds = dataStr.substr(1, dataStr.length);
11433 } else {
11434 ds = dataStr;
11435 }
11436
11437 var data = ds.split(',');
11438 var task = {}; // Get tags like active, done, crit and milestone
11439
11440 getTaskTags(data, task, tags);
11441
11442 for (var i = 0; i < data.length; i++) {
11443 data[i] = data[i].trim();
11444 }
11445
11446 switch (data.length) {
11447 case 1:
11448 task.id = parseId();
11449 task.startTime = {
11450 type: 'prevTaskEnd',
11451 id: prevTaskId
11452 };
11453 task.endTime = {
11454 data: data[0]
11455 };
11456 break;
11457
11458 case 2:
11459 task.id = parseId();
11460 task.startTime = {
11461 type: 'getStartDate',
11462 startData: data[0]
11463 };
11464 task.endTime = {
11465 data: data[1]
11466 };
11467 break;
11468
11469 case 3:
11470 task.id = parseId(data[0]);
11471 task.startTime = {
11472 type: 'getStartDate',
11473 startData: data[1]
11474 };
11475 task.endTime = {
11476 data: data[2]
11477 };
11478 break;
11479
11480 default:
11481 }
11482
11483 return task;
11484};
11485
11486var lastTask;
11487var lastTaskID;
11488var rawTasks = [];
11489var taskDb = {};
11490var addTask = function addTask(descr, data) {
11491 var rawTask = {
11492 section: currentSection,
11493 type: currentSection,
11494 processed: false,
11495 manualEndTime: false,
11496 renderEndTime: null,
11497 raw: {
11498 data: data
11499 },
11500 task: descr,
11501 classes: []
11502 };
11503 var taskInfo = parseData(lastTaskID, data);
11504 rawTask.raw.startTime = taskInfo.startTime;
11505 rawTask.raw.endTime = taskInfo.endTime;
11506 rawTask.id = taskInfo.id;
11507 rawTask.prevTaskId = lastTaskID;
11508 rawTask.active = taskInfo.active;
11509 rawTask.done = taskInfo.done;
11510 rawTask.crit = taskInfo.crit;
11511 rawTask.milestone = taskInfo.milestone;
11512 rawTask.order = lastOrder;
11513 lastOrder++;
11514 var pos = rawTasks.push(rawTask);
11515 lastTaskID = rawTask.id; // Store cross ref
11516
11517 taskDb[rawTask.id] = pos - 1;
11518};
11519var findTaskById = function findTaskById(id) {
11520 var pos = taskDb[id];
11521 return rawTasks[pos];
11522};
11523var addTaskOrg = function addTaskOrg(descr, data) {
11524 var newTask = {
11525 section: currentSection,
11526 type: currentSection,
11527 description: descr,
11528 task: descr,
11529 classes: []
11530 };
11531 var taskInfo = compileData(lastTask, data);
11532 newTask.startTime = taskInfo.startTime;
11533 newTask.endTime = taskInfo.endTime;
11534 newTask.id = taskInfo.id;
11535 newTask.active = taskInfo.active;
11536 newTask.done = taskInfo.done;
11537 newTask.crit = taskInfo.crit;
11538 newTask.milestone = taskInfo.milestone;
11539 lastTask = newTask;
11540 tasks.push(newTask);
11541};
11542
11543var compileTasks = function compileTasks() {
11544 var compileTask = function compileTask(pos) {
11545 var task = rawTasks[pos];
11546 var startTime = '';
11547
11548 switch (rawTasks[pos].raw.startTime.type) {
11549 case 'prevTaskEnd':
11550 {
11551 var prevTask = findTaskById(task.prevTaskId);
11552 task.startTime = prevTask.endTime;
11553 break;
11554 }
11555
11556 case 'getStartDate':
11557 startTime = getStartDate(undefined, dateFormat, rawTasks[pos].raw.startTime.startData);
11558
11559 if (startTime) {
11560 rawTasks[pos].startTime = startTime;
11561 }
11562
11563 break;
11564 }
11565
11566 if (rawTasks[pos].startTime) {
11567 rawTasks[pos].endTime = getEndDate(rawTasks[pos].startTime, dateFormat, rawTasks[pos].raw.endTime.data, inclusiveEndDates);
11568
11569 if (rawTasks[pos].endTime) {
11570 rawTasks[pos].processed = true;
11571 rawTasks[pos].manualEndTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(rawTasks[pos].raw.endTime.data, 'YYYY-MM-DD', true).isValid();
11572 checkTaskDates(rawTasks[pos], dateFormat, excludes);
11573 }
11574 }
11575
11576 return rawTasks[pos].processed;
11577 };
11578
11579 var allProcessed = true;
11580
11581 for (var i = 0; i < rawTasks.length; i++) {
11582 compileTask(i);
11583 allProcessed = allProcessed && rawTasks[i].processed;
11584 }
11585
11586 return allProcessed;
11587};
11588/**
11589 * Called by parser when a link is found. Adds the URL to the vertex data.
11590 * @param ids Comma separated list of ids
11591 * @param linkStr URL to create a link for
11592 */
11593
11594
11595var setLink = function setLink(ids, _linkStr) {
11596 var linkStr = _linkStr;
11597
11598 if (_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"]().securityLevel !== 'loose') {
11599 linkStr = Object(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__["sanitizeUrl"])(_linkStr);
11600 }
11601
11602 ids.split(',').forEach(function (id) {
11603 var rawTask = findTaskById(id);
11604
11605 if (typeof rawTask !== 'undefined') {
11606 pushFun(id, function () {
11607 window.open(linkStr, '_self');
11608 });
11609 }
11610 });
11611 setClass(ids, 'clickable');
11612};
11613/**
11614 * Called by parser when a special node is found, e.g. a clickable element.
11615 * @param ids Comma separated list of ids
11616 * @param className Class to add
11617 */
11618
11619var setClass = function setClass(ids, className) {
11620 ids.split(',').forEach(function (id) {
11621 var rawTask = findTaskById(id);
11622
11623 if (typeof rawTask !== 'undefined') {
11624 rawTask.classes.push(className);
11625 }
11626 });
11627};
11628
11629var setClickFun = function setClickFun(id, functionName, functionArgs) {
11630 if (_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"]().securityLevel !== 'loose') {
11631 return;
11632 }
11633
11634 if (typeof functionName === 'undefined') {
11635 return;
11636 }
11637
11638 var argList = [];
11639
11640 if (typeof functionArgs === 'string') {
11641 /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
11642 argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
11643
11644 for (var i = 0; i < argList.length; i++) {
11645 var item = argList[i].trim();
11646 /* Removes all double quotes at the start and end of an argument */
11647
11648 /* This preserves all starting and ending whitespace inside */
11649
11650 if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
11651 item = item.substr(1, item.length - 2);
11652 }
11653
11654 argList[i] = item;
11655 }
11656 }
11657 /* if no arguments passed into callback, default to passing in id */
11658
11659
11660 if (argList.length === 0) {
11661 argList.push(id);
11662 }
11663
11664 var rawTask = findTaskById(id);
11665
11666 if (typeof rawTask !== 'undefined') {
11667 pushFun(id, function () {
11668 _utils__WEBPACK_IMPORTED_MODULE_4__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_4__["default"], [functionName].concat(_toConsumableArray(argList)));
11669 });
11670 }
11671};
11672/**
11673 * The callbackFunction is executed in a click event bound to the task with the specified id or the task's assigned text
11674 * @param id The task's id
11675 * @param callbackFunction A function to be executed when clicked on the task or the task's text
11676 */
11677
11678
11679var pushFun = function pushFun(id, callbackFunction) {
11680 funs.push(function () {
11681 // const elem = d3.select(element).select(`[id="${id}"]`)
11682 var elem = document.querySelector("[id=\"".concat(id, "\"]"));
11683
11684 if (elem !== null) {
11685 elem.addEventListener('click', function () {
11686 callbackFunction();
11687 });
11688 }
11689 });
11690 funs.push(function () {
11691 // const elem = d3.select(element).select(`[id="${id}-text"]`)
11692 var elem = document.querySelector("[id=\"".concat(id, "-text\"]"));
11693
11694 if (elem !== null) {
11695 elem.addEventListener('click', function () {
11696 callbackFunction();
11697 });
11698 }
11699 });
11700};
11701/**
11702 * Called by parser when a click definition is found. Registers an event handler.
11703 * @param ids Comma separated list of ids
11704 * @param functionName Function to be called on click
11705 * @param functionArgs Function args the function should be called with
11706 */
11707
11708
11709var setClickEvent = function setClickEvent(ids, functionName, functionArgs) {
11710 ids.split(',').forEach(function (id) {
11711 setClickFun(id, functionName, functionArgs);
11712 });
11713 setClass(ids, 'clickable');
11714};
11715/**
11716 * Binds all functions previously added to fun (specified through click) to the element
11717 * @param element
11718 */
11719
11720var bindFunctions = function bindFunctions(element) {
11721 funs.forEach(function (fun) {
11722 fun(element);
11723 });
11724};
11725/* harmony default export */ __webpack_exports__["default"] = ({
11726 parseDirective: parseDirective,
11727 getConfig: function getConfig() {
11728 return _config__WEBPACK_IMPORTED_MODULE_3__["getConfig"]().gantt;
11729 },
11730 clear: clear,
11731 setDateFormat: setDateFormat,
11732 getDateFormat: getDateFormat,
11733 enableInclusiveEndDates: enableInclusiveEndDates,
11734 endDatesAreInclusive: endDatesAreInclusive,
11735 setAxisFormat: setAxisFormat,
11736 getAxisFormat: getAxisFormat,
11737 setTodayMarker: setTodayMarker,
11738 getTodayMarker: getTodayMarker,
11739 setTitle: setTitle,
11740 getTitle: getTitle,
11741 addSection: addSection,
11742 getSections: getSections,
11743 getTasks: getTasks,
11744 addTask: addTask,
11745 findTaskById: findTaskById,
11746 addTaskOrg: addTaskOrg,
11747 setExcludes: setExcludes,
11748 getExcludes: getExcludes,
11749 setClickEvent: setClickEvent,
11750 setLink: setLink,
11751 bindFunctions: bindFunctions,
11752 durationToDate: durationToDate
11753});
11754
11755function getTaskTags(data, task, tags) {
11756 var matchFound = true;
11757
11758 while (matchFound) {
11759 matchFound = false;
11760 tags.forEach(function (t) {
11761 var pattern = '^\\s*' + t + '\\s*$';
11762 var regex = new RegExp(pattern);
11763
11764 if (data[0].match(regex)) {
11765 task[t] = true;
11766 data.shift(1);
11767 matchFound = true;
11768 }
11769 });
11770 }
11771}
11772
11773/***/ }),
11774
11775/***/ "./src/diagrams/gantt/ganttRenderer.js":
11776/*!*********************************************!*\
11777 !*** ./src/diagrams/gantt/ganttRenderer.js ***!
11778 \*********************************************/
11779/*! exports provided: setConf, draw, default */
11780/***/ (function(module, __webpack_exports__, __webpack_require__) {
11781
11782"use strict";
11783__webpack_require__.r(__webpack_exports__);
11784/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
11785/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
11786/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
11787/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
11788/* harmony import */ var _parser_gantt__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/gantt */ "./src/diagrams/gantt/parser/gantt.jison");
11789/* harmony import */ var _parser_gantt__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_gantt__WEBPACK_IMPORTED_MODULE_1__);
11790/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
11791/* harmony import */ var _ganttDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ganttDb */ "./src/diagrams/gantt/ganttDb.js");
11792
11793
11794
11795
11796_parser_gantt__WEBPACK_IMPORTED_MODULE_1__["parser"].yy = _ganttDb__WEBPACK_IMPORTED_MODULE_3__["default"];
11797var conf = {
11798 titleTopMargin: 25,
11799 barHeight: 20,
11800 barGap: 4,
11801 topPadding: 50,
11802 rightPadding: 75,
11803 leftPadding: 75,
11804 gridLineStartPadding: 35,
11805 fontSize: 11,
11806 fontFamily: '"Open-Sans", "sans-serif"'
11807};
11808var setConf = function setConf(cnf) {
11809 var keys = Object.keys(cnf);
11810 keys.forEach(function (key) {
11811 conf[key] = cnf[key];
11812 });
11813};
11814var w;
11815var draw = function draw(text, id) {
11816 _parser_gantt__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.clear();
11817 _parser_gantt__WEBPACK_IMPORTED_MODULE_1__["parser"].parse(text);
11818 var elem = document.getElementById(id);
11819 w = elem.parentElement.offsetWidth;
11820
11821 if (typeof w === 'undefined') {
11822 w = 1200;
11823 }
11824
11825 if (typeof conf.useWidth !== 'undefined') {
11826 w = conf.useWidth;
11827 }
11828
11829 var taskArray = _parser_gantt__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.getTasks(); // Set height based on number of tasks
11830
11831 var h = taskArray.length * (conf.barHeight + conf.barGap) + 2 * conf.topPadding;
11832 elem.setAttribute('height', '100%'); // Set viewBox
11833
11834 elem.setAttribute('viewBox', '0 0 ' + w + ' ' + h);
11835 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id=\"".concat(id, "\"]")); // Set timescale
11836
11837 var timeScale = Object(d3__WEBPACK_IMPORTED_MODULE_0__["scaleTime"])().domain([Object(d3__WEBPACK_IMPORTED_MODULE_0__["min"])(taskArray, function (d) {
11838 return d.startTime;
11839 }), Object(d3__WEBPACK_IMPORTED_MODULE_0__["max"])(taskArray, function (d) {
11840 return d.endTime;
11841 })]).rangeRound([0, w - conf.leftPadding - conf.rightPadding]);
11842 var categories = [];
11843
11844 for (var i = 0; i < taskArray.length; i++) {
11845 categories.push(taskArray[i].type);
11846 }
11847
11848 var catsUnfiltered = categories; // for vert labels
11849
11850 categories = checkUnique(categories);
11851
11852 function taskCompare(a, b) {
11853 var taskA = a.startTime;
11854 var taskB = b.startTime;
11855 var result = 0;
11856
11857 if (taskA > taskB) {
11858 result = 1;
11859 } else if (taskA < taskB) {
11860 result = -1;
11861 }
11862
11863 return result;
11864 } // Sort the task array using the above taskCompare() so that
11865 // tasks are created based on their order of startTime
11866
11867
11868 taskArray.sort(taskCompare);
11869 makeGant(taskArray, w, h);
11870
11871 if (typeof conf.useWidth !== 'undefined') {
11872 elem.setAttribute('width', w);
11873 }
11874
11875 svg.append('text').text(_parser_gantt__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.getTitle()).attr('x', w / 2).attr('y', conf.titleTopMargin).attr('class', 'titleText');
11876
11877 function makeGant(tasks, pageWidth, pageHeight) {
11878 var barHeight = conf.barHeight;
11879 var gap = barHeight + conf.barGap;
11880 var topPadding = conf.topPadding;
11881 var leftPadding = conf.leftPadding;
11882 var colorScale = Object(d3__WEBPACK_IMPORTED_MODULE_0__["scaleLinear"])().domain([0, categories.length]).range(['#00B9FA', '#F95002']).interpolate(d3__WEBPACK_IMPORTED_MODULE_0__["interpolateHcl"]);
11883 makeGrid(leftPadding, topPadding, pageWidth, pageHeight);
11884 drawRects(tasks, gap, topPadding, leftPadding, barHeight, colorScale, pageWidth, pageHeight);
11885 vertLabels(gap, topPadding, leftPadding, barHeight, colorScale);
11886 drawToday(leftPadding, topPadding, pageWidth, pageHeight);
11887 }
11888
11889 function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w) {
11890 // Draw background rects covering the entire width of the graph, these form the section rows.
11891 svg.append('g').selectAll('rect').data(theArray).enter().append('rect').attr('x', 0).attr('y', function (d, i) {
11892 // Ignore the incoming i value and use our order instead
11893 i = d.order;
11894 return i * theGap + theTopPad - 2;
11895 }).attr('width', function () {
11896 return w - conf.rightPadding / 2;
11897 }).attr('height', theGap).attr('class', function (d) {
11898 for (var _i = 0; _i < categories.length; _i++) {
11899 if (d.type === categories[_i]) {
11900 return 'section section' + _i % conf.numberSectionStyles;
11901 }
11902 }
11903
11904 return 'section section0';
11905 }); // Draw the rects representing the tasks
11906
11907 var rectangles = svg.append('g').selectAll('rect').data(theArray).enter();
11908 rectangles.append('rect').attr('id', function (d) {
11909 return d.id;
11910 }).attr('rx', 3).attr('ry', 3).attr('x', function (d) {
11911 if (d.milestone) {
11912 return timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
11913 }
11914
11915 return timeScale(d.startTime) + theSidePad;
11916 }).attr('y', function (d, i) {
11917 // Ignore the incoming i value and use our order instead
11918 i = d.order;
11919 return i * theGap + theTopPad;
11920 }).attr('width', function (d) {
11921 if (d.milestone) {
11922 return theBarHeight;
11923 }
11924
11925 return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime);
11926 }).attr('height', theBarHeight).attr('transform-origin', function (d, i) {
11927 return (timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime))).toString() + 'px ' + (i * theGap + theTopPad + 0.5 * theBarHeight).toString() + 'px';
11928 }).attr('class', function (d) {
11929 var res = 'task';
11930 var classStr = '';
11931
11932 if (d.classes.length > 0) {
11933 classStr = d.classes.join(' ');
11934 }
11935
11936 var secNum = 0;
11937
11938 for (var _i2 = 0; _i2 < categories.length; _i2++) {
11939 if (d.type === categories[_i2]) {
11940 secNum = _i2 % conf.numberSectionStyles;
11941 }
11942 }
11943
11944 var taskClass = '';
11945
11946 if (d.active) {
11947 if (d.crit) {
11948 taskClass += ' activeCrit';
11949 } else {
11950 taskClass = ' active';
11951 }
11952 } else if (d.done) {
11953 if (d.crit) {
11954 taskClass = ' doneCrit';
11955 } else {
11956 taskClass = ' done';
11957 }
11958 } else {
11959 if (d.crit) {
11960 taskClass += ' crit';
11961 }
11962 }
11963
11964 if (taskClass.length === 0) {
11965 taskClass = ' task';
11966 }
11967
11968 if (d.milestone) {
11969 taskClass = ' milestone ' + taskClass;
11970 }
11971
11972 taskClass += secNum;
11973 taskClass += ' ' + classStr;
11974 return res + taskClass;
11975 }); // Append task labels
11976
11977 rectangles.append('text').attr('id', function (d) {
11978 return d.id + '-text';
11979 }).text(function (d) {
11980 return d.task;
11981 }).attr('font-size', conf.fontSize).attr('x', function (d) {
11982 var startX = timeScale(d.startTime);
11983 var endX = timeScale(d.renderEndTime || d.endTime);
11984
11985 if (d.milestone) {
11986 startX += 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
11987 }
11988
11989 if (d.milestone) {
11990 endX = startX + theBarHeight;
11991 }
11992
11993 var textWidth = this.getBBox().width; // Check id text width > width of rectangle
11994
11995 if (textWidth > endX - startX) {
11996 if (endX + textWidth + 1.5 * conf.leftPadding > w) {
11997 return startX + theSidePad - 5;
11998 } else {
11999 return endX + theSidePad + 5;
12000 }
12001 } else {
12002 return (endX - startX) / 2 + startX + theSidePad;
12003 }
12004 }).attr('y', function (d, i) {
12005 // Ignore the incoming i value and use our order instead
12006 i = d.order;
12007 return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad;
12008 }).attr('text-height', theBarHeight).attr('class', function (d) {
12009 var startX = timeScale(d.startTime);
12010 var endX = timeScale(d.endTime);
12011
12012 if (d.milestone) {
12013 endX = startX + theBarHeight;
12014 }
12015
12016 var textWidth = this.getBBox().width;
12017 var classStr = '';
12018
12019 if (d.classes.length > 0) {
12020 classStr = d.classes.join(' ');
12021 }
12022
12023 var secNum = 0;
12024 console.log(conf);
12025
12026 for (var _i3 = 0; _i3 < categories.length; _i3++) {
12027 if (d.type === categories[_i3]) {
12028 secNum = _i3 % conf.numberSectionStyles;
12029 }
12030 }
12031
12032 var taskType = '';
12033
12034 if (d.active) {
12035 if (d.crit) {
12036 taskType = 'activeCritText' + secNum;
12037 } else {
12038 taskType = 'activeText' + secNum;
12039 }
12040 }
12041
12042 if (d.done) {
12043 if (d.crit) {
12044 taskType = taskType + ' doneCritText' + secNum;
12045 } else {
12046 taskType = taskType + ' doneText' + secNum;
12047 }
12048 } else {
12049 if (d.crit) {
12050 taskType = taskType + ' critText' + secNum;
12051 }
12052 }
12053
12054 if (d.milestone) {
12055 taskType += ' milestoneText';
12056 } // Check id text width > width of rectangle
12057
12058
12059 if (textWidth > endX - startX) {
12060 if (endX + textWidth + 1.5 * conf.leftPadding > w) {
12061 return classStr + ' taskTextOutsideLeft taskTextOutside' + secNum + ' ' + taskType;
12062 } else {
12063 return classStr + ' taskTextOutsideRight taskTextOutside' + secNum + ' ' + taskType + ' width-' + textWidth;
12064 }
12065 } else {
12066 return classStr + ' taskText taskText' + secNum + ' ' + taskType + ' width-' + textWidth;
12067 }
12068 });
12069 }
12070
12071 function makeGrid(theSidePad, theTopPad, w, h) {
12072 var xAxis = Object(d3__WEBPACK_IMPORTED_MODULE_0__["axisBottom"])(timeScale).tickSize(-h + theTopPad + conf.gridLineStartPadding).tickFormat(Object(d3__WEBPACK_IMPORTED_MODULE_0__["timeFormat"])(_parser_gantt__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
12073 svg.append('g').attr('class', 'grid').attr('transform', 'translate(' + theSidePad + ', ' + (h - 50) + ')').call(xAxis).selectAll('text').style('text-anchor', 'middle').attr('fill', '#000').attr('stroke', 'none').attr('font-size', 10).attr('dy', '1em');
12074 }
12075
12076 function vertLabels(theGap, theTopPad) {
12077 var numOccurances = [];
12078 var prevGap = 0;
12079
12080 for (var _i4 = 0; _i4 < categories.length; _i4++) {
12081 numOccurances[_i4] = [categories[_i4], getCount(categories[_i4], catsUnfiltered)];
12082 }
12083
12084 svg.append('g') // without doing this, impossible to put grid lines behind text
12085 .selectAll('text').data(numOccurances).enter().append(function (d) {
12086 var rows = d[0].split(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex);
12087 var dy = -(rows.length - 1) / 2;
12088 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
12089 svgLabel.setAttribute('dy', dy + 'em');
12090
12091 for (var j = 0; j < rows.length; j++) {
12092 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
12093 tspan.setAttribute('alignment-baseline', 'central');
12094 tspan.setAttribute('x', '10');
12095 if (j > 0) tspan.setAttribute('dy', '1em');
12096 tspan.textContent = rows[j];
12097 svgLabel.appendChild(tspan);
12098 }
12099
12100 return svgLabel;
12101 }).attr('x', 10).attr('y', function (d, i) {
12102 if (i > 0) {
12103 for (var j = 0; j < i; j++) {
12104 prevGap += numOccurances[i - 1][1];
12105 return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
12106 }
12107 } else {
12108 return d[1] * theGap / 2 + theTopPad;
12109 }
12110 }).attr('class', function (d) {
12111 for (var _i5 = 0; _i5 < categories.length; _i5++) {
12112 if (d[0] === categories[_i5]) {
12113 return 'sectionTitle sectionTitle' + _i5 % conf.numberSectionStyles;
12114 }
12115 }
12116
12117 return 'sectionTitle';
12118 });
12119 }
12120
12121 function drawToday(theSidePad, theTopPad, w, h) {
12122 var todayMarker = _ganttDb__WEBPACK_IMPORTED_MODULE_3__["default"].getTodayMarker();
12123
12124 if (todayMarker === 'off') {
12125 return;
12126 }
12127
12128 var todayG = svg.append('g').attr('class', 'today');
12129 var today = new Date();
12130 var todayLine = todayG.append('line');
12131 todayLine.attr('x1', timeScale(today) + theSidePad).attr('x2', timeScale(today) + theSidePad).attr('y1', conf.titleTopMargin).attr('y2', h - conf.titleTopMargin).attr('class', 'today');
12132
12133 if (todayMarker !== '') {
12134 todayLine.attr('style', todayMarker.replace(/,/g, ';'));
12135 }
12136 } // from this stackexchange question: http://stackoverflow.com/questions/1890203/unique-for-arrays-in-javascript
12137
12138
12139 function checkUnique(arr) {
12140 var hash = {};
12141 var result = [];
12142
12143 for (var _i6 = 0, l = arr.length; _i6 < l; ++_i6) {
12144 if (!hash.hasOwnProperty(arr[_i6])) {
12145 // eslint-disable-line
12146 // it works with objects! in FF, at least
12147 hash[arr[_i6]] = true;
12148 result.push(arr[_i6]);
12149 }
12150 }
12151
12152 return result;
12153 } // from this stackexchange question: http://stackoverflow.com/questions/14227981/count-how-many-strings-in-an-array-have-duplicates-in-the-same-array
12154
12155
12156 function getCounts(arr) {
12157 var i = arr.length; // const to loop over
12158
12159 var obj = {}; // obj to store results
12160
12161 while (i) {
12162 obj[arr[--i]] = (obj[arr[i]] || 0) + 1; // count occurrences
12163 }
12164
12165 return obj;
12166 } // get specific from everything
12167
12168
12169 function getCount(word, arr) {
12170 return getCounts(arr)[word] || 0;
12171 }
12172};
12173/* harmony default export */ __webpack_exports__["default"] = ({
12174 setConf: setConf,
12175 draw: draw
12176});
12177
12178/***/ }),
12179
12180/***/ "./src/diagrams/gantt/parser/gantt.jison":
12181/*!***********************************************!*\
12182 !*** ./src/diagrams/gantt/parser/gantt.jison ***!
12183 \***********************************************/
12184/*! no static exports found */
12185/***/ (function(module, exports, __webpack_require__) {
12186
12187/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
12188/*
12189 Returns a Parser object of the following structure:
12190
12191 Parser: {
12192 yy: {}
12193 }
12194
12195 Parser.prototype: {
12196 yy: {},
12197 trace: function(),
12198 symbols_: {associative list: name ==> number},
12199 terminals_: {associative list: number ==> name},
12200 productions_: [...],
12201 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
12202 table: [...],
12203 defaultActions: {...},
12204 parseError: function(str, hash),
12205 parse: function(input),
12206
12207 lexer: {
12208 EOF: 1,
12209 parseError: function(str, hash),
12210 setInput: function(input),
12211 input: function(),
12212 unput: function(str),
12213 more: function(),
12214 less: function(n),
12215 pastInput: function(),
12216 upcomingInput: function(),
12217 showPosition: function(),
12218 test_match: function(regex_match_array, rule_index),
12219 next: function(),
12220 lex: function(),
12221 begin: function(condition),
12222 popState: function(),
12223 _currentRules: function(),
12224 topState: function(),
12225 pushState: function(condition),
12226
12227 options: {
12228 ranges: boolean (optional: true ==> token location info will include a .range[] member)
12229 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
12230 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
12231 },
12232
12233 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
12234 rules: [...],
12235 conditions: {associative list: name ==> set},
12236 }
12237 }
12238
12239
12240 token location info (@$, _$, etc.): {
12241 first_line: n,
12242 last_line: n,
12243 first_column: n,
12244 last_column: n,
12245 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
12246 }
12247
12248
12249 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
12250 text: (matched text)
12251 token: (the produced terminal token, if any)
12252 line: (yylineno)
12253 }
12254 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
12255 loc: (yylloc)
12256 expected: (string describing the set of expected tokens)
12257 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
12258 }
12259*/
12260var parser = (function(){
12261var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,3],$V1=[1,5],$V2=[7,9,11,12,13,14,15,16,17,18,20,27,32],$V3=[1,15],$V4=[1,16],$V5=[1,17],$V6=[1,18],$V7=[1,19],$V8=[1,20],$V9=[1,21],$Va=[1,23],$Vb=[1,25],$Vc=[1,28],$Vd=[5,7,9,11,12,13,14,15,16,17,18,20,27,32];
12262var parser = {trace: function trace () { },
12263yy: {},
12264symbols_: {"error":2,"start":3,"directive":4,"gantt":5,"document":6,"EOF":7,"line":8,"SPACE":9,"statement":10,"NL":11,"dateFormat":12,"inclusiveEndDates":13,"axisFormat":14,"excludes":15,"todayMarker":16,"title":17,"section":18,"clickStatement":19,"taskTxt":20,"taskData":21,"openDirective":22,"typeDirective":23,"closeDirective":24,":":25,"argDirective":26,"click":27,"callbackname":28,"callbackargs":29,"href":30,"clickStatementDebug":31,"open_directive":32,"type_directive":33,"arg_directive":34,"close_directive":35,"$accept":0,"$end":1},
12265terminals_: {2:"error",5:"gantt",7:"EOF",9:"SPACE",11:"NL",12:"dateFormat",13:"inclusiveEndDates",14:"axisFormat",15:"excludes",16:"todayMarker",17:"title",18:"section",20:"taskTxt",21:"taskData",25:":",27:"click",28:"callbackname",29:"callbackargs",30:"href",32:"open_directive",33:"type_directive",34:"arg_directive",35:"close_directive"},
12266productions_: [0,[3,2],[3,3],[6,0],[6,2],[8,2],[8,1],[8,1],[8,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,1],[4,4],[4,6],[19,2],[19,3],[19,3],[19,4],[19,3],[19,4],[19,2],[31,2],[31,3],[31,3],[31,4],[31,3],[31,4],[31,2],[22,1],[23,1],[26,1],[24,1]],
12267performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
12268/* this == yyval */
12269
12270var $0 = $$.length - 1;
12271switch (yystate) {
12272case 2:
12273 return $$[$0-1];
12274break;
12275case 3:
12276 this.$ = []
12277break;
12278case 4:
12279$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
12280break;
12281case 5: case 6:
12282 this.$ = $$[$0]
12283break;
12284case 7: case 8:
12285 this.$=[];
12286break;
12287case 9:
12288yy.setDateFormat($$[$0].substr(11));this.$=$$[$0].substr(11);
12289break;
12290case 10:
12291yy.enableInclusiveEndDates();this.$=$$[$0].substr(18);
12292break;
12293case 11:
12294yy.setAxisFormat($$[$0].substr(11));this.$=$$[$0].substr(11);
12295break;
12296case 12:
12297yy.setExcludes($$[$0].substr(9));this.$=$$[$0].substr(9);
12298break;
12299case 13:
12300yy.setTodayMarker($$[$0].substr(12));this.$=$$[$0].substr(12);
12301break;
12302case 14:
12303yy.setTitle($$[$0].substr(6));this.$=$$[$0].substr(6);
12304break;
12305case 15:
12306yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
12307break;
12308case 17:
12309yy.addTask($$[$0-1],$$[$0]);this.$='task';
12310break;
12311case 21:
12312this.$ = $$[$0-1];yy.setClickEvent($$[$0-1], $$[$0], null);
12313break;
12314case 22:
12315this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
12316break;
12317case 23:
12318this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], null);yy.setLink($$[$0-2],$$[$0]);
12319break;
12320case 24:
12321this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-2], $$[$0-1]);yy.setLink($$[$0-3],$$[$0]);
12322break;
12323case 25:
12324this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0], null);yy.setLink($$[$0-2],$$[$0-1]);
12325break;
12326case 26:
12327this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-1], $$[$0]);yy.setLink($$[$0-3],$$[$0-2]);
12328break;
12329case 27:
12330this.$ = $$[$0-1];yy.setLink($$[$0-1], $$[$0]);
12331break;
12332case 28: case 34:
12333this.$=$$[$0-1] + ' ' + $$[$0];
12334break;
12335case 29: case 30: case 32:
12336this.$=$$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0];
12337break;
12338case 31: case 33:
12339this.$=$$[$0-3] + ' ' + $$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0];
12340break;
12341case 35:
12342 yy.parseDirective('%%{', 'open_directive');
12343break;
12344case 36:
12345 yy.parseDirective($$[$0], 'type_directive');
12346break;
12347case 37:
12348 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
12349break;
12350case 38:
12351 yy.parseDirective('}%%', 'close_directive', 'gantt');
12352break;
12353}
12354},
12355table: [{3:1,4:2,5:$V0,22:4,32:$V1},{1:[3]},{3:6,4:2,5:$V0,22:4,32:$V1},o($V2,[2,3],{6:7}),{23:8,33:[1,9]},{33:[2,35]},{1:[2,1]},{4:24,7:[1,10],8:11,9:[1,12],10:13,11:[1,14],12:$V3,13:$V4,14:$V5,15:$V6,16:$V7,17:$V8,18:$V9,19:22,20:$Va,22:4,27:$Vb,32:$V1},{24:26,25:[1,27],35:$Vc},o([25,35],[2,36]),o($V2,[2,8],{1:[2,2]}),o($V2,[2,4]),{4:24,10:29,12:$V3,13:$V4,14:$V5,15:$V6,16:$V7,17:$V8,18:$V9,19:22,20:$Va,22:4,27:$Vb,32:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,9]),o($V2,[2,10]),o($V2,[2,11]),o($V2,[2,12]),o($V2,[2,13]),o($V2,[2,14]),o($V2,[2,15]),o($V2,[2,16]),{21:[1,30]},o($V2,[2,18]),{28:[1,31],30:[1,32]},{11:[1,33]},{26:34,34:[1,35]},{11:[2,38]},o($V2,[2,5]),o($V2,[2,17]),o($V2,[2,21],{29:[1,36],30:[1,37]}),o($V2,[2,27],{28:[1,38]}),o($Vd,[2,19]),{24:39,35:$Vc},{35:[2,37]},o($V2,[2,22],{30:[1,40]}),o($V2,[2,23]),o($V2,[2,25],{29:[1,41]}),{11:[1,42]},o($V2,[2,24]),o($V2,[2,26]),o($Vd,[2,20])],
12356defaultActions: {5:[2,35],6:[2,1],28:[2,38],35:[2,37]},
12357parseError: function parseError (str, hash) {
12358 if (hash.recoverable) {
12359 this.trace(str);
12360 } else {
12361 var error = new Error(str);
12362 error.hash = hash;
12363 throw error;
12364 }
12365},
12366parse: function parse(input) {
12367 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
12368 var args = lstack.slice.call(arguments, 1);
12369 var lexer = Object.create(this.lexer);
12370 var sharedState = { yy: {} };
12371 for (var k in this.yy) {
12372 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
12373 sharedState.yy[k] = this.yy[k];
12374 }
12375 }
12376 lexer.setInput(input, sharedState.yy);
12377 sharedState.yy.lexer = lexer;
12378 sharedState.yy.parser = this;
12379 if (typeof lexer.yylloc == 'undefined') {
12380 lexer.yylloc = {};
12381 }
12382 var yyloc = lexer.yylloc;
12383 lstack.push(yyloc);
12384 var ranges = lexer.options && lexer.options.ranges;
12385 if (typeof sharedState.yy.parseError === 'function') {
12386 this.parseError = sharedState.yy.parseError;
12387 } else {
12388 this.parseError = Object.getPrototypeOf(this).parseError;
12389 }
12390 function popStack(n) {
12391 stack.length = stack.length - 2 * n;
12392 vstack.length = vstack.length - n;
12393 lstack.length = lstack.length - n;
12394 }
12395 function lex() {
12396 var token;
12397 token = tstack.pop() || lexer.lex() || EOF;
12398 if (typeof token !== 'number') {
12399 if (token instanceof Array) {
12400 tstack = token;
12401 token = tstack.pop();
12402 }
12403 token = self.symbols_[token] || token;
12404 }
12405 return token;
12406 }
12407 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
12408 while (true) {
12409 state = stack[stack.length - 1];
12410 if (this.defaultActions[state]) {
12411 action = this.defaultActions[state];
12412 } else {
12413 if (symbol === null || typeof symbol == 'undefined') {
12414 symbol = lex();
12415 }
12416 action = table[state] && table[state][symbol];
12417 }
12418 if (typeof action === 'undefined' || !action.length || !action[0]) {
12419 var errStr = '';
12420 expected = [];
12421 for (p in table[state]) {
12422 if (this.terminals_[p] && p > TERROR) {
12423 expected.push('\'' + this.terminals_[p] + '\'');
12424 }
12425 }
12426 if (lexer.showPosition) {
12427 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
12428 } else {
12429 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
12430 }
12431 this.parseError(errStr, {
12432 text: lexer.match,
12433 token: this.terminals_[symbol] || symbol,
12434 line: lexer.yylineno,
12435 loc: yyloc,
12436 expected: expected
12437 });
12438 }
12439 if (action[0] instanceof Array && action.length > 1) {
12440 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
12441 }
12442 switch (action[0]) {
12443 case 1:
12444 stack.push(symbol);
12445 vstack.push(lexer.yytext);
12446 lstack.push(lexer.yylloc);
12447 stack.push(action[1]);
12448 symbol = null;
12449 if (!preErrorSymbol) {
12450 yyleng = lexer.yyleng;
12451 yytext = lexer.yytext;
12452 yylineno = lexer.yylineno;
12453 yyloc = lexer.yylloc;
12454 if (recovering > 0) {
12455 recovering--;
12456 }
12457 } else {
12458 symbol = preErrorSymbol;
12459 preErrorSymbol = null;
12460 }
12461 break;
12462 case 2:
12463 len = this.productions_[action[1]][1];
12464 yyval.$ = vstack[vstack.length - len];
12465 yyval._$ = {
12466 first_line: lstack[lstack.length - (len || 1)].first_line,
12467 last_line: lstack[lstack.length - 1].last_line,
12468 first_column: lstack[lstack.length - (len || 1)].first_column,
12469 last_column: lstack[lstack.length - 1].last_column
12470 };
12471 if (ranges) {
12472 yyval._$.range = [
12473 lstack[lstack.length - (len || 1)].range[0],
12474 lstack[lstack.length - 1].range[1]
12475 ];
12476 }
12477 r = this.performAction.apply(yyval, [
12478 yytext,
12479 yyleng,
12480 yylineno,
12481 sharedState.yy,
12482 action[1],
12483 vstack,
12484 lstack
12485 ].concat(args));
12486 if (typeof r !== 'undefined') {
12487 return r;
12488 }
12489 if (len) {
12490 stack = stack.slice(0, -1 * len * 2);
12491 vstack = vstack.slice(0, -1 * len);
12492 lstack = lstack.slice(0, -1 * len);
12493 }
12494 stack.push(this.productions_[action[1]][0]);
12495 vstack.push(yyval.$);
12496 lstack.push(yyval._$);
12497 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
12498 stack.push(newState);
12499 break;
12500 case 3:
12501 return true;
12502 }
12503 }
12504 return true;
12505}};
12506
12507/* generated by jison-lex 0.3.4 */
12508var lexer = (function(){
12509var lexer = ({
12510
12511EOF:1,
12512
12513parseError:function parseError(str, hash) {
12514 if (this.yy.parser) {
12515 this.yy.parser.parseError(str, hash);
12516 } else {
12517 throw new Error(str);
12518 }
12519 },
12520
12521// resets the lexer, sets new input
12522setInput:function (input, yy) {
12523 this.yy = yy || this.yy || {};
12524 this._input = input;
12525 this._more = this._backtrack = this.done = false;
12526 this.yylineno = this.yyleng = 0;
12527 this.yytext = this.matched = this.match = '';
12528 this.conditionStack = ['INITIAL'];
12529 this.yylloc = {
12530 first_line: 1,
12531 first_column: 0,
12532 last_line: 1,
12533 last_column: 0
12534 };
12535 if (this.options.ranges) {
12536 this.yylloc.range = [0,0];
12537 }
12538 this.offset = 0;
12539 return this;
12540 },
12541
12542// consumes and returns one char from the input
12543input:function () {
12544 var ch = this._input[0];
12545 this.yytext += ch;
12546 this.yyleng++;
12547 this.offset++;
12548 this.match += ch;
12549 this.matched += ch;
12550 var lines = ch.match(/(?:\r\n?|\n).*/g);
12551 if (lines) {
12552 this.yylineno++;
12553 this.yylloc.last_line++;
12554 } else {
12555 this.yylloc.last_column++;
12556 }
12557 if (this.options.ranges) {
12558 this.yylloc.range[1]++;
12559 }
12560
12561 this._input = this._input.slice(1);
12562 return ch;
12563 },
12564
12565// unshifts one char (or a string) into the input
12566unput:function (ch) {
12567 var len = ch.length;
12568 var lines = ch.split(/(?:\r\n?|\n)/g);
12569
12570 this._input = ch + this._input;
12571 this.yytext = this.yytext.substr(0, this.yytext.length - len);
12572 //this.yyleng -= len;
12573 this.offset -= len;
12574 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
12575 this.match = this.match.substr(0, this.match.length - 1);
12576 this.matched = this.matched.substr(0, this.matched.length - 1);
12577
12578 if (lines.length - 1) {
12579 this.yylineno -= lines.length - 1;
12580 }
12581 var r = this.yylloc.range;
12582
12583 this.yylloc = {
12584 first_line: this.yylloc.first_line,
12585 last_line: this.yylineno + 1,
12586 first_column: this.yylloc.first_column,
12587 last_column: lines ?
12588 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
12589 + oldLines[oldLines.length - lines.length].length - lines[0].length :
12590 this.yylloc.first_column - len
12591 };
12592
12593 if (this.options.ranges) {
12594 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
12595 }
12596 this.yyleng = this.yytext.length;
12597 return this;
12598 },
12599
12600// When called from action, caches matched text and appends it on next action
12601more:function () {
12602 this._more = true;
12603 return this;
12604 },
12605
12606// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
12607reject:function () {
12608 if (this.options.backtrack_lexer) {
12609 this._backtrack = true;
12610 } else {
12611 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
12612 text: "",
12613 token: null,
12614 line: this.yylineno
12615 });
12616
12617 }
12618 return this;
12619 },
12620
12621// retain first n characters of the match
12622less:function (n) {
12623 this.unput(this.match.slice(n));
12624 },
12625
12626// displays already matched input, i.e. for error messages
12627pastInput:function () {
12628 var past = this.matched.substr(0, this.matched.length - this.match.length);
12629 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
12630 },
12631
12632// displays upcoming input, i.e. for error messages
12633upcomingInput:function () {
12634 var next = this.match;
12635 if (next.length < 20) {
12636 next += this._input.substr(0, 20-next.length);
12637 }
12638 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
12639 },
12640
12641// displays the character position where the lexing error occurred, i.e. for error messages
12642showPosition:function () {
12643 var pre = this.pastInput();
12644 var c = new Array(pre.length + 1).join("-");
12645 return pre + this.upcomingInput() + "\n" + c + "^";
12646 },
12647
12648// test the lexed token: return FALSE when not a match, otherwise return token
12649test_match:function(match, indexed_rule) {
12650 var token,
12651 lines,
12652 backup;
12653
12654 if (this.options.backtrack_lexer) {
12655 // save context
12656 backup = {
12657 yylineno: this.yylineno,
12658 yylloc: {
12659 first_line: this.yylloc.first_line,
12660 last_line: this.last_line,
12661 first_column: this.yylloc.first_column,
12662 last_column: this.yylloc.last_column
12663 },
12664 yytext: this.yytext,
12665 match: this.match,
12666 matches: this.matches,
12667 matched: this.matched,
12668 yyleng: this.yyleng,
12669 offset: this.offset,
12670 _more: this._more,
12671 _input: this._input,
12672 yy: this.yy,
12673 conditionStack: this.conditionStack.slice(0),
12674 done: this.done
12675 };
12676 if (this.options.ranges) {
12677 backup.yylloc.range = this.yylloc.range.slice(0);
12678 }
12679 }
12680
12681 lines = match[0].match(/(?:\r\n?|\n).*/g);
12682 if (lines) {
12683 this.yylineno += lines.length;
12684 }
12685 this.yylloc = {
12686 first_line: this.yylloc.last_line,
12687 last_line: this.yylineno + 1,
12688 first_column: this.yylloc.last_column,
12689 last_column: lines ?
12690 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
12691 this.yylloc.last_column + match[0].length
12692 };
12693 this.yytext += match[0];
12694 this.match += match[0];
12695 this.matches = match;
12696 this.yyleng = this.yytext.length;
12697 if (this.options.ranges) {
12698 this.yylloc.range = [this.offset, this.offset += this.yyleng];
12699 }
12700 this._more = false;
12701 this._backtrack = false;
12702 this._input = this._input.slice(match[0].length);
12703 this.matched += match[0];
12704 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
12705 if (this.done && this._input) {
12706 this.done = false;
12707 }
12708 if (token) {
12709 return token;
12710 } else if (this._backtrack) {
12711 // recover context
12712 for (var k in backup) {
12713 this[k] = backup[k];
12714 }
12715 return false; // rule action called reject() implying the next rule should be tested instead.
12716 }
12717 return false;
12718 },
12719
12720// return next match in input
12721next:function () {
12722 if (this.done) {
12723 return this.EOF;
12724 }
12725 if (!this._input) {
12726 this.done = true;
12727 }
12728
12729 var token,
12730 match,
12731 tempMatch,
12732 index;
12733 if (!this._more) {
12734 this.yytext = '';
12735 this.match = '';
12736 }
12737 var rules = this._currentRules();
12738 for (var i = 0; i < rules.length; i++) {
12739 tempMatch = this._input.match(this.rules[rules[i]]);
12740 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
12741 match = tempMatch;
12742 index = i;
12743 if (this.options.backtrack_lexer) {
12744 token = this.test_match(tempMatch, rules[i]);
12745 if (token !== false) {
12746 return token;
12747 } else if (this._backtrack) {
12748 match = false;
12749 continue; // rule action called reject() implying a rule MISmatch.
12750 } else {
12751 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
12752 return false;
12753 }
12754 } else if (!this.options.flex) {
12755 break;
12756 }
12757 }
12758 }
12759 if (match) {
12760 token = this.test_match(match, rules[index]);
12761 if (token !== false) {
12762 return token;
12763 }
12764 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
12765 return false;
12766 }
12767 if (this._input === "") {
12768 return this.EOF;
12769 } else {
12770 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
12771 text: "",
12772 token: null,
12773 line: this.yylineno
12774 });
12775 }
12776 },
12777
12778// return next match that has a token
12779lex:function lex () {
12780 var r = this.next();
12781 if (r) {
12782 return r;
12783 } else {
12784 return this.lex();
12785 }
12786 },
12787
12788// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
12789begin:function begin (condition) {
12790 this.conditionStack.push(condition);
12791 },
12792
12793// pop the previously active lexer condition state off the condition stack
12794popState:function popState () {
12795 var n = this.conditionStack.length - 1;
12796 if (n > 0) {
12797 return this.conditionStack.pop();
12798 } else {
12799 return this.conditionStack[0];
12800 }
12801 },
12802
12803// produce the lexer rule set which is active for the currently active lexer condition state
12804_currentRules:function _currentRules () {
12805 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
12806 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
12807 } else {
12808 return this.conditions["INITIAL"].rules;
12809 }
12810 },
12811
12812// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
12813topState:function topState (n) {
12814 n = this.conditionStack.length - 1 - Math.abs(n || 0);
12815 if (n >= 0) {
12816 return this.conditionStack[n];
12817 } else {
12818 return "INITIAL";
12819 }
12820 },
12821
12822// alias for begin(condition)
12823pushState:function pushState (condition) {
12824 this.begin(condition);
12825 },
12826
12827// return the number of states currently on the stack
12828stateStackSize:function stateStackSize() {
12829 return this.conditionStack.length;
12830 },
12831options: {"case-insensitive":true},
12832performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
12833var YYSTATE=YY_START;
12834switch($avoiding_name_collisions) {
12835case 0: this.begin('open_directive'); return 32;
12836break;
12837case 1: this.begin('type_directive'); return 33;
12838break;
12839case 2: this.popState(); this.begin('arg_directive'); return 25;
12840break;
12841case 3: this.popState(); this.popState(); return 35;
12842break;
12843case 4:return 34;
12844break;
12845case 5:/* skip comments */
12846break;
12847case 6:/* skip comments */
12848break;
12849case 7:/* do nothing */
12850break;
12851case 8:return 11;
12852break;
12853case 9:/* skip whitespace */
12854break;
12855case 10:/* skip comments */
12856break;
12857case 11:/* skip comments */
12858break;
12859case 12:this.begin("href");
12860break;
12861case 13:this.popState();
12862break;
12863case 14:return 30;
12864break;
12865case 15:this.begin("callbackname");
12866break;
12867case 16:this.popState();
12868break;
12869case 17:this.popState(); this.begin("callbackargs");
12870break;
12871case 18:return 28;
12872break;
12873case 19:this.popState();
12874break;
12875case 20:return 29;
12876break;
12877case 21:this.begin("click");
12878break;
12879case 22:this.popState();
12880break;
12881case 23:return 27;
12882break;
12883case 24:return 5;
12884break;
12885case 25:return 12;
12886break;
12887case 26:return 13;
12888break;
12889case 27:return 14;
12890break;
12891case 28:return 15;
12892break;
12893case 29:return 16;
12894break;
12895case 30:return 'date';
12896break;
12897case 31:return 17;
12898break;
12899case 32:return 18;
12900break;
12901case 33:return 20;
12902break;
12903case 34:return 21;
12904break;
12905case 35:return 25;
12906break;
12907case 36:return 7;
12908break;
12909case 37:return 'INVALID';
12910break;
12911}
12912},
12913rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)*[^\n]*)/i,/^(?:[^\}]%%*[^\n]*)/i,/^(?:%%*[^\n]*[\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:href[\s]+["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:call[\s]+)/i,/^(?:\([\s]*\))/i,/^(?:\()/i,/^(?:[^(]*)/i,/^(?:\))/i,/^(?:[^)]*)/i,/^(?:click[\s]+)/i,/^(?:[\s\n])/i,/^(?:[^\s\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:inclusiveEndDates\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],
12914conditions: {"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"callbackargs":{"rules":[19,20],"inclusive":false},"callbackname":{"rules":[16,17,18],"inclusive":false},"href":{"rules":[13,14],"inclusive":false},"click":{"rules":[22,23],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,15,21,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":true}}
12915});
12916return lexer;
12917})();
12918parser.lexer = lexer;
12919function Parser () {
12920 this.yy = {};
12921}
12922Parser.prototype = parser;parser.Parser = Parser;
12923return new Parser;
12924})();
12925
12926
12927if (true) {
12928exports.parser = parser;
12929exports.Parser = parser.Parser;
12930exports.parse = function () { return parser.parse.apply(parser, arguments); };
12931exports.main = function commonjsMain (args) {
12932 if (!args[1]) {
12933 console.log('Usage: '+args[0]+' FILE');
12934 process.exit(1);
12935 }
12936 var source = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
12937 return exports.parser.parse(source);
12938};
12939if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
12940 exports.main(process.argv.slice(1));
12941}
12942}
12943/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
12944
12945/***/ }),
12946
12947/***/ "./src/diagrams/gantt/styles.js":
12948/*!**************************************!*\
12949 !*** ./src/diagrams/gantt/styles.js ***!
12950 \**************************************/
12951/*! exports provided: default */
12952/***/ (function(module, __webpack_exports__, __webpack_require__) {
12953
12954"use strict";
12955__webpack_require__.r(__webpack_exports__);
12956var getStyles = function getStyles(options) {
12957 return "\n .mermaid-main-font {\n font-family: \"trebuchet ms\", verdana, arial;\n font-family: var(--mermaid-font-family);\n }\n\n .section {\n stroke: none;\n opacity: 0.2;\n }\n\n .section0 {\n fill: ".concat(options.sectionBkgColor, ";\n }\n\n .section2 {\n fill: ").concat(options.sectionBkgColor2, ";\n }\n\n .section1,\n .section3 {\n fill: ").concat(options.altSectionBkgColor, ";\n opacity: 0.2;\n }\n\n .sectionTitle0 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle1 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle2 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle3 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle {\n text-anchor: start;\n font-size: 11px;\n text-height: 14px;\n font-family: 'trebuchet ms', verdana, arial;\n font-family: var(--mermaid-font-family);\n\n }\n\n\n /* Grid and axis */\n\n .grid .tick {\n stroke: ").concat(options.gridColor, ";\n opacity: 0.8;\n shape-rendering: crispEdges;\n text {\n font-family: ").concat(options.fontFamily, ";\n fill: ").concat(options.textColor, ";\n }\n }\n\n .grid path {\n stroke-width: 0;\n }\n\n\n /* Today line */\n\n .today {\n fill: none;\n stroke: ").concat(options.todayLineColor, ";\n stroke-width: 2px;\n }\n\n\n /* Task styling */\n\n /* Default task */\n\n .task {\n stroke-width: 2;\n }\n\n .taskText {\n text-anchor: middle;\n font-family: 'trebuchet ms', verdana, arial;\n font-family: var(--mermaid-font-family);\n }\n\n .taskText:not([font-size]) {\n font-size: 11px;\n }\n\n .taskTextOutsideRight {\n fill: ").concat(options.taskTextDarkColor, ";\n text-anchor: start;\n font-size: 11px;\n font-family: 'trebuchet ms', verdana, arial;\n font-family: var(--mermaid-font-family);\n\n }\n\n .taskTextOutsideLeft {\n fill: ").concat(options.taskTextDarkColor, ";\n text-anchor: end;\n font-size: 11px;\n }\n\n /* Special case clickable */\n .task.clickable {\n cursor: pointer;\n }\n .taskText.clickable {\n cursor: pointer;\n fill: ").concat(options.taskTextClickableColor, " !important;\n font-weight: bold;\n }\n\n .taskTextOutsideLeft.clickable {\n cursor: pointer;\n fill: ").concat(options.taskTextClickableColor, " !important;\n font-weight: bold;\n }\n\n .taskTextOutsideRight.clickable {\n cursor: pointer;\n fill: ").concat(options.taskTextClickableColor, " !important;\n font-weight: bold;\n }\n\n /* Specific task settings for the sections*/\n\n .taskText0,\n .taskText1,\n .taskText2,\n .taskText3 {\n fill: ").concat(options.taskTextColor, ";\n }\n\n .task0,\n .task1,\n .task2,\n .task3 {\n fill: ").concat(options.taskBkgColor, ";\n stroke: ").concat(options.taskBorderColor, ";\n }\n\n .taskTextOutside0,\n .taskTextOutside2\n {\n fill: ").concat(options.taskTextOutsideColor, ";\n }\n\n .taskTextOutside1,\n .taskTextOutside3 {\n fill: ").concat(options.taskTextOutsideColor, ";\n }\n\n\n /* Active task */\n\n .active0,\n .active1,\n .active2,\n .active3 {\n fill: ").concat(options.activeTaskBkgColor, ";\n stroke: ").concat(options.activeTaskBorderColor, ";\n }\n\n .activeText0,\n .activeText1,\n .activeText2,\n .activeText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n\n /* Completed task */\n\n .done0,\n .done1,\n .done2,\n .done3 {\n stroke: ").concat(options.doneTaskBorderColor, ";\n fill: ").concat(options.doneTaskBkgColor, ";\n stroke-width: 2;\n }\n\n .doneText0,\n .doneText1,\n .doneText2,\n .doneText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n\n /* Tasks on the critical line */\n\n .crit0,\n .crit1,\n .crit2,\n .crit3 {\n stroke: ").concat(options.critBorderColor, ";\n fill: ").concat(options.critBkgColor, ";\n stroke-width: 2;\n }\n\n .activeCrit0,\n .activeCrit1,\n .activeCrit2,\n .activeCrit3 {\n stroke: ").concat(options.critBorderColor, ";\n fill: ").concat(options.activeTaskBkgColor, ";\n stroke-width: 2;\n }\n\n .doneCrit0,\n .doneCrit1,\n .doneCrit2,\n .doneCrit3 {\n stroke: ").concat(options.critBorderColor, ";\n fill: ").concat(options.doneTaskBkgColor, ";\n stroke-width: 2;\n cursor: pointer;\n shape-rendering: crispEdges;\n }\n\n .milestone {\n transform: rotate(45deg) scale(0.8,0.8);\n }\n\n .milestoneText {\n font-style: italic;\n }\n .doneCritText0,\n .doneCritText1,\n .doneCritText2,\n .doneCritText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n .activeCritText0,\n .activeCritText1,\n .activeCritText2,\n .activeCritText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n .titleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ").concat(options.textColor, " ;\n font-family: 'trebuchet ms', verdana, arial;\n font-family: var(--mermaid-font-family);\n }\n");
12958};
12959
12960/* harmony default export */ __webpack_exports__["default"] = (getStyles);
12961
12962/***/ }),
12963
12964/***/ "./src/diagrams/git/gitGraphAst.js":
12965/*!*****************************************!*\
12966 !*** ./src/diagrams/git/gitGraphAst.js ***!
12967 \*****************************************/
12968/*! exports provided: setDirection, setOptions, getOptions, commit, branch, merge, checkout, reset, prettyPrint, clear, getBranchesAsObjArray, getBranches, getCommits, getCommitsArray, getCurrentBranch, getDirection, getHead, default */
12969/***/ (function(module, __webpack_exports__, __webpack_require__) {
12970
12971"use strict";
12972__webpack_require__.r(__webpack_exports__);
12973/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setDirection", function() { return setDirection; });
12974/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setOptions", function() { return setOptions; });
12975/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getOptions", function() { return getOptions; });
12976/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "commit", function() { return commit; });
12977/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "branch", function() { return branch; });
12978/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return merge; });
12979/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkout", function() { return checkout; });
12980/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reset", function() { return reset; });
12981/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prettyPrint", function() { return prettyPrint; });
12982/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
12983/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBranchesAsObjArray", function() { return getBranchesAsObjArray; });
12984/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBranches", function() { return getBranches; });
12985/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCommits", function() { return getCommits; });
12986/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCommitsArray", function() { return getCommitsArray; });
12987/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCurrentBranch", function() { return getCurrentBranch; });
12988/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDirection", function() { return getDirection; });
12989/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHead", function() { return getHead; });
12990/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
12991/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
12992
12993
12994var commits = {};
12995var head = null;
12996var branches = {
12997 master: head
12998};
12999var curBranch = 'master';
13000var direction = 'LR';
13001var seq = 0;
13002
13003function getId() {
13004 return Object(_utils__WEBPACK_IMPORTED_MODULE_1__["random"])({
13005 length: 7
13006 });
13007}
13008
13009function isfastforwardable(currentCommit, otherCommit) {
13010 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Entering isfastforwardable:', currentCommit.id, otherCommit.id);
13011
13012 while (currentCommit.seq <= otherCommit.seq && currentCommit !== otherCommit) {
13013 // only if other branch has more commits
13014 if (otherCommit.parent == null) break;
13015
13016 if (Array.isArray(otherCommit.parent)) {
13017 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('In merge commit:', otherCommit.parent);
13018 return isfastforwardable(currentCommit, commits[otherCommit.parent[0]]) || isfastforwardable(currentCommit, commits[otherCommit.parent[1]]);
13019 } else {
13020 otherCommit = commits[otherCommit.parent];
13021 }
13022 }
13023
13024 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(currentCommit.id, otherCommit.id);
13025 return currentCommit.id === otherCommit.id;
13026}
13027
13028function isReachableFrom(currentCommit, otherCommit) {
13029 var currentSeq = currentCommit.seq;
13030 var otherSeq = otherCommit.seq;
13031 if (currentSeq > otherSeq) return isfastforwardable(otherCommit, currentCommit);
13032 return false;
13033}
13034
13035function uniqBy(list, fn) {
13036 var recordMap = Object.create(null);
13037 return list.reduce(function (out, item) {
13038 var key = fn(item);
13039
13040 if (!recordMap[key]) {
13041 recordMap[key] = true;
13042 out.push(item);
13043 }
13044
13045 return out;
13046 }, []);
13047}
13048
13049var setDirection = function setDirection(dir) {
13050 direction = dir;
13051};
13052var options = {};
13053var setOptions = function setOptions(rawOptString) {
13054 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('options str', rawOptString);
13055 rawOptString = rawOptString && rawOptString.trim();
13056 rawOptString = rawOptString || '{}';
13057
13058 try {
13059 options = JSON.parse(rawOptString);
13060 } catch (e) {
13061 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].error('error while parsing gitGraph options', e.message);
13062 }
13063};
13064var getOptions = function getOptions() {
13065 return options;
13066};
13067var commit = function commit(msg) {
13068 var commit = {
13069 id: getId(),
13070 message: msg,
13071 seq: seq++,
13072 parent: head == null ? null : head.id
13073 };
13074 head = commit;
13075 commits[commit.id] = commit;
13076 branches[curBranch] = commit.id;
13077 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('in pushCommit ' + commit.id);
13078};
13079var branch = function branch(name) {
13080 branches[name] = head != null ? head.id : null;
13081 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('in createBranch');
13082};
13083var merge = function merge(otherBranch) {
13084 var currentCommit = commits[branches[curBranch]];
13085 var otherCommit = commits[branches[otherBranch]];
13086
13087 if (isReachableFrom(currentCommit, otherCommit)) {
13088 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Already merged');
13089 return;
13090 }
13091
13092 if (isfastforwardable(currentCommit, otherCommit)) {
13093 branches[curBranch] = branches[otherBranch];
13094 head = commits[branches[curBranch]];
13095 } else {
13096 // create merge commit
13097 var _commit = {
13098 id: getId(),
13099 message: 'merged branch ' + otherBranch + ' into ' + curBranch,
13100 seq: seq++,
13101 parent: [head == null ? null : head.id, branches[otherBranch]]
13102 };
13103 head = _commit;
13104 commits[_commit.id] = _commit;
13105 branches[curBranch] = _commit.id;
13106 }
13107
13108 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(branches);
13109 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('in mergeBranch');
13110};
13111var checkout = function checkout(branch) {
13112 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('in checkout');
13113 curBranch = branch;
13114 var id = branches[curBranch];
13115 head = commits[id];
13116};
13117var reset = function reset(commitRef) {
13118 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('in reset', commitRef);
13119 var ref = commitRef.split(':')[0];
13120 var parentCount = parseInt(commitRef.split(':')[1]);
13121 var commit = ref === 'HEAD' ? head : commits[branches[ref]];
13122 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(commit, parentCount);
13123
13124 while (parentCount > 0) {
13125 commit = commits[commit.parent];
13126 parentCount--;
13127
13128 if (!commit) {
13129 var err = 'Critical error - unique parent commit not found during reset';
13130 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].error(err);
13131 throw err;
13132 }
13133 }
13134
13135 head = commit;
13136 branches[curBranch] = commit.id;
13137};
13138
13139function upsert(arr, key, newval) {
13140 var index = arr.indexOf(key);
13141
13142 if (index === -1) {
13143 arr.push(newval);
13144 } else {
13145 arr.splice(index, 1, newval);
13146 }
13147}
13148
13149function prettyPrintCommitHistory(commitArr) {
13150 var commit = commitArr.reduce(function (out, commit) {
13151 if (out.seq > commit.seq) return out;
13152 return commit;
13153 }, commitArr[0]);
13154 var line = '';
13155 commitArr.forEach(function (c) {
13156 if (c === commit) {
13157 line += '\t*';
13158 } else {
13159 line += '\t|';
13160 }
13161 });
13162 var label = [line, commit.id, commit.seq];
13163
13164 for (var _branch in branches) {
13165 if (branches[_branch] === commit.id) label.push(_branch);
13166 }
13167
13168 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(label.join(' '));
13169
13170 if (Array.isArray(commit.parent)) {
13171 var newCommit = commits[commit.parent[0]];
13172 upsert(commitArr, commit, newCommit);
13173 commitArr.push(commits[commit.parent[1]]);
13174 } else if (commit.parent == null) {
13175 return;
13176 } else {
13177 var nextCommit = commits[commit.parent];
13178 upsert(commitArr, commit, nextCommit);
13179 }
13180
13181 commitArr = uniqBy(commitArr, function (c) {
13182 return c.id;
13183 });
13184 prettyPrintCommitHistory(commitArr);
13185}
13186
13187var prettyPrint = function prettyPrint() {
13188 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(commits);
13189 var node = getCommitsArray()[0];
13190 prettyPrintCommitHistory([node]);
13191};
13192var clear = function clear() {
13193 commits = {};
13194 head = null;
13195 branches = {
13196 master: head
13197 };
13198 curBranch = 'master';
13199 seq = 0;
13200};
13201var getBranchesAsObjArray = function getBranchesAsObjArray() {
13202 var branchArr = [];
13203
13204 for (var _branch2 in branches) {
13205 branchArr.push({
13206 name: _branch2,
13207 commit: commits[branches[_branch2]]
13208 });
13209 }
13210
13211 return branchArr;
13212};
13213var getBranches = function getBranches() {
13214 return branches;
13215};
13216var getCommits = function getCommits() {
13217 return commits;
13218};
13219var getCommitsArray = function getCommitsArray() {
13220 var commitArr = Object.keys(commits).map(function (key) {
13221 return commits[key];
13222 });
13223 commitArr.forEach(function (o) {
13224 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(o.id);
13225 });
13226 commitArr.sort(function (a, b) {
13227 return b.seq - a.seq;
13228 });
13229 return commitArr;
13230};
13231var getCurrentBranch = function getCurrentBranch() {
13232 return curBranch;
13233};
13234var getDirection = function getDirection() {
13235 return direction;
13236};
13237var getHead = function getHead() {
13238 return head;
13239};
13240/* harmony default export */ __webpack_exports__["default"] = ({
13241 setDirection: setDirection,
13242 setOptions: setOptions,
13243 getOptions: getOptions,
13244 commit: commit,
13245 branch: branch,
13246 merge: merge,
13247 checkout: checkout,
13248 reset: reset,
13249 prettyPrint: prettyPrint,
13250 clear: clear,
13251 getBranchesAsObjArray: getBranchesAsObjArray,
13252 getBranches: getBranches,
13253 getCommits: getCommits,
13254 getCommitsArray: getCommitsArray,
13255 getCurrentBranch: getCurrentBranch,
13256 getDirection: getDirection,
13257 getHead: getHead
13258});
13259
13260/***/ }),
13261
13262/***/ "./src/diagrams/git/gitGraphRenderer.js":
13263/*!**********************************************!*\
13264 !*** ./src/diagrams/git/gitGraphRenderer.js ***!
13265 \**********************************************/
13266/*! exports provided: setConf, draw, default */
13267/***/ (function(module, __webpack_exports__, __webpack_require__) {
13268
13269"use strict";
13270__webpack_require__.r(__webpack_exports__);
13271/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
13272/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
13273/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
13274/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
13275/* harmony import */ var _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./gitGraphAst */ "./src/diagrams/git/gitGraphAst.js");
13276/* harmony import */ var _parser_gitGraph__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./parser/gitGraph */ "./src/diagrams/git/parser/gitGraph.jison");
13277/* harmony import */ var _parser_gitGraph__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_parser_gitGraph__WEBPACK_IMPORTED_MODULE_2__);
13278/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
13279/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
13280
13281
13282
13283
13284
13285var allCommitsDict = {};
13286var branchNum;
13287var config = {
13288 nodeSpacing: 150,
13289 nodeFillColor: 'yellow',
13290 nodeStrokeWidth: 2,
13291 nodeStrokeColor: 'grey',
13292 lineStrokeWidth: 4,
13293 branchOffset: 50,
13294 lineColor: 'grey',
13295 leftMargin: 50,
13296 branchColors: ['#442f74', '#983351', '#609732', '#AA9A39'],
13297 nodeRadius: 10,
13298 nodeLabel: {
13299 width: 75,
13300 height: 100,
13301 x: -25,
13302 y: 0
13303 }
13304};
13305var apiConfig = {};
13306var setConf = function setConf(c) {
13307 apiConfig = c;
13308};
13309
13310function svgCreateDefs(svg) {
13311 svg.append('defs').append('g').attr('id', 'def-commit').append('circle').attr('r', config.nodeRadius).attr('cx', 0).attr('cy', 0);
13312 svg.select('#def-commit').append('foreignObject').attr('width', config.nodeLabel.width).attr('height', config.nodeLabel.height).attr('x', config.nodeLabel.x).attr('y', config.nodeLabel.y).attr('class', 'node-label').attr('requiredFeatures', 'http://www.w3.org/TR/SVG11/feature#Extensibility').append('p').html('');
13313}
13314
13315function svgDrawLine(svg, points, colorIdx, interpolate) {
13316 var curve = Object(_utils__WEBPACK_IMPORTED_MODULE_4__["interpolateToCurve"])(interpolate, d3__WEBPACK_IMPORTED_MODULE_0__["curveBasis"]);
13317 var color = config.branchColors[colorIdx % config.branchColors.length];
13318 var lineGen = Object(d3__WEBPACK_IMPORTED_MODULE_0__["line"])().x(function (d) {
13319 return Math.round(d.x);
13320 }).y(function (d) {
13321 return Math.round(d.y);
13322 }).curve(curve);
13323 svg.append('svg:path').attr('d', lineGen(points)).style('stroke', color).style('stroke-width', config.lineStrokeWidth).style('fill', 'none');
13324} // Pass in the element and its pre-transform coords
13325
13326
13327function getElementCoords(element, coords) {
13328 coords = coords || element.node().getBBox();
13329 var ctm = element.node().getCTM();
13330 var xn = ctm.e + coords.x * ctm.a;
13331 var yn = ctm.f + coords.y * ctm.d;
13332 return {
13333 left: xn,
13334 top: yn,
13335 width: coords.width,
13336 height: coords.height
13337 };
13338}
13339
13340function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
13341 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('svgDrawLineForCommits: ', fromId, toId);
13342 var fromBbox = getElementCoords(svg.select('#node-' + fromId + ' circle'));
13343 var toBbox = getElementCoords(svg.select('#node-' + toId + ' circle'));
13344
13345 switch (direction) {
13346 case 'LR':
13347 // (toBbox)
13348 // +--------
13349 // + (fromBbox)
13350 if (fromBbox.left - toBbox.left > config.nodeSpacing) {
13351 var lineStart = {
13352 x: fromBbox.left - config.nodeSpacing,
13353 y: toBbox.top + toBbox.height / 2
13354 };
13355 var lineEnd = {
13356 x: toBbox.left + toBbox.width,
13357 y: toBbox.top + toBbox.height / 2
13358 };
13359 svgDrawLine(svg, [lineStart, lineEnd], color, 'linear');
13360 svgDrawLine(svg, [{
13361 x: fromBbox.left,
13362 y: fromBbox.top + fromBbox.height / 2
13363 }, {
13364 x: fromBbox.left - config.nodeSpacing / 2,
13365 y: fromBbox.top + fromBbox.height / 2
13366 }, {
13367 x: fromBbox.left - config.nodeSpacing / 2,
13368 y: lineStart.y
13369 }, lineStart], color);
13370 } else {
13371 svgDrawLine(svg, [{
13372 x: fromBbox.left,
13373 y: fromBbox.top + fromBbox.height / 2
13374 }, {
13375 x: fromBbox.left - config.nodeSpacing / 2,
13376 y: fromBbox.top + fromBbox.height / 2
13377 }, {
13378 x: fromBbox.left - config.nodeSpacing / 2,
13379 y: toBbox.top + toBbox.height / 2
13380 }, {
13381 x: toBbox.left + toBbox.width,
13382 y: toBbox.top + toBbox.height / 2
13383 }], color);
13384 }
13385
13386 break;
13387
13388 case 'BT':
13389 // + (fromBbox)
13390 // |
13391 // |
13392 // + (toBbox)
13393 if (toBbox.top - fromBbox.top > config.nodeSpacing) {
13394 var _lineStart = {
13395 x: toBbox.left + toBbox.width / 2,
13396 y: fromBbox.top + fromBbox.height + config.nodeSpacing
13397 };
13398 var _lineEnd = {
13399 x: toBbox.left + toBbox.width / 2,
13400 y: toBbox.top
13401 };
13402 svgDrawLine(svg, [_lineStart, _lineEnd], color, 'linear');
13403 svgDrawLine(svg, [{
13404 x: fromBbox.left + fromBbox.width / 2,
13405 y: fromBbox.top + fromBbox.height
13406 }, {
13407 x: fromBbox.left + fromBbox.width / 2,
13408 y: fromBbox.top + fromBbox.height + config.nodeSpacing / 2
13409 }, {
13410 x: toBbox.left + toBbox.width / 2,
13411 y: _lineStart.y - config.nodeSpacing / 2
13412 }, _lineStart], color);
13413 } else {
13414 svgDrawLine(svg, [{
13415 x: fromBbox.left + fromBbox.width / 2,
13416 y: fromBbox.top + fromBbox.height
13417 }, {
13418 x: fromBbox.left + fromBbox.width / 2,
13419 y: fromBbox.top + config.nodeSpacing / 2
13420 }, {
13421 x: toBbox.left + toBbox.width / 2,
13422 y: toBbox.top - config.nodeSpacing / 2
13423 }, {
13424 x: toBbox.left + toBbox.width / 2,
13425 y: toBbox.top
13426 }], color);
13427 }
13428
13429 break;
13430 }
13431}
13432
13433function cloneNode(svg, selector) {
13434 return svg.select(selector).node().cloneNode(true);
13435}
13436
13437function renderCommitHistory(svg, commitid, branches, direction) {
13438 var commit;
13439 var numCommits = Object.keys(allCommitsDict).length;
13440
13441 if (typeof commitid === 'string') {
13442 do {
13443 commit = allCommitsDict[commitid];
13444 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('in renderCommitHistory', commit.id, commit.seq);
13445
13446 if (svg.select('#node-' + commitid).size() > 0) {
13447 return;
13448 }
13449
13450 svg.append(function () {
13451 return cloneNode(svg, '#def-commit');
13452 }).attr('class', 'commit').attr('id', function () {
13453 return 'node-' + commit.id;
13454 }).attr('transform', function () {
13455 switch (direction) {
13456 case 'LR':
13457 return 'translate(' + (commit.seq * config.nodeSpacing + config.leftMargin) + ', ' + branchNum * config.branchOffset + ')';
13458
13459 case 'BT':
13460 return 'translate(' + (branchNum * config.branchOffset + config.leftMargin) + ', ' + (numCommits - commit.seq) * config.nodeSpacing + ')';
13461 }
13462 }).attr('fill', config.nodeFillColor).attr('stroke', config.nodeStrokeColor).attr('stroke-width', config.nodeStrokeWidth);
13463 var branch = void 0;
13464
13465 for (var branchName in branches) {
13466 if (branches[branchName].commit === commit) {
13467 branch = branches[branchName];
13468 break;
13469 }
13470 }
13471
13472 if (branch) {
13473 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('found branch ', branch.name);
13474 svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'branch-label').text(branch.name + ', ');
13475 }
13476
13477 svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'commit-id').text(commit.id);
13478
13479 if (commit.message !== '' && direction === 'BT') {
13480 svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'commit-msg').text(', ' + commit.message);
13481 }
13482
13483 commitid = commit.parent;
13484 } while (commitid && allCommitsDict[commitid]);
13485 }
13486
13487 if (Array.isArray(commitid)) {
13488 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('found merge commmit', commitid);
13489 renderCommitHistory(svg, commitid[0], branches, direction);
13490 branchNum++;
13491 renderCommitHistory(svg, commitid[1], branches, direction);
13492 branchNum--;
13493 }
13494}
13495
13496function renderLines(svg, commit, direction, branchColor) {
13497 branchColor = branchColor || 0;
13498
13499 while (commit.seq > 0 && !commit.lineDrawn) {
13500 if (typeof commit.parent === 'string') {
13501 svgDrawLineForCommits(svg, commit.id, commit.parent, direction, branchColor);
13502 commit.lineDrawn = true;
13503 commit = allCommitsDict[commit.parent];
13504 } else if (Array.isArray(commit.parent)) {
13505 svgDrawLineForCommits(svg, commit.id, commit.parent[0], direction, branchColor);
13506 svgDrawLineForCommits(svg, commit.id, commit.parent[1], direction, branchColor + 1);
13507 renderLines(svg, allCommitsDict[commit.parent[1]], direction, branchColor + 1);
13508 commit.lineDrawn = true;
13509 commit = allCommitsDict[commit.parent[0]];
13510 }
13511 }
13512}
13513
13514var draw = function draw(txt, id, ver) {
13515 try {
13516 var parser = _parser_gitGraph__WEBPACK_IMPORTED_MODULE_2___default.a.parser;
13517 parser.yy = _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__["default"];
13518 parser.yy.clear();
13519 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('in gitgraph renderer', txt + '\n', 'id:', id, ver); // Parse the graph definition
13520
13521 parser.parse(txt + '\n');
13522 config = Object.assign(config, apiConfig, _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__["default"].getOptions());
13523 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('effective options', config);
13524 var direction = _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__["default"].getDirection();
13525 allCommitsDict = _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__["default"].getCommits();
13526 var branches = _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__["default"].getBranchesAsObjArray();
13527
13528 if (direction === 'BT') {
13529 config.nodeLabel.x = branches.length * config.branchOffset;
13530 config.nodeLabel.width = '100%';
13531 config.nodeLabel.y = -1 * 2 * config.nodeRadius;
13532 }
13533
13534 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id=\"".concat(id, "\"]"));
13535 svgCreateDefs(svg);
13536 branchNum = 1;
13537
13538 for (var branch in branches) {
13539 var v = branches[branch];
13540 renderCommitHistory(svg, v.commit.id, branches, direction);
13541 renderLines(svg, v.commit, direction);
13542 branchNum++;
13543 }
13544
13545 svg.attr('height', function () {
13546 if (direction === 'BT') return Object.keys(allCommitsDict).length * config.nodeSpacing;
13547 return (branches.length + 1) * config.branchOffset;
13548 });
13549 } catch (e) {
13550 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error('Error while rendering gitgraph');
13551 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error(e.message);
13552 }
13553};
13554/* harmony default export */ __webpack_exports__["default"] = ({
13555 setConf: setConf,
13556 draw: draw
13557});
13558
13559/***/ }),
13560
13561/***/ "./src/diagrams/git/parser/gitGraph.jison":
13562/*!************************************************!*\
13563 !*** ./src/diagrams/git/parser/gitGraph.jison ***!
13564 \************************************************/
13565/*! no static exports found */
13566/***/ (function(module, exports, __webpack_require__) {
13567
13568/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
13569/*
13570 Returns a Parser object of the following structure:
13571
13572 Parser: {
13573 yy: {}
13574 }
13575
13576 Parser.prototype: {
13577 yy: {},
13578 trace: function(),
13579 symbols_: {associative list: name ==> number},
13580 terminals_: {associative list: number ==> name},
13581 productions_: [...],
13582 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
13583 table: [...],
13584 defaultActions: {...},
13585 parseError: function(str, hash),
13586 parse: function(input),
13587
13588 lexer: {
13589 EOF: 1,
13590 parseError: function(str, hash),
13591 setInput: function(input),
13592 input: function(),
13593 unput: function(str),
13594 more: function(),
13595 less: function(n),
13596 pastInput: function(),
13597 upcomingInput: function(),
13598 showPosition: function(),
13599 test_match: function(regex_match_array, rule_index),
13600 next: function(),
13601 lex: function(),
13602 begin: function(condition),
13603 popState: function(),
13604 _currentRules: function(),
13605 topState: function(),
13606 pushState: function(condition),
13607
13608 options: {
13609 ranges: boolean (optional: true ==> token location info will include a .range[] member)
13610 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
13611 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
13612 },
13613
13614 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
13615 rules: [...],
13616 conditions: {associative list: name ==> set},
13617 }
13618 }
13619
13620
13621 token location info (@$, _$, etc.): {
13622 first_line: n,
13623 last_line: n,
13624 first_column: n,
13625 last_column: n,
13626 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
13627 }
13628
13629
13630 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
13631 text: (matched text)
13632 token: (the produced terminal token, if any)
13633 line: (yylineno)
13634 }
13635 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
13636 loc: (yylloc)
13637 expected: (string describing the set of expected tokens)
13638 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
13639 }
13640*/
13641var parser = (function(){
13642var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[2,3],$V1=[1,7],$V2=[7,12,15,17,19,20,21],$V3=[7,11,12,15,17,19,20,21],$V4=[2,20],$V5=[1,32];
13643var parser = {trace: function trace () { },
13644yy: {},
13645symbols_: {"error":2,"start":3,"GG":4,":":5,"document":6,"EOF":7,"DIR":8,"options":9,"body":10,"OPT":11,"NL":12,"line":13,"statement":14,"COMMIT":15,"commit_arg":16,"BRANCH":17,"ID":18,"CHECKOUT":19,"MERGE":20,"RESET":21,"reset_arg":22,"STR":23,"HEAD":24,"reset_parents":25,"CARET":26,"$accept":0,"$end":1},
13646terminals_: {2:"error",4:"GG",5:":",7:"EOF",8:"DIR",11:"OPT",12:"NL",15:"COMMIT",17:"BRANCH",18:"ID",19:"CHECKOUT",20:"MERGE",21:"RESET",23:"STR",24:"HEAD",26:"CARET"},
13647productions_: [0,[3,4],[3,5],[6,0],[6,2],[9,2],[9,1],[10,0],[10,2],[13,2],[13,1],[14,2],[14,2],[14,2],[14,2],[14,2],[16,0],[16,1],[22,2],[22,2],[25,0],[25,2]],
13648performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
13649/* this == yyval */
13650
13651var $0 = $$.length - 1;
13652switch (yystate) {
13653case 1:
13654 return $$[$0-1];
13655break;
13656case 2:
13657yy.setDirection($$[$0-3]); return $$[$0-1];
13658break;
13659case 4:
13660 yy.setOptions($$[$0-1]); this.$ = $$[$0]
13661break;
13662case 5:
13663$$[$0-1] +=$$[$0]; this.$=$$[$0-1]
13664break;
13665case 7:
13666this.$ = []
13667break;
13668case 8:
13669$$[$0-1].push($$[$0]); this.$=$$[$0-1];
13670break;
13671case 9:
13672this.$ =$$[$0-1]
13673break;
13674case 11:
13675yy.commit($$[$0])
13676break;
13677case 12:
13678yy.branch($$[$0])
13679break;
13680case 13:
13681yy.checkout($$[$0])
13682break;
13683case 14:
13684yy.merge($$[$0])
13685break;
13686case 15:
13687yy.reset($$[$0])
13688break;
13689case 16:
13690this.$ = ""
13691break;
13692case 17:
13693this.$=$$[$0]
13694break;
13695case 18:
13696this.$ = $$[$0-1]+ ":" + $$[$0]
13697break;
13698case 19:
13699this.$ = $$[$0-1]+ ":" + yy.count; yy.count = 0
13700break;
13701case 20:
13702yy.count = 0
13703break;
13704case 21:
13705 yy.count += 1
13706break;
13707}
13708},
13709table: [{3:1,4:[1,2]},{1:[3]},{5:[1,3],8:[1,4]},{6:5,7:$V0,9:6,12:$V1},{5:[1,8]},{7:[1,9]},o($V2,[2,7],{10:10,11:[1,11]}),o($V3,[2,6]),{6:12,7:$V0,9:6,12:$V1},{1:[2,1]},{7:[2,4],12:[1,15],13:13,14:14,15:[1,16],17:[1,17],19:[1,18],20:[1,19],21:[1,20]},o($V3,[2,5]),{7:[1,21]},o($V2,[2,8]),{12:[1,22]},o($V2,[2,10]),{12:[2,16],16:23,23:[1,24]},{18:[1,25]},{18:[1,26]},{18:[1,27]},{18:[1,30],22:28,24:[1,29]},{1:[2,2]},o($V2,[2,9]),{12:[2,11]},{12:[2,17]},{12:[2,12]},{12:[2,13]},{12:[2,14]},{12:[2,15]},{12:$V4,25:31,26:$V5},{12:$V4,25:33,26:$V5},{12:[2,18]},{12:$V4,25:34,26:$V5},{12:[2,19]},{12:[2,21]}],
13710defaultActions: {9:[2,1],21:[2,2],23:[2,11],24:[2,17],25:[2,12],26:[2,13],27:[2,14],28:[2,15],31:[2,18],33:[2,19],34:[2,21]},
13711parseError: function parseError (str, hash) {
13712 if (hash.recoverable) {
13713 this.trace(str);
13714 } else {
13715 var error = new Error(str);
13716 error.hash = hash;
13717 throw error;
13718 }
13719},
13720parse: function parse(input) {
13721 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
13722 var args = lstack.slice.call(arguments, 1);
13723 var lexer = Object.create(this.lexer);
13724 var sharedState = { yy: {} };
13725 for (var k in this.yy) {
13726 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
13727 sharedState.yy[k] = this.yy[k];
13728 }
13729 }
13730 lexer.setInput(input, sharedState.yy);
13731 sharedState.yy.lexer = lexer;
13732 sharedState.yy.parser = this;
13733 if (typeof lexer.yylloc == 'undefined') {
13734 lexer.yylloc = {};
13735 }
13736 var yyloc = lexer.yylloc;
13737 lstack.push(yyloc);
13738 var ranges = lexer.options && lexer.options.ranges;
13739 if (typeof sharedState.yy.parseError === 'function') {
13740 this.parseError = sharedState.yy.parseError;
13741 } else {
13742 this.parseError = Object.getPrototypeOf(this).parseError;
13743 }
13744 function popStack(n) {
13745 stack.length = stack.length - 2 * n;
13746 vstack.length = vstack.length - n;
13747 lstack.length = lstack.length - n;
13748 }
13749 function lex() {
13750 var token;
13751 token = tstack.pop() || lexer.lex() || EOF;
13752 if (typeof token !== 'number') {
13753 if (token instanceof Array) {
13754 tstack = token;
13755 token = tstack.pop();
13756 }
13757 token = self.symbols_[token] || token;
13758 }
13759 return token;
13760 }
13761 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
13762 while (true) {
13763 state = stack[stack.length - 1];
13764 if (this.defaultActions[state]) {
13765 action = this.defaultActions[state];
13766 } else {
13767 if (symbol === null || typeof symbol == 'undefined') {
13768 symbol = lex();
13769 }
13770 action = table[state] && table[state][symbol];
13771 }
13772 if (typeof action === 'undefined' || !action.length || !action[0]) {
13773 var errStr = '';
13774 expected = [];
13775 for (p in table[state]) {
13776 if (this.terminals_[p] && p > TERROR) {
13777 expected.push('\'' + this.terminals_[p] + '\'');
13778 }
13779 }
13780 if (lexer.showPosition) {
13781 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
13782 } else {
13783 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
13784 }
13785 this.parseError(errStr, {
13786 text: lexer.match,
13787 token: this.terminals_[symbol] || symbol,
13788 line: lexer.yylineno,
13789 loc: yyloc,
13790 expected: expected
13791 });
13792 }
13793 if (action[0] instanceof Array && action.length > 1) {
13794 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
13795 }
13796 switch (action[0]) {
13797 case 1:
13798 stack.push(symbol);
13799 vstack.push(lexer.yytext);
13800 lstack.push(lexer.yylloc);
13801 stack.push(action[1]);
13802 symbol = null;
13803 if (!preErrorSymbol) {
13804 yyleng = lexer.yyleng;
13805 yytext = lexer.yytext;
13806 yylineno = lexer.yylineno;
13807 yyloc = lexer.yylloc;
13808 if (recovering > 0) {
13809 recovering--;
13810 }
13811 } else {
13812 symbol = preErrorSymbol;
13813 preErrorSymbol = null;
13814 }
13815 break;
13816 case 2:
13817 len = this.productions_[action[1]][1];
13818 yyval.$ = vstack[vstack.length - len];
13819 yyval._$ = {
13820 first_line: lstack[lstack.length - (len || 1)].first_line,
13821 last_line: lstack[lstack.length - 1].last_line,
13822 first_column: lstack[lstack.length - (len || 1)].first_column,
13823 last_column: lstack[lstack.length - 1].last_column
13824 };
13825 if (ranges) {
13826 yyval._$.range = [
13827 lstack[lstack.length - (len || 1)].range[0],
13828 lstack[lstack.length - 1].range[1]
13829 ];
13830 }
13831 r = this.performAction.apply(yyval, [
13832 yytext,
13833 yyleng,
13834 yylineno,
13835 sharedState.yy,
13836 action[1],
13837 vstack,
13838 lstack
13839 ].concat(args));
13840 if (typeof r !== 'undefined') {
13841 return r;
13842 }
13843 if (len) {
13844 stack = stack.slice(0, -1 * len * 2);
13845 vstack = vstack.slice(0, -1 * len);
13846 lstack = lstack.slice(0, -1 * len);
13847 }
13848 stack.push(this.productions_[action[1]][0]);
13849 vstack.push(yyval.$);
13850 lstack.push(yyval._$);
13851 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
13852 stack.push(newState);
13853 break;
13854 case 3:
13855 return true;
13856 }
13857 }
13858 return true;
13859}};
13860/* generated by jison-lex 0.3.4 */
13861var lexer = (function(){
13862var lexer = ({
13863
13864EOF:1,
13865
13866parseError:function parseError(str, hash) {
13867 if (this.yy.parser) {
13868 this.yy.parser.parseError(str, hash);
13869 } else {
13870 throw new Error(str);
13871 }
13872 },
13873
13874// resets the lexer, sets new input
13875setInput:function (input, yy) {
13876 this.yy = yy || this.yy || {};
13877 this._input = input;
13878 this._more = this._backtrack = this.done = false;
13879 this.yylineno = this.yyleng = 0;
13880 this.yytext = this.matched = this.match = '';
13881 this.conditionStack = ['INITIAL'];
13882 this.yylloc = {
13883 first_line: 1,
13884 first_column: 0,
13885 last_line: 1,
13886 last_column: 0
13887 };
13888 if (this.options.ranges) {
13889 this.yylloc.range = [0,0];
13890 }
13891 this.offset = 0;
13892 return this;
13893 },
13894
13895// consumes and returns one char from the input
13896input:function () {
13897 var ch = this._input[0];
13898 this.yytext += ch;
13899 this.yyleng++;
13900 this.offset++;
13901 this.match += ch;
13902 this.matched += ch;
13903 var lines = ch.match(/(?:\r\n?|\n).*/g);
13904 if (lines) {
13905 this.yylineno++;
13906 this.yylloc.last_line++;
13907 } else {
13908 this.yylloc.last_column++;
13909 }
13910 if (this.options.ranges) {
13911 this.yylloc.range[1]++;
13912 }
13913
13914 this._input = this._input.slice(1);
13915 return ch;
13916 },
13917
13918// unshifts one char (or a string) into the input
13919unput:function (ch) {
13920 var len = ch.length;
13921 var lines = ch.split(/(?:\r\n?|\n)/g);
13922
13923 this._input = ch + this._input;
13924 this.yytext = this.yytext.substr(0, this.yytext.length - len);
13925 //this.yyleng -= len;
13926 this.offset -= len;
13927 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
13928 this.match = this.match.substr(0, this.match.length - 1);
13929 this.matched = this.matched.substr(0, this.matched.length - 1);
13930
13931 if (lines.length - 1) {
13932 this.yylineno -= lines.length - 1;
13933 }
13934 var r = this.yylloc.range;
13935
13936 this.yylloc = {
13937 first_line: this.yylloc.first_line,
13938 last_line: this.yylineno + 1,
13939 first_column: this.yylloc.first_column,
13940 last_column: lines ?
13941 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
13942 + oldLines[oldLines.length - lines.length].length - lines[0].length :
13943 this.yylloc.first_column - len
13944 };
13945
13946 if (this.options.ranges) {
13947 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
13948 }
13949 this.yyleng = this.yytext.length;
13950 return this;
13951 },
13952
13953// When called from action, caches matched text and appends it on next action
13954more:function () {
13955 this._more = true;
13956 return this;
13957 },
13958
13959// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
13960reject:function () {
13961 if (this.options.backtrack_lexer) {
13962 this._backtrack = true;
13963 } else {
13964 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
13965 text: "",
13966 token: null,
13967 line: this.yylineno
13968 });
13969
13970 }
13971 return this;
13972 },
13973
13974// retain first n characters of the match
13975less:function (n) {
13976 this.unput(this.match.slice(n));
13977 },
13978
13979// displays already matched input, i.e. for error messages
13980pastInput:function () {
13981 var past = this.matched.substr(0, this.matched.length - this.match.length);
13982 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
13983 },
13984
13985// displays upcoming input, i.e. for error messages
13986upcomingInput:function () {
13987 var next = this.match;
13988 if (next.length < 20) {
13989 next += this._input.substr(0, 20-next.length);
13990 }
13991 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
13992 },
13993
13994// displays the character position where the lexing error occurred, i.e. for error messages
13995showPosition:function () {
13996 var pre = this.pastInput();
13997 var c = new Array(pre.length + 1).join("-");
13998 return pre + this.upcomingInput() + "\n" + c + "^";
13999 },
14000
14001// test the lexed token: return FALSE when not a match, otherwise return token
14002test_match:function(match, indexed_rule) {
14003 var token,
14004 lines,
14005 backup;
14006
14007 if (this.options.backtrack_lexer) {
14008 // save context
14009 backup = {
14010 yylineno: this.yylineno,
14011 yylloc: {
14012 first_line: this.yylloc.first_line,
14013 last_line: this.last_line,
14014 first_column: this.yylloc.first_column,
14015 last_column: this.yylloc.last_column
14016 },
14017 yytext: this.yytext,
14018 match: this.match,
14019 matches: this.matches,
14020 matched: this.matched,
14021 yyleng: this.yyleng,
14022 offset: this.offset,
14023 _more: this._more,
14024 _input: this._input,
14025 yy: this.yy,
14026 conditionStack: this.conditionStack.slice(0),
14027 done: this.done
14028 };
14029 if (this.options.ranges) {
14030 backup.yylloc.range = this.yylloc.range.slice(0);
14031 }
14032 }
14033
14034 lines = match[0].match(/(?:\r\n?|\n).*/g);
14035 if (lines) {
14036 this.yylineno += lines.length;
14037 }
14038 this.yylloc = {
14039 first_line: this.yylloc.last_line,
14040 last_line: this.yylineno + 1,
14041 first_column: this.yylloc.last_column,
14042 last_column: lines ?
14043 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
14044 this.yylloc.last_column + match[0].length
14045 };
14046 this.yytext += match[0];
14047 this.match += match[0];
14048 this.matches = match;
14049 this.yyleng = this.yytext.length;
14050 if (this.options.ranges) {
14051 this.yylloc.range = [this.offset, this.offset += this.yyleng];
14052 }
14053 this._more = false;
14054 this._backtrack = false;
14055 this._input = this._input.slice(match[0].length);
14056 this.matched += match[0];
14057 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
14058 if (this.done && this._input) {
14059 this.done = false;
14060 }
14061 if (token) {
14062 return token;
14063 } else if (this._backtrack) {
14064 // recover context
14065 for (var k in backup) {
14066 this[k] = backup[k];
14067 }
14068 return false; // rule action called reject() implying the next rule should be tested instead.
14069 }
14070 return false;
14071 },
14072
14073// return next match in input
14074next:function () {
14075 if (this.done) {
14076 return this.EOF;
14077 }
14078 if (!this._input) {
14079 this.done = true;
14080 }
14081
14082 var token,
14083 match,
14084 tempMatch,
14085 index;
14086 if (!this._more) {
14087 this.yytext = '';
14088 this.match = '';
14089 }
14090 var rules = this._currentRules();
14091 for (var i = 0; i < rules.length; i++) {
14092 tempMatch = this._input.match(this.rules[rules[i]]);
14093 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
14094 match = tempMatch;
14095 index = i;
14096 if (this.options.backtrack_lexer) {
14097 token = this.test_match(tempMatch, rules[i]);
14098 if (token !== false) {
14099 return token;
14100 } else if (this._backtrack) {
14101 match = false;
14102 continue; // rule action called reject() implying a rule MISmatch.
14103 } else {
14104 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
14105 return false;
14106 }
14107 } else if (!this.options.flex) {
14108 break;
14109 }
14110 }
14111 }
14112 if (match) {
14113 token = this.test_match(match, rules[index]);
14114 if (token !== false) {
14115 return token;
14116 }
14117 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
14118 return false;
14119 }
14120 if (this._input === "") {
14121 return this.EOF;
14122 } else {
14123 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
14124 text: "",
14125 token: null,
14126 line: this.yylineno
14127 });
14128 }
14129 },
14130
14131// return next match that has a token
14132lex:function lex () {
14133 var r = this.next();
14134 if (r) {
14135 return r;
14136 } else {
14137 return this.lex();
14138 }
14139 },
14140
14141// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
14142begin:function begin (condition) {
14143 this.conditionStack.push(condition);
14144 },
14145
14146// pop the previously active lexer condition state off the condition stack
14147popState:function popState () {
14148 var n = this.conditionStack.length - 1;
14149 if (n > 0) {
14150 return this.conditionStack.pop();
14151 } else {
14152 return this.conditionStack[0];
14153 }
14154 },
14155
14156// produce the lexer rule set which is active for the currently active lexer condition state
14157_currentRules:function _currentRules () {
14158 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
14159 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
14160 } else {
14161 return this.conditions["INITIAL"].rules;
14162 }
14163 },
14164
14165// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
14166topState:function topState (n) {
14167 n = this.conditionStack.length - 1 - Math.abs(n || 0);
14168 if (n >= 0) {
14169 return this.conditionStack[n];
14170 } else {
14171 return "INITIAL";
14172 }
14173 },
14174
14175// alias for begin(condition)
14176pushState:function pushState (condition) {
14177 this.begin(condition);
14178 },
14179
14180// return the number of states currently on the stack
14181stateStackSize:function stateStackSize() {
14182 return this.conditionStack.length;
14183 },
14184options: {"case-insensitive":true},
14185performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
14186var YYSTATE=YY_START;
14187switch($avoiding_name_collisions) {
14188case 0:return 12;
14189break;
14190case 1:/* skip all whitespace */
14191break;
14192case 2:/* skip comments */
14193break;
14194case 3:/* skip comments */
14195break;
14196case 4:return 4;
14197break;
14198case 5:return 15;
14199break;
14200case 6:return 17;
14201break;
14202case 7:return 20;
14203break;
14204case 8:return 21;
14205break;
14206case 9:return 19;
14207break;
14208case 10:return 8;
14209break;
14210case 11:return 8;
14211break;
14212case 12:return 5;
14213break;
14214case 13:return 26
14215break;
14216case 14:this.begin("options");
14217break;
14218case 15:this.popState();
14219break;
14220case 16:return 11;
14221break;
14222case 17:this.begin("string");
14223break;
14224case 18:this.popState();
14225break;
14226case 19:return 23;
14227break;
14228case 20:return 18;
14229break;
14230case 21:return 7;
14231break;
14232}
14233},
14234rules: [/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:gitGraph\b)/i,/^(?:commit\b)/i,/^(?:branch\b)/i,/^(?:merge\b)/i,/^(?:reset\b)/i,/^(?:checkout\b)/i,/^(?:LR\b)/i,/^(?:BT\b)/i,/^(?::)/i,/^(?:\^)/i,/^(?:options\r?\n)/i,/^(?:end\r?\n)/i,/^(?:[^\n]+\r?\n)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[a-zA-Z][-_\.a-zA-Z0-9]*[-_a-zA-Z0-9])/i,/^(?:$)/i],
14235conditions: {"options":{"rules":[15,16],"inclusive":false},"string":{"rules":[18,19],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,20,21],"inclusive":true}}
14236});
14237return lexer;
14238})();
14239parser.lexer = lexer;
14240function Parser () {
14241 this.yy = {};
14242}
14243Parser.prototype = parser;parser.Parser = Parser;
14244return new Parser;
14245})();
14246
14247
14248if (true) {
14249exports.parser = parser;
14250exports.Parser = parser.Parser;
14251exports.parse = function () { return parser.parse.apply(parser, arguments); };
14252exports.main = function commonjsMain (args) {
14253 if (!args[1]) {
14254 console.log('Usage: '+args[0]+' FILE');
14255 process.exit(1);
14256 }
14257 var source = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
14258 return exports.parser.parse(source);
14259};
14260if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
14261 exports.main(process.argv.slice(1));
14262}
14263}
14264/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
14265
14266/***/ }),
14267
14268/***/ "./src/diagrams/git/styles.js":
14269/*!************************************!*\
14270 !*** ./src/diagrams/git/styles.js ***!
14271 \************************************/
14272/*! exports provided: default */
14273/***/ (function(module, __webpack_exports__, __webpack_require__) {
14274
14275"use strict";
14276__webpack_require__.r(__webpack_exports__);
14277var getStyles = function getStyles() {
14278 return "\n .commit-id,\n .commit-msg,\n .branch-label {\n fill: lightgrey;\n color: lightgrey;\n font-family: 'trebuchet ms', verdana, arial;\n font-family: var(--mermaid-font-family);\n }\n";
14279};
14280
14281/* harmony default export */ __webpack_exports__["default"] = (getStyles);
14282
14283/***/ }),
14284
14285/***/ "./src/diagrams/info/infoDb.js":
14286/*!*************************************!*\
14287 !*** ./src/diagrams/info/infoDb.js ***!
14288 \*************************************/
14289/*! exports provided: setMessage, getMessage, setInfo, getInfo, default */
14290/***/ (function(module, __webpack_exports__, __webpack_require__) {
14291
14292"use strict";
14293__webpack_require__.r(__webpack_exports__);
14294/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setMessage", function() { return setMessage; });
14295/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMessage", function() { return getMessage; });
14296/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setInfo", function() { return setInfo; });
14297/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getInfo", function() { return getInfo; });
14298/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
14299/**
14300 * Created by knut on 15-01-14.
14301 */
14302
14303var message = '';
14304var info = false;
14305var setMessage = function setMessage(txt) {
14306 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Setting message to: ' + txt);
14307 message = txt;
14308};
14309var getMessage = function getMessage() {
14310 return message;
14311};
14312var setInfo = function setInfo(inf) {
14313 info = inf;
14314};
14315var getInfo = function getInfo() {
14316 return info;
14317}; // export const parseError = (err, hash) => {
14318// global.mermaidAPI.parseError(err, hash)
14319// }
14320
14321/* harmony default export */ __webpack_exports__["default"] = ({
14322 setMessage: setMessage,
14323 getMessage: getMessage,
14324 setInfo: setInfo,
14325 getInfo: getInfo // parseError
14326
14327});
14328
14329/***/ }),
14330
14331/***/ "./src/diagrams/info/infoRenderer.js":
14332/*!*******************************************!*\
14333 !*** ./src/diagrams/info/infoRenderer.js ***!
14334 \*******************************************/
14335/*! exports provided: setConf, draw, default */
14336/***/ (function(module, __webpack_exports__, __webpack_require__) {
14337
14338"use strict";
14339__webpack_require__.r(__webpack_exports__);
14340/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
14341/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
14342/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
14343/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
14344/* harmony import */ var _infoDb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./infoDb */ "./src/diagrams/info/infoDb.js");
14345/* harmony import */ var _parser_info__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./parser/info */ "./src/diagrams/info/parser/info.jison");
14346/* harmony import */ var _parser_info__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_parser_info__WEBPACK_IMPORTED_MODULE_2__);
14347/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
14348/**
14349 * Created by knut on 14-12-11.
14350 */
14351
14352
14353
14354
14355var conf = {};
14356var setConf = function setConf(cnf) {
14357 var keys = Object.keys(cnf);
14358 keys.forEach(function (key) {
14359 conf[key] = cnf[key];
14360 });
14361};
14362/**
14363 * Draws a an info picture in the tag with id: id based on the graph definition in text.
14364 * @param text
14365 * @param id
14366 */
14367
14368var draw = function draw(txt, id, ver) {
14369 try {
14370 var parser = _parser_info__WEBPACK_IMPORTED_MODULE_2___default.a.parser;
14371 parser.yy = _infoDb__WEBPACK_IMPORTED_MODULE_1__["default"];
14372 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Renering info diagram\n' + txt); // Parse the graph definition
14373
14374 parser.parse(txt);
14375 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Parsed info diagram'); // Fetch the default direction, use TD if none was found
14376
14377 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + id);
14378 var g = svg.append('g');
14379 g.append('text') // text label for the x axis
14380 .attr('x', 100).attr('y', 40).attr('class', 'version').attr('font-size', '32px').style('text-anchor', 'middle').text('v ' + ver);
14381 svg.attr('height', 100);
14382 svg.attr('width', 400); // svg.attr('viewBox', '0 0 300 150');
14383 } catch (e) {
14384 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error('Error while rendering info diagram');
14385 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error(e.message);
14386 }
14387};
14388/* harmony default export */ __webpack_exports__["default"] = ({
14389 setConf: setConf,
14390 draw: draw
14391});
14392
14393/***/ }),
14394
14395/***/ "./src/diagrams/info/parser/info.jison":
14396/*!*********************************************!*\
14397 !*** ./src/diagrams/info/parser/info.jison ***!
14398 \*********************************************/
14399/*! no static exports found */
14400/***/ (function(module, exports, __webpack_require__) {
14401
14402/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
14403/*
14404 Returns a Parser object of the following structure:
14405
14406 Parser: {
14407 yy: {}
14408 }
14409
14410 Parser.prototype: {
14411 yy: {},
14412 trace: function(),
14413 symbols_: {associative list: name ==> number},
14414 terminals_: {associative list: number ==> name},
14415 productions_: [...],
14416 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
14417 table: [...],
14418 defaultActions: {...},
14419 parseError: function(str, hash),
14420 parse: function(input),
14421
14422 lexer: {
14423 EOF: 1,
14424 parseError: function(str, hash),
14425 setInput: function(input),
14426 input: function(),
14427 unput: function(str),
14428 more: function(),
14429 less: function(n),
14430 pastInput: function(),
14431 upcomingInput: function(),
14432 showPosition: function(),
14433 test_match: function(regex_match_array, rule_index),
14434 next: function(),
14435 lex: function(),
14436 begin: function(condition),
14437 popState: function(),
14438 _currentRules: function(),
14439 topState: function(),
14440 pushState: function(condition),
14441
14442 options: {
14443 ranges: boolean (optional: true ==> token location info will include a .range[] member)
14444 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
14445 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
14446 },
14447
14448 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
14449 rules: [...],
14450 conditions: {associative list: name ==> set},
14451 }
14452 }
14453
14454
14455 token location info (@$, _$, etc.): {
14456 first_line: n,
14457 last_line: n,
14458 first_column: n,
14459 last_column: n,
14460 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
14461 }
14462
14463
14464 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
14465 text: (matched text)
14466 token: (the produced terminal token, if any)
14467 line: (yylineno)
14468 }
14469 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
14470 loc: (yylloc)
14471 expected: (string describing the set of expected tokens)
14472 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
14473 }
14474*/
14475var parser = (function(){
14476var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,9,10];
14477var parser = {trace: function trace () { },
14478yy: {},
14479symbols_: {"error":2,"start":3,"info":4,"document":5,"EOF":6,"line":7,"statement":8,"NL":9,"showInfo":10,"$accept":0,"$end":1},
14480terminals_: {2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},
14481productions_: [0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],
14482performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
14483/* this == yyval */
14484
14485var $0 = $$.length - 1;
14486switch (yystate) {
14487case 1:
14488 return yy;
14489break;
14490case 4:
14491
14492break;
14493case 6:
14494 yy.setInfo(true);
14495break;
14496}
14497},
14498table: [{3:1,4:[1,2]},{1:[3]},o($V0,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},o($V0,[2,3]),o($V0,[2,4]),o($V0,[2,5]),o($V0,[2,6])],
14499defaultActions: {4:[2,1]},
14500parseError: function parseError (str, hash) {
14501 if (hash.recoverable) {
14502 this.trace(str);
14503 } else {
14504 var error = new Error(str);
14505 error.hash = hash;
14506 throw error;
14507 }
14508},
14509parse: function parse(input) {
14510 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
14511 var args = lstack.slice.call(arguments, 1);
14512 var lexer = Object.create(this.lexer);
14513 var sharedState = { yy: {} };
14514 for (var k in this.yy) {
14515 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
14516 sharedState.yy[k] = this.yy[k];
14517 }
14518 }
14519 lexer.setInput(input, sharedState.yy);
14520 sharedState.yy.lexer = lexer;
14521 sharedState.yy.parser = this;
14522 if (typeof lexer.yylloc == 'undefined') {
14523 lexer.yylloc = {};
14524 }
14525 var yyloc = lexer.yylloc;
14526 lstack.push(yyloc);
14527 var ranges = lexer.options && lexer.options.ranges;
14528 if (typeof sharedState.yy.parseError === 'function') {
14529 this.parseError = sharedState.yy.parseError;
14530 } else {
14531 this.parseError = Object.getPrototypeOf(this).parseError;
14532 }
14533 function popStack(n) {
14534 stack.length = stack.length - 2 * n;
14535 vstack.length = vstack.length - n;
14536 lstack.length = lstack.length - n;
14537 }
14538 function lex() {
14539 var token;
14540 token = tstack.pop() || lexer.lex() || EOF;
14541 if (typeof token !== 'number') {
14542 if (token instanceof Array) {
14543 tstack = token;
14544 token = tstack.pop();
14545 }
14546 token = self.symbols_[token] || token;
14547 }
14548 return token;
14549 }
14550 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
14551 while (true) {
14552 state = stack[stack.length - 1];
14553 if (this.defaultActions[state]) {
14554 action = this.defaultActions[state];
14555 } else {
14556 if (symbol === null || typeof symbol == 'undefined') {
14557 symbol = lex();
14558 }
14559 action = table[state] && table[state][symbol];
14560 }
14561 if (typeof action === 'undefined' || !action.length || !action[0]) {
14562 var errStr = '';
14563 expected = [];
14564 for (p in table[state]) {
14565 if (this.terminals_[p] && p > TERROR) {
14566 expected.push('\'' + this.terminals_[p] + '\'');
14567 }
14568 }
14569 if (lexer.showPosition) {
14570 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
14571 } else {
14572 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
14573 }
14574 this.parseError(errStr, {
14575 text: lexer.match,
14576 token: this.terminals_[symbol] || symbol,
14577 line: lexer.yylineno,
14578 loc: yyloc,
14579 expected: expected
14580 });
14581 }
14582 if (action[0] instanceof Array && action.length > 1) {
14583 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
14584 }
14585 switch (action[0]) {
14586 case 1:
14587 stack.push(symbol);
14588 vstack.push(lexer.yytext);
14589 lstack.push(lexer.yylloc);
14590 stack.push(action[1]);
14591 symbol = null;
14592 if (!preErrorSymbol) {
14593 yyleng = lexer.yyleng;
14594 yytext = lexer.yytext;
14595 yylineno = lexer.yylineno;
14596 yyloc = lexer.yylloc;
14597 if (recovering > 0) {
14598 recovering--;
14599 }
14600 } else {
14601 symbol = preErrorSymbol;
14602 preErrorSymbol = null;
14603 }
14604 break;
14605 case 2:
14606 len = this.productions_[action[1]][1];
14607 yyval.$ = vstack[vstack.length - len];
14608 yyval._$ = {
14609 first_line: lstack[lstack.length - (len || 1)].first_line,
14610 last_line: lstack[lstack.length - 1].last_line,
14611 first_column: lstack[lstack.length - (len || 1)].first_column,
14612 last_column: lstack[lstack.length - 1].last_column
14613 };
14614 if (ranges) {
14615 yyval._$.range = [
14616 lstack[lstack.length - (len || 1)].range[0],
14617 lstack[lstack.length - 1].range[1]
14618 ];
14619 }
14620 r = this.performAction.apply(yyval, [
14621 yytext,
14622 yyleng,
14623 yylineno,
14624 sharedState.yy,
14625 action[1],
14626 vstack,
14627 lstack
14628 ].concat(args));
14629 if (typeof r !== 'undefined') {
14630 return r;
14631 }
14632 if (len) {
14633 stack = stack.slice(0, -1 * len * 2);
14634 vstack = vstack.slice(0, -1 * len);
14635 lstack = lstack.slice(0, -1 * len);
14636 }
14637 stack.push(this.productions_[action[1]][0]);
14638 vstack.push(yyval.$);
14639 lstack.push(yyval._$);
14640 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
14641 stack.push(newState);
14642 break;
14643 case 3:
14644 return true;
14645 }
14646 }
14647 return true;
14648}};
14649
14650/* generated by jison-lex 0.3.4 */
14651var lexer = (function(){
14652var lexer = ({
14653
14654EOF:1,
14655
14656parseError:function parseError(str, hash) {
14657 if (this.yy.parser) {
14658 this.yy.parser.parseError(str, hash);
14659 } else {
14660 throw new Error(str);
14661 }
14662 },
14663
14664// resets the lexer, sets new input
14665setInput:function (input, yy) {
14666 this.yy = yy || this.yy || {};
14667 this._input = input;
14668 this._more = this._backtrack = this.done = false;
14669 this.yylineno = this.yyleng = 0;
14670 this.yytext = this.matched = this.match = '';
14671 this.conditionStack = ['INITIAL'];
14672 this.yylloc = {
14673 first_line: 1,
14674 first_column: 0,
14675 last_line: 1,
14676 last_column: 0
14677 };
14678 if (this.options.ranges) {
14679 this.yylloc.range = [0,0];
14680 }
14681 this.offset = 0;
14682 return this;
14683 },
14684
14685// consumes and returns one char from the input
14686input:function () {
14687 var ch = this._input[0];
14688 this.yytext += ch;
14689 this.yyleng++;
14690 this.offset++;
14691 this.match += ch;
14692 this.matched += ch;
14693 var lines = ch.match(/(?:\r\n?|\n).*/g);
14694 if (lines) {
14695 this.yylineno++;
14696 this.yylloc.last_line++;
14697 } else {
14698 this.yylloc.last_column++;
14699 }
14700 if (this.options.ranges) {
14701 this.yylloc.range[1]++;
14702 }
14703
14704 this._input = this._input.slice(1);
14705 return ch;
14706 },
14707
14708// unshifts one char (or a string) into the input
14709unput:function (ch) {
14710 var len = ch.length;
14711 var lines = ch.split(/(?:\r\n?|\n)/g);
14712
14713 this._input = ch + this._input;
14714 this.yytext = this.yytext.substr(0, this.yytext.length - len);
14715 //this.yyleng -= len;
14716 this.offset -= len;
14717 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
14718 this.match = this.match.substr(0, this.match.length - 1);
14719 this.matched = this.matched.substr(0, this.matched.length - 1);
14720
14721 if (lines.length - 1) {
14722 this.yylineno -= lines.length - 1;
14723 }
14724 var r = this.yylloc.range;
14725
14726 this.yylloc = {
14727 first_line: this.yylloc.first_line,
14728 last_line: this.yylineno + 1,
14729 first_column: this.yylloc.first_column,
14730 last_column: lines ?
14731 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
14732 + oldLines[oldLines.length - lines.length].length - lines[0].length :
14733 this.yylloc.first_column - len
14734 };
14735
14736 if (this.options.ranges) {
14737 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
14738 }
14739 this.yyleng = this.yytext.length;
14740 return this;
14741 },
14742
14743// When called from action, caches matched text and appends it on next action
14744more:function () {
14745 this._more = true;
14746 return this;
14747 },
14748
14749// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
14750reject:function () {
14751 if (this.options.backtrack_lexer) {
14752 this._backtrack = true;
14753 } else {
14754 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
14755 text: "",
14756 token: null,
14757 line: this.yylineno
14758 });
14759
14760 }
14761 return this;
14762 },
14763
14764// retain first n characters of the match
14765less:function (n) {
14766 this.unput(this.match.slice(n));
14767 },
14768
14769// displays already matched input, i.e. for error messages
14770pastInput:function () {
14771 var past = this.matched.substr(0, this.matched.length - this.match.length);
14772 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
14773 },
14774
14775// displays upcoming input, i.e. for error messages
14776upcomingInput:function () {
14777 var next = this.match;
14778 if (next.length < 20) {
14779 next += this._input.substr(0, 20-next.length);
14780 }
14781 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
14782 },
14783
14784// displays the character position where the lexing error occurred, i.e. for error messages
14785showPosition:function () {
14786 var pre = this.pastInput();
14787 var c = new Array(pre.length + 1).join("-");
14788 return pre + this.upcomingInput() + "\n" + c + "^";
14789 },
14790
14791// test the lexed token: return FALSE when not a match, otherwise return token
14792test_match:function(match, indexed_rule) {
14793 var token,
14794 lines,
14795 backup;
14796
14797 if (this.options.backtrack_lexer) {
14798 // save context
14799 backup = {
14800 yylineno: this.yylineno,
14801 yylloc: {
14802 first_line: this.yylloc.first_line,
14803 last_line: this.last_line,
14804 first_column: this.yylloc.first_column,
14805 last_column: this.yylloc.last_column
14806 },
14807 yytext: this.yytext,
14808 match: this.match,
14809 matches: this.matches,
14810 matched: this.matched,
14811 yyleng: this.yyleng,
14812 offset: this.offset,
14813 _more: this._more,
14814 _input: this._input,
14815 yy: this.yy,
14816 conditionStack: this.conditionStack.slice(0),
14817 done: this.done
14818 };
14819 if (this.options.ranges) {
14820 backup.yylloc.range = this.yylloc.range.slice(0);
14821 }
14822 }
14823
14824 lines = match[0].match(/(?:\r\n?|\n).*/g);
14825 if (lines) {
14826 this.yylineno += lines.length;
14827 }
14828 this.yylloc = {
14829 first_line: this.yylloc.last_line,
14830 last_line: this.yylineno + 1,
14831 first_column: this.yylloc.last_column,
14832 last_column: lines ?
14833 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
14834 this.yylloc.last_column + match[0].length
14835 };
14836 this.yytext += match[0];
14837 this.match += match[0];
14838 this.matches = match;
14839 this.yyleng = this.yytext.length;
14840 if (this.options.ranges) {
14841 this.yylloc.range = [this.offset, this.offset += this.yyleng];
14842 }
14843 this._more = false;
14844 this._backtrack = false;
14845 this._input = this._input.slice(match[0].length);
14846 this.matched += match[0];
14847 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
14848 if (this.done && this._input) {
14849 this.done = false;
14850 }
14851 if (token) {
14852 return token;
14853 } else if (this._backtrack) {
14854 // recover context
14855 for (var k in backup) {
14856 this[k] = backup[k];
14857 }
14858 return false; // rule action called reject() implying the next rule should be tested instead.
14859 }
14860 return false;
14861 },
14862
14863// return next match in input
14864next:function () {
14865 if (this.done) {
14866 return this.EOF;
14867 }
14868 if (!this._input) {
14869 this.done = true;
14870 }
14871
14872 var token,
14873 match,
14874 tempMatch,
14875 index;
14876 if (!this._more) {
14877 this.yytext = '';
14878 this.match = '';
14879 }
14880 var rules = this._currentRules();
14881 for (var i = 0; i < rules.length; i++) {
14882 tempMatch = this._input.match(this.rules[rules[i]]);
14883 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
14884 match = tempMatch;
14885 index = i;
14886 if (this.options.backtrack_lexer) {
14887 token = this.test_match(tempMatch, rules[i]);
14888 if (token !== false) {
14889 return token;
14890 } else if (this._backtrack) {
14891 match = false;
14892 continue; // rule action called reject() implying a rule MISmatch.
14893 } else {
14894 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
14895 return false;
14896 }
14897 } else if (!this.options.flex) {
14898 break;
14899 }
14900 }
14901 }
14902 if (match) {
14903 token = this.test_match(match, rules[index]);
14904 if (token !== false) {
14905 return token;
14906 }
14907 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
14908 return false;
14909 }
14910 if (this._input === "") {
14911 return this.EOF;
14912 } else {
14913 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
14914 text: "",
14915 token: null,
14916 line: this.yylineno
14917 });
14918 }
14919 },
14920
14921// return next match that has a token
14922lex:function lex () {
14923 var r = this.next();
14924 if (r) {
14925 return r;
14926 } else {
14927 return this.lex();
14928 }
14929 },
14930
14931// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
14932begin:function begin (condition) {
14933 this.conditionStack.push(condition);
14934 },
14935
14936// pop the previously active lexer condition state off the condition stack
14937popState:function popState () {
14938 var n = this.conditionStack.length - 1;
14939 if (n > 0) {
14940 return this.conditionStack.pop();
14941 } else {
14942 return this.conditionStack[0];
14943 }
14944 },
14945
14946// produce the lexer rule set which is active for the currently active lexer condition state
14947_currentRules:function _currentRules () {
14948 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
14949 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
14950 } else {
14951 return this.conditions["INITIAL"].rules;
14952 }
14953 },
14954
14955// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
14956topState:function topState (n) {
14957 n = this.conditionStack.length - 1 - Math.abs(n || 0);
14958 if (n >= 0) {
14959 return this.conditionStack[n];
14960 } else {
14961 return "INITIAL";
14962 }
14963 },
14964
14965// alias for begin(condition)
14966pushState:function pushState (condition) {
14967 this.begin(condition);
14968 },
14969
14970// return the number of states currently on the stack
14971stateStackSize:function stateStackSize() {
14972 return this.conditionStack.length;
14973 },
14974options: {"case-insensitive":true},
14975performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
14976 // Pre-lexer code can go here
14977
14978var YYSTATE=YY_START;
14979switch($avoiding_name_collisions) {
14980case 0:return 4 ;
14981break;
14982case 1:return 9 ;
14983break;
14984case 2:return 'space';
14985break;
14986case 3:return 10;
14987break;
14988case 4:return 6 ;
14989break;
14990case 5:return 'TXT' ;
14991break;
14992}
14993},
14994rules: [/^(?:info\b)/i,/^(?:[\s\n\r]+)/i,/^(?:[\s]+)/i,/^(?:showInfo\b)/i,/^(?:$)/i,/^(?:.)/i],
14995conditions: {"INITIAL":{"rules":[0,1,2,3,4,5],"inclusive":true}}
14996});
14997return lexer;
14998})();
14999parser.lexer = lexer;
15000function Parser () {
15001 this.yy = {};
15002}
15003Parser.prototype = parser;parser.Parser = Parser;
15004return new Parser;
15005})();
15006
15007
15008if (true) {
15009exports.parser = parser;
15010exports.Parser = parser.Parser;
15011exports.parse = function () { return parser.parse.apply(parser, arguments); };
15012exports.main = function commonjsMain (args) {
15013 if (!args[1]) {
15014 console.log('Usage: '+args[0]+' FILE');
15015 process.exit(1);
15016 }
15017 var source = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
15018 return exports.parser.parse(source);
15019};
15020if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
15021 exports.main(process.argv.slice(1));
15022}
15023}
15024/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
15025
15026/***/ }),
15027
15028/***/ "./src/diagrams/info/styles.js":
15029/*!*************************************!*\
15030 !*** ./src/diagrams/info/styles.js ***!
15031 \*************************************/
15032/*! exports provided: default */
15033/***/ (function(module, __webpack_exports__, __webpack_require__) {
15034
15035"use strict";
15036__webpack_require__.r(__webpack_exports__);
15037var getStyles = function getStyles() {
15038 return "";
15039};
15040
15041/* harmony default export */ __webpack_exports__["default"] = (getStyles);
15042
15043/***/ }),
15044
15045/***/ "./src/diagrams/pie/parser/pie.jison":
15046/*!*******************************************!*\
15047 !*** ./src/diagrams/pie/parser/pie.jison ***!
15048 \*******************************************/
15049/*! no static exports found */
15050/***/ (function(module, exports, __webpack_require__) {
15051
15052/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
15053/*
15054 Returns a Parser object of the following structure:
15055
15056 Parser: {
15057 yy: {}
15058 }
15059
15060 Parser.prototype: {
15061 yy: {},
15062 trace: function(),
15063 symbols_: {associative list: name ==> number},
15064 terminals_: {associative list: number ==> name},
15065 productions_: [...],
15066 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
15067 table: [...],
15068 defaultActions: {...},
15069 parseError: function(str, hash),
15070 parse: function(input),
15071
15072 lexer: {
15073 EOF: 1,
15074 parseError: function(str, hash),
15075 setInput: function(input),
15076 input: function(),
15077 unput: function(str),
15078 more: function(),
15079 less: function(n),
15080 pastInput: function(),
15081 upcomingInput: function(),
15082 showPosition: function(),
15083 test_match: function(regex_match_array, rule_index),
15084 next: function(),
15085 lex: function(),
15086 begin: function(condition),
15087 popState: function(),
15088 _currentRules: function(),
15089 topState: function(),
15090 pushState: function(condition),
15091
15092 options: {
15093 ranges: boolean (optional: true ==> token location info will include a .range[] member)
15094 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
15095 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
15096 },
15097
15098 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
15099 rules: [...],
15100 conditions: {associative list: name ==> set},
15101 }
15102 }
15103
15104
15105 token location info (@$, _$, etc.): {
15106 first_line: n,
15107 last_line: n,
15108 first_column: n,
15109 last_column: n,
15110 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
15111 }
15112
15113
15114 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
15115 text: (matched text)
15116 token: (the produced terminal token, if any)
15117 line: (yylineno)
15118 }
15119 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
15120 loc: (yylloc)
15121 expected: (string describing the set of expected tokens)
15122 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
15123 }
15124*/
15125var parser = (function(){
15126var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,5],$V2=[1,6],$V3=[1,7],$V4=[1,9],$V5=[1,10,12,19,20,21,22],$V6=[1,6,10,12,19,20,21,22],$V7=[19,20,21],$V8=[1,22],$V9=[6,19,20,21,22];
15127var parser = {trace: function trace () { },
15128yy: {},
15129symbols_: {"error":2,"start":3,"eol":4,"directive":5,"PIE":6,"document":7,"line":8,"statement":9,"txt":10,"value":11,"title":12,"title_value":13,"openDirective":14,"typeDirective":15,"closeDirective":16,":":17,"argDirective":18,"NEWLINE":19,";":20,"EOF":21,"open_directive":22,"type_directive":23,"arg_directive":24,"close_directive":25,"$accept":0,"$end":1},
15130terminals_: {2:"error",6:"PIE",10:"txt",11:"value",12:"title",13:"title_value",17:":",19:"NEWLINE",20:";",21:"EOF",22:"open_directive",23:"type_directive",24:"arg_directive",25:"close_directive"},
15131productions_: [0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[9,0],[9,2],[9,2],[9,1],[5,3],[5,5],[4,1],[4,1],[4,1],[14,1],[15,1],[18,1],[16,1]],
15132performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
15133/* this == yyval */
15134
15135var $0 = $$.length - 1;
15136switch (yystate) {
15137case 6:
15138 this.$ = $$[$0-1]
15139break;
15140case 8:
15141 yy.addSection($$[$0-1],yy.cleanupValue($$[$0]));
15142break;
15143case 9:
15144 this.$=$$[$0].trim();yy.setTitle(this.$);
15145break;
15146case 16:
15147 yy.parseDirective('%%{', 'open_directive');
15148break;
15149case 17:
15150 yy.parseDirective($$[$0], 'type_directive');
15151break;
15152case 18:
15153 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
15154break;
15155case 19:
15156 yy.parseDirective('}%%', 'close_directive', 'pie');
15157break;
15158}
15159},
15160table: [{3:1,4:2,5:3,6:$V0,14:8,19:$V1,20:$V2,21:$V3,22:$V4},{1:[3]},{3:10,4:2,5:3,6:$V0,14:8,19:$V1,20:$V2,21:$V3,22:$V4},{3:11,4:2,5:3,6:$V0,14:8,19:$V1,20:$V2,21:$V3,22:$V4},o($V5,[2,4],{7:12}),o($V6,[2,13]),o($V6,[2,14]),o($V6,[2,15]),{15:13,23:[1,14]},{23:[2,16]},{1:[2,1]},{1:[2,2]},o($V7,[2,7],{14:8,8:15,9:16,5:19,1:[2,3],10:[1,17],12:[1,18],22:$V4}),{16:20,17:[1,21],25:$V8},o([17,25],[2,17]),o($V5,[2,5]),{4:23,19:$V1,20:$V2,21:$V3},{11:[1,24]},{13:[1,25]},o($V7,[2,10]),o($V9,[2,11]),{18:26,24:[1,27]},o($V9,[2,19]),o($V5,[2,6]),o($V7,[2,8]),o($V7,[2,9]),{16:28,25:$V8},{25:[2,18]},o($V9,[2,12])],
15161defaultActions: {9:[2,16],10:[2,1],11:[2,2],27:[2,18]},
15162parseError: function parseError (str, hash) {
15163 if (hash.recoverable) {
15164 this.trace(str);
15165 } else {
15166 var error = new Error(str);
15167 error.hash = hash;
15168 throw error;
15169 }
15170},
15171parse: function parse(input) {
15172 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
15173 var args = lstack.slice.call(arguments, 1);
15174 var lexer = Object.create(this.lexer);
15175 var sharedState = { yy: {} };
15176 for (var k in this.yy) {
15177 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
15178 sharedState.yy[k] = this.yy[k];
15179 }
15180 }
15181 lexer.setInput(input, sharedState.yy);
15182 sharedState.yy.lexer = lexer;
15183 sharedState.yy.parser = this;
15184 if (typeof lexer.yylloc == 'undefined') {
15185 lexer.yylloc = {};
15186 }
15187 var yyloc = lexer.yylloc;
15188 lstack.push(yyloc);
15189 var ranges = lexer.options && lexer.options.ranges;
15190 if (typeof sharedState.yy.parseError === 'function') {
15191 this.parseError = sharedState.yy.parseError;
15192 } else {
15193 this.parseError = Object.getPrototypeOf(this).parseError;
15194 }
15195 function popStack(n) {
15196 stack.length = stack.length - 2 * n;
15197 vstack.length = vstack.length - n;
15198 lstack.length = lstack.length - n;
15199 }
15200 function lex() {
15201 var token;
15202 token = tstack.pop() || lexer.lex() || EOF;
15203 if (typeof token !== 'number') {
15204 if (token instanceof Array) {
15205 tstack = token;
15206 token = tstack.pop();
15207 }
15208 token = self.symbols_[token] || token;
15209 }
15210 return token;
15211 }
15212 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
15213 while (true) {
15214 state = stack[stack.length - 1];
15215 if (this.defaultActions[state]) {
15216 action = this.defaultActions[state];
15217 } else {
15218 if (symbol === null || typeof symbol == 'undefined') {
15219 symbol = lex();
15220 }
15221 action = table[state] && table[state][symbol];
15222 }
15223 if (typeof action === 'undefined' || !action.length || !action[0]) {
15224 var errStr = '';
15225 expected = [];
15226 for (p in table[state]) {
15227 if (this.terminals_[p] && p > TERROR) {
15228 expected.push('\'' + this.terminals_[p] + '\'');
15229 }
15230 }
15231 if (lexer.showPosition) {
15232 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
15233 } else {
15234 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
15235 }
15236 this.parseError(errStr, {
15237 text: lexer.match,
15238 token: this.terminals_[symbol] || symbol,
15239 line: lexer.yylineno,
15240 loc: yyloc,
15241 expected: expected
15242 });
15243 }
15244 if (action[0] instanceof Array && action.length > 1) {
15245 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
15246 }
15247 switch (action[0]) {
15248 case 1:
15249 stack.push(symbol);
15250 vstack.push(lexer.yytext);
15251 lstack.push(lexer.yylloc);
15252 stack.push(action[1]);
15253 symbol = null;
15254 if (!preErrorSymbol) {
15255 yyleng = lexer.yyleng;
15256 yytext = lexer.yytext;
15257 yylineno = lexer.yylineno;
15258 yyloc = lexer.yylloc;
15259 if (recovering > 0) {
15260 recovering--;
15261 }
15262 } else {
15263 symbol = preErrorSymbol;
15264 preErrorSymbol = null;
15265 }
15266 break;
15267 case 2:
15268 len = this.productions_[action[1]][1];
15269 yyval.$ = vstack[vstack.length - len];
15270 yyval._$ = {
15271 first_line: lstack[lstack.length - (len || 1)].first_line,
15272 last_line: lstack[lstack.length - 1].last_line,
15273 first_column: lstack[lstack.length - (len || 1)].first_column,
15274 last_column: lstack[lstack.length - 1].last_column
15275 };
15276 if (ranges) {
15277 yyval._$.range = [
15278 lstack[lstack.length - (len || 1)].range[0],
15279 lstack[lstack.length - 1].range[1]
15280 ];
15281 }
15282 r = this.performAction.apply(yyval, [
15283 yytext,
15284 yyleng,
15285 yylineno,
15286 sharedState.yy,
15287 action[1],
15288 vstack,
15289 lstack
15290 ].concat(args));
15291 if (typeof r !== 'undefined') {
15292 return r;
15293 }
15294 if (len) {
15295 stack = stack.slice(0, -1 * len * 2);
15296 vstack = vstack.slice(0, -1 * len);
15297 lstack = lstack.slice(0, -1 * len);
15298 }
15299 stack.push(this.productions_[action[1]][0]);
15300 vstack.push(yyval.$);
15301 lstack.push(yyval._$);
15302 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
15303 stack.push(newState);
15304 break;
15305 case 3:
15306 return true;
15307 }
15308 }
15309 return true;
15310}};
15311
15312/* generated by jison-lex 0.3.4 */
15313var lexer = (function(){
15314var lexer = ({
15315
15316EOF:1,
15317
15318parseError:function parseError(str, hash) {
15319 if (this.yy.parser) {
15320 this.yy.parser.parseError(str, hash);
15321 } else {
15322 throw new Error(str);
15323 }
15324 },
15325
15326// resets the lexer, sets new input
15327setInput:function (input, yy) {
15328 this.yy = yy || this.yy || {};
15329 this._input = input;
15330 this._more = this._backtrack = this.done = false;
15331 this.yylineno = this.yyleng = 0;
15332 this.yytext = this.matched = this.match = '';
15333 this.conditionStack = ['INITIAL'];
15334 this.yylloc = {
15335 first_line: 1,
15336 first_column: 0,
15337 last_line: 1,
15338 last_column: 0
15339 };
15340 if (this.options.ranges) {
15341 this.yylloc.range = [0,0];
15342 }
15343 this.offset = 0;
15344 return this;
15345 },
15346
15347// consumes and returns one char from the input
15348input:function () {
15349 var ch = this._input[0];
15350 this.yytext += ch;
15351 this.yyleng++;
15352 this.offset++;
15353 this.match += ch;
15354 this.matched += ch;
15355 var lines = ch.match(/(?:\r\n?|\n).*/g);
15356 if (lines) {
15357 this.yylineno++;
15358 this.yylloc.last_line++;
15359 } else {
15360 this.yylloc.last_column++;
15361 }
15362 if (this.options.ranges) {
15363 this.yylloc.range[1]++;
15364 }
15365
15366 this._input = this._input.slice(1);
15367 return ch;
15368 },
15369
15370// unshifts one char (or a string) into the input
15371unput:function (ch) {
15372 var len = ch.length;
15373 var lines = ch.split(/(?:\r\n?|\n)/g);
15374
15375 this._input = ch + this._input;
15376 this.yytext = this.yytext.substr(0, this.yytext.length - len);
15377 //this.yyleng -= len;
15378 this.offset -= len;
15379 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
15380 this.match = this.match.substr(0, this.match.length - 1);
15381 this.matched = this.matched.substr(0, this.matched.length - 1);
15382
15383 if (lines.length - 1) {
15384 this.yylineno -= lines.length - 1;
15385 }
15386 var r = this.yylloc.range;
15387
15388 this.yylloc = {
15389 first_line: this.yylloc.first_line,
15390 last_line: this.yylineno + 1,
15391 first_column: this.yylloc.first_column,
15392 last_column: lines ?
15393 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
15394 + oldLines[oldLines.length - lines.length].length - lines[0].length :
15395 this.yylloc.first_column - len
15396 };
15397
15398 if (this.options.ranges) {
15399 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
15400 }
15401 this.yyleng = this.yytext.length;
15402 return this;
15403 },
15404
15405// When called from action, caches matched text and appends it on next action
15406more:function () {
15407 this._more = true;
15408 return this;
15409 },
15410
15411// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
15412reject:function () {
15413 if (this.options.backtrack_lexer) {
15414 this._backtrack = true;
15415 } else {
15416 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
15417 text: "",
15418 token: null,
15419 line: this.yylineno
15420 });
15421
15422 }
15423 return this;
15424 },
15425
15426// retain first n characters of the match
15427less:function (n) {
15428 this.unput(this.match.slice(n));
15429 },
15430
15431// displays already matched input, i.e. for error messages
15432pastInput:function () {
15433 var past = this.matched.substr(0, this.matched.length - this.match.length);
15434 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
15435 },
15436
15437// displays upcoming input, i.e. for error messages
15438upcomingInput:function () {
15439 var next = this.match;
15440 if (next.length < 20) {
15441 next += this._input.substr(0, 20-next.length);
15442 }
15443 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
15444 },
15445
15446// displays the character position where the lexing error occurred, i.e. for error messages
15447showPosition:function () {
15448 var pre = this.pastInput();
15449 var c = new Array(pre.length + 1).join("-");
15450 return pre + this.upcomingInput() + "\n" + c + "^";
15451 },
15452
15453// test the lexed token: return FALSE when not a match, otherwise return token
15454test_match:function(match, indexed_rule) {
15455 var token,
15456 lines,
15457 backup;
15458
15459 if (this.options.backtrack_lexer) {
15460 // save context
15461 backup = {
15462 yylineno: this.yylineno,
15463 yylloc: {
15464 first_line: this.yylloc.first_line,
15465 last_line: this.last_line,
15466 first_column: this.yylloc.first_column,
15467 last_column: this.yylloc.last_column
15468 },
15469 yytext: this.yytext,
15470 match: this.match,
15471 matches: this.matches,
15472 matched: this.matched,
15473 yyleng: this.yyleng,
15474 offset: this.offset,
15475 _more: this._more,
15476 _input: this._input,
15477 yy: this.yy,
15478 conditionStack: this.conditionStack.slice(0),
15479 done: this.done
15480 };
15481 if (this.options.ranges) {
15482 backup.yylloc.range = this.yylloc.range.slice(0);
15483 }
15484 }
15485
15486 lines = match[0].match(/(?:\r\n?|\n).*/g);
15487 if (lines) {
15488 this.yylineno += lines.length;
15489 }
15490 this.yylloc = {
15491 first_line: this.yylloc.last_line,
15492 last_line: this.yylineno + 1,
15493 first_column: this.yylloc.last_column,
15494 last_column: lines ?
15495 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
15496 this.yylloc.last_column + match[0].length
15497 };
15498 this.yytext += match[0];
15499 this.match += match[0];
15500 this.matches = match;
15501 this.yyleng = this.yytext.length;
15502 if (this.options.ranges) {
15503 this.yylloc.range = [this.offset, this.offset += this.yyleng];
15504 }
15505 this._more = false;
15506 this._backtrack = false;
15507 this._input = this._input.slice(match[0].length);
15508 this.matched += match[0];
15509 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
15510 if (this.done && this._input) {
15511 this.done = false;
15512 }
15513 if (token) {
15514 return token;
15515 } else if (this._backtrack) {
15516 // recover context
15517 for (var k in backup) {
15518 this[k] = backup[k];
15519 }
15520 return false; // rule action called reject() implying the next rule should be tested instead.
15521 }
15522 return false;
15523 },
15524
15525// return next match in input
15526next:function () {
15527 if (this.done) {
15528 return this.EOF;
15529 }
15530 if (!this._input) {
15531 this.done = true;
15532 }
15533
15534 var token,
15535 match,
15536 tempMatch,
15537 index;
15538 if (!this._more) {
15539 this.yytext = '';
15540 this.match = '';
15541 }
15542 var rules = this._currentRules();
15543 for (var i = 0; i < rules.length; i++) {
15544 tempMatch = this._input.match(this.rules[rules[i]]);
15545 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
15546 match = tempMatch;
15547 index = i;
15548 if (this.options.backtrack_lexer) {
15549 token = this.test_match(tempMatch, rules[i]);
15550 if (token !== false) {
15551 return token;
15552 } else if (this._backtrack) {
15553 match = false;
15554 continue; // rule action called reject() implying a rule MISmatch.
15555 } else {
15556 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
15557 return false;
15558 }
15559 } else if (!this.options.flex) {
15560 break;
15561 }
15562 }
15563 }
15564 if (match) {
15565 token = this.test_match(match, rules[index]);
15566 if (token !== false) {
15567 return token;
15568 }
15569 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
15570 return false;
15571 }
15572 if (this._input === "") {
15573 return this.EOF;
15574 } else {
15575 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
15576 text: "",
15577 token: null,
15578 line: this.yylineno
15579 });
15580 }
15581 },
15582
15583// return next match that has a token
15584lex:function lex () {
15585 var r = this.next();
15586 if (r) {
15587 return r;
15588 } else {
15589 return this.lex();
15590 }
15591 },
15592
15593// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
15594begin:function begin (condition) {
15595 this.conditionStack.push(condition);
15596 },
15597
15598// pop the previously active lexer condition state off the condition stack
15599popState:function popState () {
15600 var n = this.conditionStack.length - 1;
15601 if (n > 0) {
15602 return this.conditionStack.pop();
15603 } else {
15604 return this.conditionStack[0];
15605 }
15606 },
15607
15608// produce the lexer rule set which is active for the currently active lexer condition state
15609_currentRules:function _currentRules () {
15610 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
15611 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
15612 } else {
15613 return this.conditions["INITIAL"].rules;
15614 }
15615 },
15616
15617// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
15618topState:function topState (n) {
15619 n = this.conditionStack.length - 1 - Math.abs(n || 0);
15620 if (n >= 0) {
15621 return this.conditionStack[n];
15622 } else {
15623 return "INITIAL";
15624 }
15625 },
15626
15627// alias for begin(condition)
15628pushState:function pushState (condition) {
15629 this.begin(condition);
15630 },
15631
15632// return the number of states currently on the stack
15633stateStackSize:function stateStackSize() {
15634 return this.conditionStack.length;
15635 },
15636options: {"case-insensitive":true},
15637performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
15638var YYSTATE=YY_START;
15639switch($avoiding_name_collisions) {
15640case 0: this.begin('open_directive'); return 22;
15641break;
15642case 1: this.begin('type_directive'); return 23;
15643break;
15644case 2: this.popState(); this.begin('arg_directive'); return 17;
15645break;
15646case 3: this.popState(); this.popState(); return 25;
15647break;
15648case 4:return 24;
15649break;
15650case 5:/* skip comments */
15651break;
15652case 6:/* skip comments */{ console.log('Crap after close'); }
15653break;
15654case 7:return 19;
15655break;
15656case 8:/* do nothing */
15657break;
15658case 9:/* ignore */
15659break;
15660case 10: this.begin("title");return 12;
15661break;
15662case 11: this.popState(); return "title_value";
15663break;
15664case 12: this.begin("string");
15665break;
15666case 13: this.popState();
15667break;
15668case 14: return "txt";
15669break;
15670case 15:return 6;
15671break;
15672case 16:return "value";
15673break;
15674case 17:return 21;
15675break;
15676}
15677},
15678rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[\s]+)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:pie\b)/i,/^(?::[\s]*[\d]+(?:\.[\d]+)?)/i,/^(?:$)/i],
15679conditions: {"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"title":{"rules":[11],"inclusive":false},"string":{"rules":[13,14],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,12,15,16,17],"inclusive":true}}
15680});
15681return lexer;
15682})();
15683parser.lexer = lexer;
15684function Parser () {
15685 this.yy = {};
15686}
15687Parser.prototype = parser;parser.Parser = Parser;
15688return new Parser;
15689})();
15690
15691
15692if (true) {
15693exports.parser = parser;
15694exports.Parser = parser.Parser;
15695exports.parse = function () { return parser.parse.apply(parser, arguments); };
15696exports.main = function commonjsMain (args) {
15697 if (!args[1]) {
15698 console.log('Usage: '+args[0]+' FILE');
15699 process.exit(1);
15700 }
15701 var source = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
15702 return exports.parser.parse(source);
15703};
15704if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
15705 exports.main(process.argv.slice(1));
15706}
15707}
15708/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
15709
15710/***/ }),
15711
15712/***/ "./src/diagrams/pie/pieDb.js":
15713/*!***********************************!*\
15714 !*** ./src/diagrams/pie/pieDb.js ***!
15715 \***********************************/
15716/*! exports provided: parseDirective, default */
15717/***/ (function(module, __webpack_exports__, __webpack_require__) {
15718
15719"use strict";
15720__webpack_require__.r(__webpack_exports__);
15721/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
15722/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
15723/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
15724/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
15725/**
15726 *
15727 */
15728
15729
15730
15731var sections = {};
15732var title = '';
15733var parseDirective = function parseDirective(statement, context, type) {
15734 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].parseDirective(this, statement, context, type);
15735};
15736
15737var addSection = function addSection(id, value) {
15738 if (typeof sections[id] === 'undefined') {
15739 sections[id] = value;
15740 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Added new section :', id);
15741 }
15742};
15743
15744var getSections = function getSections() {
15745 return sections;
15746};
15747
15748var setTitle = function setTitle(txt) {
15749 title = txt;
15750};
15751
15752var getTitle = function getTitle() {
15753 return title;
15754};
15755
15756var cleanupValue = function cleanupValue(value) {
15757 if (value.substring(0, 1) === ':') {
15758 value = value.substring(1).trim();
15759 return Number(value.trim());
15760 } else {
15761 return Number(value.trim());
15762 }
15763};
15764
15765var clear = function clear() {
15766 sections = {};
15767 title = '';
15768}; // export const parseError = (err, hash) => {
15769// global.mermaidAPI.parseError(err, hash)
15770// }
15771
15772
15773/* harmony default export */ __webpack_exports__["default"] = ({
15774 parseDirective: parseDirective,
15775 getConfig: function getConfig() {
15776 return _config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]().pie;
15777 },
15778 addSection: addSection,
15779 getSections: getSections,
15780 cleanupValue: cleanupValue,
15781 clear: clear,
15782 setTitle: setTitle,
15783 getTitle: getTitle // parseError
15784
15785});
15786
15787/***/ }),
15788
15789/***/ "./src/diagrams/pie/pieRenderer.js":
15790/*!*****************************************!*\
15791 !*** ./src/diagrams/pie/pieRenderer.js ***!
15792 \*****************************************/
15793/*! exports provided: setConf, draw, default */
15794/***/ (function(module, __webpack_exports__, __webpack_require__) {
15795
15796"use strict";
15797__webpack_require__.r(__webpack_exports__);
15798/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
15799/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
15800/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
15801/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
15802/* harmony import */ var _pieDb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pieDb */ "./src/diagrams/pie/pieDb.js");
15803/* harmony import */ var _parser_pie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./parser/pie */ "./src/diagrams/pie/parser/pie.jison");
15804/* harmony import */ var _parser_pie__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_parser_pie__WEBPACK_IMPORTED_MODULE_2__);
15805/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
15806/**
15807 * Created by AshishJ on 11-09-2019.
15808 */
15809
15810
15811
15812
15813var conf = {};
15814var setConf = function setConf(cnf) {
15815 var keys = Object.keys(cnf);
15816 keys.forEach(function (key) {
15817 conf[key] = cnf[key];
15818 });
15819};
15820/**
15821 * Draws a Pie Chart with the data given in text.
15822 * @param text
15823 * @param id
15824 */
15825
15826var w;
15827var draw = function draw(txt, id) {
15828 try {
15829 var parser = _parser_pie__WEBPACK_IMPORTED_MODULE_2___default.a.parser;
15830 parser.yy = _pieDb__WEBPACK_IMPORTED_MODULE_1__["default"];
15831 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Rendering info diagram\n' + txt); // Parse the Pie Chart definition
15832
15833 parser.yy.clear();
15834 parser.parse(txt);
15835 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Parsed info diagram');
15836 var elem = document.getElementById(id);
15837 w = elem.parentElement.offsetWidth;
15838
15839 if (typeof w === 'undefined') {
15840 w = 1200;
15841 }
15842
15843 if (typeof conf.useWidth !== 'undefined') {
15844 w = conf.useWidth;
15845 }
15846
15847 var h = 450;
15848 elem.setAttribute('height', '100%'); // Set viewBox
15849
15850 elem.setAttribute('viewBox', '0 0 ' + w + ' ' + h); // Fetch the default direction, use TD if none was found
15851
15852 var width = w; // 450
15853
15854 var height = 450;
15855 var margin = 40;
15856 var legendRectSize = 18;
15857 var legendSpacing = 4;
15858 var radius = Math.min(width, height) / 2 - margin;
15859 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + id).append('svg').attr('width', width).attr('height', height).append('g').attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');
15860 var data = _pieDb__WEBPACK_IMPORTED_MODULE_1__["default"].getSections();
15861 var sum = 0;
15862 Object.keys(data).forEach(function (key) {
15863 sum += data[key];
15864 });
15865 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info(data); // set the color scale
15866
15867 var color = Object(d3__WEBPACK_IMPORTED_MODULE_0__["scaleOrdinal"])().domain(data).range(d3__WEBPACK_IMPORTED_MODULE_0__["schemeSet2"]); // Compute the position of each group on the pie:
15868
15869 var pie = Object(d3__WEBPACK_IMPORTED_MODULE_0__["pie"])().value(function (d) {
15870 return d.value;
15871 });
15872 var dataReady = pie(Object(d3__WEBPACK_IMPORTED_MODULE_0__["entries"])(data)); // shape helper to build arcs:
15873
15874 var arcGenerator = Object(d3__WEBPACK_IMPORTED_MODULE_0__["arc"])().innerRadius(0).outerRadius(radius); // Build the pie chart: Basically, each part of the pie is a path that we build using the arc function.
15875
15876 svg.selectAll('mySlices').data(dataReady).enter().append('path').attr('d', arcGenerator).attr('fill', function (d) {
15877 return color(d.data.key);
15878 }).attr('stroke', 'black').style('stroke-width', '2px').style('opacity', 0.7); // Now add the Percentage. Use the centroid method to get the best coordinates
15879
15880 svg.selectAll('mySlices').data(dataReady).enter().append('text').text(function (d) {
15881 return (d.data.value / sum * 100).toFixed(0) + '%';
15882 }).attr('transform', function (d) {
15883 return 'translate(' + arcGenerator.centroid(d) + ')';
15884 }).style('text-anchor', 'middle').attr('class', 'slice').style('font-size', 17);
15885 svg.append('text').text(parser.yy.getTitle()).attr('x', 0).attr('y', -(h - 50) / 2).attr('class', 'pieTitleText'); //Add the slegend/annotations for each section
15886
15887 var legend = svg.selectAll('.legend').data(color.domain()).enter().append('g').attr('class', 'legend').attr('transform', function (d, i) {
15888 var height = legendRectSize + legendSpacing;
15889 var offset = height * color.domain().length / 2;
15890 var horz = 12 * legendRectSize;
15891 var vert = i * height - offset;
15892 return 'translate(' + horz + ',' + vert + ')';
15893 });
15894 legend.append('rect').attr('width', legendRectSize).attr('height', legendRectSize).style('fill', color).style('stroke', color);
15895 legend.append('text').attr('x', legendRectSize + legendSpacing).attr('y', legendRectSize - legendSpacing).text(function (d) {
15896 return d;
15897 });
15898 } catch (e) {
15899 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error('Error while rendering info diagram');
15900 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error(e);
15901 }
15902};
15903/* harmony default export */ __webpack_exports__["default"] = ({
15904 setConf: setConf,
15905 draw: draw
15906});
15907
15908/***/ }),
15909
15910/***/ "./src/diagrams/pie/styles.js":
15911/*!************************************!*\
15912 !*** ./src/diagrams/pie/styles.js ***!
15913 \************************************/
15914/*! exports provided: default */
15915/***/ (function(module, __webpack_exports__, __webpack_require__) {
15916
15917"use strict";
15918__webpack_require__.r(__webpack_exports__);
15919var getStyles = function getStyles(options) {
15920 return ".pieTitleText {\n text-anchor: middle;\n font-size: 25px;\n fill: ".concat(options.taskTextDarkColor, ";\n font-family: ").concat(options.fontFamily, ";\n }\n .slice {\n font-family: ").concat(options.fontFamily, ";\n fill: ").concat(options.textColor, ";\n // fill: white;\n }\n .legend text {\n fill: ").concat(options.taskTextDarkColor, ";\n font-family: ").concat(options.fontFamily, ";\n font-size: 17px;\n }\n");
15921};
15922
15923/* harmony default export */ __webpack_exports__["default"] = (getStyles);
15924
15925/***/ }),
15926
15927/***/ "./src/diagrams/sequence/parser/sequenceDiagram.jison":
15928/*!************************************************************!*\
15929 !*** ./src/diagrams/sequence/parser/sequenceDiagram.jison ***!
15930 \************************************************************/
15931/*! no static exports found */
15932/***/ (function(module, exports, __webpack_require__) {
15933
15934/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
15935/*
15936 Returns a Parser object of the following structure:
15937
15938 Parser: {
15939 yy: {}
15940 }
15941
15942 Parser.prototype: {
15943 yy: {},
15944 trace: function(),
15945 symbols_: {associative list: name ==> number},
15946 terminals_: {associative list: number ==> name},
15947 productions_: [...],
15948 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
15949 table: [...],
15950 defaultActions: {...},
15951 parseError: function(str, hash),
15952 parse: function(input),
15953
15954 lexer: {
15955 EOF: 1,
15956 parseError: function(str, hash),
15957 setInput: function(input),
15958 input: function(),
15959 unput: function(str),
15960 more: function(),
15961 less: function(n),
15962 pastInput: function(),
15963 upcomingInput: function(),
15964 showPosition: function(),
15965 test_match: function(regex_match_array, rule_index),
15966 next: function(),
15967 lex: function(),
15968 begin: function(condition),
15969 popState: function(),
15970 _currentRules: function(),
15971 topState: function(),
15972 pushState: function(condition),
15973
15974 options: {
15975 ranges: boolean (optional: true ==> token location info will include a .range[] member)
15976 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
15977 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
15978 },
15979
15980 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
15981 rules: [...],
15982 conditions: {associative list: name ==> set},
15983 }
15984 }
15985
15986
15987 token location info (@$, _$, etc.): {
15988 first_line: n,
15989 last_line: n,
15990 first_column: n,
15991 last_column: n,
15992 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
15993 }
15994
15995
15996 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
15997 text: (matched text)
15998 token: (the produced terminal token, if any)
15999 line: (yylineno)
16000 }
16001 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
16002 loc: (yylloc)
16003 expected: (string describing the set of expected tokens)
16004 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
16005 }
16006*/
16007var parser = (function(){
16008var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,3],$V2=[1,5],$V3=[1,7],$V4=[2,5],$V5=[1,15],$V6=[1,17],$V7=[1,18],$V8=[1,20],$V9=[1,21],$Va=[1,22],$Vb=[1,24],$Vc=[1,25],$Vd=[1,26],$Ve=[1,27],$Vf=[1,28],$Vg=[1,29],$Vh=[1,32],$Vi=[1,33],$Vj=[1,36],$Vk=[1,4,5,16,21,22,23,25,27,28,29,30,31,33,35,36,37,48,56],$Vl=[1,44],$Vm=[4,5,16,21,22,23,25,27,28,29,30,31,33,37,48,56],$Vn=[4,5,16,21,22,23,25,27,28,29,30,31,33,36,37,48,56],$Vo=[4,5,16,21,22,23,25,27,28,29,30,31,33,35,37,48,56],$Vp=[46,47,48],$Vq=[1,4,5,7,16,21,22,23,25,27,28,29,30,31,33,35,36,37,48,56];
16009var parser = {trace: function trace () { },
16010yy: {},
16011symbols_: {"error":2,"start":3,"SPACE":4,"NEWLINE":5,"directive":6,"SD":7,"document":8,"line":9,"statement":10,"openDirective":11,"typeDirective":12,"closeDirective":13,":":14,"argDirective":15,"participant":16,"actor":17,"AS":18,"restOfLine":19,"signal":20,"autonumber":21,"activate":22,"deactivate":23,"note_statement":24,"title":25,"text2":26,"loop":27,"end":28,"rect":29,"opt":30,"alt":31,"else_sections":32,"par":33,"par_sections":34,"and":35,"else":36,"note":37,"placement":38,"over":39,"actor_pair":40,"spaceList":41,",":42,"left_of":43,"right_of":44,"signaltype":45,"+":46,"-":47,"ACTOR":48,"SOLID_OPEN_ARROW":49,"DOTTED_OPEN_ARROW":50,"SOLID_ARROW":51,"DOTTED_ARROW":52,"SOLID_CROSS":53,"DOTTED_CROSS":54,"TXT":55,"open_directive":56,"type_directive":57,"arg_directive":58,"close_directive":59,"$accept":0,"$end":1},
16012terminals_: {2:"error",4:"SPACE",5:"NEWLINE",7:"SD",14:":",16:"participant",18:"AS",19:"restOfLine",21:"autonumber",22:"activate",23:"deactivate",25:"title",27:"loop",28:"end",29:"rect",30:"opt",31:"alt",33:"par",35:"and",36:"else",37:"note",39:"over",42:",",43:"left_of",44:"right_of",46:"+",47:"-",48:"ACTOR",49:"SOLID_OPEN_ARROW",50:"DOTTED_OPEN_ARROW",51:"SOLID_ARROW",52:"DOTTED_ARROW",53:"SOLID_CROSS",54:"DOTTED_CROSS",55:"TXT",56:"open_directive",57:"type_directive",58:"arg_directive",59:"close_directive"},
16013productions_: [0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[6,4],[6,6],[10,5],[10,3],[10,2],[10,1],[10,3],[10,3],[10,2],[10,3],[10,4],[10,4],[10,4],[10,4],[10,4],[10,1],[34,1],[34,4],[32,1],[32,4],[24,4],[24,4],[41,2],[41,1],[40,3],[40,1],[38,1],[38,1],[20,5],[20,5],[20,4],[17,1],[45,1],[45,1],[45,1],[45,1],[45,1],[45,1],[26,1],[11,1],[12,1],[15,1],[13,1]],
16014performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
16015/* this == yyval */
16016
16017var $0 = $$.length - 1;
16018switch (yystate) {
16019case 4:
16020 yy.apply($$[$0]);return $$[$0];
16021break;
16022case 5:
16023 this.$ = []
16024break;
16025case 6:
16026$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
16027break;
16028case 7: case 8:
16029 this.$ = $$[$0]
16030break;
16031case 9:
16032 this.$=[];
16033break;
16034case 12:
16035$$[$0-3].description=yy.parseMessage($$[$0-1]); this.$=$$[$0-3];
16036break;
16037case 13:
16038this.$=$$[$0-1];
16039break;
16040case 15:
16041yy.enableSequenceNumbers()
16042break;
16043case 16:
16044this.$={type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]};
16045break;
16046case 17:
16047this.$={type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-1]};
16048break;
16049case 19:
16050this.$=[{type:'setTitle', text:$$[$0-1]}]
16051break;
16052case 20:
16053
16054 $$[$0-1].unshift({type: 'loopStart', loopText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.LOOP_START});
16055 $$[$0-1].push({type: 'loopEnd', loopText:$$[$0-2], signalType: yy.LINETYPE.LOOP_END});
16056 this.$=$$[$0-1];
16057break;
16058case 21:
16059
16060 $$[$0-1].unshift({type: 'rectStart', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_START });
16061 $$[$0-1].push({type: 'rectEnd', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_END });
16062 this.$=$$[$0-1];
16063break;
16064case 22:
16065
16066 $$[$0-1].unshift({type: 'optStart', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_START});
16067 $$[$0-1].push({type: 'optEnd', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_END});
16068 this.$=$$[$0-1];
16069break;
16070case 23:
16071
16072 // Alt start
16073 $$[$0-1].unshift({type: 'altStart', altText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.ALT_START});
16074 // Content in alt is already in $$[$0-1]
16075 // End
16076 $$[$0-1].push({type: 'altEnd', signalType: yy.LINETYPE.ALT_END});
16077 this.$=$$[$0-1];
16078break;
16079case 24:
16080
16081 // Parallel start
16082 $$[$0-1].unshift({type: 'parStart', parText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.PAR_START});
16083 // Content in par is already in $$[$0-1]
16084 // End
16085 $$[$0-1].push({type: 'parEnd', signalType: yy.LINETYPE.PAR_END});
16086 this.$=$$[$0-1];
16087break;
16088case 27:
16089 this.$ = $$[$0-3].concat([{type: 'and', parText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.PAR_AND}, $$[$0]]);
16090break;
16091case 29:
16092 this.$ = $$[$0-3].concat([{type: 'else', altText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.ALT_ELSE}, $$[$0]]);
16093break;
16094case 30:
16095
16096 this.$ = [$$[$0-1], {type:'addNote', placement:$$[$0-2], actor:$$[$0-1].actor, text:$$[$0]}];
16097break;
16098case 31:
16099
16100 // Coerce actor_pair into a [to, from, ...] array
16101 $$[$0-2] = [].concat($$[$0-1], $$[$0-1]).slice(0, 2);
16102 $$[$0-2][0] = $$[$0-2][0].actor;
16103 $$[$0-2][1] = $$[$0-2][1].actor;
16104 this.$ = [$$[$0-1], {type:'addNote', placement:yy.PLACEMENT.OVER, actor:$$[$0-2].slice(0, 2), text:$$[$0]}];
16105break;
16106case 34:
16107 this.$ = [$$[$0-2], $$[$0]];
16108break;
16109case 35:
16110 this.$ = $$[$0];
16111break;
16112case 36:
16113 this.$ = yy.PLACEMENT.LEFTOF;
16114break;
16115case 37:
16116 this.$ = yy.PLACEMENT.RIGHTOF;
16117break;
16118case 38:
16119 this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]},
16120 {type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]}
16121 ]
16122break;
16123case 39:
16124 this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]},
16125 {type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-4]}
16126 ]
16127break;
16128case 40:
16129 this.$ = [$$[$0-3],$$[$0-1],{type: 'addMessage', from:$$[$0-3].actor, to:$$[$0-1].actor, signalType:$$[$0-2], msg:$$[$0]}]
16130break;
16131case 41:
16132this.$={type: 'addActor', actor:$$[$0]}
16133break;
16134case 42:
16135 this.$ = yy.LINETYPE.SOLID_OPEN;
16136break;
16137case 43:
16138 this.$ = yy.LINETYPE.DOTTED_OPEN;
16139break;
16140case 44:
16141 this.$ = yy.LINETYPE.SOLID;
16142break;
16143case 45:
16144 this.$ = yy.LINETYPE.DOTTED;
16145break;
16146case 46:
16147 this.$ = yy.LINETYPE.SOLID_CROSS;
16148break;
16149case 47:
16150 this.$ = yy.LINETYPE.DOTTED_CROSS;
16151break;
16152case 48:
16153this.$ = yy.parseMessage($$[$0].trim().substring(1))
16154break;
16155case 49:
16156 yy.parseDirective('%%{', 'open_directive');
16157break;
16158case 50:
16159 yy.parseDirective($$[$0], 'type_directive');
16160break;
16161case 51:
16162 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
16163break;
16164case 52:
16165 yy.parseDirective('}%%', 'close_directive', 'sequence');
16166break;
16167}
16168},
16169table: [{3:1,4:$V0,5:$V1,6:4,7:$V2,11:6,56:$V3},{1:[3]},{3:8,4:$V0,5:$V1,6:4,7:$V2,11:6,56:$V3},{3:9,4:$V0,5:$V1,6:4,7:$V2,11:6,56:$V3},{3:10,4:$V0,5:$V1,6:4,7:$V2,11:6,56:$V3},o([1,4,5,16,21,22,23,25,27,29,30,31,33,37,48,56],$V4,{8:11}),{12:12,57:[1,13]},{57:[2,49]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:$V5,5:$V6,6:30,9:14,10:16,11:6,16:$V7,17:31,20:19,21:$V8,22:$V9,23:$Va,24:23,25:$Vb,27:$Vc,29:$Vd,30:$Ve,31:$Vf,33:$Vg,37:$Vh,48:$Vi,56:$V3},{13:34,14:[1,35],59:$Vj},o([14,59],[2,50]),o($Vk,[2,6]),{6:30,10:37,11:6,16:$V7,17:31,20:19,21:$V8,22:$V9,23:$Va,24:23,25:$Vb,27:$Vc,29:$Vd,30:$Ve,31:$Vf,33:$Vg,37:$Vh,48:$Vi,56:$V3},o($Vk,[2,8]),o($Vk,[2,9]),{17:38,48:$Vi},{5:[1,39]},o($Vk,[2,15]),{17:40,48:$Vi},{17:41,48:$Vi},{5:[1,42]},{26:43,55:$Vl},{19:[1,45]},{19:[1,46]},{19:[1,47]},{19:[1,48]},{19:[1,49]},o($Vk,[2,25]),{45:50,49:[1,51],50:[1,52],51:[1,53],52:[1,54],53:[1,55],54:[1,56]},{38:57,39:[1,58],43:[1,59],44:[1,60]},o([5,18,42,49,50,51,52,53,54,55],[2,41]),{5:[1,61]},{15:62,58:[1,63]},{5:[2,52]},o($Vk,[2,7]),{5:[1,65],18:[1,64]},o($Vk,[2,14]),{5:[1,66]},{5:[1,67]},o($Vk,[2,18]),{5:[1,68]},{5:[2,48]},o($Vm,$V4,{8:69}),o($Vm,$V4,{8:70}),o($Vm,$V4,{8:71}),o($Vn,$V4,{32:72,8:73}),o($Vo,$V4,{34:74,8:75}),{17:78,46:[1,76],47:[1,77],48:$Vi},o($Vp,[2,42]),o($Vp,[2,43]),o($Vp,[2,44]),o($Vp,[2,45]),o($Vp,[2,46]),o($Vp,[2,47]),{17:79,48:$Vi},{17:81,40:80,48:$Vi},{48:[2,36]},{48:[2,37]},o($Vq,[2,10]),{13:82,59:$Vj},{59:[2,51]},{19:[1,83]},o($Vk,[2,13]),o($Vk,[2,16]),o($Vk,[2,17]),o($Vk,[2,19]),{4:$V5,5:$V6,6:30,9:14,10:16,11:6,16:$V7,17:31,20:19,21:$V8,22:$V9,23:$Va,24:23,25:$Vb,27:$Vc,28:[1,84],29:$Vd,30:$Ve,31:$Vf,33:$Vg,37:$Vh,48:$Vi,56:$V3},{4:$V5,5:$V6,6:30,9:14,10:16,11:6,16:$V7,17:31,20:19,21:$V8,22:$V9,23:$Va,24:23,25:$Vb,27:$Vc,28:[1,85],29:$Vd,30:$Ve,31:$Vf,33:$Vg,37:$Vh,48:$Vi,56:$V3},{4:$V5,5:$V6,6:30,9:14,10:16,11:6,16:$V7,17:31,20:19,21:$V8,22:$V9,23:$Va,24:23,25:$Vb,27:$Vc,28:[1,86],29:$Vd,30:$Ve,31:$Vf,33:$Vg,37:$Vh,48:$Vi,56:$V3},{28:[1,87]},{4:$V5,5:$V6,6:30,9:14,10:16,11:6,16:$V7,17:31,20:19,21:$V8,22:$V9,23:$Va,24:23,25:$Vb,27:$Vc,28:[2,28],29:$Vd,30:$Ve,31:$Vf,33:$Vg,36:[1,88],37:$Vh,48:$Vi,56:$V3},{28:[1,89]},{4:$V5,5:$V6,6:30,9:14,10:16,11:6,16:$V7,17:31,20:19,21:$V8,22:$V9,23:$Va,24:23,25:$Vb,27:$Vc,28:[2,26],29:$Vd,30:$Ve,31:$Vf,33:$Vg,35:[1,90],37:$Vh,48:$Vi,56:$V3},{17:91,48:$Vi},{17:92,48:$Vi},{26:93,55:$Vl},{26:94,55:$Vl},{26:95,55:$Vl},{42:[1,96],55:[2,35]},{5:[1,97]},{5:[1,98]},o($Vk,[2,20]),o($Vk,[2,21]),o($Vk,[2,22]),o($Vk,[2,23]),{19:[1,99]},o($Vk,[2,24]),{19:[1,100]},{26:101,55:$Vl},{26:102,55:$Vl},{5:[2,40]},{5:[2,30]},{5:[2,31]},{17:103,48:$Vi},o($Vq,[2,11]),o($Vk,[2,12]),o($Vn,$V4,{8:73,32:104}),o($Vo,$V4,{8:75,34:105}),{5:[2,38]},{5:[2,39]},{55:[2,34]},{28:[2,29]},{28:[2,27]}],
16170defaultActions: {7:[2,49],8:[2,1],9:[2,2],10:[2,3],36:[2,52],44:[2,48],59:[2,36],60:[2,37],63:[2,51],93:[2,40],94:[2,30],95:[2,31],101:[2,38],102:[2,39],103:[2,34],104:[2,29],105:[2,27]},
16171parseError: function parseError (str, hash) {
16172 if (hash.recoverable) {
16173 this.trace(str);
16174 } else {
16175 var error = new Error(str);
16176 error.hash = hash;
16177 throw error;
16178 }
16179},
16180parse: function parse(input) {
16181 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
16182 var args = lstack.slice.call(arguments, 1);
16183 var lexer = Object.create(this.lexer);
16184 var sharedState = { yy: {} };
16185 for (var k in this.yy) {
16186 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
16187 sharedState.yy[k] = this.yy[k];
16188 }
16189 }
16190 lexer.setInput(input, sharedState.yy);
16191 sharedState.yy.lexer = lexer;
16192 sharedState.yy.parser = this;
16193 if (typeof lexer.yylloc == 'undefined') {
16194 lexer.yylloc = {};
16195 }
16196 var yyloc = lexer.yylloc;
16197 lstack.push(yyloc);
16198 var ranges = lexer.options && lexer.options.ranges;
16199 if (typeof sharedState.yy.parseError === 'function') {
16200 this.parseError = sharedState.yy.parseError;
16201 } else {
16202 this.parseError = Object.getPrototypeOf(this).parseError;
16203 }
16204 function popStack(n) {
16205 stack.length = stack.length - 2 * n;
16206 vstack.length = vstack.length - n;
16207 lstack.length = lstack.length - n;
16208 }
16209 function lex() {
16210 var token;
16211 token = tstack.pop() || lexer.lex() || EOF;
16212 if (typeof token !== 'number') {
16213 if (token instanceof Array) {
16214 tstack = token;
16215 token = tstack.pop();
16216 }
16217 token = self.symbols_[token] || token;
16218 }
16219 return token;
16220 }
16221 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
16222 while (true) {
16223 state = stack[stack.length - 1];
16224 if (this.defaultActions[state]) {
16225 action = this.defaultActions[state];
16226 } else {
16227 if (symbol === null || typeof symbol == 'undefined') {
16228 symbol = lex();
16229 }
16230 action = table[state] && table[state][symbol];
16231 }
16232 if (typeof action === 'undefined' || !action.length || !action[0]) {
16233 var errStr = '';
16234 expected = [];
16235 for (p in table[state]) {
16236 if (this.terminals_[p] && p > TERROR) {
16237 expected.push('\'' + this.terminals_[p] + '\'');
16238 }
16239 }
16240 if (lexer.showPosition) {
16241 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
16242 } else {
16243 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
16244 }
16245 this.parseError(errStr, {
16246 text: lexer.match,
16247 token: this.terminals_[symbol] || symbol,
16248 line: lexer.yylineno,
16249 loc: yyloc,
16250 expected: expected
16251 });
16252 }
16253 if (action[0] instanceof Array && action.length > 1) {
16254 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
16255 }
16256 switch (action[0]) {
16257 case 1:
16258 stack.push(symbol);
16259 vstack.push(lexer.yytext);
16260 lstack.push(lexer.yylloc);
16261 stack.push(action[1]);
16262 symbol = null;
16263 if (!preErrorSymbol) {
16264 yyleng = lexer.yyleng;
16265 yytext = lexer.yytext;
16266 yylineno = lexer.yylineno;
16267 yyloc = lexer.yylloc;
16268 if (recovering > 0) {
16269 recovering--;
16270 }
16271 } else {
16272 symbol = preErrorSymbol;
16273 preErrorSymbol = null;
16274 }
16275 break;
16276 case 2:
16277 len = this.productions_[action[1]][1];
16278 yyval.$ = vstack[vstack.length - len];
16279 yyval._$ = {
16280 first_line: lstack[lstack.length - (len || 1)].first_line,
16281 last_line: lstack[lstack.length - 1].last_line,
16282 first_column: lstack[lstack.length - (len || 1)].first_column,
16283 last_column: lstack[lstack.length - 1].last_column
16284 };
16285 if (ranges) {
16286 yyval._$.range = [
16287 lstack[lstack.length - (len || 1)].range[0],
16288 lstack[lstack.length - 1].range[1]
16289 ];
16290 }
16291 r = this.performAction.apply(yyval, [
16292 yytext,
16293 yyleng,
16294 yylineno,
16295 sharedState.yy,
16296 action[1],
16297 vstack,
16298 lstack
16299 ].concat(args));
16300 if (typeof r !== 'undefined') {
16301 return r;
16302 }
16303 if (len) {
16304 stack = stack.slice(0, -1 * len * 2);
16305 vstack = vstack.slice(0, -1 * len);
16306 lstack = lstack.slice(0, -1 * len);
16307 }
16308 stack.push(this.productions_[action[1]][0]);
16309 vstack.push(yyval.$);
16310 lstack.push(yyval._$);
16311 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
16312 stack.push(newState);
16313 break;
16314 case 3:
16315 return true;
16316 }
16317 }
16318 return true;
16319}};
16320
16321/* generated by jison-lex 0.3.4 */
16322var lexer = (function(){
16323var lexer = ({
16324
16325EOF:1,
16326
16327parseError:function parseError(str, hash) {
16328 if (this.yy.parser) {
16329 this.yy.parser.parseError(str, hash);
16330 } else {
16331 throw new Error(str);
16332 }
16333 },
16334
16335// resets the lexer, sets new input
16336setInput:function (input, yy) {
16337 this.yy = yy || this.yy || {};
16338 this._input = input;
16339 this._more = this._backtrack = this.done = false;
16340 this.yylineno = this.yyleng = 0;
16341 this.yytext = this.matched = this.match = '';
16342 this.conditionStack = ['INITIAL'];
16343 this.yylloc = {
16344 first_line: 1,
16345 first_column: 0,
16346 last_line: 1,
16347 last_column: 0
16348 };
16349 if (this.options.ranges) {
16350 this.yylloc.range = [0,0];
16351 }
16352 this.offset = 0;
16353 return this;
16354 },
16355
16356// consumes and returns one char from the input
16357input:function () {
16358 var ch = this._input[0];
16359 this.yytext += ch;
16360 this.yyleng++;
16361 this.offset++;
16362 this.match += ch;
16363 this.matched += ch;
16364 var lines = ch.match(/(?:\r\n?|\n).*/g);
16365 if (lines) {
16366 this.yylineno++;
16367 this.yylloc.last_line++;
16368 } else {
16369 this.yylloc.last_column++;
16370 }
16371 if (this.options.ranges) {
16372 this.yylloc.range[1]++;
16373 }
16374
16375 this._input = this._input.slice(1);
16376 return ch;
16377 },
16378
16379// unshifts one char (or a string) into the input
16380unput:function (ch) {
16381 var len = ch.length;
16382 var lines = ch.split(/(?:\r\n?|\n)/g);
16383
16384 this._input = ch + this._input;
16385 this.yytext = this.yytext.substr(0, this.yytext.length - len);
16386 //this.yyleng -= len;
16387 this.offset -= len;
16388 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
16389 this.match = this.match.substr(0, this.match.length - 1);
16390 this.matched = this.matched.substr(0, this.matched.length - 1);
16391
16392 if (lines.length - 1) {
16393 this.yylineno -= lines.length - 1;
16394 }
16395 var r = this.yylloc.range;
16396
16397 this.yylloc = {
16398 first_line: this.yylloc.first_line,
16399 last_line: this.yylineno + 1,
16400 first_column: this.yylloc.first_column,
16401 last_column: lines ?
16402 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
16403 + oldLines[oldLines.length - lines.length].length - lines[0].length :
16404 this.yylloc.first_column - len
16405 };
16406
16407 if (this.options.ranges) {
16408 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
16409 }
16410 this.yyleng = this.yytext.length;
16411 return this;
16412 },
16413
16414// When called from action, caches matched text and appends it on next action
16415more:function () {
16416 this._more = true;
16417 return this;
16418 },
16419
16420// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
16421reject:function () {
16422 if (this.options.backtrack_lexer) {
16423 this._backtrack = true;
16424 } else {
16425 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
16426 text: "",
16427 token: null,
16428 line: this.yylineno
16429 });
16430
16431 }
16432 return this;
16433 },
16434
16435// retain first n characters of the match
16436less:function (n) {
16437 this.unput(this.match.slice(n));
16438 },
16439
16440// displays already matched input, i.e. for error messages
16441pastInput:function () {
16442 var past = this.matched.substr(0, this.matched.length - this.match.length);
16443 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
16444 },
16445
16446// displays upcoming input, i.e. for error messages
16447upcomingInput:function () {
16448 var next = this.match;
16449 if (next.length < 20) {
16450 next += this._input.substr(0, 20-next.length);
16451 }
16452 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
16453 },
16454
16455// displays the character position where the lexing error occurred, i.e. for error messages
16456showPosition:function () {
16457 var pre = this.pastInput();
16458 var c = new Array(pre.length + 1).join("-");
16459 return pre + this.upcomingInput() + "\n" + c + "^";
16460 },
16461
16462// test the lexed token: return FALSE when not a match, otherwise return token
16463test_match:function(match, indexed_rule) {
16464 var token,
16465 lines,
16466 backup;
16467
16468 if (this.options.backtrack_lexer) {
16469 // save context
16470 backup = {
16471 yylineno: this.yylineno,
16472 yylloc: {
16473 first_line: this.yylloc.first_line,
16474 last_line: this.last_line,
16475 first_column: this.yylloc.first_column,
16476 last_column: this.yylloc.last_column
16477 },
16478 yytext: this.yytext,
16479 match: this.match,
16480 matches: this.matches,
16481 matched: this.matched,
16482 yyleng: this.yyleng,
16483 offset: this.offset,
16484 _more: this._more,
16485 _input: this._input,
16486 yy: this.yy,
16487 conditionStack: this.conditionStack.slice(0),
16488 done: this.done
16489 };
16490 if (this.options.ranges) {
16491 backup.yylloc.range = this.yylloc.range.slice(0);
16492 }
16493 }
16494
16495 lines = match[0].match(/(?:\r\n?|\n).*/g);
16496 if (lines) {
16497 this.yylineno += lines.length;
16498 }
16499 this.yylloc = {
16500 first_line: this.yylloc.last_line,
16501 last_line: this.yylineno + 1,
16502 first_column: this.yylloc.last_column,
16503 last_column: lines ?
16504 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
16505 this.yylloc.last_column + match[0].length
16506 };
16507 this.yytext += match[0];
16508 this.match += match[0];
16509 this.matches = match;
16510 this.yyleng = this.yytext.length;
16511 if (this.options.ranges) {
16512 this.yylloc.range = [this.offset, this.offset += this.yyleng];
16513 }
16514 this._more = false;
16515 this._backtrack = false;
16516 this._input = this._input.slice(match[0].length);
16517 this.matched += match[0];
16518 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
16519 if (this.done && this._input) {
16520 this.done = false;
16521 }
16522 if (token) {
16523 return token;
16524 } else if (this._backtrack) {
16525 // recover context
16526 for (var k in backup) {
16527 this[k] = backup[k];
16528 }
16529 return false; // rule action called reject() implying the next rule should be tested instead.
16530 }
16531 return false;
16532 },
16533
16534// return next match in input
16535next:function () {
16536 if (this.done) {
16537 return this.EOF;
16538 }
16539 if (!this._input) {
16540 this.done = true;
16541 }
16542
16543 var token,
16544 match,
16545 tempMatch,
16546 index;
16547 if (!this._more) {
16548 this.yytext = '';
16549 this.match = '';
16550 }
16551 var rules = this._currentRules();
16552 for (var i = 0; i < rules.length; i++) {
16553 tempMatch = this._input.match(this.rules[rules[i]]);
16554 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
16555 match = tempMatch;
16556 index = i;
16557 if (this.options.backtrack_lexer) {
16558 token = this.test_match(tempMatch, rules[i]);
16559 if (token !== false) {
16560 return token;
16561 } else if (this._backtrack) {
16562 match = false;
16563 continue; // rule action called reject() implying a rule MISmatch.
16564 } else {
16565 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
16566 return false;
16567 }
16568 } else if (!this.options.flex) {
16569 break;
16570 }
16571 }
16572 }
16573 if (match) {
16574 token = this.test_match(match, rules[index]);
16575 if (token !== false) {
16576 return token;
16577 }
16578 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
16579 return false;
16580 }
16581 if (this._input === "") {
16582 return this.EOF;
16583 } else {
16584 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
16585 text: "",
16586 token: null,
16587 line: this.yylineno
16588 });
16589 }
16590 },
16591
16592// return next match that has a token
16593lex:function lex () {
16594 var r = this.next();
16595 if (r) {
16596 return r;
16597 } else {
16598 return this.lex();
16599 }
16600 },
16601
16602// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
16603begin:function begin (condition) {
16604 this.conditionStack.push(condition);
16605 },
16606
16607// pop the previously active lexer condition state off the condition stack
16608popState:function popState () {
16609 var n = this.conditionStack.length - 1;
16610 if (n > 0) {
16611 return this.conditionStack.pop();
16612 } else {
16613 return this.conditionStack[0];
16614 }
16615 },
16616
16617// produce the lexer rule set which is active for the currently active lexer condition state
16618_currentRules:function _currentRules () {
16619 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
16620 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
16621 } else {
16622 return this.conditions["INITIAL"].rules;
16623 }
16624 },
16625
16626// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
16627topState:function topState (n) {
16628 n = this.conditionStack.length - 1 - Math.abs(n || 0);
16629 if (n >= 0) {
16630 return this.conditionStack[n];
16631 } else {
16632 return "INITIAL";
16633 }
16634 },
16635
16636// alias for begin(condition)
16637pushState:function pushState (condition) {
16638 this.begin(condition);
16639 },
16640
16641// return the number of states currently on the stack
16642stateStackSize:function stateStackSize() {
16643 return this.conditionStack.length;
16644 },
16645options: {"case-insensitive":true},
16646performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
16647var YYSTATE=YY_START;
16648switch($avoiding_name_collisions) {
16649case 0: this.begin('open_directive'); return 56;
16650break;
16651case 1: this.begin('type_directive'); return 57;
16652break;
16653case 2: this.popState(); this.begin('arg_directive'); return 14;
16654break;
16655case 3: this.popState(); this.popState(); return 59;
16656break;
16657case 4:return 58;
16658break;
16659case 5:return 5;
16660break;
16661case 6:/* skip all whitespace */
16662break;
16663case 7:/* skip same-line whitespace */
16664break;
16665case 8:/* skip comments */
16666break;
16667case 9:/* skip comments */
16668break;
16669case 10:/* skip comments */
16670break;
16671case 11: this.begin('ID'); return 16;
16672break;
16673case 12: yy_.yytext = yy_.yytext.trim(); this.begin('ALIAS'); return 48;
16674break;
16675case 13: this.popState(); this.popState(); this.begin('LINE'); return 18;
16676break;
16677case 14: this.popState(); this.popState(); return 5;
16678break;
16679case 15: this.begin('LINE'); return 27;
16680break;
16681case 16: this.begin('LINE'); return 29;
16682break;
16683case 17: this.begin('LINE'); return 30;
16684break;
16685case 18: this.begin('LINE'); return 31;
16686break;
16687case 19: this.begin('LINE'); return 36;
16688break;
16689case 20: this.begin('LINE'); return 33;
16690break;
16691case 21: this.begin('LINE'); return 35;
16692break;
16693case 22: this.popState(); return 19;
16694break;
16695case 23:return 28;
16696break;
16697case 24:return 43;
16698break;
16699case 25:return 44;
16700break;
16701case 26:return 39;
16702break;
16703case 27:return 37;
16704break;
16705case 28: this.begin('ID'); return 22;
16706break;
16707case 29: this.begin('ID'); return 23;
16708break;
16709case 30:return 25;
16710break;
16711case 31:return 7;
16712break;
16713case 32:return 21;
16714break;
16715case 33:return 42;
16716break;
16717case 34:return 5;
16718break;
16719case 35: yy_.yytext = yy_.yytext.trim(); return 48;
16720break;
16721case 36:return 51;
16722break;
16723case 37:return 52;
16724break;
16725case 38:return 49;
16726break;
16727case 39:return 50;
16728break;
16729case 40:return 53;
16730break;
16731case 41:return 54;
16732break;
16733case 42:return 55;
16734break;
16735case 43:return 46;
16736break;
16737case 44:return 47;
16738break;
16739case 45:return 5;
16740break;
16741case 46:return 'INVALID';
16742break;
16743}
16744},
16745rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:participant\b)/i,/^(?:[^\->:\n,;]+?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:and\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\b)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\+\->:\n,;]+((?!(-x|--x))[\-]*[^\+\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?::(?:(?:no)?wrap)?[^#\n;]+)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],
16746conditions: {"open_directive":{"rules":[1,8],"inclusive":false},"type_directive":{"rules":[2,3,8],"inclusive":false},"arg_directive":{"rules":[3,4,8],"inclusive":false},"ID":{"rules":[7,8,12],"inclusive":false},"ALIAS":{"rules":[7,8,13,14],"inclusive":false},"LINE":{"rules":[7,8,22],"inclusive":false},"INITIAL":{"rules":[0,5,6,8,9,10,11,15,16,17,18,19,20,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],"inclusive":true}}
16747});
16748return lexer;
16749})();
16750parser.lexer = lexer;
16751function Parser () {
16752 this.yy = {};
16753}
16754Parser.prototype = parser;parser.Parser = Parser;
16755return new Parser;
16756})();
16757
16758
16759if (true) {
16760exports.parser = parser;
16761exports.Parser = parser.Parser;
16762exports.parse = function () { return parser.parse.apply(parser, arguments); };
16763exports.main = function commonjsMain (args) {
16764 if (!args[1]) {
16765 console.log('Usage: '+args[0]+' FILE');
16766 process.exit(1);
16767 }
16768 var source = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
16769 return exports.parser.parse(source);
16770};
16771if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
16772 exports.main(process.argv.slice(1));
16773}
16774}
16775/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
16776
16777/***/ }),
16778
16779/***/ "./src/diagrams/sequence/sequenceDb.js":
16780/*!*********************************************!*\
16781 !*** ./src/diagrams/sequence/sequenceDb.js ***!
16782 \*********************************************/
16783/*! exports provided: parseDirective, addActor, addMessage, addSignal, getMessages, getActors, getActor, getActorKeys, getTitle, getTitleWrapped, enableSequenceNumbers, showSequenceNumbers, setWrap, autoWrap, clear, parseMessage, LINETYPE, ARROWTYPE, PLACEMENT, addNote, setTitle, apply, default */
16784/***/ (function(module, __webpack_exports__, __webpack_require__) {
16785
16786"use strict";
16787__webpack_require__.r(__webpack_exports__);
16788/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
16789/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addActor", function() { return addActor; });
16790/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addMessage", function() { return addMessage; });
16791/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSignal", function() { return addSignal; });
16792/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMessages", function() { return getMessages; });
16793/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getActors", function() { return getActors; });
16794/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getActor", function() { return getActor; });
16795/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getActorKeys", function() { return getActorKeys; });
16796/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTitle", function() { return getTitle; });
16797/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTitleWrapped", function() { return getTitleWrapped; });
16798/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableSequenceNumbers", function() { return enableSequenceNumbers; });
16799/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showSequenceNumbers", function() { return showSequenceNumbers; });
16800/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setWrap", function() { return setWrap; });
16801/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autoWrap", function() { return autoWrap; });
16802/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
16803/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseMessage", function() { return parseMessage; });
16804/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LINETYPE", function() { return LINETYPE; });
16805/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARROWTYPE", function() { return ARROWTYPE; });
16806/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PLACEMENT", function() { return PLACEMENT; });
16807/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addNote", function() { return addNote; });
16808/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTitle", function() { return setTitle; });
16809/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apply", function() { return apply; });
16810/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
16811/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
16812/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
16813/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
16814
16815
16816
16817
16818var prevActor = undefined;
16819var actors = {};
16820var messages = [];
16821var notes = [];
16822var title = '';
16823var titleWrapped = false;
16824var sequenceNumbersEnabled = false;
16825var wrapEnabled = false;
16826var parseDirective = function parseDirective(statement, context, type) {
16827 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
16828};
16829var addActor = function addActor(id, name, description) {
16830 // Don't allow description nulling
16831 var old = actors[id];
16832 if (old && name === old.name && description == null) return; // Don't allow null descriptions, either
16833
16834 if (description == null || description.text == null) {
16835 description = {
16836 text: name,
16837 wrap: null
16838 };
16839 }
16840
16841 actors[id] = {
16842 name: name,
16843 description: description.text,
16844 wrap: description.wrap === undefined && autoWrap() || !!description.wrap,
16845 prevActor: prevActor
16846 };
16847
16848 if (prevActor && actors[prevActor]) {
16849 actors[prevActor].nextActor = id;
16850 }
16851
16852 prevActor = id;
16853};
16854
16855var activationCount = function activationCount(part) {
16856 var i;
16857 var count = 0;
16858
16859 for (i = 0; i < messages.length; i++) {
16860 // console.warn(i, messages[i]);
16861 if (messages[i].type === LINETYPE.ACTIVE_START) {
16862 if (messages[i].from.actor === part) {
16863 count++;
16864 }
16865 }
16866
16867 if (messages[i].type === LINETYPE.ACTIVE_END) {
16868 if (messages[i].from.actor === part) {
16869 count--;
16870 }
16871 }
16872 }
16873
16874 return count;
16875};
16876
16877var addMessage = function addMessage(idFrom, idTo, message, answer) {
16878 messages.push({
16879 from: idFrom,
16880 to: idTo,
16881 message: message.text,
16882 wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
16883 answer: answer
16884 });
16885};
16886var addSignal = function addSignal(idFrom, idTo) {
16887 var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
16888 text: undefined,
16889 wrap: undefined
16890 };
16891 var messageType = arguments.length > 3 ? arguments[3] : undefined;
16892
16893 if (messageType === LINETYPE.ACTIVE_END) {
16894 var cnt = activationCount(idFrom.actor);
16895
16896 if (cnt < 1) {
16897 // Bail out as there is an activation signal from an inactive participant
16898 var error = new Error('Trying to inactivate an inactive participant (' + idFrom.actor + ')');
16899 error.hash = {
16900 text: '->>-',
16901 token: '->>-',
16902 line: '1',
16903 loc: {
16904 first_line: 1,
16905 last_line: 1,
16906 first_column: 1,
16907 last_column: 1
16908 },
16909 expected: ["'ACTIVE_PARTICIPANT'"]
16910 };
16911 throw error;
16912 }
16913 }
16914
16915 messages.push({
16916 from: idFrom,
16917 to: idTo,
16918 message: message.text,
16919 wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
16920 type: messageType
16921 });
16922 return true;
16923};
16924var getMessages = function getMessages() {
16925 return messages;
16926};
16927var getActors = function getActors() {
16928 return actors;
16929};
16930var getActor = function getActor(id) {
16931 return actors[id];
16932};
16933var getActorKeys = function getActorKeys() {
16934 return Object.keys(actors);
16935};
16936var getTitle = function getTitle() {
16937 return title;
16938};
16939var getTitleWrapped = function getTitleWrapped() {
16940 return titleWrapped;
16941};
16942var enableSequenceNumbers = function enableSequenceNumbers() {
16943 sequenceNumbersEnabled = true;
16944};
16945var showSequenceNumbers = function showSequenceNumbers() {
16946 return sequenceNumbersEnabled;
16947};
16948var setWrap = function setWrap(wrapSetting) {
16949 wrapEnabled = wrapSetting;
16950};
16951var autoWrap = function autoWrap() {
16952 return wrapEnabled;
16953};
16954var clear = function clear() {
16955 actors = {};
16956 messages = [];
16957};
16958var parseMessage = function parseMessage(str) {
16959 var _str = str.trim();
16960
16961 var message = {
16962 text: _str.replace(/^[:]?(?:no)?wrap:/, '').trim(),
16963 wrap: _str.match(/^[:]?(?:no)?wrap:/) === null ? _common_common__WEBPACK_IMPORTED_MODULE_2__["default"].hasBreaks(_str) || undefined : _str.match(/^[:]?wrap:/) !== null ? true : _str.match(/^[:]?nowrap:/) !== null ? false : undefined
16964 };
16965 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('parseMessage:', message);
16966 return message;
16967};
16968var LINETYPE = {
16969 SOLID: 0,
16970 DOTTED: 1,
16971 NOTE: 2,
16972 SOLID_CROSS: 3,
16973 DOTTED_CROSS: 4,
16974 SOLID_OPEN: 5,
16975 DOTTED_OPEN: 6,
16976 LOOP_START: 10,
16977 LOOP_END: 11,
16978 ALT_START: 12,
16979 ALT_ELSE: 13,
16980 ALT_END: 14,
16981 OPT_START: 15,
16982 OPT_END: 16,
16983 ACTIVE_START: 17,
16984 ACTIVE_END: 18,
16985 PAR_START: 19,
16986 PAR_AND: 20,
16987 PAR_END: 21,
16988 RECT_START: 22,
16989 RECT_END: 23
16990};
16991var ARROWTYPE = {
16992 FILLED: 0,
16993 OPEN: 1
16994};
16995var PLACEMENT = {
16996 LEFTOF: 0,
16997 RIGHTOF: 1,
16998 OVER: 2
16999};
17000var addNote = function addNote(actor, placement, message) {
17001 var note = {
17002 actor: actor,
17003 placement: placement,
17004 message: message.text,
17005 wrap: message.wrap === undefined && autoWrap() || !!message.wrap
17006 }; // Coerce actor into a [to, from, ...] array
17007
17008 var actors = [].concat(actor, actor);
17009 notes.push(note);
17010 messages.push({
17011 from: actors[0],
17012 to: actors[1],
17013 message: message.text,
17014 wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
17015 type: LINETYPE.NOTE,
17016 placement: placement
17017 });
17018};
17019var setTitle = function setTitle(titleWrap) {
17020 title = titleWrap.text;
17021 titleWrapped = titleWrap.wrap === undefined && autoWrap() || !!titleWrap.wrap;
17022};
17023var apply = function apply(param) {
17024 if (param instanceof Array) {
17025 param.forEach(function (item) {
17026 apply(item);
17027 });
17028 } else {
17029 switch (param.type) {
17030 case 'addActor':
17031 addActor(param.actor, param.actor, param.description);
17032 break;
17033
17034 case 'activeStart':
17035 addSignal(param.actor, undefined, undefined, param.signalType);
17036 break;
17037
17038 case 'activeEnd':
17039 addSignal(param.actor, undefined, undefined, param.signalType);
17040 break;
17041
17042 case 'addNote':
17043 addNote(param.actor, param.placement, param.text);
17044 break;
17045
17046 case 'addMessage':
17047 addSignal(param.from, param.to, param.msg, param.signalType);
17048 break;
17049
17050 case 'loopStart':
17051 addSignal(undefined, undefined, param.loopText, param.signalType);
17052 break;
17053
17054 case 'loopEnd':
17055 addSignal(undefined, undefined, undefined, param.signalType);
17056 break;
17057
17058 case 'rectStart':
17059 addSignal(undefined, undefined, param.color, param.signalType);
17060 break;
17061
17062 case 'rectEnd':
17063 addSignal(undefined, undefined, undefined, param.signalType);
17064 break;
17065
17066 case 'optStart':
17067 addSignal(undefined, undefined, param.optText, param.signalType);
17068 break;
17069
17070 case 'optEnd':
17071 addSignal(undefined, undefined, undefined, param.signalType);
17072 break;
17073
17074 case 'altStart':
17075 addSignal(undefined, undefined, param.altText, param.signalType);
17076 break;
17077
17078 case 'else':
17079 addSignal(undefined, undefined, param.altText, param.signalType);
17080 break;
17081
17082 case 'altEnd':
17083 addSignal(undefined, undefined, undefined, param.signalType);
17084 break;
17085
17086 case 'setTitle':
17087 setTitle(param.text);
17088 break;
17089
17090 case 'parStart':
17091 addSignal(undefined, undefined, param.parText, param.signalType);
17092 break;
17093
17094 case 'and':
17095 addSignal(undefined, undefined, param.parText, param.signalType);
17096 break;
17097
17098 case 'parEnd':
17099 addSignal(undefined, undefined, undefined, param.signalType);
17100 break;
17101 }
17102 }
17103};
17104/* harmony default export */ __webpack_exports__["default"] = ({
17105 addActor: addActor,
17106 addMessage: addMessage,
17107 addSignal: addSignal,
17108 autoWrap: autoWrap,
17109 setWrap: setWrap,
17110 enableSequenceNumbers: enableSequenceNumbers,
17111 showSequenceNumbers: showSequenceNumbers,
17112 getMessages: getMessages,
17113 getActors: getActors,
17114 getActor: getActor,
17115 getActorKeys: getActorKeys,
17116 getTitle: getTitle,
17117 parseDirective: parseDirective,
17118 getConfig: function getConfig() {
17119 return _config__WEBPACK_IMPORTED_MODULE_1__["getConfig"]().sequence;
17120 },
17121 getTitleWrapped: getTitleWrapped,
17122 clear: clear,
17123 parseMessage: parseMessage,
17124 LINETYPE: LINETYPE,
17125 ARROWTYPE: ARROWTYPE,
17126 PLACEMENT: PLACEMENT,
17127 addNote: addNote,
17128 setTitle: setTitle,
17129 apply: apply
17130});
17131
17132/***/ }),
17133
17134/***/ "./src/diagrams/sequence/sequenceRenderer.js":
17135/*!***************************************************!*\
17136 !*** ./src/diagrams/sequence/sequenceRenderer.js ***!
17137 \***************************************************/
17138/*! exports provided: bounds, drawActors, setConf, draw, default */
17139/***/ (function(module, __webpack_exports__, __webpack_require__) {
17140
17141"use strict";
17142__webpack_require__.r(__webpack_exports__);
17143/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bounds", function() { return bounds; });
17144/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawActors", function() { return drawActors; });
17145/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
17146/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
17147/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
17148/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
17149/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/sequence/svgDraw.js");
17150/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
17151/* harmony import */ var _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/sequenceDiagram */ "./src/diagrams/sequence/parser/sequenceDiagram.jison");
17152/* harmony import */ var _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__);
17153/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
17154/* harmony import */ var _sequenceDb__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./sequenceDb */ "./src/diagrams/sequence/sequenceDb.js");
17155/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js");
17156/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
17157
17158
17159
17160
17161
17162
17163
17164
17165_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy = _sequenceDb__WEBPACK_IMPORTED_MODULE_5__["default"];
17166var conf = {};
17167var bounds = {
17168 data: {
17169 startx: undefined,
17170 stopx: undefined,
17171 starty: undefined,
17172 stopy: undefined
17173 },
17174 verticalPos: 0,
17175 sequenceItems: [],
17176 activations: [],
17177 models: {
17178 getHeight: function getHeight() {
17179 return Math.max.apply(null, this.actors.length === 0 ? [0] : this.actors.map(function (actor) {
17180 return actor.height || 0;
17181 })) + (this.loops.length === 0 ? 0 : this.loops.map(function (it) {
17182 return it.height || 0;
17183 }).reduce(function (acc, h) {
17184 return acc + h;
17185 })) + (this.messages.length === 0 ? 0 : this.messages.map(function (it) {
17186 return it.height || 0;
17187 }).reduce(function (acc, h) {
17188 return acc + h;
17189 })) + (this.notes.length === 0 ? 0 : this.notes.map(function (it) {
17190 return it.height || 0;
17191 }).reduce(function (acc, h) {
17192 return acc + h;
17193 }));
17194 },
17195 clear: function clear() {
17196 this.actors = [];
17197 this.loops = [];
17198 this.messages = [];
17199 this.notes = [];
17200 },
17201 addActor: function addActor(actorModel) {
17202 this.actors.push(actorModel);
17203 },
17204 addLoop: function addLoop(loopModel) {
17205 this.loops.push(loopModel);
17206 },
17207 addMessage: function addMessage(msgModel) {
17208 this.messages.push(msgModel);
17209 },
17210 addNote: function addNote(noteModel) {
17211 this.notes.push(noteModel);
17212 },
17213 lastActor: function lastActor() {
17214 return this.actors[this.actors.length - 1];
17215 },
17216 lastLoop: function lastLoop() {
17217 return this.loops[this.loops.length - 1];
17218 },
17219 lastMessage: function lastMessage() {
17220 return this.messages[this.messages.length - 1];
17221 },
17222 lastNote: function lastNote() {
17223 return this.notes[this.notes.length - 1];
17224 },
17225 actors: [],
17226 loops: [],
17227 messages: [],
17228 notes: []
17229 },
17230 init: function init() {
17231 this.sequenceItems = [];
17232 this.activations = [];
17233 this.models.clear();
17234 this.data = {
17235 startx: undefined,
17236 stopx: undefined,
17237 starty: undefined,
17238 stopy: undefined
17239 };
17240 this.verticalPos = 0;
17241 setConf(_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.getConfig());
17242 },
17243 updateVal: function updateVal(obj, key, val, fun) {
17244 if (typeof obj[key] === 'undefined') {
17245 obj[key] = val;
17246 } else {
17247 obj[key] = fun(val, obj[key]);
17248 }
17249 },
17250 updateBounds: function updateBounds(startx, starty, stopx, stopy) {
17251 var _self = this;
17252
17253 var cnt = 0;
17254
17255 function updateFn(type) {
17256 return function updateItemBounds(item) {
17257 cnt++; // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
17258
17259 var n = _self.sequenceItems.length - cnt + 1;
17260
17261 _self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min);
17262
17263 _self.updateVal(item, 'stopy', stopy + n * conf.boxMargin, Math.max);
17264
17265 _self.updateVal(bounds.data, 'startx', startx - n * conf.boxMargin, Math.min);
17266
17267 _self.updateVal(bounds.data, 'stopx', stopx + n * conf.boxMargin, Math.max);
17268
17269 if (!(type === 'activation')) {
17270 _self.updateVal(item, 'startx', startx - n * conf.boxMargin, Math.min);
17271
17272 _self.updateVal(item, 'stopx', stopx + n * conf.boxMargin, Math.max);
17273
17274 _self.updateVal(bounds.data, 'starty', starty - n * conf.boxMargin, Math.min);
17275
17276 _self.updateVal(bounds.data, 'stopy', stopy + n * conf.boxMargin, Math.max);
17277 }
17278 };
17279 }
17280
17281 this.sequenceItems.forEach(updateFn());
17282 this.activations.forEach(updateFn('activation'));
17283 },
17284 insert: function insert(startx, starty, stopx, stopy) {
17285 var _startx = Math.min(startx, stopx);
17286
17287 var _stopx = Math.max(startx, stopx);
17288
17289 var _starty = Math.min(starty, stopy);
17290
17291 var _stopy = Math.max(starty, stopy);
17292
17293 this.updateVal(bounds.data, 'startx', _startx, Math.min);
17294 this.updateVal(bounds.data, 'starty', _starty, Math.min);
17295 this.updateVal(bounds.data, 'stopx', _stopx, Math.max);
17296 this.updateVal(bounds.data, 'stopy', _stopy, Math.max);
17297 this.updateBounds(_startx, _starty, _stopx, _stopy);
17298 },
17299 newActivation: function newActivation(message, diagram, actors) {
17300 var actorRect = actors[message.from.actor];
17301 var stackedSize = actorActivations(message.from.actor).length || 0;
17302 var x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
17303 this.activations.push({
17304 startx: x,
17305 starty: this.verticalPos + 2,
17306 stopx: x + conf.activationWidth,
17307 stopy: undefined,
17308 actor: message.from.actor,
17309 anchored: _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].anchorElement(diagram)
17310 });
17311 },
17312 endActivation: function endActivation(message) {
17313 // find most recent activation for given actor
17314 var lastActorActivationIdx = this.activations.map(function (activation) {
17315 return activation.actor;
17316 }).lastIndexOf(message.from.actor);
17317 return this.activations.splice(lastActorActivationIdx, 1)[0];
17318 },
17319 createLoop: function createLoop() {
17320 var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
17321 message: undefined,
17322 wrap: false,
17323 width: undefined
17324 };
17325 var fill = arguments.length > 1 ? arguments[1] : undefined;
17326 return {
17327 startx: undefined,
17328 starty: this.verticalPos,
17329 stopx: undefined,
17330 stopy: undefined,
17331 title: title.message,
17332 wrap: title.wrap,
17333 width: title.width,
17334 height: 0,
17335 fill: fill
17336 };
17337 },
17338 newLoop: function newLoop() {
17339 var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
17340 message: undefined,
17341 wrap: false,
17342 width: undefined
17343 };
17344 var fill = arguments.length > 1 ? arguments[1] : undefined;
17345 this.sequenceItems.push(this.createLoop(title, fill));
17346 },
17347 endLoop: function endLoop() {
17348 return this.sequenceItems.pop();
17349 },
17350 addSectionToLoop: function addSectionToLoop(message) {
17351 var loop = this.sequenceItems.pop();
17352 loop.sections = loop.sections || [];
17353 loop.sectionTitles = loop.sectionTitles || [];
17354 loop.sections.push({
17355 y: bounds.getVerticalPos(),
17356 height: 0
17357 });
17358 loop.sectionTitles.push(message);
17359 this.sequenceItems.push(loop);
17360 },
17361 bumpVerticalPos: function bumpVerticalPos(bump) {
17362 this.verticalPos = this.verticalPos + bump;
17363 this.data.stopy = this.verticalPos;
17364 },
17365 getVerticalPos: function getVerticalPos() {
17366 return this.verticalPos;
17367 },
17368 getBounds: function getBounds() {
17369 console.log('here', this.data);
17370 return {
17371 bounds: this.data,
17372 models: this.models
17373 };
17374 }
17375};
17376/**
17377 * Draws an note in the diagram with the attached line
17378 * @param elem - The diagram to draw to.
17379 * @param noteModel:{x: number, y: number, message: string, width: number} - startx: x axis start position, verticalPos: y axis position, messsage: the message to be shown, width: Set this with a custom width to override the default configured width.
17380 */
17381
17382var drawNote = function drawNote(elem, noteModel) {
17383 bounds.bumpVerticalPos(conf.boxMargin);
17384 noteModel.height = conf.boxMargin;
17385 noteModel.starty = bounds.getVerticalPos();
17386 var rect = _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].getNoteRect();
17387 rect.x = noteModel.startx;
17388 rect.y = noteModel.starty;
17389 rect.width = noteModel.width || conf.width;
17390 rect.class = 'note';
17391 var g = elem.append('g');
17392 var rectElem = _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawRect(g, rect);
17393 var textObj = _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].getTextObj();
17394 textObj.x = noteModel.startx;
17395 textObj.y = noteModel.starty;
17396 textObj.width = rect.width;
17397 textObj.dy = '1em';
17398 textObj.text = noteModel.message;
17399 textObj.class = 'noteText';
17400 textObj.fontFamily = conf.noteFontFamily;
17401 textObj.fontSize = conf.noteFontSize;
17402 textObj.fontWeight = conf.noteFontWeight;
17403 textObj.anchor = conf.noteAlign;
17404 textObj.textMargin = conf.noteMargin;
17405 textObj.valign = conf.noteAlign;
17406 textObj.wrap = true;
17407 var textElem = Object(_svgDraw__WEBPACK_IMPORTED_MODULE_1__["drawText"])(g, textObj);
17408 var textHeight = Math.round(textElem.map(function (te) {
17409 return (te._groups || te)[0][0].getBBox().height;
17410 }).reduce(function (acc, curr) {
17411 return acc + curr;
17412 }));
17413 rectElem.attr('height', textHeight + 2 * conf.noteMargin);
17414 noteModel.height += textHeight + 2 * conf.noteMargin;
17415 bounds.bumpVerticalPos(textHeight + 2 * conf.noteMargin);
17416 noteModel.stopy = noteModel.starty + textHeight + 2 * conf.noteMargin;
17417 noteModel.stopx = noteModel.startx + rect.width;
17418 bounds.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
17419 bounds.models.addNote(noteModel);
17420};
17421
17422var messageFont = function messageFont(cnf) {
17423 return {
17424 fontFamily: cnf.messageFontFamily,
17425 fontSize: cnf.messageFontSize,
17426 fontWeight: cnf.messageFontWeight
17427 };
17428};
17429
17430var noteFont = function noteFont(cnf) {
17431 return {
17432 fontFamily: cnf.noteFontFamily,
17433 fontSize: cnf.noteFontSize,
17434 fontWeight: cnf.noteFontWeight
17435 };
17436};
17437
17438var actorFont = function actorFont(cnf) {
17439 return {
17440 fontFamily: cnf.actorFontFamily,
17441 fontSize: cnf.actorFontSize,
17442 fontWeight: cnf.actorFontWeight
17443 };
17444};
17445/**
17446 * Draws a message
17447 * @param g - the parent of the message element
17448 * @param msgModel - the model containing fields describing a message
17449 */
17450
17451
17452var drawMessage = function drawMessage(g, msgModel) {
17453 bounds.bumpVerticalPos(10);
17454 var startx = msgModel.startx,
17455 stopx = msgModel.stopx,
17456 starty = msgModel.starty,
17457 message = msgModel.message,
17458 type = msgModel.type,
17459 sequenceIndex = msgModel.sequenceIndex,
17460 wrap = msgModel.wrap;
17461 var lines = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].splitBreaks(message).length;
17462 var textDims = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(message, messageFont(conf));
17463 var lineHeight = textDims.height / lines;
17464 msgModel.height += lineHeight;
17465 bounds.bumpVerticalPos(lineHeight);
17466 var textObj = _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].getTextObj();
17467 textObj.x = startx;
17468 textObj.y = starty + 10;
17469 textObj.width = stopx - startx;
17470 textObj.class = 'messageText';
17471 textObj.dy = '1em';
17472 textObj.text = message;
17473 textObj.fontFamily = conf.messageFontFamily;
17474 textObj.fontSize = conf.messageFontSize;
17475 textObj.fontWeight = conf.messageFontWeight;
17476 textObj.anchor = conf.messageAlign;
17477 textObj.valign = conf.messageAlign;
17478 textObj.textMargin = conf.wrapPadding;
17479 textObj.tspan = false;
17480 textObj.wrap = wrap;
17481 Object(_svgDraw__WEBPACK_IMPORTED_MODULE_1__["drawText"])(g, textObj);
17482 var totalOffset = textDims.height - 10;
17483 var textWidth = textDims.width;
17484 var line, lineStarty;
17485
17486 if (startx === stopx) {
17487 lineStarty = bounds.getVerticalPos() + totalOffset;
17488
17489 if (conf.rightAngles) {
17490 line = g.append('path').attr('d', "M ".concat(startx, ",").concat(lineStarty, " H ").concat(startx + Math.max(conf.width / 2, textWidth / 2), " V ").concat(lineStarty + 25, " H ").concat(startx));
17491 } else {
17492 totalOffset += conf.boxMargin;
17493 lineStarty = bounds.getVerticalPos() + totalOffset;
17494 line = g.append('path').attr('d', 'M ' + startx + ',' + lineStarty + ' C ' + (startx + 60) + ',' + (lineStarty - 10) + ' ' + (startx + 60) + ',' + (lineStarty + 30) + ' ' + startx + ',' + (lineStarty + 20));
17495 }
17496
17497 totalOffset += 30;
17498 var dx = Math.max(textWidth / 2, conf.width / 2);
17499 bounds.insert(startx - dx, bounds.getVerticalPos() - 10 + totalOffset, stopx + dx, bounds.getVerticalPos() + 30 + totalOffset);
17500 } else {
17501 totalOffset += conf.boxMargin;
17502 lineStarty = bounds.getVerticalPos() + totalOffset;
17503 line = g.append('line');
17504 line.attr('x1', startx);
17505 line.attr('y1', lineStarty);
17506 line.attr('x2', stopx);
17507 line.attr('y2', lineStarty);
17508 bounds.insert(startx, lineStarty - 10, stopx, lineStarty);
17509 } // Make an SVG Container
17510 // Draw the line
17511
17512
17513 if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED_CROSS || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED_OPEN) {
17514 line.style('stroke-dasharray', '3, 3');
17515 line.attr('class', 'messageLine1');
17516 } else {
17517 line.attr('class', 'messageLine0');
17518 }
17519
17520 var url = '';
17521
17522 if (conf.arrowMarkerAbsolute) {
17523 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
17524 url = url.replace(/\(/g, '\\(');
17525 url = url.replace(/\)/g, '\\)');
17526 }
17527
17528 line.attr('stroke-width', 2);
17529 line.attr('stroke', 'none'); // handled by theme/css anyway
17530
17531 line.style('fill', 'none'); // remove any fill colour
17532
17533 if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.SOLID || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED) {
17534 line.attr('marker-end', 'url(' + url + '#arrowhead)');
17535 }
17536
17537 if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.SOLID_CROSS || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED_CROSS) {
17538 line.attr('marker-end', 'url(' + url + '#crosshead)');
17539 } // add node number
17540
17541
17542 if (_sequenceDb__WEBPACK_IMPORTED_MODULE_5__["default"].showSequenceNumbers() || conf.showSequenceNumbers) {
17543 line.attr('marker-start', 'url(' + url + '#sequencenumber)');
17544 g.append('text').attr('x', startx).attr('y', lineStarty + 4).attr('font-family', 'sans-serif').attr('font-size', '12px').attr('text-anchor', 'middle').attr('textLength', '16px').attr('class', 'sequenceNumber').text(sequenceIndex);
17545 }
17546
17547 bounds.bumpVerticalPos(totalOffset);
17548 msgModel.height += totalOffset;
17549 msgModel.stopy = msgModel.starty + msgModel.height;
17550 bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
17551};
17552
17553var drawActors = function drawActors(diagram, actors, actorKeys, verticalPos) {
17554 // Draw the actors
17555 var prevWidth = 0;
17556 var prevMargin = 0;
17557
17558 for (var i = 0; i < actorKeys.length; i++) {
17559 var actor = actors[actorKeys[i]]; // Add some rendering data to the object
17560
17561 actor.width = actor.width || conf.width;
17562 actor.height = Math.max(actor.height || conf.height, conf.height);
17563 actor.margin = actor.margin || conf.actorMargin;
17564 actor.x = prevWidth + prevMargin;
17565 actor.y = verticalPos; // Draw the box with the attached line
17566
17567 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawActor(diagram, actor, conf);
17568 bounds.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
17569 prevWidth += actor.width;
17570 prevMargin += actor.margin;
17571 bounds.models.addActor(actor);
17572 } // Add a margin between the actor boxes and the first arrow
17573
17574
17575 bounds.bumpVerticalPos(conf.height);
17576};
17577var setConf = function setConf(cnf) {
17578 Object(_utils__WEBPACK_IMPORTED_MODULE_7__["assignWithDepth"])(conf, cnf);
17579
17580 if (cnf.fontFamily) {
17581 conf.actorFontFamily = conf.noteFontFamily = conf.messageFontFamily = cnf.fontFamily;
17582 }
17583
17584 if (cnf.fontSize) {
17585 conf.actorFontSize = conf.noteFontSize = conf.messageFontSize = cnf.fontSize;
17586 }
17587
17588 if (cnf.fontWeight) {
17589 conf.actorFontWeight = conf.noteFontWeight = conf.messageFontWeight = cnf.fontWeight;
17590 }
17591};
17592
17593var actorActivations = function actorActivations(actor) {
17594 return bounds.activations.filter(function (activation) {
17595 return activation.actor === actor;
17596 });
17597};
17598
17599var activationBounds = function activationBounds(actor, actors) {
17600 // handle multiple stacked activations for same actor
17601 var actorObj = actors[actor];
17602 var activations = actorActivations(actor);
17603 var left = activations.reduce(function (acc, activation) {
17604 return Math.min(acc, activation.startx);
17605 }, actorObj.x + actorObj.width / 2);
17606 var right = activations.reduce(function (acc, activation) {
17607 return Math.max(acc, activation.stopx);
17608 }, actorObj.x + actorObj.width / 2);
17609 return [left, right];
17610};
17611
17612function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
17613 bounds.bumpVerticalPos(preMargin);
17614 var heightAdjust = postMargin;
17615
17616 if (msg.id && msg.message && loopWidths[msg.id]) {
17617 var loopWidth = loopWidths[msg.id].width;
17618 var textConf = messageFont(conf);
17619 msg.message = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel("[".concat(msg.message, "]"), loopWidth - 2 * conf.wrapPadding, textConf);
17620 msg.width = loopWidth;
17621 msg.wrap = true; // const lines = common.splitBreaks(msg.message).length;
17622
17623 var textDims = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(msg.message, textConf);
17624 var totalOffset = Math.max(textDims.height, conf.labelBoxHeight);
17625 heightAdjust = postMargin + totalOffset;
17626 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug("".concat(totalOffset, " - ").concat(msg.message));
17627 }
17628
17629 addLoopFn(msg);
17630 bounds.bumpVerticalPos(heightAdjust);
17631}
17632/**
17633 * Draws a sequenceDiagram in the tag with id: id based on the graph definition in text.
17634 * @param text
17635 * @param id
17636 */
17637
17638
17639var draw = function draw(text, id) {
17640 conf = _config__WEBPACK_IMPORTED_MODULE_6__["getConfig"]().sequence;
17641 console.log('there ', conf);
17642 _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.clear();
17643 _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.setWrap(conf.wrap);
17644 _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].parse(text + '\n');
17645 bounds.init();
17646 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug("C:".concat(JSON.stringify(conf, null, 2)));
17647 var diagram = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id=\"".concat(id, "\"]")); // Fetch data from the parsing
17648
17649 var actors = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.getActors();
17650 var actorKeys = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.getActorKeys();
17651 var messages = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.getMessages();
17652 var title = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.getTitle();
17653 var maxMessageWidthPerActor = getMaxMessageWidthPerActor(actors, messages);
17654 conf.height = calculateActorMargins(actors, maxMessageWidthPerActor);
17655 drawActors(diagram, actors, actorKeys, 0);
17656 var loopWidths = calculateLoopBounds(messages, actors, maxMessageWidthPerActor); // The arrow head definition is attached to the svg once
17657
17658 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].insertArrowHead(diagram);
17659 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].insertArrowCrossHead(diagram);
17660 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].insertSequenceNumber(diagram);
17661
17662 function activeEnd(msg, verticalPos) {
17663 var activationData = bounds.endActivation(msg);
17664
17665 if (activationData.starty + 18 > verticalPos) {
17666 activationData.starty = verticalPos - 6;
17667 verticalPos += 12;
17668 }
17669
17670 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawActivation(diagram, activationData, verticalPos, conf, actorActivations(msg.from.actor).length);
17671 bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
17672 } // Draw the messages/signals
17673
17674
17675 var sequenceIndex = 1;
17676 messages.forEach(function (msg) {
17677 var loopModel, noteModel, msgModel;
17678
17679 switch (msg.type) {
17680 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.NOTE:
17681 noteModel = msg.noteModel;
17682 drawNote(diagram, noteModel);
17683 break;
17684
17685 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ACTIVE_START:
17686 bounds.newActivation(msg, diagram, actors);
17687 break;
17688
17689 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ACTIVE_END:
17690 activeEnd(msg, bounds.getVerticalPos());
17691 break;
17692
17693 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.LOOP_START:
17694 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
17695 return bounds.newLoop(message);
17696 });
17697 break;
17698
17699 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.LOOP_END:
17700 loopModel = bounds.endLoop();
17701 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawLoop(diagram, loopModel, 'loop', conf);
17702 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
17703 bounds.models.addLoop(loopModel);
17704 break;
17705
17706 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.RECT_START:
17707 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin, function (message) {
17708 return bounds.newLoop(undefined, message.message);
17709 });
17710 break;
17711
17712 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.RECT_END:
17713 loopModel = bounds.endLoop();
17714 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawBackgroundRect(diagram, loopModel);
17715 bounds.models.addLoop(loopModel);
17716 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
17717 break;
17718
17719 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.OPT_START:
17720 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
17721 return bounds.newLoop(message);
17722 });
17723 break;
17724
17725 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.OPT_END:
17726 loopModel = bounds.endLoop();
17727 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawLoop(diagram, loopModel, 'opt', conf);
17728 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
17729 bounds.models.addLoop(loopModel);
17730 break;
17731
17732 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_START:
17733 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
17734 return bounds.newLoop(message);
17735 });
17736 break;
17737
17738 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_ELSE:
17739 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin + conf.boxTextMargin, conf.boxMargin, function (message) {
17740 return bounds.addSectionToLoop(message);
17741 });
17742 break;
17743
17744 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_END:
17745 loopModel = bounds.endLoop();
17746 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawLoop(diagram, loopModel, 'alt', conf);
17747 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
17748 bounds.models.addLoop(loopModel);
17749 break;
17750
17751 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_START:
17752 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
17753 return bounds.newLoop(message);
17754 });
17755 break;
17756
17757 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_AND:
17758 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin + conf.boxTextMargin, conf.boxMargin, function (message) {
17759 return bounds.addSectionToLoop(message);
17760 });
17761 break;
17762
17763 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_END:
17764 loopModel = bounds.endLoop();
17765 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawLoop(diagram, loopModel, 'par', conf);
17766 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
17767 bounds.models.addLoop(loopModel);
17768 break;
17769
17770 default:
17771 try {
17772 // lastMsg = msg
17773 msgModel = msg.msgModel;
17774 msgModel.starty = bounds.getVerticalPos();
17775 msgModel.sequenceIndex = sequenceIndex;
17776 drawMessage(diagram, msgModel);
17777 bounds.models.addMessage(msgModel);
17778 } catch (e) {
17779 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].error('error while drawing message', e);
17780 }
17781
17782 } // Increment sequence counter if msg.type is a line (and not another event like activation or note, etc)
17783
17784
17785 if ([_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.SOLID_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.SOLID, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.SOLID_CROSS, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED_CROSS].includes(msg.type)) {
17786 sequenceIndex++;
17787 }
17788 });
17789
17790 if (conf.mirrorActors) {
17791 // Draw actors below diagram
17792 bounds.bumpVerticalPos(conf.boxMargin * 2);
17793 drawActors(diagram, actors, actorKeys, bounds.getVerticalPos());
17794 }
17795
17796 var _bounds$getBounds = bounds.getBounds(),
17797 box = _bounds$getBounds.bounds; // Adjust line height of actor lines now that the height of the diagram is known
17798
17799
17800 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('For line height fix Querying: #' + id + ' .actor-line');
17801 var actorLines = Object(d3__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('#' + id + ' .actor-line');
17802 actorLines.attr('y2', box.stopy);
17803 var height = box.stopy - box.starty + 2 * conf.diagramMarginY;
17804
17805 if (conf.mirrorActors) {
17806 height = height - conf.boxMargin + conf.bottomMarginAdj;
17807 }
17808
17809 var width = box.stopx - box.startx + 2 * conf.diagramMarginX;
17810
17811 if (title) {
17812 diagram.append('text').text(title).attr('x', (box.stopx - box.startx) / 2 - 2 * conf.diagramMarginX).attr('y', -25);
17813 }
17814
17815 if (conf.useMaxWidth) {
17816 diagram.attr('height', '100%');
17817 diagram.attr('width', '100%');
17818 diagram.attr('style', 'max-width:' + width + 'px;'); // diagram.attr('style', 'max-width:100%;');
17819 } else {
17820 diagram.attr('height', height);
17821 diagram.attr('width', width);
17822 }
17823
17824 var extraVertForTitle = title ? 40 : 0;
17825 diagram.attr('viewBox', box.startx - conf.diagramMarginX + ' -' + (conf.diagramMarginY + extraVertForTitle) + ' ' + width + ' ' + (height + extraVertForTitle));
17826 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug("models:", bounds.models);
17827};
17828/**
17829 * Retrieves the max message width of each actor, supports signals (messages, loops)
17830 * and notes.
17831 *
17832 * It will enumerate each given message, and will determine its text width, in relation
17833 * to the actor it originates from, and destined to.
17834 *
17835 * @param actors - The actors map
17836 * @param messages - A list of message objects to iterate
17837 */
17838
17839var getMaxMessageWidthPerActor = function getMaxMessageWidthPerActor(actors, messages) {
17840 var maxMessageWidthPerActor = {};
17841 messages.forEach(function (msg) {
17842 if (actors[msg.to] && actors[msg.from]) {
17843 var actor = actors[msg.to]; // If this is the first actor, and the message is left of it, no need to calculate the margin
17844
17845 if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.LEFTOF && !actor.prevActor) {
17846 return;
17847 } // If this is the last actor, and the message is right of it, no need to calculate the margin
17848
17849
17850 if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.RIGHTOF && !actor.nextActor) {
17851 return;
17852 }
17853
17854 var isNote = msg.placement !== undefined;
17855 var isMessage = !isNote;
17856 var textFont = isNote ? noteFont(conf) : messageFont(conf);
17857 var wrappedMessage = msg.wrap ? _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel(msg.message, conf.width - 2 * conf.wrapPadding, textFont) : msg.message;
17858 var messageDimensions = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(wrappedMessage, textFont);
17859 var messageWidth = messageDimensions.width + 2 * conf.wrapPadding;
17860 /*
17861 * The following scenarios should be supported:
17862 *
17863 * - There's a message (non-note) between fromActor and toActor
17864 * - If fromActor is on the right and toActor is on the left, we should
17865 * define the toActor's margin
17866 * - If fromActor is on the left and toActor is on the right, we should
17867 * define the fromActor's margin
17868 * - There's a note, in which case fromActor == toActor
17869 * - If the note is to the left of the actor, we should define the previous actor
17870 * margin
17871 * - If the note is on the actor, we should define both the previous and next actor
17872 * margins, each being the half of the note size
17873 * - If the note is on the right of the actor, we should define the current actor
17874 * margin
17875 */
17876
17877 if (isMessage && msg.from === actor.nextActor) {
17878 maxMessageWidthPerActor[msg.to] = Math.max(maxMessageWidthPerActor[msg.to] || 0, messageWidth);
17879 } else if (isMessage && msg.from === actor.prevActor) {
17880 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth);
17881 } else if (isMessage && msg.from === msg.to) {
17882 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth / 2);
17883 maxMessageWidthPerActor[msg.to] = Math.max(maxMessageWidthPerActor[msg.to] || 0, messageWidth / 2);
17884 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.RIGHTOF) {
17885 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth);
17886 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.LEFTOF) {
17887 maxMessageWidthPerActor[actor.prevActor] = Math.max(maxMessageWidthPerActor[actor.prevActor] || 0, messageWidth);
17888 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.OVER) {
17889 if (actor.prevActor) {
17890 maxMessageWidthPerActor[actor.prevActor] = Math.max(maxMessageWidthPerActor[actor.prevActor] || 0, messageWidth / 2);
17891 }
17892
17893 if (actor.nextActor) {
17894 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth / 2);
17895 }
17896 }
17897 }
17898 });
17899 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('maxMessageWidthPerActor:', maxMessageWidthPerActor);
17900 return maxMessageWidthPerActor;
17901};
17902/**
17903 * This will calculate the optimal margin for each given actor, for a given
17904 * actor->messageWidth map.
17905 *
17906 * An actor's margin is determined by the width of the actor, the width of the
17907 * largest message that originates from it, and the configured conf.actorMargin.
17908 *
17909 * @param actors - The actors map to calculate margins for
17910 * @param actorToMessageWidth - A map of actor key -> max message width it holds
17911 */
17912
17913
17914var calculateActorMargins = function calculateActorMargins(actors, actorToMessageWidth) {
17915 var maxHeight = 0;
17916 Object.keys(actors).forEach(function (prop) {
17917 var actor = actors[prop];
17918
17919 if (actor.wrap) {
17920 actor.description = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel(actor.description, conf.width - 2 * conf.wrapPadding, actorFont(conf));
17921 }
17922
17923 var actDims = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(actor.description, actorFont(conf));
17924 actor.width = actor.wrap ? conf.width : Math.max(conf.width, actDims.width + 2 * conf.wrapPadding);
17925 actor.height = actor.wrap ? Math.max(actDims.height, conf.height) : conf.height;
17926 maxHeight = Math.max(maxHeight, actor.height);
17927 });
17928
17929 for (var actorKey in actorToMessageWidth) {
17930 var actor = actors[actorKey];
17931
17932 if (!actor) {
17933 continue;
17934 }
17935
17936 var nextActor = actors[actor.nextActor]; // No need to space out an actor that doesn't have a next link
17937
17938 if (!nextActor) {
17939 continue;
17940 }
17941
17942 var messageWidth = actorToMessageWidth[actorKey];
17943 var actorWidth = messageWidth + conf.actorMargin - actor.width / 2 - nextActor.width / 2;
17944 actor.margin = Math.max(actorWidth, conf.actorMargin);
17945 }
17946
17947 return Math.max(maxHeight, conf.height);
17948};
17949
17950var buildNoteModel = function buildNoteModel(msg, actors) {
17951 var startx = actors[msg.from].x;
17952 var stopx = actors[msg.to].x;
17953 var shouldWrap = msg.wrap && msg.message;
17954 var textDimensions = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(shouldWrap ? _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel(msg.message, conf.width, noteFont(conf)) : msg.message, noteFont(conf));
17955 var noteModel = {
17956 width: shouldWrap ? conf.width : Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin),
17957 height: 0,
17958 startx: actors[msg.from].x,
17959 stopx: 0,
17960 starty: 0,
17961 stopy: 0,
17962 message: msg.message
17963 };
17964
17965 if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.RIGHTOF) {
17966 noteModel.width = shouldWrap ? Math.max(conf.width, textDimensions.width) : Math.max(actors[msg.from].width / 2 + actors[msg.to].width / 2, textDimensions.width + 2 * conf.noteMargin);
17967 noteModel.startx = startx + (actors[msg.from].width + conf.actorMargin) / 2;
17968 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.LEFTOF) {
17969 noteModel.width = shouldWrap ? Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin) : Math.max(actors[msg.from].width / 2 + actors[msg.to].width / 2, textDimensions.width + 2 * conf.noteMargin);
17970 noteModel.startx = startx - noteModel.width + (actors[msg.from].width - conf.actorMargin) / 2;
17971 } else if (msg.to === msg.from) {
17972 textDimensions = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(shouldWrap ? _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel(msg.message, Math.max(conf.width, actors[msg.from].width), noteFont(conf)) : msg.message, noteFont(conf));
17973 noteModel.width = shouldWrap ? Math.max(conf.width, actors[msg.from].width) : Math.max(actors[msg.from].width, conf.width, textDimensions.width + 2 * conf.noteMargin);
17974 noteModel.startx = startx + (actors[msg.from].width - noteModel.width) / 2;
17975 } else {
17976 noteModel.width = Math.abs(startx + actors[msg.from].width / 2 - (stopx + actors[msg.to].width / 2)) + conf.actorMargin;
17977 noteModel.startx = startx < stopx ? startx + actors[msg.from].width / 2 - conf.actorMargin / 2 : stopx + actors[msg.to].width / 2 - conf.actorMargin / 2;
17978 }
17979
17980 if (shouldWrap) {
17981 noteModel.message = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel(msg.message, noteModel.width - 2 * conf.wrapPadding, noteFont(conf));
17982 }
17983
17984 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug("NM:[".concat(noteModel.startx, ",").concat(noteModel.stopx, ",").concat(noteModel.starty, ",").concat(noteModel.stopy, ":").concat(noteModel.width, ",").concat(noteModel.height, "=").concat(msg.message, "]"));
17985 return noteModel;
17986};
17987
17988var buildMessageModel = function buildMessageModel(msg, actors) {
17989 var process = false;
17990
17991 if ([_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.SOLID_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.SOLID, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.SOLID_CROSS, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED_CROSS].includes(msg.type)) {
17992 process = true;
17993 }
17994
17995 if (!process) {
17996 return {};
17997 }
17998
17999 var fromBounds = activationBounds(msg.from, actors);
18000 var toBounds = activationBounds(msg.to, actors);
18001 var fromIdx = fromBounds[0] <= toBounds[0] ? 1 : 0;
18002 var toIdx = fromBounds[0] < toBounds[0] ? 0 : 1;
18003 var allBounds = fromBounds.concat(toBounds);
18004 var boundedWidth = Math.abs(toBounds[toIdx] - fromBounds[fromIdx]);
18005 var msgDims = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(msg.message, messageFont(conf));
18006
18007 if (msg.wrap && msg.message) {
18008 msg.message = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel(msg.message, Math.max(boundedWidth + 2 * conf.wrapPadding, conf.width), messageFont(conf));
18009 }
18010
18011 return {
18012 width: Math.max(msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding, boundedWidth + 2 * conf.wrapPadding, conf.width),
18013 height: 0,
18014 startx: fromBounds[fromIdx],
18015 stopx: toBounds[toIdx],
18016 starty: 0,
18017 stopy: 0,
18018 message: msg.message,
18019 type: msg.type,
18020 wrap: msg.wrap,
18021 fromBounds: Math.min.apply(null, allBounds),
18022 toBounds: Math.max.apply(null, allBounds)
18023 };
18024};
18025
18026var calculateLoopBounds = function calculateLoopBounds(messages, actors) {
18027 var loops = {};
18028 var stack = [];
18029 var current, noteModel, msgModel;
18030 messages.forEach(function (msg) {
18031 msg.id = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].random({
18032 length: 10
18033 });
18034
18035 switch (msg.type) {
18036 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.LOOP_START:
18037 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_START:
18038 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.OPT_START:
18039 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_START:
18040 stack.push({
18041 id: msg.id,
18042 msg: msg.message,
18043 from: Number.MAX_SAFE_INTEGER,
18044 to: Number.MIN_SAFE_INTEGER,
18045 width: 0
18046 });
18047 break;
18048
18049 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_ELSE:
18050 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_AND:
18051 if (msg.message) {
18052 current = stack.pop();
18053 loops[current.id] = current;
18054 loops[msg.id] = current;
18055 stack.push(current);
18056 }
18057
18058 break;
18059
18060 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.LOOP_END:
18061 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_END:
18062 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.OPT_END:
18063 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_END:
18064 current = stack.pop();
18065 loops[current.id] = current;
18066 break;
18067
18068 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ACTIVE_START:
18069 {
18070 var actorRect = actors[msg.from ? msg.from.actor : msg.to.actor];
18071 var stackedSize = actorActivations(msg.from ? msg.from.actor : msg.to.actor).length;
18072 var x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
18073 var toAdd = {
18074 startx: x,
18075 stopx: x + conf.activationWidth,
18076 actor: msg.from.actor,
18077 enabled: true
18078 };
18079 bounds.activations.push(toAdd);
18080 }
18081 break;
18082
18083 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ACTIVE_END:
18084 {
18085 var lastActorActivationIdx = bounds.activations.map(function (a) {
18086 return a.actor;
18087 }).lastIndexOf(msg.from.actor);
18088 delete bounds.activations.splice(lastActorActivationIdx, 1)[0];
18089 }
18090 break;
18091 }
18092
18093 var isNote = msg.placement !== undefined;
18094
18095 if (isNote) {
18096 noteModel = buildNoteModel(msg, actors);
18097 msg.noteModel = noteModel;
18098 stack.forEach(function (stk) {
18099 current = stk;
18100 current.from = Math.min(current.from, noteModel.startx);
18101 current.to = Math.max(current.to, noteModel.startx + noteModel.width);
18102 current.width = Math.max(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
18103 });
18104 } else {
18105 msgModel = buildMessageModel(msg, actors);
18106 msg.msgModel = msgModel;
18107
18108 if (msgModel.startx && msgModel.stopx && stack.length > 0) {
18109 stack.forEach(function (stk) {
18110 current = stk;
18111
18112 if (msgModel.startx === msgModel.stopx) {
18113 var from = actors[msg.from];
18114 var to = actors[msg.to];
18115 current.from = Math.min(from.x - msgModel.width / 2, from.x - from.width / 2, current.from);
18116 current.to = Math.max(to.x + msgModel.width / 2, to.x + from.width / 2, current.to);
18117 current.width = Math.max(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth;
18118 } else {
18119 current.from = Math.min(msgModel.startx, current.from);
18120 current.to = Math.max(msgModel.stopx, current.to);
18121 current.width = Math.max(current.width, msgModel.width) - conf.labelBoxWidth;
18122 }
18123 });
18124 }
18125 }
18126 });
18127 bounds.activations = [];
18128 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Loop type widths:', loops);
18129 return loops;
18130};
18131
18132/* harmony default export */ __webpack_exports__["default"] = ({
18133 bounds: bounds,
18134 drawActors: drawActors,
18135 setConf: setConf,
18136 draw: draw
18137});
18138
18139/***/ }),
18140
18141/***/ "./src/diagrams/sequence/styles.js":
18142/*!*****************************************!*\
18143 !*** ./src/diagrams/sequence/styles.js ***!
18144 \*****************************************/
18145/*! exports provided: default */
18146/***/ (function(module, __webpack_exports__, __webpack_require__) {
18147
18148"use strict";
18149__webpack_require__.r(__webpack_exports__);
18150var getStyles = function getStyles(options) {
18151 return ".actor {\n stroke: ".concat(options.actorBorder, ";\n fill: ").concat(options.actorBkg, ";\n }\n\n text.actor > tspan {\n fill: ").concat(options.actorTextColor, ";\n stroke: none;\n }\n\n .actor-line {\n stroke: ").concat(options.actorLineColor, ";\n }\n\n .messageLine0 {\n stroke-width: 1.5;\n stroke-dasharray: none;\n stroke: ").concat(options.signalColor, ";\n }\n\n .messageLine1 {\n stroke-width: 1.5;\n stroke-dasharray: 2, 2;\n stroke: ").concat(options.signalColor, ";\n }\n\n #arrowhead path {\n fill: ").concat(options.signalColor, ";\n stroke: ").concat(options.signalColor, ";\n }\n\n .sequenceNumber {\n fill: ").concat(options.sequenceNumberColor, ";\n }\n\n #sequencenumber {\n fill: ").concat(options.signalColor, ";\n }\n\n #crosshead path {\n fill: ").concat(options.signalColor, ";\n stroke: ").concat(options.signalColor, ";\n }\n\n .messageText {\n fill: ").concat(options.signalTextColor, ";\n stroke: ").concat(options.signalTextColor, ";\n }\n\n .labelBox {\n stroke: ").concat(options.labelBoxBorderColor, ";\n fill: ").concat(options.labelBoxBkgColor, ";\n }\n\n .labelText, .labelText > tspan {\n fill: ").concat(options.labelTextColor, ";\n stroke: none;\n }\n\n .loopText, .loopText > tspan {\n fill: ").concat(options.loopTextColor, ";\n stroke: none;\n }\n\n .loopLine {\n stroke-width: 2px;\n stroke-dasharray: 2, 2;\n stroke: ").concat(options.labelBoxBorderColor, ";\n fill: ").concat(options.labelBoxBorderColor, ";\n }\n\n .note {\n //stroke: #decc93;\n stroke: ").concat(options.noteBorderColor, ";\n fill: ").concat(options.noteBkgColor, ";\n }\n\n .noteText, .noteText > tspan {\n fill: ").concat(options.noteTextColor, ";\n stroke: none;\n }\n\n .activation0 {\n fill: ").concat(options.activationBkgColor, ";\n stroke: ").concat(options.activationBorderColor, ";\n }\n\n .activation1 {\n fill: ").concat(options.activationBkgColor, ";\n stroke: ").concat(options.activationBorderColor, ";\n }\n\n .activation2 {\n fill: ").concat(options.activationBkgColor, ";\n stroke: ").concat(options.activationBorderColor, ";\n }\n");
18152};
18153
18154/* harmony default export */ __webpack_exports__["default"] = (getStyles);
18155
18156/***/ }),
18157
18158/***/ "./src/diagrams/sequence/svgDraw.js":
18159/*!******************************************!*\
18160 !*** ./src/diagrams/sequence/svgDraw.js ***!
18161 \******************************************/
18162/*! exports provided: drawRect, drawText, drawLabel, drawActor, anchorElement, drawActivation, drawLoop, drawBackgroundRect, insertArrowHead, insertSequenceNumber, insertArrowCrossHead, getTextObj, getNoteRect, default */
18163/***/ (function(module, __webpack_exports__, __webpack_require__) {
18164
18165"use strict";
18166__webpack_require__.r(__webpack_exports__);
18167/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawRect", function() { return drawRect; });
18168/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawText", function() { return drawText; });
18169/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawLabel", function() { return drawLabel; });
18170/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawActor", function() { return drawActor; });
18171/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "anchorElement", function() { return anchorElement; });
18172/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawActivation", function() { return drawActivation; });
18173/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawLoop", function() { return drawLoop; });
18174/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawBackgroundRect", function() { return drawBackgroundRect; });
18175/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertArrowHead", function() { return insertArrowHead; });
18176/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertSequenceNumber", function() { return insertSequenceNumber; });
18177/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertArrowCrossHead", function() { return insertArrowCrossHead; });
18178/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextObj", function() { return getTextObj; });
18179/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNoteRect", function() { return getNoteRect; });
18180/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
18181
18182var drawRect = function drawRect(elem, rectData) {
18183 var rectElem = elem.append('rect');
18184 rectElem.attr('x', rectData.x);
18185 rectElem.attr('y', rectData.y);
18186 rectElem.attr('fill', rectData.fill);
18187 rectElem.attr('stroke', rectData.stroke);
18188 rectElem.attr('width', rectData.width);
18189 rectElem.attr('height', rectData.height);
18190 rectElem.attr('rx', rectData.rx);
18191 rectElem.attr('ry', rectData.ry);
18192
18193 if (typeof rectData.class !== 'undefined') {
18194 rectElem.attr('class', rectData.class);
18195 }
18196
18197 return rectElem;
18198};
18199var drawText = function drawText(elem, textData) {
18200 var prevTextHeight = 0,
18201 textHeight = 0;
18202 var lines = textData.wrap ? textData.text.split(_common_common__WEBPACK_IMPORTED_MODULE_0__["default"].lineBreakRegex) : [textData.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_0__["default"].lineBreakRegex, ' ')];
18203 var textElems = [];
18204 var dy = 0;
18205
18206 var yfunc = function yfunc() {
18207 return textData.y;
18208 };
18209
18210 if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
18211 switch (textData.valign) {
18212 case 'top':
18213 case 'start':
18214 yfunc = function yfunc() {
18215 return Math.round(textData.y + textData.textMargin);
18216 };
18217
18218 break;
18219
18220 case 'middle':
18221 case 'center':
18222 yfunc = function yfunc() {
18223 return Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2);
18224 };
18225
18226 break;
18227
18228 case 'bottom':
18229 case 'end':
18230 yfunc = function yfunc() {
18231 return Math.round(textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin);
18232 };
18233
18234 break;
18235 }
18236 }
18237
18238 if (typeof textData.anchor !== 'undefined' && typeof textData.textMargin !== 'undefined' && typeof textData.width !== 'undefined') {
18239 switch (textData.anchor) {
18240 case 'left':
18241 case 'start':
18242 textData.x = Math.round(textData.x + textData.textMargin);
18243 textData.anchor = 'start';
18244 textData.dominantBaseline = 'text-after-edge';
18245 textData.alignmentBaseline = 'middle';
18246 break;
18247
18248 case 'middle':
18249 case 'center':
18250 textData.x = Math.round(textData.x + textData.width / 2);
18251 textData.anchor = 'middle';
18252 textData.dominantBaseline = 'middle';
18253 textData.alignmentBaseline = 'middle';
18254 break;
18255
18256 case 'right':
18257 case 'end':
18258 textData.x = Math.round(textData.x + textData.width - textData.textMargin);
18259 textData.anchor = 'end';
18260 textData.dominantBaseline = 'text-before-edge';
18261 textData.alignmentBaseline = 'middle';
18262 break;
18263 }
18264 }
18265
18266 for (var i = 0; i < lines.length; i++) {
18267 var line = lines[i];
18268
18269 if (typeof textData.textMargin !== 'undefined' && textData.textMargin === 0 && typeof textData.fontSize !== 'undefined') {
18270 dy = i * textData.fontSize;
18271 }
18272
18273 var textElem = elem.append('text');
18274 textElem.attr('x', textData.x);
18275 textElem.attr('y', yfunc());
18276
18277 if (typeof textData.anchor !== 'undefined') {
18278 textElem.attr('text-anchor', textData.anchor).attr('dominant-baseline', textData.dominantBaseline).attr('alignment-baseline', textData.alignmentBaseline);
18279 }
18280
18281 if (typeof textData.fontFamily !== 'undefined') {
18282 textElem.style('font-family', textData.fontFamily);
18283 }
18284
18285 if (typeof textData.fontSize !== 'undefined') {
18286 textElem.style('font-size', textData.fontSize);
18287 }
18288
18289 if (typeof textData.fontWeight !== 'undefined') {
18290 textElem.style('font-weight', textData.fontWeight);
18291 }
18292
18293 if (typeof textData.fill !== 'undefined') {
18294 textElem.attr('fill', textData.fill);
18295 }
18296
18297 if (typeof textData.class !== 'undefined') {
18298 textElem.attr('class', textData.class);
18299 }
18300
18301 if (typeof textData.dy !== 'undefined') {
18302 textElem.attr('dy', textData.dy);
18303 } else if (dy !== 0) {
18304 textElem.attr('dy', dy);
18305 }
18306
18307 if (textData.tspan) {
18308 var span = textElem.append('tspan');
18309 span.attr('x', textData.x);
18310
18311 if (typeof textData.fill !== 'undefined') {
18312 span.attr('fill', textData.fill);
18313 }
18314
18315 span.text(line);
18316 } else {
18317 textElem.text(line);
18318 }
18319
18320 if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
18321 textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
18322 prevTextHeight = textHeight;
18323 }
18324
18325 textElems.push(textElem);
18326 }
18327
18328 return textElems;
18329};
18330var drawLabel = function drawLabel(elem, txtObject) {
18331 function genPoints(x, y, width, height, cut) {
18332 return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height);
18333 }
18334
18335 var polygon = elem.append('polygon');
18336 polygon.attr('points', genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
18337 polygon.attr('class', 'labelBox');
18338 txtObject.y = txtObject.y + txtObject.height / 2;
18339 drawText(elem, txtObject);
18340 return polygon;
18341};
18342var actorCnt = -1;
18343/**
18344 * Draws an actor in the diagram with the attached line
18345 * @param elem - The diagram we'll draw to.
18346 * @param actor - The actor to draw.
18347 * @param conf - drawText implementation discriminator object
18348 */
18349
18350var drawActor = function drawActor(elem, actor, conf) {
18351 var center = actor.x + actor.width / 2;
18352 var g = elem.append('g');
18353
18354 if (actor.y === 0) {
18355 actorCnt++;
18356 g.append('line').attr('id', 'actor' + actorCnt).attr('x1', center).attr('y1', 5).attr('x2', center).attr('y2', 2000).attr('class', 'actor-line').attr('stroke-width', '0.5px').attr('stroke', '#999');
18357 }
18358
18359 var rect = getNoteRect();
18360 rect.x = actor.x;
18361 rect.y = actor.y;
18362 rect.fill = '#eaeaea';
18363 rect.width = actor.width;
18364 rect.height = actor.height;
18365 rect.class = 'actor';
18366 rect.rx = 3;
18367 rect.ry = 3;
18368 drawRect(g, rect);
18369
18370 _drawTextCandidateFunc(conf)(actor.description, g, rect.x, rect.y, rect.width, rect.height, {
18371 class: 'actor'
18372 }, conf);
18373};
18374var anchorElement = function anchorElement(elem) {
18375 return elem.append('g');
18376};
18377/**
18378 * Draws an activation in the diagram
18379 * @param elem - element to append activation rect.
18380 * @param bounds - activation box bounds.
18381 * @param verticalPos - precise y cooridnate of bottom activation box edge.
18382 * @param conf - sequence diagram config object.
18383 * @param actorActivations - number of activations on the actor.
18384 */
18385
18386var drawActivation = function drawActivation(elem, bounds, verticalPos, conf, actorActivations) {
18387 var rect = getNoteRect();
18388 var g = bounds.anchored;
18389 rect.x = bounds.startx;
18390 rect.y = bounds.starty;
18391 rect.class = 'activation' + actorActivations % 3; // Will evaluate to 0, 1 or 2
18392
18393 rect.width = bounds.stopx - bounds.startx;
18394 rect.height = verticalPos - bounds.starty;
18395 drawRect(g, rect);
18396};
18397/**
18398 * Draws a loop in the diagram
18399 * @param elem - elemenet to append the loop to.
18400 * @param loopModel - loopModel of the given loop.
18401 * @param labelText - Text within the loop.
18402 * @param conf - diagrom configuration
18403 */
18404
18405var drawLoop = function drawLoop(elem, loopModel, labelText, conf) {
18406 var boxMargin = conf.boxMargin,
18407 boxTextMargin = conf.boxTextMargin,
18408 labelBoxHeight = conf.labelBoxHeight,
18409 labelBoxWidth = conf.labelBoxWidth,
18410 fontFamily = conf.messageFontFamily,
18411 fontSize = conf.messageFontSize,
18412 fontWeight = conf.messageFontWeight;
18413 var g = elem.append('g');
18414
18415 var drawLoopLine = function drawLoopLine(startx, starty, stopx, stopy) {
18416 return g.append('line').attr('x1', startx).attr('y1', starty).attr('x2', stopx).attr('y2', stopy).attr('class', 'loopLine');
18417 };
18418
18419 drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
18420 drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
18421 drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
18422 drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
18423
18424 if (typeof loopModel.sections !== 'undefined') {
18425 loopModel.sections.forEach(function (item) {
18426 drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style('stroke-dasharray', '3, 3');
18427 });
18428 }
18429
18430 var txt = getTextObj();
18431 txt.text = labelText;
18432 txt.x = loopModel.startx;
18433 txt.y = loopModel.starty;
18434 txt.fontFamily = fontFamily;
18435 txt.fontSize = fontSize;
18436 txt.fontWeight = fontWeight;
18437 txt.anchor = 'middle';
18438 txt.valign = 'middle';
18439 txt.tspan = false;
18440 txt.width = labelBoxWidth || 50;
18441 txt.height = labelBoxHeight || 20;
18442 txt.textMargin = boxTextMargin;
18443 txt.class = 'labelText';
18444 drawLabel(g, txt);
18445 txt = getTextObj();
18446 txt.text = loopModel.title;
18447 txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
18448 txt.y = loopModel.starty + boxMargin + boxTextMargin;
18449 txt.anchor = 'middle';
18450 txt.valign = 'middle';
18451 txt.textMargin = boxTextMargin;
18452 txt.class = 'loopText';
18453 txt.fontFamily = fontFamily;
18454 txt.fontSize = fontSize;
18455 txt.fontWeight = fontWeight;
18456 txt.wrap = true;
18457 var textElem = drawText(g, txt);
18458
18459 if (typeof loopModel.sectionTitles !== 'undefined') {
18460 loopModel.sectionTitles.forEach(function (item, idx) {
18461 if (item.message) {
18462 txt.text = item.message;
18463 txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
18464 txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
18465 txt.class = 'loopText';
18466 txt.anchor = 'middle';
18467 txt.valign = 'middle';
18468 txt.tspan = false;
18469 txt.fontFamily = fontFamily;
18470 txt.fontSize = fontSize;
18471 txt.fontWeight = fontWeight;
18472 txt.wrap = loopModel.wrap;
18473 textElem = drawText(g, txt);
18474 var sectionHeight = Math.round(textElem.map(function (te) {
18475 return (te._groups || te)[0][0].getBBox().height;
18476 }).reduce(function (acc, curr) {
18477 return acc + curr;
18478 }));
18479 loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
18480 }
18481 });
18482 }
18483
18484 loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
18485 return g;
18486};
18487/**
18488 * Draws a background rectangle
18489 * @param elem diagram (reference for bounds)
18490 * @param bounds shape of the rectangle
18491 */
18492
18493var drawBackgroundRect = function drawBackgroundRect(elem, bounds) {
18494 var rectElem = drawRect(elem, {
18495 x: bounds.startx,
18496 y: bounds.starty,
18497 width: bounds.stopx - bounds.startx,
18498 height: bounds.stopy - bounds.starty,
18499 fill: bounds.fill,
18500 class: 'rect'
18501 });
18502 rectElem.lower();
18503};
18504/**
18505 * Setup arrow head and define the marker. The result is appended to the svg.
18506 */
18507
18508var insertArrowHead = function insertArrowHead(elem) {
18509 elem.append('defs').append('marker').attr('id', 'arrowhead').attr('refX', 5).attr('refY', 2).attr('markerWidth', 6).attr('markerHeight', 4).attr('orient', 'auto').append('path').attr('d', 'M 0,0 V 4 L6,2 Z'); // this is actual shape for arrowhead
18510};
18511/**
18512 * Setup node number. The result is appended to the svg.
18513 */
18514
18515var insertSequenceNumber = function insertSequenceNumber(elem) {
18516 elem.append('defs').append('marker').attr('id', 'sequencenumber').attr('refX', 15).attr('refY', 15).attr('markerWidth', 60).attr('markerHeight', 40).attr('orient', 'auto').append('circle').attr('cx', 15).attr('cy', 15).attr('r', 6); // .style("fill", '#f00');
18517};
18518/**
18519 * Setup arrow head and define the marker. The result is appended to the svg.
18520 */
18521
18522var insertArrowCrossHead = function insertArrowCrossHead(elem) {
18523 var defs = elem.append('defs');
18524 var marker = defs.append('marker').attr('id', 'crosshead').attr('markerWidth', 15).attr('markerHeight', 8).attr('orient', 'auto').attr('refX', 16).attr('refY', 4); // The arrow
18525
18526 marker.append('path').attr('fill', 'black').attr('stroke', '#000000').style('stroke-dasharray', '0, 0').attr('stroke-width', '1px').attr('d', 'M 9,2 V 6 L16,4 Z'); // The cross
18527
18528 marker.append('path').attr('fill', 'none').attr('stroke', '#000000').style('stroke-dasharray', '0, 0').attr('stroke-width', '1px').attr('d', 'M 0,1 L 6,7 M 6,1 L 0,7'); // this is actual shape for arrowhead
18529};
18530var getTextObj = function getTextObj() {
18531 return {
18532 x: 0,
18533 y: 0,
18534 fill: undefined,
18535 anchor: undefined,
18536 style: '#666',
18537 width: undefined,
18538 height: undefined,
18539 textMargin: 0,
18540 rx: 0,
18541 ry: 0,
18542 tspan: true,
18543 valign: undefined
18544 };
18545};
18546var getNoteRect = function getNoteRect() {
18547 return {
18548 x: 0,
18549 y: 0,
18550 fill: '#EDF2AE',
18551 stroke: '#666',
18552 width: 100,
18553 anchor: 'start',
18554 height: 100,
18555 rx: 0,
18556 ry: 0
18557 };
18558};
18559
18560var _drawTextCandidateFunc = function () {
18561 function byText(content, g, x, y, width, height, textAttrs) {
18562 var text = g.append('text').attr('x', x + width / 2).attr('y', y + height / 2 + 5).style('text-anchor', 'middle').text(content);
18563
18564 _setTextAttrs(text, textAttrs);
18565 }
18566
18567 function byTspan(content, g, x, y, width, height, textAttrs, conf) {
18568 var actorFontSize = conf.actorFontSize,
18569 actorFontFamily = conf.actorFontFamily,
18570 actorFontWeight = conf.actorFontWeight;
18571 var lines = content.split(_common_common__WEBPACK_IMPORTED_MODULE_0__["default"].lineBreakRegex);
18572
18573 for (var i = 0; i < lines.length; i++) {
18574 var dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
18575 var text = g.append('text').attr('x', x + width / 2).attr('y', y).style('text-anchor', 'middle').style('font-size', actorFontSize).style('font-weight', actorFontWeight).style('font-family', actorFontFamily);
18576 text.append('tspan').attr('x', x + width / 2).attr('dy', dy).text(lines[i]);
18577 text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
18578
18579 _setTextAttrs(text, textAttrs);
18580 }
18581 }
18582
18583 function byFo(content, g, x, y, width, height, textAttrs, conf) {
18584 var s = g.append('switch');
18585 var f = s.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height);
18586 var text = f.append('div').style('display', 'table').style('height', '100%').style('width', '100%');
18587 text.append('div').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle').text(content);
18588 byTspan(content, s, x, y, width, height, textAttrs, conf);
18589
18590 _setTextAttrs(text, textAttrs);
18591 }
18592
18593 function _setTextAttrs(toText, fromTextAttrsDict) {
18594 for (var key in fromTextAttrsDict) {
18595 if (fromTextAttrsDict.hasOwnProperty(key)) {
18596 // eslint-disable-line
18597 toText.attr(key, fromTextAttrsDict[key]);
18598 }
18599 }
18600 }
18601
18602 return function (conf) {
18603 return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
18604 };
18605}();
18606
18607/* harmony default export */ __webpack_exports__["default"] = ({
18608 drawRect: drawRect,
18609 drawText: drawText,
18610 drawLabel: drawLabel,
18611 drawActor: drawActor,
18612 anchorElement: anchorElement,
18613 drawActivation: drawActivation,
18614 drawLoop: drawLoop,
18615 drawBackgroundRect: drawBackgroundRect,
18616 insertArrowHead: insertArrowHead,
18617 insertSequenceNumber: insertSequenceNumber,
18618 insertArrowCrossHead: insertArrowCrossHead,
18619 getTextObj: getTextObj,
18620 getNoteRect: getNoteRect
18621});
18622
18623/***/ }),
18624
18625/***/ "./src/diagrams/state/id-cache.js":
18626/*!****************************************!*\
18627 !*** ./src/diagrams/state/id-cache.js ***!
18628 \****************************************/
18629/*! exports provided: set, get, keys, size, default */
18630/***/ (function(module, __webpack_exports__, __webpack_require__) {
18631
18632"use strict";
18633__webpack_require__.r(__webpack_exports__);
18634/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; });
18635/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; });
18636/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return keys; });
18637/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return size; });
18638var idCache = {};
18639var set = function set(key, val) {
18640 idCache[key] = val;
18641};
18642var get = function get(k) {
18643 return idCache[k];
18644};
18645var keys = function keys() {
18646 return Object.keys(idCache);
18647};
18648var size = function size() {
18649 return keys().length;
18650};
18651/* harmony default export */ __webpack_exports__["default"] = ({
18652 get: get,
18653 set: set,
18654 keys: keys,
18655 size: size
18656});
18657
18658/***/ }),
18659
18660/***/ "./src/diagrams/state/parser/stateDiagram.jison":
18661/*!******************************************************!*\
18662 !*** ./src/diagrams/state/parser/stateDiagram.jison ***!
18663 \******************************************************/
18664/*! no static exports found */
18665/***/ (function(module, exports, __webpack_require__) {
18666
18667/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
18668/*
18669 Returns a Parser object of the following structure:
18670
18671 Parser: {
18672 yy: {}
18673 }
18674
18675 Parser.prototype: {
18676 yy: {},
18677 trace: function(),
18678 symbols_: {associative list: name ==> number},
18679 terminals_: {associative list: number ==> name},
18680 productions_: [...],
18681 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
18682 table: [...],
18683 defaultActions: {...},
18684 parseError: function(str, hash),
18685 parse: function(input),
18686
18687 lexer: {
18688 EOF: 1,
18689 parseError: function(str, hash),
18690 setInput: function(input),
18691 input: function(),
18692 unput: function(str),
18693 more: function(),
18694 less: function(n),
18695 pastInput: function(),
18696 upcomingInput: function(),
18697 showPosition: function(),
18698 test_match: function(regex_match_array, rule_index),
18699 next: function(),
18700 lex: function(),
18701 begin: function(condition),
18702 popState: function(),
18703 _currentRules: function(),
18704 topState: function(),
18705 pushState: function(condition),
18706
18707 options: {
18708 ranges: boolean (optional: true ==> token location info will include a .range[] member)
18709 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
18710 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
18711 },
18712
18713 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
18714 rules: [...],
18715 conditions: {associative list: name ==> set},
18716 }
18717 }
18718
18719
18720 token location info (@$, _$, etc.): {
18721 first_line: n,
18722 last_line: n,
18723 first_column: n,
18724 last_column: n,
18725 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
18726 }
18727
18728
18729 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
18730 text: (matched text)
18731 token: (the produced terminal token, if any)
18732 line: (yylineno)
18733 }
18734 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
18735 loc: (yylloc)
18736 expected: (string describing the set of expected tokens)
18737 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
18738 }
18739*/
18740var parser = (function(){
18741var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,3],$V2=[1,5],$V3=[1,7],$V4=[2,5],$V5=[1,15],$V6=[1,17],$V7=[1,19],$V8=[1,20],$V9=[1,21],$Va=[1,22],$Vb=[1,28],$Vc=[1,23],$Vd=[1,24],$Ve=[1,25],$Vf=[1,26],$Vg=[1,29],$Vh=[1,32],$Vi=[1,4,5,14,15,17,19,20,22,23,24,25,26,36,39],$Vj=[1,4,5,12,13,14,15,17,19,20,22,23,24,25,26,36,39],$Vk=[1,4,5,7,14,15,17,19,20,22,23,24,25,26,36,39],$Vl=[4,5,14,15,17,19,20,22,23,24,25,26,36,39];
18742var parser = {trace: function trace () { },
18743yy: {},
18744symbols_: {"error":2,"start":3,"SPACE":4,"NL":5,"directive":6,"SD":7,"document":8,"line":9,"statement":10,"idStatement":11,"DESCR":12,"-->":13,"HIDE_EMPTY":14,"scale":15,"WIDTH":16,"COMPOSIT_STATE":17,"STRUCT_START":18,"STRUCT_STOP":19,"STATE_DESCR":20,"AS":21,"ID":22,"FORK":23,"JOIN":24,"CONCURRENT":25,"note":26,"notePosition":27,"NOTE_TEXT":28,"openDirective":29,"typeDirective":30,"closeDirective":31,":":32,"argDirective":33,"eol":34,";":35,"EDGE_STATE":36,"left_of":37,"right_of":38,"open_directive":39,"type_directive":40,"arg_directive":41,"close_directive":42,"$accept":0,"$end":1},
18745terminals_: {2:"error",4:"SPACE",5:"NL",7:"SD",12:"DESCR",13:"-->",14:"HIDE_EMPTY",15:"scale",16:"WIDTH",17:"COMPOSIT_STATE",18:"STRUCT_START",19:"STRUCT_STOP",20:"STATE_DESCR",21:"AS",22:"ID",23:"FORK",24:"JOIN",25:"CONCURRENT",26:"note",28:"NOTE_TEXT",32:":",35:";",36:"EDGE_STATE",37:"left_of",38:"right_of",39:"open_directive",40:"type_directive",41:"arg_directive",42:"close_directive"},
18746productions_: [0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,1],[10,2],[10,1],[10,4],[10,3],[10,6],[10,1],[10,1],[10,1],[10,4],[10,4],[10,1],[6,3],[6,5],[34,1],[34,1],[11,1],[11,1],[27,1],[27,1],[29,1],[30,1],[33,1],[31,1]],
18747performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
18748/* this == yyval */
18749
18750var $0 = $$.length - 1;
18751switch (yystate) {
18752case 4:
18753 /*console.warn('Root document', $$[$0]);*/ yy.setRootDoc($$[$0]);return $$[$0];
18754break;
18755case 5:
18756 this.$ = []
18757break;
18758case 6:
18759
18760 if($$[$0]!='nl'){
18761 $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
18762 }
18763 // console.warn('Got document',$$[$0-1], $$[$0]);
18764
18765break;
18766case 7: case 8:
18767 this.$ = $$[$0]
18768break;
18769case 9:
18770 this.$='nl';
18771break;
18772case 10:
18773 /*console.warn('got id and descr', $$[$0]);*/this.$={ stmt: 'state', id: $$[$0], type: 'default', description: ''};
18774break;
18775case 11:
18776 /*console.warn('got id and descr', $$[$0-1], $$[$0].trim());*/this.$={ stmt: 'state', id: $$[$0-1], type: 'default', description: yy.trimColon($$[$0])};
18777break;
18778case 12:
18779
18780 /*console.warn('got id', $$[$0-2]);yy.addRelation($$[$0-2], $$[$0]);*/
18781 this.$={ stmt: 'relation', state1: { stmt: 'state', id: $$[$0-2], type: 'default', description: '' }, state2:{ stmt: 'state', id: $$[$0] ,type: 'default', description: ''}};
18782
18783break;
18784case 13:
18785
18786 /*yy.addRelation($$[$0-3], $$[$0-1], $$[$0].substr(1).trim());*/
18787 this.$={ stmt: 'relation', state1: { stmt: 'state', id: $$[$0-3], type: 'default', description: '' }, state2:{ stmt: 'state', id: $$[$0-1] ,type: 'default', description: ''}, description: $$[$0].substr(1).trim()};
18788
18789break;
18790case 17:
18791
18792
18793 /* console.warn('Adding document for state without id ', $$[$0-3]);*/
18794 this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: '', doc: $$[$0-1] }
18795
18796break;
18797case 18:
18798
18799 var id=$$[$0];
18800 var description = $$[$0-2].trim();
18801 if($$[$0].match(':')){
18802 var parts = $$[$0].split(':');
18803 id=parts[0];
18804 description = [description, parts[1]];
18805 }
18806 this.$={stmt: 'state', id: id, type: 'default', description: description};
18807
18808
18809break;
18810case 19:
18811
18812 //console.warn('Adding document for state with id ', $$[$0-3], $$[$0-2]); yy.addDocument($$[$0-3]);
18813 this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: $$[$0-5], doc: $$[$0-1] }
18814
18815break;
18816case 20:
18817
18818 this.$={ stmt: 'state', id: $$[$0], type: 'fork' }
18819
18820break;
18821case 21:
18822
18823 this.$={ stmt: 'state', id: $$[$0], type: 'join' }
18824
18825break;
18826case 22:
18827
18828 this.$={ stmt: 'state', id: yy.getDividerId(), type: 'divider' }
18829
18830break;
18831case 23:
18832
18833 /*console.warn('got NOTE, position: ', $$[$0-2].trim(), 'id = ', $$[$0-1].trim(), 'note: ', $$[$0]);*/
18834 this.$={ stmt: 'state', id: $$[$0-1].trim(), note:{position: $$[$0-2].trim(), text: $$[$0].trim()}};
18835
18836break;
18837case 30: case 31:
18838this.$=$$[$0];
18839break;
18840case 34:
18841 yy.parseDirective('%%{', 'open_directive');
18842break;
18843case 35:
18844 yy.parseDirective($$[$0], 'type_directive');
18845break;
18846case 36:
18847 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
18848break;
18849case 37:
18850 yy.parseDirective('}%%', 'close_directive', 'state');
18851break;
18852}
18853},
18854table: [{3:1,4:$V0,5:$V1,6:4,7:$V2,29:6,39:$V3},{1:[3]},{3:8,4:$V0,5:$V1,6:4,7:$V2,29:6,39:$V3},{3:9,4:$V0,5:$V1,6:4,7:$V2,29:6,39:$V3},{3:10,4:$V0,5:$V1,6:4,7:$V2,29:6,39:$V3},o([1,4,5,14,15,17,20,22,23,24,25,26,36,39],$V4,{8:11}),{30:12,40:[1,13]},{40:[2,34]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:$V5,5:$V6,6:27,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,29:6,36:$Vg,39:$V3},{31:30,32:[1,31],42:$Vh},o([32,42],[2,35]),o($Vi,[2,6]),{6:27,10:33,11:18,14:$V7,15:$V8,17:$V9,20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,29:6,36:$Vg,39:$V3},o($Vi,[2,8]),o($Vi,[2,9]),o($Vi,[2,10],{12:[1,34],13:[1,35]}),o($Vi,[2,14]),{16:[1,36]},o($Vi,[2,16],{18:[1,37]}),{21:[1,38]},o($Vi,[2,20]),o($Vi,[2,21]),o($Vi,[2,22]),{27:39,28:[1,40],37:[1,41],38:[1,42]},o($Vi,[2,25]),o($Vj,[2,30]),o($Vj,[2,31]),o($Vk,[2,26]),{33:43,41:[1,44]},o($Vk,[2,37]),o($Vi,[2,7]),o($Vi,[2,11]),{11:45,22:$Vb,36:$Vg},o($Vi,[2,15]),o($Vl,$V4,{8:46}),{22:[1,47]},{22:[1,48]},{21:[1,49]},{22:[2,32]},{22:[2,33]},{31:50,42:$Vh},{42:[2,36]},o($Vi,[2,12],{12:[1,51]}),{4:$V5,5:$V6,6:27,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,19:[1,52],20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,29:6,36:$Vg,39:$V3},o($Vi,[2,18],{18:[1,53]}),{28:[1,54]},{22:[1,55]},o($Vk,[2,27]),o($Vi,[2,13]),o($Vi,[2,17]),o($Vl,$V4,{8:56}),o($Vi,[2,23]),o($Vi,[2,24]),{4:$V5,5:$V6,6:27,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,19:[1,57],20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,29:6,36:$Vg,39:$V3},o($Vi,[2,19])],
18855defaultActions: {7:[2,34],8:[2,1],9:[2,2],10:[2,3],41:[2,32],42:[2,33],44:[2,36]},
18856parseError: function parseError (str, hash) {
18857 if (hash.recoverable) {
18858 this.trace(str);
18859 } else {
18860 var error = new Error(str);
18861 error.hash = hash;
18862 throw error;
18863 }
18864},
18865parse: function parse(input) {
18866 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
18867 var args = lstack.slice.call(arguments, 1);
18868 var lexer = Object.create(this.lexer);
18869 var sharedState = { yy: {} };
18870 for (var k in this.yy) {
18871 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
18872 sharedState.yy[k] = this.yy[k];
18873 }
18874 }
18875 lexer.setInput(input, sharedState.yy);
18876 sharedState.yy.lexer = lexer;
18877 sharedState.yy.parser = this;
18878 if (typeof lexer.yylloc == 'undefined') {
18879 lexer.yylloc = {};
18880 }
18881 var yyloc = lexer.yylloc;
18882 lstack.push(yyloc);
18883 var ranges = lexer.options && lexer.options.ranges;
18884 if (typeof sharedState.yy.parseError === 'function') {
18885 this.parseError = sharedState.yy.parseError;
18886 } else {
18887 this.parseError = Object.getPrototypeOf(this).parseError;
18888 }
18889 function popStack(n) {
18890 stack.length = stack.length - 2 * n;
18891 vstack.length = vstack.length - n;
18892 lstack.length = lstack.length - n;
18893 }
18894 function lex() {
18895 var token;
18896 token = tstack.pop() || lexer.lex() || EOF;
18897 if (typeof token !== 'number') {
18898 if (token instanceof Array) {
18899 tstack = token;
18900 token = tstack.pop();
18901 }
18902 token = self.symbols_[token] || token;
18903 }
18904 return token;
18905 }
18906 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
18907 while (true) {
18908 state = stack[stack.length - 1];
18909 if (this.defaultActions[state]) {
18910 action = this.defaultActions[state];
18911 } else {
18912 if (symbol === null || typeof symbol == 'undefined') {
18913 symbol = lex();
18914 }
18915 action = table[state] && table[state][symbol];
18916 }
18917 if (typeof action === 'undefined' || !action.length || !action[0]) {
18918 var errStr = '';
18919 expected = [];
18920 for (p in table[state]) {
18921 if (this.terminals_[p] && p > TERROR) {
18922 expected.push('\'' + this.terminals_[p] + '\'');
18923 }
18924 }
18925 if (lexer.showPosition) {
18926 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
18927 } else {
18928 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
18929 }
18930 this.parseError(errStr, {
18931 text: lexer.match,
18932 token: this.terminals_[symbol] || symbol,
18933 line: lexer.yylineno,
18934 loc: yyloc,
18935 expected: expected
18936 });
18937 }
18938 if (action[0] instanceof Array && action.length > 1) {
18939 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
18940 }
18941 switch (action[0]) {
18942 case 1:
18943 stack.push(symbol);
18944 vstack.push(lexer.yytext);
18945 lstack.push(lexer.yylloc);
18946 stack.push(action[1]);
18947 symbol = null;
18948 if (!preErrorSymbol) {
18949 yyleng = lexer.yyleng;
18950 yytext = lexer.yytext;
18951 yylineno = lexer.yylineno;
18952 yyloc = lexer.yylloc;
18953 if (recovering > 0) {
18954 recovering--;
18955 }
18956 } else {
18957 symbol = preErrorSymbol;
18958 preErrorSymbol = null;
18959 }
18960 break;
18961 case 2:
18962 len = this.productions_[action[1]][1];
18963 yyval.$ = vstack[vstack.length - len];
18964 yyval._$ = {
18965 first_line: lstack[lstack.length - (len || 1)].first_line,
18966 last_line: lstack[lstack.length - 1].last_line,
18967 first_column: lstack[lstack.length - (len || 1)].first_column,
18968 last_column: lstack[lstack.length - 1].last_column
18969 };
18970 if (ranges) {
18971 yyval._$.range = [
18972 lstack[lstack.length - (len || 1)].range[0],
18973 lstack[lstack.length - 1].range[1]
18974 ];
18975 }
18976 r = this.performAction.apply(yyval, [
18977 yytext,
18978 yyleng,
18979 yylineno,
18980 sharedState.yy,
18981 action[1],
18982 vstack,
18983 lstack
18984 ].concat(args));
18985 if (typeof r !== 'undefined') {
18986 return r;
18987 }
18988 if (len) {
18989 stack = stack.slice(0, -1 * len * 2);
18990 vstack = vstack.slice(0, -1 * len);
18991 lstack = lstack.slice(0, -1 * len);
18992 }
18993 stack.push(this.productions_[action[1]][0]);
18994 vstack.push(yyval.$);
18995 lstack.push(yyval._$);
18996 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
18997 stack.push(newState);
18998 break;
18999 case 3:
19000 return true;
19001 }
19002 }
19003 return true;
19004}};
19005
19006/* generated by jison-lex 0.3.4 */
19007var lexer = (function(){
19008var lexer = ({
19009
19010EOF:1,
19011
19012parseError:function parseError(str, hash) {
19013 if (this.yy.parser) {
19014 this.yy.parser.parseError(str, hash);
19015 } else {
19016 throw new Error(str);
19017 }
19018 },
19019
19020// resets the lexer, sets new input
19021setInput:function (input, yy) {
19022 this.yy = yy || this.yy || {};
19023 this._input = input;
19024 this._more = this._backtrack = this.done = false;
19025 this.yylineno = this.yyleng = 0;
19026 this.yytext = this.matched = this.match = '';
19027 this.conditionStack = ['INITIAL'];
19028 this.yylloc = {
19029 first_line: 1,
19030 first_column: 0,
19031 last_line: 1,
19032 last_column: 0
19033 };
19034 if (this.options.ranges) {
19035 this.yylloc.range = [0,0];
19036 }
19037 this.offset = 0;
19038 return this;
19039 },
19040
19041// consumes and returns one char from the input
19042input:function () {
19043 var ch = this._input[0];
19044 this.yytext += ch;
19045 this.yyleng++;
19046 this.offset++;
19047 this.match += ch;
19048 this.matched += ch;
19049 var lines = ch.match(/(?:\r\n?|\n).*/g);
19050 if (lines) {
19051 this.yylineno++;
19052 this.yylloc.last_line++;
19053 } else {
19054 this.yylloc.last_column++;
19055 }
19056 if (this.options.ranges) {
19057 this.yylloc.range[1]++;
19058 }
19059
19060 this._input = this._input.slice(1);
19061 return ch;
19062 },
19063
19064// unshifts one char (or a string) into the input
19065unput:function (ch) {
19066 var len = ch.length;
19067 var lines = ch.split(/(?:\r\n?|\n)/g);
19068
19069 this._input = ch + this._input;
19070 this.yytext = this.yytext.substr(0, this.yytext.length - len);
19071 //this.yyleng -= len;
19072 this.offset -= len;
19073 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
19074 this.match = this.match.substr(0, this.match.length - 1);
19075 this.matched = this.matched.substr(0, this.matched.length - 1);
19076
19077 if (lines.length - 1) {
19078 this.yylineno -= lines.length - 1;
19079 }
19080 var r = this.yylloc.range;
19081
19082 this.yylloc = {
19083 first_line: this.yylloc.first_line,
19084 last_line: this.yylineno + 1,
19085 first_column: this.yylloc.first_column,
19086 last_column: lines ?
19087 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
19088 + oldLines[oldLines.length - lines.length].length - lines[0].length :
19089 this.yylloc.first_column - len
19090 };
19091
19092 if (this.options.ranges) {
19093 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
19094 }
19095 this.yyleng = this.yytext.length;
19096 return this;
19097 },
19098
19099// When called from action, caches matched text and appends it on next action
19100more:function () {
19101 this._more = true;
19102 return this;
19103 },
19104
19105// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
19106reject:function () {
19107 if (this.options.backtrack_lexer) {
19108 this._backtrack = true;
19109 } else {
19110 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
19111 text: "",
19112 token: null,
19113 line: this.yylineno
19114 });
19115
19116 }
19117 return this;
19118 },
19119
19120// retain first n characters of the match
19121less:function (n) {
19122 this.unput(this.match.slice(n));
19123 },
19124
19125// displays already matched input, i.e. for error messages
19126pastInput:function () {
19127 var past = this.matched.substr(0, this.matched.length - this.match.length);
19128 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
19129 },
19130
19131// displays upcoming input, i.e. for error messages
19132upcomingInput:function () {
19133 var next = this.match;
19134 if (next.length < 20) {
19135 next += this._input.substr(0, 20-next.length);
19136 }
19137 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
19138 },
19139
19140// displays the character position where the lexing error occurred, i.e. for error messages
19141showPosition:function () {
19142 var pre = this.pastInput();
19143 var c = new Array(pre.length + 1).join("-");
19144 return pre + this.upcomingInput() + "\n" + c + "^";
19145 },
19146
19147// test the lexed token: return FALSE when not a match, otherwise return token
19148test_match:function(match, indexed_rule) {
19149 var token,
19150 lines,
19151 backup;
19152
19153 if (this.options.backtrack_lexer) {
19154 // save context
19155 backup = {
19156 yylineno: this.yylineno,
19157 yylloc: {
19158 first_line: this.yylloc.first_line,
19159 last_line: this.last_line,
19160 first_column: this.yylloc.first_column,
19161 last_column: this.yylloc.last_column
19162 },
19163 yytext: this.yytext,
19164 match: this.match,
19165 matches: this.matches,
19166 matched: this.matched,
19167 yyleng: this.yyleng,
19168 offset: this.offset,
19169 _more: this._more,
19170 _input: this._input,
19171 yy: this.yy,
19172 conditionStack: this.conditionStack.slice(0),
19173 done: this.done
19174 };
19175 if (this.options.ranges) {
19176 backup.yylloc.range = this.yylloc.range.slice(0);
19177 }
19178 }
19179
19180 lines = match[0].match(/(?:\r\n?|\n).*/g);
19181 if (lines) {
19182 this.yylineno += lines.length;
19183 }
19184 this.yylloc = {
19185 first_line: this.yylloc.last_line,
19186 last_line: this.yylineno + 1,
19187 first_column: this.yylloc.last_column,
19188 last_column: lines ?
19189 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
19190 this.yylloc.last_column + match[0].length
19191 };
19192 this.yytext += match[0];
19193 this.match += match[0];
19194 this.matches = match;
19195 this.yyleng = this.yytext.length;
19196 if (this.options.ranges) {
19197 this.yylloc.range = [this.offset, this.offset += this.yyleng];
19198 }
19199 this._more = false;
19200 this._backtrack = false;
19201 this._input = this._input.slice(match[0].length);
19202 this.matched += match[0];
19203 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
19204 if (this.done && this._input) {
19205 this.done = false;
19206 }
19207 if (token) {
19208 return token;
19209 } else if (this._backtrack) {
19210 // recover context
19211 for (var k in backup) {
19212 this[k] = backup[k];
19213 }
19214 return false; // rule action called reject() implying the next rule should be tested instead.
19215 }
19216 return false;
19217 },
19218
19219// return next match in input
19220next:function () {
19221 if (this.done) {
19222 return this.EOF;
19223 }
19224 if (!this._input) {
19225 this.done = true;
19226 }
19227
19228 var token,
19229 match,
19230 tempMatch,
19231 index;
19232 if (!this._more) {
19233 this.yytext = '';
19234 this.match = '';
19235 }
19236 var rules = this._currentRules();
19237 for (var i = 0; i < rules.length; i++) {
19238 tempMatch = this._input.match(this.rules[rules[i]]);
19239 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
19240 match = tempMatch;
19241 index = i;
19242 if (this.options.backtrack_lexer) {
19243 token = this.test_match(tempMatch, rules[i]);
19244 if (token !== false) {
19245 return token;
19246 } else if (this._backtrack) {
19247 match = false;
19248 continue; // rule action called reject() implying a rule MISmatch.
19249 } else {
19250 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
19251 return false;
19252 }
19253 } else if (!this.options.flex) {
19254 break;
19255 }
19256 }
19257 }
19258 if (match) {
19259 token = this.test_match(match, rules[index]);
19260 if (token !== false) {
19261 return token;
19262 }
19263 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
19264 return false;
19265 }
19266 if (this._input === "") {
19267 return this.EOF;
19268 } else {
19269 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
19270 text: "",
19271 token: null,
19272 line: this.yylineno
19273 });
19274 }
19275 },
19276
19277// return next match that has a token
19278lex:function lex () {
19279 var r = this.next();
19280 if (r) {
19281 return r;
19282 } else {
19283 return this.lex();
19284 }
19285 },
19286
19287// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
19288begin:function begin (condition) {
19289 this.conditionStack.push(condition);
19290 },
19291
19292// pop the previously active lexer condition state off the condition stack
19293popState:function popState () {
19294 var n = this.conditionStack.length - 1;
19295 if (n > 0) {
19296 return this.conditionStack.pop();
19297 } else {
19298 return this.conditionStack[0];
19299 }
19300 },
19301
19302// produce the lexer rule set which is active for the currently active lexer condition state
19303_currentRules:function _currentRules () {
19304 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
19305 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
19306 } else {
19307 return this.conditions["INITIAL"].rules;
19308 }
19309 },
19310
19311// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
19312topState:function topState (n) {
19313 n = this.conditionStack.length - 1 - Math.abs(n || 0);
19314 if (n >= 0) {
19315 return this.conditionStack[n];
19316 } else {
19317 return "INITIAL";
19318 }
19319 },
19320
19321// alias for begin(condition)
19322pushState:function pushState (condition) {
19323 this.begin(condition);
19324 },
19325
19326// return the number of states currently on the stack
19327stateStackSize:function stateStackSize() {
19328 return this.conditionStack.length;
19329 },
19330options: {"case-insensitive":true},
19331performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
19332var YYSTATE=YY_START;
19333switch($avoiding_name_collisions) {
19334case 0: this.begin('open_directive'); return 39;
19335break;
19336case 1: this.begin('type_directive'); return 40;
19337break;
19338case 2: this.popState(); this.begin('arg_directive'); return 32;
19339break;
19340case 3: this.popState(); this.popState(); return 42;
19341break;
19342case 4:return 41;
19343break;
19344case 5:/* skip comments */
19345break;
19346case 6:/* skip comments */{ console.log('Crap after close'); }
19347break;
19348case 7:return 5;
19349break;
19350case 8:/* skip all whitespace */
19351break;
19352case 9:/* skip same-line whitespace */
19353break;
19354case 10:/* skip comments */
19355break;
19356case 11:/* skip comments */
19357break;
19358case 12: this.pushState('SCALE'); /* console.log('Got scale', yy_.yytext);*/ return 15;
19359break;
19360case 13:return 16;
19361break;
19362case 14:this.popState();
19363break;
19364case 15: this.pushState('STATE');
19365break;
19366case 16:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim(); /*console.warn('Fork Fork: ',yy_.yytext);*/return 23;
19367break;
19368case 17:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24;
19369break;
19370case 18:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Fork: ',yy_.yytext);*/return 23;
19371break;
19372case 19:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24;
19373break;
19374case 20:this.begin("STATE_STRING");
19375break;
19376case 21:this.popState();this.pushState('STATE_ID');return "AS";
19377break;
19378case 22:this.popState();/* console.log('STATE_ID', yy_.yytext);*/return "ID";
19379break;
19380case 23:this.popState();
19381break;
19382case 24: /*console.log('Long description:', yy_.yytext);*/return "STATE_DESCR";
19383break;
19384case 25:/*console.log('COMPOSIT_STATE', yy_.yytext);*/return 17;
19385break;
19386case 26:this.popState();
19387break;
19388case 27:this.popState();this.pushState('struct'); /*console.log('begin struct', yy_.yytext);*/return 18;
19389break;
19390case 28: /*console.log('Ending struct');*/ this.popState(); return 19;
19391break;
19392case 29:/* nothing */
19393break;
19394case 30: this.begin('NOTE'); return 26;
19395break;
19396case 31: this.popState();this.pushState('NOTE_ID');return 37;
19397break;
19398case 32: this.popState();this.pushState('NOTE_ID');return 38;
19399break;
19400case 33: this.popState();this.pushState('FLOATING_NOTE');
19401break;
19402case 34:this.popState();this.pushState('FLOATING_NOTE_ID');return "AS";
19403break;
19404case 35:/**/
19405break;
19406case 36: /*console.log('Floating note text: ', yy_.yytext);*/return "NOTE_TEXT";
19407break;
19408case 37:this.popState();/*console.log('Floating note ID', yy_.yytext);*/return "ID";
19409break;
19410case 38: this.popState();this.pushState('NOTE_TEXT');/*console.log('Got ID for note', yy_.yytext);*/return 22;
19411break;
19412case 39: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.substr(2).trim();return 28;
19413break;
19414case 40: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.slice(0,-8).trim();return 28;
19415break;
19416case 41: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7;
19417break;
19418case 42: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7;
19419break;
19420case 43: /*console.log('HIDE_EMPTY', yy_.yytext,'#');*/return 14;
19421break;
19422case 44: /*console.log('EDGE_STATE=',yy_.yytext);*/ return 36;
19423break;
19424case 45: /*console.log('=>ID=',yy_.yytext);*/ return 22;
19425break;
19426case 46: yy_.yytext = yy_.yytext.trim(); /*console.log('Descr = ', yy_.yytext);*/ return 12;
19427break;
19428case 47:return 13;
19429break;
19430case 48:return 25;
19431break;
19432case 49:return 5;
19433break;
19434case 50:return 'INVALID';
19435break;
19436}
19437},
19438rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:\s*[^:;]+end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?:$)/i,/^(?:.)/i],
19439conditions: {"LINE":{"rules":[9,10],"inclusive":false},"close_directive":{"rules":[9,10],"inclusive":false},"arg_directive":{"rules":[3,4,9,10],"inclusive":false},"type_directive":{"rules":[2,3,9,10],"inclusive":false},"open_directive":{"rules":[1,9,10],"inclusive":false},"struct":{"rules":[9,10,15,28,29,30,44,45,46,47,48],"inclusive":false},"FLOATING_NOTE_ID":{"rules":[37],"inclusive":false},"FLOATING_NOTE":{"rules":[34,35,36],"inclusive":false},"NOTE_TEXT":{"rules":[39,40],"inclusive":false},"NOTE_ID":{"rules":[38],"inclusive":false},"NOTE":{"rules":[31,32,33],"inclusive":false},"SCALE":{"rules":[13,14],"inclusive":false},"ALIAS":{"rules":[],"inclusive":false},"STATE_ID":{"rules":[22],"inclusive":false},"STATE_STRING":{"rules":[23,24],"inclusive":false},"FORK_STATE":{"rules":[],"inclusive":false},"STATE":{"rules":[9,10,16,17,18,19,20,21,25,26,27],"inclusive":false},"ID":{"rules":[9,10],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,10,11,12,15,27,30,41,42,43,44,45,46,47,49,50],"inclusive":true}}
19440});
19441return lexer;
19442})();
19443parser.lexer = lexer;
19444function Parser () {
19445 this.yy = {};
19446}
19447Parser.prototype = parser;parser.Parser = Parser;
19448return new Parser;
19449})();
19450
19451
19452if (true) {
19453exports.parser = parser;
19454exports.Parser = parser.Parser;
19455exports.parse = function () { return parser.parse.apply(parser, arguments); };
19456exports.main = function commonjsMain (args) {
19457 if (!args[1]) {
19458 console.log('Usage: '+args[0]+' FILE');
19459 process.exit(1);
19460 }
19461 var source = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
19462 return exports.parser.parse(source);
19463};
19464if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
19465 exports.main(process.argv.slice(1));
19466}
19467}
19468/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
19469
19470/***/ }),
19471
19472/***/ "./src/diagrams/state/shapes.js":
19473/*!**************************************!*\
19474 !*** ./src/diagrams/state/shapes.js ***!
19475 \**************************************/
19476/*! exports provided: drawStartState, drawDivider, drawSimpleState, drawDescrState, addTitleAndBox, drawText, drawNote, drawState, drawEdge */
19477/***/ (function(module, __webpack_exports__, __webpack_require__) {
19478
19479"use strict";
19480__webpack_require__.r(__webpack_exports__);
19481/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawStartState", function() { return drawStartState; });
19482/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawDivider", function() { return drawDivider; });
19483/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawSimpleState", function() { return drawSimpleState; });
19484/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawDescrState", function() { return drawDescrState; });
19485/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTitleAndBox", function() { return addTitleAndBox; });
19486/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawText", function() { return drawText; });
19487/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawNote", function() { return drawNote; });
19488/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawState", function() { return drawState; });
19489/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawEdge", function() { return drawEdge; });
19490/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
19491/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
19492/* harmony import */ var _id_cache_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./id-cache.js */ "./src/diagrams/state/id-cache.js");
19493/* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
19494/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
19495/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
19496/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../config */ "./src/config.js");
19497/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
19498
19499
19500
19501
19502
19503
19504 // let conf;
19505
19506/**
19507 * Draws a start state as a black circle
19508 */
19509
19510var drawStartState = function drawStartState(g) {
19511 return g.append('circle') // .style('stroke', 'black')
19512 // .style('fill', 'black')
19513 .attr('class', 'start-state').attr('r', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.sizeUnit).attr('cx', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.sizeUnit).attr('cy', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.sizeUnit);
19514};
19515/**
19516 * Draws a start state as a black circle
19517 */
19518
19519var drawDivider = function drawDivider(g) {
19520 return g.append('line').style('stroke', 'grey').style('stroke-dasharray', '3').attr('x1', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight).attr('class', 'divider').attr('x2', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight * 2).attr('y1', 0).attr('y2', 0);
19521};
19522/**
19523 * Draws a an end state as a black circle
19524 */
19525
19526var drawSimpleState = function drawSimpleState(g, stateDef) {
19527 var state = g.append('text').attr('x', 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('y', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('font-size', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.fontSize).attr('class', 'state-title').text(stateDef.id);
19528 var classBox = state.node().getBBox();
19529 g.insert('rect', ':first-child').attr('x', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('y', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('width', classBox.width + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('height', classBox.height + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('rx', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.radius);
19530 return state;
19531};
19532/**
19533 * Draws a state with descriptions
19534 * @param {*} g
19535 * @param {*} stateDef
19536 */
19537
19538var drawDescrState = function drawDescrState(g, stateDef) {
19539 var addTspan = function addTspan(textEl, txt, isFirst) {
19540 var tSpan = textEl.append('tspan').attr('x', 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).text(txt);
19541
19542 if (!isFirst) {
19543 tSpan.attr('dy', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight);
19544 }
19545 };
19546
19547 var title = g.append('text').attr('x', 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('y', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight + 1.3 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('font-size', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.fontSize).attr('class', 'state-title').text(stateDef.descriptions[0]);
19548 var titleBox = title.node().getBBox();
19549 var titleHeight = titleBox.height;
19550 var description = g.append('text') // text label for the x axis
19551 .attr('x', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('y', titleHeight + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding * 0.4 + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.dividerMargin + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight).attr('class', 'state-description');
19552 var isFirst = true;
19553 var isSecond = true;
19554 stateDef.descriptions.forEach(function (descr) {
19555 if (!isFirst) {
19556 addTspan(description, descr, isSecond);
19557 isSecond = false;
19558 }
19559
19560 isFirst = false;
19561 });
19562 var descrLine = g.append('line') // text label for the x axis
19563 .attr('x1', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('y1', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding + titleHeight + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.dividerMargin / 2).attr('y2', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding + titleHeight + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.dividerMargin / 2).attr('class', 'descr-divider');
19564 var descrBox = description.node().getBBox();
19565 var width = Math.max(descrBox.width, titleBox.width);
19566 descrLine.attr('x2', width + 3 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding); // const classBox = title.node().getBBox();
19567
19568 g.insert('rect', ':first-child').attr('x', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('y', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('width', width + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('height', descrBox.height + titleHeight + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('rx', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.radius);
19569 return g;
19570};
19571/**
19572 * Adds the creates a box around the existing content and adds a
19573 * panel for the id on top of the content.
19574 */
19575
19576/**
19577 * Function that creates an title row and a frame around a substate for a composit state diagram.
19578 * The function returns a new d3 svg object with updated width and height properties;
19579 * @param {*} g The d3 svg object for the substate to framed
19580 * @param {*} stateDef The info about the
19581 */
19582
19583var addTitleAndBox = function addTitleAndBox(g, stateDef, altBkg) {
19584 var pad = Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding;
19585 var dblPad = 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding;
19586 var orgBox = g.node().getBBox();
19587 var orgWidth = orgBox.width;
19588 var orgX = orgBox.x;
19589 var title = g.append('text').attr('x', 0).attr('y', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.titleShift).attr('font-size', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.fontSize).attr('class', 'state-title').text(stateDef.id);
19590 var titleBox = title.node().getBBox();
19591 var titleWidth = titleBox.width + dblPad;
19592 var width = Math.max(titleWidth, orgWidth); // + dblPad;
19593
19594 if (width === orgWidth) {
19595 width = width + dblPad;
19596 }
19597
19598 var startX; // const lineY = 1 - getConfig().state.textHeight;
19599 // const descrLine = g
19600 // .append('line') // text label for the x axis
19601 // .attr('x1', 0)
19602 // .attr('y1', lineY)
19603 // .attr('y2', lineY)
19604 // .attr('class', 'descr-divider');
19605
19606 var graphBox = g.node().getBBox(); // console.warn(width / 2, titleWidth / 2, getConfig().state.padding, orgBox);
19607 // descrLine.attr('x2', graphBox.width + getConfig().state.padding);
19608
19609 if (stateDef.doc) {// cnsole.warn(
19610 // stateDef.id,
19611 // 'orgX: ',
19612 // orgX,
19613 // 'width: ',
19614 // width,
19615 // 'titleWidth: ',
19616 // titleWidth,
19617 // 'orgWidth: ',
19618 // orgWidth,
19619 // 'width',
19620 // width
19621 // );
19622 }
19623
19624 startX = orgX - pad;
19625
19626 if (titleWidth > orgWidth) {
19627 startX = (orgWidth - width) / 2 + pad;
19628 }
19629
19630 if (Math.abs(orgX - graphBox.x) < pad) {
19631 if (titleWidth > orgWidth) {
19632 startX = orgX - (titleWidth - orgWidth) / 2;
19633 }
19634 }
19635
19636 var lineY = 1 - Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight; // White color
19637
19638 g.insert('rect', ':first-child').attr('x', startX).attr('y', lineY).attr('class', altBkg ? 'alt-composit' : 'composit').attr('width', width).attr('height', graphBox.height + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.titleShift + 1).attr('rx', '0');
19639 title.attr('x', startX + pad);
19640 if (titleWidth <= orgWidth) title.attr('x', orgX + (width - dblPad) / 2 - titleWidth / 2 + pad); // Title background
19641
19642 g.insert('rect', ':first-child').attr('x', startX).attr('y', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.titleShift - Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight - Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('width', width) // Just needs to be higher then the descr line, will be clipped by the white color box
19643 .attr('height', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight * 3).attr('rx', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.radius); // Full background
19644
19645 g.insert('rect', ':first-child').attr('x', startX).attr('y', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.titleShift - Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight - Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('width', width).attr('height', graphBox.height + 3 + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight).attr('rx', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.radius);
19646 return g;
19647};
19648
19649var drawEndState = function drawEndState(g) {
19650 g.append('circle') // .style('stroke', 'black')
19651 // .style('fill', 'white')
19652 .attr('class', 'end-state-outer').attr('r', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.sizeUnit + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.miniPadding).attr('cx', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.sizeUnit + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.miniPadding).attr('cy', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.sizeUnit + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.miniPadding);
19653 return g.append('circle') // .style('stroke', 'black')
19654 // .style('fill', 'black')
19655 .attr('class', 'end-state-inner').attr('r', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.sizeUnit).attr('cx', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.sizeUnit + 2).attr('cy', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.sizeUnit + 2);
19656};
19657
19658var drawForkJoinState = function drawForkJoinState(g, stateDef) {
19659 var width = Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.forkWidth;
19660 var height = Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.forkHeight;
19661
19662 if (stateDef.parentId) {
19663 var tmp = width;
19664 width = height;
19665 height = tmp;
19666 }
19667
19668 return g.append('rect').style('stroke', 'black').style('fill', 'black').attr('width', width).attr('height', height).attr('x', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('y', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding);
19669};
19670
19671var drawText = function drawText(elem, textData) {
19672 // Remove and ignore br:s
19673 var nText = textData.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex, ' ');
19674 var textElem = elem.append('text');
19675 textElem.attr('x', textData.x);
19676 textElem.attr('y', textData.y);
19677 textElem.style('text-anchor', textData.anchor);
19678 textElem.attr('fill', textData.fill);
19679
19680 if (typeof textData.class !== 'undefined') {
19681 textElem.attr('class', textData.class);
19682 }
19683
19684 var span = textElem.append('tspan');
19685 span.attr('x', textData.x + textData.textMargin * 2);
19686 span.attr('fill', textData.fill);
19687 span.text(nText);
19688 return textElem;
19689};
19690
19691var _drawLongText = function _drawLongText(_text, x, y, g) {
19692 var textHeight = 0;
19693 var textElem = g.append('text');
19694 textElem.style('text-anchor', 'start');
19695 textElem.attr('class', 'noteText');
19696
19697 var text = _text.replace(/\r\n/g, '<br/>');
19698
19699 text = text.replace(/\n/g, '<br/>');
19700 var lines = text.split(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex);
19701 var tHeight = 1.25 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.noteMargin;
19702 var _iteratorNormalCompletion = true;
19703 var _didIteratorError = false;
19704 var _iteratorError = undefined;
19705
19706 try {
19707 for (var _iterator = lines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
19708 var _line = _step.value;
19709
19710 var txt = _line.trim();
19711
19712 if (txt.length > 0) {
19713 var span = textElem.append('tspan');
19714 span.text(txt);
19715
19716 if (tHeight === 0) {
19717 var textBounds = span.node().getBBox();
19718 tHeight += textBounds.height;
19719 } // console.warn('textBounds', textBounds);
19720
19721
19722 textHeight += tHeight;
19723 span.attr('x', x + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.noteMargin);
19724 span.attr('y', y + textHeight + 1.25 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.noteMargin);
19725 }
19726 }
19727 } catch (err) {
19728 _didIteratorError = true;
19729 _iteratorError = err;
19730 } finally {
19731 try {
19732 if (!_iteratorNormalCompletion && _iterator.return != null) {
19733 _iterator.return();
19734 }
19735 } finally {
19736 if (_didIteratorError) {
19737 throw _iteratorError;
19738 }
19739 }
19740 }
19741
19742 return {
19743 textWidth: textElem.node().getBBox().width,
19744 textHeight: textHeight
19745 };
19746};
19747/**
19748 * Draws a note to the diagram
19749 * @param text - The text of the given note.
19750 * @param g - The element the note is attached to.
19751 */
19752
19753
19754var drawNote = function drawNote(text, g) {
19755 g.attr('class', 'state-note');
19756 var note = g.append('rect').attr('x', 0).attr('y', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding);
19757 var rectElem = g.append('g');
19758
19759 var _drawLongText2 = _drawLongText(text, 0, 0, rectElem),
19760 textWidth = _drawLongText2.textWidth,
19761 textHeight = _drawLongText2.textHeight;
19762
19763 note.attr('height', textHeight + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.noteMargin);
19764 note.attr('width', textWidth + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.noteMargin * 2);
19765 return note;
19766};
19767/**
19768 * Starting point for drawing a state. The function finds out the specifics
19769 * about the state and renders with approprtiate function.
19770 * @param {*} elem
19771 * @param {*} stateDef
19772 */
19773
19774var drawState = function drawState(elem, stateDef) {
19775 var id = stateDef.id;
19776 var stateInfo = {
19777 id: id,
19778 label: stateDef.id,
19779 width: 0,
19780 height: 0
19781 };
19782 var g = elem.append('g').attr('id', id).attr('class', 'stateGroup');
19783 if (stateDef.type === 'start') drawStartState(g);
19784 if (stateDef.type === 'end') drawEndState(g);
19785 if (stateDef.type === 'fork' || stateDef.type === 'join') drawForkJoinState(g, stateDef);
19786 if (stateDef.type === 'note') drawNote(stateDef.note.text, g);
19787 if (stateDef.type === 'divider') drawDivider(g);
19788 if (stateDef.type === 'default' && stateDef.descriptions.length === 0) drawSimpleState(g, stateDef);
19789 if (stateDef.type === 'default' && stateDef.descriptions.length > 0) drawDescrState(g, stateDef);
19790 var stateBox = g.node().getBBox();
19791 stateInfo.width = stateBox.width + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding;
19792 stateInfo.height = stateBox.height + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding;
19793 _id_cache_js__WEBPACK_IMPORTED_MODULE_1__["default"].set(id, stateInfo); // stateCnt++;
19794
19795 return stateInfo;
19796};
19797var edgeCount = 0;
19798var drawEdge = function drawEdge(elem, path, relation) {
19799 var getRelationType = function getRelationType(type) {
19800 switch (type) {
19801 case _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].relationType.AGGREGATION:
19802 return 'aggregation';
19803
19804 case _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].relationType.EXTENSION:
19805 return 'extension';
19806
19807 case _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].relationType.COMPOSITION:
19808 return 'composition';
19809
19810 case _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].relationType.DEPENDENCY:
19811 return 'dependency';
19812 }
19813 };
19814
19815 path.points = path.points.filter(function (p) {
19816 return !Number.isNaN(p.y);
19817 }); // The data for our line
19818
19819 var lineData = path.points; // This is the accessor function we talked about above
19820
19821 var lineFunction = Object(d3__WEBPACK_IMPORTED_MODULE_0__["line"])().x(function (d) {
19822 return d.x;
19823 }).y(function (d) {
19824 return d.y;
19825 }).curve(d3__WEBPACK_IMPORTED_MODULE_0__["curveBasis"]);
19826 var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', 'edge' + edgeCount).attr('class', 'transition');
19827 var url = '';
19828
19829 if (Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.arrowMarkerAbsolute) {
19830 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
19831 url = url.replace(/\(/g, '\\(');
19832 url = url.replace(/\)/g, '\\)');
19833 }
19834
19835 svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(_stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].relationType.DEPENDENCY) + 'End' + ')');
19836
19837 if (typeof relation.title !== 'undefined') {
19838 var label = elem.append('g').attr('class', 'stateLabel');
19839
19840 var _utils$calcLabelPosit = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].calcLabelPosition(path.points),
19841 x = _utils$calcLabelPosit.x,
19842 y = _utils$calcLabelPosit.y;
19843
19844 var rows = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].getRows(relation.title); // console.warn(rows);
19845
19846 var titleHeight = 0;
19847 var titleRows = [];
19848 var maxWidth = 0;
19849 var minX = 0;
19850
19851 for (var i = 0; i <= rows.length; i++) {
19852 var title = label.append('text').attr('text-anchor', 'middle').text(rows[i]).attr('x', x).attr('y', y + titleHeight);
19853 var boundstmp = title.node().getBBox();
19854 maxWidth = Math.max(maxWidth, boundstmp.width);
19855 minX = Math.min(minX, boundstmp.x);
19856 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info(boundstmp.x, x, y + titleHeight);
19857
19858 if (titleHeight === 0) {
19859 var titleBox = title.node().getBBox();
19860 titleHeight = titleBox.height;
19861 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Title height', titleHeight, y);
19862 }
19863
19864 titleRows.push(title);
19865 }
19866
19867 var boxHeight = titleHeight * rows.length;
19868
19869 if (rows.length > 1) {
19870 var heightAdj = (rows.length - 1) * titleHeight * 0.5;
19871 titleRows.forEach(function (title, i) {
19872 return title.attr('y', y + i * titleHeight - heightAdj);
19873 });
19874 boxHeight = titleHeight * rows.length;
19875 }
19876
19877 var bounds = label.node().getBBox();
19878 label.insert('rect', ':first-child').attr('class', 'box').attr('x', x - maxWidth / 2 - Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding / 2).attr('y', y - boxHeight / 2 - Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding / 2 - 3.5).attr('width', maxWidth + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).attr('height', boxHeight + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding);
19879 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info(bounds); //label.attr('transform', '0 -' + (bounds.y / 2));
19880 // Debug points
19881 // path.points.forEach(point => {
19882 // g.append('circle')
19883 // .style('stroke', 'red')
19884 // .style('fill', 'red')
19885 // .attr('r', 1)
19886 // .attr('cx', point.x)
19887 // .attr('cy', point.y);
19888 // });
19889 // g.append('circle')
19890 // .style('stroke', 'blue')
19891 // .style('fill', 'blue')
19892 // .attr('r', 1)
19893 // .attr('cx', x)
19894 // .attr('cy', y);
19895 }
19896
19897 edgeCount++;
19898};
19899
19900/***/ }),
19901
19902/***/ "./src/diagrams/state/stateDb.js":
19903/*!***************************************!*\
19904 !*** ./src/diagrams/state/stateDb.js ***!
19905 \***************************************/
19906/*! exports provided: parseDirective, addState, clear, getState, getStates, logDocuments, getRelations, addRelation, cleanupLabel, lineType, relationType, default */
19907/***/ (function(module, __webpack_exports__, __webpack_require__) {
19908
19909"use strict";
19910__webpack_require__.r(__webpack_exports__);
19911/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
19912/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addState", function() { return addState; });
19913/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
19914/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getState", function() { return getState; });
19915/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStates", function() { return getStates; });
19916/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logDocuments", function() { return logDocuments; });
19917/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRelations", function() { return getRelations; });
19918/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addRelation", function() { return addRelation; });
19919/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cleanupLabel", function() { return cleanupLabel; });
19920/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lineType", function() { return lineType; });
19921/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "relationType", function() { return relationType; });
19922/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
19923/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
19924/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
19925/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
19926function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
19927
19928
19929
19930
19931
19932
19933var clone = function clone(o) {
19934 return JSON.parse(JSON.stringify(o));
19935};
19936
19937var rootDoc = [];
19938var parseDirective = function parseDirective(statement, context, type) {
19939 _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type);
19940};
19941
19942var setRootDoc = function setRootDoc(o) {
19943 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Setting root doc', o); // rootDoc = { id: 'root', doc: o };
19944
19945 rootDoc = o;
19946};
19947
19948var getRootDoc = function getRootDoc() {
19949 return rootDoc;
19950};
19951
19952var docTranslator = function docTranslator(parent, node, first) {
19953 if (node.stmt === 'relation') {
19954 docTranslator(parent, node.state1, true);
19955 docTranslator(parent, node.state2, false);
19956 } else {
19957 if (node.stmt === 'state') {
19958 if (node.id === '[*]') {
19959 node.id = first ? parent.id + '_start' : parent.id + '_end';
19960 node.start = first;
19961 }
19962 }
19963
19964 if (node.doc) {
19965 var doc = []; // Check for concurrency
19966
19967 var i = 0;
19968 var currentDoc = [];
19969
19970 for (i = 0; i < node.doc.length; i++) {
19971 if (node.doc[i].type === 'divider') {
19972 // debugger;
19973 var newNode = clone(node.doc[i]);
19974 newNode.doc = clone(currentDoc);
19975 doc.push(newNode);
19976 currentDoc = [];
19977 } else {
19978 currentDoc.push(node.doc[i]);
19979 }
19980 } // If any divider was encountered
19981
19982
19983 if (doc.length > 0 && currentDoc.length > 0) {
19984 var _newNode = {
19985 stmt: 'state',
19986 id: Object(_utils__WEBPACK_IMPORTED_MODULE_1__["generateId"])(),
19987 type: 'divider',
19988 doc: clone(currentDoc)
19989 };
19990 doc.push(clone(_newNode));
19991 node.doc = doc;
19992 }
19993
19994 node.doc.forEach(function (docNode) {
19995 return docTranslator(node, docNode, true);
19996 });
19997 }
19998 }
19999};
20000
20001var getRootDocV2 = function getRootDocV2() {
20002 docTranslator({
20003 id: 'root'
20004 }, {
20005 id: 'root',
20006 doc: rootDoc
20007 }, true);
20008 return {
20009 id: 'root',
20010 doc: rootDoc
20011 };
20012};
20013
20014var extract = function extract(_doc) {
20015 // const res = { states: [], relations: [] };
20016 var doc;
20017
20018 if (_doc.doc) {
20019 doc = _doc.doc;
20020 } else {
20021 doc = _doc;
20022 } // let doc = root.doc;
20023 // if (!doc) {
20024 // doc = root;
20025 // }
20026
20027
20028 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info(doc);
20029 clear();
20030 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Extract', doc);
20031 doc.forEach(function (item) {
20032 if (item.stmt === 'state') {
20033 addState(item.id, item.type, item.doc, item.description, item.note);
20034 }
20035
20036 if (item.stmt === 'relation') {
20037 addRelation(item.state1.id, item.state2.id, item.description);
20038 }
20039 });
20040};
20041
20042var newDoc = function newDoc() {
20043 return {
20044 relations: [],
20045 states: {},
20046 documents: {}
20047 };
20048};
20049
20050var documents = {
20051 root: newDoc()
20052};
20053var currentDocument = documents.root;
20054var startCnt = 0;
20055var endCnt = 0; // eslint-disable-line
20056// let stateCnt = 0;
20057
20058/**
20059 * Function called by parser when a node definition has been found.
20060 * @param id
20061 * @param text
20062 * @param type
20063 * @param style
20064 */
20065
20066var addState = function addState(id, type, doc, descr, note) {
20067 if (typeof currentDocument.states[id] === 'undefined') {
20068 currentDocument.states[id] = {
20069 id: id,
20070 descriptions: [],
20071 type: type,
20072 doc: doc,
20073 note: note
20074 };
20075 } else {
20076 if (!currentDocument.states[id].doc) {
20077 currentDocument.states[id].doc = doc;
20078 }
20079
20080 if (!currentDocument.states[id].type) {
20081 currentDocument.states[id].type = type;
20082 }
20083 }
20084
20085 if (descr) {
20086 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Adding state ', id, descr);
20087 if (typeof descr === 'string') addDescription(id, descr.trim());
20088
20089 if (_typeof(descr) === 'object') {
20090 descr.forEach(function (des) {
20091 return addDescription(id, des.trim());
20092 });
20093 }
20094 }
20095
20096 if (note) currentDocument.states[id].note = note;
20097};
20098var clear = function clear() {
20099 documents = {
20100 root: newDoc()
20101 };
20102 currentDocument = documents.root;
20103 currentDocument = documents.root;
20104 startCnt = 0;
20105 endCnt = 0; // eslint-disable-line
20106
20107 classes = [];
20108};
20109var getState = function getState(id) {
20110 return currentDocument.states[id];
20111};
20112var getStates = function getStates() {
20113 return currentDocument.states;
20114};
20115var logDocuments = function logDocuments() {
20116 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Documents = ', documents);
20117};
20118var getRelations = function getRelations() {
20119 return currentDocument.relations;
20120};
20121var addRelation = function addRelation(_id1, _id2, title) {
20122 var id1 = _id1;
20123 var id2 = _id2;
20124 var type1 = 'default';
20125 var type2 = 'default';
20126
20127 if (_id1 === '[*]') {
20128 startCnt++;
20129 id1 = 'start' + startCnt;
20130 type1 = 'start';
20131 }
20132
20133 if (_id2 === '[*]') {
20134 endCnt++;
20135 id2 = 'end' + startCnt;
20136 type2 = 'end';
20137 }
20138
20139 addState(id1, type1);
20140 addState(id2, type2);
20141 currentDocument.relations.push({
20142 id1: id1,
20143 id2: id2,
20144 title: title
20145 });
20146};
20147
20148var addDescription = function addDescription(id, _descr) {
20149 var theState = currentDocument.states[id];
20150 var descr = _descr;
20151
20152 if (descr[0] === ':') {
20153 descr = descr.substr(1).trim();
20154 }
20155
20156 theState.descriptions.push(descr);
20157};
20158
20159var cleanupLabel = function cleanupLabel(label) {
20160 if (label.substring(0, 1) === ':') {
20161 return label.substr(2).trim();
20162 } else {
20163 return label.trim();
20164 }
20165};
20166var lineType = {
20167 LINE: 0,
20168 DOTTED_LINE: 1
20169};
20170var dividerCnt = 0;
20171
20172var getDividerId = function getDividerId() {
20173 dividerCnt++;
20174 return 'divider-id-' + dividerCnt;
20175};
20176
20177var classes = [];
20178
20179var getClasses = function getClasses() {
20180 return classes;
20181};
20182
20183var getDirection = function getDirection() {
20184 return 'TB';
20185};
20186
20187var relationType = {
20188 AGGREGATION: 0,
20189 EXTENSION: 1,
20190 COMPOSITION: 2,
20191 DEPENDENCY: 3
20192};
20193
20194var trimColon = function trimColon(str) {
20195 return str && str[0] === ':' ? str.substr(1).trim() : str.trim();
20196};
20197
20198/* harmony default export */ __webpack_exports__["default"] = ({
20199 parseDirective: parseDirective,
20200 getConfig: function getConfig() {
20201 return _config__WEBPACK_IMPORTED_MODULE_3__["getConfig"]().state;
20202 },
20203 addState: addState,
20204 clear: clear,
20205 getState: getState,
20206 getStates: getStates,
20207 getRelations: getRelations,
20208 getClasses: getClasses,
20209 getDirection: getDirection,
20210 addRelation: addRelation,
20211 getDividerId: getDividerId,
20212 // addDescription,
20213 cleanupLabel: cleanupLabel,
20214 lineType: lineType,
20215 relationType: relationType,
20216 logDocuments: logDocuments,
20217 getRootDoc: getRootDoc,
20218 setRootDoc: setRootDoc,
20219 getRootDocV2: getRootDocV2,
20220 extract: extract,
20221 trimColon: trimColon
20222});
20223
20224/***/ }),
20225
20226/***/ "./src/diagrams/state/stateRenderer-v2.js":
20227/*!************************************************!*\
20228 !*** ./src/diagrams/state/stateRenderer-v2.js ***!
20229 \************************************************/
20230/*! exports provided: setConf, getClasses, draw, default */
20231/***/ (function(module, __webpack_exports__, __webpack_require__) {
20232
20233"use strict";
20234__webpack_require__.r(__webpack_exports__);
20235/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
20236/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClasses", function() { return getClasses; });
20237/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
20238/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
20239/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
20240/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
20241/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
20242/* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
20243/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
20244/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__);
20245/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
20246/* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
20247/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
20248
20249
20250
20251
20252
20253
20254
20255var conf = {};
20256var setConf = function setConf(cnf) {
20257 var keys = Object.keys(cnf);
20258
20259 for (var i = 0; i < keys.length; i++) {
20260 conf[keys[i]] = cnf[keys[i]];
20261 }
20262};
20263var nodeDb = {};
20264/**
20265 * Returns the all the styles from classDef statements in the graph definition.
20266 * @returns {object} classDef styles
20267 */
20268
20269var getClasses = function getClasses(text) {
20270 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].trace('Extracting classes');
20271 _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
20272 var parser = _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
20273 parser.yy = _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the graph definition
20274
20275 parser.parse(text);
20276 return _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getClasses();
20277};
20278
20279var setupNode = function setupNode(g, parent, node, altFlag) {
20280 // Add the node
20281 if (node.id !== 'root') {
20282 var shape = 'rect';
20283
20284 if (node.start === true) {
20285 shape = 'start';
20286 }
20287
20288 if (node.start === false) {
20289 shape = 'end';
20290 }
20291
20292 if (node.type !== 'default') {
20293 shape = node.type;
20294 }
20295
20296 if (!nodeDb[node.id]) {
20297 nodeDb[node.id] = {
20298 id: node.id,
20299 shape: shape,
20300 description: node.id,
20301 classes: 'statediagram-state'
20302 };
20303 } // Build of the array of description strings accordinging
20304
20305
20306 if (node.description) {
20307 if (Array.isArray(nodeDb[node.id].description)) {
20308 // There already is an array of strings,add to it
20309 nodeDb[node.id].shape = 'rectWithTitle';
20310 nodeDb[node.id].description.push(node.description);
20311 } else {
20312 if (nodeDb[node.id].description.length > 0) {
20313 // if there is a description already transformit to an array
20314 nodeDb[node.id].shape = 'rectWithTitle';
20315
20316 if (nodeDb[node.id].description === node.id) {
20317 // If the previous description was the is, remove it
20318 nodeDb[node.id].description = [node.description];
20319 } else {
20320 nodeDb[node.id].description = [nodeDb[node.id].description, node.description];
20321 }
20322 } else {
20323 nodeDb[node.id].shape = 'rect';
20324 nodeDb[node.id].description = node.description;
20325 }
20326 }
20327 } // Save data for description and group so that for instance a statement without description overwrites
20328 // one with description
20329 // group
20330
20331
20332 if (!nodeDb[node.id].type && node.doc) {
20333 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Setting cluser for ', node.id);
20334 nodeDb[node.id].type = 'group';
20335 nodeDb[node.id].shape = node.type === 'divider' ? 'divider' : 'roundedWithTitle';
20336 nodeDb[node.id].classes = nodeDb[node.id].classes + ' ' + (altFlag ? 'statediagram-cluster statediagram-cluster-alt' : 'statediagram-cluster');
20337 }
20338
20339 var nodeData = {
20340 labelStyle: '',
20341 shape: nodeDb[node.id].shape,
20342 labelText: nodeDb[node.id].description,
20343 classes: nodeDb[node.id].classes,
20344 //classStr,
20345 style: '',
20346 //styles.style,
20347 id: node.id,
20348 type: nodeDb[node.id].type,
20349 padding: 15 //getConfig().flowchart.padding
20350
20351 };
20352
20353 if (node.note) {
20354 // Todo: set random id
20355 var noteData = {
20356 labelStyle: '',
20357 shape: 'note',
20358 labelText: node.note.text,
20359 classes: 'statediagram-note',
20360 //classStr,
20361 style: '',
20362 //styles.style,
20363 id: node.id + '----note',
20364 type: nodeDb[node.id].type,
20365 padding: 15 //getConfig().flowchart.padding
20366
20367 };
20368 var groupData = {
20369 labelStyle: '',
20370 shape: 'noteGroup',
20371 labelText: node.note.text,
20372 classes: nodeDb[node.id].classes,
20373 //classStr,
20374 style: '',
20375 //styles.style,
20376 id: node.id + '----parent',
20377 type: 'group',
20378 padding: 0 //getConfig().flowchart.padding
20379
20380 };
20381 g.setNode(node.id + '----parent', groupData);
20382 g.setNode(noteData.id, noteData);
20383 g.setNode(node.id, nodeData);
20384 g.setParent(node.id, node.id + '----parent');
20385 g.setParent(noteData.id, node.id + '----parent');
20386 var from = node.id;
20387 var to = noteData.id;
20388
20389 if (node.note.position === 'left of') {
20390 from = noteData.id;
20391 to = node.id;
20392 }
20393
20394 g.setEdge(from, to, {
20395 arrowhead: 'none',
20396 arrowType: '',
20397 style: 'fill:none',
20398 labelStyle: '',
20399 classes: 'transition note-edge',
20400 arrowheadStyle: 'fill: #333',
20401 labelpos: 'c',
20402 labelType: 'text',
20403 thickness: 'normal'
20404 });
20405 } else {
20406 g.setNode(node.id, nodeData);
20407 }
20408 }
20409
20410 if (parent) {
20411 if (parent.id !== 'root') {
20412 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Setting node ', node.id, ' to be child of its parent ', parent.id);
20413 g.setParent(node.id, parent.id);
20414 }
20415 }
20416
20417 if (node.doc) {
20418 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Adding nodes children ');
20419 setupDoc(g, node, node.doc, !altFlag);
20420 }
20421};
20422
20423var cnt = 0;
20424
20425var setupDoc = function setupDoc(g, parent, doc, altFlag) {
20426 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].trace('items', doc);
20427 doc.forEach(function (item) {
20428 if (item.stmt === 'state' || item.stmt === 'default') {
20429 setupNode(g, parent, item, altFlag);
20430 } else if (item.stmt === 'relation') {
20431 setupNode(g, parent, item.state1, altFlag);
20432 setupNode(g, parent, item.state2, altFlag);
20433 var edgeData = {
20434 id: 'edge' + cnt,
20435 arrowhead: 'normal',
20436 arrowTypeEnd: 'arrow_barb',
20437 style: 'fill:none',
20438 labelStyle: '',
20439 label: item.description,
20440 arrowheadStyle: 'fill: #333',
20441 labelpos: 'c',
20442 labelType: 'text',
20443 thickness: 'normal',
20444 classes: 'transition'
20445 };
20446 var startId = item.state1.id;
20447 var endId = item.state2.id;
20448 g.setEdge(startId, endId, edgeData, cnt);
20449 cnt++;
20450 }
20451 });
20452};
20453/**
20454 * Draws a flowchart in the tag with id: id based on the graph definition in text.
20455 * @param text
20456 * @param id
20457 */
20458
20459
20460var draw = function draw(text, id) {
20461 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Drawing state diagram (v2)', id);
20462 _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
20463 nodeDb = {};
20464 var parser = _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
20465 parser.yy = _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the graph definition
20466 // try {
20467
20468 parser.parse(text); // } catch (err) {
20469 // logger.error('Parsing failed', err);
20470 // }
20471 // Fetch the default direction, use TD if none was found
20472
20473 var dir = _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getDirection();
20474
20475 if (typeof dir === 'undefined') {
20476 dir = 'LR';
20477 }
20478
20479 var conf = Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().state;
20480 var nodeSpacing = conf.nodeSpacing || 50;
20481 var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
20482
20483 var g = new graphlib__WEBPACK_IMPORTED_MODULE_0___default.a.Graph({
20484 multigraph: true,
20485 compound: true
20486 }).setGraph({
20487 rankdir: 'TB',
20488 nodesep: nodeSpacing,
20489 ranksep: rankSpacing,
20490 marginx: 8,
20491 marginy: 8
20492 }).setDefaultEdgeLabel(function () {
20493 return {};
20494 });
20495 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info(_stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getRootDocV2());
20496 _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].extract(_stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getRootDocV2());
20497 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info(_stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getRootDocV2());
20498 setupNode(g, undefined, _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getRootDocV2(), true); // Set up an SVG group so that we can translate the final graph.
20499
20500 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(id, "\"]")); // Run the renderer. This is what draws the final graph.
20501
20502 var element = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#' + id + ' g');
20503 Object(_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_5__["render"])(element, g, ['barb'], 'statediagram', id);
20504 var padding = 8; // const svgBounds = svg.node().getBBox();
20505 // const width = svgBounds.width + padding * 2;
20506 // const height = svgBounds.height + padding * 2;
20507 // logger.debug(
20508 // `new ViewBox 0 0 ${width} ${height}`,
20509 // `translate(${padding + g._label.marginx}, ${padding + g._label.marginy})`
20510 // );
20511 // if (conf.useMaxWidth) {
20512 // svg.attr('width', '100%');
20513 // svg.attr('style', `max-width: ${width}px;`);
20514 // } else {
20515 // svg.attr('height', height);
20516 // svg.attr('width', width);
20517 // }
20518 // svg.attr('viewBox', `0 0 ${width} ${height}`);
20519 // svg
20520 // .select('g')
20521 // .attr('transform', `translate(${padding - g._label.marginx}, ${padding - svgBounds.y})`);
20522
20523 var bounds = svg.node().getBBox();
20524 var width = bounds.width + padding * 2;
20525 var height = bounds.height + padding * 2; // diagram.attr('height', '100%');
20526 // diagram.attr('style', `width: ${bounds.width * 3 + conf.padding * 2};`);
20527 // diagram.attr('height', height);
20528 // Zoom in a bit
20529
20530 svg.attr('width', width * 1.75);
20531 svg.attr('class', 'statediagram'); // diagram.attr('height', bounds.height * 3 + conf.padding * 2);
20532 // svg.attr(
20533 // 'viewBox',
20534 // `${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + ' ' + height
20535 // );
20536
20537 var svgBounds = svg.node().getBBox();
20538
20539 if (conf.useMaxWidth) {
20540 svg.attr('width', '100%');
20541 svg.attr('style', "max-width: ".concat(width, "px;"));
20542 } else {
20543 svg.attr('height', height);
20544 svg.attr('width', width);
20545 } // Ensure the viewBox includes the whole svgBounds area with extra space for padding
20546
20547
20548 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
20549 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].debug("viewBox ".concat(vBox));
20550 svg.attr('viewBox', vBox); // Add label rects for non html labels
20551
20552 if (!conf.htmlLabels) {
20553 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
20554
20555 for (var k = 0; k < labels.length; k++) {
20556 var label = labels[k]; // Get dimensions of label
20557
20558 var dim = label.getBBox();
20559 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
20560 rect.setAttribute('rx', 0);
20561 rect.setAttribute('ry', 0);
20562 rect.setAttribute('width', dim.width);
20563 rect.setAttribute('height', dim.height);
20564 label.insertBefore(rect, label.firstChild);
20565 }
20566 }
20567};
20568/* harmony default export */ __webpack_exports__["default"] = ({
20569 setConf: setConf,
20570 getClasses: getClasses,
20571 draw: draw
20572});
20573
20574/***/ }),
20575
20576/***/ "./src/diagrams/state/stateRenderer.js":
20577/*!*********************************************!*\
20578 !*** ./src/diagrams/state/stateRenderer.js ***!
20579 \*********************************************/
20580/*! exports provided: setConf, draw, default */
20581/***/ (function(module, __webpack_exports__, __webpack_require__) {
20582
20583"use strict";
20584__webpack_require__.r(__webpack_exports__);
20585/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
20586/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
20587/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
20588/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
20589/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
20590/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
20591/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
20592/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
20593/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
20594/* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
20595/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
20596/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
20597/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6__);
20598/* harmony import */ var _shapes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./shapes */ "./src/diagrams/state/shapes.js");
20599/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../config */ "./src/config.js");
20600
20601
20602
20603
20604
20605
20606 // import idCache from './id-cache';
20607
20608
20609
20610_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6__["parser"].yy = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"]; // TODO Move conf object to main conf in mermaidAPI
20611
20612var conf;
20613var transformationLog = {};
20614var setConf = function setConf() {}; // Todo optimize
20615
20616/**
20617 * Setup arrow head and define the marker. The result is appended to the svg.
20618 */
20619
20620var insertMarkers = function insertMarkers(elem) {
20621 elem.append('defs').append('marker').attr('id', 'dependencyEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 19,7 L9,13 L14,7 L9,1 Z');
20622};
20623/**
20624 * Draws a flowchart in the tag with id: id based on the graph definition in text.
20625 * @param text
20626 * @param id
20627 */
20628
20629
20630var draw = function draw(text, id) {
20631 conf = Object(_config__WEBPACK_IMPORTED_MODULE_8__["getConfig"])().state;
20632 _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6__["parser"].yy.clear();
20633 _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6__["parser"].parse(text);
20634 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
20635
20636 var diagram = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id='".concat(id, "']"));
20637 insertMarkers(diagram); // Layout graph, Create a new directed graph
20638
20639 var graph = new graphlib__WEBPACK_IMPORTED_MODULE_2___default.a.Graph({
20640 multigraph: true,
20641 compound: true,
20642 // acyclicer: 'greedy',
20643 rankdir: 'RL' // ranksep: '20'
20644
20645 }); // Default to assigning a new object as a label for each new edge.
20646
20647 graph.setDefaultEdgeLabel(function () {
20648 return {};
20649 });
20650 var rootDoc = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRootDoc();
20651 renderDoc(rootDoc, diagram, undefined, false);
20652 var padding = conf.padding;
20653 var bounds = diagram.node().getBBox();
20654 var width = bounds.width + padding * 2;
20655 var height = bounds.height + padding * 2;
20656
20657 if (conf.useMaxWidth) {
20658 diagram.attr('width', '100%');
20659 diagram.attr('style', "max-width: ".concat(width * 1.75, "px;"));
20660 } else {
20661 // Zoom in a bit
20662 diagram.attr('width', width * 1.75);
20663 } // diagram.attr('height', bounds.height * 3 + conf.padding * 2);
20664
20665
20666 diagram.attr('viewBox', "".concat(bounds.x - conf.padding, " ").concat(bounds.y - conf.padding, " ") + width + ' ' + height);
20667};
20668
20669var getLabelWidth = function getLabelWidth(text) {
20670 return text ? text.length * conf.fontSizeFactor : 1;
20671};
20672
20673var renderDoc = function renderDoc(doc, diagram, parentId, altBkg) {
20674 // // Layout graph, Create a new directed graph
20675 var graph = new graphlib__WEBPACK_IMPORTED_MODULE_2___default.a.Graph({
20676 compound: true,
20677 multigraph: true
20678 });
20679 var i;
20680 var edgeFreeDoc = true;
20681
20682 for (i = 0; i < doc.length; i++) {
20683 if (doc[i].stmt === 'relation') {
20684 edgeFreeDoc = false;
20685 break;
20686 }
20687 } // Set an object for the graph label
20688
20689
20690 if (parentId) graph.setGraph({
20691 rankdir: 'LR',
20692 multigraph: true,
20693 compound: true,
20694 // acyclicer: 'greedy',
20695 ranker: 'tight-tree',
20696 ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
20697 nodeSep: edgeFreeDoc ? 1 : 50,
20698 isMultiGraph: true // ranksep: 5,
20699 // nodesep: 1
20700
20701 });else {
20702 graph.setGraph({
20703 rankdir: 'TB',
20704 multigraph: true,
20705 compound: true,
20706 // isCompound: true,
20707 // acyclicer: 'greedy',
20708 // ranker: 'longest-path'
20709 ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
20710 nodeSep: edgeFreeDoc ? 1 : 50,
20711 ranker: 'tight-tree',
20712 // ranker: 'network-simplex'
20713 isMultiGraph: true
20714 });
20715 } // Default to assigning a new object as a label for each new edge.
20716
20717 graph.setDefaultEdgeLabel(function () {
20718 return {};
20719 });
20720 _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].extract(doc);
20721 var states = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getStates();
20722 var relations = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
20723 var keys = Object.keys(states);
20724 var first = true;
20725
20726 for (var _i = 0; _i < keys.length; _i++) {
20727 var stateDef = states[keys[_i]];
20728
20729 if (parentId) {
20730 stateDef.parentId = parentId;
20731 }
20732
20733 var node = void 0;
20734
20735 if (stateDef.doc) {
20736 var sub = diagram.append('g').attr('id', stateDef.id).attr('class', 'stateGroup');
20737 node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg);
20738
20739 if (first) {
20740 // first = false;
20741 sub = Object(_shapes__WEBPACK_IMPORTED_MODULE_7__["addTitleAndBox"])(sub, stateDef, altBkg);
20742 var boxBounds = sub.node().getBBox();
20743 node.width = boxBounds.width;
20744 node.height = boxBounds.height + conf.padding / 2;
20745 transformationLog[stateDef.id] = {
20746 y: conf.compositTitleSize
20747 };
20748 } else {
20749 // sub = addIdAndBox(sub, stateDef);
20750 var _boxBounds = sub.node().getBBox();
20751
20752 node.width = _boxBounds.width;
20753 node.height = _boxBounds.height; // transformationLog[stateDef.id] = { y: conf.compositTitleSize };
20754 }
20755 } else {
20756 node = Object(_shapes__WEBPACK_IMPORTED_MODULE_7__["drawState"])(diagram, stateDef, graph);
20757 }
20758
20759 if (stateDef.note) {
20760 // Draw note note
20761 var noteDef = {
20762 descriptions: [],
20763 id: stateDef.id + '-note',
20764 note: stateDef.note,
20765 type: 'note'
20766 };
20767 var note = Object(_shapes__WEBPACK_IMPORTED_MODULE_7__["drawState"])(diagram, noteDef, graph); // graph.setNode(node.id, node);
20768
20769 if (stateDef.note.position === 'left of') {
20770 graph.setNode(node.id + '-note', note);
20771 graph.setNode(node.id, node);
20772 } else {
20773 graph.setNode(node.id, node);
20774 graph.setNode(node.id + '-note', note);
20775 } // graph.setNode(node.id);
20776
20777
20778 graph.setParent(node.id, node.id + '-group');
20779 graph.setParent(node.id + '-note', node.id + '-group');
20780 } else {
20781 // Add nodes to the graph. The first argument is the node id. The second is
20782 // metadata about the node. In this case we're going to add labels to each of
20783 // our nodes.
20784 graph.setNode(node.id, node);
20785 }
20786 }
20787
20788 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Count=', graph.nodeCount(), graph);
20789 var cnt = 0;
20790 relations.forEach(function (relation) {
20791 cnt++;
20792 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Setting edge', relation);
20793 graph.setEdge(relation.id1, relation.id2, {
20794 relation: relation,
20795 width: getLabelWidth(relation.title),
20796 height: conf.labelHeight * _common_common__WEBPACK_IMPORTED_MODULE_5__["default"].getRows(relation.title).length,
20797 labelpos: 'c'
20798 }, 'id' + cnt);
20799 });
20800 dagre__WEBPACK_IMPORTED_MODULE_1___default.a.layout(graph);
20801 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Graph after layout', graph.nodes());
20802 var svgElem = diagram.node();
20803 graph.nodes().forEach(function (v) {
20804 if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
20805 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].warn('Node ' + v + ': ' + JSON.stringify(graph.node(v)));
20806 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + svgElem.id + ' #' + v).attr('transform', 'translate(' + (graph.node(v).x - graph.node(v).width / 2) + ',' + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + ' )');
20807 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + svgElem.id + ' #' + v).attr('data-x-shift', graph.node(v).x - graph.node(v).width / 2);
20808 var dividers = document.querySelectorAll('#' + svgElem.id + ' #' + v + ' .divider');
20809 dividers.forEach(function (divider) {
20810 var parent = divider.parentElement;
20811 var pWidth = 0;
20812 var pShift = 0;
20813
20814 if (parent) {
20815 if (parent.parentElement) pWidth = parent.parentElement.getBBox().width;
20816 pShift = parseInt(parent.getAttribute('data-x-shift'), 10);
20817
20818 if (Number.isNaN(pShift)) {
20819 pShift = 0;
20820 }
20821 }
20822
20823 divider.setAttribute('x1', 0 - pShift + 8);
20824 divider.setAttribute('x2', pWidth - pShift - 8);
20825 });
20826 } else {
20827 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('No Node ' + v + ': ' + JSON.stringify(graph.node(v)));
20828 }
20829 });
20830 var stateBox = svgElem.getBBox();
20831 graph.edges().forEach(function (e) {
20832 if (typeof e !== 'undefined' && typeof graph.edge(e) !== 'undefined') {
20833 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
20834 Object(_shapes__WEBPACK_IMPORTED_MODULE_7__["drawEdge"])(diagram, graph.edge(e), graph.edge(e).relation);
20835 }
20836 });
20837 stateBox = svgElem.getBBox();
20838 var stateInfo = {
20839 id: parentId ? parentId : 'root',
20840 label: parentId ? parentId : 'root',
20841 width: 0,
20842 height: 0
20843 };
20844 stateInfo.width = stateBox.width + 2 * conf.padding;
20845 stateInfo.height = stateBox.height + 2 * conf.padding;
20846 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Doc rendered', stateInfo, graph);
20847 return stateInfo;
20848};
20849
20850/* harmony default export */ __webpack_exports__["default"] = ({
20851 setConf: setConf,
20852 draw: draw
20853});
20854
20855/***/ }),
20856
20857/***/ "./src/diagrams/state/styles.js":
20858/*!**************************************!*\
20859 !*** ./src/diagrams/state/styles.js ***!
20860 \**************************************/
20861/*! exports provided: default */
20862/***/ (function(module, __webpack_exports__, __webpack_require__) {
20863
20864"use strict";
20865__webpack_require__.r(__webpack_exports__);
20866var getStyles = function getStyles(options) {
20867 return "g.stateGroup text {\n fill: ".concat(options.nodeBorder, ";\n stroke: none;\n font-size: 10px;\n font-family: 'trebuchet ms', verdana, arial;\n font-family: var(--mermaid-font-family);\n}\ng.stateGroup text {\n fill: ").concat(options.textColor, ";\n stroke: none;\n font-size: 10px;\n\n}\ng.stateGroup .state-title {\n font-weight: bolder;\n fill: ").concat(options.labelColor, ";\n}\n\ng.stateGroup rect {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n}\n\ng.stateGroup line {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1;\n}\n\n.transition {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1;\n fill: none;\n}\n\n.stateGroup .composit {\n fill: ").concat(options.background, ";\n border-bottom: 1px\n}\n\n.stateGroup .alt-composit {\n fill: #e0e0e0;\n border-bottom: 1px\n}\n\n.state-note {\n stroke: ").concat(options.noteBorderColor, ";\n fill: ").concat(options.noteBkgColor, ";\n\n text {\n fill: black;\n stroke: none;\n font-size: 10px;\n }\n}\n\n.stateLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ").concat(options.mainBkg, ";\n opacity: 0.5;\n}\n\n.edgeLabel .label rect {\n fill: ").concat(options.tertiaryColor, ";\n opacity: 0.5;\n}\n.edgeLabel .label text {\n fill: ").concat(options.tertiaryTextColor, ";\n}\n.label div .edgeLabel {\n color: ").concat(options.tertiaryTextColor, ";\n}\n\n.stateLabel text {\n fill: ").concat(options.labelColor, ";\n font-size: 10px;\n font-weight: bold;\n font-family: 'trebuchet ms', verdana, arial;\n font-family: var(--mermaid-font-family);\n}\n\n.node circle.state-start {\n fill: ").concat(options.lineColor, ";\n stroke: black;\n}\n.node circle.state-end {\n fill: ").concat(options.primaryBorderColor, ";\n stroke: ").concat(options.background, ";\n stroke-width: 1.5\n}\n.end-state-inner {\n fill: ").concat(options.background, ";\n // stroke: ").concat(options.background, ";\n stroke-width: 1.5\n}\n\n.node rect {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1px;\n}\n#statediagram-barbEnd {\n fill: ").concat(options.lineColor, ";\n}\n\n.statediagram-cluster rect {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1px;\n}\n\n.cluster-label, .nodeLabel {\n color: ").concat(options.textColor, ";\n}\n\n.statediagram-cluster rect.outer {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state .divider {\n stroke: ").concat(options.nodeBorder, ";\n}\n\n.statediagram-state .title-state {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-cluster.statediagram-cluster .inner {\n fill: ").concat(options.background, ";\n}\n.statediagram-cluster.statediagram-cluster-alt .inner {\n fill: #e0e0e0;\n}\n\n.statediagram-cluster .inner {\n rx:0;\n ry:0;\n}\n\n.statediagram-state rect.basic {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state rect.divider {\n stroke-dasharray: 10,10;\n fill: ").concat(options.altBackground ? options.altBackground : '#efefef', ";\n}\n\n.note-edge {\n stroke-dasharray: 5;\n}\n\n.statediagram-note rect {\n fill: ").concat(options.noteBkgColor, ";\n stroke: ").concat(options.noteBorderColor, ";\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n.statediagram-note rect {\n fill: ").concat(options.noteBkgColor, ";\n stroke: ").concat(options.noteBorderColor, ";\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n\n.statediagram-note text {\n fill: ").concat(options.noteTextColor, ";\n}\n\n.statediagram-note .nodeLabel {\n color: ").concat(options.noteTextColor, ";\n}\n\n#dependencyStart, #dependencyEnd {\n fill: ").concat(options.lineColor, ";\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1;\n}\n");
20868};
20869
20870/* harmony default export */ __webpack_exports__["default"] = (getStyles);
20871
20872/***/ }),
20873
20874/***/ "./src/diagrams/user-journey/journeyDb.js":
20875/*!************************************************!*\
20876 !*** ./src/diagrams/user-journey/journeyDb.js ***!
20877 \************************************************/
20878/*! exports provided: parseDirective, clear, setTitle, getTitle, addSection, getSections, getTasks, addTask, addTaskOrg, default */
20879/***/ (function(module, __webpack_exports__, __webpack_require__) {
20880
20881"use strict";
20882__webpack_require__.r(__webpack_exports__);
20883/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
20884/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
20885/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTitle", function() { return setTitle; });
20886/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTitle", function() { return getTitle; });
20887/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSection", function() { return addSection; });
20888/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSections", function() { return getSections; });
20889/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTasks", function() { return getTasks; });
20890/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTask", function() { return addTask; });
20891/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTaskOrg", function() { return addTaskOrg; });
20892/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
20893/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
20894function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
20895
20896function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
20897
20898function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
20899
20900function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
20901
20902
20903
20904var title = '';
20905var currentSection = '';
20906var sections = [];
20907var tasks = [];
20908var rawTasks = [];
20909var parseDirective = function parseDirective(statement, context, type) {
20910 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
20911};
20912var clear = function clear() {
20913 sections.length = 0;
20914 tasks.length = 0;
20915 currentSection = '';
20916 title = '';
20917 rawTasks.length = 0;
20918};
20919var setTitle = function setTitle(txt) {
20920 title = txt;
20921};
20922var getTitle = function getTitle() {
20923 return title;
20924};
20925var addSection = function addSection(txt) {
20926 currentSection = txt;
20927 sections.push(txt);
20928};
20929var getSections = function getSections() {
20930 return sections;
20931};
20932var getTasks = function getTasks() {
20933 var allItemsProcessed = compileTasks();
20934 var maxDepth = 100;
20935 var iterationCount = 0;
20936
20937 while (!allItemsProcessed && iterationCount < maxDepth) {
20938 allItemsProcessed = compileTasks();
20939 iterationCount++;
20940 }
20941
20942 tasks.push.apply(tasks, rawTasks);
20943 return tasks;
20944};
20945
20946var updateActors = function updateActors() {
20947 var tempActors = [];
20948 tasks.forEach(function (task) {
20949 if (task.people) {
20950 tempActors.push.apply(tempActors, _toConsumableArray(task.people));
20951 }
20952 });
20953 var unique = new Set(tempActors);
20954 return _toConsumableArray(unique).sort();
20955};
20956
20957var addTask = function addTask(descr, taskData) {
20958 var pieces = taskData.substr(1).split(':');
20959 var score = 0;
20960 var peeps = [];
20961
20962 if (pieces.length === 1) {
20963 score = Number(pieces[0]);
20964 peeps = [];
20965 } else {
20966 score = Number(pieces[0]);
20967 peeps = pieces[1].split(',');
20968 }
20969
20970 var peopleList = peeps.map(function (s) {
20971 return s.trim();
20972 });
20973 var rawTask = {
20974 section: currentSection,
20975 type: currentSection,
20976 people: peopleList,
20977 task: descr,
20978 score: score
20979 };
20980 rawTasks.push(rawTask);
20981};
20982var addTaskOrg = function addTaskOrg(descr) {
20983 var newTask = {
20984 section: currentSection,
20985 type: currentSection,
20986 description: descr,
20987 task: descr,
20988 classes: []
20989 };
20990 tasks.push(newTask);
20991};
20992
20993var compileTasks = function compileTasks() {
20994 var compileTask = function compileTask(pos) {
20995 return rawTasks[pos].processed;
20996 };
20997
20998 var allProcessed = true;
20999
21000 for (var i = 0; i < rawTasks.length; i++) {
21001 compileTask(i);
21002 allProcessed = allProcessed && rawTasks[i].processed;
21003 }
21004
21005 return allProcessed;
21006};
21007
21008var getActors = function getActors() {
21009 return updateActors();
21010};
21011
21012/* harmony default export */ __webpack_exports__["default"] = ({
21013 parseDirective: parseDirective,
21014 getConfig: function getConfig() {
21015 return _config__WEBPACK_IMPORTED_MODULE_1__["getConfig"]().journey;
21016 },
21017 clear: clear,
21018 setTitle: setTitle,
21019 getTitle: getTitle,
21020 addSection: addSection,
21021 getSections: getSections,
21022 getTasks: getTasks,
21023 addTask: addTask,
21024 addTaskOrg: addTaskOrg,
21025 getActors: getActors
21026});
21027
21028/***/ }),
21029
21030/***/ "./src/diagrams/user-journey/journeyRenderer.js":
21031/*!******************************************************!*\
21032 !*** ./src/diagrams/user-journey/journeyRenderer.js ***!
21033 \******************************************************/
21034/*! exports provided: setConf, draw, bounds, drawTasks, default */
21035/***/ (function(module, __webpack_exports__, __webpack_require__) {
21036
21037"use strict";
21038__webpack_require__.r(__webpack_exports__);
21039/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
21040/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
21041/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bounds", function() { return bounds; });
21042/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawTasks", function() { return drawTasks; });
21043/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
21044/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
21045/* harmony import */ var _parser_journey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/journey */ "./src/diagrams/user-journey/parser/journey.jison");
21046/* harmony import */ var _parser_journey__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_journey__WEBPACK_IMPORTED_MODULE_1__);
21047/* harmony import */ var _journeyDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./journeyDb */ "./src/diagrams/user-journey/journeyDb.js");
21048/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/user-journey/svgDraw.js");
21049
21050
21051
21052
21053_parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].yy = _journeyDb__WEBPACK_IMPORTED_MODULE_2__["default"];
21054var conf = {
21055 leftMargin: 150,
21056 diagramMarginX: 50,
21057 diagramMarginY: 20,
21058 // Margin between tasks
21059 taskMargin: 50,
21060 // Width of task boxes
21061 width: 150,
21062 // Height of task boxes
21063 height: 50,
21064 taskFontSize: 14,
21065 taskFontFamily: '"Open-Sans", "sans-serif"',
21066 // Margin around loop boxes
21067 boxMargin: 10,
21068 boxTextMargin: 5,
21069 noteMargin: 10,
21070 // Space between messages
21071 messageMargin: 35,
21072 // Multiline message alignment
21073 messageAlign: 'center',
21074 // Depending on css styling this might need adjustment
21075 // Projects the edge of the diagram downwards
21076 bottomMarginAdj: 1,
21077 // width of activation box
21078 activationWidth: 10,
21079 // text placement as: tspan | fo | old only text as before
21080 textPlacement: 'fo',
21081 actorColours: ['#8FBC8F', '#7CFC00', '#00FFFF', '#20B2AA', '#B0E0E6', '#FFFFE0'],
21082 sectionFills: ['#191970', '#8B008B', '#4B0082', '#2F4F4F', '#800000', '#8B4513', '#00008B'],
21083 sectionColours: ['#fff']
21084};
21085var setConf = function setConf(cnf) {
21086 var keys = Object.keys(cnf);
21087 keys.forEach(function (key) {
21088 conf[key] = cnf[key];
21089 });
21090};
21091var actors = {};
21092
21093function drawActorLegend(diagram) {
21094 // Draw the actors
21095 var yPos = 60;
21096 Object.keys(actors).forEach(function (person) {
21097 var colour = actors[person];
21098 var circleData = {
21099 cx: 20,
21100 cy: yPos,
21101 r: 7,
21102 fill: colour,
21103 stroke: '#000'
21104 };
21105 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawCircle(diagram, circleData);
21106 var labelData = {
21107 x: 40,
21108 y: yPos + 7,
21109 fill: '#666',
21110 text: person,
21111 textMargin: conf.boxTextMargin | 5
21112 };
21113 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawText(diagram, labelData);
21114 yPos += 20;
21115 });
21116}
21117
21118var LEFT_MARGIN = conf.leftMargin;
21119var draw = function draw(text, id) {
21120 _parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.clear();
21121 _parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].parse(text + '\n');
21122 bounds.init();
21123 var diagram = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + id);
21124 diagram.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink');
21125 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].initGraphics(diagram);
21126 var tasks = _parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.getTasks();
21127 var title = _parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.getTitle();
21128 var actorNames = _parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.getActors();
21129
21130 for (var member in actors) {
21131 delete actors[member];
21132 }
21133
21134 var actorPos = 0;
21135 actorNames.forEach(function (actorName) {
21136 actors[actorName] = conf.actorColours[actorPos % conf.actorColours.length];
21137 actorPos++;
21138 });
21139 drawActorLegend(diagram);
21140 bounds.insert(0, 0, LEFT_MARGIN, Object.keys(actors).length * 50);
21141 drawTasks(diagram, tasks, 0);
21142 var box = bounds.getBounds();
21143
21144 if (title) {
21145 diagram.append('text').text(title).attr('x', LEFT_MARGIN).attr('font-size', '4ex').attr('font-weight', 'bold').attr('y', 25);
21146 }
21147
21148 var height = box.stopy - box.starty + 2 * conf.diagramMarginY;
21149 var width = LEFT_MARGIN + box.stopx + 2 * conf.diagramMarginX;
21150
21151 if (conf.useMaxWidth) {
21152 diagram.attr('height', '100%');
21153 diagram.attr('width', '100%');
21154 diagram.attr('style', 'max-width:' + width + 'px;');
21155 } else {
21156 diagram.attr('height', height);
21157 diagram.attr('width', width);
21158 } // Draw activity line
21159
21160
21161 diagram.append('line').attr('x1', LEFT_MARGIN).attr('y1', conf.height * 4) // One section head + one task + margins
21162 .attr('x2', width - LEFT_MARGIN - 4) // Subtract stroke width so arrow point is retained
21163 .attr('y2', conf.height * 4).attr('stroke-width', 4).attr('stroke', 'black').attr('marker-end', 'url(#arrowhead)');
21164 var extraVertForTitle = title ? 70 : 0;
21165 diagram.attr('viewBox', "".concat(box.startx, " -25 ").concat(width, " ").concat(height + extraVertForTitle));
21166 diagram.attr('preserveAspectRatio', 'xMinYMin meet');
21167};
21168var bounds = {
21169 data: {
21170 startx: undefined,
21171 stopx: undefined,
21172 starty: undefined,
21173 stopy: undefined
21174 },
21175 verticalPos: 0,
21176 sequenceItems: [],
21177 init: function init() {
21178 this.sequenceItems = [];
21179 this.data = {
21180 startx: undefined,
21181 stopx: undefined,
21182 starty: undefined,
21183 stopy: undefined
21184 };
21185 this.verticalPos = 0;
21186 },
21187 updateVal: function updateVal(obj, key, val, fun) {
21188 if (typeof obj[key] === 'undefined') {
21189 obj[key] = val;
21190 } else {
21191 obj[key] = fun(val, obj[key]);
21192 }
21193 },
21194 updateBounds: function updateBounds(startx, starty, stopx, stopy) {
21195 var _self = this;
21196
21197 var cnt = 0;
21198
21199 function updateFn(type) {
21200 return function updateItemBounds(item) {
21201 cnt++; // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
21202
21203 var n = _self.sequenceItems.length - cnt + 1;
21204
21205 _self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min);
21206
21207 _self.updateVal(item, 'stopy', stopy + n * conf.boxMargin, Math.max);
21208
21209 _self.updateVal(bounds.data, 'startx', startx - n * conf.boxMargin, Math.min);
21210
21211 _self.updateVal(bounds.data, 'stopx', stopx + n * conf.boxMargin, Math.max);
21212
21213 if (!(type === 'activation')) {
21214 _self.updateVal(item, 'startx', startx - n * conf.boxMargin, Math.min);
21215
21216 _self.updateVal(item, 'stopx', stopx + n * conf.boxMargin, Math.max);
21217
21218 _self.updateVal(bounds.data, 'starty', starty - n * conf.boxMargin, Math.min);
21219
21220 _self.updateVal(bounds.data, 'stopy', stopy + n * conf.boxMargin, Math.max);
21221 }
21222 };
21223 }
21224
21225 this.sequenceItems.forEach(updateFn());
21226 },
21227 insert: function insert(startx, starty, stopx, stopy) {
21228 var _startx = Math.min(startx, stopx);
21229
21230 var _stopx = Math.max(startx, stopx);
21231
21232 var _starty = Math.min(starty, stopy);
21233
21234 var _stopy = Math.max(starty, stopy);
21235
21236 this.updateVal(bounds.data, 'startx', _startx, Math.min);
21237 this.updateVal(bounds.data, 'starty', _starty, Math.min);
21238 this.updateVal(bounds.data, 'stopx', _stopx, Math.max);
21239 this.updateVal(bounds.data, 'stopy', _stopy, Math.max);
21240 this.updateBounds(_startx, _starty, _stopx, _stopy);
21241 },
21242 bumpVerticalPos: function bumpVerticalPos(bump) {
21243 this.verticalPos = this.verticalPos + bump;
21244 this.data.stopy = this.verticalPos;
21245 },
21246 getVerticalPos: function getVerticalPos() {
21247 return this.verticalPos;
21248 },
21249 getBounds: function getBounds() {
21250 return this.data;
21251 }
21252};
21253var fills = conf.sectionFills;
21254var textColours = conf.sectionColours;
21255var drawTasks = function drawTasks(diagram, tasks, verticalPos) {
21256 var lastSection = '';
21257 var sectionVHeight = conf.height * 2 + conf.diagramMarginY;
21258 var taskPos = verticalPos + sectionVHeight;
21259 var sectionNumber = 0;
21260 var fill = '#CCC';
21261 var colour = 'black';
21262 var num = 0; // Draw the tasks
21263
21264 for (var i = 0; i < tasks.length; i++) {
21265 var task = tasks[i];
21266
21267 if (lastSection !== task.section) {
21268 fill = fills[sectionNumber % fills.length];
21269 num = sectionNumber % fills.length;
21270 colour = textColours[sectionNumber % textColours.length];
21271 var section = {
21272 x: i * conf.taskMargin + i * conf.width + LEFT_MARGIN,
21273 y: 50,
21274 text: task.section,
21275 fill: fill,
21276 num: num,
21277 colour: colour
21278 };
21279 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawSection(diagram, section, conf);
21280 lastSection = task.section;
21281 sectionNumber++;
21282 } // Collect the actors involved in the task
21283
21284
21285 var taskActors = task.people.reduce(function (acc, actorName) {
21286 if (actors[actorName]) {
21287 acc[actorName] = actors[actorName];
21288 }
21289
21290 return acc;
21291 }, {}); // Add some rendering data to the object
21292
21293 task.x = i * conf.taskMargin + i * conf.width + LEFT_MARGIN;
21294 task.y = taskPos;
21295 task.width = conf.diagramMarginX;
21296 task.height = conf.diagramMarginY;
21297 task.colour = colour;
21298 task.fill = fill;
21299 task.num = num;
21300 task.actors = taskActors; // Draw the box with the attached line
21301
21302 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawTask(diagram, task, conf);
21303 bounds.insert(task.x, task.y, task.x + task.width + conf.taskMargin, 300 + 5 * 30); // stopy is the length of the descenders.
21304 }
21305};
21306/* harmony default export */ __webpack_exports__["default"] = ({
21307 setConf: setConf,
21308 draw: draw
21309});
21310
21311/***/ }),
21312
21313/***/ "./src/diagrams/user-journey/parser/journey.jison":
21314/*!********************************************************!*\
21315 !*** ./src/diagrams/user-journey/parser/journey.jison ***!
21316 \********************************************************/
21317/*! no static exports found */
21318/***/ (function(module, exports, __webpack_require__) {
21319
21320/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
21321/*
21322 Returns a Parser object of the following structure:
21323
21324 Parser: {
21325 yy: {}
21326 }
21327
21328 Parser.prototype: {
21329 yy: {},
21330 trace: function(),
21331 symbols_: {associative list: name ==> number},
21332 terminals_: {associative list: number ==> name},
21333 productions_: [...],
21334 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
21335 table: [...],
21336 defaultActions: {...},
21337 parseError: function(str, hash),
21338 parse: function(input),
21339
21340 lexer: {
21341 EOF: 1,
21342 parseError: function(str, hash),
21343 setInput: function(input),
21344 input: function(),
21345 unput: function(str),
21346 more: function(),
21347 less: function(n),
21348 pastInput: function(),
21349 upcomingInput: function(),
21350 showPosition: function(),
21351 test_match: function(regex_match_array, rule_index),
21352 next: function(),
21353 lex: function(),
21354 begin: function(condition),
21355 popState: function(),
21356 _currentRules: function(),
21357 topState: function(),
21358 pushState: function(condition),
21359
21360 options: {
21361 ranges: boolean (optional: true ==> token location info will include a .range[] member)
21362 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
21363 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
21364 },
21365
21366 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
21367 rules: [...],
21368 conditions: {associative list: name ==> set},
21369 }
21370 }
21371
21372
21373 token location info (@$, _$, etc.): {
21374 first_line: n,
21375 last_line: n,
21376 first_column: n,
21377 last_column: n,
21378 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
21379 }
21380
21381
21382 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
21383 text: (matched text)
21384 token: (the produced terminal token, if any)
21385 line: (yylineno)
21386 }
21387 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
21388 loc: (yylloc)
21389 expected: (string describing the set of expected tokens)
21390 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
21391 }
21392*/
21393var parser = (function(){
21394var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,5],$V2=[6,9,11,17,18,19,21],$V3=[1,15],$V4=[1,16],$V5=[1,17],$V6=[1,21],$V7=[4,6,9,11,17,18,19,21];
21395var parser = {trace: function trace () { },
21396yy: {},
21397symbols_: {"error":2,"start":3,"journey":4,"document":5,"EOF":6,"directive":7,"line":8,"SPACE":9,"statement":10,"NEWLINE":11,"openDirective":12,"typeDirective":13,"closeDirective":14,":":15,"argDirective":16,"title":17,"section":18,"taskName":19,"taskData":20,"open_directive":21,"type_directive":22,"arg_directive":23,"close_directive":24,"$accept":0,"$end":1},
21398terminals_: {2:"error",4:"journey",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",17:"title",18:"section",19:"taskName",20:"taskData",21:"open_directive",22:"type_directive",23:"arg_directive",24:"close_directive"},
21399productions_: [0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,1],[10,2],[10,1],[12,1],[13,1],[16,1],[14,1]],
21400performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
21401/* this == yyval */
21402
21403var $0 = $$.length - 1;
21404switch (yystate) {
21405case 1:
21406 return $$[$0-1];
21407break;
21408case 3:
21409 this.$ = []
21410break;
21411case 4:
21412$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
21413break;
21414case 5: case 6:
21415 this.$ = $$[$0]
21416break;
21417case 7: case 8:
21418 this.$=[];
21419break;
21420case 11:
21421yy.setTitle($$[$0].substr(6));this.$=$$[$0].substr(6);
21422break;
21423case 12:
21424yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
21425break;
21426case 13:
21427yy.addTask($$[$0-1], $$[$0]);this.$='task';
21428break;
21429case 15:
21430 yy.parseDirective('%%{', 'open_directive');
21431break;
21432case 16:
21433 yy.parseDirective($$[$0], 'type_directive');
21434break;
21435case 17:
21436 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
21437break;
21438case 18:
21439 yy.parseDirective('}%%', 'close_directive', 'journey');
21440break;
21441}
21442},
21443table: [{3:1,4:$V0,7:3,12:4,21:$V1},{1:[3]},o($V2,[2,3],{5:6}),{3:7,4:$V0,7:3,12:4,21:$V1},{13:8,22:[1,9]},{22:[2,15]},{6:[1,10],7:18,8:11,9:[1,12],10:13,11:[1,14],12:4,17:$V3,18:$V4,19:$V5,21:$V1},{1:[2,2]},{14:19,15:[1,20],24:$V6},o([15,24],[2,16]),o($V2,[2,8],{1:[2,1]}),o($V2,[2,4]),{7:18,10:22,12:4,17:$V3,18:$V4,19:$V5,21:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,11]),o($V2,[2,12]),{20:[1,23]},o($V2,[2,14]),{11:[1,24]},{16:25,23:[1,26]},{11:[2,18]},o($V2,[2,5]),o($V2,[2,13]),o($V7,[2,9]),{14:27,24:$V6},{24:[2,17]},{11:[1,28]},o($V7,[2,10])],
21444defaultActions: {5:[2,15],7:[2,2],21:[2,18],26:[2,17]},
21445parseError: function parseError (str, hash) {
21446 if (hash.recoverable) {
21447 this.trace(str);
21448 } else {
21449 var error = new Error(str);
21450 error.hash = hash;
21451 throw error;
21452 }
21453},
21454parse: function parse(input) {
21455 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
21456 var args = lstack.slice.call(arguments, 1);
21457 var lexer = Object.create(this.lexer);
21458 var sharedState = { yy: {} };
21459 for (var k in this.yy) {
21460 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
21461 sharedState.yy[k] = this.yy[k];
21462 }
21463 }
21464 lexer.setInput(input, sharedState.yy);
21465 sharedState.yy.lexer = lexer;
21466 sharedState.yy.parser = this;
21467 if (typeof lexer.yylloc == 'undefined') {
21468 lexer.yylloc = {};
21469 }
21470 var yyloc = lexer.yylloc;
21471 lstack.push(yyloc);
21472 var ranges = lexer.options && lexer.options.ranges;
21473 if (typeof sharedState.yy.parseError === 'function') {
21474 this.parseError = sharedState.yy.parseError;
21475 } else {
21476 this.parseError = Object.getPrototypeOf(this).parseError;
21477 }
21478 function popStack(n) {
21479 stack.length = stack.length - 2 * n;
21480 vstack.length = vstack.length - n;
21481 lstack.length = lstack.length - n;
21482 }
21483 function lex() {
21484 var token;
21485 token = tstack.pop() || lexer.lex() || EOF;
21486 if (typeof token !== 'number') {
21487 if (token instanceof Array) {
21488 tstack = token;
21489 token = tstack.pop();
21490 }
21491 token = self.symbols_[token] || token;
21492 }
21493 return token;
21494 }
21495 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
21496 while (true) {
21497 state = stack[stack.length - 1];
21498 if (this.defaultActions[state]) {
21499 action = this.defaultActions[state];
21500 } else {
21501 if (symbol === null || typeof symbol == 'undefined') {
21502 symbol = lex();
21503 }
21504 action = table[state] && table[state][symbol];
21505 }
21506 if (typeof action === 'undefined' || !action.length || !action[0]) {
21507 var errStr = '';
21508 expected = [];
21509 for (p in table[state]) {
21510 if (this.terminals_[p] && p > TERROR) {
21511 expected.push('\'' + this.terminals_[p] + '\'');
21512 }
21513 }
21514 if (lexer.showPosition) {
21515 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
21516 } else {
21517 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
21518 }
21519 this.parseError(errStr, {
21520 text: lexer.match,
21521 token: this.terminals_[symbol] || symbol,
21522 line: lexer.yylineno,
21523 loc: yyloc,
21524 expected: expected
21525 });
21526 }
21527 if (action[0] instanceof Array && action.length > 1) {
21528 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
21529 }
21530 switch (action[0]) {
21531 case 1:
21532 stack.push(symbol);
21533 vstack.push(lexer.yytext);
21534 lstack.push(lexer.yylloc);
21535 stack.push(action[1]);
21536 symbol = null;
21537 if (!preErrorSymbol) {
21538 yyleng = lexer.yyleng;
21539 yytext = lexer.yytext;
21540 yylineno = lexer.yylineno;
21541 yyloc = lexer.yylloc;
21542 if (recovering > 0) {
21543 recovering--;
21544 }
21545 } else {
21546 symbol = preErrorSymbol;
21547 preErrorSymbol = null;
21548 }
21549 break;
21550 case 2:
21551 len = this.productions_[action[1]][1];
21552 yyval.$ = vstack[vstack.length - len];
21553 yyval._$ = {
21554 first_line: lstack[lstack.length - (len || 1)].first_line,
21555 last_line: lstack[lstack.length - 1].last_line,
21556 first_column: lstack[lstack.length - (len || 1)].first_column,
21557 last_column: lstack[lstack.length - 1].last_column
21558 };
21559 if (ranges) {
21560 yyval._$.range = [
21561 lstack[lstack.length - (len || 1)].range[0],
21562 lstack[lstack.length - 1].range[1]
21563 ];
21564 }
21565 r = this.performAction.apply(yyval, [
21566 yytext,
21567 yyleng,
21568 yylineno,
21569 sharedState.yy,
21570 action[1],
21571 vstack,
21572 lstack
21573 ].concat(args));
21574 if (typeof r !== 'undefined') {
21575 return r;
21576 }
21577 if (len) {
21578 stack = stack.slice(0, -1 * len * 2);
21579 vstack = vstack.slice(0, -1 * len);
21580 lstack = lstack.slice(0, -1 * len);
21581 }
21582 stack.push(this.productions_[action[1]][0]);
21583 vstack.push(yyval.$);
21584 lstack.push(yyval._$);
21585 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
21586 stack.push(newState);
21587 break;
21588 case 3:
21589 return true;
21590 }
21591 }
21592 return true;
21593}};
21594
21595/* generated by jison-lex 0.3.4 */
21596var lexer = (function(){
21597var lexer = ({
21598
21599EOF:1,
21600
21601parseError:function parseError(str, hash) {
21602 if (this.yy.parser) {
21603 this.yy.parser.parseError(str, hash);
21604 } else {
21605 throw new Error(str);
21606 }
21607 },
21608
21609// resets the lexer, sets new input
21610setInput:function (input, yy) {
21611 this.yy = yy || this.yy || {};
21612 this._input = input;
21613 this._more = this._backtrack = this.done = false;
21614 this.yylineno = this.yyleng = 0;
21615 this.yytext = this.matched = this.match = '';
21616 this.conditionStack = ['INITIAL'];
21617 this.yylloc = {
21618 first_line: 1,
21619 first_column: 0,
21620 last_line: 1,
21621 last_column: 0
21622 };
21623 if (this.options.ranges) {
21624 this.yylloc.range = [0,0];
21625 }
21626 this.offset = 0;
21627 return this;
21628 },
21629
21630// consumes and returns one char from the input
21631input:function () {
21632 var ch = this._input[0];
21633 this.yytext += ch;
21634 this.yyleng++;
21635 this.offset++;
21636 this.match += ch;
21637 this.matched += ch;
21638 var lines = ch.match(/(?:\r\n?|\n).*/g);
21639 if (lines) {
21640 this.yylineno++;
21641 this.yylloc.last_line++;
21642 } else {
21643 this.yylloc.last_column++;
21644 }
21645 if (this.options.ranges) {
21646 this.yylloc.range[1]++;
21647 }
21648
21649 this._input = this._input.slice(1);
21650 return ch;
21651 },
21652
21653// unshifts one char (or a string) into the input
21654unput:function (ch) {
21655 var len = ch.length;
21656 var lines = ch.split(/(?:\r\n?|\n)/g);
21657
21658 this._input = ch + this._input;
21659 this.yytext = this.yytext.substr(0, this.yytext.length - len);
21660 //this.yyleng -= len;
21661 this.offset -= len;
21662 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
21663 this.match = this.match.substr(0, this.match.length - 1);
21664 this.matched = this.matched.substr(0, this.matched.length - 1);
21665
21666 if (lines.length - 1) {
21667 this.yylineno -= lines.length - 1;
21668 }
21669 var r = this.yylloc.range;
21670
21671 this.yylloc = {
21672 first_line: this.yylloc.first_line,
21673 last_line: this.yylineno + 1,
21674 first_column: this.yylloc.first_column,
21675 last_column: lines ?
21676 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
21677 + oldLines[oldLines.length - lines.length].length - lines[0].length :
21678 this.yylloc.first_column - len
21679 };
21680
21681 if (this.options.ranges) {
21682 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
21683 }
21684 this.yyleng = this.yytext.length;
21685 return this;
21686 },
21687
21688// When called from action, caches matched text and appends it on next action
21689more:function () {
21690 this._more = true;
21691 return this;
21692 },
21693
21694// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
21695reject:function () {
21696 if (this.options.backtrack_lexer) {
21697 this._backtrack = true;
21698 } else {
21699 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
21700 text: "",
21701 token: null,
21702 line: this.yylineno
21703 });
21704
21705 }
21706 return this;
21707 },
21708
21709// retain first n characters of the match
21710less:function (n) {
21711 this.unput(this.match.slice(n));
21712 },
21713
21714// displays already matched input, i.e. for error messages
21715pastInput:function () {
21716 var past = this.matched.substr(0, this.matched.length - this.match.length);
21717 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
21718 },
21719
21720// displays upcoming input, i.e. for error messages
21721upcomingInput:function () {
21722 var next = this.match;
21723 if (next.length < 20) {
21724 next += this._input.substr(0, 20-next.length);
21725 }
21726 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
21727 },
21728
21729// displays the character position where the lexing error occurred, i.e. for error messages
21730showPosition:function () {
21731 var pre = this.pastInput();
21732 var c = new Array(pre.length + 1).join("-");
21733 return pre + this.upcomingInput() + "\n" + c + "^";
21734 },
21735
21736// test the lexed token: return FALSE when not a match, otherwise return token
21737test_match:function(match, indexed_rule) {
21738 var token,
21739 lines,
21740 backup;
21741
21742 if (this.options.backtrack_lexer) {
21743 // save context
21744 backup = {
21745 yylineno: this.yylineno,
21746 yylloc: {
21747 first_line: this.yylloc.first_line,
21748 last_line: this.last_line,
21749 first_column: this.yylloc.first_column,
21750 last_column: this.yylloc.last_column
21751 },
21752 yytext: this.yytext,
21753 match: this.match,
21754 matches: this.matches,
21755 matched: this.matched,
21756 yyleng: this.yyleng,
21757 offset: this.offset,
21758 _more: this._more,
21759 _input: this._input,
21760 yy: this.yy,
21761 conditionStack: this.conditionStack.slice(0),
21762 done: this.done
21763 };
21764 if (this.options.ranges) {
21765 backup.yylloc.range = this.yylloc.range.slice(0);
21766 }
21767 }
21768
21769 lines = match[0].match(/(?:\r\n?|\n).*/g);
21770 if (lines) {
21771 this.yylineno += lines.length;
21772 }
21773 this.yylloc = {
21774 first_line: this.yylloc.last_line,
21775 last_line: this.yylineno + 1,
21776 first_column: this.yylloc.last_column,
21777 last_column: lines ?
21778 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
21779 this.yylloc.last_column + match[0].length
21780 };
21781 this.yytext += match[0];
21782 this.match += match[0];
21783 this.matches = match;
21784 this.yyleng = this.yytext.length;
21785 if (this.options.ranges) {
21786 this.yylloc.range = [this.offset, this.offset += this.yyleng];
21787 }
21788 this._more = false;
21789 this._backtrack = false;
21790 this._input = this._input.slice(match[0].length);
21791 this.matched += match[0];
21792 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
21793 if (this.done && this._input) {
21794 this.done = false;
21795 }
21796 if (token) {
21797 return token;
21798 } else if (this._backtrack) {
21799 // recover context
21800 for (var k in backup) {
21801 this[k] = backup[k];
21802 }
21803 return false; // rule action called reject() implying the next rule should be tested instead.
21804 }
21805 return false;
21806 },
21807
21808// return next match in input
21809next:function () {
21810 if (this.done) {
21811 return this.EOF;
21812 }
21813 if (!this._input) {
21814 this.done = true;
21815 }
21816
21817 var token,
21818 match,
21819 tempMatch,
21820 index;
21821 if (!this._more) {
21822 this.yytext = '';
21823 this.match = '';
21824 }
21825 var rules = this._currentRules();
21826 for (var i = 0; i < rules.length; i++) {
21827 tempMatch = this._input.match(this.rules[rules[i]]);
21828 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
21829 match = tempMatch;
21830 index = i;
21831 if (this.options.backtrack_lexer) {
21832 token = this.test_match(tempMatch, rules[i]);
21833 if (token !== false) {
21834 return token;
21835 } else if (this._backtrack) {
21836 match = false;
21837 continue; // rule action called reject() implying a rule MISmatch.
21838 } else {
21839 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
21840 return false;
21841 }
21842 } else if (!this.options.flex) {
21843 break;
21844 }
21845 }
21846 }
21847 if (match) {
21848 token = this.test_match(match, rules[index]);
21849 if (token !== false) {
21850 return token;
21851 }
21852 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
21853 return false;
21854 }
21855 if (this._input === "") {
21856 return this.EOF;
21857 } else {
21858 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
21859 text: "",
21860 token: null,
21861 line: this.yylineno
21862 });
21863 }
21864 },
21865
21866// return next match that has a token
21867lex:function lex () {
21868 var r = this.next();
21869 if (r) {
21870 return r;
21871 } else {
21872 return this.lex();
21873 }
21874 },
21875
21876// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
21877begin:function begin (condition) {
21878 this.conditionStack.push(condition);
21879 },
21880
21881// pop the previously active lexer condition state off the condition stack
21882popState:function popState () {
21883 var n = this.conditionStack.length - 1;
21884 if (n > 0) {
21885 return this.conditionStack.pop();
21886 } else {
21887 return this.conditionStack[0];
21888 }
21889 },
21890
21891// produce the lexer rule set which is active for the currently active lexer condition state
21892_currentRules:function _currentRules () {
21893 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
21894 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
21895 } else {
21896 return this.conditions["INITIAL"].rules;
21897 }
21898 },
21899
21900// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
21901topState:function topState (n) {
21902 n = this.conditionStack.length - 1 - Math.abs(n || 0);
21903 if (n >= 0) {
21904 return this.conditionStack[n];
21905 } else {
21906 return "INITIAL";
21907 }
21908 },
21909
21910// alias for begin(condition)
21911pushState:function pushState (condition) {
21912 this.begin(condition);
21913 },
21914
21915// return the number of states currently on the stack
21916stateStackSize:function stateStackSize() {
21917 return this.conditionStack.length;
21918 },
21919options: {"case-insensitive":true},
21920performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
21921var YYSTATE=YY_START;
21922switch($avoiding_name_collisions) {
21923case 0: this.begin('open_directive'); return 21;
21924break;
21925case 1: this.begin('type_directive'); return 22;
21926break;
21927case 2: this.popState(); this.begin('arg_directive'); return 15;
21928break;
21929case 3: this.popState(); this.popState(); return 24;
21930break;
21931case 4:return 23;
21932break;
21933case 5:/* skip comments */
21934break;
21935case 6:/* skip comments */
21936break;
21937case 7:return 11;
21938break;
21939case 8:/* skip whitespace */
21940break;
21941case 9:/* skip comments */
21942break;
21943case 10:return 4;
21944break;
21945case 11:return 17;
21946break;
21947case 12:return 18;
21948break;
21949case 13:return 19;
21950break;
21951case 14:return 20;
21952break;
21953case 15:return 15;
21954break;
21955case 16:return 6;
21956break;
21957case 17:return 'INVALID';
21958break;
21959}
21960},
21961rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],
21962conditions: {"open_directive":{"rules":[1],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,13,14,15,16,17],"inclusive":true}}
21963});
21964return lexer;
21965})();
21966parser.lexer = lexer;
21967function Parser () {
21968 this.yy = {};
21969}
21970Parser.prototype = parser;parser.Parser = Parser;
21971return new Parser;
21972})();
21973
21974
21975if (true) {
21976exports.parser = parser;
21977exports.Parser = parser.Parser;
21978exports.parse = function () { return parser.parse.apply(parser, arguments); };
21979exports.main = function commonjsMain (args) {
21980 if (!args[1]) {
21981 console.log('Usage: '+args[0]+' FILE');
21982 process.exit(1);
21983 }
21984 var source = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
21985 return exports.parser.parse(source);
21986};
21987if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
21988 exports.main(process.argv.slice(1));
21989}
21990}
21991/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
21992
21993/***/ }),
21994
21995/***/ "./src/diagrams/user-journey/styles.js":
21996/*!*********************************************!*\
21997 !*** ./src/diagrams/user-journey/styles.js ***!
21998 \*********************************************/
21999/*! exports provided: default */
22000/***/ (function(module, __webpack_exports__, __webpack_require__) {
22001
22002"use strict";
22003__webpack_require__.r(__webpack_exports__);
22004var getStyles = function getStyles(options) {
22005 return ".label {\n font-family: 'trebuchet ms', verdana, arial;\n font-family: var(--mermaid-font-family);\n color: ".concat(options.textColor, ";\n }\n .mouth {\n stroke: #666;\n }\n\n line {\n stroke: ").concat(options.textColor, "\n }\n\n .legend {\n fill: ").concat(options.textColor, ";\n }\n\n .label text {\n fill: #333;\n }\n .label {\n color: ").concat(options.textColor, "\n }\n\n .face {\n fill: #FFF8DC;\n stroke: #999;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ").concat(options.arrowheadColor, ";\n }\n\n .edgePath .path {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1.5px;\n }\n\n .flowchart-link {\n stroke: ").concat(options.lineColor, ";\n fill: none;\n }\n\n .edgeLabel {\n background-color: ").concat(options.edgeLabelBackground, ";\n rect {\n opacity: 0.5;\n }\n text-align: center;\n }\n\n .cluster rect {\n }\n\n .cluster text {\n fill: ").concat(options.titleColor, ";\n }\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: 'trebuchet ms', verdana, arial;\n font-family: var(--mermaid-font-family);\n font-size: 12px;\n background: ").concat(options.tertiaryColor, ";\n border: 1px solid ").concat(options.border2, ";\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .task-type-0, .section-type-0 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType0) : '', ";\n }\n .task-type-1, .section-type-1 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType1) : '', ";\n }\n .task-type-2, .section-type-2 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType2) : '', ";\n }\n .task-type-3, .section-type-3 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType3) : '', ";\n }\n .task-type-4, .section-type-4 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType4) : '', ";\n }\n .task-type-5, .section-type-5 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType5) : '', ";\n }\n .task-type-6, .section-type-6 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType6) : '', ";\n }\n .task-type-7, .section-type-7 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType7) : '', ";\n }\n");
22006};
22007
22008/* harmony default export */ __webpack_exports__["default"] = (getStyles);
22009
22010/***/ }),
22011
22012/***/ "./src/diagrams/user-journey/svgDraw.js":
22013/*!**********************************************!*\
22014 !*** ./src/diagrams/user-journey/svgDraw.js ***!
22015 \**********************************************/
22016/*! exports provided: drawRect, drawFace, drawCircle, drawText, drawLabel, drawSection, drawTask, drawBackgroundRect, getTextObj, getNoteRect, default */
22017/***/ (function(module, __webpack_exports__, __webpack_require__) {
22018
22019"use strict";
22020__webpack_require__.r(__webpack_exports__);
22021/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawRect", function() { return drawRect; });
22022/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawFace", function() { return drawFace; });
22023/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawCircle", function() { return drawCircle; });
22024/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawText", function() { return drawText; });
22025/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawLabel", function() { return drawLabel; });
22026/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawSection", function() { return drawSection; });
22027/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawTask", function() { return drawTask; });
22028/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawBackgroundRect", function() { return drawBackgroundRect; });
22029/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextObj", function() { return getTextObj; });
22030/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNoteRect", function() { return getNoteRect; });
22031/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
22032/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
22033
22034var drawRect = function drawRect(elem, rectData) {
22035 var rectElem = elem.append('rect');
22036 rectElem.attr('x', rectData.x);
22037 rectElem.attr('y', rectData.y);
22038 rectElem.attr('fill', rectData.fill);
22039 rectElem.attr('stroke', rectData.stroke);
22040 rectElem.attr('width', rectData.width);
22041 rectElem.attr('height', rectData.height);
22042 rectElem.attr('rx', rectData.rx);
22043 rectElem.attr('ry', rectData.ry);
22044
22045 if (typeof rectData.class !== 'undefined') {
22046 rectElem.attr('class', rectData.class);
22047 }
22048
22049 return rectElem;
22050};
22051var drawFace = function drawFace(element, faceData) {
22052 var radius = 15;
22053 var circleElement = element.append('circle').attr('cx', faceData.cx).attr('cy', faceData.cy).attr('class', 'face').attr('r', radius).attr('stroke-width', 2).attr('overflow', 'visible');
22054 var face = element.append('g'); //left eye
22055
22056 face.append('circle').attr('cx', faceData.cx - radius / 3).attr('cy', faceData.cy - radius / 3).attr('r', 1.5).attr('stroke-width', 2).attr('fill', '#666').attr('stroke', '#666'); //right eye
22057
22058 face.append('circle').attr('cx', faceData.cx + radius / 3).attr('cy', faceData.cy - radius / 3).attr('r', 1.5).attr('stroke-width', 2).attr('fill', '#666').attr('stroke', '#666');
22059
22060 function smile(face) {
22061 var arc = Object(d3__WEBPACK_IMPORTED_MODULE_0__["arc"])().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2); //mouth
22062
22063 face.append('path').attr('class', 'mouth').attr('d', arc).attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 2) + ')');
22064 }
22065
22066 function sad(face) {
22067 var arc = Object(d3__WEBPACK_IMPORTED_MODULE_0__["arc"])().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2); //mouth
22068
22069 face.append('path').attr('class', 'mouth').attr('d', arc).attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 7) + ')');
22070 }
22071
22072 function ambivalent(face) {
22073 face.append('line').attr('class', 'mouth').attr('stroke', 2).attr('x1', faceData.cx - 5).attr('y1', faceData.cy + 7).attr('x2', faceData.cx + 5).attr('y2', faceData.cy + 7).attr('class', 'mouth').attr('stroke-width', '1px').attr('stroke', '#666');
22074 }
22075
22076 if (faceData.score > 3) {
22077 smile(face);
22078 } else if (faceData.score < 3) {
22079 sad(face);
22080 } else {
22081 ambivalent(face);
22082 }
22083
22084 return circleElement;
22085};
22086var drawCircle = function drawCircle(element, circleData) {
22087 var circleElement = element.append('circle');
22088 circleElement.attr('cx', circleData.cx);
22089 circleElement.attr('cy', circleData.cy);
22090 circleElement.attr('fill', circleData.fill);
22091 circleElement.attr('stroke', circleData.stroke);
22092 circleElement.attr('r', circleData.r);
22093
22094 if (typeof circleElement.class !== 'undefined') {
22095 circleElement.attr('class', circleElement.class);
22096 }
22097
22098 if (typeof circleData.title !== 'undefined') {
22099 circleElement.append('title').text(circleData.title);
22100 }
22101
22102 return circleElement;
22103};
22104var drawText = function drawText(elem, textData) {
22105 // Remove and ignore br:s
22106 var nText = textData.text.replace(/<br\s*\/?>/gi, ' ');
22107 var textElem = elem.append('text');
22108 textElem.attr('x', textData.x);
22109 textElem.attr('y', textData.y);
22110 textElem.attr('class', 'legend');
22111 textElem.style('text-anchor', textData.anchor);
22112
22113 if (typeof textData.class !== 'undefined') {
22114 textElem.attr('class', textData.class);
22115 }
22116
22117 var span = textElem.append('tspan');
22118 span.attr('x', textData.x + textData.textMargin * 2);
22119 span.text(nText);
22120 return textElem;
22121};
22122var drawLabel = function drawLabel(elem, txtObject) {
22123 function genPoints(x, y, width, height, cut) {
22124 return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height);
22125 }
22126
22127 var polygon = elem.append('polygon');
22128 polygon.attr('points', genPoints(txtObject.x, txtObject.y, 50, 20, 7));
22129 polygon.attr('class', 'labelBox');
22130 txtObject.y = txtObject.y + txtObject.labelMargin;
22131 txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
22132 drawText(elem, txtObject);
22133};
22134var drawSection = function drawSection(elem, section, conf) {
22135 var g = elem.append('g');
22136 var rect = getNoteRect();
22137 rect.x = section.x;
22138 rect.y = section.y;
22139 rect.fill = section.fill;
22140 rect.width = conf.width;
22141 rect.height = conf.height;
22142 rect.class = 'journey-section section-type-' + section.num;
22143 rect.rx = 3;
22144 rect.ry = 3;
22145 drawRect(g, rect);
22146
22147 _drawTextCandidateFunc(conf)(section.text, g, rect.x, rect.y, rect.width, rect.height, {
22148 class: 'journey-section section-type-' + section.num
22149 }, conf, section.colour);
22150};
22151var taskCount = -1;
22152/**
22153 * Draws an actor in the diagram with the attaced line
22154 * @param elem The HTML element
22155 * @param task The task to render
22156 * @param conf The global configuration
22157 */
22158
22159var drawTask = function drawTask(elem, task, conf) {
22160 var center = task.x + conf.width / 2;
22161 var g = elem.append('g');
22162 taskCount++;
22163 var maxHeight = 300 + 5 * 30;
22164 g.append('line').attr('id', 'task' + taskCount).attr('x1', center).attr('y1', task.y).attr('x2', center).attr('y2', maxHeight).attr('class', 'task-line').attr('stroke-width', '1px').attr('stroke-dasharray', '4 2').attr('stroke', '#666');
22165 drawFace(g, {
22166 cx: center,
22167 cy: 300 + (5 - task.score) * 30,
22168 score: task.score
22169 });
22170 var rect = getNoteRect();
22171 rect.x = task.x;
22172 rect.y = task.y;
22173 rect.fill = task.fill;
22174 rect.width = conf.width;
22175 rect.height = conf.height;
22176 rect.class = 'task task-type-' + task.num;
22177 rect.rx = 3;
22178 rect.ry = 3;
22179 drawRect(g, rect);
22180 var xPos = task.x + 14;
22181 task.people.forEach(function (person) {
22182 var colour = task.actors[person];
22183 var circle = {
22184 cx: xPos,
22185 cy: task.y,
22186 r: 7,
22187 fill: colour,
22188 stroke: '#000',
22189 title: person
22190 };
22191 drawCircle(g, circle);
22192 xPos += 10;
22193 });
22194
22195 _drawTextCandidateFunc(conf)(task.task, g, rect.x, rect.y, rect.width, rect.height, {
22196 class: 'task'
22197 }, conf, task.colour);
22198};
22199/**
22200 * Draws a background rectangle
22201 * @param elem The html element
22202 * @param bounds The bounds of the drawing
22203 */
22204
22205var drawBackgroundRect = function drawBackgroundRect(elem, bounds) {
22206 var rectElem = drawRect(elem, {
22207 x: bounds.startx,
22208 y: bounds.starty,
22209 width: bounds.stopx - bounds.startx,
22210 height: bounds.stopy - bounds.starty,
22211 fill: bounds.fill,
22212 class: 'rect'
22213 });
22214 rectElem.lower();
22215};
22216var getTextObj = function getTextObj() {
22217 return {
22218 x: 0,
22219 y: 0,
22220 fill: undefined,
22221 'text-anchor': 'start',
22222 width: 100,
22223 height: 100,
22224 textMargin: 0,
22225 rx: 0,
22226 ry: 0
22227 };
22228};
22229var getNoteRect = function getNoteRect() {
22230 return {
22231 x: 0,
22232 y: 0,
22233 width: 100,
22234 anchor: 'start',
22235 height: 100,
22236 rx: 0,
22237 ry: 0
22238 };
22239};
22240
22241var _drawTextCandidateFunc = function () {
22242 function byText(content, g, x, y, width, height, textAttrs, colour) {
22243 var text = g.append('text').attr('x', x + width / 2).attr('y', y + height / 2 + 5).style('font-color', colour).style('text-anchor', 'middle').text(content);
22244
22245 _setTextAttrs(text, textAttrs);
22246 }
22247
22248 function byTspan(content, g, x, y, width, height, textAttrs, conf, colour) {
22249 var taskFontSize = conf.taskFontSize,
22250 taskFontFamily = conf.taskFontFamily;
22251 var lines = content.split(/<br\s*\/?>/gi);
22252
22253 for (var i = 0; i < lines.length; i++) {
22254 var dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2;
22255 var text = g.append('text').attr('x', x + width / 2).attr('y', y).attr('fill', colour).style('text-anchor', 'middle').style('font-size', taskFontSize).style('font-family', taskFontFamily);
22256 text.append('tspan').attr('x', x + width / 2).attr('dy', dy).text(lines[i]);
22257 text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
22258
22259 _setTextAttrs(text, textAttrs);
22260 }
22261 }
22262
22263 function byFo(content, g, x, y, width, height, textAttrs, conf) {
22264 var body = g.append('switch');
22265 var f = body.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height).attr('position', 'fixed');
22266 var text = f.append('div').style('display', 'table').style('height', '100%').style('width', '100%');
22267 text.append('div').attr('class', 'label').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle') // .style('color', colour)
22268 .text(content);
22269 byTspan(content, body, x, y, width, height, textAttrs, conf);
22270
22271 _setTextAttrs(text, textAttrs);
22272 }
22273
22274 function _setTextAttrs(toText, fromTextAttrsDict) {
22275 for (var key in fromTextAttrsDict) {
22276 if (key in fromTextAttrsDict) {
22277 // eslint-disable-line
22278 // noinspection JSUnfilteredForInLoop
22279 toText.attr(key, fromTextAttrsDict[key]);
22280 }
22281 }
22282 }
22283
22284 return function (conf) {
22285 return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
22286 };
22287}();
22288
22289var initGraphics = function initGraphics(graphics) {
22290 graphics.append('defs').append('marker').attr('id', 'arrowhead').attr('refX', 5).attr('refY', 2).attr('markerWidth', 6).attr('markerHeight', 4).attr('orient', 'auto').append('path').attr('d', 'M 0,0 V 4 L6,2 Z'); // this is actual shape for arrowhead
22291};
22292
22293/* harmony default export */ __webpack_exports__["default"] = ({
22294 drawRect: drawRect,
22295 drawCircle: drawCircle,
22296 drawSection: drawSection,
22297 drawText: drawText,
22298 drawLabel: drawLabel,
22299 drawTask: drawTask,
22300 drawBackgroundRect: drawBackgroundRect,
22301 getTextObj: getTextObj,
22302 getNoteRect: getNoteRect,
22303 initGraphics: initGraphics
22304});
22305
22306/***/ }),
22307
22308/***/ "./src/errorRenderer.js":
22309/*!******************************!*\
22310 !*** ./src/errorRenderer.js ***!
22311 \******************************/
22312/*! exports provided: setConf, draw, default */
22313/***/ (function(module, __webpack_exports__, __webpack_require__) {
22314
22315"use strict";
22316__webpack_require__.r(__webpack_exports__);
22317/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
22318/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
22319/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
22320/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
22321/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
22322/**
22323 * Created by knut on 14-12-11.
22324 */
22325
22326
22327var conf = {};
22328var setConf = function setConf(cnf) {
22329 var keys = Object.keys(cnf);
22330 keys.forEach(function (key) {
22331 conf[key] = cnf[key];
22332 });
22333};
22334/**
22335 * Draws a an info picture in the tag with id: id based on the graph definition in text.
22336 * @param text
22337 * @param id
22338 */
22339
22340var draw = function draw(id, ver) {
22341 try {
22342 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].debug('Renering svg for syntax error\n');
22343 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + id);
22344 var g = svg.append('g');
22345 g.append('path').attr('class', 'error-icon').attr('d', 'm411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z');
22346 g.append('path').attr('class', 'error-icon').attr('d', 'm459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z');
22347 g.append('path').attr('class', 'error-icon').attr('d', 'm340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z');
22348 g.append('path').attr('class', 'error-icon').attr('d', 'm400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z');
22349 g.append('path').attr('class', 'error-icon').attr('d', 'm496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z');
22350 g.append('path').attr('class', 'error-icon').attr('d', 'm436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z');
22351 g.append('text') // text label for the x axis
22352 .attr('class', 'error-text').attr('x', 1240).attr('y', 250).attr('font-size', '150px').style('text-anchor', 'middle').text('Syntax error in graph');
22353 g.append('text') // text label for the x axis
22354 .attr('class', 'error-text').attr('x', 1050).attr('y', 400).attr('font-size', '100px').style('text-anchor', 'middle').text('mermaid version ' + ver);
22355 svg.attr('height', 100);
22356 svg.attr('width', 400);
22357 svg.attr('viewBox', '768 0 512 512');
22358 } catch (e) {
22359 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].error('Error while rendering info diagram');
22360 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].error(e.message);
22361 }
22362};
22363/* harmony default export */ __webpack_exports__["default"] = ({
22364 setConf: setConf,
22365 draw: draw
22366});
22367
22368/***/ }),
22369
22370/***/ "./src/logger.js":
22371/*!***********************!*\
22372 !*** ./src/logger.js ***!
22373 \***********************/
22374/*! exports provided: LEVELS, logger, setLogLevel */
22375/***/ (function(module, __webpack_exports__, __webpack_require__) {
22376
22377"use strict";
22378__webpack_require__.r(__webpack_exports__);
22379/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LEVELS", function() { return LEVELS; });
22380/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logger", function() { return logger; });
22381/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLogLevel", function() { return setLogLevel; });
22382/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
22383/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
22384 //
22385
22386var LEVELS = {
22387 debug: 1,
22388 info: 2,
22389 warn: 3,
22390 error: 4,
22391 fatal: 5
22392};
22393var logger = {
22394 debug: function debug() {},
22395 info: function info() {},
22396 warn: function warn() {},
22397 error: function error() {},
22398 fatal: function fatal() {}
22399};
22400var setLogLevel = function setLogLevel() {
22401 var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'fatal';
22402
22403 if (isNaN(level)) {
22404 level = level.toLowerCase();
22405
22406 if (LEVELS[level] !== undefined) {
22407 level = LEVELS[level];
22408 }
22409 }
22410
22411 logger.trace = function () {};
22412
22413 logger.debug = function () {};
22414
22415 logger.info = function () {};
22416
22417 logger.warn = function () {};
22418
22419 logger.error = function () {};
22420
22421 logger.fatal = function () {};
22422
22423 if (level <= LEVELS.fatal) {
22424 logger.fatal = console.error ? console.error.bind(console, format('FATAL'), 'color: orange') : console.log.bind(console, '\x1b[35m', format('FATAL'));
22425 }
22426
22427 if (level <= LEVELS.error) {
22428 logger.error = console.error ? console.error.bind(console, format('ERROR'), 'color: orange') : console.log.bind(console, '\x1b[31m', format('ERROR'));
22429 }
22430
22431 if (level <= LEVELS.warn) {
22432 logger.warn = console.warn ? console.warn.bind(console, format('WARN'), 'color: orange') : console.log.bind(console, "\x1B[33m", format('WARN'));
22433 }
22434
22435 if (level <= LEVELS.info) {
22436 logger.info = console.info ? // ? console.info.bind(console, '\x1b[34m', format('INFO'), 'color: blue')
22437 console.info.bind(console, format('INFO'), 'color: lightblue') : console.log.bind(console, '\x1b[34m', format('INFO'));
22438 }
22439
22440 if (level <= LEVELS.debug) {
22441 logger.debug = console.debug ? console.debug.bind(console, format('DEBUG'), 'color: lightgreen') : console.log.bind(console, '\x1b[32m', format('DEBUG'));
22442 }
22443};
22444
22445var format = function format(level) {
22446 var time = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()().format('ss.SSS');
22447 return "%c".concat(time, " : ").concat(level, " : ");
22448};
22449
22450/***/ }),
22451
22452/***/ "./src/mermaid.js":
22453/*!************************!*\
22454 !*** ./src/mermaid.js ***!
22455 \************************/
22456/*! exports provided: default */
22457/***/ (function(module, __webpack_exports__, __webpack_require__) {
22458
22459"use strict";
22460__webpack_require__.r(__webpack_exports__);
22461/* harmony import */ var entity_decode_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! entity-decode/browser */ "entity-decode/browser");
22462/* harmony import */ var entity_decode_browser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(entity_decode_browser__WEBPACK_IMPORTED_MODULE_0__);
22463/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mermaidAPI */ "./src/mermaidAPI.js");
22464/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
22465/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
22466/**
22467 * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid functionality and to render
22468 * the diagrams to svg code.
22469 */
22470// import { decode } from 'he';
22471
22472
22473
22474
22475/**
22476 * ## init
22477 * Function that goes through the document to find the chart definitions in there and render them.
22478 *
22479 * The function tags the processed attributes with the attribute data-processed and ignores found elements with the
22480 * attribute already set. This way the init function can be triggered several times.
22481 *
22482 * Optionally, `init` can accept in the second argument one of the following:
22483 * - a DOM Node
22484 * - an array of DOM nodes (as would come from a jQuery selector)
22485 * - a W3C selector, a la `.mermaid`
22486 *
22487 * ```mermaid
22488 * graph LR;
22489 * a(Find elements)-->b{Processed}
22490 * b-->|Yes|c(Leave element)
22491 * b-->|No |d(Transform)
22492 * ```
22493 * Renders the mermaid diagrams
22494 * @param nodes a css selector or an array of nodes
22495 */
22496
22497var init = function init() {
22498 var _this = this;
22499
22500 var conf = _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].getConfig(); // console.log('Starting rendering diagrams (init) - mermaid.init', conf);
22501
22502 var nodes;
22503
22504 if (arguments.length >= 2) {
22505 /*! sequence config was passed as #1 */
22506 if (typeof arguments[0] !== 'undefined') {
22507 mermaid.sequenceConfig = arguments[0];
22508 }
22509
22510 nodes = arguments[1];
22511 } else {
22512 nodes = arguments[0];
22513 } // if last argument is a function this is the callback function
22514
22515
22516 var callback;
22517
22518 if (typeof arguments[arguments.length - 1] === 'function') {
22519 callback = arguments[arguments.length - 1];
22520 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Callback function found');
22521 } else {
22522 if (typeof conf.mermaid !== 'undefined') {
22523 if (typeof conf.mermaid.callback === 'function') {
22524 callback = conf.mermaid.callback;
22525 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Callback function found');
22526 } else {
22527 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('No Callback function found');
22528 }
22529 }
22530 }
22531
22532 nodes = nodes === undefined ? document.querySelectorAll('.mermaid') : typeof nodes === 'string' ? document.querySelectorAll(nodes) : nodes instanceof window.Node ? [nodes] : nodes; // Last case - sequence config was passed pick next
22533
22534 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Start On Load before: ' + mermaid.startOnLoad);
22535
22536 if (typeof mermaid.startOnLoad !== 'undefined') {
22537 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Start On Load inner: ' + mermaid.startOnLoad);
22538 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].updateSiteConfig({
22539 startOnLoad: mermaid.startOnLoad
22540 });
22541 }
22542
22543 if (typeof mermaid.ganttConfig !== 'undefined') {
22544 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].updateSiteConfig({
22545 gantt: mermaid.ganttConfig
22546 });
22547 }
22548
22549 var txt;
22550
22551 var _loop = function _loop(i) {
22552 var element = nodes[i];
22553 /*! Check if previously processed */
22554
22555 if (!element.getAttribute('data-processed')) {
22556 element.setAttribute('data-processed', true);
22557 } else {
22558 return "continue";
22559 }
22560
22561 var id = "mermaid-".concat(Date.now()); // Fetch the graph definition including tags
22562
22563 txt = element.innerHTML; // transforms the html to pure text
22564
22565 txt = entity_decode_browser__WEBPACK_IMPORTED_MODULE_0___default()(txt).trim().replace(/<br\s*\/?>/gi, '<br/>');
22566 var init = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].detectInit(txt);
22567
22568 if (init) {
22569 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Detected early reinit: ', init);
22570 }
22571
22572 try {
22573 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].render(id, txt, function (svgCode, bindFunctions) {
22574 element.innerHTML = svgCode;
22575
22576 if (typeof callback !== 'undefined') {
22577 callback(id);
22578 }
22579
22580 if (bindFunctions) bindFunctions(element);
22581 }, element);
22582 } catch (e) {
22583 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].warn('Syntax Error rendering');
22584 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].warn(e);
22585
22586 if (_this.parseError) {
22587 _this.parseError(e);
22588 }
22589 }
22590 };
22591
22592 for (var i = 0; i < nodes.length; i++) {
22593 var _ret = _loop(i);
22594
22595 if (_ret === "continue") continue;
22596 }
22597};
22598
22599var initialize = function initialize(config) {
22600 // mermaidAPI.reset();
22601 if (typeof config.mermaid !== 'undefined') {
22602 if (typeof config.mermaid.startOnLoad !== 'undefined') {
22603 mermaid.startOnLoad = config.mermaid.startOnLoad;
22604 }
22605
22606 if (typeof config.mermaid.htmlLabels !== 'undefined') {
22607 mermaid.htmlLabels = config.mermaid.htmlLabels;
22608 }
22609 }
22610
22611 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].initialize(config); // mermaidAPI.reset();
22612};
22613/**
22614 * ##contentLoaded
22615 * Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and
22616 * calls init for rendering the mermaid diagrams on the page.
22617 */
22618
22619
22620var contentLoaded = function contentLoaded() {
22621 var config;
22622
22623 if (mermaid.startOnLoad) {
22624 // No config found, do check API config
22625 config = _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].getConfig();
22626
22627 if (config.startOnLoad) {
22628 mermaid.init();
22629 }
22630 } else {
22631 if (typeof mermaid.startOnLoad === 'undefined') {
22632 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('In start, no config');
22633 config = _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].getConfig();
22634
22635 if (config.startOnLoad) {
22636 mermaid.init();
22637 }
22638 }
22639 }
22640};
22641
22642if (typeof document !== 'undefined') {
22643 /*!
22644 * Wait for document loaded before starting the execution
22645 */
22646 window.addEventListener('load', function () {
22647 contentLoaded();
22648 }, false);
22649}
22650
22651var mermaid = {
22652 startOnLoad: true,
22653 htmlLabels: true,
22654 mermaidAPI: _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"],
22655 parse: _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].parse,
22656 render: _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].render,
22657 init: init,
22658 initialize: initialize,
22659 contentLoaded: contentLoaded
22660};
22661/* harmony default export */ __webpack_exports__["default"] = (mermaid);
22662
22663/***/ }),
22664
22665/***/ "./src/mermaidAPI.js":
22666/*!***************************!*\
22667 !*** ./src/mermaidAPI.js ***!
22668 \***************************/
22669/*! exports provided: encodeEntities, decodeEntities, default */
22670/***/ (function(module, __webpack_exports__, __webpack_require__) {
22671
22672"use strict";
22673__webpack_require__.r(__webpack_exports__);
22674/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encodeEntities", function() { return encodeEntities; });
22675/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decodeEntities", function() { return decodeEntities; });
22676/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! stylis */ "stylis");
22677/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(stylis__WEBPACK_IMPORTED_MODULE_0__);
22678/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
22679/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
22680/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../package.json */ "./package.json");
22681var _package_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ../package.json */ "./package.json", 1);
22682/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
22683/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
22684/* harmony import */ var _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./diagrams/flowchart/flowRenderer */ "./src/diagrams/flowchart/flowRenderer.js");
22685/* harmony import */ var _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./diagrams/flowchart/flowRenderer-v2 */ "./src/diagrams/flowchart/flowRenderer-v2.js");
22686/* harmony import */ var _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./diagrams/flowchart/parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
22687/* harmony import */ var _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_7__);
22688/* harmony import */ var _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagrams/flowchart/flowDb */ "./src/diagrams/flowchart/flowDb.js");
22689/* harmony import */ var _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./diagrams/sequence/sequenceRenderer */ "./src/diagrams/sequence/sequenceRenderer.js");
22690/* harmony import */ var _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./diagrams/sequence/parser/sequenceDiagram */ "./src/diagrams/sequence/parser/sequenceDiagram.jison");
22691/* harmony import */ var _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_10__);
22692/* harmony import */ var _diagrams_sequence_sequenceDb__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./diagrams/sequence/sequenceDb */ "./src/diagrams/sequence/sequenceDb.js");
22693/* harmony import */ var _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./diagrams/gantt/ganttRenderer */ "./src/diagrams/gantt/ganttRenderer.js");
22694/* harmony import */ var _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./diagrams/gantt/parser/gantt */ "./src/diagrams/gantt/parser/gantt.jison");
22695/* harmony import */ var _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_13__);
22696/* harmony import */ var _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./diagrams/gantt/ganttDb */ "./src/diagrams/gantt/ganttDb.js");
22697/* harmony import */ var _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./diagrams/class/classRenderer */ "./src/diagrams/class/classRenderer.js");
22698/* harmony import */ var _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./diagrams/class/classRenderer-v2 */ "./src/diagrams/class/classRenderer-v2.js");
22699/* harmony import */ var _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./diagrams/class/parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
22700/* harmony import */ var _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_17__);
22701/* harmony import */ var _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./diagrams/class/classDb */ "./src/diagrams/class/classDb.js");
22702/* harmony import */ var _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./diagrams/state/stateRenderer */ "./src/diagrams/state/stateRenderer.js");
22703/* harmony import */ var _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./diagrams/state/stateRenderer-v2 */ "./src/diagrams/state/stateRenderer-v2.js");
22704/* harmony import */ var _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./diagrams/state/parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
22705/* harmony import */ var _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(_diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_21__);
22706/* harmony import */ var _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./diagrams/state/stateDb */ "./src/diagrams/state/stateDb.js");
22707/* harmony import */ var _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./diagrams/git/gitGraphRenderer */ "./src/diagrams/git/gitGraphRenderer.js");
22708/* harmony import */ var _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./diagrams/git/parser/gitGraph */ "./src/diagrams/git/parser/gitGraph.jison");
22709/* harmony import */ var _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(_diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_24__);
22710/* harmony import */ var _diagrams_git_gitGraphAst__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./diagrams/git/gitGraphAst */ "./src/diagrams/git/gitGraphAst.js");
22711/* harmony import */ var _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./diagrams/info/infoRenderer */ "./src/diagrams/info/infoRenderer.js");
22712/* harmony import */ var _errorRenderer__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./errorRenderer */ "./src/errorRenderer.js");
22713/* harmony import */ var _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./diagrams/info/parser/info */ "./src/diagrams/info/parser/info.jison");
22714/* harmony import */ var _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_28___default = /*#__PURE__*/__webpack_require__.n(_diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_28__);
22715/* harmony import */ var _diagrams_info_infoDb__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./diagrams/info/infoDb */ "./src/diagrams/info/infoDb.js");
22716/* harmony import */ var _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./diagrams/pie/pieRenderer */ "./src/diagrams/pie/pieRenderer.js");
22717/* harmony import */ var _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./diagrams/pie/parser/pie */ "./src/diagrams/pie/parser/pie.jison");
22718/* harmony import */ var _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_31___default = /*#__PURE__*/__webpack_require__.n(_diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_31__);
22719/* harmony import */ var _diagrams_pie_pieDb__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./diagrams/pie/pieDb */ "./src/diagrams/pie/pieDb.js");
22720/* harmony import */ var _diagrams_er_erDb__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./diagrams/er/erDb */ "./src/diagrams/er/erDb.js");
22721/* harmony import */ var _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./diagrams/er/parser/erDiagram */ "./src/diagrams/er/parser/erDiagram.jison");
22722/* harmony import */ var _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_34___default = /*#__PURE__*/__webpack_require__.n(_diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_34__);
22723/* harmony import */ var _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./diagrams/er/erRenderer */ "./src/diagrams/er/erRenderer.js");
22724/* harmony import */ var _diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./diagrams/user-journey/parser/journey */ "./src/diagrams/user-journey/parser/journey.jison");
22725/* harmony import */ var _diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_36___default = /*#__PURE__*/__webpack_require__.n(_diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_36__);
22726/* harmony import */ var _diagrams_user_journey_journeyDb__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./diagrams/user-journey/journeyDb */ "./src/diagrams/user-journey/journeyDb.js");
22727/* harmony import */ var _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./diagrams/user-journey/journeyRenderer */ "./src/diagrams/user-journey/journeyRenderer.js");
22728/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./config */ "./src/config.js");
22729/* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./styles */ "./src/styles.js");
22730/* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
22731function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
22732
22733/**
22734 * This is the api to be used when optionally handling the integration with the web page, instead of using the default integration provided by mermaid.js.
22735 *
22736 * The core of this api is the [**render**](Setup.md?id=render) function which, given a graph
22737 * definition as text, renders the graph/diagram and returns an svg element for the graph.
22738 *
22739 * It is is then up to the user of the API to make use of the svg, either insert it somewhere in the page or do something completely different.
22740 *
22741 * In addition to the render function, a number of behavioral configuration options are available.
22742 *
22743 * @name mermaidAPI
22744 */
22745
22746
22747 // import * as configApi from './config';
22748// // , {
22749// // setConfig,
22750// // configApi.getConfig,
22751// // configApi.updateSiteConfig,
22752// // configApi.setSiteConfig,
22753// // configApi.getSiteConfig,
22754// // configApi.defaultConfig
22755// // }
22756
22757
22758
22759
22760
22761
22762
22763
22764
22765
22766
22767
22768
22769
22770
22771
22772
22773
22774
22775
22776
22777
22778
22779
22780
22781
22782
22783
22784
22785
22786
22787
22788
22789
22790
22791
22792
22793
22794
22795
22796
22797function parse(text) {
22798 var graphInit = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].detectInit(text);
22799
22800 if (graphInit) {
22801 reinitialize(graphInit);
22802 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('reinit ', graphInit);
22803 }
22804
22805 var graphType = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].detectType(text);
22806 var parser;
22807 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Type ' + graphType);
22808
22809 switch (graphType) {
22810 case 'git':
22811 parser = _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_24___default.a;
22812 parser.parser.yy = _diagrams_git_gitGraphAst__WEBPACK_IMPORTED_MODULE_25__["default"];
22813 break;
22814
22815 case 'flowchart':
22816 _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].clear();
22817 parser = _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_7___default.a;
22818 parser.parser.yy = _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"];
22819 break;
22820
22821 case 'flowchart-v2':
22822 _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].clear();
22823 parser = _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_7___default.a;
22824 parser.parser.yy = _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"];
22825 break;
22826
22827 case 'sequence':
22828 parser = _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_10___default.a;
22829 parser.parser.yy = _diagrams_sequence_sequenceDb__WEBPACK_IMPORTED_MODULE_11__["default"];
22830 break;
22831
22832 case 'gantt':
22833 parser = _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_13___default.a;
22834 parser.parser.yy = _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_14__["default"];
22835 break;
22836
22837 case 'class':
22838 parser = _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_17___default.a;
22839 parser.parser.yy = _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_18__["default"];
22840 break;
22841
22842 case 'classDiagram':
22843 parser = _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_17___default.a;
22844 parser.parser.yy = _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_18__["default"];
22845 break;
22846
22847 case 'state':
22848 parser = _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_21___default.a;
22849 parser.parser.yy = _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_22__["default"];
22850 break;
22851
22852 case 'stateDiagram':
22853 parser = _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_21___default.a;
22854 parser.parser.yy = _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_22__["default"];
22855 break;
22856
22857 case 'info':
22858 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('info info info');
22859 parser = _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_28___default.a;
22860 parser.parser.yy = _diagrams_info_infoDb__WEBPACK_IMPORTED_MODULE_29__["default"];
22861 break;
22862
22863 case 'pie':
22864 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('pie');
22865 parser = _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_31___default.a;
22866 parser.parser.yy = _diagrams_pie_pieDb__WEBPACK_IMPORTED_MODULE_32__["default"];
22867 break;
22868
22869 case 'er':
22870 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('er');
22871 parser = _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_34___default.a;
22872 parser.parser.yy = _diagrams_er_erDb__WEBPACK_IMPORTED_MODULE_33__["default"];
22873 break;
22874
22875 case 'journey':
22876 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Journey');
22877 parser = _diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_36___default.a;
22878 parser.parser.yy = _diagrams_user_journey_journeyDb__WEBPACK_IMPORTED_MODULE_37__["default"];
22879 break;
22880 }
22881
22882 parser.parser.yy.graphType = graphType;
22883
22884 parser.parser.yy.parseError = function (str, hash) {
22885 var error = {
22886 str: str,
22887 hash: hash
22888 };
22889 throw error;
22890 };
22891
22892 parser.parse(text);
22893 return parser;
22894}
22895
22896var encodeEntities = function encodeEntities(text) {
22897 var txt = text;
22898 txt = txt.replace(/style.*:\S*#.*;/g, function (s) {
22899 var innerTxt = s.substring(0, s.length - 1);
22900 return innerTxt;
22901 });
22902 txt = txt.replace(/classDef.*:\S*#.*;/g, function (s) {
22903 var innerTxt = s.substring(0, s.length - 1);
22904 return innerTxt;
22905 });
22906 txt = txt.replace(/#\w+;/g, function (s) {
22907 var innerTxt = s.substring(1, s.length - 1);
22908 var isInt = /^\+?\d+$/.test(innerTxt);
22909
22910 if (isInt) {
22911 return 'fl°°' + innerTxt + '¶ß';
22912 } else {
22913 return 'fl°' + innerTxt + '¶ß';
22914 }
22915 });
22916 return txt;
22917};
22918var decodeEntities = function decodeEntities(text) {
22919 var txt = text;
22920 txt = txt.replace(/fl°°/g, function () {
22921 return '&#';
22922 });
22923 txt = txt.replace(/fl°/g, function () {
22924 return '&';
22925 });
22926 txt = txt.replace(/¶ß/g, function () {
22927 return ';';
22928 });
22929 return txt;
22930};
22931/**
22932 * Function that renders an svg with a graph from a chart definition. Usage example below.
22933 *
22934 * ```js
22935 * mermaidAPI.initialize({
22936 * startOnLoad:true
22937 * });
22938 * $(function(){
22939 * const graphDefinition = 'graph TB\na-->b';
22940 * const cb = function(svgGraph){
22941 * console.log(svgGraph);
22942 * };
22943 * mermaidAPI.render('id1',graphDefinition,cb);
22944 * });
22945 *```
22946 * @param id the id of the element to be rendered
22947 * @param _txt the graph definition
22948 * @param cb callback which is called after rendering is finished with the svg code as inparam.
22949 * @param container selector to element in which a div with the graph temporarily will be inserted. In one is
22950 * provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is
22951 * completed.
22952 */
22953
22954var render = function render(id, _txt, cb, container) {
22955 _config__WEBPACK_IMPORTED_MODULE_39__["reset"]();
22956 var txt = _txt;
22957 var graphInit = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].detectInit(txt);
22958
22959 if (graphInit) {
22960 _config__WEBPACK_IMPORTED_MODULE_39__["addDirective"](graphInit);
22961 } // else {
22962 // configApi.reset();
22963 // const siteConfig = configApi.getSiteConfig();
22964 // configApi.addDirective(siteConfig);
22965 // }
22966 // console.warn('Render fetching config');
22967
22968
22969 var cnf = _config__WEBPACK_IMPORTED_MODULE_39__["getConfig"]();
22970 console.warn('Render with config after adding new directives', cnf.themeVariables.primaryColor); // Check the maximum allowed text size
22971
22972 if (_txt.length > cnf.maxTextSize) {
22973 txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
22974 }
22975
22976 if (typeof container !== 'undefined') {
22977 container.innerHTML = '';
22978 Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])(container).append('div').attr('id', 'd' + id).attr('style', 'font-family: ' + cnf.fontFamily).append('svg').attr('id', id).attr('width', '100%').attr('xmlns', 'http://www.w3.org/2000/svg').append('g');
22979 } else {
22980 var existingSvg = document.getElementById(id);
22981
22982 if (existingSvg) {
22983 existingSvg.remove();
22984 }
22985
22986 var _element = document.querySelector('#' + 'd' + id);
22987
22988 if (_element) {
22989 _element.remove();
22990 }
22991
22992 Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('body').append('div').attr('id', 'd' + id).append('svg').attr('id', id).attr('width', '100%').attr('xmlns', 'http://www.w3.org/2000/svg').append('g');
22993 }
22994
22995 window.txt = txt;
22996 txt = encodeEntities(txt);
22997 var element = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#d' + id).node();
22998 var graphType = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].detectType(txt); // insert inline style into svg
22999
23000 var svg = element.firstChild;
23001 var firstChild = svg.firstChild;
23002 var userStyles = ''; // user provided theme CSS
23003
23004 if (cnf.themeCSS !== undefined) {
23005 userStyles += "\n".concat(cnf.themeCSS);
23006 } // user provided theme CSS
23007
23008
23009 if (cnf.fontFamily !== undefined) {
23010 userStyles += "\n:root { --mermaid-font-family: ".concat(cnf.fontFamily, "}");
23011 } // user provided theme CSS
23012
23013
23014 if (cnf.altFontFamily !== undefined) {
23015 userStyles += "\n:root { --mermaid-alt-font-family: ".concat(cnf.altFontFamily, "}");
23016 } // classDef
23017
23018
23019 if (graphType === 'flowchart' || graphType === 'flowchart-v2' || graphType === 'graph') {
23020 var classes = _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_5__["default"].getClasses(txt);
23021
23022 for (var className in classes) {
23023 userStyles += "\n.".concat(className, " > * { ").concat(classes[className].styles.join(' !important; '), " !important; }");
23024
23025 if (classes[className].textStyles) {
23026 userStyles += "\n.".concat(className, " tspan { ").concat(classes[className].textStyles.join(' !important; '), " !important; }");
23027 }
23028 }
23029 } // logger.warn(cnf.themeVariables);
23030
23031
23032 var stylis = new stylis__WEBPACK_IMPORTED_MODULE_0___default.a();
23033 var rules = stylis("#".concat(id), Object(_styles__WEBPACK_IMPORTED_MODULE_40__["default"])(graphType, userStyles, cnf.themeVariables));
23034 var style1 = document.createElement('style');
23035 style1.innerHTML = rules;
23036 svg.insertBefore(style1, firstChild); // Verify that the generated svgs are ok before removing this
23037 // const style2 = document.createElement('style');
23038 // const cs = window.getComputedStyle(svg);
23039 // style2.innerHTML = `#d${id} * {
23040 // color: ${cs.color};
23041 // // font: ${cs.font};
23042 // // font-family: Arial;
23043 // // font-size: 24px;
23044 // }`;
23045 // svg.insertBefore(style2, firstChild);
23046
23047 try {
23048 switch (graphType) {
23049 case 'git':
23050 cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23051 _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_23__["default"].setConf(cnf.git);
23052 _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_23__["default"].draw(txt, id, false);
23053 break;
23054
23055 case 'flowchart':
23056 cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23057 _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_5__["default"].setConf(cnf.flowchart);
23058 _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_5__["default"].draw(txt, id, false);
23059 break;
23060
23061 case 'flowchart-v2':
23062 cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23063 _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_6__["default"].setConf(cnf.flowchart);
23064 _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_6__["default"].draw(txt, id, false);
23065 break;
23066
23067 case 'sequence':
23068 cnf.sequence.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23069
23070 if (cnf.sequenceDiagram) {
23071 // backwards compatibility
23072 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__["default"].setConf(Object.assign(cnf.sequence, cnf.sequenceDiagram));
23073 console.error('`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.');
23074 } else {
23075 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__["default"].setConf(cnf.sequence);
23076 }
23077
23078 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__["default"].draw(txt, id);
23079 break;
23080
23081 case 'gantt':
23082 cnf.gantt.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23083 _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_12__["default"].setConf(cnf.gantt);
23084 _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_12__["default"].draw(txt, id);
23085 break;
23086
23087 case 'class':
23088 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23089 _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_15__["default"].setConf(cnf.class);
23090 _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_15__["default"].draw(txt, id);
23091 break;
23092
23093 case 'classDiagram':
23094 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23095 _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_16__["default"].setConf(cnf.class);
23096 _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_16__["default"].draw(txt, id);
23097 break;
23098
23099 case 'state':
23100 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23101 _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_19__["default"].setConf(cnf.state);
23102 _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_19__["default"].draw(txt, id);
23103 break;
23104
23105 case 'stateDiagram':
23106 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23107 _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_20__["default"].setConf(cnf.state);
23108 _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_20__["default"].draw(txt, id);
23109 break;
23110
23111 case 'info':
23112 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23113 _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_26__["default"].setConf(cnf.class);
23114 _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_26__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_2__.version);
23115 break;
23116
23117 case 'pie':
23118 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23119 _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_30__["default"].setConf(cnf.class);
23120 _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_30__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_2__.version);
23121 break;
23122
23123 case 'er':
23124 _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].setConf(cnf.er);
23125 _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_2__.version);
23126 break;
23127
23128 case 'journey':
23129 _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_38__["default"].setConf(cnf.journey);
23130 _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_38__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_2__.version);
23131 break;
23132 }
23133 } catch (e) {
23134 // errorRenderer.setConf(cnf.class);
23135 _errorRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].draw(id, _package_json__WEBPACK_IMPORTED_MODULE_2__.version);
23136 throw e;
23137 }
23138
23139 Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(id, "\"]")).selectAll('foreignobject > *').attr('xmlns', 'http://www.w3.org/1999/xhtml'); // if (cnf.arrowMarkerAbsolute) {
23140 // url =
23141 // window.location.protocol +
23142 // '//' +
23143 // window.location.host +
23144 // window.location.pathname +
23145 // window.location.search;
23146 // url = url.replace(/\(/g, '\\(');
23147 // url = url.replace(/\)/g, '\\)');
23148 // }
23149 // Fix for when the base tag is used
23150
23151 var svgCode = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#d' + id).node().innerHTML;
23152 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('cnf.arrowMarkerAbsolute', cnf.arrowMarkerAbsolute);
23153
23154 if (!cnf.arrowMarkerAbsolute || cnf.arrowMarkerAbsolute === 'false') {
23155 svgCode = svgCode.replace(/marker-end="url\(.*?#/g, 'marker-end="url(#', 'g');
23156 }
23157
23158 svgCode = decodeEntities(svgCode);
23159
23160 if (typeof cb !== 'undefined') {
23161 switch (graphType) {
23162 case 'flowchart':
23163 case 'flowchart-v2':
23164 cb(svgCode, _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].bindFunctions);
23165 break;
23166
23167 case 'gantt':
23168 cb(svgCode, _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_14__["default"].bindFunctions);
23169 break;
23170
23171 case 'class':
23172 cb(svgCode, _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_18__["default"].bindFunctions);
23173 break;
23174
23175 default:
23176 cb(svgCode);
23177 }
23178 } else {
23179 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('CB = undefined!');
23180 }
23181
23182 var node = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#d' + id).node();
23183
23184 if (node !== null && typeof node.remove === 'function') {
23185 Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#d' + id).node().remove();
23186 }
23187
23188 return svgCode;
23189};
23190
23191var currentDirective = {};
23192
23193var parseDirective = function parseDirective(p, statement, context, type) {
23194 try {
23195 if (statement !== undefined) {
23196 statement = statement.trim();
23197
23198 switch (context) {
23199 case 'open_directive':
23200 currentDirective = {};
23201 break;
23202
23203 case 'type_directive':
23204 currentDirective.type = statement.toLowerCase();
23205 break;
23206
23207 case 'arg_directive':
23208 currentDirective.args = JSON.parse(statement);
23209 break;
23210
23211 case 'close_directive':
23212 handleDirective(p, currentDirective, type);
23213 currentDirective = null;
23214 break;
23215 }
23216 }
23217 } catch (error) {
23218 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error("Error while rendering sequenceDiagram directive: ".concat(statement, " jison context: ").concat(context));
23219 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error(error.message);
23220 }
23221};
23222
23223var handleDirective = function handleDirective(p, directive, type) {
23224 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug("Directive type=".concat(directive.type, " with args:"), directive.args);
23225
23226 switch (directive.type) {
23227 case 'init':
23228 case 'initialize':
23229 {
23230 ['config'].forEach(function (prop) {
23231 if (typeof directive.args[prop] !== 'undefined') {
23232 if (type === 'flowchart-v2') {
23233 type = 'flowchart';
23234 }
23235
23236 directive.args[type] = directive.args[prop];
23237 delete directive.args[prop];
23238 }
23239 });
23240 reinitialize(directive.args);
23241 _config__WEBPACK_IMPORTED_MODULE_39__["addDirective"](directive.args);
23242 break;
23243 }
23244
23245 case 'wrap':
23246 case 'nowrap':
23247 if (p && p['setWrap']) {
23248 p.setWrap(directive.type === 'wrap');
23249 }
23250
23251 break;
23252
23253 default:
23254 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].warn("Unhandled directive: source: '%%{".concat(directive.type, ": ").concat(JSON.stringify(directive.args ? directive.args : {}), "}%%"), directive);
23255 break;
23256 }
23257};
23258
23259function updateRendererConfigs(conf) {
23260 _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_23__["default"].setConf(conf.git);
23261 _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_5__["default"].setConf(conf.flowchart);
23262 _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_6__["default"].setConf(conf.flowchart);
23263
23264 if (typeof conf['sequenceDiagram'] !== 'undefined') {
23265 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__["default"].setConf(Object(_utils__WEBPACK_IMPORTED_MODULE_4__["assignWithDepth"])(conf.sequence, conf['sequenceDiagram']));
23266 }
23267
23268 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__["default"].setConf(conf.sequence);
23269 _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_12__["default"].setConf(conf.gantt);
23270 _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_15__["default"].setConf(conf.class);
23271 _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_19__["default"].setConf(conf.state);
23272 _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_20__["default"].setConf(conf.state);
23273 _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_26__["default"].setConf(conf.class);
23274 _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_30__["default"].setConf(conf.class);
23275 _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].setConf(conf.er);
23276 _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_38__["default"].setConf(conf.journey);
23277 _errorRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].setConf(conf.class);
23278}
23279
23280function reinitialize() {// `mermaidAPI.reinitialize: v${pkg.version}`,
23281 // JSON.stringify(options),
23282 // options.themeVariables.primaryColor;
23283 // // if (options.theme && theme[options.theme]) {
23284 // // options.themeVariables = theme[options.theme].getThemeVariables(options.themeVariables);
23285 // // }
23286 // // Set default options
23287 // const config =
23288 // typeof options === 'object' ? configApi.setConfig(options) : configApi.getSiteConfig();
23289 // updateRendererConfigs(config);
23290 // setLogLevel(config.logLevel);
23291 // logger.debug('mermaidAPI.reinitialize: ', config);
23292}
23293
23294function initialize(options) {
23295 console.warn("mermaidAPI.initialize: v".concat(_package_json__WEBPACK_IMPORTED_MODULE_2__.version, " "), options); // Set default options
23296
23297 if (options && options.theme && _themes__WEBPACK_IMPORTED_MODULE_41__["default"][options.theme]) {
23298 // Todo merge with user options
23299 options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_41__["default"][options.theme].getThemeVariables(options.themeVariables);
23300 } else {
23301 if (options) options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_41__["default"].default.getThemeVariables();
23302 }
23303
23304 var config = _typeof(options) === 'object' ? _config__WEBPACK_IMPORTED_MODULE_39__["setSiteConfig"](options) : _config__WEBPACK_IMPORTED_MODULE_39__["getSiteConfig"]();
23305 updateRendererConfigs(config);
23306 Object(_logger__WEBPACK_IMPORTED_MODULE_3__["setLogLevel"])(config.logLevel); // logger.debug('mermaidAPI.initialize: ', config);
23307}
23308
23309var mermaidAPI = Object.freeze({
23310 render: render,
23311 parse: parse,
23312 parseDirective: parseDirective,
23313 initialize: initialize,
23314 reinitialize: reinitialize,
23315 getConfig: _config__WEBPACK_IMPORTED_MODULE_39__["getConfig"],
23316 setConfig: _config__WEBPACK_IMPORTED_MODULE_39__["setConfig"],
23317 getSiteConfig: _config__WEBPACK_IMPORTED_MODULE_39__["getSiteConfig"],
23318 updateSiteConfig: _config__WEBPACK_IMPORTED_MODULE_39__["updateSiteConfig"],
23319 reset: function reset() {
23320 // console.warn('reset');
23321 _config__WEBPACK_IMPORTED_MODULE_39__["reset"](); // const siteConfig = configApi.getSiteConfig();
23322 // updateRendererConfigs(siteConfig);
23323 },
23324 globalReset: function globalReset() {
23325 _config__WEBPACK_IMPORTED_MODULE_39__["reset"](_config__WEBPACK_IMPORTED_MODULE_39__["defaultConfig"]);
23326 updateRendererConfigs(_config__WEBPACK_IMPORTED_MODULE_39__["getConfig"]());
23327 },
23328 defaultConfig: _config__WEBPACK_IMPORTED_MODULE_39__["defaultConfig"]
23329});
23330Object(_logger__WEBPACK_IMPORTED_MODULE_3__["setLogLevel"])(_config__WEBPACK_IMPORTED_MODULE_39__["getConfig"]().logLevel);
23331_config__WEBPACK_IMPORTED_MODULE_39__["reset"](_config__WEBPACK_IMPORTED_MODULE_39__["getConfig"]());
23332/* harmony default export */ __webpack_exports__["default"] = (mermaidAPI);
23333/**
23334 * ## mermaidAPI configuration defaults
23335 * <pre>
23336 *
23337 * &lt;script>
23338 * var config = {
23339 * theme:'default',
23340 * logLevel:'fatal',
23341 * securityLevel:'strict',
23342 * startOnLoad:true,
23343 * arrowMarkerAbsolute:false,
23344 *
23345 * er:{
23346 * diagramPadding:20,
23347 * layoutDirection:'TB',
23348 * minEntityWidth:100,
23349 * minEntityHeight:75,
23350 * entityPadding:15,
23351 * stroke:'gray',
23352 * fill:'honeydew',
23353 * fontSize:12,
23354 * useMaxWidth:true,
23355 * },
23356 * flowchart:{
23357 * diagramPadding:8,
23358 * htmlLabels:true,
23359 * curve:'linear',
23360 * },
23361 * sequence:{
23362 * diagramMarginX:50,
23363 * diagramMarginY:10,
23364 * actorMargin:50,
23365 * width:150,
23366 * height:65,
23367 * boxMargin:10,
23368 * boxTextMargin:5,
23369 * noteMargin:10,
23370 * messageMargin:35,
23371 * messageAlign:'center',
23372 * mirrorActors:true,
23373 * bottomMarginAdj:1,
23374 * useMaxWidth:true,
23375 * rightAngles:false,
23376 * showSequenceNumbers:false,
23377 * },
23378 * gantt:{
23379 * titleTopMargin:25,
23380 * barHeight:20,
23381 * barGap:4,
23382 * topPadding:50,
23383 * leftPadding:75,
23384 * gridLineStartPadding:35,
23385 * fontSize:11,
23386 * fontFamily:'"Open-Sans", "sans-serif"',
23387 * numberSectionStyles:4,
23388 * axisFormat:'%Y-%m-%d',
23389 * }
23390 * };
23391 * mermaid.initialize(config);
23392 * &lt;/script>
23393 *</pre>
23394 */
23395
23396/***/ }),
23397
23398/***/ "./src/styles.js":
23399/*!***********************!*\
23400 !*** ./src/styles.js ***!
23401 \***********************/
23402/*! exports provided: calcThemeVariables, default */
23403/***/ (function(module, __webpack_exports__, __webpack_require__) {
23404
23405"use strict";
23406__webpack_require__.r(__webpack_exports__);
23407/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calcThemeVariables", function() { return calcThemeVariables; });
23408/* harmony import */ var _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./diagrams/class/styles */ "./src/diagrams/class/styles.js");
23409/* harmony import */ var _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./diagrams/er/styles */ "./src/diagrams/er/styles.js");
23410/* harmony import */ var _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./diagrams/flowchart/styles */ "./src/diagrams/flowchart/styles.js");
23411/* harmony import */ var _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagrams/gantt/styles */ "./src/diagrams/gantt/styles.js");
23412/* harmony import */ var _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./diagrams/git/styles */ "./src/diagrams/git/styles.js");
23413/* harmony import */ var _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./diagrams/info/styles */ "./src/diagrams/info/styles.js");
23414/* harmony import */ var _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./diagrams/pie/styles */ "./src/diagrams/pie/styles.js");
23415/* harmony import */ var _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./diagrams/sequence/styles */ "./src/diagrams/sequence/styles.js");
23416/* harmony import */ var _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagrams/state/styles */ "./src/diagrams/state/styles.js");
23417/* harmony import */ var _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./diagrams/user-journey/styles */ "./src/diagrams/user-journey/styles.js");
23418
23419
23420
23421
23422
23423
23424
23425
23426
23427
23428var themes = {
23429 flowchart: _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_2__["default"],
23430 'flowchart-v2': _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_2__["default"],
23431 sequence: _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_7__["default"],
23432 gantt: _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_3__["default"],
23433 classDiagram: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
23434 'classDiagram-v2': _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
23435 class: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
23436 stateDiagram: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_8__["default"],
23437 state: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_8__["default"],
23438 git: _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_4__["default"],
23439 info: _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_5__["default"],
23440 pie: _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_6__["default"],
23441 er: _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_1__["default"],
23442 journey: _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__["default"]
23443};
23444var calcThemeVariables = function calcThemeVariables(theme, userOverRides) {
23445 return theme.calcColors(userOverRides);
23446};
23447
23448var getStyles = function getStyles(type, userStyles, options) {
23449 return " {\n font-family: ".concat(options.fontFamily, ";\n font-size: ").concat(options.fontSize, ";\n fill: ").concat(options.textColor, "\n }\n\n /* Classes common for multiple diagrams */\n\n .error-icon {\n fill: ").concat(options.errorBkgColor, ";\n }\n .error-text {\n fill: ").concat(options.errorTextColor, ";\n stroke: ").concat(options.errorTextColor, ";\n }\n\n .edge-thickness-normal {\n stroke-width: 2px;\n }\n .edge-thickness-thick {\n stroke-width: 3.5px\n }\n .edge-pattern-solid {\n stroke-dasharray: 0;\n }\n\n .edge-pattern-dashed{\n stroke-dasharray: 3;\n }\n .edge-pattern-dotted {\n stroke-dasharray: 2;\n }\n\n .marker {\n fill: ").concat(options.lineColor, ";\n }\n .marker.cross {\n stroke: ").concat(options.lineColor, ";\n }\n\n svg {\n font-family: ").concat(options.fontFamily, ";\n font-size: ").concat(options.fontSize, ";\n }\n\n ").concat(themes[type](options), "\n\n ").concat(userStyles, "\n\n ").concat(type, " { fill: apa;}\n");
23450};
23451
23452/* harmony default export */ __webpack_exports__["default"] = (getStyles);
23453
23454/***/ }),
23455
23456/***/ "./src/themes/index.js":
23457/*!*****************************!*\
23458 !*** ./src/themes/index.js ***!
23459 \*****************************/
23460/*! exports provided: default */
23461/***/ (function(module, __webpack_exports__, __webpack_require__) {
23462
23463"use strict";
23464__webpack_require__.r(__webpack_exports__);
23465/* harmony import */ var _theme_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./theme-base */ "./src/themes/theme-base.js");
23466/* harmony import */ var _theme_dark__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-dark */ "./src/themes/theme-dark.js");
23467/* harmony import */ var _theme_default__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./theme-default */ "./src/themes/theme-default.js");
23468/* harmony import */ var _theme_forest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./theme-forest */ "./src/themes/theme-forest.js");
23469/* harmony import */ var _theme_neutral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./theme-neutral */ "./src/themes/theme-neutral.js");
23470
23471
23472
23473
23474
23475/* harmony default export */ __webpack_exports__["default"] = ({
23476 base: {
23477 getThemeVariables: _theme_base__WEBPACK_IMPORTED_MODULE_0__["getThemeVariables"]
23478 },
23479 dark: {
23480 getThemeVariables: _theme_dark__WEBPACK_IMPORTED_MODULE_1__["getThemeVariables"]
23481 },
23482 default: {
23483 getThemeVariables: _theme_default__WEBPACK_IMPORTED_MODULE_2__["getThemeVariables"]
23484 },
23485 forest: {
23486 getThemeVariables: _theme_forest__WEBPACK_IMPORTED_MODULE_3__["getThemeVariables"]
23487 },
23488 neutral: {
23489 getThemeVariables: _theme_neutral__WEBPACK_IMPORTED_MODULE_4__["getThemeVariables"]
23490 }
23491});
23492
23493/***/ }),
23494
23495/***/ "./src/themes/theme-base.js":
23496/*!**********************************!*\
23497 !*** ./src/themes/theme-base.js ***!
23498 \**********************************/
23499/*! exports provided: getThemeVariables */
23500/***/ (function(module, __webpack_exports__, __webpack_require__) {
23501
23502"use strict";
23503__webpack_require__.r(__webpack_exports__);
23504/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getThemeVariables", function() { return getThemeVariables; });
23505/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
23506/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
23507/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
23508function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
23509
23510function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23511
23512function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23513
23514function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23515
23516
23517
23518
23519var Theme =
23520/*#__PURE__*/
23521function () {
23522 function Theme() {
23523 _classCallCheck(this, Theme);
23524
23525 /** # Base variables */
23526
23527 /** * background - used to know what the background color is of the diagram. This is used for deducing colors for istance line color. Defaulr value is #f4f4f4. */
23528 this.background = '#f4f4f4';
23529 this.darkMode = false; // this.background = '#0c0c0c';
23530 // this.darkMode = true;
23531
23532 this.primaryColor = '#fff4dd'; // this.background = '#0c0c0c';
23533 // this.primaryColor = '#1f1f00';
23534
23535 this.noteBkgColor = '#fff5ad';
23536 this.noteTextColor = '#333'; // dark
23537 // this.primaryColor = '#034694';
23538 // this.primaryColor = '#f2ee7e';
23539 // this.primaryColor = '#9f33be';
23540 // this.primaryColor = '#f0fff0';
23541 // this.primaryColor = '#fa255e';
23542 // this.primaryColor = '#ECECFF';
23543 // this.secondaryColor = '#c39ea0';
23544 // this.tertiaryColor = '#f8e5e5';
23545 // this.secondaryColor = '#dfdfde';
23546 // this.tertiaryColor = '#CCCCFF';
23547
23548 this.fontFamily = '"trebuchet ms", verdana, arial';
23549 this.fontSize = '16px'; // this.updateColors();
23550 }
23551
23552 _createClass(Theme, [{
23553 key: "updateColors",
23554 value: function updateColors() {
23555 // The || is to make sure that if the variable has been defiend by a user override that value is to be used
23556
23557 /* Main */
23558 this.primaryTextColor = this.primaryTextColor || (this.darkMode ? '#ddd' : '#333'); // invert(this.primaryColor);
23559
23560 this.secondaryColor = this.secondaryColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23561 h: -120
23562 });
23563 this.tertiaryColor = this.tertiaryColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23564 h: 180,
23565 l: 5
23566 });
23567 this.primaryBorderColor = this.primaryBorderColor || Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.primaryColor, this.darkMode);
23568 this.secondaryBorderColor = this.secondaryBorderColor || Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.secondaryColor, this.darkMode);
23569 this.tertiaryBorderColor = this.tertiaryBorderColor || Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.tertiaryColor, this.darkMode);
23570 this.noteBorderColor = this.noteBorderColor || Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.noteBkgColor, this.darkMode);
23571 this.secondaryTextColor = this.secondaryTextColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.secondaryColor);
23572 this.tertiaryTextColor = this.tertiaryTextColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.tertiaryColor);
23573 this.lineColor = this.lineColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
23574 this.textColor = this.textColor || this.primaryTextColor;
23575 /* Flowchart variables */
23576
23577 this.nodeBkg = this.nodeBkg || this.primaryColor;
23578 this.mainBkg = this.mainBkg || this.primaryColor;
23579 this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
23580 this.clusterBkg = this.clusterBkg || this.tertiaryColor;
23581 this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
23582 this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
23583 this.titleColor = this.titleColor || this.tertiaryTextColor;
23584 this.edgeLabelBackground = this.edgeLabelBackground || this.darkMode ? Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.secondaryColor, 30) : this.secondaryColor;
23585 this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
23586 /* Sequence Diagram variables */
23587 // this.actorBorder = lighten(this.border1, 0.5);
23588
23589 this.actorBorder = this.actorBorder || this.primaryBorderColor;
23590 this.actorBkg = this.actorBkg || this.mainBkg;
23591 this.actorTextColor = this.actorTextColor || this.primaryTextColor;
23592 this.actorLineColor = this.actorLineColor || 'grey';
23593 this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
23594 this.signalColor = this.signalColor || this.textColor;
23595 this.signalTextColor = this.signalTextColor || this.textColor;
23596 this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
23597 this.labelTextColor = this.labelTextColor || this.actorTextColor;
23598 this.loopTextColor = this.loopTextColor || this.actorTextColor;
23599 this.activationBorderColor = this.activationBorderColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.secondaryColor, 10);
23600 this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
23601 this.sequenceNumberColor = this.sequenceNumberColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.lineColor);
23602 /* Gantt chart variables */
23603
23604 this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
23605 this.altSectionBkgColor = this.altSectionBkgColor || 'white';
23606 this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
23607 this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
23608 this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
23609 this.taskBkgColor = this.taskBkgColor || this.primaryColor;
23610 this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
23611 this.activeTaskBkgColor = this.activeTaskBkgColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.primaryColor, 23);
23612 this.gridColor = this.gridColor || 'lightgrey';
23613 this.doneTaskBkgColor = this.doneTaskBkgColor || 'lightgrey';
23614 this.doneTaskBorderColor = this.doneTaskBorderColor || 'grey';
23615 this.critBorderColor = this.critBorderColor || '#ff8888';
23616 this.critBkgColor = this.critBkgColor || 'red';
23617 this.todayLineColor = this.todayLineColor || 'red';
23618 this.taskTextColor = this.taskTextColor || this.textColor;
23619 this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
23620 this.taskTextLightColor = this.taskTextLightColor || this.textColor;
23621 this.taskTextColor = this.taskTextColor || this.primaryTextColor;
23622 this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
23623 this.taskTextClickableColor = this.taskTextClickableColor || '#003163';
23624 /* state colors */
23625
23626 this.labelColor = this.labelColor || this.primaryTextColor;
23627 this.altBackground = this.altBackground || this.tertiaryColor;
23628 this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
23629 this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
23630 /* class */
23631
23632 this.classText = this.classText || this.textColor;
23633 /* user-journey */
23634
23635 this.fillType0 = this.fillType0 || this.primaryColor;
23636 this.fillType1 = this.fillType1 || this.secondaryColor;
23637 this.fillType2 = this.fillType2 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23638 h: 64
23639 });
23640 this.fillType3 = this.fillType3 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
23641 h: 64
23642 });
23643 this.fillType4 = this.fillType4 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23644 h: -64
23645 });
23646 this.fillType5 = this.fillType5 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
23647 h: -64
23648 });
23649 this.fillType6 = this.fillType6 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23650 h: 128
23651 });
23652 this.fillType7 = this.fillType7 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
23653 h: 128
23654 });
23655 }
23656 }, {
23657 key: "calculate",
23658 value: function calculate(overrides) {
23659 var _this = this;
23660
23661 if (_typeof(overrides) !== 'object') {
23662 // Calculate colors form base colors
23663 this.updateColors();
23664 return;
23665 }
23666
23667 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
23668
23669 keys.forEach(function (k) {
23670 _this[k] = overrides[k];
23671 }); // Calculate colors form base colors
23672
23673 this.updateColors(); // Copy values from overrides again in case of an override of derived value
23674
23675 keys.forEach(function (k) {
23676 _this[k] = overrides[k];
23677 });
23678 }
23679 }]);
23680
23681 return Theme;
23682}();
23683
23684var getThemeVariables = function getThemeVariables(userOverrides) {
23685 var theme = new Theme();
23686 theme.calculate(userOverrides);
23687 return theme;
23688};
23689
23690/***/ }),
23691
23692/***/ "./src/themes/theme-dark.js":
23693/*!**********************************!*\
23694 !*** ./src/themes/theme-dark.js ***!
23695 \**********************************/
23696/*! exports provided: getThemeVariables */
23697/***/ (function(module, __webpack_exports__, __webpack_require__) {
23698
23699"use strict";
23700__webpack_require__.r(__webpack_exports__);
23701/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getThemeVariables", function() { return getThemeVariables; });
23702/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
23703/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
23704/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
23705function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
23706
23707function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23708
23709function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23710
23711function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23712
23713
23714
23715
23716var Theme =
23717/*#__PURE__*/
23718function () {
23719 function Theme() {
23720 _classCallCheck(this, Theme);
23721
23722 this.background = '#333';
23723 this.primaryColor = '#1f2020';
23724 this.secondaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.primaryColor, 16);
23725 this.tertiaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23726 h: -160
23727 });
23728 this.primaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.primaryColor, this.darkMode);
23729 this.secondaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.secondaryColor, this.darkMode);
23730 this.tertiaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.tertiaryColor, this.darkMode);
23731 this.primaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.primaryColor);
23732 this.secondaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.secondaryColor);
23733 this.tertiaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.tertiaryColor);
23734 this.lineColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
23735 this.textColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
23736 this.mainBkg = '#1f2020';
23737 this.secondBkg = 'calculated';
23738 this.mainContrastColor = 'lightgrey';
23739 this.darkTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])('#323D47'), 10);
23740 this.lineColor = 'calculated';
23741 this.border1 = '#81B1DB';
23742 this.border2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["rgba"])(255, 255, 255, 0.25);
23743 this.arrowheadColor = 'calculated';
23744 this.fontFamily = '"trebuchet ms", verdana, arial';
23745 this.fontSize = '16px';
23746 this.labelBackground = '#181818';
23747 this.textColor = '#ccc';
23748 /* Flowchart variables */
23749
23750 this.nodeBkg = 'calculated';
23751 this.nodeBorder = 'calculated';
23752 this.clusterBkg = 'calculated';
23753 this.clusterBorder = 'calculated';
23754 this.defaultLinkColor = 'calculated';
23755 this.titleColor = '#F9FFFE';
23756 this.edgeLabelBackground = 'calculated';
23757 /* Sequence Diagram variables */
23758
23759 this.actorBorder = 'calculated';
23760 this.actorBkg = 'calculated';
23761 this.actorTextColor = 'calculated';
23762 this.actorLineColor = 'calculated';
23763 this.signalColor = 'calculated';
23764 this.signalTextColor = 'calculated';
23765 this.labelBoxBkgColor = 'calculated';
23766 this.labelBoxBorderColor = 'calculated';
23767 this.labelTextColor = 'calculated';
23768 this.loopTextColor = 'calculated';
23769 this.noteBorderColor = 'calculated';
23770 this.noteBkgColor = '#fff5ad';
23771 this.noteTextColor = 'calculated';
23772 this.activationBorderColor = 'calculated';
23773 this.activationBkgColor = 'calculated';
23774 this.sequenceNumberColor = 'black';
23775 /* Gantt chart variables */
23776
23777 this.sectionBkgColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])('#EAE8D9', 30);
23778 this.altSectionBkgColor = 'calculated';
23779 this.sectionBkgColor2 = '#EAE8D9';
23780 this.taskBorderColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["rgba"])(255, 255, 255, 70);
23781 this.taskBkgColor = 'calculated';
23782 this.taskTextColor = 'calculated';
23783 this.taskTextLightColor = 'calculated';
23784 this.taskTextOutsideColor = 'calculated';
23785 this.taskTextClickableColor = '#003163';
23786 this.activeTaskBorderColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["rgba"])(255, 255, 255, 50);
23787 this.activeTaskBkgColor = '#81B1DB';
23788 this.gridColor = 'calculated';
23789 this.doneTaskBkgColor = 'calculated';
23790 this.doneTaskBorderColor = 'grey';
23791 this.critBorderColor = '#E83737';
23792 this.critBkgColor = '#E83737';
23793 this.taskTextDarkColor = 'calculated';
23794 this.todayLineColor = '#DB5757';
23795 /* state colors */
23796
23797 this.labelColor = 'calculated';
23798 this.errorBkgColor = '#a44141';
23799 this.errorTextColor = '#ddd';
23800 }
23801
23802 _createClass(Theme, [{
23803 key: "updateColors",
23804 value: function updateColors() {
23805 this.secondBkg = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.mainBkg, 16);
23806 this.lineColor = this.mainContrastColor;
23807 this.arrowheadColor = this.mainContrastColor;
23808 /* Flowchart variables */
23809
23810 this.nodeBkg = this.mainBkg;
23811 this.nodeBorder = this.border1;
23812 this.clusterBkg = this.secondBkg;
23813 this.clusterBorder = this.border2;
23814 this.defaultLinkColor = this.lineColor;
23815 this.edgeLabelBackground = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.labelBackground, 25);
23816 /* Sequence Diagram variables */
23817
23818 this.actorBorder = this.border1;
23819 this.actorBkg = this.mainBkg;
23820 this.actorTextColor = this.mainContrastColor;
23821 this.actorLineColor = this.mainContrastColor;
23822 this.signalColor = this.mainContrastColor;
23823 this.signalTextColor = this.mainContrastColor;
23824 this.labelBoxBkgColor = this.actorBkg;
23825 this.labelBoxBorderColor = this.actorBorder;
23826 this.labelTextColor = this.mainContrastColor;
23827 this.loopTextColor = this.mainContrastColor;
23828 this.noteBorderColor = this.border2;
23829 this.noteTextColor = this.mainBkg;
23830 this.activationBorderColor = this.border1;
23831 this.activationBkgColor = this.secondBkg;
23832 /* Gantt chart variables */
23833
23834 this.altSectionBkgColor = this.background;
23835 this.taskBkgColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.mainBkg, 23);
23836 this.taskTextColor = this.darkTextColor;
23837 this.taskTextLightColor = this.mainContrastColor;
23838 this.taskTextOutsideColor = this.taskTextLightColor;
23839 this.gridColor = this.mainContrastColor;
23840 this.doneTaskBkgColor = this.mainContrastColor;
23841 this.taskTextDarkColor = this.darkTextColor;
23842 /* state colors */
23843
23844 this.labelColor = this.textColor;
23845 this.altBackground = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.background, 20);
23846 this.fillType0 = this.primaryColor;
23847 this.fillType1 = this.secondaryColor;
23848 this.fillType2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23849 h: 64
23850 });
23851 this.fillType3 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
23852 h: 64
23853 });
23854 this.fillType4 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23855 h: -64
23856 });
23857 this.fillType5 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
23858 h: -64
23859 });
23860 this.fillType6 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23861 h: 128
23862 });
23863 this.fillType7 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
23864 h: 128
23865 });
23866 /* class */
23867
23868 this.classText = this.primaryTextColor;
23869 }
23870 }, {
23871 key: "calculate",
23872 value: function calculate(overrides) {
23873 var _this = this;
23874
23875 if (_typeof(overrides) !== 'object') {
23876 // Calculate colors form base colors
23877 this.updateColors();
23878 return;
23879 }
23880
23881 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
23882
23883 keys.forEach(function (k) {
23884 _this[k] = overrides[k];
23885 }); // Calculate colors form base colors
23886
23887 this.updateColors(); // Copy values from overrides again in case of an override of derived value
23888
23889 keys.forEach(function (k) {
23890 _this[k] = overrides[k];
23891 });
23892 }
23893 }]);
23894
23895 return Theme;
23896}();
23897
23898var getThemeVariables = function getThemeVariables(userOverrides) {
23899 var theme = new Theme();
23900 theme.calculate(userOverrides);
23901 console.info('Theme(dark)', {
23902 userOverrides: userOverrides,
23903 theme: theme
23904 });
23905 return theme;
23906};
23907
23908/***/ }),
23909
23910/***/ "./src/themes/theme-default.js":
23911/*!*************************************!*\
23912 !*** ./src/themes/theme-default.js ***!
23913 \*************************************/
23914/*! exports provided: getThemeVariables */
23915/***/ (function(module, __webpack_exports__, __webpack_require__) {
23916
23917"use strict";
23918__webpack_require__.r(__webpack_exports__);
23919/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getThemeVariables", function() { return getThemeVariables; });
23920/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
23921/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
23922/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
23923function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
23924
23925function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23926
23927function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23928
23929function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23930
23931
23932
23933
23934var Theme =
23935/*#__PURE__*/
23936function () {
23937 function Theme() {
23938 _classCallCheck(this, Theme);
23939
23940 /* Base variables */
23941 this.background = '#f4f4f4';
23942 this.primaryColor = '#ECECFF';
23943 this.secondaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23944 h: 120
23945 });
23946 this.secondaryColor = '#ffffde';
23947 this.tertiaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23948 h: -160
23949 });
23950 this.primaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.primaryColor, this.darkMode);
23951 this.secondaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.secondaryColor, this.darkMode);
23952 this.tertiaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);
23953
23954 this.primaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.primaryColor);
23955 this.secondaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.secondaryColor);
23956 this.tertiaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.tertiaryColor);
23957 this.lineColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
23958 this.textColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
23959 this.background = 'white';
23960 this.mainBkg = '#ECECFF';
23961 this.secondBkg = '#ffffde';
23962 this.lineColor = '#333333';
23963 this.border1 = '#9370DB';
23964 this.border2 = '#aaaa33';
23965 this.arrowheadColor = '#333333';
23966 this.fontFamily = '"trebuchet ms", verdana, arial';
23967 this.fontSize = '16px';
23968 this.labelBackground = '#e8e8e8';
23969 this.textColor = '#333';
23970 /* Flowchart variables */
23971
23972 this.nodeBkg = 'calculated';
23973 this.nodeBorder = 'calculated';
23974 this.clusterBkg = 'calculated';
23975 this.clusterBorder = 'calculated';
23976 this.defaultLinkColor = 'calculated';
23977 this.titleColor = 'calculated';
23978 this.edgeLabelBackground = 'calculated';
23979 /* Sequence Diagram variables */
23980
23981 this.actorBorder = 'calculated';
23982 this.actorBkg = 'calculated';
23983 this.actorTextColor = 'black';
23984 this.actorLineColor = 'grey';
23985 this.signalColor = 'calculated';
23986 this.signalTextColor = 'calculated';
23987 this.labelBoxBkgColor = 'calculated';
23988 this.labelBoxBorderColor = 'calculated';
23989 this.labelTextColor = 'calculated';
23990 this.loopTextColor = 'calculated';
23991 this.noteBorderColor = 'calculated';
23992 this.noteBkgColor = '#fff5ad';
23993 this.noteTextColor = 'calculated';
23994 this.activationBorderColor = '#666';
23995 this.activationBkgColor = '#f4f4f4';
23996 this.sequenceNumberColor = 'white';
23997 /* Gantt chart variables */
23998
23999 this.sectionBkgColor = 'calculated';
24000 this.altSectionBkgColor = 'calculated';
24001 this.sectionBkgColor2 = 'calculated';
24002 this.taskBorderColor = 'calculated';
24003 this.taskBkgColor = 'calculated';
24004 this.taskTextLightColor = 'calculated';
24005 this.taskTextColor = this.taskTextLightColor;
24006 this.taskTextDarkColor = 'calculated';
24007 this.taskTextOutsideColor = this.taskTextDarkColor;
24008 this.taskTextClickableColor = 'calculated';
24009 this.activeTaskBorderColor = 'calculated';
24010 this.activeTaskBkgColor = 'calculated';
24011 this.gridColor = 'calculated';
24012 this.doneTaskBkgColor = 'calculated';
24013 this.doneTaskBorderColor = 'calculated';
24014 this.critBorderColor = 'calculated';
24015 this.critBkgColor = 'calculated';
24016 this.todayLineColor = 'calculated';
24017 this.sectionBkgColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["rgba"])(102, 102, 255, 0.49);
24018 this.altSectionBkgColor = 'white';
24019 this.sectionBkgColor2 = '#fff400';
24020 this.taskBorderColor = '#534fbc';
24021 this.taskBkgColor = '#8a90dd';
24022 this.taskTextLightColor = 'white';
24023 this.taskTextColor = 'calculated';
24024 this.taskTextDarkColor = 'black';
24025 this.taskTextOutsideColor = 'calculated';
24026 this.taskTextClickableColor = '#003163';
24027 this.activeTaskBorderColor = '#534fbc';
24028 this.activeTaskBkgColor = '#bfc7ff';
24029 this.gridColor = 'lightgrey';
24030 this.doneTaskBkgColor = 'lightgrey';
24031 this.doneTaskBorderColor = 'grey';
24032 this.critBorderColor = '#ff8888';
24033 this.critBkgColor = 'red';
24034 this.todayLineColor = 'red';
24035 /* state colors */
24036
24037 this.labelColor = 'black';
24038 this.errorBkgColor = '#552222';
24039 this.errorTextColor = '#552222';
24040 this.updateColors();
24041 }
24042
24043 _createClass(Theme, [{
24044 key: "updateColors",
24045 value: function updateColors() {
24046 /* Flowchart variables */
24047 this.nodeBkg = this.mainBkg;
24048 this.nodeBorder = this.border1; // border 1
24049
24050 this.clusterBkg = this.secondBkg;
24051 this.clusterBorder = this.border2;
24052 this.defaultLinkColor = this.lineColor;
24053 this.titleColor = this.textColor;
24054 this.edgeLabelBackground = this.labelBackground;
24055 /* Sequence Diagram variables */
24056 // this.actorBorder = lighten(this.border1, 0.5);
24057
24058 this.actorBorder = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.border1, 23);
24059 this.actorBkg = this.mainBkg;
24060 this.labelBoxBkgColor = this.actorBkg;
24061 this.signalColor = this.textColor;
24062 this.signalTextColor = this.textColor;
24063 this.labelBoxBorderColor = this.actorBorder;
24064 this.labelTextColor = this.actorTextColor;
24065 this.loopTextColor = this.actorTextColor;
24066 this.noteBorderColor = this.border2;
24067 this.noteTextColor = this.actorTextColor;
24068 /* Gantt chart variables */
24069
24070 this.taskTextColor = this.taskTextLightColor;
24071 this.taskTextOutsideColor = this.taskTextDarkColor;
24072 /* state colors */
24073
24074 /* class */
24075
24076 this.classText = this.primaryTextColor;
24077 /* journey */
24078
24079 this.fillType0 = this.primaryColor;
24080 this.fillType1 = this.secondaryColor;
24081 this.fillType2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24082 h: 64
24083 });
24084 this.fillType3 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24085 h: 64
24086 });
24087 this.fillType4 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24088 h: -64
24089 });
24090 this.fillType5 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24091 h: -64
24092 });
24093 this.fillType6 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24094 h: 128
24095 });
24096 this.fillType7 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24097 h: 128
24098 });
24099 }
24100 }, {
24101 key: "calculate",
24102 value: function calculate(overrides) {
24103 var _this = this;
24104
24105 if (_typeof(overrides) !== 'object') {
24106 // Calculate colors form base colors
24107 this.updateColors();
24108 return;
24109 }
24110
24111 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
24112
24113 keys.forEach(function (k) {
24114 _this[k] = overrides[k];
24115 }); // Calculate colors form base colors
24116
24117 this.updateColors(); // Copy values from overrides again in case of an override of derived value
24118
24119 keys.forEach(function (k) {
24120 _this[k] = overrides[k];
24121 });
24122 }
24123 }]);
24124
24125 return Theme;
24126}();
24127
24128var getThemeVariables = function getThemeVariables(userOverrides) {
24129 var theme = new Theme();
24130 theme.calculate(userOverrides); // console.info('Theme(default)', { userOverrides, theme });
24131
24132 return theme;
24133};
24134
24135/***/ }),
24136
24137/***/ "./src/themes/theme-forest.js":
24138/*!************************************!*\
24139 !*** ./src/themes/theme-forest.js ***!
24140 \************************************/
24141/*! exports provided: getThemeVariables */
24142/***/ (function(module, __webpack_exports__, __webpack_require__) {
24143
24144"use strict";
24145__webpack_require__.r(__webpack_exports__);
24146/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getThemeVariables", function() { return getThemeVariables; });
24147/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
24148/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
24149/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
24150function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
24151
24152function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24153
24154function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
24155
24156function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
24157
24158
24159
24160
24161var Theme =
24162/*#__PURE__*/
24163function () {
24164 function Theme() {
24165 _classCallCheck(this, Theme);
24166
24167 /* Base vales */
24168 this.background = '#f4f4f4';
24169 this.primaryColor = '#cde498';
24170 this.secondaryColor = '#cdffb2';
24171 this.background = 'white';
24172 this.mainBkg = '#cde498';
24173 this.secondBkg = '#cdffb2';
24174 this.lineColor = 'green';
24175 this.border1 = '#13540c';
24176 this.border2 = '#6eaa49';
24177 this.arrowheadColor = 'green';
24178 this.fontFamily = '"trebuchet ms", verdana, arial';
24179 this.fontSize = '16px';
24180 this.tertiaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])('#cde498', 10);
24181 this.primaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.primaryColor, this.darkMode);
24182 this.secondaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.secondaryColor, this.darkMode);
24183 this.tertiaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.tertiaryColor, this.darkMode);
24184 this.primaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.primaryColor);
24185 this.secondaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.secondaryColor);
24186 this.tertiaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.primaryColor);
24187 this.lineColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
24188 this.textColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
24189 /* Flowchart variables */
24190
24191 this.nodeBkg = 'calculated';
24192 this.nodeBorder = 'calculated';
24193 this.clusterBkg = 'calculated';
24194 this.clusterBorder = 'calculated';
24195 this.defaultLinkColor = 'calculated';
24196 this.titleColor = '#333';
24197 this.edgeLabelBackground = '#e8e8e8';
24198 /* Sequence Diagram variables */
24199
24200 this.actorBorder = 'calculated';
24201 this.actorBkg = 'calculated';
24202 this.actorTextColor = 'black';
24203 this.actorLineColor = 'grey';
24204 this.signalColor = '#333';
24205 this.signalTextColor = '#333';
24206 this.labelBoxBkgColor = 'calculated';
24207 this.labelBoxBorderColor = '#326932';
24208 this.labelTextColor = 'calculated';
24209 this.loopTextColor = 'calculated';
24210 this.noteBorderColor = 'calculated';
24211 this.noteBkgColor = '#fff5ad';
24212 this.noteTextColor = 'calculated';
24213 this.activationBorderColor = '#666';
24214 this.activationBkgColor = '#f4f4f4';
24215 this.sequenceNumberColor = 'white';
24216 /* Gantt chart variables */
24217
24218 this.sectionBkgColor = '#6eaa49';
24219 this.altSectionBkgColor = 'white';
24220 this.sectionBkgColor2 = '#6eaa49';
24221 this.taskBorderColor = 'calculated';
24222 this.taskBkgColor = '#487e3a';
24223 this.taskTextLightColor = 'white';
24224 this.taskTextColor = 'calculated';
24225 this.taskTextDarkColor = 'black';
24226 this.taskTextOutsideColor = 'calculated';
24227 this.taskTextClickableColor = '#003163';
24228 this.activeTaskBorderColor = 'calculated';
24229 this.activeTaskBkgColor = 'calculated';
24230 this.gridColor = 'lightgrey';
24231 this.doneTaskBkgColor = 'lightgrey';
24232 this.doneTaskBorderColor = 'grey';
24233 this.critBorderColor = '#ff8888';
24234 this.critBkgColor = 'red';
24235 this.todayLineColor = 'red';
24236 /* state colors */
24237
24238 this.labelColor = 'black';
24239 this.errorBkgColor = '#552222';
24240 this.errorTextColor = '#552222';
24241 }
24242
24243 _createClass(Theme, [{
24244 key: "updateColors",
24245 value: function updateColors() {
24246 /* Flowchart variables */
24247 this.nodeBkg = this.mainBkg;
24248 this.nodeBorder = this.border1;
24249 this.clusterBkg = this.secondBkg;
24250 this.clusterBorder = this.border2;
24251 this.defaultLinkColor = this.lineColor;
24252 /* Sequence Diagram variables */
24253
24254 this.actorBorder = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.mainBkg, 20);
24255 this.actorBkg = this.mainBkg;
24256 this.labelBoxBkgColor = this.actorBkg;
24257 this.labelTextColor = this.actorTextColor;
24258 this.loopTextColor = this.actorTextColor;
24259 this.noteBorderColor = this.border2;
24260 this.noteTextColor = this.actorTextColor;
24261 /* Gantt chart variables */
24262
24263 this.taskBorderColor = this.border1;
24264 this.taskTextColor = this.taskTextLightColor;
24265 this.taskTextOutsideColor = this.taskTextDarkColor;
24266 this.activeTaskBorderColor = this.taskBorderColor;
24267 this.activeTaskBkgColor = this.mainBkg;
24268 /* state colors */
24269
24270 /* class */
24271
24272 this.classText = this.primaryTextColor;
24273 /* journey */
24274
24275 this.fillType0 = this.primaryColor;
24276 this.fillType1 = this.secondaryColor;
24277 this.fillType2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24278 h: 64
24279 });
24280 this.fillType3 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24281 h: 64
24282 });
24283 this.fillType4 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24284 h: -64
24285 });
24286 this.fillType5 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24287 h: -64
24288 });
24289 this.fillType6 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24290 h: 128
24291 });
24292 this.fillType7 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24293 h: 128
24294 });
24295 }
24296 }, {
24297 key: "calculate",
24298 value: function calculate(overrides) {
24299 var _this = this;
24300
24301 if (_typeof(overrides) !== 'object') {
24302 // Calculate colors form base colors
24303 this.updateColors();
24304 return;
24305 }
24306
24307 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
24308
24309 keys.forEach(function (k) {
24310 _this[k] = overrides[k];
24311 }); // Calculate colors form base colors
24312
24313 this.updateColors(); // Copy values from overrides again in case of an override of derived value
24314
24315 keys.forEach(function (k) {
24316 _this[k] = overrides[k];
24317 });
24318 }
24319 }]);
24320
24321 return Theme;
24322}();
24323
24324var getThemeVariables = function getThemeVariables(userOverrides) {
24325 var theme = new Theme();
24326 theme.calculate(userOverrides);
24327 console.info('Theme(forest)', {
24328 userOverrides: userOverrides,
24329 theme: theme
24330 });
24331 return theme;
24332};
24333
24334/***/ }),
24335
24336/***/ "./src/themes/theme-helpers.js":
24337/*!*************************************!*\
24338 !*** ./src/themes/theme-helpers.js ***!
24339 \*************************************/
24340/*! exports provided: mkBorder */
24341/***/ (function(module, __webpack_exports__, __webpack_require__) {
24342
24343"use strict";
24344__webpack_require__.r(__webpack_exports__);
24345/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mkBorder", function() { return mkBorder; });
24346/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
24347/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
24348
24349var mkBorder = function mkBorder(col, darkMode) {
24350 return darkMode ? Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(col, {
24351 s: -40,
24352 l: 10
24353 }) : Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(col, {
24354 s: -40,
24355 l: -10
24356 });
24357};
24358
24359/***/ }),
24360
24361/***/ "./src/themes/theme-neutral.js":
24362/*!*************************************!*\
24363 !*** ./src/themes/theme-neutral.js ***!
24364 \*************************************/
24365/*! exports provided: getThemeVariables */
24366/***/ (function(module, __webpack_exports__, __webpack_require__) {
24367
24368"use strict";
24369__webpack_require__.r(__webpack_exports__);
24370/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getThemeVariables", function() { return getThemeVariables; });
24371/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
24372/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
24373/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
24374function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
24375
24376function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24377
24378function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
24379
24380function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
24381
24382
24383 // const Color = require ( 'khroma/dist/color' ).default
24384// Color.format.hex.stringify(Color.parse('hsl(210, 66.6666666667%, 95%)')); // => "#EAF2FB"
24385
24386var Theme =
24387/*#__PURE__*/
24388function () {
24389 function Theme() {
24390 _classCallCheck(this, Theme);
24391
24392 this.primaryColor = '#eee';
24393 this.contrast = '#26a';
24394 this.secondaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.contrast, 55);
24395 this.background = '#ffffff'; // this.secondaryColor = adjust(this.primaryColor, { h: 120 });
24396
24397 this.tertiaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24398 h: -160
24399 });
24400 console.warn('primary color', this.primaryColor, 'tertiary - color', this.tertiaryColor);
24401 this.primaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.primaryColor, this.darkMode);
24402 this.secondaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.secondaryColor, this.darkMode);
24403 this.tertiaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);
24404
24405 this.primaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.primaryColor);
24406 this.secondaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.secondaryColor);
24407 this.tertiaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.tertiaryColor);
24408 this.lineColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
24409 this.textColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
24410 this.altBackground = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.contrast, 55);
24411 this.mainBkg = '#eee';
24412 this.secondBkg = 'calculated';
24413 this.lineColor = '#666';
24414 this.border1 = '#999';
24415 this.border2 = 'calculated';
24416 this.note = '#ffa';
24417 this.text = '#333';
24418 this.critical = '#d42';
24419 this.done = '#bbb';
24420 this.arrowheadColor = '#333333';
24421 this.fontFamily = '"trebuchet ms", verdana, arial';
24422 this.fontSize = '16px';
24423 /* Flowchart variables */
24424
24425 this.nodeBkg = 'calculated';
24426 this.nodeBorder = 'calculated';
24427 this.clusterBkg = 'calculated';
24428 this.clusterBorder = 'calculated';
24429 this.defaultLinkColor = 'calculated';
24430 this.titleColor = 'calculated';
24431 this.edgeLabelBackground = 'white';
24432 /* Sequence Diagram variables */
24433
24434 this.actorBorder = 'calculated';
24435 this.actorBkg = 'calculated';
24436 this.actorTextColor = 'calculated';
24437 this.actorLineColor = 'calculated';
24438 this.signalColor = 'calculated';
24439 this.signalTextColor = 'calculated';
24440 this.labelBoxBkgColor = 'calculated';
24441 this.labelBoxBorderColor = 'calculated';
24442 this.labelTextColor = 'calculated';
24443 this.loopTextColor = 'calculated';
24444 this.noteBorderColor = 'calculated';
24445 this.noteBkgColor = 'calculated';
24446 this.noteTextColor = 'calculated';
24447 this.activationBorderColor = '#666';
24448 this.activationBkgColor = '#f4f4f4';
24449 this.sequenceNumberColor = 'white';
24450 /* Gantt chart variables */
24451
24452 this.sectionBkgColor = 'calculated';
24453 this.altSectionBkgColor = 'white';
24454 this.sectionBkgColor2 = 'calculated';
24455 this.taskBorderColor = 'calculated';
24456 this.taskBkgColor = 'calculated';
24457 this.taskTextLightColor = 'white';
24458 this.taskTextColor = 'calculated';
24459 this.taskTextDarkColor = 'calculated';
24460 this.taskTextOutsideColor = 'calculated';
24461 this.taskTextClickableColor = '#003163';
24462 this.activeTaskBorderColor = 'calculated';
24463 this.activeTaskBkgColor = 'calculated';
24464 this.gridColor = 'calculated';
24465 this.doneTaskBkgColor = 'calculated';
24466 this.doneTaskBorderColor = 'calculated';
24467 this.critBkgColor = 'calculated';
24468 this.critBorderColor = 'calculated';
24469 this.todayLineColor = 'calculated';
24470 /* state colors */
24471
24472 this.labelColor = 'black';
24473 this.errorBkgColor = '#552222';
24474 this.errorTextColor = '#552222';
24475 }
24476
24477 _createClass(Theme, [{
24478 key: "updateColors",
24479 value: function updateColors() {
24480 this.secondBkg = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.contrast, 55);
24481 this.border2 = this.contrast;
24482 /* Flowchart variables */
24483
24484 this.nodeBkg = this.mainBkg;
24485 this.nodeBorder = this.border1;
24486 this.clusterBkg = this.secondBkg;
24487 this.clusterBorder = this.border2;
24488 this.defaultLinkColor = this.lineColor;
24489 this.titleColor = this.text;
24490 /* Sequence Diagram variables */
24491
24492 this.actorBorder = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.border1, 23);
24493 this.actorBkg = this.mainBkg;
24494 this.actorTextColor = this.text;
24495 this.actorLineColor = this.lineColor;
24496 this.signalColor = this.text;
24497 this.signalTextColor = this.text;
24498 this.labelBoxBkgColor = this.actorBkg;
24499 this.labelBoxBorderColor = this.actorBorder;
24500 this.labelTextColor = this.text;
24501 this.loopTextColor = this.text;
24502 this.noteBorderColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.note, 60);
24503 this.noteBkgColor = this.note;
24504 this.noteTextColor = this.actorTextColor;
24505 /* Gantt chart variables */
24506
24507 this.sectionBkgColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.contrast, 30);
24508 this.sectionBkgColor2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.contrast, 30);
24509 this.taskBorderColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.contrast, 10);
24510 this.taskBkgColor = this.contrast;
24511 this.taskTextColor = this.taskTextLightColor;
24512 this.taskTextDarkColor = this.text;
24513 this.taskTextOutsideColor = this.taskTextDarkColor;
24514 this.activeTaskBorderColor = this.taskBorderColor;
24515 this.activeTaskBkgColor = this.mainBkg;
24516 this.gridColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.border1, 30);
24517 this.doneTaskBkgColor = this.done;
24518 this.doneTaskBorderColor = this.lineColor;
24519 this.critBkgColor = this.critical;
24520 this.critBorderColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.critBkgColor, 10);
24521 this.todayLineColor = this.critBkgColor;
24522 /* state colors */
24523
24524 /* class */
24525
24526 this.classText = this.primaryTextColor;
24527 /* journey */
24528
24529 this.fillType0 = this.primaryColor;
24530 this.fillType1 = this.secondaryColor;
24531 this.fillType2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24532 h: 64
24533 });
24534 this.fillType3 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24535 h: 64
24536 });
24537 this.fillType4 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24538 h: -64
24539 });
24540 this.fillType5 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24541 h: -64
24542 });
24543 this.fillType6 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24544 h: 128
24545 });
24546 this.fillType7 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24547 h: 128
24548 });
24549 }
24550 }, {
24551 key: "calculate",
24552 value: function calculate(overrides) {
24553 var _this = this;
24554
24555 if (_typeof(overrides) !== 'object') {
24556 // Calculate colors form base colors
24557 this.updateColors();
24558 return;
24559 }
24560
24561 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
24562
24563 keys.forEach(function (k) {
24564 _this[k] = overrides[k];
24565 }); // Calculate colors form base colors
24566
24567 this.updateColors(); // Copy values from overrides again in case of an override of derived value
24568
24569 keys.forEach(function (k) {
24570 _this[k] = overrides[k];
24571 });
24572 }
24573 }]);
24574
24575 return Theme;
24576}();
24577
24578var getThemeVariables = function getThemeVariables(userOverrides) {
24579 var theme = new Theme();
24580 theme.calculate(userOverrides);
24581 console.info('Theme(neutral)', {
24582 userOverrides: userOverrides,
24583 theme: theme
24584 });
24585 return theme;
24586};
24587
24588/***/ }),
24589
24590/***/ "./src/utils.js":
24591/*!**********************!*\
24592 !*** ./src/utils.js ***!
24593 \**********************/
24594/*! exports provided: detectInit, detectDirective, detectType, isSubstringInArray, interpolateToCurve, formatUrl, runFunc, getStylesFromArray, generateId, random, assignWithDepth, getTextObj, drawSimpleText, wrapLabel, calculateTextHeight, calculateTextWidth, calculateTextDimensions, default */
24595/***/ (function(module, __webpack_exports__, __webpack_require__) {
24596
24597"use strict";
24598__webpack_require__.r(__webpack_exports__);
24599/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectInit", function() { return detectInit; });
24600/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectDirective", function() { return detectDirective; });
24601/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectType", function() { return detectType; });
24602/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSubstringInArray", function() { return isSubstringInArray; });
24603/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateToCurve", function() { return interpolateToCurve; });
24604/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatUrl", function() { return formatUrl; });
24605/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runFunc", function() { return runFunc; });
24606/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStylesFromArray", function() { return getStylesFromArray; });
24607/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generateId", function() { return generateId; });
24608/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return random; });
24609/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assignWithDepth", function() { return assignWithDepth; });
24610/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextObj", function() { return getTextObj; });
24611/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawSimpleText", function() { return drawSimpleText; });
24612/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapLabel", function() { return wrapLabel; });
24613/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calculateTextHeight", function() { return calculateTextHeight; });
24614/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calculateTextWidth", function() { return calculateTextWidth; });
24615/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calculateTextDimensions", function() { return calculateTextDimensions; });
24616/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
24617/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
24618/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
24619/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
24620/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_2__);
24621/* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagrams/common/common */ "./src/diagrams/common/common.js");
24622var _this = undefined;
24623
24624function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
24625
24626function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
24627
24628function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
24629
24630function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
24631
24632function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
24633
24634
24635
24636
24637 // import cryptoRandomString from 'crypto-random-string';
24638// Effectively an enum of the supported curve types, accessible by name
24639
24640var d3CurveTypes = {
24641 curveBasis: d3__WEBPACK_IMPORTED_MODULE_0__["curveBasis"],
24642 curveBasisClosed: d3__WEBPACK_IMPORTED_MODULE_0__["curveBasisClosed"],
24643 curveBasisOpen: d3__WEBPACK_IMPORTED_MODULE_0__["curveBasisOpen"],
24644 curveLinear: d3__WEBPACK_IMPORTED_MODULE_0__["curveLinear"],
24645 curveLinearClosed: d3__WEBPACK_IMPORTED_MODULE_0__["curveLinearClosed"],
24646 curveMonotoneX: d3__WEBPACK_IMPORTED_MODULE_0__["curveMonotoneX"],
24647 curveMonotoneY: d3__WEBPACK_IMPORTED_MODULE_0__["curveMonotoneY"],
24648 curveNatural: d3__WEBPACK_IMPORTED_MODULE_0__["curveNatural"],
24649 curveStep: d3__WEBPACK_IMPORTED_MODULE_0__["curveStep"],
24650 curveStepAfter: d3__WEBPACK_IMPORTED_MODULE_0__["curveStepAfter"],
24651 curveStepBefore: d3__WEBPACK_IMPORTED_MODULE_0__["curveStepBefore"]
24652};
24653var directive = /[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
24654var directiveWithoutOpen = /\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
24655var anyComment = /\s*%%.*\n/gm;
24656/**
24657 * @function detectInit
24658 * Detects the init config object from the text
24659 * ```mermaid
24660 * %%{init: {"theme": "debug", "logLevel": 1 }}%%
24661 * graph LR
24662 * a-->b
24663 * b-->c
24664 * c-->d
24665 * d-->e
24666 * e-->f
24667 * f-->g
24668 * g-->h
24669 * ```
24670 * or
24671 * ```mermaid
24672 * %%{initialize: {"theme": "dark", logLevel: "debug" }}%%
24673 * graph LR
24674 * a-->b
24675 * b-->c
24676 * c-->d
24677 * d-->e
24678 * e-->f
24679 * f-->g
24680 * g-->h
24681 * ```
24682 *
24683 * @param {string} text The text defining the graph
24684 * @returns {object} the json object representing the init passed to mermaid.initialize()
24685 */
24686
24687var detectInit = function detectInit(text) {
24688 var inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/);
24689 var results = {};
24690
24691 if (Array.isArray(inits)) {
24692 var args = inits.map(function (init) {
24693 return init.args;
24694 });
24695 results = assignWithDepth(results, _toConsumableArray(args));
24696 } else {
24697 results = inits.args;
24698 }
24699
24700 if (results) {
24701 var type = detectType(text);
24702 ['config'].forEach(function (prop) {
24703 if (typeof results[prop] !== 'undefined') {
24704 if (type === 'flowchart-v2') {
24705 type = 'flowchart';
24706 }
24707
24708 results[type] = results[prop];
24709 delete results[prop];
24710 }
24711 });
24712 }
24713
24714 return results;
24715};
24716/**
24717 * @function detectDirective
24718 * Detects the directive from the text. Text can be single line or multiline. If type is null or omitted
24719 * the first directive encountered in text will be returned
24720 * ```mermaid
24721 * graph LR
24722 * %%{somedirective}%%
24723 * a-->b
24724 * b-->c
24725 * c-->d
24726 * d-->e
24727 * e-->f
24728 * f-->g
24729 * g-->h
24730 * ```
24731 *
24732 * @param {string} text The text defining the graph
24733 * @param {string|RegExp} type The directive to return (default: null)
24734 * @returns {object | Array} An object or Array representing the directive(s): { type: string, args: object|null } matched by the input type
24735 * if a single directive was found, that directive object will be returned.
24736 */
24737
24738var detectDirective = function detectDirective(text) {
24739 var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
24740
24741 try {
24742 var commentWithoutDirectives = new RegExp("[%]{2}(?![{]".concat(directiveWithoutOpen.source, ")(?=[}][%]{2}).*\n"), 'ig');
24743 text = text.trim().replace(commentWithoutDirectives, '').replace(/'/gm, '"');
24744 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].debug("Detecting diagram directive".concat(type !== null ? ' type:' + type : '', " based on the text:").concat(text));
24745 var match,
24746 result = [];
24747
24748 while ((match = directive.exec(text)) !== null) {
24749 // This is necessary to avoid infinite loops with zero-width matches
24750 if (match.index === directive.lastIndex) {
24751 directive.lastIndex++;
24752 }
24753
24754 if (match && !type || type && match[1] && match[1].match(type) || type && match[2] && match[2].match(type)) {
24755 var _type = match[1] ? match[1] : match[2];
24756
24757 var args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null;
24758 result.push({
24759 type: _type,
24760 args: args
24761 });
24762 }
24763 }
24764
24765 if (result.length === 0) {
24766 result.push({
24767 type: text,
24768 args: null
24769 });
24770 }
24771
24772 return result.length === 1 ? result[0] : result;
24773 } catch (error) {
24774 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].error("ERROR: ".concat(error.message, " - Unable to parse directive").concat(type !== null ? ' type:' + type : '', " based on the text:").concat(text));
24775 return {
24776 type: null,
24777 args: null
24778 };
24779 }
24780};
24781/**
24782 * @function detectType
24783 * Detects the type of the graph text. Takes into consideration the possible existence of an %%init
24784 * directive
24785 * ```mermaid
24786 * %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%%
24787 * graph LR
24788 * a-->b
24789 * b-->c
24790 * c-->d
24791 * d-->e
24792 * e-->f
24793 * f-->g
24794 * g-->h
24795 * ```
24796 *
24797 * @param {string} text The text defining the graph
24798 * @returns {string} A graph definition key
24799 */
24800
24801var detectType = function detectType(text) {
24802 text = text.replace(directive, '').replace(anyComment, '\n');
24803 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].debug('Detecting diagram type based on the text ' + text);
24804
24805 if (text.match(/^\s*sequenceDiagram/)) {
24806 return 'sequence';
24807 }
24808
24809 if (text.match(/^\s*gantt/)) {
24810 return 'gantt';
24811 }
24812
24813 if (text.match(/^\s*classDiagram-v2/)) {
24814 return 'classDiagram';
24815 }
24816
24817 if (text.match(/^\s*classDiagram/)) {
24818 return 'class';
24819 }
24820
24821 if (text.match(/^\s*stateDiagram-v2/)) {
24822 return 'stateDiagram';
24823 }
24824
24825 if (text.match(/^\s*stateDiagram/)) {
24826 return 'state';
24827 }
24828
24829 if (text.match(/^\s*gitGraph/)) {
24830 return 'git';
24831 }
24832
24833 if (text.match(/^\s*flowchart/)) {
24834 return 'flowchart-v2';
24835 }
24836
24837 if (text.match(/^\s*info/)) {
24838 return 'info';
24839 }
24840
24841 if (text.match(/^\s*pie/)) {
24842 return 'pie';
24843 }
24844
24845 if (text.match(/^\s*erDiagram/)) {
24846 return 'er';
24847 }
24848
24849 if (text.match(/^\s*journey/)) {
24850 return 'journey';
24851 }
24852
24853 return 'flowchart';
24854};
24855
24856var memoize = function memoize(fn, resolver) {
24857 var cache = {};
24858 return function () {
24859 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24860 args[_key] = arguments[_key];
24861 }
24862
24863 var n = resolver ? resolver.apply(_this, args) : args[0];
24864
24865 if (n in cache) {
24866 return cache[n];
24867 } else {
24868 var result = fn.apply(void 0, args);
24869 cache[n] = result;
24870 return result;
24871 }
24872 };
24873};
24874/**
24875 * @function isSubstringInArray
24876 * Detects whether a substring in present in a given array
24877 * @param {string} str The substring to detect
24878 * @param {array} arr The array to search
24879 * @returns {number} the array index containing the substring or -1 if not present
24880 **/
24881
24882
24883var isSubstringInArray = function isSubstringInArray(str, arr) {
24884 for (var i = 0; i < arr.length; i++) {
24885 if (arr[i].match(str)) return i;
24886 }
24887
24888 return -1;
24889};
24890var interpolateToCurve = function interpolateToCurve(interpolate, defaultCurve) {
24891 if (!interpolate) {
24892 return defaultCurve;
24893 }
24894
24895 var curveName = "curve".concat(interpolate.charAt(0).toUpperCase() + interpolate.slice(1));
24896 return d3CurveTypes[curveName] || defaultCurve;
24897};
24898var formatUrl = function formatUrl(linkStr, config) {
24899 var url = linkStr.trim();
24900
24901 if (url) {
24902 if (config.securityLevel !== 'loose') {
24903 return Object(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_2__["sanitizeUrl"])(url);
24904 }
24905
24906 return url;
24907 }
24908};
24909var runFunc = function runFunc(functionName) {
24910 var _obj;
24911
24912 var arrPaths = functionName.split('.');
24913 var len = arrPaths.length - 1;
24914 var fnName = arrPaths[len];
24915 var obj = window;
24916
24917 for (var i = 0; i < len; i++) {
24918 obj = obj[arrPaths[i]];
24919 if (!obj) return;
24920 }
24921
24922 for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
24923 params[_key2 - 1] = arguments[_key2];
24924 }
24925
24926 (_obj = obj)[fnName].apply(_obj, params);
24927};
24928
24929var distance = function distance(p1, p2) {
24930 return p1 && p2 ? Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)) : 0;
24931};
24932
24933var traverseEdge = function traverseEdge(points) {
24934 var prevPoint;
24935 var totalDistance = 0;
24936 points.forEach(function (point) {
24937 totalDistance += distance(point, prevPoint);
24938 prevPoint = point;
24939 }); // Traverse half of total distance along points
24940
24941 var remainingDistance = totalDistance / 2;
24942 var center = undefined;
24943 prevPoint = undefined;
24944 points.forEach(function (point) {
24945 if (prevPoint && !center) {
24946 var vectorDistance = distance(point, prevPoint);
24947
24948 if (vectorDistance < remainingDistance) {
24949 remainingDistance -= vectorDistance;
24950 } else {
24951 // The point is remainingDistance from prevPoint in the vector between prevPoint and point
24952 // Calculate the coordinates
24953 var distanceRatio = remainingDistance / vectorDistance;
24954 if (distanceRatio <= 0) center = prevPoint;
24955 if (distanceRatio >= 1) center = {
24956 x: point.x,
24957 y: point.y
24958 };
24959
24960 if (distanceRatio > 0 && distanceRatio < 1) {
24961 center = {
24962 x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
24963 y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
24964 };
24965 }
24966 }
24967 }
24968
24969 prevPoint = point;
24970 });
24971 return center;
24972};
24973
24974var calcLabelPosition = function calcLabelPosition(points) {
24975 return traverseEdge(points);
24976};
24977
24978var calcCardinalityPosition = function calcCardinalityPosition(isRelationTypePresent, points, initialPosition) {
24979 var prevPoint;
24980 var totalDistance = 0; // eslint-disable-line
24981
24982 if (points[0] !== initialPosition) {
24983 points = points.reverse();
24984 }
24985
24986 points.forEach(function (point) {
24987 totalDistance += distance(point, prevPoint);
24988 prevPoint = point;
24989 }); // Traverse only 25 total distance along points to find cardinality point
24990
24991 var distanceToCardinalityPoint = 25;
24992 var remainingDistance = distanceToCardinalityPoint;
24993 var center;
24994 prevPoint = undefined;
24995 points.forEach(function (point) {
24996 if (prevPoint && !center) {
24997 var vectorDistance = distance(point, prevPoint);
24998
24999 if (vectorDistance < remainingDistance) {
25000 remainingDistance -= vectorDistance;
25001 } else {
25002 // The point is remainingDistance from prevPoint in the vector between prevPoint and point
25003 // Calculate the coordinates
25004 var distanceRatio = remainingDistance / vectorDistance;
25005 if (distanceRatio <= 0) center = prevPoint;
25006 if (distanceRatio >= 1) center = {
25007 x: point.x,
25008 y: point.y
25009 };
25010
25011 if (distanceRatio > 0 && distanceRatio < 1) {
25012 center = {
25013 x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
25014 y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
25015 };
25016 }
25017 }
25018 }
25019
25020 prevPoint = point;
25021 }); // if relation is present (Arrows will be added), change cardinality point off-set distance (d)
25022
25023 var d = isRelationTypePresent ? 10 : 5; //Calculate Angle for x and y axis
25024
25025 var angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
25026 var cardinalityPosition = {
25027 x: 0,
25028 y: 0
25029 }; //Calculation cardinality position using angle, center point on the line/curve but pendicular and with offset-distance
25030
25031 cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
25032 cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
25033 return cardinalityPosition;
25034};
25035
25036var getStylesFromArray = function getStylesFromArray(arr) {
25037 var style = '';
25038 var labelStyle = '';
25039
25040 for (var i = 0; i < arr.length; i++) {
25041 if (typeof arr[i] !== 'undefined') {
25042 // add text properties to label style definition
25043 if (arr[i].startsWith('color:') || arr[i].startsWith('text-align:')) {
25044 labelStyle = labelStyle + arr[i] + ';';
25045 } else {
25046 style = style + arr[i] + ';';
25047 }
25048 }
25049 }
25050
25051 return {
25052 style: style,
25053 labelStyle: labelStyle
25054 };
25055};
25056var cnt = 0;
25057var generateId = function generateId() {
25058 cnt++;
25059 return 'id-' + Math.random().toString(36).substr(2, 12) + '-' + cnt;
25060};
25061
25062function makeid(length) {
25063 var result = '';
25064 var characters = '0123456789abcdef';
25065 var charactersLength = characters.length;
25066
25067 for (var i = 0; i < length; i++) {
25068 result += characters.charAt(Math.floor(Math.random() * charactersLength));
25069 }
25070
25071 return result;
25072}
25073
25074var random = function random(options) {
25075 return makeid(options.length);
25076};
25077/**
25078 * @function assignWithDepth
25079 * Extends the functionality of {@link ObjectConstructor.assign} with the ability to merge arbitrary-depth objects
25080 * For each key in src with path `k` (recursively) performs an Object.assign(dst[`k`], src[`k`]) with
25081 * a slight change from the typical handling of undefined for dst[`k`]: instead of raising an error,
25082 * dst[`k`] is auto-initialized to {} and effectively merged with src[`k`]
25083 * <p>
25084 * Additionally, dissimilar types will not clobber unless the config.clobber parameter === true. Example:
25085 * ```
25086 * let config_0 = { foo: { bar: 'bar' }, bar: 'foo' };
25087 * let config_1 = { foo: 'foo', bar: 'bar' };
25088 * let result = assignWithDepth(config_0, config_1);
25089 * console.log(result);
25090 * //-> result: { foo: { bar: 'bar' }, bar: 'bar' }
25091 * ```
25092 * <p>
25093 * Traditional Object.assign would have clobbered foo in config_0 with foo in config_1.
25094 * <p>
25095 * If src is a destructured array of objects and dst is not an array, assignWithDepth will apply each element of src to dst
25096 * in order.
25097 * @param dst:any - the destination of the merge
25098 * @param src:any - the source object(s) to merge into destination
25099 * @param config:{ depth: number, clobber: boolean } - depth: depth to traverse within src and dst for merging -
25100 * clobber: should dissimilar types clobber (default: { depth: 2, clobber: false })
25101 * @returns {*}
25102 */
25103
25104var assignWithDepth = function assignWithDepth(dst, src, config) {
25105 var _Object$assign = Object.assign({
25106 depth: 2,
25107 clobber: false
25108 }, config),
25109 depth = _Object$assign.depth,
25110 clobber = _Object$assign.clobber;
25111
25112 if (Array.isArray(src) && !Array.isArray(dst)) {
25113 src.forEach(function (s) {
25114 return assignWithDepth(dst, s, config);
25115 });
25116 return dst;
25117 } else if (Array.isArray(src) && Array.isArray(dst)) {
25118 src.forEach(function (s) {
25119 if (dst.indexOf(s) === -1) {
25120 dst.push(s);
25121 }
25122 });
25123 return dst;
25124 }
25125
25126 if (typeof dst === 'undefined' || depth <= 0) {
25127 if (dst !== undefined && dst !== null && _typeof(dst) === 'object' && _typeof(src) === 'object') {
25128 return Object.assign(dst, src);
25129 } else {
25130 return src;
25131 }
25132 }
25133
25134 if (typeof src !== 'undefined' && _typeof(dst) === 'object' && _typeof(src) === 'object') {
25135 Object.keys(src).forEach(function (key) {
25136 if (_typeof(src[key]) === 'object' && (dst[key] === undefined || _typeof(dst[key]) === 'object')) {
25137 if (dst[key] === undefined) {
25138 dst[key] = Array.isArray(src[key]) ? [] : {};
25139 }
25140
25141 dst[key] = assignWithDepth(dst[key], src[key], {
25142 depth: depth - 1,
25143 clobber: clobber
25144 });
25145 } else if (clobber || _typeof(dst[key]) !== 'object' && _typeof(src[key]) !== 'object') {
25146 dst[key] = src[key];
25147 }
25148 });
25149 }
25150
25151 return dst;
25152};
25153var getTextObj = function getTextObj() {
25154 return {
25155 x: 0,
25156 y: 0,
25157 fill: undefined,
25158 anchor: 'start',
25159 style: '#666',
25160 width: 100,
25161 height: 100,
25162 textMargin: 0,
25163 rx: 0,
25164 ry: 0,
25165 valign: undefined
25166 };
25167};
25168var drawSimpleText = function drawSimpleText(elem, textData) {
25169 // Remove and ignore br:s
25170 var nText = textData.text.replace(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex, ' ');
25171 var textElem = elem.append('text');
25172 textElem.attr('x', textData.x);
25173 textElem.attr('y', textData.y);
25174 textElem.style('text-anchor', textData.anchor);
25175 textElem.style('font-family', textData.fontFamily);
25176 textElem.style('font-size', textData.fontSize);
25177 textElem.style('font-weight', textData.fontWeight);
25178 textElem.attr('fill', textData.fill);
25179
25180 if (typeof textData.class !== 'undefined') {
25181 textElem.attr('class', textData.class);
25182 }
25183
25184 var span = textElem.append('tspan');
25185 span.attr('x', textData.x + textData.textMargin * 2);
25186 span.attr('fill', textData.fill);
25187 span.text(nText);
25188 return textElem;
25189};
25190var wrapLabel = memoize(function (label, maxWidth, config) {
25191 if (!label) {
25192 return label;
25193 }
25194
25195 config = Object.assign({
25196 fontSize: 12,
25197 fontWeight: 400,
25198 fontFamily: 'Arial',
25199 joinWith: '<br/>'
25200 }, config);
25201
25202 if (_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex.test(label)) {
25203 return label;
25204 }
25205
25206 var words = label.split(' ');
25207 var completedLines = [];
25208 var nextLine = '';
25209 words.forEach(function (word, index) {
25210 var wordLength = calculateTextWidth("".concat(word, " "), config);
25211 var nextLineLength = calculateTextWidth(nextLine, config);
25212
25213 if (wordLength > maxWidth) {
25214 var _breakString = breakString(word, maxWidth, '-', config),
25215 hyphenatedStrings = _breakString.hyphenatedStrings,
25216 remainingWord = _breakString.remainingWord;
25217
25218 completedLines.push.apply(completedLines, [nextLine].concat(_toConsumableArray(hyphenatedStrings)));
25219 nextLine = remainingWord;
25220 } else if (nextLineLength + wordLength >= maxWidth) {
25221 completedLines.push(nextLine);
25222 nextLine = word;
25223 } else {
25224 nextLine = [nextLine, word].filter(Boolean).join(' ');
25225 }
25226
25227 var currentWord = index + 1;
25228 var isLastWord = currentWord === words.length;
25229
25230 if (isLastWord) {
25231 completedLines.push(nextLine);
25232 }
25233 });
25234 return completedLines.filter(function (line) {
25235 return line !== '';
25236 }).join(config.joinWith);
25237}, function (label, maxWidth, config) {
25238 return "".concat(label, "-").concat(maxWidth, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily, "-").concat(config.joinWith);
25239});
25240var breakString = memoize(function (word, maxWidth) {
25241 var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-';
25242 var config = arguments.length > 3 ? arguments[3] : undefined;
25243 config = Object.assign({
25244 fontSize: 12,
25245 fontWeight: 400,
25246 fontFamily: 'Arial',
25247 margin: 0
25248 }, config);
25249 var characters = word.split('');
25250 var lines = [];
25251 var currentLine = '';
25252 characters.forEach(function (character, index) {
25253 var nextLine = "".concat(currentLine).concat(character);
25254 var lineWidth = calculateTextWidth(nextLine, config);
25255
25256 if (lineWidth >= maxWidth) {
25257 var currentCharacter = index + 1;
25258 var isLastLine = characters.length === currentCharacter;
25259 var hyphenatedNextLine = "".concat(nextLine).concat(hyphenCharacter);
25260 lines.push(isLastLine ? nextLine : hyphenatedNextLine);
25261 currentLine = '';
25262 } else {
25263 currentLine = nextLine;
25264 }
25265 });
25266 return {
25267 hyphenatedStrings: lines,
25268 remainingWord: currentLine
25269 };
25270}, function (word, maxWidth) {
25271 var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-';
25272 var config = arguments.length > 3 ? arguments[3] : undefined;
25273 return "".concat(word, "-").concat(maxWidth, "-").concat(hyphenCharacter, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily);
25274});
25275/**
25276 * This calculates the text's height, taking into account the wrap breaks and
25277 * both the statically configured height, width, and the length of the text (in pixels).
25278 *
25279 * If the wrapped text text has greater height, we extend the height, so it's
25280 * value won't overflow.
25281 *
25282 * @return - The height for the given text
25283 * @param text the text to measure
25284 * @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
25285 */
25286
25287var calculateTextHeight = function calculateTextHeight(text, config) {
25288 config = Object.assign({
25289 fontSize: 12,
25290 fontWeight: 400,
25291 fontFamily: 'Arial',
25292 margin: 15
25293 }, config);
25294 return calculateTextDimensions(text, config).height;
25295};
25296/**
25297 * This calculates the width of the given text, font size and family.
25298 *
25299 * @return - The width for the given text
25300 * @param text - The text to calculate the width of
25301 * @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
25302 */
25303
25304var calculateTextWidth = function calculateTextWidth(text, config) {
25305 config = Object.assign({
25306 fontSize: 12,
25307 fontWeight: 400,
25308 fontFamily: 'Arial'
25309 }, config);
25310 return calculateTextDimensions(text, config).width;
25311};
25312/**
25313 * This calculates the dimensions of the given text, font size, font family, font weight, and margins.
25314 *
25315 * @return - The width for the given text
25316 * @param text - The text to calculate the width of
25317 * @param config - the config for fontSize, fontFamily, fontWeight, and margin all impacting the resulting size
25318 */
25319
25320var calculateTextDimensions = memoize(function (text, config) {
25321 config = Object.assign({
25322 fontSize: 12,
25323 fontWeight: 400,
25324 fontFamily: 'Arial'
25325 }, config);
25326 var _config = config,
25327 fontSize = _config.fontSize,
25328 fontFamily = _config.fontFamily,
25329 fontWeight = _config.fontWeight;
25330
25331 if (!text) {
25332 return {
25333 width: 0,
25334 height: 0
25335 };
25336 } // We can't really know if the user supplied font family will render on the user agent;
25337 // thus, we'll take the max width between the user supplied font family, and a default
25338 // of sans-serif.
25339
25340
25341 var fontFamilies = ['sans-serif', fontFamily];
25342 var lines = text.split(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex);
25343 var dims = [];
25344 var body = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('body'); // We don't want to leak DOM elements - if a removal operation isn't available
25345 // for any reason, do not continue.
25346
25347 if (!body.remove) {
25348 return {
25349 width: 0,
25350 height: 0,
25351 lineHeight: 0
25352 };
25353 }
25354
25355 var g = body.append('svg');
25356
25357 for (var _i = 0, _fontFamilies = fontFamilies; _i < _fontFamilies.length; _i++) {
25358 var _fontFamily = _fontFamilies[_i];
25359 var cheight = 0;
25360 var dim = {
25361 width: 0,
25362 height: 0,
25363 lineHeight: 0
25364 };
25365 var _iteratorNormalCompletion = true;
25366 var _didIteratorError = false;
25367 var _iteratorError = undefined;
25368
25369 try {
25370 for (var _iterator = lines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
25371 var line = _step.value;
25372 var textObj = getTextObj();
25373 textObj.text = line;
25374 var textElem = drawSimpleText(g, textObj).style('font-size', fontSize).style('font-weight', fontWeight).style('font-family', _fontFamily);
25375 var bBox = (textElem._groups || textElem)[0][0].getBBox();
25376 dim.width = Math.round(Math.max(dim.width, bBox.width));
25377 cheight = Math.round(bBox.height);
25378 dim.height += cheight;
25379 dim.lineHeight = Math.round(Math.max(dim.lineHeight, cheight));
25380 }
25381 } catch (err) {
25382 _didIteratorError = true;
25383 _iteratorError = err;
25384 } finally {
25385 try {
25386 if (!_iteratorNormalCompletion && _iterator.return != null) {
25387 _iterator.return();
25388 }
25389 } finally {
25390 if (_didIteratorError) {
25391 throw _iteratorError;
25392 }
25393 }
25394 }
25395
25396 dims.push(dim);
25397 }
25398
25399 g.remove();
25400 var index = isNaN(dims[1].height) || isNaN(dims[1].width) || isNaN(dims[1].lineHeight) || dims[0].height > dims[1].height && dims[0].width > dims[1].width && dims[0].lineHeight > dims[1].lineHeight ? 0 : 1;
25401 return dims[index];
25402}, function (text, config) {
25403 return "".concat(text, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily);
25404});
25405/* harmony default export */ __webpack_exports__["default"] = ({
25406 assignWithDepth: assignWithDepth,
25407 wrapLabel: wrapLabel,
25408 calculateTextHeight: calculateTextHeight,
25409 calculateTextWidth: calculateTextWidth,
25410 calculateTextDimensions: calculateTextDimensions,
25411 detectInit: detectInit,
25412 detectDirective: detectDirective,
25413 detectType: detectType,
25414 isSubstringInArray: isSubstringInArray,
25415 interpolateToCurve: interpolateToCurve,
25416 calcLabelPosition: calcLabelPosition,
25417 calcCardinalityPosition: calcCardinalityPosition,
25418 formatUrl: formatUrl,
25419 getStylesFromArray: getStylesFromArray,
25420 generateId: generateId,
25421 random: random,
25422 memoize: memoize,
25423 runFunc: runFunc
25424});
25425
25426/***/ }),
25427
25428/***/ "@braintree/sanitize-url":
25429/*!******************************************!*\
25430 !*** external "@braintree/sanitize-url" ***!
25431 \******************************************/
25432/*! no static exports found */
25433/***/ (function(module, exports) {
25434
25435module.exports = require("@braintree/sanitize-url");
25436
25437/***/ }),
25438
25439/***/ "d3":
25440/*!*********************!*\
25441 !*** external "d3" ***!
25442 \*********************/
25443/*! no static exports found */
25444/***/ (function(module, exports) {
25445
25446module.exports = require("d3");
25447
25448/***/ }),
25449
25450/***/ "dagre":
25451/*!************************!*\
25452 !*** external "dagre" ***!
25453 \************************/
25454/*! no static exports found */
25455/***/ (function(module, exports) {
25456
25457module.exports = require("dagre");
25458
25459/***/ }),
25460
25461/***/ "dagre-d3":
25462/*!***************************!*\
25463 !*** external "dagre-d3" ***!
25464 \***************************/
25465/*! no static exports found */
25466/***/ (function(module, exports) {
25467
25468module.exports = require("dagre-d3");
25469
25470/***/ }),
25471
25472/***/ "dagre-d3/lib/label/add-html-label.js":
25473/*!*******************************************************!*\
25474 !*** external "dagre-d3/lib/label/add-html-label.js" ***!
25475 \*******************************************************/
25476/*! no static exports found */
25477/***/ (function(module, exports) {
25478
25479module.exports = require("dagre-d3/lib/label/add-html-label.js");
25480
25481/***/ }),
25482
25483/***/ "entity-decode/browser":
25484/*!****************************************!*\
25485 !*** external "entity-decode/browser" ***!
25486 \****************************************/
25487/*! no static exports found */
25488/***/ (function(module, exports) {
25489
25490module.exports = require("entity-decode/browser");
25491
25492/***/ }),
25493
25494/***/ "graphlib":
25495/*!***************************!*\
25496 !*** external "graphlib" ***!
25497 \***************************/
25498/*! no static exports found */
25499/***/ (function(module, exports) {
25500
25501module.exports = require("graphlib");
25502
25503/***/ }),
25504
25505/***/ "khroma":
25506/*!*************************!*\
25507 !*** external "khroma" ***!
25508 \*************************/
25509/*! no static exports found */
25510/***/ (function(module, exports) {
25511
25512module.exports = require("khroma");
25513
25514/***/ }),
25515
25516/***/ "moment-mini":
25517/*!******************************!*\
25518 !*** external "moment-mini" ***!
25519 \******************************/
25520/*! no static exports found */
25521/***/ (function(module, exports) {
25522
25523module.exports = require("moment-mini");
25524
25525/***/ }),
25526
25527/***/ "stylis":
25528/*!*************************!*\
25529 !*** external "stylis" ***!
25530 \*************************/
25531/*! no static exports found */
25532/***/ (function(module, exports) {
25533
25534module.exports = require("stylis");
25535
25536/***/ })
25537
25538/******/ })["default"];
25539});
25540//# sourceMappingURL=mermaid.core.js.map
\No newline at end of file