UNPKG

1.02 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.8.3\",\"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 > 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\",\"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, setSiteConfigDelta, 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__, "setSiteConfigDelta", function() { return setSiteConfigDelta; });
676/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateSiteConfig", function() { return updateSiteConfig; });
677/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSiteConfig", function() { return getSiteConfig; });
678/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConfig", function() { return setConfig; });
679/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getConfig", function() { return getConfig; });
680/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sanitize", function() { return sanitize; });
681/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addDirective", function() { return addDirective; });
682/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reset", function() { return reset; });
683/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
684/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
685/* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
686/* harmony import */ var _defaultConfig__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./defaultConfig */ "./src/defaultConfig.js");
687
688
689
690 // debugger;
691
692var defaultConfig = Object.freeze(_defaultConfig__WEBPACK_IMPORTED_MODULE_3__["default"]);
693var siteConfig = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, defaultConfig);
694var siteConfigDelta;
695var directives = [];
696var currentConfig = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, defaultConfig);
697var updateCurrentConfig = function updateCurrentConfig(siteCfg, _directives) {
698 // start with config beeing the siteConfig
699 var cfg = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, siteCfg); // let sCfg = assignWithDepth(defaultConfig, siteConfigDelta);
700 // Join directives
701
702 var sumOfDirectives = {};
703
704 for (var i = 0; i < _directives.length; i++) {
705 var d = _directives[i];
706 sanitize(d); // Apply the data from the directive where the the overrides the themeVaraibles
707
708 sumOfDirectives = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])(sumOfDirectives, d);
709 }
710
711 cfg = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])(cfg, sumOfDirectives);
712
713 if (sumOfDirectives.theme) {
714 var themeVariables = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])(siteConfigDelta.themeVariables || {}, sumOfDirectives.themeVariables);
715 cfg.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][cfg.theme].getThemeVariables(themeVariables);
716 } // if (cfg.theme && theme[cfg.theme]) {
717 // let tVars = assignWithDepth({}, cfg.themeVariables);
718 // tVars = assignWithDepth(tVars, themeVariables);
719 // const variables = theme[cfg.theme].getThemeVariables(tVars);
720 // cfg.themeVariables = variables;
721 // }
722
723
724 currentConfig = cfg;
725 return cfg;
726};
727/**
728 *## setSiteConfig
729 *| Function | Description | Type | Values |
730 *| --------- | ------------------- | ------- | ------------------ |
731 *| setSiteConfig|Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array|
732 ***Notes:**
733 *Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls to reset() will reset
734 *the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) will reset siteConfig and currentConfig
735 *to the defaultConfig
736 *Note: currentConfig is set in this function
737 **Default value: At default, will mirror Global Config**
738 * @param conf - the base currentConfig to use as siteConfig
739 * @returns {*} - the siteConfig
740 */
741
742var setSiteConfig = function setSiteConfig(conf) {
743 siteConfig = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, defaultConfig);
744 siteConfig = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])(siteConfig, conf);
745
746 if (conf.theme) {
747 siteConfig.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][conf.theme].getThemeVariables(conf.themeVariables);
748 }
749
750 currentConfig = updateCurrentConfig(siteConfig, directives);
751 return siteConfig;
752};
753var setSiteConfigDelta = function setSiteConfigDelta(conf) {
754 siteConfigDelta = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, conf);
755};
756var updateSiteConfig = function updateSiteConfig(conf) {
757 siteConfig = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])(siteConfig, conf);
758 updateCurrentConfig(siteConfig, directives);
759 return siteConfig;
760};
761/**
762 *## getSiteConfig
763 *| Function | Description | Type | Values |
764 *| --------- | ------------------- | ------- | ------------------ |
765 *| setSiteConfig|Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig|
766 ***Notes**:
767 *Returns **any** values in siteConfig.
768 * @returns {*}
769 */
770
771var getSiteConfig = function getSiteConfig() {
772 return Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, siteConfig);
773};
774/**
775 *## setConfig
776 *| Function | Description | Type | Values |
777 *| --------- | ------------------- | ------- | ------------------ |
778 *| setSiteConfig|Sets the siteConfig to desired values | Put Request| Any Values, except ones in secure array|
779 ***Notes**:
780 *Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure keys. Any
781 *values found in conf with key found in siteConfig.secure will be replaced with the corresponding
782 *siteConfig value.
783 * @param conf - the potential currentConfig
784 * @returns {*} - the currentConfig merged with the sanitized conf
785 */
786
787var setConfig = function setConfig(conf) {
788 // sanitize(conf);
789 // Object.keys(conf).forEach(key => {
790 // const manipulator = manipulators[key];
791 // conf[key] = manipulator ? manipulator(conf[key]) : conf[key];
792 // });
793 Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])(currentConfig, conf);
794 return getConfig();
795};
796/**
797 * ## getConfig
798 *| Function | Description | Type | Return Values |
799 *| --------- | ------------------- | ------- | ------------------ |
800 *| getConfig |Obtains the currentConfig | Get Request | Any Values from currentConfig|
801 ***Notes**:
802 *Returns **any** the currentConfig
803 * @returns {*} - the currentConfig
804 */
805
806var getConfig = function getConfig() {
807 return Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assignWithDepth"])({}, currentConfig);
808};
809/**
810 *## sanitize
811 *| Function | Description | Type | Values |
812 *| --------- | ------------------- | ------- | ------------------ |
813 *| sanitize |Sets the siteConfig to desired values. | Put Request |None|
814 *Ensures options parameter does not attempt to override siteConfig secure keys
815 *Note: modifies options in-place
816 * @param options - the potential setConfig parameter
817 */
818
819var sanitize = function sanitize(options) {
820 Object.keys(siteConfig.secure).forEach(function (key) {
821 if (typeof options[siteConfig.secure[key]] !== 'undefined') {
822 // DO NOT attempt to print options[siteConfig.secure[key]] within `${}` as a malicious script
823 // can exploit the logger's attempt to stringify the value and execute arbitrary code
824 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].debug("Denied attempt to modify a secure key ".concat(siteConfig.secure[key]), options[siteConfig.secure[key]]);
825 delete options[siteConfig.secure[key]];
826 }
827 });
828};
829var addDirective = function addDirective(directive) {
830 if (directive.fontFamily) {
831 if (!directive.themeVariables) {
832 directive.themeVariables = {
833 fontFamily: directive.fontFamily
834 };
835 } else {
836 if (!directive.themeVariables.fontFamily) {
837 directive.themeVariables = {
838 fontFamily: directive.fontFamily
839 };
840 }
841 }
842 }
843
844 directives.push(directive);
845 updateCurrentConfig(siteConfig, directives);
846};
847/**
848 *## reset
849 *| Function | Description | Type | Required | Values |
850 *| --------- | ------------------- | ------- | -------- | ------------------ |
851 *| reset|Resets currentConfig to conf| Put Request | Required | None|
852 *
853 *| Parameter | Description |Type | Required | Values|
854 *| --- | --- | --- | --- | --- |
855 *| conf| base set of values, which currentConfig coul be **reset** to.| Dictionary | Required | Any Values, with respect to the secure Array|
856 *
857 **Notes :
858 (default: current siteConfig ) (optional, default `getSiteConfig()`)
859 * @param conf the base currentConfig to reset to (default: current siteConfig ) (optional, default `getSiteConfig()`)
860 */
861
862var reset = function reset() {
863 // Replace current config with siteConfig
864 directives = [];
865 updateCurrentConfig(siteConfig, directives);
866};
867
868/***/ }),
869
870/***/ "./src/dagre-wrapper/clusters.js":
871/*!***************************************!*\
872 !*** ./src/dagre-wrapper/clusters.js ***!
873 \***************************************/
874/*! exports provided: insertCluster, getClusterTitleWidth, clear, positionCluster */
875/***/ (function(module, __webpack_exports__, __webpack_require__) {
876
877"use strict";
878__webpack_require__.r(__webpack_exports__);
879/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertCluster", function() { return insertCluster; });
880/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClusterTitleWidth", function() { return getClusterTitleWidth; });
881/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
882/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionCluster", function() { return positionCluster; });
883/* harmony import */ var _intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect/intersect-rect */ "./src/dagre-wrapper/intersect/intersect-rect.js");
884/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
885/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
886/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! d3 */ "d3");
887/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_3__);
888/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../config */ "./src/config.js");
889
890 // eslint-disable-line
891
892
893
894
895
896var rect = function rect(parent, node) {
897 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].trace('Creating subgraph rect for ', node.id, node); // Add outer g element
898
899 var shapeSvg = parent.insert('g').attr('class', 'cluster' + (node.class ? ' ' + node.class : '')).attr('id', node.id); // add the rect
900
901 var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect
902
903 var label = shapeSvg.insert('g').attr('class', 'cluster-label');
904 var text = label.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label
905
906 var bbox = text.getBBox();
907
908 if (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels) {
909 var div = text.children[0];
910 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_3__["select"])(text);
911 bbox = div.getBoundingClientRect();
912 dv.attr('width', bbox.width);
913 dv.attr('height', bbox.height);
914 }
915
916 var padding = 0 * node.padding;
917 var halfPadding = padding / 2;
918 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].trace('Data ', node, JSON.stringify(node)); // center the rect around its coordinate
919
920 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
921
922 label.attr('transform', 'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2 - node.padding / 3 + 3) + ')');
923 var rectBox = rect.node().getBBox();
924 node.width = rectBox.width;
925 node.height = rectBox.height;
926
927 node.intersect = function (point) {
928 return Object(_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point);
929 };
930
931 return shapeSvg;
932};
933/**
934 * Non visiable cluster where the note is group with its
935 */
936
937
938var noteGroup = function noteGroup(parent, node) {
939 // Add outer g element
940 var shapeSvg = parent.insert('g').attr('class', 'note-cluster').attr('id', node.id); // add the rect
941
942 var rect = shapeSvg.insert('rect', ':first-child');
943 var padding = 0 * node.padding;
944 var halfPadding = padding / 2; // center the rect around its coordinate
945
946 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');
947 var rectBox = rect.node().getBBox();
948 node.width = rectBox.width;
949 node.height = rectBox.height;
950
951 node.intersect = function (point) {
952 return Object(_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point);
953 };
954
955 return shapeSvg;
956};
957
958var roundedWithTitle = function roundedWithTitle(parent, node) {
959 // Add outer g element
960 var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect
961
962 var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect
963
964 var label = shapeSvg.insert('g').attr('class', 'cluster-label');
965 var innerRect = shapeSvg.append('rect');
966 var text = label.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label
967
968 var bbox = text.getBBox();
969
970 if (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels) {
971 var div = text.children[0];
972 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_3__["select"])(text);
973 bbox = div.getBoundingClientRect();
974 dv.attr('width', bbox.width);
975 dv.attr('height', bbox.height);
976 }
977
978 bbox = text.getBBox();
979 var padding = 0 * node.padding;
980 var halfPadding = padding / 2; // center the rect around its coordinate
981
982 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);
983 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
984
985 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)) + ')');
986 var rectBox = rect.node().getBBox();
987 node.width = rectBox.width;
988 node.height = rectBox.height;
989
990 node.intersect = function (point) {
991 return Object(_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point);
992 };
993
994 return shapeSvg;
995};
996
997var divider = function divider(parent, node) {
998 // Add outer g element
999 var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect
1000
1001 var rect = shapeSvg.insert('rect', ':first-child');
1002 var padding = 0 * node.padding;
1003 var halfPadding = padding / 2; // center the rect around its coordinate
1004
1005 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);
1006 var rectBox = rect.node().getBBox();
1007 node.width = rectBox.width;
1008 node.height = rectBox.height;
1009
1010 node.intersect = function (point) {
1011 return Object(_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point);
1012 };
1013
1014 return shapeSvg;
1015};
1016
1017var shapes = {
1018 rect: rect,
1019 roundedWithTitle: roundedWithTitle,
1020 noteGroup: noteGroup,
1021 divider: divider
1022};
1023var clusterElems = {};
1024var insertCluster = function insertCluster(elem, node) {
1025 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].trace('Inserting cluster');
1026 var shape = node.shape || 'rect';
1027 clusterElems[node.id] = shapes[shape](elem, node);
1028};
1029var getClusterTitleWidth = function getClusterTitleWidth(elem, node) {
1030 var label = Object(_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true);
1031 elem.node().appendChild(label);
1032 var width = label.getBBox().width;
1033 elem.node().removeChild(label);
1034 return width;
1035};
1036var clear = function clear() {
1037 clusterElems = {};
1038};
1039var positionCluster = function positionCluster(node) {
1040 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Position cluster');
1041 var el = clusterElems[node.id];
1042 el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');
1043};
1044
1045/***/ }),
1046
1047/***/ "./src/dagre-wrapper/createLabel.js":
1048/*!******************************************!*\
1049 !*** ./src/dagre-wrapper/createLabel.js ***!
1050 \******************************************/
1051/*! exports provided: default */
1052/***/ (function(module, __webpack_exports__, __webpack_require__) {
1053
1054"use strict";
1055__webpack_require__.r(__webpack_exports__);
1056/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
1057/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
1058/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
1059/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config */ "./src/config.js");
1060
1061 // eslint-disable-line
1062// let vertexNode;
1063// if (getConfig().flowchart.htmlLabels) {
1064// // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
1065// const node = {
1066// label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, s => `<i class='${s.replace(':', ' ')}'></i>`)
1067// };
1068// vertexNode = addHtmlLabel(svg, node).node();
1069// vertexNode.parentNode.removeChild(vertexNode);
1070// } else {
1071// const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
1072// svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
1073// const rows = vertexText.split(common.lineBreakRegex);
1074// for (let j = 0; j < rows.length; j++) {
1075// const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
1076// tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
1077// tspan.setAttribute('dy', '1em');
1078// tspan.setAttribute('x', '1');
1079// tspan.textContent = rows[j];
1080// svgLabel.appendChild(tspan);
1081// }
1082// vertexNode = svgLabel;
1083// }
1084
1085
1086
1087function applyStyle(dom, styleFn) {
1088 if (styleFn) {
1089 dom.attr('style', styleFn);
1090 }
1091}
1092
1093function addHtmlLabel(node) {
1094 // var fo = root.append('foreignObject').attr('width', '100000');
1095 // var div = fo.append('xhtml:div');
1096 // div.attr('xmlns', 'http://www.w3.org/1999/xhtml');
1097 // var label = node.label;
1098 // switch (typeof label) {
1099 // case 'function':
1100 // div.insert(label);
1101 // break;
1102 // case 'object':
1103 // // Currently we assume this is a DOM object.
1104 // div.insert(function() {
1105 // return label;
1106 // });
1107 // break;
1108 // default:
1109 // div.html(label);
1110 // }
1111 // applyStyle(div, node.labelStyle);
1112 // div.style('display', 'inline-block');
1113 // // Fix for firefox
1114 // div.style('white-space', 'nowrap');
1115 // var client = div.node().getBoundingClientRect();
1116 // fo.attr('width', client.width).attr('height', client.height);
1117 var fo = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject'));
1118 var div = fo.append('xhtml:div');
1119 var label = node.label;
1120 var labelClass = node.isNode ? 'nodeLabel' : 'edgeLabel';
1121 div.html('<span class="' + labelClass + '">' + label + '</span>');
1122 applyStyle(div, node.labelStyle);
1123 div.style('display', 'inline-block'); // Fix for firefox
1124
1125 div.style('white-space', 'nowrap');
1126 div.attr('xmlns', 'http://www.w3.org/1999/xhtml');
1127 return fo.node();
1128}
1129
1130var createLabel = function createLabel(_vertexText, style, isTitle, isNode) {
1131 var vertexText = _vertexText || '';
1132
1133 if (Object(_config__WEBPACK_IMPORTED_MODULE_2__["getConfig"])().flowchart.htmlLabels) {
1134 // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
1135 vertexText = vertexText.replace(/\\n|\n/g, '<br />');
1136 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('vertexText' + vertexText);
1137 var node = {
1138 isNode: isNode,
1139 label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
1140 return "<i class='".concat(s.replace(':', ' '), "'></i>");
1141 }),
1142 labelStyle: style.replace('fill:', 'color:')
1143 };
1144 var vertexNode = addHtmlLabel(node); // vertexNode.parentNode.removeChild(vertexNode);
1145
1146 return vertexNode;
1147 } else {
1148 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
1149 svgLabel.setAttribute('style', style.replace('color:', 'fill:'));
1150 var rows = [];
1151
1152 if (typeof vertexText === 'string') {
1153 rows = vertexText.split(/\\n|\n|<br\s*\/?>/gi);
1154 } else if (Array.isArray(vertexText)) {
1155 rows = vertexText;
1156 } else {
1157 rows = [];
1158 }
1159
1160 for (var j = 0; j < rows.length; j++) {
1161 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
1162 tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
1163 tspan.setAttribute('dy', '1em');
1164 tspan.setAttribute('x', '0');
1165
1166 if (isTitle) {
1167 tspan.setAttribute('class', 'title-row');
1168 } else {
1169 tspan.setAttribute('class', 'row');
1170 }
1171
1172 tspan.textContent = rows[j].trim();
1173 svgLabel.appendChild(tspan);
1174 }
1175
1176 return svgLabel;
1177 }
1178};
1179
1180/* harmony default export */ __webpack_exports__["default"] = (createLabel);
1181
1182/***/ }),
1183
1184/***/ "./src/dagre-wrapper/edges.js":
1185/*!************************************!*\
1186 !*** ./src/dagre-wrapper/edges.js ***!
1187 \************************************/
1188/*! exports provided: clear, insertEdgeLabel, positionEdgeLabel, intersection, insertEdge */
1189/***/ (function(module, __webpack_exports__, __webpack_require__) {
1190
1191"use strict";
1192__webpack_require__.r(__webpack_exports__);
1193/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
1194/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertEdgeLabel", function() { return insertEdgeLabel; });
1195/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionEdgeLabel", function() { return positionEdgeLabel; });
1196/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return intersection; });
1197/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertEdge", function() { return insertEdge; });
1198/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
1199/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
1200/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! d3 */ "d3");
1201/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_2__);
1202/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../config */ "./src/config.js");
1203/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils.js");
1204 // eslint-disable-line
1205
1206
1207
1208
1209 // import { calcLabelPosition } from '../utils';
1210
1211var edgeLabels = {};
1212var terminalLabels = {};
1213var clear = function clear() {
1214 edgeLabels = {};
1215 terminalLabels = {};
1216};
1217var insertEdgeLabel = function insertEdgeLabel(elem, edge) {
1218 // Create the actual text element
1219 var labelElement = Object(_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.label, edge.labelStyle); // Create outer g, edgeLabel, this will be positioned after graph layout
1220
1221 var edgeLabel = elem.insert('g').attr('class', 'edgeLabel'); // Create inner g, label, this will be positioned now for centering the text
1222
1223 var label = edgeLabel.insert('g').attr('class', 'label');
1224 label.node().appendChild(labelElement); // Center the label
1225
1226 var bbox = labelElement.getBBox();
1227
1228 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().flowchart.htmlLabels) {
1229 var div = labelElement.children[0];
1230 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_2__["select"])(labelElement);
1231 bbox = div.getBoundingClientRect();
1232 dv.attr('width', bbox.width);
1233 dv.attr('height', bbox.height);
1234 }
1235
1236 label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')'); // Make element accessible by id for positioning
1237
1238 edgeLabels[edge.id] = edgeLabel; // Update the abstract data of the edge with the new information about its width and height
1239
1240 edge.width = bbox.width;
1241 edge.height = bbox.height;
1242
1243 if (edge.startLabelLeft) {
1244 // Create the actual text element
1245 var startLabelElement = Object(_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.startLabelLeft, edge.labelStyle);
1246 var startEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
1247 var inner = startEdgeLabelLeft.insert('g').attr('class', 'inner');
1248 inner.node().appendChild(startLabelElement);
1249 var slBox = startLabelElement.getBBox();
1250 inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
1251
1252 if (!terminalLabels[edge.id]) {
1253 terminalLabels[edge.id] = {};
1254 }
1255
1256 terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
1257 }
1258
1259 if (edge.startLabelRight) {
1260 // Create the actual text element
1261 var _startLabelElement = Object(_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.startLabelRight, edge.labelStyle);
1262
1263 var startEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
1264
1265 var _inner = startEdgeLabelRight.insert('g').attr('class', 'inner');
1266
1267 startEdgeLabelRight.node().appendChild(_startLabelElement);
1268
1269 _inner.node().appendChild(_startLabelElement);
1270
1271 var _slBox = _startLabelElement.getBBox();
1272
1273 _inner.attr('transform', 'translate(' + -_slBox.width / 2 + ', ' + -_slBox.height / 2 + ')');
1274
1275 if (!terminalLabels[edge.id]) {
1276 terminalLabels[edge.id] = {};
1277 }
1278
1279 terminalLabels[edge.id].startRight = startEdgeLabelRight;
1280 }
1281
1282 if (edge.endLabelLeft) {
1283 // Create the actual text element
1284 var endLabelElement = Object(_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.endLabelLeft, edge.labelStyle);
1285 var endEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
1286
1287 var _inner2 = endEdgeLabelLeft.insert('g').attr('class', 'inner');
1288
1289 _inner2.node().appendChild(endLabelElement);
1290
1291 var _slBox2 = endLabelElement.getBBox();
1292
1293 _inner2.attr('transform', 'translate(' + -_slBox2.width / 2 + ', ' + -_slBox2.height / 2 + ')');
1294
1295 endEdgeLabelLeft.node().appendChild(endLabelElement);
1296
1297 if (!terminalLabels[edge.id]) {
1298 terminalLabels[edge.id] = {};
1299 }
1300
1301 terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
1302 }
1303
1304 if (edge.endLabelRight) {
1305 // Create the actual text element
1306 var _endLabelElement = Object(_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.endLabelRight, edge.labelStyle);
1307
1308 var endEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
1309
1310 var _inner3 = endEdgeLabelRight.insert('g').attr('class', 'inner');
1311
1312 _inner3.node().appendChild(_endLabelElement);
1313
1314 var _slBox3 = _endLabelElement.getBBox();
1315
1316 _inner3.attr('transform', 'translate(' + -_slBox3.width / 2 + ', ' + -_slBox3.height / 2 + ')');
1317
1318 endEdgeLabelRight.node().appendChild(_endLabelElement);
1319
1320 if (!terminalLabels[edge.id]) {
1321 terminalLabels[edge.id] = {};
1322 }
1323
1324 terminalLabels[edge.id].endRight = endEdgeLabelRight;
1325 }
1326};
1327var positionEdgeLabel = function positionEdgeLabel(edge, paths) {
1328 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Moving label', edge.id, edge.label, edgeLabels[edge.id]);
1329 var path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
1330
1331 if (edge.label) {
1332 var el = edgeLabels[edge.id];
1333 var x = edge.x;
1334 var y = edge.y;
1335
1336 if (path) {
1337 // // debugger;
1338 var pos = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calcLabelPosition(path);
1339 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Moving label from (', x, ',', y, ') to (', pos.x, ',', pos.y, ')'); // x = pos.x;
1340 // y = pos.y;
1341 }
1342
1343 el.attr('transform', 'translate(' + x + ', ' + y + ')');
1344 } //let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
1345
1346
1347 if (edge.startLabelLeft) {
1348 var _el = terminalLabels[edge.id].startLeft;
1349 var _x = edge.x;
1350 var _y = edge.y;
1351
1352 if (path) {
1353 // debugger;
1354 var _pos = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calcTerminalLabelPosition(0, 'start_left', path);
1355
1356 _x = _pos.x;
1357 _y = _pos.y;
1358 }
1359
1360 _el.attr('transform', 'translate(' + _x + ', ' + _y + ')');
1361 }
1362
1363 if (edge.startLabelRight) {
1364 var _el2 = terminalLabels[edge.id].startRight;
1365 var _x2 = edge.x;
1366 var _y2 = edge.y;
1367
1368 if (path) {
1369 // debugger;
1370 var _pos2 = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calcTerminalLabelPosition(0, 'start_right', path);
1371
1372 _x2 = _pos2.x;
1373 _y2 = _pos2.y;
1374 }
1375
1376 _el2.attr('transform', 'translate(' + _x2 + ', ' + _y2 + ')');
1377 }
1378
1379 if (edge.endLabelLeft) {
1380 var _el3 = terminalLabels[edge.id].endLeft;
1381 var _x3 = edge.x;
1382 var _y3 = edge.y;
1383
1384 if (path) {
1385 // debugger;
1386 var _pos3 = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calcTerminalLabelPosition(0, 'end_left', path);
1387
1388 _x3 = _pos3.x;
1389 _y3 = _pos3.y;
1390 }
1391
1392 _el3.attr('transform', 'translate(' + _x3 + ', ' + _y3 + ')');
1393 }
1394
1395 if (edge.endLabelRight) {
1396 var _el4 = terminalLabels[edge.id].endRight;
1397 var _x4 = edge.x;
1398 var _y4 = edge.y;
1399
1400 if (path) {
1401 // debugger;
1402 var _pos4 = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calcTerminalLabelPosition(0, 'end_right', path);
1403
1404 _x4 = _pos4.x;
1405 _y4 = _pos4.y;
1406 }
1407
1408 _el4.attr('transform', 'translate(' + _x4 + ', ' + _y4 + ')');
1409 }
1410}; // const getRelationType = function(type) {
1411// switch (type) {
1412// case stateDb.relationType.AGGREGATION:
1413// return 'aggregation';
1414// case stateDb.relationType.EXTENSION:
1415// return 'extension';
1416// case stateDb.relationType.COMPOSITION:
1417// return 'composition';
1418// case stateDb.relationType.DEPENDENCY:
1419// return 'dependency';
1420// }
1421// };
1422
1423var outsideNode = function outsideNode(node, point) {
1424 // logger.warn('Checking bounds ', node, point);
1425 var x = node.x;
1426 var y = node.y;
1427 var dx = Math.abs(point.x - x);
1428 var dy = Math.abs(point.y - y);
1429 var w = node.width / 2;
1430 var h = node.height / 2;
1431
1432 if (dx >= w || dy >= h) {
1433 return true;
1434 }
1435
1436 return false;
1437};
1438
1439var intersection = function intersection(node, outsidePoint, insidePoint) {
1440 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('intersection calc o:', outsidePoint, ' i:', insidePoint, node);
1441 var x = node.x;
1442 var y = node.y;
1443 var dx = Math.abs(x - insidePoint.x);
1444 var w = node.width / 2;
1445 var r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
1446 var h = node.height / 2;
1447 var edges = {
1448 x1: x - w,
1449 x2: x + w,
1450 y1: y - h,
1451 y2: y + h
1452 };
1453
1454 if (outsidePoint.x === edges.x1 || outsidePoint.x === edges.x2 || outsidePoint.y === edges.y1 || outsidePoint.y === edges.y2) {
1455 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('calc equals on edge');
1456 return outsidePoint;
1457 }
1458
1459 var Q = Math.abs(outsidePoint.y - insidePoint.y);
1460 var R = Math.abs(outsidePoint.x - insidePoint.x); // log.warn();
1461
1462 if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
1463 // eslint-disable-line
1464 // Intersection is top or bottom of rect.
1465 // let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
1466 var q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
1467 r = R * q / Q;
1468 var res = {
1469 x: insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - r,
1470 y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - q
1471 };
1472 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn("topp/bott calc, Q ".concat(Q, ", q ").concat(q, ", R ").concat(R, ", r ").concat(r), res);
1473 return res;
1474 } else {
1475 // Intersection onn sides of rect
1476 // q = (Q * r) / R;
1477 // q = 2;
1478 // r = (R * q) / Q;
1479 if (insidePoint.x < outsidePoint.x) {
1480 r = outsidePoint.x - w - x;
1481 } else {
1482 // r = outsidePoint.x - w - x;
1483 r = x - w - outsidePoint.x;
1484 }
1485
1486 var _q = _q = Q * r / R;
1487
1488 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn("sides calc, Q ".concat(Q, ", q ").concat(_q, ", R ").concat(R, ", r ").concat(r), {
1489 x: insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x + dx - w,
1490 y: insidePoint.y < outsidePoint.y ? insidePoint.y + _q : insidePoint.y - _q
1491 });
1492 return {
1493 x: insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x + dx - w,
1494 y: insidePoint.y < outsidePoint.y ? insidePoint.y + _q : insidePoint.y - _q
1495 };
1496 }
1497}; //(edgePaths, e, edge, clusterDb, diagramtype, graph)
1498
1499var insertEdge = function insertEdge(elem, e, edge, clusterDb, diagramType, graph) {
1500 var points = edge.points;
1501 var pointsHasChanged = false;
1502 var tail = graph.node(e.v);
1503 var head = graph.node(e.w);
1504
1505 if (head.intersect && tail.intersect) {
1506 points = points.slice(1, edge.points.length - 1);
1507 points.unshift(tail.intersect(points[0]));
1508 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Last point', points[points.length - 1], head, head.intersect(points[points.length - 1]));
1509 points.push(head.intersect(points[points.length - 1]));
1510 }
1511
1512 if (edge.toCluster) {
1513 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('edge', edge);
1514 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('to cluster', clusterDb[edge.toCluster]);
1515 points = [];
1516 var lastPointOutside;
1517 var isInside = false;
1518 edge.points.forEach(function (point) {
1519 var node = clusterDb[edge.toCluster].node;
1520
1521 if (!outsideNode(node, point) && !isInside) {
1522 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('inside', edge.toCluster, point, lastPointOutside); // First point inside the rect
1523
1524 var inter = intersection(node, lastPointOutside, point);
1525 var pointPresent = false;
1526 points.forEach(function (p) {
1527 pointPresent = pointPresent || p.x === inter.x && p.y === inter.y;
1528 }); // if (!pointPresent) {
1529
1530 if (!points.find(function (e) {
1531 return e.x === inter.x && e.y === inter.y;
1532 })) {
1533 points.push(inter);
1534 } else {
1535 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('no intersect', inter, points);
1536 }
1537
1538 isInside = true;
1539 } else {
1540 if (!isInside) points.push(point);
1541 }
1542
1543 lastPointOutside = point;
1544 });
1545 pointsHasChanged = true;
1546 }
1547
1548 if (edge.fromCluster) {
1549 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('edge', edge);
1550 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('from cluster', clusterDb[edge.fromCluster]);
1551 var updatedPoints = [];
1552
1553 var _lastPointOutside;
1554
1555 var _isInside = false;
1556
1557 for (var i = points.length - 1; i >= 0; i--) {
1558 var point = points[i];
1559 var node = clusterDb[edge.fromCluster].node;
1560
1561 if (!outsideNode(node, point) && !_isInside) {
1562 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('inside', edge.fromCluster, point, node); // First point inside the rect
1563
1564 var insterection = intersection(node, _lastPointOutside, point); // logger.trace('intersect', intersection(node, lastPointOutside, point));
1565
1566 updatedPoints.unshift(insterection); // points.push(insterection);
1567
1568 _isInside = true;
1569 } else {
1570 // at the outside
1571 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Outside point', point);
1572 if (!_isInside) updatedPoints.unshift(point);
1573 }
1574
1575 _lastPointOutside = point;
1576 }
1577
1578 points = updatedPoints;
1579 pointsHasChanged = true;
1580 } // The data for our line
1581
1582
1583 var lineData = points.filter(function (p) {
1584 return !Number.isNaN(p.y);
1585 }); // This is the accessor function we talked about above
1586
1587 var lineFunction = Object(d3__WEBPACK_IMPORTED_MODULE_2__["line"])().x(function (d) {
1588 return d.x;
1589 }).y(function (d) {
1590 return d.y;
1591 }).curve(d3__WEBPACK_IMPORTED_MODULE_2__["curveBasis"]); // Contruct stroke classes based on properties
1592
1593 var strokeClasses;
1594
1595 switch (edge.thickness) {
1596 case 'normal':
1597 strokeClasses = 'edge-thickness-normal';
1598 break;
1599
1600 case 'thick':
1601 strokeClasses = 'edge-thickness-thick';
1602 break;
1603
1604 default:
1605 strokeClasses = '';
1606 }
1607
1608 switch (edge.pattern) {
1609 case 'solid':
1610 strokeClasses += ' edge-pattern-solid';
1611 break;
1612
1613 case 'dotted':
1614 strokeClasses += ' edge-pattern-dotted';
1615 break;
1616
1617 case 'dashed':
1618 strokeClasses += ' edge-pattern-dashed';
1619 break;
1620 }
1621
1622 var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', edge.id).attr('class', ' ' + strokeClasses + (edge.classes ? ' ' + edge.classes : '')).attr('style', edge.style); // DEBUG code, adds a red circle at each edge coordinate
1623 // edge.points.forEach(point => {
1624 // elem
1625 // .append('circle')
1626 // .style('stroke', 'red')
1627 // .style('fill', 'red')
1628 // .attr('r', 1)
1629 // .attr('cx', point.x)
1630 // .attr('cy', point.y);
1631 // });
1632
1633 var url = '';
1634
1635 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().state.arrowMarkerAbsolute) {
1636 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
1637 url = url.replace(/\(/g, '\\(');
1638 url = url.replace(/\)/g, '\\)');
1639 }
1640
1641 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('arrowTypeStart', edge.arrowTypeStart);
1642 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('arrowTypeEnd', edge.arrowTypeEnd);
1643
1644 switch (edge.arrowTypeStart) {
1645 case 'arrow_cross':
1646 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-crossStart' + ')');
1647 break;
1648
1649 case 'arrow_point':
1650 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-pointStart' + ')');
1651 break;
1652
1653 case 'arrow_barb':
1654 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-barbStart' + ')');
1655 break;
1656
1657 case 'arrow_circle':
1658 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-circleStart' + ')');
1659 break;
1660
1661 case 'aggregation':
1662 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-aggregationStart' + ')');
1663 break;
1664
1665 case 'extension':
1666 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-extensionStart' + ')');
1667 break;
1668
1669 case 'composition':
1670 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-compositionStart' + ')');
1671 break;
1672
1673 case 'dependency':
1674 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-dependencyStart' + ')');
1675 break;
1676
1677 default:
1678 }
1679
1680 switch (edge.arrowTypeEnd) {
1681 case 'arrow_cross':
1682 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-crossEnd' + ')');
1683 break;
1684
1685 case 'arrow_point':
1686 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-pointEnd' + ')');
1687 break;
1688
1689 case 'arrow_barb':
1690 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-barbEnd' + ')');
1691 break;
1692
1693 case 'arrow_circle':
1694 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-circleEnd' + ')');
1695 break;
1696
1697 case 'aggregation':
1698 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-aggregationEnd' + ')');
1699 break;
1700
1701 case 'extension':
1702 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-extensionEnd' + ')');
1703 break;
1704
1705 case 'composition':
1706 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-compositionEnd' + ')');
1707 break;
1708
1709 case 'dependency':
1710 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-dependencyEnd' + ')');
1711 break;
1712
1713 default:
1714 }
1715
1716 var paths = {};
1717
1718 if (pointsHasChanged) {
1719 paths.updatedPath = points;
1720 }
1721
1722 paths.originalPath = edge.points;
1723 return paths;
1724};
1725
1726/***/ }),
1727
1728/***/ "./src/dagre-wrapper/index.js":
1729/*!************************************!*\
1730 !*** ./src/dagre-wrapper/index.js ***!
1731 \************************************/
1732/*! exports provided: render */
1733/***/ (function(module, __webpack_exports__, __webpack_require__) {
1734
1735"use strict";
1736__webpack_require__.r(__webpack_exports__);
1737/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
1738/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dagre */ "dagre");
1739/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_0__);
1740/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphlib */ "graphlib");
1741/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_1__);
1742/* harmony import */ var _markers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./markers */ "./src/dagre-wrapper/markers.js");
1743/* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js");
1744/* harmony import */ var _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./mermaid-graphlib */ "./src/dagre-wrapper/mermaid-graphlib.js");
1745/* harmony import */ var _nodes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./nodes */ "./src/dagre-wrapper/nodes.js");
1746/* harmony import */ var _clusters__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./clusters */ "./src/dagre-wrapper/clusters.js");
1747/* harmony import */ var _edges__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./edges */ "./src/dagre-wrapper/edges.js");
1748/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759var recursiveRender = function recursiveRender(_elem, graph, diagramtype, parentCluster) {
1760 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Graph in recursive render: XXX', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph), parentCluster);
1761 var dir = graph.graph().rankdir;
1762 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].warn('Dir in recursive render - dir:', dir);
1763
1764 var elem = _elem.insert('g').attr('class', 'root'); // eslint-disable-line
1765
1766
1767 if (!graph.nodes()) {
1768 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('No nodes found for', graph);
1769 } else {
1770 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Recursive render XXX', graph.nodes());
1771 }
1772
1773 if (graph.edges().length > 0) {
1774 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Recursive edges', graph.edge(graph.edges()[0]));
1775 }
1776
1777 var clusters = elem.insert('g').attr('class', 'clusters'); // eslint-disable-line
1778
1779 var edgePaths = elem.insert('g').attr('class', 'edgePaths');
1780 var edgeLabels = elem.insert('g').attr('class', 'edgeLabels');
1781 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
1782 // to the abstract node and is later used by dagre for the layout
1783
1784 graph.nodes().forEach(function (v) {
1785 var node = graph.node(v);
1786
1787 if (typeof parentCluster !== 'undefined') {
1788 var data = JSON.parse(JSON.stringify(parentCluster.clusterData)); // data.clusterPositioning = true;
1789
1790 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Setting data for cluster XXX (', v, ') ', data, parentCluster);
1791 graph.setNode(parentCluster.id, data);
1792
1793 if (!graph.parent(v)) {
1794 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].warn('Setting parent', v, parentCluster.id);
1795 graph.setParent(v, parentCluster.id, data);
1796 }
1797 }
1798
1799 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('(Insert) Node XXX' + v + ': ' + JSON.stringify(graph.node(v)));
1800
1801 if (node && node.clusterNode) {
1802 // const children = graph.children(v);
1803 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Cluster identified', v, node, graph.node(v));
1804 var newEl = recursiveRender(nodes, node.graph, diagramtype, graph.node(v));
1805 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_3__["updateNodeBounds"])(node, newEl);
1806 Object(_nodes__WEBPACK_IMPORTED_MODULE_5__["setNodeElem"])(newEl, node);
1807 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].warn('Recursive render complete', newEl, node);
1808 } else {
1809 if (graph.children(v).length > 0) {
1810 // This is a cluster but not to be rendered recusively
1811 // Render as before
1812 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Cluster - the non recursive path XXX', v, node.id, node, graph);
1813 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info(Object(_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["findNonClusterChild"])(node.id, graph));
1814 _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["clusterDb"][node.id] = {
1815 id: Object(_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["findNonClusterChild"])(node.id, graph),
1816 node: node
1817 }; // insertCluster(clusters, graph.node(v));
1818 } else {
1819 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Node - the non recursive path', v, node.id, node);
1820 Object(_nodes__WEBPACK_IMPORTED_MODULE_5__["insertNode"])(nodes, graph.node(v), dir);
1821 }
1822 }
1823 }); // Insert labels, this will insert them into the dom so that the width can be calculated
1824 // Also figure out which edges point to/from clusters and adjust them accordingly
1825 // Edges from/to clusters really points to the first child in the cluster.
1826 // TODO: pick optimal child in the cluster to us as link anchor
1827
1828 graph.edges().forEach(function (e) {
1829 var edge = graph.edge(e.v, e.w, e.name);
1830 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
1831 _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
1832
1833 _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]);
1834 Object(_edges__WEBPACK_IMPORTED_MODULE_7__["insertEdgeLabel"])(edgeLabels, edge);
1835 });
1836 graph.edges().forEach(function (e) {
1837 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
1838 });
1839 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('#############################################');
1840 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('### Layout ###');
1841 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('#############################################');
1842 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info(graph);
1843 dagre__WEBPACK_IMPORTED_MODULE_0___default.a.layout(graph);
1844 _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
1845
1846 Object(_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["sortNodesByHierarchy"])(graph).forEach(function (v) {
1847 var node = graph.node(v);
1848 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Position ' + v + ': ' + JSON.stringify(graph.node(v)));
1849 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Position ' + v + ': (' + node.x, ',' + node.y, ') width: ', node.width, ' height: ', node.height);
1850
1851 if (node && node.clusterNode) {
1852 // clusterDb[node.id].node = node;
1853 Object(_nodes__WEBPACK_IMPORTED_MODULE_5__["positionNode"])(node);
1854 } else {
1855 // Non cluster node
1856 if (graph.children(v).length > 0) {
1857 // A cluster in the non-recurive way
1858 // positionCluster(node);
1859 Object(_clusters__WEBPACK_IMPORTED_MODULE_6__["insertCluster"])(clusters, node);
1860 _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["clusterDb"][node.id].node = node;
1861 } else {
1862 Object(_nodes__WEBPACK_IMPORTED_MODULE_5__["positionNode"])(node);
1863 }
1864 }
1865 }); // Move the edge labels to the correct place after layout
1866
1867 graph.edges().forEach(function (e) {
1868 var edge = graph.edge(e);
1869 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(edge), edge);
1870 var paths = Object(_edges__WEBPACK_IMPORTED_MODULE_7__["insertEdge"])(edgePaths, e, edge, _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["clusterDb"], diagramtype, graph);
1871 Object(_edges__WEBPACK_IMPORTED_MODULE_7__["positionEdgeLabel"])(edge, paths);
1872 });
1873 return elem;
1874};
1875
1876var render = function render(elem, graph, markers, diagramtype, id) {
1877 Object(_markers__WEBPACK_IMPORTED_MODULE_2__["default"])(elem, markers, diagramtype, id);
1878 Object(_nodes__WEBPACK_IMPORTED_MODULE_5__["clear"])();
1879 Object(_edges__WEBPACK_IMPORTED_MODULE_7__["clear"])();
1880 Object(_clusters__WEBPACK_IMPORTED_MODULE_6__["clear"])();
1881 Object(_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["clear"])();
1882 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].warn('Graph at first:', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph));
1883 Object(_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_4__["adjustClustersAndEdges"])(graph);
1884 _logger__WEBPACK_IMPORTED_MODULE_8__["logger"].warn('Graph after:', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph)); // log.warn('Graph ever after:', graphlib.json.write(graph.node('A').graph));
1885
1886 recursiveRender(elem, graph, diagramtype);
1887}; // const shapeDefinitions = {};
1888// export const addShape = ({ shapeType: fun }) => {
1889// shapeDefinitions[shapeType] = fun;
1890// };
1891// const arrowDefinitions = {};
1892// export const addArrow = ({ arrowType: fun }) => {
1893// arrowDefinitions[arrowType] = fun;
1894// };
1895
1896/***/ }),
1897
1898/***/ "./src/dagre-wrapper/intersect/index.js":
1899/*!**********************************************!*\
1900 !*** ./src/dagre-wrapper/intersect/index.js ***!
1901 \**********************************************/
1902/*! exports provided: default */
1903/***/ (function(module, __webpack_exports__, __webpack_require__) {
1904
1905"use strict";
1906__webpack_require__.r(__webpack_exports__);
1907/* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-node.js */ "./src/dagre-wrapper/intersect/intersect-node.js");
1908/* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_intersect_node_js__WEBPACK_IMPORTED_MODULE_0__);
1909/* harmony import */ var _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./intersect-circle.js */ "./src/dagre-wrapper/intersect/intersect-circle.js");
1910/* harmony import */ var _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intersect-ellipse.js */ "./src/dagre-wrapper/intersect/intersect-ellipse.js");
1911/* harmony import */ var _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intersect-polygon.js */ "./src/dagre-wrapper/intersect/intersect-polygon.js");
1912/* harmony import */ var _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./intersect-rect.js */ "./src/dagre-wrapper/intersect/intersect-rect.js");
1913/*
1914 * Borrowed with love from from dagrge-d3. Many thanks to cpettitt!
1915 */
1916
1917
1918
1919
1920
1921/* harmony default export */ __webpack_exports__["default"] = ({
1922 node: _intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default.a,
1923 circle: _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__["default"],
1924 ellipse: _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__["default"],
1925 polygon: _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__["default"],
1926 rect: _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__["default"]
1927});
1928
1929/***/ }),
1930
1931/***/ "./src/dagre-wrapper/intersect/intersect-circle.js":
1932/*!*********************************************************!*\
1933 !*** ./src/dagre-wrapper/intersect/intersect-circle.js ***!
1934 \*********************************************************/
1935/*! exports provided: default */
1936/***/ (function(module, __webpack_exports__, __webpack_require__) {
1937
1938"use strict";
1939__webpack_require__.r(__webpack_exports__);
1940/* harmony import */ var _intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-ellipse */ "./src/dagre-wrapper/intersect/intersect-ellipse.js");
1941
1942
1943function intersectCircle(node, rx, point) {
1944 return Object(_intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__["default"])(node, rx, rx, point);
1945}
1946
1947/* harmony default export */ __webpack_exports__["default"] = (intersectCircle);
1948
1949/***/ }),
1950
1951/***/ "./src/dagre-wrapper/intersect/intersect-ellipse.js":
1952/*!**********************************************************!*\
1953 !*** ./src/dagre-wrapper/intersect/intersect-ellipse.js ***!
1954 \**********************************************************/
1955/*! exports provided: default */
1956/***/ (function(module, __webpack_exports__, __webpack_require__) {
1957
1958"use strict";
1959__webpack_require__.r(__webpack_exports__);
1960function intersectEllipse(node, rx, ry, point) {
1961 // Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html
1962 var cx = node.x;
1963 var cy = node.y;
1964 var px = cx - point.x;
1965 var py = cy - point.y;
1966 var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
1967 var dx = Math.abs(rx * ry * px / det);
1968
1969 if (point.x < cx) {
1970 dx = -dx;
1971 }
1972
1973 var dy = Math.abs(rx * ry * py / det);
1974
1975 if (point.y < cy) {
1976 dy = -dy;
1977 }
1978
1979 return {
1980 x: cx + dx,
1981 y: cy + dy
1982 };
1983}
1984
1985/* harmony default export */ __webpack_exports__["default"] = (intersectEllipse);
1986
1987/***/ }),
1988
1989/***/ "./src/dagre-wrapper/intersect/intersect-line.js":
1990/*!*******************************************************!*\
1991 !*** ./src/dagre-wrapper/intersect/intersect-line.js ***!
1992 \*******************************************************/
1993/*! exports provided: default */
1994/***/ (function(module, __webpack_exports__, __webpack_require__) {
1995
1996"use strict";
1997__webpack_require__.r(__webpack_exports__);
1998/*
1999 * Returns the point at which two lines, p and q, intersect or returns
2000 * undefined if they do not intersect.
2001 */
2002function intersectLine(p1, p2, q1, q2) {
2003 // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
2004 // p7 and p473.
2005 var a1, a2, b1, b2, c1, c2;
2006 var r1, r2, r3, r4;
2007 var denom, offset, num;
2008 var x, y; // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +
2009 // b1 y + c1 = 0.
2010
2011 a1 = p2.y - p1.y;
2012 b1 = p1.x - p2.x;
2013 c1 = p2.x * p1.y - p1.x * p2.y; // Compute r3 and r4.
2014
2015 r3 = a1 * q1.x + b1 * q1.y + c1;
2016 r4 = a1 * q2.x + b1 * q2.y + c1; // Check signs of r3 and r4. If both point 3 and point 4 lie on
2017 // same side of line 1, the line segments do not intersect.
2018
2019 if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
2020 return;
2021 } // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0
2022
2023
2024 a2 = q2.y - q1.y;
2025 b2 = q1.x - q2.x;
2026 c2 = q2.x * q1.y - q1.x * q2.y; // Compute r1 and r2
2027
2028 r1 = a2 * p1.x + b2 * p1.y + c2;
2029 r2 = a2 * p2.x + b2 * p2.y + c2; // Check signs of r1 and r2. If both point 1 and point 2 lie
2030 // on same side of second line segment, the line segments do
2031 // not intersect.
2032
2033 if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
2034 return;
2035 } // Line segments intersect: compute intersection point.
2036
2037
2038 denom = a1 * b2 - a2 * b1;
2039
2040 if (denom === 0) {
2041 return;
2042 }
2043
2044 offset = Math.abs(denom / 2); // The denom/2 is to get rounding instead of truncating. It
2045 // is added or subtracted to the numerator, depending upon the
2046 // sign of the numerator.
2047
2048 num = b1 * c2 - b2 * c1;
2049 x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
2050 num = a2 * c1 - a1 * c2;
2051 y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
2052 return {
2053 x: x,
2054 y: y
2055 };
2056}
2057
2058function sameSign(r1, r2) {
2059 return r1 * r2 > 0;
2060}
2061
2062/* harmony default export */ __webpack_exports__["default"] = (intersectLine);
2063
2064/***/ }),
2065
2066/***/ "./src/dagre-wrapper/intersect/intersect-node.js":
2067/*!*******************************************************!*\
2068 !*** ./src/dagre-wrapper/intersect/intersect-node.js ***!
2069 \*******************************************************/
2070/*! no static exports found */
2071/***/ (function(module, exports) {
2072
2073module.exports = intersectNode;
2074
2075function intersectNode(node, point) {
2076 // console.info('Intersect Node');
2077 return node.intersect(point);
2078}
2079
2080/***/ }),
2081
2082/***/ "./src/dagre-wrapper/intersect/intersect-polygon.js":
2083/*!**********************************************************!*\
2084 !*** ./src/dagre-wrapper/intersect/intersect-polygon.js ***!
2085 \**********************************************************/
2086/*! exports provided: default */
2087/***/ (function(module, __webpack_exports__, __webpack_require__) {
2088
2089"use strict";
2090__webpack_require__.r(__webpack_exports__);
2091/* harmony import */ var _intersect_line__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-line */ "./src/dagre-wrapper/intersect/intersect-line.js");
2092/* eslint "no-console": off */
2093
2094/* harmony default export */ __webpack_exports__["default"] = (intersectPolygon);
2095/*
2096 * Returns the point ({x, y}) at which the point argument intersects with the
2097 * node argument assuming that it has the shape specified by polygon.
2098 */
2099
2100function intersectPolygon(node, polyPoints, point) {
2101 var x1 = node.x;
2102 var y1 = node.y;
2103 var intersections = [];
2104 var minX = Number.POSITIVE_INFINITY;
2105 var minY = Number.POSITIVE_INFINITY;
2106
2107 if (typeof polyPoints.forEach === 'function') {
2108 polyPoints.forEach(function (entry) {
2109 minX = Math.min(minX, entry.x);
2110 minY = Math.min(minY, entry.y);
2111 });
2112 } else {
2113 minX = Math.min(minX, polyPoints.x);
2114 minY = Math.min(minY, polyPoints.y);
2115 }
2116
2117 var left = x1 - node.width / 2 - minX;
2118 var top = y1 - node.height / 2 - minY;
2119
2120 for (var i = 0; i < polyPoints.length; i++) {
2121 var p1 = polyPoints[i];
2122 var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
2123 var intersect = Object(_intersect_line__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point, {
2124 x: left + p1.x,
2125 y: top + p1.y
2126 }, {
2127 x: left + p2.x,
2128 y: top + p2.y
2129 });
2130
2131 if (intersect) {
2132 intersections.push(intersect);
2133 }
2134 }
2135
2136 if (!intersections.length) {
2137 // console.log('NO INTERSECTION FOUND, RETURN NODE CENTER', node);
2138 return node;
2139 }
2140
2141 if (intersections.length > 1) {
2142 // More intersections, find the one nearest to edge end point
2143 intersections.sort(function (p, q) {
2144 var pdx = p.x - point.x;
2145 var pdy = p.y - point.y;
2146 var distp = Math.sqrt(pdx * pdx + pdy * pdy);
2147 var qdx = q.x - point.x;
2148 var qdy = q.y - point.y;
2149 var distq = Math.sqrt(qdx * qdx + qdy * qdy);
2150 return distp < distq ? -1 : distp === distq ? 0 : 1;
2151 });
2152 }
2153
2154 return intersections[0];
2155}
2156
2157/***/ }),
2158
2159/***/ "./src/dagre-wrapper/intersect/intersect-rect.js":
2160/*!*******************************************************!*\
2161 !*** ./src/dagre-wrapper/intersect/intersect-rect.js ***!
2162 \*******************************************************/
2163/*! exports provided: default */
2164/***/ (function(module, __webpack_exports__, __webpack_require__) {
2165
2166"use strict";
2167__webpack_require__.r(__webpack_exports__);
2168var intersectRect = function intersectRect(node, point) {
2169 var x = node.x;
2170 var y = node.y; // Rectangle intersection algorithm from:
2171 // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
2172
2173 var dx = point.x - x;
2174 var dy = point.y - y;
2175 var w = node.width / 2;
2176 var h = node.height / 2;
2177 var sx, sy;
2178
2179 if (Math.abs(dy) * w > Math.abs(dx) * h) {
2180 // Intersection is top or bottom of rect.
2181 if (dy < 0) {
2182 h = -h;
2183 }
2184
2185 sx = dy === 0 ? 0 : h * dx / dy;
2186 sy = h;
2187 } else {
2188 // Intersection is left or right of rect.
2189 if (dx < 0) {
2190 w = -w;
2191 }
2192
2193 sx = w;
2194 sy = dx === 0 ? 0 : w * dy / dx;
2195 }
2196
2197 return {
2198 x: x + sx,
2199 y: y + sy
2200 };
2201};
2202
2203/* harmony default export */ __webpack_exports__["default"] = (intersectRect);
2204
2205/***/ }),
2206
2207/***/ "./src/dagre-wrapper/markers.js":
2208/*!**************************************!*\
2209 !*** ./src/dagre-wrapper/markers.js ***!
2210 \**************************************/
2211/*! exports provided: default */
2212/***/ (function(module, __webpack_exports__, __webpack_require__) {
2213
2214"use strict";
2215__webpack_require__.r(__webpack_exports__);
2216/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
2217/**
2218 * Setup arrow head and define the marker. The result is appended to the svg.
2219 */
2220 // Only add the number of markers that the diagram needs
2221
2222var insertMarkers = function insertMarkers(elem, markerArray, type, id) {
2223 markerArray.forEach(function (markerName) {
2224 markers[markerName](elem, type, id);
2225 });
2226};
2227
2228var extension = function extension(elem, type, id) {
2229 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Making markers for ', id);
2230 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');
2231 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
2232};
2233
2234var composition = function composition(elem, type) {
2235 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');
2236 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');
2237};
2238
2239var aggregation = function aggregation(elem, type) {
2240 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');
2241 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');
2242};
2243
2244var dependency = function dependency(elem, type) {
2245 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');
2246 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');
2247};
2248
2249var point = function point(elem, type) {
2250 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');
2251 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');
2252};
2253
2254var circle = function circle(elem, type) {
2255 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');
2256 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');
2257};
2258
2259var cross = function cross(elem, type) {
2260 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')
2261 .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');
2262 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')
2263 .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');
2264};
2265
2266var barb = function barb(elem, type) {
2267 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');
2268}; // TODO rename the class diagram markers to something shape descriptive and semanitc free
2269
2270
2271var markers = {
2272 extension: extension,
2273 composition: composition,
2274 aggregation: aggregation,
2275 dependency: dependency,
2276 point: point,
2277 circle: circle,
2278 cross: cross,
2279 barb: barb
2280};
2281/* harmony default export */ __webpack_exports__["default"] = (insertMarkers);
2282
2283/***/ }),
2284
2285/***/ "./src/dagre-wrapper/mermaid-graphlib.js":
2286/*!***********************************************!*\
2287 !*** ./src/dagre-wrapper/mermaid-graphlib.js ***!
2288 \***********************************************/
2289/*! exports provided: clusterDb, clear, extractDecendants, validate, findNonClusterChild, adjustClustersAndEdges, extractor, sortNodesByHierarchy */
2290/***/ (function(module, __webpack_exports__, __webpack_require__) {
2291
2292"use strict";
2293__webpack_require__.r(__webpack_exports__);
2294/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clusterDb", function() { return clusterDb; });
2295/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
2296/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractDecendants", function() { return extractDecendants; });
2297/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validate", function() { return validate; });
2298/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findNonClusterChild", function() { return findNonClusterChild; });
2299/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "adjustClustersAndEdges", function() { return adjustClustersAndEdges; });
2300/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractor", function() { return extractor; });
2301/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sortNodesByHierarchy", function() { return sortNodesByHierarchy; });
2302/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
2303/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphlib */ "graphlib");
2304/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_1__);
2305/**
2306 * Decorates with functions required by mermaids dagre-wrapper.
2307 */
2308
2309
2310var clusterDb = {};
2311var decendants = {};
2312var parents = {};
2313var clear = function clear() {
2314 decendants = {};
2315 parents = {};
2316 clusterDb = {};
2317};
2318
2319var isDecendant = function isDecendant(id, ancenstorId) {
2320 // if (id === ancenstorId) return true;
2321 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('In isDecendant', ancenstorId, ' ', id, ' = ', decendants[ancenstorId].indexOf(id) >= 0);
2322 if (decendants[ancenstorId].indexOf(id) >= 0) return true;
2323 return false;
2324};
2325
2326var edgeInCluster = function edgeInCluster(edge, clusterId) {
2327 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Decendants of ', clusterId, ' is ', decendants[clusterId]);
2328 _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
2329
2330 if (edge.v === clusterId) return false;
2331 if (edge.w === clusterId) return false;
2332
2333 if (!decendants[clusterId]) {
2334 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Tilt, ', clusterId, ',not in decendants');
2335 return false;
2336 }
2337
2338 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Here ');
2339 if (decendants[clusterId].indexOf(edge.v) >= 0) return true;
2340 if (isDecendant(edge.v, clusterId)) return true;
2341 if (isDecendant(edge.w, clusterId)) return true;
2342 if (decendants[clusterId].indexOf(edge.w) >= 0) return true;
2343 return false;
2344};
2345
2346var copy = function copy(clusterId, graph, newGraph, rootId) {
2347 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Copying children of ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);
2348 var nodes = graph.children(clusterId) || []; // Include cluster node if it is not the root
2349
2350 if (clusterId !== rootId) {
2351 nodes.push(clusterId);
2352 }
2353
2354 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Copying (nodes) clusterId', clusterId, 'nodes', nodes);
2355 nodes.forEach(function (node) {
2356 if (graph.children(node).length > 0) {
2357 copy(node, graph, newGraph, rootId);
2358 } else {
2359 var data = graph.node(node);
2360 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('cp ', node, ' to ', rootId, ' with parent ', clusterId); //,node, data, ' parent is ', clusterId);
2361
2362 newGraph.setNode(node, data);
2363
2364 if (rootId !== graph.parent(node)) {
2365 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Setting parent', node, graph.parent(node));
2366 newGraph.setParent(node, graph.parent(node));
2367 }
2368
2369 if (clusterId !== rootId && node !== clusterId) {
2370 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Setting parent', node, clusterId);
2371 newGraph.setParent(node, clusterId);
2372 } else {
2373 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('In copy ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);
2374 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Not Setting parent for node=', node, 'cluster!==rootId', clusterId !== rootId, 'node!==clusterId', node !== clusterId);
2375 }
2376
2377 var edges = graph.edges(node);
2378 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Copying Edges', edges);
2379 edges.forEach(function (edge) {
2380 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Edge', edge);
2381 var data = graph.edge(edge.v, edge.w, edge.name);
2382 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Edge data', data, rootId);
2383
2384 try {
2385 // Do not copy edges in and out of the root cluster, they belong to the parent graph
2386 if (edgeInCluster(edge, rootId)) {
2387 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Copying as ', edge.v, edge.w, data, edge.name);
2388 newGraph.setEdge(edge.v, edge.w, data, edge.name);
2389 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('newGraph edges ', newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
2390 } else {
2391 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Skipping copy of edge ', edge.v, '-->', edge.w, ' rootId: ', rootId, ' clusterId:', clusterId);
2392 }
2393 } catch (e) {
2394 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].error(e);
2395 }
2396 });
2397 }
2398
2399 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Removing node', node);
2400 graph.removeNode(node);
2401 });
2402};
2403
2404var extractDecendants = function extractDecendants(id, graph) {
2405 // log.debug('Extracting ', id);
2406 var children = graph.children(id);
2407 var res = [].concat(children);
2408
2409 for (var i = 0; i < children.length; i++) {
2410 parents[children[i]] = id;
2411 res = res.concat(extractDecendants(children[i], graph));
2412 }
2413
2414 return res;
2415};
2416/**
2417 * Validates the graph, checking that all parent child relation points to existing nodes and that
2418 * edges between nodes also ia correct. When not correct the function logs the discrepancies.
2419 * @param {graphlib graph} g
2420 */
2421
2422var validate = function validate(graph) {
2423 var edges = graph.edges();
2424 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Edges: ', edges);
2425
2426 for (var i = 0; i < edges.length; i++) {
2427 if (graph.children(edges[i].v).length > 0) {
2428 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('The node ', edges[i].v, ' is part of and edge even though it has children');
2429 return false;
2430 }
2431
2432 if (graph.children(edges[i].w).length > 0) {
2433 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('The node ', edges[i].w, ' is part of and edge even though it has children');
2434 return false;
2435 }
2436 }
2437
2438 return true;
2439};
2440/**
2441 * Finds a child that is not a cluster. When faking a edge between a node and a cluster.
2442 * @param {Finds a } id
2443 * @param {*} graph
2444 */
2445
2446var findNonClusterChild = function findNonClusterChild(id, graph) {
2447 // const node = graph.node(id);
2448 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Searching', id); // const children = graph.children(id).reverse();
2449
2450 var children = graph.children(id); //.reverse();
2451
2452 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Searching children of id ', id, children);
2453
2454 if (children.length < 1) {
2455 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('This is a valid node', id);
2456 return id;
2457 }
2458
2459 for (var i = 0; i < children.length; i++) {
2460 var _id = findNonClusterChild(children[i], graph);
2461
2462 if (_id) {
2463 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace('Found replacement for', id, ' => ', _id);
2464 return _id;
2465 }
2466 }
2467};
2468
2469var getAnchorId = function getAnchorId(id) {
2470 if (!clusterDb[id]) {
2471 return id;
2472 } // If the cluster has no external connections
2473
2474
2475 if (!clusterDb[id].externalConnections) {
2476 return id;
2477 } // Return the replacement node
2478
2479
2480 if (clusterDb[id]) {
2481 return clusterDb[id].id;
2482 }
2483
2484 return id;
2485};
2486
2487var adjustClustersAndEdges = function adjustClustersAndEdges(graph, depth) {
2488 if (!graph || depth > 10) {
2489 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Opting out, no graph ');
2490 return;
2491 } else {
2492 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Opting in, graph ');
2493 } // Go through the nodes and for each cluster found, save a replacment node, this can be used when
2494 // faking a link to a cluster
2495
2496
2497 graph.nodes().forEach(function (id) {
2498 var children = graph.children(id);
2499
2500 if (children.length > 0) {
2501 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Cluster identified', id, ' Replacement id in edges: ', findNonClusterChild(id, graph));
2502 decendants[id] = extractDecendants(id, graph);
2503 clusterDb[id] = {
2504 id: findNonClusterChild(id, graph),
2505 clusterData: graph.node(id)
2506 };
2507 }
2508 }); // Check incoming and outgoing edges for each cluster
2509
2510 graph.nodes().forEach(function (id) {
2511 var children = graph.children(id);
2512 var edges = graph.edges();
2513
2514 if (children.length > 0) {
2515 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Cluster identified', id, decendants);
2516 edges.forEach(function (edge) {
2517 // log.debug('Edge, decendants: ', edge, decendants[id]);
2518 // Check if any edge leaves the cluster (not the actual cluster, thats a link from the box)
2519 if (edge.v !== id && edge.w !== id) {
2520 // Any edge where either the one of the nodes is decending to the cluster but not the other
2521 // if (decendants[id].indexOf(edge.v) < 0 && decendants[id].indexOf(edge.w) < 0) {
2522 var d1 = isDecendant(edge.v, id);
2523 var d2 = isDecendant(edge.w, id); // d1 xor d2 - if either d1 is true and d2 is false or the other way around
2524
2525 if (d1 ^ d2) {
2526 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Edge: ', edge, ' leaves cluster ', id);
2527 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Decendants of XXX ', id, ': ', decendants[id]);
2528 clusterDb[id].externalConnections = true;
2529 }
2530 }
2531 });
2532 } else {
2533 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Not a cluster ', id, decendants);
2534 }
2535 }); // For clusters with incoming and/or outgoing edges translate those edges to a real node
2536 // in the cluster inorder to fake the edge
2537
2538 graph.edges().forEach(function (e) {
2539 var edge = graph.edge(e);
2540 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
2541 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
2542 var v = e.v;
2543 var w = e.w; // Check if link is either from or to a cluster
2544
2545 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Fix XXX', clusterDb, 'ids:', e.v, e.w, 'Translateing: ', clusterDb[e.v], ' --- ', clusterDb[e.w]);
2546
2547 if (clusterDb[e.v] || clusterDb[e.w]) {
2548 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Fixing and trixing - removing XXX', e.v, e.w, e.name);
2549 v = getAnchorId(e.v);
2550 w = getAnchorId(e.w);
2551 graph.removeEdge(e.v, e.w, e.name);
2552 if (v !== e.v) edge.fromCluster = e.v;
2553 if (w !== e.w) edge.toCluster = e.w;
2554 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Fix Replacing with XXX', v, w, e.name);
2555 graph.setEdge(v, w, edge, e.name);
2556 }
2557 });
2558 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Adjusted Graph', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph));
2559 extractor(graph, 0);
2560 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].trace(clusterDb); // Remove references to extracted cluster
2561 // graph.edges().forEach(edge => {
2562 // if (isDecendant(edge.v, clusterId) || isDecendant(edge.w, clusterId)) {
2563 // graph.removeEdge(edge);
2564 // }
2565 // });
2566};
2567var extractor = function extractor(graph, depth) {
2568 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('extractor - ', depth, graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph), graph.children('D'));
2569
2570 if (depth > 10) {
2571 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].error('Bailing out');
2572 return;
2573 } // For clusters without incoming and/or outgoing edges, create a new cluster-node
2574 // containing the nodes and edges in the custer in a new graph
2575 // for (let i = 0;)
2576
2577
2578 var nodes = graph.nodes();
2579 var hasChildren = false;
2580
2581 for (var i = 0; i < nodes.length; i++) {
2582 var node = nodes[i];
2583 var children = graph.children(node);
2584 hasChildren = hasChildren || children.length > 0;
2585 }
2586
2587 if (!hasChildren) {
2588 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Done, no node has children', graph.nodes());
2589 return;
2590 } // const clusters = Object.keys(clusterDb);
2591 // clusters.forEach(clusterId => {
2592
2593
2594 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Nodes = ', nodes, depth);
2595
2596 for (var _i = 0; _i < nodes.length; _i++) {
2597 var _node = nodes[_i];
2598 _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
2599 // that it still is in the game
2600
2601 if (!clusterDb[_node]) {
2602 // Skip if the node is not a cluster
2603 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Not a cluster', _node, depth); // break;
2604 } else if (!clusterDb[_node].externalConnections && // !graph.parent(node) &&
2605 graph.children(_node) && graph.children(_node).length > 0) {
2606 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Cluster without external connections, without a parent and with children', _node, depth);
2607 var graphSettings = graph.graph();
2608 var clusterGraph = new graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.Graph({
2609 multigraph: true,
2610 compound: true
2611 }).setGraph({
2612 rankdir: graphSettings.rankdir === 'TB' ? 'LR' : 'TB',
2613 // Todo: set proper spacing
2614 nodesep: 50,
2615 ranksep: 50,
2616 marginx: 8,
2617 marginy: 8
2618 }).setDefaultEdgeLabel(function () {
2619 return {};
2620 });
2621 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('Old graph before copy', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph));
2622 copy(_node, graph, clusterGraph, _node);
2623 graph.setNode(_node, {
2624 clusterNode: true,
2625 id: _node,
2626 clusterData: clusterDb[_node].clusterData,
2627 labelText: clusterDb[_node].labelText,
2628 graph: clusterGraph
2629 });
2630 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('New graph after copy node: (', _node, ')', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(clusterGraph));
2631 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Old graph after copy', graphlib__WEBPACK_IMPORTED_MODULE_1___default.a.json.write(graph));
2632 } else {
2633 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('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);
2634 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(clusterDb);
2635 }
2636 }
2637
2638 nodes = graph.nodes();
2639 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn('New list of nodes', nodes);
2640
2641 for (var _i2 = 0; _i2 < nodes.length; _i2++) {
2642 var _node2 = nodes[_i2];
2643 var data = graph.node(_node2);
2644 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].warn(' Now next level', _node2, data);
2645
2646 if (data.clusterNode) {
2647 extractor(data.graph, depth + 1);
2648 }
2649 }
2650};
2651
2652var sorter = function sorter(graph, nodes) {
2653 if (nodes.length === 0) return [];
2654 var result = Object.assign(nodes);
2655 nodes.forEach(function (node) {
2656 var children = graph.children(node);
2657 var sorted = sorter(graph, children);
2658 result = result.concat(sorted);
2659 });
2660 return result;
2661};
2662
2663var sortNodesByHierarchy = function sortNodesByHierarchy(graph) {
2664 return sorter(graph, graph.children());
2665};
2666
2667/***/ }),
2668
2669/***/ "./src/dagre-wrapper/nodes.js":
2670/*!************************************!*\
2671 !*** ./src/dagre-wrapper/nodes.js ***!
2672 \************************************/
2673/*! exports provided: insertNode, setNodeElem, clear, positionNode */
2674/***/ (function(module, __webpack_exports__, __webpack_require__) {
2675
2676"use strict";
2677__webpack_require__.r(__webpack_exports__);
2678/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertNode", function() { return insertNode; });
2679/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setNodeElem", function() { return setNodeElem; });
2680/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
2681/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionNode", function() { return positionNode; });
2682/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
2683/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
2684/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
2685/* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js");
2686/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../config */ "./src/config.js");
2687/* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./intersect/index.js */ "./src/dagre-wrapper/intersect/index.js");
2688/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
2689/* harmony import */ var _shapes_note__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./shapes/note */ "./src/dagre-wrapper/shapes/note.js");
2690/* harmony import */ var _diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../diagrams/class/svgDraw */ "./src/diagrams/class/svgDraw.js");
2691
2692 // eslint-disable-line
2693
2694
2695
2696
2697
2698
2699
2700
2701var question = function question(parent, node) {
2702 var _labelHelper = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2703 shapeSvg = _labelHelper.shapeSvg,
2704 bbox = _labelHelper.bbox;
2705
2706 var w = bbox.width + node.padding;
2707 var h = bbox.height + node.padding;
2708 var s = w + h;
2709 var points = [{
2710 x: s / 2,
2711 y: 0
2712 }, {
2713 x: s,
2714 y: -s / 2
2715 }, {
2716 x: s / 2,
2717 y: -s
2718 }, {
2719 x: 0,
2720 y: -s / 2
2721 }];
2722 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Question main (Circle)');
2723 var questionElem = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, s, s, points);
2724 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, questionElem);
2725
2726 node.intersect = function (point) {
2727 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].warn('Intersect called');
2728 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, points, point);
2729 };
2730
2731 return shapeSvg;
2732};
2733
2734var hexagon = function hexagon(parent, node) {
2735 var _labelHelper2 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2736 shapeSvg = _labelHelper2.shapeSvg,
2737 bbox = _labelHelper2.bbox;
2738
2739 var f = 4;
2740 var h = bbox.height + node.padding;
2741 var m = h / f;
2742 var w = bbox.width + 2 * m + node.padding;
2743 var points = [{
2744 x: m,
2745 y: 0
2746 }, {
2747 x: w - m,
2748 y: 0
2749 }, {
2750 x: w,
2751 y: -h / 2
2752 }, {
2753 x: w - m,
2754 y: -h
2755 }, {
2756 x: m,
2757 y: -h
2758 }, {
2759 x: 0,
2760 y: -h / 2
2761 }];
2762 var hex = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2763 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, hex);
2764
2765 node.intersect = function (point) {
2766 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2767 };
2768
2769 return shapeSvg;
2770};
2771
2772var rect_left_inv_arrow = function rect_left_inv_arrow(parent, node) {
2773 var _labelHelper3 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2774 shapeSvg = _labelHelper3.shapeSvg,
2775 bbox = _labelHelper3.bbox;
2776
2777 var w = bbox.width + node.padding;
2778 var h = bbox.height + node.padding;
2779 var points = [{
2780 x: -h / 2,
2781 y: 0
2782 }, {
2783 x: w,
2784 y: 0
2785 }, {
2786 x: w,
2787 y: -h
2788 }, {
2789 x: -h / 2,
2790 y: -h
2791 }, {
2792 x: 0,
2793 y: -h / 2
2794 }];
2795 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2796 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2797
2798 node.intersect = function (point) {
2799 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2800 };
2801
2802 return shapeSvg;
2803};
2804
2805var lean_right = function lean_right(parent, node) {
2806 var _labelHelper4 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2807 shapeSvg = _labelHelper4.shapeSvg,
2808 bbox = _labelHelper4.bbox;
2809
2810 var w = bbox.width + node.padding;
2811 var h = bbox.height + node.padding;
2812 var points = [{
2813 x: -2 * h / 6,
2814 y: 0
2815 }, {
2816 x: w - h / 6,
2817 y: 0
2818 }, {
2819 x: w + 2 * h / 6,
2820 y: -h
2821 }, {
2822 x: h / 6,
2823 y: -h
2824 }];
2825 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2826 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2827
2828 node.intersect = function (point) {
2829 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2830 };
2831
2832 return shapeSvg;
2833};
2834
2835var lean_left = function lean_left(parent, node) {
2836 var _labelHelper5 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2837 shapeSvg = _labelHelper5.shapeSvg,
2838 bbox = _labelHelper5.bbox;
2839
2840 var w = bbox.width + node.padding;
2841 var h = bbox.height + node.padding;
2842 var points = [{
2843 x: 2 * h / 6,
2844 y: 0
2845 }, {
2846 x: w + h / 6,
2847 y: 0
2848 }, {
2849 x: w - 2 * h / 6,
2850 y: -h
2851 }, {
2852 x: -h / 6,
2853 y: -h
2854 }];
2855 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2856 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2857
2858 node.intersect = function (point) {
2859 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2860 };
2861
2862 return shapeSvg;
2863};
2864
2865var trapezoid = function trapezoid(parent, node) {
2866 var _labelHelper6 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2867 shapeSvg = _labelHelper6.shapeSvg,
2868 bbox = _labelHelper6.bbox;
2869
2870 var w = bbox.width + node.padding;
2871 var h = bbox.height + node.padding;
2872 var points = [{
2873 x: -2 * h / 6,
2874 y: 0
2875 }, {
2876 x: w + 2 * h / 6,
2877 y: 0
2878 }, {
2879 x: w - h / 6,
2880 y: -h
2881 }, {
2882 x: h / 6,
2883 y: -h
2884 }];
2885 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2886 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2887
2888 node.intersect = function (point) {
2889 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2890 };
2891
2892 return shapeSvg;
2893};
2894
2895var inv_trapezoid = function inv_trapezoid(parent, node) {
2896 var _labelHelper7 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2897 shapeSvg = _labelHelper7.shapeSvg,
2898 bbox = _labelHelper7.bbox;
2899
2900 var w = bbox.width + node.padding;
2901 var h = bbox.height + node.padding;
2902 var points = [{
2903 x: h / 6,
2904 y: 0
2905 }, {
2906 x: w - h / 6,
2907 y: 0
2908 }, {
2909 x: w + 2 * h / 6,
2910 y: -h
2911 }, {
2912 x: -2 * h / 6,
2913 y: -h
2914 }];
2915 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2916 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2917
2918 node.intersect = function (point) {
2919 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2920 };
2921
2922 return shapeSvg;
2923};
2924
2925var rect_right_inv_arrow = function rect_right_inv_arrow(parent, node) {
2926 var _labelHelper8 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2927 shapeSvg = _labelHelper8.shapeSvg,
2928 bbox = _labelHelper8.bbox;
2929
2930 var w = bbox.width + node.padding;
2931 var h = bbox.height + node.padding;
2932 var points = [{
2933 x: 0,
2934 y: 0
2935 }, {
2936 x: w + h / 2,
2937 y: 0
2938 }, {
2939 x: w,
2940 y: -h / 2
2941 }, {
2942 x: w + h / 2,
2943 y: -h
2944 }, {
2945 x: 0,
2946 y: -h
2947 }];
2948 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
2949 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2950
2951 node.intersect = function (point) {
2952 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
2953 };
2954
2955 return shapeSvg;
2956};
2957
2958var cylinder = function cylinder(parent, node) {
2959 var _labelHelper9 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
2960 shapeSvg = _labelHelper9.shapeSvg,
2961 bbox = _labelHelper9.bbox;
2962
2963 var w = bbox.width + node.padding;
2964 var rx = w / 2;
2965 var ry = rx / (2.5 + w / 50);
2966 var h = bbox.height + ry + node.padding;
2967 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;
2968 var el = shapeSvg.attr('label-offset-y', ry).insert('path', ':first-child').attr('d', shape).attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');
2969 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
2970
2971 node.intersect = function (point) {
2972 var pos = _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
2973 var x = pos.x - node.x;
2974
2975 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)) {
2976 // ellipsis equation: x*x / a*a + y*y / b*b = 1
2977 // solve for y to get adjustion value for pos.y
2978 var y = ry * ry * (1 - x * x / (rx * rx));
2979 if (y != 0) y = Math.sqrt(y);
2980 y = ry - y;
2981 if (point.y - node.y > 0) y = -y;
2982 pos.y += y;
2983 }
2984
2985 return pos;
2986 };
2987
2988 return shapeSvg;
2989};
2990
2991var rect = function rect(parent, node) {
2992 var _labelHelper10 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, 'node ' + node.classes, true),
2993 shapeSvg = _labelHelper10.shapeSvg,
2994 bbox = _labelHelper10.bbox,
2995 halfPadding = _labelHelper10.halfPadding;
2996
2997 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].trace('Classes = ', node.classes); // add the rect
2998
2999 var rect = shapeSvg.insert('rect', ':first-child');
3000 rect.attr('class', 'basic label-container').attr('style', node.style).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);
3001 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, rect);
3002
3003 node.intersect = function (point) {
3004 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
3005 };
3006
3007 return shapeSvg;
3008};
3009
3010var rectWithTitle = function rectWithTitle(parent, node) {
3011 // const { shapeSvg, bbox, halfPadding } = labelHelper(parent, node, 'node ' + node.classes);
3012 var classes;
3013
3014 if (!node.classes) {
3015 classes = 'node default';
3016 } else {
3017 classes = 'node ' + node.classes;
3018 } // Add outer g element
3019
3020
3021 var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the title label and insert it after the rect
3022
3023 var rect = shapeSvg.insert('rect', ':first-child'); // const innerRect = shapeSvg.insert('rect');
3024
3025 var innerLine = shapeSvg.insert('line');
3026 var label = shapeSvg.insert('g').attr('class', 'label');
3027 var text2 = node.labelText.flat();
3028 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Label text', text2[0]);
3029 var text = label.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(text2[0], node.labelStyle, true, true));
3030 var bbox;
3031
3032 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().flowchart.htmlLabels) {
3033 var div = text.children[0];
3034 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(text);
3035 bbox = div.getBoundingClientRect();
3036 dv.attr('width', bbox.width);
3037 dv.attr('height', bbox.height);
3038 }
3039
3040 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Text 2', text2);
3041 var textRows = text2.slice(1, text2.length);
3042 var titleBox = text.getBBox();
3043 var descr = label.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(textRows.join('<br/>'), node.labelStyle, true, true));
3044
3045 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().flowchart.htmlLabels) {
3046 var _div = descr.children[0];
3047
3048 var _dv = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(descr);
3049
3050 bbox = _div.getBoundingClientRect();
3051
3052 _dv.attr('width', bbox.width);
3053
3054 _dv.attr('height', bbox.height);
3055 } // bbox = label.getBBox();
3056 // logger.info(descr);
3057
3058
3059 var halfPadding = node.padding / 2;
3060 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(descr).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 +
3061 bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ', ' + (titleBox.height + halfPadding + 5) + ')');
3062 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(text).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 +
3063 bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ', ' + 0 + ')'); // Get the size of the label
3064 // Bounding box for title and text
3065
3066 bbox = label.node().getBBox(); // Center the label
3067
3068 label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')');
3069 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);
3070 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);
3071 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, rect);
3072
3073 node.intersect = function (point) {
3074 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
3075 };
3076
3077 return shapeSvg;
3078};
3079
3080var stadium = function stadium(parent, node) {
3081 var _labelHelper11 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
3082 shapeSvg = _labelHelper11.shapeSvg,
3083 bbox = _labelHelper11.bbox;
3084
3085 var h = bbox.height + node.padding;
3086 var w = bbox.width + h / 4 + node.padding; // add the rect
3087
3088 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);
3089 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, rect);
3090
3091 node.intersect = function (point) {
3092 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
3093 };
3094
3095 return shapeSvg;
3096};
3097
3098var circle = function circle(parent, node) {
3099 var _labelHelper12 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
3100 shapeSvg = _labelHelper12.shapeSvg,
3101 bbox = _labelHelper12.bbox,
3102 halfPadding = _labelHelper12.halfPadding;
3103
3104 var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate
3105
3106 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);
3107 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Circle main');
3108 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, circle);
3109
3110 node.intersect = function (point) {
3111 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Circle intersect', node, bbox.width / 2 + halfPadding, point);
3112 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].circle(node, bbox.width / 2 + halfPadding, point);
3113 };
3114
3115 return shapeSvg;
3116};
3117
3118var subroutine = function subroutine(parent, node) {
3119 var _labelHelper13 = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["labelHelper"])(parent, node, undefined, true),
3120 shapeSvg = _labelHelper13.shapeSvg,
3121 bbox = _labelHelper13.bbox;
3122
3123 var w = bbox.width + node.padding;
3124 var h = bbox.height + node.padding;
3125 var points = [{
3126 x: 0,
3127 y: 0
3128 }, {
3129 x: w,
3130 y: 0
3131 }, {
3132 x: w,
3133 y: -h
3134 }, {
3135 x: 0,
3136 y: -h
3137 }, {
3138 x: 0,
3139 y: 0
3140 }, {
3141 x: -8,
3142 y: 0
3143 }, {
3144 x: w + 8,
3145 y: 0
3146 }, {
3147 x: w + 8,
3148 y: -h
3149 }, {
3150 x: -8,
3151 y: -h
3152 }, {
3153 x: -8,
3154 y: 0
3155 }];
3156 var el = Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["insertPolygonShape"])(shapeSvg, w, h, points);
3157 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, el);
3158
3159 node.intersect = function (point) {
3160 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].polygon(node, point);
3161 };
3162
3163 return shapeSvg;
3164};
3165
3166var start = function start(parent, node) {
3167 var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
3168 var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate
3169
3170 circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
3171 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, circle);
3172
3173 node.intersect = function (point) {
3174 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].circle(node, 7, point);
3175 };
3176
3177 return shapeSvg;
3178};
3179
3180var forkJoin = function forkJoin(parent, node, dir) {
3181 var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
3182 var width = 70;
3183 var height = 10;
3184
3185 if (dir === 'LR') {
3186 width = 10;
3187 height = 70;
3188 }
3189
3190 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');
3191 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, shape);
3192 node.height = node.height + node.padding / 2;
3193 node.width = node.width + node.padding / 2;
3194
3195 node.intersect = function (point) {
3196 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
3197 };
3198
3199 return shapeSvg;
3200};
3201
3202var end = function end(parent, node) {
3203 var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
3204 var innerCircle = shapeSvg.insert('circle', ':first-child');
3205 var circle = shapeSvg.insert('circle', ':first-child');
3206 circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
3207 innerCircle.attr('class', 'state-end').attr('r', 5).attr('width', 10).attr('height', 10);
3208 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, circle);
3209
3210 node.intersect = function (point) {
3211 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].circle(node, 7, point);
3212 };
3213
3214 return shapeSvg;
3215};
3216
3217var class_box = function class_box(parent, node) {
3218 var halfPadding = node.padding / 2;
3219 var rowPadding = 4;
3220 var lineHeight = 8;
3221 var classes;
3222
3223 if (!node.classes) {
3224 classes = 'node default';
3225 } else {
3226 classes = 'node ' + node.classes;
3227 } // Add outer g element
3228
3229
3230 var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the title label and insert it after the rect
3231
3232 var rect = shapeSvg.insert('rect', ':first-child');
3233 var topLine = shapeSvg.insert('line');
3234 var bottomLine = shapeSvg.insert('line');
3235 var maxWidth = 0;
3236 var maxHeight = rowPadding;
3237 var labelContainer = shapeSvg.insert('g').attr('class', 'label');
3238 var verticalPos = 0;
3239 var hasInterface = node.classData.annotations && node.classData.annotations[0]; // 1. Create the labels
3240
3241 var interfaceLabelText = node.classData.annotations[0] ? '«' + node.classData.annotations[0] + '»' : '';
3242 var interfaceLabel = labelContainer.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(interfaceLabelText, node.labelStyle, true, true));
3243 var interfaceBBox = interfaceLabel.getBBox();
3244
3245 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().flowchart.htmlLabels) {
3246 var div = interfaceLabel.children[0];
3247 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(interfaceLabel);
3248 interfaceBBox = div.getBoundingClientRect();
3249 dv.attr('width', interfaceBBox.width);
3250 dv.attr('height', interfaceBBox.height);
3251 }
3252
3253 if (node.classData.annotations[0]) {
3254 maxHeight += interfaceBBox.height + rowPadding;
3255 maxWidth += interfaceBBox.width;
3256 }
3257
3258 var classTitleString = node.classData.id;
3259
3260 if (node.classData.type !== undefined && node.classData.type !== '') {
3261 classTitleString += '<' + node.classData.type + '>';
3262 }
3263
3264 var classTitleLabel = labelContainer.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(classTitleString, node.labelStyle, true, true));
3265 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(classTitleLabel).attr('class', 'classTitle');
3266 var classTitleBBox = classTitleLabel.getBBox();
3267
3268 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().flowchart.htmlLabels) {
3269 var _div2 = classTitleLabel.children[0];
3270
3271 var _dv2 = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(classTitleLabel);
3272
3273 classTitleBBox = _div2.getBoundingClientRect();
3274
3275 _dv2.attr('width', classTitleBBox.width);
3276
3277 _dv2.attr('height', classTitleBBox.height);
3278 }
3279
3280 maxHeight += classTitleBBox.height + rowPadding;
3281
3282 if (classTitleBBox.width > maxWidth) {
3283 maxWidth = classTitleBBox.width;
3284 }
3285
3286 var classAttributes = [];
3287 node.classData.members.forEach(function (str) {
3288 var parsedText = Object(_diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__["parseMember"])(str).displayText;
3289 var lbl = labelContainer.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(parsedText, node.labelStyle, true, true));
3290 var bbox = lbl.getBBox();
3291
3292 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().flowchart.htmlLabels) {
3293 var _div3 = lbl.children[0];
3294
3295 var _dv3 = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(lbl);
3296
3297 bbox = _div3.getBoundingClientRect();
3298
3299 _dv3.attr('width', bbox.width);
3300
3301 _dv3.attr('height', bbox.height);
3302 }
3303
3304 if (bbox.width > maxWidth) {
3305 maxWidth = bbox.width;
3306 }
3307
3308 maxHeight += bbox.height + rowPadding;
3309 classAttributes.push(lbl);
3310 });
3311 maxHeight += lineHeight;
3312 var classMethods = [];
3313 node.classData.methods.forEach(function (str) {
3314 var parsedText = Object(_diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__["parseMember"])(str).displayText;
3315 var lbl = labelContainer.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_5__["default"])(parsedText, node.labelStyle, true, true));
3316 var bbox = lbl.getBBox();
3317
3318 if (Object(_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"])().flowchart.htmlLabels) {
3319 var _div4 = lbl.children[0];
3320
3321 var _dv4 = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(lbl);
3322
3323 bbox = _div4.getBoundingClientRect();
3324
3325 _dv4.attr('width', bbox.width);
3326
3327 _dv4.attr('height', bbox.height);
3328 }
3329
3330 if (bbox.width > maxWidth) {
3331 maxWidth = bbox.width;
3332 }
3333
3334 maxHeight += bbox.height + rowPadding;
3335 classMethods.push(lbl);
3336 });
3337 maxHeight += lineHeight; // 2. Position the labels
3338 // position the interface label
3339
3340 if (hasInterface) {
3341 var _diffX = (maxWidth - interfaceBBox.width) / 2;
3342
3343 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(interfaceLabel).attr('transform', 'translate( ' + (-1 * maxWidth / 2 + _diffX) + ', ' + -1 * maxHeight / 2 + ')');
3344 verticalPos = interfaceBBox.height + rowPadding;
3345 } // Positin the class title label
3346
3347
3348 var diffX = (maxWidth - classTitleBBox.width) / 2;
3349 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(classTitleLabel).attr('transform', 'translate( ' + (-1 * maxWidth / 2 + diffX) + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')');
3350 verticalPos += classTitleBBox.height + rowPadding;
3351 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);
3352 verticalPos += lineHeight;
3353 classAttributes.forEach(function (lbl) {
3354 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ')');
3355 verticalPos += classTitleBBox.height + rowPadding;
3356 });
3357 verticalPos += lineHeight;
3358 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);
3359 verticalPos += lineHeight;
3360 classMethods.forEach(function (lbl) {
3361 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')');
3362 verticalPos += classTitleBBox.height + rowPadding;
3363 }); //
3364 // let bbox;
3365 // if (getConfig().flowchart.htmlLabels) {
3366 // const div = interfaceLabel.children[0];
3367 // const dv = select(interfaceLabel);
3368 // bbox = div.getBoundingClientRect();
3369 // dv.attr('width', bbox.width);
3370 // dv.attr('height', bbox.height);
3371 // }
3372 // bbox = labelContainer.getBBox();
3373 // logger.info('Text 2', text2);
3374 // const textRows = text2.slice(1, text2.length);
3375 // let titleBox = text.getBBox();
3376 // const descr = label
3377 // .node()
3378 // .appendChild(createLabel(textRows.join('<br/>'), node.labelStyle, true, true));
3379 // if (getConfig().flowchart.htmlLabels) {
3380 // const div = descr.children[0];
3381 // const dv = select(descr);
3382 // bbox = div.getBoundingClientRect();
3383 // dv.attr('width', bbox.width);
3384 // dv.attr('height', bbox.height);
3385 // }
3386 // // bbox = label.getBBox();
3387 // // logger.info(descr);
3388 // select(descr).attr(
3389 // 'transform',
3390 // 'translate( ' +
3391 // // (titleBox.width - bbox.width) / 2 +
3392 // (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) +
3393 // ', ' +
3394 // (titleBox.height + halfPadding + 5) +
3395 // ')'
3396 // );
3397 // select(text).attr(
3398 // 'transform',
3399 // 'translate( ' +
3400 // // (titleBox.width - bbox.width) / 2 +
3401 // (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) +
3402 // ', ' +
3403 // 0 +
3404 // ')'
3405 // );
3406 // // Get the size of the label
3407 // // Bounding box for title and text
3408 // bbox = label.node().getBBox();
3409 // // Center the label
3410 // label.attr(
3411 // 'transform',
3412 // 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')'
3413 // );
3414
3415 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
3416 // .attr('class', 'divider')
3417 // .attr('x1', -bbox.width / 2 - halfPadding)
3418 // .attr('x2', bbox.width / 2 + halfPadding)
3419 // .attr('y1', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding)
3420 // .attr('y2', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
3421
3422 Object(_shapes_util__WEBPACK_IMPORTED_MODULE_2__["updateNodeBounds"])(node, rect);
3423
3424 node.intersect = function (point) {
3425 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_4__["default"].rect(node, point);
3426 };
3427
3428 return shapeSvg;
3429};
3430
3431var shapes = {
3432 question: question,
3433 rect: rect,
3434 rectWithTitle: rectWithTitle,
3435 circle: circle,
3436 stadium: stadium,
3437 hexagon: hexagon,
3438 rect_left_inv_arrow: rect_left_inv_arrow,
3439 lean_right: lean_right,
3440 lean_left: lean_left,
3441 trapezoid: trapezoid,
3442 inv_trapezoid: inv_trapezoid,
3443 rect_right_inv_arrow: rect_right_inv_arrow,
3444 cylinder: cylinder,
3445 start: start,
3446 end: end,
3447 note: _shapes_note__WEBPACK_IMPORTED_MODULE_6__["default"],
3448 subroutine: subroutine,
3449 fork: forkJoin,
3450 join: forkJoin,
3451 class_box: class_box
3452};
3453var nodeElems = {};
3454var insertNode = function insertNode(elem, node, dir) {
3455 var newEl;
3456 var el; // Add link when appropriate
3457
3458 if (node.link) {
3459 newEl = elem.insert('svg:a').attr('xlink:href', node.link).attr('target', node.linkTarget || '_blank');
3460 el = shapes[node.shape](newEl, node, dir);
3461 } else {
3462 el = shapes[node.shape](elem, node, dir);
3463 newEl = el;
3464 }
3465
3466 if (node.tooltip) {
3467 el.attr('title', node.tooltip);
3468 }
3469
3470 if (node.class) {
3471 el.attr('class', 'node default ' + node.class);
3472 }
3473
3474 nodeElems[node.id] = newEl;
3475
3476 if (node.haveCallback) {
3477 nodeElems[node.id].attr('class', nodeElems[node.id].attr('class') + ' clickable');
3478 }
3479};
3480var setNodeElem = function setNodeElem(elem, node) {
3481 nodeElems[node.id] = elem;
3482};
3483var clear = function clear() {
3484 nodeElems = {};
3485};
3486var positionNode = function positionNode(node) {
3487 var el = nodeElems[node.id];
3488 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].trace('Transforming node', node, 'translate(' + (node.x - node.width / 2 - 5) + ', ' + (node.y - node.height / 2 - 5) + ')');
3489 var padding = 8;
3490
3491 if (node.clusterNode) {
3492 el.attr('transform', 'translate(' + (node.x - node.width / 2 - padding) + ', ' + (node.y - node.height / 2 - padding) + ')');
3493 } else {
3494 el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');
3495 }
3496};
3497
3498/***/ }),
3499
3500/***/ "./src/dagre-wrapper/shapes/note.js":
3501/*!******************************************!*\
3502 !*** ./src/dagre-wrapper/shapes/note.js ***!
3503 \******************************************/
3504/*! exports provided: default */
3505/***/ (function(module, __webpack_exports__, __webpack_require__) {
3506
3507"use strict";
3508__webpack_require__.r(__webpack_exports__);
3509/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./src/dagre-wrapper/shapes/util.js");
3510/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
3511/* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../intersect/index.js */ "./src/dagre-wrapper/intersect/index.js");
3512
3513 // eslint-disable-line
3514
3515
3516
3517var note = function note(parent, node) {
3518 var _labelHelper = Object(_util__WEBPACK_IMPORTED_MODULE_0__["labelHelper"])(parent, node, 'node ' + node.classes, true),
3519 shapeSvg = _labelHelper.shapeSvg,
3520 bbox = _labelHelper.bbox,
3521 halfPadding = _labelHelper.halfPadding;
3522
3523 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('Classes = ', node.classes); // add the rect
3524
3525 var rect = shapeSvg.insert('rect', ':first-child');
3526 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);
3527 Object(_util__WEBPACK_IMPORTED_MODULE_0__["updateNodeBounds"])(node, rect);
3528
3529 node.intersect = function (point) {
3530 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__["default"].rect(node, point);
3531 };
3532
3533 return shapeSvg;
3534};
3535
3536/* harmony default export */ __webpack_exports__["default"] = (note);
3537
3538/***/ }),
3539
3540/***/ "./src/dagre-wrapper/shapes/util.js":
3541/*!******************************************!*\
3542 !*** ./src/dagre-wrapper/shapes/util.js ***!
3543 \******************************************/
3544/*! exports provided: labelHelper, updateNodeBounds, insertPolygonShape */
3545/***/ (function(module, __webpack_exports__, __webpack_require__) {
3546
3547"use strict";
3548__webpack_require__.r(__webpack_exports__);
3549/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "labelHelper", function() { return labelHelper; });
3550/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateNodeBounds", function() { return updateNodeBounds; });
3551/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertPolygonShape", function() { return insertPolygonShape; });
3552/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../createLabel */ "./src/dagre-wrapper/createLabel.js");
3553/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
3554/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! d3 */ "d3");
3555/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_2__);
3556
3557
3558
3559var labelHelper = function labelHelper(parent, node, _classes, isNode) {
3560 var classes;
3561
3562 if (!_classes) {
3563 classes = 'node default';
3564 } else {
3565 classes = _classes;
3566 } // Add outer g element
3567
3568
3569 var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the label and insert it after the rect
3570
3571 var label = shapeSvg.insert('g').attr('class', 'label').attr('style', node.labelStyle);
3572 var text = label.node().appendChild(Object(_createLabel__WEBPACK_IMPORTED_MODULE_0__["default"])(node.labelText, node.labelStyle, false, isNode)); // Get the size of the label
3573
3574 var bbox = text.getBBox();
3575
3576 if (Object(_config__WEBPACK_IMPORTED_MODULE_1__["getConfig"])().flowchart.htmlLabels) {
3577 var div = text.children[0];
3578 var dv = Object(d3__WEBPACK_IMPORTED_MODULE_2__["select"])(text);
3579 bbox = div.getBoundingClientRect();
3580 dv.attr('width', bbox.width);
3581 dv.attr('height', bbox.height);
3582 }
3583
3584 var halfPadding = node.padding / 2; // Center the label
3585
3586 label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')');
3587 return {
3588 shapeSvg: shapeSvg,
3589 bbox: bbox,
3590 halfPadding: halfPadding,
3591 label: label
3592 };
3593};
3594var updateNodeBounds = function updateNodeBounds(node, element) {
3595 var bbox = element.node().getBBox();
3596 node.width = bbox.width;
3597 node.height = bbox.height;
3598};
3599function insertPolygonShape(parent, w, h, points) {
3600 return parent.insert('polygon', ':first-child').attr('points', points.map(function (d) {
3601 return d.x + ',' + d.y;
3602 }).join(' ')).attr('class', 'label-container').attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');
3603}
3604
3605/***/ }),
3606
3607/***/ "./src/defaultConfig.js":
3608/*!******************************!*\
3609 !*** ./src/defaultConfig.js ***!
3610 \******************************/
3611/*! exports provided: default */
3612/***/ (function(module, __webpack_exports__, __webpack_require__) {
3613
3614"use strict";
3615__webpack_require__.r(__webpack_exports__);
3616/* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
3617
3618/**
3619 * **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more[[click here](8.6.0_docs.md)].**
3620 *
3621 * ## **What follows are config instructions for older versions**
3622 * These are the default options which can be overridden with the initialization call like so:
3623 * **Example 1:**
3624 * <pre>
3625 * mermaid.initialize({
3626 * flowchart:{
3627 * htmlLabels: false
3628 * }
3629 * });
3630 * </pre>
3631 *
3632 * **Example 2:**
3633 * <pre>
3634 * &lt;script>
3635 * var config = {
3636 * startOnLoad:true,
3637 * flowchart:{
3638 * useMaxWidth:true,
3639 * htmlLabels:true,
3640 * curve:'cardinal',
3641 * },
3642 *
3643 * securityLevel:'loose',
3644 * };
3645 * mermaid.initialize(config);
3646 * &lt;/script>
3647 * </pre>
3648 * A summary of all options and their defaults is found [here](#mermaidapi-configuration-defaults). A description of each option follows below.
3649 *
3650 * @name Configuration
3651 */
3652
3653var config = {
3654 /** theme , the CSS style sheet
3655 *
3656 * theme , the CSS style sheet
3657 *
3658 *| Parameter | Description |Type | Required | Values|
3659 *| --- | --- | --- | --- | --- |
3660 *| Theme |Built in Themes| String | Optional | Values include, default, forest, dark, neutral, null|
3661 *
3662 ***Notes:**To disable any pre-defined mermaid theme, use "null".
3663 * <pre>
3664 * "theme": "forest",
3665 * "themeCSS": ".node rect { fill: red; }"
3666 * </pre>
3667 */
3668 theme: 'default',
3669 themeVariables: _themes__WEBPACK_IMPORTED_MODULE_0__["default"]['default'].getThemeVariables(),
3670 themeCSS: undefined,
3671
3672 /* **maxTextSize** - The maximum allowed size of the users text diamgram */
3673 maxTextSize: 50000,
3674
3675 /**
3676 *| Parameter | Description |Type | Required | Values|
3677 *| --- | --- | --- | --- | --- |
3678 *|fontFamily | specifies the font to be used in the rendered diagrams| String | Required | Verdana, Arial, Trebuchet MS,|
3679 *
3680 ***notes: Default value is \\"trebuchet ms\\".
3681 */
3682 fontFamily: '"trebuchet ms", verdana, arial;',
3683
3684 /**
3685 *| Parameter | Description |Type | Required | Values|
3686 *| --- | --- | --- | --- | --- |
3687 *| logLevel |This option decides the amount of logging to be used.| String | Required | 1, 2, 3, 4, 5 |
3688 *
3689 *
3690 ***Notes:**
3691 *- debug: 1.
3692 *- info: 2.
3693 *- warn: 3.
3694 *- error: 4.
3695 *- fatal: 5(default).
3696 */
3697 logLevel: 5,
3698
3699 /**
3700 *| Parameter | Description |Type | Required | Values|
3701 *| --- | --- | --- | --- | --- |
3702 *| securitylevel | Level of trust for parsed diagram|String | Required | Strict, Loose, antiscript |
3703 *
3704 ***Notes:
3705 *- **strict**: (**default**) tags in text are encoded, click functionality is disabeled
3706 *- **loose**: tags in text are allowed, click functionality is enabled
3707 *- **antiscript**: html tags in text are allowed, (only script element is removed), click functionality is enabled
3708 */
3709 securityLevel: 'strict',
3710
3711 /**
3712 *| Parameter | Description |Type | Required | Values|
3713 *| --- | --- | --- | --- | --- |
3714 *| startOnLoad| Dictates whether mermaind starts on Page load | Boolean | Required | True, False |
3715 *
3716 ***Notes:**
3717 ***Default value: true**
3718 */
3719 startOnLoad: true,
3720
3721 /**
3722 *| Parameter | Description |Type | Required |Values|
3723 *| --- | --- | --- | --- | --- |
3724 *| arrowMarkerAbsolute | Controls whether or arrow markers in html code are absolute paths or anchors | Boolean | Required | True, False |
3725 *
3726 *
3727 *## Notes**: This matters if you are using base tag settings.
3728 ***Default value: false**.
3729 */
3730 arrowMarkerAbsolute: false,
3731
3732 /**
3733 * This option controls which currentConfig keys are considered _secure_ and can only be changed via
3734 * call to mermaidAPI.initialize. Calls to mermaidAPI.reinitialize cannot make changes to
3735 * the `secure` keys in the current currentConfig. This prevents malicious graph directives from
3736 * overriding a site's default security.
3737 */
3738 secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize'],
3739
3740 /**
3741 * The object containing configurations specific for flowcharts
3742 */
3743 flowchart: {
3744 /**
3745 *| Parameter | Description |Type | Required | Values|
3746 *| --- | --- | --- | --- | --- |
3747 *| diagramPadding | amount of padding around the diagram as a whole | Integer | Required | Any Positive Value |
3748 *
3749 ***Notes:**The amount of padding around the diagram as a whole so that embedded diagrams have margins, expressed in pixels
3750 ***Default value: 8**.
3751 */
3752 diagramPadding: 8,
3753
3754 /**
3755 *| Parameter | Description |Type | Required | Values|
3756 *| --- | --- | --- | --- | --- |
3757 *| htmlLabels | Flag for setting whether or not a html tag should be used for rendering labels on the edges. | Boolean| Required | True, False|
3758 *
3759 ***Notes: Default value: true**.
3760 */
3761 htmlLabels: true,
3762
3763 /**
3764 *| Parameter | Description |Type | Required | Values|
3765 *| --- | --- | --- | --- | --- |
3766 *| nodeSpacing | Defines the spacing between nodes on the same level | Integer| Required | Any positive Numbers |
3767 *
3768 ***Notes:
3769 *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.**
3770 ***Default value 50**.
3771 */
3772 nodeSpacing: 50,
3773
3774 /**
3775 *| Parameter | Description |Type | Required | Values|
3776 *| --- | --- | --- | --- | --- |
3777 *| rankSpacing | Defines the spacing between nodes on different levels | Integer | Required| Any Positive Numbers |
3778 *
3779 ***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.
3780 ***Default value 50**.
3781 */
3782 rankSpacing: 50,
3783
3784 /**
3785 *| Parameter | Description |Type | Required | Values|
3786 *| --- | --- | --- | --- | --- |
3787 *| curve | Defines how mermaid renders curves for flowcharts. | String | Required | Basis, Linear, Cardinal|
3788 *
3789 ***Notes:
3790 *Default Vaue: Linear**
3791 */
3792 curve: 'linear',
3793 // Only used in new experimental rendering
3794 // represents the padding between the labels and the shape
3795 padding: 15,
3796
3797 /**
3798 *| Parameter | Description |Type | Required | Values|
3799 *| --- | --- | --- | --- | --- |
3800 *| useMaxWidth | See notes | Boolean | 4 | True, False |
3801 *
3802 ***Notes:**when this flag is set the height and width is set to 100% and is then scaling with the
3803 *available space if not the absolute space required is used.
3804 *
3805 ***Default value true**.
3806 */
3807 useMaxWidth: true
3808 },
3809
3810 /**
3811 * The object containing configurations specific for sequence diagrams
3812 */
3813 sequence: {
3814 /**
3815 * widt of the activation rect
3816 * **Default value 10**.
3817 */
3818 activationWidth: 10,
3819
3820 /**
3821 *| Parameter | Description |Type | Required | Values|
3822 *| --- | --- | --- | --- | --- |
3823 *| diagramMarginX | margin to the right and left of the sequence diagram | Integer | Required | Any Positive Values |
3824 *
3825 ***Notes:**
3826 ***Default value 50**.
3827 */
3828 diagramMarginX: 50,
3829
3830 /**
3831 *| Parameter | Description |Type | Required | Values|
3832 *| --- | --- | --- | --- | --- |
3833 *| diagramMarginY | Margin to the over and under the sequence diagram | Integer | Required | Any Positive Values|
3834 *
3835 ***Notes:**
3836 ***Default value 10**.
3837 */
3838 diagramMarginY: 10,
3839
3840 /**
3841 *| Parameter | Description |Type | Required | Values|
3842 *| --- | --- | --- | --- | --- |
3843 *| actorMargin | Margin between actors. | Integer | Required | Any Positive Value |
3844 *
3845 ***Notes:**
3846 ***Default value 50**.
3847 */
3848 actorMargin: 50,
3849
3850 /**
3851 *| Parameter | Description |Type | Required | Values|
3852 *| --- | --- | --- | --- | --- |
3853 *| width | Width of actor boxes | Integer | Required | Any Positive Value |
3854 *
3855 ***Notes:**
3856 ***Default value 150**.
3857 */
3858 width: 150,
3859
3860 /**
3861 *| Parameter | Description |Type | Required | Values|
3862 *| --- | --- | --- | --- | --- |
3863 *| height | Height of actor boxes | Integer | Required | Any Positive Value|
3864 *
3865 ***Notes:**
3866 ***Default value 65**..
3867 */
3868 height: 65,
3869
3870 /**
3871 *| Parameter | Description |Type | Required | Values|
3872 *| --- | --- | --- | --- | --- |
3873 *| boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
3874 *
3875 ***Notes:**
3876 *
3877 ***Default value 10**.
3878 */
3879 boxMargin: 10,
3880
3881 /**
3882 *| Parameter | Description |Type | Required | Values|
3883 *| --- | --- | --- | --- | --- |
3884 *| boxTextMargin| margin around the text in loop/alt/opt boxes | Integer | Required| Any Positive Value|
3885 *
3886 ***Notes:**
3887 *
3888 ***Default value 5**.
3889 */
3890 boxTextMargin: 5,
3891
3892 /**
3893 *| Parameter | Description |Type | Required | Values|
3894 *| --- | --- | --- | --- | --- |
3895 *| noteMargin | margin around notes. | Integer | Required | Any Positive Value |
3896 *
3897 ***Notes:**
3898 *
3899 ***Default value 10**.
3900 */
3901 noteMargin: 10,
3902
3903 /**
3904 *| Parameter | Description |Type | Required | Values|
3905 *| --- | --- | --- | --- | --- |
3906 *| messageMargin | Space between messages. | Integer | Required | Any Positive Value |
3907 *
3908 ***Notes:**
3909 *
3910 *Space between messages.
3911 ***Default value 35**.
3912 */
3913 messageMargin: 35,
3914
3915 /**
3916 *| Parameter | Description |Type | Required | Values|
3917 *| --- | --- | --- | --- | --- |
3918 *| messageAlign | Multiline message alignment | Integer | Required | left, center, right |
3919 *
3920 ***Notes:**center **default**
3921 */
3922 messageAlign: 'center',
3923
3924 /**
3925 *| Parameter | Description |Type | Required | Values|
3926 *| --- | --- | --- | --- | --- |
3927 *| mirrorActors | mirror actors under diagram. | Boolean| Required | True, False |
3928 *
3929 ***Notes:**
3930 *
3931 ***Default value true**.
3932 */
3933 mirrorActors: true,
3934
3935 /**
3936 *| Parameter | Description |Type | Required | Values|
3937 *| --- | --- | --- | --- | --- |
3938 *| bottomMarginAdj | Prolongs the edge of the diagram downwards. | Integer | Required | Any Positive Value |
3939 *
3940 ***Notes:**Depending on css styling this might need adjustment.
3941 ***Default value 1**.
3942 */
3943 bottomMarginAdj: 1,
3944
3945 /**
3946 *| Parameter | Description |Type | Required | Values|
3947 *| --- | --- | --- | --- | --- |
3948 *| useMaxWidth | See Notes | Boolean | Required | True, False |
3949 *
3950 ***Notes:**
3951 *when this flag is set to true, the height and width is set to 100% and is then scaling with the
3952 *available space. If set to false, the absolute space required is used.
3953 ***Default value: True**.
3954 */
3955 useMaxWidth: true,
3956
3957 /**
3958 *| Parameter | Description |Type | Required | Values|
3959 *| --- | --- | --- | --- | --- |
3960 *| rightAngles | display curve arrows as right angles| Boolean | Required | True, False |
3961 *
3962 ***Notes:**
3963 *
3964 *This will display arrows that start and begin at the same node as right angles, rather than a curve
3965 ***Default value false**.
3966 */
3967 rightAngles: false,
3968
3969 /**
3970 *| Parameter | Description |Type | Required | Values|
3971 *| --- | --- | --- | --- | --- |
3972 *| showSequenceNumbers | This will show the node numbers | Boolean | Required | True, False |
3973 *
3974 ***Notes:**
3975 ***Default value false**.
3976 */
3977 showSequenceNumbers: false,
3978
3979 /**
3980 *| Parameter | Description |Type | Required | Values|
3981 *| --- | --- | --- | --- | --- |
3982 *| actorFontSize| This sets the font size of the actor's description | Integer | Require | Any Positive Value |
3983 *
3984 ***Notes:**
3985 ***Default value 14**..
3986 */
3987 actorFontSize: 14,
3988
3989 /**
3990 *| Parameter | Description |Type | Required | Values|
3991 *| --- | --- | --- | --- | --- |
3992 *| actorFontFamily |This sets the font family of the actor's description | 3 | 4 | Open-Sans, Sans-Serif |
3993 *
3994 ***Notes:**
3995 ***Default value "Open-Sans", "sans-serif"**.
3996 */
3997 actorFontFamily: '"Open-Sans", "sans-serif"',
3998
3999 /**
4000 * This sets the font weight of the actor's description
4001 * **Default value 400.
4002 */
4003 actorFontWeight: 400,
4004
4005 /**
4006 *| Parameter | Description |Type | Required | Values|
4007 *| --- | --- | --- | --- | --- |
4008 *| noteFontSize |This sets the font size of actor-attached notes. | Integer | Required | Any Positive Value |
4009 *
4010 ***Notes:**
4011 ***Default value 14**..
4012 */
4013 noteFontSize: 14,
4014
4015 /**
4016 *| Parameter | Description |Type | Required | Values|
4017 *| --- | --- | --- | --- | --- |
4018 *| noteFontFamily| This sets the font family of actor-attached notes. | String | Required | trebuchet ms, verdana, arial |
4019 *
4020 ***Notes:**
4021 ***Default value: trebuchet ms **.
4022 */
4023 noteFontFamily: '"trebuchet ms", verdana, arial',
4024
4025 /**
4026 * This sets the font weight of the note's description
4027 * **Default value 400.
4028 */
4029 noteFontWeight: 400,
4030
4031 /**
4032 *| Parameter | Description |Type | Required | Values|
4033 *| --- | --- | --- | --- | --- |
4034 *| noteAlign | This sets the text alignment of actor-attached notes. | string | required | left, center, right|
4035 *
4036 ***Notes:**
4037 ***Default value center**.
4038 */
4039 noteAlign: 'center',
4040
4041 /**
4042 *| Parameter | Description |Type | Required | Values|
4043 *| --- | --- | --- | --- | --- |
4044 *| messageFontSize | This sets the font size of actor messages. | Integer | Required | Any Positive Number |
4045 *
4046 ***Notes:**
4047 ***Default value 16**.
4048 */
4049 messageFontSize: 16,
4050
4051 /**
4052 *| Parameter | Description |Type | Required | Values|
4053 *| --- | --- | --- | --- | --- |
4054 *| messageFontFamily | This sets the font family of actor messages. | String| Required | trebuchet ms", verdana, aria |
4055 *
4056 ***Notes:**
4057 ***Default value:"trebuchet ms**.
4058 */
4059 messageFontFamily: '"trebuchet ms", verdana, arial',
4060
4061 /**
4062 * This sets the font weight of the message's description
4063 * **Default value 400.
4064 */
4065 messageFontWeight: 400,
4066
4067 /**
4068 * This sets the auto-wrap state for the diagram
4069 * **Default value false.
4070 */
4071 wrap: false,
4072
4073 /**
4074 * This sets the auto-wrap padding for the diagram (sides only)
4075 * **Default value 10.
4076 */
4077 wrapPadding: 10,
4078
4079 /**
4080 * This sets the width of the loop-box (loop, alt, opt, par)
4081 * **Default value 50.
4082 */
4083 labelBoxWidth: 50,
4084
4085 /**
4086 * This sets the height of the loop-box (loop, alt, opt, par)
4087 * **Default value 20.
4088 */
4089 labelBoxHeight: 20,
4090 messageFont: function messageFont() {
4091 return {
4092 fontFamily: this.messageFontFamily,
4093 fontSize: this.messageFontSize,
4094 fontWeight: this.messageFontWeight
4095 };
4096 },
4097 noteFont: function noteFont() {
4098 return {
4099 fontFamily: this.noteFontFamily,
4100 fontSize: this.noteFontSize,
4101 fontWeight: this.noteFontWeight
4102 };
4103 },
4104 actorFont: function actorFont() {
4105 return {
4106 fontFamily: this.actorFontFamily,
4107 fontSize: this.actorFontSize,
4108 fontWeight: this.actorFontWeight
4109 };
4110 }
4111 },
4112
4113 /**
4114 * The object containing configurations specific for gantt diagrams*
4115 */
4116 gantt: {
4117 /**
4118 *### titleTopMargin
4119 *
4120 *| Parameter | Description |Type | Required | Values|
4121 *| --- | --- | --- | --- | --- |
4122 *| titleTopMargin | Margin top for the text over the gantt diagram | Integer | Required | Any Positive Value |
4123 *
4124 ***Notes:**
4125 ***Default value 25**.
4126 */
4127 titleTopMargin: 25,
4128
4129 /**
4130 *| Parameter | Description |Type | Required | Values|
4131 *| --- | --- | --- | --- | --- |
4132 *| barHeight | The height of the bars in the graph | Integer | Required | Any Positive Value |
4133 *
4134 ***Notes:**
4135 ***Default value 20**.
4136 */
4137 barHeight: 20,
4138
4139 /**
4140 *| Parameter | Description |Type | Required | Values|
4141 *| --- | --- | --- | --- | --- |
4142 *| barGap | The margin between the different activities in the gantt diagram. | Integer | Optional |Any Positive Value |
4143 *
4144 ***Notes:**
4145 ***Default value 4**.
4146 */
4147 barGap: 4,
4148
4149 /**
4150 *| Parameter | Description |Type | Required | Values|
4151 *| --- | --- | --- | --- | --- |
4152 *| topPadding | Margin between title and gantt diagram and between axis and gantt diagram. | Integer | Required | Any Positive Value |
4153 *
4154 ***Notes:**
4155 ***Default value 50**.
4156 */
4157 topPadding: 50,
4158
4159 /**
4160 *| Parameter | Description |Type | Required | Values|
4161 *| --- | --- | --- | --- | --- |
4162 *| leftPadding | The space allocated for the section name to the left of the activities. | Integer| Required | Any Positive Value |
4163 *
4164 ***Notes:**
4165 ***Default value 75**.
4166 */
4167 leftPadding: 75,
4168
4169 /**
4170 *| Parameter | Description |Type | Required | Values|
4171 *| --- | --- | --- | --- | --- |
4172 *| gridLineStartPadding | Vertical starting position of the grid lines. | Integer | Required | Any Positive Value |
4173 *
4174 ***Notes:**
4175 ***Default value 35**.
4176 */
4177 gridLineStartPadding: 35,
4178
4179 /**
4180 *| Parameter | Description |Type | Required | Values|
4181 *| --- | --- | --- | --- | --- |
4182 *| fontSize | Font size| Integer | Required | Any Positive Value |
4183 *
4184 ***Notes:**
4185 ***Default value 11**.
4186 */
4187 fontSize: 11,
4188
4189 /**
4190 *| Parameter | Description |Type | Required | Values|
4191 *| --- | --- | --- | --- | --- |
4192 *| fontFamily | font Family | string | required |"Open-Sans", "sans-serif" |
4193 *
4194 ***Notes:**
4195 *
4196 ***Default value '"Open-Sans", "sans-serif"'**.
4197 */
4198 fontFamily: '"Open-Sans", "sans-serif"',
4199
4200 /**
4201 *| Parameter | Description |Type | Required | Values|
4202 *| --- | --- | --- | --- | --- |
4203 *| numberSectionStyles | The number of alternating section styles | Integer | 4 | Any Positive Value |
4204 *
4205 ***Notes:**
4206 ***Default value 4**.
4207 */
4208 numberSectionStyles: 4,
4209
4210 /**
4211 *| Parameter | Description |Type | Required | Values|
4212 *| --- | --- | --- | --- | --- |
4213 *| axisFormat | Datetime format of the axis. | 3 | Required | Date in yy-mm-dd |
4214 *
4215 ***Notes:**
4216 *
4217 * This might need adjustment to match your locale and preferences
4218 ***Default value '%Y-%m-%d'**.
4219 */
4220 axisFormat: '%Y-%m-%d',
4221
4222 /**
4223 *| Parameter | Description |Type | Required | Values|
4224 *| --- | --- | --- | --- | --- |
4225 *| useMaxWidth | See notes | Boolean | 4 | True, False |
4226 *
4227 ***Notes:**when this flag is set the height and width is set to 100% and is then scaling with the
4228 *available space if not the absolute space required is used.
4229 *
4230 ***Default value true**.
4231 */
4232 useMaxWidth: true,
4233 useWidth: undefined
4234 },
4235
4236 /**
4237 * The object containing configurations specific for journey diagrams
4238 */
4239 journey: {
4240 /**
4241 *| Parameter | Description |Type | Required | Values|
4242 *| --- | --- | --- | --- | --- |
4243 *| diagramMarginX | margin to the right and left of the sequence diagram | Integer | Required | Any Positive Value |
4244 *
4245 ***Notes:**
4246 ***Default value 50**.
4247 */
4248 diagramMarginX: 50,
4249
4250 /**
4251 *| Parameter | Description |Type | Required | Values|
4252 *| --- | --- | --- | --- | --- |
4253 *| diagramMarginY | margin to the over and under the sequence diagram. | Integer | Required | Any Positive Value|
4254 *
4255 ***Notes:**
4256 ***Default value 10**..
4257 */
4258 diagramMarginY: 10,
4259
4260 /**
4261 *| Parameter | Description |Type | Required | Values|
4262 *| --- | --- | --- | --- | --- |
4263 *| actorMargin | Margin between actors. | Integer | Required | Any Positive Value|
4264 *
4265 ***Notes:**
4266 ***Default value 50**.
4267 */
4268 actorMargin: 50,
4269
4270 /**
4271 *| Parameter | Description |Type | Required | Values|
4272 *| --- | --- | --- | --- | --- |
4273 *| width | Width of actor boxes | Integer | Required | Any Positive Value |
4274 *
4275 ***Notes:**
4276 ***Default value 150**.
4277 */
4278 width: 150,
4279
4280 /**
4281 *| Parameter | Description |Type | Required | Values|
4282 *| --- | --- | --- | --- | --- |
4283 *| height | Height of actor boxes | Integer | Required | Any Positive Value |
4284 *
4285 ***Notes:**
4286 ***Default value 65**.
4287 */
4288 height: 65,
4289
4290 /**
4291 *| Parameter | Description |Type | Required | Values|
4292 *| --- | --- | --- | --- | --- |
4293 *| boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
4294 *
4295 ***Notes:**
4296 ***Default value 10**.
4297 */
4298 boxMargin: 10,
4299
4300 /**
4301 *| Parameter | Description |Type | Required | Values|
4302 *| --- | --- | --- | --- | --- |
4303 *| boxTextMargin | margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value |
4304 *
4305 ***Notes:**
4306 */
4307 boxTextMargin: 5,
4308
4309 /**
4310 *| Parameter | Description |Type | Required | Values|
4311 *| --- | --- | --- | --- | --- |
4312 *| noteMargin | margin around notes. | Integer | Required | Any Positive Value |
4313 *
4314 ***Notes:**
4315 ***Default value 10**.
4316 */
4317 noteMargin: 10,
4318
4319 /**
4320 *| Parameter | Description |Type | Required | Values|
4321 *| --- | --- | --- | --- | --- |
4322 *| messageMargin |Space between messages. | Integer | Required | Any Positive Value |
4323 *
4324 ***Notes:**
4325 *
4326 *Space between messages.
4327 ***Default value 35**.
4328 */
4329 messageMargin: 35,
4330
4331 /**
4332 *| Parameter | Description |Type | Required | Values|
4333 *| --- | --- | --- | --- | --- |
4334 *| messageAlign |Multiline message alignment | 3 | 4 | left, center, right |
4335 *
4336 ***Notes:**default:center**
4337 */
4338 messageAlign: 'center',
4339
4340 /**
4341 *| Parameter | Description |Type | Required | Values|
4342 *| --- | --- | --- | --- | --- |
4343 *| bottomMarginAdj | Prolongs the edge of the diagram downwards. | Integer | 4 | Any Positive Value |
4344 *
4345 ***Notes:**Depending on css styling this might need adjustment.
4346 ***Default value 1**.
4347 */
4348 bottomMarginAdj: 1,
4349
4350 /**
4351 *| Parameter | Description |Type | Required | Values|
4352 *| --- | --- | --- | --- | --- |
4353 *| useMaxWidth | See notes | Boolean | 4 | True, False |
4354 *
4355 ***Notes:**when this flag is set the height and width is set to 100% and is then scaling with the
4356 *available space if not the absolute space required is used.
4357 *
4358 ***Default value true**.
4359 */
4360 useMaxWidth: true,
4361
4362 /**
4363 *| Parameter | Description |Type | Required | Values|
4364 *| --- | --- | --- | --- | --- |
4365 *| rightAngles | Curved Arrows become Right Angles, | 3 | 4 | True, False |
4366 *
4367 ***Notes:**This will display arrows that start and begin at the same node as right angles, rather than a curves
4368 ***Default value false**.
4369 */
4370 rightAngles: false
4371 },
4372 class: {
4373 arrowMarkerAbsolute: false,
4374
4375 /**
4376 *| Parameter | Description |Type | Required | Values|
4377 *| --- | --- | --- | --- | --- |
4378 *| useMaxWidth | See notes | Boolean | 4 | True, False |
4379 *
4380 ***Notes:**when this flag is set the height and width is set to 100% and is then scaling with the
4381 *available space if not the absolute space required is used.
4382 *
4383 ***Default value true**.
4384 */
4385 useMaxWidth: true
4386 },
4387 git: {
4388 arrowMarkerAbsolute: false,
4389 useWidth: undefined,
4390
4391 /**
4392 *| Parameter | Description |Type | Required | Values|
4393 *| --- | --- | --- | --- | --- |
4394 *| useMaxWidth | See notes | Boolean | 4 | True, False |
4395 *
4396 ***Notes:**when this flag is set the height and width is set to 100% and is then scaling with the
4397 *available space if not the absolute space required is used.
4398 *
4399 ***Default value true**.
4400 */
4401 useMaxWidth: true
4402 },
4403 state: {
4404 dividerMargin: 10,
4405 sizeUnit: 5,
4406 padding: 8,
4407 textHeight: 10,
4408 titleShift: -15,
4409 noteMargin: 10,
4410 forkWidth: 70,
4411 forkHeight: 7,
4412 // Used
4413 miniPadding: 2,
4414 // Font size factor, this is used to guess the width of the edges labels before rendering by dagre
4415 // layout. This might need updating if/when switching font
4416 fontSizeFactor: 5.02,
4417 fontSize: 24,
4418 labelHeight: 16,
4419 edgeLengthFactor: '20',
4420 compositTitleSize: 35,
4421 radius: 5,
4422
4423 /**
4424 *| Parameter | Description |Type | Required | Values|
4425 *| --- | --- | --- | --- | --- |
4426 *| useMaxWidth | See notes | Boolean | 4 | True, False |
4427 *
4428 ***Notes:**when this flag is set the height and width is set to 100% and is then scaling with the
4429 *available space if not the absolute space required is used.
4430 *
4431 ***Default value true**.
4432 */
4433 useMaxWidth: true
4434 },
4435
4436 /**
4437 * The object containing configurations specific for entity relationship diagrams
4438 */
4439 er: {
4440 /**
4441 *| Parameter | Description |Type | Required | Values|
4442 *| --- | --- | --- | --- | --- |
4443 *| diagramPadding | amount of padding around the diagram as a whole | Integer | Required | Any Positive Value |
4444 *
4445 ***Notes:**The amount of padding around the diagram as a whole so that embedded diagrams have margins, expressed in pixels
4446 ***Default value: 20**.
4447 */
4448 diagramPadding: 20,
4449
4450 /**
4451 *| Parameter | Description |Type | Required | Values|
4452 *| --- | --- | --- | --- | --- |
4453 *| layoutDirection | Directional bias for layout of entities. | String | Required | "TB", "BT","LR","RL" |
4454 *
4455 ***Notes:**
4456 *'TB' for Top-Bottom, 'BT'for Bottom-Top, 'LR' for Left-Right, or 'RL' for Right to Left.
4457 * T = top, B = bottom, L = left, and R = right.
4458 ***Default value: TB **.
4459 */
4460 layoutDirection: 'TB',
4461
4462 /**
4463 *| Parameter | Description |Type | Required | Values|
4464 *| --- | --- | --- | --- | --- |
4465 *| minEntityWidth | The mimimum width of an entity box, | Integer | Required| Any Positive Value |
4466 *
4467 ***Notes:**expressed in pixels
4468 ***Default value: 100**.
4469 */
4470 minEntityWidth: 100,
4471
4472 /**
4473 *| Parameter | Description |Type | Required | Values|
4474 *| --- | --- | --- | --- | --- |
4475 *| minEntityHeight| The minimum height of an entity box, | Integer | 4 | Any Positive Value |
4476 *
4477 ***Notes:**expressed in pixels
4478 ***Default value: 75 **
4479 */
4480 minEntityHeight: 75,
4481
4482 /**
4483 *| Parameter | Description |Type | Required | Values|
4484 *| --- | --- | --- | --- | --- |
4485 *| entityPadding|minimum internal padding betweentext in box and box borders| Integer | 4 | Any Positive Value |
4486 *
4487 ***Notes:**The minimum internal padding betweentext in an entity box and the enclosing box borders, expressed in pixels.
4488 ***Default value: 15 **
4489 */
4490 entityPadding: 15,
4491
4492 /**
4493 *| Parameter | Description |Type | Required | Values|
4494 *| --- | --- | --- | --- | --- |
4495 *| stroke | Stroke color of box edges and lines | String | 4 | Any recognized color |
4496 ***Default value: gray **
4497 */
4498 stroke: 'gray',
4499
4500 /**
4501 *| Parameter | Description |Type | Required | Values|
4502 *| --- | --- | --- | --- | --- |
4503 *| fill | Fill color of entity boxes | String | 4 | Any recognized color |
4504 *
4505 ***Notes:**
4506 ***Default value:'honeydew'**
4507 */
4508 fill: 'honeydew',
4509
4510 /**
4511 *| Parameter | Description |Type | Required | Values|
4512 *| --- | --- | --- | --- | --- |
4513 *| fontSize| Font Size in pixels| Integer | | Any Positive Value |
4514 *
4515 ***Notes:**Font size (expressed as an integer representing a number of pixels)
4516 ***Default value: 12 **
4517 */
4518 fontSize: 12,
4519
4520 /**
4521 *| Parameter | Description |Type | Required | Values|
4522 *| --- | --- | --- | --- | --- |
4523 *| useMaxWidth | See Notes | Boolean | Required | true, false |
4524 *
4525 ***Notes:**
4526 *When this flag is set to true, the diagram width is locked to 100% and
4527 *scaled based on available space. If set to false, the diagram reserves its
4528 *absolute width.
4529 ***Default value: true**.
4530 */
4531 useMaxWidth: true
4532 },
4533
4534 /**
4535 * The object containing configurations specific for pie diagrams
4536 */
4537 pie: {
4538 useWidth: undefined,
4539
4540 /**
4541 *| Parameter | Description |Type | Required | Values|
4542 *| --- | --- | --- | --- | --- |
4543 *| useMaxWidth | See Notes | Boolean | Required | true, false |
4544 *
4545 ***Notes:**
4546 *When this flag is set to true, the diagram width is locked to 100% and
4547 *scaled based on available space. If set to false, the diagram reserves its
4548 *absolute width.
4549 ***Default value: true**.
4550 */
4551 useMaxWidth: true
4552 }
4553};
4554config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
4555config.git.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
4556/* harmony default export */ __webpack_exports__["default"] = (config);
4557
4558/***/ }),
4559
4560/***/ "./src/diagrams/class/classDb.js":
4561/*!***************************************!*\
4562 !*** ./src/diagrams/class/classDb.js ***!
4563 \***************************************/
4564/*! exports provided: parseDirective, addClass, lookUpDomId, clear, getClass, getClasses, getRelations, addRelation, addAnnotation, addMember, addMembers, cleanupLabel, setCssClass, setLink, setClickEvent, bindFunctions, lineType, relationType, default */
4565/***/ (function(module, __webpack_exports__, __webpack_require__) {
4566
4567"use strict";
4568__webpack_require__.r(__webpack_exports__);
4569/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
4570/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addClass", function() { return addClass; });
4571/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lookUpDomId", function() { return lookUpDomId; });
4572/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
4573/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClass", function() { return getClass; });
4574/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClasses", function() { return getClasses; });
4575/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRelations", function() { return getRelations; });
4576/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addRelation", function() { return addRelation; });
4577/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addAnnotation", function() { return addAnnotation; });
4578/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addMember", function() { return addMember; });
4579/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addMembers", function() { return addMembers; });
4580/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cleanupLabel", function() { return cleanupLabel; });
4581/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setCssClass", function() { return setCssClass; });
4582/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLink", function() { return setLink; });
4583/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setClickEvent", function() { return setClickEvent; });
4584/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindFunctions", function() { return bindFunctions; });
4585/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lineType", function() { return lineType; });
4586/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "relationType", function() { return relationType; });
4587/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
4588/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
4589/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
4590/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
4591/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
4592/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
4593/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
4594
4595
4596
4597
4598
4599
4600var MERMAID_DOM_ID_PREFIX = 'classid-';
4601var relations = [];
4602var classes = {};
4603var classCounter = 0;
4604var funs = [];
4605var parseDirective = function parseDirective(statement, context, type) {
4606 _mermaidAPI__WEBPACK_IMPORTED_MODULE_5__["default"].parseDirective(this, statement, context, type);
4607};
4608
4609var splitClassNameAndType = function splitClassNameAndType(id) {
4610 var genericType = '';
4611 var className = id;
4612
4613 if (id.indexOf('~') > 0) {
4614 var split = id.split('~');
4615 className = split[0];
4616 genericType = split[1];
4617 }
4618
4619 return {
4620 className: className,
4621 type: genericType
4622 };
4623};
4624/**
4625 * Function called by parser when a node definition has been found.
4626 * @param id
4627 * @public
4628 */
4629
4630
4631var addClass = function addClass(id) {
4632 var classId = splitClassNameAndType(id); // Only add class if not exists
4633
4634 if (typeof classes[classId.className] !== 'undefined') return;
4635 classes[classId.className] = {
4636 id: classId.className,
4637 type: classId.type,
4638 cssClasses: [],
4639 methods: [],
4640 members: [],
4641 annotations: [],
4642 domId: MERMAID_DOM_ID_PREFIX + classId.className + '-' + classCounter
4643 };
4644 classCounter++;
4645};
4646/**
4647 * Function to lookup domId from id in the graph definition.
4648 * @param id
4649 * @public
4650 */
4651
4652var lookUpDomId = function lookUpDomId(id) {
4653 var classKeys = Object.keys(classes);
4654
4655 for (var i = 0; i < classKeys.length; i++) {
4656 if (classes[classKeys[i]].id === id) {
4657 return classes[classKeys[i]].domId;
4658 }
4659 }
4660};
4661var clear = function clear() {
4662 relations = [];
4663 classes = {};
4664 funs = [];
4665 funs.push(setupToolTips);
4666};
4667var getClass = function getClass(id) {
4668 return classes[id];
4669};
4670var getClasses = function getClasses() {
4671 return classes;
4672};
4673var getRelations = function getRelations() {
4674 return relations;
4675};
4676var addRelation = function addRelation(relation) {
4677 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].debug('Adding relation: ' + JSON.stringify(relation));
4678 addClass(relation.id1);
4679 addClass(relation.id2);
4680 relation.id1 = splitClassNameAndType(relation.id1).className;
4681 relation.id2 = splitClassNameAndType(relation.id2).className;
4682 relations.push(relation);
4683};
4684/**
4685 * Adds an annotation to the specified class
4686 * Annotations mark special properties of the given type (like 'interface' or 'service')
4687 * @param className The class name
4688 * @param annotation The name of the annotation without any brackets
4689 * @public
4690 */
4691
4692var addAnnotation = function addAnnotation(className, annotation) {
4693 var validatedClassName = splitClassNameAndType(className).className;
4694 classes[validatedClassName].annotations.push(annotation);
4695};
4696/**
4697 * Adds a member to the specified class
4698 * @param className The class name
4699 * @param member The full name of the member.
4700 * If the member is enclosed in <<brackets>> it is treated as an annotation
4701 * If the member is ending with a closing bracket ) it is treated as a method
4702 * Otherwise the member will be treated as a normal property
4703 * @public
4704 */
4705
4706var addMember = function addMember(className, member) {
4707 var validatedClassName = splitClassNameAndType(className).className;
4708 var theClass = classes[validatedClassName];
4709
4710 if (typeof member === 'string') {
4711 // Member can contain white spaces, we trim them out
4712 var memberString = member.trim();
4713
4714 if (memberString.startsWith('<<') && memberString.endsWith('>>')) {
4715 // Remove leading and trailing brackets
4716 theClass.annotations.push(memberString.substring(2, memberString.length - 2));
4717 } else if (memberString.indexOf(')') > 0) {
4718 theClass.methods.push(memberString);
4719 } else if (memberString) {
4720 theClass.members.push(memberString);
4721 }
4722 }
4723};
4724var addMembers = function addMembers(className, members) {
4725 if (Array.isArray(members)) {
4726 members.reverse();
4727 members.forEach(function (member) {
4728 return addMember(className, member);
4729 });
4730 }
4731};
4732var cleanupLabel = function cleanupLabel(label) {
4733 if (label.substring(0, 1) === ':') {
4734 return label.substr(1).trim();
4735 } else {
4736 return label.trim();
4737 }
4738};
4739/**
4740 * Called by parser when a special node is found, e.g. a clickable element.
4741 * @param ids Comma separated list of ids
4742 * @param className Class to add
4743 */
4744
4745var setCssClass = function setCssClass(ids, className) {
4746 ids.split(',').forEach(function (_id) {
4747 var id = _id;
4748 if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
4749
4750 if (typeof classes[id] !== 'undefined') {
4751 classes[id].cssClasses.push(className);
4752 }
4753 });
4754};
4755/**
4756 * Called by parser when a link is found. Adds the URL to the vertex data.
4757 * @param ids Comma separated list of ids
4758 * @param linkStr URL to create a link for
4759 * @param tooltip Tooltip for the clickable element
4760 */
4761
4762var setLink = function setLink(ids, linkStr, tooltip) {
4763 var config = _config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]();
4764 ids.split(',').forEach(function (_id) {
4765 var id = _id;
4766 if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
4767
4768 if (typeof classes[id] !== 'undefined') {
4769 classes[id].link = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].formatUrl(linkStr, config);
4770
4771 if (tooltip) {
4772 classes[id].tooltip = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(tooltip, config);
4773 }
4774 }
4775 });
4776 setCssClass(ids, 'clickable');
4777};
4778/**
4779 * Called by parser when a click definition is found. Registers an event handler.
4780 * @param ids Comma separated list of ids
4781 * @param functionName Function to be called on click
4782 * @param tooltip Tooltip for the clickable element
4783 */
4784
4785var setClickEvent = function setClickEvent(ids, functionName, tooltip) {
4786 ids.split(',').forEach(function (id) {
4787 setClickFunc(id, functionName, tooltip);
4788 classes[id].haveCallback = true;
4789 });
4790 setCssClass(ids, 'clickable');
4791};
4792
4793var setClickFunc = function setClickFunc(domId, functionName, tooltip) {
4794 var config = _config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]();
4795 var id = domId;
4796 var elemId = lookUpDomId(id);
4797
4798 if (config.securityLevel !== 'loose') {
4799 return;
4800 }
4801
4802 if (typeof functionName === 'undefined') {
4803 return;
4804 }
4805
4806 if (typeof classes[id] !== 'undefined') {
4807 if (tooltip) {
4808 classes[id].tooltip = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(tooltip, config);
4809 }
4810
4811 funs.push(function () {
4812 var elem = document.querySelector("[id=\"".concat(elemId, "\"]"));
4813
4814 if (elem !== null) {
4815 elem.addEventListener('click', function () {
4816 _utils__WEBPACK_IMPORTED_MODULE_4__["default"].runFunc(functionName, elemId);
4817 }, false);
4818 }
4819 });
4820 }
4821};
4822
4823var bindFunctions = function bindFunctions(element) {
4824 funs.forEach(function (fun) {
4825 fun(element);
4826 });
4827};
4828var lineType = {
4829 LINE: 0,
4830 DOTTED_LINE: 1
4831};
4832var relationType = {
4833 AGGREGATION: 0,
4834 EXTENSION: 1,
4835 COMPOSITION: 2,
4836 DEPENDENCY: 3
4837};
4838
4839var setupToolTips = function setupToolTips(element) {
4840 var tooltipElem = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('.mermaidTooltip');
4841
4842 if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
4843 tooltipElem = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
4844 }
4845
4846 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(element).select('svg');
4847 var nodes = svg.selectAll('g.node');
4848 nodes.on('mouseover', function () {
4849 var el = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(this);
4850 var title = el.attr('title'); // Dont try to draw a tooltip if no data is provided
4851
4852 if (title === null) {
4853 return;
4854 }
4855
4856 var rect = this.getBoundingClientRect();
4857 tooltipElem.transition().duration(200).style('opacity', '.9');
4858 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');
4859 el.classed('hover', true);
4860 }).on('mouseout', function () {
4861 tooltipElem.transition().duration(500).style('opacity', 0);
4862 var el = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(this);
4863 el.classed('hover', false);
4864 });
4865};
4866
4867funs.push(setupToolTips);
4868/* harmony default export */ __webpack_exports__["default"] = ({
4869 parseDirective: parseDirective,
4870 getConfig: function getConfig() {
4871 return _config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]().class;
4872 },
4873 addClass: addClass,
4874 bindFunctions: bindFunctions,
4875 clear: clear,
4876 getClass: getClass,
4877 getClasses: getClasses,
4878 addAnnotation: addAnnotation,
4879 getRelations: getRelations,
4880 addRelation: addRelation,
4881 addMember: addMember,
4882 addMembers: addMembers,
4883 cleanupLabel: cleanupLabel,
4884 lineType: lineType,
4885 relationType: relationType,
4886 setClickEvent: setClickEvent,
4887 setCssClass: setCssClass,
4888 setLink: setLink,
4889 lookUpDomId: lookUpDomId
4890});
4891
4892/***/ }),
4893
4894/***/ "./src/diagrams/class/classRenderer-v2.js":
4895/*!************************************************!*\
4896 !*** ./src/diagrams/class/classRenderer-v2.js ***!
4897 \************************************************/
4898/*! exports provided: addClasses, addRelations, setConf, drawOld, draw, default */
4899/***/ (function(module, __webpack_exports__, __webpack_require__) {
4900
4901"use strict";
4902__webpack_require__.r(__webpack_exports__);
4903/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addClasses", function() { return addClasses; });
4904/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addRelations", function() { return addRelations; });
4905/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
4906/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawOld", function() { return drawOld; });
4907/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
4908/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
4909/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
4910/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
4911/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
4912/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
4913/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
4914/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
4915/* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
4916/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
4917/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__);
4918/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/class/svgDraw.js");
4919/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../config */ "./src/config.js");
4920/* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
4921/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
4922/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
4923
4924
4925
4926
4927
4928
4929
4930
4931 // import addHtmlLabel from 'dagre-d3/lib/label/add-html-label.js';
4932
4933
4934
4935
4936_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].yy = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"];
4937var idCache = {};
4938var padding = 20;
4939var conf = {
4940 dividerMargin: 10,
4941 padding: 5,
4942 textHeight: 10
4943};
4944/**
4945 * Function that adds the vertices found during parsing to the graph to be rendered.
4946 * @param vert Object containing the vertices.
4947 * @param g The graph that is to be drawn.
4948 */
4949
4950var addClasses = function addClasses(classes, g) {
4951 // const svg = select(`[id="${svgId}"]`);
4952 var keys = Object.keys(classes);
4953 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('keys:', keys);
4954 _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
4955
4956 keys.forEach(function (id) {
4957 var vertex = classes[id];
4958 /**
4959 * Variable for storing the classes for the vertex
4960 * @type {string}
4961 */
4962
4963 var cssClassStr = '';
4964
4965 if (vertex.cssClasses.length > 0) {
4966 cssClassStr = cssClassStr + ' ' + vertex.cssClasses.join(' ');
4967 } // if (vertex.classes.length > 0) {
4968 // classStr = vertex.classes.join(' ');
4969 // }
4970
4971
4972 var styles = {
4973 labelStyle: ''
4974 }; //getStylesFromArray(vertex.styles);
4975 // Use vertex id as text in the box if no text is provided by the graph definition
4976
4977 var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
4978 // let vertexNode;
4979 // if (getConfig().flowchart.htmlLabels) {
4980 // const node = {
4981 // label: vertexText.replace(
4982 // /fa[lrsb]?:fa-[\w-]+/g,
4983 // s => `<i class='${s.replace(':', ' ')}'></i>`
4984 // )
4985 // };
4986 // vertexNode = addHtmlLabel(svg, node).node();
4987 // vertexNode.parentNode.removeChild(vertexNode);
4988 // } else {
4989 // const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
4990 // svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
4991 // const rows = vertexText.split(common.lineBreakRegex);
4992 // for (let j = 0; j < rows.length; j++) {
4993 // const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
4994 // tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
4995 // tspan.setAttribute('dy', '1em');
4996 // tspan.setAttribute('x', '1');
4997 // tspan.textContent = rows[j];
4998 // svgLabel.appendChild(tspan);
4999 // }
5000 // vertexNode = svgLabel;
5001 // }
5002
5003 var radious = 0;
5004 var _shape = ''; // Set the shape based parameters
5005
5006 switch (vertex.type) {
5007 case 'class':
5008 _shape = 'class_box';
5009 break;
5010
5011 default:
5012 _shape = 'class_box';
5013 } // Add the node
5014
5015
5016 g.setNode(vertex.id, {
5017 labelStyle: styles.labelStyle,
5018 shape: _shape,
5019 labelText: vertexText,
5020 classData: vertex,
5021 rx: radious,
5022 ry: radious,
5023 class: cssClassStr,
5024 style: styles.style,
5025 id: vertex.id,
5026 domId: vertex.domId,
5027 haveCallback: vertex.haveCallback,
5028 link: vertex.link,
5029 width: vertex.type === 'group' ? 500 : undefined,
5030 type: vertex.type,
5031 padding: Object(_config__WEBPACK_IMPORTED_MODULE_7__["getConfig"])().flowchart.padding
5032 });
5033 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('setNode', {
5034 labelStyle: styles.labelStyle,
5035 shape: _shape,
5036 labelText: vertexText,
5037 rx: radious,
5038 ry: radious,
5039 class: cssClassStr,
5040 style: styles.style,
5041 id: vertex.id,
5042 width: vertex.type === 'group' ? 500 : undefined,
5043 type: vertex.type,
5044 padding: Object(_config__WEBPACK_IMPORTED_MODULE_7__["getConfig"])().flowchart.padding
5045 });
5046 });
5047};
5048/**
5049 * Add edges to graph based on parsed graph defninition
5050 * @param {Object} edges The edges to add to the graph
5051 * @param {Object} g The graph object
5052 */
5053
5054var addRelations = function addRelations(relations, g) {
5055 var cnt = 0;
5056 var defaultStyle;
5057 var defaultLabelStyle; // if (typeof relations.defaultStyle !== 'undefined') {
5058 // const defaultStyles = getStylesFromArray(relations.defaultStyle);
5059 // defaultStyle = defaultStyles.style;
5060 // defaultLabelStyle = defaultStyles.labelStyle;
5061 // }
5062
5063 relations.forEach(function (edge) {
5064 cnt++;
5065 var edgeData = {}; //Set relationship style and line type
5066
5067 edgeData.classes = 'relation';
5068 edgeData.pattern = edge.relation.lineType == 1 ? 'dashed' : 'solid';
5069 edgeData.id = 'id' + cnt; // Set link type for rendering
5070
5071 if (edge.type === 'arrow_open') {
5072 edgeData.arrowhead = 'none';
5073 } else {
5074 edgeData.arrowhead = 'normal';
5075 }
5076
5077 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info(edgeData, edge); //Set edge extra labels
5078 //edgeData.startLabelLeft = edge.relationTitle1;
5079
5080 edgeData.startLabelRight = edge.relationTitle1 === 'none' ? '' : edge.relationTitle1;
5081 edgeData.endLabelLeft = edge.relationTitle2 === 'none' ? '' : edge.relationTitle2; //edgeData.endLabelRight = edge.relationTitle2;
5082 //Set relation arrow types
5083
5084 edgeData.arrowTypeStart = getArrowMarker(edge.relation.type1);
5085 edgeData.arrowTypeEnd = getArrowMarker(edge.relation.type2);
5086 var style = '';
5087 var labelStyle = '';
5088
5089 if (typeof edge.style !== 'undefined') {
5090 var styles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(edge.style);
5091 style = styles.style;
5092 labelStyle = styles.labelStyle;
5093 } else {
5094 style = 'fill:none';
5095
5096 if (typeof defaultStyle !== 'undefined') {
5097 style = defaultStyle;
5098 }
5099
5100 if (typeof defaultLabelStyle !== 'undefined') {
5101 labelStyle = defaultLabelStyle;
5102 }
5103 }
5104
5105 edgeData.style = style;
5106 edgeData.labelStyle = labelStyle;
5107
5108 if (typeof edge.interpolate !== 'undefined') {
5109 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_0__["curveLinear"]);
5110 } else if (typeof relations.defaultInterpolate !== 'undefined') {
5111 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(relations.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_0__["curveLinear"]);
5112 } else {
5113 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(conf.curve, d3__WEBPACK_IMPORTED_MODULE_0__["curveLinear"]);
5114 }
5115
5116 edge.text = edge.title;
5117
5118 if (typeof edge.text === 'undefined') {
5119 if (typeof edge.style !== 'undefined') {
5120 edgeData.arrowheadStyle = 'fill: #333';
5121 }
5122 } else {
5123 edgeData.arrowheadStyle = 'fill: #333';
5124 edgeData.labelpos = 'c';
5125
5126 if (Object(_config__WEBPACK_IMPORTED_MODULE_7__["getConfig"])().flowchart.htmlLabels && false) {
5127 // eslint-disable-line
5128 edgeData.labelType = 'html';
5129 edgeData.label = '<span class="edgeLabel">' + edge.text + '</span>';
5130 } else {
5131 edgeData.labelType = 'text';
5132 edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_10__["default"].lineBreakRegex, '\n');
5133
5134 if (typeof edge.style === 'undefined') {
5135 edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
5136 }
5137
5138 edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
5139 }
5140 } // Add the edge to the graph
5141
5142
5143 g.setEdge(edge.id1, edge.id2, edgeData, cnt);
5144 });
5145}; // Todo optimize
5146
5147var getGraphId = function getGraphId(label) {
5148 var keys = Object.keys(idCache);
5149
5150 for (var i = 0; i < keys.length; i++) {
5151 if (idCache[keys[i]].label === label) {
5152 return keys[i];
5153 }
5154 }
5155
5156 return undefined;
5157};
5158
5159var setConf = function setConf(cnf) {
5160 var keys = Object.keys(cnf);
5161 keys.forEach(function (key) {
5162 conf[key] = cnf[key];
5163 });
5164};
5165/**
5166 * Draws a flowchart in the tag with id: id based on the graph definition in text.
5167 * @param text
5168 * @param id
5169 */
5170
5171var drawOld = function drawOld(text, id) {
5172 idCache = {};
5173 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].yy.clear();
5174 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].parse(text);
5175 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
5176
5177 var diagram = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id='".concat(id, "']")); // insertMarkers(diagram);
5178 // Layout graph, Create a new directed graph
5179
5180 var g = new graphlib__WEBPACK_IMPORTED_MODULE_2___default.a.Graph({
5181 multigraph: true
5182 }); // Set an object for the graph label
5183
5184 g.setGraph({
5185 isMultiGraph: true
5186 }); // Default to assigning a new object as a label for each new edge.
5187
5188 g.setDefaultEdgeLabel(function () {
5189 return {};
5190 });
5191 var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
5192 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('classes:');
5193 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info(classes);
5194 var keys = Object.keys(classes);
5195
5196 for (var i = 0; i < keys.length; i++) {
5197 var classDef = classes[keys[i]];
5198 var node = _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawClass(diagram, classDef, conf);
5199 idCache[node.id] = node; // Add nodes to the graph. The first argument is the node id. The second is
5200 // metadata about the node. In this case we're going to add labels to each of
5201 // our nodes.
5202
5203 g.setNode(node.id, node);
5204 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Org height: ' + node.height);
5205 }
5206
5207 var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
5208 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('relations:', relations);
5209 relations.forEach(function (relation) {
5210 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation));
5211 g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), {
5212 relation: relation
5213 }, relation.title || 'DEFAULT');
5214 });
5215 dagre__WEBPACK_IMPORTED_MODULE_1___default.a.layout(g);
5216 g.nodes().forEach(function (v) {
5217 if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
5218 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
5219 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) + ' )');
5220 }
5221 });
5222 g.edges().forEach(function (e) {
5223 if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
5224 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
5225 _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawEdge(diagram, g.edge(e), g.edge(e).relation, conf);
5226 }
5227 });
5228 var svgBounds = diagram.node().getBBox();
5229 var width = svgBounds.width + padding * 2;
5230 var height = svgBounds.height + padding * 2;
5231 Object(_utils__WEBPACK_IMPORTED_MODULE_9__["configureSvgSize"])(diagram, height, width, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
5232
5233 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
5234 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug("viewBox ".concat(vBox));
5235 diagram.attr('viewBox', vBox);
5236};
5237var draw = function draw(text, id) {
5238 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Drawing class');
5239 _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].clear(); // const parser = classDb.parser;
5240 // parser.yy = classDb;
5241 // Parse the graph definition
5242 // try {
5243
5244 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].parse(text); // } catch (err) {
5245 // logger.debug('Parsing failed');
5246 // }
5247 // Fetch the default direction, use TD if none was found
5248
5249 var dir = 'TD';
5250 var conf = Object(_config__WEBPACK_IMPORTED_MODULE_7__["getConfig"])().flowchart;
5251 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('config:', conf);
5252 var nodeSpacing = conf.nodeSpacing || 50;
5253 var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
5254
5255 var g = new graphlib__WEBPACK_IMPORTED_MODULE_2___default.a.Graph({
5256 multigraph: true,
5257 compound: true
5258 }).setGraph({
5259 rankdir: dir,
5260 nodesep: nodeSpacing,
5261 ranksep: rankSpacing,
5262 marginx: 8,
5263 marginy: 8
5264 }).setDefaultEdgeLabel(function () {
5265 return {};
5266 }); // let subG;
5267 // const subGraphs = flowDb.getSubGraphs();
5268 // logger.info('Subgraphs - ', subGraphs);
5269 // for (let i = subGraphs.length - 1; i >= 0; i--) {
5270 // subG = subGraphs[i];
5271 // logger.info('Subgraph - ', subG);
5272 // flowDb.addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
5273 // }
5274 // Fetch the verices/nodes and edges/links from the parsed graph definition
5275
5276 var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
5277 var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
5278 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info(relations); // let i = 0;
5279 // for (i = subGraphs.length - 1; i >= 0; i--) {
5280 // subG = subGraphs[i];
5281 // selectAll('cluster').append('text');
5282 // for (let j = 0; j < subG.nodes.length; j++) {
5283 // g.setParent(subG.nodes[j], subG.id);
5284 // }
5285 // }
5286
5287 addClasses(classes, g, id);
5288 addRelations(relations, g); // Add custom shapes
5289 // flowChartShapes.addToRenderV2(addShape);
5290 // Set up an SVG group so that we can translate the final graph.
5291
5292 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id=\"".concat(id, "\"]"));
5293 svg.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink'); // Run the renderer. This is what draws the final graph.
5294
5295 var element = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + id + ' g');
5296 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() {
5297 // return flowDb.getTooltip(this.id);
5298 // });
5299
5300 var padding = 8;
5301 var svgBounds = svg.node().getBBox();
5302 var width = svgBounds.width + padding * 2;
5303 var height = svgBounds.height + padding * 2;
5304 _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, ")"));
5305 Object(_utils__WEBPACK_IMPORTED_MODULE_9__["configureSvgSize"])(svg, height, width, conf.useMaxWidth);
5306 svg.attr('viewBox', "0 0 ".concat(width, " ").concat(height));
5307 svg.select('g').attr('transform', "translate(".concat(padding - g._label.marginx, ", ").concat(padding - svgBounds.y, ")")); // Index nodes
5308 // flowDb.indexNodes('subGraph' + i);
5309 // Add label rects for non html labels
5310
5311 if (!conf.htmlLabels) {
5312 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
5313
5314 for (var k = 0; k < labels.length; k++) {
5315 var label = labels[k]; // Get dimensions of label
5316
5317 var dim = label.getBBox();
5318 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
5319 rect.setAttribute('rx', 0);
5320 rect.setAttribute('ry', 0);
5321 rect.setAttribute('width', dim.width);
5322 rect.setAttribute('height', dim.height);
5323 rect.setAttribute('style', 'fill:#e8e8e8;');
5324 label.insertBefore(rect, label.firstChild);
5325 }
5326 } // If node has a link, wrap it in an anchor SVG object.
5327 // const keys = Object.keys(classes);
5328 // keys.forEach(function(key) {
5329 // const vertex = classes[key];
5330 // if (vertex.link) {
5331 // const node = select('#' + id + ' [id="' + key + '"]');
5332 // if (node) {
5333 // const link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
5334 // link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
5335 // link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
5336 // link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
5337 // const linkNode = node.insert(function() {
5338 // return link;
5339 // }, ':first-child');
5340 // const shape = node.select('.label-container');
5341 // if (shape) {
5342 // linkNode.append(function() {
5343 // return shape.node();
5344 // });
5345 // }
5346 // const label = node.select('.label');
5347 // if (label) {
5348 // linkNode.append(function() {
5349 // return label.node();
5350 // });
5351 // }
5352 // }
5353 // }
5354 // });
5355
5356};
5357/* harmony default export */ __webpack_exports__["default"] = ({
5358 setConf: setConf,
5359 draw: draw
5360});
5361
5362function getArrowMarker(type) {
5363 var marker;
5364
5365 switch (type) {
5366 case 0:
5367 marker = 'aggregation';
5368 break;
5369
5370 case 1:
5371 marker = 'extension';
5372 break;
5373
5374 case 2:
5375 marker = 'composition';
5376 break;
5377
5378 case 3:
5379 marker = 'dependency';
5380 break;
5381
5382 default:
5383 marker = 'none';
5384 }
5385
5386 return marker;
5387}
5388
5389/***/ }),
5390
5391/***/ "./src/diagrams/class/classRenderer.js":
5392/*!*********************************************!*\
5393 !*** ./src/diagrams/class/classRenderer.js ***!
5394 \*********************************************/
5395/*! exports provided: setConf, draw, default */
5396/***/ (function(module, __webpack_exports__, __webpack_require__) {
5397
5398"use strict";
5399__webpack_require__.r(__webpack_exports__);
5400/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
5401/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
5402/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
5403/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
5404/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
5405/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
5406/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
5407/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
5408/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
5409/* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
5410/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
5411/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__);
5412/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/class/svgDraw.js");
5413/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
5414
5415
5416
5417
5418
5419
5420
5421
5422_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].yy = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"];
5423var idCache = {};
5424var padding = 20;
5425var conf = {
5426 dividerMargin: 10,
5427 padding: 5,
5428 textHeight: 10
5429}; // Todo optimize
5430
5431var getGraphId = function getGraphId(label) {
5432 var keys = Object.keys(idCache);
5433
5434 for (var i = 0; i < keys.length; i++) {
5435 if (idCache[keys[i]].label === label) {
5436 return keys[i];
5437 }
5438 }
5439
5440 return undefined;
5441};
5442/**
5443 * Setup arrow head and define the marker. The result is appended to the svg.
5444 */
5445
5446
5447var insertMarkers = function insertMarkers(elem) {
5448 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');
5449 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
5450
5451 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');
5452 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');
5453 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');
5454 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');
5455 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');
5456 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');
5457};
5458
5459var setConf = function setConf(cnf) {
5460 var keys = Object.keys(cnf);
5461 keys.forEach(function (key) {
5462 conf[key] = cnf[key];
5463 });
5464};
5465/**
5466 * Draws a flowchart in the tag with id: id based on the graph definition in text.
5467 * @param text
5468 * @param id
5469 */
5470
5471var draw = function draw(text, id) {
5472 idCache = {};
5473 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].yy.clear();
5474 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__["parser"].parse(text);
5475 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
5476
5477 var diagram = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id='".concat(id, "']"));
5478 diagram.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink');
5479 insertMarkers(diagram); // Layout graph, Create a new directed graph
5480
5481 var g = new graphlib__WEBPACK_IMPORTED_MODULE_2___default.a.Graph({
5482 multigraph: true
5483 }); // Set an object for the graph label
5484
5485 g.setGraph({
5486 isMultiGraph: true
5487 }); // Default to assigning a new object as a label for each new edge.
5488
5489 g.setDefaultEdgeLabel(function () {
5490 return {};
5491 });
5492 var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
5493 var keys = Object.keys(classes);
5494
5495 for (var i = 0; i < keys.length; i++) {
5496 var classDef = classes[keys[i]];
5497 var node = _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawClass(diagram, classDef, conf);
5498 idCache[node.id] = node; // Add nodes to the graph. The first argument is the node id. The second is
5499 // metadata about the node. In this case we're going to add labels to each of
5500 // our nodes.
5501
5502 g.setNode(node.id, node);
5503 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Org height: ' + node.height);
5504 }
5505
5506 var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
5507 relations.forEach(function (relation) {
5508 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation));
5509 g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), {
5510 relation: relation
5511 }, relation.title || 'DEFAULT');
5512 });
5513 dagre__WEBPACK_IMPORTED_MODULE_1___default.a.layout(g);
5514 g.nodes().forEach(function (v) {
5515 if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
5516 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
5517 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) + ' )');
5518 }
5519 });
5520 g.edges().forEach(function (e) {
5521 if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
5522 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
5523 _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawEdge(diagram, g.edge(e), g.edge(e).relation, conf);
5524 }
5525 });
5526 var svgBounds = diagram.node().getBBox();
5527 var width = svgBounds.width + padding * 2;
5528 var height = svgBounds.height + padding * 2;
5529 Object(_utils__WEBPACK_IMPORTED_MODULE_7__["configureSvgSize"])(diagram, height, width, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
5530
5531 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
5532 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug("viewBox ".concat(vBox));
5533 diagram.attr('viewBox', vBox);
5534};
5535/* harmony default export */ __webpack_exports__["default"] = ({
5536 setConf: setConf,
5537 draw: draw
5538});
5539
5540/***/ }),
5541
5542/***/ "./src/diagrams/class/parser/classDiagram.jison":
5543/*!******************************************************!*\
5544 !*** ./src/diagrams/class/parser/classDiagram.jison ***!
5545 \******************************************************/
5546/*! no static exports found */
5547/***/ (function(module, exports, __webpack_require__) {
5548
5549/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
5550/*
5551 Returns a Parser object of the following structure:
5552
5553 Parser: {
5554 yy: {}
5555 }
5556
5557 Parser.prototype: {
5558 yy: {},
5559 trace: function(),
5560 symbols_: {associative list: name ==> number},
5561 terminals_: {associative list: number ==> name},
5562 productions_: [...],
5563 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
5564 table: [...],
5565 defaultActions: {...},
5566 parseError: function(str, hash),
5567 parse: function(input),
5568
5569 lexer: {
5570 EOF: 1,
5571 parseError: function(str, hash),
5572 setInput: function(input),
5573 input: function(),
5574 unput: function(str),
5575 more: function(),
5576 less: function(n),
5577 pastInput: function(),
5578 upcomingInput: function(),
5579 showPosition: function(),
5580 test_match: function(regex_match_array, rule_index),
5581 next: function(),
5582 lex: function(),
5583 begin: function(condition),
5584 popState: function(),
5585 _currentRules: function(),
5586 topState: function(),
5587 pushState: function(condition),
5588
5589 options: {
5590 ranges: boolean (optional: true ==> token location info will include a .range[] member)
5591 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
5592 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)
5593 },
5594
5595 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
5596 rules: [...],
5597 conditions: {associative list: name ==> set},
5598 }
5599 }
5600
5601
5602 token location info (@$, _$, etc.): {
5603 first_line: n,
5604 last_line: n,
5605 first_column: n,
5606 last_column: n,
5607 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
5608 }
5609
5610
5611 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
5612 text: (matched text)
5613 token: (the produced terminal token, if any)
5614 line: (yylineno)
5615 }
5616 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
5617 loc: (yylloc)
5618 expected: (string describing the set of expected tokens)
5619 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
5620 }
5621*/
5622var parser = (function(){
5623var 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];
5624var parser = {trace: function trace () { },
5625yy: {},
5626symbols_: {"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},
5627terminals_: {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"},
5628productions_: [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]],
5629performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
5630/* this == yyval */
5631
5632var $0 = $$.length - 1;
5633switch (yystate) {
5634case 6:
5635 yy.parseDirective('%%{', 'open_directive');
5636break;
5637case 7:
5638 yy.parseDirective($$[$0], 'type_directive');
5639break;
5640case 8:
5641 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
5642break;
5643case 9:
5644 yy.parseDirective('}%%', 'close_directive', 'class');
5645break;
5646case 14:
5647 this.$=$$[$0];
5648break;
5649case 15:
5650 this.$=$$[$0-1]+$$[$0];
5651break;
5652case 16:
5653 this.$=$$[$0-2]+'~'+$$[$0-1]+$$[$0];
5654break;
5655case 17:
5656 this.$=$$[$0-1]+'~'+$$[$0];
5657break;
5658case 18:
5659 yy.addRelation($$[$0]);
5660break;
5661case 19:
5662 $$[$0-1].title = yy.cleanupLabel($$[$0]); yy.addRelation($$[$0-1]);
5663break;
5664case 26:
5665yy.addClass($$[$0]);
5666break;
5667case 27:
5668yy.addClass($$[$0-2]);yy.setCssClass($$[$0-2], $$[$0]);
5669break;
5670case 28:
5671/*console.log($$[$0-3],JSON.stringify($$[$0-1]));*/yy.addClass($$[$0-3]);yy.addMembers($$[$0-3],$$[$0-1]);
5672break;
5673case 29:
5674yy.addClass($$[$0-5]);yy.setCssClass($$[$0-5], $$[$0-3]);yy.addMembers($$[$0-5],$$[$0-1]);
5675break;
5676case 30:
5677 yy.addAnnotation($$[$0],$$[$0-2]);
5678break;
5679case 31:
5680 this.$ = [$$[$0]];
5681break;
5682case 32:
5683 $$[$0].push($$[$0-1]);this.$=$$[$0];
5684break;
5685case 33:
5686/*console.log('Rel found',$$[$0]);*/
5687break;
5688case 34:
5689yy.addMember($$[$0-1],yy.cleanupLabel($$[$0]));
5690break;
5691case 35:
5692/*console.warn('Member',$$[$0]);*/
5693break;
5694case 36:
5695/*console.log('sep found',$$[$0]);*/
5696break;
5697case 37:
5698 this.$ = {'id1':$$[$0-2],'id2':$$[$0], relation:$$[$0-1], relationTitle1:'none', relationTitle2:'none'};
5699break;
5700case 38:
5701 this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-1], relationTitle1:$$[$0-2], relationTitle2:'none'}
5702break;
5703case 39:
5704 this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-2], relationTitle1:'none', relationTitle2:$$[$0-1]};
5705break;
5706case 40:
5707 this.$ = {id1:$$[$0-4], id2:$$[$0], relation:$$[$0-2], relationTitle1:$$[$0-3], relationTitle2:$$[$0-1]}
5708break;
5709case 41:
5710 this.$={type1:$$[$0-2],type2:$$[$0],lineType:$$[$0-1]};
5711break;
5712case 42:
5713 this.$={type1:'none',type2:$$[$0],lineType:$$[$0-1]};
5714break;
5715case 43:
5716 this.$={type1:$$[$0-1],type2:'none',lineType:$$[$0]};
5717break;
5718case 44:
5719 this.$={type1:'none',type2:'none',lineType:$$[$0]};
5720break;
5721case 45:
5722 this.$=yy.relationType.AGGREGATION;
5723break;
5724case 46:
5725 this.$=yy.relationType.EXTENSION;
5726break;
5727case 47:
5728 this.$=yy.relationType.COMPOSITION;
5729break;
5730case 48:
5731 this.$=yy.relationType.DEPENDENCY;
5732break;
5733case 49:
5734this.$=yy.lineType.LINE;
5735break;
5736case 50:
5737this.$=yy.lineType.DOTTED_LINE;
5738break;
5739case 51:
5740this.$ = $$[$0-2];yy.setClickEvent($$[$0-1], $$[$0], undefined);
5741break;
5742case 52:
5743this.$ = $$[$0-3];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
5744break;
5745case 53:
5746this.$ = $$[$0-2];yy.setLink($$[$0-1], $$[$0], undefined);
5747break;
5748case 54:
5749this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1], $$[$0]);
5750break;
5751case 55:
5752yy.setCssClass($$[$0-1], $$[$0]);
5753break;
5754}
5755},
5756table: [{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])],
5757defaultActions: {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]},
5758parseError: function parseError (str, hash) {
5759 if (hash.recoverable) {
5760 this.trace(str);
5761 } else {
5762 var error = new Error(str);
5763 error.hash = hash;
5764 throw error;
5765 }
5766},
5767parse: function parse(input) {
5768 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
5769 var args = lstack.slice.call(arguments, 1);
5770 var lexer = Object.create(this.lexer);
5771 var sharedState = { yy: {} };
5772 for (var k in this.yy) {
5773 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
5774 sharedState.yy[k] = this.yy[k];
5775 }
5776 }
5777 lexer.setInput(input, sharedState.yy);
5778 sharedState.yy.lexer = lexer;
5779 sharedState.yy.parser = this;
5780 if (typeof lexer.yylloc == 'undefined') {
5781 lexer.yylloc = {};
5782 }
5783 var yyloc = lexer.yylloc;
5784 lstack.push(yyloc);
5785 var ranges = lexer.options && lexer.options.ranges;
5786 if (typeof sharedState.yy.parseError === 'function') {
5787 this.parseError = sharedState.yy.parseError;
5788 } else {
5789 this.parseError = Object.getPrototypeOf(this).parseError;
5790 }
5791 function popStack(n) {
5792 stack.length = stack.length - 2 * n;
5793 vstack.length = vstack.length - n;
5794 lstack.length = lstack.length - n;
5795 }
5796 function lex() {
5797 var token;
5798 token = tstack.pop() || lexer.lex() || EOF;
5799 if (typeof token !== 'number') {
5800 if (token instanceof Array) {
5801 tstack = token;
5802 token = tstack.pop();
5803 }
5804 token = self.symbols_[token] || token;
5805 }
5806 return token;
5807 }
5808 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
5809 while (true) {
5810 state = stack[stack.length - 1];
5811 if (this.defaultActions[state]) {
5812 action = this.defaultActions[state];
5813 } else {
5814 if (symbol === null || typeof symbol == 'undefined') {
5815 symbol = lex();
5816 }
5817 action = table[state] && table[state][symbol];
5818 }
5819 if (typeof action === 'undefined' || !action.length || !action[0]) {
5820 var errStr = '';
5821 expected = [];
5822 for (p in table[state]) {
5823 if (this.terminals_[p] && p > TERROR) {
5824 expected.push('\'' + this.terminals_[p] + '\'');
5825 }
5826 }
5827 if (lexer.showPosition) {
5828 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
5829 } else {
5830 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
5831 }
5832 this.parseError(errStr, {
5833 text: lexer.match,
5834 token: this.terminals_[symbol] || symbol,
5835 line: lexer.yylineno,
5836 loc: yyloc,
5837 expected: expected
5838 });
5839 }
5840 if (action[0] instanceof Array && action.length > 1) {
5841 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
5842 }
5843 switch (action[0]) {
5844 case 1:
5845 stack.push(symbol);
5846 vstack.push(lexer.yytext);
5847 lstack.push(lexer.yylloc);
5848 stack.push(action[1]);
5849 symbol = null;
5850 if (!preErrorSymbol) {
5851 yyleng = lexer.yyleng;
5852 yytext = lexer.yytext;
5853 yylineno = lexer.yylineno;
5854 yyloc = lexer.yylloc;
5855 if (recovering > 0) {
5856 recovering--;
5857 }
5858 } else {
5859 symbol = preErrorSymbol;
5860 preErrorSymbol = null;
5861 }
5862 break;
5863 case 2:
5864 len = this.productions_[action[1]][1];
5865 yyval.$ = vstack[vstack.length - len];
5866 yyval._$ = {
5867 first_line: lstack[lstack.length - (len || 1)].first_line,
5868 last_line: lstack[lstack.length - 1].last_line,
5869 first_column: lstack[lstack.length - (len || 1)].first_column,
5870 last_column: lstack[lstack.length - 1].last_column
5871 };
5872 if (ranges) {
5873 yyval._$.range = [
5874 lstack[lstack.length - (len || 1)].range[0],
5875 lstack[lstack.length - 1].range[1]
5876 ];
5877 }
5878 r = this.performAction.apply(yyval, [
5879 yytext,
5880 yyleng,
5881 yylineno,
5882 sharedState.yy,
5883 action[1],
5884 vstack,
5885 lstack
5886 ].concat(args));
5887 if (typeof r !== 'undefined') {
5888 return r;
5889 }
5890 if (len) {
5891 stack = stack.slice(0, -1 * len * 2);
5892 vstack = vstack.slice(0, -1 * len);
5893 lstack = lstack.slice(0, -1 * len);
5894 }
5895 stack.push(this.productions_[action[1]][0]);
5896 vstack.push(yyval.$);
5897 lstack.push(yyval._$);
5898 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
5899 stack.push(newState);
5900 break;
5901 case 3:
5902 return true;
5903 }
5904 }
5905 return true;
5906}};
5907
5908/* generated by jison-lex 0.3.4 */
5909var lexer = (function(){
5910var lexer = ({
5911
5912EOF:1,
5913
5914parseError:function parseError(str, hash) {
5915 if (this.yy.parser) {
5916 this.yy.parser.parseError(str, hash);
5917 } else {
5918 throw new Error(str);
5919 }
5920 },
5921
5922// resets the lexer, sets new input
5923setInput:function (input, yy) {
5924 this.yy = yy || this.yy || {};
5925 this._input = input;
5926 this._more = this._backtrack = this.done = false;
5927 this.yylineno = this.yyleng = 0;
5928 this.yytext = this.matched = this.match = '';
5929 this.conditionStack = ['INITIAL'];
5930 this.yylloc = {
5931 first_line: 1,
5932 first_column: 0,
5933 last_line: 1,
5934 last_column: 0
5935 };
5936 if (this.options.ranges) {
5937 this.yylloc.range = [0,0];
5938 }
5939 this.offset = 0;
5940 return this;
5941 },
5942
5943// consumes and returns one char from the input
5944input:function () {
5945 var ch = this._input[0];
5946 this.yytext += ch;
5947 this.yyleng++;
5948 this.offset++;
5949 this.match += ch;
5950 this.matched += ch;
5951 var lines = ch.match(/(?:\r\n?|\n).*/g);
5952 if (lines) {
5953 this.yylineno++;
5954 this.yylloc.last_line++;
5955 } else {
5956 this.yylloc.last_column++;
5957 }
5958 if (this.options.ranges) {
5959 this.yylloc.range[1]++;
5960 }
5961
5962 this._input = this._input.slice(1);
5963 return ch;
5964 },
5965
5966// unshifts one char (or a string) into the input
5967unput:function (ch) {
5968 var len = ch.length;
5969 var lines = ch.split(/(?:\r\n?|\n)/g);
5970
5971 this._input = ch + this._input;
5972 this.yytext = this.yytext.substr(0, this.yytext.length - len);
5973 //this.yyleng -= len;
5974 this.offset -= len;
5975 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
5976 this.match = this.match.substr(0, this.match.length - 1);
5977 this.matched = this.matched.substr(0, this.matched.length - 1);
5978
5979 if (lines.length - 1) {
5980 this.yylineno -= lines.length - 1;
5981 }
5982 var r = this.yylloc.range;
5983
5984 this.yylloc = {
5985 first_line: this.yylloc.first_line,
5986 last_line: this.yylineno + 1,
5987 first_column: this.yylloc.first_column,
5988 last_column: lines ?
5989 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
5990 + oldLines[oldLines.length - lines.length].length - lines[0].length :
5991 this.yylloc.first_column - len
5992 };
5993
5994 if (this.options.ranges) {
5995 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
5996 }
5997 this.yyleng = this.yytext.length;
5998 return this;
5999 },
6000
6001// When called from action, caches matched text and appends it on next action
6002more:function () {
6003 this._more = true;
6004 return this;
6005 },
6006
6007// 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.
6008reject:function () {
6009 if (this.options.backtrack_lexer) {
6010 this._backtrack = true;
6011 } else {
6012 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(), {
6013 text: "",
6014 token: null,
6015 line: this.yylineno
6016 });
6017
6018 }
6019 return this;
6020 },
6021
6022// retain first n characters of the match
6023less:function (n) {
6024 this.unput(this.match.slice(n));
6025 },
6026
6027// displays already matched input, i.e. for error messages
6028pastInput:function () {
6029 var past = this.matched.substr(0, this.matched.length - this.match.length);
6030 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
6031 },
6032
6033// displays upcoming input, i.e. for error messages
6034upcomingInput:function () {
6035 var next = this.match;
6036 if (next.length < 20) {
6037 next += this._input.substr(0, 20-next.length);
6038 }
6039 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
6040 },
6041
6042// displays the character position where the lexing error occurred, i.e. for error messages
6043showPosition:function () {
6044 var pre = this.pastInput();
6045 var c = new Array(pre.length + 1).join("-");
6046 return pre + this.upcomingInput() + "\n" + c + "^";
6047 },
6048
6049// test the lexed token: return FALSE when not a match, otherwise return token
6050test_match:function(match, indexed_rule) {
6051 var token,
6052 lines,
6053 backup;
6054
6055 if (this.options.backtrack_lexer) {
6056 // save context
6057 backup = {
6058 yylineno: this.yylineno,
6059 yylloc: {
6060 first_line: this.yylloc.first_line,
6061 last_line: this.last_line,
6062 first_column: this.yylloc.first_column,
6063 last_column: this.yylloc.last_column
6064 },
6065 yytext: this.yytext,
6066 match: this.match,
6067 matches: this.matches,
6068 matched: this.matched,
6069 yyleng: this.yyleng,
6070 offset: this.offset,
6071 _more: this._more,
6072 _input: this._input,
6073 yy: this.yy,
6074 conditionStack: this.conditionStack.slice(0),
6075 done: this.done
6076 };
6077 if (this.options.ranges) {
6078 backup.yylloc.range = this.yylloc.range.slice(0);
6079 }
6080 }
6081
6082 lines = match[0].match(/(?:\r\n?|\n).*/g);
6083 if (lines) {
6084 this.yylineno += lines.length;
6085 }
6086 this.yylloc = {
6087 first_line: this.yylloc.last_line,
6088 last_line: this.yylineno + 1,
6089 first_column: this.yylloc.last_column,
6090 last_column: lines ?
6091 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
6092 this.yylloc.last_column + match[0].length
6093 };
6094 this.yytext += match[0];
6095 this.match += match[0];
6096 this.matches = match;
6097 this.yyleng = this.yytext.length;
6098 if (this.options.ranges) {
6099 this.yylloc.range = [this.offset, this.offset += this.yyleng];
6100 }
6101 this._more = false;
6102 this._backtrack = false;
6103 this._input = this._input.slice(match[0].length);
6104 this.matched += match[0];
6105 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
6106 if (this.done && this._input) {
6107 this.done = false;
6108 }
6109 if (token) {
6110 return token;
6111 } else if (this._backtrack) {
6112 // recover context
6113 for (var k in backup) {
6114 this[k] = backup[k];
6115 }
6116 return false; // rule action called reject() implying the next rule should be tested instead.
6117 }
6118 return false;
6119 },
6120
6121// return next match in input
6122next:function () {
6123 if (this.done) {
6124 return this.EOF;
6125 }
6126 if (!this._input) {
6127 this.done = true;
6128 }
6129
6130 var token,
6131 match,
6132 tempMatch,
6133 index;
6134 if (!this._more) {
6135 this.yytext = '';
6136 this.match = '';
6137 }
6138 var rules = this._currentRules();
6139 for (var i = 0; i < rules.length; i++) {
6140 tempMatch = this._input.match(this.rules[rules[i]]);
6141 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
6142 match = tempMatch;
6143 index = i;
6144 if (this.options.backtrack_lexer) {
6145 token = this.test_match(tempMatch, rules[i]);
6146 if (token !== false) {
6147 return token;
6148 } else if (this._backtrack) {
6149 match = false;
6150 continue; // rule action called reject() implying a rule MISmatch.
6151 } else {
6152 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
6153 return false;
6154 }
6155 } else if (!this.options.flex) {
6156 break;
6157 }
6158 }
6159 }
6160 if (match) {
6161 token = this.test_match(match, rules[index]);
6162 if (token !== false) {
6163 return token;
6164 }
6165 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
6166 return false;
6167 }
6168 if (this._input === "") {
6169 return this.EOF;
6170 } else {
6171 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
6172 text: "",
6173 token: null,
6174 line: this.yylineno
6175 });
6176 }
6177 },
6178
6179// return next match that has a token
6180lex:function lex () {
6181 var r = this.next();
6182 if (r) {
6183 return r;
6184 } else {
6185 return this.lex();
6186 }
6187 },
6188
6189// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
6190begin:function begin (condition) {
6191 this.conditionStack.push(condition);
6192 },
6193
6194// pop the previously active lexer condition state off the condition stack
6195popState:function popState () {
6196 var n = this.conditionStack.length - 1;
6197 if (n > 0) {
6198 return this.conditionStack.pop();
6199 } else {
6200 return this.conditionStack[0];
6201 }
6202 },
6203
6204// produce the lexer rule set which is active for the currently active lexer condition state
6205_currentRules:function _currentRules () {
6206 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
6207 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
6208 } else {
6209 return this.conditions["INITIAL"].rules;
6210 }
6211 },
6212
6213// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
6214topState:function topState (n) {
6215 n = this.conditionStack.length - 1 - Math.abs(n || 0);
6216 if (n >= 0) {
6217 return this.conditionStack[n];
6218 } else {
6219 return "INITIAL";
6220 }
6221 },
6222
6223// alias for begin(condition)
6224pushState:function pushState (condition) {
6225 this.begin(condition);
6226 },
6227
6228// return the number of states currently on the stack
6229stateStackSize:function stateStackSize() {
6230 return this.conditionStack.length;
6231 },
6232options: {},
6233performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
6234var YYSTATE=YY_START;
6235switch($avoiding_name_collisions) {
6236case 0: this.begin('open_directive'); return 13;
6237break;
6238case 1: this.begin('type_directive'); return 14;
6239break;
6240case 2: this.popState(); this.begin('arg_directive'); return 11;
6241break;
6242case 3: this.popState(); this.popState(); return 16;
6243break;
6244case 4:return 15;
6245break;
6246case 5:/* skip comments */
6247break;
6248case 6:/* skip comments */
6249break;
6250case 7:return 10;
6251break;
6252case 8:/* skip whitespace */
6253break;
6254case 9:return 17;
6255break;
6256case 10:return 17;
6257break;
6258case 11: this.begin("struct"); /*console.log('Starting struct');*/ return 33;
6259break;
6260case 12:return "EOF_IN_STRUCT";
6261break;
6262case 13:return "OPEN_IN_STRUCT";
6263break;
6264case 14: /*console.log('Ending struct');*/this.popState(); return 35;
6265break;
6266case 15:/* nothing */
6267break;
6268case 16: /*console.log('lex-member: ' + yy_.yytext);*/ return "MEMBER";
6269break;
6270case 17:return 31;
6271break;
6272case 18:return 52;
6273break;
6274case 19:return 50;
6275break;
6276case 20:return 51;
6277break;
6278case 21:return 36;
6279break;
6280case 22:return 37;
6281break;
6282case 23:this.begin("generic");
6283break;
6284case 24:this.popState();
6285break;
6286case 25:return "GENERICTYPE";
6287break;
6288case 26:this.begin("string");
6289break;
6290case 27:this.popState();
6291break;
6292case 28:return "STR";
6293break;
6294case 29:return 45;
6295break;
6296case 30:return 45;
6297break;
6298case 31:return 47;
6299break;
6300case 32:return 47;
6301break;
6302case 33:return 46;
6303break;
6304case 34:return 44;
6305break;
6306case 35:return 48;
6307break;
6308case 36:return 49;
6309break;
6310case 37:return 25;
6311break;
6312case 38:return 32;
6313break;
6314case 39:return 64;
6315break;
6316case 40:return 'DOT';
6317break;
6318case 41:return 'PLUS';
6319break;
6320case 42:return 61;
6321break;
6322case 43:return 'EQUALS';
6323break;
6324case 44:return 'EQUALS';
6325break;
6326case 45:return 68;
6327break;
6328case 46:return 'PUNCTUATION';
6329break;
6330case 47:return 67;
6331break;
6332case 48:return 66;
6333break;
6334case 49:return 63;
6335break;
6336case 50:return 19;
6337break;
6338}
6339},
6340rules: [/^(?:%%\{)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\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)/,/^(?:$)/],
6341conditions: {"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}}
6342});
6343return lexer;
6344})();
6345parser.lexer = lexer;
6346function Parser () {
6347 this.yy = {};
6348}
6349Parser.prototype = parser;parser.Parser = Parser;
6350return new Parser;
6351})();
6352
6353
6354if (true) {
6355exports.parser = parser;
6356exports.Parser = parser.Parser;
6357exports.parse = function () { return parser.parse.apply(parser, arguments); };
6358exports.main = function commonjsMain (args) {
6359 if (!args[1]) {
6360 console.log('Usage: '+args[0]+' FILE');
6361 process.exit(1);
6362 }
6363 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");
6364 return exports.parser.parse(source);
6365};
6366if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
6367 exports.main(process.argv.slice(1));
6368}
6369}
6370/* 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)))
6371
6372/***/ }),
6373
6374/***/ "./src/diagrams/class/styles.js":
6375/*!**************************************!*\
6376 !*** ./src/diagrams/class/styles.js ***!
6377 \**************************************/
6378/*! exports provided: default */
6379/***/ (function(module, __webpack_exports__, __webpack_require__) {
6380
6381"use strict";
6382__webpack_require__.r(__webpack_exports__);
6383var getStyles = function getStyles(options) {
6384 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}\n\n.classTitle {\n font-weight: bolder;\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\n.edgeTerminals {\n font-size: 11px;\n}\n\n");
6385};
6386
6387/* harmony default export */ __webpack_exports__["default"] = (getStyles);
6388
6389/***/ }),
6390
6391/***/ "./src/diagrams/class/svgDraw.js":
6392/*!***************************************!*\
6393 !*** ./src/diagrams/class/svgDraw.js ***!
6394 \***************************************/
6395/*! exports provided: drawEdge, drawClass, parseMember, default */
6396/***/ (function(module, __webpack_exports__, __webpack_require__) {
6397
6398"use strict";
6399__webpack_require__.r(__webpack_exports__);
6400/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawEdge", function() { return drawEdge; });
6401/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawClass", function() { return drawClass; });
6402/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseMember", function() { return parseMember; });
6403/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
6404/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
6405/* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
6406/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
6407/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
6408
6409
6410
6411
6412var edgeCount = 0;
6413var drawEdge = function drawEdge(elem, path, relation, conf) {
6414 var getRelationType = function getRelationType(type) {
6415 switch (type) {
6416 case _classDb__WEBPACK_IMPORTED_MODULE_1__["relationType"].AGGREGATION:
6417 return 'aggregation';
6418
6419 case _classDb__WEBPACK_IMPORTED_MODULE_1__["relationType"].EXTENSION:
6420 return 'extension';
6421
6422 case _classDb__WEBPACK_IMPORTED_MODULE_1__["relationType"].COMPOSITION:
6423 return 'composition';
6424
6425 case _classDb__WEBPACK_IMPORTED_MODULE_1__["relationType"].DEPENDENCY:
6426 return 'dependency';
6427 }
6428 };
6429
6430 path.points = path.points.filter(function (p) {
6431 return !Number.isNaN(p.y);
6432 }); // The data for our line
6433
6434 var lineData = path.points; // This is the accessor function we talked about above
6435
6436 var lineFunction = Object(d3__WEBPACK_IMPORTED_MODULE_0__["line"])().x(function (d) {
6437 return d.x;
6438 }).y(function (d) {
6439 return d.y;
6440 }).curve(d3__WEBPACK_IMPORTED_MODULE_0__["curveBasis"]);
6441 var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', 'edge' + edgeCount).attr('class', 'relation');
6442 var url = '';
6443
6444 if (conf.arrowMarkerAbsolute) {
6445 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
6446 url = url.replace(/\(/g, '\\(');
6447 url = url.replace(/\)/g, '\\)');
6448 }
6449
6450 if (relation.relation.lineType == 1) {
6451 svgPath.attr('class', 'relation dashed-line');
6452 }
6453
6454 if (relation.relation.type1 !== 'none') {
6455 svgPath.attr('marker-start', 'url(' + url + '#' + getRelationType(relation.relation.type1) + 'Start' + ')');
6456 }
6457
6458 if (relation.relation.type2 !== 'none') {
6459 svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(relation.relation.type2) + 'End' + ')');
6460 }
6461
6462 var x, y;
6463 var l = path.points.length; // Calculate Label position
6464
6465 var labelPosition = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcLabelPosition(path.points);
6466 x = labelPosition.x;
6467 y = labelPosition.y;
6468 var p1_card_x, p1_card_y;
6469 var p2_card_x, p2_card_y;
6470
6471 if (l % 2 !== 0 && l > 1) {
6472 var cardinality_1_point = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcCardinalityPosition(relation.relation.type1 !== 'none', path.points, path.points[0]);
6473 var cardinality_2_point = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcCardinalityPosition(relation.relation.type2 !== 'none', path.points, path.points[l - 1]);
6474 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('cardinality_1_point ' + JSON.stringify(cardinality_1_point));
6475 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('cardinality_2_point ' + JSON.stringify(cardinality_2_point));
6476 p1_card_x = cardinality_1_point.x;
6477 p1_card_y = cardinality_1_point.y;
6478 p2_card_x = cardinality_2_point.x;
6479 p2_card_y = cardinality_2_point.y;
6480 }
6481
6482 if (typeof relation.title !== 'undefined') {
6483 var g = elem.append('g').attr('class', 'classLabel');
6484 var label = g.append('text').attr('class', 'label').attr('x', x).attr('y', y).attr('fill', 'red').attr('text-anchor', 'middle').text(relation.title);
6485 window.label = label;
6486 var bounds = label.node().getBBox();
6487 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);
6488 }
6489
6490 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Rendering relation ' + JSON.stringify(relation));
6491
6492 if (typeof relation.relationTitle1 !== 'undefined' && relation.relationTitle1 !== 'none') {
6493 var _g = elem.append('g').attr('class', 'cardinality');
6494
6495 _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);
6496 }
6497
6498 if (typeof relation.relationTitle2 !== 'undefined' && relation.relationTitle2 !== 'none') {
6499 var _g2 = elem.append('g').attr('class', 'cardinality');
6500
6501 _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);
6502 }
6503
6504 edgeCount++;
6505};
6506var drawClass = function drawClass(elem, classDef, conf) {
6507 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].info('Rendering class ' + classDef);
6508 var id = classDef.id;
6509 var classInfo = {
6510 id: id,
6511 label: classDef.id,
6512 width: 0,
6513 height: 0
6514 }; // add class group
6515
6516 var g = elem.append('g').attr('id', Object(_classDb__WEBPACK_IMPORTED_MODULE_1__["lookUpDomId"])(id)).attr('class', 'classGroup'); // add title
6517
6518 var title;
6519
6520 if (classDef.link) {
6521 title = g.append('svg:a').attr('xlink:href', classDef.link).attr('target', '_blank').append('text').attr('y', conf.textHeight + conf.padding).attr('x', 0);
6522 } else {
6523 title = g.append('text').attr('y', conf.textHeight + conf.padding).attr('x', 0);
6524 } // add annotations
6525
6526
6527 var isFirst = true;
6528 classDef.annotations.forEach(function (member) {
6529 var titleText2 = title.append('tspan').text('«' + member + '»');
6530 if (!isFirst) titleText2.attr('dy', conf.textHeight);
6531 isFirst = false;
6532 });
6533 var classTitleString = classDef.id;
6534
6535 if (classDef.type !== undefined && classDef.type !== '') {
6536 classTitleString += '<' + classDef.type + '>';
6537 }
6538
6539 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
6540
6541 if (!isFirst) classTitle.attr('dy', conf.textHeight);
6542 var titleHeight = title.node().getBBox().height;
6543 var membersLine = g.append('line') // text label for the x axis
6544 .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin / 2).attr('y2', conf.padding + titleHeight + conf.dividerMargin / 2);
6545 var members = g.append('text') // text label for the x axis
6546 .attr('x', conf.padding).attr('y', titleHeight + conf.dividerMargin + conf.textHeight).attr('fill', 'white').attr('class', 'classText');
6547 isFirst = true;
6548 classDef.members.forEach(function (member) {
6549 addTspan(members, member, isFirst, conf);
6550 isFirst = false;
6551 });
6552 var membersBox = members.node().getBBox();
6553 var methodsLine = g.append('line') // text label for the x axis
6554 .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr('y2', conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
6555 var methods = g.append('text') // text label for the x axis
6556 .attr('x', conf.padding).attr('y', titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr('fill', 'white').attr('class', 'classText');
6557 isFirst = true;
6558 classDef.methods.forEach(function (method) {
6559 addTspan(methods, method, isFirst, conf);
6560 isFirst = false;
6561 });
6562 var classBox = g.node().getBBox();
6563 var cssClassStr = ' ';
6564
6565 if (classDef.cssClasses.length > 0) {
6566 cssClassStr = cssClassStr + classDef.cssClasses.join(' ');
6567 }
6568
6569 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);
6570 var rectWidth = rect.node().getBBox().width; // Center title
6571 // We subtract the width of each text element from the class box width and divide it by 2
6572
6573 title.node().childNodes.forEach(function (x) {
6574 x.setAttribute('x', (rectWidth - x.getBBox().width) / 2);
6575 });
6576
6577 if (classDef.tooltip) {
6578 title.insert('title').text(classDef.tooltip);
6579 }
6580
6581 membersLine.attr('x2', rectWidth);
6582 methodsLine.attr('x2', rectWidth);
6583 classInfo.width = rectWidth;
6584 classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
6585 return classInfo;
6586};
6587var parseMember = function parseMember(text) {
6588 var fieldRegEx = /(\+|-|~|#)?(\w+)(~\w+~|\[\])?\s+(\w+)/;
6589 var methodRegEx = /^([+|\-|~|#])?(\w+) *\( *(.*)\) *(\*|\$)? *(\w*[~|[\]]*\s*\w*~?)$/;
6590 var fieldMatch = text.match(fieldRegEx);
6591 var methodMatch = text.match(methodRegEx);
6592
6593 if (fieldMatch && !methodMatch) {
6594 return buildFieldDisplay(fieldMatch);
6595 } else if (methodMatch) {
6596 return buildMethodDisplay(methodMatch);
6597 } else {
6598 return buildLegacyDisplay(text);
6599 }
6600};
6601
6602var buildFieldDisplay = function buildFieldDisplay(parsedText) {
6603 var displayText = '';
6604
6605 try {
6606 var visibility = parsedText[1] ? parsedText[1].trim() : '';
6607 var fieldType = parsedText[2] ? parsedText[2].trim() : '';
6608 var genericType = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : '';
6609 var fieldName = parsedText[4] ? parsedText[4].trim() : '';
6610 displayText = visibility + fieldType + genericType + ' ' + fieldName;
6611 } catch (err) {
6612 displayText = parsedText;
6613 }
6614
6615 return {
6616 displayText: displayText,
6617 cssStyle: ''
6618 };
6619};
6620
6621var buildMethodDisplay = function buildMethodDisplay(parsedText) {
6622 var cssStyle = '';
6623 var displayText = '';
6624
6625 try {
6626 var visibility = parsedText[1] ? parsedText[1].trim() : '';
6627 var methodName = parsedText[2] ? parsedText[2].trim() : '';
6628 var parameters = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : '';
6629 var classifier = parsedText[4] ? parsedText[4].trim() : '';
6630 var returnType = parsedText[5] ? ' : ' + parseGenericTypes(parsedText[5]).trim() : '';
6631 displayText = visibility + methodName + '(' + parameters + ')' + returnType;
6632 cssStyle = parseClassifier(classifier);
6633 } catch (err) {
6634 displayText = parsedText;
6635 }
6636
6637 return {
6638 displayText: displayText,
6639 cssStyle: cssStyle
6640 };
6641};
6642
6643var buildLegacyDisplay = function buildLegacyDisplay(text) {
6644 // if for some reason we dont have any match, use old format to parse text
6645 var displayText = '';
6646 var cssStyle = '';
6647 var memberText = '';
6648 var returnType = '';
6649 var methodStart = text.indexOf('(');
6650 var methodEnd = text.indexOf(')');
6651
6652 if (methodStart > 1 && methodEnd > methodStart && methodEnd <= text.length) {
6653 var visibility = '';
6654 var methodName = '';
6655 var firstChar = text.substring(0, 1);
6656
6657 if (firstChar.match(/\w/)) {
6658 methodName = text.substring(0, methodStart).trim();
6659 } else {
6660 if (firstChar.match(/\+|-|~|#/)) {
6661 visibility = firstChar;
6662 }
6663
6664 methodName = text.substring(1, methodStart).trim();
6665 }
6666
6667 var parameters = text.substring(methodStart + 1, methodEnd);
6668 var classifier = text.substring(methodEnd + 1, 1);
6669 cssStyle = parseClassifier(classifier);
6670 displayText = visibility + methodName + '(' + parseGenericTypes(parameters.trim()) + ')';
6671
6672 if (methodEnd < memberText.length) {
6673 returnType = text.substring(methodEnd + 2).trim();
6674
6675 if (returnType !== '') {
6676 returnType = ' : ' + parseGenericTypes(returnType);
6677 }
6678 }
6679 } else {
6680 // finally - if all else fails, just send the text back as written (other than parsing for generic types)
6681 displayText = parseGenericTypes(text);
6682 }
6683
6684 return {
6685 displayText: displayText,
6686 cssStyle: cssStyle
6687 };
6688};
6689
6690var addTspan = function addTspan(textEl, txt, isFirst, conf) {
6691 var member = parseMember(txt);
6692 var tSpan = textEl.append('tspan').attr('x', conf.padding).text(member.displayText);
6693
6694 if (member.cssStyle !== '') {
6695 tSpan.attr('style', member.cssStyle);
6696 }
6697
6698 if (!isFirst) {
6699 tSpan.attr('dy', conf.textHeight);
6700 }
6701};
6702
6703var parseGenericTypes = function parseGenericTypes(text) {
6704 var cleanedText = text;
6705
6706 if (text.indexOf('~') != -1) {
6707 cleanedText = cleanedText.replace('~', '<');
6708 cleanedText = cleanedText.replace('~', '>');
6709 return parseGenericTypes(cleanedText);
6710 } else {
6711 return cleanedText;
6712 }
6713};
6714
6715var parseClassifier = function parseClassifier(classifier) {
6716 switch (classifier) {
6717 case '*':
6718 return 'font-style:italic;';
6719
6720 case '$':
6721 return 'text-decoration:underline;';
6722
6723 default:
6724 return '';
6725 }
6726};
6727
6728/* harmony default export */ __webpack_exports__["default"] = ({
6729 drawClass: drawClass,
6730 drawEdge: drawEdge,
6731 parseMember: parseMember
6732});
6733
6734/***/ }),
6735
6736/***/ "./src/diagrams/common/common.js":
6737/*!***************************************!*\
6738 !*** ./src/diagrams/common/common.js ***!
6739 \***************************************/
6740/*! exports provided: getRows, removeScript, sanitizeText, lineBreakRegex, hasBreaks, splitBreaks, default */
6741/***/ (function(module, __webpack_exports__, __webpack_require__) {
6742
6743"use strict";
6744__webpack_require__.r(__webpack_exports__);
6745/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRows", function() { return getRows; });
6746/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeScript", function() { return removeScript; });
6747/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sanitizeText", function() { return sanitizeText; });
6748/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lineBreakRegex", function() { return lineBreakRegex; });
6749/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasBreaks", function() { return hasBreaks; });
6750/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "splitBreaks", function() { return splitBreaks; });
6751var getRows = function getRows(s) {
6752 if (!s) return 1;
6753 var str = breakToPlaceholder(s);
6754 str = str.replace(/\\n/g, '#br#');
6755 return str.split('#br#');
6756};
6757var removeScript = function removeScript(txt) {
6758 var rs = '';
6759 var idx = 0;
6760
6761 while (idx >= 0) {
6762 idx = txt.indexOf('<script');
6763
6764 if (idx >= 0) {
6765 rs += txt.substr(0, idx);
6766 txt = txt.substr(idx + 1);
6767 idx = txt.indexOf('</script>');
6768
6769 if (idx >= 0) {
6770 idx += 9;
6771 txt = txt.substr(idx);
6772 }
6773 } else {
6774 rs += txt;
6775 idx = -1;
6776 break;
6777 }
6778 }
6779
6780 return rs;
6781};
6782var sanitizeText = function sanitizeText(text, config) {
6783 var txt = text;
6784 var htmlLabels = true;
6785
6786 if (config.flowchart && (config.flowchart.htmlLabels === false || config.flowchart.htmlLabels === 'false')) {
6787 htmlLabels = false;
6788 }
6789
6790 if (htmlLabels) {
6791 var level = config.securityLevel;
6792
6793 if (level === 'antiscript') {
6794 txt = removeScript(txt);
6795 } else if (level !== 'loose') {
6796 // eslint-disable-line
6797 txt = breakToPlaceholder(txt);
6798 txt = txt.replace(/</g, '&lt;').replace(/>/g, '&gt;');
6799 txt = txt.replace(/=/g, '&equals;');
6800 txt = placeholderToBreak(txt);
6801 }
6802 }
6803
6804 return txt;
6805};
6806var lineBreakRegex = /<br\s*\/?>/gi;
6807var hasBreaks = function hasBreaks(text) {
6808 return /<br\s*[/]?>/gi.test(text);
6809};
6810var splitBreaks = function splitBreaks(text) {
6811 return text.split(/<br\s*[/]?>/gi);
6812};
6813
6814var breakToPlaceholder = function breakToPlaceholder(s) {
6815 return s.replace(lineBreakRegex, '#br#');
6816};
6817
6818var placeholderToBreak = function placeholderToBreak(s) {
6819 return s.replace(/#br#/g, '<br/>');
6820};
6821
6822/* harmony default export */ __webpack_exports__["default"] = ({
6823 getRows: getRows,
6824 sanitizeText: sanitizeText,
6825 hasBreaks: hasBreaks,
6826 splitBreaks: splitBreaks,
6827 lineBreakRegex: lineBreakRegex,
6828 removeScript: removeScript
6829});
6830
6831/***/ }),
6832
6833/***/ "./src/diagrams/er/erDb.js":
6834/*!*********************************!*\
6835 !*** ./src/diagrams/er/erDb.js ***!
6836 \*********************************/
6837/*! exports provided: parseDirective, default */
6838/***/ (function(module, __webpack_exports__, __webpack_require__) {
6839
6840"use strict";
6841__webpack_require__.r(__webpack_exports__);
6842/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
6843/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
6844/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
6845/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
6846/**
6847 *
6848 */
6849
6850
6851
6852var entities = {};
6853var relationships = [];
6854var title = '';
6855var Cardinality = {
6856 ZERO_OR_ONE: 'ZERO_OR_ONE',
6857 ZERO_OR_MORE: 'ZERO_OR_MORE',
6858 ONE_OR_MORE: 'ONE_OR_MORE',
6859 ONLY_ONE: 'ONLY_ONE'
6860};
6861var Identification = {
6862 NON_IDENTIFYING: 'NON_IDENTIFYING',
6863 IDENTIFYING: 'IDENTIFYING'
6864};
6865var parseDirective = function parseDirective(statement, context, type) {
6866 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].parseDirective(this, statement, context, type);
6867};
6868
6869var addEntity = function addEntity(name) {
6870 if (typeof entities[name] === 'undefined') {
6871 entities[name] = name;
6872 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Added new entity :', name);
6873 }
6874};
6875
6876var getEntities = function getEntities() {
6877 return entities;
6878};
6879/**
6880 * Add a relationship
6881 * @param entA The first entity in the relationship
6882 * @param rolA The role played by the first entity in relation to the second
6883 * @param entB The second entity in the relationship
6884 * @param rSpec The details of the relationship between the two entities
6885 */
6886
6887
6888var addRelationship = function addRelationship(entA, rolA, entB, rSpec) {
6889 var rel = {
6890 entityA: entA,
6891 roleA: rolA,
6892 entityB: entB,
6893 relSpec: rSpec
6894 };
6895 relationships.push(rel);
6896 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Added new relationship :', rel);
6897};
6898
6899var getRelationships = function getRelationships() {
6900 return relationships;
6901}; // Keep this - TODO: revisit...allow the diagram to have a title
6902
6903
6904var setTitle = function setTitle(txt) {
6905 title = txt;
6906};
6907
6908var getTitle = function getTitle() {
6909 return title;
6910};
6911
6912var clear = function clear() {
6913 entities = {};
6914 relationships = [];
6915 title = '';
6916};
6917
6918/* harmony default export */ __webpack_exports__["default"] = ({
6919 Cardinality: Cardinality,
6920 Identification: Identification,
6921 parseDirective: parseDirective,
6922 getConfig: function getConfig() {
6923 return _config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]().er;
6924 },
6925 addEntity: addEntity,
6926 getEntities: getEntities,
6927 addRelationship: addRelationship,
6928 getRelationships: getRelationships,
6929 clear: clear,
6930 setTitle: setTitle,
6931 getTitle: getTitle
6932});
6933
6934/***/ }),
6935
6936/***/ "./src/diagrams/er/erMarkers.js":
6937/*!**************************************!*\
6938 !*** ./src/diagrams/er/erMarkers.js ***!
6939 \**************************************/
6940/*! exports provided: default */
6941/***/ (function(module, __webpack_exports__, __webpack_require__) {
6942
6943"use strict";
6944__webpack_require__.r(__webpack_exports__);
6945var ERMarkers = {
6946 ONLY_ONE_START: 'ONLY_ONE_START',
6947 ONLY_ONE_END: 'ONLY_ONE_END',
6948 ZERO_OR_ONE_START: 'ZERO_OR_ONE_START',
6949 ZERO_OR_ONE_END: 'ZERO_OR_ONE_END',
6950 ONE_OR_MORE_START: 'ONE_OR_MORE_START',
6951 ONE_OR_MORE_END: 'ONE_OR_MORE_END',
6952 ZERO_OR_MORE_START: 'ZERO_OR_MORE_START',
6953 ZERO_OR_MORE_END: 'ZERO_OR_MORE_END'
6954};
6955/**
6956 * Put the markers into the svg DOM for later use with edge paths
6957 */
6958
6959var insertMarkers = function insertMarkers(elem, conf) {
6960 var marker;
6961 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');
6962 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');
6963 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');
6964 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 21).attr('cy', 9).attr('r', 6);
6965 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M9,0 L9,18');
6966 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');
6967 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 9).attr('cy', 9).attr('r', 6);
6968 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,0 L21,18');
6969 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');
6970 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');
6971 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');
6972 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 48).attr('cy', 18).attr('r', 6);
6973 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M0,18 Q18,0 36,18 Q18,36 0,18');
6974 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');
6975 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 9).attr('cy', 18).attr('r', 6);
6976 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,18 Q39,0 57,18 Q39,36 21,18');
6977 return;
6978};
6979
6980/* harmony default export */ __webpack_exports__["default"] = ({
6981 ERMarkers: ERMarkers,
6982 insertMarkers: insertMarkers
6983});
6984
6985/***/ }),
6986
6987/***/ "./src/diagrams/er/erRenderer.js":
6988/*!***************************************!*\
6989 !*** ./src/diagrams/er/erRenderer.js ***!
6990 \***************************************/
6991/*! exports provided: setConf, draw, default */
6992/***/ (function(module, __webpack_exports__, __webpack_require__) {
6993
6994"use strict";
6995__webpack_require__.r(__webpack_exports__);
6996/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
6997/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
6998/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
6999/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
7000/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
7001/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
7002/* harmony import */ var _erDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./erDb */ "./src/diagrams/er/erDb.js");
7003/* harmony import */ var _parser_erDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/erDiagram */ "./src/diagrams/er/parser/erDiagram.jison");
7004/* harmony import */ var _parser_erDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_erDiagram__WEBPACK_IMPORTED_MODULE_3__);
7005/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! dagre */ "dagre");
7006/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_4__);
7007/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../config */ "./src/config.js");
7008/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
7009/* harmony import */ var _erMarkers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./erMarkers */ "./src/diagrams/er/erMarkers.js");
7010/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020var conf = {};
7021/**
7022 * Allows the top-level API module to inject config specific to this renderer,
7023 * storing it in the local conf object. Note that generic config still needs to be
7024 * retrieved using getConfig() imported from the config module
7025 */
7026
7027var setConf = function setConf(cnf) {
7028 var keys = Object.keys(cnf);
7029
7030 for (var i = 0; i < keys.length; i++) {
7031 conf[keys[i]] = cnf[keys[i]];
7032 }
7033};
7034/**
7035 * Use D3 to construct the svg elements for the entities
7036 * @param svgNode the svg node that contains the diagram
7037 * @param entities The entities to be drawn
7038 * @param graph The graph that contains the vertex and edge definitions post-layout
7039 * @return The first entity that was inserted
7040 */
7041
7042var drawEntities = function drawEntities(svgNode, entities, graph) {
7043 var keys = Object.keys(entities);
7044 var firstOne;
7045 keys.forEach(function (id) {
7046 // Create a group for each entity
7047 var groupNode = svgNode.append('g').attr('id', id);
7048 firstOne = firstOne === undefined ? id : firstOne; // Label the entity - this is done first so that we can get the bounding box
7049 // which then determines the size of the rectangle
7050
7051 var textId = 'entity-' + id;
7052 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
7053
7054 var textBBox = textNode.node().getBBox();
7055 var entityWidth = Math.max(conf.minEntityWidth, textBBox.width + conf.entityPadding * 2);
7056 var entityHeight = Math.max(conf.minEntityHeight, textBBox.height + conf.entityPadding * 2); // Make sure the text gets centred relative to the entity box
7057
7058 textNode.attr('transform', 'translate(' + entityWidth / 2 + ',' + entityHeight / 2 + ')'); // Draw the rectangle - insert it before the text so that the text is not obscured
7059
7060 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);
7061 var rectBBox = rectNode.node().getBBox(); // Add the entity to the graph
7062
7063 graph.setNode(id, {
7064 width: rectBBox.width,
7065 height: rectBBox.height,
7066 shape: 'rect',
7067 id: id
7068 });
7069 });
7070 return firstOne;
7071}; // drawEntities
7072
7073
7074var adjustEntities = function adjustEntities(svgNode, graph) {
7075 graph.nodes().forEach(function (v) {
7076 if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
7077 svgNode.select('#' + v).attr('transform', 'translate(' + (graph.node(v).x - graph.node(v).width / 2) + ',' + (graph.node(v).y - graph.node(v).height / 2) + ' )');
7078 }
7079 });
7080 return;
7081};
7082
7083var getEdgeName = function getEdgeName(rel) {
7084 return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, '');
7085};
7086/**
7087 * Add each relationship to the graph
7088 * @param relationships the relationships to be added
7089 * @param g the graph
7090 * @return {Array} The array of relationships
7091 */
7092
7093
7094var addRelationships = function addRelationships(relationships, g) {
7095 relationships.forEach(function (r) {
7096 g.setEdge(r.entityA, r.entityB, {
7097 relationship: r
7098 }, getEdgeName(r));
7099 });
7100 return relationships;
7101}; // addRelationships
7102
7103
7104var relCnt = 0;
7105/**
7106 * Draw a relationship using edge information from the graph
7107 * @param svg the svg node
7108 * @param rel the relationship to draw in the svg
7109 * @param g the graph containing the edge information
7110 * @param insert the insertion point in the svg DOM (because relationships have markers that need to sit 'behind' opaque entity boxes)
7111 */
7112
7113var drawRelationshipFromLayout = function drawRelationshipFromLayout(svg, rel, g, insert) {
7114 relCnt++; // Find the edge relating to this relationship
7115
7116 var edge = g.edge(rel.entityA, rel.entityB, getEdgeName(rel)); // Get a function that will generate the line path
7117
7118 var lineFunction = Object(d3__WEBPACK_IMPORTED_MODULE_1__["line"])().x(function (d) {
7119 return d.x;
7120 }).y(function (d) {
7121 return d.y;
7122 }).curve(d3__WEBPACK_IMPORTED_MODULE_1__["curveBasis"]); // Insert the line at the right place
7123
7124 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
7125
7126 if (rel.relSpec.relType === _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Identification.NON_IDENTIFYING) {
7127 svgPath.attr('stroke-dasharray', '8,8');
7128 } // TODO: Understand this better
7129
7130
7131 var url = '';
7132
7133 if (conf.arrowMarkerAbsolute) {
7134 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
7135 url = url.replace(/\(/g, '\\(');
7136 url = url.replace(/\)/g, '\\)');
7137 } // Decide which start and end markers it needs. It may be possible to be more concise here
7138 // by reversing a start marker to make an end marker...but this will do for now
7139 // Note that the 'A' entity's marker is at the end of the relationship and the 'B' entity's marker is at the start
7140
7141
7142 switch (rel.relSpec.cardA) {
7143 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ZERO_OR_ONE:
7144 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ZERO_OR_ONE_END + ')');
7145 break;
7146
7147 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ZERO_OR_MORE:
7148 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ZERO_OR_MORE_END + ')');
7149 break;
7150
7151 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ONE_OR_MORE:
7152 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ONE_OR_MORE_END + ')');
7153 break;
7154
7155 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ONLY_ONE:
7156 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ONLY_ONE_END + ')');
7157 break;
7158 }
7159
7160 switch (rel.relSpec.cardB) {
7161 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ZERO_OR_ONE:
7162 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ZERO_OR_ONE_START + ')');
7163 break;
7164
7165 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ZERO_OR_MORE:
7166 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ZERO_OR_MORE_START + ')');
7167 break;
7168
7169 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ONE_OR_MORE:
7170 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ONE_OR_MORE_START + ')');
7171 break;
7172
7173 case _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].Cardinality.ONLY_ONE:
7174 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].ERMarkers.ONLY_ONE_START + ')');
7175 break;
7176 } // Now label the relationship
7177 // Find the half-way point
7178
7179
7180 var len = svgPath.node().getTotalLength();
7181 var labelPoint = svgPath.node().getPointAtLength(len * 0.5); // Append a text node containing the label
7182
7183 var labelId = 'rel' + relCnt;
7184 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
7185
7186 var labelBBox = labelNode.node().getBBox(); // Insert the opaque rectangle before the text label
7187
7188 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%');
7189 return;
7190};
7191/**
7192 * Draw en E-R diagram in the tag with id: id based on the text definition of the diagram
7193 * @param text the text of the diagram
7194 * @param id the unique id of the DOM node that contains the diagram
7195 */
7196
7197
7198var draw = function draw(text, id) {
7199 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Drawing ER diagram');
7200 _erDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
7201 var parser = _parser_erDiagram__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
7202 parser.yy = _erDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the text to populate erDb
7203
7204 try {
7205 parser.parse(text);
7206 } catch (err) {
7207 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].debug('Parsing failed');
7208 } // Get a reference to the svg node that contains the text
7209
7210
7211 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id='".concat(id, "']")); // Add cardinality marker definitions to the svg
7212
7213 _erMarkers__WEBPACK_IMPORTED_MODULE_7__["default"].insertMarkers(svg, conf); // Now we have to construct the diagram in a specific way:
7214 // ---
7215 // 1. Create all the entities in the svg node at 0,0, but with the correct dimensions (allowing for text content)
7216 // 2. Make sure they are all added to the graph
7217 // 3. Add all the edges (relationships) to the graph aswell
7218 // 4. Let dagre do its magic to layout the graph. This assigns:
7219 // - the centre co-ordinates for each node, bearing in mind the dimensions and edge relationships
7220 // - the path co-ordinates for each edge
7221 // But it has no impact on the svg child nodes - the diagram remains with every entity rooted at 0,0
7222 // 5. Now assign a transform to each entity in the svg node so that it gets drawn in the correct place, as determined by
7223 // its centre point, which is obtained from the graph, and it's width and height
7224 // 6. And finally, create all the edges in the svg node using information from the graph
7225 // ---
7226 // Create the graph
7227
7228 var g; // TODO: Explore directed vs undirected graphs, and how the layout is affected
7229 // An E-R diagram could be said to be undirected, but there is merit in setting
7230 // the direction from parent to child in a one-to-many as this influences graphlib to
7231 // put the parent above the child (does it?), which is intuitive. Most relationships
7232 // in ER diagrams are one-to-many.
7233
7234 g = new graphlib__WEBPACK_IMPORTED_MODULE_0___default.a.Graph({
7235 multigraph: true,
7236 directed: true,
7237 compound: false
7238 }).setGraph({
7239 rankdir: conf.layoutDirection,
7240 marginx: 20,
7241 marginy: 20,
7242 nodesep: 100,
7243 edgesep: 100,
7244 ranksep: 100
7245 }).setDefaultEdgeLabel(function () {
7246 return {};
7247 }); // Draw the entities (at 0,0), returning the first svg node that got
7248 // inserted - this represents the insertion point for relationship paths
7249
7250 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
7251 // Add all the relationships to the graph
7252
7253 var relationships = addRelationships(_erDb__WEBPACK_IMPORTED_MODULE_2__["default"].getRelationships(), g);
7254 dagre__WEBPACK_IMPORTED_MODULE_4___default.a.layout(g); // Node and edge positions will be updated
7255 // Adjust the positions of the entities so that they adhere to the layout
7256
7257 adjustEntities(svg, g); // Draw the relationships
7258
7259 relationships.forEach(function (rel) {
7260 drawRelationshipFromLayout(svg, rel, g, firstEntity);
7261 });
7262 var padding = conf.diagramPadding;
7263 var svgBounds = svg.node().getBBox();
7264 var width = svgBounds.width + padding * 2;
7265 var height = svgBounds.height + padding * 2;
7266 Object(_utils__WEBPACK_IMPORTED_MODULE_8__["configureSvgSize"])(svg, height, width, conf.useMaxWidth);
7267 svg.attr('viewBox', "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height));
7268}; // draw
7269
7270/* harmony default export */ __webpack_exports__["default"] = ({
7271 setConf: setConf,
7272 draw: draw
7273});
7274
7275/***/ }),
7276
7277/***/ "./src/diagrams/er/parser/erDiagram.jison":
7278/*!************************************************!*\
7279 !*** ./src/diagrams/er/parser/erDiagram.jison ***!
7280 \************************************************/
7281/*! no static exports found */
7282/***/ (function(module, exports, __webpack_require__) {
7283
7284/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
7285/*
7286 Returns a Parser object of the following structure:
7287
7288 Parser: {
7289 yy: {}
7290 }
7291
7292 Parser.prototype: {
7293 yy: {},
7294 trace: function(),
7295 symbols_: {associative list: name ==> number},
7296 terminals_: {associative list: number ==> name},
7297 productions_: [...],
7298 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
7299 table: [...],
7300 defaultActions: {...},
7301 parseError: function(str, hash),
7302 parse: function(input),
7303
7304 lexer: {
7305 EOF: 1,
7306 parseError: function(str, hash),
7307 setInput: function(input),
7308 input: function(),
7309 unput: function(str),
7310 more: function(),
7311 less: function(n),
7312 pastInput: function(),
7313 upcomingInput: function(),
7314 showPosition: function(),
7315 test_match: function(regex_match_array, rule_index),
7316 next: function(),
7317 lex: function(),
7318 begin: function(condition),
7319 popState: function(),
7320 _currentRules: function(),
7321 topState: function(),
7322 pushState: function(condition),
7323
7324 options: {
7325 ranges: boolean (optional: true ==> token location info will include a .range[] member)
7326 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
7327 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)
7328 },
7329
7330 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
7331 rules: [...],
7332 conditions: {associative list: name ==> set},
7333 }
7334 }
7335
7336
7337 token location info (@$, _$, etc.): {
7338 first_line: n,
7339 last_line: n,
7340 first_column: n,
7341 last_column: n,
7342 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
7343 }
7344
7345
7346 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
7347 text: (matched text)
7348 token: (the produced terminal token, if any)
7349 line: (yylineno)
7350 }
7351 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
7352 loc: (yylloc)
7353 expected: (string describing the set of expected tokens)
7354 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
7355 }
7356*/
7357var parser = (function(){
7358var 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];
7359var parser = {trace: function trace () { },
7360yy: {},
7361symbols_: {"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},
7362terminals_: {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"},
7363productions_: [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],[10,1],[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]],
7364performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
7365/* this == yyval */
7366
7367var $0 = $$.length - 1;
7368switch (yystate) {
7369case 1:
7370 /*console.log('finished parsing');*/
7371break;
7372case 3:
7373 this.$ = []
7374break;
7375case 4:
7376$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
7377break;
7378case 5: case 6:
7379 this.$ = $$[$0]
7380break;
7381case 7: case 8:
7382 this.$=[];
7383break;
7384case 12:
7385
7386 yy.addEntity($$[$0-4]);
7387 yy.addEntity($$[$0-2]);
7388 yy.addRelationship($$[$0-4], $$[$0], $$[$0-2], $$[$0-3]);
7389 /*console.log($$[$0-4] + $$[$0-3] + $$[$0-2] + ':' + $$[$0]);*/
7390
7391break;
7392case 13:
7393 yy.addEntity($$[$0]);
7394break;
7395case 14:
7396 this.$ = $$[$0]; /*console.log('Entity: ' + $$[$0]);*/
7397break;
7398case 15:
7399
7400 this.$ = { cardA: $$[$0], relType: $$[$0-1], cardB: $$[$0-2] };
7401 /*console.log('relSpec: ' + $$[$0] + $$[$0-1] + $$[$0-2]);*/
7402
7403break;
7404case 16:
7405 this.$ = yy.Cardinality.ZERO_OR_ONE;
7406break;
7407case 17:
7408 this.$ = yy.Cardinality.ZERO_OR_MORE;
7409break;
7410case 18:
7411 this.$ = yy.Cardinality.ONE_OR_MORE;
7412break;
7413case 19:
7414 this.$ = yy.Cardinality.ONLY_ONE;
7415break;
7416case 20:
7417 this.$ = yy.Identification.NON_IDENTIFYING;
7418break;
7419case 21:
7420 this.$ = yy.Identification.IDENTIFYING;
7421break;
7422case 22:
7423 this.$ = $$[$0].replace(/"/g, '');
7424break;
7425case 23:
7426 this.$ = $$[$0];
7427break;
7428case 24:
7429 yy.parseDirective('%%{', 'open_directive');
7430break;
7431case 25:
7432 yy.parseDirective($$[$0], 'type_directive');
7433break;
7434case 26:
7435 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
7436break;
7437case 27:
7438 yy.parseDirective('}%%', 'close_directive', 'er');
7439break;
7440}
7441},
7442table: [{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,24]},{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,25]),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]),o($V2,[2,13],{18:22,21:23,23:$V5,24:$V6,25:$V7,26:$V8}),o([6,9,11,15,20,23,24,25,26,30],[2,14]),{11:[1,28]},{16:29,32:[1,30]},{11:[2,27]},o($V2,[2,5]),{17:31,20:$V3},{22:32,27:[1,33],28:[1,34]},o($V9,[2,16]),o($V9,[2,17]),o($V9,[2,18]),o($V9,[2,19]),o($Va,[2,9]),{14:35,33:$V4},{33:[2,26]},{15:[1,36]},{21:37,23:$V5,24:$V6,25:$V7,26:$V8},o($Vb,[2,20]),o($Vb,[2,21]),{11:[1,38]},{19:39,20:[1,41],29:[1,40]},{20:[2,15]},o($Va,[2,10]),o($V2,[2,12]),o($V2,[2,22]),o($V2,[2,23])],
7443defaultActions: {5:[2,24],7:[2,2],20:[2,27],30:[2,26],37:[2,15]},
7444parseError: function parseError (str, hash) {
7445 if (hash.recoverable) {
7446 this.trace(str);
7447 } else {
7448 var error = new Error(str);
7449 error.hash = hash;
7450 throw error;
7451 }
7452},
7453parse: function parse(input) {
7454 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
7455 var args = lstack.slice.call(arguments, 1);
7456 var lexer = Object.create(this.lexer);
7457 var sharedState = { yy: {} };
7458 for (var k in this.yy) {
7459 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
7460 sharedState.yy[k] = this.yy[k];
7461 }
7462 }
7463 lexer.setInput(input, sharedState.yy);
7464 sharedState.yy.lexer = lexer;
7465 sharedState.yy.parser = this;
7466 if (typeof lexer.yylloc == 'undefined') {
7467 lexer.yylloc = {};
7468 }
7469 var yyloc = lexer.yylloc;
7470 lstack.push(yyloc);
7471 var ranges = lexer.options && lexer.options.ranges;
7472 if (typeof sharedState.yy.parseError === 'function') {
7473 this.parseError = sharedState.yy.parseError;
7474 } else {
7475 this.parseError = Object.getPrototypeOf(this).parseError;
7476 }
7477 function popStack(n) {
7478 stack.length = stack.length - 2 * n;
7479 vstack.length = vstack.length - n;
7480 lstack.length = lstack.length - n;
7481 }
7482 function lex() {
7483 var token;
7484 token = tstack.pop() || lexer.lex() || EOF;
7485 if (typeof token !== 'number') {
7486 if (token instanceof Array) {
7487 tstack = token;
7488 token = tstack.pop();
7489 }
7490 token = self.symbols_[token] || token;
7491 }
7492 return token;
7493 }
7494 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
7495 while (true) {
7496 state = stack[stack.length - 1];
7497 if (this.defaultActions[state]) {
7498 action = this.defaultActions[state];
7499 } else {
7500 if (symbol === null || typeof symbol == 'undefined') {
7501 symbol = lex();
7502 }
7503 action = table[state] && table[state][symbol];
7504 }
7505 if (typeof action === 'undefined' || !action.length || !action[0]) {
7506 var errStr = '';
7507 expected = [];
7508 for (p in table[state]) {
7509 if (this.terminals_[p] && p > TERROR) {
7510 expected.push('\'' + this.terminals_[p] + '\'');
7511 }
7512 }
7513 if (lexer.showPosition) {
7514 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
7515 } else {
7516 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
7517 }
7518 this.parseError(errStr, {
7519 text: lexer.match,
7520 token: this.terminals_[symbol] || symbol,
7521 line: lexer.yylineno,
7522 loc: yyloc,
7523 expected: expected
7524 });
7525 }
7526 if (action[0] instanceof Array && action.length > 1) {
7527 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
7528 }
7529 switch (action[0]) {
7530 case 1:
7531 stack.push(symbol);
7532 vstack.push(lexer.yytext);
7533 lstack.push(lexer.yylloc);
7534 stack.push(action[1]);
7535 symbol = null;
7536 if (!preErrorSymbol) {
7537 yyleng = lexer.yyleng;
7538 yytext = lexer.yytext;
7539 yylineno = lexer.yylineno;
7540 yyloc = lexer.yylloc;
7541 if (recovering > 0) {
7542 recovering--;
7543 }
7544 } else {
7545 symbol = preErrorSymbol;
7546 preErrorSymbol = null;
7547 }
7548 break;
7549 case 2:
7550 len = this.productions_[action[1]][1];
7551 yyval.$ = vstack[vstack.length - len];
7552 yyval._$ = {
7553 first_line: lstack[lstack.length - (len || 1)].first_line,
7554 last_line: lstack[lstack.length - 1].last_line,
7555 first_column: lstack[lstack.length - (len || 1)].first_column,
7556 last_column: lstack[lstack.length - 1].last_column
7557 };
7558 if (ranges) {
7559 yyval._$.range = [
7560 lstack[lstack.length - (len || 1)].range[0],
7561 lstack[lstack.length - 1].range[1]
7562 ];
7563 }
7564 r = this.performAction.apply(yyval, [
7565 yytext,
7566 yyleng,
7567 yylineno,
7568 sharedState.yy,
7569 action[1],
7570 vstack,
7571 lstack
7572 ].concat(args));
7573 if (typeof r !== 'undefined') {
7574 return r;
7575 }
7576 if (len) {
7577 stack = stack.slice(0, -1 * len * 2);
7578 vstack = vstack.slice(0, -1 * len);
7579 lstack = lstack.slice(0, -1 * len);
7580 }
7581 stack.push(this.productions_[action[1]][0]);
7582 vstack.push(yyval.$);
7583 lstack.push(yyval._$);
7584 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
7585 stack.push(newState);
7586 break;
7587 case 3:
7588 return true;
7589 }
7590 }
7591 return true;
7592}};
7593
7594/* generated by jison-lex 0.3.4 */
7595var lexer = (function(){
7596var lexer = ({
7597
7598EOF:1,
7599
7600parseError:function parseError(str, hash) {
7601 if (this.yy.parser) {
7602 this.yy.parser.parseError(str, hash);
7603 } else {
7604 throw new Error(str);
7605 }
7606 },
7607
7608// resets the lexer, sets new input
7609setInput:function (input, yy) {
7610 this.yy = yy || this.yy || {};
7611 this._input = input;
7612 this._more = this._backtrack = this.done = false;
7613 this.yylineno = this.yyleng = 0;
7614 this.yytext = this.matched = this.match = '';
7615 this.conditionStack = ['INITIAL'];
7616 this.yylloc = {
7617 first_line: 1,
7618 first_column: 0,
7619 last_line: 1,
7620 last_column: 0
7621 };
7622 if (this.options.ranges) {
7623 this.yylloc.range = [0,0];
7624 }
7625 this.offset = 0;
7626 return this;
7627 },
7628
7629// consumes and returns one char from the input
7630input:function () {
7631 var ch = this._input[0];
7632 this.yytext += ch;
7633 this.yyleng++;
7634 this.offset++;
7635 this.match += ch;
7636 this.matched += ch;
7637 var lines = ch.match(/(?:\r\n?|\n).*/g);
7638 if (lines) {
7639 this.yylineno++;
7640 this.yylloc.last_line++;
7641 } else {
7642 this.yylloc.last_column++;
7643 }
7644 if (this.options.ranges) {
7645 this.yylloc.range[1]++;
7646 }
7647
7648 this._input = this._input.slice(1);
7649 return ch;
7650 },
7651
7652// unshifts one char (or a string) into the input
7653unput:function (ch) {
7654 var len = ch.length;
7655 var lines = ch.split(/(?:\r\n?|\n)/g);
7656
7657 this._input = ch + this._input;
7658 this.yytext = this.yytext.substr(0, this.yytext.length - len);
7659 //this.yyleng -= len;
7660 this.offset -= len;
7661 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
7662 this.match = this.match.substr(0, this.match.length - 1);
7663 this.matched = this.matched.substr(0, this.matched.length - 1);
7664
7665 if (lines.length - 1) {
7666 this.yylineno -= lines.length - 1;
7667 }
7668 var r = this.yylloc.range;
7669
7670 this.yylloc = {
7671 first_line: this.yylloc.first_line,
7672 last_line: this.yylineno + 1,
7673 first_column: this.yylloc.first_column,
7674 last_column: lines ?
7675 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
7676 + oldLines[oldLines.length - lines.length].length - lines[0].length :
7677 this.yylloc.first_column - len
7678 };
7679
7680 if (this.options.ranges) {
7681 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
7682 }
7683 this.yyleng = this.yytext.length;
7684 return this;
7685 },
7686
7687// When called from action, caches matched text and appends it on next action
7688more:function () {
7689 this._more = true;
7690 return this;
7691 },
7692
7693// 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.
7694reject:function () {
7695 if (this.options.backtrack_lexer) {
7696 this._backtrack = true;
7697 } else {
7698 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(), {
7699 text: "",
7700 token: null,
7701 line: this.yylineno
7702 });
7703
7704 }
7705 return this;
7706 },
7707
7708// retain first n characters of the match
7709less:function (n) {
7710 this.unput(this.match.slice(n));
7711 },
7712
7713// displays already matched input, i.e. for error messages
7714pastInput:function () {
7715 var past = this.matched.substr(0, this.matched.length - this.match.length);
7716 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
7717 },
7718
7719// displays upcoming input, i.e. for error messages
7720upcomingInput:function () {
7721 var next = this.match;
7722 if (next.length < 20) {
7723 next += this._input.substr(0, 20-next.length);
7724 }
7725 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
7726 },
7727
7728// displays the character position where the lexing error occurred, i.e. for error messages
7729showPosition:function () {
7730 var pre = this.pastInput();
7731 var c = new Array(pre.length + 1).join("-");
7732 return pre + this.upcomingInput() + "\n" + c + "^";
7733 },
7734
7735// test the lexed token: return FALSE when not a match, otherwise return token
7736test_match:function(match, indexed_rule) {
7737 var token,
7738 lines,
7739 backup;
7740
7741 if (this.options.backtrack_lexer) {
7742 // save context
7743 backup = {
7744 yylineno: this.yylineno,
7745 yylloc: {
7746 first_line: this.yylloc.first_line,
7747 last_line: this.last_line,
7748 first_column: this.yylloc.first_column,
7749 last_column: this.yylloc.last_column
7750 },
7751 yytext: this.yytext,
7752 match: this.match,
7753 matches: this.matches,
7754 matched: this.matched,
7755 yyleng: this.yyleng,
7756 offset: this.offset,
7757 _more: this._more,
7758 _input: this._input,
7759 yy: this.yy,
7760 conditionStack: this.conditionStack.slice(0),
7761 done: this.done
7762 };
7763 if (this.options.ranges) {
7764 backup.yylloc.range = this.yylloc.range.slice(0);
7765 }
7766 }
7767
7768 lines = match[0].match(/(?:\r\n?|\n).*/g);
7769 if (lines) {
7770 this.yylineno += lines.length;
7771 }
7772 this.yylloc = {
7773 first_line: this.yylloc.last_line,
7774 last_line: this.yylineno + 1,
7775 first_column: this.yylloc.last_column,
7776 last_column: lines ?
7777 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
7778 this.yylloc.last_column + match[0].length
7779 };
7780 this.yytext += match[0];
7781 this.match += match[0];
7782 this.matches = match;
7783 this.yyleng = this.yytext.length;
7784 if (this.options.ranges) {
7785 this.yylloc.range = [this.offset, this.offset += this.yyleng];
7786 }
7787 this._more = false;
7788 this._backtrack = false;
7789 this._input = this._input.slice(match[0].length);
7790 this.matched += match[0];
7791 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
7792 if (this.done && this._input) {
7793 this.done = false;
7794 }
7795 if (token) {
7796 return token;
7797 } else if (this._backtrack) {
7798 // recover context
7799 for (var k in backup) {
7800 this[k] = backup[k];
7801 }
7802 return false; // rule action called reject() implying the next rule should be tested instead.
7803 }
7804 return false;
7805 },
7806
7807// return next match in input
7808next:function () {
7809 if (this.done) {
7810 return this.EOF;
7811 }
7812 if (!this._input) {
7813 this.done = true;
7814 }
7815
7816 var token,
7817 match,
7818 tempMatch,
7819 index;
7820 if (!this._more) {
7821 this.yytext = '';
7822 this.match = '';
7823 }
7824 var rules = this._currentRules();
7825 for (var i = 0; i < rules.length; i++) {
7826 tempMatch = this._input.match(this.rules[rules[i]]);
7827 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
7828 match = tempMatch;
7829 index = i;
7830 if (this.options.backtrack_lexer) {
7831 token = this.test_match(tempMatch, rules[i]);
7832 if (token !== false) {
7833 return token;
7834 } else if (this._backtrack) {
7835 match = false;
7836 continue; // rule action called reject() implying a rule MISmatch.
7837 } else {
7838 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
7839 return false;
7840 }
7841 } else if (!this.options.flex) {
7842 break;
7843 }
7844 }
7845 }
7846 if (match) {
7847 token = this.test_match(match, rules[index]);
7848 if (token !== false) {
7849 return token;
7850 }
7851 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
7852 return false;
7853 }
7854 if (this._input === "") {
7855 return this.EOF;
7856 } else {
7857 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
7858 text: "",
7859 token: null,
7860 line: this.yylineno
7861 });
7862 }
7863 },
7864
7865// return next match that has a token
7866lex:function lex () {
7867 var r = this.next();
7868 if (r) {
7869 return r;
7870 } else {
7871 return this.lex();
7872 }
7873 },
7874
7875// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
7876begin:function begin (condition) {
7877 this.conditionStack.push(condition);
7878 },
7879
7880// pop the previously active lexer condition state off the condition stack
7881popState:function popState () {
7882 var n = this.conditionStack.length - 1;
7883 if (n > 0) {
7884 return this.conditionStack.pop();
7885 } else {
7886 return this.conditionStack[0];
7887 }
7888 },
7889
7890// produce the lexer rule set which is active for the currently active lexer condition state
7891_currentRules:function _currentRules () {
7892 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
7893 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
7894 } else {
7895 return this.conditions["INITIAL"].rules;
7896 }
7897 },
7898
7899// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
7900topState:function topState (n) {
7901 n = this.conditionStack.length - 1 - Math.abs(n || 0);
7902 if (n >= 0) {
7903 return this.conditionStack[n];
7904 } else {
7905 return "INITIAL";
7906 }
7907 },
7908
7909// alias for begin(condition)
7910pushState:function pushState (condition) {
7911 this.begin(condition);
7912 },
7913
7914// return the number of states currently on the stack
7915stateStackSize:function stateStackSize() {
7916 return this.conditionStack.length;
7917 },
7918options: {"case-insensitive":true},
7919performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
7920var YYSTATE=YY_START;
7921switch($avoiding_name_collisions) {
7922case 0: this.begin('open_directive'); return 30;
7923break;
7924case 1: this.begin('type_directive'); return 31;
7925break;
7926case 2: this.popState(); this.begin('arg_directive'); return 15;
7927break;
7928case 3: this.popState(); this.popState(); return 33;
7929break;
7930case 4:return 32;
7931break;
7932case 5:/* skip comments */
7933break;
7934case 6:/* skip comments */
7935break;
7936case 7:return 11;
7937break;
7938case 8:/* skip whitespace */
7939break;
7940case 9:return 9;
7941break;
7942case 10:return 29;
7943break;
7944case 11:return 4;
7945break;
7946case 12:return 23;
7947break;
7948case 13:return 24;
7949break;
7950case 14:return 25;
7951break;
7952case 15:return 26;
7953break;
7954case 16:return 23;
7955break;
7956case 17:return 24;
7957break;
7958case 18:return 25;
7959break;
7960case 19:return 27;
7961break;
7962case 20:return 28;
7963break;
7964case 21:return 27;
7965break;
7966case 22:return 27;
7967break;
7968case 23:return 20;
7969break;
7970case 24:return yy_.yytext[0];
7971break;
7972case 25:return 6;
7973break;
7974}
7975},
7976rules: [/^(?:%%\{)/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],
7977conditions: {"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}}
7978});
7979return lexer;
7980})();
7981parser.lexer = lexer;
7982function Parser () {
7983 this.yy = {};
7984}
7985Parser.prototype = parser;parser.Parser = Parser;
7986return new Parser;
7987})();
7988
7989
7990if (true) {
7991exports.parser = parser;
7992exports.Parser = parser.Parser;
7993exports.parse = function () { return parser.parse.apply(parser, arguments); };
7994exports.main = function commonjsMain (args) {
7995 if (!args[1]) {
7996 console.log('Usage: '+args[0]+' FILE');
7997 process.exit(1);
7998 }
7999 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");
8000 return exports.parser.parse(source);
8001};
8002if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
8003 exports.main(process.argv.slice(1));
8004}
8005}
8006/* 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)))
8007
8008/***/ }),
8009
8010/***/ "./src/diagrams/er/styles.js":
8011/*!***********************************!*\
8012 !*** ./src/diagrams/er/styles.js ***!
8013 \***********************************/
8014/*! exports provided: default */
8015/***/ (function(module, __webpack_exports__, __webpack_require__) {
8016
8017"use strict";
8018__webpack_require__.r(__webpack_exports__);
8019var getStyles = function getStyles(options) {
8020 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");
8021};
8022
8023/* harmony default export */ __webpack_exports__["default"] = (getStyles);
8024
8025/***/ }),
8026
8027/***/ "./src/diagrams/flowchart/flowChartShapes.js":
8028/*!***************************************************!*\
8029 !*** ./src/diagrams/flowchart/flowChartShapes.js ***!
8030 \***************************************************/
8031/*! exports provided: addToRender, addToRenderV2, default */
8032/***/ (function(module, __webpack_exports__, __webpack_require__) {
8033
8034"use strict";
8035__webpack_require__.r(__webpack_exports__);
8036/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addToRender", function() { return addToRender; });
8037/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addToRenderV2", function() { return addToRenderV2; });
8038/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dagre-d3 */ "dagre-d3");
8039/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dagre_d3__WEBPACK_IMPORTED_MODULE_0__);
8040
8041
8042function question(parent, bbox, node) {
8043 var w = bbox.width;
8044 var h = bbox.height;
8045 var s = (w + h) * 0.9;
8046 var points = [{
8047 x: s / 2,
8048 y: 0
8049 }, {
8050 x: s,
8051 y: -s / 2
8052 }, {
8053 x: s / 2,
8054 y: -s
8055 }, {
8056 x: 0,
8057 y: -s / 2
8058 }];
8059 var shapeSvg = insertPolygonShape(parent, s, s, points);
8060
8061 node.intersect = function (point) {
8062 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
8063 };
8064
8065 return shapeSvg;
8066}
8067
8068function hexagon(parent, bbox, node) {
8069 var f = 4;
8070 var h = bbox.height;
8071 var m = h / f;
8072 var w = bbox.width + 2 * m;
8073 var points = [{
8074 x: m,
8075 y: 0
8076 }, {
8077 x: w - m,
8078 y: 0
8079 }, {
8080 x: w,
8081 y: -h / 2
8082 }, {
8083 x: w - m,
8084 y: -h
8085 }, {
8086 x: m,
8087 y: -h
8088 }, {
8089 x: 0,
8090 y: -h / 2
8091 }];
8092 var shapeSvg = insertPolygonShape(parent, w, h, points);
8093
8094 node.intersect = function (point) {
8095 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
8096 };
8097
8098 return shapeSvg;
8099}
8100
8101function rect_left_inv_arrow(parent, bbox, node) {
8102 var w = bbox.width;
8103 var h = bbox.height;
8104 var points = [{
8105 x: -h / 2,
8106 y: 0
8107 }, {
8108 x: w,
8109 y: 0
8110 }, {
8111 x: w,
8112 y: -h
8113 }, {
8114 x: -h / 2,
8115 y: -h
8116 }, {
8117 x: 0,
8118 y: -h / 2
8119 }];
8120 var shapeSvg = insertPolygonShape(parent, w, h, points);
8121
8122 node.intersect = function (point) {
8123 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
8124 };
8125
8126 return shapeSvg;
8127}
8128
8129function lean_right(parent, bbox, node) {
8130 var w = bbox.width;
8131 var h = bbox.height;
8132 var points = [{
8133 x: -2 * h / 6,
8134 y: 0
8135 }, {
8136 x: w - h / 6,
8137 y: 0
8138 }, {
8139 x: w + 2 * h / 6,
8140 y: -h
8141 }, {
8142 x: h / 6,
8143 y: -h
8144 }];
8145 var shapeSvg = insertPolygonShape(parent, w, h, points);
8146
8147 node.intersect = function (point) {
8148 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
8149 };
8150
8151 return shapeSvg;
8152}
8153
8154function lean_left(parent, bbox, node) {
8155 var w = bbox.width;
8156 var h = bbox.height;
8157 var points = [{
8158 x: 2 * h / 6,
8159 y: 0
8160 }, {
8161 x: w + h / 6,
8162 y: 0
8163 }, {
8164 x: w - 2 * h / 6,
8165 y: -h
8166 }, {
8167 x: -h / 6,
8168 y: -h
8169 }];
8170 var shapeSvg = insertPolygonShape(parent, w, h, points);
8171
8172 node.intersect = function (point) {
8173 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
8174 };
8175
8176 return shapeSvg;
8177}
8178
8179function trapezoid(parent, bbox, node) {
8180 var w = bbox.width;
8181 var h = bbox.height;
8182 var points = [{
8183 x: -2 * h / 6,
8184 y: 0
8185 }, {
8186 x: w + 2 * h / 6,
8187 y: 0
8188 }, {
8189 x: w - h / 6,
8190 y: -h
8191 }, {
8192 x: h / 6,
8193 y: -h
8194 }];
8195 var shapeSvg = insertPolygonShape(parent, w, h, points);
8196
8197 node.intersect = function (point) {
8198 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
8199 };
8200
8201 return shapeSvg;
8202}
8203
8204function inv_trapezoid(parent, bbox, node) {
8205 var w = bbox.width;
8206 var h = bbox.height;
8207 var points = [{
8208 x: h / 6,
8209 y: 0
8210 }, {
8211 x: w - h / 6,
8212 y: 0
8213 }, {
8214 x: w + 2 * h / 6,
8215 y: -h
8216 }, {
8217 x: -2 * h / 6,
8218 y: -h
8219 }];
8220 var shapeSvg = insertPolygonShape(parent, w, h, points);
8221
8222 node.intersect = function (point) {
8223 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
8224 };
8225
8226 return shapeSvg;
8227}
8228
8229function rect_right_inv_arrow(parent, bbox, node) {
8230 var w = bbox.width;
8231 var h = bbox.height;
8232 var points = [{
8233 x: 0,
8234 y: 0
8235 }, {
8236 x: w + h / 2,
8237 y: 0
8238 }, {
8239 x: w,
8240 y: -h / 2
8241 }, {
8242 x: w + h / 2,
8243 y: -h
8244 }, {
8245 x: 0,
8246 y: -h
8247 }];
8248 var shapeSvg = insertPolygonShape(parent, w, h, points);
8249
8250 node.intersect = function (point) {
8251 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
8252 };
8253
8254 return shapeSvg;
8255}
8256
8257function stadium(parent, bbox, node) {
8258 var h = bbox.height;
8259 var w = bbox.width + h / 4;
8260 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);
8261
8262 node.intersect = function (point) {
8263 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.rect(node, point);
8264 };
8265
8266 return shapeSvg;
8267}
8268
8269function subroutine(parent, bbox, node) {
8270 var w = bbox.width;
8271 var h = bbox.height;
8272 var points = [{
8273 x: 0,
8274 y: 0
8275 }, {
8276 x: w,
8277 y: 0
8278 }, {
8279 x: w,
8280 y: -h
8281 }, {
8282 x: 0,
8283 y: -h
8284 }, {
8285 x: 0,
8286 y: 0
8287 }, {
8288 x: -8,
8289 y: 0
8290 }, {
8291 x: w + 8,
8292 y: 0
8293 }, {
8294 x: w + 8,
8295 y: -h
8296 }, {
8297 x: -8,
8298 y: -h
8299 }, {
8300 x: -8,
8301 y: 0
8302 }];
8303 var shapeSvg = insertPolygonShape(parent, w, h, points);
8304
8305 node.intersect = function (point) {
8306 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.polygon(node, points, point);
8307 };
8308
8309 return shapeSvg;
8310}
8311
8312function cylinder(parent, bbox, node) {
8313 var w = bbox.width;
8314 var rx = w / 2;
8315 var ry = rx / (2.5 + w / 50);
8316 var h = bbox.height + ry;
8317 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;
8318 var shapeSvg = parent.attr('label-offset-y', ry).insert('path', ':first-child').attr('d', shape).attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');
8319
8320 node.intersect = function (point) {
8321 var pos = dagre_d3__WEBPACK_IMPORTED_MODULE_0___default.a.intersect.rect(node, point);
8322 var x = pos.x - node.x;
8323
8324 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)) {
8325 // ellipsis equation: x*x / a*a + y*y / b*b = 1
8326 // solve for y to get adjustion value for pos.y
8327 var y = ry * ry * (1 - x * x / (rx * rx));
8328 if (y != 0) y = Math.sqrt(y);
8329 y = ry - y;
8330 if (point.y - node.y > 0) y = -y;
8331 pos.y += y;
8332 }
8333
8334 return pos;
8335 };
8336
8337 return shapeSvg;
8338}
8339
8340function addToRender(render) {
8341 render.shapes().question = question;
8342 render.shapes().hexagon = hexagon;
8343 render.shapes().stadium = stadium;
8344 render.shapes().subroutine = subroutine;
8345 render.shapes().cylinder = cylinder; // Add custom shape for box with inverted arrow on left side
8346
8347 render.shapes().rect_left_inv_arrow = rect_left_inv_arrow; // Add custom shape for box with inverted arrow on left side
8348
8349 render.shapes().lean_right = lean_right; // Add custom shape for box with inverted arrow on left side
8350
8351 render.shapes().lean_left = lean_left; // Add custom shape for box with inverted arrow on left side
8352
8353 render.shapes().trapezoid = trapezoid; // Add custom shape for box with inverted arrow on left side
8354
8355 render.shapes().inv_trapezoid = inv_trapezoid; // Add custom shape for box with inverted arrow on right side
8356
8357 render.shapes().rect_right_inv_arrow = rect_right_inv_arrow;
8358}
8359function addToRenderV2(addShape) {
8360 addShape({
8361 question: question
8362 });
8363 addShape({
8364 hexagon: hexagon
8365 });
8366 addShape({
8367 stadium: stadium
8368 });
8369 addShape({
8370 subroutine: subroutine
8371 });
8372 addShape({
8373 cylinder: cylinder
8374 }); // Add custom shape for box with inverted arrow on left side
8375
8376 addShape({
8377 rect_left_inv_arrow: rect_left_inv_arrow
8378 }); // Add custom shape for box with inverted arrow on left side
8379
8380 addShape({
8381 lean_right: lean_right
8382 }); // Add custom shape for box with inverted arrow on left side
8383
8384 addShape({
8385 lean_left: lean_left
8386 }); // Add custom shape for box with inverted arrow on left side
8387
8388 addShape({
8389 trapezoid: trapezoid
8390 }); // Add custom shape for box with inverted arrow on left side
8391
8392 addShape({
8393 inv_trapezoid: inv_trapezoid
8394 }); // Add custom shape for box with inverted arrow on right side
8395
8396 addShape({
8397 rect_right_inv_arrow: rect_right_inv_arrow
8398 });
8399}
8400
8401function insertPolygonShape(parent, w, h, points) {
8402 return parent.insert('polygon', ':first-child').attr('points', points.map(function (d) {
8403 return d.x + ',' + d.y;
8404 }).join(' ')).attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');
8405}
8406
8407/* harmony default export */ __webpack_exports__["default"] = ({
8408 addToRender: addToRender,
8409 addToRenderV2: addToRenderV2
8410});
8411
8412/***/ }),
8413
8414/***/ "./src/diagrams/flowchart/flowDb.js":
8415/*!******************************************!*\
8416 !*** ./src/diagrams/flowchart/flowDb.js ***!
8417 \******************************************/
8418/*! exports provided: parseDirective, lookUpDomId, addVertex, addSingleLink, addLink, updateLinkInterpolate, updateLink, addClass, setDirection, setClass, setLink, getTooltip, setClickEvent, bindFunctions, getDirection, getVertices, getEdges, getClasses, clear, setGen, defaultStyle, addSubGraph, getDepthFirstPos, indexNodes, getSubGraphs, firstGraph, default */
8419/***/ (function(module, __webpack_exports__, __webpack_require__) {
8420
8421"use strict";
8422__webpack_require__.r(__webpack_exports__);
8423/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
8424/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lookUpDomId", function() { return lookUpDomId; });
8425/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addVertex", function() { return addVertex; });
8426/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSingleLink", function() { return addSingleLink; });
8427/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addLink", function() { return addLink; });
8428/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateLinkInterpolate", function() { return updateLinkInterpolate; });
8429/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateLink", function() { return updateLink; });
8430/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addClass", function() { return addClass; });
8431/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setDirection", function() { return setDirection; });
8432/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setClass", function() { return setClass; });
8433/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLink", function() { return setLink; });
8434/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTooltip", function() { return getTooltip; });
8435/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setClickEvent", function() { return setClickEvent; });
8436/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindFunctions", function() { return bindFunctions; });
8437/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDirection", function() { return getDirection; });
8438/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getVertices", function() { return getVertices; });
8439/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getEdges", function() { return getEdges; });
8440/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClasses", function() { return getClasses; });
8441/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
8442/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setGen", function() { return setGen; });
8443/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultStyle", function() { return defaultStyle; });
8444/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSubGraph", function() { return addSubGraph; });
8445/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDepthFirstPos", function() { return getDepthFirstPos; });
8446/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "indexNodes", function() { return indexNodes; });
8447/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSubGraphs", function() { return getSubGraphs; });
8448/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "firstGraph", function() { return firstGraph; });
8449/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
8450/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
8451/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
8452/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
8453/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
8454/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
8455/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
8456function _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); }
8457
8458
8459
8460
8461
8462
8463
8464var MERMAID_DOM_ID_PREFIX = 'flowchart-';
8465var vertexCounter = 0;
8466var config = _config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]();
8467var vertices = {};
8468var edges = [];
8469var classes = [];
8470var subGraphs = [];
8471var subGraphLookup = {};
8472var tooltips = {};
8473var subCount = 0;
8474var firstGraphFlag = true;
8475var direction;
8476var version; // As in graph
8477// Functions to be run after graph rendering
8478
8479var funs = [];
8480var parseDirective = function parseDirective(statement, context, type) {
8481 _mermaidAPI__WEBPACK_IMPORTED_MODULE_4__["default"].parseDirective(this, statement, context, type);
8482};
8483/**
8484 * Function to lookup domId from id in the graph definition.
8485 * @param id
8486 * @public
8487 */
8488
8489var lookUpDomId = function lookUpDomId(id) {
8490 var veritceKeys = Object.keys(vertices);
8491
8492 for (var i = 0; i < veritceKeys.length; i++) {
8493 if (vertices[veritceKeys[i]].id === id) {
8494 return vertices[veritceKeys[i]].domId;
8495 }
8496 }
8497
8498 return id;
8499};
8500/**
8501 * Function called by parser when a node definition has been found
8502 * @param id
8503 * @param text
8504 * @param type
8505 * @param style
8506 * @param classes
8507 */
8508
8509var addVertex = function addVertex(_id, text, type, style, classes) {
8510 var txt;
8511 var id = _id;
8512
8513 if (typeof id === 'undefined') {
8514 return;
8515 }
8516
8517 if (id.trim().length === 0) {
8518 return;
8519 } // if (id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
8520
8521
8522 if (typeof vertices[id] === 'undefined') {
8523 vertices[id] = {
8524 id: id,
8525 domId: MERMAID_DOM_ID_PREFIX + id + '-' + vertexCounter,
8526 styles: [],
8527 classes: []
8528 };
8529 }
8530
8531 vertexCounter++;
8532
8533 if (typeof text !== 'undefined') {
8534 config = _config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]();
8535 txt = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(text.trim(), config); // strip quotes if string starts and ends with a quote
8536
8537 if (txt[0] === '"' && txt[txt.length - 1] === '"') {
8538 txt = txt.substring(1, txt.length - 1);
8539 }
8540
8541 vertices[id].text = txt;
8542 } else {
8543 if (typeof vertices[id].text === 'undefined') {
8544 vertices[id].text = _id;
8545 }
8546 }
8547
8548 if (typeof type !== 'undefined') {
8549 vertices[id].type = type;
8550 }
8551
8552 if (typeof style !== 'undefined') {
8553 if (style !== null) {
8554 style.forEach(function (s) {
8555 vertices[id].styles.push(s);
8556 });
8557 }
8558 }
8559
8560 if (typeof classes !== 'undefined') {
8561 if (classes !== null) {
8562 classes.forEach(function (s) {
8563 vertices[id].classes.push(s);
8564 });
8565 }
8566 }
8567};
8568/**
8569 * Function called by parser when a link/edge definition has been found
8570 * @param start
8571 * @param end
8572 * @param type
8573 * @param linktext
8574 */
8575
8576var addSingleLink = function addSingleLink(_start, _end, type, linktext) {
8577 var start = _start;
8578 var end = _end; // if (start[0].match(/\d/)) start = MERMAID_DOM_ID_PREFIX + start;
8579 // if (end[0].match(/\d/)) end = MERMAID_DOM_ID_PREFIX + end;
8580 // logger.info('Got edge...', start, end);
8581
8582 var edge = {
8583 start: start,
8584 end: end,
8585 type: undefined,
8586 text: ''
8587 };
8588 linktext = type.text;
8589
8590 if (typeof linktext !== 'undefined') {
8591 edge.text = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(linktext.trim(), config); // strip quotes if string starts and exnds with a quote
8592
8593 if (edge.text[0] === '"' && edge.text[edge.text.length - 1] === '"') {
8594 edge.text = edge.text.substring(1, edge.text.length - 1);
8595 }
8596 }
8597
8598 if (typeof type !== 'undefined') {
8599 edge.type = type.type;
8600 edge.stroke = type.stroke;
8601 edge.length = type.length;
8602 }
8603
8604 edges.push(edge);
8605};
8606var addLink = function addLink(_start, _end, type, linktext) {
8607 var i, j;
8608
8609 for (i = 0; i < _start.length; i++) {
8610 for (j = 0; j < _end.length; j++) {
8611 addSingleLink(_start[i], _end[j], type, linktext);
8612 }
8613 }
8614};
8615/**
8616 * Updates a link's line interpolation algorithm
8617 * @param pos
8618 * @param interpolate
8619 */
8620
8621var updateLinkInterpolate = function updateLinkInterpolate(positions, interp) {
8622 positions.forEach(function (pos) {
8623 if (pos === 'default') {
8624 edges.defaultInterpolate = interp;
8625 } else {
8626 edges[pos].interpolate = interp;
8627 }
8628 });
8629};
8630/**
8631 * Updates a link with a style
8632 * @param pos
8633 * @param style
8634 */
8635
8636var updateLink = function updateLink(positions, style) {
8637 positions.forEach(function (pos) {
8638 if (pos === 'default') {
8639 edges.defaultStyle = style;
8640 } else {
8641 if (_utils__WEBPACK_IMPORTED_MODULE_1__["default"].isSubstringInArray('fill', style) === -1) {
8642 style.push('fill:none');
8643 }
8644
8645 edges[pos].style = style;
8646 }
8647 });
8648};
8649var addClass = function addClass(id, style) {
8650 if (typeof classes[id] === 'undefined') {
8651 classes[id] = {
8652 id: id,
8653 styles: [],
8654 textStyles: []
8655 };
8656 }
8657
8658 if (typeof style !== 'undefined') {
8659 if (style !== null) {
8660 style.forEach(function (s) {
8661 if (s.match('color')) {
8662 var newStyle1 = s.replace('fill', 'bgFill');
8663 var newStyle2 = newStyle1.replace('color', 'fill');
8664 classes[id].textStyles.push(newStyle2);
8665 }
8666
8667 classes[id].styles.push(s);
8668 });
8669 }
8670 }
8671};
8672/**
8673 * Called by parser when a graph definition is found, stores the direction of the chart.
8674 * @param dir
8675 */
8676
8677var setDirection = function setDirection(dir) {
8678 direction = dir;
8679
8680 if (direction.match(/.*</)) {
8681 direction = 'RL';
8682 }
8683
8684 if (direction.match(/.*\^/)) {
8685 direction = 'BT';
8686 }
8687
8688 if (direction.match(/.*>/)) {
8689 direction = 'LR';
8690 }
8691
8692 if (direction.match(/.*v/)) {
8693 direction = 'TB';
8694 }
8695};
8696/**
8697 * Called by parser when a special node is found, e.g. a clickable element.
8698 * @param ids Comma separated list of ids
8699 * @param className Class to add
8700 */
8701
8702var setClass = function setClass(ids, className) {
8703 ids.split(',').forEach(function (_id) {
8704 // let id = version === 'gen-2' ? lookUpDomId(_id) : _id;
8705 var id = _id; // if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
8706
8707 if (typeof vertices[id] !== 'undefined') {
8708 vertices[id].classes.push(className);
8709 }
8710
8711 if (typeof subGraphLookup[id] !== 'undefined') {
8712 subGraphLookup[id].classes.push(className);
8713 }
8714 });
8715};
8716
8717var setTooltip = function setTooltip(ids, tooltip) {
8718 ids.split(',').forEach(function (id) {
8719 if (typeof tooltip !== 'undefined') {
8720 tooltips[version === 'gen-1' ? lookUpDomId(id) : id] = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(tooltip, config);
8721 }
8722 });
8723};
8724
8725var setClickFun = function setClickFun(id, functionName) {
8726 var domId = lookUpDomId(id); // if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
8727
8728 if (_config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]().securityLevel !== 'loose') {
8729 return;
8730 }
8731
8732 if (typeof functionName === 'undefined') {
8733 return;
8734 }
8735
8736 if (typeof vertices[id] !== 'undefined') {
8737 vertices[id].haveCallback = true;
8738 funs.push(function () {
8739 var elem = document.querySelector("[id=\"".concat(domId, "\"]"));
8740
8741 if (elem !== null) {
8742 elem.addEventListener('click', function () {
8743 _utils__WEBPACK_IMPORTED_MODULE_1__["default"].runFunc(functionName, id);
8744 }, false);
8745 }
8746 });
8747 }
8748};
8749/**
8750 * Called by parser when a link is found. Adds the URL to the vertex data.
8751 * @param ids Comma separated list of ids
8752 * @param linkStr URL to create a link for
8753 * @param tooltip Tooltip for the clickable element
8754 */
8755
8756
8757var setLink = function setLink(ids, linkStr, tooltip, target) {
8758 ids.split(',').forEach(function (id) {
8759 if (typeof vertices[id] !== 'undefined') {
8760 vertices[id].link = _utils__WEBPACK_IMPORTED_MODULE_1__["default"].formatUrl(linkStr, config);
8761 vertices[id].linkTarget = target;
8762 }
8763 });
8764 setTooltip(ids, tooltip);
8765 setClass(ids, 'clickable');
8766};
8767var getTooltip = function getTooltip(id) {
8768 return tooltips[id];
8769};
8770/**
8771 * Called by parser when a click definition is found. Registers an event handler.
8772 * @param ids Comma separated list of ids
8773 * @param functionName Function to be called on click
8774 * @param tooltip Tooltip for the clickable element
8775 */
8776
8777var setClickEvent = function setClickEvent(ids, functionName, tooltip) {
8778 ids.split(',').forEach(function (id) {
8779 setClickFun(id, functionName);
8780 });
8781 setTooltip(ids, tooltip);
8782 setClass(ids, 'clickable');
8783};
8784var bindFunctions = function bindFunctions(element) {
8785 funs.forEach(function (fun) {
8786 fun(element);
8787 });
8788};
8789var getDirection = function getDirection() {
8790 return direction.trim();
8791};
8792/**
8793 * Retrieval function for fetching the found nodes after parsing has completed.
8794 * @returns {{}|*|vertices}
8795 */
8796
8797var getVertices = function getVertices() {
8798 return vertices;
8799};
8800/**
8801 * Retrieval function for fetching the found links after parsing has completed.
8802 * @returns {{}|*|edges}
8803 */
8804
8805var getEdges = function getEdges() {
8806 return edges;
8807};
8808/**
8809 * Retrieval function for fetching the found class definitions after parsing has completed.
8810 * @returns {{}|*|classes}
8811 */
8812
8813var getClasses = function getClasses() {
8814 return classes;
8815};
8816
8817var setupToolTips = function setupToolTips(element) {
8818 var tooltipElem = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('.mermaidTooltip');
8819
8820 if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
8821 tooltipElem = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
8822 }
8823
8824 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(element).select('svg');
8825 var nodes = svg.selectAll('g.node');
8826 nodes.on('mouseover', function () {
8827 var el = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(this);
8828 var title = el.attr('title'); // Dont try to draw a tooltip if no data is provided
8829
8830 if (title === null) {
8831 return;
8832 }
8833
8834 var rect = this.getBoundingClientRect();
8835 tooltipElem.transition().duration(200).style('opacity', '.9');
8836 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');
8837 el.classed('hover', true);
8838 }).on('mouseout', function () {
8839 tooltipElem.transition().duration(500).style('opacity', 0);
8840 var el = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(this);
8841 el.classed('hover', false);
8842 });
8843};
8844
8845funs.push(setupToolTips);
8846/**
8847 * Clears the internal graph db so that a new graph can be parsed.
8848 */
8849
8850var clear = function clear(ver) {
8851 vertices = {};
8852 classes = {};
8853 edges = [];
8854 funs = [];
8855 funs.push(setupToolTips);
8856 subGraphs = [];
8857 subGraphLookup = {};
8858 subCount = 0;
8859 tooltips = [];
8860 firstGraphFlag = true;
8861 version = ver || 'gen-1';
8862};
8863var setGen = function setGen(ver) {
8864 version = ver || 'gen-1';
8865};
8866/**
8867 *
8868 * @returns {string}
8869 */
8870
8871var defaultStyle = function defaultStyle() {
8872 return 'fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;';
8873};
8874/**
8875 * Clears the internal graph db so that a new graph can be parsed.
8876 */
8877
8878var addSubGraph = function addSubGraph(_id, list, _title) {
8879 var id = _id.trim();
8880
8881 var title = _title;
8882
8883 if (_id === _title && _title.match(/\s/)) {
8884 id = undefined;
8885 }
8886
8887 function uniq(a) {
8888 var prims = {
8889 boolean: {},
8890 number: {},
8891 string: {}
8892 };
8893 var objs = [];
8894 return a.filter(function (item) {
8895 var type = _typeof(item);
8896
8897 if (item.trim() === '') {
8898 return false;
8899 }
8900
8901 if (type in prims) {
8902 return prims[type].hasOwnProperty(item) ? false : prims[type][item] = true; // eslint-disable-line
8903 } else {
8904 return objs.indexOf(item) >= 0 ? false : objs.push(item);
8905 }
8906 });
8907 }
8908
8909 var nodeList = [];
8910 nodeList = uniq(nodeList.concat.apply(nodeList, list));
8911
8912 if (version === 'gen-1') {
8913 _logger__WEBPACK_IMPORTED_MODULE_5__["logger"].warn('LOOKING UP');
8914
8915 for (var i = 0; i < nodeList.length; i++) {
8916 nodeList[i] = lookUpDomId(nodeList[i]);
8917 }
8918 }
8919
8920 id = id || 'subGraph' + subCount; // if (id[0].match(/\d/)) id = lookUpDomId(id);
8921
8922 title = title || '';
8923 title = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(title, config);
8924 subCount = subCount + 1;
8925 var subGraph = {
8926 id: id,
8927 nodes: nodeList,
8928 title: title.trim(),
8929 classes: []
8930 };
8931 console.log('Adding', subGraph.id, subGraph.nodes);
8932 /**
8933 * Deletes an id from all subgraphs
8934 */
8935 // const del = _id => {
8936 // subGraphs.forEach(sg => {
8937 // const pos = sg.nodes.indexOf(_id);
8938 // if (pos >= 0) {
8939 // sg.nodes.splice(pos, 1);
8940 // }
8941 // });
8942 // };
8943 // // Removes the members of this subgraph from any other subgraphs, a node only belong to one subgraph
8944 // subGraph.nodes.forEach(_id => del(_id));
8945 // Remove the members in the new subgraph if they already belong to another subgraph
8946
8947 subGraph.nodes = makeUniq(subGraph, subGraphs).nodes;
8948 subGraphs.push(subGraph);
8949 subGraphLookup[id] = subGraph;
8950 return id;
8951};
8952
8953var getPosForId = function getPosForId(id) {
8954 for (var i = 0; i < subGraphs.length; i++) {
8955 if (subGraphs[i].id === id) {
8956 return i;
8957 }
8958 }
8959
8960 return -1;
8961};
8962
8963var secCount = -1;
8964var posCrossRef = [];
8965
8966var indexNodes2 = function indexNodes2(id, pos) {
8967 var nodes = subGraphs[pos].nodes;
8968 secCount = secCount + 1;
8969
8970 if (secCount > 2000) {
8971 return;
8972 }
8973
8974 posCrossRef[secCount] = pos; // Check if match
8975
8976 if (subGraphs[pos].id === id) {
8977 return {
8978 result: true,
8979 count: 0
8980 };
8981 }
8982
8983 var count = 0;
8984 var posCount = 1;
8985
8986 while (count < nodes.length) {
8987 var childPos = getPosForId(nodes[count]); // Ignore regular nodes (pos will be -1)
8988
8989 if (childPos >= 0) {
8990 var res = indexNodes2(id, childPos);
8991
8992 if (res.result) {
8993 return {
8994 result: true,
8995 count: posCount + res.count
8996 };
8997 } else {
8998 posCount = posCount + res.count;
8999 }
9000 }
9001
9002 count = count + 1;
9003 }
9004
9005 return {
9006 result: false,
9007 count: posCount
9008 };
9009};
9010
9011var getDepthFirstPos = function getDepthFirstPos(pos) {
9012 return posCrossRef[pos];
9013};
9014var indexNodes = function indexNodes() {
9015 secCount = -1;
9016
9017 if (subGraphs.length > 0) {
9018 indexNodes2('none', subGraphs.length - 1, 0);
9019 }
9020};
9021var getSubGraphs = function getSubGraphs() {
9022 return subGraphs;
9023};
9024var firstGraph = function firstGraph() {
9025 if (firstGraphFlag) {
9026 firstGraphFlag = false;
9027 return true;
9028 }
9029
9030 return false;
9031};
9032
9033var destructStartLink = function destructStartLink(_str) {
9034 var str = _str.trim();
9035
9036 var type = 'arrow_open';
9037
9038 switch (str[0]) {
9039 case '<':
9040 type = 'arrow_point';
9041 str = str.slice(1);
9042 break;
9043
9044 case 'x':
9045 type = 'arrow_cross';
9046 str = str.slice(1);
9047 break;
9048
9049 case 'o':
9050 type = 'arrow_circle';
9051 str = str.slice(1);
9052 break;
9053 }
9054
9055 var stroke = 'normal';
9056
9057 if (str.indexOf('=') !== -1) {
9058 stroke = 'thick';
9059 }
9060
9061 if (str.indexOf('.') !== -1) {
9062 stroke = 'dotted';
9063 }
9064
9065 return {
9066 type: type,
9067 stroke: stroke
9068 };
9069};
9070
9071var countChar = function countChar(char, str) {
9072 var length = str.length;
9073 var count = 0;
9074
9075 for (var i = 0; i < length; ++i) {
9076 if (str[i] === char) {
9077 ++count;
9078 }
9079 }
9080
9081 return count;
9082};
9083
9084var destructEndLink = function destructEndLink(_str) {
9085 var str = _str.trim();
9086
9087 var line = str.slice(0, -1);
9088 var type = 'arrow_open';
9089
9090 switch (str.slice(-1)) {
9091 case 'x':
9092 type = 'arrow_cross';
9093
9094 if (str[0] === 'x') {
9095 type = 'double_' + type;
9096 line = line.slice(1);
9097 }
9098
9099 break;
9100
9101 case '>':
9102 type = 'arrow_point';
9103
9104 if (str[0] === '<') {
9105 type = 'double_' + type;
9106 line = line.slice(1);
9107 }
9108
9109 break;
9110
9111 case 'o':
9112 type = 'arrow_circle';
9113
9114 if (str[0] === 'o') {
9115 type = 'double_' + type;
9116 line = line.slice(1);
9117 }
9118
9119 break;
9120 }
9121
9122 var stroke = 'normal';
9123 var length = line.length - 1;
9124
9125 if (line[0] === '=') {
9126 stroke = 'thick';
9127 }
9128
9129 var dots = countChar('.', line);
9130
9131 if (dots) {
9132 stroke = 'dotted';
9133 length = dots;
9134 }
9135
9136 return {
9137 type: type,
9138 stroke: stroke,
9139 length: length
9140 };
9141};
9142
9143var destructLink = function destructLink(_str, _startStr) {
9144 var info = destructEndLink(_str);
9145 var startInfo;
9146
9147 if (_startStr) {
9148 startInfo = destructStartLink(_startStr);
9149
9150 if (startInfo.stroke !== info.stroke) {
9151 return {
9152 type: 'INVALID',
9153 stroke: 'INVALID'
9154 };
9155 }
9156
9157 if (startInfo.type === 'arrow_open') {
9158 // -- xyz --> - take arrow type from ending
9159 startInfo.type = info.type;
9160 } else {
9161 // x-- xyz --> - not supported
9162 if (startInfo.type !== info.type) return {
9163 type: 'INVALID',
9164 stroke: 'INVALID'
9165 };
9166 startInfo.type = 'double_' + startInfo.type;
9167 }
9168
9169 if (startInfo.type === 'double_arrow') {
9170 startInfo.type = 'double_arrow_point';
9171 }
9172
9173 startInfo.length = info.length;
9174 return startInfo;
9175 }
9176
9177 return info;
9178}; // Todo optimizer this by caching existing nodes
9179
9180
9181var exists = function exists(allSgs, _id) {
9182 var res = false;
9183 allSgs.forEach(function (sg) {
9184 var pos = sg.nodes.indexOf(_id);
9185
9186 if (pos >= 0) {
9187 res = true;
9188 }
9189 });
9190 return res;
9191};
9192/**
9193 * Deletes an id from all subgraphs
9194 */
9195
9196
9197var makeUniq = function makeUniq(sg, allSubgraphs) {
9198 var res = [];
9199 sg.nodes.forEach(function (_id, pos) {
9200 if (!exists(allSubgraphs, _id)) {
9201 res.push(sg.nodes[pos]);
9202 }
9203 });
9204 return {
9205 nodes: res
9206 };
9207};
9208
9209/* harmony default export */ __webpack_exports__["default"] = ({
9210 parseDirective: parseDirective,
9211 defaultConfig: function defaultConfig() {
9212 return _config__WEBPACK_IMPORTED_MODULE_2__["defaultConfig"].flowchart;
9213 },
9214 addVertex: addVertex,
9215 lookUpDomId: lookUpDomId,
9216 addLink: addLink,
9217 updateLinkInterpolate: updateLinkInterpolate,
9218 updateLink: updateLink,
9219 addClass: addClass,
9220 setDirection: setDirection,
9221 setClass: setClass,
9222 getTooltip: getTooltip,
9223 setClickEvent: setClickEvent,
9224 setLink: setLink,
9225 bindFunctions: bindFunctions,
9226 getDirection: getDirection,
9227 getVertices: getVertices,
9228 getEdges: getEdges,
9229 getClasses: getClasses,
9230 clear: clear,
9231 setGen: setGen,
9232 defaultStyle: defaultStyle,
9233 addSubGraph: addSubGraph,
9234 getDepthFirstPos: getDepthFirstPos,
9235 indexNodes: indexNodes,
9236 getSubGraphs: getSubGraphs,
9237 destructLink: destructLink,
9238 lex: {
9239 firstGraph: firstGraph
9240 },
9241 exists: exists,
9242 makeUniq: makeUniq
9243});
9244
9245/***/ }),
9246
9247/***/ "./src/diagrams/flowchart/flowRenderer-v2.js":
9248/*!***************************************************!*\
9249 !*** ./src/diagrams/flowchart/flowRenderer-v2.js ***!
9250 \***************************************************/
9251/*! exports provided: setConf, addVertices, addEdges, getClasses, draw, default */
9252/***/ (function(module, __webpack_exports__, __webpack_require__) {
9253
9254"use strict";
9255__webpack_require__.r(__webpack_exports__);
9256/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
9257/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addVertices", function() { return addVertices; });
9258/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addEdges", function() { return addEdges; });
9259/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClasses", function() { return getClasses; });
9260/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
9261/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
9262/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
9263/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
9264/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
9265/* harmony import */ var _flowDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./flowDb */ "./src/diagrams/flowchart/flowDb.js");
9266/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
9267/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_flow__WEBPACK_IMPORTED_MODULE_3__);
9268/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
9269/* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
9270/* 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");
9271/* 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__);
9272/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
9273/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
9274/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285var conf = {};
9286var setConf = function setConf(cnf) {
9287 var keys = Object.keys(cnf);
9288
9289 for (var i = 0; i < keys.length; i++) {
9290 conf[keys[i]] = cnf[keys[i]];
9291 }
9292};
9293/**
9294 * Function that adds the vertices found during parsing to the graph to be rendered.
9295 * @param vert Object containing the vertices.
9296 * @param g The graph that is to be drawn.
9297 */
9298
9299var addVertices = function addVertices(vert, g, svgId) {
9300 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(svgId, "\"]"));
9301 var keys = Object.keys(vert); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
9302
9303 keys.forEach(function (id) {
9304 var vertex = vert[id];
9305 /**
9306 * Variable for storing the classes for the vertex
9307 * @type {string}
9308 */
9309
9310 var classStr = 'default';
9311
9312 if (vertex.classes.length > 0) {
9313 classStr = vertex.classes.join(' ');
9314 }
9315
9316 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
9317
9318 var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
9319
9320 var vertexNode;
9321
9322 if (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels) {
9323 // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
9324 var node = {
9325 label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
9326 return "<i class='".concat(s.replace(':', ' '), "'></i>");
9327 })
9328 };
9329 vertexNode = dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_6___default()(svg, node).node();
9330 vertexNode.parentNode.removeChild(vertexNode);
9331 } else {
9332 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
9333 svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
9334 var rows = vertexText.split(_common_common__WEBPACK_IMPORTED_MODULE_8__["default"].lineBreakRegex);
9335
9336 for (var j = 0; j < rows.length; j++) {
9337 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
9338 tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
9339 tspan.setAttribute('dy', '1em');
9340 tspan.setAttribute('x', '1');
9341 tspan.textContent = rows[j];
9342 svgLabel.appendChild(tspan);
9343 }
9344
9345 vertexNode = svgLabel;
9346 }
9347
9348 var radious = 0;
9349 var _shape = ''; // Set the shape based parameters
9350
9351 switch (vertex.type) {
9352 case 'round':
9353 radious = 5;
9354 _shape = 'rect';
9355 break;
9356
9357 case 'square':
9358 _shape = 'rect';
9359 break;
9360
9361 case 'diamond':
9362 _shape = 'question';
9363 break;
9364
9365 case 'hexagon':
9366 _shape = 'hexagon';
9367 break;
9368
9369 case 'odd':
9370 _shape = 'rect_left_inv_arrow';
9371 break;
9372
9373 case 'lean_right':
9374 _shape = 'lean_right';
9375 break;
9376
9377 case 'lean_left':
9378 _shape = 'lean_left';
9379 break;
9380
9381 case 'trapezoid':
9382 _shape = 'trapezoid';
9383 break;
9384
9385 case 'inv_trapezoid':
9386 _shape = 'inv_trapezoid';
9387 break;
9388
9389 case 'odd_right':
9390 _shape = 'rect_left_inv_arrow';
9391 break;
9392
9393 case 'circle':
9394 _shape = 'circle';
9395 break;
9396
9397 case 'ellipse':
9398 _shape = 'ellipse';
9399 break;
9400
9401 case 'stadium':
9402 _shape = 'stadium';
9403 break;
9404
9405 case 'subroutine':
9406 _shape = 'subroutine';
9407 break;
9408
9409 case 'cylinder':
9410 _shape = 'cylinder';
9411 break;
9412
9413 case 'group':
9414 _shape = 'rect';
9415 break;
9416
9417 default:
9418 _shape = 'rect';
9419 } // Add the node
9420
9421
9422 g.setNode(vertex.id, {
9423 labelStyle: styles.labelStyle,
9424 shape: _shape,
9425 labelText: vertexText,
9426 rx: radious,
9427 ry: radious,
9428 class: classStr,
9429 style: styles.style,
9430 id: vertex.id,
9431 link: vertex.link,
9432 linkTarget: vertex.linkTarget,
9433 tooltip: _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getTooltip(vertex.id) || '',
9434 domId: _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(vertex.id),
9435 haveCallback: vertex.haveCallback,
9436 width: vertex.type === 'group' ? 500 : undefined,
9437 type: vertex.type,
9438 padding: Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.padding
9439 });
9440 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('setNode', {
9441 labelStyle: styles.labelStyle,
9442 shape: _shape,
9443 labelText: vertexText,
9444 rx: radious,
9445 ry: radious,
9446 class: classStr,
9447 style: styles.style,
9448 id: vertex.id,
9449 domId: _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(vertex.id),
9450 width: vertex.type === 'group' ? 500 : undefined,
9451 type: vertex.type,
9452 padding: Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.padding
9453 });
9454 });
9455};
9456/**
9457 * Add edges to graph based on parsed graph defninition
9458 * @param {Object} edges The edges to add to the graph
9459 * @param {Object} g The graph object
9460 */
9461
9462var addEdges = function addEdges(edges, g) {
9463 var cnt = 0;
9464 var defaultStyle;
9465 var defaultLabelStyle;
9466
9467 if (typeof edges.defaultStyle !== 'undefined') {
9468 var defaultStyles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(edges.defaultStyle);
9469 defaultStyle = defaultStyles.style;
9470 defaultLabelStyle = defaultStyles.labelStyle;
9471 }
9472
9473 edges.forEach(function (edge) {
9474 cnt++; // Identify Link
9475
9476 var linkId = 'L-' + edge.start + '-' + edge.end;
9477 var linkNameStart = 'LS-' + edge.start;
9478 var linkNameEnd = 'LE-' + edge.end;
9479 var edgeData = {
9480 style: '',
9481 labelStyle: ''
9482 };
9483 edgeData.minlen = edge.length || 1; //edgeData.id = 'id' + cnt;
9484 // Set link type for rendering
9485
9486 if (edge.type === 'arrow_open') {
9487 edgeData.arrowhead = 'none';
9488 } else {
9489 edgeData.arrowhead = 'normal';
9490 } // Check of arrow types, placed here in order not to break old rendering
9491
9492
9493 edgeData.arrowTypeStart = 'arrow_open';
9494 edgeData.arrowTypeEnd = 'arrow_open';
9495 /* eslint-disable no-fallthrough */
9496
9497 switch (edge.type) {
9498 case 'double_arrow_cross':
9499 edgeData.arrowTypeStart = 'arrow_cross';
9500
9501 case 'arrow_cross':
9502 edgeData.arrowTypeEnd = 'arrow_cross';
9503 break;
9504
9505 case 'double_arrow_point':
9506 edgeData.arrowTypeStart = 'arrow_point';
9507
9508 case 'arrow_point':
9509 edgeData.arrowTypeEnd = 'arrow_point';
9510 break;
9511
9512 case 'double_arrow_circle':
9513 edgeData.arrowTypeStart = 'arrow_circle';
9514
9515 case 'arrow_circle':
9516 edgeData.arrowTypeEnd = 'arrow_circle';
9517 break;
9518 }
9519
9520 var style = '';
9521 var labelStyle = '';
9522
9523 switch (edge.stroke) {
9524 case 'normal':
9525 style = 'fill:none;';
9526
9527 if (typeof defaultStyle !== 'undefined') {
9528 style = defaultStyle;
9529 }
9530
9531 if (typeof defaultLabelStyle !== 'undefined') {
9532 labelStyle = defaultLabelStyle;
9533 }
9534
9535 edgeData.thickness = 'normal';
9536 edgeData.pattern = 'solid';
9537 break;
9538
9539 case 'dotted':
9540 edgeData.thickness = 'normal';
9541 edgeData.pattern = 'dotted';
9542 edgeData.style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';
9543 break;
9544
9545 case 'thick':
9546 edgeData.thickness = 'thick';
9547 edgeData.pattern = 'solid';
9548 edgeData.style = 'stroke-width: 3.5px;fill:none;';
9549 break;
9550 }
9551
9552 if (typeof edge.style !== 'undefined') {
9553 var styles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(edge.style);
9554 style = styles.style;
9555 labelStyle = styles.labelStyle;
9556 }
9557
9558 edgeData.style = edgeData.style += style;
9559 edgeData.labelStyle = edgeData.labelStyle += labelStyle;
9560
9561 if (typeof edge.interpolate !== 'undefined') {
9562 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
9563 } else if (typeof edges.defaultInterpolate !== 'undefined') {
9564 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
9565 } else {
9566 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(conf.curve, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
9567 }
9568
9569 if (typeof edge.text === 'undefined') {
9570 if (typeof edge.style !== 'undefined') {
9571 edgeData.arrowheadStyle = 'fill: #333';
9572 }
9573 } else {
9574 edgeData.arrowheadStyle = 'fill: #333';
9575 edgeData.labelpos = 'c';
9576 } // if (getConfig().flowchart.htmlLabels && false) {
9577 // // eslint-disable-line
9578 // edgeData.labelType = 'html';
9579 // edgeData.label = `<span id="L-${linkId}" class="edgeLabel L-${linkNameStart}' L-${linkNameEnd}">${edge.text}</span>`;
9580 // } else {
9581
9582
9583 edgeData.labelType = 'text';
9584 edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_8__["default"].lineBreakRegex, '\n');
9585
9586 if (typeof edge.style === 'undefined') {
9587 edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none;';
9588 }
9589
9590 edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:'); // }
9591
9592 edgeData.id = linkId;
9593 edgeData.classes = 'flowchart-link ' + linkNameStart + ' ' + linkNameEnd; // Add the edge to the graph
9594
9595 g.setEdge(edge.start, edge.end, edgeData, cnt);
9596 });
9597};
9598/**
9599 * Returns the all the styles from classDef statements in the graph definition.
9600 * @returns {object} classDef styles
9601 */
9602
9603var getClasses = function getClasses(text) {
9604 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Extracting classes');
9605 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
9606 var parser = _parser_flow__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
9607 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"];
9608
9609 try {
9610 // Parse the graph definition
9611 parser.parse(text);
9612 } catch (e) {
9613 return;
9614 }
9615
9616 return _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getClasses();
9617};
9618/**
9619 * Draws a flowchart in the tag with id: id based on the graph definition in text.
9620 * @param text
9621 * @param id
9622 */
9623
9624var draw = function draw(text, id) {
9625 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Drawing flowchart');
9626 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
9627 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].setGen('gen-2');
9628 var parser = _parser_flow__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
9629 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the graph definition
9630 // try {
9631
9632 parser.parse(text); // } catch (err) {
9633 // logger.debug('Parsing failed');
9634 // }
9635 // Fetch the default direction, use TD if none was found
9636
9637 var dir = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getDirection();
9638
9639 if (typeof dir === 'undefined') {
9640 dir = 'TD';
9641 }
9642
9643 var conf = Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart;
9644 var nodeSpacing = conf.nodeSpacing || 50;
9645 var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
9646
9647 var g = new graphlib__WEBPACK_IMPORTED_MODULE_0___default.a.Graph({
9648 multigraph: true,
9649 compound: true
9650 }).setGraph({
9651 rankdir: dir,
9652 nodesep: nodeSpacing,
9653 ranksep: rankSpacing,
9654 marginx: 8,
9655 marginy: 8
9656 }).setDefaultEdgeLabel(function () {
9657 return {};
9658 });
9659 var subG;
9660 var subGraphs = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getSubGraphs();
9661 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Subgraphs - ', subGraphs);
9662
9663 for (var _i = subGraphs.length - 1; _i >= 0; _i--) {
9664 subG = subGraphs[_i];
9665 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Subgraph - ', subG);
9666 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
9667 } // Fetch the verices/nodes and edges/links from the parsed graph definition
9668
9669
9670 var vert = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getVertices();
9671 var edges = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getEdges();
9672 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info(edges);
9673 var i = 0;
9674
9675 for (i = subGraphs.length - 1; i >= 0; i--) {
9676 // for (let i = 0; i < subGraphs.length; i++) {
9677 subG = subGraphs[i];
9678 Object(d3__WEBPACK_IMPORTED_MODULE_1__["selectAll"])('cluster').append('text');
9679
9680 for (var j = 0; j < subG.nodes.length; j++) {
9681 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Setting up subgraphs', subG.nodes[j], subG.id);
9682 g.setParent(subG.nodes[j], subG.id);
9683 }
9684 }
9685
9686 addVertices(vert, g, id);
9687 addEdges(edges, g); // Add custom shapes
9688 // flowChartShapes.addToRenderV2(addShape);
9689 // Set up an SVG group so that we can translate the final graph.
9690
9691 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(id, "\"]"));
9692 svg.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink'); // Run the renderer. This is what draws the final graph.
9693
9694 var element = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#' + id + ' g');
9695 Object(_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_5__["render"])(element, g, ['point', 'circle', 'cross'], 'flowchart', id);
9696 var padding = conf.diagramPadding;
9697 var svgBounds = svg.node().getBBox();
9698 var width = svgBounds.width + padding * 2;
9699 var height = svgBounds.height + padding * 2;
9700 _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, ")"));
9701 Object(_utils__WEBPACK_IMPORTED_MODULE_9__["configureSvgSize"])(svg, height, width, conf.useMaxWidth);
9702 svg.attr('viewBox', "0 0 ".concat(width, " ").concat(height));
9703 svg.select('g').attr('transform', "translate(".concat(padding - g._label.marginx, ", ").concat(padding - svgBounds.y, ")")); // Index nodes
9704
9705 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].indexNodes('subGraph' + i); // Add label rects for non html labels
9706
9707 if (!conf.htmlLabels) {
9708 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
9709
9710 for (var k = 0; k < labels.length; k++) {
9711 var label = labels[k]; // Get dimensions of label
9712
9713 var dim = label.getBBox();
9714 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
9715 rect.setAttribute('rx', 0);
9716 rect.setAttribute('ry', 0);
9717 rect.setAttribute('width', dim.width);
9718 rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
9719
9720 label.insertBefore(rect, label.firstChild);
9721 }
9722 } // If node has a link, wrap it in an anchor SVG object.
9723
9724
9725 var keys = Object.keys(vert);
9726 keys.forEach(function (key) {
9727 var vertex = vert[key];
9728
9729 if (vertex.link) {
9730 var node = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#' + id + ' [id="' + key + '"]');
9731
9732 if (node) {
9733 var link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
9734 link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
9735 link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
9736 link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
9737
9738 if (vertex.linkTarget) {
9739 link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
9740 }
9741
9742 var linkNode = node.insert(function () {
9743 return link;
9744 }, ':first-child');
9745 var shape = node.select('.label-container');
9746
9747 if (shape) {
9748 linkNode.append(function () {
9749 return shape.node();
9750 });
9751 }
9752
9753 var _label = node.select('.label');
9754
9755 if (_label) {
9756 linkNode.append(function () {
9757 return _label.node();
9758 });
9759 }
9760 }
9761 }
9762 });
9763};
9764/* harmony default export */ __webpack_exports__["default"] = ({
9765 setConf: setConf,
9766 addVertices: addVertices,
9767 addEdges: addEdges,
9768 getClasses: getClasses,
9769 draw: draw
9770});
9771
9772/***/ }),
9773
9774/***/ "./src/diagrams/flowchart/flowRenderer.js":
9775/*!************************************************!*\
9776 !*** ./src/diagrams/flowchart/flowRenderer.js ***!
9777 \************************************************/
9778/*! exports provided: setConf, addVertices, addEdges, getClasses, draw, default */
9779/***/ (function(module, __webpack_exports__, __webpack_require__) {
9780
9781"use strict";
9782__webpack_require__.r(__webpack_exports__);
9783/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
9784/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addVertices", function() { return addVertices; });
9785/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addEdges", function() { return addEdges; });
9786/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClasses", function() { return getClasses; });
9787/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
9788/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
9789/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
9790/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
9791/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
9792/* harmony import */ var _flowDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./flowDb */ "./src/diagrams/flowchart/flowDb.js");
9793/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
9794/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_flow__WEBPACK_IMPORTED_MODULE_3__);
9795/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
9796/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! dagre-d3 */ "dagre-d3");
9797/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(dagre_d3__WEBPACK_IMPORTED_MODULE_5__);
9798/* 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");
9799/* 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__);
9800/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
9801/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
9802/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
9803/* harmony import */ var _flowChartShapes__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./flowChartShapes */ "./src/diagrams/flowchart/flowChartShapes.js");
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815var conf = {};
9816var setConf = function setConf(cnf) {
9817 var keys = Object.keys(cnf);
9818
9819 for (var i = 0; i < keys.length; i++) {
9820 conf[keys[i]] = cnf[keys[i]];
9821 }
9822};
9823/**
9824 * Function that adds the vertices found in the graph definition to the graph to be rendered.
9825 * @param vert Object containing the vertices.
9826 * @param g The graph that is to be drawn.
9827 */
9828
9829var addVertices = function addVertices(vert, g, svgId) {
9830 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(svgId, "\"]"));
9831 var keys = Object.keys(vert); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
9832
9833 keys.forEach(function (id) {
9834 var vertex = vert[id];
9835 /**
9836 * Variable for storing the classes for the vertex
9837 * @type {string}
9838 */
9839
9840 var classStr = 'default';
9841
9842 if (vertex.classes.length > 0) {
9843 classStr = vertex.classes.join(' ');
9844 }
9845
9846 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
9847
9848 var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
9849
9850 var vertexNode;
9851
9852 if (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels) {
9853 // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
9854 var node = {
9855 label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
9856 return "<i class='".concat(s.replace(':', ' '), "'></i>");
9857 })
9858 };
9859 vertexNode = dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_6___default()(svg, node).node();
9860 vertexNode.parentNode.removeChild(vertexNode);
9861 } else {
9862 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
9863 svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
9864 var rows = vertexText.split(_common_common__WEBPACK_IMPORTED_MODULE_8__["default"].lineBreakRegex);
9865
9866 for (var j = 0; j < rows.length; j++) {
9867 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
9868 tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
9869 tspan.setAttribute('dy', '1em');
9870 tspan.setAttribute('x', '1');
9871 tspan.textContent = rows[j];
9872 svgLabel.appendChild(tspan);
9873 }
9874
9875 vertexNode = svgLabel;
9876 }
9877
9878 var radious = 0;
9879 var _shape = ''; // Set the shape based parameters
9880
9881 switch (vertex.type) {
9882 case 'round':
9883 radious = 5;
9884 _shape = 'rect';
9885 break;
9886
9887 case 'square':
9888 _shape = 'rect';
9889 break;
9890
9891 case 'diamond':
9892 _shape = 'question';
9893 break;
9894
9895 case 'hexagon':
9896 _shape = 'hexagon';
9897 break;
9898
9899 case 'odd':
9900 _shape = 'rect_left_inv_arrow';
9901 break;
9902
9903 case 'lean_right':
9904 _shape = 'lean_right';
9905 break;
9906
9907 case 'lean_left':
9908 _shape = 'lean_left';
9909 break;
9910
9911 case 'trapezoid':
9912 _shape = 'trapezoid';
9913 break;
9914
9915 case 'inv_trapezoid':
9916 _shape = 'inv_trapezoid';
9917 break;
9918
9919 case 'odd_right':
9920 _shape = 'rect_left_inv_arrow';
9921 break;
9922
9923 case 'circle':
9924 _shape = 'circle';
9925 break;
9926
9927 case 'ellipse':
9928 _shape = 'ellipse';
9929 break;
9930
9931 case 'stadium':
9932 _shape = 'stadium';
9933 break;
9934
9935 case 'subroutine':
9936 _shape = 'subroutine';
9937 break;
9938
9939 case 'cylinder':
9940 _shape = 'cylinder';
9941 break;
9942
9943 case 'group':
9944 _shape = 'rect';
9945 break;
9946
9947 default:
9948 _shape = 'rect';
9949 } // Add the node
9950
9951
9952 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].warn('Adding node', vertex.id, vertex.domId);
9953 g.setNode(_flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(vertex.id), {
9954 labelType: 'svg',
9955 labelStyle: styles.labelStyle,
9956 shape: _shape,
9957 label: vertexNode,
9958 rx: radious,
9959 ry: radious,
9960 class: classStr,
9961 style: styles.style,
9962 id: _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(vertex.id)
9963 });
9964 });
9965};
9966/**
9967 * Add edges to graph based on parsed graph defninition
9968 * @param {Object} edges The edges to add to the graph
9969 * @param {Object} g The graph object
9970 */
9971
9972var addEdges = function addEdges(edges, g) {
9973 var cnt = 0;
9974 var defaultStyle;
9975 var defaultLabelStyle;
9976
9977 if (typeof edges.defaultStyle !== 'undefined') {
9978 var defaultStyles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(edges.defaultStyle);
9979 defaultStyle = defaultStyles.style;
9980 defaultLabelStyle = defaultStyles.labelStyle;
9981 }
9982
9983 edges.forEach(function (edge) {
9984 cnt++; // Identify Link
9985
9986 var linkId = 'L-' + edge.start + '-' + edge.end;
9987 var linkNameStart = 'LS-' + edge.start;
9988 var linkNameEnd = 'LE-' + edge.end;
9989 var edgeData = {}; // Set link type for rendering
9990
9991 if (edge.type === 'arrow_open') {
9992 edgeData.arrowhead = 'none';
9993 } else {
9994 edgeData.arrowhead = 'normal';
9995 }
9996
9997 var style = '';
9998 var labelStyle = '';
9999
10000 if (typeof edge.style !== 'undefined') {
10001 var styles = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getStylesFromArray"])(edge.style);
10002 style = styles.style;
10003 labelStyle = styles.labelStyle;
10004 } else {
10005 switch (edge.stroke) {
10006 case 'normal':
10007 style = 'fill:none';
10008
10009 if (typeof defaultStyle !== 'undefined') {
10010 style = defaultStyle;
10011 }
10012
10013 if (typeof defaultLabelStyle !== 'undefined') {
10014 labelStyle = defaultLabelStyle;
10015 }
10016
10017 break;
10018
10019 case 'dotted':
10020 style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';
10021 break;
10022
10023 case 'thick':
10024 style = ' stroke-width: 3.5px;fill:none';
10025 break;
10026 }
10027 }
10028
10029 edgeData.style = style;
10030 edgeData.labelStyle = labelStyle;
10031
10032 if (typeof edge.interpolate !== 'undefined') {
10033 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
10034 } else if (typeof edges.defaultInterpolate !== 'undefined') {
10035 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
10036 } else {
10037 edgeData.curve = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["interpolateToCurve"])(conf.curve, d3__WEBPACK_IMPORTED_MODULE_1__["curveLinear"]);
10038 }
10039
10040 if (typeof edge.text === 'undefined') {
10041 if (typeof edge.style !== 'undefined') {
10042 edgeData.arrowheadStyle = 'fill: #333';
10043 }
10044 } else {
10045 edgeData.arrowheadStyle = 'fill: #333';
10046 edgeData.labelpos = 'c';
10047
10048 if (Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart.htmlLabels) {
10049 edgeData.labelType = 'html';
10050 edgeData.label = "<span id=\"L-".concat(linkId, "\" class=\"edgeLabel L-").concat(linkNameStart, "' L-").concat(linkNameEnd, "\">").concat(edge.text.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
10051 return "<i class='".concat(s.replace(':', ' '), "'></i>");
10052 }), "</span>");
10053 } else {
10054 edgeData.labelType = 'text';
10055 edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_8__["default"].lineBreakRegex, '\n');
10056
10057 if (typeof edge.style === 'undefined') {
10058 edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
10059 }
10060
10061 edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
10062 }
10063 }
10064
10065 edgeData.id = linkId;
10066 edgeData.class = linkNameStart + ' ' + linkNameEnd;
10067 edgeData.minlen = edge.length || 1; // Add the edge to the graph
10068
10069 g.setEdge(_flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(edge.start), _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(edge.end), edgeData, cnt);
10070 });
10071};
10072/**
10073 * Returns the all the styles from classDef statements in the graph definition.
10074 * @returns {object} classDef styles
10075 */
10076
10077var getClasses = function getClasses(text) {
10078 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Extracting classes');
10079 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
10080
10081 try {
10082 var parser = _parser_flow__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
10083 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the graph definition
10084
10085 parser.parse(text);
10086 return _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getClasses();
10087 } catch (e) {
10088 return;
10089 }
10090};
10091/**
10092 * Draws a flowchart in the tag with id: id based on the graph definition in text.
10093 * @param text
10094 * @param id
10095 */
10096
10097var draw = function draw(text, id) {
10098 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].info('Drawing flowchart');
10099 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
10100 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].setGen('gen-1');
10101 var parser = _parser_flow__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
10102 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the graph definition
10103 // try {
10104
10105 parser.parse(text); // } catch (err) {
10106 // logger.debug('Parsing failed');
10107 // }
10108 // Fetch the default direction, use TD if none was found
10109
10110 var dir = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getDirection();
10111
10112 if (typeof dir === 'undefined') {
10113 dir = 'TD';
10114 }
10115
10116 var conf = Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().flowchart;
10117 var nodeSpacing = conf.nodeSpacing || 50;
10118 var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
10119
10120 var g = new graphlib__WEBPACK_IMPORTED_MODULE_0___default.a.Graph({
10121 multigraph: true,
10122 compound: true
10123 }).setGraph({
10124 rankdir: dir,
10125 nodesep: nodeSpacing,
10126 ranksep: rankSpacing,
10127 marginx: 8,
10128 marginy: 8
10129 }).setDefaultEdgeLabel(function () {
10130 return {};
10131 });
10132 var subG;
10133 var subGraphs = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getSubGraphs();
10134
10135 for (var _i = subGraphs.length - 1; _i >= 0; _i--) {
10136 subG = subGraphs[_i];
10137 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
10138 } // Fetch the verices/nodes and edges/links from the parsed graph definition
10139
10140
10141 var vert = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getVertices();
10142 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].warn('Get vertices', vert);
10143 var edges = _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getEdges();
10144 var i = 0;
10145
10146 for (i = subGraphs.length - 1; i >= 0; i--) {
10147 subG = subGraphs[i];
10148 Object(d3__WEBPACK_IMPORTED_MODULE_1__["selectAll"])('cluster').append('text');
10149
10150 for (var j = 0; j < subG.nodes.length; j++) {
10151 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].warn('Setting subgraph', subG.nodes[j], _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(subG.nodes[j]), _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(subG.id));
10152 g.setParent(_flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(subG.nodes[j]), _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(subG.id));
10153 }
10154 }
10155
10156 addVertices(vert, g, id);
10157 addEdges(edges, g); // Create the renderer
10158
10159 var Render = dagre_d3__WEBPACK_IMPORTED_MODULE_5___default.a.render;
10160 var render = new Render(); // Add custom shapes
10161
10162 _flowChartShapes__WEBPACK_IMPORTED_MODULE_10__["default"].addToRender(render); // Add our custom arrow - an empty arrowhead
10163
10164 render.arrows().none = function normal(parent, id, edge, type) {
10165 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');
10166 var path = marker.append('path').attr('d', 'M 0 0 L 0 0 L 0 0 z');
10167 dagre_d3__WEBPACK_IMPORTED_MODULE_5___default.a.util.applyStyle(path, edge[type + 'Style']);
10168 }; // Override normal arrowhead defined in d3. Remove style & add class to allow css styling.
10169
10170
10171 render.arrows().normal = function normal(parent, id) {
10172 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');
10173 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');
10174 }; // Set up an SVG group so that we can translate the final graph.
10175
10176
10177 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(id, "\"]"));
10178 svg.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink');
10179 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].warn(g); // Run the renderer. This is what draws the final graph.
10180
10181 var element = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#' + id + ' g');
10182 render(element, g);
10183 element.selectAll('g.node').attr('title', function () {
10184 return _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].getTooltip(this.id);
10185 });
10186 var padding = conf.diagramPadding;
10187 var svgBounds = svg.node().getBBox();
10188 var width = svgBounds.width + padding * 2;
10189 var height = svgBounds.height + padding * 2;
10190 Object(_utils__WEBPACK_IMPORTED_MODULE_9__["configureSvgSize"])(svg, height, width, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
10191
10192 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
10193 _logger__WEBPACK_IMPORTED_MODULE_7__["logger"].debug("viewBox ".concat(vBox));
10194 svg.attr('viewBox', vBox); // Index nodes
10195
10196 _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].indexNodes('subGraph' + i); // reposition labels
10197
10198 for (i = 0; i < subGraphs.length; i++) {
10199 subG = subGraphs[i];
10200
10201 if (subG.title !== 'undefined') {
10202 var clusterRects = document.querySelectorAll('#' + id + ' [id="' + _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(subG.id) + '"] rect');
10203 var clusterEl = document.querySelectorAll('#' + id + ' [id="' + _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(subG.id) + '"]');
10204 var xPos = clusterRects[0].x.baseVal.value;
10205 var yPos = clusterRects[0].y.baseVal.value;
10206 var _width = clusterRects[0].width.baseVal.value;
10207 var cluster = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])(clusterEl[0]);
10208 var te = cluster.select('.label');
10209 te.attr('transform', "translate(".concat(xPos + _width / 2, ", ").concat(yPos + 14, ")"));
10210 te.attr('id', id + 'Text');
10211
10212 for (var _j = 0; _j < subG.classes.length; _j++) {
10213 clusterEl[0].classList.add(subG.classes[_j]);
10214 }
10215 }
10216 } // Add label rects for non html labels
10217
10218
10219 if (!conf.htmlLabels || true) {
10220 // eslint-disable-line
10221 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
10222
10223 for (var k = 0; k < labels.length; k++) {
10224 var label = labels[k]; // Get dimensions of label
10225
10226 var dim = label.getBBox();
10227 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
10228 rect.setAttribute('rx', 0);
10229 rect.setAttribute('ry', 0);
10230 rect.setAttribute('width', dim.width);
10231 rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
10232
10233 label.insertBefore(rect, label.firstChild);
10234 }
10235 } // If node has a link, wrap it in an anchor SVG object.
10236
10237
10238 var keys = Object.keys(vert);
10239 keys.forEach(function (key) {
10240 var vertex = vert[key];
10241
10242 if (vertex.link) {
10243 var node = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#' + id + ' [id="' + _flowDb__WEBPACK_IMPORTED_MODULE_2__["default"].lookUpDomId(key) + '"]');
10244
10245 if (node) {
10246 var link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
10247 link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
10248 link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
10249 link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
10250
10251 if (vertex.linkTarget) {
10252 link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
10253 }
10254
10255 var linkNode = node.insert(function () {
10256 return link;
10257 }, ':first-child');
10258 var shape = node.select('.label-container');
10259
10260 if (shape) {
10261 linkNode.append(function () {
10262 return shape.node();
10263 });
10264 }
10265
10266 var _label = node.select('.label');
10267
10268 if (_label) {
10269 linkNode.append(function () {
10270 return _label.node();
10271 });
10272 }
10273 }
10274 }
10275 });
10276};
10277/* harmony default export */ __webpack_exports__["default"] = ({
10278 setConf: setConf,
10279 addVertices: addVertices,
10280 addEdges: addEdges,
10281 getClasses: getClasses,
10282 draw: draw
10283});
10284
10285/***/ }),
10286
10287/***/ "./src/diagrams/flowchart/parser/flow.jison":
10288/*!**************************************************!*\
10289 !*** ./src/diagrams/flowchart/parser/flow.jison ***!
10290 \**************************************************/
10291/*! no static exports found */
10292/***/ (function(module, exports, __webpack_require__) {
10293
10294/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
10295/*
10296 Returns a Parser object of the following structure:
10297
10298 Parser: {
10299 yy: {}
10300 }
10301
10302 Parser.prototype: {
10303 yy: {},
10304 trace: function(),
10305 symbols_: {associative list: name ==> number},
10306 terminals_: {associative list: number ==> name},
10307 productions_: [...],
10308 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
10309 table: [...],
10310 defaultActions: {...},
10311 parseError: function(str, hash),
10312 parse: function(input),
10313
10314 lexer: {
10315 EOF: 1,
10316 parseError: function(str, hash),
10317 setInput: function(input),
10318 input: function(),
10319 unput: function(str),
10320 more: function(),
10321 less: function(n),
10322 pastInput: function(),
10323 upcomingInput: function(),
10324 showPosition: function(),
10325 test_match: function(regex_match_array, rule_index),
10326 next: function(),
10327 lex: function(),
10328 begin: function(condition),
10329 popState: function(),
10330 _currentRules: function(),
10331 topState: function(),
10332 pushState: function(condition),
10333
10334 options: {
10335 ranges: boolean (optional: true ==> token location info will include a .range[] member)
10336 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
10337 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)
10338 },
10339
10340 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
10341 rules: [...],
10342 conditions: {associative list: name ==> set},
10343 }
10344 }
10345
10346
10347 token location info (@$, _$, etc.): {
10348 first_line: n,
10349 last_line: n,
10350 first_column: n,
10351 last_column: n,
10352 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
10353 }
10354
10355
10356 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
10357 text: (matched text)
10358 token: (the produced terminal token, if any)
10359 line: (yylineno)
10360 }
10361 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
10362 loc: (yylloc)
10363 expected: (string describing the set of expected tokens)
10364 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
10365 }
10366*/
10367var parser = (function(){
10368var 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];
10369var parser = {trace: function trace () { },
10370yy: {},
10371symbols_: {"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},
10372terminals_: {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"},
10373productions_: [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]],
10374performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
10375/* this == yyval */
10376
10377var $0 = $$.length - 1;
10378switch (yystate) {
10379case 5:
10380 yy.parseDirective('%%{', 'open_directive');
10381break;
10382case 6:
10383 yy.parseDirective($$[$0], 'type_directive');
10384break;
10385case 7:
10386 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
10387break;
10388case 8:
10389 yy.parseDirective('}%%', 'close_directive', 'flowchart');
10390break;
10391case 10:
10392 this.$ = [];
10393break;
10394case 11:
10395
10396 if($$[$0] !== []){
10397 $$[$0-1].push($$[$0]);
10398 }
10399 this.$=$$[$0-1];
10400break;
10401case 12: case 76: case 78: case 90: case 138: case 140: case 141:
10402this.$=$$[$0];
10403break;
10404case 19:
10405 yy.setDirection('TB');this.$ = 'TB';
10406break;
10407case 20:
10408 yy.setDirection($$[$0-1]);this.$ = $$[$0-1];
10409break;
10410case 35:
10411 /* console.warn('finat vs', $$[$0-1].nodes); */ this.$=$$[$0-1].nodes
10412break;
10413case 36: case 37: case 38: case 39: case 40:
10414this.$=[];
10415break;
10416case 41:
10417this.$=yy.addSubGraph($$[$0-6],$$[$0-1],$$[$0-4]);
10418break;
10419case 42:
10420this.$=yy.addSubGraph($$[$0-3],$$[$0-1],$$[$0-3]);
10421break;
10422case 43:
10423this.$=yy.addSubGraph(undefined,$$[$0-1],undefined);
10424break;
10425case 47:
10426 /* console.warn('vs',$$[$0-2].stmt,$$[$0]); */ yy.addLink($$[$0-2].stmt,$$[$0],$$[$0-1]); this.$ = { stmt: $$[$0], nodes: $$[$0].concat($$[$0-2].nodes) }
10427break;
10428case 48:
10429 /* 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) }
10430break;
10431case 49:
10432/*console.warn('noda', $$[$0-1]);*/ this.$ = {stmt: $$[$0-1], nodes:$$[$0-1] }
10433break;
10434case 50:
10435 /*console.warn('noda', $$[$0]);*/ this.$ = {stmt: $$[$0], nodes:$$[$0] }
10436break;
10437case 51:
10438 /* console.warn('nod', $$[$0]); */ this.$ = [$$[$0]];
10439break;
10440case 52:
10441 this.$ = $$[$0-4].concat($$[$0]); /* console.warn('pip', $$[$0-4][0], $$[$0], this.$); */
10442break;
10443case 53:
10444this.$ = [$$[$0-2]];yy.setClass($$[$0-2],$$[$0])
10445break;
10446case 54:
10447this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'square');
10448break;
10449case 55:
10450this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'circle');
10451break;
10452case 56:
10453this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'ellipse');
10454break;
10455case 57:
10456this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'stadium');
10457break;
10458case 58:
10459this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'subroutine');
10460break;
10461case 59:
10462this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'cylinder');
10463break;
10464case 60:
10465this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'round');
10466break;
10467case 61:
10468this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'diamond');
10469break;
10470case 62:
10471this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'hexagon');
10472break;
10473case 63:
10474this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'odd');
10475break;
10476case 64:
10477this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'trapezoid');
10478break;
10479case 65:
10480this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'inv_trapezoid');
10481break;
10482case 66:
10483this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_right');
10484break;
10485case 67:
10486this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_left');
10487break;
10488case 68:
10489 /*console.warn('h: ', $$[$0]);*/this.$ = $$[$0];yy.addVertex($$[$0]);
10490break;
10491case 69:
10492$$[$0-1].text = $$[$0];this.$ = $$[$0-1];
10493break;
10494case 70: case 71:
10495$$[$0-2].text = $$[$0-1];this.$ = $$[$0-2];
10496break;
10497case 72:
10498this.$ = $$[$0];
10499break;
10500case 73:
10501var inf = yy.destructLink($$[$0], $$[$0-2]); this.$ = {"type":inf.type,"stroke":inf.stroke,"length":inf.length,"text":$$[$0-1]};
10502break;
10503case 74:
10504var inf = yy.destructLink($$[$0]);this.$ = {"type":inf.type,"stroke":inf.stroke,"length":inf.length};
10505break;
10506case 75:
10507this.$ = $$[$0-1];
10508break;
10509case 77: case 91: case 139:
10510this.$=$$[$0-1]+''+$$[$0];
10511break;
10512case 92: case 93:
10513this.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]);
10514break;
10515case 94:
10516this.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]);
10517break;
10518case 95:
10519this.$ = $$[$0-4];yy.setClickEvent($$[$0-2], $$[$0], undefined);
10520break;
10521case 96:
10522this.$ = $$[$0-6];yy.setClickEvent($$[$0-4], $$[$0-2], $$[$0]) ;
10523break;
10524case 97:
10525this.$ = $$[$0-4];yy.setLink($$[$0-2], $$[$0], undefined, undefined);
10526break;
10527case 98:
10528this.$ = $$[$0-6];yy.setLink($$[$0-4], $$[$0-2], $$[$0], undefined );
10529break;
10530case 99:
10531this.$ = $$[$0-6];yy.setLink($$[$0-4], $$[$0-2], undefined, $$[$0] );
10532break;
10533case 100:
10534this.$ = $$[$0-8];yy.setLink($$[$0-6], $$[$0-4], $$[$0-2], $$[$0] );
10535break;
10536case 101:
10537this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]);
10538break;
10539case 102: case 104:
10540this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]);
10541break;
10542case 103:
10543this.$ = $$[$0-4];yy.updateLink([$$[$0-2]],$$[$0]);
10544break;
10545case 105:
10546this.$ = $$[$0-8];yy.updateLinkInterpolate([$$[$0-6]],$$[$0-2]);yy.updateLink([$$[$0-6]],$$[$0]);
10547break;
10548case 106:
10549this.$ = $$[$0-8];yy.updateLinkInterpolate($$[$0-6],$$[$0-2]);yy.updateLink($$[$0-6],$$[$0]);
10550break;
10551case 107:
10552this.$ = $$[$0-6];yy.updateLinkInterpolate([$$[$0-4]],$$[$0]);
10553break;
10554case 108:
10555this.$ = $$[$0-6];yy.updateLinkInterpolate($$[$0-4],$$[$0]);
10556break;
10557case 109: case 111:
10558this.$ = [$$[$0]]
10559break;
10560case 110: case 112:
10561$$[$0-2].push($$[$0]);this.$ = $$[$0-2];
10562break;
10563case 114:
10564this.$ = $$[$0-1] + $$[$0];
10565break;
10566case 136:
10567this.$=$$[$0]
10568break;
10569case 137:
10570this.$=$$[$0-1]+''+$$[$0]
10571break;
10572case 142:
10573this.$='v';
10574break;
10575case 143:
10576this.$='-';
10577break;
10578}
10579},
10580table: [{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])],
10581defaultActions: {2:[2,1],9:[2,5],10:[2,2],98:[2,7]},
10582parseError: function parseError (str, hash) {
10583 if (hash.recoverable) {
10584 this.trace(str);
10585 } else {
10586 var error = new Error(str);
10587 error.hash = hash;
10588 throw error;
10589 }
10590},
10591parse: function parse(input) {
10592 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
10593 var args = lstack.slice.call(arguments, 1);
10594 var lexer = Object.create(this.lexer);
10595 var sharedState = { yy: {} };
10596 for (var k in this.yy) {
10597 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
10598 sharedState.yy[k] = this.yy[k];
10599 }
10600 }
10601 lexer.setInput(input, sharedState.yy);
10602 sharedState.yy.lexer = lexer;
10603 sharedState.yy.parser = this;
10604 if (typeof lexer.yylloc == 'undefined') {
10605 lexer.yylloc = {};
10606 }
10607 var yyloc = lexer.yylloc;
10608 lstack.push(yyloc);
10609 var ranges = lexer.options && lexer.options.ranges;
10610 if (typeof sharedState.yy.parseError === 'function') {
10611 this.parseError = sharedState.yy.parseError;
10612 } else {
10613 this.parseError = Object.getPrototypeOf(this).parseError;
10614 }
10615 function popStack(n) {
10616 stack.length = stack.length - 2 * n;
10617 vstack.length = vstack.length - n;
10618 lstack.length = lstack.length - n;
10619 }
10620 function lex() {
10621 var token;
10622 token = tstack.pop() || lexer.lex() || EOF;
10623 if (typeof token !== 'number') {
10624 if (token instanceof Array) {
10625 tstack = token;
10626 token = tstack.pop();
10627 }
10628 token = self.symbols_[token] || token;
10629 }
10630 return token;
10631 }
10632 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
10633 while (true) {
10634 state = stack[stack.length - 1];
10635 if (this.defaultActions[state]) {
10636 action = this.defaultActions[state];
10637 } else {
10638 if (symbol === null || typeof symbol == 'undefined') {
10639 symbol = lex();
10640 }
10641 action = table[state] && table[state][symbol];
10642 }
10643 if (typeof action === 'undefined' || !action.length || !action[0]) {
10644 var errStr = '';
10645 expected = [];
10646 for (p in table[state]) {
10647 if (this.terminals_[p] && p > TERROR) {
10648 expected.push('\'' + this.terminals_[p] + '\'');
10649 }
10650 }
10651 if (lexer.showPosition) {
10652 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
10653 } else {
10654 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
10655 }
10656 this.parseError(errStr, {
10657 text: lexer.match,
10658 token: this.terminals_[symbol] || symbol,
10659 line: lexer.yylineno,
10660 loc: yyloc,
10661 expected: expected
10662 });
10663 }
10664 if (action[0] instanceof Array && action.length > 1) {
10665 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
10666 }
10667 switch (action[0]) {
10668 case 1:
10669 stack.push(symbol);
10670 vstack.push(lexer.yytext);
10671 lstack.push(lexer.yylloc);
10672 stack.push(action[1]);
10673 symbol = null;
10674 if (!preErrorSymbol) {
10675 yyleng = lexer.yyleng;
10676 yytext = lexer.yytext;
10677 yylineno = lexer.yylineno;
10678 yyloc = lexer.yylloc;
10679 if (recovering > 0) {
10680 recovering--;
10681 }
10682 } else {
10683 symbol = preErrorSymbol;
10684 preErrorSymbol = null;
10685 }
10686 break;
10687 case 2:
10688 len = this.productions_[action[1]][1];
10689 yyval.$ = vstack[vstack.length - len];
10690 yyval._$ = {
10691 first_line: lstack[lstack.length - (len || 1)].first_line,
10692 last_line: lstack[lstack.length - 1].last_line,
10693 first_column: lstack[lstack.length - (len || 1)].first_column,
10694 last_column: lstack[lstack.length - 1].last_column
10695 };
10696 if (ranges) {
10697 yyval._$.range = [
10698 lstack[lstack.length - (len || 1)].range[0],
10699 lstack[lstack.length - 1].range[1]
10700 ];
10701 }
10702 r = this.performAction.apply(yyval, [
10703 yytext,
10704 yyleng,
10705 yylineno,
10706 sharedState.yy,
10707 action[1],
10708 vstack,
10709 lstack
10710 ].concat(args));
10711 if (typeof r !== 'undefined') {
10712 return r;
10713 }
10714 if (len) {
10715 stack = stack.slice(0, -1 * len * 2);
10716 vstack = vstack.slice(0, -1 * len);
10717 lstack = lstack.slice(0, -1 * len);
10718 }
10719 stack.push(this.productions_[action[1]][0]);
10720 vstack.push(yyval.$);
10721 lstack.push(yyval._$);
10722 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
10723 stack.push(newState);
10724 break;
10725 case 3:
10726 return true;
10727 }
10728 }
10729 return true;
10730}};
10731
10732/* generated by jison-lex 0.3.4 */
10733var lexer = (function(){
10734var lexer = ({
10735
10736EOF:1,
10737
10738parseError:function parseError(str, hash) {
10739 if (this.yy.parser) {
10740 this.yy.parser.parseError(str, hash);
10741 } else {
10742 throw new Error(str);
10743 }
10744 },
10745
10746// resets the lexer, sets new input
10747setInput:function (input, yy) {
10748 this.yy = yy || this.yy || {};
10749 this._input = input;
10750 this._more = this._backtrack = this.done = false;
10751 this.yylineno = this.yyleng = 0;
10752 this.yytext = this.matched = this.match = '';
10753 this.conditionStack = ['INITIAL'];
10754 this.yylloc = {
10755 first_line: 1,
10756 first_column: 0,
10757 last_line: 1,
10758 last_column: 0
10759 };
10760 if (this.options.ranges) {
10761 this.yylloc.range = [0,0];
10762 }
10763 this.offset = 0;
10764 return this;
10765 },
10766
10767// consumes and returns one char from the input
10768input:function () {
10769 var ch = this._input[0];
10770 this.yytext += ch;
10771 this.yyleng++;
10772 this.offset++;
10773 this.match += ch;
10774 this.matched += ch;
10775 var lines = ch.match(/(?:\r\n?|\n).*/g);
10776 if (lines) {
10777 this.yylineno++;
10778 this.yylloc.last_line++;
10779 } else {
10780 this.yylloc.last_column++;
10781 }
10782 if (this.options.ranges) {
10783 this.yylloc.range[1]++;
10784 }
10785
10786 this._input = this._input.slice(1);
10787 return ch;
10788 },
10789
10790// unshifts one char (or a string) into the input
10791unput:function (ch) {
10792 var len = ch.length;
10793 var lines = ch.split(/(?:\r\n?|\n)/g);
10794
10795 this._input = ch + this._input;
10796 this.yytext = this.yytext.substr(0, this.yytext.length - len);
10797 //this.yyleng -= len;
10798 this.offset -= len;
10799 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
10800 this.match = this.match.substr(0, this.match.length - 1);
10801 this.matched = this.matched.substr(0, this.matched.length - 1);
10802
10803 if (lines.length - 1) {
10804 this.yylineno -= lines.length - 1;
10805 }
10806 var r = this.yylloc.range;
10807
10808 this.yylloc = {
10809 first_line: this.yylloc.first_line,
10810 last_line: this.yylineno + 1,
10811 first_column: this.yylloc.first_column,
10812 last_column: lines ?
10813 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
10814 + oldLines[oldLines.length - lines.length].length - lines[0].length :
10815 this.yylloc.first_column - len
10816 };
10817
10818 if (this.options.ranges) {
10819 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
10820 }
10821 this.yyleng = this.yytext.length;
10822 return this;
10823 },
10824
10825// When called from action, caches matched text and appends it on next action
10826more:function () {
10827 this._more = true;
10828 return this;
10829 },
10830
10831// 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.
10832reject:function () {
10833 if (this.options.backtrack_lexer) {
10834 this._backtrack = true;
10835 } else {
10836 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(), {
10837 text: "",
10838 token: null,
10839 line: this.yylineno
10840 });
10841
10842 }
10843 return this;
10844 },
10845
10846// retain first n characters of the match
10847less:function (n) {
10848 this.unput(this.match.slice(n));
10849 },
10850
10851// displays already matched input, i.e. for error messages
10852pastInput:function () {
10853 var past = this.matched.substr(0, this.matched.length - this.match.length);
10854 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
10855 },
10856
10857// displays upcoming input, i.e. for error messages
10858upcomingInput:function () {
10859 var next = this.match;
10860 if (next.length < 20) {
10861 next += this._input.substr(0, 20-next.length);
10862 }
10863 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
10864 },
10865
10866// displays the character position where the lexing error occurred, i.e. for error messages
10867showPosition:function () {
10868 var pre = this.pastInput();
10869 var c = new Array(pre.length + 1).join("-");
10870 return pre + this.upcomingInput() + "\n" + c + "^";
10871 },
10872
10873// test the lexed token: return FALSE when not a match, otherwise return token
10874test_match:function(match, indexed_rule) {
10875 var token,
10876 lines,
10877 backup;
10878
10879 if (this.options.backtrack_lexer) {
10880 // save context
10881 backup = {
10882 yylineno: this.yylineno,
10883 yylloc: {
10884 first_line: this.yylloc.first_line,
10885 last_line: this.last_line,
10886 first_column: this.yylloc.first_column,
10887 last_column: this.yylloc.last_column
10888 },
10889 yytext: this.yytext,
10890 match: this.match,
10891 matches: this.matches,
10892 matched: this.matched,
10893 yyleng: this.yyleng,
10894 offset: this.offset,
10895 _more: this._more,
10896 _input: this._input,
10897 yy: this.yy,
10898 conditionStack: this.conditionStack.slice(0),
10899 done: this.done
10900 };
10901 if (this.options.ranges) {
10902 backup.yylloc.range = this.yylloc.range.slice(0);
10903 }
10904 }
10905
10906 lines = match[0].match(/(?:\r\n?|\n).*/g);
10907 if (lines) {
10908 this.yylineno += lines.length;
10909 }
10910 this.yylloc = {
10911 first_line: this.yylloc.last_line,
10912 last_line: this.yylineno + 1,
10913 first_column: this.yylloc.last_column,
10914 last_column: lines ?
10915 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
10916 this.yylloc.last_column + match[0].length
10917 };
10918 this.yytext += match[0];
10919 this.match += match[0];
10920 this.matches = match;
10921 this.yyleng = this.yytext.length;
10922 if (this.options.ranges) {
10923 this.yylloc.range = [this.offset, this.offset += this.yyleng];
10924 }
10925 this._more = false;
10926 this._backtrack = false;
10927 this._input = this._input.slice(match[0].length);
10928 this.matched += match[0];
10929 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
10930 if (this.done && this._input) {
10931 this.done = false;
10932 }
10933 if (token) {
10934 return token;
10935 } else if (this._backtrack) {
10936 // recover context
10937 for (var k in backup) {
10938 this[k] = backup[k];
10939 }
10940 return false; // rule action called reject() implying the next rule should be tested instead.
10941 }
10942 return false;
10943 },
10944
10945// return next match in input
10946next:function () {
10947 if (this.done) {
10948 return this.EOF;
10949 }
10950 if (!this._input) {
10951 this.done = true;
10952 }
10953
10954 var token,
10955 match,
10956 tempMatch,
10957 index;
10958 if (!this._more) {
10959 this.yytext = '';
10960 this.match = '';
10961 }
10962 var rules = this._currentRules();
10963 for (var i = 0; i < rules.length; i++) {
10964 tempMatch = this._input.match(this.rules[rules[i]]);
10965 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
10966 match = tempMatch;
10967 index = i;
10968 if (this.options.backtrack_lexer) {
10969 token = this.test_match(tempMatch, rules[i]);
10970 if (token !== false) {
10971 return token;
10972 } else if (this._backtrack) {
10973 match = false;
10974 continue; // rule action called reject() implying a rule MISmatch.
10975 } else {
10976 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
10977 return false;
10978 }
10979 } else if (!this.options.flex) {
10980 break;
10981 }
10982 }
10983 }
10984 if (match) {
10985 token = this.test_match(match, rules[index]);
10986 if (token !== false) {
10987 return token;
10988 }
10989 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
10990 return false;
10991 }
10992 if (this._input === "") {
10993 return this.EOF;
10994 } else {
10995 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
10996 text: "",
10997 token: null,
10998 line: this.yylineno
10999 });
11000 }
11001 },
11002
11003// return next match that has a token
11004lex:function lex () {
11005 var r = this.next();
11006 if (r) {
11007 return r;
11008 } else {
11009 return this.lex();
11010 }
11011 },
11012
11013// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
11014begin:function begin (condition) {
11015 this.conditionStack.push(condition);
11016 },
11017
11018// pop the previously active lexer condition state off the condition stack
11019popState:function popState () {
11020 var n = this.conditionStack.length - 1;
11021 if (n > 0) {
11022 return this.conditionStack.pop();
11023 } else {
11024 return this.conditionStack[0];
11025 }
11026 },
11027
11028// produce the lexer rule set which is active for the currently active lexer condition state
11029_currentRules:function _currentRules () {
11030 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
11031 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
11032 } else {
11033 return this.conditions["INITIAL"].rules;
11034 }
11035 },
11036
11037// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
11038topState:function topState (n) {
11039 n = this.conditionStack.length - 1 - Math.abs(n || 0);
11040 if (n >= 0) {
11041 return this.conditionStack[n];
11042 } else {
11043 return "INITIAL";
11044 }
11045 },
11046
11047// alias for begin(condition)
11048pushState:function pushState (condition) {
11049 this.begin(condition);
11050 },
11051
11052// return the number of states currently on the stack
11053stateStackSize:function stateStackSize() {
11054 return this.conditionStack.length;
11055 },
11056options: {},
11057performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
11058var YYSTATE=YY_START;
11059switch($avoiding_name_collisions) {
11060case 0: this.begin('open_directive'); return 12;
11061break;
11062case 1: this.begin('type_directive'); return 13;
11063break;
11064case 2: this.popState(); this.begin('arg_directive'); return 10;
11065break;
11066case 3: this.popState(); this.popState(); return 15;
11067break;
11068case 4:return 14;
11069break;
11070case 5:/* skip comments */
11071break;
11072case 6:/* skip comments */
11073break;
11074case 7:this.begin("string");
11075break;
11076case 8:this.popState();
11077break;
11078case 9:return "STR";
11079break;
11080case 10:return 75;
11081break;
11082case 11:return 84;
11083break;
11084case 12:return 76;
11085break;
11086case 13:return 90;
11087break;
11088case 14:return 77;
11089break;
11090case 15:return 78;
11091break;
11092case 16:return 79;
11093break;
11094case 17:if(yy.lex.firstGraph()){this.begin("dir");} return 24;
11095break;
11096case 18:if(yy.lex.firstGraph()){this.begin("dir");} return 24;
11097break;
11098case 19:return 38;
11099break;
11100case 20:return 42;
11101break;
11102case 21:return 87;
11103break;
11104case 22:return 87;
11105break;
11106case 23:return 87;
11107break;
11108case 24:return 87;
11109break;
11110case 25: this.popState(); return 25;
11111break;
11112case 26: this.popState(); return 26;
11113break;
11114case 27: this.popState(); return 26;
11115break;
11116case 28: this.popState(); return 26;
11117break;
11118case 29: this.popState(); return 26;
11119break;
11120case 30: this.popState(); return 26;
11121break;
11122case 31: this.popState(); return 26;
11123break;
11124case 32: this.popState(); return 26;
11125break;
11126case 33: this.popState(); return 26;
11127break;
11128case 34: this.popState(); return 26;
11129break;
11130case 35: this.popState(); return 26;
11131break;
11132case 36: return 91;
11133break;
11134case 37:return 99;
11135break;
11136case 38:return 47;
11137break;
11138case 39:return 96;
11139break;
11140case 40:return 46;
11141break;
11142case 41:return 20;
11143break;
11144case 42:return 92;
11145break;
11146case 43:return 110;
11147break;
11148case 44:return 70;
11149break;
11150case 45:return 70;
11151break;
11152case 46:return 70;
11153break;
11154case 47:return 69;
11155break;
11156case 48:return 69;
11157break;
11158case 49:return 69;
11159break;
11160case 50:return 51;
11161break;
11162case 51:return 52;
11163break;
11164case 52:return 53;
11165break;
11166case 53:return 54;
11167break;
11168case 54:return 55;
11169break;
11170case 55:return 56;
11171break;
11172case 56:return 57;
11173break;
11174case 57:return 58;
11175break;
11176case 58:return 97;
11177break;
11178case 59:return 100;
11179break;
11180case 60:return 111;
11181break;
11182case 61:return 108;
11183break;
11184case 62:return 101;
11185break;
11186case 63:return 109;
11187break;
11188case 64:return 109;
11189break;
11190case 65:return 102;
11191break;
11192case 66:return 61;
11193break;
11194case 67:return 81;
11195break;
11196case 68:return 'SEP';
11197break;
11198case 69:return 80;
11199break;
11200case 70:return 95;
11201break;
11202case 71:return 63;
11203break;
11204case 72:return 62;
11205break;
11206case 73:return 65;
11207break;
11208case 74:return 64;
11209break;
11210case 75:return 106;
11211break;
11212case 76:return 107;
11213break;
11214case 77:return 71;
11215break;
11216case 78:return 49;
11217break;
11218case 79:return 50;
11219break;
11220case 80:return 40;
11221break;
11222case 81:return 41;
11223break;
11224case 82:return 59
11225break;
11226case 83:return 60
11227break;
11228case 84:return 117;
11229break;
11230case 85:return 21;
11231break;
11232case 86:return 22;
11233break;
11234case 87:return 23;
11235break;
11236}
11237},
11238rules: [/^(?:%%\{)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\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*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\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)/,/^(?:$)/],
11239conditions: {"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],"inclusive":true}}
11240});
11241return lexer;
11242})();
11243parser.lexer = lexer;
11244function Parser () {
11245 this.yy = {};
11246}
11247Parser.prototype = parser;parser.Parser = Parser;
11248return new Parser;
11249})();
11250
11251
11252if (true) {
11253exports.parser = parser;
11254exports.Parser = parser.Parser;
11255exports.parse = function () { return parser.parse.apply(parser, arguments); };
11256exports.main = function commonjsMain (args) {
11257 if (!args[1]) {
11258 console.log('Usage: '+args[0]+' FILE');
11259 process.exit(1);
11260 }
11261 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");
11262 return exports.parser.parse(source);
11263};
11264if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
11265 exports.main(process.argv.slice(1));
11266}
11267}
11268/* 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)))
11269
11270/***/ }),
11271
11272/***/ "./src/diagrams/flowchart/styles.js":
11273/*!******************************************!*\
11274 !*** ./src/diagrams/flowchart/styles.js ***!
11275 \******************************************/
11276/*! exports provided: default */
11277/***/ (function(module, __webpack_exports__, __webpack_require__) {
11278
11279"use strict";
11280__webpack_require__.r(__webpack_exports__);
11281var getStyles = function getStyles(options) {
11282 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");
11283};
11284
11285/* harmony default export */ __webpack_exports__["default"] = (getStyles);
11286
11287/***/ }),
11288
11289/***/ "./src/diagrams/gantt/ganttDb.js":
11290/*!***************************************!*\
11291 !*** ./src/diagrams/gantt/ganttDb.js ***!
11292 \***************************************/
11293/*! 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 */
11294/***/ (function(module, __webpack_exports__, __webpack_require__) {
11295
11296"use strict";
11297__webpack_require__.r(__webpack_exports__);
11298/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
11299/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
11300/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setAxisFormat", function() { return setAxisFormat; });
11301/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAxisFormat", function() { return getAxisFormat; });
11302/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTodayMarker", function() { return setTodayMarker; });
11303/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTodayMarker", function() { return getTodayMarker; });
11304/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setDateFormat", function() { return setDateFormat; });
11305/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableInclusiveEndDates", function() { return enableInclusiveEndDates; });
11306/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "endDatesAreInclusive", function() { return endDatesAreInclusive; });
11307/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDateFormat", function() { return getDateFormat; });
11308/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setExcludes", function() { return setExcludes; });
11309/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getExcludes", function() { return getExcludes; });
11310/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTitle", function() { return setTitle; });
11311/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTitle", function() { return getTitle; });
11312/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSection", function() { return addSection; });
11313/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSections", function() { return getSections; });
11314/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTasks", function() { return getTasks; });
11315/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTask", function() { return addTask; });
11316/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findTaskById", function() { return findTaskById; });
11317/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTaskOrg", function() { return addTaskOrg; });
11318/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLink", function() { return setLink; });
11319/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setClass", function() { return setClass; });
11320/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setClickEvent", function() { return setClickEvent; });
11321/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindFunctions", function() { return bindFunctions; });
11322/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
11323/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
11324/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
11325/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__);
11326/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
11327/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
11328/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
11329/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
11330function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
11331
11332function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
11333
11334function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
11335
11336function _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; } }
11337
11338
11339
11340
11341
11342
11343
11344var dateFormat = '';
11345var axisFormat = '';
11346var todayMarker = '';
11347var excludes = [];
11348var title = '';
11349var sections = [];
11350var tasks = [];
11351var currentSection = '';
11352var tags = ['active', 'done', 'crit', 'milestone'];
11353var funs = [];
11354var inclusiveEndDates = false; // The serial order of the task in the script
11355
11356var lastOrder = 0;
11357var parseDirective = function parseDirective(statement, context, type) {
11358 _mermaidAPI__WEBPACK_IMPORTED_MODULE_5__["default"].parseDirective(this, statement, context, type);
11359};
11360var clear = function clear() {
11361 sections = [];
11362 tasks = [];
11363 currentSection = '';
11364 funs = [];
11365 title = '';
11366 taskCnt = 0;
11367 lastTask = undefined;
11368 lastTaskID = undefined;
11369 rawTasks = [];
11370 dateFormat = '';
11371 axisFormat = '';
11372 todayMarker = '';
11373 excludes = [];
11374 inclusiveEndDates = false;
11375 lastOrder = 0;
11376};
11377var setAxisFormat = function setAxisFormat(txt) {
11378 axisFormat = txt;
11379};
11380var getAxisFormat = function getAxisFormat() {
11381 return axisFormat;
11382};
11383var setTodayMarker = function setTodayMarker(txt) {
11384 todayMarker = txt;
11385};
11386var getTodayMarker = function getTodayMarker() {
11387 return todayMarker;
11388};
11389var setDateFormat = function setDateFormat(txt) {
11390 dateFormat = txt;
11391};
11392var enableInclusiveEndDates = function enableInclusiveEndDates() {
11393 inclusiveEndDates = true;
11394};
11395var endDatesAreInclusive = function endDatesAreInclusive() {
11396 return inclusiveEndDates;
11397};
11398var getDateFormat = function getDateFormat() {
11399 return dateFormat;
11400};
11401var setExcludes = function setExcludes(txt) {
11402 excludes = txt.toLowerCase().split(/[\s,]+/);
11403};
11404var getExcludes = function getExcludes() {
11405 return excludes;
11406};
11407var setTitle = function setTitle(txt) {
11408 title = txt;
11409};
11410var getTitle = function getTitle() {
11411 return title;
11412};
11413var addSection = function addSection(txt) {
11414 currentSection = txt;
11415 sections.push(txt);
11416};
11417var getSections = function getSections() {
11418 return sections;
11419};
11420var getTasks = function getTasks() {
11421 var allItemsPricessed = compileTasks();
11422 var maxDepth = 10;
11423 var iterationCount = 0;
11424
11425 while (!allItemsPricessed && iterationCount < maxDepth) {
11426 allItemsPricessed = compileTasks();
11427 iterationCount++;
11428 }
11429
11430 tasks = rawTasks;
11431 return tasks;
11432};
11433
11434var isInvalidDate = function isInvalidDate(date, dateFormat, excludes) {
11435 if (date.isoWeekday() >= 6 && excludes.indexOf('weekends') >= 0) {
11436 return true;
11437 }
11438
11439 if (excludes.indexOf(date.format('dddd').toLowerCase()) >= 0) {
11440 return true;
11441 }
11442
11443 return excludes.indexOf(date.format(dateFormat.trim())) >= 0;
11444};
11445
11446var checkTaskDates = function checkTaskDates(task, dateFormat, excludes) {
11447 if (!excludes.length || task.manualEndTime) return;
11448 var startTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(task.startTime, dateFormat, true);
11449 startTime.add(1, 'd');
11450 var endTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(task.endTime, dateFormat, true);
11451 var renderEndTime = fixTaskDates(startTime, endTime, dateFormat, excludes);
11452 task.endTime = endTime.toDate();
11453 task.renderEndTime = renderEndTime;
11454};
11455
11456var fixTaskDates = function fixTaskDates(startTime, endTime, dateFormat, excludes) {
11457 var invalid = false;
11458 var renderEndTime = null;
11459
11460 while (startTime <= endTime) {
11461 if (!invalid) {
11462 renderEndTime = endTime.toDate();
11463 }
11464
11465 invalid = isInvalidDate(startTime, dateFormat, excludes);
11466
11467 if (invalid) {
11468 endTime.add(1, 'd');
11469 }
11470
11471 startTime.add(1, 'd');
11472 }
11473
11474 return renderEndTime;
11475};
11476
11477var getStartDate = function getStartDate(prevTime, dateFormat, str) {
11478 str = str.trim(); // Test for after
11479
11480 var re = /^after\s+([\d\w- ]+)/;
11481 var afterStatement = re.exec(str.trim());
11482
11483 if (afterStatement !== null) {
11484 // check all after ids and take the latest
11485 var latestEndingTask = null;
11486 afterStatement[1].split(' ').forEach(function (id) {
11487 var task = findTaskById(id);
11488
11489 if (typeof task !== 'undefined') {
11490 if (!latestEndingTask) {
11491 latestEndingTask = task;
11492 } else {
11493 if (task.endTime > latestEndingTask.endTime) {
11494 latestEndingTask = task;
11495 }
11496 }
11497 }
11498 });
11499
11500 if (!latestEndingTask) {
11501 var dt = new Date();
11502 dt.setHours(0, 0, 0, 0);
11503 return dt;
11504 } else {
11505 return latestEndingTask.endTime;
11506 }
11507 } // Check for actual date set
11508
11509
11510 var mDate = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(str, dateFormat.trim(), true);
11511
11512 if (mDate.isValid()) {
11513 return mDate.toDate();
11514 } else {
11515 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Invalid date:' + str);
11516 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('With date format:' + dateFormat.trim());
11517 } // Default date - now
11518
11519
11520 return new Date();
11521};
11522
11523var durationToDate = function durationToDate(durationStatement, relativeTime) {
11524 if (durationStatement !== null) {
11525 switch (durationStatement[2]) {
11526 case 's':
11527 relativeTime.add(durationStatement[1], 'seconds');
11528 break;
11529
11530 case 'm':
11531 relativeTime.add(durationStatement[1], 'minutes');
11532 break;
11533
11534 case 'h':
11535 relativeTime.add(durationStatement[1], 'hours');
11536 break;
11537
11538 case 'd':
11539 relativeTime.add(durationStatement[1], 'days');
11540 break;
11541
11542 case 'w':
11543 relativeTime.add(durationStatement[1], 'weeks');
11544 break;
11545 }
11546 } // Default date - now
11547
11548
11549 return relativeTime.toDate();
11550};
11551
11552var getEndDate = function getEndDate(prevTime, dateFormat, str, inclusive) {
11553 inclusive = inclusive || false;
11554 str = str.trim(); // Check for actual date
11555
11556 var mDate = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(str, dateFormat.trim(), true);
11557
11558 if (mDate.isValid()) {
11559 if (inclusive) {
11560 mDate.add(1, 'd');
11561 }
11562
11563 return mDate.toDate();
11564 }
11565
11566 return durationToDate(/^([\d]+)([wdhms])/.exec(str.trim()), moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(prevTime));
11567};
11568
11569var taskCnt = 0;
11570
11571var parseId = function parseId(idStr) {
11572 if (typeof idStr === 'undefined') {
11573 taskCnt = taskCnt + 1;
11574 return 'task' + taskCnt;
11575 }
11576
11577 return idStr;
11578}; // id, startDate, endDate
11579// id, startDate, length
11580// id, after x, endDate
11581// id, after x, length
11582// startDate, endDate
11583// startDate, length
11584// after x, endDate
11585// after x, length
11586// endDate
11587// length
11588
11589
11590var compileData = function compileData(prevTask, dataStr) {
11591 var ds;
11592
11593 if (dataStr.substr(0, 1) === ':') {
11594 ds = dataStr.substr(1, dataStr.length);
11595 } else {
11596 ds = dataStr;
11597 }
11598
11599 var data = ds.split(',');
11600 var task = {}; // Get tags like active, done, crit and milestone
11601
11602 getTaskTags(data, task, tags);
11603
11604 for (var i = 0; i < data.length; i++) {
11605 data[i] = data[i].trim();
11606 }
11607
11608 var endTimeData = '';
11609
11610 switch (data.length) {
11611 case 1:
11612 task.id = parseId();
11613 task.startTime = prevTask.endTime;
11614 endTimeData = data[0];
11615 break;
11616
11617 case 2:
11618 task.id = parseId();
11619 task.startTime = getStartDate(undefined, dateFormat, data[0]);
11620 endTimeData = data[1];
11621 break;
11622
11623 case 3:
11624 task.id = parseId(data[0]);
11625 task.startTime = getStartDate(undefined, dateFormat, data[1]);
11626 endTimeData = data[2];
11627 break;
11628
11629 default:
11630 }
11631
11632 if (endTimeData) {
11633 task.endTime = getEndDate(task.startTime, dateFormat, endTimeData, inclusiveEndDates);
11634 task.manualEndTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(endTimeData, 'YYYY-MM-DD', true).isValid();
11635 checkTaskDates(task, dateFormat, excludes);
11636 }
11637
11638 return task;
11639};
11640
11641var parseData = function parseData(prevTaskId, dataStr) {
11642 var ds;
11643
11644 if (dataStr.substr(0, 1) === ':') {
11645 ds = dataStr.substr(1, dataStr.length);
11646 } else {
11647 ds = dataStr;
11648 }
11649
11650 var data = ds.split(',');
11651 var task = {}; // Get tags like active, done, crit and milestone
11652
11653 getTaskTags(data, task, tags);
11654
11655 for (var i = 0; i < data.length; i++) {
11656 data[i] = data[i].trim();
11657 }
11658
11659 switch (data.length) {
11660 case 1:
11661 task.id = parseId();
11662 task.startTime = {
11663 type: 'prevTaskEnd',
11664 id: prevTaskId
11665 };
11666 task.endTime = {
11667 data: data[0]
11668 };
11669 break;
11670
11671 case 2:
11672 task.id = parseId();
11673 task.startTime = {
11674 type: 'getStartDate',
11675 startData: data[0]
11676 };
11677 task.endTime = {
11678 data: data[1]
11679 };
11680 break;
11681
11682 case 3:
11683 task.id = parseId(data[0]);
11684 task.startTime = {
11685 type: 'getStartDate',
11686 startData: data[1]
11687 };
11688 task.endTime = {
11689 data: data[2]
11690 };
11691 break;
11692
11693 default:
11694 }
11695
11696 return task;
11697};
11698
11699var lastTask;
11700var lastTaskID;
11701var rawTasks = [];
11702var taskDb = {};
11703var addTask = function addTask(descr, data) {
11704 var rawTask = {
11705 section: currentSection,
11706 type: currentSection,
11707 processed: false,
11708 manualEndTime: false,
11709 renderEndTime: null,
11710 raw: {
11711 data: data
11712 },
11713 task: descr,
11714 classes: []
11715 };
11716 var taskInfo = parseData(lastTaskID, data);
11717 rawTask.raw.startTime = taskInfo.startTime;
11718 rawTask.raw.endTime = taskInfo.endTime;
11719 rawTask.id = taskInfo.id;
11720 rawTask.prevTaskId = lastTaskID;
11721 rawTask.active = taskInfo.active;
11722 rawTask.done = taskInfo.done;
11723 rawTask.crit = taskInfo.crit;
11724 rawTask.milestone = taskInfo.milestone;
11725 rawTask.order = lastOrder;
11726 lastOrder++;
11727 var pos = rawTasks.push(rawTask);
11728 lastTaskID = rawTask.id; // Store cross ref
11729
11730 taskDb[rawTask.id] = pos - 1;
11731};
11732var findTaskById = function findTaskById(id) {
11733 var pos = taskDb[id];
11734 return rawTasks[pos];
11735};
11736var addTaskOrg = function addTaskOrg(descr, data) {
11737 var newTask = {
11738 section: currentSection,
11739 type: currentSection,
11740 description: descr,
11741 task: descr,
11742 classes: []
11743 };
11744 var taskInfo = compileData(lastTask, data);
11745 newTask.startTime = taskInfo.startTime;
11746 newTask.endTime = taskInfo.endTime;
11747 newTask.id = taskInfo.id;
11748 newTask.active = taskInfo.active;
11749 newTask.done = taskInfo.done;
11750 newTask.crit = taskInfo.crit;
11751 newTask.milestone = taskInfo.milestone;
11752 lastTask = newTask;
11753 tasks.push(newTask);
11754};
11755
11756var compileTasks = function compileTasks() {
11757 var compileTask = function compileTask(pos) {
11758 var task = rawTasks[pos];
11759 var startTime = '';
11760
11761 switch (rawTasks[pos].raw.startTime.type) {
11762 case 'prevTaskEnd':
11763 {
11764 var prevTask = findTaskById(task.prevTaskId);
11765 task.startTime = prevTask.endTime;
11766 break;
11767 }
11768
11769 case 'getStartDate':
11770 startTime = getStartDate(undefined, dateFormat, rawTasks[pos].raw.startTime.startData);
11771
11772 if (startTime) {
11773 rawTasks[pos].startTime = startTime;
11774 }
11775
11776 break;
11777 }
11778
11779 if (rawTasks[pos].startTime) {
11780 rawTasks[pos].endTime = getEndDate(rawTasks[pos].startTime, dateFormat, rawTasks[pos].raw.endTime.data, inclusiveEndDates);
11781
11782 if (rawTasks[pos].endTime) {
11783 rawTasks[pos].processed = true;
11784 rawTasks[pos].manualEndTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(rawTasks[pos].raw.endTime.data, 'YYYY-MM-DD', true).isValid();
11785 checkTaskDates(rawTasks[pos], dateFormat, excludes);
11786 }
11787 }
11788
11789 return rawTasks[pos].processed;
11790 };
11791
11792 var allProcessed = true;
11793
11794 for (var i = 0; i < rawTasks.length; i++) {
11795 compileTask(i);
11796 allProcessed = allProcessed && rawTasks[i].processed;
11797 }
11798
11799 return allProcessed;
11800};
11801/**
11802 * Called by parser when a link is found. Adds the URL to the vertex data.
11803 * @param ids Comma separated list of ids
11804 * @param linkStr URL to create a link for
11805 */
11806
11807
11808var setLink = function setLink(ids, _linkStr) {
11809 var linkStr = _linkStr;
11810
11811 if (_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"]().securityLevel !== 'loose') {
11812 linkStr = Object(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__["sanitizeUrl"])(_linkStr);
11813 }
11814
11815 ids.split(',').forEach(function (id) {
11816 var rawTask = findTaskById(id);
11817
11818 if (typeof rawTask !== 'undefined') {
11819 pushFun(id, function () {
11820 window.open(linkStr, '_self');
11821 });
11822 }
11823 });
11824 setClass(ids, 'clickable');
11825};
11826/**
11827 * Called by parser when a special node is found, e.g. a clickable element.
11828 * @param ids Comma separated list of ids
11829 * @param className Class to add
11830 */
11831
11832var setClass = function setClass(ids, className) {
11833 ids.split(',').forEach(function (id) {
11834 var rawTask = findTaskById(id);
11835
11836 if (typeof rawTask !== 'undefined') {
11837 rawTask.classes.push(className);
11838 }
11839 });
11840};
11841
11842var setClickFun = function setClickFun(id, functionName, functionArgs) {
11843 if (_config__WEBPACK_IMPORTED_MODULE_3__["getConfig"]().securityLevel !== 'loose') {
11844 return;
11845 }
11846
11847 if (typeof functionName === 'undefined') {
11848 return;
11849 }
11850
11851 var argList = [];
11852
11853 if (typeof functionArgs === 'string') {
11854 /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
11855 argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
11856
11857 for (var i = 0; i < argList.length; i++) {
11858 var item = argList[i].trim();
11859 /* Removes all double quotes at the start and end of an argument */
11860
11861 /* This preserves all starting and ending whitespace inside */
11862
11863 if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
11864 item = item.substr(1, item.length - 2);
11865 }
11866
11867 argList[i] = item;
11868 }
11869 }
11870 /* if no arguments passed into callback, default to passing in id */
11871
11872
11873 if (argList.length === 0) {
11874 argList.push(id);
11875 }
11876
11877 var rawTask = findTaskById(id);
11878
11879 if (typeof rawTask !== 'undefined') {
11880 pushFun(id, function () {
11881 _utils__WEBPACK_IMPORTED_MODULE_4__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_4__["default"], [functionName].concat(_toConsumableArray(argList)));
11882 });
11883 }
11884};
11885/**
11886 * The callbackFunction is executed in a click event bound to the task with the specified id or the task's assigned text
11887 * @param id The task's id
11888 * @param callbackFunction A function to be executed when clicked on the task or the task's text
11889 */
11890
11891
11892var pushFun = function pushFun(id, callbackFunction) {
11893 funs.push(function () {
11894 // const elem = d3.select(element).select(`[id="${id}"]`)
11895 var elem = document.querySelector("[id=\"".concat(id, "\"]"));
11896
11897 if (elem !== null) {
11898 elem.addEventListener('click', function () {
11899 callbackFunction();
11900 });
11901 }
11902 });
11903 funs.push(function () {
11904 // const elem = d3.select(element).select(`[id="${id}-text"]`)
11905 var elem = document.querySelector("[id=\"".concat(id, "-text\"]"));
11906
11907 if (elem !== null) {
11908 elem.addEventListener('click', function () {
11909 callbackFunction();
11910 });
11911 }
11912 });
11913};
11914/**
11915 * Called by parser when a click definition is found. Registers an event handler.
11916 * @param ids Comma separated list of ids
11917 * @param functionName Function to be called on click
11918 * @param functionArgs Function args the function should be called with
11919 */
11920
11921
11922var setClickEvent = function setClickEvent(ids, functionName, functionArgs) {
11923 ids.split(',').forEach(function (id) {
11924 setClickFun(id, functionName, functionArgs);
11925 });
11926 setClass(ids, 'clickable');
11927};
11928/**
11929 * Binds all functions previously added to fun (specified through click) to the element
11930 * @param element
11931 */
11932
11933var bindFunctions = function bindFunctions(element) {
11934 funs.forEach(function (fun) {
11935 fun(element);
11936 });
11937};
11938/* harmony default export */ __webpack_exports__["default"] = ({
11939 parseDirective: parseDirective,
11940 getConfig: function getConfig() {
11941 return _config__WEBPACK_IMPORTED_MODULE_3__["getConfig"]().gantt;
11942 },
11943 clear: clear,
11944 setDateFormat: setDateFormat,
11945 getDateFormat: getDateFormat,
11946 enableInclusiveEndDates: enableInclusiveEndDates,
11947 endDatesAreInclusive: endDatesAreInclusive,
11948 setAxisFormat: setAxisFormat,
11949 getAxisFormat: getAxisFormat,
11950 setTodayMarker: setTodayMarker,
11951 getTodayMarker: getTodayMarker,
11952 setTitle: setTitle,
11953 getTitle: getTitle,
11954 addSection: addSection,
11955 getSections: getSections,
11956 getTasks: getTasks,
11957 addTask: addTask,
11958 findTaskById: findTaskById,
11959 addTaskOrg: addTaskOrg,
11960 setExcludes: setExcludes,
11961 getExcludes: getExcludes,
11962 setClickEvent: setClickEvent,
11963 setLink: setLink,
11964 bindFunctions: bindFunctions,
11965 durationToDate: durationToDate
11966});
11967
11968function getTaskTags(data, task, tags) {
11969 var matchFound = true;
11970
11971 while (matchFound) {
11972 matchFound = false;
11973 tags.forEach(function (t) {
11974 var pattern = '^\\s*' + t + '\\s*$';
11975 var regex = new RegExp(pattern);
11976
11977 if (data[0].match(regex)) {
11978 task[t] = true;
11979 data.shift(1);
11980 matchFound = true;
11981 }
11982 });
11983 }
11984}
11985
11986/***/ }),
11987
11988/***/ "./src/diagrams/gantt/ganttRenderer.js":
11989/*!*********************************************!*\
11990 !*** ./src/diagrams/gantt/ganttRenderer.js ***!
11991 \*********************************************/
11992/*! exports provided: setConf, draw, default */
11993/***/ (function(module, __webpack_exports__, __webpack_require__) {
11994
11995"use strict";
11996__webpack_require__.r(__webpack_exports__);
11997/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
11998/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
11999/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
12000/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
12001/* harmony import */ var _parser_gantt__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/gantt */ "./src/diagrams/gantt/parser/gantt.jison");
12002/* harmony import */ var _parser_gantt__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_gantt__WEBPACK_IMPORTED_MODULE_1__);
12003/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
12004/* harmony import */ var _ganttDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ganttDb */ "./src/diagrams/gantt/ganttDb.js");
12005/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
12006
12007
12008
12009
12010
12011_parser_gantt__WEBPACK_IMPORTED_MODULE_1__["parser"].yy = _ganttDb__WEBPACK_IMPORTED_MODULE_3__["default"];
12012var conf = {
12013 titleTopMargin: 25,
12014 barHeight: 20,
12015 barGap: 4,
12016 topPadding: 50,
12017 rightPadding: 75,
12018 leftPadding: 75,
12019 gridLineStartPadding: 35,
12020 fontSize: 11,
12021 fontFamily: '"Open-Sans", "sans-serif"'
12022};
12023var setConf = function setConf(cnf) {
12024 var keys = Object.keys(cnf);
12025 keys.forEach(function (key) {
12026 conf[key] = cnf[key];
12027 });
12028};
12029var w;
12030var draw = function draw(text, id) {
12031 _parser_gantt__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.clear();
12032 _parser_gantt__WEBPACK_IMPORTED_MODULE_1__["parser"].parse(text);
12033 var elem = document.getElementById(id);
12034 w = elem.parentElement.offsetWidth;
12035
12036 if (typeof w === 'undefined') {
12037 w = 1200;
12038 }
12039
12040 if (typeof conf.useWidth !== 'undefined') {
12041 w = conf.useWidth;
12042 }
12043
12044 var taskArray = _parser_gantt__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.getTasks(); // Set height based on number of tasks
12045
12046 var h = taskArray.length * (conf.barHeight + conf.barGap) + 2 * conf.topPadding; // Set viewBox
12047
12048 elem.setAttribute('viewBox', '0 0 ' + w + ' ' + h);
12049 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id=\"".concat(id, "\"]")); // Set timescale
12050
12051 var timeScale = Object(d3__WEBPACK_IMPORTED_MODULE_0__["scaleTime"])().domain([Object(d3__WEBPACK_IMPORTED_MODULE_0__["min"])(taskArray, function (d) {
12052 return d.startTime;
12053 }), Object(d3__WEBPACK_IMPORTED_MODULE_0__["max"])(taskArray, function (d) {
12054 return d.endTime;
12055 })]).rangeRound([0, w - conf.leftPadding - conf.rightPadding]);
12056 var categories = [];
12057
12058 for (var i = 0; i < taskArray.length; i++) {
12059 categories.push(taskArray[i].type);
12060 }
12061
12062 var catsUnfiltered = categories; // for vert labels
12063
12064 categories = checkUnique(categories);
12065
12066 function taskCompare(a, b) {
12067 var taskA = a.startTime;
12068 var taskB = b.startTime;
12069 var result = 0;
12070
12071 if (taskA > taskB) {
12072 result = 1;
12073 } else if (taskA < taskB) {
12074 result = -1;
12075 }
12076
12077 return result;
12078 } // Sort the task array using the above taskCompare() so that
12079 // tasks are created based on their order of startTime
12080
12081
12082 taskArray.sort(taskCompare);
12083 makeGant(taskArray, w, h);
12084 Object(_utils__WEBPACK_IMPORTED_MODULE_4__["configureSvgSize"])(svg, h, w, conf.useMaxWidth);
12085 svg.append('text').text(_parser_gantt__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.getTitle()).attr('x', w / 2).attr('y', conf.titleTopMargin).attr('class', 'titleText');
12086
12087 function makeGant(tasks, pageWidth, pageHeight) {
12088 var barHeight = conf.barHeight;
12089 var gap = barHeight + conf.barGap;
12090 var topPadding = conf.topPadding;
12091 var leftPadding = conf.leftPadding;
12092 var colorScale = Object(d3__WEBPACK_IMPORTED_MODULE_0__["scaleLinear"])().domain([0, categories.length]).range(['#00B9FA', '#F95002']).interpolate(d3__WEBPACK_IMPORTED_MODULE_0__["interpolateHcl"]);
12093 makeGrid(leftPadding, topPadding, pageWidth, pageHeight);
12094 drawRects(tasks, gap, topPadding, leftPadding, barHeight, colorScale, pageWidth, pageHeight);
12095 vertLabels(gap, topPadding, leftPadding, barHeight, colorScale);
12096 drawToday(leftPadding, topPadding, pageWidth, pageHeight);
12097 }
12098
12099 function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w) {
12100 // Draw background rects covering the entire width of the graph, these form the section rows.
12101 svg.append('g').selectAll('rect').data(theArray).enter().append('rect').attr('x', 0).attr('y', function (d, i) {
12102 // Ignore the incoming i value and use our order instead
12103 i = d.order;
12104 return i * theGap + theTopPad - 2;
12105 }).attr('width', function () {
12106 return w - conf.rightPadding / 2;
12107 }).attr('height', theGap).attr('class', function (d) {
12108 for (var _i = 0; _i < categories.length; _i++) {
12109 if (d.type === categories[_i]) {
12110 return 'section section' + _i % conf.numberSectionStyles;
12111 }
12112 }
12113
12114 return 'section section0';
12115 }); // Draw the rects representing the tasks
12116
12117 var rectangles = svg.append('g').selectAll('rect').data(theArray).enter();
12118 rectangles.append('rect').attr('id', function (d) {
12119 return d.id;
12120 }).attr('rx', 3).attr('ry', 3).attr('x', function (d) {
12121 if (d.milestone) {
12122 return timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
12123 }
12124
12125 return timeScale(d.startTime) + theSidePad;
12126 }).attr('y', function (d, i) {
12127 // Ignore the incoming i value and use our order instead
12128 i = d.order;
12129 return i * theGap + theTopPad;
12130 }).attr('width', function (d) {
12131 if (d.milestone) {
12132 return theBarHeight;
12133 }
12134
12135 return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime);
12136 }).attr('height', theBarHeight).attr('transform-origin', function (d, i) {
12137 return (timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime))).toString() + 'px ' + (i * theGap + theTopPad + 0.5 * theBarHeight).toString() + 'px';
12138 }).attr('class', function (d) {
12139 var res = 'task';
12140 var classStr = '';
12141
12142 if (d.classes.length > 0) {
12143 classStr = d.classes.join(' ');
12144 }
12145
12146 var secNum = 0;
12147
12148 for (var _i2 = 0; _i2 < categories.length; _i2++) {
12149 if (d.type === categories[_i2]) {
12150 secNum = _i2 % conf.numberSectionStyles;
12151 }
12152 }
12153
12154 var taskClass = '';
12155
12156 if (d.active) {
12157 if (d.crit) {
12158 taskClass += ' activeCrit';
12159 } else {
12160 taskClass = ' active';
12161 }
12162 } else if (d.done) {
12163 if (d.crit) {
12164 taskClass = ' doneCrit';
12165 } else {
12166 taskClass = ' done';
12167 }
12168 } else {
12169 if (d.crit) {
12170 taskClass += ' crit';
12171 }
12172 }
12173
12174 if (taskClass.length === 0) {
12175 taskClass = ' task';
12176 }
12177
12178 if (d.milestone) {
12179 taskClass = ' milestone ' + taskClass;
12180 }
12181
12182 taskClass += secNum;
12183 taskClass += ' ' + classStr;
12184 return res + taskClass;
12185 }); // Append task labels
12186
12187 rectangles.append('text').attr('id', function (d) {
12188 return d.id + '-text';
12189 }).text(function (d) {
12190 return d.task;
12191 }).attr('font-size', conf.fontSize).attr('x', function (d) {
12192 var startX = timeScale(d.startTime);
12193 var endX = timeScale(d.renderEndTime || d.endTime);
12194
12195 if (d.milestone) {
12196 startX += 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
12197 }
12198
12199 if (d.milestone) {
12200 endX = startX + theBarHeight;
12201 }
12202
12203 var textWidth = this.getBBox().width; // Check id text width > width of rectangle
12204
12205 if (textWidth > endX - startX) {
12206 if (endX + textWidth + 1.5 * conf.leftPadding > w) {
12207 return startX + theSidePad - 5;
12208 } else {
12209 return endX + theSidePad + 5;
12210 }
12211 } else {
12212 return (endX - startX) / 2 + startX + theSidePad;
12213 }
12214 }).attr('y', function (d, i) {
12215 // Ignore the incoming i value and use our order instead
12216 i = d.order;
12217 return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad;
12218 }).attr('text-height', theBarHeight).attr('class', function (d) {
12219 var startX = timeScale(d.startTime);
12220 var endX = timeScale(d.endTime);
12221
12222 if (d.milestone) {
12223 endX = startX + theBarHeight;
12224 }
12225
12226 var textWidth = this.getBBox().width;
12227 var classStr = '';
12228
12229 if (d.classes.length > 0) {
12230 classStr = d.classes.join(' ');
12231 }
12232
12233 var secNum = 0;
12234
12235 for (var _i3 = 0; _i3 < categories.length; _i3++) {
12236 if (d.type === categories[_i3]) {
12237 secNum = _i3 % conf.numberSectionStyles;
12238 }
12239 }
12240
12241 var taskType = '';
12242
12243 if (d.active) {
12244 if (d.crit) {
12245 taskType = 'activeCritText' + secNum;
12246 } else {
12247 taskType = 'activeText' + secNum;
12248 }
12249 }
12250
12251 if (d.done) {
12252 if (d.crit) {
12253 taskType = taskType + ' doneCritText' + secNum;
12254 } else {
12255 taskType = taskType + ' doneText' + secNum;
12256 }
12257 } else {
12258 if (d.crit) {
12259 taskType = taskType + ' critText' + secNum;
12260 }
12261 }
12262
12263 if (d.milestone) {
12264 taskType += ' milestoneText';
12265 } // Check id text width > width of rectangle
12266
12267
12268 if (textWidth > endX - startX) {
12269 if (endX + textWidth + 1.5 * conf.leftPadding > w) {
12270 return classStr + ' taskTextOutsideLeft taskTextOutside' + secNum + ' ' + taskType;
12271 } else {
12272 return classStr + ' taskTextOutsideRight taskTextOutside' + secNum + ' ' + taskType + ' width-' + textWidth;
12273 }
12274 } else {
12275 return classStr + ' taskText taskText' + secNum + ' ' + taskType + ' width-' + textWidth;
12276 }
12277 });
12278 }
12279
12280 function makeGrid(theSidePad, theTopPad, w, h) {
12281 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'));
12282 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');
12283 }
12284
12285 function vertLabels(theGap, theTopPad) {
12286 var numOccurances = [];
12287 var prevGap = 0;
12288
12289 for (var _i4 = 0; _i4 < categories.length; _i4++) {
12290 numOccurances[_i4] = [categories[_i4], getCount(categories[_i4], catsUnfiltered)];
12291 }
12292
12293 svg.append('g') // without doing this, impossible to put grid lines behind text
12294 .selectAll('text').data(numOccurances).enter().append(function (d) {
12295 var rows = d[0].split(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex);
12296 var dy = -(rows.length - 1) / 2;
12297 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
12298 svgLabel.setAttribute('dy', dy + 'em');
12299
12300 for (var j = 0; j < rows.length; j++) {
12301 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
12302 tspan.setAttribute('alignment-baseline', 'central');
12303 tspan.setAttribute('x', '10');
12304 if (j > 0) tspan.setAttribute('dy', '1em');
12305 tspan.textContent = rows[j];
12306 svgLabel.appendChild(tspan);
12307 }
12308
12309 return svgLabel;
12310 }).attr('x', 10).attr('y', function (d, i) {
12311 if (i > 0) {
12312 for (var j = 0; j < i; j++) {
12313 prevGap += numOccurances[i - 1][1];
12314 return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
12315 }
12316 } else {
12317 return d[1] * theGap / 2 + theTopPad;
12318 }
12319 }).attr('class', function (d) {
12320 for (var _i5 = 0; _i5 < categories.length; _i5++) {
12321 if (d[0] === categories[_i5]) {
12322 return 'sectionTitle sectionTitle' + _i5 % conf.numberSectionStyles;
12323 }
12324 }
12325
12326 return 'sectionTitle';
12327 });
12328 }
12329
12330 function drawToday(theSidePad, theTopPad, w, h) {
12331 var todayMarker = _ganttDb__WEBPACK_IMPORTED_MODULE_3__["default"].getTodayMarker();
12332
12333 if (todayMarker === 'off') {
12334 return;
12335 }
12336
12337 var todayG = svg.append('g').attr('class', 'today');
12338 var today = new Date();
12339 var todayLine = todayG.append('line');
12340 todayLine.attr('x1', timeScale(today) + theSidePad).attr('x2', timeScale(today) + theSidePad).attr('y1', conf.titleTopMargin).attr('y2', h - conf.titleTopMargin).attr('class', 'today');
12341
12342 if (todayMarker !== '') {
12343 todayLine.attr('style', todayMarker.replace(/,/g, ';'));
12344 }
12345 } // from this stackexchange question: http://stackoverflow.com/questions/1890203/unique-for-arrays-in-javascript
12346
12347
12348 function checkUnique(arr) {
12349 var hash = {};
12350 var result = [];
12351
12352 for (var _i6 = 0, l = arr.length; _i6 < l; ++_i6) {
12353 if (!hash.hasOwnProperty(arr[_i6])) {
12354 // eslint-disable-line
12355 // it works with objects! in FF, at least
12356 hash[arr[_i6]] = true;
12357 result.push(arr[_i6]);
12358 }
12359 }
12360
12361 return result;
12362 } // from this stackexchange question: http://stackoverflow.com/questions/14227981/count-how-many-strings-in-an-array-have-duplicates-in-the-same-array
12363
12364
12365 function getCounts(arr) {
12366 var i = arr.length; // const to loop over
12367
12368 var obj = {}; // obj to store results
12369
12370 while (i) {
12371 obj[arr[--i]] = (obj[arr[i]] || 0) + 1; // count occurrences
12372 }
12373
12374 return obj;
12375 } // get specific from everything
12376
12377
12378 function getCount(word, arr) {
12379 return getCounts(arr)[word] || 0;
12380 }
12381};
12382/* harmony default export */ __webpack_exports__["default"] = ({
12383 setConf: setConf,
12384 draw: draw
12385});
12386
12387/***/ }),
12388
12389/***/ "./src/diagrams/gantt/parser/gantt.jison":
12390/*!***********************************************!*\
12391 !*** ./src/diagrams/gantt/parser/gantt.jison ***!
12392 \***********************************************/
12393/*! no static exports found */
12394/***/ (function(module, exports, __webpack_require__) {
12395
12396/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
12397/*
12398 Returns a Parser object of the following structure:
12399
12400 Parser: {
12401 yy: {}
12402 }
12403
12404 Parser.prototype: {
12405 yy: {},
12406 trace: function(),
12407 symbols_: {associative list: name ==> number},
12408 terminals_: {associative list: number ==> name},
12409 productions_: [...],
12410 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
12411 table: [...],
12412 defaultActions: {...},
12413 parseError: function(str, hash),
12414 parse: function(input),
12415
12416 lexer: {
12417 EOF: 1,
12418 parseError: function(str, hash),
12419 setInput: function(input),
12420 input: function(),
12421 unput: function(str),
12422 more: function(),
12423 less: function(n),
12424 pastInput: function(),
12425 upcomingInput: function(),
12426 showPosition: function(),
12427 test_match: function(regex_match_array, rule_index),
12428 next: function(),
12429 lex: function(),
12430 begin: function(condition),
12431 popState: function(),
12432 _currentRules: function(),
12433 topState: function(),
12434 pushState: function(condition),
12435
12436 options: {
12437 ranges: boolean (optional: true ==> token location info will include a .range[] member)
12438 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
12439 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)
12440 },
12441
12442 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
12443 rules: [...],
12444 conditions: {associative list: name ==> set},
12445 }
12446 }
12447
12448
12449 token location info (@$, _$, etc.): {
12450 first_line: n,
12451 last_line: n,
12452 first_column: n,
12453 last_column: n,
12454 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
12455 }
12456
12457
12458 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
12459 text: (matched text)
12460 token: (the produced terminal token, if any)
12461 line: (yylineno)
12462 }
12463 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
12464 loc: (yylloc)
12465 expected: (string describing the set of expected tokens)
12466 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
12467 }
12468*/
12469var parser = (function(){
12470var 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];
12471var parser = {trace: function trace () { },
12472yy: {},
12473symbols_: {"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},
12474terminals_: {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"},
12475productions_: [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]],
12476performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
12477/* this == yyval */
12478
12479var $0 = $$.length - 1;
12480switch (yystate) {
12481case 2:
12482 return $$[$0-1];
12483break;
12484case 3:
12485 this.$ = []
12486break;
12487case 4:
12488$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
12489break;
12490case 5: case 6:
12491 this.$ = $$[$0]
12492break;
12493case 7: case 8:
12494 this.$=[];
12495break;
12496case 9:
12497yy.setDateFormat($$[$0].substr(11));this.$=$$[$0].substr(11);
12498break;
12499case 10:
12500yy.enableInclusiveEndDates();this.$=$$[$0].substr(18);
12501break;
12502case 11:
12503yy.setAxisFormat($$[$0].substr(11));this.$=$$[$0].substr(11);
12504break;
12505case 12:
12506yy.setExcludes($$[$0].substr(9));this.$=$$[$0].substr(9);
12507break;
12508case 13:
12509yy.setTodayMarker($$[$0].substr(12));this.$=$$[$0].substr(12);
12510break;
12511case 14:
12512yy.setTitle($$[$0].substr(6));this.$=$$[$0].substr(6);
12513break;
12514case 15:
12515yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
12516break;
12517case 17:
12518yy.addTask($$[$0-1],$$[$0]);this.$='task';
12519break;
12520case 21:
12521this.$ = $$[$0-1];yy.setClickEvent($$[$0-1], $$[$0], null);
12522break;
12523case 22:
12524this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
12525break;
12526case 23:
12527this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], null);yy.setLink($$[$0-2],$$[$0]);
12528break;
12529case 24:
12530this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-2], $$[$0-1]);yy.setLink($$[$0-3],$$[$0]);
12531break;
12532case 25:
12533this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0], null);yy.setLink($$[$0-2],$$[$0-1]);
12534break;
12535case 26:
12536this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-1], $$[$0]);yy.setLink($$[$0-3],$$[$0-2]);
12537break;
12538case 27:
12539this.$ = $$[$0-1];yy.setLink($$[$0-1], $$[$0]);
12540break;
12541case 28: case 34:
12542this.$=$$[$0-1] + ' ' + $$[$0];
12543break;
12544case 29: case 30: case 32:
12545this.$=$$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0];
12546break;
12547case 31: case 33:
12548this.$=$$[$0-3] + ' ' + $$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0];
12549break;
12550case 35:
12551 yy.parseDirective('%%{', 'open_directive');
12552break;
12553case 36:
12554 yy.parseDirective($$[$0], 'type_directive');
12555break;
12556case 37:
12557 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
12558break;
12559case 38:
12560 yy.parseDirective('}%%', 'close_directive', 'gantt');
12561break;
12562}
12563},
12564table: [{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])],
12565defaultActions: {5:[2,35],6:[2,1],28:[2,38],35:[2,37]},
12566parseError: function parseError (str, hash) {
12567 if (hash.recoverable) {
12568 this.trace(str);
12569 } else {
12570 var error = new Error(str);
12571 error.hash = hash;
12572 throw error;
12573 }
12574},
12575parse: function parse(input) {
12576 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
12577 var args = lstack.slice.call(arguments, 1);
12578 var lexer = Object.create(this.lexer);
12579 var sharedState = { yy: {} };
12580 for (var k in this.yy) {
12581 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
12582 sharedState.yy[k] = this.yy[k];
12583 }
12584 }
12585 lexer.setInput(input, sharedState.yy);
12586 sharedState.yy.lexer = lexer;
12587 sharedState.yy.parser = this;
12588 if (typeof lexer.yylloc == 'undefined') {
12589 lexer.yylloc = {};
12590 }
12591 var yyloc = lexer.yylloc;
12592 lstack.push(yyloc);
12593 var ranges = lexer.options && lexer.options.ranges;
12594 if (typeof sharedState.yy.parseError === 'function') {
12595 this.parseError = sharedState.yy.parseError;
12596 } else {
12597 this.parseError = Object.getPrototypeOf(this).parseError;
12598 }
12599 function popStack(n) {
12600 stack.length = stack.length - 2 * n;
12601 vstack.length = vstack.length - n;
12602 lstack.length = lstack.length - n;
12603 }
12604 function lex() {
12605 var token;
12606 token = tstack.pop() || lexer.lex() || EOF;
12607 if (typeof token !== 'number') {
12608 if (token instanceof Array) {
12609 tstack = token;
12610 token = tstack.pop();
12611 }
12612 token = self.symbols_[token] || token;
12613 }
12614 return token;
12615 }
12616 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
12617 while (true) {
12618 state = stack[stack.length - 1];
12619 if (this.defaultActions[state]) {
12620 action = this.defaultActions[state];
12621 } else {
12622 if (symbol === null || typeof symbol == 'undefined') {
12623 symbol = lex();
12624 }
12625 action = table[state] && table[state][symbol];
12626 }
12627 if (typeof action === 'undefined' || !action.length || !action[0]) {
12628 var errStr = '';
12629 expected = [];
12630 for (p in table[state]) {
12631 if (this.terminals_[p] && p > TERROR) {
12632 expected.push('\'' + this.terminals_[p] + '\'');
12633 }
12634 }
12635 if (lexer.showPosition) {
12636 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
12637 } else {
12638 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
12639 }
12640 this.parseError(errStr, {
12641 text: lexer.match,
12642 token: this.terminals_[symbol] || symbol,
12643 line: lexer.yylineno,
12644 loc: yyloc,
12645 expected: expected
12646 });
12647 }
12648 if (action[0] instanceof Array && action.length > 1) {
12649 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
12650 }
12651 switch (action[0]) {
12652 case 1:
12653 stack.push(symbol);
12654 vstack.push(lexer.yytext);
12655 lstack.push(lexer.yylloc);
12656 stack.push(action[1]);
12657 symbol = null;
12658 if (!preErrorSymbol) {
12659 yyleng = lexer.yyleng;
12660 yytext = lexer.yytext;
12661 yylineno = lexer.yylineno;
12662 yyloc = lexer.yylloc;
12663 if (recovering > 0) {
12664 recovering--;
12665 }
12666 } else {
12667 symbol = preErrorSymbol;
12668 preErrorSymbol = null;
12669 }
12670 break;
12671 case 2:
12672 len = this.productions_[action[1]][1];
12673 yyval.$ = vstack[vstack.length - len];
12674 yyval._$ = {
12675 first_line: lstack[lstack.length - (len || 1)].first_line,
12676 last_line: lstack[lstack.length - 1].last_line,
12677 first_column: lstack[lstack.length - (len || 1)].first_column,
12678 last_column: lstack[lstack.length - 1].last_column
12679 };
12680 if (ranges) {
12681 yyval._$.range = [
12682 lstack[lstack.length - (len || 1)].range[0],
12683 lstack[lstack.length - 1].range[1]
12684 ];
12685 }
12686 r = this.performAction.apply(yyval, [
12687 yytext,
12688 yyleng,
12689 yylineno,
12690 sharedState.yy,
12691 action[1],
12692 vstack,
12693 lstack
12694 ].concat(args));
12695 if (typeof r !== 'undefined') {
12696 return r;
12697 }
12698 if (len) {
12699 stack = stack.slice(0, -1 * len * 2);
12700 vstack = vstack.slice(0, -1 * len);
12701 lstack = lstack.slice(0, -1 * len);
12702 }
12703 stack.push(this.productions_[action[1]][0]);
12704 vstack.push(yyval.$);
12705 lstack.push(yyval._$);
12706 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
12707 stack.push(newState);
12708 break;
12709 case 3:
12710 return true;
12711 }
12712 }
12713 return true;
12714}};
12715
12716/* generated by jison-lex 0.3.4 */
12717var lexer = (function(){
12718var lexer = ({
12719
12720EOF:1,
12721
12722parseError:function parseError(str, hash) {
12723 if (this.yy.parser) {
12724 this.yy.parser.parseError(str, hash);
12725 } else {
12726 throw new Error(str);
12727 }
12728 },
12729
12730// resets the lexer, sets new input
12731setInput:function (input, yy) {
12732 this.yy = yy || this.yy || {};
12733 this._input = input;
12734 this._more = this._backtrack = this.done = false;
12735 this.yylineno = this.yyleng = 0;
12736 this.yytext = this.matched = this.match = '';
12737 this.conditionStack = ['INITIAL'];
12738 this.yylloc = {
12739 first_line: 1,
12740 first_column: 0,
12741 last_line: 1,
12742 last_column: 0
12743 };
12744 if (this.options.ranges) {
12745 this.yylloc.range = [0,0];
12746 }
12747 this.offset = 0;
12748 return this;
12749 },
12750
12751// consumes and returns one char from the input
12752input:function () {
12753 var ch = this._input[0];
12754 this.yytext += ch;
12755 this.yyleng++;
12756 this.offset++;
12757 this.match += ch;
12758 this.matched += ch;
12759 var lines = ch.match(/(?:\r\n?|\n).*/g);
12760 if (lines) {
12761 this.yylineno++;
12762 this.yylloc.last_line++;
12763 } else {
12764 this.yylloc.last_column++;
12765 }
12766 if (this.options.ranges) {
12767 this.yylloc.range[1]++;
12768 }
12769
12770 this._input = this._input.slice(1);
12771 return ch;
12772 },
12773
12774// unshifts one char (or a string) into the input
12775unput:function (ch) {
12776 var len = ch.length;
12777 var lines = ch.split(/(?:\r\n?|\n)/g);
12778
12779 this._input = ch + this._input;
12780 this.yytext = this.yytext.substr(0, this.yytext.length - len);
12781 //this.yyleng -= len;
12782 this.offset -= len;
12783 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
12784 this.match = this.match.substr(0, this.match.length - 1);
12785 this.matched = this.matched.substr(0, this.matched.length - 1);
12786
12787 if (lines.length - 1) {
12788 this.yylineno -= lines.length - 1;
12789 }
12790 var r = this.yylloc.range;
12791
12792 this.yylloc = {
12793 first_line: this.yylloc.first_line,
12794 last_line: this.yylineno + 1,
12795 first_column: this.yylloc.first_column,
12796 last_column: lines ?
12797 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
12798 + oldLines[oldLines.length - lines.length].length - lines[0].length :
12799 this.yylloc.first_column - len
12800 };
12801
12802 if (this.options.ranges) {
12803 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
12804 }
12805 this.yyleng = this.yytext.length;
12806 return this;
12807 },
12808
12809// When called from action, caches matched text and appends it on next action
12810more:function () {
12811 this._more = true;
12812 return this;
12813 },
12814
12815// 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.
12816reject:function () {
12817 if (this.options.backtrack_lexer) {
12818 this._backtrack = true;
12819 } else {
12820 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(), {
12821 text: "",
12822 token: null,
12823 line: this.yylineno
12824 });
12825
12826 }
12827 return this;
12828 },
12829
12830// retain first n characters of the match
12831less:function (n) {
12832 this.unput(this.match.slice(n));
12833 },
12834
12835// displays already matched input, i.e. for error messages
12836pastInput:function () {
12837 var past = this.matched.substr(0, this.matched.length - this.match.length);
12838 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
12839 },
12840
12841// displays upcoming input, i.e. for error messages
12842upcomingInput:function () {
12843 var next = this.match;
12844 if (next.length < 20) {
12845 next += this._input.substr(0, 20-next.length);
12846 }
12847 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
12848 },
12849
12850// displays the character position where the lexing error occurred, i.e. for error messages
12851showPosition:function () {
12852 var pre = this.pastInput();
12853 var c = new Array(pre.length + 1).join("-");
12854 return pre + this.upcomingInput() + "\n" + c + "^";
12855 },
12856
12857// test the lexed token: return FALSE when not a match, otherwise return token
12858test_match:function(match, indexed_rule) {
12859 var token,
12860 lines,
12861 backup;
12862
12863 if (this.options.backtrack_lexer) {
12864 // save context
12865 backup = {
12866 yylineno: this.yylineno,
12867 yylloc: {
12868 first_line: this.yylloc.first_line,
12869 last_line: this.last_line,
12870 first_column: this.yylloc.first_column,
12871 last_column: this.yylloc.last_column
12872 },
12873 yytext: this.yytext,
12874 match: this.match,
12875 matches: this.matches,
12876 matched: this.matched,
12877 yyleng: this.yyleng,
12878 offset: this.offset,
12879 _more: this._more,
12880 _input: this._input,
12881 yy: this.yy,
12882 conditionStack: this.conditionStack.slice(0),
12883 done: this.done
12884 };
12885 if (this.options.ranges) {
12886 backup.yylloc.range = this.yylloc.range.slice(0);
12887 }
12888 }
12889
12890 lines = match[0].match(/(?:\r\n?|\n).*/g);
12891 if (lines) {
12892 this.yylineno += lines.length;
12893 }
12894 this.yylloc = {
12895 first_line: this.yylloc.last_line,
12896 last_line: this.yylineno + 1,
12897 first_column: this.yylloc.last_column,
12898 last_column: lines ?
12899 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
12900 this.yylloc.last_column + match[0].length
12901 };
12902 this.yytext += match[0];
12903 this.match += match[0];
12904 this.matches = match;
12905 this.yyleng = this.yytext.length;
12906 if (this.options.ranges) {
12907 this.yylloc.range = [this.offset, this.offset += this.yyleng];
12908 }
12909 this._more = false;
12910 this._backtrack = false;
12911 this._input = this._input.slice(match[0].length);
12912 this.matched += match[0];
12913 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
12914 if (this.done && this._input) {
12915 this.done = false;
12916 }
12917 if (token) {
12918 return token;
12919 } else if (this._backtrack) {
12920 // recover context
12921 for (var k in backup) {
12922 this[k] = backup[k];
12923 }
12924 return false; // rule action called reject() implying the next rule should be tested instead.
12925 }
12926 return false;
12927 },
12928
12929// return next match in input
12930next:function () {
12931 if (this.done) {
12932 return this.EOF;
12933 }
12934 if (!this._input) {
12935 this.done = true;
12936 }
12937
12938 var token,
12939 match,
12940 tempMatch,
12941 index;
12942 if (!this._more) {
12943 this.yytext = '';
12944 this.match = '';
12945 }
12946 var rules = this._currentRules();
12947 for (var i = 0; i < rules.length; i++) {
12948 tempMatch = this._input.match(this.rules[rules[i]]);
12949 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
12950 match = tempMatch;
12951 index = i;
12952 if (this.options.backtrack_lexer) {
12953 token = this.test_match(tempMatch, rules[i]);
12954 if (token !== false) {
12955 return token;
12956 } else if (this._backtrack) {
12957 match = false;
12958 continue; // rule action called reject() implying a rule MISmatch.
12959 } else {
12960 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
12961 return false;
12962 }
12963 } else if (!this.options.flex) {
12964 break;
12965 }
12966 }
12967 }
12968 if (match) {
12969 token = this.test_match(match, rules[index]);
12970 if (token !== false) {
12971 return token;
12972 }
12973 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
12974 return false;
12975 }
12976 if (this._input === "") {
12977 return this.EOF;
12978 } else {
12979 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
12980 text: "",
12981 token: null,
12982 line: this.yylineno
12983 });
12984 }
12985 },
12986
12987// return next match that has a token
12988lex:function lex () {
12989 var r = this.next();
12990 if (r) {
12991 return r;
12992 } else {
12993 return this.lex();
12994 }
12995 },
12996
12997// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
12998begin:function begin (condition) {
12999 this.conditionStack.push(condition);
13000 },
13001
13002// pop the previously active lexer condition state off the condition stack
13003popState:function popState () {
13004 var n = this.conditionStack.length - 1;
13005 if (n > 0) {
13006 return this.conditionStack.pop();
13007 } else {
13008 return this.conditionStack[0];
13009 }
13010 },
13011
13012// produce the lexer rule set which is active for the currently active lexer condition state
13013_currentRules:function _currentRules () {
13014 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
13015 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
13016 } else {
13017 return this.conditions["INITIAL"].rules;
13018 }
13019 },
13020
13021// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
13022topState:function topState (n) {
13023 n = this.conditionStack.length - 1 - Math.abs(n || 0);
13024 if (n >= 0) {
13025 return this.conditionStack[n];
13026 } else {
13027 return "INITIAL";
13028 }
13029 },
13030
13031// alias for begin(condition)
13032pushState:function pushState (condition) {
13033 this.begin(condition);
13034 },
13035
13036// return the number of states currently on the stack
13037stateStackSize:function stateStackSize() {
13038 return this.conditionStack.length;
13039 },
13040options: {"case-insensitive":true},
13041performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
13042var YYSTATE=YY_START;
13043switch($avoiding_name_collisions) {
13044case 0: this.begin('open_directive'); return 32;
13045break;
13046case 1: this.begin('type_directive'); return 33;
13047break;
13048case 2: this.popState(); this.begin('arg_directive'); return 25;
13049break;
13050case 3: this.popState(); this.popState(); return 35;
13051break;
13052case 4:return 34;
13053break;
13054case 5:/* skip comments */
13055break;
13056case 6:/* skip comments */
13057break;
13058case 7:/* do nothing */
13059break;
13060case 8:return 11;
13061break;
13062case 9:/* skip whitespace */
13063break;
13064case 10:/* skip comments */
13065break;
13066case 11:/* skip comments */
13067break;
13068case 12:this.begin("href");
13069break;
13070case 13:this.popState();
13071break;
13072case 14:return 30;
13073break;
13074case 15:this.begin("callbackname");
13075break;
13076case 16:this.popState();
13077break;
13078case 17:this.popState(); this.begin("callbackargs");
13079break;
13080case 18:return 28;
13081break;
13082case 19:this.popState();
13083break;
13084case 20:return 29;
13085break;
13086case 21:this.begin("click");
13087break;
13088case 22:this.popState();
13089break;
13090case 23:return 27;
13091break;
13092case 24:return 5;
13093break;
13094case 25:return 12;
13095break;
13096case 26:return 13;
13097break;
13098case 27:return 14;
13099break;
13100case 28:return 15;
13101break;
13102case 29:return 16;
13103break;
13104case 30:return 'date';
13105break;
13106case 31:return 17;
13107break;
13108case 32:return 18;
13109break;
13110case 33:return 20;
13111break;
13112case 34:return 21;
13113break;
13114case 35:return 25;
13115break;
13116case 36:return 7;
13117break;
13118case 37:return 'INVALID';
13119break;
13120}
13121},
13122rules: [/^(?:%%\{)/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],
13123conditions: {"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}}
13124});
13125return lexer;
13126})();
13127parser.lexer = lexer;
13128function Parser () {
13129 this.yy = {};
13130}
13131Parser.prototype = parser;parser.Parser = Parser;
13132return new Parser;
13133})();
13134
13135
13136if (true) {
13137exports.parser = parser;
13138exports.Parser = parser.Parser;
13139exports.parse = function () { return parser.parse.apply(parser, arguments); };
13140exports.main = function commonjsMain (args) {
13141 if (!args[1]) {
13142 console.log('Usage: '+args[0]+' FILE');
13143 process.exit(1);
13144 }
13145 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");
13146 return exports.parser.parse(source);
13147};
13148if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
13149 exports.main(process.argv.slice(1));
13150}
13151}
13152/* 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)))
13153
13154/***/ }),
13155
13156/***/ "./src/diagrams/gantt/styles.js":
13157/*!**************************************!*\
13158 !*** ./src/diagrams/gantt/styles.js ***!
13159 \**************************************/
13160/*! exports provided: default */
13161/***/ (function(module, __webpack_exports__, __webpack_require__) {
13162
13163"use strict";
13164__webpack_require__.r(__webpack_exports__);
13165var getStyles = function getStyles(options) {
13166 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");
13167};
13168
13169/* harmony default export */ __webpack_exports__["default"] = (getStyles);
13170
13171/***/ }),
13172
13173/***/ "./src/diagrams/git/gitGraphAst.js":
13174/*!*****************************************!*\
13175 !*** ./src/diagrams/git/gitGraphAst.js ***!
13176 \*****************************************/
13177/*! exports provided: setDirection, setOptions, getOptions, commit, branch, merge, checkout, reset, prettyPrint, clear, getBranchesAsObjArray, getBranches, getCommits, getCommitsArray, getCurrentBranch, getDirection, getHead, default */
13178/***/ (function(module, __webpack_exports__, __webpack_require__) {
13179
13180"use strict";
13181__webpack_require__.r(__webpack_exports__);
13182/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setDirection", function() { return setDirection; });
13183/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setOptions", function() { return setOptions; });
13184/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getOptions", function() { return getOptions; });
13185/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "commit", function() { return commit; });
13186/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "branch", function() { return branch; });
13187/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return merge; });
13188/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkout", function() { return checkout; });
13189/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reset", function() { return reset; });
13190/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prettyPrint", function() { return prettyPrint; });
13191/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
13192/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBranchesAsObjArray", function() { return getBranchesAsObjArray; });
13193/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBranches", function() { return getBranches; });
13194/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCommits", function() { return getCommits; });
13195/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCommitsArray", function() { return getCommitsArray; });
13196/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCurrentBranch", function() { return getCurrentBranch; });
13197/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDirection", function() { return getDirection; });
13198/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHead", function() { return getHead; });
13199/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
13200/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
13201
13202
13203var commits = {};
13204var head = null;
13205var branches = {
13206 master: head
13207};
13208var curBranch = 'master';
13209var direction = 'LR';
13210var seq = 0;
13211
13212function getId() {
13213 return Object(_utils__WEBPACK_IMPORTED_MODULE_1__["random"])({
13214 length: 7
13215 });
13216}
13217
13218function isfastforwardable(currentCommit, otherCommit) {
13219 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Entering isfastforwardable:', currentCommit.id, otherCommit.id);
13220
13221 while (currentCommit.seq <= otherCommit.seq && currentCommit !== otherCommit) {
13222 // only if other branch has more commits
13223 if (otherCommit.parent == null) break;
13224
13225 if (Array.isArray(otherCommit.parent)) {
13226 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('In merge commit:', otherCommit.parent);
13227 return isfastforwardable(currentCommit, commits[otherCommit.parent[0]]) || isfastforwardable(currentCommit, commits[otherCommit.parent[1]]);
13228 } else {
13229 otherCommit = commits[otherCommit.parent];
13230 }
13231 }
13232
13233 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(currentCommit.id, otherCommit.id);
13234 return currentCommit.id === otherCommit.id;
13235}
13236
13237function isReachableFrom(currentCommit, otherCommit) {
13238 var currentSeq = currentCommit.seq;
13239 var otherSeq = otherCommit.seq;
13240 if (currentSeq > otherSeq) return isfastforwardable(otherCommit, currentCommit);
13241 return false;
13242}
13243
13244function uniqBy(list, fn) {
13245 var recordMap = Object.create(null);
13246 return list.reduce(function (out, item) {
13247 var key = fn(item);
13248
13249 if (!recordMap[key]) {
13250 recordMap[key] = true;
13251 out.push(item);
13252 }
13253
13254 return out;
13255 }, []);
13256}
13257
13258var setDirection = function setDirection(dir) {
13259 direction = dir;
13260};
13261var options = {};
13262var setOptions = function setOptions(rawOptString) {
13263 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('options str', rawOptString);
13264 rawOptString = rawOptString && rawOptString.trim();
13265 rawOptString = rawOptString || '{}';
13266
13267 try {
13268 options = JSON.parse(rawOptString);
13269 } catch (e) {
13270 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].error('error while parsing gitGraph options', e.message);
13271 }
13272};
13273var getOptions = function getOptions() {
13274 return options;
13275};
13276var commit = function commit(msg) {
13277 var commit = {
13278 id: getId(),
13279 message: msg,
13280 seq: seq++,
13281 parent: head == null ? null : head.id
13282 };
13283 head = commit;
13284 commits[commit.id] = commit;
13285 branches[curBranch] = commit.id;
13286 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('in pushCommit ' + commit.id);
13287};
13288var branch = function branch(name) {
13289 branches[name] = head != null ? head.id : null;
13290 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('in createBranch');
13291};
13292var merge = function merge(otherBranch) {
13293 var currentCommit = commits[branches[curBranch]];
13294 var otherCommit = commits[branches[otherBranch]];
13295
13296 if (isReachableFrom(currentCommit, otherCommit)) {
13297 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Already merged');
13298 return;
13299 }
13300
13301 if (isfastforwardable(currentCommit, otherCommit)) {
13302 branches[curBranch] = branches[otherBranch];
13303 head = commits[branches[curBranch]];
13304 } else {
13305 // create merge commit
13306 var _commit = {
13307 id: getId(),
13308 message: 'merged branch ' + otherBranch + ' into ' + curBranch,
13309 seq: seq++,
13310 parent: [head == null ? null : head.id, branches[otherBranch]]
13311 };
13312 head = _commit;
13313 commits[_commit.id] = _commit;
13314 branches[curBranch] = _commit.id;
13315 }
13316
13317 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(branches);
13318 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('in mergeBranch');
13319};
13320var checkout = function checkout(branch) {
13321 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('in checkout');
13322 curBranch = branch;
13323 var id = branches[curBranch];
13324 head = commits[id];
13325};
13326var reset = function reset(commitRef) {
13327 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('in reset', commitRef);
13328 var ref = commitRef.split(':')[0];
13329 var parentCount = parseInt(commitRef.split(':')[1]);
13330 var commit = ref === 'HEAD' ? head : commits[branches[ref]];
13331 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(commit, parentCount);
13332
13333 while (parentCount > 0) {
13334 commit = commits[commit.parent];
13335 parentCount--;
13336
13337 if (!commit) {
13338 var err = 'Critical error - unique parent commit not found during reset';
13339 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].error(err);
13340 throw err;
13341 }
13342 }
13343
13344 head = commit;
13345 branches[curBranch] = commit.id;
13346};
13347
13348function upsert(arr, key, newval) {
13349 var index = arr.indexOf(key);
13350
13351 if (index === -1) {
13352 arr.push(newval);
13353 } else {
13354 arr.splice(index, 1, newval);
13355 }
13356}
13357
13358function prettyPrintCommitHistory(commitArr) {
13359 var commit = commitArr.reduce(function (out, commit) {
13360 if (out.seq > commit.seq) return out;
13361 return commit;
13362 }, commitArr[0]);
13363 var line = '';
13364 commitArr.forEach(function (c) {
13365 if (c === commit) {
13366 line += '\t*';
13367 } else {
13368 line += '\t|';
13369 }
13370 });
13371 var label = [line, commit.id, commit.seq];
13372
13373 for (var _branch in branches) {
13374 if (branches[_branch] === commit.id) label.push(_branch);
13375 }
13376
13377 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(label.join(' '));
13378
13379 if (Array.isArray(commit.parent)) {
13380 var newCommit = commits[commit.parent[0]];
13381 upsert(commitArr, commit, newCommit);
13382 commitArr.push(commits[commit.parent[1]]);
13383 } else if (commit.parent == null) {
13384 return;
13385 } else {
13386 var nextCommit = commits[commit.parent];
13387 upsert(commitArr, commit, nextCommit);
13388 }
13389
13390 commitArr = uniqBy(commitArr, function (c) {
13391 return c.id;
13392 });
13393 prettyPrintCommitHistory(commitArr);
13394}
13395
13396var prettyPrint = function prettyPrint() {
13397 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(commits);
13398 var node = getCommitsArray()[0];
13399 prettyPrintCommitHistory([node]);
13400};
13401var clear = function clear() {
13402 commits = {};
13403 head = null;
13404 branches = {
13405 master: head
13406 };
13407 curBranch = 'master';
13408 seq = 0;
13409};
13410var getBranchesAsObjArray = function getBranchesAsObjArray() {
13411 var branchArr = [];
13412
13413 for (var _branch2 in branches) {
13414 branchArr.push({
13415 name: _branch2,
13416 commit: commits[branches[_branch2]]
13417 });
13418 }
13419
13420 return branchArr;
13421};
13422var getBranches = function getBranches() {
13423 return branches;
13424};
13425var getCommits = function getCommits() {
13426 return commits;
13427};
13428var getCommitsArray = function getCommitsArray() {
13429 var commitArr = Object.keys(commits).map(function (key) {
13430 return commits[key];
13431 });
13432 commitArr.forEach(function (o) {
13433 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug(o.id);
13434 });
13435 commitArr.sort(function (a, b) {
13436 return b.seq - a.seq;
13437 });
13438 return commitArr;
13439};
13440var getCurrentBranch = function getCurrentBranch() {
13441 return curBranch;
13442};
13443var getDirection = function getDirection() {
13444 return direction;
13445};
13446var getHead = function getHead() {
13447 return head;
13448};
13449/* harmony default export */ __webpack_exports__["default"] = ({
13450 setDirection: setDirection,
13451 setOptions: setOptions,
13452 getOptions: getOptions,
13453 commit: commit,
13454 branch: branch,
13455 merge: merge,
13456 checkout: checkout,
13457 reset: reset,
13458 prettyPrint: prettyPrint,
13459 clear: clear,
13460 getBranchesAsObjArray: getBranchesAsObjArray,
13461 getBranches: getBranches,
13462 getCommits: getCommits,
13463 getCommitsArray: getCommitsArray,
13464 getCurrentBranch: getCurrentBranch,
13465 getDirection: getDirection,
13466 getHead: getHead
13467});
13468
13469/***/ }),
13470
13471/***/ "./src/diagrams/git/gitGraphRenderer.js":
13472/*!**********************************************!*\
13473 !*** ./src/diagrams/git/gitGraphRenderer.js ***!
13474 \**********************************************/
13475/*! exports provided: setConf, draw, default */
13476/***/ (function(module, __webpack_exports__, __webpack_require__) {
13477
13478"use strict";
13479__webpack_require__.r(__webpack_exports__);
13480/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
13481/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
13482/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
13483/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
13484/* harmony import */ var _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./gitGraphAst */ "./src/diagrams/git/gitGraphAst.js");
13485/* harmony import */ var _parser_gitGraph__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./parser/gitGraph */ "./src/diagrams/git/parser/gitGraph.jison");
13486/* harmony import */ var _parser_gitGraph__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_parser_gitGraph__WEBPACK_IMPORTED_MODULE_2__);
13487/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
13488/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
13489
13490
13491
13492
13493
13494var allCommitsDict = {};
13495var branchNum;
13496var config = {
13497 nodeSpacing: 150,
13498 nodeFillColor: 'yellow',
13499 nodeStrokeWidth: 2,
13500 nodeStrokeColor: 'grey',
13501 lineStrokeWidth: 4,
13502 branchOffset: 50,
13503 lineColor: 'grey',
13504 leftMargin: 50,
13505 branchColors: ['#442f74', '#983351', '#609732', '#AA9A39'],
13506 nodeRadius: 10,
13507 nodeLabel: {
13508 width: 75,
13509 height: 100,
13510 x: -25,
13511 y: 0
13512 }
13513};
13514var apiConfig = {};
13515var setConf = function setConf(c) {
13516 apiConfig = c;
13517};
13518
13519function svgCreateDefs(svg) {
13520 svg.append('defs').append('g').attr('id', 'def-commit').append('circle').attr('r', config.nodeRadius).attr('cx', 0).attr('cy', 0);
13521 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('');
13522}
13523
13524function svgDrawLine(svg, points, colorIdx, interpolate) {
13525 var curve = Object(_utils__WEBPACK_IMPORTED_MODULE_4__["interpolateToCurve"])(interpolate, d3__WEBPACK_IMPORTED_MODULE_0__["curveBasis"]);
13526 var color = config.branchColors[colorIdx % config.branchColors.length];
13527 var lineGen = Object(d3__WEBPACK_IMPORTED_MODULE_0__["line"])().x(function (d) {
13528 return Math.round(d.x);
13529 }).y(function (d) {
13530 return Math.round(d.y);
13531 }).curve(curve);
13532 svg.append('svg:path').attr('d', lineGen(points)).style('stroke', color).style('stroke-width', config.lineStrokeWidth).style('fill', 'none');
13533} // Pass in the element and its pre-transform coords
13534
13535
13536function getElementCoords(element, coords) {
13537 coords = coords || element.node().getBBox();
13538 var ctm = element.node().getCTM();
13539 var xn = ctm.e + coords.x * ctm.a;
13540 var yn = ctm.f + coords.y * ctm.d;
13541 return {
13542 left: xn,
13543 top: yn,
13544 width: coords.width,
13545 height: coords.height
13546 };
13547}
13548
13549function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
13550 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('svgDrawLineForCommits: ', fromId, toId);
13551 var fromBbox = getElementCoords(svg.select('#node-' + fromId + ' circle'));
13552 var toBbox = getElementCoords(svg.select('#node-' + toId + ' circle'));
13553
13554 switch (direction) {
13555 case 'LR':
13556 // (toBbox)
13557 // +--------
13558 // + (fromBbox)
13559 if (fromBbox.left - toBbox.left > config.nodeSpacing) {
13560 var lineStart = {
13561 x: fromBbox.left - config.nodeSpacing,
13562 y: toBbox.top + toBbox.height / 2
13563 };
13564 var lineEnd = {
13565 x: toBbox.left + toBbox.width,
13566 y: toBbox.top + toBbox.height / 2
13567 };
13568 svgDrawLine(svg, [lineStart, lineEnd], color, 'linear');
13569 svgDrawLine(svg, [{
13570 x: fromBbox.left,
13571 y: fromBbox.top + fromBbox.height / 2
13572 }, {
13573 x: fromBbox.left - config.nodeSpacing / 2,
13574 y: fromBbox.top + fromBbox.height / 2
13575 }, {
13576 x: fromBbox.left - config.nodeSpacing / 2,
13577 y: lineStart.y
13578 }, lineStart], color);
13579 } else {
13580 svgDrawLine(svg, [{
13581 x: fromBbox.left,
13582 y: fromBbox.top + fromBbox.height / 2
13583 }, {
13584 x: fromBbox.left - config.nodeSpacing / 2,
13585 y: fromBbox.top + fromBbox.height / 2
13586 }, {
13587 x: fromBbox.left - config.nodeSpacing / 2,
13588 y: toBbox.top + toBbox.height / 2
13589 }, {
13590 x: toBbox.left + toBbox.width,
13591 y: toBbox.top + toBbox.height / 2
13592 }], color);
13593 }
13594
13595 break;
13596
13597 case 'BT':
13598 // + (fromBbox)
13599 // |
13600 // |
13601 // + (toBbox)
13602 if (toBbox.top - fromBbox.top > config.nodeSpacing) {
13603 var _lineStart = {
13604 x: toBbox.left + toBbox.width / 2,
13605 y: fromBbox.top + fromBbox.height + config.nodeSpacing
13606 };
13607 var _lineEnd = {
13608 x: toBbox.left + toBbox.width / 2,
13609 y: toBbox.top
13610 };
13611 svgDrawLine(svg, [_lineStart, _lineEnd], color, 'linear');
13612 svgDrawLine(svg, [{
13613 x: fromBbox.left + fromBbox.width / 2,
13614 y: fromBbox.top + fromBbox.height
13615 }, {
13616 x: fromBbox.left + fromBbox.width / 2,
13617 y: fromBbox.top + fromBbox.height + config.nodeSpacing / 2
13618 }, {
13619 x: toBbox.left + toBbox.width / 2,
13620 y: _lineStart.y - config.nodeSpacing / 2
13621 }, _lineStart], color);
13622 } else {
13623 svgDrawLine(svg, [{
13624 x: fromBbox.left + fromBbox.width / 2,
13625 y: fromBbox.top + fromBbox.height
13626 }, {
13627 x: fromBbox.left + fromBbox.width / 2,
13628 y: fromBbox.top + config.nodeSpacing / 2
13629 }, {
13630 x: toBbox.left + toBbox.width / 2,
13631 y: toBbox.top - config.nodeSpacing / 2
13632 }, {
13633 x: toBbox.left + toBbox.width / 2,
13634 y: toBbox.top
13635 }], color);
13636 }
13637
13638 break;
13639 }
13640}
13641
13642function cloneNode(svg, selector) {
13643 return svg.select(selector).node().cloneNode(true);
13644}
13645
13646function renderCommitHistory(svg, commitid, branches, direction) {
13647 var commit;
13648 var numCommits = Object.keys(allCommitsDict).length;
13649
13650 if (typeof commitid === 'string') {
13651 do {
13652 commit = allCommitsDict[commitid];
13653 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('in renderCommitHistory', commit.id, commit.seq);
13654
13655 if (svg.select('#node-' + commitid).size() > 0) {
13656 return;
13657 }
13658
13659 svg.append(function () {
13660 return cloneNode(svg, '#def-commit');
13661 }).attr('class', 'commit').attr('id', function () {
13662 return 'node-' + commit.id;
13663 }).attr('transform', function () {
13664 switch (direction) {
13665 case 'LR':
13666 return 'translate(' + (commit.seq * config.nodeSpacing + config.leftMargin) + ', ' + branchNum * config.branchOffset + ')';
13667
13668 case 'BT':
13669 return 'translate(' + (branchNum * config.branchOffset + config.leftMargin) + ', ' + (numCommits - commit.seq) * config.nodeSpacing + ')';
13670 }
13671 }).attr('fill', config.nodeFillColor).attr('stroke', config.nodeStrokeColor).attr('stroke-width', config.nodeStrokeWidth);
13672 var branch = void 0;
13673
13674 for (var branchName in branches) {
13675 if (branches[branchName].commit === commit) {
13676 branch = branches[branchName];
13677 break;
13678 }
13679 }
13680
13681 if (branch) {
13682 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('found branch ', branch.name);
13683 svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'branch-label').text(branch.name + ', ');
13684 }
13685
13686 svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'commit-id').text(commit.id);
13687
13688 if (commit.message !== '' && direction === 'BT') {
13689 svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'commit-msg').text(', ' + commit.message);
13690 }
13691
13692 commitid = commit.parent;
13693 } while (commitid && allCommitsDict[commitid]);
13694 }
13695
13696 if (Array.isArray(commitid)) {
13697 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('found merge commmit', commitid);
13698 renderCommitHistory(svg, commitid[0], branches, direction);
13699 branchNum++;
13700 renderCommitHistory(svg, commitid[1], branches, direction);
13701 branchNum--;
13702 }
13703}
13704
13705function renderLines(svg, commit, direction, branchColor) {
13706 branchColor = branchColor || 0;
13707
13708 while (commit.seq > 0 && !commit.lineDrawn) {
13709 if (typeof commit.parent === 'string') {
13710 svgDrawLineForCommits(svg, commit.id, commit.parent, direction, branchColor);
13711 commit.lineDrawn = true;
13712 commit = allCommitsDict[commit.parent];
13713 } else if (Array.isArray(commit.parent)) {
13714 svgDrawLineForCommits(svg, commit.id, commit.parent[0], direction, branchColor);
13715 svgDrawLineForCommits(svg, commit.id, commit.parent[1], direction, branchColor + 1);
13716 renderLines(svg, allCommitsDict[commit.parent[1]], direction, branchColor + 1);
13717 commit.lineDrawn = true;
13718 commit = allCommitsDict[commit.parent[0]];
13719 }
13720 }
13721}
13722
13723var draw = function draw(txt, id, ver) {
13724 try {
13725 var parser = _parser_gitGraph__WEBPACK_IMPORTED_MODULE_2___default.a.parser;
13726 parser.yy = _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__["default"];
13727 parser.yy.clear();
13728 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('in gitgraph renderer', txt + '\n', 'id:', id, ver); // Parse the graph definition
13729
13730 parser.parse(txt + '\n');
13731 config = Object.assign(config, apiConfig, _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__["default"].getOptions());
13732 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('effective options', config);
13733 var direction = _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__["default"].getDirection();
13734 allCommitsDict = _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__["default"].getCommits();
13735 var branches = _gitGraphAst__WEBPACK_IMPORTED_MODULE_1__["default"].getBranchesAsObjArray();
13736
13737 if (direction === 'BT') {
13738 config.nodeLabel.x = branches.length * config.branchOffset;
13739 config.nodeLabel.width = '100%';
13740 config.nodeLabel.y = -1 * 2 * config.nodeRadius;
13741 }
13742
13743 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id=\"".concat(id, "\"]"));
13744 svgCreateDefs(svg);
13745 branchNum = 1;
13746
13747 for (var branch in branches) {
13748 var v = branches[branch];
13749 renderCommitHistory(svg, v.commit.id, branches, direction);
13750 renderLines(svg, v.commit, direction);
13751 branchNum++;
13752 }
13753
13754 svg.attr('height', function () {
13755 if (direction === 'BT') return Object.keys(allCommitsDict).length * config.nodeSpacing;
13756 return (branches.length + 1) * config.branchOffset;
13757 });
13758 } catch (e) {
13759 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error('Error while rendering gitgraph');
13760 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error(e.message);
13761 }
13762};
13763/* harmony default export */ __webpack_exports__["default"] = ({
13764 setConf: setConf,
13765 draw: draw
13766});
13767
13768/***/ }),
13769
13770/***/ "./src/diagrams/git/parser/gitGraph.jison":
13771/*!************************************************!*\
13772 !*** ./src/diagrams/git/parser/gitGraph.jison ***!
13773 \************************************************/
13774/*! no static exports found */
13775/***/ (function(module, exports, __webpack_require__) {
13776
13777/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
13778/*
13779 Returns a Parser object of the following structure:
13780
13781 Parser: {
13782 yy: {}
13783 }
13784
13785 Parser.prototype: {
13786 yy: {},
13787 trace: function(),
13788 symbols_: {associative list: name ==> number},
13789 terminals_: {associative list: number ==> name},
13790 productions_: [...],
13791 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
13792 table: [...],
13793 defaultActions: {...},
13794 parseError: function(str, hash),
13795 parse: function(input),
13796
13797 lexer: {
13798 EOF: 1,
13799 parseError: function(str, hash),
13800 setInput: function(input),
13801 input: function(),
13802 unput: function(str),
13803 more: function(),
13804 less: function(n),
13805 pastInput: function(),
13806 upcomingInput: function(),
13807 showPosition: function(),
13808 test_match: function(regex_match_array, rule_index),
13809 next: function(),
13810 lex: function(),
13811 begin: function(condition),
13812 popState: function(),
13813 _currentRules: function(),
13814 topState: function(),
13815 pushState: function(condition),
13816
13817 options: {
13818 ranges: boolean (optional: true ==> token location info will include a .range[] member)
13819 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
13820 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)
13821 },
13822
13823 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
13824 rules: [...],
13825 conditions: {associative list: name ==> set},
13826 }
13827 }
13828
13829
13830 token location info (@$, _$, etc.): {
13831 first_line: n,
13832 last_line: n,
13833 first_column: n,
13834 last_column: n,
13835 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
13836 }
13837
13838
13839 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
13840 text: (matched text)
13841 token: (the produced terminal token, if any)
13842 line: (yylineno)
13843 }
13844 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
13845 loc: (yylloc)
13846 expected: (string describing the set of expected tokens)
13847 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
13848 }
13849*/
13850var parser = (function(){
13851var 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];
13852var parser = {trace: function trace () { },
13853yy: {},
13854symbols_: {"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},
13855terminals_: {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"},
13856productions_: [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]],
13857performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
13858/* this == yyval */
13859
13860var $0 = $$.length - 1;
13861switch (yystate) {
13862case 1:
13863 return $$[$0-1];
13864break;
13865case 2:
13866yy.setDirection($$[$0-3]); return $$[$0-1];
13867break;
13868case 4:
13869 yy.setOptions($$[$0-1]); this.$ = $$[$0]
13870break;
13871case 5:
13872$$[$0-1] +=$$[$0]; this.$=$$[$0-1]
13873break;
13874case 7:
13875this.$ = []
13876break;
13877case 8:
13878$$[$0-1].push($$[$0]); this.$=$$[$0-1];
13879break;
13880case 9:
13881this.$ =$$[$0-1]
13882break;
13883case 11:
13884yy.commit($$[$0])
13885break;
13886case 12:
13887yy.branch($$[$0])
13888break;
13889case 13:
13890yy.checkout($$[$0])
13891break;
13892case 14:
13893yy.merge($$[$0])
13894break;
13895case 15:
13896yy.reset($$[$0])
13897break;
13898case 16:
13899this.$ = ""
13900break;
13901case 17:
13902this.$=$$[$0]
13903break;
13904case 18:
13905this.$ = $$[$0-1]+ ":" + $$[$0]
13906break;
13907case 19:
13908this.$ = $$[$0-1]+ ":" + yy.count; yy.count = 0
13909break;
13910case 20:
13911yy.count = 0
13912break;
13913case 21:
13914 yy.count += 1
13915break;
13916}
13917},
13918table: [{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]}],
13919defaultActions: {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]},
13920parseError: function parseError (str, hash) {
13921 if (hash.recoverable) {
13922 this.trace(str);
13923 } else {
13924 var error = new Error(str);
13925 error.hash = hash;
13926 throw error;
13927 }
13928},
13929parse: function parse(input) {
13930 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
13931 var args = lstack.slice.call(arguments, 1);
13932 var lexer = Object.create(this.lexer);
13933 var sharedState = { yy: {} };
13934 for (var k in this.yy) {
13935 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
13936 sharedState.yy[k] = this.yy[k];
13937 }
13938 }
13939 lexer.setInput(input, sharedState.yy);
13940 sharedState.yy.lexer = lexer;
13941 sharedState.yy.parser = this;
13942 if (typeof lexer.yylloc == 'undefined') {
13943 lexer.yylloc = {};
13944 }
13945 var yyloc = lexer.yylloc;
13946 lstack.push(yyloc);
13947 var ranges = lexer.options && lexer.options.ranges;
13948 if (typeof sharedState.yy.parseError === 'function') {
13949 this.parseError = sharedState.yy.parseError;
13950 } else {
13951 this.parseError = Object.getPrototypeOf(this).parseError;
13952 }
13953 function popStack(n) {
13954 stack.length = stack.length - 2 * n;
13955 vstack.length = vstack.length - n;
13956 lstack.length = lstack.length - n;
13957 }
13958 function lex() {
13959 var token;
13960 token = tstack.pop() || lexer.lex() || EOF;
13961 if (typeof token !== 'number') {
13962 if (token instanceof Array) {
13963 tstack = token;
13964 token = tstack.pop();
13965 }
13966 token = self.symbols_[token] || token;
13967 }
13968 return token;
13969 }
13970 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
13971 while (true) {
13972 state = stack[stack.length - 1];
13973 if (this.defaultActions[state]) {
13974 action = this.defaultActions[state];
13975 } else {
13976 if (symbol === null || typeof symbol == 'undefined') {
13977 symbol = lex();
13978 }
13979 action = table[state] && table[state][symbol];
13980 }
13981 if (typeof action === 'undefined' || !action.length || !action[0]) {
13982 var errStr = '';
13983 expected = [];
13984 for (p in table[state]) {
13985 if (this.terminals_[p] && p > TERROR) {
13986 expected.push('\'' + this.terminals_[p] + '\'');
13987 }
13988 }
13989 if (lexer.showPosition) {
13990 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
13991 } else {
13992 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
13993 }
13994 this.parseError(errStr, {
13995 text: lexer.match,
13996 token: this.terminals_[symbol] || symbol,
13997 line: lexer.yylineno,
13998 loc: yyloc,
13999 expected: expected
14000 });
14001 }
14002 if (action[0] instanceof Array && action.length > 1) {
14003 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
14004 }
14005 switch (action[0]) {
14006 case 1:
14007 stack.push(symbol);
14008 vstack.push(lexer.yytext);
14009 lstack.push(lexer.yylloc);
14010 stack.push(action[1]);
14011 symbol = null;
14012 if (!preErrorSymbol) {
14013 yyleng = lexer.yyleng;
14014 yytext = lexer.yytext;
14015 yylineno = lexer.yylineno;
14016 yyloc = lexer.yylloc;
14017 if (recovering > 0) {
14018 recovering--;
14019 }
14020 } else {
14021 symbol = preErrorSymbol;
14022 preErrorSymbol = null;
14023 }
14024 break;
14025 case 2:
14026 len = this.productions_[action[1]][1];
14027 yyval.$ = vstack[vstack.length - len];
14028 yyval._$ = {
14029 first_line: lstack[lstack.length - (len || 1)].first_line,
14030 last_line: lstack[lstack.length - 1].last_line,
14031 first_column: lstack[lstack.length - (len || 1)].first_column,
14032 last_column: lstack[lstack.length - 1].last_column
14033 };
14034 if (ranges) {
14035 yyval._$.range = [
14036 lstack[lstack.length - (len || 1)].range[0],
14037 lstack[lstack.length - 1].range[1]
14038 ];
14039 }
14040 r = this.performAction.apply(yyval, [
14041 yytext,
14042 yyleng,
14043 yylineno,
14044 sharedState.yy,
14045 action[1],
14046 vstack,
14047 lstack
14048 ].concat(args));
14049 if (typeof r !== 'undefined') {
14050 return r;
14051 }
14052 if (len) {
14053 stack = stack.slice(0, -1 * len * 2);
14054 vstack = vstack.slice(0, -1 * len);
14055 lstack = lstack.slice(0, -1 * len);
14056 }
14057 stack.push(this.productions_[action[1]][0]);
14058 vstack.push(yyval.$);
14059 lstack.push(yyval._$);
14060 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
14061 stack.push(newState);
14062 break;
14063 case 3:
14064 return true;
14065 }
14066 }
14067 return true;
14068}};
14069/* generated by jison-lex 0.3.4 */
14070var lexer = (function(){
14071var lexer = ({
14072
14073EOF:1,
14074
14075parseError:function parseError(str, hash) {
14076 if (this.yy.parser) {
14077 this.yy.parser.parseError(str, hash);
14078 } else {
14079 throw new Error(str);
14080 }
14081 },
14082
14083// resets the lexer, sets new input
14084setInput:function (input, yy) {
14085 this.yy = yy || this.yy || {};
14086 this._input = input;
14087 this._more = this._backtrack = this.done = false;
14088 this.yylineno = this.yyleng = 0;
14089 this.yytext = this.matched = this.match = '';
14090 this.conditionStack = ['INITIAL'];
14091 this.yylloc = {
14092 first_line: 1,
14093 first_column: 0,
14094 last_line: 1,
14095 last_column: 0
14096 };
14097 if (this.options.ranges) {
14098 this.yylloc.range = [0,0];
14099 }
14100 this.offset = 0;
14101 return this;
14102 },
14103
14104// consumes and returns one char from the input
14105input:function () {
14106 var ch = this._input[0];
14107 this.yytext += ch;
14108 this.yyleng++;
14109 this.offset++;
14110 this.match += ch;
14111 this.matched += ch;
14112 var lines = ch.match(/(?:\r\n?|\n).*/g);
14113 if (lines) {
14114 this.yylineno++;
14115 this.yylloc.last_line++;
14116 } else {
14117 this.yylloc.last_column++;
14118 }
14119 if (this.options.ranges) {
14120 this.yylloc.range[1]++;
14121 }
14122
14123 this._input = this._input.slice(1);
14124 return ch;
14125 },
14126
14127// unshifts one char (or a string) into the input
14128unput:function (ch) {
14129 var len = ch.length;
14130 var lines = ch.split(/(?:\r\n?|\n)/g);
14131
14132 this._input = ch + this._input;
14133 this.yytext = this.yytext.substr(0, this.yytext.length - len);
14134 //this.yyleng -= len;
14135 this.offset -= len;
14136 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
14137 this.match = this.match.substr(0, this.match.length - 1);
14138 this.matched = this.matched.substr(0, this.matched.length - 1);
14139
14140 if (lines.length - 1) {
14141 this.yylineno -= lines.length - 1;
14142 }
14143 var r = this.yylloc.range;
14144
14145 this.yylloc = {
14146 first_line: this.yylloc.first_line,
14147 last_line: this.yylineno + 1,
14148 first_column: this.yylloc.first_column,
14149 last_column: lines ?
14150 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
14151 + oldLines[oldLines.length - lines.length].length - lines[0].length :
14152 this.yylloc.first_column - len
14153 };
14154
14155 if (this.options.ranges) {
14156 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
14157 }
14158 this.yyleng = this.yytext.length;
14159 return this;
14160 },
14161
14162// When called from action, caches matched text and appends it on next action
14163more:function () {
14164 this._more = true;
14165 return this;
14166 },
14167
14168// 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.
14169reject:function () {
14170 if (this.options.backtrack_lexer) {
14171 this._backtrack = true;
14172 } else {
14173 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(), {
14174 text: "",
14175 token: null,
14176 line: this.yylineno
14177 });
14178
14179 }
14180 return this;
14181 },
14182
14183// retain first n characters of the match
14184less:function (n) {
14185 this.unput(this.match.slice(n));
14186 },
14187
14188// displays already matched input, i.e. for error messages
14189pastInput:function () {
14190 var past = this.matched.substr(0, this.matched.length - this.match.length);
14191 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
14192 },
14193
14194// displays upcoming input, i.e. for error messages
14195upcomingInput:function () {
14196 var next = this.match;
14197 if (next.length < 20) {
14198 next += this._input.substr(0, 20-next.length);
14199 }
14200 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
14201 },
14202
14203// displays the character position where the lexing error occurred, i.e. for error messages
14204showPosition:function () {
14205 var pre = this.pastInput();
14206 var c = new Array(pre.length + 1).join("-");
14207 return pre + this.upcomingInput() + "\n" + c + "^";
14208 },
14209
14210// test the lexed token: return FALSE when not a match, otherwise return token
14211test_match:function(match, indexed_rule) {
14212 var token,
14213 lines,
14214 backup;
14215
14216 if (this.options.backtrack_lexer) {
14217 // save context
14218 backup = {
14219 yylineno: this.yylineno,
14220 yylloc: {
14221 first_line: this.yylloc.first_line,
14222 last_line: this.last_line,
14223 first_column: this.yylloc.first_column,
14224 last_column: this.yylloc.last_column
14225 },
14226 yytext: this.yytext,
14227 match: this.match,
14228 matches: this.matches,
14229 matched: this.matched,
14230 yyleng: this.yyleng,
14231 offset: this.offset,
14232 _more: this._more,
14233 _input: this._input,
14234 yy: this.yy,
14235 conditionStack: this.conditionStack.slice(0),
14236 done: this.done
14237 };
14238 if (this.options.ranges) {
14239 backup.yylloc.range = this.yylloc.range.slice(0);
14240 }
14241 }
14242
14243 lines = match[0].match(/(?:\r\n?|\n).*/g);
14244 if (lines) {
14245 this.yylineno += lines.length;
14246 }
14247 this.yylloc = {
14248 first_line: this.yylloc.last_line,
14249 last_line: this.yylineno + 1,
14250 first_column: this.yylloc.last_column,
14251 last_column: lines ?
14252 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
14253 this.yylloc.last_column + match[0].length
14254 };
14255 this.yytext += match[0];
14256 this.match += match[0];
14257 this.matches = match;
14258 this.yyleng = this.yytext.length;
14259 if (this.options.ranges) {
14260 this.yylloc.range = [this.offset, this.offset += this.yyleng];
14261 }
14262 this._more = false;
14263 this._backtrack = false;
14264 this._input = this._input.slice(match[0].length);
14265 this.matched += match[0];
14266 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
14267 if (this.done && this._input) {
14268 this.done = false;
14269 }
14270 if (token) {
14271 return token;
14272 } else if (this._backtrack) {
14273 // recover context
14274 for (var k in backup) {
14275 this[k] = backup[k];
14276 }
14277 return false; // rule action called reject() implying the next rule should be tested instead.
14278 }
14279 return false;
14280 },
14281
14282// return next match in input
14283next:function () {
14284 if (this.done) {
14285 return this.EOF;
14286 }
14287 if (!this._input) {
14288 this.done = true;
14289 }
14290
14291 var token,
14292 match,
14293 tempMatch,
14294 index;
14295 if (!this._more) {
14296 this.yytext = '';
14297 this.match = '';
14298 }
14299 var rules = this._currentRules();
14300 for (var i = 0; i < rules.length; i++) {
14301 tempMatch = this._input.match(this.rules[rules[i]]);
14302 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
14303 match = tempMatch;
14304 index = i;
14305 if (this.options.backtrack_lexer) {
14306 token = this.test_match(tempMatch, rules[i]);
14307 if (token !== false) {
14308 return token;
14309 } else if (this._backtrack) {
14310 match = false;
14311 continue; // rule action called reject() implying a rule MISmatch.
14312 } else {
14313 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
14314 return false;
14315 }
14316 } else if (!this.options.flex) {
14317 break;
14318 }
14319 }
14320 }
14321 if (match) {
14322 token = this.test_match(match, rules[index]);
14323 if (token !== false) {
14324 return token;
14325 }
14326 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
14327 return false;
14328 }
14329 if (this._input === "") {
14330 return this.EOF;
14331 } else {
14332 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
14333 text: "",
14334 token: null,
14335 line: this.yylineno
14336 });
14337 }
14338 },
14339
14340// return next match that has a token
14341lex:function lex () {
14342 var r = this.next();
14343 if (r) {
14344 return r;
14345 } else {
14346 return this.lex();
14347 }
14348 },
14349
14350// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
14351begin:function begin (condition) {
14352 this.conditionStack.push(condition);
14353 },
14354
14355// pop the previously active lexer condition state off the condition stack
14356popState:function popState () {
14357 var n = this.conditionStack.length - 1;
14358 if (n > 0) {
14359 return this.conditionStack.pop();
14360 } else {
14361 return this.conditionStack[0];
14362 }
14363 },
14364
14365// produce the lexer rule set which is active for the currently active lexer condition state
14366_currentRules:function _currentRules () {
14367 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
14368 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
14369 } else {
14370 return this.conditions["INITIAL"].rules;
14371 }
14372 },
14373
14374// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
14375topState:function topState (n) {
14376 n = this.conditionStack.length - 1 - Math.abs(n || 0);
14377 if (n >= 0) {
14378 return this.conditionStack[n];
14379 } else {
14380 return "INITIAL";
14381 }
14382 },
14383
14384// alias for begin(condition)
14385pushState:function pushState (condition) {
14386 this.begin(condition);
14387 },
14388
14389// return the number of states currently on the stack
14390stateStackSize:function stateStackSize() {
14391 return this.conditionStack.length;
14392 },
14393options: {"case-insensitive":true},
14394performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
14395var YYSTATE=YY_START;
14396switch($avoiding_name_collisions) {
14397case 0:return 12;
14398break;
14399case 1:/* skip all whitespace */
14400break;
14401case 2:/* skip comments */
14402break;
14403case 3:/* skip comments */
14404break;
14405case 4:return 4;
14406break;
14407case 5:return 15;
14408break;
14409case 6:return 17;
14410break;
14411case 7:return 20;
14412break;
14413case 8:return 21;
14414break;
14415case 9:return 19;
14416break;
14417case 10:return 8;
14418break;
14419case 11:return 8;
14420break;
14421case 12:return 5;
14422break;
14423case 13:return 26
14424break;
14425case 14:this.begin("options");
14426break;
14427case 15:this.popState();
14428break;
14429case 16:return 11;
14430break;
14431case 17:this.begin("string");
14432break;
14433case 18:this.popState();
14434break;
14435case 19:return 23;
14436break;
14437case 20:return 18;
14438break;
14439case 21:return 7;
14440break;
14441}
14442},
14443rules: [/^(?:(\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],
14444conditions: {"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}}
14445});
14446return lexer;
14447})();
14448parser.lexer = lexer;
14449function Parser () {
14450 this.yy = {};
14451}
14452Parser.prototype = parser;parser.Parser = Parser;
14453return new Parser;
14454})();
14455
14456
14457if (true) {
14458exports.parser = parser;
14459exports.Parser = parser.Parser;
14460exports.parse = function () { return parser.parse.apply(parser, arguments); };
14461exports.main = function commonjsMain (args) {
14462 if (!args[1]) {
14463 console.log('Usage: '+args[0]+' FILE');
14464 process.exit(1);
14465 }
14466 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");
14467 return exports.parser.parse(source);
14468};
14469if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
14470 exports.main(process.argv.slice(1));
14471}
14472}
14473/* 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)))
14474
14475/***/ }),
14476
14477/***/ "./src/diagrams/git/styles.js":
14478/*!************************************!*\
14479 !*** ./src/diagrams/git/styles.js ***!
14480 \************************************/
14481/*! exports provided: default */
14482/***/ (function(module, __webpack_exports__, __webpack_require__) {
14483
14484"use strict";
14485__webpack_require__.r(__webpack_exports__);
14486var getStyles = function getStyles() {
14487 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";
14488};
14489
14490/* harmony default export */ __webpack_exports__["default"] = (getStyles);
14491
14492/***/ }),
14493
14494/***/ "./src/diagrams/info/infoDb.js":
14495/*!*************************************!*\
14496 !*** ./src/diagrams/info/infoDb.js ***!
14497 \*************************************/
14498/*! exports provided: setMessage, getMessage, setInfo, getInfo, default */
14499/***/ (function(module, __webpack_exports__, __webpack_require__) {
14500
14501"use strict";
14502__webpack_require__.r(__webpack_exports__);
14503/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setMessage", function() { return setMessage; });
14504/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMessage", function() { return getMessage; });
14505/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setInfo", function() { return setInfo; });
14506/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getInfo", function() { return getInfo; });
14507/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
14508/**
14509 * Created by knut on 15-01-14.
14510 */
14511
14512var message = '';
14513var info = false;
14514var setMessage = function setMessage(txt) {
14515 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Setting message to: ' + txt);
14516 message = txt;
14517};
14518var getMessage = function getMessage() {
14519 return message;
14520};
14521var setInfo = function setInfo(inf) {
14522 info = inf;
14523};
14524var getInfo = function getInfo() {
14525 return info;
14526}; // export const parseError = (err, hash) => {
14527// global.mermaidAPI.parseError(err, hash)
14528// }
14529
14530/* harmony default export */ __webpack_exports__["default"] = ({
14531 setMessage: setMessage,
14532 getMessage: getMessage,
14533 setInfo: setInfo,
14534 getInfo: getInfo // parseError
14535
14536});
14537
14538/***/ }),
14539
14540/***/ "./src/diagrams/info/infoRenderer.js":
14541/*!*******************************************!*\
14542 !*** ./src/diagrams/info/infoRenderer.js ***!
14543 \*******************************************/
14544/*! exports provided: setConf, draw, default */
14545/***/ (function(module, __webpack_exports__, __webpack_require__) {
14546
14547"use strict";
14548__webpack_require__.r(__webpack_exports__);
14549/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
14550/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
14551/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
14552/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
14553/* harmony import */ var _infoDb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./infoDb */ "./src/diagrams/info/infoDb.js");
14554/* harmony import */ var _parser_info__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./parser/info */ "./src/diagrams/info/parser/info.jison");
14555/* harmony import */ var _parser_info__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_parser_info__WEBPACK_IMPORTED_MODULE_2__);
14556/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
14557/**
14558 * Created by knut on 14-12-11.
14559 */
14560
14561
14562
14563
14564var conf = {};
14565var setConf = function setConf(cnf) {
14566 var keys = Object.keys(cnf);
14567 keys.forEach(function (key) {
14568 conf[key] = cnf[key];
14569 });
14570};
14571/**
14572 * Draws a an info picture in the tag with id: id based on the graph definition in text.
14573 * @param text
14574 * @param id
14575 */
14576
14577var draw = function draw(txt, id, ver) {
14578 try {
14579 var parser = _parser_info__WEBPACK_IMPORTED_MODULE_2___default.a.parser;
14580 parser.yy = _infoDb__WEBPACK_IMPORTED_MODULE_1__["default"];
14581 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Renering info diagram\n' + txt); // Parse the graph definition
14582
14583 parser.parse(txt);
14584 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Parsed info diagram'); // Fetch the default direction, use TD if none was found
14585
14586 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + id);
14587 var g = svg.append('g');
14588 g.append('text') // text label for the x axis
14589 .attr('x', 100).attr('y', 40).attr('class', 'version').attr('font-size', '32px').style('text-anchor', 'middle').text('v ' + ver);
14590 svg.attr('height', 100);
14591 svg.attr('width', 400); // svg.attr('viewBox', '0 0 300 150');
14592 } catch (e) {
14593 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error('Error while rendering info diagram');
14594 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error(e.message);
14595 }
14596};
14597/* harmony default export */ __webpack_exports__["default"] = ({
14598 setConf: setConf,
14599 draw: draw
14600});
14601
14602/***/ }),
14603
14604/***/ "./src/diagrams/info/parser/info.jison":
14605/*!*********************************************!*\
14606 !*** ./src/diagrams/info/parser/info.jison ***!
14607 \*********************************************/
14608/*! no static exports found */
14609/***/ (function(module, exports, __webpack_require__) {
14610
14611/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
14612/*
14613 Returns a Parser object of the following structure:
14614
14615 Parser: {
14616 yy: {}
14617 }
14618
14619 Parser.prototype: {
14620 yy: {},
14621 trace: function(),
14622 symbols_: {associative list: name ==> number},
14623 terminals_: {associative list: number ==> name},
14624 productions_: [...],
14625 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
14626 table: [...],
14627 defaultActions: {...},
14628 parseError: function(str, hash),
14629 parse: function(input),
14630
14631 lexer: {
14632 EOF: 1,
14633 parseError: function(str, hash),
14634 setInput: function(input),
14635 input: function(),
14636 unput: function(str),
14637 more: function(),
14638 less: function(n),
14639 pastInput: function(),
14640 upcomingInput: function(),
14641 showPosition: function(),
14642 test_match: function(regex_match_array, rule_index),
14643 next: function(),
14644 lex: function(),
14645 begin: function(condition),
14646 popState: function(),
14647 _currentRules: function(),
14648 topState: function(),
14649 pushState: function(condition),
14650
14651 options: {
14652 ranges: boolean (optional: true ==> token location info will include a .range[] member)
14653 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
14654 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)
14655 },
14656
14657 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
14658 rules: [...],
14659 conditions: {associative list: name ==> set},
14660 }
14661 }
14662
14663
14664 token location info (@$, _$, etc.): {
14665 first_line: n,
14666 last_line: n,
14667 first_column: n,
14668 last_column: n,
14669 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
14670 }
14671
14672
14673 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
14674 text: (matched text)
14675 token: (the produced terminal token, if any)
14676 line: (yylineno)
14677 }
14678 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
14679 loc: (yylloc)
14680 expected: (string describing the set of expected tokens)
14681 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
14682 }
14683*/
14684var parser = (function(){
14685var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,9,10];
14686var parser = {trace: function trace () { },
14687yy: {},
14688symbols_: {"error":2,"start":3,"info":4,"document":5,"EOF":6,"line":7,"statement":8,"NL":9,"showInfo":10,"$accept":0,"$end":1},
14689terminals_: {2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},
14690productions_: [0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],
14691performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
14692/* this == yyval */
14693
14694var $0 = $$.length - 1;
14695switch (yystate) {
14696case 1:
14697 return yy;
14698break;
14699case 4:
14700
14701break;
14702case 6:
14703 yy.setInfo(true);
14704break;
14705}
14706},
14707table: [{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])],
14708defaultActions: {4:[2,1]},
14709parseError: function parseError (str, hash) {
14710 if (hash.recoverable) {
14711 this.trace(str);
14712 } else {
14713 var error = new Error(str);
14714 error.hash = hash;
14715 throw error;
14716 }
14717},
14718parse: function parse(input) {
14719 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
14720 var args = lstack.slice.call(arguments, 1);
14721 var lexer = Object.create(this.lexer);
14722 var sharedState = { yy: {} };
14723 for (var k in this.yy) {
14724 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
14725 sharedState.yy[k] = this.yy[k];
14726 }
14727 }
14728 lexer.setInput(input, sharedState.yy);
14729 sharedState.yy.lexer = lexer;
14730 sharedState.yy.parser = this;
14731 if (typeof lexer.yylloc == 'undefined') {
14732 lexer.yylloc = {};
14733 }
14734 var yyloc = lexer.yylloc;
14735 lstack.push(yyloc);
14736 var ranges = lexer.options && lexer.options.ranges;
14737 if (typeof sharedState.yy.parseError === 'function') {
14738 this.parseError = sharedState.yy.parseError;
14739 } else {
14740 this.parseError = Object.getPrototypeOf(this).parseError;
14741 }
14742 function popStack(n) {
14743 stack.length = stack.length - 2 * n;
14744 vstack.length = vstack.length - n;
14745 lstack.length = lstack.length - n;
14746 }
14747 function lex() {
14748 var token;
14749 token = tstack.pop() || lexer.lex() || EOF;
14750 if (typeof token !== 'number') {
14751 if (token instanceof Array) {
14752 tstack = token;
14753 token = tstack.pop();
14754 }
14755 token = self.symbols_[token] || token;
14756 }
14757 return token;
14758 }
14759 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
14760 while (true) {
14761 state = stack[stack.length - 1];
14762 if (this.defaultActions[state]) {
14763 action = this.defaultActions[state];
14764 } else {
14765 if (symbol === null || typeof symbol == 'undefined') {
14766 symbol = lex();
14767 }
14768 action = table[state] && table[state][symbol];
14769 }
14770 if (typeof action === 'undefined' || !action.length || !action[0]) {
14771 var errStr = '';
14772 expected = [];
14773 for (p in table[state]) {
14774 if (this.terminals_[p] && p > TERROR) {
14775 expected.push('\'' + this.terminals_[p] + '\'');
14776 }
14777 }
14778 if (lexer.showPosition) {
14779 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
14780 } else {
14781 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
14782 }
14783 this.parseError(errStr, {
14784 text: lexer.match,
14785 token: this.terminals_[symbol] || symbol,
14786 line: lexer.yylineno,
14787 loc: yyloc,
14788 expected: expected
14789 });
14790 }
14791 if (action[0] instanceof Array && action.length > 1) {
14792 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
14793 }
14794 switch (action[0]) {
14795 case 1:
14796 stack.push(symbol);
14797 vstack.push(lexer.yytext);
14798 lstack.push(lexer.yylloc);
14799 stack.push(action[1]);
14800 symbol = null;
14801 if (!preErrorSymbol) {
14802 yyleng = lexer.yyleng;
14803 yytext = lexer.yytext;
14804 yylineno = lexer.yylineno;
14805 yyloc = lexer.yylloc;
14806 if (recovering > 0) {
14807 recovering--;
14808 }
14809 } else {
14810 symbol = preErrorSymbol;
14811 preErrorSymbol = null;
14812 }
14813 break;
14814 case 2:
14815 len = this.productions_[action[1]][1];
14816 yyval.$ = vstack[vstack.length - len];
14817 yyval._$ = {
14818 first_line: lstack[lstack.length - (len || 1)].first_line,
14819 last_line: lstack[lstack.length - 1].last_line,
14820 first_column: lstack[lstack.length - (len || 1)].first_column,
14821 last_column: lstack[lstack.length - 1].last_column
14822 };
14823 if (ranges) {
14824 yyval._$.range = [
14825 lstack[lstack.length - (len || 1)].range[0],
14826 lstack[lstack.length - 1].range[1]
14827 ];
14828 }
14829 r = this.performAction.apply(yyval, [
14830 yytext,
14831 yyleng,
14832 yylineno,
14833 sharedState.yy,
14834 action[1],
14835 vstack,
14836 lstack
14837 ].concat(args));
14838 if (typeof r !== 'undefined') {
14839 return r;
14840 }
14841 if (len) {
14842 stack = stack.slice(0, -1 * len * 2);
14843 vstack = vstack.slice(0, -1 * len);
14844 lstack = lstack.slice(0, -1 * len);
14845 }
14846 stack.push(this.productions_[action[1]][0]);
14847 vstack.push(yyval.$);
14848 lstack.push(yyval._$);
14849 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
14850 stack.push(newState);
14851 break;
14852 case 3:
14853 return true;
14854 }
14855 }
14856 return true;
14857}};
14858
14859/* generated by jison-lex 0.3.4 */
14860var lexer = (function(){
14861var lexer = ({
14862
14863EOF:1,
14864
14865parseError:function parseError(str, hash) {
14866 if (this.yy.parser) {
14867 this.yy.parser.parseError(str, hash);
14868 } else {
14869 throw new Error(str);
14870 }
14871 },
14872
14873// resets the lexer, sets new input
14874setInput:function (input, yy) {
14875 this.yy = yy || this.yy || {};
14876 this._input = input;
14877 this._more = this._backtrack = this.done = false;
14878 this.yylineno = this.yyleng = 0;
14879 this.yytext = this.matched = this.match = '';
14880 this.conditionStack = ['INITIAL'];
14881 this.yylloc = {
14882 first_line: 1,
14883 first_column: 0,
14884 last_line: 1,
14885 last_column: 0
14886 };
14887 if (this.options.ranges) {
14888 this.yylloc.range = [0,0];
14889 }
14890 this.offset = 0;
14891 return this;
14892 },
14893
14894// consumes and returns one char from the input
14895input:function () {
14896 var ch = this._input[0];
14897 this.yytext += ch;
14898 this.yyleng++;
14899 this.offset++;
14900 this.match += ch;
14901 this.matched += ch;
14902 var lines = ch.match(/(?:\r\n?|\n).*/g);
14903 if (lines) {
14904 this.yylineno++;
14905 this.yylloc.last_line++;
14906 } else {
14907 this.yylloc.last_column++;
14908 }
14909 if (this.options.ranges) {
14910 this.yylloc.range[1]++;
14911 }
14912
14913 this._input = this._input.slice(1);
14914 return ch;
14915 },
14916
14917// unshifts one char (or a string) into the input
14918unput:function (ch) {
14919 var len = ch.length;
14920 var lines = ch.split(/(?:\r\n?|\n)/g);
14921
14922 this._input = ch + this._input;
14923 this.yytext = this.yytext.substr(0, this.yytext.length - len);
14924 //this.yyleng -= len;
14925 this.offset -= len;
14926 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
14927 this.match = this.match.substr(0, this.match.length - 1);
14928 this.matched = this.matched.substr(0, this.matched.length - 1);
14929
14930 if (lines.length - 1) {
14931 this.yylineno -= lines.length - 1;
14932 }
14933 var r = this.yylloc.range;
14934
14935 this.yylloc = {
14936 first_line: this.yylloc.first_line,
14937 last_line: this.yylineno + 1,
14938 first_column: this.yylloc.first_column,
14939 last_column: lines ?
14940 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
14941 + oldLines[oldLines.length - lines.length].length - lines[0].length :
14942 this.yylloc.first_column - len
14943 };
14944
14945 if (this.options.ranges) {
14946 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
14947 }
14948 this.yyleng = this.yytext.length;
14949 return this;
14950 },
14951
14952// When called from action, caches matched text and appends it on next action
14953more:function () {
14954 this._more = true;
14955 return this;
14956 },
14957
14958// 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.
14959reject:function () {
14960 if (this.options.backtrack_lexer) {
14961 this._backtrack = true;
14962 } else {
14963 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(), {
14964 text: "",
14965 token: null,
14966 line: this.yylineno
14967 });
14968
14969 }
14970 return this;
14971 },
14972
14973// retain first n characters of the match
14974less:function (n) {
14975 this.unput(this.match.slice(n));
14976 },
14977
14978// displays already matched input, i.e. for error messages
14979pastInput:function () {
14980 var past = this.matched.substr(0, this.matched.length - this.match.length);
14981 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
14982 },
14983
14984// displays upcoming input, i.e. for error messages
14985upcomingInput:function () {
14986 var next = this.match;
14987 if (next.length < 20) {
14988 next += this._input.substr(0, 20-next.length);
14989 }
14990 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
14991 },
14992
14993// displays the character position where the lexing error occurred, i.e. for error messages
14994showPosition:function () {
14995 var pre = this.pastInput();
14996 var c = new Array(pre.length + 1).join("-");
14997 return pre + this.upcomingInput() + "\n" + c + "^";
14998 },
14999
15000// test the lexed token: return FALSE when not a match, otherwise return token
15001test_match:function(match, indexed_rule) {
15002 var token,
15003 lines,
15004 backup;
15005
15006 if (this.options.backtrack_lexer) {
15007 // save context
15008 backup = {
15009 yylineno: this.yylineno,
15010 yylloc: {
15011 first_line: this.yylloc.first_line,
15012 last_line: this.last_line,
15013 first_column: this.yylloc.first_column,
15014 last_column: this.yylloc.last_column
15015 },
15016 yytext: this.yytext,
15017 match: this.match,
15018 matches: this.matches,
15019 matched: this.matched,
15020 yyleng: this.yyleng,
15021 offset: this.offset,
15022 _more: this._more,
15023 _input: this._input,
15024 yy: this.yy,
15025 conditionStack: this.conditionStack.slice(0),
15026 done: this.done
15027 };
15028 if (this.options.ranges) {
15029 backup.yylloc.range = this.yylloc.range.slice(0);
15030 }
15031 }
15032
15033 lines = match[0].match(/(?:\r\n?|\n).*/g);
15034 if (lines) {
15035 this.yylineno += lines.length;
15036 }
15037 this.yylloc = {
15038 first_line: this.yylloc.last_line,
15039 last_line: this.yylineno + 1,
15040 first_column: this.yylloc.last_column,
15041 last_column: lines ?
15042 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
15043 this.yylloc.last_column + match[0].length
15044 };
15045 this.yytext += match[0];
15046 this.match += match[0];
15047 this.matches = match;
15048 this.yyleng = this.yytext.length;
15049 if (this.options.ranges) {
15050 this.yylloc.range = [this.offset, this.offset += this.yyleng];
15051 }
15052 this._more = false;
15053 this._backtrack = false;
15054 this._input = this._input.slice(match[0].length);
15055 this.matched += match[0];
15056 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
15057 if (this.done && this._input) {
15058 this.done = false;
15059 }
15060 if (token) {
15061 return token;
15062 } else if (this._backtrack) {
15063 // recover context
15064 for (var k in backup) {
15065 this[k] = backup[k];
15066 }
15067 return false; // rule action called reject() implying the next rule should be tested instead.
15068 }
15069 return false;
15070 },
15071
15072// return next match in input
15073next:function () {
15074 if (this.done) {
15075 return this.EOF;
15076 }
15077 if (!this._input) {
15078 this.done = true;
15079 }
15080
15081 var token,
15082 match,
15083 tempMatch,
15084 index;
15085 if (!this._more) {
15086 this.yytext = '';
15087 this.match = '';
15088 }
15089 var rules = this._currentRules();
15090 for (var i = 0; i < rules.length; i++) {
15091 tempMatch = this._input.match(this.rules[rules[i]]);
15092 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
15093 match = tempMatch;
15094 index = i;
15095 if (this.options.backtrack_lexer) {
15096 token = this.test_match(tempMatch, rules[i]);
15097 if (token !== false) {
15098 return token;
15099 } else if (this._backtrack) {
15100 match = false;
15101 continue; // rule action called reject() implying a rule MISmatch.
15102 } else {
15103 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
15104 return false;
15105 }
15106 } else if (!this.options.flex) {
15107 break;
15108 }
15109 }
15110 }
15111 if (match) {
15112 token = this.test_match(match, rules[index]);
15113 if (token !== false) {
15114 return token;
15115 }
15116 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
15117 return false;
15118 }
15119 if (this._input === "") {
15120 return this.EOF;
15121 } else {
15122 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
15123 text: "",
15124 token: null,
15125 line: this.yylineno
15126 });
15127 }
15128 },
15129
15130// return next match that has a token
15131lex:function lex () {
15132 var r = this.next();
15133 if (r) {
15134 return r;
15135 } else {
15136 return this.lex();
15137 }
15138 },
15139
15140// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
15141begin:function begin (condition) {
15142 this.conditionStack.push(condition);
15143 },
15144
15145// pop the previously active lexer condition state off the condition stack
15146popState:function popState () {
15147 var n = this.conditionStack.length - 1;
15148 if (n > 0) {
15149 return this.conditionStack.pop();
15150 } else {
15151 return this.conditionStack[0];
15152 }
15153 },
15154
15155// produce the lexer rule set which is active for the currently active lexer condition state
15156_currentRules:function _currentRules () {
15157 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
15158 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
15159 } else {
15160 return this.conditions["INITIAL"].rules;
15161 }
15162 },
15163
15164// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
15165topState:function topState (n) {
15166 n = this.conditionStack.length - 1 - Math.abs(n || 0);
15167 if (n >= 0) {
15168 return this.conditionStack[n];
15169 } else {
15170 return "INITIAL";
15171 }
15172 },
15173
15174// alias for begin(condition)
15175pushState:function pushState (condition) {
15176 this.begin(condition);
15177 },
15178
15179// return the number of states currently on the stack
15180stateStackSize:function stateStackSize() {
15181 return this.conditionStack.length;
15182 },
15183options: {"case-insensitive":true},
15184performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
15185 // Pre-lexer code can go here
15186
15187var YYSTATE=YY_START;
15188switch($avoiding_name_collisions) {
15189case 0:return 4 ;
15190break;
15191case 1:return 9 ;
15192break;
15193case 2:return 'space';
15194break;
15195case 3:return 10;
15196break;
15197case 4:return 6 ;
15198break;
15199case 5:return 'TXT' ;
15200break;
15201}
15202},
15203rules: [/^(?:info\b)/i,/^(?:[\s\n\r]+)/i,/^(?:[\s]+)/i,/^(?:showInfo\b)/i,/^(?:$)/i,/^(?:.)/i],
15204conditions: {"INITIAL":{"rules":[0,1,2,3,4,5],"inclusive":true}}
15205});
15206return lexer;
15207})();
15208parser.lexer = lexer;
15209function Parser () {
15210 this.yy = {};
15211}
15212Parser.prototype = parser;parser.Parser = Parser;
15213return new Parser;
15214})();
15215
15216
15217if (true) {
15218exports.parser = parser;
15219exports.Parser = parser.Parser;
15220exports.parse = function () { return parser.parse.apply(parser, arguments); };
15221exports.main = function commonjsMain (args) {
15222 if (!args[1]) {
15223 console.log('Usage: '+args[0]+' FILE');
15224 process.exit(1);
15225 }
15226 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");
15227 return exports.parser.parse(source);
15228};
15229if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
15230 exports.main(process.argv.slice(1));
15231}
15232}
15233/* 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)))
15234
15235/***/ }),
15236
15237/***/ "./src/diagrams/info/styles.js":
15238/*!*************************************!*\
15239 !*** ./src/diagrams/info/styles.js ***!
15240 \*************************************/
15241/*! exports provided: default */
15242/***/ (function(module, __webpack_exports__, __webpack_require__) {
15243
15244"use strict";
15245__webpack_require__.r(__webpack_exports__);
15246var getStyles = function getStyles() {
15247 return "";
15248};
15249
15250/* harmony default export */ __webpack_exports__["default"] = (getStyles);
15251
15252/***/ }),
15253
15254/***/ "./src/diagrams/pie/parser/pie.jison":
15255/*!*******************************************!*\
15256 !*** ./src/diagrams/pie/parser/pie.jison ***!
15257 \*******************************************/
15258/*! no static exports found */
15259/***/ (function(module, exports, __webpack_require__) {
15260
15261/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
15262/*
15263 Returns a Parser object of the following structure:
15264
15265 Parser: {
15266 yy: {}
15267 }
15268
15269 Parser.prototype: {
15270 yy: {},
15271 trace: function(),
15272 symbols_: {associative list: name ==> number},
15273 terminals_: {associative list: number ==> name},
15274 productions_: [...],
15275 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
15276 table: [...],
15277 defaultActions: {...},
15278 parseError: function(str, hash),
15279 parse: function(input),
15280
15281 lexer: {
15282 EOF: 1,
15283 parseError: function(str, hash),
15284 setInput: function(input),
15285 input: function(),
15286 unput: function(str),
15287 more: function(),
15288 less: function(n),
15289 pastInput: function(),
15290 upcomingInput: function(),
15291 showPosition: function(),
15292 test_match: function(regex_match_array, rule_index),
15293 next: function(),
15294 lex: function(),
15295 begin: function(condition),
15296 popState: function(),
15297 _currentRules: function(),
15298 topState: function(),
15299 pushState: function(condition),
15300
15301 options: {
15302 ranges: boolean (optional: true ==> token location info will include a .range[] member)
15303 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
15304 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)
15305 },
15306
15307 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
15308 rules: [...],
15309 conditions: {associative list: name ==> set},
15310 }
15311 }
15312
15313
15314 token location info (@$, _$, etc.): {
15315 first_line: n,
15316 last_line: n,
15317 first_column: n,
15318 last_column: n,
15319 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
15320 }
15321
15322
15323 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
15324 text: (matched text)
15325 token: (the produced terminal token, if any)
15326 line: (yylineno)
15327 }
15328 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
15329 loc: (yylloc)
15330 expected: (string describing the set of expected tokens)
15331 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
15332 }
15333*/
15334var parser = (function(){
15335var 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];
15336var parser = {trace: function trace () { },
15337yy: {},
15338symbols_: {"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},
15339terminals_: {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"},
15340productions_: [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]],
15341performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
15342/* this == yyval */
15343
15344var $0 = $$.length - 1;
15345switch (yystate) {
15346case 6:
15347 this.$ = $$[$0-1]
15348break;
15349case 8:
15350 yy.addSection($$[$0-1],yy.cleanupValue($$[$0]));
15351break;
15352case 9:
15353 this.$=$$[$0].trim();yy.setTitle(this.$);
15354break;
15355case 16:
15356 yy.parseDirective('%%{', 'open_directive');
15357break;
15358case 17:
15359 yy.parseDirective($$[$0], 'type_directive');
15360break;
15361case 18:
15362 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
15363break;
15364case 19:
15365 yy.parseDirective('}%%', 'close_directive', 'pie');
15366break;
15367}
15368},
15369table: [{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])],
15370defaultActions: {9:[2,16],10:[2,1],11:[2,2],27:[2,18]},
15371parseError: function parseError (str, hash) {
15372 if (hash.recoverable) {
15373 this.trace(str);
15374 } else {
15375 var error = new Error(str);
15376 error.hash = hash;
15377 throw error;
15378 }
15379},
15380parse: function parse(input) {
15381 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
15382 var args = lstack.slice.call(arguments, 1);
15383 var lexer = Object.create(this.lexer);
15384 var sharedState = { yy: {} };
15385 for (var k in this.yy) {
15386 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
15387 sharedState.yy[k] = this.yy[k];
15388 }
15389 }
15390 lexer.setInput(input, sharedState.yy);
15391 sharedState.yy.lexer = lexer;
15392 sharedState.yy.parser = this;
15393 if (typeof lexer.yylloc == 'undefined') {
15394 lexer.yylloc = {};
15395 }
15396 var yyloc = lexer.yylloc;
15397 lstack.push(yyloc);
15398 var ranges = lexer.options && lexer.options.ranges;
15399 if (typeof sharedState.yy.parseError === 'function') {
15400 this.parseError = sharedState.yy.parseError;
15401 } else {
15402 this.parseError = Object.getPrototypeOf(this).parseError;
15403 }
15404 function popStack(n) {
15405 stack.length = stack.length - 2 * n;
15406 vstack.length = vstack.length - n;
15407 lstack.length = lstack.length - n;
15408 }
15409 function lex() {
15410 var token;
15411 token = tstack.pop() || lexer.lex() || EOF;
15412 if (typeof token !== 'number') {
15413 if (token instanceof Array) {
15414 tstack = token;
15415 token = tstack.pop();
15416 }
15417 token = self.symbols_[token] || token;
15418 }
15419 return token;
15420 }
15421 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
15422 while (true) {
15423 state = stack[stack.length - 1];
15424 if (this.defaultActions[state]) {
15425 action = this.defaultActions[state];
15426 } else {
15427 if (symbol === null || typeof symbol == 'undefined') {
15428 symbol = lex();
15429 }
15430 action = table[state] && table[state][symbol];
15431 }
15432 if (typeof action === 'undefined' || !action.length || !action[0]) {
15433 var errStr = '';
15434 expected = [];
15435 for (p in table[state]) {
15436 if (this.terminals_[p] && p > TERROR) {
15437 expected.push('\'' + this.terminals_[p] + '\'');
15438 }
15439 }
15440 if (lexer.showPosition) {
15441 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
15442 } else {
15443 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
15444 }
15445 this.parseError(errStr, {
15446 text: lexer.match,
15447 token: this.terminals_[symbol] || symbol,
15448 line: lexer.yylineno,
15449 loc: yyloc,
15450 expected: expected
15451 });
15452 }
15453 if (action[0] instanceof Array && action.length > 1) {
15454 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
15455 }
15456 switch (action[0]) {
15457 case 1:
15458 stack.push(symbol);
15459 vstack.push(lexer.yytext);
15460 lstack.push(lexer.yylloc);
15461 stack.push(action[1]);
15462 symbol = null;
15463 if (!preErrorSymbol) {
15464 yyleng = lexer.yyleng;
15465 yytext = lexer.yytext;
15466 yylineno = lexer.yylineno;
15467 yyloc = lexer.yylloc;
15468 if (recovering > 0) {
15469 recovering--;
15470 }
15471 } else {
15472 symbol = preErrorSymbol;
15473 preErrorSymbol = null;
15474 }
15475 break;
15476 case 2:
15477 len = this.productions_[action[1]][1];
15478 yyval.$ = vstack[vstack.length - len];
15479 yyval._$ = {
15480 first_line: lstack[lstack.length - (len || 1)].first_line,
15481 last_line: lstack[lstack.length - 1].last_line,
15482 first_column: lstack[lstack.length - (len || 1)].first_column,
15483 last_column: lstack[lstack.length - 1].last_column
15484 };
15485 if (ranges) {
15486 yyval._$.range = [
15487 lstack[lstack.length - (len || 1)].range[0],
15488 lstack[lstack.length - 1].range[1]
15489 ];
15490 }
15491 r = this.performAction.apply(yyval, [
15492 yytext,
15493 yyleng,
15494 yylineno,
15495 sharedState.yy,
15496 action[1],
15497 vstack,
15498 lstack
15499 ].concat(args));
15500 if (typeof r !== 'undefined') {
15501 return r;
15502 }
15503 if (len) {
15504 stack = stack.slice(0, -1 * len * 2);
15505 vstack = vstack.slice(0, -1 * len);
15506 lstack = lstack.slice(0, -1 * len);
15507 }
15508 stack.push(this.productions_[action[1]][0]);
15509 vstack.push(yyval.$);
15510 lstack.push(yyval._$);
15511 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
15512 stack.push(newState);
15513 break;
15514 case 3:
15515 return true;
15516 }
15517 }
15518 return true;
15519}};
15520
15521/* generated by jison-lex 0.3.4 */
15522var lexer = (function(){
15523var lexer = ({
15524
15525EOF:1,
15526
15527parseError:function parseError(str, hash) {
15528 if (this.yy.parser) {
15529 this.yy.parser.parseError(str, hash);
15530 } else {
15531 throw new Error(str);
15532 }
15533 },
15534
15535// resets the lexer, sets new input
15536setInput:function (input, yy) {
15537 this.yy = yy || this.yy || {};
15538 this._input = input;
15539 this._more = this._backtrack = this.done = false;
15540 this.yylineno = this.yyleng = 0;
15541 this.yytext = this.matched = this.match = '';
15542 this.conditionStack = ['INITIAL'];
15543 this.yylloc = {
15544 first_line: 1,
15545 first_column: 0,
15546 last_line: 1,
15547 last_column: 0
15548 };
15549 if (this.options.ranges) {
15550 this.yylloc.range = [0,0];
15551 }
15552 this.offset = 0;
15553 return this;
15554 },
15555
15556// consumes and returns one char from the input
15557input:function () {
15558 var ch = this._input[0];
15559 this.yytext += ch;
15560 this.yyleng++;
15561 this.offset++;
15562 this.match += ch;
15563 this.matched += ch;
15564 var lines = ch.match(/(?:\r\n?|\n).*/g);
15565 if (lines) {
15566 this.yylineno++;
15567 this.yylloc.last_line++;
15568 } else {
15569 this.yylloc.last_column++;
15570 }
15571 if (this.options.ranges) {
15572 this.yylloc.range[1]++;
15573 }
15574
15575 this._input = this._input.slice(1);
15576 return ch;
15577 },
15578
15579// unshifts one char (or a string) into the input
15580unput:function (ch) {
15581 var len = ch.length;
15582 var lines = ch.split(/(?:\r\n?|\n)/g);
15583
15584 this._input = ch + this._input;
15585 this.yytext = this.yytext.substr(0, this.yytext.length - len);
15586 //this.yyleng -= len;
15587 this.offset -= len;
15588 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
15589 this.match = this.match.substr(0, this.match.length - 1);
15590 this.matched = this.matched.substr(0, this.matched.length - 1);
15591
15592 if (lines.length - 1) {
15593 this.yylineno -= lines.length - 1;
15594 }
15595 var r = this.yylloc.range;
15596
15597 this.yylloc = {
15598 first_line: this.yylloc.first_line,
15599 last_line: this.yylineno + 1,
15600 first_column: this.yylloc.first_column,
15601 last_column: lines ?
15602 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
15603 + oldLines[oldLines.length - lines.length].length - lines[0].length :
15604 this.yylloc.first_column - len
15605 };
15606
15607 if (this.options.ranges) {
15608 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
15609 }
15610 this.yyleng = this.yytext.length;
15611 return this;
15612 },
15613
15614// When called from action, caches matched text and appends it on next action
15615more:function () {
15616 this._more = true;
15617 return this;
15618 },
15619
15620// 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.
15621reject:function () {
15622 if (this.options.backtrack_lexer) {
15623 this._backtrack = true;
15624 } else {
15625 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(), {
15626 text: "",
15627 token: null,
15628 line: this.yylineno
15629 });
15630
15631 }
15632 return this;
15633 },
15634
15635// retain first n characters of the match
15636less:function (n) {
15637 this.unput(this.match.slice(n));
15638 },
15639
15640// displays already matched input, i.e. for error messages
15641pastInput:function () {
15642 var past = this.matched.substr(0, this.matched.length - this.match.length);
15643 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
15644 },
15645
15646// displays upcoming input, i.e. for error messages
15647upcomingInput:function () {
15648 var next = this.match;
15649 if (next.length < 20) {
15650 next += this._input.substr(0, 20-next.length);
15651 }
15652 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
15653 },
15654
15655// displays the character position where the lexing error occurred, i.e. for error messages
15656showPosition:function () {
15657 var pre = this.pastInput();
15658 var c = new Array(pre.length + 1).join("-");
15659 return pre + this.upcomingInput() + "\n" + c + "^";
15660 },
15661
15662// test the lexed token: return FALSE when not a match, otherwise return token
15663test_match:function(match, indexed_rule) {
15664 var token,
15665 lines,
15666 backup;
15667
15668 if (this.options.backtrack_lexer) {
15669 // save context
15670 backup = {
15671 yylineno: this.yylineno,
15672 yylloc: {
15673 first_line: this.yylloc.first_line,
15674 last_line: this.last_line,
15675 first_column: this.yylloc.first_column,
15676 last_column: this.yylloc.last_column
15677 },
15678 yytext: this.yytext,
15679 match: this.match,
15680 matches: this.matches,
15681 matched: this.matched,
15682 yyleng: this.yyleng,
15683 offset: this.offset,
15684 _more: this._more,
15685 _input: this._input,
15686 yy: this.yy,
15687 conditionStack: this.conditionStack.slice(0),
15688 done: this.done
15689 };
15690 if (this.options.ranges) {
15691 backup.yylloc.range = this.yylloc.range.slice(0);
15692 }
15693 }
15694
15695 lines = match[0].match(/(?:\r\n?|\n).*/g);
15696 if (lines) {
15697 this.yylineno += lines.length;
15698 }
15699 this.yylloc = {
15700 first_line: this.yylloc.last_line,
15701 last_line: this.yylineno + 1,
15702 first_column: this.yylloc.last_column,
15703 last_column: lines ?
15704 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
15705 this.yylloc.last_column + match[0].length
15706 };
15707 this.yytext += match[0];
15708 this.match += match[0];
15709 this.matches = match;
15710 this.yyleng = this.yytext.length;
15711 if (this.options.ranges) {
15712 this.yylloc.range = [this.offset, this.offset += this.yyleng];
15713 }
15714 this._more = false;
15715 this._backtrack = false;
15716 this._input = this._input.slice(match[0].length);
15717 this.matched += match[0];
15718 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
15719 if (this.done && this._input) {
15720 this.done = false;
15721 }
15722 if (token) {
15723 return token;
15724 } else if (this._backtrack) {
15725 // recover context
15726 for (var k in backup) {
15727 this[k] = backup[k];
15728 }
15729 return false; // rule action called reject() implying the next rule should be tested instead.
15730 }
15731 return false;
15732 },
15733
15734// return next match in input
15735next:function () {
15736 if (this.done) {
15737 return this.EOF;
15738 }
15739 if (!this._input) {
15740 this.done = true;
15741 }
15742
15743 var token,
15744 match,
15745 tempMatch,
15746 index;
15747 if (!this._more) {
15748 this.yytext = '';
15749 this.match = '';
15750 }
15751 var rules = this._currentRules();
15752 for (var i = 0; i < rules.length; i++) {
15753 tempMatch = this._input.match(this.rules[rules[i]]);
15754 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
15755 match = tempMatch;
15756 index = i;
15757 if (this.options.backtrack_lexer) {
15758 token = this.test_match(tempMatch, rules[i]);
15759 if (token !== false) {
15760 return token;
15761 } else if (this._backtrack) {
15762 match = false;
15763 continue; // rule action called reject() implying a rule MISmatch.
15764 } else {
15765 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
15766 return false;
15767 }
15768 } else if (!this.options.flex) {
15769 break;
15770 }
15771 }
15772 }
15773 if (match) {
15774 token = this.test_match(match, rules[index]);
15775 if (token !== false) {
15776 return token;
15777 }
15778 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
15779 return false;
15780 }
15781 if (this._input === "") {
15782 return this.EOF;
15783 } else {
15784 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
15785 text: "",
15786 token: null,
15787 line: this.yylineno
15788 });
15789 }
15790 },
15791
15792// return next match that has a token
15793lex:function lex () {
15794 var r = this.next();
15795 if (r) {
15796 return r;
15797 } else {
15798 return this.lex();
15799 }
15800 },
15801
15802// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
15803begin:function begin (condition) {
15804 this.conditionStack.push(condition);
15805 },
15806
15807// pop the previously active lexer condition state off the condition stack
15808popState:function popState () {
15809 var n = this.conditionStack.length - 1;
15810 if (n > 0) {
15811 return this.conditionStack.pop();
15812 } else {
15813 return this.conditionStack[0];
15814 }
15815 },
15816
15817// produce the lexer rule set which is active for the currently active lexer condition state
15818_currentRules:function _currentRules () {
15819 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
15820 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
15821 } else {
15822 return this.conditions["INITIAL"].rules;
15823 }
15824 },
15825
15826// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
15827topState:function topState (n) {
15828 n = this.conditionStack.length - 1 - Math.abs(n || 0);
15829 if (n >= 0) {
15830 return this.conditionStack[n];
15831 } else {
15832 return "INITIAL";
15833 }
15834 },
15835
15836// alias for begin(condition)
15837pushState:function pushState (condition) {
15838 this.begin(condition);
15839 },
15840
15841// return the number of states currently on the stack
15842stateStackSize:function stateStackSize() {
15843 return this.conditionStack.length;
15844 },
15845options: {"case-insensitive":true},
15846performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
15847var YYSTATE=YY_START;
15848switch($avoiding_name_collisions) {
15849case 0: this.begin('open_directive'); return 22;
15850break;
15851case 1: this.begin('type_directive'); return 23;
15852break;
15853case 2: this.popState(); this.begin('arg_directive'); return 17;
15854break;
15855case 3: this.popState(); this.popState(); return 25;
15856break;
15857case 4:return 24;
15858break;
15859case 5:/* skip comments */
15860break;
15861case 6:/* skip comments */{ /*console.log('');*/ }
15862break;
15863case 7:return 19;
15864break;
15865case 8:/* do nothing */
15866break;
15867case 9:/* ignore */
15868break;
15869case 10: this.begin("title");return 12;
15870break;
15871case 11: this.popState(); return "title_value";
15872break;
15873case 12: this.begin("string");
15874break;
15875case 13: this.popState();
15876break;
15877case 14: return "txt";
15878break;
15879case 15:return 6;
15880break;
15881case 16:return "value";
15882break;
15883case 17:return 21;
15884break;
15885}
15886},
15887rules: [/^(?:%%\{)/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],
15888conditions: {"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}}
15889});
15890return lexer;
15891})();
15892parser.lexer = lexer;
15893function Parser () {
15894 this.yy = {};
15895}
15896Parser.prototype = parser;parser.Parser = Parser;
15897return new Parser;
15898})();
15899
15900
15901if (true) {
15902exports.parser = parser;
15903exports.Parser = parser.Parser;
15904exports.parse = function () { return parser.parse.apply(parser, arguments); };
15905exports.main = function commonjsMain (args) {
15906 if (!args[1]) {
15907 console.log('Usage: '+args[0]+' FILE');
15908 process.exit(1);
15909 }
15910 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");
15911 return exports.parser.parse(source);
15912};
15913if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
15914 exports.main(process.argv.slice(1));
15915}
15916}
15917/* 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)))
15918
15919/***/ }),
15920
15921/***/ "./src/diagrams/pie/pieDb.js":
15922/*!***********************************!*\
15923 !*** ./src/diagrams/pie/pieDb.js ***!
15924 \***********************************/
15925/*! exports provided: parseDirective, default */
15926/***/ (function(module, __webpack_exports__, __webpack_require__) {
15927
15928"use strict";
15929__webpack_require__.r(__webpack_exports__);
15930/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
15931/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
15932/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
15933/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
15934/**
15935 *
15936 */
15937
15938
15939
15940var sections = {};
15941var title = '';
15942var parseDirective = function parseDirective(statement, context, type) {
15943 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].parseDirective(this, statement, context, type);
15944};
15945
15946var addSection = function addSection(id, value) {
15947 if (typeof sections[id] === 'undefined') {
15948 sections[id] = value;
15949 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].debug('Added new section :', id);
15950 }
15951};
15952
15953var getSections = function getSections() {
15954 return sections;
15955};
15956
15957var setTitle = function setTitle(txt) {
15958 title = txt;
15959};
15960
15961var getTitle = function getTitle() {
15962 return title;
15963};
15964
15965var cleanupValue = function cleanupValue(value) {
15966 if (value.substring(0, 1) === ':') {
15967 value = value.substring(1).trim();
15968 return Number(value.trim());
15969 } else {
15970 return Number(value.trim());
15971 }
15972};
15973
15974var clear = function clear() {
15975 sections = {};
15976 title = '';
15977}; // export const parseError = (err, hash) => {
15978// global.mermaidAPI.parseError(err, hash)
15979// }
15980
15981
15982/* harmony default export */ __webpack_exports__["default"] = ({
15983 parseDirective: parseDirective,
15984 getConfig: function getConfig() {
15985 return _config__WEBPACK_IMPORTED_MODULE_2__["getConfig"]().pie;
15986 },
15987 addSection: addSection,
15988 getSections: getSections,
15989 cleanupValue: cleanupValue,
15990 clear: clear,
15991 setTitle: setTitle,
15992 getTitle: getTitle // parseError
15993
15994});
15995
15996/***/ }),
15997
15998/***/ "./src/diagrams/pie/pieRenderer.js":
15999/*!*****************************************!*\
16000 !*** ./src/diagrams/pie/pieRenderer.js ***!
16001 \*****************************************/
16002/*! exports provided: setConf, draw, default */
16003/***/ (function(module, __webpack_exports__, __webpack_require__) {
16004
16005"use strict";
16006__webpack_require__.r(__webpack_exports__);
16007/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
16008/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
16009/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
16010/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
16011/* harmony import */ var _pieDb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pieDb */ "./src/diagrams/pie/pieDb.js");
16012/* harmony import */ var _parser_pie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./parser/pie */ "./src/diagrams/pie/parser/pie.jison");
16013/* harmony import */ var _parser_pie__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_parser_pie__WEBPACK_IMPORTED_MODULE_2__);
16014/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
16015/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
16016/**
16017 * Created by AshishJ on 11-09-2019.
16018 */
16019
16020
16021
16022
16023
16024var conf = {};
16025var setConf = function setConf(cnf) {
16026 var keys = Object.keys(cnf);
16027 keys.forEach(function (key) {
16028 conf[key] = cnf[key];
16029 });
16030};
16031/**
16032 * Draws a Pie Chart with the data given in text.
16033 * @param text
16034 * @param id
16035 */
16036
16037var width;
16038var height = 450;
16039var draw = function draw(txt, id) {
16040 try {
16041 var parser = _parser_pie__WEBPACK_IMPORTED_MODULE_2___default.a.parser;
16042 parser.yy = _pieDb__WEBPACK_IMPORTED_MODULE_1__["default"];
16043 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Rendering info diagram\n' + txt); // Parse the Pie Chart definition
16044
16045 parser.yy.clear();
16046 parser.parse(txt);
16047 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Parsed info diagram');
16048 var elem = document.getElementById(id);
16049 width = elem.parentElement.offsetWidth;
16050
16051 if (typeof width === 'undefined') {
16052 width = 1200;
16053 }
16054
16055 if (typeof conf.useWidth !== 'undefined') {
16056 width = conf.useWidth;
16057 }
16058
16059 var diagram = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + id);
16060 Object(_utils__WEBPACK_IMPORTED_MODULE_4__["configureSvgSize"])(diagram, height, width, conf.useMaxWidth); // Set viewBox
16061
16062 elem.setAttribute('viewBox', '0 0 ' + width + ' ' + height); // Fetch the default direction, use TD if none was found
16063
16064 var margin = 40;
16065 var legendRectSize = 18;
16066 var legendSpacing = 4;
16067 var radius = Math.min(width, height) / 2 - margin;
16068 var svg = diagram.append('g').attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');
16069 var data = _pieDb__WEBPACK_IMPORTED_MODULE_1__["default"].getSections();
16070 var sum = 0;
16071 Object.keys(data).forEach(function (key) {
16072 sum += data[key];
16073 }); // Set the color scale
16074
16075 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:
16076
16077 var pie = Object(d3__WEBPACK_IMPORTED_MODULE_0__["pie"])().value(function (d) {
16078 return d.value;
16079 });
16080 var dataReady = pie(Object(d3__WEBPACK_IMPORTED_MODULE_0__["entries"])(data)); // Shape helper to build arcs:
16081
16082 var arcGenerator = Object(d3__WEBPACK_IMPORTED_MODULE_0__["arc"])().innerRadius(0).outerRadius(radius); // Build the pie chart: each part of the pie is a path that we build using the arc function.
16083
16084 svg.selectAll('mySlices').data(dataReady).enter().append('path').attr('d', arcGenerator).attr('fill', function (d) {
16085 return color(d.data.key);
16086 }).attr('stroke', 'black').style('stroke-width', '2px').style('opacity', 0.7); // Now add the percentage.
16087 // Use the centroid method to get the best coordinates.
16088
16089 svg.selectAll('mySlices').data(dataReady).enter().append('text').text(function (d) {
16090 return (d.data.value / sum * 100).toFixed(0) + '%';
16091 }).attr('transform', function (d) {
16092 return 'translate(' + arcGenerator.centroid(d) + ')';
16093 }).style('text-anchor', 'middle').attr('class', 'slice').style('font-size', 17);
16094 svg.append('text').text(parser.yy.getTitle()).attr('x', 0).attr('y', -(height - 50) / 2).attr('class', 'pieTitleText'); // Add the legends/annotations for each section
16095
16096 var legend = svg.selectAll('.legend').data(color.domain()).enter().append('g').attr('class', 'legend').attr('transform', function (d, i) {
16097 var height = legendRectSize + legendSpacing;
16098 var offset = height * color.domain().length / 2;
16099 var horz = 12 * legendRectSize;
16100 var vert = i * height - offset;
16101 return 'translate(' + horz + ',' + vert + ')';
16102 });
16103 legend.append('rect').attr('width', legendRectSize).attr('height', legendRectSize).style('fill', color).style('stroke', color);
16104 legend.append('text').attr('x', legendRectSize + legendSpacing).attr('y', legendRectSize - legendSpacing).text(function (d) {
16105 return d;
16106 });
16107 } catch (e) {
16108 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error('Error while rendering info diagram');
16109 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error(e);
16110 }
16111};
16112/* harmony default export */ __webpack_exports__["default"] = ({
16113 setConf: setConf,
16114 draw: draw
16115});
16116
16117/***/ }),
16118
16119/***/ "./src/diagrams/pie/styles.js":
16120/*!************************************!*\
16121 !*** ./src/diagrams/pie/styles.js ***!
16122 \************************************/
16123/*! exports provided: default */
16124/***/ (function(module, __webpack_exports__, __webpack_require__) {
16125
16126"use strict";
16127__webpack_require__.r(__webpack_exports__);
16128var getStyles = function getStyles(options) {
16129 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");
16130};
16131
16132/* harmony default export */ __webpack_exports__["default"] = (getStyles);
16133
16134/***/ }),
16135
16136/***/ "./src/diagrams/sequence/parser/sequenceDiagram.jison":
16137/*!************************************************************!*\
16138 !*** ./src/diagrams/sequence/parser/sequenceDiagram.jison ***!
16139 \************************************************************/
16140/*! no static exports found */
16141/***/ (function(module, exports, __webpack_require__) {
16142
16143/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
16144/*
16145 Returns a Parser object of the following structure:
16146
16147 Parser: {
16148 yy: {}
16149 }
16150
16151 Parser.prototype: {
16152 yy: {},
16153 trace: function(),
16154 symbols_: {associative list: name ==> number},
16155 terminals_: {associative list: number ==> name},
16156 productions_: [...],
16157 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
16158 table: [...],
16159 defaultActions: {...},
16160 parseError: function(str, hash),
16161 parse: function(input),
16162
16163 lexer: {
16164 EOF: 1,
16165 parseError: function(str, hash),
16166 setInput: function(input),
16167 input: function(),
16168 unput: function(str),
16169 more: function(),
16170 less: function(n),
16171 pastInput: function(),
16172 upcomingInput: function(),
16173 showPosition: function(),
16174 test_match: function(regex_match_array, rule_index),
16175 next: function(),
16176 lex: function(),
16177 begin: function(condition),
16178 popState: function(),
16179 _currentRules: function(),
16180 topState: function(),
16181 pushState: function(condition),
16182
16183 options: {
16184 ranges: boolean (optional: true ==> token location info will include a .range[] member)
16185 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
16186 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)
16187 },
16188
16189 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
16190 rules: [...],
16191 conditions: {associative list: name ==> set},
16192 }
16193 }
16194
16195
16196 token location info (@$, _$, etc.): {
16197 first_line: n,
16198 last_line: n,
16199 first_column: n,
16200 last_column: n,
16201 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
16202 }
16203
16204
16205 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
16206 text: (matched text)
16207 token: (the produced terminal token, if any)
16208 line: (yylineno)
16209 }
16210 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
16211 loc: (yylloc)
16212 expected: (string describing the set of expected tokens)
16213 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
16214 }
16215*/
16216var parser = (function(){
16217var 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];
16218var parser = {trace: function trace () { },
16219yy: {},
16220symbols_: {"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},
16221terminals_: {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"},
16222productions_: [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]],
16223performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
16224/* this == yyval */
16225
16226var $0 = $$.length - 1;
16227switch (yystate) {
16228case 4:
16229 yy.apply($$[$0]);return $$[$0];
16230break;
16231case 5:
16232 this.$ = []
16233break;
16234case 6:
16235$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
16236break;
16237case 7: case 8:
16238 this.$ = $$[$0]
16239break;
16240case 9:
16241 this.$=[];
16242break;
16243case 12:
16244$$[$0-3].description=yy.parseMessage($$[$0-1]); this.$=$$[$0-3];
16245break;
16246case 13:
16247this.$=$$[$0-1];
16248break;
16249case 15:
16250yy.enableSequenceNumbers()
16251break;
16252case 16:
16253this.$={type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]};
16254break;
16255case 17:
16256this.$={type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-1]};
16257break;
16258case 19:
16259this.$=[{type:'setTitle', text:$$[$0-1]}]
16260break;
16261case 20:
16262
16263 $$[$0-1].unshift({type: 'loopStart', loopText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.LOOP_START});
16264 $$[$0-1].push({type: 'loopEnd', loopText:$$[$0-2], signalType: yy.LINETYPE.LOOP_END});
16265 this.$=$$[$0-1];
16266break;
16267case 21:
16268
16269 $$[$0-1].unshift({type: 'rectStart', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_START });
16270 $$[$0-1].push({type: 'rectEnd', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_END });
16271 this.$=$$[$0-1];
16272break;
16273case 22:
16274
16275 $$[$0-1].unshift({type: 'optStart', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_START});
16276 $$[$0-1].push({type: 'optEnd', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_END});
16277 this.$=$$[$0-1];
16278break;
16279case 23:
16280
16281 // Alt start
16282 $$[$0-1].unshift({type: 'altStart', altText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.ALT_START});
16283 // Content in alt is already in $$[$0-1]
16284 // End
16285 $$[$0-1].push({type: 'altEnd', signalType: yy.LINETYPE.ALT_END});
16286 this.$=$$[$0-1];
16287break;
16288case 24:
16289
16290 // Parallel start
16291 $$[$0-1].unshift({type: 'parStart', parText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.PAR_START});
16292 // Content in par is already in $$[$0-1]
16293 // End
16294 $$[$0-1].push({type: 'parEnd', signalType: yy.LINETYPE.PAR_END});
16295 this.$=$$[$0-1];
16296break;
16297case 27:
16298 this.$ = $$[$0-3].concat([{type: 'and', parText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.PAR_AND}, $$[$0]]);
16299break;
16300case 29:
16301 this.$ = $$[$0-3].concat([{type: 'else', altText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.ALT_ELSE}, $$[$0]]);
16302break;
16303case 30:
16304
16305 this.$ = [$$[$0-1], {type:'addNote', placement:$$[$0-2], actor:$$[$0-1].actor, text:$$[$0]}];
16306break;
16307case 31:
16308
16309 // Coerce actor_pair into a [to, from, ...] array
16310 $$[$0-2] = [].concat($$[$0-1], $$[$0-1]).slice(0, 2);
16311 $$[$0-2][0] = $$[$0-2][0].actor;
16312 $$[$0-2][1] = $$[$0-2][1].actor;
16313 this.$ = [$$[$0-1], {type:'addNote', placement:yy.PLACEMENT.OVER, actor:$$[$0-2].slice(0, 2), text:$$[$0]}];
16314break;
16315case 34:
16316 this.$ = [$$[$0-2], $$[$0]];
16317break;
16318case 35:
16319 this.$ = $$[$0];
16320break;
16321case 36:
16322 this.$ = yy.PLACEMENT.LEFTOF;
16323break;
16324case 37:
16325 this.$ = yy.PLACEMENT.RIGHTOF;
16326break;
16327case 38:
16328 this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]},
16329 {type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]}
16330 ]
16331break;
16332case 39:
16333 this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]},
16334 {type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-4]}
16335 ]
16336break;
16337case 40:
16338 this.$ = [$$[$0-3],$$[$0-1],{type: 'addMessage', from:$$[$0-3].actor, to:$$[$0-1].actor, signalType:$$[$0-2], msg:$$[$0]}]
16339break;
16340case 41:
16341this.$={type: 'addActor', actor:$$[$0]}
16342break;
16343case 42:
16344 this.$ = yy.LINETYPE.SOLID_OPEN;
16345break;
16346case 43:
16347 this.$ = yy.LINETYPE.DOTTED_OPEN;
16348break;
16349case 44:
16350 this.$ = yy.LINETYPE.SOLID;
16351break;
16352case 45:
16353 this.$ = yy.LINETYPE.DOTTED;
16354break;
16355case 46:
16356 this.$ = yy.LINETYPE.SOLID_CROSS;
16357break;
16358case 47:
16359 this.$ = yy.LINETYPE.DOTTED_CROSS;
16360break;
16361case 48:
16362this.$ = yy.parseMessage($$[$0].trim().substring(1))
16363break;
16364case 49:
16365 yy.parseDirective('%%{', 'open_directive');
16366break;
16367case 50:
16368 yy.parseDirective($$[$0], 'type_directive');
16369break;
16370case 51:
16371 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
16372break;
16373case 52:
16374 yy.parseDirective('}%%', 'close_directive', 'sequence');
16375break;
16376}
16377},
16378table: [{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]}],
16379defaultActions: {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]},
16380parseError: function parseError (str, hash) {
16381 if (hash.recoverable) {
16382 this.trace(str);
16383 } else {
16384 var error = new Error(str);
16385 error.hash = hash;
16386 throw error;
16387 }
16388},
16389parse: function parse(input) {
16390 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
16391 var args = lstack.slice.call(arguments, 1);
16392 var lexer = Object.create(this.lexer);
16393 var sharedState = { yy: {} };
16394 for (var k in this.yy) {
16395 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
16396 sharedState.yy[k] = this.yy[k];
16397 }
16398 }
16399 lexer.setInput(input, sharedState.yy);
16400 sharedState.yy.lexer = lexer;
16401 sharedState.yy.parser = this;
16402 if (typeof lexer.yylloc == 'undefined') {
16403 lexer.yylloc = {};
16404 }
16405 var yyloc = lexer.yylloc;
16406 lstack.push(yyloc);
16407 var ranges = lexer.options && lexer.options.ranges;
16408 if (typeof sharedState.yy.parseError === 'function') {
16409 this.parseError = sharedState.yy.parseError;
16410 } else {
16411 this.parseError = Object.getPrototypeOf(this).parseError;
16412 }
16413 function popStack(n) {
16414 stack.length = stack.length - 2 * n;
16415 vstack.length = vstack.length - n;
16416 lstack.length = lstack.length - n;
16417 }
16418 function lex() {
16419 var token;
16420 token = tstack.pop() || lexer.lex() || EOF;
16421 if (typeof token !== 'number') {
16422 if (token instanceof Array) {
16423 tstack = token;
16424 token = tstack.pop();
16425 }
16426 token = self.symbols_[token] || token;
16427 }
16428 return token;
16429 }
16430 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
16431 while (true) {
16432 state = stack[stack.length - 1];
16433 if (this.defaultActions[state]) {
16434 action = this.defaultActions[state];
16435 } else {
16436 if (symbol === null || typeof symbol == 'undefined') {
16437 symbol = lex();
16438 }
16439 action = table[state] && table[state][symbol];
16440 }
16441 if (typeof action === 'undefined' || !action.length || !action[0]) {
16442 var errStr = '';
16443 expected = [];
16444 for (p in table[state]) {
16445 if (this.terminals_[p] && p > TERROR) {
16446 expected.push('\'' + this.terminals_[p] + '\'');
16447 }
16448 }
16449 if (lexer.showPosition) {
16450 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
16451 } else {
16452 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
16453 }
16454 this.parseError(errStr, {
16455 text: lexer.match,
16456 token: this.terminals_[symbol] || symbol,
16457 line: lexer.yylineno,
16458 loc: yyloc,
16459 expected: expected
16460 });
16461 }
16462 if (action[0] instanceof Array && action.length > 1) {
16463 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
16464 }
16465 switch (action[0]) {
16466 case 1:
16467 stack.push(symbol);
16468 vstack.push(lexer.yytext);
16469 lstack.push(lexer.yylloc);
16470 stack.push(action[1]);
16471 symbol = null;
16472 if (!preErrorSymbol) {
16473 yyleng = lexer.yyleng;
16474 yytext = lexer.yytext;
16475 yylineno = lexer.yylineno;
16476 yyloc = lexer.yylloc;
16477 if (recovering > 0) {
16478 recovering--;
16479 }
16480 } else {
16481 symbol = preErrorSymbol;
16482 preErrorSymbol = null;
16483 }
16484 break;
16485 case 2:
16486 len = this.productions_[action[1]][1];
16487 yyval.$ = vstack[vstack.length - len];
16488 yyval._$ = {
16489 first_line: lstack[lstack.length - (len || 1)].first_line,
16490 last_line: lstack[lstack.length - 1].last_line,
16491 first_column: lstack[lstack.length - (len || 1)].first_column,
16492 last_column: lstack[lstack.length - 1].last_column
16493 };
16494 if (ranges) {
16495 yyval._$.range = [
16496 lstack[lstack.length - (len || 1)].range[0],
16497 lstack[lstack.length - 1].range[1]
16498 ];
16499 }
16500 r = this.performAction.apply(yyval, [
16501 yytext,
16502 yyleng,
16503 yylineno,
16504 sharedState.yy,
16505 action[1],
16506 vstack,
16507 lstack
16508 ].concat(args));
16509 if (typeof r !== 'undefined') {
16510 return r;
16511 }
16512 if (len) {
16513 stack = stack.slice(0, -1 * len * 2);
16514 vstack = vstack.slice(0, -1 * len);
16515 lstack = lstack.slice(0, -1 * len);
16516 }
16517 stack.push(this.productions_[action[1]][0]);
16518 vstack.push(yyval.$);
16519 lstack.push(yyval._$);
16520 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
16521 stack.push(newState);
16522 break;
16523 case 3:
16524 return true;
16525 }
16526 }
16527 return true;
16528}};
16529
16530/* generated by jison-lex 0.3.4 */
16531var lexer = (function(){
16532var lexer = ({
16533
16534EOF:1,
16535
16536parseError:function parseError(str, hash) {
16537 if (this.yy.parser) {
16538 this.yy.parser.parseError(str, hash);
16539 } else {
16540 throw new Error(str);
16541 }
16542 },
16543
16544// resets the lexer, sets new input
16545setInput:function (input, yy) {
16546 this.yy = yy || this.yy || {};
16547 this._input = input;
16548 this._more = this._backtrack = this.done = false;
16549 this.yylineno = this.yyleng = 0;
16550 this.yytext = this.matched = this.match = '';
16551 this.conditionStack = ['INITIAL'];
16552 this.yylloc = {
16553 first_line: 1,
16554 first_column: 0,
16555 last_line: 1,
16556 last_column: 0
16557 };
16558 if (this.options.ranges) {
16559 this.yylloc.range = [0,0];
16560 }
16561 this.offset = 0;
16562 return this;
16563 },
16564
16565// consumes and returns one char from the input
16566input:function () {
16567 var ch = this._input[0];
16568 this.yytext += ch;
16569 this.yyleng++;
16570 this.offset++;
16571 this.match += ch;
16572 this.matched += ch;
16573 var lines = ch.match(/(?:\r\n?|\n).*/g);
16574 if (lines) {
16575 this.yylineno++;
16576 this.yylloc.last_line++;
16577 } else {
16578 this.yylloc.last_column++;
16579 }
16580 if (this.options.ranges) {
16581 this.yylloc.range[1]++;
16582 }
16583
16584 this._input = this._input.slice(1);
16585 return ch;
16586 },
16587
16588// unshifts one char (or a string) into the input
16589unput:function (ch) {
16590 var len = ch.length;
16591 var lines = ch.split(/(?:\r\n?|\n)/g);
16592
16593 this._input = ch + this._input;
16594 this.yytext = this.yytext.substr(0, this.yytext.length - len);
16595 //this.yyleng -= len;
16596 this.offset -= len;
16597 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
16598 this.match = this.match.substr(0, this.match.length - 1);
16599 this.matched = this.matched.substr(0, this.matched.length - 1);
16600
16601 if (lines.length - 1) {
16602 this.yylineno -= lines.length - 1;
16603 }
16604 var r = this.yylloc.range;
16605
16606 this.yylloc = {
16607 first_line: this.yylloc.first_line,
16608 last_line: this.yylineno + 1,
16609 first_column: this.yylloc.first_column,
16610 last_column: lines ?
16611 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
16612 + oldLines[oldLines.length - lines.length].length - lines[0].length :
16613 this.yylloc.first_column - len
16614 };
16615
16616 if (this.options.ranges) {
16617 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
16618 }
16619 this.yyleng = this.yytext.length;
16620 return this;
16621 },
16622
16623// When called from action, caches matched text and appends it on next action
16624more:function () {
16625 this._more = true;
16626 return this;
16627 },
16628
16629// 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.
16630reject:function () {
16631 if (this.options.backtrack_lexer) {
16632 this._backtrack = true;
16633 } else {
16634 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(), {
16635 text: "",
16636 token: null,
16637 line: this.yylineno
16638 });
16639
16640 }
16641 return this;
16642 },
16643
16644// retain first n characters of the match
16645less:function (n) {
16646 this.unput(this.match.slice(n));
16647 },
16648
16649// displays already matched input, i.e. for error messages
16650pastInput:function () {
16651 var past = this.matched.substr(0, this.matched.length - this.match.length);
16652 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
16653 },
16654
16655// displays upcoming input, i.e. for error messages
16656upcomingInput:function () {
16657 var next = this.match;
16658 if (next.length < 20) {
16659 next += this._input.substr(0, 20-next.length);
16660 }
16661 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
16662 },
16663
16664// displays the character position where the lexing error occurred, i.e. for error messages
16665showPosition:function () {
16666 var pre = this.pastInput();
16667 var c = new Array(pre.length + 1).join("-");
16668 return pre + this.upcomingInput() + "\n" + c + "^";
16669 },
16670
16671// test the lexed token: return FALSE when not a match, otherwise return token
16672test_match:function(match, indexed_rule) {
16673 var token,
16674 lines,
16675 backup;
16676
16677 if (this.options.backtrack_lexer) {
16678 // save context
16679 backup = {
16680 yylineno: this.yylineno,
16681 yylloc: {
16682 first_line: this.yylloc.first_line,
16683 last_line: this.last_line,
16684 first_column: this.yylloc.first_column,
16685 last_column: this.yylloc.last_column
16686 },
16687 yytext: this.yytext,
16688 match: this.match,
16689 matches: this.matches,
16690 matched: this.matched,
16691 yyleng: this.yyleng,
16692 offset: this.offset,
16693 _more: this._more,
16694 _input: this._input,
16695 yy: this.yy,
16696 conditionStack: this.conditionStack.slice(0),
16697 done: this.done
16698 };
16699 if (this.options.ranges) {
16700 backup.yylloc.range = this.yylloc.range.slice(0);
16701 }
16702 }
16703
16704 lines = match[0].match(/(?:\r\n?|\n).*/g);
16705 if (lines) {
16706 this.yylineno += lines.length;
16707 }
16708 this.yylloc = {
16709 first_line: this.yylloc.last_line,
16710 last_line: this.yylineno + 1,
16711 first_column: this.yylloc.last_column,
16712 last_column: lines ?
16713 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
16714 this.yylloc.last_column + match[0].length
16715 };
16716 this.yytext += match[0];
16717 this.match += match[0];
16718 this.matches = match;
16719 this.yyleng = this.yytext.length;
16720 if (this.options.ranges) {
16721 this.yylloc.range = [this.offset, this.offset += this.yyleng];
16722 }
16723 this._more = false;
16724 this._backtrack = false;
16725 this._input = this._input.slice(match[0].length);
16726 this.matched += match[0];
16727 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
16728 if (this.done && this._input) {
16729 this.done = false;
16730 }
16731 if (token) {
16732 return token;
16733 } else if (this._backtrack) {
16734 // recover context
16735 for (var k in backup) {
16736 this[k] = backup[k];
16737 }
16738 return false; // rule action called reject() implying the next rule should be tested instead.
16739 }
16740 return false;
16741 },
16742
16743// return next match in input
16744next:function () {
16745 if (this.done) {
16746 return this.EOF;
16747 }
16748 if (!this._input) {
16749 this.done = true;
16750 }
16751
16752 var token,
16753 match,
16754 tempMatch,
16755 index;
16756 if (!this._more) {
16757 this.yytext = '';
16758 this.match = '';
16759 }
16760 var rules = this._currentRules();
16761 for (var i = 0; i < rules.length; i++) {
16762 tempMatch = this._input.match(this.rules[rules[i]]);
16763 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
16764 match = tempMatch;
16765 index = i;
16766 if (this.options.backtrack_lexer) {
16767 token = this.test_match(tempMatch, rules[i]);
16768 if (token !== false) {
16769 return token;
16770 } else if (this._backtrack) {
16771 match = false;
16772 continue; // rule action called reject() implying a rule MISmatch.
16773 } else {
16774 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
16775 return false;
16776 }
16777 } else if (!this.options.flex) {
16778 break;
16779 }
16780 }
16781 }
16782 if (match) {
16783 token = this.test_match(match, rules[index]);
16784 if (token !== false) {
16785 return token;
16786 }
16787 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
16788 return false;
16789 }
16790 if (this._input === "") {
16791 return this.EOF;
16792 } else {
16793 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
16794 text: "",
16795 token: null,
16796 line: this.yylineno
16797 });
16798 }
16799 },
16800
16801// return next match that has a token
16802lex:function lex () {
16803 var r = this.next();
16804 if (r) {
16805 return r;
16806 } else {
16807 return this.lex();
16808 }
16809 },
16810
16811// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
16812begin:function begin (condition) {
16813 this.conditionStack.push(condition);
16814 },
16815
16816// pop the previously active lexer condition state off the condition stack
16817popState:function popState () {
16818 var n = this.conditionStack.length - 1;
16819 if (n > 0) {
16820 return this.conditionStack.pop();
16821 } else {
16822 return this.conditionStack[0];
16823 }
16824 },
16825
16826// produce the lexer rule set which is active for the currently active lexer condition state
16827_currentRules:function _currentRules () {
16828 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
16829 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
16830 } else {
16831 return this.conditions["INITIAL"].rules;
16832 }
16833 },
16834
16835// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
16836topState:function topState (n) {
16837 n = this.conditionStack.length - 1 - Math.abs(n || 0);
16838 if (n >= 0) {
16839 return this.conditionStack[n];
16840 } else {
16841 return "INITIAL";
16842 }
16843 },
16844
16845// alias for begin(condition)
16846pushState:function pushState (condition) {
16847 this.begin(condition);
16848 },
16849
16850// return the number of states currently on the stack
16851stateStackSize:function stateStackSize() {
16852 return this.conditionStack.length;
16853 },
16854options: {"case-insensitive":true},
16855performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
16856var YYSTATE=YY_START;
16857switch($avoiding_name_collisions) {
16858case 0: this.begin('open_directive'); return 56;
16859break;
16860case 1: this.begin('type_directive'); return 57;
16861break;
16862case 2: this.popState(); this.begin('arg_directive'); return 14;
16863break;
16864case 3: this.popState(); this.popState(); return 59;
16865break;
16866case 4:return 58;
16867break;
16868case 5:return 5;
16869break;
16870case 6:/* skip all whitespace */
16871break;
16872case 7:/* skip same-line whitespace */
16873break;
16874case 8:/* skip comments */
16875break;
16876case 9:/* skip comments */
16877break;
16878case 10:/* skip comments */
16879break;
16880case 11: this.begin('ID'); return 16;
16881break;
16882case 12: yy_.yytext = yy_.yytext.trim(); this.begin('ALIAS'); return 48;
16883break;
16884case 13: this.popState(); this.popState(); this.begin('LINE'); return 18;
16885break;
16886case 14: this.popState(); this.popState(); return 5;
16887break;
16888case 15: this.begin('LINE'); return 27;
16889break;
16890case 16: this.begin('LINE'); return 29;
16891break;
16892case 17: this.begin('LINE'); return 30;
16893break;
16894case 18: this.begin('LINE'); return 31;
16895break;
16896case 19: this.begin('LINE'); return 36;
16897break;
16898case 20: this.begin('LINE'); return 33;
16899break;
16900case 21: this.begin('LINE'); return 35;
16901break;
16902case 22: this.popState(); return 19;
16903break;
16904case 23:return 28;
16905break;
16906case 24:return 43;
16907break;
16908case 25:return 44;
16909break;
16910case 26:return 39;
16911break;
16912case 27:return 37;
16913break;
16914case 28: this.begin('ID'); return 22;
16915break;
16916case 29: this.begin('ID'); return 23;
16917break;
16918case 30:return 25;
16919break;
16920case 31:return 7;
16921break;
16922case 32:return 21;
16923break;
16924case 33:return 42;
16925break;
16926case 34:return 5;
16927break;
16928case 35: yy_.yytext = yy_.yytext.trim(); return 48;
16929break;
16930case 36:return 51;
16931break;
16932case 37:return 52;
16933break;
16934case 38:return 49;
16935break;
16936case 39:return 50;
16937break;
16938case 40:return 53;
16939break;
16940case 41:return 54;
16941break;
16942case 42:return 55;
16943break;
16944case 43:return 46;
16945break;
16946case 44:return 47;
16947break;
16948case 45:return 5;
16949break;
16950case 46:return 'INVALID';
16951break;
16952}
16953},
16954rules: [/^(?:%%\{)/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],
16955conditions: {"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}}
16956});
16957return lexer;
16958})();
16959parser.lexer = lexer;
16960function Parser () {
16961 this.yy = {};
16962}
16963Parser.prototype = parser;parser.Parser = Parser;
16964return new Parser;
16965})();
16966
16967
16968if (true) {
16969exports.parser = parser;
16970exports.Parser = parser.Parser;
16971exports.parse = function () { return parser.parse.apply(parser, arguments); };
16972exports.main = function commonjsMain (args) {
16973 if (!args[1]) {
16974 console.log('Usage: '+args[0]+' FILE');
16975 process.exit(1);
16976 }
16977 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");
16978 return exports.parser.parse(source);
16979};
16980if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
16981 exports.main(process.argv.slice(1));
16982}
16983}
16984/* 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)))
16985
16986/***/ }),
16987
16988/***/ "./src/diagrams/sequence/sequenceDb.js":
16989/*!*********************************************!*\
16990 !*** ./src/diagrams/sequence/sequenceDb.js ***!
16991 \*********************************************/
16992/*! 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 */
16993/***/ (function(module, __webpack_exports__, __webpack_require__) {
16994
16995"use strict";
16996__webpack_require__.r(__webpack_exports__);
16997/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
16998/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addActor", function() { return addActor; });
16999/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addMessage", function() { return addMessage; });
17000/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSignal", function() { return addSignal; });
17001/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMessages", function() { return getMessages; });
17002/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getActors", function() { return getActors; });
17003/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getActor", function() { return getActor; });
17004/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getActorKeys", function() { return getActorKeys; });
17005/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTitle", function() { return getTitle; });
17006/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTitleWrapped", function() { return getTitleWrapped; });
17007/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableSequenceNumbers", function() { return enableSequenceNumbers; });
17008/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showSequenceNumbers", function() { return showSequenceNumbers; });
17009/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setWrap", function() { return setWrap; });
17010/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autoWrap", function() { return autoWrap; });
17011/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
17012/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseMessage", function() { return parseMessage; });
17013/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LINETYPE", function() { return LINETYPE; });
17014/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARROWTYPE", function() { return ARROWTYPE; });
17015/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PLACEMENT", function() { return PLACEMENT; });
17016/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addNote", function() { return addNote; });
17017/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTitle", function() { return setTitle; });
17018/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apply", function() { return apply; });
17019/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
17020/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
17021/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
17022/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
17023
17024
17025
17026
17027var prevActor = undefined;
17028var actors = {};
17029var messages = [];
17030var notes = [];
17031var title = '';
17032var titleWrapped = false;
17033var sequenceNumbersEnabled = false;
17034var wrapEnabled = false;
17035var parseDirective = function parseDirective(statement, context, type) {
17036 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
17037};
17038var addActor = function addActor(id, name, description) {
17039 // Don't allow description nulling
17040 var old = actors[id];
17041 if (old && name === old.name && description == null) return; // Don't allow null descriptions, either
17042
17043 if (description == null || description.text == null) {
17044 description = {
17045 text: name,
17046 wrap: null
17047 };
17048 }
17049
17050 actors[id] = {
17051 name: name,
17052 description: description.text,
17053 wrap: description.wrap === undefined && autoWrap() || !!description.wrap,
17054 prevActor: prevActor
17055 };
17056
17057 if (prevActor && actors[prevActor]) {
17058 actors[prevActor].nextActor = id;
17059 }
17060
17061 prevActor = id;
17062};
17063
17064var activationCount = function activationCount(part) {
17065 var i;
17066 var count = 0;
17067
17068 for (i = 0; i < messages.length; i++) {
17069 if (messages[i].type === LINETYPE.ACTIVE_START) {
17070 if (messages[i].from.actor === part) {
17071 count++;
17072 }
17073 }
17074
17075 if (messages[i].type === LINETYPE.ACTIVE_END) {
17076 if (messages[i].from.actor === part) {
17077 count--;
17078 }
17079 }
17080 }
17081
17082 return count;
17083};
17084
17085var addMessage = function addMessage(idFrom, idTo, message, answer) {
17086 messages.push({
17087 from: idFrom,
17088 to: idTo,
17089 message: message.text,
17090 wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
17091 answer: answer
17092 });
17093};
17094var addSignal = function addSignal(idFrom, idTo) {
17095 var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
17096 text: undefined,
17097 wrap: undefined
17098 };
17099 var messageType = arguments.length > 3 ? arguments[3] : undefined;
17100
17101 if (messageType === LINETYPE.ACTIVE_END) {
17102 var cnt = activationCount(idFrom.actor);
17103
17104 if (cnt < 1) {
17105 // Bail out as there is an activation signal from an inactive participant
17106 var error = new Error('Trying to inactivate an inactive participant (' + idFrom.actor + ')');
17107 error.hash = {
17108 text: '->>-',
17109 token: '->>-',
17110 line: '1',
17111 loc: {
17112 first_line: 1,
17113 last_line: 1,
17114 first_column: 1,
17115 last_column: 1
17116 },
17117 expected: ["'ACTIVE_PARTICIPANT'"]
17118 };
17119 throw error;
17120 }
17121 }
17122
17123 messages.push({
17124 from: idFrom,
17125 to: idTo,
17126 message: message.text,
17127 wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
17128 type: messageType
17129 });
17130 return true;
17131};
17132var getMessages = function getMessages() {
17133 return messages;
17134};
17135var getActors = function getActors() {
17136 return actors;
17137};
17138var getActor = function getActor(id) {
17139 return actors[id];
17140};
17141var getActorKeys = function getActorKeys() {
17142 return Object.keys(actors);
17143};
17144var getTitle = function getTitle() {
17145 return title;
17146};
17147var getTitleWrapped = function getTitleWrapped() {
17148 return titleWrapped;
17149};
17150var enableSequenceNumbers = function enableSequenceNumbers() {
17151 sequenceNumbersEnabled = true;
17152};
17153var showSequenceNumbers = function showSequenceNumbers() {
17154 return sequenceNumbersEnabled;
17155};
17156var setWrap = function setWrap(wrapSetting) {
17157 wrapEnabled = wrapSetting;
17158};
17159var autoWrap = function autoWrap() {
17160 return wrapEnabled;
17161};
17162var clear = function clear() {
17163 actors = {};
17164 messages = [];
17165};
17166var parseMessage = function parseMessage(str) {
17167 var _str = str.trim();
17168
17169 var message = {
17170 text: _str.replace(/^[:]?(?:no)?wrap:/, '').trim(),
17171 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
17172 };
17173 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('parseMessage:', message);
17174 return message;
17175};
17176var LINETYPE = {
17177 SOLID: 0,
17178 DOTTED: 1,
17179 NOTE: 2,
17180 SOLID_CROSS: 3,
17181 DOTTED_CROSS: 4,
17182 SOLID_OPEN: 5,
17183 DOTTED_OPEN: 6,
17184 LOOP_START: 10,
17185 LOOP_END: 11,
17186 ALT_START: 12,
17187 ALT_ELSE: 13,
17188 ALT_END: 14,
17189 OPT_START: 15,
17190 OPT_END: 16,
17191 ACTIVE_START: 17,
17192 ACTIVE_END: 18,
17193 PAR_START: 19,
17194 PAR_AND: 20,
17195 PAR_END: 21,
17196 RECT_START: 22,
17197 RECT_END: 23
17198};
17199var ARROWTYPE = {
17200 FILLED: 0,
17201 OPEN: 1
17202};
17203var PLACEMENT = {
17204 LEFTOF: 0,
17205 RIGHTOF: 1,
17206 OVER: 2
17207};
17208var addNote = function addNote(actor, placement, message) {
17209 var note = {
17210 actor: actor,
17211 placement: placement,
17212 message: message.text,
17213 wrap: message.wrap === undefined && autoWrap() || !!message.wrap
17214 }; // Coerce actor into a [to, from, ...] array
17215
17216 var actors = [].concat(actor, actor);
17217 notes.push(note);
17218 messages.push({
17219 from: actors[0],
17220 to: actors[1],
17221 message: message.text,
17222 wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
17223 type: LINETYPE.NOTE,
17224 placement: placement
17225 });
17226};
17227var setTitle = function setTitle(titleWrap) {
17228 title = titleWrap.text;
17229 titleWrapped = titleWrap.wrap === undefined && autoWrap() || !!titleWrap.wrap;
17230};
17231var apply = function apply(param) {
17232 if (param instanceof Array) {
17233 param.forEach(function (item) {
17234 apply(item);
17235 });
17236 } else {
17237 switch (param.type) {
17238 case 'addActor':
17239 addActor(param.actor, param.actor, param.description);
17240 break;
17241
17242 case 'activeStart':
17243 addSignal(param.actor, undefined, undefined, param.signalType);
17244 break;
17245
17246 case 'activeEnd':
17247 addSignal(param.actor, undefined, undefined, param.signalType);
17248 break;
17249
17250 case 'addNote':
17251 addNote(param.actor, param.placement, param.text);
17252 break;
17253
17254 case 'addMessage':
17255 addSignal(param.from, param.to, param.msg, param.signalType);
17256 break;
17257
17258 case 'loopStart':
17259 addSignal(undefined, undefined, param.loopText, param.signalType);
17260 break;
17261
17262 case 'loopEnd':
17263 addSignal(undefined, undefined, undefined, param.signalType);
17264 break;
17265
17266 case 'rectStart':
17267 addSignal(undefined, undefined, param.color, param.signalType);
17268 break;
17269
17270 case 'rectEnd':
17271 addSignal(undefined, undefined, undefined, param.signalType);
17272 break;
17273
17274 case 'optStart':
17275 addSignal(undefined, undefined, param.optText, param.signalType);
17276 break;
17277
17278 case 'optEnd':
17279 addSignal(undefined, undefined, undefined, param.signalType);
17280 break;
17281
17282 case 'altStart':
17283 addSignal(undefined, undefined, param.altText, param.signalType);
17284 break;
17285
17286 case 'else':
17287 addSignal(undefined, undefined, param.altText, param.signalType);
17288 break;
17289
17290 case 'altEnd':
17291 addSignal(undefined, undefined, undefined, param.signalType);
17292 break;
17293
17294 case 'setTitle':
17295 setTitle(param.text);
17296 break;
17297
17298 case 'parStart':
17299 addSignal(undefined, undefined, param.parText, param.signalType);
17300 break;
17301
17302 case 'and':
17303 addSignal(undefined, undefined, param.parText, param.signalType);
17304 break;
17305
17306 case 'parEnd':
17307 addSignal(undefined, undefined, undefined, param.signalType);
17308 break;
17309 }
17310 }
17311};
17312/* harmony default export */ __webpack_exports__["default"] = ({
17313 addActor: addActor,
17314 addMessage: addMessage,
17315 addSignal: addSignal,
17316 autoWrap: autoWrap,
17317 setWrap: setWrap,
17318 enableSequenceNumbers: enableSequenceNumbers,
17319 showSequenceNumbers: showSequenceNumbers,
17320 getMessages: getMessages,
17321 getActors: getActors,
17322 getActor: getActor,
17323 getActorKeys: getActorKeys,
17324 getTitle: getTitle,
17325 parseDirective: parseDirective,
17326 getConfig: function getConfig() {
17327 return _config__WEBPACK_IMPORTED_MODULE_1__["getConfig"]().sequence;
17328 },
17329 getTitleWrapped: getTitleWrapped,
17330 clear: clear,
17331 parseMessage: parseMessage,
17332 LINETYPE: LINETYPE,
17333 ARROWTYPE: ARROWTYPE,
17334 PLACEMENT: PLACEMENT,
17335 addNote: addNote,
17336 setTitle: setTitle,
17337 apply: apply
17338});
17339
17340/***/ }),
17341
17342/***/ "./src/diagrams/sequence/sequenceRenderer.js":
17343/*!***************************************************!*\
17344 !*** ./src/diagrams/sequence/sequenceRenderer.js ***!
17345 \***************************************************/
17346/*! exports provided: bounds, drawActors, setConf, draw, default */
17347/***/ (function(module, __webpack_exports__, __webpack_require__) {
17348
17349"use strict";
17350__webpack_require__.r(__webpack_exports__);
17351/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bounds", function() { return bounds; });
17352/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawActors", function() { return drawActors; });
17353/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
17354/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
17355/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
17356/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
17357/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/sequence/svgDraw.js");
17358/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
17359/* harmony import */ var _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/sequenceDiagram */ "./src/diagrams/sequence/parser/sequenceDiagram.jison");
17360/* harmony import */ var _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__);
17361/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
17362/* harmony import */ var _sequenceDb__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./sequenceDb */ "./src/diagrams/sequence/sequenceDb.js");
17363/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js");
17364/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
17365
17366
17367
17368
17369
17370
17371
17372
17373_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy = _sequenceDb__WEBPACK_IMPORTED_MODULE_5__["default"];
17374var conf = {};
17375var bounds = {
17376 data: {
17377 startx: undefined,
17378 stopx: undefined,
17379 starty: undefined,
17380 stopy: undefined
17381 },
17382 verticalPos: 0,
17383 sequenceItems: [],
17384 activations: [],
17385 models: {
17386 getHeight: function getHeight() {
17387 return Math.max.apply(null, this.actors.length === 0 ? [0] : this.actors.map(function (actor) {
17388 return actor.height || 0;
17389 })) + (this.loops.length === 0 ? 0 : this.loops.map(function (it) {
17390 return it.height || 0;
17391 }).reduce(function (acc, h) {
17392 return acc + h;
17393 })) + (this.messages.length === 0 ? 0 : this.messages.map(function (it) {
17394 return it.height || 0;
17395 }).reduce(function (acc, h) {
17396 return acc + h;
17397 })) + (this.notes.length === 0 ? 0 : this.notes.map(function (it) {
17398 return it.height || 0;
17399 }).reduce(function (acc, h) {
17400 return acc + h;
17401 }));
17402 },
17403 clear: function clear() {
17404 this.actors = [];
17405 this.loops = [];
17406 this.messages = [];
17407 this.notes = [];
17408 },
17409 addActor: function addActor(actorModel) {
17410 this.actors.push(actorModel);
17411 },
17412 addLoop: function addLoop(loopModel) {
17413 this.loops.push(loopModel);
17414 },
17415 addMessage: function addMessage(msgModel) {
17416 this.messages.push(msgModel);
17417 },
17418 addNote: function addNote(noteModel) {
17419 this.notes.push(noteModel);
17420 },
17421 lastActor: function lastActor() {
17422 return this.actors[this.actors.length - 1];
17423 },
17424 lastLoop: function lastLoop() {
17425 return this.loops[this.loops.length - 1];
17426 },
17427 lastMessage: function lastMessage() {
17428 return this.messages[this.messages.length - 1];
17429 },
17430 lastNote: function lastNote() {
17431 return this.notes[this.notes.length - 1];
17432 },
17433 actors: [],
17434 loops: [],
17435 messages: [],
17436 notes: []
17437 },
17438 init: function init() {
17439 this.sequenceItems = [];
17440 this.activations = [];
17441 this.models.clear();
17442 this.data = {
17443 startx: undefined,
17444 stopx: undefined,
17445 starty: undefined,
17446 stopy: undefined
17447 };
17448 this.verticalPos = 0;
17449 setConf(_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.getConfig());
17450 },
17451 updateVal: function updateVal(obj, key, val, fun) {
17452 if (typeof obj[key] === 'undefined') {
17453 obj[key] = val;
17454 } else {
17455 obj[key] = fun(val, obj[key]);
17456 }
17457 },
17458 updateBounds: function updateBounds(startx, starty, stopx, stopy) {
17459 var _self = this;
17460
17461 var cnt = 0;
17462
17463 function updateFn(type) {
17464 return function updateItemBounds(item) {
17465 cnt++; // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
17466
17467 var n = _self.sequenceItems.length - cnt + 1;
17468
17469 _self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min);
17470
17471 _self.updateVal(item, 'stopy', stopy + n * conf.boxMargin, Math.max);
17472
17473 _self.updateVal(bounds.data, 'startx', startx - n * conf.boxMargin, Math.min);
17474
17475 _self.updateVal(bounds.data, 'stopx', stopx + n * conf.boxMargin, Math.max);
17476
17477 if (!(type === 'activation')) {
17478 _self.updateVal(item, 'startx', startx - n * conf.boxMargin, Math.min);
17479
17480 _self.updateVal(item, 'stopx', stopx + n * conf.boxMargin, Math.max);
17481
17482 _self.updateVal(bounds.data, 'starty', starty - n * conf.boxMargin, Math.min);
17483
17484 _self.updateVal(bounds.data, 'stopy', stopy + n * conf.boxMargin, Math.max);
17485 }
17486 };
17487 }
17488
17489 this.sequenceItems.forEach(updateFn());
17490 this.activations.forEach(updateFn('activation'));
17491 },
17492 insert: function insert(startx, starty, stopx, stopy) {
17493 var _startx = Math.min(startx, stopx);
17494
17495 var _stopx = Math.max(startx, stopx);
17496
17497 var _starty = Math.min(starty, stopy);
17498
17499 var _stopy = Math.max(starty, stopy);
17500
17501 this.updateVal(bounds.data, 'startx', _startx, Math.min);
17502 this.updateVal(bounds.data, 'starty', _starty, Math.min);
17503 this.updateVal(bounds.data, 'stopx', _stopx, Math.max);
17504 this.updateVal(bounds.data, 'stopy', _stopy, Math.max);
17505 this.updateBounds(_startx, _starty, _stopx, _stopy);
17506 },
17507 newActivation: function newActivation(message, diagram, actors) {
17508 var actorRect = actors[message.from.actor];
17509 var stackedSize = actorActivations(message.from.actor).length || 0;
17510 var x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
17511 this.activations.push({
17512 startx: x,
17513 starty: this.verticalPos + 2,
17514 stopx: x + conf.activationWidth,
17515 stopy: undefined,
17516 actor: message.from.actor,
17517 anchored: _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].anchorElement(diagram)
17518 });
17519 },
17520 endActivation: function endActivation(message) {
17521 // find most recent activation for given actor
17522 var lastActorActivationIdx = this.activations.map(function (activation) {
17523 return activation.actor;
17524 }).lastIndexOf(message.from.actor);
17525 return this.activations.splice(lastActorActivationIdx, 1)[0];
17526 },
17527 createLoop: function createLoop() {
17528 var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
17529 message: undefined,
17530 wrap: false,
17531 width: undefined
17532 };
17533 var fill = arguments.length > 1 ? arguments[1] : undefined;
17534 return {
17535 startx: undefined,
17536 starty: this.verticalPos,
17537 stopx: undefined,
17538 stopy: undefined,
17539 title: title.message,
17540 wrap: title.wrap,
17541 width: title.width,
17542 height: 0,
17543 fill: fill
17544 };
17545 },
17546 newLoop: function newLoop() {
17547 var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
17548 message: undefined,
17549 wrap: false,
17550 width: undefined
17551 };
17552 var fill = arguments.length > 1 ? arguments[1] : undefined;
17553 this.sequenceItems.push(this.createLoop(title, fill));
17554 },
17555 endLoop: function endLoop() {
17556 return this.sequenceItems.pop();
17557 },
17558 addSectionToLoop: function addSectionToLoop(message) {
17559 var loop = this.sequenceItems.pop();
17560 loop.sections = loop.sections || [];
17561 loop.sectionTitles = loop.sectionTitles || [];
17562 loop.sections.push({
17563 y: bounds.getVerticalPos(),
17564 height: 0
17565 });
17566 loop.sectionTitles.push(message);
17567 this.sequenceItems.push(loop);
17568 },
17569 bumpVerticalPos: function bumpVerticalPos(bump) {
17570 this.verticalPos = this.verticalPos + bump;
17571 this.data.stopy = this.verticalPos;
17572 },
17573 getVerticalPos: function getVerticalPos() {
17574 return this.verticalPos;
17575 },
17576 getBounds: function getBounds() {
17577 return {
17578 bounds: this.data,
17579 models: this.models
17580 };
17581 }
17582};
17583/**
17584 * Draws an note in the diagram with the attached line
17585 * @param elem - The diagram to draw to.
17586 * @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.
17587 */
17588
17589var drawNote = function drawNote(elem, noteModel) {
17590 bounds.bumpVerticalPos(conf.boxMargin);
17591 noteModel.height = conf.boxMargin;
17592 noteModel.starty = bounds.getVerticalPos();
17593 var rect = _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].getNoteRect();
17594 rect.x = noteModel.startx;
17595 rect.y = noteModel.starty;
17596 rect.width = noteModel.width || conf.width;
17597 rect.class = 'note';
17598 var g = elem.append('g');
17599 var rectElem = _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawRect(g, rect);
17600 var textObj = _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].getTextObj();
17601 textObj.x = noteModel.startx;
17602 textObj.y = noteModel.starty;
17603 textObj.width = rect.width;
17604 textObj.dy = '1em';
17605 textObj.text = noteModel.message;
17606 textObj.class = 'noteText';
17607 textObj.fontFamily = conf.noteFontFamily;
17608 textObj.fontSize = conf.noteFontSize;
17609 textObj.fontWeight = conf.noteFontWeight;
17610 textObj.anchor = conf.noteAlign;
17611 textObj.textMargin = conf.noteMargin;
17612 textObj.valign = conf.noteAlign;
17613 textObj.wrap = true;
17614 var textElem = Object(_svgDraw__WEBPACK_IMPORTED_MODULE_1__["drawText"])(g, textObj);
17615 var textHeight = Math.round(textElem.map(function (te) {
17616 return (te._groups || te)[0][0].getBBox().height;
17617 }).reduce(function (acc, curr) {
17618 return acc + curr;
17619 }));
17620 rectElem.attr('height', textHeight + 2 * conf.noteMargin);
17621 noteModel.height += textHeight + 2 * conf.noteMargin;
17622 bounds.bumpVerticalPos(textHeight + 2 * conf.noteMargin);
17623 noteModel.stopy = noteModel.starty + textHeight + 2 * conf.noteMargin;
17624 noteModel.stopx = noteModel.startx + rect.width;
17625 bounds.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
17626 bounds.models.addNote(noteModel);
17627};
17628
17629var messageFont = function messageFont(cnf) {
17630 return {
17631 fontFamily: cnf.messageFontFamily,
17632 fontSize: cnf.messageFontSize,
17633 fontWeight: cnf.messageFontWeight
17634 };
17635};
17636
17637var noteFont = function noteFont(cnf) {
17638 return {
17639 fontFamily: cnf.noteFontFamily,
17640 fontSize: cnf.noteFontSize,
17641 fontWeight: cnf.noteFontWeight
17642 };
17643};
17644
17645var actorFont = function actorFont(cnf) {
17646 return {
17647 fontFamily: cnf.actorFontFamily,
17648 fontSize: cnf.actorFontSize,
17649 fontWeight: cnf.actorFontWeight
17650 };
17651};
17652/**
17653 * Draws a message
17654 * @param g - the parent of the message element
17655 * @param msgModel - the model containing fields describing a message
17656 */
17657
17658
17659var drawMessage = function drawMessage(g, msgModel) {
17660 bounds.bumpVerticalPos(10);
17661 var startx = msgModel.startx,
17662 stopx = msgModel.stopx,
17663 starty = msgModel.starty,
17664 message = msgModel.message,
17665 type = msgModel.type,
17666 sequenceIndex = msgModel.sequenceIndex,
17667 wrap = msgModel.wrap;
17668 var lines = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].splitBreaks(message).length;
17669 var textDims = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(message, messageFont(conf));
17670 var lineHeight = textDims.height / lines;
17671 msgModel.height += lineHeight;
17672 bounds.bumpVerticalPos(lineHeight);
17673 var textObj = _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].getTextObj();
17674 textObj.x = startx;
17675 textObj.y = starty + 10;
17676 textObj.width = stopx - startx;
17677 textObj.class = 'messageText';
17678 textObj.dy = '1em';
17679 textObj.text = message;
17680 textObj.fontFamily = conf.messageFontFamily;
17681 textObj.fontSize = conf.messageFontSize;
17682 textObj.fontWeight = conf.messageFontWeight;
17683 textObj.anchor = conf.messageAlign;
17684 textObj.valign = conf.messageAlign;
17685 textObj.textMargin = conf.wrapPadding;
17686 textObj.tspan = false;
17687 textObj.wrap = wrap;
17688 Object(_svgDraw__WEBPACK_IMPORTED_MODULE_1__["drawText"])(g, textObj);
17689 var totalOffset = textDims.height - 10;
17690 var textWidth = textDims.width;
17691 var line, lineStarty;
17692
17693 if (startx === stopx) {
17694 lineStarty = bounds.getVerticalPos() + totalOffset;
17695
17696 if (conf.rightAngles) {
17697 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));
17698 } else {
17699 totalOffset += conf.boxMargin;
17700 lineStarty = bounds.getVerticalPos() + totalOffset;
17701 line = g.append('path').attr('d', 'M ' + startx + ',' + lineStarty + ' C ' + (startx + 60) + ',' + (lineStarty - 10) + ' ' + (startx + 60) + ',' + (lineStarty + 30) + ' ' + startx + ',' + (lineStarty + 20));
17702 }
17703
17704 totalOffset += 30;
17705 var dx = Math.max(textWidth / 2, conf.width / 2);
17706 bounds.insert(startx - dx, bounds.getVerticalPos() - 10 + totalOffset, stopx + dx, bounds.getVerticalPos() + 30 + totalOffset);
17707 } else {
17708 totalOffset += conf.boxMargin;
17709 lineStarty = bounds.getVerticalPos() + totalOffset;
17710 line = g.append('line');
17711 line.attr('x1', startx);
17712 line.attr('y1', lineStarty);
17713 line.attr('x2', stopx);
17714 line.attr('y2', lineStarty);
17715 bounds.insert(startx, lineStarty - 10, stopx, lineStarty);
17716 } // Make an SVG Container
17717 // Draw the line
17718
17719
17720 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) {
17721 line.style('stroke-dasharray', '3, 3');
17722 line.attr('class', 'messageLine1');
17723 } else {
17724 line.attr('class', 'messageLine0');
17725 }
17726
17727 var url = '';
17728
17729 if (conf.arrowMarkerAbsolute) {
17730 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
17731 url = url.replace(/\(/g, '\\(');
17732 url = url.replace(/\)/g, '\\)');
17733 }
17734
17735 line.attr('stroke-width', 2);
17736 line.attr('stroke', 'none'); // handled by theme/css anyway
17737
17738 line.style('fill', 'none'); // remove any fill colour
17739
17740 if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.SOLID || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.DOTTED) {
17741 line.attr('marker-end', 'url(' + url + '#arrowhead)');
17742 }
17743
17744 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) {
17745 line.attr('marker-end', 'url(' + url + '#crosshead)');
17746 } // add node number
17747
17748
17749 if (_sequenceDb__WEBPACK_IMPORTED_MODULE_5__["default"].showSequenceNumbers() || conf.showSequenceNumbers) {
17750 line.attr('marker-start', 'url(' + url + '#sequencenumber)');
17751 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);
17752 }
17753
17754 bounds.bumpVerticalPos(totalOffset);
17755 msgModel.height += totalOffset;
17756 msgModel.stopy = msgModel.starty + msgModel.height;
17757 bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
17758};
17759
17760var drawActors = function drawActors(diagram, actors, actorKeys, verticalPos) {
17761 // Draw the actors
17762 var prevWidth = 0;
17763 var prevMargin = 0;
17764
17765 for (var i = 0; i < actorKeys.length; i++) {
17766 var actor = actors[actorKeys[i]]; // Add some rendering data to the object
17767
17768 actor.width = actor.width || conf.width;
17769 actor.height = Math.max(actor.height || conf.height, conf.height);
17770 actor.margin = actor.margin || conf.actorMargin;
17771 actor.x = prevWidth + prevMargin;
17772 actor.y = verticalPos; // Draw the box with the attached line
17773
17774 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawActor(diagram, actor, conf);
17775 bounds.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
17776 prevWidth += actor.width;
17777 prevMargin += actor.margin;
17778 bounds.models.addActor(actor);
17779 } // Add a margin between the actor boxes and the first arrow
17780
17781
17782 bounds.bumpVerticalPos(conf.height);
17783};
17784var setConf = function setConf(cnf) {
17785 Object(_utils__WEBPACK_IMPORTED_MODULE_7__["assignWithDepth"])(conf, cnf);
17786
17787 if (cnf.fontFamily) {
17788 conf.actorFontFamily = conf.noteFontFamily = conf.messageFontFamily = cnf.fontFamily;
17789 }
17790
17791 if (cnf.fontSize) {
17792 conf.actorFontSize = conf.noteFontSize = conf.messageFontSize = cnf.fontSize;
17793 }
17794
17795 if (cnf.fontWeight) {
17796 conf.actorFontWeight = conf.noteFontWeight = conf.messageFontWeight = cnf.fontWeight;
17797 }
17798};
17799
17800var actorActivations = function actorActivations(actor) {
17801 return bounds.activations.filter(function (activation) {
17802 return activation.actor === actor;
17803 });
17804};
17805
17806var activationBounds = function activationBounds(actor, actors) {
17807 // handle multiple stacked activations for same actor
17808 var actorObj = actors[actor];
17809 var activations = actorActivations(actor);
17810 var left = activations.reduce(function (acc, activation) {
17811 return Math.min(acc, activation.startx);
17812 }, actorObj.x + actorObj.width / 2);
17813 var right = activations.reduce(function (acc, activation) {
17814 return Math.max(acc, activation.stopx);
17815 }, actorObj.x + actorObj.width / 2);
17816 return [left, right];
17817};
17818
17819function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
17820 bounds.bumpVerticalPos(preMargin);
17821 var heightAdjust = postMargin;
17822
17823 if (msg.id && msg.message && loopWidths[msg.id]) {
17824 var loopWidth = loopWidths[msg.id].width;
17825 var textConf = messageFont(conf);
17826 msg.message = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel("[".concat(msg.message, "]"), loopWidth - 2 * conf.wrapPadding, textConf);
17827 msg.width = loopWidth;
17828 msg.wrap = true; // const lines = common.splitBreaks(msg.message).length;
17829
17830 var textDims = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(msg.message, textConf);
17831 var totalOffset = Math.max(textDims.height, conf.labelBoxHeight);
17832 heightAdjust = postMargin + totalOffset;
17833 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug("".concat(totalOffset, " - ").concat(msg.message));
17834 }
17835
17836 addLoopFn(msg);
17837 bounds.bumpVerticalPos(heightAdjust);
17838}
17839/**
17840 * Draws a sequenceDiagram in the tag with id: id based on the graph definition in text.
17841 * @param text
17842 * @param id
17843 */
17844
17845
17846var draw = function draw(text, id) {
17847 conf = _config__WEBPACK_IMPORTED_MODULE_6__["getConfig"]().sequence;
17848 _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.clear();
17849 _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.setWrap(conf.wrap);
17850 _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].parse(text + '\n');
17851 bounds.init();
17852 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug("C:".concat(JSON.stringify(conf, null, 2)));
17853 var diagram = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id=\"".concat(id, "\"]")); // Fetch data from the parsing
17854
17855 var actors = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.getActors();
17856 var actorKeys = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.getActorKeys();
17857 var messages = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.getMessages();
17858 var title = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.getTitle();
17859 var maxMessageWidthPerActor = getMaxMessageWidthPerActor(actors, messages);
17860 conf.height = calculateActorMargins(actors, maxMessageWidthPerActor);
17861 drawActors(diagram, actors, actorKeys, 0);
17862 var loopWidths = calculateLoopBounds(messages, actors, maxMessageWidthPerActor); // The arrow head definition is attached to the svg once
17863
17864 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].insertArrowHead(diagram);
17865 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].insertArrowCrossHead(diagram);
17866 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].insertSequenceNumber(diagram);
17867
17868 function activeEnd(msg, verticalPos) {
17869 var activationData = bounds.endActivation(msg);
17870
17871 if (activationData.starty + 18 > verticalPos) {
17872 activationData.starty = verticalPos - 6;
17873 verticalPos += 12;
17874 }
17875
17876 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawActivation(diagram, activationData, verticalPos, conf, actorActivations(msg.from.actor).length);
17877 bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
17878 } // Draw the messages/signals
17879
17880
17881 var sequenceIndex = 1;
17882 messages.forEach(function (msg) {
17883 var loopModel, noteModel, msgModel;
17884
17885 switch (msg.type) {
17886 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.NOTE:
17887 noteModel = msg.noteModel;
17888 drawNote(diagram, noteModel);
17889 break;
17890
17891 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ACTIVE_START:
17892 bounds.newActivation(msg, diagram, actors);
17893 break;
17894
17895 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ACTIVE_END:
17896 activeEnd(msg, bounds.getVerticalPos());
17897 break;
17898
17899 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.LOOP_START:
17900 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
17901 return bounds.newLoop(message);
17902 });
17903 break;
17904
17905 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.LOOP_END:
17906 loopModel = bounds.endLoop();
17907 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawLoop(diagram, loopModel, 'loop', conf);
17908 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
17909 bounds.models.addLoop(loopModel);
17910 break;
17911
17912 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.RECT_START:
17913 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin, function (message) {
17914 return bounds.newLoop(undefined, message.message);
17915 });
17916 break;
17917
17918 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.RECT_END:
17919 loopModel = bounds.endLoop();
17920 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawBackgroundRect(diagram, loopModel);
17921 bounds.models.addLoop(loopModel);
17922 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
17923 break;
17924
17925 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.OPT_START:
17926 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
17927 return bounds.newLoop(message);
17928 });
17929 break;
17930
17931 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.OPT_END:
17932 loopModel = bounds.endLoop();
17933 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawLoop(diagram, loopModel, 'opt', conf);
17934 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
17935 bounds.models.addLoop(loopModel);
17936 break;
17937
17938 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_START:
17939 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
17940 return bounds.newLoop(message);
17941 });
17942 break;
17943
17944 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_ELSE:
17945 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin + conf.boxTextMargin, conf.boxMargin, function (message) {
17946 return bounds.addSectionToLoop(message);
17947 });
17948 break;
17949
17950 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_END:
17951 loopModel = bounds.endLoop();
17952 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawLoop(diagram, loopModel, 'alt', conf);
17953 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
17954 bounds.models.addLoop(loopModel);
17955 break;
17956
17957 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_START:
17958 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
17959 return bounds.newLoop(message);
17960 });
17961 break;
17962
17963 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_AND:
17964 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin + conf.boxTextMargin, conf.boxMargin, function (message) {
17965 return bounds.addSectionToLoop(message);
17966 });
17967 break;
17968
17969 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_END:
17970 loopModel = bounds.endLoop();
17971 _svgDraw__WEBPACK_IMPORTED_MODULE_1__["default"].drawLoop(diagram, loopModel, 'par', conf);
17972 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
17973 bounds.models.addLoop(loopModel);
17974 break;
17975
17976 default:
17977 try {
17978 // lastMsg = msg
17979 msgModel = msg.msgModel;
17980 msgModel.starty = bounds.getVerticalPos();
17981 msgModel.sequenceIndex = sequenceIndex;
17982 drawMessage(diagram, msgModel);
17983 bounds.models.addMessage(msgModel);
17984 } catch (e) {
17985 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].error('error while drawing message', e);
17986 }
17987
17988 } // Increment sequence counter if msg.type is a line (and not another event like activation or note, etc)
17989
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 sequenceIndex++;
17993 }
17994 });
17995
17996 if (conf.mirrorActors) {
17997 // Draw actors below diagram
17998 bounds.bumpVerticalPos(conf.boxMargin * 2);
17999 drawActors(diagram, actors, actorKeys, bounds.getVerticalPos());
18000 }
18001
18002 var _bounds$getBounds = bounds.getBounds(),
18003 box = _bounds$getBounds.bounds; // Adjust line height of actor lines now that the height of the diagram is known
18004
18005
18006 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('For line height fix Querying: #' + id + ' .actor-line');
18007 var actorLines = Object(d3__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('#' + id + ' .actor-line');
18008 actorLines.attr('y2', box.stopy);
18009 var height = box.stopy - box.starty + 2 * conf.diagramMarginY;
18010
18011 if (conf.mirrorActors) {
18012 height = height - conf.boxMargin + conf.bottomMarginAdj;
18013 }
18014
18015 var width = box.stopx - box.startx + 2 * conf.diagramMarginX;
18016
18017 if (title) {
18018 diagram.append('text').text(title).attr('x', (box.stopx - box.startx) / 2 - 2 * conf.diagramMarginX).attr('y', -25);
18019 }
18020
18021 Object(_utils__WEBPACK_IMPORTED_MODULE_7__["configureSvgSize"])(diagram, height, width, conf.useMaxWidth);
18022 var extraVertForTitle = title ? 40 : 0;
18023 diagram.attr('viewBox', box.startx - conf.diagramMarginX + ' -' + (conf.diagramMarginY + extraVertForTitle) + ' ' + width + ' ' + (height + extraVertForTitle));
18024 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug("models:", bounds.models);
18025};
18026/**
18027 * Retrieves the max message width of each actor, supports signals (messages, loops)
18028 * and notes.
18029 *
18030 * It will enumerate each given message, and will determine its text width, in relation
18031 * to the actor it originates from, and destined to.
18032 *
18033 * @param actors - The actors map
18034 * @param messages - A list of message objects to iterate
18035 */
18036
18037var getMaxMessageWidthPerActor = function getMaxMessageWidthPerActor(actors, messages) {
18038 var maxMessageWidthPerActor = {};
18039 messages.forEach(function (msg) {
18040 if (actors[msg.to] && actors[msg.from]) {
18041 var actor = actors[msg.to]; // If this is the first actor, and the message is left of it, no need to calculate the margin
18042
18043 if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.LEFTOF && !actor.prevActor) {
18044 return;
18045 } // If this is the last actor, and the message is right of it, no need to calculate the margin
18046
18047
18048 if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.RIGHTOF && !actor.nextActor) {
18049 return;
18050 }
18051
18052 var isNote = msg.placement !== undefined;
18053 var isMessage = !isNote;
18054 var textFont = isNote ? noteFont(conf) : messageFont(conf);
18055 var wrappedMessage = msg.wrap ? _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel(msg.message, conf.width - 2 * conf.wrapPadding, textFont) : msg.message;
18056 var messageDimensions = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(wrappedMessage, textFont);
18057 var messageWidth = messageDimensions.width + 2 * conf.wrapPadding;
18058 /*
18059 * The following scenarios should be supported:
18060 *
18061 * - There's a message (non-note) between fromActor and toActor
18062 * - If fromActor is on the right and toActor is on the left, we should
18063 * define the toActor's margin
18064 * - If fromActor is on the left and toActor is on the right, we should
18065 * define the fromActor's margin
18066 * - There's a note, in which case fromActor == toActor
18067 * - If the note is to the left of the actor, we should define the previous actor
18068 * margin
18069 * - If the note is on the actor, we should define both the previous and next actor
18070 * margins, each being the half of the note size
18071 * - If the note is on the right of the actor, we should define the current actor
18072 * margin
18073 */
18074
18075 if (isMessage && msg.from === actor.nextActor) {
18076 maxMessageWidthPerActor[msg.to] = Math.max(maxMessageWidthPerActor[msg.to] || 0, messageWidth);
18077 } else if (isMessage && msg.from === actor.prevActor) {
18078 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth);
18079 } else if (isMessage && msg.from === msg.to) {
18080 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth / 2);
18081 maxMessageWidthPerActor[msg.to] = Math.max(maxMessageWidthPerActor[msg.to] || 0, messageWidth / 2);
18082 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.RIGHTOF) {
18083 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth);
18084 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.LEFTOF) {
18085 maxMessageWidthPerActor[actor.prevActor] = Math.max(maxMessageWidthPerActor[actor.prevActor] || 0, messageWidth);
18086 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.OVER) {
18087 if (actor.prevActor) {
18088 maxMessageWidthPerActor[actor.prevActor] = Math.max(maxMessageWidthPerActor[actor.prevActor] || 0, messageWidth / 2);
18089 }
18090
18091 if (actor.nextActor) {
18092 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth / 2);
18093 }
18094 }
18095 }
18096 });
18097 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('maxMessageWidthPerActor:', maxMessageWidthPerActor);
18098 return maxMessageWidthPerActor;
18099};
18100/**
18101 * This will calculate the optimal margin for each given actor, for a given
18102 * actor->messageWidth map.
18103 *
18104 * An actor's margin is determined by the width of the actor, the width of the
18105 * largest message that originates from it, and the configured conf.actorMargin.
18106 *
18107 * @param actors - The actors map to calculate margins for
18108 * @param actorToMessageWidth - A map of actor key -> max message width it holds
18109 */
18110
18111
18112var calculateActorMargins = function calculateActorMargins(actors, actorToMessageWidth) {
18113 var maxHeight = 0;
18114 Object.keys(actors).forEach(function (prop) {
18115 var actor = actors[prop];
18116
18117 if (actor.wrap) {
18118 actor.description = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel(actor.description, conf.width - 2 * conf.wrapPadding, actorFont(conf));
18119 }
18120
18121 var actDims = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(actor.description, actorFont(conf));
18122 actor.width = actor.wrap ? conf.width : Math.max(conf.width, actDims.width + 2 * conf.wrapPadding);
18123 actor.height = actor.wrap ? Math.max(actDims.height, conf.height) : conf.height;
18124 maxHeight = Math.max(maxHeight, actor.height);
18125 });
18126
18127 for (var actorKey in actorToMessageWidth) {
18128 var actor = actors[actorKey];
18129
18130 if (!actor) {
18131 continue;
18132 }
18133
18134 var nextActor = actors[actor.nextActor]; // No need to space out an actor that doesn't have a next link
18135
18136 if (!nextActor) {
18137 continue;
18138 }
18139
18140 var messageWidth = actorToMessageWidth[actorKey];
18141 var actorWidth = messageWidth + conf.actorMargin - actor.width / 2 - nextActor.width / 2;
18142 actor.margin = Math.max(actorWidth, conf.actorMargin);
18143 }
18144
18145 return Math.max(maxHeight, conf.height);
18146};
18147
18148var buildNoteModel = function buildNoteModel(msg, actors) {
18149 var startx = actors[msg.from].x;
18150 var stopx = actors[msg.to].x;
18151 var shouldWrap = msg.wrap && msg.message;
18152 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));
18153 var noteModel = {
18154 width: shouldWrap ? conf.width : Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin),
18155 height: 0,
18156 startx: actors[msg.from].x,
18157 stopx: 0,
18158 starty: 0,
18159 stopy: 0,
18160 message: msg.message
18161 };
18162
18163 if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.RIGHTOF) {
18164 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);
18165 noteModel.startx = startx + (actors[msg.from].width + conf.actorMargin) / 2;
18166 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.PLACEMENT.LEFTOF) {
18167 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);
18168 noteModel.startx = startx - noteModel.width + (actors[msg.from].width - conf.actorMargin) / 2;
18169 } else if (msg.to === msg.from) {
18170 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));
18171 noteModel.width = shouldWrap ? Math.max(conf.width, actors[msg.from].width) : Math.max(actors[msg.from].width, conf.width, textDimensions.width + 2 * conf.noteMargin);
18172 noteModel.startx = startx + (actors[msg.from].width - noteModel.width) / 2;
18173 } else {
18174 noteModel.width = Math.abs(startx + actors[msg.from].width / 2 - (stopx + actors[msg.to].width / 2)) + conf.actorMargin;
18175 noteModel.startx = startx < stopx ? startx + actors[msg.from].width / 2 - conf.actorMargin / 2 : stopx + actors[msg.to].width / 2 - conf.actorMargin / 2;
18176 }
18177
18178 if (shouldWrap) {
18179 noteModel.message = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel(msg.message, noteModel.width - 2 * conf.wrapPadding, noteFont(conf));
18180 }
18181
18182 _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, "]"));
18183 return noteModel;
18184};
18185
18186var buildMessageModel = function buildMessageModel(msg, actors) {
18187 var process = false;
18188
18189 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)) {
18190 process = true;
18191 }
18192
18193 if (!process) {
18194 return {};
18195 }
18196
18197 var fromBounds = activationBounds(msg.from, actors);
18198 var toBounds = activationBounds(msg.to, actors);
18199 var fromIdx = fromBounds[0] <= toBounds[0] ? 1 : 0;
18200 var toIdx = fromBounds[0] < toBounds[0] ? 0 : 1;
18201 var allBounds = fromBounds.concat(toBounds);
18202 var boundedWidth = Math.abs(toBounds[toIdx] - fromBounds[fromIdx]);
18203 var msgDims = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].calculateTextDimensions(msg.message, messageFont(conf));
18204
18205 if (msg.wrap && msg.message) {
18206 msg.message = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].wrapLabel(msg.message, Math.max(boundedWidth + 2 * conf.wrapPadding, conf.width), messageFont(conf));
18207 }
18208
18209 return {
18210 width: Math.max(msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding, boundedWidth + 2 * conf.wrapPadding, conf.width),
18211 height: 0,
18212 startx: fromBounds[fromIdx],
18213 stopx: toBounds[toIdx],
18214 starty: 0,
18215 stopy: 0,
18216 message: msg.message,
18217 type: msg.type,
18218 wrap: msg.wrap,
18219 fromBounds: Math.min.apply(null, allBounds),
18220 toBounds: Math.max.apply(null, allBounds)
18221 };
18222};
18223
18224var calculateLoopBounds = function calculateLoopBounds(messages, actors) {
18225 var loops = {};
18226 var stack = [];
18227 var current, noteModel, msgModel;
18228 messages.forEach(function (msg) {
18229 msg.id = _utils__WEBPACK_IMPORTED_MODULE_7__["default"].random({
18230 length: 10
18231 });
18232
18233 switch (msg.type) {
18234 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.LOOP_START:
18235 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_START:
18236 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.OPT_START:
18237 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_START:
18238 stack.push({
18239 id: msg.id,
18240 msg: msg.message,
18241 from: Number.MAX_SAFE_INTEGER,
18242 to: Number.MIN_SAFE_INTEGER,
18243 width: 0
18244 });
18245 break;
18246
18247 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_ELSE:
18248 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_AND:
18249 if (msg.message) {
18250 current = stack.pop();
18251 loops[current.id] = current;
18252 loops[msg.id] = current;
18253 stack.push(current);
18254 }
18255
18256 break;
18257
18258 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.LOOP_END:
18259 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ALT_END:
18260 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.OPT_END:
18261 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.PAR_END:
18262 current = stack.pop();
18263 loops[current.id] = current;
18264 break;
18265
18266 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ACTIVE_START:
18267 {
18268 var actorRect = actors[msg.from ? msg.from.actor : msg.to.actor];
18269 var stackedSize = actorActivations(msg.from ? msg.from.actor : msg.to.actor).length;
18270 var x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
18271 var toAdd = {
18272 startx: x,
18273 stopx: x + conf.activationWidth,
18274 actor: msg.from.actor,
18275 enabled: true
18276 };
18277 bounds.activations.push(toAdd);
18278 }
18279 break;
18280
18281 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_3__["parser"].yy.LINETYPE.ACTIVE_END:
18282 {
18283 var lastActorActivationIdx = bounds.activations.map(function (a) {
18284 return a.actor;
18285 }).lastIndexOf(msg.from.actor);
18286 delete bounds.activations.splice(lastActorActivationIdx, 1)[0];
18287 }
18288 break;
18289 }
18290
18291 var isNote = msg.placement !== undefined;
18292
18293 if (isNote) {
18294 noteModel = buildNoteModel(msg, actors);
18295 msg.noteModel = noteModel;
18296 stack.forEach(function (stk) {
18297 current = stk;
18298 current.from = Math.min(current.from, noteModel.startx);
18299 current.to = Math.max(current.to, noteModel.startx + noteModel.width);
18300 current.width = Math.max(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
18301 });
18302 } else {
18303 msgModel = buildMessageModel(msg, actors);
18304 msg.msgModel = msgModel;
18305
18306 if (msgModel.startx && msgModel.stopx && stack.length > 0) {
18307 stack.forEach(function (stk) {
18308 current = stk;
18309
18310 if (msgModel.startx === msgModel.stopx) {
18311 var from = actors[msg.from];
18312 var to = actors[msg.to];
18313 current.from = Math.min(from.x - msgModel.width / 2, from.x - from.width / 2, current.from);
18314 current.to = Math.max(to.x + msgModel.width / 2, to.x + from.width / 2, current.to);
18315 current.width = Math.max(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth;
18316 } else {
18317 current.from = Math.min(msgModel.startx, current.from);
18318 current.to = Math.max(msgModel.stopx, current.to);
18319 current.width = Math.max(current.width, msgModel.width) - conf.labelBoxWidth;
18320 }
18321 });
18322 }
18323 }
18324 });
18325 bounds.activations = [];
18326 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Loop type widths:', loops);
18327 return loops;
18328};
18329
18330/* harmony default export */ __webpack_exports__["default"] = ({
18331 bounds: bounds,
18332 drawActors: drawActors,
18333 setConf: setConf,
18334 draw: draw
18335});
18336
18337/***/ }),
18338
18339/***/ "./src/diagrams/sequence/styles.js":
18340/*!*****************************************!*\
18341 !*** ./src/diagrams/sequence/styles.js ***!
18342 \*****************************************/
18343/*! exports provided: default */
18344/***/ (function(module, __webpack_exports__, __webpack_require__) {
18345
18346"use strict";
18347__webpack_require__.r(__webpack_exports__);
18348var getStyles = function getStyles(options) {
18349 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");
18350};
18351
18352/* harmony default export */ __webpack_exports__["default"] = (getStyles);
18353
18354/***/ }),
18355
18356/***/ "./src/diagrams/sequence/svgDraw.js":
18357/*!******************************************!*\
18358 !*** ./src/diagrams/sequence/svgDraw.js ***!
18359 \******************************************/
18360/*! exports provided: drawRect, drawText, drawLabel, drawActor, anchorElement, drawActivation, drawLoop, drawBackgroundRect, insertArrowHead, insertSequenceNumber, insertArrowCrossHead, getTextObj, getNoteRect, default */
18361/***/ (function(module, __webpack_exports__, __webpack_require__) {
18362
18363"use strict";
18364__webpack_require__.r(__webpack_exports__);
18365/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawRect", function() { return drawRect; });
18366/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawText", function() { return drawText; });
18367/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawLabel", function() { return drawLabel; });
18368/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawActor", function() { return drawActor; });
18369/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "anchorElement", function() { return anchorElement; });
18370/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawActivation", function() { return drawActivation; });
18371/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawLoop", function() { return drawLoop; });
18372/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawBackgroundRect", function() { return drawBackgroundRect; });
18373/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertArrowHead", function() { return insertArrowHead; });
18374/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertSequenceNumber", function() { return insertSequenceNumber; });
18375/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertArrowCrossHead", function() { return insertArrowCrossHead; });
18376/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextObj", function() { return getTextObj; });
18377/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNoteRect", function() { return getNoteRect; });
18378/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
18379
18380var drawRect = function drawRect(elem, rectData) {
18381 var rectElem = elem.append('rect');
18382 rectElem.attr('x', rectData.x);
18383 rectElem.attr('y', rectData.y);
18384 rectElem.attr('fill', rectData.fill);
18385 rectElem.attr('stroke', rectData.stroke);
18386 rectElem.attr('width', rectData.width);
18387 rectElem.attr('height', rectData.height);
18388 rectElem.attr('rx', rectData.rx);
18389 rectElem.attr('ry', rectData.ry);
18390
18391 if (typeof rectData.class !== 'undefined') {
18392 rectElem.attr('class', rectData.class);
18393 }
18394
18395 return rectElem;
18396};
18397var drawText = function drawText(elem, textData) {
18398 var prevTextHeight = 0,
18399 textHeight = 0;
18400 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, ' ')];
18401 var textElems = [];
18402 var dy = 0;
18403
18404 var yfunc = function yfunc() {
18405 return textData.y;
18406 };
18407
18408 if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
18409 switch (textData.valign) {
18410 case 'top':
18411 case 'start':
18412 yfunc = function yfunc() {
18413 return Math.round(textData.y + textData.textMargin);
18414 };
18415
18416 break;
18417
18418 case 'middle':
18419 case 'center':
18420 yfunc = function yfunc() {
18421 return Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2);
18422 };
18423
18424 break;
18425
18426 case 'bottom':
18427 case 'end':
18428 yfunc = function yfunc() {
18429 return Math.round(textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin);
18430 };
18431
18432 break;
18433 }
18434 }
18435
18436 if (typeof textData.anchor !== 'undefined' && typeof textData.textMargin !== 'undefined' && typeof textData.width !== 'undefined') {
18437 switch (textData.anchor) {
18438 case 'left':
18439 case 'start':
18440 textData.x = Math.round(textData.x + textData.textMargin);
18441 textData.anchor = 'start';
18442 textData.dominantBaseline = 'text-after-edge';
18443 textData.alignmentBaseline = 'middle';
18444 break;
18445
18446 case 'middle':
18447 case 'center':
18448 textData.x = Math.round(textData.x + textData.width / 2);
18449 textData.anchor = 'middle';
18450 textData.dominantBaseline = 'middle';
18451 textData.alignmentBaseline = 'middle';
18452 break;
18453
18454 case 'right':
18455 case 'end':
18456 textData.x = Math.round(textData.x + textData.width - textData.textMargin);
18457 textData.anchor = 'end';
18458 textData.dominantBaseline = 'text-before-edge';
18459 textData.alignmentBaseline = 'middle';
18460 break;
18461 }
18462 }
18463
18464 for (var i = 0; i < lines.length; i++) {
18465 var line = lines[i];
18466
18467 if (typeof textData.textMargin !== 'undefined' && textData.textMargin === 0 && typeof textData.fontSize !== 'undefined') {
18468 dy = i * textData.fontSize;
18469 }
18470
18471 var textElem = elem.append('text');
18472 textElem.attr('x', textData.x);
18473 textElem.attr('y', yfunc());
18474
18475 if (typeof textData.anchor !== 'undefined') {
18476 textElem.attr('text-anchor', textData.anchor).attr('dominant-baseline', textData.dominantBaseline).attr('alignment-baseline', textData.alignmentBaseline);
18477 }
18478
18479 if (typeof textData.fontFamily !== 'undefined') {
18480 textElem.style('font-family', textData.fontFamily);
18481 }
18482
18483 if (typeof textData.fontSize !== 'undefined') {
18484 textElem.style('font-size', textData.fontSize);
18485 }
18486
18487 if (typeof textData.fontWeight !== 'undefined') {
18488 textElem.style('font-weight', textData.fontWeight);
18489 }
18490
18491 if (typeof textData.fill !== 'undefined') {
18492 textElem.attr('fill', textData.fill);
18493 }
18494
18495 if (typeof textData.class !== 'undefined') {
18496 textElem.attr('class', textData.class);
18497 }
18498
18499 if (typeof textData.dy !== 'undefined') {
18500 textElem.attr('dy', textData.dy);
18501 } else if (dy !== 0) {
18502 textElem.attr('dy', dy);
18503 }
18504
18505 if (textData.tspan) {
18506 var span = textElem.append('tspan');
18507 span.attr('x', textData.x);
18508
18509 if (typeof textData.fill !== 'undefined') {
18510 span.attr('fill', textData.fill);
18511 }
18512
18513 span.text(line);
18514 } else {
18515 textElem.text(line);
18516 }
18517
18518 if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
18519 textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
18520 prevTextHeight = textHeight;
18521 }
18522
18523 textElems.push(textElem);
18524 }
18525
18526 return textElems;
18527};
18528var drawLabel = function drawLabel(elem, txtObject) {
18529 function genPoints(x, y, width, height, cut) {
18530 return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height);
18531 }
18532
18533 var polygon = elem.append('polygon');
18534 polygon.attr('points', genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
18535 polygon.attr('class', 'labelBox');
18536 txtObject.y = txtObject.y + txtObject.height / 2;
18537 drawText(elem, txtObject);
18538 return polygon;
18539};
18540var actorCnt = -1;
18541/**
18542 * Draws an actor in the diagram with the attached line
18543 * @param elem - The diagram we'll draw to.
18544 * @param actor - The actor to draw.
18545 * @param conf - drawText implementation discriminator object
18546 */
18547
18548var drawActor = function drawActor(elem, actor, conf) {
18549 var center = actor.x + actor.width / 2;
18550 var g = elem.append('g');
18551
18552 if (actor.y === 0) {
18553 actorCnt++;
18554 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');
18555 }
18556
18557 var rect = getNoteRect();
18558 rect.x = actor.x;
18559 rect.y = actor.y;
18560 rect.fill = '#eaeaea';
18561 rect.width = actor.width;
18562 rect.height = actor.height;
18563 rect.class = 'actor';
18564 rect.rx = 3;
18565 rect.ry = 3;
18566 drawRect(g, rect);
18567
18568 _drawTextCandidateFunc(conf)(actor.description, g, rect.x, rect.y, rect.width, rect.height, {
18569 class: 'actor'
18570 }, conf);
18571};
18572var anchorElement = function anchorElement(elem) {
18573 return elem.append('g');
18574};
18575/**
18576 * Draws an activation in the diagram
18577 * @param elem - element to append activation rect.
18578 * @param bounds - activation box bounds.
18579 * @param verticalPos - precise y cooridnate of bottom activation box edge.
18580 * @param conf - sequence diagram config object.
18581 * @param actorActivations - number of activations on the actor.
18582 */
18583
18584var drawActivation = function drawActivation(elem, bounds, verticalPos, conf, actorActivations) {
18585 var rect = getNoteRect();
18586 var g = bounds.anchored;
18587 rect.x = bounds.startx;
18588 rect.y = bounds.starty;
18589 rect.class = 'activation' + actorActivations % 3; // Will evaluate to 0, 1 or 2
18590
18591 rect.width = bounds.stopx - bounds.startx;
18592 rect.height = verticalPos - bounds.starty;
18593 drawRect(g, rect);
18594};
18595/**
18596 * Draws a loop in the diagram
18597 * @param elem - elemenet to append the loop to.
18598 * @param loopModel - loopModel of the given loop.
18599 * @param labelText - Text within the loop.
18600 * @param conf - diagrom configuration
18601 */
18602
18603var drawLoop = function drawLoop(elem, loopModel, labelText, conf) {
18604 var boxMargin = conf.boxMargin,
18605 boxTextMargin = conf.boxTextMargin,
18606 labelBoxHeight = conf.labelBoxHeight,
18607 labelBoxWidth = conf.labelBoxWidth,
18608 fontFamily = conf.messageFontFamily,
18609 fontSize = conf.messageFontSize,
18610 fontWeight = conf.messageFontWeight;
18611 var g = elem.append('g');
18612
18613 var drawLoopLine = function drawLoopLine(startx, starty, stopx, stopy) {
18614 return g.append('line').attr('x1', startx).attr('y1', starty).attr('x2', stopx).attr('y2', stopy).attr('class', 'loopLine');
18615 };
18616
18617 drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
18618 drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
18619 drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
18620 drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
18621
18622 if (typeof loopModel.sections !== 'undefined') {
18623 loopModel.sections.forEach(function (item) {
18624 drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style('stroke-dasharray', '3, 3');
18625 });
18626 }
18627
18628 var txt = getTextObj();
18629 txt.text = labelText;
18630 txt.x = loopModel.startx;
18631 txt.y = loopModel.starty;
18632 txt.fontFamily = fontFamily;
18633 txt.fontSize = fontSize;
18634 txt.fontWeight = fontWeight;
18635 txt.anchor = 'middle';
18636 txt.valign = 'middle';
18637 txt.tspan = false;
18638 txt.width = labelBoxWidth || 50;
18639 txt.height = labelBoxHeight || 20;
18640 txt.textMargin = boxTextMargin;
18641 txt.class = 'labelText';
18642 drawLabel(g, txt);
18643 txt = getTextObj();
18644 txt.text = loopModel.title;
18645 txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
18646 txt.y = loopModel.starty + boxMargin + boxTextMargin;
18647 txt.anchor = 'middle';
18648 txt.valign = 'middle';
18649 txt.textMargin = boxTextMargin;
18650 txt.class = 'loopText';
18651 txt.fontFamily = fontFamily;
18652 txt.fontSize = fontSize;
18653 txt.fontWeight = fontWeight;
18654 txt.wrap = true;
18655 var textElem = drawText(g, txt);
18656
18657 if (typeof loopModel.sectionTitles !== 'undefined') {
18658 loopModel.sectionTitles.forEach(function (item, idx) {
18659 if (item.message) {
18660 txt.text = item.message;
18661 txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
18662 txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
18663 txt.class = 'loopText';
18664 txt.anchor = 'middle';
18665 txt.valign = 'middle';
18666 txt.tspan = false;
18667 txt.fontFamily = fontFamily;
18668 txt.fontSize = fontSize;
18669 txt.fontWeight = fontWeight;
18670 txt.wrap = loopModel.wrap;
18671 textElem = drawText(g, txt);
18672 var sectionHeight = Math.round(textElem.map(function (te) {
18673 return (te._groups || te)[0][0].getBBox().height;
18674 }).reduce(function (acc, curr) {
18675 return acc + curr;
18676 }));
18677 loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
18678 }
18679 });
18680 }
18681
18682 loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
18683 return g;
18684};
18685/**
18686 * Draws a background rectangle
18687 * @param elem diagram (reference for bounds)
18688 * @param bounds shape of the rectangle
18689 */
18690
18691var drawBackgroundRect = function drawBackgroundRect(elem, bounds) {
18692 var rectElem = drawRect(elem, {
18693 x: bounds.startx,
18694 y: bounds.starty,
18695 width: bounds.stopx - bounds.startx,
18696 height: bounds.stopy - bounds.starty,
18697 fill: bounds.fill,
18698 class: 'rect'
18699 });
18700 rectElem.lower();
18701};
18702/**
18703 * Setup arrow head and define the marker. The result is appended to the svg.
18704 */
18705
18706var insertArrowHead = function insertArrowHead(elem) {
18707 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
18708};
18709/**
18710 * Setup node number. The result is appended to the svg.
18711 */
18712
18713var insertSequenceNumber = function insertSequenceNumber(elem) {
18714 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');
18715};
18716/**
18717 * Setup arrow head and define the marker. The result is appended to the svg.
18718 */
18719
18720var insertArrowCrossHead = function insertArrowCrossHead(elem) {
18721 var defs = elem.append('defs');
18722 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
18723
18724 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
18725
18726 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
18727};
18728var getTextObj = function getTextObj() {
18729 return {
18730 x: 0,
18731 y: 0,
18732 fill: undefined,
18733 anchor: undefined,
18734 style: '#666',
18735 width: undefined,
18736 height: undefined,
18737 textMargin: 0,
18738 rx: 0,
18739 ry: 0,
18740 tspan: true,
18741 valign: undefined
18742 };
18743};
18744var getNoteRect = function getNoteRect() {
18745 return {
18746 x: 0,
18747 y: 0,
18748 fill: '#EDF2AE',
18749 stroke: '#666',
18750 width: 100,
18751 anchor: 'start',
18752 height: 100,
18753 rx: 0,
18754 ry: 0
18755 };
18756};
18757
18758var _drawTextCandidateFunc = function () {
18759 function byText(content, g, x, y, width, height, textAttrs) {
18760 var text = g.append('text').attr('x', x + width / 2).attr('y', y + height / 2 + 5).style('text-anchor', 'middle').text(content);
18761
18762 _setTextAttrs(text, textAttrs);
18763 }
18764
18765 function byTspan(content, g, x, y, width, height, textAttrs, conf) {
18766 var actorFontSize = conf.actorFontSize,
18767 actorFontFamily = conf.actorFontFamily,
18768 actorFontWeight = conf.actorFontWeight;
18769 var lines = content.split(_common_common__WEBPACK_IMPORTED_MODULE_0__["default"].lineBreakRegex);
18770
18771 for (var i = 0; i < lines.length; i++) {
18772 var dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
18773 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);
18774 text.append('tspan').attr('x', x + width / 2).attr('dy', dy).text(lines[i]);
18775 text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
18776
18777 _setTextAttrs(text, textAttrs);
18778 }
18779 }
18780
18781 function byFo(content, g, x, y, width, height, textAttrs, conf) {
18782 var s = g.append('switch');
18783 var f = s.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height);
18784 var text = f.append('div').style('display', 'table').style('height', '100%').style('width', '100%');
18785 text.append('div').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle').text(content);
18786 byTspan(content, s, x, y, width, height, textAttrs, conf);
18787
18788 _setTextAttrs(text, textAttrs);
18789 }
18790
18791 function _setTextAttrs(toText, fromTextAttrsDict) {
18792 for (var key in fromTextAttrsDict) {
18793 if (fromTextAttrsDict.hasOwnProperty(key)) {
18794 // eslint-disable-line
18795 toText.attr(key, fromTextAttrsDict[key]);
18796 }
18797 }
18798 }
18799
18800 return function (conf) {
18801 return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
18802 };
18803}();
18804
18805/* harmony default export */ __webpack_exports__["default"] = ({
18806 drawRect: drawRect,
18807 drawText: drawText,
18808 drawLabel: drawLabel,
18809 drawActor: drawActor,
18810 anchorElement: anchorElement,
18811 drawActivation: drawActivation,
18812 drawLoop: drawLoop,
18813 drawBackgroundRect: drawBackgroundRect,
18814 insertArrowHead: insertArrowHead,
18815 insertSequenceNumber: insertSequenceNumber,
18816 insertArrowCrossHead: insertArrowCrossHead,
18817 getTextObj: getTextObj,
18818 getNoteRect: getNoteRect
18819});
18820
18821/***/ }),
18822
18823/***/ "./src/diagrams/state/id-cache.js":
18824/*!****************************************!*\
18825 !*** ./src/diagrams/state/id-cache.js ***!
18826 \****************************************/
18827/*! exports provided: set, get, keys, size, default */
18828/***/ (function(module, __webpack_exports__, __webpack_require__) {
18829
18830"use strict";
18831__webpack_require__.r(__webpack_exports__);
18832/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; });
18833/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; });
18834/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return keys; });
18835/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return size; });
18836var idCache = {};
18837var set = function set(key, val) {
18838 idCache[key] = val;
18839};
18840var get = function get(k) {
18841 return idCache[k];
18842};
18843var keys = function keys() {
18844 return Object.keys(idCache);
18845};
18846var size = function size() {
18847 return keys().length;
18848};
18849/* harmony default export */ __webpack_exports__["default"] = ({
18850 get: get,
18851 set: set,
18852 keys: keys,
18853 size: size
18854});
18855
18856/***/ }),
18857
18858/***/ "./src/diagrams/state/parser/stateDiagram.jison":
18859/*!******************************************************!*\
18860 !*** ./src/diagrams/state/parser/stateDiagram.jison ***!
18861 \******************************************************/
18862/*! no static exports found */
18863/***/ (function(module, exports, __webpack_require__) {
18864
18865/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
18866/*
18867 Returns a Parser object of the following structure:
18868
18869 Parser: {
18870 yy: {}
18871 }
18872
18873 Parser.prototype: {
18874 yy: {},
18875 trace: function(),
18876 symbols_: {associative list: name ==> number},
18877 terminals_: {associative list: number ==> name},
18878 productions_: [...],
18879 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
18880 table: [...],
18881 defaultActions: {...},
18882 parseError: function(str, hash),
18883 parse: function(input),
18884
18885 lexer: {
18886 EOF: 1,
18887 parseError: function(str, hash),
18888 setInput: function(input),
18889 input: function(),
18890 unput: function(str),
18891 more: function(),
18892 less: function(n),
18893 pastInput: function(),
18894 upcomingInput: function(),
18895 showPosition: function(),
18896 test_match: function(regex_match_array, rule_index),
18897 next: function(),
18898 lex: function(),
18899 begin: function(condition),
18900 popState: function(),
18901 _currentRules: function(),
18902 topState: function(),
18903 pushState: function(condition),
18904
18905 options: {
18906 ranges: boolean (optional: true ==> token location info will include a .range[] member)
18907 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
18908 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)
18909 },
18910
18911 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
18912 rules: [...],
18913 conditions: {associative list: name ==> set},
18914 }
18915 }
18916
18917
18918 token location info (@$, _$, etc.): {
18919 first_line: n,
18920 last_line: n,
18921 first_column: n,
18922 last_column: n,
18923 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
18924 }
18925
18926
18927 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
18928 text: (matched text)
18929 token: (the produced terminal token, if any)
18930 line: (yylineno)
18931 }
18932 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
18933 loc: (yylloc)
18934 expected: (string describing the set of expected tokens)
18935 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
18936 }
18937*/
18938var parser = (function(){
18939var 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];
18940var parser = {trace: function trace () { },
18941yy: {},
18942symbols_: {"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},
18943terminals_: {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"},
18944productions_: [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]],
18945performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
18946/* this == yyval */
18947
18948var $0 = $$.length - 1;
18949switch (yystate) {
18950case 4:
18951 /*console.warn('Root document', $$[$0]);*/ yy.setRootDoc($$[$0]);return $$[$0];
18952break;
18953case 5:
18954 this.$ = []
18955break;
18956case 6:
18957
18958 if($$[$0]!='nl'){
18959 $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
18960 }
18961 // console.warn('Got document',$$[$0-1], $$[$0]);
18962
18963break;
18964case 7: case 8:
18965 this.$ = $$[$0]
18966break;
18967case 9:
18968 this.$='nl';
18969break;
18970case 10:
18971 /*console.warn('got id and descr', $$[$0]);*/this.$={ stmt: 'state', id: $$[$0], type: 'default', description: ''};
18972break;
18973case 11:
18974 /*console.warn('got id and descr', $$[$0-1], $$[$0].trim());*/this.$={ stmt: 'state', id: $$[$0-1], type: 'default', description: yy.trimColon($$[$0])};
18975break;
18976case 12:
18977
18978 /*console.warn('got id', $$[$0-2]);yy.addRelation($$[$0-2], $$[$0]);*/
18979 this.$={ stmt: 'relation', state1: { stmt: 'state', id: $$[$0-2], type: 'default', description: '' }, state2:{ stmt: 'state', id: $$[$0] ,type: 'default', description: ''}};
18980
18981break;
18982case 13:
18983
18984 /*yy.addRelation($$[$0-3], $$[$0-1], $$[$0].substr(1).trim());*/
18985 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()};
18986
18987break;
18988case 17:
18989
18990
18991 /* console.warn('Adding document for state without id ', $$[$0-3]);*/
18992 this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: '', doc: $$[$0-1] }
18993
18994break;
18995case 18:
18996
18997 var id=$$[$0];
18998 var description = $$[$0-2].trim();
18999 if($$[$0].match(':')){
19000 var parts = $$[$0].split(':');
19001 id=parts[0];
19002 description = [description, parts[1]];
19003 }
19004 this.$={stmt: 'state', id: id, type: 'default', description: description};
19005
19006
19007break;
19008case 19:
19009
19010 //console.warn('Adding document for state with id ', $$[$0-3], $$[$0-2]); yy.addDocument($$[$0-3]);
19011 this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: $$[$0-5], doc: $$[$0-1] }
19012
19013break;
19014case 20:
19015
19016 this.$={ stmt: 'state', id: $$[$0], type: 'fork' }
19017
19018break;
19019case 21:
19020
19021 this.$={ stmt: 'state', id: $$[$0], type: 'join' }
19022
19023break;
19024case 22:
19025
19026 this.$={ stmt: 'state', id: yy.getDividerId(), type: 'divider' }
19027
19028break;
19029case 23:
19030
19031 /*console.warn('got NOTE, position: ', $$[$0-2].trim(), 'id = ', $$[$0-1].trim(), 'note: ', $$[$0]);*/
19032 this.$={ stmt: 'state', id: $$[$0-1].trim(), note:{position: $$[$0-2].trim(), text: $$[$0].trim()}};
19033
19034break;
19035case 30: case 31:
19036this.$=$$[$0];
19037break;
19038case 34:
19039 yy.parseDirective('%%{', 'open_directive');
19040break;
19041case 35:
19042 yy.parseDirective($$[$0], 'type_directive');
19043break;
19044case 36:
19045 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
19046break;
19047case 37:
19048 yy.parseDirective('}%%', 'close_directive', 'state');
19049break;
19050}
19051},
19052table: [{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])],
19053defaultActions: {7:[2,34],8:[2,1],9:[2,2],10:[2,3],41:[2,32],42:[2,33],44:[2,36]},
19054parseError: function parseError (str, hash) {
19055 if (hash.recoverable) {
19056 this.trace(str);
19057 } else {
19058 var error = new Error(str);
19059 error.hash = hash;
19060 throw error;
19061 }
19062},
19063parse: function parse(input) {
19064 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
19065 var args = lstack.slice.call(arguments, 1);
19066 var lexer = Object.create(this.lexer);
19067 var sharedState = { yy: {} };
19068 for (var k in this.yy) {
19069 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
19070 sharedState.yy[k] = this.yy[k];
19071 }
19072 }
19073 lexer.setInput(input, sharedState.yy);
19074 sharedState.yy.lexer = lexer;
19075 sharedState.yy.parser = this;
19076 if (typeof lexer.yylloc == 'undefined') {
19077 lexer.yylloc = {};
19078 }
19079 var yyloc = lexer.yylloc;
19080 lstack.push(yyloc);
19081 var ranges = lexer.options && lexer.options.ranges;
19082 if (typeof sharedState.yy.parseError === 'function') {
19083 this.parseError = sharedState.yy.parseError;
19084 } else {
19085 this.parseError = Object.getPrototypeOf(this).parseError;
19086 }
19087 function popStack(n) {
19088 stack.length = stack.length - 2 * n;
19089 vstack.length = vstack.length - n;
19090 lstack.length = lstack.length - n;
19091 }
19092 function lex() {
19093 var token;
19094 token = tstack.pop() || lexer.lex() || EOF;
19095 if (typeof token !== 'number') {
19096 if (token instanceof Array) {
19097 tstack = token;
19098 token = tstack.pop();
19099 }
19100 token = self.symbols_[token] || token;
19101 }
19102 return token;
19103 }
19104 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
19105 while (true) {
19106 state = stack[stack.length - 1];
19107 if (this.defaultActions[state]) {
19108 action = this.defaultActions[state];
19109 } else {
19110 if (symbol === null || typeof symbol == 'undefined') {
19111 symbol = lex();
19112 }
19113 action = table[state] && table[state][symbol];
19114 }
19115 if (typeof action === 'undefined' || !action.length || !action[0]) {
19116 var errStr = '';
19117 expected = [];
19118 for (p in table[state]) {
19119 if (this.terminals_[p] && p > TERROR) {
19120 expected.push('\'' + this.terminals_[p] + '\'');
19121 }
19122 }
19123 if (lexer.showPosition) {
19124 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
19125 } else {
19126 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
19127 }
19128 this.parseError(errStr, {
19129 text: lexer.match,
19130 token: this.terminals_[symbol] || symbol,
19131 line: lexer.yylineno,
19132 loc: yyloc,
19133 expected: expected
19134 });
19135 }
19136 if (action[0] instanceof Array && action.length > 1) {
19137 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
19138 }
19139 switch (action[0]) {
19140 case 1:
19141 stack.push(symbol);
19142 vstack.push(lexer.yytext);
19143 lstack.push(lexer.yylloc);
19144 stack.push(action[1]);
19145 symbol = null;
19146 if (!preErrorSymbol) {
19147 yyleng = lexer.yyleng;
19148 yytext = lexer.yytext;
19149 yylineno = lexer.yylineno;
19150 yyloc = lexer.yylloc;
19151 if (recovering > 0) {
19152 recovering--;
19153 }
19154 } else {
19155 symbol = preErrorSymbol;
19156 preErrorSymbol = null;
19157 }
19158 break;
19159 case 2:
19160 len = this.productions_[action[1]][1];
19161 yyval.$ = vstack[vstack.length - len];
19162 yyval._$ = {
19163 first_line: lstack[lstack.length - (len || 1)].first_line,
19164 last_line: lstack[lstack.length - 1].last_line,
19165 first_column: lstack[lstack.length - (len || 1)].first_column,
19166 last_column: lstack[lstack.length - 1].last_column
19167 };
19168 if (ranges) {
19169 yyval._$.range = [
19170 lstack[lstack.length - (len || 1)].range[0],
19171 lstack[lstack.length - 1].range[1]
19172 ];
19173 }
19174 r = this.performAction.apply(yyval, [
19175 yytext,
19176 yyleng,
19177 yylineno,
19178 sharedState.yy,
19179 action[1],
19180 vstack,
19181 lstack
19182 ].concat(args));
19183 if (typeof r !== 'undefined') {
19184 return r;
19185 }
19186 if (len) {
19187 stack = stack.slice(0, -1 * len * 2);
19188 vstack = vstack.slice(0, -1 * len);
19189 lstack = lstack.slice(0, -1 * len);
19190 }
19191 stack.push(this.productions_[action[1]][0]);
19192 vstack.push(yyval.$);
19193 lstack.push(yyval._$);
19194 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
19195 stack.push(newState);
19196 break;
19197 case 3:
19198 return true;
19199 }
19200 }
19201 return true;
19202}};
19203
19204/* generated by jison-lex 0.3.4 */
19205var lexer = (function(){
19206var lexer = ({
19207
19208EOF:1,
19209
19210parseError:function parseError(str, hash) {
19211 if (this.yy.parser) {
19212 this.yy.parser.parseError(str, hash);
19213 } else {
19214 throw new Error(str);
19215 }
19216 },
19217
19218// resets the lexer, sets new input
19219setInput:function (input, yy) {
19220 this.yy = yy || this.yy || {};
19221 this._input = input;
19222 this._more = this._backtrack = this.done = false;
19223 this.yylineno = this.yyleng = 0;
19224 this.yytext = this.matched = this.match = '';
19225 this.conditionStack = ['INITIAL'];
19226 this.yylloc = {
19227 first_line: 1,
19228 first_column: 0,
19229 last_line: 1,
19230 last_column: 0
19231 };
19232 if (this.options.ranges) {
19233 this.yylloc.range = [0,0];
19234 }
19235 this.offset = 0;
19236 return this;
19237 },
19238
19239// consumes and returns one char from the input
19240input:function () {
19241 var ch = this._input[0];
19242 this.yytext += ch;
19243 this.yyleng++;
19244 this.offset++;
19245 this.match += ch;
19246 this.matched += ch;
19247 var lines = ch.match(/(?:\r\n?|\n).*/g);
19248 if (lines) {
19249 this.yylineno++;
19250 this.yylloc.last_line++;
19251 } else {
19252 this.yylloc.last_column++;
19253 }
19254 if (this.options.ranges) {
19255 this.yylloc.range[1]++;
19256 }
19257
19258 this._input = this._input.slice(1);
19259 return ch;
19260 },
19261
19262// unshifts one char (or a string) into the input
19263unput:function (ch) {
19264 var len = ch.length;
19265 var lines = ch.split(/(?:\r\n?|\n)/g);
19266
19267 this._input = ch + this._input;
19268 this.yytext = this.yytext.substr(0, this.yytext.length - len);
19269 //this.yyleng -= len;
19270 this.offset -= len;
19271 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
19272 this.match = this.match.substr(0, this.match.length - 1);
19273 this.matched = this.matched.substr(0, this.matched.length - 1);
19274
19275 if (lines.length - 1) {
19276 this.yylineno -= lines.length - 1;
19277 }
19278 var r = this.yylloc.range;
19279
19280 this.yylloc = {
19281 first_line: this.yylloc.first_line,
19282 last_line: this.yylineno + 1,
19283 first_column: this.yylloc.first_column,
19284 last_column: lines ?
19285 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
19286 + oldLines[oldLines.length - lines.length].length - lines[0].length :
19287 this.yylloc.first_column - len
19288 };
19289
19290 if (this.options.ranges) {
19291 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
19292 }
19293 this.yyleng = this.yytext.length;
19294 return this;
19295 },
19296
19297// When called from action, caches matched text and appends it on next action
19298more:function () {
19299 this._more = true;
19300 return this;
19301 },
19302
19303// 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.
19304reject:function () {
19305 if (this.options.backtrack_lexer) {
19306 this._backtrack = true;
19307 } else {
19308 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(), {
19309 text: "",
19310 token: null,
19311 line: this.yylineno
19312 });
19313
19314 }
19315 return this;
19316 },
19317
19318// retain first n characters of the match
19319less:function (n) {
19320 this.unput(this.match.slice(n));
19321 },
19322
19323// displays already matched input, i.e. for error messages
19324pastInput:function () {
19325 var past = this.matched.substr(0, this.matched.length - this.match.length);
19326 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
19327 },
19328
19329// displays upcoming input, i.e. for error messages
19330upcomingInput:function () {
19331 var next = this.match;
19332 if (next.length < 20) {
19333 next += this._input.substr(0, 20-next.length);
19334 }
19335 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
19336 },
19337
19338// displays the character position where the lexing error occurred, i.e. for error messages
19339showPosition:function () {
19340 var pre = this.pastInput();
19341 var c = new Array(pre.length + 1).join("-");
19342 return pre + this.upcomingInput() + "\n" + c + "^";
19343 },
19344
19345// test the lexed token: return FALSE when not a match, otherwise return token
19346test_match:function(match, indexed_rule) {
19347 var token,
19348 lines,
19349 backup;
19350
19351 if (this.options.backtrack_lexer) {
19352 // save context
19353 backup = {
19354 yylineno: this.yylineno,
19355 yylloc: {
19356 first_line: this.yylloc.first_line,
19357 last_line: this.last_line,
19358 first_column: this.yylloc.first_column,
19359 last_column: this.yylloc.last_column
19360 },
19361 yytext: this.yytext,
19362 match: this.match,
19363 matches: this.matches,
19364 matched: this.matched,
19365 yyleng: this.yyleng,
19366 offset: this.offset,
19367 _more: this._more,
19368 _input: this._input,
19369 yy: this.yy,
19370 conditionStack: this.conditionStack.slice(0),
19371 done: this.done
19372 };
19373 if (this.options.ranges) {
19374 backup.yylloc.range = this.yylloc.range.slice(0);
19375 }
19376 }
19377
19378 lines = match[0].match(/(?:\r\n?|\n).*/g);
19379 if (lines) {
19380 this.yylineno += lines.length;
19381 }
19382 this.yylloc = {
19383 first_line: this.yylloc.last_line,
19384 last_line: this.yylineno + 1,
19385 first_column: this.yylloc.last_column,
19386 last_column: lines ?
19387 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
19388 this.yylloc.last_column + match[0].length
19389 };
19390 this.yytext += match[0];
19391 this.match += match[0];
19392 this.matches = match;
19393 this.yyleng = this.yytext.length;
19394 if (this.options.ranges) {
19395 this.yylloc.range = [this.offset, this.offset += this.yyleng];
19396 }
19397 this._more = false;
19398 this._backtrack = false;
19399 this._input = this._input.slice(match[0].length);
19400 this.matched += match[0];
19401 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
19402 if (this.done && this._input) {
19403 this.done = false;
19404 }
19405 if (token) {
19406 return token;
19407 } else if (this._backtrack) {
19408 // recover context
19409 for (var k in backup) {
19410 this[k] = backup[k];
19411 }
19412 return false; // rule action called reject() implying the next rule should be tested instead.
19413 }
19414 return false;
19415 },
19416
19417// return next match in input
19418next:function () {
19419 if (this.done) {
19420 return this.EOF;
19421 }
19422 if (!this._input) {
19423 this.done = true;
19424 }
19425
19426 var token,
19427 match,
19428 tempMatch,
19429 index;
19430 if (!this._more) {
19431 this.yytext = '';
19432 this.match = '';
19433 }
19434 var rules = this._currentRules();
19435 for (var i = 0; i < rules.length; i++) {
19436 tempMatch = this._input.match(this.rules[rules[i]]);
19437 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
19438 match = tempMatch;
19439 index = i;
19440 if (this.options.backtrack_lexer) {
19441 token = this.test_match(tempMatch, rules[i]);
19442 if (token !== false) {
19443 return token;
19444 } else if (this._backtrack) {
19445 match = false;
19446 continue; // rule action called reject() implying a rule MISmatch.
19447 } else {
19448 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
19449 return false;
19450 }
19451 } else if (!this.options.flex) {
19452 break;
19453 }
19454 }
19455 }
19456 if (match) {
19457 token = this.test_match(match, rules[index]);
19458 if (token !== false) {
19459 return token;
19460 }
19461 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
19462 return false;
19463 }
19464 if (this._input === "") {
19465 return this.EOF;
19466 } else {
19467 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
19468 text: "",
19469 token: null,
19470 line: this.yylineno
19471 });
19472 }
19473 },
19474
19475// return next match that has a token
19476lex:function lex () {
19477 var r = this.next();
19478 if (r) {
19479 return r;
19480 } else {
19481 return this.lex();
19482 }
19483 },
19484
19485// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
19486begin:function begin (condition) {
19487 this.conditionStack.push(condition);
19488 },
19489
19490// pop the previously active lexer condition state off the condition stack
19491popState:function popState () {
19492 var n = this.conditionStack.length - 1;
19493 if (n > 0) {
19494 return this.conditionStack.pop();
19495 } else {
19496 return this.conditionStack[0];
19497 }
19498 },
19499
19500// produce the lexer rule set which is active for the currently active lexer condition state
19501_currentRules:function _currentRules () {
19502 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
19503 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
19504 } else {
19505 return this.conditions["INITIAL"].rules;
19506 }
19507 },
19508
19509// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
19510topState:function topState (n) {
19511 n = this.conditionStack.length - 1 - Math.abs(n || 0);
19512 if (n >= 0) {
19513 return this.conditionStack[n];
19514 } else {
19515 return "INITIAL";
19516 }
19517 },
19518
19519// alias for begin(condition)
19520pushState:function pushState (condition) {
19521 this.begin(condition);
19522 },
19523
19524// return the number of states currently on the stack
19525stateStackSize:function stateStackSize() {
19526 return this.conditionStack.length;
19527 },
19528options: {"case-insensitive":true},
19529performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
19530var YYSTATE=YY_START;
19531switch($avoiding_name_collisions) {
19532case 0: this.begin('open_directive'); return 39;
19533break;
19534case 1: this.begin('type_directive'); return 40;
19535break;
19536case 2: this.popState(); this.begin('arg_directive'); return 32;
19537break;
19538case 3: this.popState(); this.popState(); return 42;
19539break;
19540case 4:return 41;
19541break;
19542case 5:/* skip comments */
19543break;
19544case 6:/* skip comments */{ console.log('Crap after close'); }
19545break;
19546case 7:return 5;
19547break;
19548case 8:/* skip all whitespace */
19549break;
19550case 9:/* skip same-line whitespace */
19551break;
19552case 10:/* skip comments */
19553break;
19554case 11:/* skip comments */
19555break;
19556case 12: this.pushState('SCALE'); /* console.log('Got scale', yy_.yytext);*/ return 15;
19557break;
19558case 13:return 16;
19559break;
19560case 14:this.popState();
19561break;
19562case 15: this.pushState('STATE');
19563break;
19564case 16:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim(); /*console.warn('Fork Fork: ',yy_.yytext);*/return 23;
19565break;
19566case 17:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24;
19567break;
19568case 18:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Fork: ',yy_.yytext);*/return 23;
19569break;
19570case 19:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24;
19571break;
19572case 20:this.begin("STATE_STRING");
19573break;
19574case 21:this.popState();this.pushState('STATE_ID');return "AS";
19575break;
19576case 22:this.popState();/* console.log('STATE_ID', yy_.yytext);*/return "ID";
19577break;
19578case 23:this.popState();
19579break;
19580case 24: /*console.log('Long description:', yy_.yytext);*/return "STATE_DESCR";
19581break;
19582case 25:/*console.log('COMPOSIT_STATE', yy_.yytext);*/return 17;
19583break;
19584case 26:this.popState();
19585break;
19586case 27:this.popState();this.pushState('struct'); /*console.log('begin struct', yy_.yytext);*/return 18;
19587break;
19588case 28: /*console.log('Ending struct');*/ this.popState(); return 19;
19589break;
19590case 29:/* nothing */
19591break;
19592case 30: this.begin('NOTE'); return 26;
19593break;
19594case 31: this.popState();this.pushState('NOTE_ID');return 37;
19595break;
19596case 32: this.popState();this.pushState('NOTE_ID');return 38;
19597break;
19598case 33: this.popState();this.pushState('FLOATING_NOTE');
19599break;
19600case 34:this.popState();this.pushState('FLOATING_NOTE_ID');return "AS";
19601break;
19602case 35:/**/
19603break;
19604case 36: /*console.log('Floating note text: ', yy_.yytext);*/return "NOTE_TEXT";
19605break;
19606case 37:this.popState();/*console.log('Floating note ID', yy_.yytext);*/return "ID";
19607break;
19608case 38: this.popState();this.pushState('NOTE_TEXT');/*console.log('Got ID for note', yy_.yytext);*/return 22;
19609break;
19610case 39: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.substr(2).trim();return 28;
19611break;
19612case 40: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.slice(0,-8).trim();return 28;
19613break;
19614case 41: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7;
19615break;
19616case 42: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7;
19617break;
19618case 43: /*console.log('HIDE_EMPTY', yy_.yytext,'#');*/return 14;
19619break;
19620case 44: /*console.log('EDGE_STATE=',yy_.yytext);*/ return 36;
19621break;
19622case 45: /*console.log('=>ID=',yy_.yytext);*/ return 22;
19623break;
19624case 46: yy_.yytext = yy_.yytext.trim(); /*console.log('Descr = ', yy_.yytext);*/ return 12;
19625break;
19626case 47:return 13;
19627break;
19628case 48:return 25;
19629break;
19630case 49:return 5;
19631break;
19632case 50:return 'INVALID';
19633break;
19634}
19635},
19636rules: [/^(?:%%\{)/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],
19637conditions: {"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}}
19638});
19639return lexer;
19640})();
19641parser.lexer = lexer;
19642function Parser () {
19643 this.yy = {};
19644}
19645Parser.prototype = parser;parser.Parser = Parser;
19646return new Parser;
19647})();
19648
19649
19650if (true) {
19651exports.parser = parser;
19652exports.Parser = parser.Parser;
19653exports.parse = function () { return parser.parse.apply(parser, arguments); };
19654exports.main = function commonjsMain (args) {
19655 if (!args[1]) {
19656 console.log('Usage: '+args[0]+' FILE');
19657 process.exit(1);
19658 }
19659 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");
19660 return exports.parser.parse(source);
19661};
19662if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
19663 exports.main(process.argv.slice(1));
19664}
19665}
19666/* 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)))
19667
19668/***/ }),
19669
19670/***/ "./src/diagrams/state/shapes.js":
19671/*!**************************************!*\
19672 !*** ./src/diagrams/state/shapes.js ***!
19673 \**************************************/
19674/*! exports provided: drawStartState, drawDivider, drawSimpleState, drawDescrState, addTitleAndBox, drawText, drawNote, drawState, drawEdge */
19675/***/ (function(module, __webpack_exports__, __webpack_require__) {
19676
19677"use strict";
19678__webpack_require__.r(__webpack_exports__);
19679/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawStartState", function() { return drawStartState; });
19680/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawDivider", function() { return drawDivider; });
19681/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawSimpleState", function() { return drawSimpleState; });
19682/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawDescrState", function() { return drawDescrState; });
19683/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTitleAndBox", function() { return addTitleAndBox; });
19684/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawText", function() { return drawText; });
19685/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawNote", function() { return drawNote; });
19686/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawState", function() { return drawState; });
19687/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawEdge", function() { return drawEdge; });
19688/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
19689/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
19690/* harmony import */ var _id_cache_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./id-cache.js */ "./src/diagrams/state/id-cache.js");
19691/* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
19692/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
19693/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
19694/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../config */ "./src/config.js");
19695/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
19696
19697
19698
19699
19700
19701
19702 // let conf;
19703
19704/**
19705 * Draws a start state as a black circle
19706 */
19707
19708var drawStartState = function drawStartState(g) {
19709 return g.append('circle') // .style('stroke', 'black')
19710 // .style('fill', 'black')
19711 .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);
19712};
19713/**
19714 * Draws a start state as a black circle
19715 */
19716
19717var drawDivider = function drawDivider(g) {
19718 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);
19719};
19720/**
19721 * Draws a an end state as a black circle
19722 */
19723
19724var drawSimpleState = function drawSimpleState(g, stateDef) {
19725 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);
19726 var classBox = state.node().getBBox();
19727 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);
19728 return state;
19729};
19730/**
19731 * Draws a state with descriptions
19732 * @param {*} g
19733 * @param {*} stateDef
19734 */
19735
19736var drawDescrState = function drawDescrState(g, stateDef) {
19737 var addTspan = function addTspan(textEl, txt, isFirst) {
19738 var tSpan = textEl.append('tspan').attr('x', 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding).text(txt);
19739
19740 if (!isFirst) {
19741 tSpan.attr('dy', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight);
19742 }
19743 };
19744
19745 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]);
19746 var titleBox = title.node().getBBox();
19747 var titleHeight = titleBox.height;
19748 var description = g.append('text') // text label for the x axis
19749 .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');
19750 var isFirst = true;
19751 var isSecond = true;
19752 stateDef.descriptions.forEach(function (descr) {
19753 if (!isFirst) {
19754 addTspan(description, descr, isSecond);
19755 isSecond = false;
19756 }
19757
19758 isFirst = false;
19759 });
19760 var descrLine = g.append('line') // text label for the x axis
19761 .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');
19762 var descrBox = description.node().getBBox();
19763 var width = Math.max(descrBox.width, titleBox.width);
19764 descrLine.attr('x2', width + 3 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding); // const classBox = title.node().getBBox();
19765
19766 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);
19767 return g;
19768};
19769/**
19770 * Adds the creates a box around the existing content and adds a
19771 * panel for the id on top of the content.
19772 */
19773
19774/**
19775 * Function that creates an title row and a frame around a substate for a composit state diagram.
19776 * The function returns a new d3 svg object with updated width and height properties;
19777 * @param {*} g The d3 svg object for the substate to framed
19778 * @param {*} stateDef The info about the
19779 */
19780
19781var addTitleAndBox = function addTitleAndBox(g, stateDef, altBkg) {
19782 var pad = Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding;
19783 var dblPad = 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding;
19784 var orgBox = g.node().getBBox();
19785 var orgWidth = orgBox.width;
19786 var orgX = orgBox.x;
19787 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);
19788 var titleBox = title.node().getBBox();
19789 var titleWidth = titleBox.width + dblPad;
19790 var width = Math.max(titleWidth, orgWidth); // + dblPad;
19791
19792 if (width === orgWidth) {
19793 width = width + dblPad;
19794 }
19795
19796 var startX; // const lineY = 1 - getConfig().state.textHeight;
19797 // const descrLine = g
19798 // .append('line') // text label for the x axis
19799 // .attr('x1', 0)
19800 // .attr('y1', lineY)
19801 // .attr('y2', lineY)
19802 // .attr('class', 'descr-divider');
19803
19804 var graphBox = g.node().getBBox(); // descrLine.attr('x2', graphBox.width + getConfig().state.padding);
19805
19806 if (stateDef.doc) {// cnsole.warn(
19807 // stateDef.id,
19808 // 'orgX: ',
19809 // orgX,
19810 // 'width: ',
19811 // width,
19812 // 'titleWidth: ',
19813 // titleWidth,
19814 // 'orgWidth: ',
19815 // orgWidth,
19816 // 'width',
19817 // width
19818 // );
19819 }
19820
19821 startX = orgX - pad;
19822
19823 if (titleWidth > orgWidth) {
19824 startX = (orgWidth - width) / 2 + pad;
19825 }
19826
19827 if (Math.abs(orgX - graphBox.x) < pad) {
19828 if (titleWidth > orgWidth) {
19829 startX = orgX - (titleWidth - orgWidth) / 2;
19830 }
19831 }
19832
19833 var lineY = 1 - Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.textHeight; // White color
19834
19835 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');
19836 title.attr('x', startX + pad);
19837 if (titleWidth <= orgWidth) title.attr('x', orgX + (width - dblPad) / 2 - titleWidth / 2 + pad); // Title background
19838
19839 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
19840 .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
19841
19842 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);
19843 return g;
19844};
19845
19846var drawEndState = function drawEndState(g) {
19847 g.append('circle') // .style('stroke', 'black')
19848 // .style('fill', 'white')
19849 .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);
19850 return g.append('circle') // .style('stroke', 'black')
19851 // .style('fill', 'black')
19852 .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);
19853};
19854
19855var drawForkJoinState = function drawForkJoinState(g, stateDef) {
19856 var width = Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.forkWidth;
19857 var height = Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.forkHeight;
19858
19859 if (stateDef.parentId) {
19860 var tmp = width;
19861 width = height;
19862 height = tmp;
19863 }
19864
19865 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);
19866};
19867
19868var drawText = function drawText(elem, textData) {
19869 // Remove and ignore br:s
19870 var nText = textData.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex, ' ');
19871 var textElem = elem.append('text');
19872 textElem.attr('x', textData.x);
19873 textElem.attr('y', textData.y);
19874 textElem.style('text-anchor', textData.anchor);
19875 textElem.attr('fill', textData.fill);
19876
19877 if (typeof textData.class !== 'undefined') {
19878 textElem.attr('class', textData.class);
19879 }
19880
19881 var span = textElem.append('tspan');
19882 span.attr('x', textData.x + textData.textMargin * 2);
19883 span.attr('fill', textData.fill);
19884 span.text(nText);
19885 return textElem;
19886};
19887
19888var _drawLongText = function _drawLongText(_text, x, y, g) {
19889 var textHeight = 0;
19890 var textElem = g.append('text');
19891 textElem.style('text-anchor', 'start');
19892 textElem.attr('class', 'noteText');
19893
19894 var text = _text.replace(/\r\n/g, '<br/>');
19895
19896 text = text.replace(/\n/g, '<br/>');
19897 var lines = text.split(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex);
19898 var tHeight = 1.25 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.noteMargin;
19899 var _iteratorNormalCompletion = true;
19900 var _didIteratorError = false;
19901 var _iteratorError = undefined;
19902
19903 try {
19904 for (var _iterator = lines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
19905 var _line = _step.value;
19906
19907 var txt = _line.trim();
19908
19909 if (txt.length > 0) {
19910 var span = textElem.append('tspan');
19911 span.text(txt);
19912
19913 if (tHeight === 0) {
19914 var textBounds = span.node().getBBox();
19915 tHeight += textBounds.height;
19916 }
19917
19918 textHeight += tHeight;
19919 span.attr('x', x + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.noteMargin);
19920 span.attr('y', y + textHeight + 1.25 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.noteMargin);
19921 }
19922 }
19923 } catch (err) {
19924 _didIteratorError = true;
19925 _iteratorError = err;
19926 } finally {
19927 try {
19928 if (!_iteratorNormalCompletion && _iterator.return != null) {
19929 _iterator.return();
19930 }
19931 } finally {
19932 if (_didIteratorError) {
19933 throw _iteratorError;
19934 }
19935 }
19936 }
19937
19938 return {
19939 textWidth: textElem.node().getBBox().width,
19940 textHeight: textHeight
19941 };
19942};
19943/**
19944 * Draws a note to the diagram
19945 * @param text - The text of the given note.
19946 * @param g - The element the note is attached to.
19947 */
19948
19949
19950var drawNote = function drawNote(text, g) {
19951 g.attr('class', 'state-note');
19952 var note = g.append('rect').attr('x', 0).attr('y', Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding);
19953 var rectElem = g.append('g');
19954
19955 var _drawLongText2 = _drawLongText(text, 0, 0, rectElem),
19956 textWidth = _drawLongText2.textWidth,
19957 textHeight = _drawLongText2.textHeight;
19958
19959 note.attr('height', textHeight + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.noteMargin);
19960 note.attr('width', textWidth + Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.noteMargin * 2);
19961 return note;
19962};
19963/**
19964 * Starting point for drawing a state. The function finds out the specifics
19965 * about the state and renders with approprtiate function.
19966 * @param {*} elem
19967 * @param {*} stateDef
19968 */
19969
19970var drawState = function drawState(elem, stateDef) {
19971 var id = stateDef.id;
19972 var stateInfo = {
19973 id: id,
19974 label: stateDef.id,
19975 width: 0,
19976 height: 0
19977 };
19978 var g = elem.append('g').attr('id', id).attr('class', 'stateGroup');
19979 if (stateDef.type === 'start') drawStartState(g);
19980 if (stateDef.type === 'end') drawEndState(g);
19981 if (stateDef.type === 'fork' || stateDef.type === 'join') drawForkJoinState(g, stateDef);
19982 if (stateDef.type === 'note') drawNote(stateDef.note.text, g);
19983 if (stateDef.type === 'divider') drawDivider(g);
19984 if (stateDef.type === 'default' && stateDef.descriptions.length === 0) drawSimpleState(g, stateDef);
19985 if (stateDef.type === 'default' && stateDef.descriptions.length > 0) drawDescrState(g, stateDef);
19986 var stateBox = g.node().getBBox();
19987 stateInfo.width = stateBox.width + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding;
19988 stateInfo.height = stateBox.height + 2 * Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.padding;
19989 _id_cache_js__WEBPACK_IMPORTED_MODULE_1__["default"].set(id, stateInfo); // stateCnt++;
19990
19991 return stateInfo;
19992};
19993var edgeCount = 0;
19994var drawEdge = function drawEdge(elem, path, relation) {
19995 var getRelationType = function getRelationType(type) {
19996 switch (type) {
19997 case _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].relationType.AGGREGATION:
19998 return 'aggregation';
19999
20000 case _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].relationType.EXTENSION:
20001 return 'extension';
20002
20003 case _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].relationType.COMPOSITION:
20004 return 'composition';
20005
20006 case _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].relationType.DEPENDENCY:
20007 return 'dependency';
20008 }
20009 };
20010
20011 path.points = path.points.filter(function (p) {
20012 return !Number.isNaN(p.y);
20013 }); // The data for our line
20014
20015 var lineData = path.points; // This is the accessor function we talked about above
20016
20017 var lineFunction = Object(d3__WEBPACK_IMPORTED_MODULE_0__["line"])().x(function (d) {
20018 return d.x;
20019 }).y(function (d) {
20020 return d.y;
20021 }).curve(d3__WEBPACK_IMPORTED_MODULE_0__["curveBasis"]);
20022 var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', 'edge' + edgeCount).attr('class', 'transition');
20023 var url = '';
20024
20025 if (Object(_config__WEBPACK_IMPORTED_MODULE_5__["getConfig"])().state.arrowMarkerAbsolute) {
20026 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
20027 url = url.replace(/\(/g, '\\(');
20028 url = url.replace(/\)/g, '\\)');
20029 }
20030
20031 svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(_stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].relationType.DEPENDENCY) + 'End' + ')');
20032
20033 if (typeof relation.title !== 'undefined') {
20034 var label = elem.append('g').attr('class', 'stateLabel');
20035
20036 var _utils$calcLabelPosit = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].calcLabelPosition(path.points),
20037 x = _utils$calcLabelPosit.x,
20038 y = _utils$calcLabelPosit.y;
20039
20040 var rows = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].getRows(relation.title);
20041 var titleHeight = 0;
20042 var titleRows = [];
20043 var maxWidth = 0;
20044 var minX = 0;
20045
20046 for (var i = 0; i <= rows.length; i++) {
20047 var title = label.append('text').attr('text-anchor', 'middle').text(rows[i]).attr('x', x).attr('y', y + titleHeight);
20048 var boundstmp = title.node().getBBox();
20049 maxWidth = Math.max(maxWidth, boundstmp.width);
20050 minX = Math.min(minX, boundstmp.x);
20051 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info(boundstmp.x, x, y + titleHeight);
20052
20053 if (titleHeight === 0) {
20054 var titleBox = title.node().getBBox();
20055 titleHeight = titleBox.height;
20056 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Title height', titleHeight, y);
20057 }
20058
20059 titleRows.push(title);
20060 }
20061
20062 var boxHeight = titleHeight * rows.length;
20063
20064 if (rows.length > 1) {
20065 var heightAdj = (rows.length - 1) * titleHeight * 0.5;
20066 titleRows.forEach(function (title, i) {
20067 return title.attr('y', y + i * titleHeight - heightAdj);
20068 });
20069 boxHeight = titleHeight * rows.length;
20070 }
20071
20072 var bounds = label.node().getBBox();
20073 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);
20074 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info(bounds); //label.attr('transform', '0 -' + (bounds.y / 2));
20075 // Debug points
20076 // path.points.forEach(point => {
20077 // g.append('circle')
20078 // .style('stroke', 'red')
20079 // .style('fill', 'red')
20080 // .attr('r', 1)
20081 // .attr('cx', point.x)
20082 // .attr('cy', point.y);
20083 // });
20084 // g.append('circle')
20085 // .style('stroke', 'blue')
20086 // .style('fill', 'blue')
20087 // .attr('r', 1)
20088 // .attr('cx', x)
20089 // .attr('cy', y);
20090 }
20091
20092 edgeCount++;
20093};
20094
20095/***/ }),
20096
20097/***/ "./src/diagrams/state/stateDb.js":
20098/*!***************************************!*\
20099 !*** ./src/diagrams/state/stateDb.js ***!
20100 \***************************************/
20101/*! exports provided: parseDirective, addState, clear, getState, getStates, logDocuments, getRelations, addRelation, cleanupLabel, lineType, relationType, default */
20102/***/ (function(module, __webpack_exports__, __webpack_require__) {
20103
20104"use strict";
20105__webpack_require__.r(__webpack_exports__);
20106/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
20107/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addState", function() { return addState; });
20108/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
20109/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getState", function() { return getState; });
20110/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStates", function() { return getStates; });
20111/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logDocuments", function() { return logDocuments; });
20112/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRelations", function() { return getRelations; });
20113/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addRelation", function() { return addRelation; });
20114/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cleanupLabel", function() { return cleanupLabel; });
20115/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lineType", function() { return lineType; });
20116/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "relationType", function() { return relationType; });
20117/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
20118/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
20119/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
20120/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
20121function _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); }
20122
20123
20124
20125
20126
20127
20128var clone = function clone(o) {
20129 return JSON.parse(JSON.stringify(o));
20130};
20131
20132var rootDoc = [];
20133var parseDirective = function parseDirective(statement, context, type) {
20134 _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type);
20135};
20136
20137var setRootDoc = function setRootDoc(o) {
20138 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Setting root doc', o); // rootDoc = { id: 'root', doc: o };
20139
20140 rootDoc = o;
20141};
20142
20143var getRootDoc = function getRootDoc() {
20144 return rootDoc;
20145};
20146
20147var docTranslator = function docTranslator(parent, node, first) {
20148 if (node.stmt === 'relation') {
20149 docTranslator(parent, node.state1, true);
20150 docTranslator(parent, node.state2, false);
20151 } else {
20152 if (node.stmt === 'state') {
20153 if (node.id === '[*]') {
20154 node.id = first ? parent.id + '_start' : parent.id + '_end';
20155 node.start = first;
20156 }
20157 }
20158
20159 if (node.doc) {
20160 var doc = []; // Check for concurrency
20161
20162 var i = 0;
20163 var currentDoc = [];
20164
20165 for (i = 0; i < node.doc.length; i++) {
20166 if (node.doc[i].type === 'divider') {
20167 // debugger;
20168 var newNode = clone(node.doc[i]);
20169 newNode.doc = clone(currentDoc);
20170 doc.push(newNode);
20171 currentDoc = [];
20172 } else {
20173 currentDoc.push(node.doc[i]);
20174 }
20175 } // If any divider was encountered
20176
20177
20178 if (doc.length > 0 && currentDoc.length > 0) {
20179 var _newNode = {
20180 stmt: 'state',
20181 id: Object(_utils__WEBPACK_IMPORTED_MODULE_1__["generateId"])(),
20182 type: 'divider',
20183 doc: clone(currentDoc)
20184 };
20185 doc.push(clone(_newNode));
20186 node.doc = doc;
20187 }
20188
20189 node.doc.forEach(function (docNode) {
20190 return docTranslator(node, docNode, true);
20191 });
20192 }
20193 }
20194};
20195
20196var getRootDocV2 = function getRootDocV2() {
20197 docTranslator({
20198 id: 'root'
20199 }, {
20200 id: 'root',
20201 doc: rootDoc
20202 }, true);
20203 return {
20204 id: 'root',
20205 doc: rootDoc
20206 };
20207};
20208
20209var extract = function extract(_doc) {
20210 // const res = { states: [], relations: [] };
20211 var doc;
20212
20213 if (_doc.doc) {
20214 doc = _doc.doc;
20215 } else {
20216 doc = _doc;
20217 } // let doc = root.doc;
20218 // if (!doc) {
20219 // doc = root;
20220 // }
20221
20222
20223 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info(doc);
20224 clear();
20225 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Extract', doc);
20226 doc.forEach(function (item) {
20227 if (item.stmt === 'state') {
20228 addState(item.id, item.type, item.doc, item.description, item.note);
20229 }
20230
20231 if (item.stmt === 'relation') {
20232 addRelation(item.state1.id, item.state2.id, item.description);
20233 }
20234 });
20235};
20236
20237var newDoc = function newDoc() {
20238 return {
20239 relations: [],
20240 states: {},
20241 documents: {}
20242 };
20243};
20244
20245var documents = {
20246 root: newDoc()
20247};
20248var currentDocument = documents.root;
20249var startCnt = 0;
20250var endCnt = 0; // eslint-disable-line
20251// let stateCnt = 0;
20252
20253/**
20254 * Function called by parser when a node definition has been found.
20255 * @param id
20256 * @param text
20257 * @param type
20258 * @param style
20259 */
20260
20261var addState = function addState(id, type, doc, descr, note) {
20262 if (typeof currentDocument.states[id] === 'undefined') {
20263 currentDocument.states[id] = {
20264 id: id,
20265 descriptions: [],
20266 type: type,
20267 doc: doc,
20268 note: note
20269 };
20270 } else {
20271 if (!currentDocument.states[id].doc) {
20272 currentDocument.states[id].doc = doc;
20273 }
20274
20275 if (!currentDocument.states[id].type) {
20276 currentDocument.states[id].type = type;
20277 }
20278 }
20279
20280 if (descr) {
20281 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Adding state ', id, descr);
20282 if (typeof descr === 'string') addDescription(id, descr.trim());
20283
20284 if (_typeof(descr) === 'object') {
20285 descr.forEach(function (des) {
20286 return addDescription(id, des.trim());
20287 });
20288 }
20289 }
20290
20291 if (note) currentDocument.states[id].note = note;
20292};
20293var clear = function clear() {
20294 documents = {
20295 root: newDoc()
20296 };
20297 currentDocument = documents.root;
20298 currentDocument = documents.root;
20299 startCnt = 0;
20300 endCnt = 0; // eslint-disable-line
20301
20302 classes = [];
20303};
20304var getState = function getState(id) {
20305 return currentDocument.states[id];
20306};
20307var getStates = function getStates() {
20308 return currentDocument.states;
20309};
20310var logDocuments = function logDocuments() {
20311 _logger__WEBPACK_IMPORTED_MODULE_0__["logger"].info('Documents = ', documents);
20312};
20313var getRelations = function getRelations() {
20314 return currentDocument.relations;
20315};
20316var addRelation = function addRelation(_id1, _id2, title) {
20317 var id1 = _id1;
20318 var id2 = _id2;
20319 var type1 = 'default';
20320 var type2 = 'default';
20321
20322 if (_id1 === '[*]') {
20323 startCnt++;
20324 id1 = 'start' + startCnt;
20325 type1 = 'start';
20326 }
20327
20328 if (_id2 === '[*]') {
20329 endCnt++;
20330 id2 = 'end' + startCnt;
20331 type2 = 'end';
20332 }
20333
20334 addState(id1, type1);
20335 addState(id2, type2);
20336 currentDocument.relations.push({
20337 id1: id1,
20338 id2: id2,
20339 title: title
20340 });
20341};
20342
20343var addDescription = function addDescription(id, _descr) {
20344 var theState = currentDocument.states[id];
20345 var descr = _descr;
20346
20347 if (descr[0] === ':') {
20348 descr = descr.substr(1).trim();
20349 }
20350
20351 theState.descriptions.push(descr);
20352};
20353
20354var cleanupLabel = function cleanupLabel(label) {
20355 if (label.substring(0, 1) === ':') {
20356 return label.substr(2).trim();
20357 } else {
20358 return label.trim();
20359 }
20360};
20361var lineType = {
20362 LINE: 0,
20363 DOTTED_LINE: 1
20364};
20365var dividerCnt = 0;
20366
20367var getDividerId = function getDividerId() {
20368 dividerCnt++;
20369 return 'divider-id-' + dividerCnt;
20370};
20371
20372var classes = [];
20373
20374var getClasses = function getClasses() {
20375 return classes;
20376};
20377
20378var getDirection = function getDirection() {
20379 return 'TB';
20380};
20381
20382var relationType = {
20383 AGGREGATION: 0,
20384 EXTENSION: 1,
20385 COMPOSITION: 2,
20386 DEPENDENCY: 3
20387};
20388
20389var trimColon = function trimColon(str) {
20390 return str && str[0] === ':' ? str.substr(1).trim() : str.trim();
20391};
20392
20393/* harmony default export */ __webpack_exports__["default"] = ({
20394 parseDirective: parseDirective,
20395 getConfig: function getConfig() {
20396 return _config__WEBPACK_IMPORTED_MODULE_3__["getConfig"]().state;
20397 },
20398 addState: addState,
20399 clear: clear,
20400 getState: getState,
20401 getStates: getStates,
20402 getRelations: getRelations,
20403 getClasses: getClasses,
20404 getDirection: getDirection,
20405 addRelation: addRelation,
20406 getDividerId: getDividerId,
20407 // addDescription,
20408 cleanupLabel: cleanupLabel,
20409 lineType: lineType,
20410 relationType: relationType,
20411 logDocuments: logDocuments,
20412 getRootDoc: getRootDoc,
20413 setRootDoc: setRootDoc,
20414 getRootDocV2: getRootDocV2,
20415 extract: extract,
20416 trimColon: trimColon
20417});
20418
20419/***/ }),
20420
20421/***/ "./src/diagrams/state/stateRenderer-v2.js":
20422/*!************************************************!*\
20423 !*** ./src/diagrams/state/stateRenderer-v2.js ***!
20424 \************************************************/
20425/*! exports provided: setConf, getClasses, draw, default */
20426/***/ (function(module, __webpack_exports__, __webpack_require__) {
20427
20428"use strict";
20429__webpack_require__.r(__webpack_exports__);
20430/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
20431/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClasses", function() { return getClasses; });
20432/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
20433/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
20434/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
20435/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
20436/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
20437/* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
20438/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
20439/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__);
20440/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
20441/* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
20442/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
20443/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
20444
20445
20446
20447
20448
20449
20450
20451
20452var conf = {};
20453var setConf = function setConf(cnf) {
20454 var keys = Object.keys(cnf);
20455
20456 for (var i = 0; i < keys.length; i++) {
20457 conf[keys[i]] = cnf[keys[i]];
20458 }
20459};
20460var nodeDb = {};
20461/**
20462 * Returns the all the styles from classDef statements in the graph definition.
20463 * @returns {object} classDef styles
20464 */
20465
20466var getClasses = function getClasses(text) {
20467 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].trace('Extracting classes');
20468 _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
20469 var parser = _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
20470 parser.yy = _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the graph definition
20471
20472 parser.parse(text);
20473 return _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getClasses();
20474};
20475
20476var setupNode = function setupNode(g, parent, node, altFlag) {
20477 // Add the node
20478 if (node.id !== 'root') {
20479 var shape = 'rect';
20480
20481 if (node.start === true) {
20482 shape = 'start';
20483 }
20484
20485 if (node.start === false) {
20486 shape = 'end';
20487 }
20488
20489 if (node.type !== 'default') {
20490 shape = node.type;
20491 }
20492
20493 if (!nodeDb[node.id]) {
20494 nodeDb[node.id] = {
20495 id: node.id,
20496 shape: shape,
20497 description: node.id,
20498 classes: 'statediagram-state'
20499 };
20500 } // Build of the array of description strings accordinging
20501
20502
20503 if (node.description) {
20504 if (Array.isArray(nodeDb[node.id].description)) {
20505 // There already is an array of strings,add to it
20506 nodeDb[node.id].shape = 'rectWithTitle';
20507 nodeDb[node.id].description.push(node.description);
20508 } else {
20509 if (nodeDb[node.id].description.length > 0) {
20510 // if there is a description already transformit to an array
20511 nodeDb[node.id].shape = 'rectWithTitle';
20512
20513 if (nodeDb[node.id].description === node.id) {
20514 // If the previous description was the is, remove it
20515 nodeDb[node.id].description = [node.description];
20516 } else {
20517 nodeDb[node.id].description = [nodeDb[node.id].description, node.description];
20518 }
20519 } else {
20520 nodeDb[node.id].shape = 'rect';
20521 nodeDb[node.id].description = node.description;
20522 }
20523 }
20524 } // Save data for description and group so that for instance a statement without description overwrites
20525 // one with description
20526 // group
20527
20528
20529 if (!nodeDb[node.id].type && node.doc) {
20530 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Setting cluser for ', node.id);
20531 nodeDb[node.id].type = 'group';
20532 nodeDb[node.id].shape = node.type === 'divider' ? 'divider' : 'roundedWithTitle';
20533 nodeDb[node.id].classes = nodeDb[node.id].classes + ' ' + (altFlag ? 'statediagram-cluster statediagram-cluster-alt' : 'statediagram-cluster');
20534 }
20535
20536 var nodeData = {
20537 labelStyle: '',
20538 shape: nodeDb[node.id].shape,
20539 labelText: nodeDb[node.id].description,
20540 classes: nodeDb[node.id].classes,
20541 //classStr,
20542 style: '',
20543 //styles.style,
20544 id: node.id,
20545 domId: 'state-' + node.id + '-' + cnt,
20546 type: nodeDb[node.id].type,
20547 padding: 15 //getConfig().flowchart.padding
20548
20549 };
20550
20551 if (node.note) {
20552 // Todo: set random id
20553 var noteData = {
20554 labelStyle: '',
20555 shape: 'note',
20556 labelText: node.note.text,
20557 classes: 'statediagram-note',
20558 //classStr,
20559 style: '',
20560 //styles.style,
20561 id: node.id + '----note',
20562 domId: 'state-' + node.id + '----note-' + cnt,
20563 type: nodeDb[node.id].type,
20564 padding: 15 //getConfig().flowchart.padding
20565
20566 };
20567 var groupData = {
20568 labelStyle: '',
20569 shape: 'noteGroup',
20570 labelText: node.note.text,
20571 classes: nodeDb[node.id].classes,
20572 //classStr,
20573 style: '',
20574 //styles.style,
20575 id: node.id + '----parent',
20576 domId: 'state-' + node.id + '----parent-' + cnt,
20577 type: 'group',
20578 padding: 0 //getConfig().flowchart.padding
20579
20580 };
20581 cnt++;
20582 g.setNode(node.id + '----parent', groupData);
20583 g.setNode(noteData.id, noteData);
20584 g.setNode(node.id, nodeData);
20585 g.setParent(node.id, node.id + '----parent');
20586 g.setParent(noteData.id, node.id + '----parent');
20587 var from = node.id;
20588 var to = noteData.id;
20589
20590 if (node.note.position === 'left of') {
20591 from = noteData.id;
20592 to = node.id;
20593 }
20594
20595 g.setEdge(from, to, {
20596 arrowhead: 'none',
20597 arrowType: '',
20598 style: 'fill:none',
20599 labelStyle: '',
20600 classes: 'transition note-edge',
20601 arrowheadStyle: 'fill: #333',
20602 labelpos: 'c',
20603 labelType: 'text',
20604 thickness: 'normal'
20605 });
20606 } else {
20607 g.setNode(node.id, nodeData);
20608 }
20609 }
20610
20611 if (parent) {
20612 if (parent.id !== 'root') {
20613 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Setting node ', node.id, ' to be child of its parent ', parent.id);
20614 g.setParent(node.id, parent.id);
20615 }
20616 }
20617
20618 if (node.doc) {
20619 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Adding nodes children ');
20620 setupDoc(g, node, node.doc, !altFlag);
20621 }
20622};
20623
20624var cnt = 0;
20625
20626var setupDoc = function setupDoc(g, parent, doc, altFlag) {
20627 cnt = 0;
20628 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].trace('items', doc);
20629 doc.forEach(function (item) {
20630 if (item.stmt === 'state' || item.stmt === 'default') {
20631 setupNode(g, parent, item, altFlag);
20632 } else if (item.stmt === 'relation') {
20633 setupNode(g, parent, item.state1, altFlag);
20634 setupNode(g, parent, item.state2, altFlag);
20635 var edgeData = {
20636 id: 'edge' + cnt,
20637 arrowhead: 'normal',
20638 arrowTypeEnd: 'arrow_barb',
20639 style: 'fill:none',
20640 labelStyle: '',
20641 label: item.description,
20642 arrowheadStyle: 'fill: #333',
20643 labelpos: 'c',
20644 labelType: 'text',
20645 thickness: 'normal',
20646 classes: 'transition'
20647 };
20648 var startId = item.state1.id;
20649 var endId = item.state2.id;
20650 g.setEdge(startId, endId, edgeData, cnt);
20651 cnt++;
20652 }
20653 });
20654};
20655/**
20656 * Draws a flowchart in the tag with id: id based on the graph definition in text.
20657 * @param text
20658 * @param id
20659 */
20660
20661
20662var draw = function draw(text, id) {
20663 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info('Drawing state diagram (v2)', id);
20664 _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].clear();
20665 nodeDb = {};
20666 var parser = _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3___default.a.parser;
20667 parser.yy = _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"]; // Parse the graph definition
20668
20669 parser.parse(text); // Fetch the default direction, use TD if none was found
20670
20671 var dir = _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getDirection();
20672
20673 if (typeof dir === 'undefined') {
20674 dir = 'LR';
20675 }
20676
20677 var conf = Object(_config__WEBPACK_IMPORTED_MODULE_4__["getConfig"])().state;
20678 var nodeSpacing = conf.nodeSpacing || 50;
20679 var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
20680
20681 var g = new graphlib__WEBPACK_IMPORTED_MODULE_0___default.a.Graph({
20682 multigraph: true,
20683 compound: true
20684 }).setGraph({
20685 rankdir: 'TB',
20686 nodesep: nodeSpacing,
20687 ranksep: rankSpacing,
20688 marginx: 8,
20689 marginy: 8
20690 }).setDefaultEdgeLabel(function () {
20691 return {};
20692 });
20693 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info(_stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getRootDocV2());
20694 _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].extract(_stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getRootDocV2());
20695 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].info(_stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getRootDocV2());
20696 setupNode(g, undefined, _stateDb__WEBPACK_IMPORTED_MODULE_2__["default"].getRootDocV2(), true); // Set up an SVG group so that we can translate the final graph.
20697
20698 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(id, "\"]")); // Run the renderer. This is what draws the final graph.
20699
20700 var element = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#' + id + ' g');
20701 Object(_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_5__["render"])(element, g, ['barb'], 'statediagram', id);
20702 var padding = 8;
20703 var bounds = svg.node().getBBox();
20704 var width = bounds.width + padding * 2;
20705 var height = bounds.height + padding * 2; // Zoom in a bit
20706
20707 svg.attr('class', 'statediagram');
20708 var svgBounds = svg.node().getBBox();
20709 Object(_utils__WEBPACK_IMPORTED_MODULE_7__["configureSvgSize"])(svg, height, width * 1.75, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
20710
20711 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
20712 _logger__WEBPACK_IMPORTED_MODULE_6__["logger"].debug("viewBox ".concat(vBox));
20713 svg.attr('viewBox', vBox); // Add label rects for non html labels
20714
20715 if (!conf.htmlLabels) {
20716 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
20717
20718 for (var k = 0; k < labels.length; k++) {
20719 var label = labels[k]; // Get dimensions of label
20720
20721 var dim = label.getBBox();
20722 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
20723 rect.setAttribute('rx', 0);
20724 rect.setAttribute('ry', 0);
20725 rect.setAttribute('width', dim.width);
20726 rect.setAttribute('height', dim.height);
20727 label.insertBefore(rect, label.firstChild);
20728 }
20729 }
20730};
20731/* harmony default export */ __webpack_exports__["default"] = ({
20732 setConf: setConf,
20733 getClasses: getClasses,
20734 draw: draw
20735});
20736
20737/***/ }),
20738
20739/***/ "./src/diagrams/state/stateRenderer.js":
20740/*!*********************************************!*\
20741 !*** ./src/diagrams/state/stateRenderer.js ***!
20742 \*********************************************/
20743/*! exports provided: setConf, draw, default */
20744/***/ (function(module, __webpack_exports__, __webpack_require__) {
20745
20746"use strict";
20747__webpack_require__.r(__webpack_exports__);
20748/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
20749/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
20750/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
20751/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
20752/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
20753/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
20754/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
20755/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
20756/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
20757/* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
20758/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
20759/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
20760/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6__);
20761/* harmony import */ var _shapes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./shapes */ "./src/diagrams/state/shapes.js");
20762/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../config */ "./src/config.js");
20763/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
20764
20765
20766
20767
20768
20769
20770 // import idCache from './id-cache';
20771
20772
20773
20774
20775_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6__["parser"].yy = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"]; // TODO Move conf object to main conf in mermaidAPI
20776
20777var conf;
20778var transformationLog = {};
20779var setConf = function setConf() {}; // Todo optimize
20780
20781/**
20782 * Setup arrow head and define the marker. The result is appended to the svg.
20783 */
20784
20785var insertMarkers = function insertMarkers(elem) {
20786 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');
20787};
20788/**
20789 * Draws a flowchart in the tag with id: id based on the graph definition in text.
20790 * @param text
20791 * @param id
20792 */
20793
20794
20795var draw = function draw(text, id) {
20796 conf = Object(_config__WEBPACK_IMPORTED_MODULE_8__["getConfig"])().state;
20797 _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6__["parser"].yy.clear();
20798 _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_6__["parser"].parse(text);
20799 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
20800
20801 var diagram = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])("[id='".concat(id, "']"));
20802 insertMarkers(diagram); // Layout graph, Create a new directed graph
20803
20804 var graph = new graphlib__WEBPACK_IMPORTED_MODULE_2___default.a.Graph({
20805 multigraph: true,
20806 compound: true,
20807 // acyclicer: 'greedy',
20808 rankdir: 'RL' // ranksep: '20'
20809
20810 }); // Default to assigning a new object as a label for each new edge.
20811
20812 graph.setDefaultEdgeLabel(function () {
20813 return {};
20814 });
20815 var rootDoc = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRootDoc();
20816 renderDoc(rootDoc, diagram, undefined, false);
20817 var padding = conf.padding;
20818 var bounds = diagram.node().getBBox();
20819 var width = bounds.width + padding * 2;
20820 var height = bounds.height + padding * 2; // zoom in a bit
20821
20822 var svgWidth = width * 1.75;
20823 Object(_utils__WEBPACK_IMPORTED_MODULE_9__["configureSvgSize"])(diagram, height, svgWidth, conf.useMaxWidth);
20824 diagram.attr('viewBox', "".concat(bounds.x - conf.padding, " ").concat(bounds.y - conf.padding, " ") + width + ' ' + height);
20825};
20826
20827var getLabelWidth = function getLabelWidth(text) {
20828 return text ? text.length * conf.fontSizeFactor : 1;
20829};
20830
20831var renderDoc = function renderDoc(doc, diagram, parentId, altBkg) {
20832 // // Layout graph, Create a new directed graph
20833 var graph = new graphlib__WEBPACK_IMPORTED_MODULE_2___default.a.Graph({
20834 compound: true,
20835 multigraph: true
20836 });
20837 var i;
20838 var edgeFreeDoc = true;
20839
20840 for (i = 0; i < doc.length; i++) {
20841 if (doc[i].stmt === 'relation') {
20842 edgeFreeDoc = false;
20843 break;
20844 }
20845 } // Set an object for the graph label
20846
20847
20848 if (parentId) graph.setGraph({
20849 rankdir: 'LR',
20850 multigraph: true,
20851 compound: true,
20852 // acyclicer: 'greedy',
20853 ranker: 'tight-tree',
20854 ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
20855 nodeSep: edgeFreeDoc ? 1 : 50,
20856 isMultiGraph: true // ranksep: 5,
20857 // nodesep: 1
20858
20859 });else {
20860 graph.setGraph({
20861 rankdir: 'TB',
20862 multigraph: true,
20863 compound: true,
20864 // isCompound: true,
20865 // acyclicer: 'greedy',
20866 // ranker: 'longest-path'
20867 ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
20868 nodeSep: edgeFreeDoc ? 1 : 50,
20869 ranker: 'tight-tree',
20870 // ranker: 'network-simplex'
20871 isMultiGraph: true
20872 });
20873 } // Default to assigning a new object as a label for each new edge.
20874
20875 graph.setDefaultEdgeLabel(function () {
20876 return {};
20877 });
20878 _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].extract(doc);
20879 var states = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getStates();
20880 var relations = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
20881 var keys = Object.keys(states);
20882 var first = true;
20883
20884 for (var _i = 0; _i < keys.length; _i++) {
20885 var stateDef = states[keys[_i]];
20886
20887 if (parentId) {
20888 stateDef.parentId = parentId;
20889 }
20890
20891 var node = void 0;
20892
20893 if (stateDef.doc) {
20894 var sub = diagram.append('g').attr('id', stateDef.id).attr('class', 'stateGroup');
20895 node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg);
20896
20897 if (first) {
20898 // first = false;
20899 sub = Object(_shapes__WEBPACK_IMPORTED_MODULE_7__["addTitleAndBox"])(sub, stateDef, altBkg);
20900 var boxBounds = sub.node().getBBox();
20901 node.width = boxBounds.width;
20902 node.height = boxBounds.height + conf.padding / 2;
20903 transformationLog[stateDef.id] = {
20904 y: conf.compositTitleSize
20905 };
20906 } else {
20907 // sub = addIdAndBox(sub, stateDef);
20908 var _boxBounds = sub.node().getBBox();
20909
20910 node.width = _boxBounds.width;
20911 node.height = _boxBounds.height; // transformationLog[stateDef.id] = { y: conf.compositTitleSize };
20912 }
20913 } else {
20914 node = Object(_shapes__WEBPACK_IMPORTED_MODULE_7__["drawState"])(diagram, stateDef, graph);
20915 }
20916
20917 if (stateDef.note) {
20918 // Draw note note
20919 var noteDef = {
20920 descriptions: [],
20921 id: stateDef.id + '-note',
20922 note: stateDef.note,
20923 type: 'note'
20924 };
20925 var note = Object(_shapes__WEBPACK_IMPORTED_MODULE_7__["drawState"])(diagram, noteDef, graph); // graph.setNode(node.id, node);
20926
20927 if (stateDef.note.position === 'left of') {
20928 graph.setNode(node.id + '-note', note);
20929 graph.setNode(node.id, node);
20930 } else {
20931 graph.setNode(node.id, node);
20932 graph.setNode(node.id + '-note', note);
20933 } // graph.setNode(node.id);
20934
20935
20936 graph.setParent(node.id, node.id + '-group');
20937 graph.setParent(node.id + '-note', node.id + '-group');
20938 } else {
20939 // Add nodes to the graph. The first argument is the node id. The second is
20940 // metadata about the node. In this case we're going to add labels to each of
20941 // our nodes.
20942 graph.setNode(node.id, node);
20943 }
20944 }
20945
20946 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Count=', graph.nodeCount(), graph);
20947 var cnt = 0;
20948 relations.forEach(function (relation) {
20949 cnt++;
20950 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Setting edge', relation);
20951 graph.setEdge(relation.id1, relation.id2, {
20952 relation: relation,
20953 width: getLabelWidth(relation.title),
20954 height: conf.labelHeight * _common_common__WEBPACK_IMPORTED_MODULE_5__["default"].getRows(relation.title).length,
20955 labelpos: 'c'
20956 }, 'id' + cnt);
20957 });
20958 dagre__WEBPACK_IMPORTED_MODULE_1___default.a.layout(graph);
20959 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Graph after layout', graph.nodes());
20960 var svgElem = diagram.node();
20961 graph.nodes().forEach(function (v) {
20962 if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
20963 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].warn('Node ' + v + ': ' + JSON.stringify(graph.node(v)));
20964 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) + ' )');
20965 Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + svgElem.id + ' #' + v).attr('data-x-shift', graph.node(v).x - graph.node(v).width / 2);
20966 var dividers = document.querySelectorAll('#' + svgElem.id + ' #' + v + ' .divider');
20967 dividers.forEach(function (divider) {
20968 var parent = divider.parentElement;
20969 var pWidth = 0;
20970 var pShift = 0;
20971
20972 if (parent) {
20973 if (parent.parentElement) pWidth = parent.parentElement.getBBox().width;
20974 pShift = parseInt(parent.getAttribute('data-x-shift'), 10);
20975
20976 if (Number.isNaN(pShift)) {
20977 pShift = 0;
20978 }
20979 }
20980
20981 divider.setAttribute('x1', 0 - pShift + 8);
20982 divider.setAttribute('x2', pWidth - pShift - 8);
20983 });
20984 } else {
20985 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('No Node ' + v + ': ' + JSON.stringify(graph.node(v)));
20986 }
20987 });
20988 var stateBox = svgElem.getBBox();
20989 graph.edges().forEach(function (e) {
20990 if (typeof e !== 'undefined' && typeof graph.edge(e) !== 'undefined') {
20991 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
20992 Object(_shapes__WEBPACK_IMPORTED_MODULE_7__["drawEdge"])(diagram, graph.edge(e), graph.edge(e).relation);
20993 }
20994 });
20995 stateBox = svgElem.getBBox();
20996 var stateInfo = {
20997 id: parentId ? parentId : 'root',
20998 label: parentId ? parentId : 'root',
20999 width: 0,
21000 height: 0
21001 };
21002 stateInfo.width = stateBox.width + 2 * conf.padding;
21003 stateInfo.height = stateBox.height + 2 * conf.padding;
21004 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Doc rendered', stateInfo, graph);
21005 return stateInfo;
21006};
21007
21008/* harmony default export */ __webpack_exports__["default"] = ({
21009 setConf: setConf,
21010 draw: draw
21011});
21012
21013/***/ }),
21014
21015/***/ "./src/diagrams/state/styles.js":
21016/*!**************************************!*\
21017 !*** ./src/diagrams/state/styles.js ***!
21018 \**************************************/
21019/*! exports provided: default */
21020/***/ (function(module, __webpack_exports__, __webpack_require__) {
21021
21022"use strict";
21023__webpack_require__.r(__webpack_exports__);
21024var getStyles = function getStyles(options) {
21025 return "g.stateGroup text {\n fill: ".concat(options.nodeBorder, ";\n stroke: none;\n font-size: 10px;\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}\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");
21026};
21027
21028/* harmony default export */ __webpack_exports__["default"] = (getStyles);
21029
21030/***/ }),
21031
21032/***/ "./src/diagrams/user-journey/journeyDb.js":
21033/*!************************************************!*\
21034 !*** ./src/diagrams/user-journey/journeyDb.js ***!
21035 \************************************************/
21036/*! exports provided: parseDirective, clear, setTitle, getTitle, addSection, getSections, getTasks, addTask, addTaskOrg, default */
21037/***/ (function(module, __webpack_exports__, __webpack_require__) {
21038
21039"use strict";
21040__webpack_require__.r(__webpack_exports__);
21041/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDirective", function() { return parseDirective; });
21042/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
21043/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTitle", function() { return setTitle; });
21044/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTitle", function() { return getTitle; });
21045/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSection", function() { return addSection; });
21046/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSections", function() { return getSections; });
21047/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTasks", function() { return getTasks; });
21048/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTask", function() { return addTask; });
21049/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTaskOrg", function() { return addTaskOrg; });
21050/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
21051/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
21052function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
21053
21054function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
21055
21056function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
21057
21058function _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; } }
21059
21060
21061
21062var title = '';
21063var currentSection = '';
21064var sections = [];
21065var tasks = [];
21066var rawTasks = [];
21067var parseDirective = function parseDirective(statement, context, type) {
21068 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
21069};
21070var clear = function clear() {
21071 sections.length = 0;
21072 tasks.length = 0;
21073 currentSection = '';
21074 title = '';
21075 rawTasks.length = 0;
21076};
21077var setTitle = function setTitle(txt) {
21078 title = txt;
21079};
21080var getTitle = function getTitle() {
21081 return title;
21082};
21083var addSection = function addSection(txt) {
21084 currentSection = txt;
21085 sections.push(txt);
21086};
21087var getSections = function getSections() {
21088 return sections;
21089};
21090var getTasks = function getTasks() {
21091 var allItemsProcessed = compileTasks();
21092 var maxDepth = 100;
21093 var iterationCount = 0;
21094
21095 while (!allItemsProcessed && iterationCount < maxDepth) {
21096 allItemsProcessed = compileTasks();
21097 iterationCount++;
21098 }
21099
21100 tasks.push.apply(tasks, rawTasks);
21101 return tasks;
21102};
21103
21104var updateActors = function updateActors() {
21105 var tempActors = [];
21106 tasks.forEach(function (task) {
21107 if (task.people) {
21108 tempActors.push.apply(tempActors, _toConsumableArray(task.people));
21109 }
21110 });
21111 var unique = new Set(tempActors);
21112 return _toConsumableArray(unique).sort();
21113};
21114
21115var addTask = function addTask(descr, taskData) {
21116 var pieces = taskData.substr(1).split(':');
21117 var score = 0;
21118 var peeps = [];
21119
21120 if (pieces.length === 1) {
21121 score = Number(pieces[0]);
21122 peeps = [];
21123 } else {
21124 score = Number(pieces[0]);
21125 peeps = pieces[1].split(',');
21126 }
21127
21128 var peopleList = peeps.map(function (s) {
21129 return s.trim();
21130 });
21131 var rawTask = {
21132 section: currentSection,
21133 type: currentSection,
21134 people: peopleList,
21135 task: descr,
21136 score: score
21137 };
21138 rawTasks.push(rawTask);
21139};
21140var addTaskOrg = function addTaskOrg(descr) {
21141 var newTask = {
21142 section: currentSection,
21143 type: currentSection,
21144 description: descr,
21145 task: descr,
21146 classes: []
21147 };
21148 tasks.push(newTask);
21149};
21150
21151var compileTasks = function compileTasks() {
21152 var compileTask = function compileTask(pos) {
21153 return rawTasks[pos].processed;
21154 };
21155
21156 var allProcessed = true;
21157
21158 for (var i = 0; i < rawTasks.length; i++) {
21159 compileTask(i);
21160 allProcessed = allProcessed && rawTasks[i].processed;
21161 }
21162
21163 return allProcessed;
21164};
21165
21166var getActors = function getActors() {
21167 return updateActors();
21168};
21169
21170/* harmony default export */ __webpack_exports__["default"] = ({
21171 parseDirective: parseDirective,
21172 getConfig: function getConfig() {
21173 return _config__WEBPACK_IMPORTED_MODULE_1__["getConfig"]().journey;
21174 },
21175 clear: clear,
21176 setTitle: setTitle,
21177 getTitle: getTitle,
21178 addSection: addSection,
21179 getSections: getSections,
21180 getTasks: getTasks,
21181 addTask: addTask,
21182 addTaskOrg: addTaskOrg,
21183 getActors: getActors
21184});
21185
21186/***/ }),
21187
21188/***/ "./src/diagrams/user-journey/journeyRenderer.js":
21189/*!******************************************************!*\
21190 !*** ./src/diagrams/user-journey/journeyRenderer.js ***!
21191 \******************************************************/
21192/*! exports provided: setConf, draw, bounds, drawTasks, default */
21193/***/ (function(module, __webpack_exports__, __webpack_require__) {
21194
21195"use strict";
21196__webpack_require__.r(__webpack_exports__);
21197/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
21198/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
21199/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bounds", function() { return bounds; });
21200/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawTasks", function() { return drawTasks; });
21201/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
21202/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
21203/* harmony import */ var _parser_journey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/journey */ "./src/diagrams/user-journey/parser/journey.jison");
21204/* harmony import */ var _parser_journey__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_journey__WEBPACK_IMPORTED_MODULE_1__);
21205/* harmony import */ var _journeyDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./journeyDb */ "./src/diagrams/user-journey/journeyDb.js");
21206/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/user-journey/svgDraw.js");
21207/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
21208
21209
21210
21211
21212
21213_parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].yy = _journeyDb__WEBPACK_IMPORTED_MODULE_2__["default"];
21214var conf = {
21215 leftMargin: 150,
21216 diagramMarginX: 50,
21217 diagramMarginY: 20,
21218 // Margin between tasks
21219 taskMargin: 50,
21220 // Width of task boxes
21221 width: 150,
21222 // Height of task boxes
21223 height: 50,
21224 taskFontSize: 14,
21225 taskFontFamily: '"Open-Sans", "sans-serif"',
21226 // Margin around loop boxes
21227 boxMargin: 10,
21228 boxTextMargin: 5,
21229 noteMargin: 10,
21230 // Space between messages
21231 messageMargin: 35,
21232 // Multiline message alignment
21233 messageAlign: 'center',
21234 // Depending on css styling this might need adjustment
21235 // Projects the edge of the diagram downwards
21236 bottomMarginAdj: 1,
21237 // width of activation box
21238 activationWidth: 10,
21239 // text placement as: tspan | fo | old only text as before
21240 textPlacement: 'fo',
21241 actorColours: ['#8FBC8F', '#7CFC00', '#00FFFF', '#20B2AA', '#B0E0E6', '#FFFFE0'],
21242 sectionFills: ['#191970', '#8B008B', '#4B0082', '#2F4F4F', '#800000', '#8B4513', '#00008B'],
21243 sectionColours: ['#fff']
21244};
21245var setConf = function setConf(cnf) {
21246 var keys = Object.keys(cnf);
21247 keys.forEach(function (key) {
21248 conf[key] = cnf[key];
21249 });
21250};
21251var actors = {};
21252
21253function drawActorLegend(diagram) {
21254 // Draw the actors
21255 var yPos = 60;
21256 Object.keys(actors).forEach(function (person) {
21257 var colour = actors[person];
21258 var circleData = {
21259 cx: 20,
21260 cy: yPos,
21261 r: 7,
21262 fill: colour,
21263 stroke: '#000'
21264 };
21265 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawCircle(diagram, circleData);
21266 var labelData = {
21267 x: 40,
21268 y: yPos + 7,
21269 fill: '#666',
21270 text: person,
21271 textMargin: conf.boxTextMargin | 5
21272 };
21273 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawText(diagram, labelData);
21274 yPos += 20;
21275 });
21276}
21277
21278var LEFT_MARGIN = conf.leftMargin;
21279var draw = function draw(text, id) {
21280 _parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.clear();
21281 _parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].parse(text + '\n');
21282 bounds.init();
21283 var diagram = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + id);
21284 diagram.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink');
21285 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].initGraphics(diagram);
21286 var tasks = _parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.getTasks();
21287 var title = _parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.getTitle();
21288 var actorNames = _parser_journey__WEBPACK_IMPORTED_MODULE_1__["parser"].yy.getActors();
21289
21290 for (var member in actors) {
21291 delete actors[member];
21292 }
21293
21294 var actorPos = 0;
21295 actorNames.forEach(function (actorName) {
21296 actors[actorName] = conf.actorColours[actorPos % conf.actorColours.length];
21297 actorPos++;
21298 });
21299 drawActorLegend(diagram);
21300 bounds.insert(0, 0, LEFT_MARGIN, Object.keys(actors).length * 50);
21301 drawTasks(diagram, tasks, 0);
21302 var box = bounds.getBounds();
21303
21304 if (title) {
21305 diagram.append('text').text(title).attr('x', LEFT_MARGIN).attr('font-size', '4ex').attr('font-weight', 'bold').attr('y', 25);
21306 }
21307
21308 var height = box.stopy - box.starty + 2 * conf.diagramMarginY;
21309 var width = LEFT_MARGIN + box.stopx + 2 * conf.diagramMarginX;
21310 Object(_utils__WEBPACK_IMPORTED_MODULE_4__["configureSvgSize"])(diagram, height, width, conf.useMaxWidth); // Draw activity line
21311
21312 diagram.append('line').attr('x1', LEFT_MARGIN).attr('y1', conf.height * 4) // One section head + one task + margins
21313 .attr('x2', width - LEFT_MARGIN - 4) // Subtract stroke width so arrow point is retained
21314 .attr('y2', conf.height * 4).attr('stroke-width', 4).attr('stroke', 'black').attr('marker-end', 'url(#arrowhead)');
21315 var extraVertForTitle = title ? 70 : 0;
21316 diagram.attr('viewBox', "".concat(box.startx, " -25 ").concat(width, " ").concat(height + extraVertForTitle));
21317 diagram.attr('preserveAspectRatio', 'xMinYMin meet');
21318};
21319var bounds = {
21320 data: {
21321 startx: undefined,
21322 stopx: undefined,
21323 starty: undefined,
21324 stopy: undefined
21325 },
21326 verticalPos: 0,
21327 sequenceItems: [],
21328 init: function init() {
21329 this.sequenceItems = [];
21330 this.data = {
21331 startx: undefined,
21332 stopx: undefined,
21333 starty: undefined,
21334 stopy: undefined
21335 };
21336 this.verticalPos = 0;
21337 },
21338 updateVal: function updateVal(obj, key, val, fun) {
21339 if (typeof obj[key] === 'undefined') {
21340 obj[key] = val;
21341 } else {
21342 obj[key] = fun(val, obj[key]);
21343 }
21344 },
21345 updateBounds: function updateBounds(startx, starty, stopx, stopy) {
21346 var _self = this;
21347
21348 var cnt = 0;
21349
21350 function updateFn(type) {
21351 return function updateItemBounds(item) {
21352 cnt++; // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
21353
21354 var n = _self.sequenceItems.length - cnt + 1;
21355
21356 _self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min);
21357
21358 _self.updateVal(item, 'stopy', stopy + n * conf.boxMargin, Math.max);
21359
21360 _self.updateVal(bounds.data, 'startx', startx - n * conf.boxMargin, Math.min);
21361
21362 _self.updateVal(bounds.data, 'stopx', stopx + n * conf.boxMargin, Math.max);
21363
21364 if (!(type === 'activation')) {
21365 _self.updateVal(item, 'startx', startx - n * conf.boxMargin, Math.min);
21366
21367 _self.updateVal(item, 'stopx', stopx + n * conf.boxMargin, Math.max);
21368
21369 _self.updateVal(bounds.data, 'starty', starty - n * conf.boxMargin, Math.min);
21370
21371 _self.updateVal(bounds.data, 'stopy', stopy + n * conf.boxMargin, Math.max);
21372 }
21373 };
21374 }
21375
21376 this.sequenceItems.forEach(updateFn());
21377 },
21378 insert: function insert(startx, starty, stopx, stopy) {
21379 var _startx = Math.min(startx, stopx);
21380
21381 var _stopx = Math.max(startx, stopx);
21382
21383 var _starty = Math.min(starty, stopy);
21384
21385 var _stopy = Math.max(starty, stopy);
21386
21387 this.updateVal(bounds.data, 'startx', _startx, Math.min);
21388 this.updateVal(bounds.data, 'starty', _starty, Math.min);
21389 this.updateVal(bounds.data, 'stopx', _stopx, Math.max);
21390 this.updateVal(bounds.data, 'stopy', _stopy, Math.max);
21391 this.updateBounds(_startx, _starty, _stopx, _stopy);
21392 },
21393 bumpVerticalPos: function bumpVerticalPos(bump) {
21394 this.verticalPos = this.verticalPos + bump;
21395 this.data.stopy = this.verticalPos;
21396 },
21397 getVerticalPos: function getVerticalPos() {
21398 return this.verticalPos;
21399 },
21400 getBounds: function getBounds() {
21401 return this.data;
21402 }
21403};
21404var fills = conf.sectionFills;
21405var textColours = conf.sectionColours;
21406var drawTasks = function drawTasks(diagram, tasks, verticalPos) {
21407 var lastSection = '';
21408 var sectionVHeight = conf.height * 2 + conf.diagramMarginY;
21409 var taskPos = verticalPos + sectionVHeight;
21410 var sectionNumber = 0;
21411 var fill = '#CCC';
21412 var colour = 'black';
21413 var num = 0; // Draw the tasks
21414
21415 for (var i = 0; i < tasks.length; i++) {
21416 var task = tasks[i];
21417
21418 if (lastSection !== task.section) {
21419 fill = fills[sectionNumber % fills.length];
21420 num = sectionNumber % fills.length;
21421 colour = textColours[sectionNumber % textColours.length];
21422 var section = {
21423 x: i * conf.taskMargin + i * conf.width + LEFT_MARGIN,
21424 y: 50,
21425 text: task.section,
21426 fill: fill,
21427 num: num,
21428 colour: colour
21429 };
21430 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawSection(diagram, section, conf);
21431 lastSection = task.section;
21432 sectionNumber++;
21433 } // Collect the actors involved in the task
21434
21435
21436 var taskActors = task.people.reduce(function (acc, actorName) {
21437 if (actors[actorName]) {
21438 acc[actorName] = actors[actorName];
21439 }
21440
21441 return acc;
21442 }, {}); // Add some rendering data to the object
21443
21444 task.x = i * conf.taskMargin + i * conf.width + LEFT_MARGIN;
21445 task.y = taskPos;
21446 task.width = conf.diagramMarginX;
21447 task.height = conf.diagramMarginY;
21448 task.colour = colour;
21449 task.fill = fill;
21450 task.num = num;
21451 task.actors = taskActors; // Draw the box with the attached line
21452
21453 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawTask(diagram, task, conf);
21454 bounds.insert(task.x, task.y, task.x + task.width + conf.taskMargin, 300 + 5 * 30); // stopy is the length of the descenders.
21455 }
21456};
21457/* harmony default export */ __webpack_exports__["default"] = ({
21458 setConf: setConf,
21459 draw: draw
21460});
21461
21462/***/ }),
21463
21464/***/ "./src/diagrams/user-journey/parser/journey.jison":
21465/*!********************************************************!*\
21466 !*** ./src/diagrams/user-journey/parser/journey.jison ***!
21467 \********************************************************/
21468/*! no static exports found */
21469/***/ (function(module, exports, __webpack_require__) {
21470
21471/* WEBPACK VAR INJECTION */(function(process, module) {/* parser generated by jison 0.4.18 */
21472/*
21473 Returns a Parser object of the following structure:
21474
21475 Parser: {
21476 yy: {}
21477 }
21478
21479 Parser.prototype: {
21480 yy: {},
21481 trace: function(),
21482 symbols_: {associative list: name ==> number},
21483 terminals_: {associative list: number ==> name},
21484 productions_: [...],
21485 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
21486 table: [...],
21487 defaultActions: {...},
21488 parseError: function(str, hash),
21489 parse: function(input),
21490
21491 lexer: {
21492 EOF: 1,
21493 parseError: function(str, hash),
21494 setInput: function(input),
21495 input: function(),
21496 unput: function(str),
21497 more: function(),
21498 less: function(n),
21499 pastInput: function(),
21500 upcomingInput: function(),
21501 showPosition: function(),
21502 test_match: function(regex_match_array, rule_index),
21503 next: function(),
21504 lex: function(),
21505 begin: function(condition),
21506 popState: function(),
21507 _currentRules: function(),
21508 topState: function(),
21509 pushState: function(condition),
21510
21511 options: {
21512 ranges: boolean (optional: true ==> token location info will include a .range[] member)
21513 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
21514 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)
21515 },
21516
21517 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
21518 rules: [...],
21519 conditions: {associative list: name ==> set},
21520 }
21521 }
21522
21523
21524 token location info (@$, _$, etc.): {
21525 first_line: n,
21526 last_line: n,
21527 first_column: n,
21528 last_column: n,
21529 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
21530 }
21531
21532
21533 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
21534 text: (matched text)
21535 token: (the produced terminal token, if any)
21536 line: (yylineno)
21537 }
21538 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
21539 loc: (yylloc)
21540 expected: (string describing the set of expected tokens)
21541 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
21542 }
21543*/
21544var parser = (function(){
21545var 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];
21546var parser = {trace: function trace () { },
21547yy: {},
21548symbols_: {"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},
21549terminals_: {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"},
21550productions_: [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]],
21551performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
21552/* this == yyval */
21553
21554var $0 = $$.length - 1;
21555switch (yystate) {
21556case 1:
21557 return $$[$0-1];
21558break;
21559case 3:
21560 this.$ = []
21561break;
21562case 4:
21563$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
21564break;
21565case 5: case 6:
21566 this.$ = $$[$0]
21567break;
21568case 7: case 8:
21569 this.$=[];
21570break;
21571case 11:
21572yy.setTitle($$[$0].substr(6));this.$=$$[$0].substr(6);
21573break;
21574case 12:
21575yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
21576break;
21577case 13:
21578yy.addTask($$[$0-1], $$[$0]);this.$='task';
21579break;
21580case 15:
21581 yy.parseDirective('%%{', 'open_directive');
21582break;
21583case 16:
21584 yy.parseDirective($$[$0], 'type_directive');
21585break;
21586case 17:
21587 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
21588break;
21589case 18:
21590 yy.parseDirective('}%%', 'close_directive', 'journey');
21591break;
21592}
21593},
21594table: [{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])],
21595defaultActions: {5:[2,15],7:[2,2],21:[2,18],26:[2,17]},
21596parseError: function parseError (str, hash) {
21597 if (hash.recoverable) {
21598 this.trace(str);
21599 } else {
21600 var error = new Error(str);
21601 error.hash = hash;
21602 throw error;
21603 }
21604},
21605parse: function parse(input) {
21606 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
21607 var args = lstack.slice.call(arguments, 1);
21608 var lexer = Object.create(this.lexer);
21609 var sharedState = { yy: {} };
21610 for (var k in this.yy) {
21611 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
21612 sharedState.yy[k] = this.yy[k];
21613 }
21614 }
21615 lexer.setInput(input, sharedState.yy);
21616 sharedState.yy.lexer = lexer;
21617 sharedState.yy.parser = this;
21618 if (typeof lexer.yylloc == 'undefined') {
21619 lexer.yylloc = {};
21620 }
21621 var yyloc = lexer.yylloc;
21622 lstack.push(yyloc);
21623 var ranges = lexer.options && lexer.options.ranges;
21624 if (typeof sharedState.yy.parseError === 'function') {
21625 this.parseError = sharedState.yy.parseError;
21626 } else {
21627 this.parseError = Object.getPrototypeOf(this).parseError;
21628 }
21629 function popStack(n) {
21630 stack.length = stack.length - 2 * n;
21631 vstack.length = vstack.length - n;
21632 lstack.length = lstack.length - n;
21633 }
21634 function lex() {
21635 var token;
21636 token = tstack.pop() || lexer.lex() || EOF;
21637 if (typeof token !== 'number') {
21638 if (token instanceof Array) {
21639 tstack = token;
21640 token = tstack.pop();
21641 }
21642 token = self.symbols_[token] || token;
21643 }
21644 return token;
21645 }
21646 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
21647 while (true) {
21648 state = stack[stack.length - 1];
21649 if (this.defaultActions[state]) {
21650 action = this.defaultActions[state];
21651 } else {
21652 if (symbol === null || typeof symbol == 'undefined') {
21653 symbol = lex();
21654 }
21655 action = table[state] && table[state][symbol];
21656 }
21657 if (typeof action === 'undefined' || !action.length || !action[0]) {
21658 var errStr = '';
21659 expected = [];
21660 for (p in table[state]) {
21661 if (this.terminals_[p] && p > TERROR) {
21662 expected.push('\'' + this.terminals_[p] + '\'');
21663 }
21664 }
21665 if (lexer.showPosition) {
21666 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
21667 } else {
21668 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
21669 }
21670 this.parseError(errStr, {
21671 text: lexer.match,
21672 token: this.terminals_[symbol] || symbol,
21673 line: lexer.yylineno,
21674 loc: yyloc,
21675 expected: expected
21676 });
21677 }
21678 if (action[0] instanceof Array && action.length > 1) {
21679 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
21680 }
21681 switch (action[0]) {
21682 case 1:
21683 stack.push(symbol);
21684 vstack.push(lexer.yytext);
21685 lstack.push(lexer.yylloc);
21686 stack.push(action[1]);
21687 symbol = null;
21688 if (!preErrorSymbol) {
21689 yyleng = lexer.yyleng;
21690 yytext = lexer.yytext;
21691 yylineno = lexer.yylineno;
21692 yyloc = lexer.yylloc;
21693 if (recovering > 0) {
21694 recovering--;
21695 }
21696 } else {
21697 symbol = preErrorSymbol;
21698 preErrorSymbol = null;
21699 }
21700 break;
21701 case 2:
21702 len = this.productions_[action[1]][1];
21703 yyval.$ = vstack[vstack.length - len];
21704 yyval._$ = {
21705 first_line: lstack[lstack.length - (len || 1)].first_line,
21706 last_line: lstack[lstack.length - 1].last_line,
21707 first_column: lstack[lstack.length - (len || 1)].first_column,
21708 last_column: lstack[lstack.length - 1].last_column
21709 };
21710 if (ranges) {
21711 yyval._$.range = [
21712 lstack[lstack.length - (len || 1)].range[0],
21713 lstack[lstack.length - 1].range[1]
21714 ];
21715 }
21716 r = this.performAction.apply(yyval, [
21717 yytext,
21718 yyleng,
21719 yylineno,
21720 sharedState.yy,
21721 action[1],
21722 vstack,
21723 lstack
21724 ].concat(args));
21725 if (typeof r !== 'undefined') {
21726 return r;
21727 }
21728 if (len) {
21729 stack = stack.slice(0, -1 * len * 2);
21730 vstack = vstack.slice(0, -1 * len);
21731 lstack = lstack.slice(0, -1 * len);
21732 }
21733 stack.push(this.productions_[action[1]][0]);
21734 vstack.push(yyval.$);
21735 lstack.push(yyval._$);
21736 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
21737 stack.push(newState);
21738 break;
21739 case 3:
21740 return true;
21741 }
21742 }
21743 return true;
21744}};
21745
21746/* generated by jison-lex 0.3.4 */
21747var lexer = (function(){
21748var lexer = ({
21749
21750EOF:1,
21751
21752parseError:function parseError(str, hash) {
21753 if (this.yy.parser) {
21754 this.yy.parser.parseError(str, hash);
21755 } else {
21756 throw new Error(str);
21757 }
21758 },
21759
21760// resets the lexer, sets new input
21761setInput:function (input, yy) {
21762 this.yy = yy || this.yy || {};
21763 this._input = input;
21764 this._more = this._backtrack = this.done = false;
21765 this.yylineno = this.yyleng = 0;
21766 this.yytext = this.matched = this.match = '';
21767 this.conditionStack = ['INITIAL'];
21768 this.yylloc = {
21769 first_line: 1,
21770 first_column: 0,
21771 last_line: 1,
21772 last_column: 0
21773 };
21774 if (this.options.ranges) {
21775 this.yylloc.range = [0,0];
21776 }
21777 this.offset = 0;
21778 return this;
21779 },
21780
21781// consumes and returns one char from the input
21782input:function () {
21783 var ch = this._input[0];
21784 this.yytext += ch;
21785 this.yyleng++;
21786 this.offset++;
21787 this.match += ch;
21788 this.matched += ch;
21789 var lines = ch.match(/(?:\r\n?|\n).*/g);
21790 if (lines) {
21791 this.yylineno++;
21792 this.yylloc.last_line++;
21793 } else {
21794 this.yylloc.last_column++;
21795 }
21796 if (this.options.ranges) {
21797 this.yylloc.range[1]++;
21798 }
21799
21800 this._input = this._input.slice(1);
21801 return ch;
21802 },
21803
21804// unshifts one char (or a string) into the input
21805unput:function (ch) {
21806 var len = ch.length;
21807 var lines = ch.split(/(?:\r\n?|\n)/g);
21808
21809 this._input = ch + this._input;
21810 this.yytext = this.yytext.substr(0, this.yytext.length - len);
21811 //this.yyleng -= len;
21812 this.offset -= len;
21813 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
21814 this.match = this.match.substr(0, this.match.length - 1);
21815 this.matched = this.matched.substr(0, this.matched.length - 1);
21816
21817 if (lines.length - 1) {
21818 this.yylineno -= lines.length - 1;
21819 }
21820 var r = this.yylloc.range;
21821
21822 this.yylloc = {
21823 first_line: this.yylloc.first_line,
21824 last_line: this.yylineno + 1,
21825 first_column: this.yylloc.first_column,
21826 last_column: lines ?
21827 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
21828 + oldLines[oldLines.length - lines.length].length - lines[0].length :
21829 this.yylloc.first_column - len
21830 };
21831
21832 if (this.options.ranges) {
21833 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
21834 }
21835 this.yyleng = this.yytext.length;
21836 return this;
21837 },
21838
21839// When called from action, caches matched text and appends it on next action
21840more:function () {
21841 this._more = true;
21842 return this;
21843 },
21844
21845// 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.
21846reject:function () {
21847 if (this.options.backtrack_lexer) {
21848 this._backtrack = true;
21849 } else {
21850 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(), {
21851 text: "",
21852 token: null,
21853 line: this.yylineno
21854 });
21855
21856 }
21857 return this;
21858 },
21859
21860// retain first n characters of the match
21861less:function (n) {
21862 this.unput(this.match.slice(n));
21863 },
21864
21865// displays already matched input, i.e. for error messages
21866pastInput:function () {
21867 var past = this.matched.substr(0, this.matched.length - this.match.length);
21868 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
21869 },
21870
21871// displays upcoming input, i.e. for error messages
21872upcomingInput:function () {
21873 var next = this.match;
21874 if (next.length < 20) {
21875 next += this._input.substr(0, 20-next.length);
21876 }
21877 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
21878 },
21879
21880// displays the character position where the lexing error occurred, i.e. for error messages
21881showPosition:function () {
21882 var pre = this.pastInput();
21883 var c = new Array(pre.length + 1).join("-");
21884 return pre + this.upcomingInput() + "\n" + c + "^";
21885 },
21886
21887// test the lexed token: return FALSE when not a match, otherwise return token
21888test_match:function(match, indexed_rule) {
21889 var token,
21890 lines,
21891 backup;
21892
21893 if (this.options.backtrack_lexer) {
21894 // save context
21895 backup = {
21896 yylineno: this.yylineno,
21897 yylloc: {
21898 first_line: this.yylloc.first_line,
21899 last_line: this.last_line,
21900 first_column: this.yylloc.first_column,
21901 last_column: this.yylloc.last_column
21902 },
21903 yytext: this.yytext,
21904 match: this.match,
21905 matches: this.matches,
21906 matched: this.matched,
21907 yyleng: this.yyleng,
21908 offset: this.offset,
21909 _more: this._more,
21910 _input: this._input,
21911 yy: this.yy,
21912 conditionStack: this.conditionStack.slice(0),
21913 done: this.done
21914 };
21915 if (this.options.ranges) {
21916 backup.yylloc.range = this.yylloc.range.slice(0);
21917 }
21918 }
21919
21920 lines = match[0].match(/(?:\r\n?|\n).*/g);
21921 if (lines) {
21922 this.yylineno += lines.length;
21923 }
21924 this.yylloc = {
21925 first_line: this.yylloc.last_line,
21926 last_line: this.yylineno + 1,
21927 first_column: this.yylloc.last_column,
21928 last_column: lines ?
21929 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
21930 this.yylloc.last_column + match[0].length
21931 };
21932 this.yytext += match[0];
21933 this.match += match[0];
21934 this.matches = match;
21935 this.yyleng = this.yytext.length;
21936 if (this.options.ranges) {
21937 this.yylloc.range = [this.offset, this.offset += this.yyleng];
21938 }
21939 this._more = false;
21940 this._backtrack = false;
21941 this._input = this._input.slice(match[0].length);
21942 this.matched += match[0];
21943 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
21944 if (this.done && this._input) {
21945 this.done = false;
21946 }
21947 if (token) {
21948 return token;
21949 } else if (this._backtrack) {
21950 // recover context
21951 for (var k in backup) {
21952 this[k] = backup[k];
21953 }
21954 return false; // rule action called reject() implying the next rule should be tested instead.
21955 }
21956 return false;
21957 },
21958
21959// return next match in input
21960next:function () {
21961 if (this.done) {
21962 return this.EOF;
21963 }
21964 if (!this._input) {
21965 this.done = true;
21966 }
21967
21968 var token,
21969 match,
21970 tempMatch,
21971 index;
21972 if (!this._more) {
21973 this.yytext = '';
21974 this.match = '';
21975 }
21976 var rules = this._currentRules();
21977 for (var i = 0; i < rules.length; i++) {
21978 tempMatch = this._input.match(this.rules[rules[i]]);
21979 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
21980 match = tempMatch;
21981 index = i;
21982 if (this.options.backtrack_lexer) {
21983 token = this.test_match(tempMatch, rules[i]);
21984 if (token !== false) {
21985 return token;
21986 } else if (this._backtrack) {
21987 match = false;
21988 continue; // rule action called reject() implying a rule MISmatch.
21989 } else {
21990 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
21991 return false;
21992 }
21993 } else if (!this.options.flex) {
21994 break;
21995 }
21996 }
21997 }
21998 if (match) {
21999 token = this.test_match(match, rules[index]);
22000 if (token !== false) {
22001 return token;
22002 }
22003 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
22004 return false;
22005 }
22006 if (this._input === "") {
22007 return this.EOF;
22008 } else {
22009 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
22010 text: "",
22011 token: null,
22012 line: this.yylineno
22013 });
22014 }
22015 },
22016
22017// return next match that has a token
22018lex:function lex () {
22019 var r = this.next();
22020 if (r) {
22021 return r;
22022 } else {
22023 return this.lex();
22024 }
22025 },
22026
22027// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
22028begin:function begin (condition) {
22029 this.conditionStack.push(condition);
22030 },
22031
22032// pop the previously active lexer condition state off the condition stack
22033popState:function popState () {
22034 var n = this.conditionStack.length - 1;
22035 if (n > 0) {
22036 return this.conditionStack.pop();
22037 } else {
22038 return this.conditionStack[0];
22039 }
22040 },
22041
22042// produce the lexer rule set which is active for the currently active lexer condition state
22043_currentRules:function _currentRules () {
22044 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
22045 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
22046 } else {
22047 return this.conditions["INITIAL"].rules;
22048 }
22049 },
22050
22051// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
22052topState:function topState (n) {
22053 n = this.conditionStack.length - 1 - Math.abs(n || 0);
22054 if (n >= 0) {
22055 return this.conditionStack[n];
22056 } else {
22057 return "INITIAL";
22058 }
22059 },
22060
22061// alias for begin(condition)
22062pushState:function pushState (condition) {
22063 this.begin(condition);
22064 },
22065
22066// return the number of states currently on the stack
22067stateStackSize:function stateStackSize() {
22068 return this.conditionStack.length;
22069 },
22070options: {"case-insensitive":true},
22071performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
22072var YYSTATE=YY_START;
22073switch($avoiding_name_collisions) {
22074case 0: this.begin('open_directive'); return 21;
22075break;
22076case 1: this.begin('type_directive'); return 22;
22077break;
22078case 2: this.popState(); this.begin('arg_directive'); return 15;
22079break;
22080case 3: this.popState(); this.popState(); return 24;
22081break;
22082case 4:return 23;
22083break;
22084case 5:/* skip comments */
22085break;
22086case 6:/* skip comments */
22087break;
22088case 7:return 11;
22089break;
22090case 8:/* skip whitespace */
22091break;
22092case 9:/* skip comments */
22093break;
22094case 10:return 4;
22095break;
22096case 11:return 17;
22097break;
22098case 12:return 18;
22099break;
22100case 13:return 19;
22101break;
22102case 14:return 20;
22103break;
22104case 15:return 15;
22105break;
22106case 16:return 6;
22107break;
22108case 17:return 'INVALID';
22109break;
22110}
22111},
22112rules: [/^(?:%%\{)/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],
22113conditions: {"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}}
22114});
22115return lexer;
22116})();
22117parser.lexer = lexer;
22118function Parser () {
22119 this.yy = {};
22120}
22121Parser.prototype = parser;parser.Parser = Parser;
22122return new Parser;
22123})();
22124
22125
22126if (true) {
22127exports.parser = parser;
22128exports.Parser = parser.Parser;
22129exports.parse = function () { return parser.parse.apply(parser, arguments); };
22130exports.main = function commonjsMain (args) {
22131 if (!args[1]) {
22132 console.log('Usage: '+args[0]+' FILE');
22133 process.exit(1);
22134 }
22135 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");
22136 return exports.parser.parse(source);
22137};
22138if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
22139 exports.main(process.argv.slice(1));
22140}
22141}
22142/* 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)))
22143
22144/***/ }),
22145
22146/***/ "./src/diagrams/user-journey/styles.js":
22147/*!*********************************************!*\
22148 !*** ./src/diagrams/user-journey/styles.js ***!
22149 \*********************************************/
22150/*! exports provided: default */
22151/***/ (function(module, __webpack_exports__, __webpack_require__) {
22152
22153"use strict";
22154__webpack_require__.r(__webpack_exports__);
22155var getStyles = function getStyles(options) {
22156 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");
22157};
22158
22159/* harmony default export */ __webpack_exports__["default"] = (getStyles);
22160
22161/***/ }),
22162
22163/***/ "./src/diagrams/user-journey/svgDraw.js":
22164/*!**********************************************!*\
22165 !*** ./src/diagrams/user-journey/svgDraw.js ***!
22166 \**********************************************/
22167/*! exports provided: drawRect, drawFace, drawCircle, drawText, drawLabel, drawSection, drawTask, drawBackgroundRect, getTextObj, getNoteRect, default */
22168/***/ (function(module, __webpack_exports__, __webpack_require__) {
22169
22170"use strict";
22171__webpack_require__.r(__webpack_exports__);
22172/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawRect", function() { return drawRect; });
22173/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawFace", function() { return drawFace; });
22174/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawCircle", function() { return drawCircle; });
22175/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawText", function() { return drawText; });
22176/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawLabel", function() { return drawLabel; });
22177/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawSection", function() { return drawSection; });
22178/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawTask", function() { return drawTask; });
22179/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawBackgroundRect", function() { return drawBackgroundRect; });
22180/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextObj", function() { return getTextObj; });
22181/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNoteRect", function() { return getNoteRect; });
22182/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
22183/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
22184
22185var drawRect = function drawRect(elem, rectData) {
22186 var rectElem = elem.append('rect');
22187 rectElem.attr('x', rectData.x);
22188 rectElem.attr('y', rectData.y);
22189 rectElem.attr('fill', rectData.fill);
22190 rectElem.attr('stroke', rectData.stroke);
22191 rectElem.attr('width', rectData.width);
22192 rectElem.attr('height', rectData.height);
22193 rectElem.attr('rx', rectData.rx);
22194 rectElem.attr('ry', rectData.ry);
22195
22196 if (typeof rectData.class !== 'undefined') {
22197 rectElem.attr('class', rectData.class);
22198 }
22199
22200 return rectElem;
22201};
22202var drawFace = function drawFace(element, faceData) {
22203 var radius = 15;
22204 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');
22205 var face = element.append('g'); //left eye
22206
22207 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
22208
22209 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');
22210
22211 function smile(face) {
22212 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
22213
22214 face.append('path').attr('class', 'mouth').attr('d', arc).attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 2) + ')');
22215 }
22216
22217 function sad(face) {
22218 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
22219
22220 face.append('path').attr('class', 'mouth').attr('d', arc).attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 7) + ')');
22221 }
22222
22223 function ambivalent(face) {
22224 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');
22225 }
22226
22227 if (faceData.score > 3) {
22228 smile(face);
22229 } else if (faceData.score < 3) {
22230 sad(face);
22231 } else {
22232 ambivalent(face);
22233 }
22234
22235 return circleElement;
22236};
22237var drawCircle = function drawCircle(element, circleData) {
22238 var circleElement = element.append('circle');
22239 circleElement.attr('cx', circleData.cx);
22240 circleElement.attr('cy', circleData.cy);
22241 circleElement.attr('fill', circleData.fill);
22242 circleElement.attr('stroke', circleData.stroke);
22243 circleElement.attr('r', circleData.r);
22244
22245 if (typeof circleElement.class !== 'undefined') {
22246 circleElement.attr('class', circleElement.class);
22247 }
22248
22249 if (typeof circleData.title !== 'undefined') {
22250 circleElement.append('title').text(circleData.title);
22251 }
22252
22253 return circleElement;
22254};
22255var drawText = function drawText(elem, textData) {
22256 // Remove and ignore br:s
22257 var nText = textData.text.replace(/<br\s*\/?>/gi, ' ');
22258 var textElem = elem.append('text');
22259 textElem.attr('x', textData.x);
22260 textElem.attr('y', textData.y);
22261 textElem.attr('class', 'legend');
22262 textElem.style('text-anchor', textData.anchor);
22263
22264 if (typeof textData.class !== 'undefined') {
22265 textElem.attr('class', textData.class);
22266 }
22267
22268 var span = textElem.append('tspan');
22269 span.attr('x', textData.x + textData.textMargin * 2);
22270 span.text(nText);
22271 return textElem;
22272};
22273var drawLabel = function drawLabel(elem, txtObject) {
22274 function genPoints(x, y, width, height, cut) {
22275 return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height);
22276 }
22277
22278 var polygon = elem.append('polygon');
22279 polygon.attr('points', genPoints(txtObject.x, txtObject.y, 50, 20, 7));
22280 polygon.attr('class', 'labelBox');
22281 txtObject.y = txtObject.y + txtObject.labelMargin;
22282 txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
22283 drawText(elem, txtObject);
22284};
22285var drawSection = function drawSection(elem, section, conf) {
22286 var g = elem.append('g');
22287 var rect = getNoteRect();
22288 rect.x = section.x;
22289 rect.y = section.y;
22290 rect.fill = section.fill;
22291 rect.width = conf.width;
22292 rect.height = conf.height;
22293 rect.class = 'journey-section section-type-' + section.num;
22294 rect.rx = 3;
22295 rect.ry = 3;
22296 drawRect(g, rect);
22297
22298 _drawTextCandidateFunc(conf)(section.text, g, rect.x, rect.y, rect.width, rect.height, {
22299 class: 'journey-section section-type-' + section.num
22300 }, conf, section.colour);
22301};
22302var taskCount = -1;
22303/**
22304 * Draws an actor in the diagram with the attaced line
22305 * @param elem The HTML element
22306 * @param task The task to render
22307 * @param conf The global configuration
22308 */
22309
22310var drawTask = function drawTask(elem, task, conf) {
22311 var center = task.x + conf.width / 2;
22312 var g = elem.append('g');
22313 taskCount++;
22314 var maxHeight = 300 + 5 * 30;
22315 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');
22316 drawFace(g, {
22317 cx: center,
22318 cy: 300 + (5 - task.score) * 30,
22319 score: task.score
22320 });
22321 var rect = getNoteRect();
22322 rect.x = task.x;
22323 rect.y = task.y;
22324 rect.fill = task.fill;
22325 rect.width = conf.width;
22326 rect.height = conf.height;
22327 rect.class = 'task task-type-' + task.num;
22328 rect.rx = 3;
22329 rect.ry = 3;
22330 drawRect(g, rect);
22331 var xPos = task.x + 14;
22332 task.people.forEach(function (person) {
22333 var colour = task.actors[person];
22334 var circle = {
22335 cx: xPos,
22336 cy: task.y,
22337 r: 7,
22338 fill: colour,
22339 stroke: '#000',
22340 title: person
22341 };
22342 drawCircle(g, circle);
22343 xPos += 10;
22344 });
22345
22346 _drawTextCandidateFunc(conf)(task.task, g, rect.x, rect.y, rect.width, rect.height, {
22347 class: 'task'
22348 }, conf, task.colour);
22349};
22350/**
22351 * Draws a background rectangle
22352 * @param elem The html element
22353 * @param bounds The bounds of the drawing
22354 */
22355
22356var drawBackgroundRect = function drawBackgroundRect(elem, bounds) {
22357 var rectElem = drawRect(elem, {
22358 x: bounds.startx,
22359 y: bounds.starty,
22360 width: bounds.stopx - bounds.startx,
22361 height: bounds.stopy - bounds.starty,
22362 fill: bounds.fill,
22363 class: 'rect'
22364 });
22365 rectElem.lower();
22366};
22367var getTextObj = function getTextObj() {
22368 return {
22369 x: 0,
22370 y: 0,
22371 fill: undefined,
22372 'text-anchor': 'start',
22373 width: 100,
22374 height: 100,
22375 textMargin: 0,
22376 rx: 0,
22377 ry: 0
22378 };
22379};
22380var getNoteRect = function getNoteRect() {
22381 return {
22382 x: 0,
22383 y: 0,
22384 width: 100,
22385 anchor: 'start',
22386 height: 100,
22387 rx: 0,
22388 ry: 0
22389 };
22390};
22391
22392var _drawTextCandidateFunc = function () {
22393 function byText(content, g, x, y, width, height, textAttrs, colour) {
22394 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);
22395
22396 _setTextAttrs(text, textAttrs);
22397 }
22398
22399 function byTspan(content, g, x, y, width, height, textAttrs, conf, colour) {
22400 var taskFontSize = conf.taskFontSize,
22401 taskFontFamily = conf.taskFontFamily;
22402 var lines = content.split(/<br\s*\/?>/gi);
22403
22404 for (var i = 0; i < lines.length; i++) {
22405 var dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2;
22406 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);
22407 text.append('tspan').attr('x', x + width / 2).attr('dy', dy).text(lines[i]);
22408 text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
22409
22410 _setTextAttrs(text, textAttrs);
22411 }
22412 }
22413
22414 function byFo(content, g, x, y, width, height, textAttrs, conf) {
22415 var body = g.append('switch');
22416 var f = body.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height).attr('position', 'fixed');
22417 var text = f.append('div').style('display', 'table').style('height', '100%').style('width', '100%');
22418 text.append('div').attr('class', 'label').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle') // .style('color', colour)
22419 .text(content);
22420 byTspan(content, body, x, y, width, height, textAttrs, conf);
22421
22422 _setTextAttrs(text, textAttrs);
22423 }
22424
22425 function _setTextAttrs(toText, fromTextAttrsDict) {
22426 for (var key in fromTextAttrsDict) {
22427 if (key in fromTextAttrsDict) {
22428 // eslint-disable-line
22429 // noinspection JSUnfilteredForInLoop
22430 toText.attr(key, fromTextAttrsDict[key]);
22431 }
22432 }
22433 }
22434
22435 return function (conf) {
22436 return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
22437 };
22438}();
22439
22440var initGraphics = function initGraphics(graphics) {
22441 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
22442};
22443
22444/* harmony default export */ __webpack_exports__["default"] = ({
22445 drawRect: drawRect,
22446 drawCircle: drawCircle,
22447 drawSection: drawSection,
22448 drawText: drawText,
22449 drawLabel: drawLabel,
22450 drawTask: drawTask,
22451 drawBackgroundRect: drawBackgroundRect,
22452 getTextObj: getTextObj,
22453 getNoteRect: getNoteRect,
22454 initGraphics: initGraphics
22455});
22456
22457/***/ }),
22458
22459/***/ "./src/errorRenderer.js":
22460/*!******************************!*\
22461 !*** ./src/errorRenderer.js ***!
22462 \******************************/
22463/*! exports provided: setConf, draw, default */
22464/***/ (function(module, __webpack_exports__, __webpack_require__) {
22465
22466"use strict";
22467__webpack_require__.r(__webpack_exports__);
22468/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setConf", function() { return setConf; });
22469/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return draw; });
22470/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
22471/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
22472/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
22473/**
22474 * Created by knut on 14-12-11.
22475 */
22476
22477
22478var conf = {};
22479var setConf = function setConf(cnf) {
22480 var keys = Object.keys(cnf);
22481 keys.forEach(function (key) {
22482 conf[key] = cnf[key];
22483 });
22484};
22485/**
22486 * Draws a an info picture in the tag with id: id based on the graph definition in text.
22487 * @param text
22488 * @param id
22489 */
22490
22491var draw = function draw(id, ver) {
22492 try {
22493 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].debug('Renering svg for syntax error\n');
22494 var svg = Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])('#' + id);
22495 var g = svg.append('g');
22496 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');
22497 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');
22498 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');
22499 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');
22500 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');
22501 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');
22502 g.append('text') // text label for the x axis
22503 .attr('class', 'error-text').attr('x', 1240).attr('y', 250).attr('font-size', '150px').style('text-anchor', 'middle').text('Syntax error in graph');
22504 g.append('text') // text label for the x axis
22505 .attr('class', 'error-text').attr('x', 1050).attr('y', 400).attr('font-size', '100px').style('text-anchor', 'middle').text('mermaid version ' + ver);
22506 svg.attr('height', 100);
22507 svg.attr('width', 400);
22508 svg.attr('viewBox', '768 0 512 512');
22509 } catch (e) {
22510 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].error('Error while rendering info diagram');
22511 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].error(e.message);
22512 }
22513};
22514/* harmony default export */ __webpack_exports__["default"] = ({
22515 setConf: setConf,
22516 draw: draw
22517});
22518
22519/***/ }),
22520
22521/***/ "./src/logger.js":
22522/*!***********************!*\
22523 !*** ./src/logger.js ***!
22524 \***********************/
22525/*! exports provided: LEVELS, logger, setLogLevel */
22526/***/ (function(module, __webpack_exports__, __webpack_require__) {
22527
22528"use strict";
22529__webpack_require__.r(__webpack_exports__);
22530/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LEVELS", function() { return LEVELS; });
22531/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logger", function() { return logger; });
22532/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLogLevel", function() { return setLogLevel; });
22533/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
22534/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
22535 //
22536
22537var LEVELS = {
22538 debug: 1,
22539 info: 2,
22540 warn: 3,
22541 error: 4,
22542 fatal: 5
22543};
22544var logger = {
22545 debug: function debug() {},
22546 info: function info() {},
22547 warn: function warn() {},
22548 error: function error() {},
22549 fatal: function fatal() {}
22550};
22551var setLogLevel = function setLogLevel() {
22552 var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'fatal';
22553
22554 if (isNaN(level)) {
22555 level = level.toLowerCase();
22556
22557 if (LEVELS[level] !== undefined) {
22558 level = LEVELS[level];
22559 }
22560 }
22561
22562 logger.trace = function () {};
22563
22564 logger.debug = function () {};
22565
22566 logger.info = function () {};
22567
22568 logger.warn = function () {};
22569
22570 logger.error = function () {};
22571
22572 logger.fatal = function () {};
22573
22574 if (level <= LEVELS.fatal) {
22575 logger.fatal = console.error ? console.error.bind(console, format('FATAL'), 'color: orange') : console.log.bind(console, '\x1b[35m', format('FATAL'));
22576 }
22577
22578 if (level <= LEVELS.error) {
22579 logger.error = console.error ? console.error.bind(console, format('ERROR'), 'color: orange') : console.log.bind(console, '\x1b[31m', format('ERROR'));
22580 }
22581
22582 if (level <= LEVELS.warn) {
22583 logger.warn = console.warn ? console.warn.bind(console, format('WARN'), 'color: orange') : console.log.bind(console, "\x1B[33m", format('WARN'));
22584 }
22585
22586 if (level <= LEVELS.info) {
22587 logger.info = console.info ? // ? console.info.bind(console, '\x1b[34m', format('INFO'), 'color: blue')
22588 console.info.bind(console, format('INFO'), 'color: lightblue') : console.log.bind(console, '\x1b[34m', format('INFO'));
22589 }
22590
22591 if (level <= LEVELS.debug) {
22592 logger.debug = console.debug ? console.debug.bind(console, format('DEBUG'), 'color: lightgreen') : console.log.bind(console, '\x1b[32m', format('DEBUG'));
22593 }
22594};
22595
22596var format = function format(level) {
22597 var time = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()().format('ss.SSS');
22598 return "%c".concat(time, " : ").concat(level, " : ");
22599};
22600
22601/***/ }),
22602
22603/***/ "./src/mermaid.js":
22604/*!************************!*\
22605 !*** ./src/mermaid.js ***!
22606 \************************/
22607/*! exports provided: default */
22608/***/ (function(module, __webpack_exports__, __webpack_require__) {
22609
22610"use strict";
22611__webpack_require__.r(__webpack_exports__);
22612/* harmony import */ var entity_decode_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! entity-decode/browser */ "entity-decode/browser");
22613/* harmony import */ var entity_decode_browser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(entity_decode_browser__WEBPACK_IMPORTED_MODULE_0__);
22614/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mermaidAPI */ "./src/mermaidAPI.js");
22615/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
22616/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
22617/**
22618 * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid functionality and to render
22619 * the diagrams to svg code.
22620 */
22621// import { decode } from 'he';
22622
22623
22624
22625
22626/**
22627 * ## init
22628 * Function that goes through the document to find the chart definitions in there and render them.
22629 *
22630 * The function tags the processed attributes with the attribute data-processed and ignores found elements with the
22631 * attribute already set. This way the init function can be triggered several times.
22632 *
22633 * Optionally, `init` can accept in the second argument one of the following:
22634 * - a DOM Node
22635 * - an array of DOM nodes (as would come from a jQuery selector)
22636 * - a W3C selector, a la `.mermaid`
22637 *
22638 * ```mermaid
22639 * graph LR;
22640 * a(Find elements)-->b{Processed}
22641 * b-->|Yes|c(Leave element)
22642 * b-->|No |d(Transform)
22643 * ```
22644 * Renders the mermaid diagrams
22645 * @param nodes a css selector or an array of nodes
22646 */
22647
22648var init = function init() {
22649 var _this = this;
22650
22651 var conf = _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].getConfig(); // console.log('Starting rendering diagrams (init) - mermaid.init', conf);
22652
22653 var nodes;
22654
22655 if (arguments.length >= 2) {
22656 /*! sequence config was passed as #1 */
22657 if (typeof arguments[0] !== 'undefined') {
22658 mermaid.sequenceConfig = arguments[0];
22659 }
22660
22661 nodes = arguments[1];
22662 } else {
22663 nodes = arguments[0];
22664 } // if last argument is a function this is the callback function
22665
22666
22667 var callback;
22668
22669 if (typeof arguments[arguments.length - 1] === 'function') {
22670 callback = arguments[arguments.length - 1];
22671 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Callback function found');
22672 } else {
22673 if (typeof conf.mermaid !== 'undefined') {
22674 if (typeof conf.mermaid.callback === 'function') {
22675 callback = conf.mermaid.callback;
22676 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Callback function found');
22677 } else {
22678 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('No Callback function found');
22679 }
22680 }
22681 }
22682
22683 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
22684
22685 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Start On Load before: ' + mermaid.startOnLoad);
22686
22687 if (typeof mermaid.startOnLoad !== 'undefined') {
22688 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Start On Load inner: ' + mermaid.startOnLoad);
22689 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].updateSiteConfig({
22690 startOnLoad: mermaid.startOnLoad
22691 });
22692 }
22693
22694 if (typeof mermaid.ganttConfig !== 'undefined') {
22695 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].updateSiteConfig({
22696 gantt: mermaid.ganttConfig
22697 });
22698 }
22699
22700 var txt;
22701
22702 var _loop = function _loop(i) {
22703 var element = nodes[i];
22704 /*! Check if previously processed */
22705
22706 if (!element.getAttribute('data-processed')) {
22707 element.setAttribute('data-processed', true);
22708 } else {
22709 return "continue";
22710 }
22711
22712 var id = "mermaid-".concat(Date.now()); // Fetch the graph definition including tags
22713
22714 txt = element.innerHTML; // transforms the html to pure text
22715
22716 txt = entity_decode_browser__WEBPACK_IMPORTED_MODULE_0___default()(txt).trim().replace(/<br\s*\/?>/gi, '<br/>');
22717 var init = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].detectInit(txt);
22718
22719 if (init) {
22720 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Detected early reinit: ', init);
22721 }
22722
22723 try {
22724 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].render(id, txt, function (svgCode, bindFunctions) {
22725 element.innerHTML = svgCode;
22726
22727 if (typeof callback !== 'undefined') {
22728 callback(id);
22729 }
22730
22731 if (bindFunctions) bindFunctions(element);
22732 }, element);
22733 } catch (e) {
22734 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].warn('Syntax Error rendering');
22735 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].warn(e);
22736
22737 if (_this.parseError) {
22738 _this.parseError(e);
22739 }
22740 }
22741 };
22742
22743 for (var i = 0; i < nodes.length; i++) {
22744 var _ret = _loop(i);
22745
22746 if (_ret === "continue") continue;
22747 }
22748};
22749
22750var initialize = function initialize(config) {
22751 // mermaidAPI.reset();
22752 if (typeof config.mermaid !== 'undefined') {
22753 if (typeof config.mermaid.startOnLoad !== 'undefined') {
22754 mermaid.startOnLoad = config.mermaid.startOnLoad;
22755 }
22756
22757 if (typeof config.mermaid.htmlLabels !== 'undefined') {
22758 mermaid.htmlLabels = config.mermaid.htmlLabels;
22759 }
22760 }
22761
22762 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].initialize(config); // mermaidAPI.reset();
22763};
22764/**
22765 * ##contentLoaded
22766 * Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and
22767 * calls init for rendering the mermaid diagrams on the page.
22768 */
22769
22770
22771var contentLoaded = function contentLoaded() {
22772 var config;
22773
22774 if (mermaid.startOnLoad) {
22775 // No config found, do check API config
22776 config = _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].getConfig();
22777
22778 if (config.startOnLoad) {
22779 mermaid.init();
22780 }
22781 } else {
22782 if (typeof mermaid.startOnLoad === 'undefined') {
22783 _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('In start, no config');
22784 config = _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].getConfig();
22785
22786 if (config.startOnLoad) {
22787 mermaid.init();
22788 }
22789 }
22790 }
22791};
22792
22793if (typeof document !== 'undefined') {
22794 /*!
22795 * Wait for document loaded before starting the execution
22796 */
22797 window.addEventListener('load', function () {
22798 contentLoaded();
22799 }, false);
22800}
22801
22802var mermaid = {
22803 startOnLoad: true,
22804 htmlLabels: true,
22805 mermaidAPI: _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"],
22806 parse: _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].parse,
22807 render: _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].render,
22808 init: init,
22809 initialize: initialize,
22810 contentLoaded: contentLoaded
22811};
22812/* harmony default export */ __webpack_exports__["default"] = (mermaid);
22813
22814/***/ }),
22815
22816/***/ "./src/mermaidAPI.js":
22817/*!***************************!*\
22818 !*** ./src/mermaidAPI.js ***!
22819 \***************************/
22820/*! exports provided: encodeEntities, decodeEntities, default */
22821/***/ (function(module, __webpack_exports__, __webpack_require__) {
22822
22823"use strict";
22824__webpack_require__.r(__webpack_exports__);
22825/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encodeEntities", function() { return encodeEntities; });
22826/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decodeEntities", function() { return decodeEntities; });
22827/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! stylis */ "stylis");
22828/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(stylis__WEBPACK_IMPORTED_MODULE_0__);
22829/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
22830/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
22831/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../package.json */ "./package.json");
22832var _package_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ../package.json */ "./package.json", 1);
22833/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
22834/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
22835/* harmony import */ var _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./diagrams/flowchart/flowRenderer */ "./src/diagrams/flowchart/flowRenderer.js");
22836/* harmony import */ var _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./diagrams/flowchart/flowRenderer-v2 */ "./src/diagrams/flowchart/flowRenderer-v2.js");
22837/* harmony import */ var _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./diagrams/flowchart/parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
22838/* harmony import */ var _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_7__);
22839/* harmony import */ var _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagrams/flowchart/flowDb */ "./src/diagrams/flowchart/flowDb.js");
22840/* harmony import */ var _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./diagrams/sequence/sequenceRenderer */ "./src/diagrams/sequence/sequenceRenderer.js");
22841/* harmony import */ var _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./diagrams/sequence/parser/sequenceDiagram */ "./src/diagrams/sequence/parser/sequenceDiagram.jison");
22842/* harmony import */ var _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_10__);
22843/* harmony import */ var _diagrams_sequence_sequenceDb__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./diagrams/sequence/sequenceDb */ "./src/diagrams/sequence/sequenceDb.js");
22844/* harmony import */ var _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./diagrams/gantt/ganttRenderer */ "./src/diagrams/gantt/ganttRenderer.js");
22845/* harmony import */ var _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./diagrams/gantt/parser/gantt */ "./src/diagrams/gantt/parser/gantt.jison");
22846/* harmony import */ var _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_13__);
22847/* harmony import */ var _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./diagrams/gantt/ganttDb */ "./src/diagrams/gantt/ganttDb.js");
22848/* harmony import */ var _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./diagrams/class/classRenderer */ "./src/diagrams/class/classRenderer.js");
22849/* harmony import */ var _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./diagrams/class/classRenderer-v2 */ "./src/diagrams/class/classRenderer-v2.js");
22850/* harmony import */ var _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./diagrams/class/parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
22851/* harmony import */ var _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_17__);
22852/* harmony import */ var _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./diagrams/class/classDb */ "./src/diagrams/class/classDb.js");
22853/* harmony import */ var _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./diagrams/state/stateRenderer */ "./src/diagrams/state/stateRenderer.js");
22854/* harmony import */ var _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./diagrams/state/stateRenderer-v2 */ "./src/diagrams/state/stateRenderer-v2.js");
22855/* harmony import */ var _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./diagrams/state/parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
22856/* harmony import */ var _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(_diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_21__);
22857/* harmony import */ var _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./diagrams/state/stateDb */ "./src/diagrams/state/stateDb.js");
22858/* harmony import */ var _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./diagrams/git/gitGraphRenderer */ "./src/diagrams/git/gitGraphRenderer.js");
22859/* harmony import */ var _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./diagrams/git/parser/gitGraph */ "./src/diagrams/git/parser/gitGraph.jison");
22860/* harmony import */ var _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(_diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_24__);
22861/* harmony import */ var _diagrams_git_gitGraphAst__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./diagrams/git/gitGraphAst */ "./src/diagrams/git/gitGraphAst.js");
22862/* harmony import */ var _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./diagrams/info/infoRenderer */ "./src/diagrams/info/infoRenderer.js");
22863/* harmony import */ var _errorRenderer__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./errorRenderer */ "./src/errorRenderer.js");
22864/* harmony import */ var _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./diagrams/info/parser/info */ "./src/diagrams/info/parser/info.jison");
22865/* harmony import */ var _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_28___default = /*#__PURE__*/__webpack_require__.n(_diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_28__);
22866/* harmony import */ var _diagrams_info_infoDb__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./diagrams/info/infoDb */ "./src/diagrams/info/infoDb.js");
22867/* harmony import */ var _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./diagrams/pie/pieRenderer */ "./src/diagrams/pie/pieRenderer.js");
22868/* harmony import */ var _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./diagrams/pie/parser/pie */ "./src/diagrams/pie/parser/pie.jison");
22869/* harmony import */ var _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_31___default = /*#__PURE__*/__webpack_require__.n(_diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_31__);
22870/* harmony import */ var _diagrams_pie_pieDb__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./diagrams/pie/pieDb */ "./src/diagrams/pie/pieDb.js");
22871/* harmony import */ var _diagrams_er_erDb__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./diagrams/er/erDb */ "./src/diagrams/er/erDb.js");
22872/* harmony import */ var _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./diagrams/er/parser/erDiagram */ "./src/diagrams/er/parser/erDiagram.jison");
22873/* harmony import */ var _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_34___default = /*#__PURE__*/__webpack_require__.n(_diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_34__);
22874/* harmony import */ var _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./diagrams/er/erRenderer */ "./src/diagrams/er/erRenderer.js");
22875/* 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");
22876/* 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__);
22877/* harmony import */ var _diagrams_user_journey_journeyDb__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./diagrams/user-journey/journeyDb */ "./src/diagrams/user-journey/journeyDb.js");
22878/* harmony import */ var _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./diagrams/user-journey/journeyRenderer */ "./src/diagrams/user-journey/journeyRenderer.js");
22879/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./config */ "./src/config.js");
22880/* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./styles */ "./src/styles.js");
22881/* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
22882function _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); }
22883
22884/**
22885 * 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.
22886 *
22887 * The core of this api is the [**render**](Setup.md?id=render) function which, given a graph
22888 * definition as text, renders the graph/diagram and returns an svg element for the graph.
22889 *
22890 * 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.
22891 *
22892 * In addition to the render function, a number of behavioral configuration options are available.
22893 *
22894 * @name mermaidAPI
22895 */
22896
22897
22898 // import * as configApi from './config';
22899// // , {
22900// // setConfig,
22901// // configApi.getConfig,
22902// // configApi.updateSiteConfig,
22903// // configApi.setSiteConfig,
22904// // configApi.getSiteConfig,
22905// // configApi.defaultConfig
22906// // }
22907
22908
22909
22910
22911
22912
22913
22914
22915
22916
22917
22918
22919
22920
22921
22922
22923
22924
22925
22926
22927
22928
22929
22930
22931
22932
22933
22934
22935
22936
22937
22938
22939
22940
22941
22942
22943
22944
22945
22946
22947
22948function parse(text) {
22949 var graphInit = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].detectInit(text);
22950
22951 if (graphInit) {
22952 reinitialize(graphInit);
22953 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('reinit ', graphInit);
22954 }
22955
22956 var graphType = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].detectType(text);
22957 var parser;
22958 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Type ' + graphType);
22959
22960 switch (graphType) {
22961 case 'git':
22962 parser = _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_24___default.a;
22963 parser.parser.yy = _diagrams_git_gitGraphAst__WEBPACK_IMPORTED_MODULE_25__["default"];
22964 break;
22965
22966 case 'flowchart':
22967 _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].clear();
22968 parser = _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_7___default.a;
22969 parser.parser.yy = _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"];
22970 break;
22971
22972 case 'flowchart-v2':
22973 _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].clear();
22974 parser = _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_7___default.a;
22975 parser.parser.yy = _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"];
22976 break;
22977
22978 case 'sequence':
22979 parser = _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_10___default.a;
22980 parser.parser.yy = _diagrams_sequence_sequenceDb__WEBPACK_IMPORTED_MODULE_11__["default"];
22981 break;
22982
22983 case 'gantt':
22984 parser = _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_13___default.a;
22985 parser.parser.yy = _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_14__["default"];
22986 break;
22987
22988 case 'class':
22989 parser = _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_17___default.a;
22990 parser.parser.yy = _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_18__["default"];
22991 break;
22992
22993 case 'classDiagram':
22994 parser = _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_17___default.a;
22995 parser.parser.yy = _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_18__["default"];
22996 break;
22997
22998 case 'state':
22999 parser = _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_21___default.a;
23000 parser.parser.yy = _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_22__["default"];
23001 break;
23002
23003 case 'stateDiagram':
23004 parser = _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_21___default.a;
23005 parser.parser.yy = _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_22__["default"];
23006 break;
23007
23008 case 'info':
23009 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('info info info');
23010 parser = _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_28___default.a;
23011 parser.parser.yy = _diagrams_info_infoDb__WEBPACK_IMPORTED_MODULE_29__["default"];
23012 break;
23013
23014 case 'pie':
23015 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('pie');
23016 parser = _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_31___default.a;
23017 parser.parser.yy = _diagrams_pie_pieDb__WEBPACK_IMPORTED_MODULE_32__["default"];
23018 break;
23019
23020 case 'er':
23021 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('er');
23022 parser = _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_34___default.a;
23023 parser.parser.yy = _diagrams_er_erDb__WEBPACK_IMPORTED_MODULE_33__["default"];
23024 break;
23025
23026 case 'journey':
23027 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('Journey');
23028 parser = _diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_36___default.a;
23029 parser.parser.yy = _diagrams_user_journey_journeyDb__WEBPACK_IMPORTED_MODULE_37__["default"];
23030 break;
23031 }
23032
23033 parser.parser.yy.graphType = graphType;
23034
23035 parser.parser.yy.parseError = function (str, hash) {
23036 var error = {
23037 str: str,
23038 hash: hash
23039 };
23040 throw error;
23041 };
23042
23043 parser.parse(text);
23044 return parser;
23045}
23046
23047var encodeEntities = function encodeEntities(text) {
23048 var txt = text;
23049 txt = txt.replace(/style.*:\S*#.*;/g, function (s) {
23050 var innerTxt = s.substring(0, s.length - 1);
23051 return innerTxt;
23052 });
23053 txt = txt.replace(/classDef.*:\S*#.*;/g, function (s) {
23054 var innerTxt = s.substring(0, s.length - 1);
23055 return innerTxt;
23056 });
23057 txt = txt.replace(/#\w+;/g, function (s) {
23058 var innerTxt = s.substring(1, s.length - 1);
23059 var isInt = /^\+?\d+$/.test(innerTxt);
23060
23061 if (isInt) {
23062 return 'fl°°' + innerTxt + '¶ß';
23063 } else {
23064 return 'fl°' + innerTxt + '¶ß';
23065 }
23066 });
23067 return txt;
23068};
23069var decodeEntities = function decodeEntities(text) {
23070 var txt = text;
23071 txt = txt.replace(/fl°°/g, function () {
23072 return '&#';
23073 });
23074 txt = txt.replace(/fl°/g, function () {
23075 return '&';
23076 });
23077 txt = txt.replace(/¶ß/g, function () {
23078 return ';';
23079 });
23080 return txt;
23081};
23082/**
23083 * Function that renders an svg with a graph from a chart definition. Usage example below.
23084 *
23085 * ```js
23086 * mermaidAPI.initialize({
23087 * startOnLoad:true
23088 * });
23089 * $(function(){
23090 * const graphDefinition = 'graph TB\na-->b';
23091 * const cb = function(svgGraph){
23092 * console.log(svgGraph);
23093 * };
23094 * mermaidAPI.render('id1',graphDefinition,cb);
23095 * });
23096 *```
23097 * @param id the id of the element to be rendered
23098 * @param _txt the graph definition
23099 * @param cb callback which is called after rendering is finished with the svg code as inparam.
23100 * @param container selector to element in which a div with the graph temporarily will be inserted. In one is
23101 * provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is
23102 * completed.
23103 */
23104
23105var render = function render(id, _txt, cb, container) {
23106 _config__WEBPACK_IMPORTED_MODULE_39__["reset"]();
23107 var txt = _txt;
23108 var graphInit = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].detectInit(txt);
23109
23110 if (graphInit) {
23111 _config__WEBPACK_IMPORTED_MODULE_39__["addDirective"](graphInit);
23112 } // else {
23113 // configApi.reset();
23114 // const siteConfig = configApi.getSiteConfig();
23115 // configApi.addDirective(siteConfig);
23116 // }
23117 // console.warn('Render fetching config');
23118
23119
23120 var cnf = _config__WEBPACK_IMPORTED_MODULE_39__["getConfig"](); // console.warn('Render with config after adding new directives', cnf.sequence);
23121 // console.warn(
23122 // 'Render with config after adding new directives',
23123 // cnf.fontFamily,
23124 // cnf.themeVariables.fontFamily
23125 // );
23126 // Check the maximum allowed text size
23127
23128 if (_txt.length > cnf.maxTextSize) {
23129 txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
23130 }
23131
23132 if (typeof container !== 'undefined') {
23133 container.innerHTML = '';
23134 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');
23135 } else {
23136 var existingSvg = document.getElementById(id);
23137
23138 if (existingSvg) {
23139 existingSvg.remove();
23140 }
23141
23142 var _element = document.querySelector('#' + 'd' + id);
23143
23144 if (_element) {
23145 _element.remove();
23146 }
23147
23148 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');
23149 }
23150
23151 window.txt = txt;
23152 txt = encodeEntities(txt);
23153 var element = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#d' + id).node();
23154 var graphType = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].detectType(txt); // insert inline style into svg
23155
23156 var svg = element.firstChild;
23157 var firstChild = svg.firstChild;
23158 var userStyles = ''; // user provided theme CSS
23159
23160 if (cnf.themeCSS !== undefined) {
23161 userStyles += "\n".concat(cnf.themeCSS);
23162 } // user provided theme CSS
23163
23164
23165 if (cnf.fontFamily !== undefined) {
23166 userStyles += "\n:root { --mermaid-font-family: ".concat(cnf.fontFamily, "}");
23167 } // user provided theme CSS
23168
23169
23170 if (cnf.altFontFamily !== undefined) {
23171 userStyles += "\n:root { --mermaid-alt-font-family: ".concat(cnf.altFontFamily, "}");
23172 } // classDef
23173
23174
23175 if (graphType === 'flowchart' || graphType === 'flowchart-v2' || graphType === 'graph') {
23176 var classes = _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_5__["default"].getClasses(txt);
23177
23178 for (var className in classes) {
23179 userStyles += "\n.".concat(className, " > * { ").concat(classes[className].styles.join(' !important; '), " !important; }");
23180
23181 if (classes[className].textStyles) {
23182 userStyles += "\n.".concat(className, " tspan { ").concat(classes[className].textStyles.join(' !important; '), " !important; }");
23183 }
23184 }
23185 } // logger.warn(cnf.themeVariables);
23186
23187
23188 var stylis = new stylis__WEBPACK_IMPORTED_MODULE_0___default.a();
23189 var rules = stylis("#".concat(id), Object(_styles__WEBPACK_IMPORTED_MODULE_40__["default"])(graphType, userStyles, cnf.themeVariables));
23190 var style1 = document.createElement('style');
23191 style1.innerHTML = rules;
23192 svg.insertBefore(style1, firstChild); // Verify that the generated svgs are ok before removing this
23193 // const style2 = document.createElement('style');
23194 // const cs = window.getComputedStyle(svg);
23195 // style2.innerHTML = `#d${id} * {
23196 // color: ${cs.color};
23197 // // font: ${cs.font};
23198 // // font-family: Arial;
23199 // // font-size: 24px;
23200 // }`;
23201 // svg.insertBefore(style2, firstChild);
23202
23203 try {
23204 switch (graphType) {
23205 case 'git':
23206 cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23207 _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_23__["default"].setConf(cnf.git);
23208 _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_23__["default"].draw(txt, id, false);
23209 break;
23210
23211 case 'flowchart':
23212 cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23213 _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_5__["default"].setConf(cnf.flowchart);
23214 _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_5__["default"].draw(txt, id, false);
23215 break;
23216
23217 case 'flowchart-v2':
23218 cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23219 _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_6__["default"].setConf(cnf.flowchart);
23220 _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_6__["default"].draw(txt, id, false);
23221 break;
23222
23223 case 'sequence':
23224 cnf.sequence.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23225
23226 if (cnf.sequenceDiagram) {
23227 // backwards compatibility
23228 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__["default"].setConf(Object.assign(cnf.sequence, cnf.sequenceDiagram));
23229 console.error('`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.');
23230 } else {
23231 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__["default"].setConf(cnf.sequence);
23232 }
23233
23234 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__["default"].draw(txt, id);
23235 break;
23236
23237 case 'gantt':
23238 cnf.gantt.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23239 _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_12__["default"].setConf(cnf.gantt);
23240 _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_12__["default"].draw(txt, id);
23241 break;
23242
23243 case 'class':
23244 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23245 _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_15__["default"].setConf(cnf.class);
23246 _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_15__["default"].draw(txt, id);
23247 break;
23248
23249 case 'classDiagram':
23250 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23251 _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_16__["default"].setConf(cnf.class);
23252 _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_16__["default"].draw(txt, id);
23253 break;
23254
23255 case 'state':
23256 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23257 _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_19__["default"].setConf(cnf.state);
23258 _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_19__["default"].draw(txt, id);
23259 break;
23260
23261 case 'stateDiagram':
23262 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23263 _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_20__["default"].setConf(cnf.state);
23264 _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_20__["default"].draw(txt, id);
23265 break;
23266
23267 case 'info':
23268 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23269 _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_26__["default"].setConf(cnf.class);
23270 _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_26__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_2__.version);
23271 break;
23272
23273 case 'pie':
23274 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
23275 _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_30__["default"].setConf(cnf.pie);
23276 _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_30__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_2__.version);
23277 break;
23278
23279 case 'er':
23280 _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].setConf(cnf.er);
23281 _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_2__.version);
23282 break;
23283
23284 case 'journey':
23285 _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_38__["default"].setConf(cnf.journey);
23286 _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_38__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_2__.version);
23287 break;
23288 }
23289 } catch (e) {
23290 // errorRenderer.setConf(cnf.class);
23291 _errorRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].draw(id, _package_json__WEBPACK_IMPORTED_MODULE_2__.version);
23292 throw e;
23293 }
23294
23295 Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])("[id=\"".concat(id, "\"]")).selectAll('foreignobject > *').attr('xmlns', 'http://www.w3.org/1999/xhtml'); // if (cnf.arrowMarkerAbsolute) {
23296 // url =
23297 // window.location.protocol +
23298 // '//' +
23299 // window.location.host +
23300 // window.location.pathname +
23301 // window.location.search;
23302 // url = url.replace(/\(/g, '\\(');
23303 // url = url.replace(/\)/g, '\\)');
23304 // }
23305 // Fix for when the base tag is used
23306
23307 var svgCode = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#d' + id).node().innerHTML;
23308 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('cnf.arrowMarkerAbsolute', cnf.arrowMarkerAbsolute);
23309
23310 if (!cnf.arrowMarkerAbsolute || cnf.arrowMarkerAbsolute === 'false') {
23311 svgCode = svgCode.replace(/marker-end="url\(.*?#/g, 'marker-end="url(#', 'g');
23312 }
23313
23314 svgCode = decodeEntities(svgCode);
23315
23316 if (typeof cb !== 'undefined') {
23317 switch (graphType) {
23318 case 'flowchart':
23319 case 'flowchart-v2':
23320 cb(svgCode, _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].bindFunctions);
23321 break;
23322
23323 case 'gantt':
23324 cb(svgCode, _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_14__["default"].bindFunctions);
23325 break;
23326
23327 case 'class':
23328 case 'classDiagram':
23329 cb(svgCode, _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_18__["default"].bindFunctions);
23330 break;
23331
23332 default:
23333 cb(svgCode);
23334 }
23335 } else {
23336 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug('CB = undefined!');
23337 }
23338
23339 var node = Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#d' + id).node();
23340
23341 if (node !== null && typeof node.remove === 'function') {
23342 Object(d3__WEBPACK_IMPORTED_MODULE_1__["select"])('#d' + id).node().remove();
23343 }
23344
23345 return svgCode;
23346};
23347
23348var currentDirective = {};
23349
23350var parseDirective = function parseDirective(p, statement, context, type) {
23351 try {
23352 if (statement !== undefined) {
23353 statement = statement.trim();
23354
23355 switch (context) {
23356 case 'open_directive':
23357 currentDirective = {};
23358 break;
23359
23360 case 'type_directive':
23361 currentDirective.type = statement.toLowerCase();
23362 break;
23363
23364 case 'arg_directive':
23365 currentDirective.args = JSON.parse(statement);
23366 break;
23367
23368 case 'close_directive':
23369 handleDirective(p, currentDirective, type);
23370 currentDirective = null;
23371 break;
23372 }
23373 }
23374 } catch (error) {
23375 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error("Error while rendering sequenceDiagram directive: ".concat(statement, " jison context: ").concat(context));
23376 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].error(error.message);
23377 }
23378};
23379
23380var handleDirective = function handleDirective(p, directive, type) {
23381 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].debug("Directive type=".concat(directive.type, " with args:"), directive.args);
23382
23383 switch (directive.type) {
23384 case 'init':
23385 case 'initialize':
23386 {
23387 ['config'].forEach(function (prop) {
23388 if (typeof directive.args[prop] !== 'undefined') {
23389 if (type === 'flowchart-v2') {
23390 type = 'flowchart';
23391 }
23392
23393 directive.args[type] = directive.args[prop];
23394 delete directive.args[prop];
23395 }
23396 });
23397 reinitialize(directive.args);
23398 _config__WEBPACK_IMPORTED_MODULE_39__["addDirective"](directive.args);
23399 break;
23400 }
23401
23402 case 'wrap':
23403 case 'nowrap':
23404 if (p && p['setWrap']) {
23405 p.setWrap(directive.type === 'wrap');
23406 }
23407
23408 break;
23409
23410 default:
23411 _logger__WEBPACK_IMPORTED_MODULE_3__["logger"].warn("Unhandled directive: source: '%%{".concat(directive.type, ": ").concat(JSON.stringify(directive.args ? directive.args : {}), "}%%"), directive);
23412 break;
23413 }
23414};
23415
23416function updateRendererConfigs(conf) {
23417 _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_23__["default"].setConf(conf.git);
23418 _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_5__["default"].setConf(conf.flowchart);
23419 _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_6__["default"].setConf(conf.flowchart);
23420
23421 if (typeof conf['sequenceDiagram'] !== 'undefined') {
23422 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__["default"].setConf(Object(_utils__WEBPACK_IMPORTED_MODULE_4__["assignWithDepth"])(conf.sequence, conf['sequenceDiagram']));
23423 }
23424
23425 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_9__["default"].setConf(conf.sequence);
23426 _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_12__["default"].setConf(conf.gantt);
23427 _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_15__["default"].setConf(conf.class);
23428 _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_19__["default"].setConf(conf.state);
23429 _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_20__["default"].setConf(conf.state);
23430 _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_26__["default"].setConf(conf.class);
23431 _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_30__["default"].setConf(conf.class);
23432 _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].setConf(conf.er);
23433 _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_38__["default"].setConf(conf.journey);
23434 _errorRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].setConf(conf.class);
23435}
23436
23437function reinitialize() {// `mermaidAPI.reinitialize: v${pkg.version}`,
23438 // JSON.stringify(options),
23439 // options.themeVariables.primaryColor;
23440 // // if (options.theme && theme[options.theme]) {
23441 // // options.themeVariables = theme[options.theme].getThemeVariables(options.themeVariables);
23442 // // }
23443 // // Set default options
23444 // const config =
23445 // typeof options === 'object' ? configApi.setConfig(options) : configApi.getSiteConfig();
23446 // updateRendererConfigs(config);
23447 // setLogLevel(config.logLevel);
23448 // logger.debug('mermaidAPI.reinitialize: ', config);
23449}
23450
23451function initialize(options) {
23452 // console.warn(`mermaidAPI.initialize: v${pkg.version} `, options);
23453 // Handle legacy location of font-family configuration
23454 if (options && options.fontFamily) {
23455 if (!options.themeVariables) {
23456 options.themeVariables = {
23457 fontFamily: options.fontFamily
23458 };
23459 } else {
23460 if (!options.themeVariables.fontFamily) {
23461 options.themeVariables = {
23462 fontFamily: options.fontFamily
23463 };
23464 }
23465 }
23466 } // Set default options
23467
23468
23469 _config__WEBPACK_IMPORTED_MODULE_39__["setSiteConfigDelta"](options);
23470
23471 if (options && options.theme && _themes__WEBPACK_IMPORTED_MODULE_41__["default"][options.theme]) {
23472 // Todo merge with user options
23473 options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_41__["default"][options.theme].getThemeVariables(options.themeVariables);
23474 } else {
23475 if (options) options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_41__["default"].default.getThemeVariables(options.themeVariables);
23476 }
23477
23478 var config = _typeof(options) === 'object' ? _config__WEBPACK_IMPORTED_MODULE_39__["setSiteConfig"](options) : _config__WEBPACK_IMPORTED_MODULE_39__["getSiteConfig"]();
23479 updateRendererConfigs(config);
23480 Object(_logger__WEBPACK_IMPORTED_MODULE_3__["setLogLevel"])(config.logLevel); // logger.debug('mermaidAPI.initialize: ', config);
23481}
23482
23483var mermaidAPI = Object.freeze({
23484 render: render,
23485 parse: parse,
23486 parseDirective: parseDirective,
23487 initialize: initialize,
23488 reinitialize: reinitialize,
23489 getConfig: _config__WEBPACK_IMPORTED_MODULE_39__["getConfig"],
23490 setConfig: _config__WEBPACK_IMPORTED_MODULE_39__["setConfig"],
23491 getSiteConfig: _config__WEBPACK_IMPORTED_MODULE_39__["getSiteConfig"],
23492 updateSiteConfig: _config__WEBPACK_IMPORTED_MODULE_39__["updateSiteConfig"],
23493 reset: function reset() {
23494 // console.warn('reset');
23495 _config__WEBPACK_IMPORTED_MODULE_39__["reset"](); // const siteConfig = configApi.getSiteConfig();
23496 // updateRendererConfigs(siteConfig);
23497 },
23498 globalReset: function globalReset() {
23499 _config__WEBPACK_IMPORTED_MODULE_39__["reset"](_config__WEBPACK_IMPORTED_MODULE_39__["defaultConfig"]);
23500 updateRendererConfigs(_config__WEBPACK_IMPORTED_MODULE_39__["getConfig"]());
23501 },
23502 defaultConfig: _config__WEBPACK_IMPORTED_MODULE_39__["defaultConfig"]
23503});
23504Object(_logger__WEBPACK_IMPORTED_MODULE_3__["setLogLevel"])(_config__WEBPACK_IMPORTED_MODULE_39__["getConfig"]().logLevel);
23505_config__WEBPACK_IMPORTED_MODULE_39__["reset"](_config__WEBPACK_IMPORTED_MODULE_39__["getConfig"]());
23506/* harmony default export */ __webpack_exports__["default"] = (mermaidAPI);
23507/**
23508 * ## mermaidAPI configuration defaults
23509 *
23510 * ```html
23511 * <script>
23512 * var config = {
23513 * theme:'default',
23514 * logLevel:'fatal',
23515 * securityLevel:'strict',
23516 * startOnLoad:true,
23517 * arrowMarkerAbsolute:false,
23518 *
23519 * er:{
23520 * diagramPadding:20,
23521 * layoutDirection:'TB',
23522 * minEntityWidth:100,
23523 * minEntityHeight:75,
23524 * entityPadding:15,
23525 * stroke:'gray',
23526 * fill:'honeydew',
23527 * fontSize:12,
23528 * useMaxWidth:true,
23529 * },
23530 * flowchart:{
23531 * diagramPadding:8,
23532 * htmlLabels:true,
23533 * curve:'linear',
23534 * },
23535 * sequence:{
23536 * diagramMarginX:50,
23537 * diagramMarginY:10,
23538 * actorMargin:50,
23539 * width:150,
23540 * height:65,
23541 * boxMargin:10,
23542 * boxTextMargin:5,
23543 * noteMargin:10,
23544 * messageMargin:35,
23545 * messageAlign:'center',
23546 * mirrorActors:true,
23547 * bottomMarginAdj:1,
23548 * useMaxWidth:true,
23549 * rightAngles:false,
23550 * showSequenceNumbers:false,
23551 * },
23552 * gantt:{
23553 * titleTopMargin:25,
23554 * barHeight:20,
23555 * barGap:4,
23556 * topPadding:50,
23557 * leftPadding:75,
23558 * gridLineStartPadding:35,
23559 * fontSize:11,
23560 * fontFamily:'"Open-Sans", "sans-serif"',
23561 * numberSectionStyles:4,
23562 * axisFormat:'%Y-%m-%d',
23563 * }
23564 * };
23565 * mermaid.initialize(config);
23566 * </script>
23567 * ```
23568 */
23569
23570/***/ }),
23571
23572/***/ "./src/styles.js":
23573/*!***********************!*\
23574 !*** ./src/styles.js ***!
23575 \***********************/
23576/*! exports provided: calcThemeVariables, default */
23577/***/ (function(module, __webpack_exports__, __webpack_require__) {
23578
23579"use strict";
23580__webpack_require__.r(__webpack_exports__);
23581/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calcThemeVariables", function() { return calcThemeVariables; });
23582/* harmony import */ var _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./diagrams/class/styles */ "./src/diagrams/class/styles.js");
23583/* harmony import */ var _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./diagrams/er/styles */ "./src/diagrams/er/styles.js");
23584/* harmony import */ var _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./diagrams/flowchart/styles */ "./src/diagrams/flowchart/styles.js");
23585/* harmony import */ var _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagrams/gantt/styles */ "./src/diagrams/gantt/styles.js");
23586/* harmony import */ var _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./diagrams/git/styles */ "./src/diagrams/git/styles.js");
23587/* harmony import */ var _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./diagrams/info/styles */ "./src/diagrams/info/styles.js");
23588/* harmony import */ var _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./diagrams/pie/styles */ "./src/diagrams/pie/styles.js");
23589/* harmony import */ var _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./diagrams/sequence/styles */ "./src/diagrams/sequence/styles.js");
23590/* harmony import */ var _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagrams/state/styles */ "./src/diagrams/state/styles.js");
23591/* harmony import */ var _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./diagrams/user-journey/styles */ "./src/diagrams/user-journey/styles.js");
23592
23593
23594
23595
23596
23597
23598
23599
23600
23601
23602var themes = {
23603 flowchart: _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_2__["default"],
23604 'flowchart-v2': _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_2__["default"],
23605 sequence: _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_7__["default"],
23606 gantt: _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_3__["default"],
23607 classDiagram: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
23608 'classDiagram-v2': _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
23609 class: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
23610 stateDiagram: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_8__["default"],
23611 state: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_8__["default"],
23612 git: _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_4__["default"],
23613 info: _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_5__["default"],
23614 pie: _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_6__["default"],
23615 er: _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_1__["default"],
23616 journey: _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__["default"]
23617};
23618var calcThemeVariables = function calcThemeVariables(theme, userOverRides) {
23619 return theme.calcColors(userOverRides);
23620};
23621
23622var getStyles = function getStyles(type, userStyles, options) {
23623 //console.warn('options in styles: ', options);
23624 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");
23625};
23626
23627/* harmony default export */ __webpack_exports__["default"] = (getStyles);
23628
23629/***/ }),
23630
23631/***/ "./src/themes/index.js":
23632/*!*****************************!*\
23633 !*** ./src/themes/index.js ***!
23634 \*****************************/
23635/*! exports provided: default */
23636/***/ (function(module, __webpack_exports__, __webpack_require__) {
23637
23638"use strict";
23639__webpack_require__.r(__webpack_exports__);
23640/* harmony import */ var _theme_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./theme-base */ "./src/themes/theme-base.js");
23641/* harmony import */ var _theme_dark__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-dark */ "./src/themes/theme-dark.js");
23642/* harmony import */ var _theme_default__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./theme-default */ "./src/themes/theme-default.js");
23643/* harmony import */ var _theme_forest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./theme-forest */ "./src/themes/theme-forest.js");
23644/* harmony import */ var _theme_neutral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./theme-neutral */ "./src/themes/theme-neutral.js");
23645
23646
23647
23648
23649
23650/* harmony default export */ __webpack_exports__["default"] = ({
23651 base: {
23652 getThemeVariables: _theme_base__WEBPACK_IMPORTED_MODULE_0__["getThemeVariables"]
23653 },
23654 dark: {
23655 getThemeVariables: _theme_dark__WEBPACK_IMPORTED_MODULE_1__["getThemeVariables"]
23656 },
23657 default: {
23658 getThemeVariables: _theme_default__WEBPACK_IMPORTED_MODULE_2__["getThemeVariables"]
23659 },
23660 forest: {
23661 getThemeVariables: _theme_forest__WEBPACK_IMPORTED_MODULE_3__["getThemeVariables"]
23662 },
23663 neutral: {
23664 getThemeVariables: _theme_neutral__WEBPACK_IMPORTED_MODULE_4__["getThemeVariables"]
23665 }
23666});
23667
23668/***/ }),
23669
23670/***/ "./src/themes/theme-base.js":
23671/*!**********************************!*\
23672 !*** ./src/themes/theme-base.js ***!
23673 \**********************************/
23674/*! exports provided: getThemeVariables */
23675/***/ (function(module, __webpack_exports__, __webpack_require__) {
23676
23677"use strict";
23678__webpack_require__.r(__webpack_exports__);
23679/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getThemeVariables", function() { return getThemeVariables; });
23680/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
23681/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
23682/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
23683function _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); }
23684
23685function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23686
23687function _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); } }
23688
23689function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23690
23691
23692
23693
23694var Theme =
23695/*#__PURE__*/
23696function () {
23697 function Theme() {
23698 _classCallCheck(this, Theme);
23699
23700 /** # Base variables */
23701
23702 /** * 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. */
23703 this.background = '#f4f4f4';
23704 this.darkMode = false; // this.background = '#0c0c0c';
23705 // this.darkMode = true;
23706
23707 this.primaryColor = '#fff4dd'; // this.background = '#0c0c0c';
23708 // this.primaryColor = '#1f1f00';
23709
23710 this.noteBkgColor = '#fff5ad';
23711 this.noteTextColor = '#333'; // dark
23712 // this.primaryColor = '#034694';
23713 // this.primaryColor = '#f2ee7e';
23714 // this.primaryColor = '#9f33be';
23715 // this.primaryColor = '#f0fff0';
23716 // this.primaryColor = '#fa255e';
23717 // this.primaryColor = '#ECECFF';
23718 // this.secondaryColor = '#c39ea0';
23719 // this.tertiaryColor = '#f8e5e5';
23720 // this.secondaryColor = '#dfdfde';
23721 // this.tertiaryColor = '#CCCCFF';
23722
23723 this.fontFamily = '"trebuchet ms", verdana, arial';
23724 this.fontSize = '16px'; // this.updateColors();
23725 }
23726
23727 _createClass(Theme, [{
23728 key: "updateColors",
23729 value: function updateColors() {
23730 // The || is to make sure that if the variable has been defiend by a user override that value is to be used
23731
23732 /* Main */
23733 this.primaryTextColor = this.primaryTextColor || (this.darkMode ? '#ddd' : '#333'); // invert(this.primaryColor);
23734
23735 this.secondaryColor = this.secondaryColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23736 h: -120
23737 });
23738 this.tertiaryColor = this.tertiaryColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23739 h: 180,
23740 l: 5
23741 });
23742 this.primaryBorderColor = this.primaryBorderColor || Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.primaryColor, this.darkMode);
23743 this.secondaryBorderColor = this.secondaryBorderColor || Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.secondaryColor, this.darkMode);
23744 this.tertiaryBorderColor = this.tertiaryBorderColor || Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.tertiaryColor, this.darkMode);
23745 this.noteBorderColor = this.noteBorderColor || Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.noteBkgColor, this.darkMode);
23746 this.secondaryTextColor = this.secondaryTextColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.secondaryColor);
23747 this.tertiaryTextColor = this.tertiaryTextColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.tertiaryColor);
23748 this.lineColor = this.lineColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
23749 this.textColor = this.textColor || this.primaryTextColor;
23750 /* Flowchart variables */
23751
23752 this.nodeBkg = this.nodeBkg || this.primaryColor;
23753 this.mainBkg = this.mainBkg || this.primaryColor;
23754 this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
23755 this.clusterBkg = this.clusterBkg || this.tertiaryColor;
23756 this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
23757 this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
23758 this.titleColor = this.titleColor || this.tertiaryTextColor;
23759 this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.secondaryColor, 30) : this.secondaryColor);
23760 this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
23761 /* Sequence Diagram variables */
23762 // this.actorBorder = lighten(this.border1, 0.5);
23763
23764 this.actorBorder = this.actorBorder || this.primaryBorderColor;
23765 this.actorBkg = this.actorBkg || this.mainBkg;
23766 this.actorTextColor = this.actorTextColor || this.primaryTextColor;
23767 this.actorLineColor = this.actorLineColor || 'grey';
23768 this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
23769 this.signalColor = this.signalColor || this.textColor;
23770 this.signalTextColor = this.signalTextColor || this.textColor;
23771 this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
23772 this.labelTextColor = this.labelTextColor || this.actorTextColor;
23773 this.loopTextColor = this.loopTextColor || this.actorTextColor;
23774 this.activationBorderColor = this.activationBorderColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.secondaryColor, 10);
23775 this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
23776 this.sequenceNumberColor = this.sequenceNumberColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.lineColor);
23777 /* Gantt chart variables */
23778
23779 this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
23780 this.altSectionBkgColor = this.altSectionBkgColor || 'white';
23781 this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
23782 this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
23783 this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
23784 this.taskBkgColor = this.taskBkgColor || this.primaryColor;
23785 this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
23786 this.activeTaskBkgColor = this.activeTaskBkgColor || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.primaryColor, 23);
23787 this.gridColor = this.gridColor || 'lightgrey';
23788 this.doneTaskBkgColor = this.doneTaskBkgColor || 'lightgrey';
23789 this.doneTaskBorderColor = this.doneTaskBorderColor || 'grey';
23790 this.critBorderColor = this.critBorderColor || '#ff8888';
23791 this.critBkgColor = this.critBkgColor || 'red';
23792 this.todayLineColor = this.todayLineColor || 'red';
23793 this.taskTextColor = this.taskTextColor || this.textColor;
23794 this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
23795 this.taskTextLightColor = this.taskTextLightColor || this.textColor;
23796 this.taskTextColor = this.taskTextColor || this.primaryTextColor;
23797 this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
23798 this.taskTextClickableColor = this.taskTextClickableColor || '#003163';
23799 /* state colors */
23800
23801 this.labelColor = this.labelColor || this.primaryTextColor;
23802 this.altBackground = this.altBackground || this.tertiaryColor;
23803 this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
23804 this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
23805 /* class */
23806
23807 this.classText = this.classText || this.textColor;
23808 /* user-journey */
23809
23810 this.fillType0 = this.fillType0 || this.primaryColor;
23811 this.fillType1 = this.fillType1 || this.secondaryColor;
23812 this.fillType2 = this.fillType2 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23813 h: 64
23814 });
23815 this.fillType3 = this.fillType3 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
23816 h: 64
23817 });
23818 this.fillType4 = this.fillType4 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23819 h: -64
23820 });
23821 this.fillType5 = this.fillType5 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
23822 h: -64
23823 });
23824 this.fillType6 = this.fillType6 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23825 h: 128
23826 });
23827 this.fillType7 = this.fillType7 || Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
23828 h: 128
23829 });
23830 }
23831 }, {
23832 key: "calculate",
23833 value: function calculate(overrides) {
23834 var _this = this;
23835
23836 if (_typeof(overrides) !== 'object') {
23837 // Calculate colors form base colors
23838 this.updateColors();
23839 return;
23840 }
23841
23842 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
23843
23844 keys.forEach(function (k) {
23845 _this[k] = overrides[k];
23846 }); // Calculate colors form base colors
23847
23848 this.updateColors(); // Copy values from overrides again in case of an override of derived value
23849
23850 keys.forEach(function (k) {
23851 _this[k] = overrides[k];
23852 });
23853 }
23854 }]);
23855
23856 return Theme;
23857}();
23858
23859var getThemeVariables = function getThemeVariables(userOverrides) {
23860 var theme = new Theme();
23861 theme.calculate(userOverrides);
23862 return theme;
23863};
23864
23865/***/ }),
23866
23867/***/ "./src/themes/theme-dark.js":
23868/*!**********************************!*\
23869 !*** ./src/themes/theme-dark.js ***!
23870 \**********************************/
23871/*! exports provided: getThemeVariables */
23872/***/ (function(module, __webpack_exports__, __webpack_require__) {
23873
23874"use strict";
23875__webpack_require__.r(__webpack_exports__);
23876/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getThemeVariables", function() { return getThemeVariables; });
23877/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
23878/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
23879/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
23880function _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); }
23881
23882function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23883
23884function _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); } }
23885
23886function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23887
23888
23889
23890
23891var Theme =
23892/*#__PURE__*/
23893function () {
23894 function Theme() {
23895 _classCallCheck(this, Theme);
23896
23897 this.background = '#333';
23898 this.primaryColor = '#1f2020';
23899 this.secondaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.primaryColor, 16);
23900 this.tertiaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
23901 h: -160
23902 });
23903 this.primaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.primaryColor, this.darkMode);
23904 this.secondaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.secondaryColor, this.darkMode);
23905 this.tertiaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.tertiaryColor, this.darkMode);
23906 this.primaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.primaryColor);
23907 this.secondaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.secondaryColor);
23908 this.tertiaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.tertiaryColor);
23909 this.lineColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
23910 this.textColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
23911 this.mainBkg = '#1f2020';
23912 this.secondBkg = 'calculated';
23913 this.mainContrastColor = 'lightgrey';
23914 this.darkTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])('#323D47'), 10);
23915 this.lineColor = 'calculated';
23916 this.border1 = '#81B1DB';
23917 this.border2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["rgba"])(255, 255, 255, 0.25);
23918 this.arrowheadColor = 'calculated';
23919 this.fontFamily = '"trebuchet ms", verdana, arial';
23920 this.fontSize = '16px';
23921 this.labelBackground = '#181818';
23922 this.textColor = '#ccc';
23923 /* Flowchart variables */
23924
23925 this.nodeBkg = 'calculated';
23926 this.nodeBorder = 'calculated';
23927 this.clusterBkg = 'calculated';
23928 this.clusterBorder = 'calculated';
23929 this.defaultLinkColor = 'calculated';
23930 this.titleColor = '#F9FFFE';
23931 this.edgeLabelBackground = 'calculated';
23932 /* Sequence Diagram variables */
23933
23934 this.actorBorder = 'calculated';
23935 this.actorBkg = 'calculated';
23936 this.actorTextColor = 'calculated';
23937 this.actorLineColor = 'calculated';
23938 this.signalColor = 'calculated';
23939 this.signalTextColor = 'calculated';
23940 this.labelBoxBkgColor = 'calculated';
23941 this.labelBoxBorderColor = 'calculated';
23942 this.labelTextColor = 'calculated';
23943 this.loopTextColor = 'calculated';
23944 this.noteBorderColor = 'calculated';
23945 this.noteBkgColor = '#fff5ad';
23946 this.noteTextColor = 'calculated';
23947 this.activationBorderColor = 'calculated';
23948 this.activationBkgColor = 'calculated';
23949 this.sequenceNumberColor = 'black';
23950 /* Gantt chart variables */
23951
23952 this.sectionBkgColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])('#EAE8D9', 30);
23953 this.altSectionBkgColor = 'calculated';
23954 this.sectionBkgColor2 = '#EAE8D9';
23955 this.taskBorderColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["rgba"])(255, 255, 255, 70);
23956 this.taskBkgColor = 'calculated';
23957 this.taskTextColor = 'calculated';
23958 this.taskTextLightColor = 'calculated';
23959 this.taskTextOutsideColor = 'calculated';
23960 this.taskTextClickableColor = '#003163';
23961 this.activeTaskBorderColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["rgba"])(255, 255, 255, 50);
23962 this.activeTaskBkgColor = '#81B1DB';
23963 this.gridColor = 'calculated';
23964 this.doneTaskBkgColor = 'calculated';
23965 this.doneTaskBorderColor = 'grey';
23966 this.critBorderColor = '#E83737';
23967 this.critBkgColor = '#E83737';
23968 this.taskTextDarkColor = 'calculated';
23969 this.todayLineColor = '#DB5757';
23970 /* state colors */
23971
23972 this.labelColor = 'calculated';
23973 this.errorBkgColor = '#a44141';
23974 this.errorTextColor = '#ddd';
23975 }
23976
23977 _createClass(Theme, [{
23978 key: "updateColors",
23979 value: function updateColors() {
23980 this.secondBkg = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.mainBkg, 16);
23981 this.lineColor = this.mainContrastColor;
23982 this.arrowheadColor = this.mainContrastColor;
23983 /* Flowchart variables */
23984
23985 this.nodeBkg = this.mainBkg;
23986 this.nodeBorder = this.border1;
23987 this.clusterBkg = this.secondBkg;
23988 this.clusterBorder = this.border2;
23989 this.defaultLinkColor = this.lineColor;
23990 this.edgeLabelBackground = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.labelBackground, 25);
23991 /* Sequence Diagram variables */
23992
23993 this.actorBorder = this.border1;
23994 this.actorBkg = this.mainBkg;
23995 this.actorTextColor = this.mainContrastColor;
23996 this.actorLineColor = this.mainContrastColor;
23997 this.signalColor = this.mainContrastColor;
23998 this.signalTextColor = this.mainContrastColor;
23999 this.labelBoxBkgColor = this.actorBkg;
24000 this.labelBoxBorderColor = this.actorBorder;
24001 this.labelTextColor = this.mainContrastColor;
24002 this.loopTextColor = this.mainContrastColor;
24003 this.noteBorderColor = this.border2;
24004 this.noteTextColor = this.mainBkg;
24005 this.activationBorderColor = this.border1;
24006 this.activationBkgColor = this.secondBkg;
24007 /* Gantt chart variables */
24008
24009 this.altSectionBkgColor = this.background;
24010 this.taskBkgColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.mainBkg, 23);
24011 this.taskTextColor = this.darkTextColor;
24012 this.taskTextLightColor = this.mainContrastColor;
24013 this.taskTextOutsideColor = this.taskTextLightColor;
24014 this.gridColor = this.mainContrastColor;
24015 this.doneTaskBkgColor = this.mainContrastColor;
24016 this.taskTextDarkColor = this.darkTextColor;
24017 /* state colors */
24018
24019 this.labelColor = this.textColor;
24020 this.altBackground = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.background, 20);
24021 this.fillType0 = this.primaryColor;
24022 this.fillType1 = this.secondaryColor;
24023 this.fillType2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24024 h: 64
24025 });
24026 this.fillType3 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24027 h: 64
24028 });
24029 this.fillType4 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24030 h: -64
24031 });
24032 this.fillType5 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24033 h: -64
24034 });
24035 this.fillType6 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24036 h: 128
24037 });
24038 this.fillType7 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24039 h: 128
24040 });
24041 /* class */
24042
24043 this.classText = this.primaryTextColor;
24044 }
24045 }, {
24046 key: "calculate",
24047 value: function calculate(overrides) {
24048 var _this = this;
24049
24050 if (_typeof(overrides) !== 'object') {
24051 // Calculate colors form base colors
24052 this.updateColors();
24053 return;
24054 }
24055
24056 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
24057
24058 keys.forEach(function (k) {
24059 _this[k] = overrides[k];
24060 }); // Calculate colors form base colors
24061
24062 this.updateColors(); // Copy values from overrides again in case of an override of derived value
24063
24064 keys.forEach(function (k) {
24065 _this[k] = overrides[k];
24066 });
24067 }
24068 }]);
24069
24070 return Theme;
24071}();
24072
24073var getThemeVariables = function getThemeVariables(userOverrides) {
24074 var theme = new Theme();
24075 theme.calculate(userOverrides);
24076 return theme;
24077};
24078
24079/***/ }),
24080
24081/***/ "./src/themes/theme-default.js":
24082/*!*************************************!*\
24083 !*** ./src/themes/theme-default.js ***!
24084 \*************************************/
24085/*! exports provided: getThemeVariables */
24086/***/ (function(module, __webpack_exports__, __webpack_require__) {
24087
24088"use strict";
24089__webpack_require__.r(__webpack_exports__);
24090/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getThemeVariables", function() { return getThemeVariables; });
24091/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
24092/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
24093/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
24094function _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); }
24095
24096function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24097
24098function _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); } }
24099
24100function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
24101
24102
24103
24104
24105var Theme =
24106/*#__PURE__*/
24107function () {
24108 function Theme() {
24109 _classCallCheck(this, Theme);
24110
24111 /* Base variables */
24112 this.background = '#f4f4f4';
24113 this.primaryColor = '#ECECFF';
24114 this.secondaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24115 h: 120
24116 });
24117 this.secondaryColor = '#ffffde';
24118 this.tertiaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24119 h: -160
24120 });
24121 this.primaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.primaryColor, this.darkMode);
24122 this.secondaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.secondaryColor, this.darkMode);
24123 this.tertiaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);
24124
24125 this.primaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.primaryColor);
24126 this.secondaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.secondaryColor);
24127 this.tertiaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.tertiaryColor);
24128 this.lineColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
24129 this.textColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
24130 this.background = 'white';
24131 this.mainBkg = '#ECECFF';
24132 this.secondBkg = '#ffffde';
24133 this.lineColor = '#333333';
24134 this.border1 = '#9370DB';
24135 this.border2 = '#aaaa33';
24136 this.arrowheadColor = '#333333';
24137 this.fontFamily = '"trebuchet ms", verdana, arial';
24138 this.fontSize = '16px';
24139 this.labelBackground = '#e8e8e8';
24140 this.textColor = '#333';
24141 /* Flowchart variables */
24142
24143 this.nodeBkg = 'calculated';
24144 this.nodeBorder = 'calculated';
24145 this.clusterBkg = 'calculated';
24146 this.clusterBorder = 'calculated';
24147 this.defaultLinkColor = 'calculated';
24148 this.titleColor = 'calculated';
24149 this.edgeLabelBackground = 'calculated';
24150 /* Sequence Diagram variables */
24151
24152 this.actorBorder = 'calculated';
24153 this.actorBkg = 'calculated';
24154 this.actorTextColor = 'black';
24155 this.actorLineColor = 'grey';
24156 this.signalColor = 'calculated';
24157 this.signalTextColor = 'calculated';
24158 this.labelBoxBkgColor = 'calculated';
24159 this.labelBoxBorderColor = 'calculated';
24160 this.labelTextColor = 'calculated';
24161 this.loopTextColor = 'calculated';
24162 this.noteBorderColor = 'calculated';
24163 this.noteBkgColor = '#fff5ad';
24164 this.noteTextColor = 'calculated';
24165 this.activationBorderColor = '#666';
24166 this.activationBkgColor = '#f4f4f4';
24167 this.sequenceNumberColor = 'white';
24168 /* Gantt chart variables */
24169
24170 this.sectionBkgColor = 'calculated';
24171 this.altSectionBkgColor = 'calculated';
24172 this.sectionBkgColor2 = 'calculated';
24173 this.taskBorderColor = 'calculated';
24174 this.taskBkgColor = 'calculated';
24175 this.taskTextLightColor = 'calculated';
24176 this.taskTextColor = this.taskTextLightColor;
24177 this.taskTextDarkColor = 'calculated';
24178 this.taskTextOutsideColor = this.taskTextDarkColor;
24179 this.taskTextClickableColor = 'calculated';
24180 this.activeTaskBorderColor = 'calculated';
24181 this.activeTaskBkgColor = 'calculated';
24182 this.gridColor = 'calculated';
24183 this.doneTaskBkgColor = 'calculated';
24184 this.doneTaskBorderColor = 'calculated';
24185 this.critBorderColor = 'calculated';
24186 this.critBkgColor = 'calculated';
24187 this.todayLineColor = 'calculated';
24188 this.sectionBkgColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["rgba"])(102, 102, 255, 0.49);
24189 this.altSectionBkgColor = 'white';
24190 this.sectionBkgColor2 = '#fff400';
24191 this.taskBorderColor = '#534fbc';
24192 this.taskBkgColor = '#8a90dd';
24193 this.taskTextLightColor = 'white';
24194 this.taskTextColor = 'calculated';
24195 this.taskTextDarkColor = 'black';
24196 this.taskTextOutsideColor = 'calculated';
24197 this.taskTextClickableColor = '#003163';
24198 this.activeTaskBorderColor = '#534fbc';
24199 this.activeTaskBkgColor = '#bfc7ff';
24200 this.gridColor = 'lightgrey';
24201 this.doneTaskBkgColor = 'lightgrey';
24202 this.doneTaskBorderColor = 'grey';
24203 this.critBorderColor = '#ff8888';
24204 this.critBkgColor = 'red';
24205 this.todayLineColor = 'red';
24206 /* state colors */
24207
24208 this.labelColor = 'black';
24209 this.errorBkgColor = '#552222';
24210 this.errorTextColor = '#552222';
24211 this.updateColors();
24212 }
24213
24214 _createClass(Theme, [{
24215 key: "updateColors",
24216 value: function updateColors() {
24217 /* Flowchart variables */
24218 this.nodeBkg = this.mainBkg;
24219 this.nodeBorder = this.border1; // border 1
24220
24221 this.clusterBkg = this.secondBkg;
24222 this.clusterBorder = this.border2;
24223 this.defaultLinkColor = this.lineColor;
24224 this.titleColor = this.textColor;
24225 this.edgeLabelBackground = this.labelBackground;
24226 /* Sequence Diagram variables */
24227 // this.actorBorder = lighten(this.border1, 0.5);
24228
24229 this.actorBorder = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.border1, 23);
24230 this.actorBkg = this.mainBkg;
24231 this.labelBoxBkgColor = this.actorBkg;
24232 this.signalColor = this.textColor;
24233 this.signalTextColor = this.textColor;
24234 this.labelBoxBorderColor = this.actorBorder;
24235 this.labelTextColor = this.actorTextColor;
24236 this.loopTextColor = this.actorTextColor;
24237 this.noteBorderColor = this.border2;
24238 this.noteTextColor = this.actorTextColor;
24239 /* Gantt chart variables */
24240
24241 this.taskTextColor = this.taskTextLightColor;
24242 this.taskTextOutsideColor = this.taskTextDarkColor;
24243 /* state colors */
24244
24245 /* class */
24246
24247 this.classText = this.primaryTextColor;
24248 /* journey */
24249
24250 this.fillType0 = this.primaryColor;
24251 this.fillType1 = this.secondaryColor;
24252 this.fillType2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24253 h: 64
24254 });
24255 this.fillType3 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24256 h: 64
24257 });
24258 this.fillType4 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24259 h: -64
24260 });
24261 this.fillType5 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24262 h: -64
24263 });
24264 this.fillType6 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24265 h: 128
24266 });
24267 this.fillType7 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24268 h: 128
24269 });
24270 }
24271 }, {
24272 key: "calculate",
24273 value: function calculate(overrides) {
24274 var _this = this;
24275
24276 if (_typeof(overrides) !== 'object') {
24277 // Calculate colors form base colors
24278 this.updateColors();
24279 return;
24280 }
24281
24282 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
24283
24284 keys.forEach(function (k) {
24285 _this[k] = overrides[k];
24286 }); // Calculate colors form base colors
24287
24288 this.updateColors(); // Copy values from overrides again in case of an override of derived value
24289
24290 keys.forEach(function (k) {
24291 _this[k] = overrides[k];
24292 });
24293 }
24294 }]);
24295
24296 return Theme;
24297}();
24298
24299var getThemeVariables = function getThemeVariables(userOverrides) {
24300 var theme = new Theme();
24301 theme.calculate(userOverrides);
24302 return theme;
24303};
24304
24305/***/ }),
24306
24307/***/ "./src/themes/theme-forest.js":
24308/*!************************************!*\
24309 !*** ./src/themes/theme-forest.js ***!
24310 \************************************/
24311/*! exports provided: getThemeVariables */
24312/***/ (function(module, __webpack_exports__, __webpack_require__) {
24313
24314"use strict";
24315__webpack_require__.r(__webpack_exports__);
24316/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getThemeVariables", function() { return getThemeVariables; });
24317/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
24318/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
24319/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
24320function _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); }
24321
24322function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24323
24324function _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); } }
24325
24326function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
24327
24328
24329
24330
24331var Theme =
24332/*#__PURE__*/
24333function () {
24334 function Theme() {
24335 _classCallCheck(this, Theme);
24336
24337 /* Base vales */
24338 this.background = '#f4f4f4';
24339 this.primaryColor = '#cde498';
24340 this.secondaryColor = '#cdffb2';
24341 this.background = 'white';
24342 this.mainBkg = '#cde498';
24343 this.secondBkg = '#cdffb2';
24344 this.lineColor = 'green';
24345 this.border1 = '#13540c';
24346 this.border2 = '#6eaa49';
24347 this.arrowheadColor = 'green';
24348 this.fontFamily = '"trebuchet ms", verdana, arial';
24349 this.fontSize = '16px';
24350 this.tertiaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])('#cde498', 10);
24351 this.primaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.primaryColor, this.darkMode);
24352 this.secondaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.secondaryColor, this.darkMode);
24353 this.tertiaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.tertiaryColor, this.darkMode);
24354 this.primaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.primaryColor);
24355 this.secondaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.secondaryColor);
24356 this.tertiaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.primaryColor);
24357 this.lineColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
24358 this.textColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
24359 /* Flowchart variables */
24360
24361 this.nodeBkg = 'calculated';
24362 this.nodeBorder = 'calculated';
24363 this.clusterBkg = 'calculated';
24364 this.clusterBorder = 'calculated';
24365 this.defaultLinkColor = 'calculated';
24366 this.titleColor = '#333';
24367 this.edgeLabelBackground = '#e8e8e8';
24368 /* Sequence Diagram variables */
24369
24370 this.actorBorder = 'calculated';
24371 this.actorBkg = 'calculated';
24372 this.actorTextColor = 'black';
24373 this.actorLineColor = 'grey';
24374 this.signalColor = '#333';
24375 this.signalTextColor = '#333';
24376 this.labelBoxBkgColor = 'calculated';
24377 this.labelBoxBorderColor = '#326932';
24378 this.labelTextColor = 'calculated';
24379 this.loopTextColor = 'calculated';
24380 this.noteBorderColor = 'calculated';
24381 this.noteBkgColor = '#fff5ad';
24382 this.noteTextColor = 'calculated';
24383 this.activationBorderColor = '#666';
24384 this.activationBkgColor = '#f4f4f4';
24385 this.sequenceNumberColor = 'white';
24386 /* Gantt chart variables */
24387
24388 this.sectionBkgColor = '#6eaa49';
24389 this.altSectionBkgColor = 'white';
24390 this.sectionBkgColor2 = '#6eaa49';
24391 this.taskBorderColor = 'calculated';
24392 this.taskBkgColor = '#487e3a';
24393 this.taskTextLightColor = 'white';
24394 this.taskTextColor = 'calculated';
24395 this.taskTextDarkColor = 'black';
24396 this.taskTextOutsideColor = 'calculated';
24397 this.taskTextClickableColor = '#003163';
24398 this.activeTaskBorderColor = 'calculated';
24399 this.activeTaskBkgColor = 'calculated';
24400 this.gridColor = 'lightgrey';
24401 this.doneTaskBkgColor = 'lightgrey';
24402 this.doneTaskBorderColor = 'grey';
24403 this.critBorderColor = '#ff8888';
24404 this.critBkgColor = 'red';
24405 this.todayLineColor = 'red';
24406 /* state colors */
24407
24408 this.labelColor = 'black';
24409 this.errorBkgColor = '#552222';
24410 this.errorTextColor = '#552222';
24411 }
24412
24413 _createClass(Theme, [{
24414 key: "updateColors",
24415 value: function updateColors() {
24416 /* Flowchart variables */
24417 this.nodeBkg = this.mainBkg;
24418 this.nodeBorder = this.border1;
24419 this.clusterBkg = this.secondBkg;
24420 this.clusterBorder = this.border2;
24421 this.defaultLinkColor = this.lineColor;
24422 /* Sequence Diagram variables */
24423
24424 this.actorBorder = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.mainBkg, 20);
24425 this.actorBkg = this.mainBkg;
24426 this.labelBoxBkgColor = this.actorBkg;
24427 this.labelTextColor = this.actorTextColor;
24428 this.loopTextColor = this.actorTextColor;
24429 this.noteBorderColor = this.border2;
24430 this.noteTextColor = this.actorTextColor;
24431 /* Gantt chart variables */
24432
24433 this.taskBorderColor = this.border1;
24434 this.taskTextColor = this.taskTextLightColor;
24435 this.taskTextOutsideColor = this.taskTextDarkColor;
24436 this.activeTaskBorderColor = this.taskBorderColor;
24437 this.activeTaskBkgColor = this.mainBkg;
24438 /* state colors */
24439
24440 /* class */
24441
24442 this.classText = this.primaryTextColor;
24443 /* journey */
24444
24445 this.fillType0 = this.primaryColor;
24446 this.fillType1 = this.secondaryColor;
24447 this.fillType2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24448 h: 64
24449 });
24450 this.fillType3 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24451 h: 64
24452 });
24453 this.fillType4 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24454 h: -64
24455 });
24456 this.fillType5 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24457 h: -64
24458 });
24459 this.fillType6 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24460 h: 128
24461 });
24462 this.fillType7 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24463 h: 128
24464 });
24465 }
24466 }, {
24467 key: "calculate",
24468 value: function calculate(overrides) {
24469 var _this = this;
24470
24471 if (_typeof(overrides) !== 'object') {
24472 // Calculate colors form base colors
24473 this.updateColors();
24474 return;
24475 }
24476
24477 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
24478
24479 keys.forEach(function (k) {
24480 _this[k] = overrides[k];
24481 }); // Calculate colors form base colors
24482
24483 this.updateColors(); // Copy values from overrides again in case of an override of derived value
24484
24485 keys.forEach(function (k) {
24486 _this[k] = overrides[k];
24487 });
24488 }
24489 }]);
24490
24491 return Theme;
24492}();
24493
24494var getThemeVariables = function getThemeVariables(userOverrides) {
24495 var theme = new Theme();
24496 theme.calculate(userOverrides);
24497 return theme;
24498};
24499
24500/***/ }),
24501
24502/***/ "./src/themes/theme-helpers.js":
24503/*!*************************************!*\
24504 !*** ./src/themes/theme-helpers.js ***!
24505 \*************************************/
24506/*! exports provided: mkBorder */
24507/***/ (function(module, __webpack_exports__, __webpack_require__) {
24508
24509"use strict";
24510__webpack_require__.r(__webpack_exports__);
24511/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mkBorder", function() { return mkBorder; });
24512/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
24513/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
24514
24515var mkBorder = function mkBorder(col, darkMode) {
24516 return darkMode ? Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(col, {
24517 s: -40,
24518 l: 10
24519 }) : Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(col, {
24520 s: -40,
24521 l: -10
24522 });
24523};
24524
24525/***/ }),
24526
24527/***/ "./src/themes/theme-neutral.js":
24528/*!*************************************!*\
24529 !*** ./src/themes/theme-neutral.js ***!
24530 \*************************************/
24531/*! exports provided: getThemeVariables */
24532/***/ (function(module, __webpack_exports__, __webpack_require__) {
24533
24534"use strict";
24535__webpack_require__.r(__webpack_exports__);
24536/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getThemeVariables", function() { return getThemeVariables; });
24537/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
24538/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
24539/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
24540function _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); }
24541
24542function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24543
24544function _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); } }
24545
24546function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
24547
24548
24549 // const Color = require ( 'khroma/dist/color' ).default
24550// Color.format.hex.stringify(Color.parse('hsl(210, 66.6666666667%, 95%)')); // => "#EAF2FB"
24551
24552var Theme =
24553/*#__PURE__*/
24554function () {
24555 function Theme() {
24556 _classCallCheck(this, Theme);
24557
24558 this.primaryColor = '#eee';
24559 this.contrast = '#26a';
24560 this.secondaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.contrast, 55);
24561 this.background = '#ffffff'; // this.secondaryColor = adjust(this.primaryColor, { h: 120 });
24562
24563 this.tertiaryColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24564 h: -160
24565 });
24566 this.primaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.primaryColor, this.darkMode);
24567 this.secondaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.secondaryColor, this.darkMode);
24568 this.tertiaryBorderColor = Object(_theme_helpers__WEBPACK_IMPORTED_MODULE_1__["mkBorder"])(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);
24569
24570 this.primaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.primaryColor);
24571 this.secondaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.secondaryColor);
24572 this.tertiaryTextColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.tertiaryColor);
24573 this.lineColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
24574 this.textColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["invert"])(this.background);
24575 this.altBackground = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.contrast, 55);
24576 this.mainBkg = '#eee';
24577 this.secondBkg = 'calculated';
24578 this.lineColor = '#666';
24579 this.border1 = '#999';
24580 this.border2 = 'calculated';
24581 this.note = '#ffa';
24582 this.text = '#333';
24583 this.critical = '#d42';
24584 this.done = '#bbb';
24585 this.arrowheadColor = '#333333';
24586 this.fontFamily = '"trebuchet ms", verdana, arial';
24587 this.fontSize = '16px';
24588 /* Flowchart variables */
24589
24590 this.nodeBkg = 'calculated';
24591 this.nodeBorder = 'calculated';
24592 this.clusterBkg = 'calculated';
24593 this.clusterBorder = 'calculated';
24594 this.defaultLinkColor = 'calculated';
24595 this.titleColor = 'calculated';
24596 this.edgeLabelBackground = 'white';
24597 /* Sequence Diagram variables */
24598
24599 this.actorBorder = 'calculated';
24600 this.actorBkg = 'calculated';
24601 this.actorTextColor = 'calculated';
24602 this.actorLineColor = 'calculated';
24603 this.signalColor = 'calculated';
24604 this.signalTextColor = 'calculated';
24605 this.labelBoxBkgColor = 'calculated';
24606 this.labelBoxBorderColor = 'calculated';
24607 this.labelTextColor = 'calculated';
24608 this.loopTextColor = 'calculated';
24609 this.noteBorderColor = 'calculated';
24610 this.noteBkgColor = 'calculated';
24611 this.noteTextColor = 'calculated';
24612 this.activationBorderColor = '#666';
24613 this.activationBkgColor = '#f4f4f4';
24614 this.sequenceNumberColor = 'white';
24615 /* Gantt chart variables */
24616
24617 this.sectionBkgColor = 'calculated';
24618 this.altSectionBkgColor = 'white';
24619 this.sectionBkgColor2 = 'calculated';
24620 this.taskBorderColor = 'calculated';
24621 this.taskBkgColor = 'calculated';
24622 this.taskTextLightColor = 'white';
24623 this.taskTextColor = 'calculated';
24624 this.taskTextDarkColor = 'calculated';
24625 this.taskTextOutsideColor = 'calculated';
24626 this.taskTextClickableColor = '#003163';
24627 this.activeTaskBorderColor = 'calculated';
24628 this.activeTaskBkgColor = 'calculated';
24629 this.gridColor = 'calculated';
24630 this.doneTaskBkgColor = 'calculated';
24631 this.doneTaskBorderColor = 'calculated';
24632 this.critBkgColor = 'calculated';
24633 this.critBorderColor = 'calculated';
24634 this.todayLineColor = 'calculated';
24635 /* state colors */
24636
24637 this.labelColor = 'black';
24638 this.errorBkgColor = '#552222';
24639 this.errorTextColor = '#552222';
24640 }
24641
24642 _createClass(Theme, [{
24643 key: "updateColors",
24644 value: function updateColors() {
24645 this.secondBkg = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.contrast, 55);
24646 this.border2 = this.contrast;
24647 /* Flowchart variables */
24648
24649 this.nodeBkg = this.mainBkg;
24650 this.nodeBorder = this.border1;
24651 this.clusterBkg = this.secondBkg;
24652 this.clusterBorder = this.border2;
24653 this.defaultLinkColor = this.lineColor;
24654 this.titleColor = this.text;
24655 /* Sequence Diagram variables */
24656
24657 this.actorBorder = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.border1, 23);
24658 this.actorBkg = this.mainBkg;
24659 this.actorTextColor = this.text;
24660 this.actorLineColor = this.lineColor;
24661 this.signalColor = this.text;
24662 this.signalTextColor = this.text;
24663 this.labelBoxBkgColor = this.actorBkg;
24664 this.labelBoxBorderColor = this.actorBorder;
24665 this.labelTextColor = this.text;
24666 this.loopTextColor = this.text;
24667 this.noteBorderColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.note, 60);
24668 this.noteBkgColor = this.note;
24669 this.noteTextColor = this.actorTextColor;
24670 /* Gantt chart variables */
24671
24672 this.sectionBkgColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.contrast, 30);
24673 this.sectionBkgColor2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.contrast, 30);
24674 this.taskBorderColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.contrast, 10);
24675 this.taskBkgColor = this.contrast;
24676 this.taskTextColor = this.taskTextLightColor;
24677 this.taskTextDarkColor = this.text;
24678 this.taskTextOutsideColor = this.taskTextDarkColor;
24679 this.activeTaskBorderColor = this.taskBorderColor;
24680 this.activeTaskBkgColor = this.mainBkg;
24681 this.gridColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["lighten"])(this.border1, 30);
24682 this.doneTaskBkgColor = this.done;
24683 this.doneTaskBorderColor = this.lineColor;
24684 this.critBkgColor = this.critical;
24685 this.critBorderColor = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["darken"])(this.critBkgColor, 10);
24686 this.todayLineColor = this.critBkgColor;
24687 /* state colors */
24688
24689 /* class */
24690
24691 this.classText = this.primaryTextColor;
24692 /* journey */
24693
24694 this.fillType0 = this.primaryColor;
24695 this.fillType1 = this.secondaryColor;
24696 this.fillType2 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24697 h: 64
24698 });
24699 this.fillType3 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24700 h: 64
24701 });
24702 this.fillType4 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24703 h: -64
24704 });
24705 this.fillType5 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24706 h: -64
24707 });
24708 this.fillType6 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.primaryColor, {
24709 h: 128
24710 });
24711 this.fillType7 = Object(khroma__WEBPACK_IMPORTED_MODULE_0__["adjust"])(this.secondaryColor, {
24712 h: 128
24713 });
24714 }
24715 }, {
24716 key: "calculate",
24717 value: function calculate(overrides) {
24718 var _this = this;
24719
24720 if (_typeof(overrides) !== 'object') {
24721 // Calculate colors form base colors
24722 this.updateColors();
24723 return;
24724 }
24725
24726 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
24727
24728 keys.forEach(function (k) {
24729 _this[k] = overrides[k];
24730 }); // Calculate colors form base colors
24731
24732 this.updateColors(); // Copy values from overrides again in case of an override of derived value
24733
24734 keys.forEach(function (k) {
24735 _this[k] = overrides[k];
24736 });
24737 }
24738 }]);
24739
24740 return Theme;
24741}();
24742
24743var getThemeVariables = function getThemeVariables(userOverrides) {
24744 var theme = new Theme();
24745 theme.calculate(userOverrides);
24746 return theme;
24747};
24748
24749/***/ }),
24750
24751/***/ "./src/utils.js":
24752/*!**********************!*\
24753 !*** ./src/utils.js ***!
24754 \**********************/
24755/*! exports provided: detectInit, detectDirective, detectType, isSubstringInArray, interpolateToCurve, formatUrl, runFunc, getStylesFromArray, generateId, random, assignWithDepth, getTextObj, drawSimpleText, wrapLabel, calculateTextHeight, calculateTextWidth, calculateTextDimensions, calculateSvgSizeAttrs, configureSvgSize, default */
24756/***/ (function(module, __webpack_exports__, __webpack_require__) {
24757
24758"use strict";
24759__webpack_require__.r(__webpack_exports__);
24760/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectInit", function() { return detectInit; });
24761/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectDirective", function() { return detectDirective; });
24762/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectType", function() { return detectType; });
24763/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSubstringInArray", function() { return isSubstringInArray; });
24764/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "interpolateToCurve", function() { return interpolateToCurve; });
24765/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatUrl", function() { return formatUrl; });
24766/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runFunc", function() { return runFunc; });
24767/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStylesFromArray", function() { return getStylesFromArray; });
24768/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generateId", function() { return generateId; });
24769/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return random; });
24770/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assignWithDepth", function() { return assignWithDepth; });
24771/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextObj", function() { return getTextObj; });
24772/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawSimpleText", function() { return drawSimpleText; });
24773/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapLabel", function() { return wrapLabel; });
24774/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calculateTextHeight", function() { return calculateTextHeight; });
24775/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calculateTextWidth", function() { return calculateTextWidth; });
24776/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calculateTextDimensions", function() { return calculateTextDimensions; });
24777/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calculateSvgSizeAttrs", function() { return calculateSvgSizeAttrs; });
24778/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "configureSvgSize", function() { return configureSvgSize; });
24779/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
24780/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
24781/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
24782/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
24783/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_2__);
24784/* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagrams/common/common */ "./src/diagrams/common/common.js");
24785var _this = undefined;
24786
24787function _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); }
24788
24789function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
24790
24791function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
24792
24793function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
24794
24795function _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; } }
24796
24797
24798
24799
24800 // import cryptoRandomString from 'crypto-random-string';
24801// Effectively an enum of the supported curve types, accessible by name
24802
24803var d3CurveTypes = {
24804 curveBasis: d3__WEBPACK_IMPORTED_MODULE_0__["curveBasis"],
24805 curveBasisClosed: d3__WEBPACK_IMPORTED_MODULE_0__["curveBasisClosed"],
24806 curveBasisOpen: d3__WEBPACK_IMPORTED_MODULE_0__["curveBasisOpen"],
24807 curveLinear: d3__WEBPACK_IMPORTED_MODULE_0__["curveLinear"],
24808 curveLinearClosed: d3__WEBPACK_IMPORTED_MODULE_0__["curveLinearClosed"],
24809 curveMonotoneX: d3__WEBPACK_IMPORTED_MODULE_0__["curveMonotoneX"],
24810 curveMonotoneY: d3__WEBPACK_IMPORTED_MODULE_0__["curveMonotoneY"],
24811 curveNatural: d3__WEBPACK_IMPORTED_MODULE_0__["curveNatural"],
24812 curveStep: d3__WEBPACK_IMPORTED_MODULE_0__["curveStep"],
24813 curveStepAfter: d3__WEBPACK_IMPORTED_MODULE_0__["curveStepAfter"],
24814 curveStepBefore: d3__WEBPACK_IMPORTED_MODULE_0__["curveStepBefore"]
24815};
24816var directive = /[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
24817var directiveWithoutOpen = /\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
24818var anyComment = /\s*%%.*\n/gm;
24819/**
24820 * @function detectInit
24821 * Detects the init config object from the text
24822 * ```mermaid
24823 * %%{init: {"theme": "debug", "logLevel": 1 }}%%
24824 * graph LR
24825 * a-->b
24826 * b-->c
24827 * c-->d
24828 * d-->e
24829 * e-->f
24830 * f-->g
24831 * g-->h
24832 * ```
24833 * or
24834 * ```mermaid
24835 * %%{initialize: {"theme": "dark", logLevel: "debug" }}%%
24836 * graph LR
24837 * a-->b
24838 * b-->c
24839 * c-->d
24840 * d-->e
24841 * e-->f
24842 * f-->g
24843 * g-->h
24844 * ```
24845 *
24846 * @param {string} text The text defining the graph
24847 * @returns {object} the json object representing the init passed to mermaid.initialize()
24848 */
24849
24850var detectInit = function detectInit(text) {
24851 var inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/);
24852 var results = {};
24853
24854 if (Array.isArray(inits)) {
24855 var args = inits.map(function (init) {
24856 return init.args;
24857 });
24858 results = assignWithDepth(results, _toConsumableArray(args));
24859 } else {
24860 results = inits.args;
24861 }
24862
24863 if (results) {
24864 var type = detectType(text);
24865 ['config'].forEach(function (prop) {
24866 if (typeof results[prop] !== 'undefined') {
24867 if (type === 'flowchart-v2') {
24868 type = 'flowchart';
24869 }
24870
24871 results[type] = results[prop];
24872 delete results[prop];
24873 }
24874 });
24875 }
24876
24877 return results;
24878};
24879/**
24880 * @function detectDirective
24881 * Detects the directive from the text. Text can be single line or multiline. If type is null or omitted
24882 * the first directive encountered in text will be returned
24883 * ```mermaid
24884 * graph LR
24885 * %%{somedirective}%%
24886 * a-->b
24887 * b-->c
24888 * c-->d
24889 * d-->e
24890 * e-->f
24891 * f-->g
24892 * g-->h
24893 * ```
24894 *
24895 * @param {string} text The text defining the graph
24896 * @param {string|RegExp} type The directive to return (default: null)
24897 * @returns {object | Array} An object or Array representing the directive(s): { type: string, args: object|null } matched by the input type
24898 * if a single directive was found, that directive object will be returned.
24899 */
24900
24901var detectDirective = function detectDirective(text) {
24902 var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
24903
24904 try {
24905 var commentWithoutDirectives = new RegExp("[%]{2}(?![{]".concat(directiveWithoutOpen.source, ")(?=[}][%]{2}).*\n"), 'ig');
24906 text = text.trim().replace(commentWithoutDirectives, '').replace(/'/gm, '"');
24907 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].debug("Detecting diagram directive".concat(type !== null ? ' type:' + type : '', " based on the text:").concat(text));
24908 var match,
24909 result = [];
24910
24911 while ((match = directive.exec(text)) !== null) {
24912 // This is necessary to avoid infinite loops with zero-width matches
24913 if (match.index === directive.lastIndex) {
24914 directive.lastIndex++;
24915 }
24916
24917 if (match && !type || type && match[1] && match[1].match(type) || type && match[2] && match[2].match(type)) {
24918 var _type = match[1] ? match[1] : match[2];
24919
24920 var args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null;
24921 result.push({
24922 type: _type,
24923 args: args
24924 });
24925 }
24926 }
24927
24928 if (result.length === 0) {
24929 result.push({
24930 type: text,
24931 args: null
24932 });
24933 }
24934
24935 return result.length === 1 ? result[0] : result;
24936 } catch (error) {
24937 _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));
24938 return {
24939 type: null,
24940 args: null
24941 };
24942 }
24943};
24944/**
24945 * @function detectType
24946 * Detects the type of the graph text. Takes into consideration the possible existence of an %%init
24947 * directive
24948 * ```mermaid
24949 * %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%%
24950 * graph LR
24951 * a-->b
24952 * b-->c
24953 * c-->d
24954 * d-->e
24955 * e-->f
24956 * f-->g
24957 * g-->h
24958 * ```
24959 *
24960 * @param {string} text The text defining the graph
24961 * @returns {string} A graph definition key
24962 */
24963
24964var detectType = function detectType(text) {
24965 text = text.replace(directive, '').replace(anyComment, '\n');
24966 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].debug('Detecting diagram type based on the text ' + text);
24967
24968 if (text.match(/^\s*sequenceDiagram/)) {
24969 return 'sequence';
24970 }
24971
24972 if (text.match(/^\s*gantt/)) {
24973 return 'gantt';
24974 }
24975
24976 if (text.match(/^\s*classDiagram-v2/)) {
24977 return 'classDiagram';
24978 }
24979
24980 if (text.match(/^\s*classDiagram/)) {
24981 return 'class';
24982 }
24983
24984 if (text.match(/^\s*stateDiagram-v2/)) {
24985 return 'stateDiagram';
24986 }
24987
24988 if (text.match(/^\s*stateDiagram/)) {
24989 return 'state';
24990 }
24991
24992 if (text.match(/^\s*gitGraph/)) {
24993 return 'git';
24994 }
24995
24996 if (text.match(/^\s*flowchart/)) {
24997 return 'flowchart-v2';
24998 }
24999
25000 if (text.match(/^\s*info/)) {
25001 return 'info';
25002 }
25003
25004 if (text.match(/^\s*pie/)) {
25005 return 'pie';
25006 }
25007
25008 if (text.match(/^\s*erDiagram/)) {
25009 return 'er';
25010 }
25011
25012 if (text.match(/^\s*journey/)) {
25013 return 'journey';
25014 }
25015
25016 return 'flowchart';
25017};
25018
25019var memoize = function memoize(fn, resolver) {
25020 var cache = {};
25021 return function () {
25022 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
25023 args[_key] = arguments[_key];
25024 }
25025
25026 var n = resolver ? resolver.apply(_this, args) : args[0];
25027
25028 if (n in cache) {
25029 return cache[n];
25030 } else {
25031 var result = fn.apply(void 0, args);
25032 cache[n] = result;
25033 return result;
25034 }
25035 };
25036};
25037/**
25038 * @function isSubstringInArray
25039 * Detects whether a substring in present in a given array
25040 * @param {string} str The substring to detect
25041 * @param {array} arr The array to search
25042 * @returns {number} the array index containing the substring or -1 if not present
25043 **/
25044
25045
25046var isSubstringInArray = function isSubstringInArray(str, arr) {
25047 for (var i = 0; i < arr.length; i++) {
25048 if (arr[i].match(str)) return i;
25049 }
25050
25051 return -1;
25052};
25053var interpolateToCurve = function interpolateToCurve(interpolate, defaultCurve) {
25054 if (!interpolate) {
25055 return defaultCurve;
25056 }
25057
25058 var curveName = "curve".concat(interpolate.charAt(0).toUpperCase() + interpolate.slice(1));
25059 return d3CurveTypes[curveName] || defaultCurve;
25060};
25061var formatUrl = function formatUrl(linkStr, config) {
25062 var url = linkStr.trim();
25063
25064 if (url) {
25065 if (config.securityLevel !== 'loose') {
25066 return Object(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_2__["sanitizeUrl"])(url);
25067 }
25068
25069 return url;
25070 }
25071};
25072var runFunc = function runFunc(functionName) {
25073 var _obj;
25074
25075 var arrPaths = functionName.split('.');
25076 var len = arrPaths.length - 1;
25077 var fnName = arrPaths[len];
25078 var obj = window;
25079
25080 for (var i = 0; i < len; i++) {
25081 obj = obj[arrPaths[i]];
25082 if (!obj) return;
25083 }
25084
25085 for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
25086 params[_key2 - 1] = arguments[_key2];
25087 }
25088
25089 (_obj = obj)[fnName].apply(_obj, params);
25090};
25091
25092var distance = function distance(p1, p2) {
25093 return p1 && p2 ? Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)) : 0;
25094};
25095
25096var traverseEdge = function traverseEdge(points) {
25097 var prevPoint;
25098 var totalDistance = 0;
25099 points.forEach(function (point) {
25100 totalDistance += distance(point, prevPoint);
25101 prevPoint = point;
25102 }); // Traverse half of total distance along points
25103
25104 var remainingDistance = totalDistance / 2;
25105 var center = undefined;
25106 prevPoint = undefined;
25107 points.forEach(function (point) {
25108 if (prevPoint && !center) {
25109 var vectorDistance = distance(point, prevPoint);
25110
25111 if (vectorDistance < remainingDistance) {
25112 remainingDistance -= vectorDistance;
25113 } else {
25114 // The point is remainingDistance from prevPoint in the vector between prevPoint and point
25115 // Calculate the coordinates
25116 var distanceRatio = remainingDistance / vectorDistance;
25117 if (distanceRatio <= 0) center = prevPoint;
25118 if (distanceRatio >= 1) center = {
25119 x: point.x,
25120 y: point.y
25121 };
25122
25123 if (distanceRatio > 0 && distanceRatio < 1) {
25124 center = {
25125 x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
25126 y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
25127 };
25128 }
25129 }
25130 }
25131
25132 prevPoint = point;
25133 });
25134 return center;
25135};
25136
25137var calcLabelPosition = function calcLabelPosition(points) {
25138 return traverseEdge(points);
25139};
25140
25141var calcCardinalityPosition = function calcCardinalityPosition(isRelationTypePresent, points, initialPosition) {
25142 var prevPoint;
25143 var totalDistance = 0; // eslint-disable-line
25144
25145 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('our points', points);
25146
25147 if (points[0] !== initialPosition) {
25148 points = points.reverse();
25149 }
25150
25151 points.forEach(function (point) {
25152 totalDistance += distance(point, prevPoint);
25153 prevPoint = point;
25154 }); // Traverse only 25 total distance along points to find cardinality point
25155
25156 var distanceToCardinalityPoint = 25;
25157 var remainingDistance = distanceToCardinalityPoint;
25158 var center;
25159 prevPoint = undefined;
25160 points.forEach(function (point) {
25161 if (prevPoint && !center) {
25162 var vectorDistance = distance(point, prevPoint);
25163
25164 if (vectorDistance < remainingDistance) {
25165 remainingDistance -= vectorDistance;
25166 } else {
25167 // The point is remainingDistance from prevPoint in the vector between prevPoint and point
25168 // Calculate the coordinates
25169 var distanceRatio = remainingDistance / vectorDistance;
25170 if (distanceRatio <= 0) center = prevPoint;
25171 if (distanceRatio >= 1) center = {
25172 x: point.x,
25173 y: point.y
25174 };
25175
25176 if (distanceRatio > 0 && distanceRatio < 1) {
25177 center = {
25178 x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
25179 y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
25180 };
25181 }
25182 }
25183 }
25184
25185 prevPoint = point;
25186 }); // if relation is present (Arrows will be added), change cardinality point off-set distance (d)
25187
25188 var d = isRelationTypePresent ? 10 : 5; //Calculate Angle for x and y axis
25189
25190 var angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
25191 var cardinalityPosition = {
25192 x: 0,
25193 y: 0
25194 }; //Calculation cardinality position using angle, center point on the line/curve but pendicular and with offset-distance
25195
25196 cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
25197 cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
25198 return cardinalityPosition;
25199};
25200/**
25201 * position ['start_left', 'start_right', 'end_left', 'end_right']
25202 */
25203
25204
25205var calcTerminalLabelPosition = function calcTerminalLabelPosition(terminalMarkerSize, position, _points) {
25206 // Todo looking to faster cloning method
25207 var points = JSON.parse(JSON.stringify(_points));
25208 var prevPoint;
25209 var totalDistance = 0; // eslint-disable-line
25210
25211 _logger__WEBPACK_IMPORTED_MODULE_1__["logger"].info('our points', points);
25212
25213 if (position !== 'start_left' && position !== 'start_right') {
25214 points = points.reverse();
25215 }
25216
25217 points.forEach(function (point) {
25218 totalDistance += distance(point, prevPoint);
25219 prevPoint = point;
25220 }); // Traverse only 25 total distance along points to find cardinality point
25221
25222 var distanceToCardinalityPoint = 25;
25223 var remainingDistance = distanceToCardinalityPoint;
25224 var center;
25225 prevPoint = undefined;
25226 points.forEach(function (point) {
25227 if (prevPoint && !center) {
25228 var vectorDistance = distance(point, prevPoint);
25229
25230 if (vectorDistance < remainingDistance) {
25231 remainingDistance -= vectorDistance;
25232 } else {
25233 // The point is remainingDistance from prevPoint in the vector between prevPoint and point
25234 // Calculate the coordinates
25235 var distanceRatio = remainingDistance / vectorDistance;
25236 if (distanceRatio <= 0) center = prevPoint;
25237 if (distanceRatio >= 1) center = {
25238 x: point.x,
25239 y: point.y
25240 };
25241
25242 if (distanceRatio > 0 && distanceRatio < 1) {
25243 center = {
25244 x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
25245 y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
25246 };
25247 }
25248 }
25249 }
25250
25251 prevPoint = point;
25252 }); // if relation is present (Arrows will be added), change cardinality point off-set distance (d)
25253
25254 var d = 10; //Calculate Angle for x and y axis
25255
25256 var angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
25257 var cardinalityPosition = {
25258 x: 0,
25259 y: 0
25260 }; //Calculation cardinality position using angle, center point on the line/curve but pendicular and with offset-distance
25261
25262 cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
25263 cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
25264
25265 if (position === 'start_left') {
25266 cardinalityPosition.x = Math.sin(angle + Math.PI) * d + (points[0].x + center.x) / 2;
25267 cardinalityPosition.y = -Math.cos(angle + Math.PI) * d + (points[0].y + center.y) / 2;
25268 }
25269
25270 if (position === 'end_right') {
25271 cardinalityPosition.x = Math.sin(angle - Math.PI) * d + (points[0].x + center.x) / 2 - 5;
25272 cardinalityPosition.y = -Math.cos(angle - Math.PI) * d + (points[0].y + center.y) / 2 - 5;
25273 }
25274
25275 if (position === 'end_left') {
25276 cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2 - 5;
25277 cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2 - 5;
25278 }
25279
25280 return cardinalityPosition;
25281};
25282
25283var getStylesFromArray = function getStylesFromArray(arr) {
25284 var style = '';
25285 var labelStyle = '';
25286
25287 for (var i = 0; i < arr.length; i++) {
25288 if (typeof arr[i] !== 'undefined') {
25289 // add text properties to label style definition
25290 if (arr[i].startsWith('color:') || arr[i].startsWith('text-align:')) {
25291 labelStyle = labelStyle + arr[i] + ';';
25292 } else {
25293 style = style + arr[i] + ';';
25294 }
25295 }
25296 }
25297
25298 return {
25299 style: style,
25300 labelStyle: labelStyle
25301 };
25302};
25303var cnt = 0;
25304var generateId = function generateId() {
25305 cnt++;
25306 return 'id-' + Math.random().toString(36).substr(2, 12) + '-' + cnt;
25307};
25308
25309function makeid(length) {
25310 var result = '';
25311 var characters = '0123456789abcdef';
25312 var charactersLength = characters.length;
25313
25314 for (var i = 0; i < length; i++) {
25315 result += characters.charAt(Math.floor(Math.random() * charactersLength));
25316 }
25317
25318 return result;
25319}
25320
25321var random = function random(options) {
25322 return makeid(options.length);
25323};
25324/**
25325 * @function assignWithDepth
25326 * Extends the functionality of {@link ObjectConstructor.assign} with the ability to merge arbitrary-depth objects
25327 * For each key in src with path `k` (recursively) performs an Object.assign(dst[`k`], src[`k`]) with
25328 * a slight change from the typical handling of undefined for dst[`k`]: instead of raising an error,
25329 * dst[`k`] is auto-initialized to {} and effectively merged with src[`k`]
25330 * <p>
25331 * Additionally, dissimilar types will not clobber unless the config.clobber parameter === true. Example:
25332 * ```
25333 * let config_0 = { foo: { bar: 'bar' }, bar: 'foo' };
25334 * let config_1 = { foo: 'foo', bar: 'bar' };
25335 * let result = assignWithDepth(config_0, config_1);
25336 * console.log(result);
25337 * //-> result: { foo: { bar: 'bar' }, bar: 'bar' }
25338 * ```
25339 * <p>
25340 * Traditional Object.assign would have clobbered foo in config_0 with foo in config_1.
25341 * <p>
25342 * If src is a destructured array of objects and dst is not an array, assignWithDepth will apply each element of src to dst
25343 * in order.
25344 * @param dst:any - the destination of the merge
25345 * @param src:any - the source object(s) to merge into destination
25346 * @param config:{ depth: number, clobber: boolean } - depth: depth to traverse within src and dst for merging -
25347 * clobber: should dissimilar types clobber (default: { depth: 2, clobber: false })
25348 * @returns {*}
25349 */
25350
25351var assignWithDepth = function assignWithDepth(dst, src, config) {
25352 var _Object$assign = Object.assign({
25353 depth: 2,
25354 clobber: false
25355 }, config),
25356 depth = _Object$assign.depth,
25357 clobber = _Object$assign.clobber;
25358
25359 if (Array.isArray(src) && !Array.isArray(dst)) {
25360 src.forEach(function (s) {
25361 return assignWithDepth(dst, s, config);
25362 });
25363 return dst;
25364 } else if (Array.isArray(src) && Array.isArray(dst)) {
25365 src.forEach(function (s) {
25366 if (dst.indexOf(s) === -1) {
25367 dst.push(s);
25368 }
25369 });
25370 return dst;
25371 }
25372
25373 if (typeof dst === 'undefined' || depth <= 0) {
25374 if (dst !== undefined && dst !== null && _typeof(dst) === 'object' && _typeof(src) === 'object') {
25375 return Object.assign(dst, src);
25376 } else {
25377 return src;
25378 }
25379 }
25380
25381 if (typeof src !== 'undefined' && _typeof(dst) === 'object' && _typeof(src) === 'object') {
25382 Object.keys(src).forEach(function (key) {
25383 if (_typeof(src[key]) === 'object' && (dst[key] === undefined || _typeof(dst[key]) === 'object')) {
25384 if (dst[key] === undefined) {
25385 dst[key] = Array.isArray(src[key]) ? [] : {};
25386 }
25387
25388 dst[key] = assignWithDepth(dst[key], src[key], {
25389 depth: depth - 1,
25390 clobber: clobber
25391 });
25392 } else if (clobber || _typeof(dst[key]) !== 'object' && _typeof(src[key]) !== 'object') {
25393 dst[key] = src[key];
25394 }
25395 });
25396 }
25397
25398 return dst;
25399};
25400var getTextObj = function getTextObj() {
25401 return {
25402 x: 0,
25403 y: 0,
25404 fill: undefined,
25405 anchor: 'start',
25406 style: '#666',
25407 width: 100,
25408 height: 100,
25409 textMargin: 0,
25410 rx: 0,
25411 ry: 0,
25412 valign: undefined
25413 };
25414};
25415var drawSimpleText = function drawSimpleText(elem, textData) {
25416 // Remove and ignore br:s
25417 var nText = textData.text.replace(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex, ' ');
25418 var textElem = elem.append('text');
25419 textElem.attr('x', textData.x);
25420 textElem.attr('y', textData.y);
25421 textElem.style('text-anchor', textData.anchor);
25422 textElem.style('font-family', textData.fontFamily);
25423 textElem.style('font-size', textData.fontSize);
25424 textElem.style('font-weight', textData.fontWeight);
25425 textElem.attr('fill', textData.fill);
25426
25427 if (typeof textData.class !== 'undefined') {
25428 textElem.attr('class', textData.class);
25429 }
25430
25431 var span = textElem.append('tspan');
25432 span.attr('x', textData.x + textData.textMargin * 2);
25433 span.attr('fill', textData.fill);
25434 span.text(nText);
25435 return textElem;
25436};
25437var wrapLabel = memoize(function (label, maxWidth, config) {
25438 if (!label) {
25439 return label;
25440 }
25441
25442 config = Object.assign({
25443 fontSize: 12,
25444 fontWeight: 400,
25445 fontFamily: 'Arial',
25446 joinWith: '<br/>'
25447 }, config);
25448
25449 if (_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex.test(label)) {
25450 return label;
25451 }
25452
25453 var words = label.split(' ');
25454 var completedLines = [];
25455 var nextLine = '';
25456 words.forEach(function (word, index) {
25457 var wordLength = calculateTextWidth("".concat(word, " "), config);
25458 var nextLineLength = calculateTextWidth(nextLine, config);
25459
25460 if (wordLength > maxWidth) {
25461 var _breakString = breakString(word, maxWidth, '-', config),
25462 hyphenatedStrings = _breakString.hyphenatedStrings,
25463 remainingWord = _breakString.remainingWord;
25464
25465 completedLines.push.apply(completedLines, [nextLine].concat(_toConsumableArray(hyphenatedStrings)));
25466 nextLine = remainingWord;
25467 } else if (nextLineLength + wordLength >= maxWidth) {
25468 completedLines.push(nextLine);
25469 nextLine = word;
25470 } else {
25471 nextLine = [nextLine, word].filter(Boolean).join(' ');
25472 }
25473
25474 var currentWord = index + 1;
25475 var isLastWord = currentWord === words.length;
25476
25477 if (isLastWord) {
25478 completedLines.push(nextLine);
25479 }
25480 });
25481 return completedLines.filter(function (line) {
25482 return line !== '';
25483 }).join(config.joinWith);
25484}, function (label, maxWidth, config) {
25485 return "".concat(label, "-").concat(maxWidth, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily, "-").concat(config.joinWith);
25486});
25487var breakString = memoize(function (word, maxWidth) {
25488 var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-';
25489 var config = arguments.length > 3 ? arguments[3] : undefined;
25490 config = Object.assign({
25491 fontSize: 12,
25492 fontWeight: 400,
25493 fontFamily: 'Arial',
25494 margin: 0
25495 }, config);
25496 var characters = word.split('');
25497 var lines = [];
25498 var currentLine = '';
25499 characters.forEach(function (character, index) {
25500 var nextLine = "".concat(currentLine).concat(character);
25501 var lineWidth = calculateTextWidth(nextLine, config);
25502
25503 if (lineWidth >= maxWidth) {
25504 var currentCharacter = index + 1;
25505 var isLastLine = characters.length === currentCharacter;
25506 var hyphenatedNextLine = "".concat(nextLine).concat(hyphenCharacter);
25507 lines.push(isLastLine ? nextLine : hyphenatedNextLine);
25508 currentLine = '';
25509 } else {
25510 currentLine = nextLine;
25511 }
25512 });
25513 return {
25514 hyphenatedStrings: lines,
25515 remainingWord: currentLine
25516 };
25517}, function (word, maxWidth) {
25518 var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-';
25519 var config = arguments.length > 3 ? arguments[3] : undefined;
25520 return "".concat(word, "-").concat(maxWidth, "-").concat(hyphenCharacter, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily);
25521});
25522/**
25523 * This calculates the text's height, taking into account the wrap breaks and
25524 * both the statically configured height, width, and the length of the text (in pixels).
25525 *
25526 * If the wrapped text text has greater height, we extend the height, so it's
25527 * value won't overflow.
25528 *
25529 * @return - The height for the given text
25530 * @param text the text to measure
25531 * @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
25532 */
25533
25534var calculateTextHeight = function calculateTextHeight(text, config) {
25535 config = Object.assign({
25536 fontSize: 12,
25537 fontWeight: 400,
25538 fontFamily: 'Arial',
25539 margin: 15
25540 }, config);
25541 return calculateTextDimensions(text, config).height;
25542};
25543/**
25544 * This calculates the width of the given text, font size and family.
25545 *
25546 * @return - The width for the given text
25547 * @param text - The text to calculate the width of
25548 * @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
25549 */
25550
25551var calculateTextWidth = function calculateTextWidth(text, config) {
25552 config = Object.assign({
25553 fontSize: 12,
25554 fontWeight: 400,
25555 fontFamily: 'Arial'
25556 }, config);
25557 return calculateTextDimensions(text, config).width;
25558};
25559/**
25560 * This calculates the dimensions of the given text, font size, font family, font weight, and margins.
25561 *
25562 * @return - The width for the given text
25563 * @param text - The text to calculate the width of
25564 * @param config - the config for fontSize, fontFamily, fontWeight, and margin all impacting the resulting size
25565 */
25566
25567var calculateTextDimensions = memoize(function (text, config) {
25568 config = Object.assign({
25569 fontSize: 12,
25570 fontWeight: 400,
25571 fontFamily: 'Arial'
25572 }, config);
25573 var _config = config,
25574 fontSize = _config.fontSize,
25575 fontFamily = _config.fontFamily,
25576 fontWeight = _config.fontWeight;
25577
25578 if (!text) {
25579 return {
25580 width: 0,
25581 height: 0
25582 };
25583 } // We can't really know if the user supplied font family will render on the user agent;
25584 // thus, we'll take the max width between the user supplied font family, and a default
25585 // of sans-serif.
25586
25587
25588 var fontFamilies = ['sans-serif', fontFamily];
25589 var lines = text.split(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex);
25590 var dims = [];
25591 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
25592 // for any reason, do not continue.
25593
25594 if (!body.remove) {
25595 return {
25596 width: 0,
25597 height: 0,
25598 lineHeight: 0
25599 };
25600 }
25601
25602 var g = body.append('svg');
25603
25604 for (var _i = 0, _fontFamilies = fontFamilies; _i < _fontFamilies.length; _i++) {
25605 var _fontFamily = _fontFamilies[_i];
25606 var cheight = 0;
25607 var dim = {
25608 width: 0,
25609 height: 0,
25610 lineHeight: 0
25611 };
25612 var _iteratorNormalCompletion = true;
25613 var _didIteratorError = false;
25614 var _iteratorError = undefined;
25615
25616 try {
25617 for (var _iterator = lines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
25618 var line = _step.value;
25619 var textObj = getTextObj();
25620 textObj.text = line;
25621 var textElem = drawSimpleText(g, textObj).style('font-size', fontSize).style('font-weight', fontWeight).style('font-family', _fontFamily);
25622 var bBox = (textElem._groups || textElem)[0][0].getBBox();
25623 dim.width = Math.round(Math.max(dim.width, bBox.width));
25624 cheight = Math.round(bBox.height);
25625 dim.height += cheight;
25626 dim.lineHeight = Math.round(Math.max(dim.lineHeight, cheight));
25627 }
25628 } catch (err) {
25629 _didIteratorError = true;
25630 _iteratorError = err;
25631 } finally {
25632 try {
25633 if (!_iteratorNormalCompletion && _iterator.return != null) {
25634 _iterator.return();
25635 }
25636 } finally {
25637 if (_didIteratorError) {
25638 throw _iteratorError;
25639 }
25640 }
25641 }
25642
25643 dims.push(dim);
25644 }
25645
25646 g.remove();
25647 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;
25648 return dims[index];
25649}, function (text, config) {
25650 return "".concat(text, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily);
25651});
25652
25653var d3Attrs = function d3Attrs(d3Elem, attrs) {
25654 var _iteratorNormalCompletion2 = true;
25655 var _didIteratorError2 = false;
25656 var _iteratorError2 = undefined;
25657
25658 try {
25659 for (var _iterator2 = attrs[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
25660 var attr = _step2.value;
25661 d3Elem.attr(attr[0], attr[1]);
25662 }
25663 } catch (err) {
25664 _didIteratorError2 = true;
25665 _iteratorError2 = err;
25666 } finally {
25667 try {
25668 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
25669 _iterator2.return();
25670 }
25671 } finally {
25672 if (_didIteratorError2) {
25673 throw _iteratorError2;
25674 }
25675 }
25676 }
25677};
25678
25679var calculateSvgSizeAttrs = function calculateSvgSizeAttrs(height, width, useMaxWidth) {
25680 var attrs = new Map();
25681 attrs.set('height', height);
25682
25683 if (useMaxWidth) {
25684 attrs.set('width', '100%');
25685 attrs.set('style', "max-width: ".concat(width, "px;"));
25686 } else {
25687 attrs.set('width', width);
25688 }
25689
25690 return attrs;
25691};
25692var configureSvgSize = function configureSvgSize(svgElem, height, width, useMaxWidth) {
25693 var attrs = calculateSvgSizeAttrs(height, width, useMaxWidth);
25694 d3Attrs(svgElem, attrs);
25695};
25696/* harmony default export */ __webpack_exports__["default"] = ({
25697 assignWithDepth: assignWithDepth,
25698 wrapLabel: wrapLabel,
25699 calculateTextHeight: calculateTextHeight,
25700 calculateTextWidth: calculateTextWidth,
25701 calculateTextDimensions: calculateTextDimensions,
25702 calculateSvgSizeAttrs: calculateSvgSizeAttrs,
25703 configureSvgSize: configureSvgSize,
25704 detectInit: detectInit,
25705 detectDirective: detectDirective,
25706 detectType: detectType,
25707 isSubstringInArray: isSubstringInArray,
25708 interpolateToCurve: interpolateToCurve,
25709 calcLabelPosition: calcLabelPosition,
25710 calcCardinalityPosition: calcCardinalityPosition,
25711 calcTerminalLabelPosition: calcTerminalLabelPosition,
25712 formatUrl: formatUrl,
25713 getStylesFromArray: getStylesFromArray,
25714 generateId: generateId,
25715 random: random,
25716 memoize: memoize,
25717 runFunc: runFunc
25718});
25719
25720/***/ }),
25721
25722/***/ "@braintree/sanitize-url":
25723/*!******************************************!*\
25724 !*** external "@braintree/sanitize-url" ***!
25725 \******************************************/
25726/*! no static exports found */
25727/***/ (function(module, exports) {
25728
25729module.exports = require("@braintree/sanitize-url");
25730
25731/***/ }),
25732
25733/***/ "d3":
25734/*!*********************!*\
25735 !*** external "d3" ***!
25736 \*********************/
25737/*! no static exports found */
25738/***/ (function(module, exports) {
25739
25740module.exports = require("d3");
25741
25742/***/ }),
25743
25744/***/ "dagre":
25745/*!************************!*\
25746 !*** external "dagre" ***!
25747 \************************/
25748/*! no static exports found */
25749/***/ (function(module, exports) {
25750
25751module.exports = require("dagre");
25752
25753/***/ }),
25754
25755/***/ "dagre-d3":
25756/*!***************************!*\
25757 !*** external "dagre-d3" ***!
25758 \***************************/
25759/*! no static exports found */
25760/***/ (function(module, exports) {
25761
25762module.exports = require("dagre-d3");
25763
25764/***/ }),
25765
25766/***/ "dagre-d3/lib/label/add-html-label.js":
25767/*!*******************************************************!*\
25768 !*** external "dagre-d3/lib/label/add-html-label.js" ***!
25769 \*******************************************************/
25770/*! no static exports found */
25771/***/ (function(module, exports) {
25772
25773module.exports = require("dagre-d3/lib/label/add-html-label.js");
25774
25775/***/ }),
25776
25777/***/ "entity-decode/browser":
25778/*!****************************************!*\
25779 !*** external "entity-decode/browser" ***!
25780 \****************************************/
25781/*! no static exports found */
25782/***/ (function(module, exports) {
25783
25784module.exports = require("entity-decode/browser");
25785
25786/***/ }),
25787
25788/***/ "graphlib":
25789/*!***************************!*\
25790 !*** external "graphlib" ***!
25791 \***************************/
25792/*! no static exports found */
25793/***/ (function(module, exports) {
25794
25795module.exports = require("graphlib");
25796
25797/***/ }),
25798
25799/***/ "khroma":
25800/*!*************************!*\
25801 !*** external "khroma" ***!
25802 \*************************/
25803/*! no static exports found */
25804/***/ (function(module, exports) {
25805
25806module.exports = require("khroma");
25807
25808/***/ }),
25809
25810/***/ "moment-mini":
25811/*!******************************!*\
25812 !*** external "moment-mini" ***!
25813 \******************************/
25814/*! no static exports found */
25815/***/ (function(module, exports) {
25816
25817module.exports = require("moment-mini");
25818
25819/***/ }),
25820
25821/***/ "stylis":
25822/*!*************************!*\
25823 !*** external "stylis" ***!
25824 \*************************/
25825/*! no static exports found */
25826/***/ (function(module, exports) {
25827
25828module.exports = require("stylis");
25829
25830/***/ })
25831
25832/******/ })["default"];
25833});
25834//# sourceMappingURL=mermaid.core.js.map
\No newline at end of file