(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["mermaid"] = factory(); else root["mermaid"] = factory(); })(typeof self !== "undefined" ? self : this, () => { return /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./src/diagrams/c4/parser/c4Diagram.jison": /*!************************************************!*\ !*** ./src/diagrams/c4/parser/c4Diagram.jison ***! \************************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,6],$V1=[1,7],$V2=[1,8],$V3=[1,9],$V4=[1,16],$V5=[1,11],$V6=[1,12],$V7=[1,13],$V8=[1,14],$V9=[1,15],$Va=[1,27],$Vb=[1,33],$Vc=[1,34],$Vd=[1,35],$Ve=[1,36],$Vf=[1,37],$Vg=[1,72],$Vh=[1,73],$Vi=[1,74],$Vj=[1,75],$Vk=[1,76],$Vl=[1,77],$Vm=[1,78],$Vn=[1,38],$Vo=[1,39],$Vp=[1,40],$Vq=[1,41],$Vr=[1,42],$Vs=[1,43],$Vt=[1,44],$Vu=[1,45],$Vv=[1,46],$Vw=[1,47],$Vx=[1,48],$Vy=[1,49],$Vz=[1,50],$VA=[1,51],$VB=[1,52],$VC=[1,53],$VD=[1,54],$VE=[1,55],$VF=[1,56],$VG=[1,57],$VH=[1,59],$VI=[1,60],$VJ=[1,61],$VK=[1,62],$VL=[1,63],$VM=[1,64],$VN=[1,65],$VO=[1,66],$VP=[1,67],$VQ=[1,68],$VR=[1,69],$VS=[24,52],$VT=[24,44,46,47,48,49,50,51,52,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],$VU=[15,24,44,46,47,48,49,50,51,52,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],$VV=[1,94],$VW=[1,95],$VX=[1,96],$VY=[1,97],$VZ=[15,24,52],$V_=[7,8,9,10,18,22,25,26,27,28],$V$=[15,24,43,52],$V01=[15,24,43,52,86,87,89,90],$V11=[15,43],$V21=[44,46,47,48,49,50,51,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]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"error":2,"start":3,"mermaidDoc":4,"direction":5,"directive":6,"direction_tb":7,"direction_bt":8,"direction_rl":9,"direction_lr":10,"graphConfig":11,"openDirective":12,"typeDirective":13,"closeDirective":14,"NEWLINE":15,":":16,"argDirective":17,"open_directive":18,"type_directive":19,"arg_directive":20,"close_directive":21,"C4_CONTEXT":22,"statements":23,"EOF":24,"C4_CONTAINER":25,"C4_COMPONENT":26,"C4_DYNAMIC":27,"C4_DEPLOYMENT":28,"otherStatements":29,"diagramStatements":30,"otherStatement":31,"title":32,"accDescription":33,"acc_title":34,"acc_title_value":35,"acc_descr":36,"acc_descr_value":37,"acc_descr_multiline_value":38,"boundaryStatement":39,"boundaryStartStatement":40,"boundaryStopStatement":41,"boundaryStart":42,"LBRACE":43,"ENTERPRISE_BOUNDARY":44,"attributes":45,"SYSTEM_BOUNDARY":46,"BOUNDARY":47,"CONTAINER_BOUNDARY":48,"NODE":49,"NODE_L":50,"NODE_R":51,"RBRACE":52,"diagramStatement":53,"PERSON":54,"PERSON_EXT":55,"SYSTEM":56,"SYSTEM_DB":57,"SYSTEM_QUEUE":58,"SYSTEM_EXT":59,"SYSTEM_EXT_DB":60,"SYSTEM_EXT_QUEUE":61,"CONTAINER":62,"CONTAINER_DB":63,"CONTAINER_QUEUE":64,"CONTAINER_EXT":65,"CONTAINER_EXT_DB":66,"CONTAINER_EXT_QUEUE":67,"COMPONENT":68,"COMPONENT_DB":69,"COMPONENT_QUEUE":70,"COMPONENT_EXT":71,"COMPONENT_EXT_DB":72,"COMPONENT_EXT_QUEUE":73,"REL":74,"BIREL":75,"REL_U":76,"REL_D":77,"REL_L":78,"REL_R":79,"REL_B":80,"REL_INDEX":81,"UPDATE_EL_STYLE":82,"UPDATE_REL_STYLE":83,"UPDATE_LAYOUT_CONFIG":84,"attribute":85,"STR":86,"STR_KEY":87,"STR_VALUE":88,"ATTRIBUTE":89,"ATTRIBUTE_EMPTY":90,"$accept":0,"$end":1}, terminals_: {2:"error",7:"direction_tb",8:"direction_bt",9:"direction_rl",10:"direction_lr",15:"NEWLINE",16:":",18:"open_directive",19:"type_directive",20:"arg_directive",21:"close_directive",22:"C4_CONTEXT",24:"EOF",25:"C4_CONTAINER",26:"C4_COMPONENT",27:"C4_DYNAMIC",28:"C4_DEPLOYMENT",32:"title",33:"accDescription",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",43:"LBRACE",44:"ENTERPRISE_BOUNDARY",46:"SYSTEM_BOUNDARY",47:"BOUNDARY",48:"CONTAINER_BOUNDARY",49:"NODE",50:"NODE_L",51:"NODE_R",52:"RBRACE",54:"PERSON",55:"PERSON_EXT",56:"SYSTEM",57:"SYSTEM_DB",58:"SYSTEM_QUEUE",59:"SYSTEM_EXT",60:"SYSTEM_EXT_DB",61:"SYSTEM_EXT_QUEUE",62:"CONTAINER",63:"CONTAINER_DB",64:"CONTAINER_QUEUE",65:"CONTAINER_EXT",66:"CONTAINER_EXT_DB",67:"CONTAINER_EXT_QUEUE",68:"COMPONENT",69:"COMPONENT_DB",70:"COMPONENT_QUEUE",71:"COMPONENT_EXT",72:"COMPONENT_EXT_DB",73:"COMPONENT_EXT_QUEUE",74:"REL",75:"BIREL",76:"REL_U",77:"REL_D",78:"REL_L",79:"REL_R",80:"REL_B",81:"REL_INDEX",82:"UPDATE_EL_STYLE",83:"UPDATE_REL_STYLE",84:"UPDATE_LAYOUT_CONFIG",86:"STR",87:"STR_KEY",88:"STR_VALUE",89:"ATTRIBUTE",90:"ATTRIBUTE_EMPTY"}, productions_: [0,[3,1],[3,1],[3,2],[5,1],[5,1],[5,1],[5,1],[4,1],[6,4],[6,6],[12,1],[13,1],[17,1],[14,1],[11,4],[11,4],[11,4],[11,4],[11,4],[23,1],[23,1],[23,2],[29,1],[29,2],[29,3],[31,1],[31,1],[31,2],[31,2],[31,1],[39,3],[40,3],[40,3],[40,4],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[41,1],[30,1],[30,2],[30,3],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,1],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[45,1],[45,2],[85,1],[85,2],[85,1],[85,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 4: yy.setDirection('TB'); break; case 5: yy.setDirection('BT'); break; case 6: yy.setDirection('RL'); break; case 7: yy.setDirection('LR'); break; case 11: console.log("open_directive: ", $$[$0]); yy.parseDirective('%%{', 'open_directive'); break; case 12: break; case 13: $$[$0] = $$[$0].trim().replace(/'/g, '"'); console.log("arg_directive: ", $$[$0]); yy.parseDirective($$[$0], 'arg_directive'); break; case 14: console.log("close_directive: ", $$[$0]); yy.parseDirective('}%%', 'close_directive', 'c4Context'); break; case 15: case 16: case 17: case 18: case 19: yy.setC4Type($$[$0-3]) break; case 26: yy.setTitle($$[$0].substring(6));this.$=$$[$0].substring(6); break; case 27: yy.setAccDescription($$[$0].substring(15));this.$=$$[$0].substring(15); break; case 28: this.$=$$[$0].trim();yy.setTitle(this.$); break; case 29: case 30: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 35: case 36: console.log($$[$0-1],JSON.stringify($$[$0])); $$[$0].splice(2, 0, 'ENTERPRISE'); yy.addPersonOrSystemBoundary(...$$[$0]); this.$=$$[$0]; break; case 37: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystemBoundary(...$$[$0]); this.$=$$[$0]; break; case 38: console.log($$[$0-1],JSON.stringify($$[$0])); $$[$0].splice(2, 0, 'CONTAINER'); yy.addContainerBoundary(...$$[$0]); this.$=$$[$0]; break; case 39: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addDeploymentNode('node', ...$$[$0]); this.$=$$[$0]; break; case 40: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addDeploymentNode('nodeL', ...$$[$0]); this.$=$$[$0]; break; case 41: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addDeploymentNode('nodeR', ...$$[$0]); this.$=$$[$0]; break; case 42: yy.popBoundaryParseStack() break; case 46: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('person', ...$$[$0]); this.$=$$[$0]; break; case 47: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('external_person', ...$$[$0]); this.$=$$[$0]; break; case 48: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('system', ...$$[$0]); this.$=$$[$0]; break; case 49: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('system_db', ...$$[$0]); this.$=$$[$0]; break; case 50: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('system_queue', ...$$[$0]); this.$=$$[$0]; break; case 51: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('external_system', ...$$[$0]); this.$=$$[$0]; break; case 52: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('external_system_db', ...$$[$0]); this.$=$$[$0]; break; case 53: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('external_system_queue', ...$$[$0]); this.$=$$[$0]; break; case 54: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('container', ...$$[$0]); this.$=$$[$0]; break; case 55: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('container_db', ...$$[$0]); this.$=$$[$0]; break; case 56: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('container_queue', ...$$[$0]); this.$=$$[$0]; break; case 57: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('external_container', ...$$[$0]); this.$=$$[$0]; break; case 58: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('external_container_db', ...$$[$0]); this.$=$$[$0]; break; case 59: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('external_container_queue', ...$$[$0]); this.$=$$[$0]; break; case 60: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('component', ...$$[$0]); this.$=$$[$0]; break; case 61: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('component_db', ...$$[$0]); this.$=$$[$0]; break; case 62: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('component_queue', ...$$[$0]); this.$=$$[$0]; break; case 63: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('external_component', ...$$[$0]); this.$=$$[$0]; break; case 64: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('external_component_db', ...$$[$0]); this.$=$$[$0]; break; case 65: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('external_component_queue', ...$$[$0]); this.$=$$[$0]; break; case 67: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel', ...$$[$0]); this.$=$$[$0]; break; case 68: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('birel', ...$$[$0]); this.$=$$[$0]; break; case 69: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel_u', ...$$[$0]); this.$=$$[$0]; break; case 70: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel_d', ...$$[$0]); this.$=$$[$0]; break; case 71: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel_l', ...$$[$0]); this.$=$$[$0]; break; case 72: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel_r', ...$$[$0]); this.$=$$[$0]; break; case 73: console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel_b', ...$$[$0]); this.$=$$[$0]; break; case 74: console.log($$[$0-1],JSON.stringify($$[$0])); $$[$0].splice(0, 1); yy.addRel('rel', ...$$[$0]); this.$=$$[$0]; break; case 75: console.log($$[$0-1],JSON.stringify($$[$0])); yy.updateElStyle('update_el_style', ...$$[$0]); this.$=$$[$0]; break; case 76: console.log($$[$0-1],JSON.stringify($$[$0])); yy.updateRelStyle('update_rel_style', ...$$[$0]); this.$=$$[$0]; break; case 77: console.log($$[$0-1],JSON.stringify($$[$0])); yy.updateLayoutConfig('update_layout_config', ...$$[$0]); this.$=$$[$0]; break; case 78: console.log('PUSH ATTRIBUTE: ', $$[$0]); this.$ = [$$[$0]]; break; case 79: console.log('PUSH ATTRIBUTE: ', $$[$0-1]); $$[$0].unshift($$[$0-1]); this.$=$$[$0]; break; case 80: case 82: this.$ = $$[$0].trim(); break; case 81: console.log('kv: ', $$[$0-1], $$[$0]); let kv={}; kv[$$[$0-1].trim()]=$$[$0].trim(); this.$=kv; break; case 83: this.$ = ""; break; } }, table: [{3:1,4:2,5:3,6:4,7:$V0,8:$V1,9:$V2,10:$V3,11:5,12:10,18:$V4,22:$V5,25:$V6,26:$V7,27:$V8,28:$V9},{1:[3]},{1:[2,1]},{1:[2,2]},{3:17,4:2,5:3,6:4,7:$V0,8:$V1,9:$V2,10:$V3,11:5,12:10,18:$V4,22:$V5,25:$V6,26:$V7,27:$V8,28:$V9},{1:[2,8]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{1:[2,7]},{13:18,19:[1,19]},{15:[1,20]},{15:[1,21]},{15:[1,22]},{15:[1,23]},{15:[1,24]},{19:[2,11]},{1:[2,3]},{14:25,16:[1,26],21:$Va},o([16,21],[2,12]),{23:28,29:29,30:30,31:31,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{23:79,29:29,30:30,31:31,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{23:80,29:29,30:30,31:31,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{23:81,29:29,30:30,31:31,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{23:82,29:29,30:30,31:31,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{15:[1,83]},{17:84,20:[1,85]},{15:[2,14]},{24:[1,86]},o($VS,[2,20],{53:32,39:58,40:70,42:71,30:87,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR}),o($VS,[2,21]),o($VT,[2,23],{15:[1,88]}),o($VS,[2,43],{15:[1,89]}),o($VU,[2,26]),o($VU,[2,27]),{35:[1,90]},{37:[1,91]},o($VU,[2,30]),{45:92,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:98,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:99,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:100,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:101,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:102,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:103,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:104,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:105,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:106,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:107,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:108,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:109,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:110,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:111,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:112,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:113,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:114,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:115,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:116,85:93,86:$VV,87:$VW,89:$VX,90:$VY},o($VZ,[2,66]),{45:117,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:118,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:119,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:120,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:121,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:122,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:123,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:124,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:125,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:126,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:127,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{30:128,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{15:[1,130],43:[1,129]},{45:131,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:132,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:133,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:134,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:135,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:136,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:137,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{24:[1,138]},{24:[1,139]},{24:[1,140]},{24:[1,141]},o($V_,[2,9]),{14:142,21:$Va},{21:[2,13]},{1:[2,15]},o($VS,[2,22]),o($VT,[2,24],{31:31,29:143,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf}),o($VS,[2,44],{29:29,30:30,31:31,53:32,39:58,40:70,42:71,23:144,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR}),o($VU,[2,28]),o($VU,[2,29]),o($VZ,[2,46]),o($V$,[2,78],{85:93,45:145,86:$VV,87:$VW,89:$VX,90:$VY}),o($V01,[2,80]),{88:[1,146]},o($V01,[2,82]),o($V01,[2,83]),o($VZ,[2,47]),o($VZ,[2,48]),o($VZ,[2,49]),o($VZ,[2,50]),o($VZ,[2,51]),o($VZ,[2,52]),o($VZ,[2,53]),o($VZ,[2,54]),o($VZ,[2,55]),o($VZ,[2,56]),o($VZ,[2,57]),o($VZ,[2,58]),o($VZ,[2,59]),o($VZ,[2,60]),o($VZ,[2,61]),o($VZ,[2,62]),o($VZ,[2,63]),o($VZ,[2,64]),o($VZ,[2,65]),o($VZ,[2,67]),o($VZ,[2,68]),o($VZ,[2,69]),o($VZ,[2,70]),o($VZ,[2,71]),o($VZ,[2,72]),o($VZ,[2,73]),o($VZ,[2,74]),o($VZ,[2,75]),o($VZ,[2,76]),o($VZ,[2,77]),{41:147,52:[1,148]},{15:[1,149]},{43:[1,150]},o($V11,[2,35]),o($V11,[2,36]),o($V11,[2,37]),o($V11,[2,38]),o($V11,[2,39]),o($V11,[2,40]),o($V11,[2,41]),{1:[2,16]},{1:[2,17]},{1:[2,18]},{1:[2,19]},{15:[1,151]},o($VT,[2,25]),o($VS,[2,45]),o($V$,[2,79]),o($V01,[2,81]),o($VZ,[2,31]),o($VZ,[2,42]),o($V21,[2,32]),o($V21,[2,33],{15:[1,152]}),o($V_,[2,10]),o($V21,[2,34])], defaultActions: {2:[2,1],3:[2,2],5:[2,8],6:[2,4],7:[2,5],8:[2,6],9:[2,7],16:[2,11],17:[2,3],27:[2,14],85:[2,13],86:[2,15],138:[2,16],139:[2,17],140:[2,18],141:[2,19]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0: this.begin('open_directive'); return 18; break; case 1:return 7; break; case 2:return 8; break; case 3:return 9; break; case 4:return 10; break; case 5: this.begin('type_directive'); return 19; break; case 6: this.popState(); this.begin('arg_directive'); return 16; break; case 7: this.popState(); this.popState(); return 21; break; case 8:return 20; break; case 9:return 32; break; case 10:return 33; break; case 11: this.begin("acc_title");return 34; break; case 12: this.popState(); return "acc_title_value"; break; case 13: this.begin("acc_descr");return 36; break; case 14: this.popState(); return "acc_descr_value"; break; case 15: this.begin("acc_descr_multiline"); break; case 16: this.popState(); break; case 17:return "acc_descr_multiline_value"; break; case 18:/* skip comments */ break; case 19:c /* skip comments */ break; case 20:return 15; break; case 21:/* skip whitespace */ break; case 22:return 22; break; case 23:return 25; break; case 24:return 26; break; case 25:return 27; break; case 26:return 28; break; case 27: this.begin("person_ext"); console.log('begin person_ext'); return 55; break; case 28: this.begin("person"); console.log('begin person'); return 54; break; case 29: this.begin("system_ext_queue"); console.log('begin system_ext_queue'); return 61; break; case 30: this.begin("system_ext_db"); console.log('begin system_ext_db'); return 60; break; case 31: this.begin("system_ext"); console.log('begin system_ext'); return 59; break; case 32: this.begin("system_queue"); console.log('begin system_queue'); return 58; break; case 33: this.begin("system_db"); console.log('begin system_db'); return 57; break; case 34: this.begin("system"); console.log('begin system'); return 56; break; case 35: this.begin("boundary"); console.log('begin boundary'); return 47; break; case 36: this.begin("enterprise_boundary"); console.log('begin enterprise_boundary'); return 44; break; case 37: this.begin("system_boundary"); console.log('begin system_boundary'); return 46; break; case 38: this.begin("container_ext_queue"); console.log('begin container_ext_queue'); return 67; break; case 39: this.begin("container_ext_db"); console.log('begin container_ext_db'); return 66; break; case 40: this.begin("container_ext"); console.log('begin container_ext'); return 65; break; case 41: this.begin("container_queue"); console.log('begin container_queue'); return 64; break; case 42: this.begin("container_db"); console.log('begin container_db'); return 63; break; case 43: this.begin("container"); console.log('begin container'); return 62; break; case 44: this.begin("container_boundary"); console.log('begin container_boundary'); return 48; break; case 45: this.begin("component_ext_queue"); console.log('begin component_ext_queue'); return 73; break; case 46: this.begin("component_ext_db"); console.log('begin component_ext_db'); return 72; break; case 47: this.begin("component_ext"); console.log('begin component_ext'); return 71; break; case 48: this.begin("component_queue"); console.log('begin component_queue'); return 70; break; case 49: this.begin("component_db"); console.log('begin component_db'); return 69; break; case 50: this.begin("component"); console.log('begin component'); return 68; break; case 51: this.begin("node"); console.log('begin node'); return 49; break; case 52: this.begin("node"); console.log('begin node'); return 49; break; case 53: this.begin("node_l"); console.log('begin node_l'); return 50; break; case 54: this.begin("node_r"); console.log('begin node_r'); return 51; break; case 55: this.begin("rel"); console.log('begin rel'); return 74; break; case 56: this.begin("birel"); console.log('begin birel'); return 75; break; case 57: this.begin("rel_u"); console.log('begin rel_u'); return 76; break; case 58: this.begin("rel_u"); console.log('begin rel_u'); return 76; break; case 59: this.begin("rel_d"); console.log('begin rel_d'); return 77; break; case 60: this.begin("rel_d"); console.log('begin rel_d'); return 77; break; case 61: this.begin("rel_l"); console.log('begin rel_l'); return 78; break; case 62: this.begin("rel_l"); console.log('begin rel_l'); return 78; break; case 63: this.begin("rel_r"); console.log('begin rel_r'); return 79; break; case 64: this.begin("rel_r"); console.log('begin rel_r'); return 79; break; case 65: this.begin("rel_b"); console.log('begin rel_b'); return 80; break; case 66: this.begin("rel_index"); console.log('begin rel_index'); return 81; break; case 67: this.begin("update_el_style"); console.log('begin update_el_style'); return 82; break; case 68: this.begin("update_rel_style"); console.log('begin update_rel_style'); return 83; break; case 69: this.begin("update_layout_config"); console.log('begin update_layout_config'); return 84; break; case 70:return "EOF_IN_STRUCT"; break; case 71: console.log('begin attribute with ATTRIBUTE_EMPTY'); this.begin("attribute"); return "ATTRIBUTE_EMPTY"; break; case 72: console.log('begin attribute'); this.begin("attribute"); break; case 73: console.log('STOP attribute'); this.popState();console.log('STOP diagram'); this.popState(); break; case 74: console.log(',,'); return 90; break; case 75: console.log(','); break; case 76: console.log('ATTRIBUTE_EMPTY'); return 90; break; case 77: console.log('begin string'); this.begin("string"); break; case 78: console.log('STOP string'); this.popState(); break; case 79: console.log('STR'); return "STR"; break; case 80: console.log('begin string_kv'); this.begin("string_kv"); break; case 81: console.log('STR_KEY'); this.begin("string_kv_key"); return "STR_KEY"; break; case 82: console.log('begin string_kv_value'); this.popState(); this.begin("string_kv_value"); break; case 83: console.log('STR_VALUE'); return "STR_VALUE"; break; case 84: console.log('STOP string_kv_value'); this.popState(); this.popState(); break; case 85: console.log('not STR'); return "STR"; break; case 86: /* this.begin("lbrace"); */ console.log('begin boundary block'); return "LBRACE"; break; case 87: /* this.popState(); */ console.log('STOP boundary block'); return "RBRACE"; break; case 88:return 'SPACE'; break; case 89:return 'EOL'; break; case 90:return 24; break; } }, rules: [/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/], conditions: {"acc_descr_multiline":{"rules":[16,17],"inclusive":false},"acc_descr":{"rules":[14],"inclusive":false},"acc_title":{"rules":[12],"inclusive":false},"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[7,8],"inclusive":false},"type_directive":{"rules":[6,7],"inclusive":false},"open_directive":{"rules":[5],"inclusive":false},"string_kv_value":{"rules":[83,84],"inclusive":false},"string_kv_key":{"rules":[82],"inclusive":false},"string_kv":{"rules":[81],"inclusive":false},"string":{"rules":[78,79],"inclusive":false},"attribute":{"rules":[73,74,75,76,77,80,85],"inclusive":false},"update_layout_config":{"rules":[70,71,72,73],"inclusive":false},"update_rel_style":{"rules":[70,71,72,73],"inclusive":false},"update_el_style":{"rules":[70,71,72,73],"inclusive":false},"rel_b":{"rules":[70,71,72,73],"inclusive":false},"rel_r":{"rules":[70,71,72,73],"inclusive":false},"rel_l":{"rules":[70,71,72,73],"inclusive":false},"rel_d":{"rules":[70,71,72,73],"inclusive":false},"rel_u":{"rules":[70,71,72,73],"inclusive":false},"rel_bi":{"rules":[],"inclusive":false},"rel":{"rules":[70,71,72,73],"inclusive":false},"node_r":{"rules":[70,71,72,73],"inclusive":false},"node_l":{"rules":[70,71,72,73],"inclusive":false},"node":{"rules":[70,71,72,73],"inclusive":false},"index":{"rules":[],"inclusive":false},"rel_index":{"rules":[70,71,72,73],"inclusive":false},"component_ext_queue":{"rules":[],"inclusive":false},"component_ext_db":{"rules":[70,71,72,73],"inclusive":false},"component_ext":{"rules":[70,71,72,73],"inclusive":false},"component_queue":{"rules":[70,71,72,73],"inclusive":false},"component_db":{"rules":[70,71,72,73],"inclusive":false},"component":{"rules":[70,71,72,73],"inclusive":false},"container_boundary":{"rules":[70,71,72,73],"inclusive":false},"container_ext_queue":{"rules":[],"inclusive":false},"container_ext_db":{"rules":[70,71,72,73],"inclusive":false},"container_ext":{"rules":[70,71,72,73],"inclusive":false},"container_queue":{"rules":[70,71,72,73],"inclusive":false},"container_db":{"rules":[70,71,72,73],"inclusive":false},"container":{"rules":[70,71,72,73],"inclusive":false},"birel":{"rules":[70,71,72,73],"inclusive":false},"system_boundary":{"rules":[70,71,72,73],"inclusive":false},"enterprise_boundary":{"rules":[70,71,72,73],"inclusive":false},"boundary":{"rules":[70,71,72,73],"inclusive":false},"system_ext_queue":{"rules":[70,71,72,73],"inclusive":false},"system_ext_db":{"rules":[70,71,72,73],"inclusive":false},"system_ext":{"rules":[70,71,72,73],"inclusive":false},"system_queue":{"rules":[70,71,72,73],"inclusive":false},"system_db":{"rules":[70,71,72,73],"inclusive":false},"system":{"rules":[70,71,72,73],"inclusive":false},"person_ext":{"rules":[70,71,72,73],"inclusive":false},"person":{"rules":[70,71,72,73],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,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,86,87,88,89,90],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?1da1").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./src/diagrams/class/parser/classDiagram.jison": /*!******************************************************!*\ !*** ./src/diagrams/class/parser/classDiagram.jison ***! \******************************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,3],$V1=[1,7],$V2=[1,8],$V3=[1,9],$V4=[1,10],$V5=[1,13],$V6=[1,12],$V7=[1,16,25],$V8=[1,20],$V9=[1,31],$Va=[1,32],$Vb=[1,33],$Vc=[1,35],$Vd=[1,38],$Ve=[1,36],$Vf=[1,37],$Vg=[1,39],$Vh=[1,40],$Vi=[1,41],$Vj=[1,42],$Vk=[1,45],$Vl=[1,46],$Vm=[1,47],$Vn=[1,48],$Vo=[16,25],$Vp=[1,62],$Vq=[1,63],$Vr=[1,64],$Vs=[1,65],$Vt=[1,66],$Vu=[1,67],$Vv=[16,25,32,44,45,53,56,57,58,59,60,61,66,68],$Vw=[16,25,30,32,44,45,49,53,56,57,58,59,60,61,66,68,83,84,85,86],$Vx=[5,8,9,10,11,16,19,23,25],$Vy=[53,83,84,85,86],$Vz=[53,60,61,83,84,85,86],$VA=[53,56,57,58,59,83,84,85,86],$VB=[16,25,32],$VC=[1,99]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"error":2,"start":3,"mermaidDoc":4,"statments":5,"direction":6,"directive":7,"direction_tb":8,"direction_bt":9,"direction_rl":10,"direction_lr":11,"graphConfig":12,"openDirective":13,"typeDirective":14,"closeDirective":15,"NEWLINE":16,":":17,"argDirective":18,"open_directive":19,"type_directive":20,"arg_directive":21,"close_directive":22,"CLASS_DIAGRAM":23,"statements":24,"EOF":25,"statement":26,"className":27,"alphaNumToken":28,"classLiteralName":29,"GENERICTYPE":30,"relationStatement":31,"LABEL":32,"classStatement":33,"methodStatement":34,"annotationStatement":35,"clickStatement":36,"cssClassStatement":37,"acc_title":38,"acc_title_value":39,"acc_descr":40,"acc_descr_value":41,"acc_descr_multiline_value":42,"CLASS":43,"STYLE_SEPARATOR":44,"STRUCT_START":45,"members":46,"STRUCT_STOP":47,"ANNOTATION_START":48,"ANNOTATION_END":49,"MEMBER":50,"SEPARATOR":51,"relation":52,"STR":53,"relationType":54,"lineType":55,"AGGREGATION":56,"EXTENSION":57,"COMPOSITION":58,"DEPENDENCY":59,"LINE":60,"DOTTED_LINE":61,"CALLBACK":62,"LINK":63,"LINK_TARGET":64,"CLICK":65,"CALLBACK_NAME":66,"CALLBACK_ARGS":67,"HREF":68,"CSSCLASS":69,"commentToken":70,"textToken":71,"graphCodeTokens":72,"textNoTagsToken":73,"TAGSTART":74,"TAGEND":75,"==":76,"--":77,"PCT":78,"DEFAULT":79,"SPACE":80,"MINUS":81,"keywords":82,"UNICODE_TEXT":83,"NUM":84,"ALPHA":85,"BQUOTE_STR":86,"$accept":0,"$end":1}, terminals_: {2:"error",5:"statments",8:"direction_tb",9:"direction_bt",10:"direction_rl",11:"direction_lr",16:"NEWLINE",17:":",19:"open_directive",20:"type_directive",21:"arg_directive",22:"close_directive",23:"CLASS_DIAGRAM",25:"EOF",30:"GENERICTYPE",32:"LABEL",38:"acc_title",39:"acc_title_value",40:"acc_descr",41:"acc_descr_value",42:"acc_descr_multiline_value",43:"CLASS",44:"STYLE_SEPARATOR",45:"STRUCT_START",47:"STRUCT_STOP",48:"ANNOTATION_START",49:"ANNOTATION_END",50:"MEMBER",51:"SEPARATOR",53:"STR",56:"AGGREGATION",57:"EXTENSION",58:"COMPOSITION",59:"DEPENDENCY",60:"LINE",61:"DOTTED_LINE",62:"CALLBACK",63:"LINK",64:"LINK_TARGET",65:"CLICK",66:"CALLBACK_NAME",67:"CALLBACK_ARGS",68:"HREF",69:"CSSCLASS",72:"graphCodeTokens",74:"TAGSTART",75:"TAGEND",76:"==",77:"--",78:"PCT",79:"DEFAULT",80:"SPACE",81:"MINUS",82:"keywords",83:"UNICODE_TEXT",84:"NUM",85:"ALPHA",86:"BQUOTE_STR"}, productions_: [0,[3,1],[3,1],[3,1],[3,2],[6,1],[6,1],[6,1],[6,1],[4,1],[7,4],[7,6],[13,1],[14,1],[18,1],[15,1],[12,4],[24,1],[24,2],[24,3],[27,1],[27,1],[27,2],[27,2],[27,2],[26,1],[26,2],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,2],[26,2],[26,1],[33,2],[33,4],[33,5],[33,7],[35,4],[46,1],[46,2],[34,1],[34,2],[34,1],[34,1],[31,3],[31,4],[31,4],[31,5],[52,3],[52,2],[52,2],[52,1],[54,1],[54,1],[54,1],[54,1],[55,1],[55,1],[36,3],[36,4],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[37,3],[70,1],[70,1],[71,1],[71,1],[71,1],[71,1],[71,1],[71,1],[71,1],[73,1],[73,1],[73,1],[73,1],[28,1],[28,1],[28,1],[29,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 5: yy.setDirection('TB'); break; case 6: yy.setDirection('BT'); break; case 7: yy.setDirection('RL'); break; case 8: yy.setDirection('LR'); break; case 12: yy.parseDirective('%%{', 'open_directive'); break; case 13: yy.parseDirective($$[$0], 'type_directive'); break; case 14: $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive'); break; case 15: yy.parseDirective('}%%', 'close_directive', 'class'); break; case 20: case 21: this.$=$$[$0]; break; case 22: this.$=$$[$0-1]+$$[$0]; break; case 23: case 24: this.$=$$[$0-1]+'~'+$$[$0]; break; case 25: yy.addRelation($$[$0]); break; case 26: $$[$0-1].title = yy.cleanupLabel($$[$0]); yy.addRelation($$[$0-1]); break; case 34: this.$=$$[$0].trim();yy.setAccTitle(this.$); break; case 35: case 36: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 37: yy.addClass($$[$0]); break; case 38: yy.addClass($$[$0-2]);yy.setCssClass($$[$0-2], $$[$0]); break; case 39: /*console.log($$[$0-3],JSON.stringify($$[$0-1]));*/yy.addClass($$[$0-3]);yy.addMembers($$[$0-3],$$[$0-1]); break; case 40: yy.addClass($$[$0-5]);yy.setCssClass($$[$0-5], $$[$0-3]);yy.addMembers($$[$0-5],$$[$0-1]); break; case 41: yy.addAnnotation($$[$0],$$[$0-2]); break; case 42: this.$ = [$$[$0]]; break; case 43: $$[$0].push($$[$0-1]);this.$=$$[$0]; break; case 44: /*console.log('Rel found',$$[$0]);*/ break; case 45: yy.addMember($$[$0-1],yy.cleanupLabel($$[$0])); break; case 46: /*console.warn('Member',$$[$0]);*/ break; case 47: /*console.log('sep found',$$[$0]);*/ break; case 48: this.$ = {'id1':$$[$0-2],'id2':$$[$0], relation:$$[$0-1], relationTitle1:'none', relationTitle2:'none'}; break; case 49: this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-1], relationTitle1:$$[$0-2], relationTitle2:'none'} break; case 50: this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-2], relationTitle1:'none', relationTitle2:$$[$0-1]}; break; case 51: this.$ = {id1:$$[$0-4], id2:$$[$0], relation:$$[$0-2], relationTitle1:$$[$0-3], relationTitle2:$$[$0-1]} break; case 52: this.$={type1:$$[$0-2],type2:$$[$0],lineType:$$[$0-1]}; break; case 53: this.$={type1:'none',type2:$$[$0],lineType:$$[$0-1]}; break; case 54: this.$={type1:$$[$0-1],type2:'none',lineType:$$[$0]}; break; case 55: this.$={type1:'none',type2:'none',lineType:$$[$0]}; break; case 56: this.$=yy.relationType.AGGREGATION; break; case 57: this.$=yy.relationType.EXTENSION; break; case 58: this.$=yy.relationType.COMPOSITION; break; case 59: this.$=yy.relationType.DEPENDENCY; break; case 60: this.$=yy.lineType.LINE; break; case 61: this.$=yy.lineType.DOTTED_LINE; break; case 62: case 68: this.$ = $$[$0-2];yy.setClickEvent($$[$0-1], $$[$0]); break; case 63: case 69: this.$ = $$[$0-3];yy.setClickEvent($$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-2], $$[$0]); break; case 64: case 72: this.$ = $$[$0-2];yy.setLink($$[$0-1], $$[$0]); break; case 65: this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1],$$[$0]); break; case 66: case 74: this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-2], $$[$0]); break; case 67: case 75: this.$ = $$[$0-4];yy.setLink($$[$0-3], $$[$0-2], $$[$0]);yy.setTooltip($$[$0-3], $$[$0-1]); break; case 70: this.$ = $$[$0-3];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]); break; case 71: this.$ = $$[$0-4];yy.setClickEvent($$[$0-3], $$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-3], $$[$0]); break; case 73: this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1], $$[$0]); break; case 76: yy.setCssClass($$[$0-1], $$[$0]); break; } }, table: [{3:1,4:2,5:$V0,6:4,7:5,8:$V1,9:$V2,10:$V3,11:$V4,12:6,13:11,19:$V5,23:$V6},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{3:14,4:2,5:$V0,6:4,7:5,8:$V1,9:$V2,10:$V3,11:$V4,12:6,13:11,19:$V5,23:$V6},{1:[2,9]},o($V7,[2,5]),o($V7,[2,6]),o($V7,[2,7]),o($V7,[2,8]),{14:15,20:[1,16]},{16:[1,17]},{20:[2,12]},{1:[2,4]},{15:18,17:[1,19],22:$V8},o([17,22],[2,13]),{6:30,7:29,8:$V1,9:$V2,10:$V3,11:$V4,13:11,19:$V5,24:21,26:22,27:34,28:43,29:44,31:23,33:24,34:25,35:26,36:27,37:28,38:$V9,40:$Va,42:$Vb,43:$Vc,48:$Vd,50:$Ve,51:$Vf,62:$Vg,63:$Vh,65:$Vi,69:$Vj,83:$Vk,84:$Vl,85:$Vm,86:$Vn},{16:[1,49]},{18:50,21:[1,51]},{16:[2,15]},{25:[1,52]},{16:[1,53],25:[2,17]},o($Vo,[2,25],{32:[1,54]}),o($Vo,[2,27]),o($Vo,[2,28]),o($Vo,[2,29]),o($Vo,[2,30]),o($Vo,[2,31]),o($Vo,[2,32]),o($Vo,[2,33]),{39:[1,55]},{41:[1,56]},o($Vo,[2,36]),o($Vo,[2,44],{52:57,54:60,55:61,32:[1,59],53:[1,58],56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu}),{27:68,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},o($Vo,[2,46]),o($Vo,[2,47]),{28:69,83:$Vk,84:$Vl,85:$Vm},{27:70,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},{27:71,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},{27:72,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},{53:[1,73]},o($Vv,[2,20],{28:43,29:44,27:74,30:[1,75],83:$Vk,84:$Vl,85:$Vm,86:$Vn}),o($Vv,[2,21],{30:[1,76]}),o($Vw,[2,90]),o($Vw,[2,91]),o($Vw,[2,92]),o([16,25,30,32,44,45,53,56,57,58,59,60,61,66,68],[2,93]),o($Vx,[2,10]),{15:77,22:$V8},{22:[2,14]},{1:[2,16]},{6:30,7:29,8:$V1,9:$V2,10:$V3,11:$V4,13:11,19:$V5,24:78,25:[2,18],26:22,27:34,28:43,29:44,31:23,33:24,34:25,35:26,36:27,37:28,38:$V9,40:$Va,42:$Vb,43:$Vc,48:$Vd,50:$Ve,51:$Vf,62:$Vg,63:$Vh,65:$Vi,69:$Vj,83:$Vk,84:$Vl,85:$Vm,86:$Vn},o($Vo,[2,26]),o($Vo,[2,34]),o($Vo,[2,35]),{27:79,28:43,29:44,53:[1,80],83:$Vk,84:$Vl,85:$Vm,86:$Vn},{52:81,54:60,55:61,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu},o($Vo,[2,45]),{55:82,60:$Vt,61:$Vu},o($Vy,[2,55],{54:83,56:$Vp,57:$Vq,58:$Vr,59:$Vs}),o($Vz,[2,56]),o($Vz,[2,57]),o($Vz,[2,58]),o($Vz,[2,59]),o($VA,[2,60]),o($VA,[2,61]),o($Vo,[2,37],{44:[1,84],45:[1,85]}),{49:[1,86]},{53:[1,87]},{53:[1,88]},{66:[1,89],68:[1,90]},{28:91,83:$Vk,84:$Vl,85:$Vm},o($Vv,[2,22]),o($Vv,[2,23]),o($Vv,[2,24]),{16:[1,92]},{25:[2,19]},o($VB,[2,48]),{27:93,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},{27:94,28:43,29:44,53:[1,95],83:$Vk,84:$Vl,85:$Vm,86:$Vn},o($Vy,[2,54],{54:96,56:$Vp,57:$Vq,58:$Vr,59:$Vs}),o($Vy,[2,53]),{28:97,83:$Vk,84:$Vl,85:$Vm},{46:98,50:$VC},{27:100,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},o($Vo,[2,62],{53:[1,101]}),o($Vo,[2,64],{53:[1,103],64:[1,102]}),o($Vo,[2,68],{53:[1,104],67:[1,105]}),o($Vo,[2,72],{53:[1,107],64:[1,106]}),o($Vo,[2,76]),o($Vx,[2,11]),o($VB,[2,50]),o($VB,[2,49]),{27:108,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},o($Vy,[2,52]),o($Vo,[2,38],{45:[1,109]}),{47:[1,110]},{46:111,47:[2,42],50:$VC},o($Vo,[2,41]),o($Vo,[2,63]),o($Vo,[2,65]),o($Vo,[2,66],{64:[1,112]}),o($Vo,[2,69]),o($Vo,[2,70],{53:[1,113]}),o($Vo,[2,73]),o($Vo,[2,74],{64:[1,114]}),o($VB,[2,51]),{46:115,50:$VC},o($Vo,[2,39]),{47:[2,43]},o($Vo,[2,67]),o($Vo,[2,71]),o($Vo,[2,75]),{47:[1,116]},o($Vo,[2,40])], defaultActions: {2:[2,1],3:[2,2],4:[2,3],6:[2,9],13:[2,12],14:[2,4],20:[2,15],51:[2,14],52:[2,16],78:[2,19],111:[2,43]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0: this.begin('open_directive'); return 19; break; case 1:return 8; break; case 2:return 9; break; case 3:return 10; break; case 4:return 11; break; case 5: this.begin('type_directive'); return 20; break; case 6: this.popState(); this.begin('arg_directive'); return 17; break; case 7: this.popState(); this.popState(); return 22; break; case 8:return 21; break; case 9:/* skip comments */ break; case 10:/* skip comments */ break; case 11: this.begin("acc_title");return 38; break; case 12: this.popState(); return "acc_title_value"; break; case 13: this.begin("acc_descr");return 40; break; case 14: this.popState(); return "acc_descr_value"; break; case 15: this.begin("acc_descr_multiline"); break; case 16: this.popState(); break; case 17:return "acc_descr_multiline_value"; break; case 18:return 16; break; case 19:/* skip whitespace */ break; case 20:return 23; break; case 21:return 23; break; case 22: this.begin("struct"); /*console.log('Starting struct');*/ return 45; break; case 23:return "EOF_IN_STRUCT"; break; case 24:return "OPEN_IN_STRUCT"; break; case 25: /*console.log('Ending struct');*/this.popState(); return 47; break; case 26:/* nothing */ break; case 27: /*console.log('lex-member: ' + yy_.yytext);*/ return "MEMBER"; break; case 28:return 43; break; case 29:return 69; break; case 30:return 62; break; case 31:return 63; break; case 32:return 65; break; case 33:return 48; break; case 34:return 49; break; case 35:this.begin("generic"); break; case 36:this.popState(); break; case 37:return "GENERICTYPE"; break; case 38:this.begin("string"); break; case 39:this.popState(); break; case 40:return "STR"; break; case 41:this.begin("bqstring"); break; case 42:this.popState(); break; case 43:return "BQUOTE_STR"; break; case 44:this.begin("href"); break; case 45:this.popState(); break; case 46:return 68; break; case 47:this.begin("callback_name"); break; case 48:this.popState(); break; case 49:this.popState(); this.begin("callback_args"); break; case 50:return 66; break; case 51:this.popState(); break; case 52:return 67; break; case 53:return 64; break; case 54:return 64; break; case 55:return 64; break; case 56:return 64; break; case 57:return 57; break; case 58:return 57; break; case 59:return 59; break; case 60:return 59; break; case 61:return 58; break; case 62:return 56; break; case 63:return 60; break; case 64:return 61; break; case 65:return 32; break; case 66:return 44; break; case 67:return 81; break; case 68:return 'DOT'; break; case 69:return 'PLUS'; break; case 70:return 78; break; case 71:return 'EQUALS'; break; case 72:return 'EQUALS'; break; case 73:return 85; break; case 74:return 'PUNCTUATION'; break; case 75:return 84; break; case 76:return 83; break; case 77:return 80; break; case 78:return 25; break; } }, rules: [/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:[{])/,/^(?:$)/,/^(?:[{])/,/^(?:[}])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:class\b)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:[~])/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[`])/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\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)/,/^(?:$)/], conditions: {"acc_descr_multiline":{"rules":[16,17],"inclusive":false},"acc_descr":{"rules":[14],"inclusive":false},"acc_title":{"rules":[12],"inclusive":false},"arg_directive":{"rules":[7,8],"inclusive":false},"type_directive":{"rules":[6,7],"inclusive":false},"open_directive":{"rules":[5],"inclusive":false},"callback_args":{"rules":[51,52],"inclusive":false},"callback_name":{"rules":[48,49,50],"inclusive":false},"href":{"rules":[45,46],"inclusive":false},"struct":{"rules":[23,24,25,26,27],"inclusive":false},"generic":{"rules":[36,37],"inclusive":false},"bqstring":{"rules":[42,43],"inclusive":false},"string":{"rules":[39,40],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,28,29,30,31,32,33,34,35,38,41,44,47,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],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?35ed").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./src/diagrams/er/parser/erDiagram.jison": /*!************************************************!*\ !*** ./src/diagrams/er/parser/erDiagram.jison ***! \************************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var 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,23,25,27,29,30,49],$V3=[1,17],$V4=[1,18],$V5=[1,19],$V6=[1,20],$V7=[1,21],$V8=[1,24],$V9=[1,29],$Va=[1,30],$Vb=[1,31],$Vc=[1,32],$Vd=[6,9,11,15,20,23,25,27,29,30,42,43,44,45,49],$Ve=[1,45],$Vf=[30,46,47],$Vg=[4,6,9,11,23,25,27,29,30,49],$Vh=[42,43,44,45],$Vi=[22,37],$Vj=[1,64]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"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,"BLOCK_START":20,"attributes":21,"BLOCK_STOP":22,"title":23,"title_value":24,"acc_title":25,"acc_title_value":26,"acc_descr":27,"acc_descr_value":28,"acc_descr_multiline_value":29,"ALPHANUM":30,".":31,"attribute":32,"attributeType":33,"attributeName":34,"attributeKeyType":35,"attributeComment":36,"ATTRIBUTE_WORD":37,"ATTRIBUTE_KEY":38,"COMMENT":39,"cardinality":40,"relType":41,"ZERO_OR_ONE":42,"ZERO_OR_MORE":43,"ONE_OR_MORE":44,"ONLY_ONE":45,"NON_IDENTIFYING":46,"IDENTIFYING":47,"WORD":48,"open_directive":49,"type_directive":50,"arg_directive":51,"close_directive":52,"$accept":0,"$end":1}, terminals_: {2:"error",4:"ER_DIAGRAM",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",20:"BLOCK_START",22:"BLOCK_STOP",23:"title",24:"title_value",25:"acc_title",26:"acc_title_value",27:"acc_descr",28:"acc_descr_value",29:"acc_descr_multiline_value",30:"ALPHANUM",31:".",37:"ATTRIBUTE_WORD",38:"ATTRIBUTE_KEY",39:"COMMENT",42:"ZERO_OR_ONE",43:"ZERO_OR_MORE",44:"ONE_OR_MORE",45:"ONLY_ONE",46:"NON_IDENTIFYING",47:"IDENTIFYING",48:"WORD",49:"open_directive",50:"type_directive",51:"arg_directive",52:"close_directive"}, productions_: [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,4],[10,3],[10,1],[10,2],[10,2],[10,2],[10,1],[17,1],[17,3],[21,1],[21,2],[32,2],[32,3],[32,3],[32,4],[33,1],[34,1],[35,1],[36,1],[18,3],[40,1],[40,1],[40,1],[40,1],[41,1],[41,1],[19,1],[19,1],[12,1],[13,1],[16,1],[14,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 1: /*console.log('finished parsing');*/ break; case 3: this.$ = [] break; case 4: $$[$0-1].push($$[$0]);this.$ = $$[$0-1] break; case 5: case 6: this.$ = $$[$0] break; case 7: case 8: this.$=[]; break; case 12: yy.addEntity($$[$0-4]); yy.addEntity($$[$0-2]); yy.addRelationship($$[$0-4], $$[$0], $$[$0-2], $$[$0-3]); /*console.log($$[$0-4] + $$[$0-3] + $$[$0-2] + ':' + $$[$0]);*/ break; case 13: /* console.log('detected block'); */ yy.addEntity($$[$0-3]); yy.addAttributes($$[$0-3], $$[$0-1]); /* console.log('handled block'); */ break; case 14: yy.addEntity($$[$0-2]); break; case 15: yy.addEntity($$[$0]); break; case 16: case 17: this.$=$$[$0].trim();yy.setAccTitle(this.$); break; case 18: case 19: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 20: this.$ = $$[$0]; /*console.log('Entity: ' + $$[$0]);*/ break; case 21: this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; break; case 22: this.$ = [$$[$0]]; break; case 23: $$[$0].push($$[$0-1]); this.$=$$[$0]; break; case 24: this.$ = { attributeType: $$[$0-1], attributeName: $$[$0] }; break; case 25: this.$ = { attributeType: $$[$0-2], attributeName: $$[$0-1], attributeKeyType: $$[$0] }; break; case 26: this.$ = { attributeType: $$[$0-2], attributeName: $$[$0-1], attributeComment: $$[$0] }; break; case 27: this.$ = { attributeType: $$[$0-3], attributeName: $$[$0-2], attributeKeyType: $$[$0-1], attributeComment: $$[$0] }; break; case 28: case 29: case 30: this.$=$$[$0]; break; case 31: this.$=$$[$0].replace(/"/g, ''); break; case 32: this.$ = { cardA: $$[$0], relType: $$[$0-1], cardB: $$[$0-2] }; /*console.log('relSpec: ' + $$[$0] + $$[$0-1] + $$[$0-2]);*/ break; case 33: this.$ = yy.Cardinality.ZERO_OR_ONE; break; case 34: this.$ = yy.Cardinality.ZERO_OR_MORE; break; case 35: this.$ = yy.Cardinality.ONE_OR_MORE; break; case 36: this.$ = yy.Cardinality.ONLY_ONE; break; case 37: this.$ = yy.Identification.NON_IDENTIFYING; break; case 38: this.$ = yy.Identification.IDENTIFYING; break; case 39: this.$ = $$[$0].replace(/"/g, ''); break; case 40: this.$ = $$[$0]; break; case 41: yy.parseDirective('%%{', 'open_directive'); break; case 42: yy.parseDirective($$[$0], 'type_directive'); break; case 43: $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive'); break; case 44: yy.parseDirective('}%%', 'close_directive', 'er'); break; } }, table: [{3:1,4:$V0,7:3,12:4,49:$V1},{1:[3]},o($V2,[2,3],{5:6}),{3:7,4:$V0,7:3,12:4,49:$V1},{13:8,50:[1,9]},{50:[2,41]},{6:[1,10],7:15,8:11,9:[1,12],10:13,11:[1,14],12:4,17:16,23:$V3,25:$V4,27:$V5,29:$V6,30:$V7,49:$V1},{1:[2,2]},{14:22,15:[1,23],52:$V8},o([15,52],[2,42]),o($V2,[2,8],{1:[2,1]}),o($V2,[2,4]),{7:15,10:25,12:4,17:16,23:$V3,25:$V4,27:$V5,29:$V6,30:$V7,49:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,11]),o($V2,[2,15],{18:26,40:28,20:[1,27],42:$V9,43:$Va,44:$Vb,45:$Vc}),{24:[1,33]},{26:[1,34]},{28:[1,35]},o($V2,[2,19]),o($Vd,[2,20],{31:[1,36]}),{11:[1,37]},{16:38,51:[1,39]},{11:[2,44]},o($V2,[2,5]),{17:40,30:$V7},{21:41,22:[1,42],32:43,33:44,37:$Ve},{41:46,46:[1,47],47:[1,48]},o($Vf,[2,33]),o($Vf,[2,34]),o($Vf,[2,35]),o($Vf,[2,36]),o($V2,[2,16]),o($V2,[2,17]),o($V2,[2,18]),{17:49,30:$V7},o($Vg,[2,9]),{14:50,52:$V8},{52:[2,43]},{15:[1,51]},{22:[1,52]},o($V2,[2,14]),{21:53,22:[2,22],32:43,33:44,37:$Ve},{34:54,37:[1,55]},{37:[2,28]},{40:56,42:$V9,43:$Va,44:$Vb,45:$Vc},o($Vh,[2,37]),o($Vh,[2,38]),o($Vd,[2,21]),{11:[1,57]},{19:58,30:[1,60],48:[1,59]},o($V2,[2,13]),{22:[2,23]},o($Vi,[2,24],{35:61,36:62,38:[1,63],39:$Vj}),o([22,37,38,39],[2,29]),{30:[2,32]},o($Vg,[2,10]),o($V2,[2,12]),o($V2,[2,39]),o($V2,[2,40]),o($Vi,[2,25],{36:65,39:$Vj}),o($Vi,[2,26]),o([22,37,39],[2,30]),o($Vi,[2,31]),o($Vi,[2,27])], defaultActions: {5:[2,41],7:[2,2],24:[2,44],39:[2,43],45:[2,28],53:[2,23],56:[2,32]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {"case-insensitive":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0: this.begin("acc_title");return 25; break; case 1: this.popState(); return "acc_title_value"; break; case 2: this.begin("acc_descr");return 27; break; case 3: this.popState(); return "acc_descr_value"; break; case 4: this.begin("acc_descr_multiline"); break; case 5: this.popState(); break; case 6:return "acc_descr_multiline_value"; break; case 7: this.begin('open_directive'); return 49; break; case 8: this.begin('type_directive'); return 50; break; case 9: this.popState(); this.begin('arg_directive'); return 15; break; case 10: this.popState(); this.popState(); return 52; break; case 11:return 51; break; case 12:/* skip comments */ break; case 13:/* skip comments */ break; case 14:return 11; break; case 15:/* skip whitespace */ break; case 16:return 9; break; case 17:return 48; break; case 18:return 4; break; case 19: this.begin("block"); return 20; break; case 20:/* skip whitespace in block */ break; case 21:return 38 break; case 22:return 37 break; case 23:return 39; break; case 24:/* nothing */ break; case 25: this.popState(); return 22; break; case 26:return yy_.yytext[0]; break; case 27:return 42; break; case 28:return 43; break; case 29:return 44; break; case 30:return 45; break; case 31:return 42; break; case 32:return 43; break; case 33:return 44; break; case 34:return 46; break; case 35:return 47; break; case 36:return 46; break; case 37:return 46; break; case 38:return 30; break; case 39:return yy_.yytext[0]; break; case 40:return 6; break; } }, rules: [/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK))\b)/i,/^(?:[A-Za-z][A-Za-z0-9\-_]*)/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/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], conditions: {"acc_descr_multiline":{"rules":[5,6],"inclusive":false},"acc_descr":{"rules":[3],"inclusive":false},"acc_title":{"rules":[1],"inclusive":false},"open_directive":{"rules":[8],"inclusive":false},"type_directive":{"rules":[9,10],"inclusive":false},"arg_directive":{"rules":[10,11],"inclusive":false},"block":{"rules":[20,21,22,23,24,25,26],"inclusive":false},"INITIAL":{"rules":[0,2,4,7,12,13,14,15,16,17,18,19,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?3c87").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./src/diagrams/flowchart/parser/flow.jison": /*!**************************************************!*\ !*** ./src/diagrams/flowchart/parser/flow.jison ***! \**************************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var 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,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$V5=[2,10],$V6=[1,20],$V7=[1,21],$V8=[1,22],$V9=[1,23],$Va=[1,30],$Vb=[1,32],$Vc=[1,33],$Vd=[1,34],$Ve=[1,62],$Vf=[1,48],$Vg=[1,52],$Vh=[1,36],$Vi=[1,37],$Vj=[1,38],$Vk=[1,39],$Vl=[1,40],$Vm=[1,56],$Vn=[1,63],$Vo=[1,51],$Vp=[1,53],$Vq=[1,55],$Vr=[1,59],$Vs=[1,60],$Vt=[1,41],$Vu=[1,42],$Vv=[1,43],$Vw=[1,44],$Vx=[1,61],$Vy=[1,50],$Vz=[1,54],$VA=[1,57],$VB=[1,58],$VC=[1,49],$VD=[1,66],$VE=[1,71],$VF=[1,20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$VG=[1,75],$VH=[1,74],$VI=[1,76],$VJ=[20,21,23,81,82],$VK=[1,99],$VL=[1,104],$VM=[1,107],$VN=[1,108],$VO=[1,101],$VP=[1,106],$VQ=[1,109],$VR=[1,102],$VS=[1,114],$VT=[1,113],$VU=[1,103],$VV=[1,105],$VW=[1,110],$VX=[1,111],$VY=[1,112],$VZ=[1,115],$V_=[20,21,22,23,81,82],$V$=[20,21,22,23,53,81,82],$V01=[20,21,22,23,40,52,53,55,57,59,61,63,65,66,67,69,71,73,74,76,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],$V11=[20,21,23],$V21=[20,21,23,52,66,67,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],$V31=[1,12,20,21,22,23,24,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$V41=[52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],$V51=[1,149],$V61=[1,157],$V71=[1,158],$V81=[1,159],$V91=[1,160],$Va1=[1,144],$Vb1=[1,145],$Vc1=[1,141],$Vd1=[1,152],$Ve1=[1,153],$Vf1=[1,154],$Vg1=[1,155],$Vh1=[1,156],$Vi1=[1,161],$Vj1=[1,162],$Vk1=[1,147],$Vl1=[1,150],$Vm1=[1,146],$Vn1=[1,143],$Vo1=[20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$Vp1=[1,165],$Vq1=[20,21,22,23,26,52,66,67,91,105,106,109,111,112,122,123,124,125,126,127],$Vr1=[20,21,22,23,24,26,38,40,41,42,52,56,58,60,62,64,66,67,68,70,72,73,75,77,81,82,86,87,88,89,90,91,92,95,105,106,109,111,112,113,114,122,123,124,125,126,127],$Vs1=[12,21,22,24],$Vt1=[22,106],$Vu1=[1,250],$Vv1=[1,245],$Vw1=[1,246],$Vx1=[1,254],$Vy1=[1,251],$Vz1=[1,248],$VA1=[1,247],$VB1=[1,249],$VC1=[1,252],$VD1=[1,253],$VE1=[1,255],$VF1=[1,273],$VG1=[20,21,23,106],$VH1=[20,21,22,23,66,67,86,102,105,106,109,110,111,112,113]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"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,"direction":43,"acc_title":44,"acc_title_value":45,"acc_descr":46,"acc_descr_value":47,"acc_descr_multiline_value":48,"link":49,"node":50,"vertex":51,"AMP":52,"STYLE_SEPARATOR":53,"idString":54,"DOUBLECIRCLESTART":55,"DOUBLECIRCLEEND":56,"PS":57,"PE":58,"(-":59,"-)":60,"STADIUMSTART":61,"STADIUMEND":62,"SUBROUTINESTART":63,"SUBROUTINEEND":64,"VERTEX_WITH_PROPS_START":65,"ALPHA":66,"COLON":67,"PIPE":68,"CYLINDERSTART":69,"CYLINDEREND":70,"DIAMOND_START":71,"DIAMOND_STOP":72,"TAGEND":73,"TRAPSTART":74,"TRAPEND":75,"INVTRAPSTART":76,"INVTRAPEND":77,"linkStatement":78,"arrowText":79,"TESTSTR":80,"START_LINK":81,"LINK":82,"textToken":83,"STR":84,"keywords":85,"STYLE":86,"LINKSTYLE":87,"CLASSDEF":88,"CLASS":89,"CLICK":90,"DOWN":91,"UP":92,"textNoTags":93,"textNoTagsToken":94,"DEFAULT":95,"stylesOpt":96,"alphaNum":97,"CALLBACKNAME":98,"CALLBACKARGS":99,"HREF":100,"LINK_TARGET":101,"HEX":102,"numList":103,"INTERPOLATE":104,"NUM":105,"COMMA":106,"style":107,"styleComponent":108,"MINUS":109,"UNIT":110,"BRKT":111,"DOT":112,"PCT":113,"TAGSTART":114,"alphaNumToken":115,"idStringToken":116,"alphaNumStatement":117,"direction_tb":118,"direction_bt":119,"direction_rl":120,"direction_lr":121,"PUNCTUATION":122,"UNICODE_TEXT":123,"PLUS":124,"EQUALS":125,"MULT":126,"UNDERSCORE":127,"graphCodeTokens":128,"ARROW_CROSS":129,"ARROW_POINT":130,"ARROW_CIRCLE":131,"ARROW_OPEN":132,"QUOTE":133,"$accept":0,"$end":1}, terminals_: {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",44:"acc_title",45:"acc_title_value",46:"acc_descr",47:"acc_descr_value",48:"acc_descr_multiline_value",52:"AMP",53:"STYLE_SEPARATOR",55:"DOUBLECIRCLESTART",56:"DOUBLECIRCLEEND",57:"PS",58:"PE",59:"(-",60:"-)",61:"STADIUMSTART",62:"STADIUMEND",63:"SUBROUTINESTART",64:"SUBROUTINEEND",65:"VERTEX_WITH_PROPS_START",66:"ALPHA",67:"COLON",68:"PIPE",69:"CYLINDERSTART",70:"CYLINDEREND",71:"DIAMOND_START",72:"DIAMOND_STOP",73:"TAGEND",74:"TRAPSTART",75:"TRAPEND",76:"INVTRAPSTART",77:"INVTRAPEND",80:"TESTSTR",81:"START_LINK",82:"LINK",84:"STR",86:"STYLE",87:"LINKSTYLE",88:"CLASSDEF",89:"CLASS",90:"CLICK",91:"DOWN",92:"UP",95:"DEFAULT",98:"CALLBACKNAME",99:"CALLBACKARGS",100:"HREF",101:"LINK_TARGET",102:"HEX",104:"INTERPOLATE",105:"NUM",106:"COMMA",109:"MINUS",110:"UNIT",111:"BRKT",112:"DOT",113:"PCT",114:"TAGSTART",118:"direction_tb",119:"direction_bt",120:"direction_rl",121:"direction_lr",122:"PUNCTUATION",123:"UNICODE_TEXT",124:"PLUS",125:"EQUALS",126:"MULT",127:"UNDERSCORE",129:"ARROW_CROSS",130:"ARROW_POINT",131:"ARROW_CIRCLE",132:"ARROW_OPEN",133:"QUOTE"}, productions_: [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],[19,1],[19,2],[19,2],[19,1],[9,1],[9,1],[9,1],[32,3],[32,4],[32,2],[32,1],[50,1],[50,5],[50,3],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,8],[51,4],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,4],[51,4],[51,1],[49,2],[49,3],[49,3],[49,1],[49,3],[78,1],[79,3],[39,1],[39,2],[39,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[93,1],[93,2],[35,5],[35,5],[36,5],[37,2],[37,4],[37,3],[37,5],[37,2],[37,4],[37,4],[37,6],[37,2],[37,4],[37,2],[37,4],[37,4],[37,6],[33,5],[33,5],[34,5],[34,5],[34,9],[34,9],[34,7],[34,7],[103,1],[103,3],[96,1],[96,3],[107,1],[107,2],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[94,1],[94,1],[94,1],[94,1],[54,1],[54,2],[97,1],[97,2],[117,1],[117,1],[117,1],[117,1],[43,1],[43,1],[43,1],[43,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 5: yy.parseDirective('%%{', 'open_directive'); break; case 6: yy.parseDirective($$[$0], 'type_directive'); break; case 7: $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive'); break; case 8: yy.parseDirective('}%%', 'close_directive', 'flowchart'); break; case 10: this.$ = []; break; case 11: if($$[$0] !== []){ $$[$0-1].push($$[$0]); } this.$=$$[$0-1]; break; case 12: case 82: case 84: case 96: case 152: case 154: case 155: this.$=$$[$0]; break; case 19: yy.setDirection('TB');this.$ = 'TB'; break; case 20: yy.setDirection($$[$0-1]);this.$ = $$[$0-1]; break; case 35: /* console.warn('finat vs', $$[$0-1].nodes); */ this.$=$$[$0-1].nodes break; case 36: case 37: case 38: case 39: case 40: this.$=[]; break; case 41: this.$=yy.addSubGraph($$[$0-6],$$[$0-1],$$[$0-4]); break; case 42: this.$=yy.addSubGraph($$[$0-3],$$[$0-1],$$[$0-3]); break; case 43: this.$=yy.addSubGraph(undefined,$$[$0-1],undefined); break; case 45: this.$=$$[$0].trim();yy.setAccTitle(this.$); break; case 46: case 47: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 51: /* console.warn('vs',$$[$0-2].stmt,$$[$0]); */ yy.addLink($$[$0-2].stmt,$$[$0],$$[$0-1]); this.$ = { stmt: $$[$0], nodes: $$[$0].concat($$[$0-2].nodes) } break; case 52: /* 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) } break; case 53: /*console.warn('noda', $$[$0-1]);*/ this.$ = {stmt: $$[$0-1], nodes:$$[$0-1] } break; case 54: /*console.warn('noda', $$[$0]);*/ this.$ = {stmt: $$[$0], nodes:$$[$0] } break; case 55: /* console.warn('nod', $$[$0]); */ this.$ = [$$[$0]]; break; case 56: this.$ = $$[$0-4].concat($$[$0]); /* console.warn('pip', $$[$0-4][0], $$[$0], this.$); */ break; case 57: this.$ = [$$[$0-2]];yy.setClass($$[$0-2],$$[$0]) break; case 58: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'square'); break; case 59: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'doublecircle'); break; case 60: this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'circle'); break; case 61: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'ellipse'); break; case 62: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'stadium'); break; case 63: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'subroutine'); break; case 64: this.$ = $$[$0-7];yy.addVertex($$[$0-7],$$[$0-1],'rect',undefined,undefined,undefined, Object.fromEntries([[$$[$0-5], $$[$0-3]]])); break; case 65: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'cylinder'); break; case 66: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'round'); break; case 67: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'diamond'); break; case 68: this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'hexagon'); break; case 69: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'odd'); break; case 70: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'trapezoid'); break; case 71: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'inv_trapezoid'); break; case 72: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_right'); break; case 73: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_left'); break; case 74: /*console.warn('h: ', $$[$0]);*/this.$ = $$[$0];yy.addVertex($$[$0]); break; case 75: $$[$0-1].text = $$[$0];this.$ = $$[$0-1]; break; case 76: case 77: $$[$0-2].text = $$[$0-1];this.$ = $$[$0-2]; break; case 78: this.$ = $$[$0]; break; case 79: var inf = yy.destructLink($$[$0], $$[$0-2]); this.$ = {"type":inf.type,"stroke":inf.stroke,"length":inf.length,"text":$$[$0-1]}; break; case 80: var inf = yy.destructLink($$[$0]);this.$ = {"type":inf.type,"stroke":inf.stroke,"length":inf.length}; break; case 81: this.$ = $$[$0-1]; break; case 83: case 97: case 153: this.$=$$[$0-1]+''+$$[$0]; break; case 98: case 99: this.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]); break; case 100: this.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]); break; case 101: case 109: this.$ = $$[$0-1];yy.setClickEvent($$[$0-1], $$[$0]); break; case 102: case 110: this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-3], $$[$0]); break; case 103: this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]); break; case 104: this.$ = $$[$0-4];yy.setClickEvent($$[$0-4], $$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-4], $$[$0]); break; case 105: case 111: this.$ = $$[$0-1];yy.setLink($$[$0-1], $$[$0]); break; case 106: case 112: this.$ = $$[$0-3];yy.setLink($$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-3], $$[$0]); break; case 107: case 113: this.$ = $$[$0-3];yy.setLink($$[$0-3], $$[$0-2], $$[$0]); break; case 108: case 114: this.$ = $$[$0-5];yy.setLink($$[$0-5], $$[$0-4], $$[$0]);yy.setTooltip($$[$0-5], $$[$0-2]); break; case 115: this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]); break; case 116: case 118: this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]); break; case 117: this.$ = $$[$0-4];yy.updateLink([$$[$0-2]],$$[$0]); break; case 119: this.$ = $$[$0-8];yy.updateLinkInterpolate([$$[$0-6]],$$[$0-2]);yy.updateLink([$$[$0-6]],$$[$0]); break; case 120: this.$ = $$[$0-8];yy.updateLinkInterpolate($$[$0-6],$$[$0-2]);yy.updateLink($$[$0-6],$$[$0]); break; case 121: this.$ = $$[$0-6];yy.updateLinkInterpolate([$$[$0-4]],$$[$0]); break; case 122: this.$ = $$[$0-6];yy.updateLinkInterpolate($$[$0-4],$$[$0]); break; case 123: case 125: this.$ = [$$[$0]] break; case 124: case 126: $$[$0-2].push($$[$0]);this.$ = $$[$0-2]; break; case 128: this.$ = $$[$0-1] + $$[$0]; break; case 150: this.$=$$[$0] break; case 151: this.$=$$[$0-1]+''+$$[$0] break; case 156: this.$='v'; break; case 157: this.$='-'; break; case 158: this.$={stmt:'dir', value:'TB'}; break; case 159: this.$={stmt:'dir', value:'BT'}; break; case 160: this.$={stmt:'dir', value:'RL'}; break; case 161: this.$={stmt:'dir', value:'LR'}; break; } }, table: [{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,43:31,44:$Vb,46:$Vc,48:$Vd,50:35,51:45,52:$Ve,54:46,66:$Vf,67:$Vg,86:$Vh,87:$Vi,88:$Vj,89:$Vk,90:$Vl,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,118:$Vt,119:$Vu,120:$Vv,121:$Vw,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},{8:64,10:[1,65],15:$VD},o([10,15],[2,6]),o($V4,[2,17]),o($V4,[2,18]),o($V4,[2,19]),{20:[1,68],21:[1,69],22:$VE,27:67,30:70},o($VF,[2,11]),o($VF,[2,12]),o($VF,[2,13]),o($VF,[2,14]),o($VF,[2,15]),o($VF,[2,16]),{9:72,20:$VG,21:$VH,23:$VI,49:73,78:77,81:[1,78],82:[1,79]},{9:80,20:$VG,21:$VH,23:$VI},{9:81,20:$VG,21:$VH,23:$VI},{9:82,20:$VG,21:$VH,23:$VI},{9:83,20:$VG,21:$VH,23:$VI},{9:84,20:$VG,21:$VH,23:$VI},{9:86,20:$VG,21:$VH,22:[1,85],23:$VI},o($VF,[2,44]),{45:[1,87]},{47:[1,88]},o($VF,[2,47]),o($VJ,[2,54],{30:89,22:$VE}),{22:[1,90]},{22:[1,91]},{22:[1,92]},{22:[1,93]},{26:$VK,52:$VL,66:$VM,67:$VN,84:[1,97],91:$VO,97:96,98:[1,94],100:[1,95],105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($VF,[2,158]),o($VF,[2,159]),o($VF,[2,160]),o($VF,[2,161]),o($V_,[2,55],{53:[1,116]}),o($V$,[2,74],{116:129,40:[1,117],52:$Ve,55:[1,118],57:[1,119],59:[1,120],61:[1,121],63:[1,122],65:[1,123],66:$Vf,67:$Vg,69:[1,124],71:[1,125],73:[1,126],74:[1,127],76:[1,128],91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC}),o($V01,[2,150]),o($V01,[2,175]),o($V01,[2,176]),o($V01,[2,177]),o($V01,[2,178]),o($V01,[2,179]),o($V01,[2,180]),o($V01,[2,181]),o($V01,[2,182]),o($V01,[2,183]),o($V01,[2,184]),o($V01,[2,185]),o($V01,[2,186]),o($V01,[2,187]),o($V01,[2,188]),o($V01,[2,189]),o($V01,[2,190]),{9:130,20:$VG,21:$VH,23:$VI},{11:131,14:[1,132]},o($V11,[2,8]),o($V4,[2,20]),o($V4,[2,26]),o($V4,[2,27]),{21:[1,133]},o($V21,[2,34],{30:134,22:$VE}),o($VF,[2,35]),{50:135,51:45,52:$Ve,54:46,66:$Vf,67:$Vg,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},o($V31,[2,48]),o($V31,[2,49]),o($V31,[2,50]),o($V41,[2,78],{79:136,68:[1,138],80:[1,137]}),{22:$V51,24:$V61,26:$V71,38:$V81,39:139,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o([52,66,67,68,80,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,80]),o($VF,[2,36]),o($VF,[2,37]),o($VF,[2,38]),o($VF,[2,39]),o($VF,[2,40]),{22:$V51,24:$V61,26:$V71,38:$V81,39:163,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($Vo1,$V5,{17:164}),o($VF,[2,45]),o($VF,[2,46]),o($VJ,[2,53],{52:$Vp1}),{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,97:166,102:[1,167],105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{95:[1,168],103:169,105:[1,170]},{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,95:[1,171],97:172,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,97:173,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V11,[2,101],{22:[1,174],99:[1,175]}),o($V11,[2,105],{22:[1,176]}),o($V11,[2,109],{115:100,117:178,22:[1,177],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ}),o($V11,[2,111],{22:[1,179]}),o($Vq1,[2,152]),o($Vq1,[2,154]),o($Vq1,[2,155]),o($Vq1,[2,156]),o($Vq1,[2,157]),o($Vr1,[2,162]),o($Vr1,[2,163]),o($Vr1,[2,164]),o($Vr1,[2,165]),o($Vr1,[2,166]),o($Vr1,[2,167]),o($Vr1,[2,168]),o($Vr1,[2,169]),o($Vr1,[2,170]),o($Vr1,[2,171]),o($Vr1,[2,172]),o($Vr1,[2,173]),o($Vr1,[2,174]),{52:$Ve,54:180,66:$Vf,67:$Vg,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},{22:$V51,24:$V61,26:$V71,38:$V81,39:181,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:182,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:184,42:$V91,52:$VL,57:[1,183],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:185,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:186,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:187,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{66:[1,188]},{22:$V51,24:$V61,26:$V71,38:$V81,39:189,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:190,42:$V91,52:$VL,66:$VM,67:$VN,71:[1,191],73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:192,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:193,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:194,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V01,[2,151]),o($Vs1,[2,3]),{8:195,15:$VD},{15:[2,7]},o($V4,[2,28]),o($V21,[2,33]),o($VJ,[2,51],{30:196,22:$VE}),o($V41,[2,75],{22:[1,197]}),{22:[1,198]},{22:$V51,24:$V61,26:$V71,38:$V81,39:199,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,82:[1,200],83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($Vr1,[2,82]),o($Vr1,[2,84]),o($Vr1,[2,140]),o($Vr1,[2,141]),o($Vr1,[2,142]),o($Vr1,[2,143]),o($Vr1,[2,144]),o($Vr1,[2,145]),o($Vr1,[2,146]),o($Vr1,[2,147]),o($Vr1,[2,148]),o($Vr1,[2,149]),o($Vr1,[2,85]),o($Vr1,[2,86]),o($Vr1,[2,87]),o($Vr1,[2,88]),o($Vr1,[2,89]),o($Vr1,[2,90]),o($Vr1,[2,91]),o($Vr1,[2,92]),o($Vr1,[2,93]),o($Vr1,[2,94]),o($Vr1,[2,95]),{9:203,20:$VG,21:$VH,22:$V51,23:$VI,24:$V61,26:$V71,38:$V81,40:[1,202],42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{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,204],43:31,44:$Vb,46:$Vc,48:$Vd,50:35,51:45,52:$Ve,54:46,66:$Vf,67:$Vg,86:$Vh,87:$Vi,88:$Vj,89:$Vk,90:$Vl,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,118:$Vt,119:$Vu,120:$Vv,121:$Vw,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},{22:$VE,30:205},{22:[1,206],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:178,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:[1,207]},{22:[1,208]},{22:[1,209],106:[1,210]},o($Vt1,[2,123]),{22:[1,211]},{22:[1,212],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:178,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:[1,213],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:178,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{84:[1,214]},o($V11,[2,103],{22:[1,215]}),{84:[1,216],101:[1,217]},{84:[1,218]},o($Vq1,[2,153]),{84:[1,219],101:[1,220]},o($V_,[2,57],{116:129,52:$Ve,66:$Vf,67:$Vg,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC}),{22:$V51,24:$V61,26:$V71,38:$V81,41:[1,221],42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,56:[1,222],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:223,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,58:[1,224],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,60:[1,225],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,62:[1,226],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,64:[1,227],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{67:[1,228]},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,70:[1,229],73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,72:[1,230],73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:231,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,41:[1,232],42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,75:[1,233],77:[1,234],81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,75:[1,236],77:[1,235],81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{9:237,20:$VG,21:$VH,23:$VI},o($VJ,[2,52],{52:$Vp1}),o($V41,[2,77]),o($V41,[2,76]),{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,68:[1,238],73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V41,[2,79]),o($Vr1,[2,83]),{22:$V51,24:$V61,26:$V71,38:$V81,39:239,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($Vo1,$V5,{17:240}),o($VF,[2,43]),{51:241,52:$Ve,54:46,66:$Vf,67:$Vg,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:242,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:256,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:257,102:$Vy1,104:[1,258],105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:259,102:$Vy1,104:[1,260],105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{105:[1,261]},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:262,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:263,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,97:264,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V11,[2,102]),{84:[1,265]},o($V11,[2,106],{22:[1,266]}),o($V11,[2,107]),o($V11,[2,110]),o($V11,[2,112],{22:[1,267]}),o($V11,[2,113]),o($V$,[2,58]),o($V$,[2,59]),{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,58:[1,268],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V$,[2,66]),o($V$,[2,61]),o($V$,[2,62]),o($V$,[2,63]),{66:[1,269]},o($V$,[2,65]),o($V$,[2,67]),{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,72:[1,270],73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V$,[2,69]),o($V$,[2,70]),o($V$,[2,72]),o($V$,[2,71]),o($V$,[2,73]),o($Vs1,[2,4]),o([22,52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,81]),{22:$V51,24:$V61,26:$V71,38:$V81,41:[1,271],42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{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,272],43:31,44:$Vb,46:$Vc,48:$Vd,50:35,51:45,52:$Ve,54:46,66:$Vf,67:$Vg,86:$Vh,87:$Vi,88:$Vj,89:$Vk,90:$Vl,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,118:$Vt,119:$Vu,120:$Vv,121:$Vw,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},o($V_,[2,56]),o($V11,[2,115],{106:$VF1}),o($VG1,[2,125],{108:274,22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,102:$Vy1,105:$Vz1,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1}),o($VH1,[2,127]),o($VH1,[2,129]),o($VH1,[2,130]),o($VH1,[2,131]),o($VH1,[2,132]),o($VH1,[2,133]),o($VH1,[2,134]),o($VH1,[2,135]),o($VH1,[2,136]),o($VH1,[2,137]),o($VH1,[2,138]),o($VH1,[2,139]),o($V11,[2,116],{106:$VF1}),o($V11,[2,117],{106:$VF1}),{22:[1,275]},o($V11,[2,118],{106:$VF1}),{22:[1,276]},o($Vt1,[2,124]),o($V11,[2,98],{106:$VF1}),o($V11,[2,99],{106:$VF1}),o($V11,[2,100],{115:100,117:178,26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ}),o($V11,[2,104]),{101:[1,277]},{101:[1,278]},{58:[1,279]},{68:[1,280]},{72:[1,281]},{9:282,20:$VG,21:$VH,23:$VI},o($VF,[2,42]),{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,102:$Vy1,105:$Vz1,107:283,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},o($VH1,[2,128]),{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,97:284,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,97:285,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V11,[2,108]),o($V11,[2,114]),o($V$,[2,60]),{22:$V51,24:$V61,26:$V71,38:$V81,39:286,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V$,[2,68]),o($Vo1,$V5,{17:287}),o($VG1,[2,126],{108:274,22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,102:$Vy1,105:$Vz1,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1}),o($V11,[2,121],{115:100,117:178,22:[1,288],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ}),o($V11,[2,122],{115:100,117:178,22:[1,289],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ}),{22:$V51,24:$V61,26:$V71,38:$V81,41:[1,290],42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{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,291],43:31,44:$Vb,46:$Vc,48:$Vd,50:35,51:45,52:$Ve,54:46,66:$Vf,67:$Vg,86:$Vh,87:$Vi,88:$Vj,89:$Vk,90:$Vl,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,118:$Vt,119:$Vu,120:$Vv,121:$Vw,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:292,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:293,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},o($V$,[2,64]),o($VF,[2,41]),o($V11,[2,119],{106:$VF1}),o($V11,[2,120],{106:$VF1})], defaultActions: {2:[2,1],9:[2,5],10:[2,2],132:[2,7]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0: this.begin('open_directive'); return 12; break; case 1: this.begin('type_directive'); return 13; break; case 2: this.popState(); this.begin('arg_directive'); return 10; break; case 3: this.popState(); this.popState(); return 15; break; case 4:return 14; break; case 5:/* skip comments */ break; case 6:/* skip comments */ break; case 7: this.begin("acc_title");return 44; break; case 8: this.popState(); return "acc_title_value"; break; case 9: this.begin("acc_descr");return 46; break; case 10: this.popState(); return "acc_descr_value"; break; case 11: this.begin("acc_descr_multiline"); break; case 12: this.popState(); break; case 13:return "acc_descr_multiline_value"; break; case 14:this.begin("string"); break; case 15:this.popState(); break; case 16:return "STR"; break; case 17:return 86; break; case 18:return 95; break; case 19:return 87; break; case 20:return 104; break; case 21:return 88; break; case 22:return 89; break; case 23:this.begin("href"); break; case 24:this.popState(); break; case 25:return 100; break; case 26:this.begin("callbackname"); break; case 27:this.popState(); break; case 28:this.popState(); this.begin("callbackargs"); break; case 29:return 98; break; case 30:this.popState(); break; case 31:return 99; break; case 32:this.begin("click"); break; case 33:this.popState(); break; case 34:return 90; break; case 35:if(yy.lex.firstGraph()){this.begin("dir");} return 24; break; case 36:if(yy.lex.firstGraph()){this.begin("dir");} return 24; break; case 37:return 38; break; case 38:return 42; break; case 39:return 101; break; case 40:return 101; break; case 41:return 101; break; case 42:return 101; break; case 43: this.popState(); return 25; break; case 44: this.popState(); return 26; break; case 45: this.popState(); return 26; break; case 46: this.popState(); return 26; break; case 47: this.popState(); return 26; break; case 48: this.popState(); return 26; break; case 49: this.popState(); return 26; break; case 50: this.popState(); return 26; break; case 51: this.popState(); return 26; break; case 52: this.popState(); return 26; break; case 53: this.popState(); return 26; break; case 54:return 118; break; case 55:return 119; break; case 56:return 120; break; case 57:return 121; break; case 58: return 105; break; case 59:return 111; break; case 60:return 53; break; case 61:return 67; break; case 62:return 52; break; case 63:return 20; break; case 64:return 106; break; case 65:return 126; break; case 66:return 82; break; case 67:return 82; break; case 68:return 82; break; case 69:return 81; break; case 70:return 81; break; case 71:return 81; break; case 72:return 59; break; case 73:return 60; break; case 74:return 61; break; case 75:return 62; break; case 76:return 63; break; case 77:return 64; break; case 78:return 65; break; case 79:return 69; break; case 80:return 70; break; case 81:return 55; break; case 82:return 56; break; case 83:return 109; break; case 84:return 112; break; case 85:return 127; break; case 86:return 124; break; case 87:return 113; break; case 88:return 125; break; case 89:return 125; break; case 90:return 114; break; case 91:return 73; break; case 92:return 92; break; case 93:return 'SEP'; break; case 94:return 91; break; case 95:return 66; break; case 96:return 75; break; case 97:return 74; break; case 98:return 77; break; case 99:return 76; break; case 100:return 122; break; case 101:return 123; break; case 102:return 68; break; case 103:return 57; break; case 104:return 58; break; case 105:return 40; break; case 106:return 41; break; case 107:return 71 break; case 108:return 72 break; case 109:return 133; break; case 110:return 21; break; case 111:return 22; break; case 112:return 23; break; } }, rules: [/^(?:%%\{)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)[^\n]*)/,/^(?:[^\}]%%[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?: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)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:[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)/,/^(?:$)/], conditions: {"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":[30,31],"inclusive":false},"callbackname":{"rules":[27,28,29],"inclusive":false},"href":{"rules":[24,25],"inclusive":false},"click":{"rules":[33,34],"inclusive":false},"vertex":{"rules":[],"inclusive":false},"dir":{"rules":[43,44,45,46,47,48,49,50,51,52,53],"inclusive":false},"acc_descr_multiline":{"rules":[12,13],"inclusive":false},"acc_descr":{"rules":[10],"inclusive":false},"acc_title":{"rules":[8],"inclusive":false},"string":{"rules":[15,16],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,9,11,14,17,18,19,20,21,22,23,26,32,35,36,37,38,39,40,41,42,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?dbae").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./src/diagrams/gantt/parser/gantt.jison": /*!***********************************************!*\ !*** ./src/diagrams/gantt/parser/gantt.jison ***! \***********************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var 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,19,20,22,24,25,27,34,39],$V3=[1,15],$V4=[1,16],$V5=[1,17],$V6=[1,18],$V7=[1,19],$V8=[1,20],$V9=[1,21],$Va=[1,22],$Vb=[1,23],$Vc=[1,24],$Vd=[1,25],$Ve=[1,26],$Vf=[1,28],$Vg=[1,30],$Vh=[1,33],$Vi=[5,7,9,11,12,13,14,15,16,17,18,19,20,22,24,25,27,34,39]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"error":2,"start":3,"directive":4,"gantt":5,"document":6,"EOF":7,"line":8,"SPACE":9,"statement":10,"NL":11,"dateFormat":12,"inclusiveEndDates":13,"topAxis":14,"axisFormat":15,"excludes":16,"includes":17,"todayMarker":18,"title":19,"acc_title":20,"acc_title_value":21,"acc_descr":22,"acc_descr_value":23,"acc_descr_multiline_value":24,"section":25,"clickStatement":26,"taskTxt":27,"taskData":28,"openDirective":29,"typeDirective":30,"closeDirective":31,":":32,"argDirective":33,"click":34,"callbackname":35,"callbackargs":36,"href":37,"clickStatementDebug":38,"open_directive":39,"type_directive":40,"arg_directive":41,"close_directive":42,"$accept":0,"$end":1}, terminals_: {2:"error",5:"gantt",7:"EOF",9:"SPACE",11:"NL",12:"dateFormat",13:"inclusiveEndDates",14:"topAxis",15:"axisFormat",16:"excludes",17:"includes",18:"todayMarker",19:"title",20:"acc_title",21:"acc_title_value",22:"acc_descr",23:"acc_descr_value",24:"acc_descr_multiline_value",25:"section",27:"taskTxt",28:"taskData",32:":",34:"click",35:"callbackname",36:"callbackargs",37:"href",39:"open_directive",40:"type_directive",41:"arg_directive",42:"close_directive"}, productions_: [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,2],[10,1],[10,1],[10,1],[10,2],[10,1],[4,4],[4,6],[26,2],[26,3],[26,3],[26,4],[26,3],[26,4],[26,2],[38,2],[38,3],[38,3],[38,4],[38,3],[38,4],[38,2],[29,1],[30,1],[33,1],[31,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 2: return $$[$0-1]; break; case 3: this.$ = [] break; case 4: $$[$0-1].push($$[$0]);this.$ = $$[$0-1] break; case 5: case 6: this.$ = $$[$0] break; case 7: case 8: this.$=[]; break; case 9: yy.setDateFormat($$[$0].substr(11));this.$=$$[$0].substr(11); break; case 10: yy.enableInclusiveEndDates();this.$=$$[$0].substr(18); break; case 11: yy.TopAxis();this.$=$$[$0].substr(8); break; case 12: yy.setAxisFormat($$[$0].substr(11));this.$=$$[$0].substr(11); break; case 13: yy.setExcludes($$[$0].substr(9));this.$=$$[$0].substr(9); break; case 14: yy.setIncludes($$[$0].substr(9));this.$=$$[$0].substr(9); break; case 15: yy.setTodayMarker($$[$0].substr(12));this.$=$$[$0].substr(12); break; case 16: yy.setDiagramTitle($$[$0].substr(6));this.$=$$[$0].substr(6); break; case 17: this.$=$$[$0].trim();yy.setAccTitle(this.$); break; case 18: case 19: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 20: yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8); break; case 22: yy.addTask($$[$0-1],$$[$0]);this.$='task'; break; case 26: this.$ = $$[$0-1];yy.setClickEvent($$[$0-1], $$[$0], null); break; case 27: this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]); break; case 28: this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], null);yy.setLink($$[$0-2],$$[$0]); break; case 29: this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-2], $$[$0-1]);yy.setLink($$[$0-3],$$[$0]); break; case 30: this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0], null);yy.setLink($$[$0-2],$$[$0-1]); break; case 31: this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-1], $$[$0]);yy.setLink($$[$0-3],$$[$0-2]); break; case 32: this.$ = $$[$0-1];yy.setLink($$[$0-1], $$[$0]); break; case 33: case 39: this.$=$$[$0-1] + ' ' + $$[$0]; break; case 34: case 35: case 37: this.$=$$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0]; break; case 36: case 38: this.$=$$[$0-3] + ' ' + $$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0]; break; case 40: yy.parseDirective('%%{', 'open_directive'); break; case 41: yy.parseDirective($$[$0], 'type_directive'); break; case 42: $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive'); break; case 43: yy.parseDirective('}%%', 'close_directive', 'gantt'); break; } }, table: [{3:1,4:2,5:$V0,29:4,39:$V1},{1:[3]},{3:6,4:2,5:$V0,29:4,39:$V1},o($V2,[2,3],{6:7}),{30:8,40:[1,9]},{40:[2,40]},{1:[2,1]},{4:29,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:$Va,20:$Vb,22:$Vc,24:$Vd,25:$Ve,26:27,27:$Vf,29:4,34:$Vg,39:$V1},{31:31,32:[1,32],42:$Vh},o([32,42],[2,41]),o($V2,[2,8],{1:[2,2]}),o($V2,[2,4]),{4:29,10:34,12:$V3,13:$V4,14:$V5,15:$V6,16:$V7,17:$V8,18:$V9,19:$Va,20:$Vb,22:$Vc,24:$Vd,25:$Ve,26:27,27:$Vf,29:4,34:$Vg,39:$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,35]},{23:[1,36]},o($V2,[2,19]),o($V2,[2,20]),o($V2,[2,21]),{28:[1,37]},o($V2,[2,23]),{35:[1,38],37:[1,39]},{11:[1,40]},{33:41,41:[1,42]},{11:[2,43]},o($V2,[2,5]),o($V2,[2,17]),o($V2,[2,18]),o($V2,[2,22]),o($V2,[2,26],{36:[1,43],37:[1,44]}),o($V2,[2,32],{35:[1,45]}),o($Vi,[2,24]),{31:46,42:$Vh},{42:[2,42]},o($V2,[2,27],{37:[1,47]}),o($V2,[2,28]),o($V2,[2,30],{36:[1,48]}),{11:[1,49]},o($V2,[2,29]),o($V2,[2,31]),o($Vi,[2,25])], defaultActions: {5:[2,40],6:[2,1],33:[2,43],42:[2,42]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {"case-insensitive":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0: this.begin('open_directive'); return 39; break; case 1: this.begin('type_directive'); return 40; break; case 2: this.popState(); this.begin('arg_directive'); return 32; break; case 3: this.popState(); this.popState(); return 42; break; case 4:return 41; break; case 5: this.begin("acc_title");return 20; break; case 6: this.popState(); return "acc_title_value"; break; case 7: this.begin("acc_descr");return 22; break; case 8: this.popState(); return "acc_descr_value"; break; case 9: this.begin("acc_descr_multiline"); break; case 10: this.popState(); break; case 11:return "acc_descr_multiline_value"; break; case 12:/* skip comments */ break; case 13:/* skip comments */ break; case 14:/* do nothing */ break; case 15:return 11; break; case 16:/* skip whitespace */ break; case 17:/* skip comments */ break; case 18:/* skip comments */ break; case 19:this.begin("href"); break; case 20:this.popState(); break; case 21:return 37; break; case 22:this.begin("callbackname"); break; case 23:this.popState(); break; case 24:this.popState(); this.begin("callbackargs"); break; case 25:return 35; break; case 26:this.popState(); break; case 27:return 36; break; case 28:this.begin("click"); break; case 29:this.popState(); break; case 30:return 34; break; case 31:return 5; break; case 32:return 12; break; case 33:return 13; break; case 34:return 14; break; case 35:return 15; break; case 36:return 17; break; case 37:return 16; break; case 38:return 18; break; case 39:return 'date'; break; case 40:return 19; break; case 41:return 'accDescription' break; case 42:return 25; break; case 43:return 27; break; case 44:return 28; break; case 45:return 32; break; case 46:return 7; break; case 47:return 'INVALID'; break; } }, rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/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,/^(?:topAxis\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:includes\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,/^(?:accDescription\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i], conditions: {"acc_descr_multiline":{"rules":[10,11],"inclusive":false},"acc_descr":{"rules":[8],"inclusive":false},"acc_title":{"rules":[6],"inclusive":false},"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":[26,27],"inclusive":false},"callbackname":{"rules":[23,24,25],"inclusive":false},"href":{"rules":[20,21],"inclusive":false},"click":{"rules":[29,30],"inclusive":false},"INITIAL":{"rules":[0,5,7,9,12,13,14,15,16,17,18,19,22,28,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?8ed1").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./src/diagrams/git/parser/gitGraph.jison": /*!************************************************!*\ !*** ./src/diagrams/git/parser/gitGraph.jison ***! \************************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,7],$V2=[1,5],$V3=[1,9],$V4=[1,6],$V5=[2,6],$V6=[1,16],$V7=[6,8,14,20,22,24,25,27,29,32,35,37,49,53],$V8=[8,14,20,22,24,25,27,29,32,35,37],$V9=[8,13,14,20,22,24,25,27,29,32,35,37],$Va=[1,26],$Vb=[6,8,14,49,53],$Vc=[8,14,53],$Vd=[1,64],$Ve=[1,65],$Vf=[1,66],$Vg=[8,14,33,36,41,53]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"error":2,"start":3,"eol":4,"directive":5,"GG":6,"document":7,"EOF":8,":":9,"DIR":10,"options":11,"body":12,"OPT":13,"NL":14,"line":15,"statement":16,"commitStatement":17,"mergeStatement":18,"cherryPickStatement":19,"acc_title":20,"acc_title_value":21,"acc_descr":22,"acc_descr_value":23,"acc_descr_multiline_value":24,"section":25,"branchStatement":26,"CHECKOUT":27,"ID":28,"BRANCH":29,"ORDER":30,"NUM":31,"CHERRY_PICK":32,"COMMIT_ID":33,"STR":34,"MERGE":35,"COMMIT_TAG":36,"COMMIT":37,"commit_arg":38,"COMMIT_TYPE":39,"commitType":40,"COMMIT_MSG":41,"NORMAL":42,"REVERSE":43,"HIGHLIGHT":44,"openDirective":45,"typeDirective":46,"closeDirective":47,"argDirective":48,"open_directive":49,"type_directive":50,"arg_directive":51,"close_directive":52,";":53,"$accept":0,"$end":1}, terminals_: {2:"error",6:"GG",8:"EOF",9:":",10:"DIR",13:"OPT",14:"NL",20:"acc_title",21:"acc_title_value",22:"acc_descr",23:"acc_descr_value",24:"acc_descr_multiline_value",25:"section",27:"CHECKOUT",28:"ID",29:"BRANCH",30:"ORDER",31:"NUM",32:"CHERRY_PICK",33:"COMMIT_ID",34:"STR",35:"MERGE",36:"COMMIT_TAG",37:"COMMIT",39:"COMMIT_TYPE",41:"COMMIT_MSG",42:"NORMAL",43:"REVERSE",44:"HIGHLIGHT",49:"open_directive",50:"type_directive",51:"arg_directive",52:"close_directive",53:";"}, productions_: [0,[3,2],[3,2],[3,3],[3,4],[3,5],[7,0],[7,2],[11,2],[11,1],[12,0],[12,2],[15,2],[15,1],[16,1],[16,1],[16,1],[16,2],[16,2],[16,1],[16,1],[16,1],[16,2],[26,2],[26,4],[19,3],[18,2],[18,4],[17,2],[17,3],[17,3],[17,5],[17,5],[17,3],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,3],[17,5],[17,5],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[38,0],[38,1],[40,1],[40,1],[40,1],[5,3],[5,5],[45,1],[46,1],[48,1],[47,1],[4,1],[4,1],[4,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 3: return $$[$0]; break; case 4: return $$[$0-1]; break; case 5: yy.setDirection($$[$0-3]); return $$[$0-1]; break; case 7: yy.setOptions($$[$0-1]); this.$ = $$[$0] break; case 8: $$[$0-1] +=$$[$0]; this.$=$$[$0-1] break; case 10: this.$ = [] break; case 11: $$[$0-1].push($$[$0]); this.$=$$[$0-1]; break; case 12: this.$ =$$[$0-1] break; case 17: this.$=$$[$0].trim();yy.setAccTitle(this.$); break; case 18: case 19: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 20: yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8); break; case 22: yy.checkout($$[$0]) break; case 23: yy.branch($$[$0]) break; case 24: yy.branch($$[$0-2], $$[$0]) break; case 25: yy.cherryPick($$[$0]) break; case 26: yy.merge($$[$0]) break; case 27: yy.merge($$[$0-2], $$[$0]) break; case 28: yy.commit($$[$0]) break; case 29: yy.commit('','',yy.commitType.NORMAL,$$[$0]) break; case 30: yy.commit('','',$$[$0],'') break; case 31: yy.commit('','',$$[$0],$$[$0-2]) break; case 32: yy.commit('','',$$[$0-2],$$[$0]) break; case 33: yy.commit('',$$[$0],yy.commitType.NORMAL,'') break; case 34: yy.commit('',$$[$0-2],yy.commitType.NORMAL,$$[$0]) break; case 35: yy.commit('',$$[$0],yy.commitType.NORMAL,$$[$0-2]) break; case 36: yy.commit('',$$[$0-2],$$[$0],'') break; case 37: yy.commit('',$$[$0],$$[$0-2],'') break; case 38: yy.commit('',$$[$0-4],$$[$0-2],$$[$0]) break; case 39: yy.commit('',$$[$0-4],$$[$0],$$[$0-2]) break; case 40: yy.commit('',$$[$0-2],$$[$0-4],$$[$0]) break; case 41: yy.commit('',$$[$0],$$[$0-4],$$[$0-2]) break; case 42: yy.commit('',$$[$0],$$[$0-2],$$[$0-4]) break; case 43: yy.commit('',$$[$0-2],$$[$0],$$[$0-4]) break; case 44: yy.commit($$[$0],'',yy.commitType.NORMAL,'') break; case 45: yy.commit($$[$0],'',yy.commitType.NORMAL,$$[$0-2]) break; case 46: yy.commit($$[$0-2],'',yy.commitType.NORMAL,$$[$0]) break; case 47: yy.commit($$[$0-2],'',$$[$0],'') break; case 48: yy.commit($$[$0],'',$$[$0-2],'') break; case 49: yy.commit($$[$0],$$[$0-2],yy.commitType.NORMAL,'') break; case 50: yy.commit($$[$0-2],$$[$0],yy.commitType.NORMAL,'') break; case 51: yy.commit($$[$0-4],'',$$[$0-2],$$[$0]) break; case 52: yy.commit($$[$0-4],'',$$[$0],$$[$0-2]) break; case 53: yy.commit($$[$0-2],'',$$[$0-4],$$[$0]) break; case 54: yy.commit($$[$0],'',$$[$0-4],$$[$0-2]) break; case 55: yy.commit($$[$0],'',$$[$0-2],$$[$0-4]) break; case 56: yy.commit($$[$0-2],'',$$[$0],$$[$0-4]) break; case 57: yy.commit($$[$0-4],$$[$0],$$[$0-2],'') break; case 58: yy.commit($$[$0-4],$$[$0-2],$$[$0],'') break; case 59: yy.commit($$[$0-2],$$[$0],$$[$0-4],'') break; case 60: yy.commit($$[$0],$$[$0-2],$$[$0-4],'') break; case 61: yy.commit($$[$0],$$[$0-4],$$[$0-2],'') break; case 62: yy.commit($$[$0-2],$$[$0-4],$$[$0],'') break; case 63: yy.commit($$[$0-4],$$[$0],yy.commitType.NORMAL,$$[$0-2]) break; case 64: yy.commit($$[$0-4],$$[$0-2],yy.commitType.NORMAL,$$[$0]) break; case 65: yy.commit($$[$0-2],$$[$0],yy.commitType.NORMAL,$$[$0-4]) break; case 66: yy.commit($$[$0],$$[$0-2],yy.commitType.NORMAL,$$[$0-4]) break; case 67: yy.commit($$[$0],$$[$0-4],yy.commitType.NORMAL,$$[$0-2]) break; case 68: yy.commit($$[$0-2],$$[$0-4],yy.commitType.NORMAL,$$[$0]) break; case 69: yy.commit($$[$0-6],$$[$0-4],$$[$0-2],$$[$0]) break; case 70: yy.commit($$[$0-6],$$[$0-4],$$[$0],$$[$0-2]) break; case 71: yy.commit($$[$0-6],$$[$0-2],$$[$0-4],$$[$0]) break; case 72: yy.commit($$[$0-6],$$[$0],$$[$0-4],$$[$0-2]) break; case 73: yy.commit($$[$0-6],$$[$0-2],$$[$0],$$[$0-4]) break; case 74: yy.commit($$[$0-6],$$[$0],$$[$0-2],$$[$0-4]) break; case 75: yy.commit($$[$0-4],$$[$0-6],$$[$0-2],$$[$0]) break; case 76: yy.commit($$[$0-4],$$[$0-6],$$[$0],$$[$0-2]) break; case 77: yy.commit($$[$0-2],$$[$0-6],$$[$0-4],$$[$0]) break; case 78: yy.commit($$[$0],$$[$0-6],$$[$0-4],$$[$0-2]) break; case 79: yy.commit($$[$0-2],$$[$0-6],$$[$0],$$[$0-4]) break; case 80: yy.commit($$[$0],$$[$0-6],$$[$0-2],$$[$0-4]) break; case 81: yy.commit($$[$0],$$[$0-4],$$[$0-2],$$[$0-6]) break; case 82: yy.commit($$[$0-2],$$[$0-4],$$[$0],$$[$0-6]) break; case 83: yy.commit($$[$0],$$[$0-2],$$[$0-4],$$[$0-6]) break; case 84: yy.commit($$[$0-2],$$[$0],$$[$0-4],$$[$0-6]) break; case 85: yy.commit($$[$0-4],$$[$0-2],$$[$0],$$[$0-6]) break; case 86: yy.commit($$[$0-4],$$[$0],$$[$0-2],$$[$0-6]) break; case 87: yy.commit($$[$0-2],$$[$0-4],$$[$0-6],$$[$0]) break; case 88: yy.commit($$[$0],$$[$0-4],$$[$0-6],$$[$0-2]) break; case 89: yy.commit($$[$0-2],$$[$0],$$[$0-6],$$[$0-4]) break; case 90: yy.commit($$[$0],$$[$0-2],$$[$0-6],$$[$0-4]) break; case 91: yy.commit($$[$0-4],$$[$0-2],$$[$0-6],$$[$0]) break; case 92: yy.commit($$[$0-4],$$[$0],$$[$0-6],$$[$0-2]) break; case 93: this.$ = "" break; case 94: this.$=$$[$0] break; case 95: this.$=yy.commitType.NORMAL; break; case 96: this.$=yy.commitType.REVERSE; break; case 97: this.$=yy.commitType.HIGHLIGHT; break; case 100: yy.parseDirective('%%{', 'open_directive'); break; case 101: yy.parseDirective($$[$0], 'type_directive'); break; case 102: $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive'); break; case 103: yy.parseDirective('}%%', 'close_directive', 'gitGraph'); break; } }, table: [{3:1,4:2,5:3,6:$V0,8:$V1,14:$V2,45:8,49:$V3,53:$V4},{1:[3]},{3:10,4:2,5:3,6:$V0,8:$V1,14:$V2,45:8,49:$V3,53:$V4},{3:11,4:2,5:3,6:$V0,8:$V1,14:$V2,45:8,49:$V3,53:$V4},{7:12,8:$V5,9:[1,13],10:[1,14],11:15,14:$V6},o($V7,[2,104]),o($V7,[2,105]),o($V7,[2,106]),{46:17,50:[1,18]},{50:[2,100]},{1:[2,1]},{1:[2,2]},{8:[1,19]},{7:20,8:$V5,11:15,14:$V6},{9:[1,21]},o($V8,[2,10],{12:22,13:[1,23]}),o($V9,[2,9]),{9:[1,25],47:24,52:$Va},o([9,52],[2,101]),{1:[2,3]},{8:[1,27]},{7:28,8:$V5,11:15,14:$V6},{8:[2,7],14:[1,31],15:29,16:30,17:32,18:33,19:34,20:[1,35],22:[1,36],24:[1,37],25:[1,38],26:39,27:[1,40],29:[1,44],32:[1,43],35:[1,42],37:[1,41]},o($V9,[2,8]),o($Vb,[2,98]),{48:45,51:[1,46]},o($Vb,[2,103]),{1:[2,4]},{8:[1,47]},o($V8,[2,11]),{4:48,8:$V1,14:$V2,53:$V4},o($V8,[2,13]),o($Vc,[2,14]),o($Vc,[2,15]),o($Vc,[2,16]),{21:[1,49]},{23:[1,50]},o($Vc,[2,19]),o($Vc,[2,20]),o($Vc,[2,21]),{28:[1,51]},o($Vc,[2,93],{38:52,33:[1,55],34:[1,57],36:[1,53],39:[1,54],41:[1,56]}),{28:[1,58]},{33:[1,59]},{28:[1,60]},{47:61,52:$Va},{52:[2,102]},{1:[2,5]},o($V8,[2,12]),o($Vc,[2,17]),o($Vc,[2,18]),o($Vc,[2,22]),o($Vc,[2,28]),{34:[1,62]},{40:63,42:$Vd,43:$Ve,44:$Vf},{34:[1,67]},{34:[1,68]},o($Vc,[2,94]),o($Vc,[2,26],{36:[1,69]}),{34:[1,70]},o($Vc,[2,23],{30:[1,71]}),o($Vb,[2,99]),o($Vc,[2,29],{33:[1,73],39:[1,72],41:[1,74]}),o($Vc,[2,30],{33:[1,76],36:[1,75],41:[1,77]}),o($Vg,[2,95]),o($Vg,[2,96]),o($Vg,[2,97]),o($Vc,[2,33],{36:[1,78],39:[1,79],41:[1,80]}),o($Vc,[2,44],{33:[1,83],36:[1,81],39:[1,82]}),{34:[1,84]},o($Vc,[2,25]),{31:[1,85]},{40:86,42:$Vd,43:$Ve,44:$Vf},{34:[1,87]},{34:[1,88]},{34:[1,89]},{34:[1,90]},{34:[1,91]},{34:[1,92]},{40:93,42:$Vd,43:$Ve,44:$Vf},{34:[1,94]},{34:[1,95]},{40:96,42:$Vd,43:$Ve,44:$Vf},{34:[1,97]},o($Vc,[2,27]),o($Vc,[2,24]),o($Vc,[2,31],{33:[1,98],41:[1,99]}),o($Vc,[2,35],{39:[1,100],41:[1,101]}),o($Vc,[2,45],{33:[1,103],39:[1,102]}),o($Vc,[2,32],{33:[1,104],41:[1,105]}),o($Vc,[2,37],{36:[1,106],41:[1,107]}),o($Vc,[2,48],{33:[1,109],36:[1,108]}),o($Vc,[2,34],{39:[1,110],41:[1,111]}),o($Vc,[2,36],{36:[1,112],41:[1,113]}),o($Vc,[2,49],{36:[1,115],39:[1,114]}),o($Vc,[2,46],{33:[1,117],39:[1,116]}),o($Vc,[2,47],{33:[1,119],36:[1,118]}),o($Vc,[2,50],{36:[1,121],39:[1,120]}),{34:[1,122]},{34:[1,123]},{40:124,42:$Vd,43:$Ve,44:$Vf},{34:[1,125]},{40:126,42:$Vd,43:$Ve,44:$Vf},{34:[1,127]},{34:[1,128]},{34:[1,129]},{34:[1,130]},{34:[1,131]},{34:[1,132]},{34:[1,133]},{40:134,42:$Vd,43:$Ve,44:$Vf},{34:[1,135]},{34:[1,136]},{34:[1,137]},{40:138,42:$Vd,43:$Ve,44:$Vf},{34:[1,139]},{40:140,42:$Vd,43:$Ve,44:$Vf},{34:[1,141]},{34:[1,142]},{34:[1,143]},{40:144,42:$Vd,43:$Ve,44:$Vf},{34:[1,145]},o($Vc,[2,42],{41:[1,146]}),o($Vc,[2,55],{33:[1,147]}),o($Vc,[2,43],{41:[1,148]}),o($Vc,[2,66],{39:[1,149]}),o($Vc,[2,56],{33:[1,150]}),o($Vc,[2,65],{39:[1,151]}),o($Vc,[2,41],{41:[1,152]}),o($Vc,[2,54],{33:[1,153]}),o($Vc,[2,40],{41:[1,154]}),o($Vc,[2,60],{36:[1,155]}),o($Vc,[2,53],{33:[1,156]}),o($Vc,[2,59],{36:[1,157]}),o($Vc,[2,39],{41:[1,158]}),o($Vc,[2,67],{39:[1,159]}),o($Vc,[2,38],{41:[1,160]}),o($Vc,[2,61],{36:[1,161]}),o($Vc,[2,62],{36:[1,162]}),o($Vc,[2,68],{39:[1,163]}),o($Vc,[2,52],{33:[1,164]}),o($Vc,[2,63],{39:[1,165]}),o($Vc,[2,51],{33:[1,166]}),o($Vc,[2,57],{36:[1,167]}),o($Vc,[2,58],{36:[1,168]}),o($Vc,[2,64],{39:[1,169]}),{34:[1,170]},{34:[1,171]},{34:[1,172]},{40:173,42:$Vd,43:$Ve,44:$Vf},{34:[1,174]},{40:175,42:$Vd,43:$Ve,44:$Vf},{34:[1,176]},{34:[1,177]},{34:[1,178]},{34:[1,179]},{34:[1,180]},{34:[1,181]},{34:[1,182]},{40:183,42:$Vd,43:$Ve,44:$Vf},{34:[1,184]},{34:[1,185]},{34:[1,186]},{40:187,42:$Vd,43:$Ve,44:$Vf},{34:[1,188]},{40:189,42:$Vd,43:$Ve,44:$Vf},{34:[1,190]},{34:[1,191]},{34:[1,192]},{40:193,42:$Vd,43:$Ve,44:$Vf},o($Vc,[2,83]),o($Vc,[2,84]),o($Vc,[2,81]),o($Vc,[2,82]),o($Vc,[2,86]),o($Vc,[2,85]),o($Vc,[2,90]),o($Vc,[2,89]),o($Vc,[2,88]),o($Vc,[2,87]),o($Vc,[2,92]),o($Vc,[2,91]),o($Vc,[2,80]),o($Vc,[2,79]),o($Vc,[2,78]),o($Vc,[2,77]),o($Vc,[2,75]),o($Vc,[2,76]),o($Vc,[2,74]),o($Vc,[2,73]),o($Vc,[2,72]),o($Vc,[2,71]),o($Vc,[2,69]),o($Vc,[2,70])], defaultActions: {9:[2,100],10:[2,1],11:[2,2],19:[2,3],27:[2,4],46:[2,102],47:[2,5]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {"case-insensitive":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0: this.begin('open_directive'); return 49; break; case 1: this.begin('type_directive'); return 50; break; case 2: this.popState(); this.begin('arg_directive'); return 9; break; case 3: this.popState(); this.popState(); return 52; break; case 4:return 51; break; case 5: this.begin("acc_title");return 20; break; case 6: this.popState(); return "acc_title_value"; break; case 7: this.begin("acc_descr");return 22; break; case 8: this.popState(); return "acc_descr_value"; break; case 9: this.begin("acc_descr_multiline"); break; case 10: this.popState(); break; case 11:return "acc_descr_multiline_value"; break; case 12:/*{console.log('New line');return 14;}*/ return 14; break; case 13:/* skip all whitespace */ break; case 14:/* skip comments */ break; case 15:/* skip comments */ break; case 16:return 6; break; case 17:return 37; break; case 18:return 33; break; case 19:return 39; break; case 20:return 41; break; case 21:return 42; break; case 22:return 43; break; case 23:return 44; break; case 24:return 36; break; case 25:return 29; break; case 26:return 30; break; case 27:return 35; break; case 28:return 32; break; case 29:return 27; break; case 30:return 10; break; case 31:return 10; break; case 32:return 9; break; case 33:return 'CARET' break; case 34:this.begin("options"); // break; case 35:this.popState(); // not used anymore in the renderer, fixed for backward compatibility break; case 36:return 13; // break; case 37:this.begin("string"); break; case 38:this.popState(); break; case 39:return 34; break; case 40:return 31; break; case 41:return 28; break; case 42:return 8; break; } }, rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:gitGraph\b)/i,/^(?:commit\b)/i,/^(?:id:)/i,/^(?:type:)/i,/^(?:msg:)/i,/^(?:NORMAL\b)/i,/^(?:REVERSE\b)/i,/^(?:HIGHLIGHT\b)/i,/^(?:tag:)/i,/^(?:branch\b)/i,/^(?:order:)/i,/^(?:merge\b)/i,/^(?:cherry-pick\b)/i,/^(?:checkout\b)/i,/^(?:LR\b)/i,/^(?:BT\b)/i,/^(?::)/i,/^(?:\^)/i,/^(?:options\r?\n)/i,/^(?:[ \r\n\t]+end\b)/i,/^(?:[\s\S]+(?=[ \r\n\t]+end))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[0-9]+)/i,/^(?:[a-zA-Z][-_\./a-zA-Z0-9]*[-_a-zA-Z0-9])/i,/^(?:$)/i], conditions: {"acc_descr_multiline":{"rules":[10,11],"inclusive":false},"acc_descr":{"rules":[8],"inclusive":false},"acc_title":{"rules":[6],"inclusive":false},"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},"options":{"rules":[35,36],"inclusive":false},"string":{"rules":[38,39],"inclusive":false},"INITIAL":{"rules":[0,5,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,37,40,41,42],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?2b40").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./src/diagrams/info/parser/info.jison": /*!*********************************************!*\ !*** ./src/diagrams/info/parser/info.jison ***! \*********************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,9,10]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"error":2,"start":3,"info":4,"document":5,"EOF":6,"line":7,"statement":8,"NL":9,"showInfo":10,"$accept":0,"$end":1}, terminals_: {2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"}, productions_: [0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 1: return yy; break; case 4: break; case 6: yy.setInfo(true); break; } }, table: [{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])], defaultActions: {4:[2,1]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {"case-insensitive":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { // Pre-lexer code can go here var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0:return 4 ; break; case 1:return 9 ; break; case 2:return 'space'; break; case 3:return 10; break; case 4:return 6 ; break; case 5:return 'TXT' ; break; } }, rules: [/^(?:info\b)/i,/^(?:[\s\n\r]+)/i,/^(?:[\s]+)/i,/^(?:showInfo\b)/i,/^(?:$)/i,/^(?:.)/i], conditions: {"INITIAL":{"rules":[0,1,2,3,4,5],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?c5f1").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./src/diagrams/pie/parser/pie.jison": /*!*******************************************!*\ !*** ./src/diagrams/pie/parser/pie.jison ***! \*******************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var 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,11,13,15,17,19,20,26,27,28,29],$V6=[2,5],$V7=[1,6,11,13,15,17,19,20,26,27,28,29],$V8=[26,27,28],$V9=[2,8],$Va=[1,18],$Vb=[1,19],$Vc=[1,20],$Vd=[1,21],$Ve=[1,22],$Vf=[1,23],$Vg=[1,28],$Vh=[6,26,27,28,29]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"error":2,"start":3,"eol":4,"directive":5,"PIE":6,"document":7,"showData":8,"line":9,"statement":10,"txt":11,"value":12,"title":13,"title_value":14,"acc_title":15,"acc_title_value":16,"acc_descr":17,"acc_descr_value":18,"acc_descr_multiline_value":19,"section":20,"openDirective":21,"typeDirective":22,"closeDirective":23,":":24,"argDirective":25,"NEWLINE":26,";":27,"EOF":28,"open_directive":29,"type_directive":30,"arg_directive":31,"close_directive":32,"$accept":0,"$end":1}, terminals_: {2:"error",6:"PIE",8:"showData",11:"txt",12:"value",13:"title",14:"title_value",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",24:":",26:"NEWLINE",27:";",28:"EOF",29:"open_directive",30:"type_directive",31:"arg_directive",32:"close_directive"}, productions_: [0,[3,2],[3,2],[3,2],[3,3],[7,0],[7,2],[9,2],[10,0],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,1],[5,3],[5,5],[4,1],[4,1],[4,1],[21,1],[22,1],[25,1],[23,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 4: yy.setShowData(true); break; case 7: this.$ = $$[$0-1] break; case 9: yy.addSection($$[$0-1],yy.cleanupValue($$[$0])); break; case 10: this.$=$$[$0].trim();yy.setDiagramTitle(this.$); break; case 11: this.$=$$[$0].trim();yy.setAccTitle(this.$); break; case 12: case 13: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 14: yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8); break; case 21: yy.parseDirective('%%{', 'open_directive'); break; case 22: yy.parseDirective($$[$0], 'type_directive'); break; case 23: $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive'); break; case 24: yy.parseDirective('}%%', 'close_directive', 'pie'); break; } }, table: [{3:1,4:2,5:3,6:$V0,21:8,26:$V1,27:$V2,28:$V3,29:$V4},{1:[3]},{3:10,4:2,5:3,6:$V0,21:8,26:$V1,27:$V2,28:$V3,29:$V4},{3:11,4:2,5:3,6:$V0,21:8,26:$V1,27:$V2,28:$V3,29:$V4},o($V5,$V6,{7:12,8:[1,13]}),o($V7,[2,18]),o($V7,[2,19]),o($V7,[2,20]),{22:14,30:[1,15]},{30:[2,21]},{1:[2,1]},{1:[2,2]},o($V8,$V9,{21:8,9:16,10:17,5:24,1:[2,3],11:$Va,13:$Vb,15:$Vc,17:$Vd,19:$Ve,20:$Vf,29:$V4}),o($V5,$V6,{7:25}),{23:26,24:[1,27],32:$Vg},o([24,32],[2,22]),o($V5,[2,6]),{4:29,26:$V1,27:$V2,28:$V3},{12:[1,30]},{14:[1,31]},{16:[1,32]},{18:[1,33]},o($V8,[2,13]),o($V8,[2,14]),o($V8,[2,15]),o($V8,$V9,{21:8,9:16,10:17,5:24,1:[2,4],11:$Va,13:$Vb,15:$Vc,17:$Vd,19:$Ve,20:$Vf,29:$V4}),o($Vh,[2,16]),{25:34,31:[1,35]},o($Vh,[2,24]),o($V5,[2,7]),o($V8,[2,9]),o($V8,[2,10]),o($V8,[2,11]),o($V8,[2,12]),{23:36,32:$Vg},{32:[2,23]},o($Vh,[2,17])], defaultActions: {9:[2,21],10:[2,1],11:[2,2],35:[2,23]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {"case-insensitive":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0: this.begin('open_directive'); return 29; break; case 1: this.begin('type_directive'); return 30; break; case 2: this.popState(); this.begin('arg_directive'); return 24; break; case 3: this.popState(); this.popState(); return 32; break; case 4:return 31; break; case 5:/* skip comments */ break; case 6:/* skip comments */{ /*console.log('');*/ } break; case 7:return 26; break; case 8:/* do nothing */ break; case 9:/* ignore */ break; case 10: this.begin("title");return 13; break; case 11: this.popState(); return "title_value"; break; case 12: this.begin("acc_title");return 15; break; case 13: this.popState(); return "acc_title_value"; break; case 14: this.begin("acc_descr");return 17; break; case 15: this.popState(); return "acc_descr_value"; break; case 16: this.begin("acc_descr_multiline"); break; case 17: this.popState(); break; case 18:return "acc_descr_multiline_value"; break; case 19: this.begin("string"); break; case 20: this.popState(); break; case 21: return "txt"; break; case 22:return 6; break; case 23:return 8; break; case 24:return "value"; break; case 25:return 28; break; } }, rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[\s]+)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:pie\b)/i,/^(?:showData\b)/i,/^(?::[\s]*[\d]+(?:\.[\d]+)?)/i,/^(?:$)/i], conditions: {"acc_descr_multiline":{"rules":[17,18],"inclusive":false},"acc_descr":{"rules":[15],"inclusive":false},"acc_title":{"rules":[13],"inclusive":false},"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":[20,21],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,12,14,16,19,22,23,24,25],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?a3fa").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./src/diagrams/requirement/parser/requirementDiagram.jison": /*!******************************************************************!*\ !*** ./src/diagrams/requirement/parser/requirementDiagram.jison ***! \******************************************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var 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=[1,6],$V3=[1,7],$V4=[1,8],$V5=[5,6,8,14,16,18,19,40,41,42,43,44,45,53,71,72],$V6=[1,22],$V7=[2,13],$V8=[1,26],$V9=[1,27],$Va=[1,28],$Vb=[1,29],$Vc=[1,30],$Vd=[1,31],$Ve=[1,24],$Vf=[1,32],$Vg=[1,33],$Vh=[1,36],$Vi=[71,72],$Vj=[5,8,14,16,18,19,40,41,42,43,44,45,53,60,62,71,72],$Vk=[1,56],$Vl=[1,57],$Vm=[1,58],$Vn=[1,59],$Vo=[1,60],$Vp=[1,61],$Vq=[1,62],$Vr=[62,63],$Vs=[1,74],$Vt=[1,70],$Vu=[1,71],$Vv=[1,72],$Vw=[1,73],$Vx=[1,75],$Vy=[1,79],$Vz=[1,80],$VA=[1,77],$VB=[1,78],$VC=[5,8,14,16,18,19,40,41,42,43,44,45,53,71,72]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"error":2,"start":3,"directive":4,"NEWLINE":5,"RD":6,"diagram":7,"EOF":8,"openDirective":9,"typeDirective":10,"closeDirective":11,":":12,"argDirective":13,"acc_title":14,"acc_title_value":15,"acc_descr":16,"acc_descr_value":17,"acc_descr_multiline_value":18,"open_directive":19,"type_directive":20,"arg_directive":21,"close_directive":22,"requirementDef":23,"elementDef":24,"relationshipDef":25,"requirementType":26,"requirementName":27,"STRUCT_START":28,"requirementBody":29,"ID":30,"COLONSEP":31,"id":32,"TEXT":33,"text":34,"RISK":35,"riskLevel":36,"VERIFYMTHD":37,"verifyType":38,"STRUCT_STOP":39,"REQUIREMENT":40,"FUNCTIONAL_REQUIREMENT":41,"INTERFACE_REQUIREMENT":42,"PERFORMANCE_REQUIREMENT":43,"PHYSICAL_REQUIREMENT":44,"DESIGN_CONSTRAINT":45,"LOW_RISK":46,"MED_RISK":47,"HIGH_RISK":48,"VERIFY_ANALYSIS":49,"VERIFY_DEMONSTRATION":50,"VERIFY_INSPECTION":51,"VERIFY_TEST":52,"ELEMENT":53,"elementName":54,"elementBody":55,"TYPE":56,"type":57,"DOCREF":58,"ref":59,"END_ARROW_L":60,"relationship":61,"LINE":62,"END_ARROW_R":63,"CONTAINS":64,"COPIES":65,"DERIVES":66,"SATISFIES":67,"VERIFIES":68,"REFINES":69,"TRACES":70,"unqString":71,"qString":72,"$accept":0,"$end":1}, terminals_: {2:"error",5:"NEWLINE",6:"RD",8:"EOF",12:":",14:"acc_title",15:"acc_title_value",16:"acc_descr",17:"acc_descr_value",18:"acc_descr_multiline_value",19:"open_directive",20:"type_directive",21:"arg_directive",22:"close_directive",28:"STRUCT_START",30:"ID",31:"COLONSEP",33:"TEXT",35:"RISK",37:"VERIFYMTHD",39:"STRUCT_STOP",40:"REQUIREMENT",41:"FUNCTIONAL_REQUIREMENT",42:"INTERFACE_REQUIREMENT",43:"PERFORMANCE_REQUIREMENT",44:"PHYSICAL_REQUIREMENT",45:"DESIGN_CONSTRAINT",46:"LOW_RISK",47:"MED_RISK",48:"HIGH_RISK",49:"VERIFY_ANALYSIS",50:"VERIFY_DEMONSTRATION",51:"VERIFY_INSPECTION",52:"VERIFY_TEST",53:"ELEMENT",56:"TYPE",58:"DOCREF",60:"END_ARROW_L",62:"LINE",63:"END_ARROW_R",64:"CONTAINS",65:"COPIES",66:"DERIVES",67:"SATISFIES",68:"VERIFIES",69:"REFINES",70:"TRACES",71:"unqString",72:"qString"}, productions_: [0,[3,3],[3,2],[3,4],[4,3],[4,5],[4,2],[4,2],[4,1],[9,1],[10,1],[13,1],[11,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[23,5],[29,5],[29,5],[29,5],[29,5],[29,2],[29,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[36,1],[36,1],[36,1],[38,1],[38,1],[38,1],[38,1],[24,5],[55,5],[55,5],[55,2],[55,1],[25,5],[25,5],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[27,1],[27,1],[32,1],[32,1],[34,1],[34,1],[54,1],[54,1],[57,1],[57,1],[59,1],[59,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 6: this.$=$$[$0].trim();yy.setAccTitle(this.$); break; case 7: case 8: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 9: yy.parseDirective('%%{', 'open_directive'); break; case 10: yy.parseDirective($$[$0], 'type_directive'); break; case 11: $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive'); break; case 12: yy.parseDirective('}%%', 'close_directive', 'pie'); break; case 13: this.$ = [] break; case 19: yy.addRequirement($$[$0-3], $$[$0-4]) break; case 20: yy.setNewReqId($$[$0-2]); break; case 21: yy.setNewReqText($$[$0-2]); break; case 22: yy.setNewReqRisk($$[$0-2]); break; case 23: yy.setNewReqVerifyMethod($$[$0-2]); break; case 26: this.$=yy.RequirementType.REQUIREMENT; break; case 27: this.$=yy.RequirementType.FUNCTIONAL_REQUIREMENT; break; case 28: this.$=yy.RequirementType.INTERFACE_REQUIREMENT; break; case 29: this.$=yy.RequirementType.PERFORMANCE_REQUIREMENT; break; case 30: this.$=yy.RequirementType.PHYSICAL_REQUIREMENT; break; case 31: this.$=yy.RequirementType.DESIGN_CONSTRAINT; break; case 32: this.$=yy.RiskLevel.LOW_RISK; break; case 33: this.$=yy.RiskLevel.MED_RISK; break; case 34: this.$=yy.RiskLevel.HIGH_RISK; break; case 35: this.$=yy.VerifyType.VERIFY_ANALYSIS; break; case 36: this.$=yy.VerifyType.VERIFY_DEMONSTRATION; break; case 37: this.$=yy.VerifyType.VERIFY_INSPECTION; break; case 38: this.$=yy.VerifyType.VERIFY_TEST; break; case 39: yy.addElement($$[$0-3]) break; case 40: yy.setNewElementType($$[$0-2]); break; case 41: yy.setNewElementDocRef($$[$0-2]); break; case 44: yy.addRelationship($$[$0-2], $$[$0], $$[$0-4]) break; case 45: yy.addRelationship($$[$0-2], $$[$0-4], $$[$0]) break; case 46: this.$=yy.Relationships.CONTAINS; break; case 47: this.$=yy.Relationships.COPIES; break; case 48: this.$=yy.Relationships.DERIVES; break; case 49: this.$=yy.Relationships.SATISFIES; break; case 50: this.$=yy.Relationships.VERIFIES; break; case 51: this.$=yy.Relationships.REFINES; break; case 52: this.$=yy.Relationships.TRACES; break; } }, table: [{3:1,4:2,6:$V0,9:4,14:$V1,16:$V2,18:$V3,19:$V4},{1:[3]},{3:10,4:2,5:[1,9],6:$V0,9:4,14:$V1,16:$V2,18:$V3,19:$V4},{5:[1,11]},{10:12,20:[1,13]},{15:[1,14]},{17:[1,15]},o($V5,[2,8]),{20:[2,9]},{3:16,4:2,6:$V0,9:4,14:$V1,16:$V2,18:$V3,19:$V4},{1:[2,2]},{4:21,5:$V6,7:17,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{11:34,12:[1,35],22:$Vh},o([12,22],[2,10]),o($V5,[2,6]),o($V5,[2,7]),{1:[2,1]},{8:[1,37]},{4:21,5:$V6,7:38,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{4:21,5:$V6,7:39,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{4:21,5:$V6,7:40,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{4:21,5:$V6,7:41,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{4:21,5:$V6,7:42,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{27:43,71:[1,44],72:[1,45]},{54:46,71:[1,47],72:[1,48]},{60:[1,49],62:[1,50]},o($Vi,[2,26]),o($Vi,[2,27]),o($Vi,[2,28]),o($Vi,[2,29]),o($Vi,[2,30]),o($Vi,[2,31]),o($Vj,[2,55]),o($Vj,[2,56]),o($V5,[2,4]),{13:51,21:[1,52]},o($V5,[2,12]),{1:[2,3]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{8:[2,17]},{8:[2,18]},{28:[1,53]},{28:[2,53]},{28:[2,54]},{28:[1,54]},{28:[2,59]},{28:[2,60]},{61:55,64:$Vk,65:$Vl,66:$Vm,67:$Vn,68:$Vo,69:$Vp,70:$Vq},{61:63,64:$Vk,65:$Vl,66:$Vm,67:$Vn,68:$Vo,69:$Vp,70:$Vq},{11:64,22:$Vh},{22:[2,11]},{5:[1,65]},{5:[1,66]},{62:[1,67]},o($Vr,[2,46]),o($Vr,[2,47]),o($Vr,[2,48]),o($Vr,[2,49]),o($Vr,[2,50]),o($Vr,[2,51]),o($Vr,[2,52]),{63:[1,68]},o($V5,[2,5]),{5:$Vs,29:69,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},{5:$Vy,39:$Vz,55:76,56:$VA,58:$VB},{32:81,71:$Vf,72:$Vg},{32:82,71:$Vf,72:$Vg},o($VC,[2,19]),{31:[1,83]},{31:[1,84]},{31:[1,85]},{31:[1,86]},{5:$Vs,29:87,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},o($VC,[2,25]),o($VC,[2,39]),{31:[1,88]},{31:[1,89]},{5:$Vy,39:$Vz,55:90,56:$VA,58:$VB},o($VC,[2,43]),o($VC,[2,44]),o($VC,[2,45]),{32:91,71:$Vf,72:$Vg},{34:92,71:[1,93],72:[1,94]},{36:95,46:[1,96],47:[1,97],48:[1,98]},{38:99,49:[1,100],50:[1,101],51:[1,102],52:[1,103]},o($VC,[2,24]),{57:104,71:[1,105],72:[1,106]},{59:107,71:[1,108],72:[1,109]},o($VC,[2,42]),{5:[1,110]},{5:[1,111]},{5:[2,57]},{5:[2,58]},{5:[1,112]},{5:[2,32]},{5:[2,33]},{5:[2,34]},{5:[1,113]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[2,38]},{5:[1,114]},{5:[2,61]},{5:[2,62]},{5:[1,115]},{5:[2,63]},{5:[2,64]},{5:$Vs,29:116,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},{5:$Vs,29:117,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},{5:$Vs,29:118,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},{5:$Vs,29:119,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},{5:$Vy,39:$Vz,55:120,56:$VA,58:$VB},{5:$Vy,39:$Vz,55:121,56:$VA,58:$VB},o($VC,[2,20]),o($VC,[2,21]),o($VC,[2,22]),o($VC,[2,23]),o($VC,[2,40]),o($VC,[2,41])], defaultActions: {8:[2,9],10:[2,2],16:[2,1],37:[2,3],38:[2,14],39:[2,15],40:[2,16],41:[2,17],42:[2,18],44:[2,53],45:[2,54],47:[2,59],48:[2,60],52:[2,11],93:[2,57],94:[2,58],96:[2,32],97:[2,33],98:[2,34],100:[2,35],101:[2,36],102:[2,37],103:[2,38],105:[2,61],106:[2,62],108:[2,63],109:[2,64]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {"case-insensitive":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0: this.begin('open_directive'); return 19; break; case 1: this.begin('type_directive'); return 20; break; case 2: this.popState(); this.begin('arg_directive'); return 12; break; case 3: this.popState(); this.popState(); return 22; break; case 4:return 21; break; case 5:return 'title'; break; case 6: this.begin("acc_title");return 14; break; case 7: this.popState(); return "acc_title_value"; break; case 8: this.begin("acc_descr");return 16; break; case 9: this.popState(); return "acc_descr_value"; break; case 10: this.begin("acc_descr_multiline"); break; case 11: this.popState(); break; case 12:return "acc_descr_multiline_value"; break; case 13:return 5; break; case 14:/* skip all whitespace */ break; case 15:/* skip comments */ break; case 16:/* skip comments */ break; case 17:return 8; break; case 18:return 6; break; case 19:return 28; break; case 20:return 39; break; case 21:return 31; break; case 22:return 30; break; case 23:return 33; break; case 24:return 35; break; case 25:return 37; break; case 26:return 40; break; case 27:return 41; break; case 28:return 42; break; case 29:return 43; break; case 30:return 44; break; case 31:return 45; break; case 32:return 46; break; case 33:return 47; break; case 34:return 48; break; case 35:return 49; break; case 36:return 50; break; case 37:return 51; break; case 38:return 52; break; case 39:return 53; break; case 40:return 64; break; case 41:return 65; break; case 42:return 66; break; case 43:return 67; break; case 44:return 68; break; case 45:return 69; break; case 46:return 70; break; case 47:return 56; break; case 48:return 58; break; case 49:return 60; break; case 50:return 63; break; case 51:return 62; break; case 52: this.begin("string"); break; case 53: this.popState(); break; case 54: return "qString"; break; case 55: yy_.yytext = yy_.yytext.trim(); return 71; break; } }, rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^\r\n\{\<\>\-\=]*)/i], conditions: {"acc_descr_multiline":{"rules":[11,12],"inclusive":false},"acc_descr":{"rules":[9],"inclusive":false},"acc_title":{"rules":[7],"inclusive":false},"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},"unqString":{"rules":[],"inclusive":false},"token":{"rules":[],"inclusive":false},"string":{"rules":[53,54],"inclusive":false},"INITIAL":{"rules":[0,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,55],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?ebf4").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./src/diagrams/sequence/parser/sequenceDiagram.jison": /*!************************************************************!*\ !*** ./src/diagrams/sequence/parser/sequenceDiagram.jison ***! \************************************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var 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,19],$V9=[1,21],$Va=[1,22],$Vb=[1,23],$Vc=[1,29],$Vd=[1,30],$Ve=[1,31],$Vf=[1,32],$Vg=[1,33],$Vh=[1,34],$Vi=[1,35],$Vj=[1,36],$Vk=[1,37],$Vl=[1,38],$Vm=[1,39],$Vn=[1,40],$Vo=[1,43],$Vp=[1,44],$Vq=[1,45],$Vr=[1,46],$Vs=[1,47],$Vt=[1,48],$Vu=[1,51],$Vv=[1,4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,51,52,53,58,59,60,61,69,79],$Vw=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,53,58,59,60,61,69,79],$Vx=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,52,53,58,59,60,61,69,79],$Vy=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,51,53,58,59,60,61,69,79],$Vz=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,53,58,59,60,61,69,79],$VA=[67,68,69],$VB=[1,121],$VC=[1,4,5,7,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,51,52,53,58,59,60,61,69,79]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"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,"participant_actor":20,"signal":21,"autonumber":22,"NUM":23,"off":24,"activate":25,"deactivate":26,"note_statement":27,"links_statement":28,"link_statement":29,"properties_statement":30,"details_statement":31,"title":32,"legacy_title":33,"acc_title":34,"acc_title_value":35,"acc_descr":36,"acc_descr_value":37,"acc_descr_multiline_value":38,"loop":39,"end":40,"rect":41,"opt":42,"alt":43,"else_sections":44,"par":45,"par_sections":46,"critical":47,"option_sections":48,"break":49,"option":50,"and":51,"else":52,"note":53,"placement":54,"text2":55,"over":56,"actor_pair":57,"links":58,"link":59,"properties":60,"details":61,"spaceList":62,",":63,"left_of":64,"right_of":65,"signaltype":66,"+":67,"-":68,"ACTOR":69,"SOLID_OPEN_ARROW":70,"DOTTED_OPEN_ARROW":71,"SOLID_ARROW":72,"DOTTED_ARROW":73,"SOLID_CROSS":74,"DOTTED_CROSS":75,"SOLID_POINT":76,"DOTTED_POINT":77,"TXT":78,"open_directive":79,"type_directive":80,"arg_directive":81,"close_directive":82,"$accept":0,"$end":1}, terminals_: {2:"error",4:"SPACE",5:"NEWLINE",7:"SD",14:":",16:"participant",18:"AS",19:"restOfLine",20:"participant_actor",22:"autonumber",23:"NUM",24:"off",25:"activate",26:"deactivate",32:"title",33:"legacy_title",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",39:"loop",40:"end",41:"rect",42:"opt",43:"alt",45:"par",47:"critical",49:"break",50:"option",51:"and",52:"else",53:"note",56:"over",58:"links",59:"link",60:"properties",61:"details",63:",",64:"left_of",65:"right_of",67:"+",68:"-",69:"ACTOR",70:"SOLID_OPEN_ARROW",71:"DOTTED_OPEN_ARROW",72:"SOLID_ARROW",73:"DOTTED_ARROW",74:"SOLID_CROSS",75:"DOTTED_CROSS",76:"SOLID_POINT",77:"DOTTED_POINT",78:"TXT",79:"open_directive",80:"type_directive",81:"arg_directive",82:"close_directive"}, productions_: [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,5],[10,3],[10,2],[10,4],[10,3],[10,3],[10,2],[10,3],[10,3],[10,2],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,2],[10,2],[10,1],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,1],[48,1],[48,4],[46,1],[46,4],[44,1],[44,4],[27,4],[27,4],[28,3],[29,3],[30,3],[31,3],[62,2],[62,1],[57,3],[57,1],[54,1],[54,1],[21,5],[21,5],[21,4],[17,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[55,1],[11,1],[12,1],[15,1],[13,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 4: yy.apply($$[$0]);return $$[$0]; break; case 5: this.$ = [] break; case 6: $$[$0-1].push($$[$0]);this.$ = $$[$0-1] break; case 7: case 8: this.$ = $$[$0] break; case 9: this.$=[]; break; case 12: $$[$0-3].type='addParticipant';$$[$0-3].description=yy.parseMessage($$[$0-1]); this.$=$$[$0-3]; break; case 13: $$[$0-1].type='addParticipant';this.$=$$[$0-1]; break; case 14: $$[$0-3].type='addActor';$$[$0-3].description=yy.parseMessage($$[$0-1]); this.$=$$[$0-3]; break; case 15: $$[$0-1].type='addActor'; this.$=$$[$0-1]; break; case 17: this.$= {type:'sequenceIndex',sequenceIndex: Number($$[$0-2]), sequenceIndexStep:Number($$[$0-1]), sequenceVisible:true, signalType:yy.LINETYPE.AUTONUMBER}; break; case 18: this.$ = {type:'sequenceIndex',sequenceIndex: Number($$[$0-1]), sequenceIndexStep:1, sequenceVisible:true, signalType:yy.LINETYPE.AUTONUMBER}; break; case 19: this.$ = {type:'sequenceIndex', sequenceVisible:false, signalType:yy.LINETYPE.AUTONUMBER}; break; case 20: this.$ = {type:'sequenceIndex', sequenceVisible:true, signalType:yy.LINETYPE.AUTONUMBER}; break; case 21: this.$={type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]}; break; case 22: this.$={type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-1]}; break; case 28: yy.setDiagramTitle($$[$0].substring(6));this.$=$$[$0].substring(6); break; case 29: yy.setDiagramTitle($$[$0].substring(7));this.$=$$[$0].substring(7); break; case 30: this.$=$$[$0].trim();yy.setAccTitle(this.$); break; case 31: case 32: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 33: $$[$0-1].unshift({type: 'loopStart', loopText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.LOOP_START}); $$[$0-1].push({type: 'loopEnd', loopText:$$[$0-2], signalType: yy.LINETYPE.LOOP_END}); this.$=$$[$0-1]; break; case 34: $$[$0-1].unshift({type: 'rectStart', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_START }); $$[$0-1].push({type: 'rectEnd', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_END }); this.$=$$[$0-1]; break; case 35: $$[$0-1].unshift({type: 'optStart', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_START}); $$[$0-1].push({type: 'optEnd', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_END}); this.$=$$[$0-1]; break; case 36: // Alt start $$[$0-1].unshift({type: 'altStart', altText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.ALT_START}); // Content in alt is already in $$[$0-1] // End $$[$0-1].push({type: 'altEnd', signalType: yy.LINETYPE.ALT_END}); this.$=$$[$0-1]; break; case 37: // Parallel start $$[$0-1].unshift({type: 'parStart', parText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.PAR_START}); // Content in par is already in $$[$0-1] // End $$[$0-1].push({type: 'parEnd', signalType: yy.LINETYPE.PAR_END}); this.$=$$[$0-1]; break; case 38: // critical start $$[$0-1].unshift({type: 'criticalStart', criticalText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.CRITICAL_START}); // Content in critical is already in $$[$0-1] // critical end $$[$0-1].push({type: 'criticalEnd', signalType: yy.LINETYPE.CRITICAL_END}); this.$=$$[$0-1]; break; case 39: $$[$0-1].unshift({type: 'breakStart', breakText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.BREAK_START}); $$[$0-1].push({type: 'breakEnd', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.BREAK_END}); this.$=$$[$0-1]; break; case 42: this.$ = $$[$0-3].concat([{type: 'option', optionText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.CRITICAL_OPTION}, $$[$0]]); break; case 44: this.$ = $$[$0-3].concat([{type: 'and', parText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.PAR_AND}, $$[$0]]); break; case 46: this.$ = $$[$0-3].concat([{type: 'else', altText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.ALT_ELSE}, $$[$0]]); break; case 47: this.$ = [$$[$0-1], {type:'addNote', placement:$$[$0-2], actor:$$[$0-1].actor, text:$$[$0]}]; break; case 48: // Coerce actor_pair into a [to, from, ...] array $$[$0-2] = [].concat($$[$0-1], $$[$0-1]).slice(0, 2); $$[$0-2][0] = $$[$0-2][0].actor; $$[$0-2][1] = $$[$0-2][1].actor; this.$ = [$$[$0-1], {type:'addNote', placement:yy.PLACEMENT.OVER, actor:$$[$0-2].slice(0, 2), text:$$[$0]}]; break; case 49: this.$ = [$$[$0-1], {type:'addLinks', actor:$$[$0-1].actor, text:$$[$0]}]; break; case 50: this.$ = [$$[$0-1], {type:'addALink', actor:$$[$0-1].actor, text:$$[$0]}]; break; case 51: this.$ = [$$[$0-1], {type:'addProperties', actor:$$[$0-1].actor, text:$$[$0]}]; break; case 52: this.$ = [$$[$0-1], {type:'addDetails', actor:$$[$0-1].actor, text:$$[$0]}]; break; case 55: this.$ = [$$[$0-2], $$[$0]]; break; case 56: this.$ = $$[$0]; break; case 57: this.$ = yy.PLACEMENT.LEFTOF; break; case 58: this.$ = yy.PLACEMENT.RIGHTOF; break; case 59: this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]}, {type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]} ] break; case 60: this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]}, {type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-4]} ] break; case 61: this.$ = [$$[$0-3],$$[$0-1],{type: 'addMessage', from:$$[$0-3].actor, to:$$[$0-1].actor, signalType:$$[$0-2], msg:$$[$0]}] break; case 62: this.$={ type: 'addParticipant', actor:$$[$0]} break; case 63: this.$ = yy.LINETYPE.SOLID_OPEN; break; case 64: this.$ = yy.LINETYPE.DOTTED_OPEN; break; case 65: this.$ = yy.LINETYPE.SOLID; break; case 66: this.$ = yy.LINETYPE.DOTTED; break; case 67: this.$ = yy.LINETYPE.SOLID_CROSS; break; case 68: this.$ = yy.LINETYPE.DOTTED_CROSS; break; case 69: this.$ = yy.LINETYPE.SOLID_POINT; break; case 70: this.$ = yy.LINETYPE.DOTTED_POINT; break; case 71: this.$ = yy.parseMessage($$[$0].trim().substring(1)) break; case 72: yy.parseDirective('%%{', 'open_directive'); break; case 73: yy.parseDirective($$[$0], 'type_directive'); break; case 74: $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive'); break; case 75: yy.parseDirective('}%%', 'close_directive', 'sequence'); break; } }, table: [{3:1,4:$V0,5:$V1,6:4,7:$V2,11:6,79:$V3},{1:[3]},{3:8,4:$V0,5:$V1,6:4,7:$V2,11:6,79:$V3},{3:9,4:$V0,5:$V1,6:4,7:$V2,11:6,79:$V3},{3:10,4:$V0,5:$V1,6:4,7:$V2,11:6,79:$V3},o([1,4,5,16,20,22,25,26,32,33,34,36,38,39,41,42,43,45,47,49,53,58,59,60,61,69,79],$V4,{8:11}),{12:12,80:[1,13]},{80:[2,72]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{13:49,14:[1,50],82:$Vu},o([14,82],[2,73]),o($Vv,[2,6]),{6:41,10:52,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},o($Vv,[2,8]),o($Vv,[2,9]),{17:53,69:$Vt},{17:54,69:$Vt},{5:[1,55]},{5:[1,58],23:[1,56],24:[1,57]},{17:59,69:$Vt},{17:60,69:$Vt},{5:[1,61]},{5:[1,62]},{5:[1,63]},{5:[1,64]},{5:[1,65]},o($Vv,[2,28]),o($Vv,[2,29]),{35:[1,66]},{37:[1,67]},o($Vv,[2,32]),{19:[1,68]},{19:[1,69]},{19:[1,70]},{19:[1,71]},{19:[1,72]},{19:[1,73]},{19:[1,74]},o($Vv,[2,40]),{66:75,70:[1,76],71:[1,77],72:[1,78],73:[1,79],74:[1,80],75:[1,81],76:[1,82],77:[1,83]},{54:84,56:[1,85],64:[1,86],65:[1,87]},{17:88,69:$Vt},{17:89,69:$Vt},{17:90,69:$Vt},{17:91,69:$Vt},o([5,18,63,70,71,72,73,74,75,76,77,78],[2,62]),{5:[1,92]},{15:93,81:[1,94]},{5:[2,75]},o($Vv,[2,7]),{5:[1,96],18:[1,95]},{5:[1,98],18:[1,97]},o($Vv,[2,16]),{5:[1,100],23:[1,99]},{5:[1,101]},o($Vv,[2,20]),{5:[1,102]},{5:[1,103]},o($Vv,[2,23]),o($Vv,[2,24]),o($Vv,[2,25]),o($Vv,[2,26]),o($Vv,[2,27]),o($Vv,[2,30]),o($Vv,[2,31]),o($Vw,$V4,{8:104}),o($Vw,$V4,{8:105}),o($Vw,$V4,{8:106}),o($Vx,$V4,{44:107,8:108}),o($Vy,$V4,{46:109,8:110}),o($Vz,$V4,{48:111,8:112}),o($Vw,$V4,{8:113}),{17:116,67:[1,114],68:[1,115],69:$Vt},o($VA,[2,63]),o($VA,[2,64]),o($VA,[2,65]),o($VA,[2,66]),o($VA,[2,67]),o($VA,[2,68]),o($VA,[2,69]),o($VA,[2,70]),{17:117,69:$Vt},{17:119,57:118,69:$Vt},{69:[2,57]},{69:[2,58]},{55:120,78:$VB},{55:122,78:$VB},{55:123,78:$VB},{55:124,78:$VB},o($VC,[2,10]),{13:125,82:$Vu},{82:[2,74]},{19:[1,126]},o($Vv,[2,13]),{19:[1,127]},o($Vv,[2,15]),{5:[1,128]},o($Vv,[2,18]),o($Vv,[2,19]),o($Vv,[2,21]),o($Vv,[2,22]),{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[1,129],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[1,130],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[1,131],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{40:[1,132]},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[2,45],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,52:[1,133],53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{40:[1,134]},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[2,43],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,51:[1,135],53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{40:[1,136]},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[2,41],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,50:[1,137],53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[1,138],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{17:139,69:$Vt},{17:140,69:$Vt},{55:141,78:$VB},{55:142,78:$VB},{55:143,78:$VB},{63:[1,144],78:[2,56]},{5:[2,49]},{5:[2,71]},{5:[2,50]},{5:[2,51]},{5:[2,52]},{5:[1,145]},{5:[1,146]},{5:[1,147]},o($Vv,[2,17]),o($Vv,[2,33]),o($Vv,[2,34]),o($Vv,[2,35]),o($Vv,[2,36]),{19:[1,148]},o($Vv,[2,37]),{19:[1,149]},o($Vv,[2,38]),{19:[1,150]},o($Vv,[2,39]),{55:151,78:$VB},{55:152,78:$VB},{5:[2,61]},{5:[2,47]},{5:[2,48]},{17:153,69:$Vt},o($VC,[2,11]),o($Vv,[2,12]),o($Vv,[2,14]),o($Vx,$V4,{8:108,44:154}),o($Vy,$V4,{8:110,46:155}),o($Vz,$V4,{8:112,48:156}),{5:[2,59]},{5:[2,60]},{78:[2,55]},{40:[2,46]},{40:[2,44]},{40:[2,42]}], defaultActions: {7:[2,72],8:[2,1],9:[2,2],10:[2,3],51:[2,75],86:[2,57],87:[2,58],94:[2,74],120:[2,49],121:[2,71],122:[2,50],123:[2,51],124:[2,52],141:[2,61],142:[2,47],143:[2,48],151:[2,59],152:[2,60],153:[2,55],154:[2,46],155:[2,44],156:[2,42]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {"case-insensitive":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0: this.begin('open_directive'); return 79; break; case 1: this.begin('type_directive'); return 80; break; case 2: this.popState(); this.begin('arg_directive'); return 14; break; case 3: this.popState(); this.popState(); return 82; break; case 4:return 81; break; case 5:return 5; break; case 6:/* skip all whitespace */ break; case 7:/* skip same-line whitespace */ break; case 8:/* skip comments */ break; case 9:/* skip comments */ break; case 10:/* skip comments */ break; case 11:return 23; break; case 12: this.begin('ID'); return 16; break; case 13: this.begin('ID'); return 20; break; case 14: yy_.yytext = yy_.yytext.trim(); this.begin('ALIAS'); return 69; break; case 15: this.popState(); this.popState(); this.begin('LINE'); return 18; break; case 16: this.popState(); this.popState(); return 5; break; case 17: this.begin('LINE'); return 39; break; case 18: this.begin('LINE'); return 41; break; case 19: this.begin('LINE'); return 42; break; case 20: this.begin('LINE'); return 43; break; case 21: this.begin('LINE'); return 52; break; case 22: this.begin('LINE'); return 45; break; case 23: this.begin('LINE'); return 51; break; case 24: this.begin('LINE'); return 47; break; case 25: this.begin('LINE'); return 50; break; case 26: this.begin('LINE'); return 49; break; case 27: this.popState(); return 19; break; case 28:return 40; break; case 29:return 64; break; case 30:return 65; break; case 31:return 58; break; case 32:return 59; break; case 33:return 60; break; case 34:return 61; break; case 35:return 56; break; case 36:return 53; break; case 37: this.begin('ID'); return 25; break; case 38: this.begin('ID'); return 26; break; case 39:return 32; break; case 40:return 33; break; case 41: this.begin("acc_title");return 34; break; case 42: this.popState(); return "acc_title_value"; break; case 43: this.begin("acc_descr");return 36; break; case 44: this.popState(); return "acc_descr_value"; break; case 45: this.begin("acc_descr_multiline"); break; case 46: this.popState(); break; case 47:return "acc_descr_multiline_value"; break; case 48:return 7; break; case 49:return 22; break; case 50:return 24; break; case 51:return 63; break; case 52:return 5; break; case 53: yy_.yytext = yy_.yytext.trim(); return 69; break; case 54:return 72; break; case 55:return 73; break; case 56:return 70; break; case 57:return 71; break; case 58:return 74; break; case 59:return 75; break; case 60:return 76; break; case 61:return 77; break; case 62:return 78; break; case 63:return 67; break; case 64:return 68; break; case 65:return 5; break; case 66:return 'INVALID'; break; } }, rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[0-9]+(?=[ \n]+))/i,/^(?:participant\b)/i,/^(?:actor\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,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\+\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?::(?:(?:no)?wrap)?[^#\n;]+)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i], conditions: {"acc_descr_multiline":{"rules":[46,47],"inclusive":false},"acc_descr":{"rules":[44],"inclusive":false},"acc_title":{"rules":[42],"inclusive":false},"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,14],"inclusive":false},"ALIAS":{"rules":[7,8,15,16],"inclusive":false},"LINE":{"rules":[7,8,27],"inclusive":false},"INITIAL":{"rules":[0,5,6,8,9,10,11,12,13,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,45,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?e940").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./src/diagrams/state/parser/stateDiagram.jison": /*!******************************************************!*\ !*** ./src/diagrams/state/parser/stateDiagram.jison ***! \******************************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var 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,33],$Vc=[1,23],$Vd=[1,24],$Ve=[1,25],$Vf=[1,26],$Vg=[1,27],$Vh=[1,30],$Vi=[1,31],$Vj=[1,32],$Vk=[1,35],$Vl=[1,36],$Vm=[1,37],$Vn=[1,38],$Vo=[1,34],$Vp=[1,41],$Vq=[1,4,5,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],$Vr=[1,4,5,12,13,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],$Vs=[1,4,5,7,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],$Vt=[4,5,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"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,"CHOICE":25,"CONCURRENT":26,"note":27,"notePosition":28,"NOTE_TEXT":29,"direction":30,"acc_title":31,"acc_title_value":32,"acc_descr":33,"acc_descr_value":34,"acc_descr_multiline_value":35,"openDirective":36,"typeDirective":37,"closeDirective":38,":":39,"argDirective":40,"direction_tb":41,"direction_bt":42,"direction_rl":43,"direction_lr":44,"eol":45,";":46,"EDGE_STATE":47,"left_of":48,"right_of":49,"open_directive":50,"type_directive":51,"arg_directive":52,"close_directive":53,"$accept":0,"$end":1}, terminals_: {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:"CHOICE",26:"CONCURRENT",27:"note",29:"NOTE_TEXT",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",39:":",41:"direction_tb",42:"direction_bt",43:"direction_rl",44:"direction_lr",46:";",47:"EDGE_STATE",48:"left_of",49:"right_of",50:"open_directive",51:"type_directive",52:"arg_directive",53:"close_directive"}, productions_: [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,1],[10,4],[10,4],[10,1],[10,1],[10,2],[10,2],[10,1],[6,3],[6,5],[30,1],[30,1],[30,1],[30,1],[45,1],[45,1],[11,1],[11,1],[28,1],[28,1],[36,1],[37,1],[40,1],[38,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 4: /*console.warn('Root document', $$[$0]);*/ yy.setRootDoc($$[$0]);return $$[$0]; break; case 5: this.$ = [] break; case 6: if($$[$0]!='nl'){ $$[$0-1].push($$[$0]);this.$ = $$[$0-1] } // console.warn('Got document',$$[$0-1], $$[$0]); break; case 7: case 8: this.$ = $$[$0] break; case 9: this.$='nl'; break; case 10: /*console.warn('got id and descr', $$[$0]);*/this.$={ stmt: 'state', id: $$[$0], type: 'default', description: ''}; break; case 11: /*console.warn('got id and descr', $$[$0-1], $$[$0].trim());*/this.$={ stmt: 'state', id: $$[$0-1], type: 'default', description: yy.trimColon($$[$0])}; break; case 12: /*console.warn('got id', $$[$0-2]);yy.addRelation($$[$0-2], $$[$0]);*/ this.$={ stmt: 'relation', state1: { stmt: 'state', id: $$[$0-2], type: 'default', description: '' }, state2:{ stmt: 'state', id: $$[$0] ,type: 'default', description: ''}}; break; case 13: /*yy.addRelation($$[$0-3], $$[$0-1], $$[$0].substr(1).trim());*/ 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()}; break; case 17: /* console.warn('Adding document for state without id ', $$[$0-3]);*/ this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: '', doc: $$[$0-1] } break; case 18: var id=$$[$0]; var description = $$[$0-2].trim(); if($$[$0].match(':')){ var parts = $$[$0].split(':'); id=parts[0]; description = [description, parts[1]]; } this.$={stmt: 'state', id: id, type: 'default', description: description}; break; case 19: // console.warn('Adding document for state with id zxzx', $$[$0-3], $$[$0-2], yy.getDirection()); yy.addDocument($$[$0-3]); this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: $$[$0-5], doc: $$[$0-1] } break; case 20: this.$={ stmt: 'state', id: $$[$0], type: 'fork' } break; case 21: this.$={ stmt: 'state', id: $$[$0], type: 'join' } break; case 22: this.$={ stmt: 'state', id: $$[$0], type: 'choice' } break; case 23: this.$={ stmt: 'state', id: yy.getDividerId(), type: 'divider' } break; case 24: /* console.warn('got NOTE, position: ', $$[$0-2].trim(), 'id = ', $$[$0-1].trim(), 'note: ', $$[$0]);*/ this.$={ stmt: 'state', id: $$[$0-1].trim(), note:{position: $$[$0-2].trim(), text: $$[$0].trim()}}; break; case 28: this.$=$$[$0].trim();yy.setAccTitle(this.$); break; case 29: case 30: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 33: yy.setDirection('TB');this.$={stmt:'dir', value:'TB'}; break; case 34: yy.setDirection('BT');this.$={stmt:'dir', value:'BT'}; break; case 35: yy.setDirection('RL'); this.$={stmt:'dir', value:'RL'}; break; case 36: yy.setDirection('LR');this.$={stmt:'dir', value:'LR'}; break; case 39: case 40: this.$=$$[$0]; break; case 43: yy.parseDirective('%%{', 'open_directive'); break; case 44: yy.parseDirective($$[$0], 'type_directive'); break; case 45: $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive'); break; case 46: yy.parseDirective('}%%', 'close_directive', 'state'); break; } }, table: [{3:1,4:$V0,5:$V1,6:4,7:$V2,36:6,50:$V3},{1:[3]},{3:8,4:$V0,5:$V1,6:4,7:$V2,36:6,50:$V3},{3:9,4:$V0,5:$V1,6:4,7:$V2,36:6,50:$V3},{3:10,4:$V0,5:$V1,6:4,7:$V2,36:6,50:$V3},o([1,4,5,14,15,17,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],$V4,{8:11}),{37:12,51:[1,13]},{51:[2,43]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:$V5,5:$V6,6:28,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:$Vh,33:$Vi,35:$Vj,36:6,41:$Vk,42:$Vl,43:$Vm,44:$Vn,47:$Vo,50:$V3},{38:39,39:[1,40],53:$Vp},o([39,53],[2,44]),o($Vq,[2,6]),{6:28,10:42,11:18,14:$V7,15:$V8,17:$V9,20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:$Vh,33:$Vi,35:$Vj,36:6,41:$Vk,42:$Vl,43:$Vm,44:$Vn,47:$Vo,50:$V3},o($Vq,[2,8]),o($Vq,[2,9]),o($Vq,[2,10],{12:[1,43],13:[1,44]}),o($Vq,[2,14]),{16:[1,45]},o($Vq,[2,16],{18:[1,46]}),{21:[1,47]},o($Vq,[2,20]),o($Vq,[2,21]),o($Vq,[2,22]),o($Vq,[2,23]),{28:48,29:[1,49],48:[1,50],49:[1,51]},o($Vq,[2,26]),o($Vq,[2,27]),{32:[1,52]},{34:[1,53]},o($Vq,[2,30]),o($Vr,[2,39]),o($Vr,[2,40]),o($Vq,[2,33]),o($Vq,[2,34]),o($Vq,[2,35]),o($Vq,[2,36]),o($Vs,[2,31]),{40:54,52:[1,55]},o($Vs,[2,46]),o($Vq,[2,7]),o($Vq,[2,11]),{11:56,22:$Vb,47:$Vo},o($Vq,[2,15]),o($Vt,$V4,{8:57}),{22:[1,58]},{22:[1,59]},{21:[1,60]},{22:[2,41]},{22:[2,42]},o($Vq,[2,28]),o($Vq,[2,29]),{38:61,53:$Vp},{53:[2,45]},o($Vq,[2,12],{12:[1,62]}),{4:$V5,5:$V6,6:28,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,19:[1,63],20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:$Vh,33:$Vi,35:$Vj,36:6,41:$Vk,42:$Vl,43:$Vm,44:$Vn,47:$Vo,50:$V3},o($Vq,[2,18],{18:[1,64]}),{29:[1,65]},{22:[1,66]},o($Vs,[2,32]),o($Vq,[2,13]),o($Vq,[2,17]),o($Vt,$V4,{8:67}),o($Vq,[2,24]),o($Vq,[2,25]),{4:$V5,5:$V6,6:28,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,19:[1,68],20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:$Vh,33:$Vi,35:$Vj,36:6,41:$Vk,42:$Vl,43:$Vm,44:$Vn,47:$Vo,50:$V3},o($Vq,[2,19])], defaultActions: {7:[2,43],8:[2,1],9:[2,2],10:[2,3],50:[2,41],51:[2,42],55:[2,45]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {"case-insensitive":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0:return 41; break; case 1:return 42; break; case 2:return 43; break; case 3:return 44; break; case 4: this.begin('open_directive'); return 50; break; case 5: this.begin('type_directive'); return 51; break; case 6: this.popState(); this.begin('arg_directive'); return 39; break; case 7: this.popState(); this.popState(); return 53; break; case 8:return 52; break; case 9:/* skip comments */ break; case 10:/* skip comments */{ /*console.log('Crap after close');*/ } break; case 11:return 5; break; case 12:/* skip all whitespace */ break; case 13:/* skip same-line whitespace */ break; case 14:/* skip comments */ break; case 15:/* skip comments */ break; case 16: this.pushState('SCALE'); /* console.log('Got scale', yy_.yytext);*/ return 15; break; case 17:return 16; break; case 18:this.popState(); break; case 19: this.begin("acc_title");return 31; break; case 20: this.popState(); return "acc_title_value"; break; case 21: this.begin("acc_descr");return 33; break; case 22: this.popState(); return "acc_descr_value"; break; case 23: this.begin("acc_descr_multiline"); break; case 24: this.popState(); break; case 25:return "acc_descr_multiline_value"; break; case 26: /*console.log('Starting STATE zxzx'+yy.getDirection());*/this.pushState('STATE'); break; case 27:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim(); /*console.warn('Fork Fork: ',yy_.yytext);*/return 23; break; case 28:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24; break; case 29:this.popState();yy_.yytext=yy_.yytext.slice(0,-10).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 25; break; case 30:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Fork: ',yy_.yytext);*/return 23; break; case 31:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24; break; case 32:this.popState();yy_.yytext=yy_.yytext.slice(0,-10).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 25; break; case 33: return 41; break; case 34: return 42; break; case 35: return 43; break; case 36: return 44; break; case 37: /*console.log('Starting STATE_STRING zxzx');*/this.begin("STATE_STRING"); break; case 38:this.popState();this.pushState('STATE_ID');return "AS"; break; case 39:this.popState();/* console.log('STATE_ID', yy_.yytext);*/return "ID"; break; case 40:this.popState(); break; case 41: /*console.log('Long description:', yy_.yytext);*/return "STATE_DESCR"; break; case 42:/*console.log('COMPOSIT_STATE', yy_.yytext);*/return 17; break; case 43:this.popState(); break; case 44:this.popState();this.pushState('struct'); /*console.log('begin struct', yy_.yytext);*/return 18; break; case 45: /*console.log('Ending struct');*/ this.popState(); return 19; break; case 46:/* nothing */ break; case 47: this.begin('NOTE'); return 27; break; case 48: this.popState();this.pushState('NOTE_ID');return 48; break; case 49: this.popState();this.pushState('NOTE_ID');return 49; break; case 50: this.popState();this.pushState('FLOATING_NOTE'); break; case 51:this.popState();this.pushState('FLOATING_NOTE_ID');return "AS"; break; case 52:/**/ break; case 53: /*console.log('Floating note text: ', yy_.yytext);*/return "NOTE_TEXT"; break; case 54:this.popState();/*console.log('Floating note ID', yy_.yytext);*/return "ID"; break; case 55: this.popState();this.pushState('NOTE_TEXT');/*console.log('Got ID for note', yy_.yytext);*/return 22; break; case 56: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.substr(2).trim();return 29; break; case 57: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.slice(0,-8).trim();return 29; break; case 58: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7; break; case 59: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7; break; case 60: /*console.log('HIDE_EMPTY', yy_.yytext,'#');*/return 14; break; case 61: /*console.log('EDGE_STATE=',yy_.yytext);*/ return 47; break; case 62: /*console.log('=>ID=',yy_.yytext);*/ return 22; break; case 63: yy_.yytext = yy_.yytext.trim(); /*console.log('Descr = ', yy_.yytext);*/ return 12; break; case 64:return 13; break; case 65:return 26; break; case 66:return 5; break; case 67:return 'INVALID'; break; } }, rules: [/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%\{)/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,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:state\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/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\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], conditions: {"LINE":{"rules":[13,14],"inclusive":false},"close_directive":{"rules":[13,14],"inclusive":false},"arg_directive":{"rules":[7,8,13,14],"inclusive":false},"type_directive":{"rules":[6,7,13,14],"inclusive":false},"open_directive":{"rules":[5,13,14],"inclusive":false},"struct":{"rules":[13,14,26,33,34,35,36,45,46,47,61,62,63,64,65],"inclusive":false},"FLOATING_NOTE_ID":{"rules":[54],"inclusive":false},"FLOATING_NOTE":{"rules":[51,52,53],"inclusive":false},"NOTE_TEXT":{"rules":[56,57],"inclusive":false},"NOTE_ID":{"rules":[55],"inclusive":false},"NOTE":{"rules":[48,49,50],"inclusive":false},"acc_descr_multiline":{"rules":[24,25],"inclusive":false},"acc_descr":{"rules":[22],"inclusive":false},"acc_title":{"rules":[20],"inclusive":false},"SCALE":{"rules":[17,18],"inclusive":false},"ALIAS":{"rules":[],"inclusive":false},"STATE_ID":{"rules":[39],"inclusive":false},"STATE_STRING":{"rules":[40,41],"inclusive":false},"FORK_STATE":{"rules":[],"inclusive":false},"STATE":{"rules":[13,14,27,28,29,30,31,32,37,38,42,43,44],"inclusive":false},"ID":{"rules":[13,14],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,9,10,11,12,14,15,16,19,21,23,26,44,47,58,59,60,61,62,63,64,66,67],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?a3b8").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./src/diagrams/user-journey/parser/journey.jison": /*!********************************************************!*\ !*** ./src/diagrams/user-journey/parser/journey.jison ***! \********************************************************/ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); /* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: Parser: { yy: {} } Parser.prototype: { yy: {}, trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), parse: function(input), lexer: { EOF: 1, parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), less: function(n), pastInput: function(), upcomingInput: function(), showPosition: function(), test_match: function(regex_match_array, rule_index), next: function(), lex: function(), begin: function(condition), popState: function(), _currentRules: function(), topState: function(), pushState: function(condition), options: { ranges: boolean (optional: true ==> token location info will include a .range[] member) flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 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) }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], conditions: {associative list: name ==> set}, } } token location info (@$, _$, etc.): { first_line: n, last_line: n, first_column: n, last_column: n, range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) } the parseError function receives a 'hash' object with these members for lexer and parser errors: { text: (matched text) token: (the produced terminal token, if any) line: (yylineno) } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) expected: (string describing the set of expected tokens) recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var parser = (function(){ var 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,20,22,23,24,26],$V3=[1,15],$V4=[1,16],$V5=[1,17],$V6=[1,18],$V7=[1,19],$V8=[1,20],$V9=[1,24],$Va=[4,6,9,11,17,18,20,22,23,24,26]; var parser = {trace: function trace () { }, yy: {}, symbols_: {"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,"acc_title":18,"acc_title_value":19,"acc_descr":20,"acc_descr_value":21,"acc_descr_multiline_value":22,"section":23,"taskName":24,"taskData":25,"open_directive":26,"type_directive":27,"arg_directive":28,"close_directive":29,"$accept":0,"$end":1}, terminals_: {2:"error",4:"journey",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",17:"title",18:"acc_title",19:"acc_title_value",20:"acc_descr",21:"acc_descr_value",22:"acc_descr_multiline_value",23:"section",24:"taskName",25:"taskData",26:"open_directive",27:"type_directive",28:"arg_directive",29:"close_directive"}, productions_: [0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,2],[10,2],[10,1],[10,1],[10,2],[10,1],[12,1],[13,1],[16,1],[14,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { case 1: return $$[$0-1]; break; case 3: this.$ = [] break; case 4: $$[$0-1].push($$[$0]);this.$ = $$[$0-1] break; case 5: case 6: this.$ = $$[$0] break; case 7: case 8: this.$=[]; break; case 11: yy.setDiagramTitle($$[$0].substr(6));this.$=$$[$0].substr(6); break; case 12: this.$=$$[$0].trim();yy.setAccTitle(this.$); break; case 13: case 14: this.$=$$[$0].trim();yy.setAccDescription(this.$); break; case 15: yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8); break; case 16: yy.addTask($$[$0-1], $$[$0]);this.$='task'; break; case 18: yy.parseDirective('%%{', 'open_directive'); break; case 19: yy.parseDirective($$[$0], 'type_directive'); break; case 20: $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive'); break; case 21: yy.parseDirective('}%%', 'close_directive', 'journey'); break; } }, table: [{3:1,4:$V0,7:3,12:4,26:$V1},{1:[3]},o($V2,[2,3],{5:6}),{3:7,4:$V0,7:3,12:4,26:$V1},{13:8,27:[1,9]},{27:[2,18]},{6:[1,10],7:21,8:11,9:[1,12],10:13,11:[1,14],12:4,17:$V3,18:$V4,20:$V5,22:$V6,23:$V7,24:$V8,26:$V1},{1:[2,2]},{14:22,15:[1,23],29:$V9},o([15,29],[2,19]),o($V2,[2,8],{1:[2,1]}),o($V2,[2,4]),{7:21,10:25,12:4,17:$V3,18:$V4,20:$V5,22:$V6,23:$V7,24:$V8,26:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,11]),{19:[1,26]},{21:[1,27]},o($V2,[2,14]),o($V2,[2,15]),{25:[1,28]},o($V2,[2,17]),{11:[1,29]},{16:30,28:[1,31]},{11:[2,21]},o($V2,[2,5]),o($V2,[2,12]),o($V2,[2,13]),o($V2,[2,16]),o($Va,[2,9]),{14:32,29:$V9},{29:[2,20]},{11:[1,33]},o($Va,[2,10])], defaultActions: {5:[2,18],7:[2,2],24:[2,21],31:[2,20]}, parseError: function parseError (str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; lstack.push(yyloc); var ranges = lexer.options && lexer.options.ranges; if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = tstack.pop() || lexer.lex() || EOF; if (typeof token !== 'number') { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == 'undefined') { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push('\'' + this.terminals_[p] + '\''); } } if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer.yytext); lstack.push(lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; if (recovering > 0) { recovering--; } } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== 'undefined') { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; }}; /* generated by jison-lex 0.3.4 */ var lexer = (function(){ var lexer = ({ EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0,0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more:function () { this._more = true; return this; }, // 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. reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less:function (n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match:function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. } return false; }, // return next match in input next:function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex:function lex () { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function begin (condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState:function popState () { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules:function _currentRules () { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState:function topState (n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState:function pushState (condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {"case-insensitive":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0: this.begin('open_directive'); return 26; break; case 1: this.begin('type_directive'); return 27; break; case 2: this.popState(); this.begin('arg_directive'); return 15; break; case 3: this.popState(); this.popState(); return 29; break; case 4:return 28; break; case 5:/* skip comments */ break; case 6:/* skip comments */ break; case 7:return 11; break; case 8:/* skip whitespace */ break; case 9:/* skip comments */ break; case 10:return 4; break; case 11:return 17; break; case 12: this.begin("acc_title");return 18; break; case 13: this.popState(); return "acc_title_value"; break; case 14: this.begin("acc_descr");return 20; break; case 15: this.popState(); return "acc_descr_value"; break; case 16: this.begin("acc_descr_multiline"); break; case 17: this.popState(); break; case 18:return "acc_descr_multiline_value"; break; case 19:return 23; break; case 20:return 24; break; case 21:return 25; break; case 22:return 15; break; case 23:return 6; break; case 24:return 'INVALID'; break; } }, rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i], conditions: {"open_directive":{"rules":[1],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"acc_descr_multiline":{"rules":[17,18],"inclusive":false},"acc_descr":{"rules":[15],"inclusive":false},"acc_title":{"rules":[13],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23,24],"inclusive":true}} }); return lexer; })(); parser.lexer = lexer; function Parser () { this.yy = {}; } Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain (args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } var source = (__webpack_require__(/*! fs */ "?0f62").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8"); return exports.parser.parse(source); }; if ( true && __webpack_require__.c[__webpack_require__.s] === module) { exports.main(process.argv.slice(1)); } } /***/ }), /***/ "./node_modules/@braintree/sanitize-url/dist/index.js": /*!************************************************************!*\ !*** ./node_modules/@braintree/sanitize-url/dist/index.js ***! \************************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.sanitizeUrl = void 0; var invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im; var htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g; var ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim; var urlSchemeRegex = /^([^:]+):/gm; var relativeFirstCharacters = [".", "/"]; function isRelativeUrlWithoutProtocol(url) { return relativeFirstCharacters.indexOf(url[0]) > -1; } // adapted from https://stackoverflow.com/a/29824550/2601552 function decodeHtmlCharacters(str) { return str.replace(htmlEntitiesRegex, function (match, dec) { return String.fromCharCode(dec); }); } function sanitizeUrl(url) { var sanitizedUrl = decodeHtmlCharacters(url || "") .replace(ctrlCharactersRegex, "") .trim(); if (!sanitizedUrl) { return "about:blank"; } if (isRelativeUrlWithoutProtocol(sanitizedUrl)) { return sanitizedUrl; } var urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex); if (!urlSchemeParseResults) { return sanitizedUrl; } var urlScheme = urlSchemeParseResults[0]; if (invalidProtocolRegex.test(urlScheme)) { return "about:blank"; } return sanitizedUrl; } exports.sanitizeUrl = sanitizeUrl; /***/ }), /***/ "./src/accessibility.js": /*!******************************!*\ !*** ./src/accessibility.js ***! \******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ addSVGAccessibilityFields) /* harmony export */ }); /** * This method will add a basic title and description element to a chart. The yy parser will need to * respond to getAccTitle and getAccDescription, where the title is the title element on the chart, * which is generally not displayed and the accDescription is the description element on the chart, * which is never displayed. * * The following charts display their title as a visual and accessibility element: gantt * * @param yy_parser * @param svg * @param id */ function addSVGAccessibilityFields(yy_parser, svg, id) { if (typeof svg.insert === 'undefined') { return; } var title_string = yy_parser.getAccTitle(); var description = yy_parser.getAccDescription(); svg.attr('role', 'img').attr('aria-labelledby', 'chart-title-' + id + ' chart-desc-' + id); svg.insert('desc', ':first-child').attr('id', 'chart-desc-' + id).text(description); svg.insert('title', ':first-child').attr('id', 'chart-title-' + id).text(title_string); } /***/ }), /***/ "./src/commonDb.js": /*!*************************!*\ !*** ./src/commonDb.js ***! \*************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "clear": () => (/* binding */ clear), /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ "getAccDescription": () => (/* binding */ getAccDescription), /* harmony export */ "getAccTitle": () => (/* binding */ getAccTitle), /* harmony export */ "getDiagramTitle": () => (/* binding */ getDiagramTitle), /* harmony export */ "setAccDescription": () => (/* binding */ setAccDescription), /* harmony export */ "setAccTitle": () => (/* binding */ setAccTitle), /* harmony export */ "setDiagramTitle": () => (/* binding */ setDiagramTitle) /* harmony export */ }); /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./diagrams/common/common */ "./src/diagrams/common/common.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./config */ "./src/config.js"); var title = ''; var diagramTitle = ''; var description = ''; var sanitizeText = function sanitizeText(txt) { return (0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_0__.sanitizeText)(txt, (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)()); }; var clear = function clear() { title = ''; description = ''; diagramTitle = ''; }; var setAccTitle = function setAccTitle(txt) { title = sanitizeText(txt).replace(/^\s+/g, ''); }; var getAccTitle = function getAccTitle() { return title || diagramTitle; }; var setAccDescription = function setAccDescription(txt) { description = sanitizeText(txt).replace(/\n\s+/g, '\n'); }; var getAccDescription = function getAccDescription() { return description; }; var setDiagramTitle = function setDiagramTitle(txt) { diagramTitle = sanitizeText(txt); }; var getDiagramTitle = function getDiagramTitle() { return diagramTitle; }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ setAccTitle: setAccTitle, getAccTitle: getAccTitle, setDiagramTitle: setDiagramTitle, getDiagramTitle: getDiagramTitle, getAccDescription: getAccDescription, setAccDescription: setAccDescription, clear: clear }); /***/ }), /***/ "./src/config.js": /*!***********************!*\ !*** ./src/config.js ***! \***********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "addDirective": () => (/* binding */ addDirective), /* harmony export */ "defaultConfig": () => (/* binding */ defaultConfig), /* harmony export */ "getConfig": () => (/* binding */ getConfig), /* harmony export */ "getSiteConfig": () => (/* binding */ getSiteConfig), /* harmony export */ "reset": () => (/* binding */ reset), /* harmony export */ "sanitize": () => (/* binding */ sanitize), /* harmony export */ "saveConfigFromInitialize": () => (/* binding */ saveConfigFromInitialize), /* harmony export */ "setConfig": () => (/* binding */ setConfig), /* harmony export */ "setSiteConfig": () => (/* binding */ setSiteConfig), /* harmony export */ "updateCurrentConfig": () => (/* binding */ updateCurrentConfig), /* harmony export */ "updateSiteConfig": () => (/* binding */ updateSiteConfig) /* harmony export */ }); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./src/utils.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ "./src/logger.js"); /* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js"); /* harmony import */ var _defaultConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaultConfig */ "./src/defaultConfig.js"); function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } var defaultConfig = Object.freeze(_defaultConfig__WEBPACK_IMPORTED_MODULE_0__["default"]); var siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, defaultConfig); var configFromInitialize; var directives = []; var currentConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, defaultConfig); var updateCurrentConfig = function updateCurrentConfig(siteCfg, _directives) { // start with config beeing the siteConfig var cfg = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, siteCfg); // let sCfg = assignWithDepth(defaultConfig, siteConfigDelta); // Join directives var sumOfDirectives = {}; for (var i = 0; i < _directives.length; i++) { var d = _directives[i]; sanitize(d); // Apply the data from the directive where the the overrides the themeVariables sumOfDirectives = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(sumOfDirectives, d); } cfg = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(cfg, sumOfDirectives); if (sumOfDirectives.theme && _themes__WEBPACK_IMPORTED_MODULE_2__["default"][sumOfDirectives.theme]) { var tmpConfigFromInitialize = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, configFromInitialize); var themeVariables = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(tmpConfigFromInitialize.themeVariables || {}, sumOfDirectives.themeVariables); cfg.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][cfg.theme].getThemeVariables(themeVariables); } currentConfig = cfg; return cfg; }; /** * ## setSiteConfig * * | Function | Description | Type | Values | * | ------------- | ------------------------------------- | ----------- | --------------------------------------- | * | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array | * * **Notes:** Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls * to reset() will reset the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) * will reset siteConfig and currentConfig to the defaultConfig Note: currentConfig is set in this * function _Default value: At default, will mirror Global Config_ * * @param conf - The base currentConfig to use as siteConfig * @returns {object} - The siteConfig */ var setSiteConfig = function setSiteConfig(conf) { siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, defaultConfig); siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(siteConfig, conf); if (conf.theme && _themes__WEBPACK_IMPORTED_MODULE_2__["default"][conf.theme]) { siteConfig.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][conf.theme].getThemeVariables(conf.themeVariables); } currentConfig = updateCurrentConfig(siteConfig, directives); return siteConfig; }; var saveConfigFromInitialize = function saveConfigFromInitialize(conf) { configFromInitialize = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, conf); }; var updateSiteConfig = function updateSiteConfig(conf) { siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(siteConfig, conf); updateCurrentConfig(siteConfig, directives); return siteConfig; }; /** * ## getSiteConfig * * | Function | Description | Type | Values | * | ------------- | ------------------------------------------------- | ----------- | -------------------------------- | * | setSiteConfig | Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig | * * **Notes**: Returns **any** values in siteConfig. * * @returns {object} - The siteConfig */ var getSiteConfig = function getSiteConfig() { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, siteConfig); }; /** * ## setConfig * * | Function | Description | Type | Values | * | ------------- | ------------------------------------- | ----------- | --------------------------------------- | * | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array | * * **Notes**: Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure * keys. Any values found in conf with key found in siteConfig.secure will be replaced with the * corresponding siteConfig value. * * @param {any} conf - The potential currentConfig * @returns {any} - The currentConfig merged with the sanitized conf */ var setConfig = function setConfig(conf) { // sanitize(conf); // Object.keys(conf).forEach(key => { // const manipulator = manipulators[key]; // conf[key] = manipulator ? manipulator(conf[key]) : conf[key]; // }); (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(currentConfig, conf); return getConfig(); }; /** * ## getConfig * * | Function | Description | Type | Return Values | * | --------- | ------------------------- | ----------- | ------------------------------ | * | getConfig | Obtains the currentConfig | Get Request | Any Values from current Config | * * **Notes**: Returns **any** the currentConfig * * @returns {any} - The currentConfig */ var getConfig = function getConfig() { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, currentConfig); }; /** * ## sanitize * * | Function | Description | Type | Values | * | -------- | -------------------------------------- | ----------- | ------ | * | sanitize | Sets the siteConfig to desired values. | Put Request | None | * * Ensures options parameter does not attempt to override siteConfig secure keys **Notes**: modifies * options in-place * * @param {any} options - The potential setConfig parameter */ var sanitize = function sanitize(options) { // Checking that options are not in the list of excluded options Object.keys(siteConfig.secure).forEach(function (key) { if (typeof options[siteConfig.secure[key]] !== 'undefined') { // DO NOT attempt to print options[siteConfig.secure[key]] within `${}` as a malicious script // can exploit the logger's attempt to stringify the value and execute arbitrary code _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug("Denied attempt to modify a secure key ".concat(siteConfig.secure[key]), options[siteConfig.secure[key]]); delete options[siteConfig.secure[key]]; } }); // Check that there no attempts of prototype pollution Object.keys(options).forEach(function (key) { if (key.indexOf('__') === 0) { delete options[key]; } }); // Check that there no attempts of xss, there should be no tags at all in the directive // blocking data urls as base64 urls can contain svgs with inline script tags Object.keys(options).forEach(function (key) { if (typeof options[key] === 'string') { if (options[key].indexOf('<') > -1 || options[key].indexOf('>') > -1 || options[key].indexOf('url(data:') > -1) { delete options[key]; } } if (_typeof(options[key]) === 'object') { sanitize(options[key]); } }); }; /** * Pushes in a directive to the configuration * * @param {object} directive The directive to push in */ var addDirective = function addDirective(directive) { if (directive.fontFamily) { if (!directive.themeVariables) { directive.themeVariables = { fontFamily: directive.fontFamily }; } else { if (!directive.themeVariables.fontFamily) { directive.themeVariables = { fontFamily: directive.fontFamily }; } } } directives.push(directive); updateCurrentConfig(siteConfig, directives); }; /** * ## reset * * | Function | Description | Type | Required | Values | * | -------- | ---------------------------- | ----------- | -------- | ------ | * | reset | Resets currentConfig to conf | Put Request | Required | None | * * ## conf * * | Parameter | Description | Type | Required | Values | * | --------- | -------------------------------------------------------------- | ---------- | -------- | -------------------------------------------- | * | conf | base set of values, which currentConfig could be **reset** to. | Dictionary | Required | Any Values, with respect to the secure Array | * * **Notes**: (default: current siteConfig ) (optional, default `getSiteConfig()`) */ var reset = function reset() { // Replace current config with siteConfig directives = []; updateCurrentConfig(siteConfig, directives); }; /***/ }), /***/ "./src/dagre-wrapper/clusters.js": /*!***************************************!*\ !*** ./src/dagre-wrapper/clusters.js ***! \***************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "clear": () => (/* binding */ clear), /* harmony export */ "getClusterTitleWidth": () => (/* binding */ getClusterTitleWidth), /* harmony export */ "insertCluster": () => (/* binding */ insertCluster), /* harmony export */ "positionCluster": () => (/* binding */ positionCluster) /* harmony export */ }); /* harmony import */ var _intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./intersect/intersect-rect */ "./src/dagre-wrapper/intersect/intersect-rect.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js"); /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js"); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../config */ "./src/config.js"); /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js"); var rect = function rect(parent, node) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Creating subgraph rect for ', node.id, node); // Add outer g element var shapeSvg = parent.insert('g').attr('class', 'cluster' + (node.class ? ' ' + node.class : '')).attr('id', node.id); // add the rect var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect var label = shapeSvg.insert('g').attr('class', 'cluster-label'); var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label var bbox = text.getBBox(); if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) { var div = text.children[0]; var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text); bbox = div.getBoundingClientRect(); dv.attr('width', bbox.width); dv.attr('height', bbox.height); } var padding = 0 * node.padding; var halfPadding = padding / 2; var width = node.width <= bbox.width + padding ? bbox.width + padding : node.width; if (node.width <= bbox.width + padding) { node.diff = (bbox.width - node.width) / 2 - node.padding / 2; } else { node.diff = -node.padding / 2; } _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Data ', node, JSON.stringify(node)); // center the rect around its coordinate rect.attr('style', node.style).attr('rx', node.rx).attr('ry', node.ry).attr('x', node.x - width / 2).attr('y', node.y - node.height / 2 - halfPadding).attr('width', width).attr('height', node.height + padding); // Center the label label.attr('transform', 'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2 + node.padding / 3) + ')'); var rectBox = rect.node().getBBox(); node.width = rectBox.width; node.height = rectBox.height; node.intersect = function (point) { return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point); }; return shapeSvg; }; /** * Non visible cluster where the note is group with its * * @param {any} parent * @param {any} node * @returns {any} ShapeSvg */ var noteGroup = function noteGroup(parent, node) { // Add outer g element var shapeSvg = parent.insert('g').attr('class', 'note-cluster').attr('id', node.id); // add the rect var rect = shapeSvg.insert('rect', ':first-child'); var padding = 0 * node.padding; var halfPadding = padding / 2; // center the rect around its coordinate 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'); var rectBox = rect.node().getBBox(); node.width = rectBox.width; node.height = rectBox.height; node.intersect = function (point) { return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point); }; return shapeSvg; }; var roundedWithTitle = function roundedWithTitle(parent, node) { // Add outer g element var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect var label = shapeSvg.insert('g').attr('class', 'cluster-label'); var innerRect = shapeSvg.append('rect'); var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label var bbox = text.getBBox(); if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) { var div = text.children[0]; var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text); bbox = div.getBoundingClientRect(); dv.attr('width', bbox.width); dv.attr('height', bbox.height); } bbox = text.getBBox(); var padding = 0 * node.padding; var halfPadding = padding / 2; var width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width; if (node.width <= bbox.width + node.padding) { node.diff = (bbox.width + node.padding * 0 - node.width) / 2; } else { node.diff = -node.padding / 2; } // center the rect around its coordinate rect.attr('class', 'outer').attr('x', node.x - width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding).attr('width', width + padding).attr('height', node.height + padding); innerRect.attr('class', 'inner').attr('x', node.x - width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding + bbox.height - 1).attr('width', width + padding).attr('height', node.height + padding - bbox.height - 3); // Center the label label.attr('transform', 'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2 - node.padding / 3 + ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels) ? 5 : 3)) + ')'); var rectBox = rect.node().getBBox(); node.height = rectBox.height; node.intersect = function (point) { return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point); }; return shapeSvg; }; var divider = function divider(parent, node) { // Add outer g element var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect var rect = shapeSvg.insert('rect', ':first-child'); var padding = 0 * node.padding; var halfPadding = padding / 2; // center the rect around its coordinate 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); var rectBox = rect.node().getBBox(); node.width = rectBox.width; node.height = rectBox.height; node.diff = -node.padding / 2; node.intersect = function (point) { return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point); }; return shapeSvg; }; var shapes = { rect: rect, roundedWithTitle: roundedWithTitle, noteGroup: noteGroup, divider: divider }; var clusterElems = {}; var insertCluster = function insertCluster(elem, node) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Inserting cluster'); var shape = node.shape || 'rect'; clusterElems[node.id] = shapes[shape](elem, node); }; var getClusterTitleWidth = function getClusterTitleWidth(elem, node) { var label = (0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true); elem.node().appendChild(label); var width = label.getBBox().width; elem.node().removeChild(label); return width; }; var clear = function clear() { clusterElems = {}; }; var positionCluster = function positionCluster(node) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Position cluster (' + node.id + ', ' + node.x + ', ' + node.y + ')'); var el = clusterElems[node.id]; el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')'); }; /***/ }), /***/ "./src/dagre-wrapper/createLabel.js": /*!******************************************!*\ !*** ./src/dagre-wrapper/createLabel.js ***! \******************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../logger */ "./src/logger.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config */ "./src/config.js"); /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js"); function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } // eslint-disable-line var sanitizeTxt = function sanitizeTxt(txt) { return (0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.sanitizeText)(txt, (0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)()); }; /** * @param dom * @param styleFn */ function applyStyle(dom, styleFn) { if (styleFn) { dom.attr('style', styleFn); } } /** * @param {any} node * @returns {SVGForeignObjectElement} Node */ function addHtmlLabel(node) { var fo = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject')); var div = fo.append('xhtml:div'); var label = node.label; var labelClass = node.isNode ? 'nodeLabel' : 'edgeLabel'; div.html('' + label + ''); applyStyle(div, node.labelStyle); div.style('display', 'inline-block'); // Fix for firefox div.style('white-space', 'nowrap'); div.attr('xmlns', 'http://www.w3.org/1999/xhtml'); return fo.node(); } var createLabel = function createLabel(_vertexText, style, isTitle, isNode) { var vertexText = _vertexText || ''; if (_typeof(vertexText) === 'object') vertexText = vertexText[0]; if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) { // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that? vertexText = vertexText.replace(/\\n|\n/g, '
'); _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('vertexText' + vertexText); var node = { isNode: isNode, label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) { return ""); }), labelStyle: style.replace('fill:', 'color:') }; var vertexNode = addHtmlLabel(node); // vertexNode.parentNode.removeChild(vertexNode); return vertexNode; } else { var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text'); svgLabel.setAttribute('style', style.replace('color:', 'fill:')); var rows = []; if (typeof vertexText === 'string') { rows = vertexText.split(/\\n|\n|/gi); } else if (Array.isArray(vertexText)) { rows = vertexText; } else { rows = []; } for (var j = 0; j < rows.length; j++) { var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan'); tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve'); tspan.setAttribute('dy', '1em'); tspan.setAttribute('x', '0'); if (isTitle) { tspan.setAttribute('class', 'title-row'); } else { tspan.setAttribute('class', 'row'); } tspan.textContent = rows[j].trim(); svgLabel.appendChild(tspan); } return svgLabel; } }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (createLabel); /***/ }), /***/ "./src/dagre-wrapper/edges.js": /*!************************************!*\ !*** ./src/dagre-wrapper/edges.js ***! \************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "clear": () => (/* binding */ clear), /* harmony export */ "insertEdge": () => (/* binding */ insertEdge), /* harmony export */ "insertEdgeLabel": () => (/* binding */ insertEdgeLabel), /* harmony export */ "intersection": () => (/* binding */ intersection), /* harmony export */ "positionEdgeLabel": () => (/* binding */ positionEdgeLabel) /* harmony export */ }); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../logger */ "./src/logger.js"); /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js"); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../config */ "./src/config.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils */ "./src/utils.js"); /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js"); // eslint-disable-line var edgeLabels = {}; var terminalLabels = {}; var clear = function clear() { edgeLabels = {}; terminalLabels = {}; }; var insertEdgeLabel = function insertEdgeLabel(elem, edge) { // Create the actual text element var labelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.label, edge.labelStyle); // Create outer g, edgeLabel, this will be positioned after graph layout var edgeLabel = elem.insert('g').attr('class', 'edgeLabel'); // Create inner g, label, this will be positioned now for centering the text var label = edgeLabel.insert('g').attr('class', 'label'); label.node().appendChild(labelElement); // Center the label var bbox = labelElement.getBBox(); if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.htmlLabels)) { var div = labelElement.children[0]; var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(labelElement); bbox = div.getBoundingClientRect(); dv.attr('width', bbox.width); dv.attr('height', bbox.height); } label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')'); // Make element accessible by id for positioning edgeLabels[edge.id] = edgeLabel; // Update the abstract data of the edge with the new information about its width and height edge.width = bbox.width; edge.height = bbox.height; var fo; if (edge.startLabelLeft) { // Create the actual text element var startLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.startLabelLeft, edge.labelStyle); var startEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals'); var inner = startEdgeLabelLeft.insert('g').attr('class', 'inner'); fo = inner.node().appendChild(startLabelElement); var slBox = startLabelElement.getBBox(); inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')'); if (!terminalLabels[edge.id]) { terminalLabels[edge.id] = {}; } terminalLabels[edge.id].startLeft = startEdgeLabelLeft; setTerminalWidth(fo, edge.startLabelLeft); } if (edge.startLabelRight) { // Create the actual text element var _startLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.startLabelRight, edge.labelStyle); var startEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals'); var _inner = startEdgeLabelRight.insert('g').attr('class', 'inner'); fo = startEdgeLabelRight.node().appendChild(_startLabelElement); _inner.node().appendChild(_startLabelElement); var _slBox = _startLabelElement.getBBox(); _inner.attr('transform', 'translate(' + -_slBox.width / 2 + ', ' + -_slBox.height / 2 + ')'); if (!terminalLabels[edge.id]) { terminalLabels[edge.id] = {}; } terminalLabels[edge.id].startRight = startEdgeLabelRight; setTerminalWidth(fo, edge.startLabelRight); } if (edge.endLabelLeft) { // Create the actual text element var endLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.endLabelLeft, edge.labelStyle); var endEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals'); var _inner2 = endEdgeLabelLeft.insert('g').attr('class', 'inner'); fo = _inner2.node().appendChild(endLabelElement); var _slBox2 = endLabelElement.getBBox(); _inner2.attr('transform', 'translate(' + -_slBox2.width / 2 + ', ' + -_slBox2.height / 2 + ')'); endEdgeLabelLeft.node().appendChild(endLabelElement); if (!terminalLabels[edge.id]) { terminalLabels[edge.id] = {}; } terminalLabels[edge.id].endLeft = endEdgeLabelLeft; setTerminalWidth(fo, edge.endLabelLeft); } if (edge.endLabelRight) { // Create the actual text element var _endLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.endLabelRight, edge.labelStyle); var endEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals'); var _inner3 = endEdgeLabelRight.insert('g').attr('class', 'inner'); fo = _inner3.node().appendChild(_endLabelElement); var _slBox3 = _endLabelElement.getBBox(); _inner3.attr('transform', 'translate(' + -_slBox3.width / 2 + ', ' + -_slBox3.height / 2 + ')'); endEdgeLabelRight.node().appendChild(_endLabelElement); if (!terminalLabels[edge.id]) { terminalLabels[edge.id] = {}; } terminalLabels[edge.id].endRight = endEdgeLabelRight; setTerminalWidth(fo, edge.endLabelRight); } }; /** * @param {any} fo * @param {any} value */ function setTerminalWidth(fo, value) { if ((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.htmlLabels && fo) { fo.style.width = value.length * 9 + 'px'; fo.style.height = '12px'; } } var positionEdgeLabel = function positionEdgeLabel(edge, paths) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Moving label abc78 ', edge.id, edge.label, edgeLabels[edge.id]); var path = paths.updatedPath ? paths.updatedPath : paths.originalPath; if (edge.label) { var el = edgeLabels[edge.id]; var x = edge.x; var y = edge.y; if (path) { // // debugger; var pos = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcLabelPosition(path); _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Moving label from (', x, ',', y, ') to (', pos.x, ',', pos.y, ') abc78'); // x = pos.x; // y = pos.y; } el.attr('transform', 'translate(' + x + ', ' + y + ')'); } //let path = paths.updatedPath ? paths.updatedPath : paths.originalPath; if (edge.startLabelLeft) { var _el = terminalLabels[edge.id].startLeft; var _x2 = edge.x; var _y2 = edge.y; if (path) { // debugger; var _pos = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, 'start_left', path); _x2 = _pos.x; _y2 = _pos.y; } _el.attr('transform', 'translate(' + _x2 + ', ' + _y2 + ')'); } if (edge.startLabelRight) { var _el2 = terminalLabels[edge.id].startRight; var _x3 = edge.x; var _y3 = edge.y; if (path) { // debugger; var _pos2 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, 'start_right', path); _x3 = _pos2.x; _y3 = _pos2.y; } _el2.attr('transform', 'translate(' + _x3 + ', ' + _y3 + ')'); } if (edge.endLabelLeft) { var _el3 = terminalLabels[edge.id].endLeft; var _x4 = edge.x; var _y4 = edge.y; if (path) { // debugger; var _pos3 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, 'end_left', path); _x4 = _pos3.x; _y4 = _pos3.y; } _el3.attr('transform', 'translate(' + _x4 + ', ' + _y4 + ')'); } if (edge.endLabelRight) { var _el4 = terminalLabels[edge.id].endRight; var _x5 = edge.x; var _y5 = edge.y; if (path) { // debugger; var _pos4 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, 'end_right', path); _x5 = _pos4.x; _y5 = _pos4.y; } _el4.attr('transform', 'translate(' + _x5 + ', ' + _y5 + ')'); } }; var outsideNode = function outsideNode(node, point) { // log.warn('Checking bounds ', node, point); var x = node.x; var y = node.y; var dx = Math.abs(point.x - x); var dy = Math.abs(point.y - y); var w = node.width / 2; var h = node.height / 2; if (dx >= w || dy >= h) { return true; } return false; }; var intersection = function intersection(node, outsidePoint, insidePoint) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("intersection calc abc89:\n outsidePoint: ".concat(JSON.stringify(outsidePoint), "\n insidePoint : ").concat(JSON.stringify(insidePoint), "\n node : x:").concat(node.x, " y:").concat(node.y, " w:").concat(node.width, " h:").concat(node.height)); var x = node.x; var y = node.y; var dx = Math.abs(x - insidePoint.x); // const dy = Math.abs(y - insidePoint.y); var w = node.width / 2; var r = insidePoint.x < outsidePoint.x ? w - dx : w + dx; var h = node.height / 2; // const edges = { // x1: x - w, // x2: x + w, // y1: y - h, // y2: y + h // }; // if ( // outsidePoint.x === edges.x1 || // outsidePoint.x === edges.x2 || // outsidePoint.y === edges.y1 || // outsidePoint.y === edges.y2 // ) { // log.warn('abc89 calc equals on edge', outsidePoint, edges); // return outsidePoint; // } var Q = Math.abs(outsidePoint.y - insidePoint.y); var R = Math.abs(outsidePoint.x - insidePoint.x); // log.warn(); if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) { // eslint-disable-line // Intersection is top or bottom of rect. // let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y; var q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y; r = R * q / Q; var res = { x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r, y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q }; if (r === 0) { res.x = outsidePoint.x; res.y = outsidePoint.y; } if (R === 0) { res.x = outsidePoint.x; } if (Q === 0) { res.y = outsidePoint.y; } _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("abc89 topp/bott calc, Q ".concat(Q, ", q ").concat(q, ", R ").concat(R, ", r ").concat(r), res); return res; } else { // Intersection onn sides of rect if (insidePoint.x < outsidePoint.x) { r = outsidePoint.x - w - x; } else { // r = outsidePoint.x - w - x; r = x - w - outsidePoint.x; } var _q = Q * r / R; // OK let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x + dx - w; // OK let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : outsidePoint.x + r; var _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r; // let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : outsidePoint.x + r; var _y = insidePoint.y < outsidePoint.y ? insidePoint.y + _q : insidePoint.y - _q; _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("sides calc abc89, Q ".concat(Q, ", q ").concat(_q, ", R ").concat(R, ", r ").concat(r), { _x: _x, _y: _y }); if (r === 0) { _x = outsidePoint.x; _y = outsidePoint.y; } if (R === 0) { _x = outsidePoint.x; } if (Q === 0) { _y = outsidePoint.y; } return { x: _x, y: _y }; } }; /** * This function will page a path and node where the last point(s) in the path is inside the node * and return an update path ending by the border of the node. * * @param {Array} _points * @param {any} boundryNode * @returns {Array} Points */ var cutPathAtIntersect = function cutPathAtIntersect(_points, boundryNode) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 cutPathAtIntersect', _points, boundryNode); var points = []; var lastPointOutside = _points[0]; var isInside = false; _points.forEach(function (point) { // const node = clusterDb[edge.toCluster].node; _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('abc88 checking point', point, boundryNode); // check if point is inside the boundry rect if (!outsideNode(boundryNode, point) && !isInside) { // First point inside the rect found // Calc the intersection coord between the point anf the last point outside the rect var inter = intersection(boundryNode, lastPointOutside, point); _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 inside', point, lastPointOutside, inter); _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 intersection', inter); // // Check case where the intersection is the same as the last point var pointPresent = false; points.forEach(function (p) { pointPresent = pointPresent || p.x === inter.x && p.y === inter.y; }); // // if (!pointPresent) { if (!points.find(function (e) { return e.x === inter.x && e.y === inter.y; })) { points.push(inter); } else { _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 no intersect', inter, points); } // points.push(inter); isInside = true; } else { // Outside _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 outside', point, lastPointOutside); lastPointOutside = point; // points.push(point); if (!isInside) points.push(point); } }); _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 returning points', points); return points; }; //(edgePaths, e, edge, clusterDb, diagramtype, graph) var insertEdge = function insertEdge(elem, e, edge, clusterDb, diagramType, graph) { var points = edge.points; var pointsHasChanged = false; var tail = graph.node(e.v); var head = graph.node(e.w); _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('abc88 InsertEdge: ', edge); if (head.intersect && tail.intersect) { points = points.slice(1, edge.points.length - 1); points.unshift(tail.intersect(points[0])); _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Last point', points[points.length - 1], head, head.intersect(points[points.length - 1])); points.push(head.intersect(points[points.length - 1])); } if (edge.toCluster) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('to cluster abc88', clusterDb[edge.toCluster]); points = cutPathAtIntersect(edge.points, clusterDb[edge.toCluster].node); // log.trace('edge', edge); // points = []; // let lastPointOutside; // = edge.points[0]; // let isInside = false; // edge.points.forEach(point => { // const node = clusterDb[edge.toCluster].node; // log.warn('checking from', edge.fromCluster, point, node); // if (!outsideNode(node, point) && !isInside) { // log.trace('inside', edge.toCluster, point, lastPointOutside); // // First point inside the rect // const inter = intersection(node, lastPointOutside, point); // let pointPresent = false; // points.forEach(p => { // pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y); // }); // // if (!pointPresent) { // if (!points.find(e => e.x === inter.x && e.y === inter.y)) { // points.push(inter); // } else { // log.warn('no intersect', inter, points); // } // isInside = true; // } else { // // outside // lastPointOutside = point; // if (!isInside) points.push(point); // } // }); pointsHasChanged = true; } if (edge.fromCluster) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('from cluster abc88', clusterDb[edge.fromCluster]); points = cutPathAtIntersect(points.reverse(), clusterDb[edge.fromCluster].node).reverse(); pointsHasChanged = true; } // The data for our line var lineData = points.filter(function (p) { return !Number.isNaN(p.y); }); // This is the accessor function we talked about above var curve; // Currently only flowcharts get the curve from the settings, perhaps this should // be expanded to a common setting? Restricting it for now in order not to cause side-effects that // have not been thought through if (diagramType === 'graph' || diagramType === 'flowchart') { curve = edge.curve || d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis; } else { curve = d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis; } // curve = curveLinear; var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) { return d.x; }).y(function (d) { return d.y; }).curve(curve); // Contruct stroke classes based on properties var strokeClasses; switch (edge.thickness) { case 'normal': strokeClasses = 'edge-thickness-normal'; break; case 'thick': strokeClasses = 'edge-thickness-thick'; break; default: strokeClasses = ''; } switch (edge.pattern) { case 'solid': strokeClasses += ' edge-pattern-solid'; break; case 'dotted': strokeClasses += ' edge-pattern-dotted'; break; case 'dashed': strokeClasses += ' edge-pattern-dashed'; break; } 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 // edge.points.forEach(point => { // elem // .append('circle') // .style('stroke', 'red') // .style('fill', 'red') // .attr('r', 1) // .attr('cx', point.x) // .attr('cy', point.y); // }); var url = ''; if ((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().state.arrowMarkerAbsolute) { url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search; url = url.replace(/\(/g, '\\('); url = url.replace(/\)/g, '\\)'); } _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('arrowTypeStart', edge.arrowTypeStart); _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('arrowTypeEnd', edge.arrowTypeEnd); switch (edge.arrowTypeStart) { case 'arrow_cross': svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-crossStart' + ')'); break; case 'arrow_point': svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-pointStart' + ')'); break; case 'arrow_barb': svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-barbStart' + ')'); break; case 'arrow_circle': svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-circleStart' + ')'); break; case 'aggregation': svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-aggregationStart' + ')'); break; case 'extension': svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-extensionStart' + ')'); break; case 'composition': svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-compositionStart' + ')'); break; case 'dependency': svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-dependencyStart' + ')'); break; default: } switch (edge.arrowTypeEnd) { case 'arrow_cross': svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-crossEnd' + ')'); break; case 'arrow_point': svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-pointEnd' + ')'); break; case 'arrow_barb': svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-barbEnd' + ')'); break; case 'arrow_circle': svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-circleEnd' + ')'); break; case 'aggregation': svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-aggregationEnd' + ')'); break; case 'extension': svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-extensionEnd' + ')'); break; case 'composition': svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-compositionEnd' + ')'); break; case 'dependency': svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-dependencyEnd' + ')'); break; default: } var paths = {}; if (pointsHasChanged) { paths.updatedPath = points; } paths.originalPath = edge.points; return paths; }; /***/ }), /***/ "./src/dagre-wrapper/index.js": /*!************************************!*\ !*** ./src/dagre-wrapper/index.js ***! \************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "render": () => (/* binding */ render) /* harmony export */ }); /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dagre */ "./node_modules/dagre/index.js"); /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphlib */ "./node_modules/graphlib/index.js"); /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _markers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./markers */ "./src/dagre-wrapper/markers.js"); /* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js"); /* harmony import */ var _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./mermaid-graphlib */ "./src/dagre-wrapper/mermaid-graphlib.js"); /* harmony import */ var _nodes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nodes */ "./src/dagre-wrapper/nodes.js"); /* harmony import */ var _clusters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./clusters */ "./src/dagre-wrapper/clusters.js"); /* harmony import */ var _edges__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./edges */ "./src/dagre-wrapper/edges.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../logger */ "./src/logger.js"); var recursiveRender = function recursiveRender(_elem, graph, diagramtype, parentCluster) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Graph in recursive render: XXX', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph), parentCluster); var dir = graph.graph().rankdir; _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Dir in recursive render - dir:', dir); var elem = _elem.insert('g').attr('class', 'root'); // eslint-disable-line if (!graph.nodes()) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('No nodes found for', graph); } else { _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Recursive render XXX', graph.nodes()); } if (graph.edges().length > 0) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Recursive edges', graph.edge(graph.edges()[0])); } var clusters = elem.insert('g').attr('class', 'clusters'); // eslint-disable-line var edgePaths = elem.insert('g').attr('class', 'edgePaths'); var edgeLabels = elem.insert('g').attr('class', 'edgeLabels'); 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 // to the abstract node and is later used by dagre for the layout graph.nodes().forEach(function (v) { var node = graph.node(v); if (typeof parentCluster !== 'undefined') { var data = JSON.parse(JSON.stringify(parentCluster.clusterData)); // data.clusterPositioning = true; _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Setting data for cluster XXX (', v, ') ', data, parentCluster); graph.setNode(parentCluster.id, data); if (!graph.parent(v)) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Setting parent', v, parentCluster.id); graph.setParent(v, parentCluster.id, data); } } _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('(Insert) Node XXX' + v + ': ' + JSON.stringify(graph.node(v))); if (node && node.clusterNode) { // const children = graph.children(v); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Cluster identified', v, node.width, graph.node(v)); var o = recursiveRender(nodes, node.graph, diagramtype, graph.node(v)); var newEl = o.elem; (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, newEl); node.diff = o.diff || 0; _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Node bounds (abc123)', v, node, node.width, node.x, node.y); (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.setNodeElem)(newEl, node); _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Recursive render complete ', newEl, node); } else { if (graph.children(v).length > 0) { // This is a cluster but not to be rendered recursively // Render as before _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Cluster - the non recursive path XXX', v, node.id, node, graph); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info((0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.findNonClusterChild)(node.id, graph)); _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[node.id] = { id: (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.findNonClusterChild)(node.id, graph), node: node }; // insertCluster(clusters, graph.node(v)); } else { _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Node - the non recursive path', v, node.id, node); (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.insertNode)(nodes, graph.node(v), dir); } } }); // Insert labels, this will insert them into the dom so that the width can be calculated // Also figure out which edges point to/from clusters and adjust them accordingly // Edges from/to clusters really points to the first child in the cluster. // TODO: pick optimal child in the cluster to us as link anchor graph.edges().forEach(function (e) { var edge = graph.edge(e.v, e.w, e.name); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e)); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ', e, ' ', JSON.stringify(graph.edge(e))); // Check if link is either from or to a cluster _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Fix', _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb, 'ids:', e.v, e.w, 'Translateing: ', _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[e.v], _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[e.w]); (0,_edges__WEBPACK_IMPORTED_MODULE_6__.insertEdgeLabel)(edgeLabels, edge); }); graph.edges().forEach(function (e) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e)); }); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('#############################################'); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('### Layout ###'); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('#############################################'); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(graph); dagre__WEBPACK_IMPORTED_MODULE_0___default().layout(graph); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Graph after layout:', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph)); // Move the nodes to the correct place var diff = 0; (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.sortNodesByHierarchy)(graph).forEach(function (v) { var node = graph.node(v); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Position ' + v + ': ' + JSON.stringify(graph.node(v))); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Position ' + v + ': (' + node.x, ',' + node.y, ') width: ', node.width, ' height: ', node.height); if (node && node.clusterNode) { // clusterDb[node.id].node = node; (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.positionNode)(node); } else { // Non cluster node if (graph.children(v).length > 0) { // A cluster in the non-recursive way // positionCluster(node); (0,_clusters__WEBPACK_IMPORTED_MODULE_7__.insertCluster)(clusters, node); _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[node.id].node = node; } else { (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.positionNode)(node); } } }); // Move the edge labels to the correct place after layout graph.edges().forEach(function (e) { var edge = graph.edge(e); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(edge), edge); var paths = (0,_edges__WEBPACK_IMPORTED_MODULE_6__.insertEdge)(edgePaths, e, edge, _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb, diagramtype, graph); (0,_edges__WEBPACK_IMPORTED_MODULE_6__.positionEdgeLabel)(edge, paths); }); graph.nodes().forEach(function (v) { var n = graph.node(v); _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(v, n.type, n.diff); if (n.type === 'group') { diff = n.diff; } }); return { elem: elem, diff: diff }; }; var render = function render(elem, graph, markers, diagramtype, id) { (0,_markers__WEBPACK_IMPORTED_MODULE_8__["default"])(elem, markers, diagramtype, id); (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.clear)(); (0,_edges__WEBPACK_IMPORTED_MODULE_6__.clear)(); (0,_clusters__WEBPACK_IMPORTED_MODULE_7__.clear)(); (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clear)(); _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Graph at first:', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph)); (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.adjustClustersAndEdges)(graph); _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Graph after:', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph)); // log.warn('Graph ever after:', graphlib.json.write(graph.node('A').graph)); recursiveRender(elem, graph, diagramtype); }; // const shapeDefinitions = {}; // export const addShape = ({ shapeType: fun }) => { // shapeDefinitions[shapeType] = fun; // }; // const arrowDefinitions = {}; // export const addArrow = ({ arrowType: fun }) => { // arrowDefinitions[arrowType] = fun; // }; /***/ }), /***/ "./src/dagre-wrapper/intersect/index.js": /*!**********************************************!*\ !*** ./src/dagre-wrapper/intersect/index.js ***! \**********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-node.js */ "./src/dagre-wrapper/intersect/intersect-node.js"); /* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_intersect_node_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./intersect-circle.js */ "./src/dagre-wrapper/intersect/intersect-circle.js"); /* harmony import */ var _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intersect-ellipse.js */ "./src/dagre-wrapper/intersect/intersect-ellipse.js"); /* harmony import */ var _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intersect-polygon.js */ "./src/dagre-wrapper/intersect/intersect-polygon.js"); /* harmony import */ var _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./intersect-rect.js */ "./src/dagre-wrapper/intersect/intersect-rect.js"); /* * Borrowed with love from from dagrge-d3. Many thanks to cpettitt! */ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ node: (_intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default()), circle: _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__["default"], ellipse: _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__["default"], polygon: _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__["default"], rect: _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__["default"] }); /***/ }), /***/ "./src/dagre-wrapper/intersect/intersect-circle.js": /*!*********************************************************!*\ !*** ./src/dagre-wrapper/intersect/intersect-circle.js ***! \*********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-ellipse */ "./src/dagre-wrapper/intersect/intersect-ellipse.js"); /** * @param node * @param rx * @param point */ function intersectCircle(node, rx, point) { return (0,_intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__["default"])(node, rx, rx, point); } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectCircle); /***/ }), /***/ "./src/dagre-wrapper/intersect/intersect-ellipse.js": /*!**********************************************************!*\ !*** ./src/dagre-wrapper/intersect/intersect-ellipse.js ***! \**********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /** * @param node * @param rx * @param ry * @param point */ function intersectEllipse(node, rx, ry, point) { // Formulae from: https://mathworld.wolfram.com/Ellipse-LineIntersection.html var cx = node.x; var cy = node.y; var px = cx - point.x; var py = cy - point.y; var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px); var dx = Math.abs(rx * ry * px / det); if (point.x < cx) { dx = -dx; } var dy = Math.abs(rx * ry * py / det); if (point.y < cy) { dy = -dy; } return { x: cx + dx, y: cy + dy }; } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectEllipse); /***/ }), /***/ "./src/dagre-wrapper/intersect/intersect-line.js": /*!*******************************************************!*\ !*** ./src/dagre-wrapper/intersect/intersect-line.js ***! \*******************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /** * Returns the point at which two lines, p and q, intersect or returns undefined if they do not intersect. * * @param p1 * @param p2 * @param q1 * @param q2 */ function intersectLine(p1, p2, q1, q2) { // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994, // p7 and p473. var a1, a2, b1, b2, c1, c2; var r1, r2, r3, r4; var denom, offset, num; var x, y; // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x + // b1 y + c1 = 0. a1 = p2.y - p1.y; b1 = p1.x - p2.x; c1 = p2.x * p1.y - p1.x * p2.y; // Compute r3 and r4. r3 = a1 * q1.x + b1 * q1.y + c1; r4 = a1 * q2.x + b1 * q2.y + c1; // Check signs of r3 and r4. If both point 3 and point 4 lie on // same side of line 1, the line segments do not intersect. if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) { return; } // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0 a2 = q2.y - q1.y; b2 = q1.x - q2.x; c2 = q2.x * q1.y - q1.x * q2.y; // Compute r1 and r2 r1 = a2 * p1.x + b2 * p1.y + c2; r2 = a2 * p2.x + b2 * p2.y + c2; // Check signs of r1 and r2. If both point 1 and point 2 lie // on same side of second line segment, the line segments do // not intersect. if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) { return; } // Line segments intersect: compute intersection point. denom = a1 * b2 - a2 * b1; if (denom === 0) { return; } offset = Math.abs(denom / 2); // The denom/2 is to get rounding instead of truncating. It // is added or subtracted to the numerator, depending upon the // sign of the numerator. num = b1 * c2 - b2 * c1; x = num < 0 ? (num - offset) / denom : (num + offset) / denom; num = a2 * c1 - a1 * c2; y = num < 0 ? (num - offset) / denom : (num + offset) / denom; return { x: x, y: y }; } /** * @param r1 * @param r2 */ function sameSign(r1, r2) { return r1 * r2 > 0; } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectLine); /***/ }), /***/ "./src/dagre-wrapper/intersect/intersect-node.js": /*!*******************************************************!*\ !*** ./src/dagre-wrapper/intersect/intersect-node.js ***! \*******************************************************/ /***/ ((module) => { module.exports = intersectNode; /** * @param node * @param point */ function intersectNode(node, point) { // console.info('Intersect Node'); return node.intersect(point); } /***/ }), /***/ "./src/dagre-wrapper/intersect/intersect-polygon.js": /*!**********************************************************!*\ !*** ./src/dagre-wrapper/intersect/intersect-polygon.js ***! \**********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _intersect_line__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-line */ "./src/dagre-wrapper/intersect/intersect-line.js"); /* eslint "no-console": off */ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectPolygon); /** * Returns the point ({x, y}) at which the point argument intersects with the node argument assuming * that it has the shape specified by polygon. * * @param node * @param polyPoints * @param point */ function intersectPolygon(node, polyPoints, point) { var x1 = node.x; var y1 = node.y; var intersections = []; var minX = Number.POSITIVE_INFINITY; var minY = Number.POSITIVE_INFINITY; if (typeof polyPoints.forEach === 'function') { polyPoints.forEach(function (entry) { minX = Math.min(minX, entry.x); minY = Math.min(minY, entry.y); }); } else { minX = Math.min(minX, polyPoints.x); minY = Math.min(minY, polyPoints.y); } var left = x1 - node.width / 2 - minX; var top = y1 - node.height / 2 - minY; for (var i = 0; i < polyPoints.length; i++) { var p1 = polyPoints[i]; var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0]; var intersect = (0,_intersect_line__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point, { x: left + p1.x, y: top + p1.y }, { x: left + p2.x, y: top + p2.y }); if (intersect) { intersections.push(intersect); } } if (!intersections.length) { // console.log('NO INTERSECTION FOUND, RETURN NODE CENTER', node); return node; } if (intersections.length > 1) { // More intersections, find the one nearest to edge end point intersections.sort(function (p, q) { var pdx = p.x - point.x; var pdy = p.y - point.y; var distp = Math.sqrt(pdx * pdx + pdy * pdy); var qdx = q.x - point.x; var qdy = q.y - point.y; var distq = Math.sqrt(qdx * qdx + qdy * qdy); return distp < distq ? -1 : distp === distq ? 0 : 1; }); } return intersections[0]; } /***/ }), /***/ "./src/dagre-wrapper/intersect/intersect-rect.js": /*!*******************************************************!*\ !*** ./src/dagre-wrapper/intersect/intersect-rect.js ***! \*******************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); var intersectRect = function intersectRect(node, point) { var x = node.x; var y = node.y; // Rectangle intersection algorithm from: // https://math.stackexchange.com/questions/108113/find-edge-between-two-boxes var dx = point.x - x; var dy = point.y - y; var w = node.width / 2; var h = node.height / 2; var sx, sy; if (Math.abs(dy) * w > Math.abs(dx) * h) { // Intersection is top or bottom of rect. if (dy < 0) { h = -h; } sx = dy === 0 ? 0 : h * dx / dy; sy = h; } else { // Intersection is left or right of rect. if (dx < 0) { w = -w; } sx = w; sy = dx === 0 ? 0 : w * dy / dx; } return { x: x + sx, y: y + sy }; }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectRect); /***/ }), /***/ "./src/dagre-wrapper/markers.js": /*!**************************************!*\ !*** ./src/dagre-wrapper/markers.js ***! \**************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../logger */ "./src/logger.js"); /** Setup arrow head and define the marker. The result is appended to the svg. */ // Only add the number of markers that the diagram needs var insertMarkers = function insertMarkers(elem, markerArray, type, id) { markerArray.forEach(function (markerName) { markers[markerName](elem, type, id); }); }; var extension = function extension(elem, type, id) { _logger__WEBPACK_IMPORTED_MODULE_0__.log.trace('Making markers for ', id); 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'); 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 }; var composition = function composition(elem, type) { 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'); 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'); }; var aggregation = function aggregation(elem, type) { 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'); 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'); }; var dependency = function dependency(elem, type) { 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'); 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'); }; var point = function point(elem, type) { 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'); 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'); }; var circle = function circle(elem, type) { 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'); 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'); }; var cross = function cross(elem, type) { 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') .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'); 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') .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'); }; var barb = function barb(elem, type) { 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'); }; // TODO rename the class diagram markers to something shape descriptive and semantic free var markers = { extension: extension, composition: composition, aggregation: aggregation, dependency: dependency, point: point, circle: circle, cross: cross, barb: barb }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (insertMarkers); /***/ }), /***/ "./src/dagre-wrapper/mermaid-graphlib.js": /*!***********************************************!*\ !*** ./src/dagre-wrapper/mermaid-graphlib.js ***! \***********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "adjustClustersAndEdges": () => (/* binding */ adjustClustersAndEdges), /* harmony export */ "clear": () => (/* binding */ clear), /* harmony export */ "clusterDb": () => (/* binding */ clusterDb), /* harmony export */ "extractDecendants": () => (/* binding */ extractDecendants), /* harmony export */ "extractor": () => (/* binding */ extractor), /* harmony export */ "findNonClusterChild": () => (/* binding */ findNonClusterChild), /* harmony export */ "sortNodesByHierarchy": () => (/* binding */ sortNodesByHierarchy), /* harmony export */ "validate": () => (/* binding */ validate) /* harmony export */ }); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js"); /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "./node_modules/graphlib/index.js"); /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__); /** Decorates with functions required by mermaids dagre-wrapper. */ var clusterDb = {}; var decendants = {}; var parents = {}; var clear = function clear() { decendants = {}; parents = {}; clusterDb = {}; }; var isDecendant = function isDecendant(id, ancenstorId) { // if (id === ancenstorId) return true; _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('In isDecendant', ancenstorId, ' ', id, ' = ', decendants[ancenstorId].indexOf(id) >= 0); if (decendants[ancenstorId].indexOf(id) >= 0) return true; return false; }; var edgeInCluster = function edgeInCluster(edge, clusterId) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Decendants of ', clusterId, ' is ', decendants[clusterId]); _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Edge is ', edge); // Edges to/from the cluster is not in the cluster, they are in the parent if (edge.v === clusterId) return false; if (edge.w === clusterId) return false; if (!decendants[clusterId]) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Tilt, ', clusterId, ',not in decendants'); return false; } _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Here '); if (decendants[clusterId].indexOf(edge.v) >= 0) return true; if (isDecendant(edge.v, clusterId)) return true; if (isDecendant(edge.w, clusterId)) return true; if (decendants[clusterId].indexOf(edge.w) >= 0) return true; return false; }; var copy = function copy(clusterId, graph, newGraph, rootId) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Copying children of ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId); var nodes = graph.children(clusterId) || []; // Include cluster node if it is not the root if (clusterId !== rootId) { nodes.push(clusterId); } _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Copying (nodes) clusterId', clusterId, 'nodes', nodes); nodes.forEach(function (node) { if (graph.children(node).length > 0) { copy(node, graph, newGraph, rootId); } else { var data = graph.node(node); _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('cp ', node, ' to ', rootId, ' with parent ', clusterId); //,node, data, ' parent is ', clusterId); newGraph.setNode(node, data); if (rootId !== graph.parent(node)) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Setting parent', node, graph.parent(node)); newGraph.setParent(node, graph.parent(node)); } if (clusterId !== rootId && node !== clusterId) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Setting parent', node, clusterId); newGraph.setParent(node, clusterId); } else { _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('In copy ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId); _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not Setting parent for node=', node, 'cluster!==rootId', clusterId !== rootId, 'node!==clusterId', node !== clusterId); } var edges = graph.edges(node); _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Copying Edges', edges); edges.forEach(function (edge) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Edge', edge); var data = graph.edge(edge.v, edge.w, edge.name); _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Edge data', data, rootId); try { // Do not copy edges in and out of the root cluster, they belong to the parent graph if (edgeInCluster(edge, rootId)) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Copying as ', edge.v, edge.w, data, edge.name); newGraph.setEdge(edge.v, edge.w, data, edge.name); _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('newGraph edges ', newGraph.edges(), newGraph.edge(newGraph.edges()[0])); } else { _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Skipping copy of edge ', edge.v, '-->', edge.w, ' rootId: ', rootId, ' clusterId:', clusterId); } } catch (e) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.error(e); } }); } _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Removing node', node); graph.removeNode(node); }); }; var extractDecendants = function extractDecendants(id, graph) { // log.debug('Extracting ', id); var children = graph.children(id); var res = [].concat(children); for (var i = 0; i < children.length; i++) { parents[children[i]] = id; res = res.concat(extractDecendants(children[i], graph)); } return res; }; /** * Validates the graph, checking that all parent child relation points to existing nodes and that * edges between nodes also ia correct. When not correct the function logs the discrepancies. * * @param graph */ var validate = function validate(graph) { var edges = graph.edges(); _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Edges: ', edges); for (var i = 0; i < edges.length; i++) { if (graph.children(edges[i].v).length > 0) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('The node ', edges[i].v, ' is part of and edge even though it has children'); return false; } if (graph.children(edges[i].w).length > 0) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('The node ', edges[i].w, ' is part of and edge even though it has children'); return false; } } return true; }; /** * Finds a child that is not a cluster. When faking a edge between a node and a cluster. * * @param {Finds a} id * @param {any} graph */ var findNonClusterChild = function findNonClusterChild(id, graph) { // const node = graph.node(id); _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Searching', id); // const children = graph.children(id).reverse(); var children = graph.children(id); //.reverse(); _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Searching children of id ', id, children); if (children.length < 1) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('This is a valid node', id); return id; } for (var i = 0; i < children.length; i++) { var _id = findNonClusterChild(children[i], graph); if (_id) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Found replacement for', id, ' => ', _id); return _id; } } }; var getAnchorId = function getAnchorId(id) { if (!clusterDb[id]) { return id; } // If the cluster has no external connections if (!clusterDb[id].externalConnections) { return id; } // Return the replacement node if (clusterDb[id]) { return clusterDb[id].id; } return id; }; var adjustClustersAndEdges = function adjustClustersAndEdges(graph, depth) { if (!graph || depth > 10) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Opting out, no graph '); return; } else { _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Opting in, graph '); } // Go through the nodes and for each cluster found, save a replacement node, this can be used when // faking a link to a cluster graph.nodes().forEach(function (id) { var children = graph.children(id); if (children.length > 0) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Cluster identified', id, ' Replacement id in edges: ', findNonClusterChild(id, graph)); decendants[id] = extractDecendants(id, graph); clusterDb[id] = { id: findNonClusterChild(id, graph), clusterData: graph.node(id) }; } }); // Check incoming and outgoing edges for each cluster graph.nodes().forEach(function (id) { var children = graph.children(id); var edges = graph.edges(); if (children.length > 0) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Cluster identified', id, decendants); edges.forEach(function (edge) { // log.debug('Edge, decendants: ', edge, decendants[id]); // Check if any edge leaves the cluster (not the actual cluster, thats a link from the box) if (edge.v !== id && edge.w !== id) { // Any edge where either the one of the nodes is decending to the cluster but not the other // if (decendants[id].indexOf(edge.v) < 0 && decendants[id].indexOf(edge.w) < 0) { var d1 = isDecendant(edge.v, id); var d2 = isDecendant(edge.w, id); // d1 xor d2 - if either d1 is true and d2 is false or the other way around if (d1 ^ d2) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge: ', edge, ' leaves cluster ', id); _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Decendants of XXX ', id, ': ', decendants[id]); clusterDb[id].externalConnections = true; } } }); } else { _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not a cluster ', id, decendants); } }); // For clusters with incoming and/or outgoing edges translate those edges to a real node // in the cluster in order to fake the edge graph.edges().forEach(function (e) { var edge = graph.edge(e); _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e)); _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e))); var v = e.v; var w = e.w; // Check if link is either from or to a cluster _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fix XXX', clusterDb, 'ids:', e.v, e.w, 'Translateing: ', clusterDb[e.v], ' --- ', clusterDb[e.w]); if (clusterDb[e.v] && clusterDb[e.w] && clusterDb[e.v] === clusterDb[e.w]) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing and trixing link to self - removing XXX', e.v, e.w, e.name); _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing and trixing - removing XXX', e.v, e.w, e.name); v = getAnchorId(e.v); w = getAnchorId(e.w); graph.removeEdge(e.v, e.w, e.name); var specialId = e.w + '---' + e.v; graph.setNode(specialId, { domId: specialId, id: specialId, labelStyle: '', labelText: edge.label, padding: 0, shape: 'labelRect', style: '' }); var edge1 = JSON.parse(JSON.stringify(edge)); var edge2 = JSON.parse(JSON.stringify(edge)); edge1.label = ''; edge1.arrowTypeEnd = 'none'; edge2.label = ''; edge1.fromCluster = e.v; edge2.toCluster = e.v; graph.setEdge(v, specialId, edge1, e.name + '-cyclic-special'); graph.setEdge(specialId, w, edge2, e.name + '-cyclic-special'); } else if (clusterDb[e.v] || clusterDb[e.w]) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing and trixing - removing XXX', e.v, e.w, e.name); v = getAnchorId(e.v); w = getAnchorId(e.w); graph.removeEdge(e.v, e.w, e.name); if (v !== e.v) edge.fromCluster = e.v; if (w !== e.w) edge.toCluster = e.w; _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fix Replacing with XXX', v, w, e.name); graph.setEdge(v, w, edge, e.name); } }); _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Adjusted Graph', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph)); extractor(graph, 0); _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace(clusterDb); // Remove references to extracted cluster // graph.edges().forEach(edge => { // if (isDecendant(edge.v, clusterId) || isDecendant(edge.w, clusterId)) { // graph.removeEdge(edge); // } // }); }; var extractor = function extractor(graph, depth) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('extractor - ', depth, graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph), graph.children('D')); if (depth > 10) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('Bailing out'); return; } // For clusters without incoming and/or outgoing edges, create a new cluster-node // containing the nodes and edges in the custer in a new graph // for (let i = 0;) var nodes = graph.nodes(); var hasChildren = false; for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; var children = graph.children(node); hasChildren = hasChildren || children.length > 0; } if (!hasChildren) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Done, no node has children', graph.nodes()); return; } // const clusters = Object.keys(clusterDb); // clusters.forEach(clusterId => { _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Nodes = ', nodes, depth); for (var _i = 0; _i < nodes.length; _i++) { var _node = nodes[_i]; _logger__WEBPACK_IMPORTED_MODULE_1__.log.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 // that it still is in the game if (!clusterDb[_node]) { // Skip if the node is not a cluster _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not a cluster', _node, depth); // break; } else if (!clusterDb[_node].externalConnections && // !graph.parent(node) && graph.children(_node) && graph.children(_node).length > 0) { _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Cluster without external connections, without a parent and with children', _node, depth); var graphSettings = graph.graph(); var dir = graphSettings.rankdir === 'TB' ? 'LR' : 'TB'; if (clusterDb[_node]) { if (clusterDb[_node].clusterData && clusterDb[_node].clusterData.dir) { dir = clusterDb[_node].clusterData.dir; _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing dir', clusterDb[_node].clusterData.dir, dir); } } var clusterGraph = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({ multigraph: true, compound: true }).setGraph({ rankdir: dir, // Todo: set proper spacing nodesep: 50, ranksep: 50, marginx: 8, marginy: 8 }).setDefaultEdgeLabel(function () { return {}; }); _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Old graph before copy', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph)); copy(_node, graph, clusterGraph, _node); graph.setNode(_node, { clusterNode: true, id: _node, clusterData: clusterDb[_node].clusterData, labelText: clusterDb[_node].labelText, graph: clusterGraph }); _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('New graph after copy node: (', _node, ')', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(clusterGraph)); _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Old graph after copy', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph)); } else { _logger__WEBPACK_IMPORTED_MODULE_1__.log.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); _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(clusterDb); } } nodes = graph.nodes(); _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('New list of nodes', nodes); for (var _i2 = 0; _i2 < nodes.length; _i2++) { var _node2 = nodes[_i2]; var data = graph.node(_node2); _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn(' Now next level', _node2, data); if (data.clusterNode) { extractor(data.graph, depth + 1); } } }; var sorter = function sorter(graph, nodes) { if (nodes.length === 0) return []; var result = Object.assign(nodes); nodes.forEach(function (node) { var children = graph.children(node); var sorted = sorter(graph, children); result = result.concat(sorted); }); return result; }; var sortNodesByHierarchy = function sortNodesByHierarchy(graph) { return sorter(graph, graph.children()); }; /***/ }), /***/ "./src/dagre-wrapper/nodes.js": /*!************************************!*\ !*** ./src/dagre-wrapper/nodes.js ***! \************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "clear": () => (/* binding */ clear), /* harmony export */ "insertNode": () => (/* binding */ insertNode), /* harmony export */ "positionNode": () => (/* binding */ positionNode), /* harmony export */ "setNodeElem": () => (/* binding */ setNodeElem) /* harmony export */ }); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../logger */ "./src/logger.js"); /* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config */ "./src/config.js"); /* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./intersect/index.js */ "./src/dagre-wrapper/intersect/index.js"); /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js"); /* harmony import */ var _shapes_note__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./shapes/note */ "./src/dagre-wrapper/shapes/note.js"); /* harmony import */ var _diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../diagrams/class/svgDraw */ "./src/diagrams/class/svgDraw.js"); /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js"); function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } // eslint-disable-line var sanitizeText = function sanitizeText(txt) { return (0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.sanitizeText)(txt, (0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)()); }; var question = function question(parent, node) { var _labelHelper = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper.shapeSvg, bbox = _labelHelper.bbox; var w = bbox.width + node.padding; var h = bbox.height + node.padding; var s = w + h; var points = [{ x: s / 2, y: 0 }, { x: s, y: -s / 2 }, { x: s / 2, y: -s }, { x: 0, y: -s / 2 }]; _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Question main (Circle)'); var questionElem = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, s, s, points); questionElem.attr('style', node.style); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, questionElem); node.intersect = function (point) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('Intersect called'); return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point); }; return shapeSvg; }; var choice = function choice(parent, node) { var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id); var s = 28; var points = [{ x: 0, y: s / 2 }, { x: s / 2, y: 0 }, { x: 0, y: -s / 2 }, { x: -s / 2, y: 0 }]; var choice = shapeSvg.insert('polygon', ':first-child').attr('points', points.map(function (d) { return d.x + ',' + d.y; }).join(' ')); // center the circle around its coordinate choice.attr('class', 'state-start').attr('r', 7).attr('width', 28).attr('height', 28); node.width = 28; node.height = 28; node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].circle(node, 14, point); }; return shapeSvg; }; var hexagon = function hexagon(parent, node) { var _labelHelper2 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper2.shapeSvg, bbox = _labelHelper2.bbox; var f = 4; var h = bbox.height + node.padding; var m = h / f; var w = bbox.width + 2 * m + node.padding; var points = [{ x: m, y: 0 }, { x: w - m, y: 0 }, { x: w, y: -h / 2 }, { x: w - m, y: -h }, { x: m, y: -h }, { x: 0, y: -h / 2 }]; var hex = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points); hex.attr('style', node.style); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, hex); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point); }; return shapeSvg; }; var rect_left_inv_arrow = function rect_left_inv_arrow(parent, node) { var _labelHelper3 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper3.shapeSvg, bbox = _labelHelper3.bbox; var w = bbox.width + node.padding; var h = bbox.height + node.padding; var points = [{ x: -h / 2, y: 0 }, { x: w, y: 0 }, { x: w, y: -h }, { x: -h / 2, y: -h }, { x: 0, y: -h / 2 }]; var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points); el.attr('style', node.style); node.width = w + h; node.height = h; node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point); }; return shapeSvg; }; var lean_right = function lean_right(parent, node) { var _labelHelper4 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper4.shapeSvg, bbox = _labelHelper4.bbox; var w = bbox.width + node.padding; var h = bbox.height + node.padding; var points = [{ x: -2 * h / 6, y: 0 }, { x: w - h / 6, y: 0 }, { x: w + 2 * h / 6, y: -h }, { x: h / 6, y: -h }]; var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points); el.attr('style', node.style); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point); }; return shapeSvg; }; var lean_left = function lean_left(parent, node) { var _labelHelper5 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper5.shapeSvg, bbox = _labelHelper5.bbox; var w = bbox.width + node.padding; var h = bbox.height + node.padding; var points = [{ x: 2 * h / 6, y: 0 }, { x: w + h / 6, y: 0 }, { x: w - 2 * h / 6, y: -h }, { x: -h / 6, y: -h }]; var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points); el.attr('style', node.style); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point); }; return shapeSvg; }; var trapezoid = function trapezoid(parent, node) { var _labelHelper6 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper6.shapeSvg, bbox = _labelHelper6.bbox; var w = bbox.width + node.padding; var h = bbox.height + node.padding; var points = [{ x: -2 * h / 6, y: 0 }, { x: w + 2 * h / 6, y: 0 }, { x: w - h / 6, y: -h }, { x: h / 6, y: -h }]; var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points); el.attr('style', node.style); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point); }; return shapeSvg; }; var inv_trapezoid = function inv_trapezoid(parent, node) { var _labelHelper7 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper7.shapeSvg, bbox = _labelHelper7.bbox; var w = bbox.width + node.padding; var h = bbox.height + node.padding; var points = [{ x: h / 6, y: 0 }, { x: w - h / 6, y: 0 }, { x: w + 2 * h / 6, y: -h }, { x: -2 * h / 6, y: -h }]; var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points); el.attr('style', node.style); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point); }; return shapeSvg; }; var rect_right_inv_arrow = function rect_right_inv_arrow(parent, node) { var _labelHelper8 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper8.shapeSvg, bbox = _labelHelper8.bbox; var w = bbox.width + node.padding; var h = bbox.height + node.padding; var points = [{ x: 0, y: 0 }, { x: w + h / 2, y: 0 }, { x: w, y: -h / 2 }, { x: w + h / 2, y: -h }, { x: 0, y: -h }]; var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points); el.attr('style', node.style); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point); }; return shapeSvg; }; var cylinder = function cylinder(parent, node) { var _labelHelper9 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper9.shapeSvg, bbox = _labelHelper9.bbox; var w = bbox.width + node.padding; var rx = w / 2; var ry = rx / (2.5 + w / 50); var h = bbox.height + ry + node.padding; 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; var el = shapeSvg.attr('label-offset-y', ry).insert('path', ':first-child').attr('style', node.style).attr('d', shape).attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')'); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el); node.intersect = function (point) { var pos = _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point); var x = pos.x - node.x; 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)) { // ellipsis equation: x*x / a*a + y*y / b*b = 1 // solve for y to get adjustion value for pos.y var y = ry * ry * (1 - x * x / (rx * rx)); if (y != 0) y = Math.sqrt(y); y = ry - y; if (point.y - node.y > 0) y = -y; pos.y += y; } return pos; }; return shapeSvg; }; var rect = function rect(parent, node) { var _labelHelper10 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, 'node ' + node.classes, true), shapeSvg = _labelHelper10.shapeSvg, bbox = _labelHelper10.bbox, halfPadding = _labelHelper10.halfPadding; _logger__WEBPACK_IMPORTED_MODULE_4__.log.trace('Classes = ', node.classes); // add the rect var rect = shapeSvg.insert('rect', ':first-child'); var totalWidth = bbox.width + node.padding; var totalHeight = bbox.height + node.padding; 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', totalWidth).attr('height', totalHeight); if (node.props) { var propKeys = new Set(Object.keys(node.props)); if (node.props.borders) { applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight); propKeys.delete('borders'); } propKeys.forEach(function (propKey) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("Unknown node property ".concat(propKey)); }); } (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, rect); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point); }; return shapeSvg; }; var labelRect = function labelRect(parent, node) { var _labelHelper11 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, 'label', true), shapeSvg = _labelHelper11.shapeSvg, bbox = _labelHelper11.bbox, halfPadding = _labelHelper11.halfPadding; _logger__WEBPACK_IMPORTED_MODULE_4__.log.trace('Classes = ', node.classes); // add the rect var rect = shapeSvg.insert('rect', ':first-child'); // Hide the rect we are only after the label var totalWidth = 0; var totalHeight = 0; rect.attr('width', totalWidth).attr('height', totalHeight); shapeSvg.attr('class', 'label edgeLabel'); if (node.props) { var propKeys = new Set(Object.keys(node.props)); if (node.props.borders) { applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight); propKeys.delete('borders'); } propKeys.forEach(function (propKey) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("Unknown node property ".concat(propKey)); }); } (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, rect); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point); }; return shapeSvg; }; /** * @param rect * @param borders * @param totalWidth * @param totalHeight */ function applyNodePropertyBorders(rect, borders, totalWidth, totalHeight) { var strokeDashArray = []; var addBorder = function addBorder(length) { strokeDashArray.push(length); strokeDashArray.push(0); }; var skipBorder = function skipBorder(length) { strokeDashArray.push(0); strokeDashArray.push(length); }; if (borders.includes('t')) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('add top border'); addBorder(totalWidth); } else { skipBorder(totalWidth); } if (borders.includes('r')) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('add right border'); addBorder(totalHeight); } else { skipBorder(totalHeight); } if (borders.includes('b')) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('add bottom border'); addBorder(totalWidth); } else { skipBorder(totalWidth); } if (borders.includes('l')) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('add left border'); addBorder(totalHeight); } else { skipBorder(totalHeight); } rect.attr('stroke-dasharray', strokeDashArray.join(' ')); } var rectWithTitle = function rectWithTitle(parent, node) { // const { shapeSvg, bbox, halfPadding } = labelHelper(parent, node, 'node ' + node.classes); var classes; if (!node.classes) { classes = 'node default'; } else { classes = 'node ' + node.classes; } // Add outer g element var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the title label and insert it after the rect var rect = shapeSvg.insert('rect', ':first-child'); // const innerRect = shapeSvg.insert('rect'); var innerLine = shapeSvg.insert('line'); var label = shapeSvg.insert('g').attr('class', 'label'); var text2 = node.labelText.flat ? node.labelText.flat() : node.labelText; // const text2 = typeof text2prim === 'object' ? text2prim[0] : text2prim; var title = ''; if (_typeof(text2) === 'object') { title = text2[0]; } else { title = text2; } _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Label text abc79', title, text2, _typeof(text2) === 'object'); var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(title, node.labelStyle, true, true)); var bbox = { width: 0, height: 0 }; if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) { var div = text.children[0]; var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text); bbox = div.getBoundingClientRect(); dv.attr('width', bbox.width); dv.attr('height', bbox.height); } _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Text 2', text2); var textRows = text2.slice(1, text2.length); var titleBox = text.getBBox(); var descr = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(textRows.join ? textRows.join('
') : textRows, node.labelStyle, true, true)); if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) { var _div = descr.children[0]; var _dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(descr); bbox = _div.getBoundingClientRect(); _dv.attr('width', bbox.width); _dv.attr('height', bbox.height); } // bbox = label.getBBox(); // log.info(descr); var halfPadding = node.padding / 2; (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(descr).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 + bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ', ' + (titleBox.height + halfPadding + 5) + ')'); (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 + bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ', ' + 0 + ')'); // Get the size of the label // Bounding box for title and text bbox = label.node().getBBox(); // Center the label label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')'); 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); 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); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, rect); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point); }; return shapeSvg; }; var stadium = function stadium(parent, node) { var _labelHelper12 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper12.shapeSvg, bbox = _labelHelper12.bbox; var h = bbox.height + node.padding; var w = bbox.width + h / 4 + node.padding; // add the rect var rect = shapeSvg.insert('rect', ':first-child').attr('style', node.style).attr('rx', h / 2).attr('ry', h / 2).attr('x', -w / 2).attr('y', -h / 2).attr('width', w).attr('height', h); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, rect); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point); }; return shapeSvg; }; var circle = function circle(parent, node) { var _labelHelper13 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper13.shapeSvg, bbox = _labelHelper13.bbox, halfPadding = _labelHelper13.halfPadding; var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate circle.attr('style', node.style).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); _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Circle main'); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, circle); node.intersect = function (point) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Circle intersect', node, bbox.width / 2 + halfPadding, point); return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].circle(node, bbox.width / 2 + halfPadding, point); }; return shapeSvg; }; var doublecircle = function doublecircle(parent, node) { var _labelHelper14 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper14.shapeSvg, bbox = _labelHelper14.bbox, halfPadding = _labelHelper14.halfPadding; var gap = 5; var circleGroup = shapeSvg.insert('g', ':first-child'); var outerCircle = circleGroup.insert('circle'); var innerCircle = circleGroup.insert('circle'); // center the circle around its coordinate outerCircle.attr('style', node.style).attr('rx', node.rx).attr('ry', node.ry).attr('r', bbox.width / 2 + halfPadding + gap).attr('width', bbox.width + node.padding + gap * 2).attr('height', bbox.height + node.padding + gap * 2); innerCircle.attr('style', node.style).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); _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('DoubleCircle main'); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, outerCircle); node.intersect = function (point) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('DoubleCircle intersect', node, bbox.width / 2 + halfPadding + gap, point); return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].circle(node, bbox.width / 2 + halfPadding + gap, point); }; return shapeSvg; }; var subroutine = function subroutine(parent, node) { var _labelHelper15 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true), shapeSvg = _labelHelper15.shapeSvg, bbox = _labelHelper15.bbox; var w = bbox.width + node.padding; var h = bbox.height + node.padding; var points = [{ x: 0, y: 0 }, { x: w, y: 0 }, { x: w, y: -h }, { x: 0, y: -h }, { x: 0, y: 0 }, { x: -8, y: 0 }, { x: w + 8, y: 0 }, { x: w + 8, y: -h }, { x: -8, y: -h }, { x: -8, y: 0 }]; var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points); el.attr('style', node.style); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point); }; return shapeSvg; }; var start = function start(parent, node) { var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id); var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, circle); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].circle(node, 7, point); }; return shapeSvg; }; var forkJoin = function forkJoin(parent, node, dir) { var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id); var width = 70; var height = 10; if (dir === 'LR') { width = 10; height = 70; } var shape = shapeSvg.append('rect').attr('x', -1 * width / 2).attr('y', -1 * height / 2).attr('width', width).attr('height', height).attr('class', 'fork-join'); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, shape); node.height = node.height + node.padding / 2; node.width = node.width + node.padding / 2; node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point); }; return shapeSvg; }; var end = function end(parent, node) { var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id); var innerCircle = shapeSvg.insert('circle', ':first-child'); var circle = shapeSvg.insert('circle', ':first-child'); circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14); innerCircle.attr('class', 'state-end').attr('r', 5).attr('width', 10).attr('height', 10); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, circle); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].circle(node, 7, point); }; return shapeSvg; }; var class_box = function class_box(parent, node) { var halfPadding = node.padding / 2; var rowPadding = 4; var lineHeight = 8; var classes; if (!node.classes) { classes = 'node default'; } else { classes = 'node ' + node.classes; } // Add outer g element var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the title label and insert it after the rect var rect = shapeSvg.insert('rect', ':first-child'); var topLine = shapeSvg.insert('line'); var bottomLine = shapeSvg.insert('line'); var maxWidth = 0; var maxHeight = rowPadding; var labelContainer = shapeSvg.insert('g').attr('class', 'label'); var verticalPos = 0; var hasInterface = node.classData.annotations && node.classData.annotations[0]; // 1. Create the labels var interfaceLabelText = node.classData.annotations[0] ? '«' + node.classData.annotations[0] + '»' : ''; var interfaceLabel = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(interfaceLabelText, node.labelStyle, true, true)); var interfaceBBox = interfaceLabel.getBBox(); if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) { var div = interfaceLabel.children[0]; var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(interfaceLabel); interfaceBBox = div.getBoundingClientRect(); dv.attr('width', interfaceBBox.width); dv.attr('height', interfaceBBox.height); } if (node.classData.annotations[0]) { maxHeight += interfaceBBox.height + rowPadding; maxWidth += interfaceBBox.width; } var classTitleString = node.classData.id; if (node.classData.type !== undefined && node.classData.type !== '') { if ((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels) { classTitleString += '<' + node.classData.type + '>'; } else { classTitleString += '<' + node.classData.type + '>'; } } var classTitleLabel = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(classTitleString, node.labelStyle, true, true)); (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel).attr('class', 'classTitle'); var classTitleBBox = classTitleLabel.getBBox(); if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) { var _div2 = classTitleLabel.children[0]; var _dv2 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel); classTitleBBox = _div2.getBoundingClientRect(); _dv2.attr('width', classTitleBBox.width); _dv2.attr('height', classTitleBBox.height); } maxHeight += classTitleBBox.height + rowPadding; if (classTitleBBox.width > maxWidth) { maxWidth = classTitleBBox.width; } var classAttributes = []; node.classData.members.forEach(function (str) { var parsedInfo = (0,_diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__.parseMember)(str); var parsedText = parsedInfo.displayText; if ((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels) { parsedText = parsedText.replace(//g, '>'); } var lbl = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(parsedText, parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle, true, true)); var bbox = lbl.getBBox(); if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) { var _div3 = lbl.children[0]; var _dv3 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl); bbox = _div3.getBoundingClientRect(); _dv3.attr('width', bbox.width); _dv3.attr('height', bbox.height); } if (bbox.width > maxWidth) { maxWidth = bbox.width; } maxHeight += bbox.height + rowPadding; classAttributes.push(lbl); }); maxHeight += lineHeight; var classMethods = []; node.classData.methods.forEach(function (str) { var parsedInfo = (0,_diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__.parseMember)(str); var displayText = parsedInfo.displayText; if ((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels) { displayText = displayText.replace(//g, '>'); } var lbl = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(displayText, parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle, true, true)); var bbox = lbl.getBBox(); if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) { var _div4 = lbl.children[0]; var _dv4 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl); bbox = _div4.getBoundingClientRect(); _dv4.attr('width', bbox.width); _dv4.attr('height', bbox.height); } if (bbox.width > maxWidth) { maxWidth = bbox.width; } maxHeight += bbox.height + rowPadding; classMethods.push(lbl); }); maxHeight += lineHeight; // 2. Position the labels // position the interface label if (hasInterface) { var _diffX = (maxWidth - interfaceBBox.width) / 2; (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(interfaceLabel).attr('transform', 'translate( ' + (-1 * maxWidth / 2 + _diffX) + ', ' + -1 * maxHeight / 2 + ')'); verticalPos = interfaceBBox.height + rowPadding; } // Position the class title label var diffX = (maxWidth - classTitleBBox.width) / 2; (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel).attr('transform', 'translate( ' + (-1 * maxWidth / 2 + diffX) + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')'); verticalPos += classTitleBBox.height + rowPadding; 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); verticalPos += lineHeight; classAttributes.forEach(function (lbl) { (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ')'); verticalPos += classTitleBBox.height + rowPadding; }); verticalPos += lineHeight; 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); verticalPos += lineHeight; classMethods.forEach(function (lbl) { (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')'); verticalPos += classTitleBBox.height + rowPadding; }); // // let bbox; // if (evaluate(getConfig().flowchart.htmlLabels)) { // const div = interfaceLabel.children[0]; // const dv = select(interfaceLabel); // bbox = div.getBoundingClientRect(); // dv.attr('width', bbox.width); // dv.attr('height', bbox.height); // } // bbox = labelContainer.getBBox(); // log.info('Text 2', text2); // const textRows = text2.slice(1, text2.length); // let titleBox = text.getBBox(); // const descr = label // .node() // .appendChild(createLabel(textRows.join('
'), node.labelStyle, true, true)); // if (evaluate(getConfig().flowchart.htmlLabels)) { // const div = descr.children[0]; // const dv = select(descr); // bbox = div.getBoundingClientRect(); // dv.attr('width', bbox.width); // dv.attr('height', bbox.height); // } // // bbox = label.getBBox(); // // log.info(descr); // select(descr).attr( // 'transform', // 'translate( ' + // // (titleBox.width - bbox.width) / 2 + // (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + // ', ' + // (titleBox.height + halfPadding + 5) + // ')' // ); // select(text).attr( // 'transform', // 'translate( ' + // // (titleBox.width - bbox.width) / 2 + // (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + // ', ' + // 0 + // ')' // ); // // Get the size of the label // // Bounding box for title and text // bbox = label.node().getBBox(); // // Center the label // label.attr( // 'transform', // 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')' // ); 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 // .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); (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, rect); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point); }; return shapeSvg; }; var shapes = { question: question, rect: rect, labelRect: labelRect, rectWithTitle: rectWithTitle, choice: choice, circle: circle, doublecircle: doublecircle, stadium: stadium, hexagon: hexagon, rect_left_inv_arrow: rect_left_inv_arrow, lean_right: lean_right, lean_left: lean_left, trapezoid: trapezoid, inv_trapezoid: inv_trapezoid, rect_right_inv_arrow: rect_right_inv_arrow, cylinder: cylinder, start: start, end: end, note: _shapes_note__WEBPACK_IMPORTED_MODULE_8__["default"], subroutine: subroutine, fork: forkJoin, join: forkJoin, class_box: class_box }; var nodeElems = {}; var insertNode = function insertNode(elem, node, dir) { var newEl; var el; // Add link when appropriate if (node.link) { var target; if ((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().securityLevel === 'sandbox') { target = '_top'; } else if (node.linkTarget) { target = node.linkTarget || '_blank'; } newEl = elem.insert('svg:a').attr('xlink:href', node.link).attr('target', target); el = shapes[node.shape](newEl, node, dir); } else { el = shapes[node.shape](elem, node, dir); newEl = el; } if (node.tooltip) { el.attr('title', node.tooltip); } if (node.class) { el.attr('class', 'node default ' + node.class); } nodeElems[node.id] = newEl; if (node.haveCallback) { nodeElems[node.id].attr('class', nodeElems[node.id].attr('class') + ' clickable'); } }; var setNodeElem = function setNodeElem(elem, node) { nodeElems[node.id] = elem; }; var clear = function clear() { nodeElems = {}; }; var positionNode = function positionNode(node) { var el = nodeElems[node.id]; _logger__WEBPACK_IMPORTED_MODULE_4__.log.trace('Transforming node', node.diff, node, 'translate(' + (node.x - node.width / 2 - 5) + ', ' + node.width / 2 + ')'); var padding = 8; var diff = node.diff || 0; if (node.clusterNode) { el.attr('transform', 'translate(' + (node.x + diff - node.width / 2) + ', ' + (node.y - node.height / 2 - padding) + ')'); } else { el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')'); } return diff; }; /***/ }), /***/ "./src/dagre-wrapper/shapes/note.js": /*!******************************************!*\ !*** ./src/dagre-wrapper/shapes/note.js ***! \******************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./src/dagre-wrapper/shapes/util.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js"); /* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../intersect/index.js */ "./src/dagre-wrapper/intersect/index.js"); // eslint-disable-line var note = function note(parent, node) { var _labelHelper = (0,_util__WEBPACK_IMPORTED_MODULE_0__.labelHelper)(parent, node, 'node ' + node.classes, true), shapeSvg = _labelHelper.shapeSvg, bbox = _labelHelper.bbox, halfPadding = _labelHelper.halfPadding; _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Classes = ', node.classes); // add the rect var rect = shapeSvg.insert('rect', ':first-child'); 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); (0,_util__WEBPACK_IMPORTED_MODULE_0__.updateNodeBounds)(node, rect); node.intersect = function (point) { return _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__["default"].rect(node, point); }; return shapeSvg; }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (note); /***/ }), /***/ "./src/dagre-wrapper/shapes/util.js": /*!******************************************!*\ !*** ./src/dagre-wrapper/shapes/util.js ***! \******************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "insertPolygonShape": () => (/* binding */ insertPolygonShape), /* harmony export */ "labelHelper": () => (/* binding */ labelHelper), /* harmony export */ "updateNodeBounds": () => (/* binding */ updateNodeBounds) /* harmony export */ }); /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../createLabel */ "./src/dagre-wrapper/createLabel.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js"); /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js"); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../diagrams/common/common */ "./src/diagrams/common/common.js"); var labelHelper = function labelHelper(parent, node, _classes, isNode) { var classes; if (!_classes) { classes = 'node default'; } else { classes = _classes; } // Add outer g element var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the label and insert it after the rect var label = shapeSvg.insert('g').attr('class', 'label').attr('style', node.labelStyle); var labelText = typeof node.labelText === 'string' ? node.labelText : node.labelText[0]; var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__.sanitizeText)((0,_mermaidAPI__WEBPACK_IMPORTED_MODULE_3__.decodeEntities)(labelText), (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)()), node.labelStyle, false, isNode)); // Get the size of the label var bbox = text.getBBox(); if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) { var div = text.children[0]; var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text); bbox = div.getBoundingClientRect(); dv.attr('width', bbox.width); dv.attr('height', bbox.height); } var halfPadding = node.padding / 2; // Center the label label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')'); return { shapeSvg: shapeSvg, bbox: bbox, halfPadding: halfPadding, label: label }; }; var updateNodeBounds = function updateNodeBounds(node, element) { var bbox = element.node().getBBox(); node.width = bbox.width; node.height = bbox.height; }; /** * @param parent * @param w * @param h * @param points */ function insertPolygonShape(parent, w, h, points) { return parent.insert('polygon', ':first-child').attr('points', points.map(function (d) { return d.x + ',' + d.y; }).join(' ')).attr('class', 'label-container').attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')'); } /***/ }), /***/ "./src/defaultConfig.js": /*!******************************!*\ !*** ./src/defaultConfig.js ***! \******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "configKeys": () => (/* binding */ configKeys), /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js"); function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } /** * **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more[[click * here](8.6.0_docs.md)].** * * ## **What follows are config instructions for older versions** * * These are the default options which can be overridden with the initialization call like so: * * **Example 1:**
 mermaid.initialize({ flowchart:{ htmlLabels: false } }); 
* * **Example 2:**
  
* * A summary of all options and their defaults is found [here](#mermaidapi-configuration-defaults). * A description of each option follows below. * * @name Configuration */ var config = { /** * Theme , the CSS style sheet * * | Parameter | Description | Type | Required | Values | * | --------- | --------------- | ------ | -------- | ---------------------------------------------- | * | theme | Built in Themes | string | Optional | 'default', 'forest', 'dark', 'neutral', 'null' | * * **Notes:** To disable any pre-defined mermaid theme, use "null".
 "theme": "forest",
   * "themeCSS": ".node rect { fill: red; }" 
*/ theme: 'default', themeVariables: _themes__WEBPACK_IMPORTED_MODULE_0__["default"]["default"].getThemeVariables(), themeCSS: undefined, /* **maxTextSize** - The maximum allowed size of the users text diagram */ maxTextSize: 50000, darkMode: false, /** * | Parameter | Description | Type | Required | Values | * | ---------- | ------------------------------------------------------ | ------ | -------- | --------------------------- | * | fontFamily | specifies the font to be used in the rendered diagrams | string | Required | Any Possible CSS FontFamily | * * **Notes:** Default value: '"trebuchet ms", verdana, arial, sans-serif;'. */ fontFamily: '"trebuchet ms", verdana, arial, sans-serif;', /** * | Parameter | Description | Type | Required | Values | * | --------- | ----------------------------------------------------- | ---------------- | -------- | ------------- | * | logLevel | This option decides the amount of logging to be used. | string \| number | Required | 1, 2, 3, 4, 5 | * * **Notes:** * * - Debug: 1 * - Info: 2 * - Warn: 3 * - Error: 4 * - Fatal: 5 (default) */ logLevel: 5, /** * | Parameter | Description | Type | Required | Values | * | ------------- | --------------------------------- | ------ | -------- | ------------------------------- | * | securitylevel | Level of trust for parsed diagram | string | Required | 'strict', 'loose', 'antiscript' | * * **Notes**: * * - **strict**: (**default**) tags in text are encoded, click functionality is disabled * - **loose**: tags in text are allowed, click functionality is enabled * - **antiscript**: html tags in text are allowed, (only script element is removed), click * functionality is enabled */ securityLevel: 'strict', /** * | Parameter | Description | Type | Required | Values | * | ----------- | -------------------------------------------- | ------- | -------- | ----------- | * | startOnLoad | Dictates whether mermaid starts on Page load | boolean | Required | true, false | * * **Notes:** Default value: true */ startOnLoad: true, /** * | Parameter | Description | Type | Required | Values | * | ------------------- | ---------------------------------------------------------------------------- | ------- | -------- | ----------- | * | arrowMarkerAbsolute | Controls whether or arrow markers in html code are absolute paths or anchors | boolean | Required | true, false | * * **Notes**: * * This matters if you are using base tag settings. * * Default value: false */ arrowMarkerAbsolute: false, /** * This option controls which currentConfig keys are considered _secure_ and can only be changed * via call to mermaidAPI.initialize. Calls to mermaidAPI.reinitialize cannot make changes to the * `secure` keys in the current currentConfig. This prevents malicious graph directives from * overriding a site's default security. * * **Notes**: * * Default value: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize'] */ secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize'], /** * This option controls if the generated ids of nodes in the SVG are generated randomly or based * on a seed. If set to false, the IDs are generated based on the current date and thus are not * deterministic. This is the default behaviour. * * **Notes**: * * This matters if your files are checked into sourcecontrol e.g. git and should not change unless * content is changed. * * Default value: false */ deterministicIds: false, /** * This option is the optional seed for deterministic ids. if set to undefined but * deterministicIds is true, a simple number iterator is used. You can set this attribute to base * the seed on a static string. */ deterministicIDSeed: undefined, /** The object containing configurations specific for flowcharts */ flowchart: { /** * | Parameter | Description | Type | Required | Values | * | -------------- | ----------------------------------------------- | ------- | -------- | ------------------ | * | diagramPadding | Amount of padding around the diagram as a whole | Integer | Required | Any Positive Value | * * **Notes:** * * The amount of padding around the diagram as a whole so that embedded diagrams have margins, * expressed in pixels * * Default value: 8 */ diagramPadding: 8, /** * | Parameter | Description | Type | Required | Values | * | ---------- | -------------------------------------------------------------------------------------------- | ------- | -------- | ----------- | * | htmlLabels | Flag for setting whether or not a html tag should be used for rendering labels on the edges. | boolean | Required | true, false | * * **Notes:** Default value: true. */ htmlLabels: true, /** * | Parameter | Description | Type | Required | Values | * | ----------- | --------------------------------------------------- | ------- | -------- | ------------------- | * | nodeSpacing | Defines the spacing between nodes on the same level | Integer | Required | Any positive Number | * * **Notes:** * * 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.** * * Default value: 50 */ nodeSpacing: 50, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ----------------------------------------------------- | ------- | -------- | ------------------- | * | rankSpacing | Defines the spacing between nodes on different levels | Integer | Required | Any Positive Number | * * **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. * * Default value 50 */ rankSpacing: 50, /** * | Parameter | Description | Type | Required | Values | * | --------- | -------------------------------------------------- | ------ | -------- | ----------------------------- | * | curve | Defines how mermaid renders curves for flowcharts. | string | Required | 'basis', 'linear', 'cardinal' | * * **Notes:** * * Default Value: 'basis' */ curve: 'basis', // Only used in new experimental rendering // represents the padding between the labels and the shape padding: 15, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ----------- | ------- | -------- | ----------- | * | useMaxWidth | See notes | boolean | 4 | true, false | * * **Notes:** * * When this flag is set the height and width is set to 100% and is then scaling with the * available space if not the absolute space required is used. * * Default value: true */ useMaxWidth: true, /** * | Parameter | Description | Type | Required | Values | * | --------------- | ----------- | ------- | -------- | ----------------------- | * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper | * * **Notes:** * * Decides which rendering engine that is to be used for the rendering. Legal values are: * dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid * * Default value: 'dagre-d3' */ defaultRenderer: 'dagre-d3' }, /** The object containing configurations specific for sequence diagrams */ sequence: { hideUnusedParticipants: false, /** * | Parameter | Description | Type | Required | Values | * | --------------- | ---------------------------- | ------- | -------- | ------------------ | * | activationWidth | Width of the activation rect | Integer | Required | Any Positive Value | * * **Notes:** Default value :10 */ activationWidth: 10, /** * | Parameter | Description | Type | Required | Values | * | -------------- | ---------------------------------------------------- | ------- | -------- | ------------------ | * | diagramMarginX | Margin to the right and left of the sequence diagram | Integer | Required | Any Positive Value | * * **Notes:** Default value: 50 */ diagramMarginX: 50, /** * | Parameter | Description | Type | Required | Values | * | -------------- | ------------------------------------------------- | ------- | -------- | ------------------ | * | diagramMarginY | Margin to the over and under the sequence diagram | Integer | Required | Any Positive Value | * * **Notes:** Default value: 10 */ diagramMarginY: 10, /** * | Parameter | Description | Type | Required | Values | * | ----------- | --------------------- | ------- | -------- | ------------------ | * | actorMargin | Margin between actors | Integer | Required | Any Positive Value | * * **Notes:** Default value: 50 */ actorMargin: 50, /** * | Parameter | Description | Type | Required | Values | * | --------- | -------------------- | ------- | -------- | ------------------ | * | width | Width of actor boxes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 150 */ width: 150, /** * | Parameter | Description | Type | Required | Values | * | --------- | --------------------- | ------- | -------- | ------------------ | * | height | Height of actor boxes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 65 */ height: 65, /** * | Parameter | Description | Type | Required | Values | * | --------- | ------------------------ | ------- | -------- | ------------------ | * | boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 10 */ boxMargin: 10, /** * | Parameter | Description | Type | Required | Values | * | ------------- | -------------------------------------------- | ------- | -------- | ------------------ | * | boxTextMargin | Margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 5 */ boxTextMargin: 5, /** * | Parameter | Description | Type | Required | Values | * | ---------- | ------------------- | ------- | -------- | ------------------ | * | noteMargin | margin around notes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 10 */ noteMargin: 10, /** * | Parameter | Description | Type | Required | Values | * | ------------- | ---------------------- | ------- | -------- | ------------------ | * | messageMargin | Space between messages | Integer | Required | Any Positive Value | * * **Notes:** Default value: 35 */ messageMargin: 35, /** * | Parameter | Description | Type | Required | Values | * | ------------ | --------------------------- | ------ | -------- | ------------------------- | * | messageAlign | Multiline message alignment | string | Required | 'left', 'center', 'right' | * * **Notes:** Default value: 'center' */ messageAlign: 'center', /** * | Parameter | Description | Type | Required | Values | * | ------------ | --------------------------- | ------- | -------- | ----------- | * | mirrorActors | Mirror actors under diagram | boolean | Required | true, false | * * **Notes:** Default value: true */ mirrorActors: true, /** * | Parameter | Description | Type | Required | Values | * | ---------- | ----------------------------------------------------------------------- | ------- | -------- | ----------- | * | forceMenus | forces actor popup menus to always be visible (to support E2E testing). | Boolean | Required | True, False | * * **Notes:** * * Default value: false. */ forceMenus: false, /** * | Parameter | Description | Type | Required | Values | * | --------------- | ------------------------------------------ | ------- | -------- | ------------------ | * | bottomMarginAdj | Prolongs the edge of the diagram downwards | Integer | Required | Any Positive Value | * * **Notes:** * * Depending on css styling this might need adjustment. * * Default value: 1 */ bottomMarginAdj: 1, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ----------- | ------- | -------- | ----------- | * | useMaxWidth | See Notes | boolean | Required | true, false | * * **Notes:** When this flag is set to true, the height and width is set to 100% and is then * scaling with the available space. If set to false, the absolute space required is used. * * Default value: true */ useMaxWidth: true, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ------------------------------------ | ------- | -------- | ----------- | * | rightAngles | display curve arrows as right angles | boolean | Required | true, false | * * **Notes:** * * This will display arrows that start and begin at the same node as right angles, rather than a curve * * Default value: false */ rightAngles: false, /** * | Parameter | Description | Type | Required | Values | * | ------------------- | ------------------------------- | ------- | -------- | ----------- | * | showSequenceNumbers | This will show the node numbers | boolean | Required | true, false | * * **Notes:** Default value: false */ showSequenceNumbers: false, /** * | Parameter | Description | Type | Required | Values | * | ------------- | -------------------------------------------------- | ------- | -------- | ------------------ | * | actorFontSize | This sets the font size of the actor's description | Integer | Require | Any Positive Value | * * **Notes:** **Default value 14**.. */ actorFontSize: 14, /** * | Parameter | Description | Type | Required | Values | * | --------------- | ---------------------------------------------------- | ------ | -------- | --------------------------- | * | actorFontFamily | This sets the font family of the actor's description | string | Required | Any Possible CSS FontFamily | * * **Notes:** Default value: "'Open Sans", sans-serif' */ actorFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of the actor's description * * **Notes:** Default value: 400. */ actorFontWeight: 400, /** * | Parameter | Description | Type | Required | Values | * | ------------ | ----------------------------------------------- | ------- | -------- | ------------------ | * | noteFontSize | This sets the font size of actor-attached notes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 14 */ noteFontSize: 14, /** * | Parameter | Description | Type | Required | Values | * | -------------- | -------------------------------------------------- | ------ | -------- | --------------------------- | * | noteFontFamily | This sets the font family of actor-attached notes. | string | Required | Any Possible CSS FontFamily | * * **Notes:** Default value: ''"trebuchet ms", verdana, arial, sans-serif' */ noteFontFamily: '"trebuchet ms", verdana, arial, sans-serif', /** * This sets the font weight of the note's description * * **Notes:** Default value: 400 */ noteFontWeight: 400, /** * | Parameter | Description | Type | Required | Values | * | --------- | ---------------------------------------------------- | ------ | -------- | ------------------------- | * | noteAlign | This sets the text alignment of actor-attached notes | string | required | 'left', 'center', 'right' | * * **Notes:** Default value: 'center' */ noteAlign: 'center', /** * | Parameter | Description | Type | Required | Values | * | --------------- | ----------------------------------------- | ------- | -------- | ------------------- | * | messageFontSize | This sets the font size of actor messages | Integer | Required | Any Positive Number | * * **Notes:** Default value: 16 */ messageFontSize: 16, /** * | Parameter | Description | Type | Required | Values | * | ----------------- | ------------------------------------------- | ------ | -------- | --------------------------- | * | messageFontFamily | This sets the font family of actor messages | string | Required | Any Possible CSS FontFamily | * * **Notes:** Default value: '"trebuchet ms", verdana, arial, sans-serif' */ messageFontFamily: '"trebuchet ms", verdana, arial, sans-serif', /** * This sets the font weight of the message's description * * **Notes:** Default value: 400. */ messageFontWeight: 400, /** * This sets the auto-wrap state for the diagram * * **Notes:** Default value: false. */ wrap: false, /** * This sets the auto-wrap padding for the diagram (sides only) * * **Notes:** Default value: 0. */ wrapPadding: 10, /** * This sets the width of the loop-box (loop, alt, opt, par) * * **Notes:** Default value: 50. */ labelBoxWidth: 50, /** * This sets the height of the loop-box (loop, alt, opt, par) * * **Notes:** Default value: 20. */ labelBoxHeight: 20, messageFont: function messageFont() { return { fontFamily: this.messageFontFamily, fontSize: this.messageFontSize, fontWeight: this.messageFontWeight }; }, noteFont: function noteFont() { return { fontFamily: this.noteFontFamily, fontSize: this.noteFontSize, fontWeight: this.noteFontWeight }; }, actorFont: function actorFont() { return { fontFamily: this.actorFontFamily, fontSize: this.actorFontSize, fontWeight: this.actorFontWeight }; } }, /** The object containing configurations specific for gantt diagrams */ gantt: { /** * ### titleTopMargin * * | Parameter | Description | Type | Required | Values | * | -------------- | ---------------------------------------------- | ------- | -------- | ------------------ | * | titleTopMargin | Margin top for the text over the gantt diagram | Integer | Required | Any Positive Value | * * **Notes:** Default value: 25 */ titleTopMargin: 25, /** * | Parameter | Description | Type | Required | Values | * | --------- | ----------------------------------- | ------- | -------- | ------------------ | * | barHeight | The height of the bars in the graph | Integer | Required | Any Positive Value | * * **Notes:** Default value: 20 */ barHeight: 20, /** * | Parameter | Description | Type | Required | Values | * | --------- | ---------------------------------------------------------------- | ------- | -------- | ------------------ | * | barGap | The margin between the different activities in the gantt diagram | Integer | Optional | Any Positive Value | * * **Notes:** Default value: 4 */ barGap: 4, /** * | Parameter | Description | Type | Required | Values | * | ---------- | -------------------------------------------------------------------------- | ------- | -------- | ------------------ | * | topPadding | Margin between title and gantt diagram and between axis and gantt diagram. | Integer | Required | Any Positive Value | * * **Notes:** Default value: 50 */ topPadding: 50, /** * | Parameter | Description | Type | Required | Values | * | ------------ | ----------------------------------------------------------------------- | ------- | -------- | ------------------ | * | rightPadding | The space allocated for the section name to the right of the activities | Integer | Required | Any Positive Value | * * **Notes:** Default value: 75 */ rightPadding: 75, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ---------------------------------------------------------------------- | ------- | -------- | ------------------ | * | leftPadding | The space allocated for the section name to the left of the activities | Integer | Required | Any Positive Value | * * **Notes:** Default value: 75 */ leftPadding: 75, /** * | Parameter | Description | Type | Required | Values | * | -------------------- | -------------------------------------------- | ------- | -------- | ------------------ | * | gridLineStartPadding | Vertical starting position of the grid lines | Integer | Required | Any Positive Value | * * **Notes:** Default value: 35 */ gridLineStartPadding: 35, /** * | Parameter | Description | Type | Required | Values | * | --------- | ----------- | ------- | -------- | ------------------ | * | fontSize | Font size | Integer | Required | Any Positive Value | * * **Notes:** Default value: 11 */ fontSize: 11, /** * | Parameter | Description | Type | Required | Values | * | --------------- | ---------------------- | ------- | -------- | ------------------ | * | sectionFontSize | Font size for sections | Integer | Required | Any Positive Value | * * **Notes:** Default value: 11 */ sectionFontSize: 11, /** * | Parameter | Description | Type | Required | Values | * | ------------------- | ---------------------------------------- | ------- | -------- | ------------------ | * | numberSectionStyles | The number of alternating section styles | Integer | 4 | Any Positive Value | * * **Notes:** Default value: 4 */ numberSectionStyles: 4, /** * | Parameter | Description | Type | Required | Values | * | ---------- | --------------------------- | ---- | -------- | ---------------- | * | axisFormat | Datetime format of the axis | 3 | Required | Date in yy-mm-dd | * * **Notes:** * * This might need adjustment to match your locale and preferences * * Default value: '%Y-%m-%d'. */ axisFormat: '%Y-%m-%d', /** * | Parameter | Description | Type | Required | Values | * | ----------- | ----------- | ------- | -------- | ----------- | * | useMaxWidth | See notes | boolean | 4 | true, false | * * **Notes:** * * When this flag is set the height and width is set to 100% and is then scaling with the * available space if not the absolute space required is used. * * Default value: true */ useMaxWidth: true, /** * | Parameter | Description | Type | Required | Values | * | --------- | ----------- | ------- | -------- | ----------- | * | topAxis | See notes | Boolean | 4 | True, False | * * **Notes:** when this flag is set date labels will be added to the top of the chart * * **Default value false**. */ topAxis: false, useWidth: undefined }, /** The object containing configurations specific for journey diagrams */ journey: { /** * | Parameter | Description | Type | Required | Values | * | -------------- | ---------------------------------------------------- | ------- | -------- | ------------------ | * | diagramMarginX | Margin to the right and left of the sequence diagram | Integer | Required | Any Positive Value | * * **Notes:** Default value: 50 */ diagramMarginX: 50, /** * | Parameter | Description | Type | Required | Values | * | -------------- | -------------------------------------------------- | ------- | -------- | ------------------ | * | diagramMarginY | Margin to the over and under the sequence diagram. | Integer | Required | Any Positive Value | * * **Notes:** Default value: 10 */ diagramMarginY: 10, /** * | Parameter | Description | Type | Required | Values | * | ----------- | --------------------- | ------- | -------- | ------------------ | * | actorMargin | Margin between actors | Integer | Required | Any Positive Value | * * **Notes:** Default value: 50 */ leftMargin: 150, /** * | Parameter | Description | Type | Required | Values | * | --------- | -------------------- | ------- | -------- | ------------------ | * | width | Width of actor boxes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 150 */ width: 150, /** * | Parameter | Description | Type | Required | Values | * | --------- | --------------------- | ------- | -------- | ------------------ | * | height | Height of actor boxes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 65 */ height: 50, /** * | Parameter | Description | Type | Required | Values | * | --------- | ------------------------ | ------- | -------- | ------------------ | * | boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 10 */ boxMargin: 10, /** * | Parameter | Description | Type | Required | Values | * | ------------- | -------------------------------------------- | ------- | -------- | ------------------ | * | boxTextMargin | Margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 5 */ boxTextMargin: 5, /** * | Parameter | Description | Type | Required | Values | * | ---------- | ------------------- | ------- | -------- | ------------------ | * | noteMargin | Margin around notes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 10 */ noteMargin: 10, /** * | Parameter | Description | Type | Required | Values | * | ------------- | ----------------------- | ------- | -------- | ------------------ | * | messageMargin | Space between messages. | Integer | Required | Any Positive Value | * * **Notes:** * * Space between messages. * * Default value: 35 */ messageMargin: 35, /** * | Parameter | Description | Type | Required | Values | * | ------------ | --------------------------- | ---- | -------- | ------------------------- | * | messageAlign | Multiline message alignment | 3 | 4 | 'left', 'center', 'right' | * * **Notes:** Default value: 'center' */ messageAlign: 'center', /** * | Parameter | Description | Type | Required | Values | * | --------------- | ------------------------------------------ | ------- | -------- | ------------------ | * | bottomMarginAdj | Prolongs the edge of the diagram downwards | Integer | 4 | Any Positive Value | * * **Notes:** * * Depending on css styling this might need adjustment. * * Default value: 1 */ bottomMarginAdj: 1, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ----------- | ------- | -------- | ----------- | * | useMaxWidth | See notes | boolean | 4 | true, false | * * **Notes:** * * When this flag is set the height and width is set to 100% and is then scaling with the * available space if not the absolute space required is used. * * Default value: true */ useMaxWidth: true, /** * | Parameter | Description | Type | Required | Values | * | ----------- | --------------------------------- | ---- | -------- | ----------- | * | rightAngles | Curved Arrows become Right Angles | 3 | 4 | true, false | * * **Notes:** * * This will display arrows that start and begin at the same node as right angles, rather than a curves * * Default value: false */ rightAngles: false, taskFontSize: 14, taskFontFamily: '"Open Sans", sans-serif', taskMargin: 50, // width of activation box activationWidth: 10, // text placement as: tspan | fo | old only text as before textPlacement: 'fo', actorColours: ['#8FBC8F', '#7CFC00', '#00FFFF', '#20B2AA', '#B0E0E6', '#FFFFE0'], sectionFills: ['#191970', '#8B008B', '#4B0082', '#2F4F4F', '#800000', '#8B4513', '#00008B'], sectionColours: ['#fff'] }, class: { arrowMarkerAbsolute: false, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ----------- | ------- | -------- | ----------- | * | useMaxWidth | See notes | boolean | 4 | true, false | * * **Notes:** * * When this flag is set the height and width is set to 100% and is then scaling with the * available space if not the absolute space required is used. * * Default value: true */ useMaxWidth: true, /** * | Parameter | Description | Type | Required | Values | * | --------------- | ----------- | ------- | -------- | ----------------------- | * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper | * * **Notes**: * * Decides which rendering engine that is to be used for the rendering. Legal values are: * dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid * * Default value: 'dagre-d3' */ defaultRenderer: 'dagre-wrapper' }, state: { dividerMargin: 10, sizeUnit: 5, padding: 8, textHeight: 10, titleShift: -15, noteMargin: 10, forkWidth: 70, forkHeight: 7, // Used miniPadding: 2, // Font size factor, this is used to guess the width of the edges labels before rendering by dagre // layout. This might need updating if/when switching font fontSizeFactor: 5.02, fontSize: 24, labelHeight: 16, edgeLengthFactor: '20', compositTitleSize: 35, radius: 5, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ----------- | ------- | -------- | ----------- | * | useMaxWidth | See notes | boolean | 4 | true, false | * * **Notes:** * * When this flag is set the height and width is set to 100% and is then scaling with the * available space if not the absolute space required is used. * * Default value: true */ useMaxWidth: true, /** * | Parameter | Description | Type | Required | Values | * | --------------- | ----------- | ------- | -------- | ----------------------- | * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper | * * **Notes:** * * Decides which rendering engine that is to be used for the rendering. Legal values are: * dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid * * Default value: 'dagre-d3' */ defaultRenderer: 'dagre-wrapper' }, /** The object containing configurations specific for entity relationship diagrams */ er: { /** * | Parameter | Description | Type | Required | Values | * | -------------- | ----------------------------------------------- | ------- | -------- | ------------------ | * | diagramPadding | Amount of padding around the diagram as a whole | Integer | Required | Any Positive Value | * * **Notes:** * * The amount of padding around the diagram as a whole so that embedded diagrams have margins, * expressed in pixels * * Default value: 20 */ diagramPadding: 20, /** * | Parameter | Description | Type | Required | Values | * | --------------- | ---------------------------------------- | ------ | -------- | ---------------------- | * | layoutDirection | Directional bias for layout of entities. | string | Required | "TB", "BT", "LR", "RL" | * * **Notes:** * * 'TB' for Top-Bottom, 'BT'for Bottom-Top, 'LR' for Left-Right, or 'RL' for Right to Left. * * T = top, B = bottom, L = left, and R = right. * * Default value: 'TB' */ layoutDirection: 'TB', /** * | Parameter | Description | Type | Required | Values | * | -------------- | ---------------------------------- | ------- | -------- | ------------------ | * | minEntityWidth | The minimum width of an entity box | Integer | Required | Any Positive Value | * * **Notes:** Expressed in pixels. Default value: 100 */ minEntityWidth: 100, /** * | Parameter | Description | Type | Required | Values | * | --------------- | ----------------------------------- | ------- | -------- | ------------------ | * | minEntityHeight | The minimum height of an entity box | Integer | 4 | Any Positive Value | * * **Notes:** Expressed in pixels Default value: 75 */ minEntityHeight: 75, /** * | Parameter | Description | Type | Required | Values | * | ------------- | ------------------------------------------------------------ | ------- | -------- | ------------------ | * | entityPadding | Minimum internal padding between text in box and box borders | Integer | 4 | Any Positive Value | * * **Notes:** * * The minimum internal padding between text in an entity box and the enclosing box borders, * expressed in pixels. * * Default value: 15 */ entityPadding: 15, /** * | Parameter | Description | Type | Required | Values | * | --------- | ----------------------------------- | ------ | -------- | -------------------- | * | stroke | Stroke color of box edges and lines | string | 4 | Any recognized color | * * **Notes:** Default value: 'gray' */ stroke: 'gray', /** * | Parameter | Description | Type | Required | Values | * | --------- | -------------------------- | ------ | -------- | -------------------- | * | fill | Fill color of entity boxes | string | 4 | Any recognized color | * * **Notes:** Default value: 'honeydew' */ fill: 'honeydew', /** * | Parameter | Description | Type | Required | Values | * | --------- | ------------------- | ------- | -------- | ------------------ | * | fontSize | Font Size in pixels | Integer | | Any Positive Value | * * **Notes:** * * Font size (expressed as an integer representing a number of pixels) Default value: 12 */ fontSize: 12, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ----------- | ------- | -------- | ----------- | * | useMaxWidth | See Notes | boolean | Required | true, false | * * **Notes:** * * When this flag is set to true, the diagram width is locked to 100% and scaled based on * available space. If set to false, the diagram reserves its absolute width. * * Default value: true */ useMaxWidth: true }, /** The object containing configurations specific for pie diagrams */ pie: { useWidth: undefined, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ----------- | ------- | -------- | ----------- | * | useMaxWidth | See Notes | boolean | Required | true, false | * * **Notes:** * * When this flag is set to true, the diagram width is locked to 100% and scaled based on * available space. If set to false, the diagram reserves its absolute width. * * Default value: true */ useMaxWidth: true }, /** The object containing configurations specific for req diagrams */ requirement: { useWidth: undefined, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ----------- | ------- | -------- | ----------- | * | useMaxWidth | See Notes | boolean | Required | true, false | * * **Notes:** * * When this flag is set to true, the diagram width is locked to 100% and scaled based on * available space. If set to false, the diagram reserves its absolute width. * * Default value: true */ useMaxWidth: true, rect_fill: '#f9f9f9', text_color: '#333', rect_border_size: '0.5px', rect_border_color: '#bbb', rect_min_width: 200, rect_min_height: 200, fontSize: 14, rect_padding: 10, line_height: 20 }, gitGraph: { diagramPadding: 8, nodeLabel: { width: 75, height: 100, x: -25, y: 0 }, mainBranchName: 'main', mainBranchOrder: 0, showCommitLabel: true, showBranches: true, rotateCommitLabel: true }, /** The object containing configurations specific for c4 diagrams */ c4: { useWidth: undefined, /** * | Parameter | Description | Type | Required | Values | * | -------------- | ---------------------------------------------- | ------- | -------- | ------------------ | * | diagramMarginX | Margin to the right and left of the c4 diagram | Integer | Required | Any Positive Value | * * **Notes:** Default value: 50 */ diagramMarginX: 50, /** * | Parameter | Description | Type | Required | Values | * | -------------- | ------------------------------------------- | ------- | -------- | ------------------ | * | diagramMarginY | Margin to the over and under the c4 diagram | Integer | Required | Any Positive Value | * * **Notes:** Default value: 10 */ diagramMarginY: 10, /** * | Parameter | Description | Type | Required | Values | * | ------------- | --------------------- | ------- | -------- | ------------------ | * | c4ShapeMargin | Margin between shapes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 50 */ c4ShapeMargin: 50, /** * | Parameter | Description | Type | Required | Values | * | -------------- | ---------------------- | ------- | -------- | ------------------ | * | c4ShapePadding | Padding between shapes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 20 */ c4ShapePadding: 20, /** * | Parameter | Description | Type | Required | Values | * | --------- | --------------------- | ------- | -------- | ------------------ | * | width | Width of person boxes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 216 */ width: 216, /** * | Parameter | Description | Type | Required | Values | * | --------- | ---------------------- | ------- | -------- | ------------------ | * | height | Height of person boxes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 60 */ height: 60, /** * | Parameter | Description | Type | Required | Values | * | --------- | ------------------- | ------- | -------- | ------------------ | * | boxMargin | Margin around boxes | Integer | Required | Any Positive Value | * * **Notes:** Default value: 10 */ boxMargin: 10, /** * | Parameter | Description | Type | Required | Values | * | ----------- | ----------- | ------- | -------- | ----------- | * | useMaxWidth | See Notes | boolean | Required | true, false | * * **Notes:** When this flag is set to true, the height and width is set to 100% and is then * scaling with the available space. If set to false, the absolute space required is used. * * Default value: true */ useMaxWidth: true, /** * | Parameter | Description | Type | Required | Values | * | ------------ | ----------- | ------- | -------- | ------------------ | * | c4ShapeInRow | See Notes | Integer | Required | Any Positive Value | * * **Notes:** How many shapes to place in each row. * * Default value: 4 */ c4ShapeInRow: 4, nextLinePaddingX: 0, /** * | Parameter | Description | Type | Required | Values | * | --------------- | ----------- | ------- | -------- | ------------------ | * | c4BoundaryInRow | See Notes | Integer | Required | Any Positive Value | * * **Notes:** How many boundarys to place in each row. * * Default value: 2 */ c4BoundaryInRow: 2, /** * This sets the font size of Person shape for the diagram * * **Notes:** Default value: 14. */ personFontSize: 14, /** * This sets the font family of Person shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ personFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of Person shape for the diagram * * **Notes:** Default value: normal. */ personFontWeight: 'normal', /** * This sets the font size of External Person shape for the diagram * * **Notes:** Default value: 14. */ external_personFontSize: 14, /** * This sets the font family of External Person shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ external_personFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of External Person shape for the diagram * * **Notes:** Default value: normal. */ external_personFontWeight: 'normal', /** * This sets the font size of System shape for the diagram * * **Notes:** Default value: 14. */ systemFontSize: 14, /** * This sets the font family of System shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ systemFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of System shape for the diagram * * **Notes:** Default value: normal. */ systemFontWeight: 'normal', /** * This sets the font size of External System shape for the diagram * * **Notes:** Default value: 14. */ external_systemFontSize: 14, /** * This sets the font family of External System shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ external_systemFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of External System shape for the diagram * * **Notes:** Default value: normal. */ external_systemFontWeight: 'normal', /** * This sets the font size of System DB shape for the diagram * * **Notes:** Default value: 14. */ system_dbFontSize: 14, /** * This sets the font family of System DB shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ system_dbFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of System DB shape for the diagram * * **Notes:** Default value: normal. */ system_dbFontWeight: 'normal', /** * This sets the font size of External System DB shape for the diagram * * **Notes:** Default value: 14. */ external_system_dbFontSize: 14, /** * This sets the font family of External System DB shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ external_system_dbFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of External System DB shape for the diagram * * **Notes:** Default value: normal. */ external_system_dbFontWeight: 'normal', /** * This sets the font size of System Queue shape for the diagram * * **Notes:** Default value: 14. */ system_queueFontSize: 14, /** * This sets the font family of System Queue shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ system_queueFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of System Queue shape for the diagram * * **Notes:** Default value: normal. */ system_queueFontWeight: 'normal', /** * This sets the font size of External System Queue shape for the diagram * * **Notes:** Default value: 14. */ external_system_queueFontSize: 14, /** * This sets the font family of External System Queue shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ external_system_queueFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of External System Queue shape for the diagram * * **Notes:** Default value: normal. */ external_system_queueFontWeight: 'normal', /** * This sets the font size of Boundary shape for the diagram * * **Notes:** Default value: 14. */ boundaryFontSize: 14, /** * This sets the font family of Boundary shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ boundaryFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of Boundary shape for the diagram * * **Notes:** Default value: normal. */ boundaryFontWeight: 'normal', /** * This sets the font size of Message shape for the diagram * * **Notes:** Default value: 12. */ messageFontSize: 12, /** * This sets the font family of Message shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ messageFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of Message shape for the diagram * * **Notes:** Default value: normal. */ messageFontWeight: 'normal', /** * This sets the font size of Container shape for the diagram * * **Notes:** Default value: 14. */ containerFontSize: 14, /** * This sets the font family of Container shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ containerFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of Container shape for the diagram * * **Notes:** Default value: normal. */ containerFontWeight: 'normal', /** * This sets the font size of External Container shape for the diagram * * **Notes:** Default value: 14. */ external_containerFontSize: 14, /** * This sets the font family of External Container shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ external_containerFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of External Container shape for the diagram * * **Notes:** Default value: normal. */ external_containerFontWeight: 'normal', /** * This sets the font size of Container DB shape for the diagram * * **Notes:** Default value: 14. */ container_dbFontSize: 14, /** * This sets the font family of Container DB shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ container_dbFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of Container DB shape for the diagram * * **Notes:** Default value: normal. */ container_dbFontWeight: 'normal', /** * This sets the font size of External Container DB shape for the diagram * * **Notes:** Default value: 14. */ external_container_dbFontSize: 14, /** * This sets the font family of External Container DB shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ external_container_dbFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of External Container DB shape for the diagram * * **Notes:** Default value: normal. */ external_container_dbFontWeight: 'normal', /** * This sets the font size of Container Queue shape for the diagram * * **Notes:** Default value: 14. */ container_queueFontSize: 14, /** * This sets the font family of Container Queue shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ container_queueFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of Container Queue shape for the diagram * * **Notes:** Default value: normal. */ container_queueFontWeight: 'normal', /** * This sets the font size of External Container Queue shape for the diagram * * **Notes:** Default value: 14. */ external_container_queueFontSize: 14, /** * This sets the font family of External Container Queue shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ external_container_queueFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of External Container Queue shape for the diagram * * **Notes:** Default value: normal. */ external_container_queueFontWeight: 'normal', /** * This sets the font size of Component shape for the diagram * * **Notes:** Default value: 14. */ componentFontSize: 14, /** * This sets the font family of Component shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ componentFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of Component shape for the diagram * * **Notes:** Default value: normal. */ componentFontWeight: 'normal', /** * This sets the font size of External Component shape for the diagram * * **Notes:** Default value: 14. */ external_componentFontSize: 14, /** * This sets the font family of External Component shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ external_componentFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of External Component shape for the diagram * * **Notes:** Default value: normal. */ external_componentFontWeight: 'normal', /** * This sets the font size of Component DB shape for the diagram * * **Notes:** Default value: 14. */ component_dbFontSize: 14, /** * This sets the font family of Component DB shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ component_dbFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of Component DB shape for the diagram * * **Notes:** Default value: normal. */ component_dbFontWeight: 'normal', /** * This sets the font size of External Component DB shape for the diagram * * **Notes:** Default value: 14. */ external_component_dbFontSize: 14, /** * This sets the font family of External Component DB shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ external_component_dbFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of External Component DB shape for the diagram * * **Notes:** Default value: normal. */ external_component_dbFontWeight: 'normal', /** * This sets the font size of Component Queue shape for the diagram * * **Notes:** Default value: 14. */ component_queueFontSize: 14, /** * This sets the font family of Component Queue shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ component_queueFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of Component Queue shape for the diagram * * **Notes:** Default value: normal. */ component_queueFontWeight: 'normal', /** * This sets the font size of External Component Queue shape for the diagram * * **Notes:** Default value: 14. */ external_component_queueFontSize: 14, /** * This sets the font family of External Component Queue shape for the diagram * * **Notes:** Default value: "Open Sans", sans-serif. */ external_component_queueFontFamily: '"Open Sans", sans-serif', /** * This sets the font weight of External Component Queue shape for the diagram * * **Notes:** Default value: normal. */ external_component_queueFontWeight: 'normal', /** * This sets the auto-wrap state for the diagram * * **Notes:** Default value: true. */ wrap: true, /** * This sets the auto-wrap padding for the diagram (sides only) * * **Notes:** Default value: 0. */ wrapPadding: 10, personFont: function personFont() { return { fontFamily: this.personFontFamily, fontSize: this.personFontSize, fontWeight: this.personFontWeight }; }, external_personFont: function external_personFont() { return { fontFamily: this.external_personFontFamily, fontSize: this.external_personFontSize, fontWeight: this.external_personFontWeight }; }, systemFont: function systemFont() { return { fontFamily: this.systemFontFamily, fontSize: this.systemFontSize, fontWeight: this.systemFontWeight }; }, external_systemFont: function external_systemFont() { return { fontFamily: this.external_systemFontFamily, fontSize: this.external_systemFontSize, fontWeight: this.external_systemFontWeight }; }, system_dbFont: function system_dbFont() { return { fontFamily: this.system_dbFontFamily, fontSize: this.system_dbFontSize, fontWeight: this.system_dbFontWeight }; }, external_system_dbFont: function external_system_dbFont() { return { fontFamily: this.external_system_dbFontFamily, fontSize: this.external_system_dbFontSize, fontWeight: this.external_system_dbFontWeight }; }, system_queueFont: function system_queueFont() { return { fontFamily: this.system_queueFontFamily, fontSize: this.system_queueFontSize, fontWeight: this.system_queueFontWeight }; }, external_system_queueFont: function external_system_queueFont() { return { fontFamily: this.external_system_queueFontFamily, fontSize: this.external_system_queueFontSize, fontWeight: this.external_system_queueFontWeight }; }, containerFont: function containerFont() { return { fontFamily: this.containerFontFamily, fontSize: this.containerFontSize, fontWeight: this.containerFontWeight }; }, external_containerFont: function external_containerFont() { return { fontFamily: this.external_containerFontFamily, fontSize: this.external_containerFontSize, fontWeight: this.external_containerFontWeight }; }, container_dbFont: function container_dbFont() { return { fontFamily: this.container_dbFontFamily, fontSize: this.container_dbFontSize, fontWeight: this.container_dbFontWeight }; }, external_container_dbFont: function external_container_dbFont() { return { fontFamily: this.external_container_dbFontFamily, fontSize: this.external_container_dbFontSize, fontWeight: this.external_container_dbFontWeight }; }, container_queueFont: function container_queueFont() { return { fontFamily: this.container_queueFontFamily, fontSize: this.container_queueFontSize, fontWeight: this.container_queueFontWeight }; }, external_container_queueFont: function external_container_queueFont() { return { fontFamily: this.external_container_queueFontFamily, fontSize: this.external_container_queueFontSize, fontWeight: this.external_container_queueFontWeight }; }, componentFont: function componentFont() { return { fontFamily: this.componentFontFamily, fontSize: this.componentFontSize, fontWeight: this.componentFontWeight }; }, external_componentFont: function external_componentFont() { return { fontFamily: this.external_componentFontFamily, fontSize: this.external_componentFontSize, fontWeight: this.external_componentFontWeight }; }, component_dbFont: function component_dbFont() { return { fontFamily: this.component_dbFontFamily, fontSize: this.component_dbFontSize, fontWeight: this.component_dbFontWeight }; }, external_component_dbFont: function external_component_dbFont() { return { fontFamily: this.external_component_dbFontFamily, fontSize: this.external_component_dbFontSize, fontWeight: this.external_component_dbFontWeight }; }, component_queueFont: function component_queueFont() { return { fontFamily: this.component_queueFontFamily, fontSize: this.component_queueFontSize, fontWeight: this.component_queueFontWeight }; }, external_component_queueFont: function external_component_queueFont() { return { fontFamily: this.external_component_queueFontFamily, fontSize: this.external_component_queueFontSize, fontWeight: this.external_component_queueFontWeight }; }, boundaryFont: function boundaryFont() { return { fontFamily: this.boundaryFontFamily, fontSize: this.boundaryFontSize, fontWeight: this.boundaryFontWeight }; }, messageFont: function messageFont() { return { fontFamily: this.messageFontFamily, fontSize: this.messageFontSize, fontWeight: this.messageFontWeight }; }, // ' Colors // ' ################################## person_bg_color: '#08427B', person_border_color: '#073B6F', external_person_bg_color: '#686868', external_person_border_color: '#8A8A8A', system_bg_color: '#1168BD', system_border_color: '#3C7FC0', system_db_bg_color: '#1168BD', system_db_border_color: '#3C7FC0', system_queue_bg_color: '#1168BD', system_queue_border_color: '#3C7FC0', external_system_bg_color: '#999999', external_system_border_color: '#8A8A8A', external_system_db_bg_color: '#999999', external_system_db_border_color: '#8A8A8A', external_system_queue_bg_color: '#999999', external_system_queue_border_color: '#8A8A8A', container_bg_color: '#438DD5', container_border_color: '#3C7FC0', container_db_bg_color: '#438DD5', container_db_border_color: '#3C7FC0', container_queue_bg_color: '#438DD5', container_queue_border_color: '#3C7FC0', external_container_bg_color: '#B3B3B3', external_container_border_color: '#A6A6A6', external_container_db_bg_color: '#B3B3B3', external_container_db_border_color: '#A6A6A6', external_container_queue_bg_color: '#B3B3B3', external_container_queue_border_color: '#A6A6A6', component_bg_color: '#85BBF0', component_border_color: '#78A8D8', component_db_bg_color: '#85BBF0', component_db_border_color: '#78A8D8', component_queue_bg_color: '#85BBF0', component_queue_border_color: '#78A8D8', external_component_bg_color: '#CCCCCC', external_component_border_color: '#BFBFBF', external_component_db_bg_color: '#CCCCCC', external_component_db_border_color: '#BFBFBF', external_component_queue_bg_color: '#CCCCCC', external_component_queue_border_color: '#BFBFBF' } }; config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute; config.gitGraph.arrowMarkerAbsolute = config.arrowMarkerAbsolute; var keyify = function keyify(obj) { var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; return Object.keys(obj).reduce(function (res, el) { if (Array.isArray(obj[el])) { return res; } else if (_typeof(obj[el]) === 'object' && obj[el] !== null) { return [].concat(_toConsumableArray(res), [prefix + el], _toConsumableArray(keyify(obj[el], ''))); } return [].concat(_toConsumableArray(res), [prefix + el]); }, []); }; var configKeys = keyify(config, ''); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (config); /***/ }), /***/ "./src/diagrams/c4/c4Db.js": /*!*********************************!*\ !*** ./src/diagrams/c4/c4Db.js ***! \*********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "ARROWTYPE": () => (/* binding */ ARROWTYPE), /* harmony export */ "LINETYPE": () => (/* binding */ LINETYPE), /* harmony export */ "PLACEMENT": () => (/* binding */ PLACEMENT), /* harmony export */ "addComponent": () => (/* binding */ addComponent), /* harmony export */ "addContainer": () => (/* binding */ addContainer), /* harmony export */ "addContainerBoundary": () => (/* binding */ addContainerBoundary), /* harmony export */ "addDeploymentNode": () => (/* binding */ addDeploymentNode), /* harmony export */ "addPersonOrSystem": () => (/* binding */ addPersonOrSystem), /* harmony export */ "addPersonOrSystemBoundary": () => (/* binding */ addPersonOrSystemBoundary), /* harmony export */ "addRel": () => (/* binding */ addRel), /* harmony export */ "autoWrap": () => (/* binding */ autoWrap), /* harmony export */ "clear": () => (/* binding */ clear), /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ "getBoundarys": () => (/* binding */ getBoundarys), /* harmony export */ "getC4BoundaryInRow": () => (/* binding */ getC4BoundaryInRow), /* harmony export */ "getC4Shape": () => (/* binding */ getC4Shape), /* harmony export */ "getC4ShapeArray": () => (/* binding */ getC4ShapeArray), /* harmony export */ "getC4ShapeInRow": () => (/* binding */ getC4ShapeInRow), /* harmony export */ "getC4ShapeKeys": () => (/* binding */ getC4ShapeKeys), /* harmony export */ "getC4Type": () => (/* binding */ getC4Type), /* harmony export */ "getCurrentBoundaryParse": () => (/* binding */ getCurrentBoundaryParse), /* harmony export */ "getParentBoundaryParse": () => (/* binding */ getParentBoundaryParse), /* harmony export */ "getRels": () => (/* binding */ getRels), /* harmony export */ "getTitle": () => (/* binding */ getTitle), /* harmony export */ "parseDirective": () => (/* binding */ parseDirective), /* harmony export */ "popBoundaryParseStack": () => (/* binding */ popBoundaryParseStack), /* harmony export */ "setC4Type": () => (/* binding */ setC4Type), /* harmony export */ "setTitle": () => (/* binding */ setTitle), /* harmony export */ "setWrap": () => (/* binding */ setWrap), /* harmony export */ "updateElStyle": () => (/* binding */ updateElStyle), /* harmony export */ "updateLayoutConfig": () => (/* binding */ updateLayoutConfig), /* harmony export */ "updateRelStyle": () => (/* binding */ updateRelStyle) /* harmony export */ }); /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js"); /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js"); /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js"); function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } var c4ShapeArray = []; var boundaryParseStack = ['']; var currentBoundaryParse = 'global'; var parentBoundaryParse = ''; var boundarys = [{ alias: 'global', label: { text: 'global' }, type: { text: 'global' }, tags: null, link: null, parentBoundary: '' }]; var rels = []; var title = ''; var wrapEnabled = false; var description = ''; var c4ShapeInRow = 4; var c4BoundaryInRow = 2; var c4Type; var getC4Type = function getC4Type() { return c4Type; }; var setC4Type = function setC4Type(c4TypeParam) { var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.sanitizeText)(c4TypeParam, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig()); c4Type = sanitizedText; }; var parseDirective = function parseDirective(statement, context, type) { _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type); }; //type, from, to, label, ?techn, ?descr, ?sprite, ?tags, $link var addRel = function addRel(type, from, to, label, techn, descr, sprite, tags, link) { // Don't allow label nulling if (type === undefined || type === null || from === undefined || from === null || to === undefined || to === null || label === undefined || label === null) return; var rel = {}; var old = rels.find(function (rel) { return rel.from === from && rel.to === to; }); if (old) { rel = old; } else { rels.push(rel); } rel.type = type; rel.from = from; rel.to = to; rel.label = { text: label }; if (techn === undefined || techn === null) { rel.techn = { text: '' }; } else { if (_typeof(techn) === 'object') { var _Object$entries$ = _slicedToArray(Object.entries(techn)[0], 2), key = _Object$entries$[0], value = _Object$entries$[1]; rel[key] = { text: value }; } else { rel.techn = { text: techn }; } } if (descr === undefined || descr === null) { rel.descr = { text: '' }; } else { if (_typeof(descr) === 'object') { var _Object$entries$2 = _slicedToArray(Object.entries(descr)[0], 2), _key = _Object$entries$2[0], _value = _Object$entries$2[1]; rel[_key] = { text: _value }; } else { rel.descr = { text: descr }; } } if (_typeof(sprite) === 'object') { var _Object$entries$3 = _slicedToArray(Object.entries(sprite)[0], 2), _key2 = _Object$entries$3[0], _value2 = _Object$entries$3[1]; rel[_key2] = _value2; } else { rel.sprite = sprite; } if (_typeof(tags) === 'object') { var _Object$entries$4 = _slicedToArray(Object.entries(tags)[0], 2), _key3 = _Object$entries$4[0], _value3 = _Object$entries$4[1]; rel[_key3] = _value3; } else { rel.tags = tags; } if (_typeof(link) === 'object') { var _Object$entries$5 = _slicedToArray(Object.entries(link)[0], 2), _key4 = _Object$entries$5[0], _value4 = _Object$entries$5[1]; rel[_key4] = _value4; } else { rel.link = link; } rel.wrap = autoWrap(); }; //type, alias, label, ?descr, ?sprite, ?tags, $link var addPersonOrSystem = function addPersonOrSystem(typeC4Shape, alias, label, descr, sprite, tags, link) { // Don't allow label nulling if (alias === null || label === null) return; var personOrSystem = {}; var old = c4ShapeArray.find(function (personOrSystem) { return personOrSystem.alias === alias; }); if (old && alias === old.alias) { personOrSystem = old; } else { personOrSystem.alias = alias; c4ShapeArray.push(personOrSystem); } // Don't allow null labels, either if (label === undefined || label === null) { personOrSystem.label = { text: '' }; } else { personOrSystem.label = { text: label }; } if (descr === undefined || descr === null) { personOrSystem.descr = { text: '' }; } else { if (_typeof(descr) === 'object') { var _Object$entries$6 = _slicedToArray(Object.entries(descr)[0], 2), key = _Object$entries$6[0], value = _Object$entries$6[1]; personOrSystem[key] = { text: value }; } else { personOrSystem.descr = { text: descr }; } } if (_typeof(sprite) === 'object') { var _Object$entries$7 = _slicedToArray(Object.entries(sprite)[0], 2), _key5 = _Object$entries$7[0], _value5 = _Object$entries$7[1]; personOrSystem[_key5] = _value5; } else { personOrSystem.sprite = sprite; } if (_typeof(tags) === 'object') { var _Object$entries$8 = _slicedToArray(Object.entries(tags)[0], 2), _key6 = _Object$entries$8[0], _value6 = _Object$entries$8[1]; personOrSystem[_key6] = _value6; } else { personOrSystem.tags = tags; } if (_typeof(link) === 'object') { var _Object$entries$9 = _slicedToArray(Object.entries(link)[0], 2), _key7 = _Object$entries$9[0], _value7 = _Object$entries$9[1]; personOrSystem[_key7] = _value7; } else { personOrSystem.link = link; } personOrSystem.typeC4Shape = { text: typeC4Shape }; personOrSystem.parentBoundary = currentBoundaryParse; personOrSystem.wrap = autoWrap(); }; //type, alias, label, ?techn, ?descr ?sprite, ?tags, $link var addContainer = function addContainer(typeC4Shape, alias, label, techn, descr, sprite, tags, link) { // Don't allow label nulling if (alias === null || label === null) return; var container = {}; var old = c4ShapeArray.find(function (container) { return container.alias === alias; }); if (old && alias === old.alias) { container = old; } else { container.alias = alias; c4ShapeArray.push(container); } // Don't allow null labels, either if (label === undefined || label === null) { container.label = { text: '' }; } else { container.label = { text: label }; } if (techn === undefined || techn === null) { container.techn = { text: '' }; } else { if (_typeof(techn) === 'object') { var _Object$entries$10 = _slicedToArray(Object.entries(techn)[0], 2), key = _Object$entries$10[0], value = _Object$entries$10[1]; container[key] = { text: value }; } else { container.techn = { text: techn }; } } if (descr === undefined || descr === null) { container.descr = { text: '' }; } else { if (_typeof(descr) === 'object') { var _Object$entries$11 = _slicedToArray(Object.entries(descr)[0], 2), _key8 = _Object$entries$11[0], _value8 = _Object$entries$11[1]; container[_key8] = { text: _value8 }; } else { container.descr = { text: descr }; } } if (_typeof(sprite) === 'object') { var _Object$entries$12 = _slicedToArray(Object.entries(sprite)[0], 2), _key9 = _Object$entries$12[0], _value9 = _Object$entries$12[1]; container[_key9] = _value9; } else { container.sprite = sprite; } if (_typeof(tags) === 'object') { var _Object$entries$13 = _slicedToArray(Object.entries(tags)[0], 2), _key10 = _Object$entries$13[0], _value10 = _Object$entries$13[1]; container[_key10] = _value10; } else { container.tags = tags; } if (_typeof(link) === 'object') { var _Object$entries$14 = _slicedToArray(Object.entries(link)[0], 2), _key11 = _Object$entries$14[0], _value11 = _Object$entries$14[1]; container[_key11] = _value11; } else { container.link = link; } container.wrap = autoWrap(); container.typeC4Shape = { text: typeC4Shape }; container.parentBoundary = currentBoundaryParse; }; //type, alias, label, ?techn, ?descr ?sprite, ?tags, $link var addComponent = function addComponent(typeC4Shape, alias, label, techn, descr, sprite, tags, link) { // Don't allow label nulling if (alias === null || label === null) return; var component = {}; var old = c4ShapeArray.find(function (component) { return component.alias === alias; }); if (old && alias === old.alias) { component = old; } else { component.alias = alias; c4ShapeArray.push(component); } // Don't allow null labels, either if (label === undefined || label === null) { component.label = { text: '' }; } else { component.label = { text: label }; } if (techn === undefined || techn === null) { component.techn = { text: '' }; } else { if (_typeof(techn) === 'object') { var _Object$entries$15 = _slicedToArray(Object.entries(techn)[0], 2), key = _Object$entries$15[0], value = _Object$entries$15[1]; component[key] = { text: value }; } else { component.techn = { text: techn }; } } if (descr === undefined || descr === null) { component.descr = { text: '' }; } else { if (_typeof(descr) === 'object') { var _Object$entries$16 = _slicedToArray(Object.entries(descr)[0], 2), _key12 = _Object$entries$16[0], _value12 = _Object$entries$16[1]; component[_key12] = { text: _value12 }; } else { component.descr = { text: descr }; } } if (_typeof(sprite) === 'object') { var _Object$entries$17 = _slicedToArray(Object.entries(sprite)[0], 2), _key13 = _Object$entries$17[0], _value13 = _Object$entries$17[1]; component[_key13] = _value13; } else { component.sprite = sprite; } if (_typeof(tags) === 'object') { var _Object$entries$18 = _slicedToArray(Object.entries(tags)[0], 2), _key14 = _Object$entries$18[0], _value14 = _Object$entries$18[1]; component[_key14] = _value14; } else { component.tags = tags; } if (_typeof(link) === 'object') { var _Object$entries$19 = _slicedToArray(Object.entries(link)[0], 2), _key15 = _Object$entries$19[0], _value15 = _Object$entries$19[1]; component[_key15] = _value15; } else { component.link = link; } component.wrap = autoWrap(); component.typeC4Shape = { text: typeC4Shape }; component.parentBoundary = currentBoundaryParse; }; //alias, label, ?type, ?tags, $link var addPersonOrSystemBoundary = function addPersonOrSystemBoundary(alias, label, type, tags, link) { // if (parentBoundary === null) return; // Don't allow label nulling if (alias === null || label === null) return; var boundary = {}; var old = boundarys.find(function (boundary) { return boundary.alias === alias; }); if (old && alias === old.alias) { boundary = old; } else { boundary.alias = alias; boundarys.push(boundary); } // Don't allow null labels, either if (label === undefined || label === null) { boundary.label = { text: '' }; } else { boundary.label = { text: label }; } if (type === undefined || type === null) { boundary.type = { text: 'system' }; } else { if (_typeof(type) === 'object') { var _Object$entries$20 = _slicedToArray(Object.entries(type)[0], 2), key = _Object$entries$20[0], value = _Object$entries$20[1]; boundary[key] = { text: value }; } else { boundary.type = { text: type }; } } if (_typeof(tags) === 'object') { var _Object$entries$21 = _slicedToArray(Object.entries(tags)[0], 2), _key16 = _Object$entries$21[0], _value16 = _Object$entries$21[1]; boundary[_key16] = _value16; } else { boundary.tags = tags; } if (_typeof(link) === 'object') { var _Object$entries$22 = _slicedToArray(Object.entries(link)[0], 2), _key17 = _Object$entries$22[0], _value17 = _Object$entries$22[1]; boundary[_key17] = _value17; } else { boundary.link = link; } boundary.parentBoundary = currentBoundaryParse; boundary.wrap = autoWrap(); parentBoundaryParse = currentBoundaryParse; currentBoundaryParse = alias; boundaryParseStack.push(parentBoundaryParse); }; //alias, label, ?type, ?tags, $link var addContainerBoundary = function addContainerBoundary(alias, label, type, tags, link) { // if (parentBoundary === null) return; // Don't allow label nulling if (alias === null || label === null) return; var boundary = {}; var old = boundarys.find(function (boundary) { return boundary.alias === alias; }); if (old && alias === old.alias) { boundary = old; } else { boundary.alias = alias; boundarys.push(boundary); } // Don't allow null labels, either if (label === undefined || label === null) { boundary.label = { text: '' }; } else { boundary.label = { text: label }; } if (type === undefined || type === null) { boundary.type = { text: 'container' }; } else { if (_typeof(type) === 'object') { var _Object$entries$23 = _slicedToArray(Object.entries(type)[0], 2), key = _Object$entries$23[0], value = _Object$entries$23[1]; boundary[key] = { text: value }; } else { boundary.type = { text: type }; } } if (_typeof(tags) === 'object') { var _Object$entries$24 = _slicedToArray(Object.entries(tags)[0], 2), _key18 = _Object$entries$24[0], _value18 = _Object$entries$24[1]; boundary[_key18] = _value18; } else { boundary.tags = tags; } if (_typeof(link) === 'object') { var _Object$entries$25 = _slicedToArray(Object.entries(link)[0], 2), _key19 = _Object$entries$25[0], _value19 = _Object$entries$25[1]; boundary[_key19] = _value19; } else { boundary.link = link; } boundary.parentBoundary = currentBoundaryParse; boundary.wrap = autoWrap(); parentBoundaryParse = currentBoundaryParse; currentBoundaryParse = alias; boundaryParseStack.push(parentBoundaryParse); }; //alias, label, ?type, ?descr, ?sprite, ?tags, $link var addDeploymentNode = function addDeploymentNode(nodeType, alias, label, type, descr, sprite, tags, link) { // if (parentBoundary === null) return; // Don't allow label nulling if (alias === null || label === null) return; var boundary = {}; var old = boundarys.find(function (boundary) { return boundary.alias === alias; }); if (old && alias === old.alias) { boundary = old; } else { boundary.alias = alias; boundarys.push(boundary); } // Don't allow null labels, either if (label === undefined || label === null) { boundary.label = { text: '' }; } else { boundary.label = { text: label }; } if (type === undefined || type === null) { boundary.type = { text: 'node' }; } else { if (_typeof(type) === 'object') { var _Object$entries$26 = _slicedToArray(Object.entries(type)[0], 2), key = _Object$entries$26[0], value = _Object$entries$26[1]; boundary[key] = { text: value }; } else { boundary.type = { text: type }; } } if (descr === undefined || descr === null) { boundary.descr = { text: '' }; } else { if (_typeof(descr) === 'object') { var _Object$entries$27 = _slicedToArray(Object.entries(descr)[0], 2), _key20 = _Object$entries$27[0], _value20 = _Object$entries$27[1]; boundary[_key20] = { text: _value20 }; } else { boundary.descr = { text: descr }; } } if (_typeof(tags) === 'object') { var _Object$entries$28 = _slicedToArray(Object.entries(tags)[0], 2), _key21 = _Object$entries$28[0], _value21 = _Object$entries$28[1]; boundary[_key21] = _value21; } else { boundary.tags = tags; } if (_typeof(link) === 'object') { var _Object$entries$29 = _slicedToArray(Object.entries(link)[0], 2), _key22 = _Object$entries$29[0], _value22 = _Object$entries$29[1]; boundary[_key22] = _value22; } else { boundary.link = link; } boundary.nodeType = nodeType; boundary.parentBoundary = currentBoundaryParse; boundary.wrap = autoWrap(); parentBoundaryParse = currentBoundaryParse; currentBoundaryParse = alias; boundaryParseStack.push(parentBoundaryParse); }; var popBoundaryParseStack = function popBoundaryParseStack() { currentBoundaryParse = parentBoundaryParse; boundaryParseStack.pop(); parentBoundaryParse = boundaryParseStack.pop(); boundaryParseStack.push(parentBoundaryParse); }; //elementName, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?techn, ?legendText, ?legendSprite var updateElStyle = function updateElStyle(typeC4Shape, elementName, bgColor, fontColor, borderColor, shadowing, shape, sprite, techn, legendText, legendSprite) { var old = c4ShapeArray.find(function (element) { return element.alias === elementName; }); if (old === undefined) { old = boundarys.find(function (element) { return element.alias === elementName; }); if (old === undefined) { return; } } if (bgColor !== undefined && bgColor !== null) { if (_typeof(bgColor) === 'object') { var _Object$entries$30 = _slicedToArray(Object.entries(bgColor)[0], 2), key = _Object$entries$30[0], value = _Object$entries$30[1]; old[key] = value; } else { old.bgColor = bgColor; } } if (fontColor !== undefined && fontColor !== null) { if (_typeof(fontColor) === 'object') { var _Object$entries$31 = _slicedToArray(Object.entries(fontColor)[0], 2), _key23 = _Object$entries$31[0], _value23 = _Object$entries$31[1]; old[_key23] = _value23; } else { old.fontColor = fontColor; } } if (borderColor !== undefined && borderColor !== null) { if (_typeof(borderColor) === 'object') { var _Object$entries$32 = _slicedToArray(Object.entries(borderColor)[0], 2), _key24 = _Object$entries$32[0], _value24 = _Object$entries$32[1]; old[_key24] = _value24; } else { old.borderColor = borderColor; } } if (shadowing !== undefined && shadowing !== null) { if (_typeof(shadowing) === 'object') { var _Object$entries$33 = _slicedToArray(Object.entries(shadowing)[0], 2), _key25 = _Object$entries$33[0], _value25 = _Object$entries$33[1]; old[_key25] = _value25; } else { old.shadowing = shadowing; } } if (shape !== undefined && shape !== null) { if (_typeof(shape) === 'object') { var _Object$entries$34 = _slicedToArray(Object.entries(shape)[0], 2), _key26 = _Object$entries$34[0], _value26 = _Object$entries$34[1]; old[_key26] = _value26; } else { old.shape = shape; } } if (sprite !== undefined && sprite !== null) { if (_typeof(sprite) === 'object') { var _Object$entries$35 = _slicedToArray(Object.entries(sprite)[0], 2), _key27 = _Object$entries$35[0], _value27 = _Object$entries$35[1]; old[_key27] = _value27; } else { old.sprite = sprite; } } if (techn !== undefined && techn !== null) { if (_typeof(techn) === 'object') { var _Object$entries$36 = _slicedToArray(Object.entries(techn)[0], 2), _key28 = _Object$entries$36[0], _value28 = _Object$entries$36[1]; old[_key28] = _value28; } else { old.techn = techn; } } if (legendText !== undefined && legendText !== null) { if (_typeof(legendText) === 'object') { var _Object$entries$37 = _slicedToArray(Object.entries(legendText)[0], 2), _key29 = _Object$entries$37[0], _value29 = _Object$entries$37[1]; old[_key29] = _value29; } else { old.legendText = legendText; } } if (legendSprite !== undefined && legendSprite !== null) { if (_typeof(legendSprite) === 'object') { var _Object$entries$38 = _slicedToArray(Object.entries(legendSprite)[0], 2), _key30 = _Object$entries$38[0], _value30 = _Object$entries$38[1]; old[_key30] = _value30; } else { old.legendSprite = legendSprite; } } }; //textColor, lineColor, ?offsetX, ?offsetY var updateRelStyle = function updateRelStyle(typeC4Shape, from, to, textColor, lineColor, offsetX, offsetY) { var old = rels.find(function (rel) { return rel.from === from && rel.to === to; }); if (old === undefined) { return; } if (textColor !== undefined && textColor !== null) { if (_typeof(textColor) === 'object') { var _Object$entries$39 = _slicedToArray(Object.entries(textColor)[0], 2), key = _Object$entries$39[0], value = _Object$entries$39[1]; old[key] = value; } else { old.textColor = textColor; } } if (lineColor !== undefined && lineColor !== null) { if (_typeof(lineColor) === 'object') { var _Object$entries$40 = _slicedToArray(Object.entries(lineColor)[0], 2), _key31 = _Object$entries$40[0], _value31 = _Object$entries$40[1]; old[_key31] = _value31; } else { old.lineColor = lineColor; } } if (offsetX !== undefined && offsetX !== null) { if (_typeof(offsetX) === 'object') { var _Object$entries$41 = _slicedToArray(Object.entries(offsetX)[0], 2), _key32 = _Object$entries$41[0], _value32 = _Object$entries$41[1]; old[_key32] = parseInt(_value32); } else { old.offsetX = parseInt(offsetX); } } if (offsetY !== undefined && offsetY !== null) { if (_typeof(offsetY) === 'object') { var _Object$entries$42 = _slicedToArray(Object.entries(offsetY)[0], 2), _key33 = _Object$entries$42[0], _value33 = _Object$entries$42[1]; old[_key33] = parseInt(_value33); } else { old.offsetY = parseInt(offsetY); } } }; //?c4ShapeInRow, ?c4BoundaryInRow var updateLayoutConfig = function updateLayoutConfig(typeC4Shape, c4ShapeInRowParam, c4BoundaryInRowParam) { var c4ShapeInRowValue = c4ShapeInRow; var c4BoundaryInRowValue = c4BoundaryInRow; if (_typeof(c4ShapeInRowParam) === 'object') { var _Object$entries$43 = _slicedToArray(Object.entries(c4ShapeInRowParam)[0], 2), key = _Object$entries$43[0], value = _Object$entries$43[1]; c4ShapeInRowValue = parseInt(value); } else { c4ShapeInRowValue = parseInt(c4ShapeInRowParam); } if (_typeof(c4BoundaryInRowParam) === 'object') { var _Object$entries$44 = _slicedToArray(Object.entries(c4BoundaryInRowParam)[0], 2), _key34 = _Object$entries$44[0], _value34 = _Object$entries$44[1]; c4BoundaryInRowValue = parseInt(_value34); } else { c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam); } if (c4ShapeInRowValue >= 1) c4ShapeInRow = c4ShapeInRowValue; if (c4BoundaryInRowValue >= 1) c4BoundaryInRow = c4BoundaryInRowValue; }; var getC4ShapeInRow = function getC4ShapeInRow() { return c4ShapeInRow; }; var getC4BoundaryInRow = function getC4BoundaryInRow() { return c4BoundaryInRow; }; var getCurrentBoundaryParse = function getCurrentBoundaryParse() { return currentBoundaryParse; }; var getParentBoundaryParse = function getParentBoundaryParse() { return parentBoundaryParse; }; var getC4ShapeArray = function getC4ShapeArray(parentBoundary) { if (parentBoundary === undefined || parentBoundary === null) return c4ShapeArray;else return c4ShapeArray.filter(function (personOrSystem) { return personOrSystem.parentBoundary === parentBoundary; }); }; var getC4Shape = function getC4Shape(alias) { return c4ShapeArray.find(function (personOrSystem) { return personOrSystem.alias === alias; }); }; var getC4ShapeKeys = function getC4ShapeKeys(parentBoundary) { return Object.keys(getC4ShapeArray(parentBoundary)); }; var getBoundarys = function getBoundarys(parentBoundary) { if (parentBoundary === undefined || parentBoundary === null) return boundarys;else return boundarys.filter(function (boundary) { return boundary.parentBoundary === parentBoundary; }); }; var getRels = function getRels() { return rels; }; var getTitle = function getTitle() { return title; }; var setWrap = function setWrap(wrapSetting) { wrapEnabled = wrapSetting; }; var autoWrap = function autoWrap() { return wrapEnabled; }; var clear = function clear() { c4ShapeArray = []; boundarys = [{ alias: 'global', label: { text: 'global' }, type: { text: 'global' }, tags: null, link: null, parentBoundary: '' }]; parentBoundaryParse = ''; currentBoundaryParse = 'global'; boundaryParseStack = ['']; rels = []; boundaryParseStack = ['']; title = ''; wrapEnabled = false; description = ''; c4ShapeInRow = 4; c4BoundaryInRow = 2; }; var LINETYPE = { SOLID: 0, DOTTED: 1, NOTE: 2, SOLID_CROSS: 3, DOTTED_CROSS: 4, SOLID_OPEN: 5, DOTTED_OPEN: 6, LOOP_START: 10, LOOP_END: 11, ALT_START: 12, ALT_ELSE: 13, ALT_END: 14, OPT_START: 15, OPT_END: 16, ACTIVE_START: 17, ACTIVE_END: 18, PAR_START: 19, PAR_AND: 20, PAR_END: 21, RECT_START: 22, RECT_END: 23, SOLID_POINT: 24, DOTTED_POINT: 25 }; var ARROWTYPE = { FILLED: 0, OPEN: 1 }; var PLACEMENT = { LEFTOF: 0, RIGHTOF: 1, OVER: 2 }; var setTitle = function setTitle(txt) { var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.sanitizeText)(txt, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig()); title = sanitizedText; }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ addPersonOrSystem: addPersonOrSystem, addPersonOrSystemBoundary: addPersonOrSystemBoundary, addContainer: addContainer, addContainerBoundary: addContainerBoundary, addComponent: addComponent, addDeploymentNode: addDeploymentNode, popBoundaryParseStack: popBoundaryParseStack, addRel: addRel, updateElStyle: updateElStyle, updateRelStyle: updateRelStyle, updateLayoutConfig: updateLayoutConfig, autoWrap: autoWrap, setWrap: setWrap, getC4ShapeArray: getC4ShapeArray, getC4Shape: getC4Shape, getC4ShapeKeys: getC4ShapeKeys, getBoundarys: getBoundarys, getCurrentBoundaryParse: getCurrentBoundaryParse, getParentBoundaryParse: getParentBoundaryParse, getRels: getRels, getTitle: getTitle, getC4Type: getC4Type, getC4ShapeInRow: getC4ShapeInRow, getC4BoundaryInRow: getC4BoundaryInRow, setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_3__.setAccTitle, getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_3__.getAccTitle, getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_3__.getAccDescription, setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_3__.setAccDescription, parseDirective: parseDirective, getConfig: function getConfig() { return _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().c4; }, clear: clear, LINETYPE: LINETYPE, ARROWTYPE: ARROWTYPE, PLACEMENT: PLACEMENT, setTitle: setTitle, setC4Type: setC4Type // apply, }); /***/ }), /***/ "./src/diagrams/c4/c4Renderer.js": /*!***************************************!*\ !*** ./src/diagrams/c4/c4Renderer.js ***! \***************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ "draw": () => (/* binding */ draw), /* harmony export */ "drawBoundary": () => (/* binding */ drawBoundary), /* harmony export */ "drawC4ShapeArray": () => (/* binding */ drawC4ShapeArray), /* harmony export */ "drawRels": () => (/* binding */ drawRels), /* harmony export */ "setConf": () => (/* binding */ setConf) /* harmony export */ }); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); /* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/c4/svgDraw.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../logger */ "./src/logger.js"); /* harmony import */ var _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/c4Diagram */ "./src/diagrams/c4/parser/c4Diagram.jison"); /* harmony import */ var _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js"); /* harmony import */ var _c4Db__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./c4Db */ "./src/diagrams/c4/c4Db.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ "./src/utils.js"); /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js"); function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } var globalBoundaryMaxX = 0, globalBoundaryMaxY = 0; var c4ShapeInRow = 4; var c4BoundaryInRow = 2; _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy = _c4Db__WEBPACK_IMPORTED_MODULE_2__["default"]; var conf = {}; var Bounds = /*#__PURE__*/function () { function Bounds() { _classCallCheck(this, Bounds); this.name = ''; this.data = {}; this.data.startx = undefined; this.data.stopx = undefined; this.data.starty = undefined; this.data.stopy = undefined; this.data.widthLimit = undefined; this.nextData = {}; this.nextData.startx = undefined; this.nextData.stopx = undefined; this.nextData.starty = undefined; this.nextData.stopy = undefined; this.nextData.cnt = 0; setConf(_parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getConfig()); } _createClass(Bounds, [{ key: "setData", value: function setData(startx, stopx, starty, stopy) { this.nextData.startx = this.data.startx = startx; this.nextData.stopx = this.data.stopx = stopx; this.nextData.starty = this.data.starty = starty; this.nextData.stopy = this.data.stopy = stopy; } }, { key: "updateVal", value: function updateVal(obj, key, val, fun) { if (typeof obj[key] === 'undefined') { obj[key] = val; } else { obj[key] = fun(val, obj[key]); } } }, { key: "insert", value: function insert(c4Shape) { this.nextData.cnt = this.nextData.cnt + 1; var _startx = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + c4Shape.margin : this.nextData.stopx + c4Shape.margin * 2; var _stopx = _startx + c4Shape.width; var _starty = this.nextData.starty + c4Shape.margin * 2; var _stopy = _starty + c4Shape.height; if (_startx >= this.data.widthLimit || _stopx >= this.data.widthLimit || this.nextData.cnt > c4ShapeInRow) { _startx = this.nextData.startx + c4Shape.margin + conf.nextLinePaddingX; _starty = this.nextData.stopy + c4Shape.margin * 2; this.nextData.stopx = _stopx = _startx + c4Shape.width; this.nextData.starty = this.nextData.stopy; this.nextData.stopy = _stopy = _starty + c4Shape.height; this.nextData.cnt = 1; } c4Shape.x = _startx; c4Shape.y = _starty; this.updateVal(this.data, 'startx', _startx, Math.min); this.updateVal(this.data, 'starty', _starty, Math.min); this.updateVal(this.data, 'stopx', _stopx, Math.max); this.updateVal(this.data, 'stopy', _stopy, Math.max); this.updateVal(this.nextData, 'startx', _startx, Math.min); this.updateVal(this.nextData, 'starty', _starty, Math.min); this.updateVal(this.nextData, 'stopx', _stopx, Math.max); this.updateVal(this.nextData, 'stopy', _stopy, Math.max); } }, { key: "init", value: function init() { this.name = ''; this.data = { startx: undefined, stopx: undefined, starty: undefined, stopy: undefined, widthLimit: undefined }; this.nextData = { startx: undefined, stopx: undefined, starty: undefined, stopy: undefined, cnt: 0 }; setConf(_parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getConfig()); } }, { key: "bumpLastMargin", value: function bumpLastMargin(margin) { this.data.stopx += margin; this.data.stopy += margin; } }]); return Bounds; }(); var setConf = function setConf(cnf) { (0,_utils__WEBPACK_IMPORTED_MODULE_3__.assignWithDepth)(conf, cnf); if (cnf.fontFamily) { conf.personFontFamily = conf.systemFontFamily = conf.messageFontFamily = cnf.fontFamily; } if (cnf.fontSize) { conf.personFontSize = conf.systemFontSize = conf.messageFontSize = cnf.fontSize; } if (cnf.fontWeight) { conf.personFontWeight = conf.systemFontWeight = conf.messageFontWeight = cnf.fontWeight; } }; var c4ShapeFont = function c4ShapeFont(cnf, typeC4Shape) { return { fontFamily: cnf[typeC4Shape + 'FontFamily'], fontSize: cnf[typeC4Shape + 'FontSize'], fontWeight: cnf[typeC4Shape + 'FontWeight'] }; }; var boundaryFont = function boundaryFont(cnf) { return { fontFamily: cnf.boundaryFontFamily, fontSize: cnf.boundaryFontSize, fontWeight: cnf.boundaryFontWeight }; }; var messageFont = function messageFont(cnf) { return { fontFamily: cnf.messageFontFamily, fontSize: cnf.messageFontSize, fontWeight: cnf.messageFontWeight }; }; /** * @param textType * @param c4Shape * @param c4ShapeTextWrap * @param textConf * @param textLimitWidth */ function calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLimitWidth) { if (!c4Shape[textType].width) { if (c4ShapeTextWrap) { c4Shape[textType].text = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.wrapLabel)(c4Shape[textType].text, textLimitWidth, textConf); c4Shape[textType].textLines = c4Shape[textType].text.split(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex).length; // c4Shape[textType].width = calculateTextWidth(c4Shape[textType].text, textConf); c4Shape[textType].width = textLimitWidth; // c4Shape[textType].height = c4Shape[textType].textLines * textConf.fontSize; c4Shape[textType].height = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.calculateTextHeight)(c4Shape[textType].text, textConf); } else { var lines = c4Shape[textType].text.split(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex); c4Shape[textType].textLines = lines.length; var lineHeight = 0; c4Shape[textType].height = 0; c4Shape[textType].width = 0; for (var i = 0; i < lines.length; i++) { c4Shape[textType].width = Math.max((0,_utils__WEBPACK_IMPORTED_MODULE_3__.calculateTextWidth)(lines[i], textConf), c4Shape[textType].width); lineHeight = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.calculateTextHeight)(lines[i], textConf); c4Shape[textType].height = c4Shape[textType].height + lineHeight; } // c4Shapes[textType].height = c4Shapes[textType].textLines * textConf.fontSize; } } } var drawBoundary = function drawBoundary(diagram, boundary, bounds) { boundary.x = bounds.data.startx; boundary.y = bounds.data.starty; boundary.width = bounds.data.stopx - bounds.data.startx; boundary.height = bounds.data.stopy - bounds.data.starty; boundary.label.y = conf.c4ShapeMargin - 35; var boundaryTextWrap = boundary.wrap && conf.wrap; var boundaryLabelConf = boundaryFont(conf); boundaryLabelConf.fontSize = boundaryLabelConf.fontSize + 2; boundaryLabelConf.fontWeight = 'bold'; var textLimitWidth = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.calculateTextWidth)(boundary.label.text, boundaryLabelConf); calcC4ShapeTextWH('label', boundary, boundaryTextWrap, boundaryLabelConf, textLimitWidth); _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].drawBoundary(diagram, boundary, conf); }; var drawC4ShapeArray = function drawC4ShapeArray(currentBounds, diagram, c4ShapeArray, c4ShapeKeys) { // Upper Y is relative point var Y = 0; // Draw the c4ShapeArray for (var i = 0; i < c4ShapeKeys.length; i++) { Y = 0; var c4Shape = c4ShapeArray[c4ShapeKeys[i]]; // calc c4 shape type width and height var c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); c4ShapeTypeConf.fontSize = c4ShapeTypeConf.fontSize - 2; c4Shape.typeC4Shape.width = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.calculateTextWidth)('<<' + c4Shape.typeC4Shape.text + '>>', c4ShapeTypeConf); c4Shape.typeC4Shape.height = c4ShapeTypeConf.fontSize + 2; c4Shape.typeC4Shape.Y = conf.c4ShapePadding; Y = c4Shape.typeC4Shape.Y + c4Shape.typeC4Shape.height - 4; // set image width and height c4Shape.x + c4Shape.width / 2 - 24, c4Shape.y + 28 // let imageWidth = 0, // imageHeight = 0, // imageY = 0; // c4Shape.image = { width: 0, height: 0, Y: 0 }; switch (c4Shape.typeC4Shape.text) { case 'person': case 'external_person': c4Shape.image.width = 48; c4Shape.image.height = 48; c4Shape.image.Y = Y; Y = c4Shape.image.Y + c4Shape.image.height; break; } if (c4Shape.sprite) { c4Shape.image.width = 48; c4Shape.image.height = 48; c4Shape.image.Y = Y; Y = c4Shape.image.Y + c4Shape.image.height; } // Y = conf.c4ShapePadding + c4Shape.image.height; var c4ShapeTextWrap = c4Shape.wrap && conf.wrap; var textLimitWidth = conf.width - conf.c4ShapePadding * 2; var c4ShapeLabelConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); c4ShapeLabelConf.fontSize = c4ShapeLabelConf.fontSize + 2; c4ShapeLabelConf.fontWeight = 'bold'; calcC4ShapeTextWH('label', c4Shape, c4ShapeTextWrap, c4ShapeLabelConf, textLimitWidth); c4Shape['label'].Y = Y + 8; Y = c4Shape['label'].Y + c4Shape['label'].height; if (c4Shape.type && c4Shape.type.text !== '') { c4Shape.type.text = '[' + c4Shape.type.text + ']'; var _c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); calcC4ShapeTextWH('type', c4Shape, c4ShapeTextWrap, _c4ShapeTypeConf, textLimitWidth); c4Shape['type'].Y = Y + 5; Y = c4Shape['type'].Y + c4Shape['type'].height; } else if (c4Shape.techn && c4Shape.techn.text !== '') { c4Shape.techn.text = '[' + c4Shape.techn.text + ']'; var c4ShapeTechnConf = c4ShapeFont(conf, c4Shape.techn.text); calcC4ShapeTextWH('techn', c4Shape, c4ShapeTextWrap, c4ShapeTechnConf, textLimitWidth); c4Shape['techn'].Y = Y + 5; Y = c4Shape['techn'].Y + c4Shape['techn'].height; } var rectHeight = Y; var rectWidth = c4Shape.label.width; if (c4Shape.descr && c4Shape.descr.text !== '') { var c4ShapeDescrConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); calcC4ShapeTextWH('descr', c4Shape, c4ShapeTextWrap, c4ShapeDescrConf, textLimitWidth); c4Shape['descr'].Y = Y + 20; Y = c4Shape['descr'].Y + c4Shape['descr'].height; rectWidth = Math.max(c4Shape.label.width, c4Shape.descr.width); rectHeight = Y - c4Shape['descr'].textLines * 5; } rectWidth = rectWidth + conf.c4ShapePadding; // let rectHeight = c4Shape.width = Math.max(c4Shape.width || conf.width, rectWidth, conf.width); c4Shape.height = Math.max(c4Shape.height || conf.height, rectHeight, conf.height); c4Shape.margin = c4Shape.margin || conf.c4ShapeMargin; currentBounds.insert(c4Shape); var height = _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].drawC4Shape(diagram, c4Shape, conf); } currentBounds.bumpLastMargin(conf.c4ShapeMargin); }; var Point = /*#__PURE__*/_createClass(function Point(x, y) { _classCallCheck(this, Point); this.x = x; this.y = y; }); /* * * * Get the intersection of the line between the center point of a rectangle and a point outside the rectangle. * Algorithm idea. * Using a point outside the rectangle as the coordinate origin, the graph is divided into four quadrants, and each quadrant is divided into two cases, with separate treatment on the coordinate axes * 1. The case of coordinate axes. * 1. The case of the negative x-axis * 2. The case of the positive x-axis * 3. The case of the positive y-axis * 4. The negative y-axis case * 2. Quadrant cases. * 2.1. first quadrant: the case where the line intersects the left side of the rectangle; the case where it intersects the lower side of the rectangle * 2.2. second quadrant: the case where the line intersects the right side of the rectangle; the case where it intersects the lower edge of the rectangle * 2.3. third quadrant: the case where the line intersects the right side of the rectangle; the case where it intersects the upper edge of the rectangle * 2.4. fourth quadrant: the case where the line intersects the left side of the rectangle; the case where it intersects the upper side of the rectangle * */ var getIntersectPoint = function getIntersectPoint(fromNode, endPoint) { var x1 = fromNode.x; var y1 = fromNode.y; var x2 = endPoint.x; var y2 = endPoint.y; var fromCenterX = x1 + fromNode.width / 2; var fromCenterY = y1 + fromNode.height / 2; var dx = Math.abs(x1 - x2); var dy = Math.abs(y1 - y2); var tanDYX = dy / dx; var fromDYX = fromNode.height / fromNode.width; var returnPoint = null; if (y1 == y2 && x1 < x2) { returnPoint = new Point(x1 + fromNode.width, fromCenterY); } else if (y1 == y2 && x1 > x2) { returnPoint = new Point(x1, fromCenterY); } else if (x1 == x2 && y1 < y2) { returnPoint = new Point(fromCenterX, y1 + fromNode.height); } else if (x1 == x2 && y1 > y2) { returnPoint = new Point(fromCenterX, y1); } if (x1 > x2 && y1 < y2) { if (fromDYX >= tanDYX) { returnPoint = new Point(x1, fromCenterY + tanDYX * fromNode.width / 2); } else { returnPoint = new Point(fromCenterX - dx / dy * fromNode.height / 2, y1 + fromNode.height); } } else if (x1 < x2 && y1 < y2) { // if (fromDYX >= tanDYX) { returnPoint = new Point(x1 + fromNode.width, fromCenterY + tanDYX * fromNode.width / 2); } else { returnPoint = new Point(fromCenterX + dx / dy * fromNode.height / 2, y1 + fromNode.height); } } else if (x1 < x2 && y1 > y2) { if (fromDYX >= tanDYX) { returnPoint = new Point(x1 + fromNode.width, fromCenterY - tanDYX * fromNode.width / 2); } else { returnPoint = new Point(fromCenterX + fromNode.height / 2 * dx / dy, y1); } } else if (x1 > x2 && y1 > y2) { if (fromDYX >= tanDYX) { returnPoint = new Point(x1, fromCenterY - fromNode.width / 2 * tanDYX); } else { returnPoint = new Point(fromCenterX - fromNode.height / 2 * dx / dy, y1); } } return returnPoint; }; var getIntersectPoints = function getIntersectPoints(fromNode, endNode) { var endIntersectPoint = { x: 0, y: 0 }; endIntersectPoint.x = endNode.x + endNode.width / 2; endIntersectPoint.y = endNode.y + endNode.height / 2; var startPoint = getIntersectPoint(fromNode, endIntersectPoint); endIntersectPoint.x = fromNode.x + fromNode.width / 2; endIntersectPoint.y = fromNode.y + fromNode.height / 2; var endPoint = getIntersectPoint(endNode, endIntersectPoint); return { startPoint: startPoint, endPoint: endPoint }; }; var drawRels = function drawRels(diagram, rels, getC4ShapeObj) { var i = 0; var _iterator = _createForOfIteratorHelper(rels), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var rel = _step.value; i = i + 1; var relTextWrap = rel.wrap && conf.wrap; var relConf = messageFont(conf); var diagramType = _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getC4Type(); if (diagramType === 'C4Dynamic') rel.label.text = i + ': ' + rel.label.text; var textLimitWidth = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.calculateTextWidth)(rel.label.text, relConf); calcC4ShapeTextWH('label', rel, relTextWrap, relConf, textLimitWidth); if (rel.techn && rel.techn.text !== '') { textLimitWidth = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.calculateTextWidth)(rel.techn.text, relConf); calcC4ShapeTextWH('techn', rel, relTextWrap, relConf, textLimitWidth); } if (rel.descr && rel.descr.text !== '') { textLimitWidth = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.calculateTextWidth)(rel.descr.text, relConf); calcC4ShapeTextWH('descr', rel, relTextWrap, relConf, textLimitWidth); } var fromNode = getC4ShapeObj(rel.from); var endNode = getC4ShapeObj(rel.to); var points = getIntersectPoints(fromNode, endNode); rel.startPoint = points.startPoint; rel.endPoint = points.endPoint; } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].drawRels(diagram, rels, conf); }; /** * @param diagram * @param parentBoundaryAlias * @param parentBounds * @param currentBoundarys */ function drawInsideBoundary(diagram, parentBoundaryAlias, parentBounds, currentBoundarys) { var currentBounds = new Bounds(); // Calculate the width limit of the boundar. label/type 的长度, currentBounds.data.widthLimit = parentBounds.data.widthLimit / Math.min(c4BoundaryInRow, currentBoundarys.length); // Math.min( // conf.width * conf.c4ShapeInRow + conf.c4ShapeMargin * conf.c4ShapeInRow * 2, // parentBounds.data.widthLimit / Math.min(conf.c4BoundaryInRow, currentBoundarys.length) // ); for (var i = 0; i < currentBoundarys.length; i++) { var currentBoundary = currentBoundarys[i]; var Y = 0; currentBoundary.image = { width: 0, height: 0, Y: 0 }; if (currentBoundary.sprite) { currentBoundary.image.width = 48; currentBoundary.image.height = 48; currentBoundary.image.Y = Y; Y = currentBoundary.image.Y + currentBoundary.image.height; } var currentBoundaryTextWrap = currentBoundary.wrap && conf.wrap; var currentBoundaryLabelConf = boundaryFont(conf); currentBoundaryLabelConf.fontSize = currentBoundaryLabelConf.fontSize + 2; currentBoundaryLabelConf.fontWeight = 'bold'; calcC4ShapeTextWH('label', currentBoundary, currentBoundaryTextWrap, currentBoundaryLabelConf, currentBounds.data.widthLimit); currentBoundary['label'].Y = Y + 8; Y = currentBoundary['label'].Y + currentBoundary['label'].height; if (currentBoundary.type && currentBoundary.type.text !== '') { currentBoundary.type.text = '[' + currentBoundary.type.text + ']'; var currentBoundaryTypeConf = boundaryFont(conf); calcC4ShapeTextWH('type', currentBoundary, currentBoundaryTextWrap, currentBoundaryTypeConf, currentBounds.data.widthLimit); currentBoundary['type'].Y = Y + 5; Y = currentBoundary['type'].Y + currentBoundary['type'].height; } if (currentBoundary.descr && currentBoundary.descr.text !== '') { var currentBoundaryDescrConf = boundaryFont(conf); currentBoundaryDescrConf.fontSize = currentBoundaryDescrConf.fontSize - 2; calcC4ShapeTextWH('descr', currentBoundary, currentBoundaryTextWrap, currentBoundaryDescrConf, currentBounds.data.widthLimit); currentBoundary['descr'].Y = Y + 20; Y = currentBoundary['descr'].Y + currentBoundary['descr'].height; } if (i == 0 || i % c4BoundaryInRow === 0) { // Calculate the drawing start point of the currentBoundarys. var _x = parentBounds.data.startx + conf.diagramMarginX; var _y = parentBounds.data.stopy + conf.diagramMarginY + Y; currentBounds.setData(_x, _x, _y, _y); } else { // Calculate the drawing start point of the currentBoundarys. var _x2 = currentBounds.data.stopx !== currentBounds.data.startx ? currentBounds.data.stopx + conf.diagramMarginX : currentBounds.data.startx; var _y2 = currentBounds.data.starty; currentBounds.setData(_x2, _x2, _y2, _y2); } currentBounds.name = currentBoundary.alias; var currentPersonOrSystemArray = _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getC4ShapeArray(currentBoundary.alias); var currentPersonOrSystemKeys = _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getC4ShapeKeys(currentBoundary.alias); if (currentPersonOrSystemKeys.length > 0) { drawC4ShapeArray(currentBounds, diagram, currentPersonOrSystemArray, currentPersonOrSystemKeys); } parentBoundaryAlias = currentBoundary.alias; var nextCurrentBoundarys = _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getBoundarys(parentBoundaryAlias); if (nextCurrentBoundarys.length > 0) { // draw boundary inside currentBoundary // bounds.init(); // parentBoundaryWidthLimit = bounds.data.stopx - bounds.startx; drawInsideBoundary(diagram, parentBoundaryAlias, currentBounds, nextCurrentBoundarys); } // draw boundary if (currentBoundary.alias !== 'global') drawBoundary(diagram, currentBoundary, currentBounds); parentBounds.data.stopy = Math.max(currentBounds.data.stopy + conf.c4ShapeMargin, parentBounds.data.stopy); parentBounds.data.stopx = Math.max(currentBounds.data.stopx + conf.c4ShapeMargin, parentBounds.data.stopx); globalBoundaryMaxX = Math.max(globalBoundaryMaxX, parentBounds.data.stopx); globalBoundaryMaxY = Math.max(globalBoundaryMaxY, parentBounds.data.stopy); } } /** * Draws a sequenceDiagram in the tag with id: id based on the graph definition in text. * * @param {any} text * @param {any} id */ var draw = function draw(text, id) { conf = _config__WEBPACK_IMPORTED_MODULE_6__.getConfig().c4; var securityLevel = _config__WEBPACK_IMPORTED_MODULE_6__.getConfig().securityLevel; // Handle root and Document for when rendering in sanbox mode var sandboxElement; if (securityLevel === 'sandbox') { sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id); } var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body'); var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; var db = _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy; _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.clear(); _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.setWrap(conf.wrap); _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.parse(text + '\n'); c4ShapeInRow = db.getC4ShapeInRow(); c4BoundaryInRow = db.getC4BoundaryInRow(); _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug("C:".concat(JSON.stringify(conf, null, 2))); var diagram = securityLevel === 'sandbox' ? root.select("[id=\"".concat(id, "\"]")) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]")); _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].insertComputerIcon(diagram); _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].insertDatabaseIcon(diagram); _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].insertClockIcon(diagram); var screenBounds = new Bounds(); screenBounds.setData(conf.diagramMarginX, conf.diagramMarginX, conf.diagramMarginY, conf.diagramMarginY); screenBounds.data.widthLimit = screen.availWidth; globalBoundaryMaxX = conf.diagramMarginX; globalBoundaryMaxY = conf.diagramMarginY; var title = _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getTitle(); var c4type = _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getC4Type(); var currentBoundarys = _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getBoundarys(''); // switch (c4type) { // case 'C4Context': drawInsideBoundary(diagram, '', screenBounds, currentBoundarys); // break; // } // The arrow head definition is attached to the svg once _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].insertArrowHead(diagram); _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].insertArrowEnd(diagram); _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].insertArrowCrossHead(diagram); _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].insertArrowFilledHead(diagram); drawRels(diagram, _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getRels(), _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getC4Shape); screenBounds.data.stopx = globalBoundaryMaxX; screenBounds.data.stopy = globalBoundaryMaxY; var box = screenBounds.data; // Make sure the height of the diagram supports long menus. var boxHeight = box.stopy - box.starty; var height = boxHeight + 2 * conf.diagramMarginY; // Make sure the width of the diagram supports wide menus. var boxWidth = box.stopx - box.startx; var width = boxWidth + 2 * conf.diagramMarginX; if (title) { diagram.append('text').text(title).attr('x', (box.stopx - box.startx) / 2 - 4 * conf.diagramMarginX).attr('y', box.starty + conf.diagramMarginY); } (0,_utils__WEBPACK_IMPORTED_MODULE_3__.configureSvgSize)(diagram, height, width, conf.useMaxWidth); var extraVertForTitle = title ? 60 : 0; diagram.attr('viewBox', box.startx - conf.diagramMarginX + ' -' + (conf.diagramMarginY + extraVertForTitle) + ' ' + width + ' ' + (height + extraVertForTitle)); (0,_accessibility__WEBPACK_IMPORTED_MODULE_8__["default"])(_parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy, diagram, id); _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug("models:", box); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ drawPersonOrSystemArray: drawC4ShapeArray, drawBoundary: drawBoundary, setConf: setConf, draw: draw }); /***/ }), /***/ "./src/diagrams/c4/styles.js": /*!***********************************!*\ !*** ./src/diagrams/c4/styles.js ***! \***********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); var getStyles = function getStyles(options) { return ".person {\n stroke: ".concat(options.personBorder, ";\n fill: ").concat(options.personBkg, ";\n }\n"); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles); /***/ }), /***/ "./src/diagrams/c4/svgDraw.js": /*!************************************!*\ !*** ./src/diagrams/c4/svgDraw.js ***! \************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ "drawC4Shape": () => (/* binding */ drawC4Shape), /* harmony export */ "drawEmbeddedImage": () => (/* binding */ drawEmbeddedImage), /* harmony export */ "drawImage": () => (/* binding */ drawImage), /* harmony export */ "drawLabel": () => (/* binding */ drawLabel), /* harmony export */ "drawRect": () => (/* binding */ drawRect), /* harmony export */ "drawRels": () => (/* binding */ drawRels), /* harmony export */ "drawText": () => (/* binding */ drawText), /* harmony export */ "getNoteRect": () => (/* binding */ getNoteRect), /* harmony export */ "getTextObj": () => (/* binding */ getTextObj), /* harmony export */ "insertArrowCrossHead": () => (/* binding */ insertArrowCrossHead), /* harmony export */ "insertArrowEnd": () => (/* binding */ insertArrowEnd), /* harmony export */ "insertArrowFilledHead": () => (/* binding */ insertArrowFilledHead), /* harmony export */ "insertArrowHead": () => (/* binding */ insertArrowHead), /* harmony export */ "insertClockIcon": () => (/* binding */ insertClockIcon), /* harmony export */ "insertComputerIcon": () => (/* binding */ insertComputerIcon), /* harmony export */ "insertDatabaseIcon": () => (/* binding */ insertDatabaseIcon), /* harmony export */ "insertDynamicNumber": () => (/* binding */ insertDynamicNumber) /* harmony export */ }); /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js"); /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @braintree/sanitize-url */ "./node_modules/@braintree/sanitize-url/dist/index.js"); function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var drawRect = function drawRect(elem, rectData) { var rectElem = elem.append('rect'); rectElem.attr('x', rectData.x); rectElem.attr('y', rectData.y); rectElem.attr('fill', rectData.fill); rectElem.attr('stroke', rectData.stroke); rectElem.attr('width', rectData.width); rectElem.attr('height', rectData.height); rectElem.attr('rx', rectData.rx); rectElem.attr('ry', rectData.ry); if (rectData.attrs !== 'undefined' && rectData.attrs !== null) { for (var attrKey in rectData.attrs) { rectElem.attr(attrKey, rectData.attrs[attrKey]); } } if (rectData.class !== 'undefined') { rectElem.attr('class', rectData.class); } return rectElem; }; var drawImage = function drawImage(elem, width, height, x, y, link) { var imageElem = elem.append('image'); imageElem.attr('width', width); imageElem.attr('height', height); imageElem.attr('x', x); imageElem.attr('y', y); var sanitizedLink = link.startsWith('data:image/png;base64') ? link : (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl)(link); imageElem.attr('xlink:href', sanitizedLink); }; var drawEmbeddedImage = function drawEmbeddedImage(elem, x, y, link) { var imageElem = elem.append('use'); imageElem.attr('x', x); imageElem.attr('y', y); var sanitizedLink = (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl)(link); imageElem.attr('xlink:href', '#' + sanitizedLink); }; var drawText = function drawText(elem, textData) { var prevTextHeight = 0, textHeight = 0; var lines = textData.text.split(_common_common__WEBPACK_IMPORTED_MODULE_1__["default"].lineBreakRegex); var textElems = []; var dy = 0; var yfunc = function yfunc() { return textData.y; }; if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) { switch (textData.valign) { case 'top': case 'start': yfunc = function yfunc() { return Math.round(textData.y + textData.textMargin); }; break; case 'middle': case 'center': yfunc = function yfunc() { return Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2); }; break; case 'bottom': case 'end': yfunc = function yfunc() { return Math.round(textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin); }; break; } } if (typeof textData.anchor !== 'undefined' && typeof textData.textMargin !== 'undefined' && typeof textData.width !== 'undefined') { switch (textData.anchor) { case 'left': case 'start': textData.x = Math.round(textData.x + textData.textMargin); textData.anchor = 'start'; textData.dominantBaseline = 'text-after-edge'; textData.alignmentBaseline = 'middle'; break; case 'middle': case 'center': textData.x = Math.round(textData.x + textData.width / 2); textData.anchor = 'middle'; textData.dominantBaseline = 'middle'; textData.alignmentBaseline = 'middle'; break; case 'right': case 'end': textData.x = Math.round(textData.x + textData.width - textData.textMargin); textData.anchor = 'end'; textData.dominantBaseline = 'text-before-edge'; textData.alignmentBaseline = 'middle'; break; } } for (var i = 0; i < lines.length; i++) { var line = lines[i]; if (typeof textData.textMargin !== 'undefined' && textData.textMargin === 0 && typeof textData.fontSize !== 'undefined') { dy = i * textData.fontSize; } var textElem = elem.append('text'); textElem.attr('x', textData.x); textElem.attr('y', yfunc()); if (typeof textData.anchor !== 'undefined') { textElem.attr('text-anchor', textData.anchor).attr('dominant-baseline', textData.dominantBaseline).attr('alignment-baseline', textData.alignmentBaseline); } if (typeof textData.fontFamily !== 'undefined') { textElem.style('font-family', textData.fontFamily); } if (typeof textData.fontSize !== 'undefined') { textElem.style('font-size', textData.fontSize); } if (typeof textData.fontWeight !== 'undefined') { textElem.style('font-weight', textData.fontWeight); } if (typeof textData.fill !== 'undefined') { textElem.attr('fill', textData.fill); } if (typeof textData.class !== 'undefined') { textElem.attr('class', textData.class); } if (typeof textData.dy !== 'undefined') { textElem.attr('dy', textData.dy); } else if (dy !== 0) { textElem.attr('dy', dy); } if (textData.tspan) { var span = textElem.append('tspan'); span.attr('x', textData.x); if (typeof textData.fill !== 'undefined') { span.attr('fill', textData.fill); } span.text(line); } else { textElem.text(line); } if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) { textHeight += (textElem._groups || textElem)[0][0].getBBox().height; prevTextHeight = textHeight; } textElems.push(textElem); } return textElems; }; var drawLabel = function drawLabel(elem, txtObject) { /** * @param {any} x * @param {any} y * @param {any} width * @param {any} height * @param {any} cut * @returns {any} */ function genPoints(x, y, width, height, cut) { return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height); } var polygon = elem.append('polygon'); polygon.attr('points', genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7)); polygon.attr('class', 'labelBox'); txtObject.y = txtObject.y + txtObject.height / 2; drawText(elem, txtObject); return polygon; }; var drawRels = function drawRels(elem, rels, conf) { var relsElem = elem.append('g'); var i = 0; var _iterator = _createForOfIteratorHelper(rels), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var rel = _step.value; var textColor = rel.textColor ? rel.textColor : '#444444'; var strokeColor = rel.lineColor ? rel.lineColor : '#444444'; var offsetX = rel.offsetX ? parseInt(rel.offsetX) : 0; var offsetY = rel.offsetY ? parseInt(rel.offsetY) : 0; var url = ''; if (i === 0) { var line = relsElem.append('line'); line.attr('x1', rel.startPoint.x); line.attr('y1', rel.startPoint.y); line.attr('x2', rel.endPoint.x); line.attr('y2', rel.endPoint.y); line.attr('stroke-width', '1'); line.attr('stroke', strokeColor); line.style('fill', 'none'); if (rel.type !== 'rel_b') line.attr('marker-end', 'url(' + url + '#arrowhead)'); if (rel.type === 'birel' || rel.type === 'rel_b') line.attr('marker-start', 'url(' + url + '#arrowend)'); i = -1; } else { var _line = relsElem.append('path'); _line.attr('fill', 'none').attr('stroke-width', '1').attr('stroke', strokeColor).attr('d', 'Mstartx,starty Qcontrolx,controly stopx,stopy '.replaceAll('startx', rel.startPoint.x).replaceAll('starty', rel.startPoint.y).replaceAll('controlx', rel.startPoint.x + (rel.endPoint.x - rel.startPoint.x) / 2 - (rel.endPoint.x - rel.startPoint.x) / 4).replaceAll('controly', rel.startPoint.y + (rel.endPoint.y - rel.startPoint.y) / 2).replaceAll('stopx', rel.endPoint.x).replaceAll('stopy', rel.endPoint.y)); if (rel.type !== 'rel_b') _line.attr('marker-end', 'url(' + url + '#arrowhead)'); if (rel.type === 'birel' || rel.type === 'rel_b') _line.attr('marker-start', 'url(' + url + '#arrowend)'); } var messageConf = conf.messageFont(); _drawTextCandidateFunc(conf)(rel.label.text, relsElem, Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX, Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + offsetY, rel.label.width, rel.label.height, { fill: textColor }, messageConf); if (rel.techn && rel.techn.text !== '') { messageConf = conf.messageFont(); _drawTextCandidateFunc(conf)('[' + rel.techn.text + ']', relsElem, Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX, Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + conf.messageFontSize + 5 + offsetY, Math.max(rel.label.width, rel.techn.width), rel.techn.height, { fill: textColor, 'font-style': 'italic' }, messageConf); } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } }; /** * Draws an boundary in the diagram * * @param {any} elem - The diagram we'll draw to. * @param {any} boundary - The boundary to draw. * @param {any} conf - DrawText implementation discriminator object */ var drawBoundary = function drawBoundary(elem, boundary, conf) { var boundaryElem = elem.append('g'); var fillColor = boundary.bgColor ? boundary.bgColor : 'none'; var strokeColor = boundary.borderColor ? boundary.borderColor : '#444444'; var fontColor = boundary.fontColor ? boundary.fontColor : 'black'; var attrsValue = { 'stroke-width': 1.0, 'stroke-dasharray': '7.0,7.0' }; if (boundary.nodeType) attrsValue = { 'stroke-width': 1.0 }; var rectData = { x: boundary.x, y: boundary.y, fill: fillColor, stroke: strokeColor, width: boundary.width, height: boundary.height, rx: 2.5, ry: 2.5, attrs: attrsValue }; drawRect(boundaryElem, rectData); // draw label var boundaryConf = conf.boundaryFont(); boundaryConf.fontWeight = 'bold'; boundaryConf.fontSize = boundaryConf.fontSize + 2; boundaryConf.fontColor = fontColor; _drawTextCandidateFunc(conf)(boundary.label.text, boundaryElem, boundary.x, boundary.y + boundary.label.Y, boundary.width, boundary.height, { fill: '#444444' }, boundaryConf); // draw type if (boundary.type && boundary.type.text !== '') { boundaryConf = conf.boundaryFont(); boundaryConf.fontColor = fontColor; _drawTextCandidateFunc(conf)(boundary.type.text, boundaryElem, boundary.x, boundary.y + boundary.type.Y, boundary.width, boundary.height, { fill: '#444444' }, boundaryConf); } // draw descr if (boundary.descr && boundary.descr.text !== '') { boundaryConf = conf.boundaryFont(); boundaryConf.fontSize = boundaryConf.fontSize - 2; boundaryConf.fontColor = fontColor; _drawTextCandidateFunc(conf)(boundary.descr.text, boundaryElem, boundary.x, boundary.y + boundary.descr.Y, boundary.width, boundary.height, { fill: '#444444' }, boundaryConf); } }; var drawC4Shape = function drawC4Shape(elem, c4Shape, conf) { var fillColor = c4Shape.bgColor ? c4Shape.bgColor : conf[c4Shape.typeC4Shape.text + '_bg_color']; var strokeColor = c4Shape.borderColor ? c4Shape.borderColor : conf[c4Shape.typeC4Shape.text + '_border_color']; var fontColor = c4Shape.fontColor ? c4Shape.fontColor : '#FFFFFF'; var personImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII='; switch (c4Shape.typeC4Shape.text) { case 'person': personImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII='; break; case 'external_person': personImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII='; break; } var c4ShapeElem = elem.append('g'); c4ShapeElem.attr('class', 'person-man'); // // draw rect of c4Shape var rect = getNoteRect(); switch (c4Shape.typeC4Shape.text) { case 'person': case 'external_person': case 'system': case 'external_system': case 'container': case 'external_container': case 'component': case 'external_component': rect.x = c4Shape.x; rect.y = c4Shape.y; rect.fill = fillColor; rect.width = c4Shape.width; rect.height = c4Shape.height; rect.style = 'stroke:' + strokeColor + ';stroke-width:0.5;'; rect.rx = 2.5; rect.ry = 2.5; drawRect(c4ShapeElem, rect); break; case 'system_db': case 'external_system_db': case 'container_db': case 'external_container_db': case 'component_db': case 'external_component_db': c4ShapeElem.append('path').attr('fill', fillColor).attr('stroke-width', '0.5').attr('stroke', strokeColor).attr('d', 'Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height'.replaceAll('startx', c4Shape.x).replaceAll('starty', c4Shape.y).replaceAll('half', c4Shape.width / 2).replaceAll('height', c4Shape.height)); c4ShapeElem.append('path').attr('fill', 'none').attr('stroke-width', '0.5').attr('stroke', strokeColor).attr('d', 'Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10'.replaceAll('startx', c4Shape.x).replaceAll('starty', c4Shape.y).replaceAll('half', c4Shape.width / 2)); break; case 'system_queue': case 'external_system_queue': case 'container_queue': case 'external_container_queue': case 'component_queue': case 'external_component_queue': c4ShapeElem.append('path').attr('fill', fillColor).attr('stroke-width', '0.5').attr('stroke', strokeColor).attr('d', 'Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half'.replaceAll('startx', c4Shape.x).replaceAll('starty', c4Shape.y).replaceAll('width', c4Shape.width).replaceAll('half', c4Shape.height / 2)); c4ShapeElem.append('path').attr('fill', 'none').attr('stroke-width', '0.5').attr('stroke', strokeColor).attr('d', 'Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half'.replaceAll('startx', c4Shape.x + c4Shape.width).replaceAll('starty', c4Shape.y).replaceAll('half', c4Shape.height / 2)); break; } // draw type of c4Shape var c4ShapeFontConf = getC4ShapeFont(conf, c4Shape.typeC4Shape.text); c4ShapeElem.append('text').attr('fill', fontColor).attr('font-family', c4ShapeFontConf.fontFamily).attr('font-size', c4ShapeFontConf.fontSize - 2).attr('font-style', 'italic').attr('lengthAdjust', 'spacing').attr('textLength', c4Shape.typeC4Shape.width).attr('x', c4Shape.x + c4Shape.width / 2 - c4Shape.typeC4Shape.width / 2).attr('y', c4Shape.y + c4Shape.typeC4Shape.Y).text('<<' + c4Shape.typeC4Shape.text + '>>'); // draw image/sprite switch (c4Shape.typeC4Shape.text) { case 'person': case 'external_person': drawImage(c4ShapeElem, 48, 48, c4Shape.x + c4Shape.width / 2 - 24, c4Shape.y + c4Shape.image.Y, personImg); break; } // draw label var textFontConf = conf[c4Shape.typeC4Shape.text + 'Font'](); textFontConf.fontWeight = 'bold'; textFontConf.fontSize = textFontConf.fontSize + 2; textFontConf.fontColor = fontColor; _drawTextCandidateFunc(conf)(c4Shape.label.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.label.Y, c4Shape.width, c4Shape.height, { fill: fontColor }, textFontConf); // draw techn/type textFontConf = conf[c4Shape.typeC4Shape.text + 'Font'](); textFontConf.fontColor = fontColor; if (c4Shape.thchn && c4Shape.thchn.text !== '') { _drawTextCandidateFunc(conf)(c4Shape.thchn.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.thchn.Y, c4Shape.width, c4Shape.height, { fill: fontColor, 'font-style': 'italic' }, textFontConf); } else if (c4Shape.type && c4Shape.type.text !== '') { _drawTextCandidateFunc(conf)(c4Shape.type.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.type.Y, c4Shape.width, c4Shape.height, { fill: fontColor, 'font-style': 'italic' }, textFontConf); } // draw descr if (c4Shape.descr && c4Shape.descr.text !== '') { textFontConf = conf.personFont(); textFontConf.fontColor = fontColor; _drawTextCandidateFunc(conf)(c4Shape.descr.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.descr.Y, c4Shape.width, c4Shape.height, { fill: fontColor }, textFontConf); } return c4Shape.height; }; var insertDatabaseIcon = function insertDatabaseIcon(elem) { elem.append('defs').append('symbol').attr('id', 'database').attr('fill-rule', 'evenodd').attr('clip-rule', 'evenodd').append('path').attr('transform', 'scale(.5)').attr('d', 'M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z'); }; var insertComputerIcon = function insertComputerIcon(elem) { elem.append('defs').append('symbol').attr('id', 'computer').attr('width', '24').attr('height', '24').append('path').attr('transform', 'scale(.5)').attr('d', 'M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z'); }; var insertClockIcon = function insertClockIcon(elem) { elem.append('defs').append('symbol').attr('id', 'clock').attr('width', '24').attr('height', '24').append('path').attr('transform', 'scale(.5)').attr('d', 'M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z'); }; /** * Setup arrow head and define the marker. The result is appended to the svg. * * @param elem */ var insertArrowHead = function insertArrowHead(elem) { elem.append('defs').append('marker').attr('id', 'arrowhead').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'); // this is actual shape for arrowhead }; var insertArrowEnd = function insertArrowEnd(elem) { elem.append('defs').append('marker').attr('id', 'arrowend').attr('refX', 1).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 12).attr('markerHeight', 12).attr('orient', 'auto').append('path').attr('d', 'M 10 0 L 0 5 L 10 10 z'); // this is actual shape for arrowhead }; /** * Setup arrow head and define the marker. The result is appended to the svg. * * @param {any} elem */ var insertArrowFilledHead = function insertArrowFilledHead(elem) { elem.append('defs').append('marker').attr('id', 'filled-head').attr('refX', 18).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'); }; /** * Setup node number. The result is appended to the svg. * * @param {any} elem */ var insertDynamicNumber = function insertDynamicNumber(elem) { 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'); }; /** * Setup arrow head and define the marker. The result is appended to the svg. * * @param {any} elem */ var insertArrowCrossHead = function insertArrowCrossHead(elem) { var defs = elem.append('defs'); 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 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 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 }; var getTextObj = function getTextObj() { return { x: 0, y: 0, fill: undefined, anchor: undefined, style: '#666', width: undefined, height: undefined, textMargin: 0, rx: 0, ry: 0, tspan: true, valign: undefined }; }; var getNoteRect = function getNoteRect() { return { x: 0, y: 0, fill: '#EDF2AE', stroke: '#666', width: 100, anchor: 'start', height: 100, rx: 0, ry: 0 }; }; var getC4ShapeFont = function getC4ShapeFont(cnf, typeC4Shape) { return { fontFamily: cnf[typeC4Shape + 'FontFamily'], fontSize: cnf[typeC4Shape + 'FontSize'], fontWeight: cnf[typeC4Shape + 'FontWeight'] }; }; var _drawTextCandidateFunc = function () { /** * @param {any} content * @param {any} g * @param {any} x * @param {any} y * @param {any} width * @param {any} height * @param {any} textAttrs */ function byText(content, g, x, y, width, height, textAttrs) { var text = g.append('text').attr('x', x + width / 2).attr('y', y + height / 2 + 5).style('text-anchor', 'middle').text(content); _setTextAttrs(text, textAttrs); } /** * @param {any} content * @param {any} g * @param {any} x * @param {any} y * @param {any} width * @param {any} height * @param {any} textAttrs * @param {any} conf */ function byTspan(content, g, x, y, width, height, textAttrs, conf) { var fontSize = conf.fontSize, fontFamily = conf.fontFamily, fontWeight = conf.fontWeight; var lines = content.split(_common_common__WEBPACK_IMPORTED_MODULE_1__["default"].lineBreakRegex); for (var i = 0; i < lines.length; i++) { var dy = i * fontSize - fontSize * (lines.length - 1) / 2; var text = g.append('text').attr('x', x + width / 2).attr('y', y).style('text-anchor', 'middle').attr('dominant-baseline', 'middle').style('font-size', fontSize).style('font-weight', fontWeight).style('font-family', fontFamily); text.append('tspan') // .attr('x', x + width / 2) .attr('dy', dy).text(lines[i]) // .attr('y', y + height / 2) .attr('alignment-baseline', 'mathematical'); _setTextAttrs(text, textAttrs); } } /** * @param {any} content * @param {any} g * @param {any} x * @param {any} y * @param {any} width * @param {any} height * @param {any} textAttrs * @param {any} conf */ function byFo(content, g, x, y, width, height, textAttrs, conf) { var s = g.append('switch'); var f = s.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height); var text = f.append('xhtml:div').style('display', 'table').style('height', '100%').style('width', '100%'); text.append('div').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle').text(content); byTspan(content, s, x, y, width, height, textAttrs, conf); _setTextAttrs(text, textAttrs); } /** * @param {any} toText * @param {any} fromTextAttrsDict */ function _setTextAttrs(toText, fromTextAttrsDict) { for (var key in fromTextAttrsDict) { if (fromTextAttrsDict.hasOwnProperty(key)) { // eslint-disable-line toText.attr(key, fromTextAttrsDict[key]); } } } return function (conf) { return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan; }; }(); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ drawRect: drawRect, drawText: drawText, drawLabel: drawLabel, drawBoundary: drawBoundary, drawC4Shape: drawC4Shape, drawRels: drawRels, drawImage: drawImage, drawEmbeddedImage: drawEmbeddedImage, insertArrowHead: insertArrowHead, insertArrowEnd: insertArrowEnd, insertArrowFilledHead: insertArrowFilledHead, insertDynamicNumber: insertDynamicNumber, insertArrowCrossHead: insertArrowCrossHead, insertDatabaseIcon: insertDatabaseIcon, insertComputerIcon: insertComputerIcon, insertClockIcon: insertClockIcon, getTextObj: getTextObj, getNoteRect: getNoteRect, sanitizeUrl: _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl }); /***/ }), /***/ "./src/diagrams/class/classDb.js": /*!***************************************!*\ !*** ./src/diagrams/class/classDb.js ***! \***************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "addAnnotation": () => (/* binding */ addAnnotation), /* harmony export */ "addClass": () => (/* binding */ addClass), /* harmony export */ "addMember": () => (/* binding */ addMember), /* harmony export */ "addMembers": () => (/* binding */ addMembers), /* harmony export */ "addRelation": () => (/* binding */ addRelation), /* harmony export */ "bindFunctions": () => (/* binding */ bindFunctions), /* harmony export */ "cleanupLabel": () => (/* binding */ cleanupLabel), /* harmony export */ "clear": () => (/* binding */ clear), /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ "getClass": () => (/* binding */ getClass), /* harmony export */ "getClasses": () => (/* binding */ getClasses), /* harmony export */ "getRelations": () => (/* binding */ getRelations), /* harmony export */ "lineType": () => (/* binding */ lineType), /* harmony export */ "lookUpDomId": () => (/* binding */ lookUpDomId), /* harmony export */ "parseDirective": () => (/* binding */ parseDirective), /* harmony export */ "relationType": () => (/* binding */ relationType), /* harmony export */ "setClickEvent": () => (/* binding */ setClickEvent), /* harmony export */ "setCssClass": () => (/* binding */ setCssClass), /* harmony export */ "setLink": () => (/* binding */ setLink) /* harmony export */ }); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js"); /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils */ "./src/utils.js"); /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js"); /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js"); function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var MERMAID_DOM_ID_PREFIX = 'classid-'; var relations = []; var classes = {}; var classCounter = 0; var funs = []; var sanitizeText = function sanitizeText(txt) { return _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(txt, _config__WEBPACK_IMPORTED_MODULE_2__.getConfig()); }; var parseDirective = function parseDirective(statement, context, type) { _mermaidAPI__WEBPACK_IMPORTED_MODULE_3__["default"].parseDirective(this, statement, context, type); }; var splitClassNameAndType = function splitClassNameAndType(id) { var genericType = ''; var className = id; if (id.indexOf('~') > 0) { var split = id.split('~'); className = split[0]; genericType = _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(split[1], _config__WEBPACK_IMPORTED_MODULE_2__.getConfig()); } return { className: className, type: genericType }; }; /** * Function called by parser when a node definition has been found. * * @param id * @public */ var addClass = function addClass(id) { var classId = splitClassNameAndType(id); // Only add class if not exists if (typeof classes[classId.className] !== 'undefined') return; classes[classId.className] = { id: classId.className, type: classId.type, cssClasses: [], methods: [], members: [], annotations: [], domId: MERMAID_DOM_ID_PREFIX + classId.className + '-' + classCounter }; classCounter++; }; /** * Function to lookup domId from id in the graph definition. * * @param id * @public */ var lookUpDomId = function lookUpDomId(id) { var classKeys = Object.keys(classes); for (var i = 0; i < classKeys.length; i++) { if (classes[classKeys[i]].id === id) { return classes[classKeys[i]].domId; } } }; var clear = function clear() { relations = []; classes = {}; funs = []; funs.push(setupToolTips); (0,_commonDb__WEBPACK_IMPORTED_MODULE_4__.clear)(); }; var getClass = function getClass(id) { return classes[id]; }; var getClasses = function getClasses() { return classes; }; var getRelations = function getRelations() { return relations; }; var addRelation = function addRelation(relation) { _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Adding relation: ' + JSON.stringify(relation)); addClass(relation.id1); addClass(relation.id2); relation.id1 = splitClassNameAndType(relation.id1).className; relation.id2 = splitClassNameAndType(relation.id2).className; relation.relationTitle1 = _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(relation.relationTitle1.trim(), _config__WEBPACK_IMPORTED_MODULE_2__.getConfig()); relation.relationTitle2 = _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(relation.relationTitle2.trim(), _config__WEBPACK_IMPORTED_MODULE_2__.getConfig()); relations.push(relation); }; /** * Adds an annotation to the specified class Annotations mark special properties of the given type * (like 'interface' or 'service') * * @param className The class name * @param annotation The name of the annotation without any brackets * @public */ var addAnnotation = function addAnnotation(className, annotation) { var validatedClassName = splitClassNameAndType(className).className; classes[validatedClassName].annotations.push(annotation); }; /** * Adds a member to the specified class * * @param className The class name * @param member The full name of the member. If the member is enclosed in <> it is * treated as an annotation If the member is ending with a closing bracket ) it is treated as a * method Otherwise the member will be treated as a normal property * @public */ var addMember = function addMember(className, member) { var validatedClassName = splitClassNameAndType(className).className; var theClass = classes[validatedClassName]; if (typeof member === 'string') { // Member can contain white spaces, we trim them out var memberString = member.trim(); if (memberString.startsWith('<<') && memberString.endsWith('>>')) { // Remove leading and trailing brackets // theClass.annotations.push(memberString.substring(2, memberString.length - 2)); theClass.annotations.push(sanitizeText(memberString.substring(2, memberString.length - 2))); } else if (memberString.indexOf(')') > 0) { theClass.methods.push(sanitizeText(memberString)); } else if (memberString) { theClass.members.push(sanitizeText(memberString)); } } }; var addMembers = function addMembers(className, members) { if (Array.isArray(members)) { members.reverse(); members.forEach(function (member) { return addMember(className, member); }); } }; var cleanupLabel = function cleanupLabel(label) { if (label.substring(0, 1) === ':') { return _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(label.substr(1).trim(), _config__WEBPACK_IMPORTED_MODULE_2__.getConfig()); } else { return sanitizeText(label.trim()); } }; /** * Called by parser when a special node is found, e.g. a clickable element. * * @param ids Comma separated list of ids * @param className Class to add */ var setCssClass = function setCssClass(ids, className) { ids.split(',').forEach(function (_id) { var id = _id; if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id; if (typeof classes[id] !== 'undefined') { classes[id].cssClasses.push(className); } }); }; /** * Called by parser when a tooltip is found, e.g. a clickable element. * * @param ids Comma separated list of ids * @param tooltip Tooltip to add */ var setTooltip = function setTooltip(ids, tooltip) { var config = _config__WEBPACK_IMPORTED_MODULE_2__.getConfig(); ids.split(',').forEach(function (id) { if (typeof tooltip !== 'undefined') { classes[id].tooltip = _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(tooltip, config); } }); }; /** * Called by parser when a link is found. Adds the URL to the vertex data. * * @param ids Comma separated list of ids * @param linkStr URL to create a link for * @param target Target of the link, _blank by default as originally defined in the svgDraw.js file */ var setLink = function setLink(ids, linkStr, target) { var config = _config__WEBPACK_IMPORTED_MODULE_2__.getConfig(); ids.split(',').forEach(function (_id) { var id = _id; if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id; if (typeof classes[id] !== 'undefined') { classes[id].link = _utils__WEBPACK_IMPORTED_MODULE_6__["default"].formatUrl(linkStr, config); if (config.securityLevel === 'sandbox') { classes[id].linkTarget = '_top'; } else if (typeof target === 'string') { classes[id].linkTarget = sanitizeText(target); } else { classes[id].linkTarget = '_blank'; } } }); setCssClass(ids, 'clickable'); }; /** * Called by parser when a click definition is found. Registers an event handler. * * @param ids Comma separated list of ids * @param functionName Function to be called on click * @param functionArgs Function args the function should be called with */ var setClickEvent = function setClickEvent(ids, functionName, functionArgs) { ids.split(',').forEach(function (id) { setClickFunc(id, functionName, functionArgs); classes[id].haveCallback = true; }); setCssClass(ids, 'clickable'); }; var setClickFunc = function setClickFunc(domId, functionName, functionArgs) { var config = _config__WEBPACK_IMPORTED_MODULE_2__.getConfig(); var id = domId; var elemId = lookUpDomId(id); if (config.securityLevel !== 'loose') { return; } if (typeof functionName === 'undefined') { return; } if (typeof classes[id] !== 'undefined') { var argList = []; if (typeof functionArgs === 'string') { /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */ argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/); for (var i = 0; i < argList.length; i++) { var item = argList[i].trim(); /* Removes all double quotes at the start and end of an argument */ /* This preserves all starting and ending whitespace inside */ if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') { item = item.substr(1, item.length - 2); } argList[i] = item; } } /* if no arguments passed into callback, default to passing in id */ if (argList.length === 0) { argList.push(elemId); } funs.push(function () { var elem = document.querySelector("[id=\"".concat(elemId, "\"]")); if (elem !== null) { elem.addEventListener('click', function () { _utils__WEBPACK_IMPORTED_MODULE_6__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_6__["default"], [functionName].concat(_toConsumableArray(argList))); }, false); } }); } }; var bindFunctions = function bindFunctions(element) { funs.forEach(function (fun) { fun(element); }); }; var lineType = { LINE: 0, DOTTED_LINE: 1 }; var relationType = { AGGREGATION: 0, EXTENSION: 1, COMPOSITION: 2, DEPENDENCY: 3 }; var setupToolTips = function setupToolTips(element) { var tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('.mermaidTooltip'); if ((tooltipElem._groups || tooltipElem)[0][0] === null) { tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0); } var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(element).select('svg'); var nodes = svg.selectAll('g.node'); nodes.on('mouseover', function () { var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this); var title = el.attr('title'); // Dont try to draw a tooltip if no data is provided if (title === null) { return; } var rect = this.getBoundingClientRect(); tooltipElem.transition().duration(200).style('opacity', '.9'); tooltipElem.text(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'); el.classed('hover', true); }).on('mouseout', function () { tooltipElem.transition().duration(500).style('opacity', 0); var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this); el.classed('hover', false); }); }; funs.push(setupToolTips); var direction = 'TB'; var getDirection = function getDirection() { return direction; }; var setDirection = function setDirection(dir) { direction = dir; }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ parseDirective: parseDirective, setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_4__.setAccTitle, getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_4__.getAccTitle, getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_4__.getAccDescription, setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_4__.setAccDescription, getConfig: function getConfig() { return _config__WEBPACK_IMPORTED_MODULE_2__.getConfig().class; }, addClass: addClass, bindFunctions: bindFunctions, clear: clear, getClass: getClass, getClasses: getClasses, addAnnotation: addAnnotation, getRelations: getRelations, addRelation: addRelation, getDirection: getDirection, setDirection: setDirection, addMember: addMember, addMembers: addMembers, cleanupLabel: cleanupLabel, lineType: lineType, relationType: relationType, setClickEvent: setClickEvent, setCssClass: setCssClass, setLink: setLink, setTooltip: setTooltip, lookUpDomId: lookUpDomId }); /***/ }), /***/ "./src/diagrams/class/classRenderer-v2.js": /*!************************************************!*\ !*** ./src/diagrams/class/classRenderer-v2.js ***! \************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "addClasses": () => (/* binding */ addClasses), /* harmony export */ "addRelations": () => (/* binding */ addRelations), /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ "draw": () => (/* binding */ draw), /* harmony export */ "setConf": () => (/* binding */ setConf) /* harmony export */ }); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "./node_modules/dagre/index.js"); /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "./node_modules/graphlib/index.js"); /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../logger */ "./src/logger.js"); /* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js"); /* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison"); /* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js"); /* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils */ "./src/utils.js"); /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js"); /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js"); // import addHtmlLabel from 'dagre-d3/lib/label/add-html-label.js'; _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"]; var idCache = {}; var padding = 20; var sanitizeText = function sanitizeText(txt) { return _common_common__WEBPACK_IMPORTED_MODULE_5__["default"].sanitizeText(txt, (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)()); }; var conf = { dividerMargin: 10, padding: 5, textHeight: 10 }; /** * Function that adds the vertices found during parsing to the graph to be rendered. * * @param {Object< * string, * { cssClasses: string[]; text: string; id: string; type: string; domId: string } * >} classes * Object containing the vertices. * @param {SVGGElement} g The graph that is to be drawn. */ var addClasses = function addClasses(classes, g) { // const svg = select(`[id="${svgId}"]`); var keys = Object.keys(classes); _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('keys:', keys); _logger__WEBPACK_IMPORTED_MODULE_7__.log.info(classes); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition keys.forEach(function (id) { var vertex = classes[id]; /** * Variable for storing the classes for the vertex * * @type {string} */ var cssClassStr = ''; if (vertex.cssClasses.length > 0) { cssClassStr = cssClassStr + ' ' + vertex.cssClasses.join(' '); } // if (vertex.classes.length > 0) { // classStr = vertex.classes.join(' '); // } var styles = { labelStyle: '' }; //getStylesFromArray(vertex.styles); // Use vertex id as text in the box if no text is provided by the graph definition var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually // let vertexNode; // if (evaluate(getConfig().flowchart.htmlLabels)) { // const node = { // label: vertexText.replace( // /fa[lrsb]?:fa-[\w-]+/g, // s => `` // ) // }; // vertexNode = addHtmlLabel(svg, node).node(); // vertexNode.parentNode.removeChild(vertexNode); // } else { // const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text'); // svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:')); // const rows = vertexText.split(common.lineBreakRegex); // for (let j = 0; j < rows.length; j++) { // const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan'); // tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve'); // tspan.setAttribute('dy', '1em'); // tspan.setAttribute('x', '1'); // tspan.textContent = rows[j]; // svgLabel.appendChild(tspan); // } // vertexNode = svgLabel; // } var radious = 0; var _shape = ''; // Set the shape based parameters switch (vertex.type) { case 'class': _shape = 'class_box'; break; default: _shape = 'class_box'; } // Add the node g.setNode(vertex.id, { labelStyle: styles.labelStyle, shape: _shape, labelText: sanitizeText(vertexText), classData: vertex, rx: radious, ry: radious, class: cssClassStr, style: styles.style, id: vertex.id, domId: vertex.domId, haveCallback: vertex.haveCallback, link: vertex.link, width: vertex.type === 'group' ? 500 : undefined, type: vertex.type, padding: (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.padding }); _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('setNode', { labelStyle: styles.labelStyle, shape: _shape, labelText: vertexText, rx: radious, ry: radious, class: cssClassStr, style: styles.style, id: vertex.id, width: vertex.type === 'group' ? 500 : undefined, type: vertex.type, padding: (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.padding }); }); }; /** * Add edges to graph based on parsed graph definition * * @param relations * @param {object} g The graph object */ var addRelations = function addRelations(relations, g) { var cnt = 0; var defaultStyle; var defaultLabelStyle; // if (typeof relations.defaultStyle !== 'undefined') { // const defaultStyles = getStylesFromArray(relations.defaultStyle); // defaultStyle = defaultStyles.style; // defaultLabelStyle = defaultStyles.labelStyle; // } relations.forEach(function (edge) { cnt++; var edgeData = {}; //Set relationship style and line type edgeData.classes = 'relation'; edgeData.pattern = edge.relation.lineType == 1 ? 'dashed' : 'solid'; edgeData.id = 'id' + cnt; // Set link type for rendering if (edge.type === 'arrow_open') { edgeData.arrowhead = 'none'; } else { edgeData.arrowhead = 'normal'; } _logger__WEBPACK_IMPORTED_MODULE_7__.log.info(edgeData, edge); //Set edge extra labels //edgeData.startLabelLeft = edge.relationTitle1; edgeData.startLabelRight = edge.relationTitle1 === 'none' ? '' : edge.relationTitle1; edgeData.endLabelLeft = edge.relationTitle2 === 'none' ? '' : edge.relationTitle2; //edgeData.endLabelRight = edge.relationTitle2; //Set relation arrow types edgeData.arrowTypeStart = getArrowMarker(edge.relation.type1); edgeData.arrowTypeEnd = getArrowMarker(edge.relation.type2); var style = ''; var labelStyle = ''; if (typeof edge.style !== 'undefined') { var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_8__.getStylesFromArray)(edge.style); style = styles.style; labelStyle = styles.labelStyle; } else { style = 'fill:none'; if (typeof defaultStyle !== 'undefined') { style = defaultStyle; } if (typeof defaultLabelStyle !== 'undefined') { labelStyle = defaultLabelStyle; } } edgeData.style = style; edgeData.labelStyle = labelStyle; if (typeof edge.interpolate !== 'undefined') { edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_8__.interpolateToCurve)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear); } else if (typeof relations.defaultInterpolate !== 'undefined') { edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_8__.interpolateToCurve)(relations.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear); } else { edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_8__.interpolateToCurve)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear); } edge.text = edge.title; if (typeof edge.text === 'undefined') { if (typeof edge.style !== 'undefined') { edgeData.arrowheadStyle = 'fill: #333'; } } else { edgeData.arrowheadStyle = 'fill: #333'; edgeData.labelpos = 'c'; if ((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels) { // eslint-disable-line edgeData.labelType = 'html'; edgeData.label = '' + edge.text + ''; } else { edgeData.labelType = 'text'; edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_5__["default"].lineBreakRegex, '\n'); if (typeof edge.style === 'undefined') { edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none'; } edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:'); } } // Add the edge to the graph g.setEdge(edge.id1, edge.id2, edgeData, cnt); }); }; /** * Gets the ID with the same label as in the cache * * @param {string} label The label to look for * @returns {string} The resulting ID */ var getGraphId = function getGraphId(label) { var foundEntry = Object.entries(idCache).find(function (entry) { return entry[1].label === label; }); if (foundEntry) { return foundEntry[0]; } }; /** * Merges the value of `conf` with the passed `cnf` * * @param {object} cnf Config to merge */ var setConf = function setConf(cnf) { var keys = Object.keys(cnf); keys.forEach(function (key) { conf[key] = cnf[key]; }); }; /** * Draws a flowchart in the tag with id: id based on the graph definition in text. * * @param {string} text * @param {string} id */ var draw = function draw(text, id) { _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Drawing class - ', id); _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].clear(); // const parser = classDb.parser; // parser.yy = classDb; // Parse the graph definition // try { _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.parse(text); // } catch (err) { // log.debug('Parsing failed'); // } // Fetch the default direction, use TD if none was found //let dir = 'TD'; var conf = (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart; var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().securityLevel; _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('config:', conf); var nodeSpacing = conf.nodeSpacing || 50; var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({ multigraph: true, compound: true }).setGraph({ rankdir: _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getDirection(), nodesep: nodeSpacing, ranksep: rankSpacing, marginx: 8, marginy: 8 }).setDefaultEdgeLabel(function () { return {}; }); // let subG; // const subGraphs = flowDb.getSubGraphs(); // log.info('Subgraphs - ', subGraphs); // for (let i = subGraphs.length - 1; i >= 0; i--) { // subG = subGraphs[i]; // log.info('Subgraph - ', subG); // flowDb.addVertex(subG.id, subG.title, 'group', undefined, subG.classes); // } // Fetch the vertices/nodes and edges/links from the parsed graph definition var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses(); var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations(); _logger__WEBPACK_IMPORTED_MODULE_7__.log.info(relations); addClasses(classes, g, id); addRelations(relations, g); // Add custom shapes // flowChartShapes.addToRenderV2(addShape); // Set up an SVG group so that we can translate the final graph. var sandboxElement; if (securityLevel === 'sandbox') { sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id); } var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body'); var svg = root.select("[id=\"".concat(id, "\"]")); svg.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink'); // Run the renderer. This is what draws the final graph. var element = root.select('#' + id + ' g'); (0,_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_9__.render)(element, g, ['aggregation', 'extension', 'composition', 'dependency'], 'classDiagram', id); (0,_utils__WEBPACK_IMPORTED_MODULE_8__.setupGraphViewbox)(g, svg, conf.diagramPadding, conf.useMaxWidth); // Add label rects for non html labels if (!conf.htmlLabels) { var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; var labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label'); for (var k = 0; k < labels.length; k++) { var label = labels[k]; // Get dimensions of label var dim = label.getBBox(); var rect = doc.createElementNS('http://www.w3.org/2000/svg', 'rect'); rect.setAttribute('rx', 0); rect.setAttribute('ry', 0); rect.setAttribute('width', dim.width); rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;'); label.insertBefore(rect, label.firstChild); } } (0,_accessibility__WEBPACK_IMPORTED_MODULE_10__["default"])(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy, svg, id); // If node has a link, wrap it in an anchor SVG object. // const keys = Object.keys(classes); // keys.forEach(function(key) { // const vertex = classes[key]; // if (vertex.link) { // const node = select('#' + id + ' [id="' + key + '"]'); // if (node) { // const link = document.createElementNS('http://www.w3.org/2000/svg', 'a'); // link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' ')); // link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link); // link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener'); // const linkNode = node.insert(function() { // return link; // }, ':first-child'); // const shape = node.select('.label-container'); // if (shape) { // linkNode.append(function() { // return shape.node(); // }); // } // const label = node.select('.label'); // if (label) { // linkNode.append(function() { // return label.node(); // }); // } // } // } // }); }; /** * Gets the arrow marker for a type index * * @param {number} type The type to look for * @returns {'aggregation' | 'extension' | 'composition' | 'dependency'} The arrow marker */ function getArrowMarker(type) { var marker; switch (type) { case 0: marker = 'aggregation'; break; case 1: marker = 'extension'; break; case 2: marker = 'composition'; break; case 3: marker = 'dependency'; break; default: marker = 'none'; } return marker; } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ setConf: setConf, draw: draw }); /***/ }), /***/ "./src/diagrams/class/classRenderer.js": /*!*********************************************!*\ !*** ./src/diagrams/class/classRenderer.js ***! \*********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ "draw": () => (/* binding */ draw), /* harmony export */ "setConf": () => (/* binding */ setConf) /* harmony export */ }); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "./node_modules/dagre/index.js"); /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "./node_modules/graphlib/index.js"); /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js"); /* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js"); /* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison"); /* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/class/svgDraw.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils */ "./src/utils.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js"); /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js"); _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"]; var idCache = {}; var padding = 20; var conf = { dividerMargin: 10, padding: 5, textHeight: 10 }; /** * Gets the ID with the same label as in the cache * * @param {string} label The label to look for * @returns {string} The resulting ID */ var getGraphId = function getGraphId(label) { var foundEntry = Object.entries(idCache).find(function (entry) { return entry[1].label === label; }); if (foundEntry) { return foundEntry[0]; } }; /** * Setup arrow head and define the marker. The result is appended to the svg. * * @param {SVGSVGElement} elem The SVG element to append to */ var insertMarkers = function insertMarkers(elem) { 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'); 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 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'); 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'); 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'); 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'); 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'); 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'); }; /** * Merges the value of `conf` with the passed `cnf` * * @param {object} cnf Config to merge */ var setConf = function setConf(cnf) { var keys = Object.keys(cnf); keys.forEach(function (key) { conf[key] = cnf[key]; }); }; /** * Draws a flowchart in the tag with id: id based on the graph definition in text. * * @param {string} text * @param {string} id */ var draw = function draw(text, id) { idCache = {}; _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy.clear(); _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.parse(text); _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Rendering diagram ' + text); var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().securityLevel; // Handle root and Document for when rendering in sanbox mode var sandboxElement; if (securityLevel === 'sandbox') { sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id); } var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body'); var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; // Fetch the default direction, use TD if none was found var diagram = root.select("[id='".concat(id, "']")); diagram.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink'); insertMarkers(diagram); // Layout graph, Create a new directed graph var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({ multigraph: true }); // Set an object for the graph label g.setGraph({ isMultiGraph: true }); // Default to assigning a new object as a label for each new edge. g.setDefaultEdgeLabel(function () { return {}; }); var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses(); var keys = Object.keys(classes); for (var i = 0; i < keys.length; i++) { var classDef = classes[keys[i]]; var node = _svgDraw__WEBPACK_IMPORTED_MODULE_7__["default"].drawClass(diagram, classDef, conf); idCache[node.id] = node; // Add nodes to the graph. The first argument is the node id. The second is // metadata about the node. In this case we're going to add labels to each of // our nodes. g.setNode(node.id, node); _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Org height: ' + node.height); } var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations(); relations.forEach(function (relation) { _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)); g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), { relation: relation }, relation.title || 'DEFAULT'); }); dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(g); g.nodes().forEach(function (v) { if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') { _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v))); root.select('#' + (0,_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) + ' )'); } }); g.edges().forEach(function (e) { if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') { _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e))); _svgDraw__WEBPACK_IMPORTED_MODULE_7__["default"].drawEdge(diagram, g.edge(e), g.edge(e).relation, conf); } }); var svgBounds = diagram.node().getBBox(); var width = svgBounds.width + padding * 2; var height = svgBounds.height + padding * 2; (0,_utils__WEBPACK_IMPORTED_MODULE_8__.configureSvgSize)(diagram, height, width, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height); _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug("viewBox ".concat(vBox)); diagram.attr('viewBox', vBox); (0,_accessibility__WEBPACK_IMPORTED_MODULE_9__["default"])(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy, diagram, id); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ setConf: setConf, draw: draw }); /***/ }), /***/ "./src/diagrams/class/styles.js": /*!**************************************!*\ !*** ./src/diagrams/class/styles.js ***! \**************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); var getStyles = function getStyles(options) { 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.nodeLabel, .edgeLabel {\n color: ").concat(options.classText, ";\n}\n.edgeLabel .label rect {\n fill: ").concat(options.mainBkg, ";\n}\n.label text {\n fill: ").concat(options.classText, ";\n}\n.edgeLabel .label span {\n background: ").concat(options.mainBkg, ";\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"); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles); /***/ }), /***/ "./src/diagrams/class/svgDraw.js": /*!***************************************!*\ !*** ./src/diagrams/class/svgDraw.js ***! \***************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ "drawClass": () => (/* binding */ drawClass), /* harmony export */ "drawEdge": () => (/* binding */ drawEdge), /* harmony export */ "parseMember": () => (/* binding */ parseMember) /* harmony export */ }); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); /* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./src/utils.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js"); var edgeCount = 0; var drawEdge = function drawEdge(elem, path, relation, conf) { var getRelationType = function getRelationType(type) { switch (type) { case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.AGGREGATION: return 'aggregation'; case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.EXTENSION: return 'extension'; case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.COMPOSITION: return 'composition'; case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.DEPENDENCY: return 'dependency'; } }; path.points = path.points.filter(function (p) { return !Number.isNaN(p.y); }); // The data for our line var lineData = path.points; // This is the accessor function we talked about above var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) { return d.x; }).y(function (d) { return d.y; }).curve(d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis); var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', 'edge' + edgeCount).attr('class', 'relation'); var url = ''; if (conf.arrowMarkerAbsolute) { url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search; url = url.replace(/\(/g, '\\('); url = url.replace(/\)/g, '\\)'); } if (relation.relation.lineType == 1) { svgPath.attr('class', 'relation dashed-line'); } if (relation.relation.type1 !== 'none') { svgPath.attr('marker-start', 'url(' + url + '#' + getRelationType(relation.relation.type1) + 'Start' + ')'); } if (relation.relation.type2 !== 'none') { svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(relation.relation.type2) + 'End' + ')'); } var x, y; var l = path.points.length; // Calculate Label position var labelPosition = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcLabelPosition(path.points); x = labelPosition.x; y = labelPosition.y; var p1_card_x, p1_card_y; var p2_card_x, p2_card_y; if (l % 2 !== 0 && l > 1) { var cardinality_1_point = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcCardinalityPosition(relation.relation.type1 !== 'none', path.points, path.points[0]); var cardinality_2_point = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcCardinalityPosition(relation.relation.type2 !== 'none', path.points, path.points[l - 1]); _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('cardinality_1_point ' + JSON.stringify(cardinality_1_point)); _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('cardinality_2_point ' + JSON.stringify(cardinality_2_point)); p1_card_x = cardinality_1_point.x; p1_card_y = cardinality_1_point.y; p2_card_x = cardinality_2_point.x; p2_card_y = cardinality_2_point.y; } if (typeof relation.title !== 'undefined') { var g = elem.append('g').attr('class', 'classLabel'); var label = g.append('text').attr('class', 'label').attr('x', x).attr('y', y).attr('fill', 'red').attr('text-anchor', 'middle').text(relation.title); window.label = label; var bounds = label.node().getBBox(); 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); } _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('Rendering relation ' + JSON.stringify(relation)); if (typeof relation.relationTitle1 !== 'undefined' && relation.relationTitle1 !== 'none') { var _g = elem.append('g').attr('class', 'cardinality'); _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); } if (typeof relation.relationTitle2 !== 'undefined' && relation.relationTitle2 !== 'none') { var _g2 = elem.append('g').attr('class', 'cardinality'); _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); } edgeCount++; }; /** * Renders a class diagram * * @param {SVGSVGElement} elem The element to draw it into * @param classDef * @param conf * @todo Add more information in the JSDOC here */ var drawClass = function drawClass(elem, classDef, conf) { _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('Rendering class ' + classDef); var id = classDef.id; var classInfo = { id: id, label: classDef.id, width: 0, height: 0 }; // add class group var g = elem.append('g').attr('id', (0,_classDb__WEBPACK_IMPORTED_MODULE_1__.lookUpDomId)(id)).attr('class', 'classGroup'); // add title var title; if (classDef.link) { title = g.append('svg:a').attr('xlink:href', classDef.link).attr('target', classDef.linkTarget).append('text').attr('y', conf.textHeight + conf.padding).attr('x', 0); } else { title = g.append('text').attr('y', conf.textHeight + conf.padding).attr('x', 0); } // add annotations var isFirst = true; classDef.annotations.forEach(function (member) { var titleText2 = title.append('tspan').text('«' + member + '»'); if (!isFirst) titleText2.attr('dy', conf.textHeight); isFirst = false; }); var classTitleString = classDef.id; if (classDef.type !== undefined && classDef.type !== '') { classTitleString += '<' + classDef.type + '>'; } 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 if (!isFirst) classTitle.attr('dy', conf.textHeight); var titleHeight = title.node().getBBox().height; var membersLine = g.append('line') // text label for the x axis .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin / 2).attr('y2', conf.padding + titleHeight + conf.dividerMargin / 2); var members = g.append('text') // text label for the x axis .attr('x', conf.padding).attr('y', titleHeight + conf.dividerMargin + conf.textHeight).attr('fill', 'white').attr('class', 'classText'); isFirst = true; classDef.members.forEach(function (member) { addTspan(members, member, isFirst, conf); isFirst = false; }); var membersBox = members.node().getBBox(); var methodsLine = g.append('line') // text label for the x axis .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr('y2', conf.padding + titleHeight + conf.dividerMargin + membersBox.height); var methods = g.append('text') // text label for the x axis .attr('x', conf.padding).attr('y', titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr('fill', 'white').attr('class', 'classText'); isFirst = true; classDef.methods.forEach(function (method) { addTspan(methods, method, isFirst, conf); isFirst = false; }); var classBox = g.node().getBBox(); var cssClassStr = ' '; if (classDef.cssClasses.length > 0) { cssClassStr = cssClassStr + classDef.cssClasses.join(' '); } 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); var rectWidth = rect.node().getBBox().width; // Center title // We subtract the width of each text element from the class box width and divide it by 2 title.node().childNodes.forEach(function (x) { x.setAttribute('x', (rectWidth - x.getBBox().width) / 2); }); if (classDef.tooltip) { title.insert('title').text(classDef.tooltip); } membersLine.attr('x2', rectWidth); methodsLine.attr('x2', rectWidth); classInfo.width = rectWidth; classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin; return classInfo; }; var parseMember = function parseMember(text) { var fieldRegEx = /^(\+|-|~|#)?(\w+)(~\w+~|\[\])?\s+(\w+) *(\*|\$)?$/; var methodRegEx = /^([+|\-|~|#])?(\w+) *\( *(.*)\) *(\*|\$)? *(\w*[~|[\]]*\s*\w*~?)$/; var fieldMatch = text.match(fieldRegEx); var methodMatch = text.match(methodRegEx); if (fieldMatch && !methodMatch) { return buildFieldDisplay(fieldMatch); } else if (methodMatch) { return buildMethodDisplay(methodMatch); } else { return buildLegacyDisplay(text); } }; var buildFieldDisplay = function buildFieldDisplay(parsedText) { var cssStyle = ''; var displayText = ''; try { var visibility = parsedText[1] ? parsedText[1].trim() : ''; var fieldType = parsedText[2] ? parsedText[2].trim() : ''; var genericType = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : ''; var fieldName = parsedText[4] ? parsedText[4].trim() : ''; var classifier = parsedText[5] ? parsedText[5].trim() : ''; displayText = visibility + fieldType + genericType + ' ' + fieldName; cssStyle = parseClassifier(classifier); } catch (err) { displayText = parsedText; } return { displayText: displayText, cssStyle: cssStyle }; }; var buildMethodDisplay = function buildMethodDisplay(parsedText) { var cssStyle = ''; var displayText = ''; try { var visibility = parsedText[1] ? parsedText[1].trim() : ''; var methodName = parsedText[2] ? parsedText[2].trim() : ''; var parameters = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : ''; var classifier = parsedText[4] ? parsedText[4].trim() : ''; var returnType = parsedText[5] ? ' : ' + parseGenericTypes(parsedText[5]).trim() : ''; displayText = visibility + methodName + '(' + parameters + ')' + returnType; cssStyle = parseClassifier(classifier); } catch (err) { displayText = parsedText; } return { displayText: displayText, cssStyle: cssStyle }; }; var buildLegacyDisplay = function buildLegacyDisplay(text) { // if for some reason we dont have any match, use old format to parse text var displayText = ''; var cssStyle = ''; var memberText = ''; var returnType = ''; var methodStart = text.indexOf('('); var methodEnd = text.indexOf(')'); if (methodStart > 1 && methodEnd > methodStart && methodEnd <= text.length) { var visibility = ''; var methodName = ''; var firstChar = text.substring(0, 1); if (firstChar.match(/\w/)) { methodName = text.substring(0, methodStart).trim(); } else { if (firstChar.match(/\+|-|~|#/)) { visibility = firstChar; } methodName = text.substring(1, methodStart).trim(); } var parameters = text.substring(methodStart + 1, methodEnd); var classifier = text.substring(methodEnd + 1, 1); cssStyle = parseClassifier(classifier); displayText = visibility + methodName + '(' + parseGenericTypes(parameters.trim()) + ')'; if (methodEnd < memberText.length) { returnType = text.substring(methodEnd + 2).trim(); if (returnType !== '') { returnType = ' : ' + parseGenericTypes(returnType); } } } else { // finally - if all else fails, just send the text back as written (other than parsing for generic types) displayText = parseGenericTypes(text); } return { displayText: displayText, cssStyle: cssStyle }; }; /** * Adds a for a member in a diagram * * @param {SVGElement} textEl The element to append to * @param {string} txt The member * @param {boolean} isFirst * @param {{ padding: string; textHeight: string }} conf The configuration for the member */ var addTspan = function addTspan(textEl, txt, isFirst, conf) { var member = parseMember(txt); var tSpan = textEl.append('tspan').attr('x', conf.padding).text(member.displayText); if (member.cssStyle !== '') { tSpan.attr('style', member.cssStyle); } if (!isFirst) { tSpan.attr('dy', conf.textHeight); } }; /** * Makes generics in typescript syntax * * @example Array of array of strings in typescript syntax * // returns "Array>" * parseGenericTypes('Array~Array~string~~'); * * @param {string} text The text to convert * @returns {string} The converted string */ var parseGenericTypes = function parseGenericTypes(text) { var cleanedText = text; if (text.indexOf('~') != -1) { cleanedText = cleanedText.replace('~', '<'); cleanedText = cleanedText.replace('~', '>'); return parseGenericTypes(cleanedText); } else { return cleanedText; } }; /** * Gives the styles for a classifier * * @param {'+' | '-' | '#' | '~' | '*' | '$'} classifier The classifier string * @returns {string} Styling for the classifier */ var parseClassifier = function parseClassifier(classifier) { switch (classifier) { case '*': return 'font-style:italic;'; case '$': return 'text-decoration:underline;'; default: return ''; } }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ drawClass: drawClass, drawEdge: drawEdge, parseMember: parseMember }); /***/ }), /***/ "./src/diagrams/common/common.js": /*!***************************************!*\ !*** ./src/diagrams/common/common.js ***! \***************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ "evaluate": () => (/* binding */ evaluate), /* harmony export */ "getRows": () => (/* binding */ getRows), /* harmony export */ "hasBreaks": () => (/* binding */ hasBreaks), /* harmony export */ "lineBreakRegex": () => (/* binding */ lineBreakRegex), /* harmony export */ "removeEscapes": () => (/* binding */ removeEscapes), /* harmony export */ "removeScript": () => (/* binding */ removeScript), /* harmony export */ "sanitizeText": () => (/* binding */ sanitizeText), /* harmony export */ "sanitizeTextOrArray": () => (/* binding */ sanitizeTextOrArray), /* harmony export */ "splitBreaks": () => (/* binding */ splitBreaks) /* harmony export */ }); /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dompurify */ "./node_modules/dompurify/dist/purify.js"); /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_0__); /** * Gets the number of lines in a string * * @param {string | undefined} s The string to check the lines for * @returns {number} The number of lines in that string */ var getRows = function getRows(s) { if (!s) return 1; var str = breakToPlaceholder(s); str = str.replace(/\\n/g, '#br#'); return str.split('#br#'); }; var removeEscapes = function removeEscapes(text) { var newStr = text.replace(/\\u[\dA-F]{4}/gi, function (match) { return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16)); }); newStr = newStr.replace(/\\x([0-9a-f]{2})/gi, function (_, c) { return String.fromCharCode(parseInt(c, 16)); }); newStr = newStr.replace(/\\[\d\d\d]{3}/gi, function (match) { return String.fromCharCode(parseInt(match.replace(/\\/g, ''), 8)); }); newStr = newStr.replace(/\\[\d\d\d]{2}/gi, function (match) { return String.fromCharCode(parseInt(match.replace(/\\/g, ''), 8)); }); return newStr; }; /** * Removes script tags from a text * * @param {string} txt The text to sanitize * @returns {string} The safer text */ var removeScript = function removeScript(txt) { var rs = ''; var idx = 0; while (idx >= 0) { idx = txt.indexOf('= 0) { rs += txt.substr(0, idx); txt = txt.substr(idx + 1); idx = txt.indexOf(''); if (idx >= 0) { idx += 9; txt = txt.substr(idx); } } else { rs += txt; idx = -1; break; } } var decodedText = removeEscapes(rs); decodedText = decodedText.replaceAll(/script>/gi, '#'); decodedText = decodedText.replaceAll(/javascript:/gi, '#'); decodedText = decodedText.replaceAll(/javascript&colon/gi, '#'); decodedText = decodedText.replaceAll(/onerror=/gi, 'onerror:'); decodedText = decodedText.replaceAll(/"); } else { if (cnf.securityLevel !== 'loose') { svgCode = dompurify__WEBPACK_IMPORTED_MODULE_1___default().sanitize(svgCode, { ADD_TAGS: ['foreignobject'], ADD_ATTR: ['dominant-baseline'] }); } } if (typeof cb !== 'undefined') { switch (graphType) { case 'flowchart': case 'flowchart-v2': cb(svgCode, _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_9__["default"].bindFunctions); break; case 'gantt': cb(svgCode, _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_14__["default"].bindFunctions); break; case 'class': case 'classDiagram': cb(svgCode, _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_16__["default"].bindFunctions); break; default: cb(svgCode); } } else { _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('CB = undefined!'); } (0,_interactionDb__WEBPACK_IMPORTED_MODULE_50__.attachFunctions)(); var tmpElementSelector = cnf.securityLevel === 'sandbox' ? '#i' + id : '#d' + id; var node = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(tmpElementSelector).node(); if (node !== null && typeof node.remove === 'function') { (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(tmpElementSelector).node().remove(); } return svgCode; }; var currentDirective = {}; var parseDirective = function parseDirective(p, statement, context, type) { try { if (statement !== undefined) { statement = statement.trim(); switch (context) { case 'open_directive': currentDirective = {}; break; case 'type_directive': currentDirective.type = statement.toLowerCase(); break; case 'arg_directive': currentDirective.args = JSON.parse(statement); break; case 'close_directive': handleDirective(p, currentDirective, type); currentDirective = null; break; } } } catch (error) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.error("Error while rendering sequenceDiagram directive: ".concat(statement, " jison context: ").concat(context)); _logger__WEBPACK_IMPORTED_MODULE_4__.log.error(error.message); } }; var handleDirective = function handleDirective(p, directive, type) { _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug("Directive type=".concat(directive.type, " with args:"), directive.args); switch (directive.type) { case 'init': case 'initialize': { ['config'].forEach(function (prop) { if (typeof directive.args[prop] !== 'undefined') { if (type === 'flowchart-v2') { type = 'flowchart'; } directive.args[type] = directive.args[prop]; delete directive.args[prop]; } }); _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitize in handleDirective', directive.args); (0,_utils__WEBPACK_IMPORTED_MODULE_3__.directiveSanitizer)(directive.args); _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitize in handleDirective (done)', directive.args); reinitialize(directive.args); _config__WEBPACK_IMPORTED_MODULE_2__.addDirective(directive.args); break; } case 'wrap': case 'nowrap': if (p && p['setWrap']) { p.setWrap(directive.type === 'wrap'); } break; case 'themeCss': _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('themeCss encountered'); break; default: _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("Unhandled directive: source: '%%{".concat(directive.type, ": ").concat(JSON.stringify(directive.args ? directive.args : {}), "}%%"), directive); break; } }; /** @param {any} conf */ function updateRendererConfigs(conf) { // Todo remove, all diagrams should get config on demand from the config object, no need for this // gitGraphRenderer.setConf(conf.git); // Todo Remove all of these _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_30__["default"].setConf(conf.flowchart); _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_36__["default"].setConf(conf.flowchart); if (typeof conf['sequenceDiagram'] !== 'undefined') { _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_37__["default"].setConf((0,_utils__WEBPACK_IMPORTED_MODULE_3__.assignWithDepth)(conf.sequence, conf['sequenceDiagram'])); } _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_37__["default"].setConf(conf.sequence); _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_38__["default"].setConf(conf.gantt); _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_39__["default"].setConf(conf.class); _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_41__["default"].setConf(conf.state); _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_42__["default"].setConf(conf.state); _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_43__["default"].setConf(conf.class); // pieRenderer.setConf(conf.class); _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_46__["default"].setConf(conf.er); _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_47__["default"].setConf(conf.journey); _diagrams_requirement_requirementRenderer__WEBPACK_IMPORTED_MODULE_48__["default"].setConf(conf.requirement); _errorRenderer__WEBPACK_IMPORTED_MODULE_49__["default"].setConf(conf.class); } /** To be removed */ function reinitialize() {// `mermaidAPI.reinitialize: v${pkg.version}`, // JSON.stringify(options), // options.themeVariables.primaryColor; // // if (options.theme && theme[options.theme]) { // // options.themeVariables = theme[options.theme].getThemeVariables(options.themeVariables); // // } // // Set default options // const config = // typeof options === 'object' ? configApi.setConfig(options) : configApi.getSiteConfig(); // updateRendererConfigs(config); // setLogLevel(config.logLevel); // log.debug('mermaidAPI.reinitialize: ', config); } /** @param {any} options */ function initialize(options) { // console.warn(`mermaidAPI.initialize: v${pkg.version} `, options); // Handle legacy location of font-family configuration if (options && options.fontFamily) { if (!options.themeVariables) { options.themeVariables = { fontFamily: options.fontFamily }; } else { if (!options.themeVariables.fontFamily) { options.themeVariables = { fontFamily: options.fontFamily }; } } } // Set default options _config__WEBPACK_IMPORTED_MODULE_2__.saveConfigFromInitialize(options); if (options && options.theme && _themes__WEBPACK_IMPORTED_MODULE_51__["default"][options.theme]) { // Todo merge with user options options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_51__["default"][options.theme].getThemeVariables(options.themeVariables); } else { if (options) options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_51__["default"]["default"].getThemeVariables(options.themeVariables); } var config = _typeof(options) === 'object' ? _config__WEBPACK_IMPORTED_MODULE_2__.setSiteConfig(options) : _config__WEBPACK_IMPORTED_MODULE_2__.getSiteConfig(); updateRendererConfigs(config); (0,_logger__WEBPACK_IMPORTED_MODULE_4__.setLogLevel)(config.logLevel); // log.debug('mermaidAPI.initialize: ', config); } var mermaidAPI = Object.freeze({ render: render, parse: parse, parseDirective: parseDirective, initialize: initialize, reinitialize: reinitialize, getConfig: _config__WEBPACK_IMPORTED_MODULE_2__.getConfig, setConfig: _config__WEBPACK_IMPORTED_MODULE_2__.setConfig, getSiteConfig: _config__WEBPACK_IMPORTED_MODULE_2__.getSiteConfig, updateSiteConfig: _config__WEBPACK_IMPORTED_MODULE_2__.updateSiteConfig, reset: function reset() { // console.warn('reset'); _config__WEBPACK_IMPORTED_MODULE_2__.reset(); // const siteConfig = configApi.getSiteConfig(); // updateRendererConfigs(siteConfig); }, globalReset: function globalReset() { _config__WEBPACK_IMPORTED_MODULE_2__.reset(_config__WEBPACK_IMPORTED_MODULE_2__.defaultConfig); updateRendererConfigs(_config__WEBPACK_IMPORTED_MODULE_2__.getConfig()); }, defaultConfig: _config__WEBPACK_IMPORTED_MODULE_2__.defaultConfig }); (0,_logger__WEBPACK_IMPORTED_MODULE_4__.setLogLevel)(_config__WEBPACK_IMPORTED_MODULE_2__.getConfig().logLevel); _config__WEBPACK_IMPORTED_MODULE_2__.reset(_config__WEBPACK_IMPORTED_MODULE_2__.getConfig()); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (mermaidAPI); /** * ## mermaidAPI configuration defaults * * ```html * * ``` */ /***/ }), /***/ "./src/styles.js": /*!***********************!*\ !*** ./src/styles.js ***! \***********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "calcThemeVariables": () => (/* binding */ calcThemeVariables), /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagrams/class/styles */ "./src/diagrams/class/styles.js"); /* harmony import */ var _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagrams/er/styles */ "./src/diagrams/er/styles.js"); /* harmony import */ var _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./diagrams/flowchart/styles */ "./src/diagrams/flowchart/styles.js"); /* harmony import */ var _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./diagrams/gantt/styles */ "./src/diagrams/gantt/styles.js"); /* harmony import */ var _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./diagrams/git/styles */ "./src/diagrams/git/styles.js"); /* harmony import */ var _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./diagrams/info/styles */ "./src/diagrams/info/styles.js"); /* harmony import */ var _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./diagrams/pie/styles */ "./src/diagrams/pie/styles.js"); /* harmony import */ var _diagrams_requirement_styles__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./diagrams/requirement/styles */ "./src/diagrams/requirement/styles.js"); /* harmony import */ var _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./diagrams/sequence/styles */ "./src/diagrams/sequence/styles.js"); /* harmony import */ var _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./diagrams/state/styles */ "./src/diagrams/state/styles.js"); /* harmony import */ var _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./diagrams/user-journey/styles */ "./src/diagrams/user-journey/styles.js"); /* harmony import */ var _diagrams_c4_styles__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./diagrams/c4/styles */ "./src/diagrams/c4/styles.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./logger */ "./src/logger.js"); var themes = { flowchart: _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__["default"], 'flowchart-v2': _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__["default"], sequence: _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_1__["default"], gantt: _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_2__["default"], classDiagram: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"], 'classDiagram-v2': _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"], class: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"], stateDiagram: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__["default"], state: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__["default"], gitGraph: _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_5__["default"], info: _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_6__["default"], pie: _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_7__["default"], er: _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_8__["default"], journey: _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__["default"], requirement: _diagrams_requirement_styles__WEBPACK_IMPORTED_MODULE_10__["default"], c4: _diagrams_c4_styles__WEBPACK_IMPORTED_MODULE_11__["default"] }; var calcThemeVariables = function calcThemeVariables(theme, userOverRides) { _logger__WEBPACK_IMPORTED_MODULE_12__.log.info('userOverides', userOverRides); return theme.calcColors(userOverRides); }; var getStyles = function getStyles(type, userStyles, options) { 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 stroke: ").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"); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles); /***/ }), /***/ "./src/themes/index.js": /*!*****************************!*\ !*** ./src/themes/index.js ***! \*****************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _theme_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./theme-base */ "./src/themes/theme-base.js"); /* harmony import */ var _theme_dark__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-dark */ "./src/themes/theme-dark.js"); /* harmony import */ var _theme_default__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./theme-default */ "./src/themes/theme-default.js"); /* harmony import */ var _theme_forest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./theme-forest */ "./src/themes/theme-forest.js"); /* harmony import */ var _theme_neutral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./theme-neutral */ "./src/themes/theme-neutral.js"); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ base: { getThemeVariables: _theme_base__WEBPACK_IMPORTED_MODULE_0__.getThemeVariables }, dark: { getThemeVariables: _theme_dark__WEBPACK_IMPORTED_MODULE_1__.getThemeVariables }, default: { getThemeVariables: _theme_default__WEBPACK_IMPORTED_MODULE_2__.getThemeVariables }, forest: { getThemeVariables: _theme_forest__WEBPACK_IMPORTED_MODULE_3__.getThemeVariables }, neutral: { getThemeVariables: _theme_neutral__WEBPACK_IMPORTED_MODULE_4__.getThemeVariables } }); /***/ }), /***/ "./src/themes/theme-base.js": /*!**********************************!*\ !*** ./src/themes/theme-base.js ***! \**********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables) /* harmony export */ }); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/adjust.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/invert.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/darken.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/lighten.js"); /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js"); function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } var Theme = /*#__PURE__*/function () { function Theme() { _classCallCheck(this, Theme); /** # Base variables */ /** * - Background - used to know what the background color is of the diagram. This is used for * deducing colors for instance line color. Default value is #f4f4f4. */ this.background = '#f4f4f4'; this.darkMode = false; this.primaryColor = '#fff4dd'; this.noteBkgColor = '#fff5ad'; this.noteTextColor = '#333'; // dark this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif'; this.fontSize = '16px'; } _createClass(Theme, [{ key: "updateColors", value: function updateColors() { // The || is to make sure that if the variable has been defined by a user override that value is to be used /* Main */ this.primaryTextColor = this.primaryTextColor || (this.darkMode ? '#eee' : '#333'); // invert(this.primaryColor); this.secondaryColor = this.secondaryColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -120 }); this.tertiaryColor = this.tertiaryColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: 180, l: 5 }); this.primaryBorderColor = this.primaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode); this.secondaryBorderColor = this.secondaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode); this.tertiaryBorderColor = this.tertiaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode); this.noteBorderColor = this.noteBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.noteBkgColor, this.darkMode); this.noteBkgColor = this.noteBkgColor || '#fff5ad'; this.noteTextColor = this.noteTextColor || '#333'; this.secondaryTextColor = this.secondaryTextColor || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.secondaryColor); this.tertiaryTextColor = this.tertiaryTextColor || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.tertiaryColor); this.lineColor = this.lineColor || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.background); this.textColor = this.textColor || this.primaryTextColor; /* Flowchart variables */ this.nodeBkg = this.nodeBkg || this.primaryColor; this.mainBkg = this.mainBkg || this.primaryColor; this.nodeBorder = this.nodeBorder || this.primaryBorderColor; this.clusterBkg = this.clusterBkg || this.tertiaryColor; this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor; this.defaultLinkColor = this.defaultLinkColor || this.lineColor; this.titleColor = this.titleColor || this.tertiaryTextColor; this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.secondaryColor, 30) : this.secondaryColor); this.nodeTextColor = this.nodeTextColor || this.primaryTextColor; /* Sequence Diagram variables */ // this.actorBorder = lighten(this.border1, 0.5); this.actorBorder = this.actorBorder || this.primaryBorderColor; this.actorBkg = this.actorBkg || this.mainBkg; this.actorTextColor = this.actorTextColor || this.primaryTextColor; this.actorLineColor = this.actorLineColor || 'grey'; this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg; this.signalColor = this.signalColor || this.textColor; this.signalTextColor = this.signalTextColor || this.textColor; this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder; this.labelTextColor = this.labelTextColor || this.actorTextColor; this.loopTextColor = this.loopTextColor || this.actorTextColor; this.activationBorderColor = this.activationBorderColor || (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.secondaryColor, 10); this.activationBkgColor = this.activationBkgColor || this.secondaryColor; this.sequenceNumberColor = this.sequenceNumberColor || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.lineColor); /* Gantt chart variables */ this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor; this.altSectionBkgColor = this.altSectionBkgColor || 'white'; this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor; this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor; this.excludeBkgColor = this.excludeBkgColor || '#eeeeee'; this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor; this.taskBkgColor = this.taskBkgColor || this.primaryColor; this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor; this.activeTaskBkgColor = this.activeTaskBkgColor || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, 23); this.gridColor = this.gridColor || 'lightgrey'; this.doneTaskBkgColor = this.doneTaskBkgColor || 'lightgrey'; this.doneTaskBorderColor = this.doneTaskBorderColor || 'grey'; this.critBorderColor = this.critBorderColor || '#ff8888'; this.critBkgColor = this.critBkgColor || 'red'; this.todayLineColor = this.todayLineColor || 'red'; this.taskTextColor = this.taskTextColor || this.textColor; this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor; this.taskTextLightColor = this.taskTextLightColor || this.textColor; this.taskTextColor = this.taskTextColor || this.primaryTextColor; this.taskTextDarkColor = this.taskTextDarkColor || this.textColor; this.taskTextClickableColor = this.taskTextClickableColor || '#003163'; /* Sequence Diagram variables */ this.personBorder = this.personBorder || this.primaryBorderColor; this.personBkg = this.personBkg || this.mainBkg; /* state colors */ this.transitionColor = this.transitionColor || this.lineColor; this.transitionLabelColor = this.transitionLabelColor || this.textColor; /* The color of the text tables of the states*/ this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; this.stateBkg = this.stateBkg || this.mainBkg; this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; this.altBackground = this.altBackground || this.tertiaryColor; this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; this.compositeBorder = this.compositeBorder || this.nodeBorder; this.innerEndBackground = this.nodeBorder; this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; this.transitionColor = this.transitionColor || this.lineColor; this.specialStateColor = this.lineColor; /* class */ this.classText = this.classText || this.textColor; /* user-journey */ this.fillType0 = this.fillType0 || this.primaryColor; this.fillType1 = this.fillType1 || this.secondaryColor; this.fillType2 = this.fillType2 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: 64 }); this.fillType3 = this.fillType3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.secondaryColor, { h: 64 }); this.fillType4 = this.fillType4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -64 }); this.fillType5 = this.fillType5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.secondaryColor, { h: -64 }); this.fillType6 = this.fillType6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: 128 }); this.fillType7 = this.fillType7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.secondaryColor, { h: 128 }); /* pie */ this.pie1 = this.pie1 || this.primaryColor; this.pie2 = this.pie2 || this.secondaryColor; this.pie3 = this.pie3 || this.tertiaryColor; this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { l: -10 }); this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.secondaryColor, { l: -10 }); this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.tertiaryColor, { l: -10 }); this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: +60, l: -10 }); this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -60, l: -10 }); this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: 120, l: 0 }); this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: +60, l: -20 }); this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -60, l: -20 }); this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: 120, l: -10 }); this.pieTitleTextSize = this.pieTitleTextSize || '25px'; this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; this.pieSectionTextSize = this.pieSectionTextSize || '17px'; this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; this.pieLegendTextSize = this.pieLegendTextSize || '17px'; this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; this.pieStrokeColor = this.pieStrokeColor || 'black'; this.pieStrokeWidth = this.pieStrokeWidth || '2px'; this.pieOpacity = this.pieOpacity || '0.7'; /* requirement-diagram */ this.requirementBackground = this.requirementBackground || this.primaryColor; this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor; this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; this.relationColor = this.relationColor || this.lineColor; this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.secondaryColor, 30) : this.secondaryColor); this.relationLabelColor = this.relationLabelColor || this.actorTextColor; /* git */ this.git0 = this.git0 || this.primaryColor; this.git1 = this.git1 || this.secondaryColor; this.git2 = this.git2 || this.tertiaryColor; this.git3 = this.git3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -30 }); this.git4 = this.git4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -60 }); this.git5 = this.git5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -90 }); this.git6 = this.git6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: +60 }); this.git7 = this.git7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: +120 }); if (this.darkMode) { this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git0, 25); this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git1, 25); this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git2, 25); this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git3, 25); this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git4, 25); this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git5, 25); this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git6, 25); this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git7, 25); } else { this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git0, 25); this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git1, 25); this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git2, 25); this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git3, 25); this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git4, 25); this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git5, 25); this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git6, 25); this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git7, 25); } this.gitInv0 = this.gitInv0 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git0); this.gitInv1 = this.gitInv1 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git1); this.gitInv2 = this.gitInv2 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git2); this.gitInv3 = this.gitInv3 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git3); this.gitInv4 = this.gitInv4 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git4); this.gitInv5 = this.gitInv5 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git5); this.gitInv6 = this.gitInv6 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git6); this.gitInv7 = this.gitInv7 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git7); this.branchLabelColor = this.branchLabelColor || (this.darkMode ? 'black' : this.labelTextColor); this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor; this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor; this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor; this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor; this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor; this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor; this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor; this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor; this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; this.tagLabelFontSize = this.tagLabelFontSize || '10px'; this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; this.commitLabelFontSize = this.commitLabelFontSize || '10px'; } }, { key: "calculate", value: function calculate(overrides) { var _this = this; if (_typeof(overrides) !== 'object') { // Calculate colors form base colors this.updateColors(); return; } var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors keys.forEach(function (k) { _this[k] = overrides[k]; }); // Calculate colors form base colors this.updateColors(); // Copy values from overrides again in case of an override of derived value keys.forEach(function (k) { _this[k] = overrides[k]; }); } }]); return Theme; }(); var getThemeVariables = function getThemeVariables(userOverrides) { var theme = new Theme(); theme.calculate(userOverrides); return theme; }; /***/ }), /***/ "./src/themes/theme-dark.js": /*!**********************************!*\ !*** ./src/themes/theme-dark.js ***! \**********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables) /* harmony export */ }); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/lighten.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/adjust.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/invert.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/rgba.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/darken.js"); /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js"); function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } var Theme = /*#__PURE__*/function () { function Theme() { _classCallCheck(this, Theme); this.background = '#333'; this.primaryColor = '#1f2020'; this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, 16); this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: -160 }); this.primaryBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.background); this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_3__.mkBorder)(this.secondaryColor, this.darkMode); this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_3__.mkBorder)(this.tertiaryColor, this.darkMode); this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.primaryColor); this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.secondaryColor); this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.tertiaryColor); this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.background); this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.background); this.mainBkg = '#1f2020'; this.secondBkg = 'calculated'; this.mainContrastColor = 'lightgrey'; this.darkTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])((0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])('#323D47'), 10); this.lineColor = 'calculated'; this.border1 = '#81B1DB'; this.border2 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(255, 255, 255, 0.25); this.arrowheadColor = 'calculated'; this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif'; this.fontSize = '16px'; this.labelBackground = '#181818'; this.textColor = '#ccc'; /* Flowchart variables */ this.nodeBkg = 'calculated'; this.nodeBorder = 'calculated'; this.clusterBkg = 'calculated'; this.clusterBorder = 'calculated'; this.defaultLinkColor = 'calculated'; this.titleColor = '#F9FFFE'; this.edgeLabelBackground = 'calculated'; /* Sequence Diagram variables */ this.actorBorder = 'calculated'; this.actorBkg = 'calculated'; this.actorTextColor = 'calculated'; this.actorLineColor = 'calculated'; this.signalColor = 'calculated'; this.signalTextColor = 'calculated'; this.labelBoxBkgColor = 'calculated'; this.labelBoxBorderColor = 'calculated'; this.labelTextColor = 'calculated'; this.loopTextColor = 'calculated'; this.noteBorderColor = 'calculated'; this.noteBkgColor = '#fff5ad'; this.noteTextColor = 'calculated'; this.activationBorderColor = 'calculated'; this.activationBkgColor = 'calculated'; this.sequenceNumberColor = 'black'; /* Gantt chart variables */ this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_5__["default"])('#EAE8D9', 30); this.altSectionBkgColor = 'calculated'; this.sectionBkgColor2 = '#EAE8D9'; this.taskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(255, 255, 255, 70); this.taskBkgColor = 'calculated'; this.taskTextColor = 'calculated'; this.taskTextLightColor = 'calculated'; this.taskTextOutsideColor = 'calculated'; this.taskTextClickableColor = '#003163'; this.activeTaskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(255, 255, 255, 50); this.activeTaskBkgColor = '#81B1DB'; this.gridColor = 'calculated'; this.doneTaskBkgColor = 'calculated'; this.doneTaskBorderColor = 'grey'; this.critBorderColor = '#E83737'; this.critBkgColor = '#E83737'; this.taskTextDarkColor = 'calculated'; this.todayLineColor = '#DB5757'; /* C4 Context Diagram variables */ this.personBorder = 'calculated'; this.personBkg = 'calculated'; /* state colors */ this.labelColor = 'calculated'; this.errorBkgColor = '#a44141'; this.errorTextColor = '#ddd'; } _createClass(Theme, [{ key: "updateColors", value: function updateColors() { this.secondBkg = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.mainBkg, 16); this.lineColor = this.mainContrastColor; this.arrowheadColor = this.mainContrastColor; /* Flowchart variables */ this.nodeBkg = this.mainBkg; this.nodeBorder = this.border1; this.clusterBkg = this.secondBkg; this.clusterBorder = this.border2; this.defaultLinkColor = this.lineColor; this.edgeLabelBackground = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.labelBackground, 25); /* Sequence Diagram variables */ this.actorBorder = this.border1; this.actorBkg = this.mainBkg; this.actorTextColor = this.mainContrastColor; this.actorLineColor = this.mainContrastColor; this.signalColor = this.mainContrastColor; this.signalTextColor = this.mainContrastColor; this.labelBoxBkgColor = this.actorBkg; this.labelBoxBorderColor = this.actorBorder; this.labelTextColor = this.mainContrastColor; this.loopTextColor = this.mainContrastColor; this.noteBorderColor = this.secondaryBorderColor; this.noteBkgColor = this.secondBkg; this.noteTextColor = this.secondaryTextColor; this.activationBorderColor = this.border1; this.activationBkgColor = this.secondBkg; /* Gantt chart variables */ this.altSectionBkgColor = this.background; this.taskBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.mainBkg, 23); this.taskTextColor = this.darkTextColor; this.taskTextLightColor = this.mainContrastColor; this.taskTextOutsideColor = this.taskTextLightColor; this.gridColor = this.mainContrastColor; this.doneTaskBkgColor = this.mainContrastColor; this.taskTextDarkColor = this.darkTextColor; /* state colors */ this.transitionColor = this.transitionColor || this.lineColor; this.transitionLabelColor = this.transitionLabelColor || this.textColor; this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; this.stateBkg = this.stateBkg || this.mainBkg; this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; this.altBackground = this.altBackground || '#555'; this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; this.compositeBorder = this.compositeBorder || this.nodeBorder; this.innerEndBackground = this.primaryBorderColor; this.specialStateColor = '#f4f4f4'; // this.lineColor; this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; this.fillType0 = this.primaryColor; this.fillType1 = this.secondaryColor; this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: 64 }); this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.secondaryColor, { h: 64 }); this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: -64 }); this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.secondaryColor, { h: -64 }); this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: 128 }); this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.secondaryColor, { h: 128 }); /* pie */ this.pie1 = this.pie1 || '#0b0000'; this.pie2 = this.pie2 || '#4d1037'; this.pie3 = this.pie3 || '#3f5258'; this.pie4 = this.pie4 || '#4f2f1b'; this.pie5 = this.pie5 || '#6e0a0a'; this.pie6 = this.pie6 || '#3b0048'; this.pie7 = this.pie7 || '#995a01'; this.pie8 = this.pie8 || '#154706'; this.pie9 = this.pie9 || '#161722'; this.pie10 = this.pie10 || '#00296f'; this.pie11 = this.pie11 || '#01629c'; this.pie12 = this.pie12 || '#010029'; this.pieTitleTextSize = this.pieTitleTextSize || '25px'; this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; this.pieSectionTextSize = this.pieSectionTextSize || '17px'; this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; this.pieLegendTextSize = this.pieLegendTextSize || '17px'; this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; this.pieStrokeColor = this.pieStrokeColor || 'black'; this.pieStrokeWidth = this.pieStrokeWidth || '2px'; this.pieOpacity = this.pieOpacity || '0.7'; /* class */ this.classText = this.primaryTextColor; /* requirement-diagram */ this.requirementBackground = this.requirementBackground || this.primaryColor; this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor; this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; this.relationColor = this.relationColor || this.lineColor; this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_5__["default"])(this.secondaryColor, 30) : this.secondaryColor); this.relationLabelColor = this.relationLabelColor || this.actorTextColor; /* git */ this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.secondaryColor, 20); this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.pie2 || this.secondaryColor, 20); this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.pie3 || this.tertiaryColor, 20); this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: -30 }), 20); this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: -60 }), 20); this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: -90 }), 10); this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: +60 }), 10); this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: +120 }), 20); this.gitInv0 = this.gitInv0 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git0); this.gitInv1 = this.gitInv1 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git1); this.gitInv2 = this.gitInv2 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git2); this.gitInv3 = this.gitInv3 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git3); this.gitInv4 = this.gitInv4 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git4); this.gitInv5 = this.gitInv5 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git5); this.gitInv6 = this.gitInv6 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git6); this.gitInv7 = this.gitInv7 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git7); this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; this.tagLabelFontSize = this.tagLabelFontSize || '10px'; this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; this.commitLabelFontSize = this.commitLabelFontSize || '10px'; } }, { key: "calculate", value: function calculate(overrides) { var _this = this; if (_typeof(overrides) !== 'object') { // Calculate colors form base colors this.updateColors(); return; } var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors keys.forEach(function (k) { _this[k] = overrides[k]; }); // Calculate colors form base colors this.updateColors(); // Copy values from overrides again in case of an override of derived value keys.forEach(function (k) { _this[k] = overrides[k]; }); } }]); return Theme; }(); var getThemeVariables = function getThemeVariables(userOverrides) { var theme = new Theme(); theme.calculate(userOverrides); return theme; }; /***/ }), /***/ "./src/themes/theme-default.js": /*!*************************************!*\ !*** ./src/themes/theme-default.js ***! \*************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables) /* harmony export */ }); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/adjust.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/invert.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/rgba.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/lighten.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/darken.js"); /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js"); function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } var Theme = /*#__PURE__*/function () { function Theme() { _classCallCheck(this, Theme); /* Base variables */ this.background = '#f4f4f4'; this.primaryColor = '#ECECFF'; this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: 120 }); this.secondaryColor = '#ffffde'; this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -160 }); this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode); this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode); this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode); this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.primaryColor); this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.secondaryColor); this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.tertiaryColor); this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.background); this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.background); this.background = 'white'; this.mainBkg = '#ECECFF'; this.secondBkg = '#ffffde'; this.lineColor = '#333333'; this.border1 = '#9370DB'; this.border2 = '#aaaa33'; this.arrowheadColor = '#333333'; this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif'; this.fontSize = '16px'; this.labelBackground = '#e8e8e8'; this.textColor = '#333'; /* Flowchart variables */ this.nodeBkg = 'calculated'; this.nodeBorder = 'calculated'; this.clusterBkg = 'calculated'; this.clusterBorder = 'calculated'; this.defaultLinkColor = 'calculated'; this.titleColor = 'calculated'; this.edgeLabelBackground = 'calculated'; /* Sequence Diagram variables */ this.actorBorder = 'calculated'; this.actorBkg = 'calculated'; this.actorTextColor = 'black'; this.actorLineColor = 'grey'; this.signalColor = 'calculated'; this.signalTextColor = 'calculated'; this.labelBoxBkgColor = 'calculated'; this.labelBoxBorderColor = 'calculated'; this.labelTextColor = 'calculated'; this.loopTextColor = 'calculated'; this.noteBorderColor = 'calculated'; this.noteBkgColor = '#fff5ad'; this.noteTextColor = 'calculated'; this.activationBorderColor = '#666'; this.activationBkgColor = '#f4f4f4'; this.sequenceNumberColor = 'white'; /* Gantt chart variables */ this.sectionBkgColor = 'calculated'; this.altSectionBkgColor = 'calculated'; this.sectionBkgColor2 = 'calculated'; this.excludeBkgColor = '#eeeeee'; this.taskBorderColor = 'calculated'; this.taskBkgColor = 'calculated'; this.taskTextLightColor = 'calculated'; this.taskTextColor = this.taskTextLightColor; this.taskTextDarkColor = 'calculated'; this.taskTextOutsideColor = this.taskTextDarkColor; this.taskTextClickableColor = 'calculated'; this.activeTaskBorderColor = 'calculated'; this.activeTaskBkgColor = 'calculated'; this.gridColor = 'calculated'; this.doneTaskBkgColor = 'calculated'; this.doneTaskBorderColor = 'calculated'; this.critBorderColor = 'calculated'; this.critBkgColor = 'calculated'; this.todayLineColor = 'calculated'; this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(102, 102, 255, 0.49); this.altSectionBkgColor = 'white'; this.sectionBkgColor2 = '#fff400'; this.taskBorderColor = '#534fbc'; this.taskBkgColor = '#8a90dd'; this.taskTextLightColor = 'white'; this.taskTextColor = 'calculated'; this.taskTextDarkColor = 'black'; this.taskTextOutsideColor = 'calculated'; this.taskTextClickableColor = '#003163'; this.activeTaskBorderColor = '#534fbc'; this.activeTaskBkgColor = '#bfc7ff'; this.gridColor = 'lightgrey'; this.doneTaskBkgColor = 'lightgrey'; this.doneTaskBorderColor = 'grey'; this.critBorderColor = '#ff8888'; this.critBkgColor = 'red'; this.todayLineColor = 'red'; /* C4 Context Diagram variables */ this.personBorder = 'calculated'; this.personBkg = 'calculated'; /* state colors */ this.labelColor = 'black'; this.errorBkgColor = '#552222'; this.errorTextColor = '#552222'; this.updateColors(); } _createClass(Theme, [{ key: "updateColors", value: function updateColors() { /* Flowchart variables */ this.nodeBkg = this.mainBkg; this.nodeBorder = this.border1; // border 1 this.clusterBkg = this.secondBkg; this.clusterBorder = this.border2; this.defaultLinkColor = this.lineColor; this.titleColor = this.textColor; this.edgeLabelBackground = this.labelBackground; /* Sequence Diagram variables */ // this.actorBorder = lighten(this.border1, 0.5); this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.border1, 23); this.actorBkg = this.mainBkg; this.labelBoxBkgColor = this.actorBkg; this.signalColor = this.textColor; this.signalTextColor = this.textColor; this.labelBoxBorderColor = this.actorBorder; this.labelTextColor = this.actorTextColor; this.loopTextColor = this.actorTextColor; this.noteBorderColor = this.border2; this.noteTextColor = this.actorTextColor; /* Gantt chart variables */ this.taskTextColor = this.taskTextLightColor; this.taskTextOutsideColor = this.taskTextDarkColor; /* state colors */ this.transitionColor = this.transitionColor || this.lineColor; this.transitionLabelColor = this.transitionLabelColor || this.textColor; this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; this.stateBkg = this.stateBkg || this.mainBkg; this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; this.altBackground = this.altBackground || '#f0f0f0'; this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; this.compositeBorder = this.compositeBorder || this.nodeBorder; this.innerEndBackground = this.nodeBorder; this.specialStateColor = this.lineColor; this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; this.transitionColor = this.transitionColor || this.lineColor; /* class */ this.classText = this.primaryTextColor; /* journey */ this.fillType0 = this.primaryColor; this.fillType1 = this.secondaryColor; this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: 64 }); this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.secondaryColor, { h: 64 }); this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -64 }); this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.secondaryColor, { h: -64 }); this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: 128 }); this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.secondaryColor, { h: 128 }); /* pie */ this.pie1 = this.pie1 || this.primaryColor; this.pie2 = this.pie2 || this.secondaryColor; this.pie3 = this.pie3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.tertiaryColor, { l: -40 }); this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { l: -10 }); this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.secondaryColor, { l: -30 }); this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.tertiaryColor, { l: -20 }); this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: +60, l: -20 }); this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -60, l: -40 }); this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: 120, l: -40 }); this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: +60, l: -40 }); this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -90, l: -40 }); this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: 120, l: -30 }); this.pieTitleTextSize = this.pieTitleTextSize || '25px'; this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; this.pieSectionTextSize = this.pieSectionTextSize || '17px'; this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; this.pieLegendTextSize = this.pieLegendTextSize || '17px'; this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; this.pieStrokeColor = this.pieStrokeColor || 'black'; this.pieStrokeWidth = this.pieStrokeWidth || '2px'; this.pieOpacity = this.pieOpacity || '0.7'; /* requirement-diagram */ this.requirementBackground = this.requirementBackground || this.primaryColor; this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor; this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; this.relationColor = this.relationColor || this.lineColor; this.relationLabelBackground = this.relationLabelBackground || this.labelBackground; this.relationLabelColor = this.relationLabelColor || this.actorTextColor; /* git */ this.git0 = this.git0 || this.primaryColor; this.git1 = this.git1 || this.secondaryColor; this.git2 = this.git2 || this.tertiaryColor; this.git3 = this.git3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -30 }); this.git4 = this.git4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -60 }); this.git5 = this.git5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: -90 }); this.git6 = this.git6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: +60 }); this.git7 = this.git7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.primaryColor, { h: +120 }); if (this.darkMode) { this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git0, 25); this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git1, 25); this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git2, 25); this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git3, 25); this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git4, 25); this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git5, 25); this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git6, 25); this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.git7, 25); } else { this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_5__["default"])(this.git0, 25); this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_5__["default"])(this.git1, 25); this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_5__["default"])(this.git2, 25); this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_5__["default"])(this.git3, 25); this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_5__["default"])(this.git4, 25); this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_5__["default"])(this.git5, 25); this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_5__["default"])(this.git6, 25); this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_5__["default"])(this.git7, 25); } this.gitInv0 = this.gitInv0 || (0,khroma__WEBPACK_IMPORTED_MODULE_5__["default"])((0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git0), 25); this.gitInv1 = this.gitInv1 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git1); this.gitInv2 = this.gitInv2 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git2); this.gitInv3 = this.gitInv3 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git3); this.gitInv4 = this.gitInv4 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git4); this.gitInv5 = this.gitInv5 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git5); this.gitInv6 = this.gitInv6 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git6); this.gitInv7 = this.gitInv7 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git7); this.gitBranchLabel0 = this.gitBranchLabel0 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.labelTextColor); this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor; this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor; this.gitBranchLabel3 = this.gitBranchLabel3 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.labelTextColor); this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor; this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor; this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor; this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor; this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; this.tagLabelFontSize = this.tagLabelFontSize || '10px'; this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; this.commitLabelFontSize = this.commitLabelFontSize || '10px'; } }, { key: "calculate", value: function calculate(overrides) { var _this = this; if (_typeof(overrides) !== 'object') { // Calculate colors form base colors this.updateColors(); return; } var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors keys.forEach(function (k) { _this[k] = overrides[k]; }); // Calculate colors form base colors this.updateColors(); // Copy values from overrides again in case of an override of derived value keys.forEach(function (k) { _this[k] = overrides[k]; }); } }]); return Theme; }(); var getThemeVariables = function getThemeVariables(userOverrides) { var theme = new Theme(); theme.calculate(userOverrides); return theme; }; /***/ }), /***/ "./src/themes/theme-forest.js": /*!************************************!*\ !*** ./src/themes/theme-forest.js ***! \************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables) /* harmony export */ }); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/lighten.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/invert.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/darken.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/adjust.js"); /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js"); function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } var Theme = /*#__PURE__*/function () { function Theme() { _classCallCheck(this, Theme); /* Base vales */ this.background = '#f4f4f4'; this.primaryColor = '#cde498'; this.secondaryColor = '#cdffb2'; this.background = 'white'; this.mainBkg = '#cde498'; this.secondBkg = '#cdffb2'; this.lineColor = 'green'; this.border1 = '#13540c'; this.border2 = '#6eaa49'; this.arrowheadColor = 'green'; this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif'; this.fontSize = '16px'; this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])('#cde498', 10); this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode); this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode); this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode); this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.primaryColor); this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.secondaryColor); this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.primaryColor); this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.background); this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.background); /* Flowchart variables */ this.nodeBkg = 'calculated'; this.nodeBorder = 'calculated'; this.clusterBkg = 'calculated'; this.clusterBorder = 'calculated'; this.defaultLinkColor = 'calculated'; this.titleColor = '#333'; this.edgeLabelBackground = '#e8e8e8'; /* Sequence Diagram variables */ this.actorBorder = 'calculated'; this.actorBkg = 'calculated'; this.actorTextColor = 'black'; this.actorLineColor = 'grey'; this.signalColor = '#333'; this.signalTextColor = '#333'; this.labelBoxBkgColor = 'calculated'; this.labelBoxBorderColor = '#326932'; this.labelTextColor = 'calculated'; this.loopTextColor = 'calculated'; this.noteBorderColor = 'calculated'; this.noteBkgColor = '#fff5ad'; this.noteTextColor = 'calculated'; this.activationBorderColor = '#666'; this.activationBkgColor = '#f4f4f4'; this.sequenceNumberColor = 'white'; /* Gantt chart variables */ this.sectionBkgColor = '#6eaa49'; this.altSectionBkgColor = 'white'; this.sectionBkgColor2 = '#6eaa49'; this.excludeBkgColor = '#eeeeee'; this.taskBorderColor = 'calculated'; this.taskBkgColor = '#487e3a'; this.taskTextLightColor = 'white'; this.taskTextColor = 'calculated'; this.taskTextDarkColor = 'black'; this.taskTextOutsideColor = 'calculated'; this.taskTextClickableColor = '#003163'; this.activeTaskBorderColor = 'calculated'; this.activeTaskBkgColor = 'calculated'; this.gridColor = 'lightgrey'; this.doneTaskBkgColor = 'lightgrey'; this.doneTaskBorderColor = 'grey'; this.critBorderColor = '#ff8888'; this.critBkgColor = 'red'; this.todayLineColor = 'red'; /* C4 Context Diagram variables */ this.personBorder = 'calculated'; this.personBkg = 'calculated'; /* state colors */ this.labelColor = 'black'; this.errorBkgColor = '#552222'; this.errorTextColor = '#552222'; } _createClass(Theme, [{ key: "updateColors", value: function updateColors() { /* Flowchart variables */ this.nodeBkg = this.mainBkg; this.nodeBorder = this.border1; this.clusterBkg = this.secondBkg; this.clusterBorder = this.border2; this.defaultLinkColor = this.lineColor; /* Sequence Diagram variables */ this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.mainBkg, 20); this.actorBkg = this.mainBkg; this.labelBoxBkgColor = this.actorBkg; this.labelTextColor = this.actorTextColor; this.loopTextColor = this.actorTextColor; this.noteBorderColor = this.border2; this.noteTextColor = this.actorTextColor; /* Gantt chart variables */ this.taskBorderColor = this.border1; this.taskTextColor = this.taskTextLightColor; this.taskTextOutsideColor = this.taskTextDarkColor; this.activeTaskBorderColor = this.taskBorderColor; this.activeTaskBkgColor = this.mainBkg; /* state colors */ this.transitionColor = this.transitionColor || this.lineColor; this.transitionLabelColor = this.transitionLabelColor || this.textColor; this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; this.stateBkg = this.stateBkg || this.mainBkg; this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; this.altBackground = this.altBackground || '#f0f0f0'; this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; this.compositeBorder = this.compositeBorder || this.nodeBorder; this.innerEndBackground = this.primaryBorderColor; this.specialStateColor = this.lineColor; this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; this.transitionColor = this.transitionColor || this.lineColor; /* class */ this.classText = this.primaryTextColor; /* journey */ this.fillType0 = this.primaryColor; this.fillType1 = this.secondaryColor; this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: 64 }); this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.secondaryColor, { h: 64 }); this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: -64 }); this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.secondaryColor, { h: -64 }); this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: 128 }); this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.secondaryColor, { h: 128 }); /* pie */ this.pie1 = this.pie1 || this.primaryColor; this.pie2 = this.pie2 || this.secondaryColor; this.pie3 = this.pie3 || this.tertiaryColor; this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { l: -30 }); this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.secondaryColor, { l: -30 }); this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.tertiaryColor, { h: +40, l: -40 }); this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: +60, l: -10 }); this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: -60, l: -10 }); this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: 120, l: 0 }); this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: +60, l: -50 }); this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: -60, l: -50 }); this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: 120, l: -50 }); this.pieTitleTextSize = this.pieTitleTextSize || '25px'; this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; this.pieSectionTextSize = this.pieSectionTextSize || '17px'; this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; this.pieLegendTextSize = this.pieLegendTextSize || '17px'; this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; this.pieStrokeColor = this.pieStrokeColor || 'black'; this.pieStrokeWidth = this.pieStrokeWidth || '2px'; this.pieOpacity = this.pieOpacity || '0.7'; /* requirement-diagram */ this.requirementBackground = this.requirementBackground || this.primaryColor; this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor; this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; this.relationColor = this.relationColor || this.lineColor; this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground; this.relationLabelColor = this.relationLabelColor || this.actorTextColor; /* git */ this.git0 = this.git0 || this.primaryColor; this.git1 = this.git1 || this.secondaryColor; this.git2 = this.git2 || this.tertiaryColor; this.git3 = this.git3 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: -30 }); this.git4 = this.git4 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: -60 }); this.git5 = this.git5 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: -90 }); this.git6 = this.git6 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: +60 }); this.git7 = this.git7 || (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.primaryColor, { h: +120 }); if (this.darkMode) { this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.git0, 25); this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.git1, 25); this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.git2, 25); this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.git3, 25); this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.git4, 25); this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.git5, 25); this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.git6, 25); this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.git7, 25); } else { this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git0, 25); this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git1, 25); this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git2, 25); this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git3, 25); this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git4, 25); this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git5, 25); this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git6, 25); this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git7, 25); } this.gitInv0 = this.gitInv0 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git0); this.gitInv1 = this.gitInv1 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git1); this.gitInv2 = this.gitInv2 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git2); this.gitInv3 = this.gitInv3 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git3); this.gitInv4 = this.gitInv4 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git4); this.gitInv5 = this.gitInv5 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git5); this.gitInv6 = this.gitInv6 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git6); this.gitInv7 = this.gitInv7 || (0,khroma__WEBPACK_IMPORTED_MODULE_2__["default"])(this.git7); this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; this.tagLabelFontSize = this.tagLabelFontSize || '10px'; this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; this.commitLabelFontSize = this.commitLabelFontSize || '10px'; } }, { key: "calculate", value: function calculate(overrides) { var _this = this; if (_typeof(overrides) !== 'object') { // Calculate colors form base colors this.updateColors(); return; } var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors keys.forEach(function (k) { _this[k] = overrides[k]; }); // Calculate colors form base colors this.updateColors(); // Copy values from overrides again in case of an override of derived value keys.forEach(function (k) { _this[k] = overrides[k]; }); } }]); return Theme; }(); var getThemeVariables = function getThemeVariables(userOverrides) { var theme = new Theme(); theme.calculate(userOverrides); return theme; }; /***/ }), /***/ "./src/themes/theme-helpers.js": /*!*************************************!*\ !*** ./src/themes/theme-helpers.js ***! \*************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "mkBorder": () => (/* binding */ mkBorder) /* harmony export */ }); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/adjust.js"); var mkBorder = function mkBorder(col, darkMode) { return darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(col, { s: -40, l: 10 }) : (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(col, { s: -40, l: -10 }); }; /***/ }), /***/ "./src/themes/theme-neutral.js": /*!*************************************!*\ !*** ./src/themes/theme-neutral.js ***! \*************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables) /* harmony export */ }); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/lighten.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/adjust.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/invert.js"); /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! khroma */ "./node_modules/khroma/dist/methods/darken.js"); /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js"); function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } // const Color = require ( 'khroma/dist/color' ).default // Color.format.hex.stringify(Color.parse('hsl(210, 66.6666666667%, 95%)')); // => "#EAF2FB" var Theme = /*#__PURE__*/function () { function Theme() { _classCallCheck(this, Theme); this.primaryColor = '#eee'; this.contrast = '#707070'; this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.contrast, 55); this.background = '#ffffff'; // this.secondaryColor = adjust(this.primaryColor, { h: 120 }); this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: -160 }); this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_2__.mkBorder)(this.primaryColor, this.darkMode); this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_2__.mkBorder)(this.secondaryColor, this.darkMode); this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_2__.mkBorder)(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode); this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.primaryColor); this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.secondaryColor); this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.tertiaryColor); this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.background); this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.background); // this.altBackground = lighten(this.contrast, 55); this.mainBkg = '#eee'; this.secondBkg = 'calculated'; this.lineColor = '#666'; this.border1 = '#999'; this.border2 = 'calculated'; this.note = '#ffa'; this.text = '#333'; this.critical = '#d42'; this.done = '#bbb'; this.arrowheadColor = '#333333'; this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif'; this.fontSize = '16px'; /* Flowchart variables */ this.nodeBkg = 'calculated'; this.nodeBorder = 'calculated'; this.clusterBkg = 'calculated'; this.clusterBorder = 'calculated'; this.defaultLinkColor = 'calculated'; this.titleColor = 'calculated'; this.edgeLabelBackground = 'white'; /* Sequence Diagram variables */ this.actorBorder = 'calculated'; this.actorBkg = 'calculated'; this.actorTextColor = 'calculated'; this.actorLineColor = 'calculated'; this.signalColor = 'calculated'; this.signalTextColor = 'calculated'; this.labelBoxBkgColor = 'calculated'; this.labelBoxBorderColor = 'calculated'; this.labelTextColor = 'calculated'; this.loopTextColor = 'calculated'; this.noteBorderColor = 'calculated'; this.noteBkgColor = 'calculated'; this.noteTextColor = 'calculated'; this.activationBorderColor = '#666'; this.activationBkgColor = '#f4f4f4'; this.sequenceNumberColor = 'white'; /* Gantt chart variables */ this.sectionBkgColor = 'calculated'; this.altSectionBkgColor = 'white'; this.sectionBkgColor2 = 'calculated'; this.excludeBkgColor = '#eeeeee'; this.taskBorderColor = 'calculated'; this.taskBkgColor = 'calculated'; this.taskTextLightColor = 'white'; this.taskTextColor = 'calculated'; this.taskTextDarkColor = 'calculated'; this.taskTextOutsideColor = 'calculated'; this.taskTextClickableColor = '#003163'; this.activeTaskBorderColor = 'calculated'; this.activeTaskBkgColor = 'calculated'; this.gridColor = 'calculated'; this.doneTaskBkgColor = 'calculated'; this.doneTaskBorderColor = 'calculated'; this.critBkgColor = 'calculated'; this.critBorderColor = 'calculated'; this.todayLineColor = 'calculated'; /* C4 Context Diagram variables */ this.personBorder = 'calculated'; this.personBkg = 'calculated'; /* state colors */ this.labelColor = 'black'; this.errorBkgColor = '#552222'; this.errorTextColor = '#552222'; } _createClass(Theme, [{ key: "updateColors", value: function updateColors() { this.secondBkg = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.contrast, 55); this.border2 = this.contrast; /* Flowchart variables */ this.nodeBkg = this.mainBkg; this.nodeBorder = this.border1; this.clusterBkg = this.secondBkg; this.clusterBorder = this.border2; this.defaultLinkColor = this.lineColor; this.titleColor = this.text; /* Sequence Diagram variables */ this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.border1, 23); this.actorBkg = this.mainBkg; this.actorTextColor = this.text; this.actorLineColor = this.lineColor; this.signalColor = this.text; this.signalTextColor = this.text; this.labelBoxBkgColor = this.actorBkg; this.labelBoxBorderColor = this.actorBorder; this.labelTextColor = this.text; this.loopTextColor = this.text; this.noteBorderColor = '#999'; this.noteBkgColor = '#666'; this.noteTextColor = '#fff'; /* Gantt chart variables */ this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.contrast, 30); this.sectionBkgColor2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.contrast, 30); this.taskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.contrast, 10); this.taskBkgColor = this.contrast; this.taskTextColor = this.taskTextLightColor; this.taskTextDarkColor = this.text; this.taskTextOutsideColor = this.taskTextDarkColor; this.activeTaskBorderColor = this.taskBorderColor; this.activeTaskBkgColor = this.mainBkg; this.gridColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__["default"])(this.border1, 30); this.doneTaskBkgColor = this.done; this.doneTaskBorderColor = this.lineColor; this.critBkgColor = this.critical; this.critBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.critBkgColor, 10); this.todayLineColor = this.critBkgColor; /* state colors */ this.transitionColor = this.transitionColor || '#000'; this.transitionLabelColor = this.transitionLabelColor || this.textColor; this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; this.stateBkg = this.stateBkg || this.mainBkg; this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; this.altBackground = this.altBackground || '#f4f4f4'; this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; this.stateBorder = this.stateBorder || '#000'; this.innerEndBackground = this.primaryBorderColor; this.specialStateColor = '#222'; this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; /* class */ this.classText = this.primaryTextColor; /* journey */ this.fillType0 = this.primaryColor; this.fillType1 = this.secondaryColor; this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: 64 }); this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.secondaryColor, { h: 64 }); this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: -64 }); this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.secondaryColor, { h: -64 }); this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: 128 }); this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.secondaryColor, { h: 128 }); // /* pie */ this.pie1 = this.pie1 || '#F4F4F4'; this.pie2 = this.pie2 || '#555'; this.pie3 = this.pie3 || '#BBB'; this.pie4 = this.pie4 || '#777'; this.pie5 = this.pie5 || '#999'; this.pie6 = this.pie6 || '#DDD'; this.pie7 = this.pie7 || '#FFF'; this.pie8 = this.pie8 || '#DDD'; this.pie9 = this.pie9 || '#BBB'; this.pie10 = this.pie10 || '#999'; this.pie11 = this.pie11 || '#777'; this.pie12 = this.pie12 || '#555'; this.pieTitleTextSize = this.pieTitleTextSize || '25px'; this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; this.pieSectionTextSize = this.pieSectionTextSize || '17px'; this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; this.pieLegendTextSize = this.pieLegendTextSize || '17px'; this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; this.pieStrokeColor = this.pieStrokeColor || 'black'; this.pieStrokeWidth = this.pieStrokeWidth || '2px'; this.pieOpacity = this.pieOpacity || '0.7'; // this.pie1 = this.pie1 || '#212529'; // this.pie2 = this.pie2 || '#343A40'; // this.pie3 = this.pie3 || '#495057'; // this.pie4 = this.pie4 || '#6C757D'; // this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -10 }); // this.pie6 = this.pie6 || adjust(this.tertiaryColor, { l: -10 }); // this.pie7 = this.pie7 || adjust(this.primaryColor, { h: +60, l: -10 }); // this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -10 }); // this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: 0 }); // this.pie10 = this.pie10 || adjust(this.primaryColor, { h: +60, l: -20 }); // this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -60, l: -20 }); // this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -10 }); /* requirement-diagram */ this.requirementBackground = this.requirementBackground || this.primaryColor; this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor; this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; this.relationColor = this.relationColor || this.lineColor; this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground; this.relationLabelColor = this.relationLabelColor || this.actorTextColor; /* git */ this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_4__["default"])(this.pie1, 25) || this.primaryColor; this.git1 = this.pie2 || this.secondaryColor; this.git2 = this.pie3 || this.tertiaryColor; this.git3 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: -30 }); this.git4 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: -60 }); this.git5 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: -90 }); this.git6 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: +60 }); this.git7 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_1__["default"])(this.primaryColor, { h: +120 }); this.gitInv0 = this.gitInv0 || (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git0); this.gitInv1 = this.gitInv1 || (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git1); this.gitInv2 = this.gitInv2 || (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git2); this.gitInv3 = this.gitInv3 || (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git3); this.gitInv4 = this.gitInv4 || (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git4); this.gitInv5 = this.gitInv5 || (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git5); this.gitInv6 = this.gitInv6 || (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git6); this.gitInv7 = this.gitInv7 || (0,khroma__WEBPACK_IMPORTED_MODULE_3__["default"])(this.git7); this.branchLabelColor = this.branchLabelColor || this.labelTextColor; this.gitBranchLabel0 = this.branchLabelColor; this.gitBranchLabel1 = 'white'; this.gitBranchLabel2 = this.branchLabelColor; this.gitBranchLabel3 = 'white'; this.gitBranchLabel4 = this.branchLabelColor; this.gitBranchLabel5 = this.branchLabelColor; this.gitBranchLabel6 = this.branchLabelColor; this.gitBranchLabel7 = this.branchLabelColor; this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; this.tagLabelFontSize = this.tagLabelFontSize || '10px'; this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; this.commitLabelFontSize = this.commitLabelFontSize || '10px'; } }, { key: "calculate", value: function calculate(overrides) { var _this = this; if (_typeof(overrides) !== 'object') { // Calculate colors form base colors this.updateColors(); return; } var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors keys.forEach(function (k) { _this[k] = overrides[k]; }); // Calculate colors form base colors this.updateColors(); // Copy values from overrides again in case of an override of derived value keys.forEach(function (k) { _this[k] = overrides[k]; }); } }]); return Theme; }(); var getThemeVariables = function getThemeVariables(userOverrides) { var theme = new Theme(); theme.calculate(userOverrides); return theme; }; /***/ }), /***/ "./src/utils.js": /*!**********************!*\ !*** ./src/utils.js ***! \**********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "assignWithDepth": () => (/* binding */ assignWithDepth), /* harmony export */ "calculateSvgSizeAttrs": () => (/* binding */ calculateSvgSizeAttrs), /* harmony export */ "calculateTextDimensions": () => (/* binding */ calculateTextDimensions), /* harmony export */ "calculateTextHeight": () => (/* binding */ calculateTextHeight), /* harmony export */ "calculateTextWidth": () => (/* binding */ calculateTextWidth), /* harmony export */ "configureSvgSize": () => (/* binding */ configureSvgSize), /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ "detectDirective": () => (/* binding */ detectDirective), /* harmony export */ "detectInit": () => (/* binding */ detectInit), /* harmony export */ "detectType": () => (/* binding */ detectType), /* harmony export */ "directiveSanitizer": () => (/* binding */ directiveSanitizer), /* harmony export */ "drawSimpleText": () => (/* binding */ drawSimpleText), /* harmony export */ "entityDecode": () => (/* binding */ entityDecode), /* harmony export */ "formatUrl": () => (/* binding */ formatUrl), /* harmony export */ "generateId": () => (/* binding */ generateId), /* harmony export */ "getStylesFromArray": () => (/* binding */ getStylesFromArray), /* harmony export */ "getTextObj": () => (/* binding */ getTextObj), /* harmony export */ "initIdGenerator": () => (/* binding */ initIdGenerator), /* harmony export */ "interpolateToCurve": () => (/* binding */ interpolateToCurve), /* harmony export */ "isSubstringInArray": () => (/* binding */ isSubstringInArray), /* harmony export */ "random": () => (/* binding */ random), /* harmony export */ "runFunc": () => (/* binding */ runFunc), /* harmony export */ "sanitizeCss": () => (/* binding */ sanitizeCss), /* harmony export */ "setupGraphViewbox": () => (/* binding */ setupGraphViewbox), /* harmony export */ "wrapLabel": () => (/* binding */ wrapLabel) /* harmony export */ }); /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @braintree/sanitize-url */ "./node_modules/@braintree/sanitize-url/dist/index.js"); /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagrams/common/common */ "./src/diagrams/common/common.js"); /* harmony import */ var _defaultConfig__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./defaultConfig */ "./src/defaultConfig.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger */ "./src/logger.js"); var _this = undefined; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } // Effectively an enum of the supported curve types, accessible by name var d3CurveTypes = { curveBasis: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasis, curveBasisClosed: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasisClosed, curveBasisOpen: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasisOpen, curveLinear: d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear, curveLinearClosed: d3__WEBPACK_IMPORTED_MODULE_1__.curveLinearClosed, curveMonotoneX: d3__WEBPACK_IMPORTED_MODULE_1__.curveMonotoneX, curveMonotoneY: d3__WEBPACK_IMPORTED_MODULE_1__.curveMonotoneY, curveNatural: d3__WEBPACK_IMPORTED_MODULE_1__.curveNatural, curveStep: d3__WEBPACK_IMPORTED_MODULE_1__.curveStep, curveStepAfter: d3__WEBPACK_IMPORTED_MODULE_1__.curveStepAfter, curveStepBefore: d3__WEBPACK_IMPORTED_MODULE_1__.curveStepBefore }; var directive = /[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi; var directiveWithoutOpen = /\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi; var anyComment = /\s*%%.*\n/gm; /** * @function detectInit Detects the init config object from the text * * ```mermaid * %%{init: {"theme": "debug", "logLevel": 1 }}%% * graph LR * a-->b * b-->c * c-->d * d-->e * e-->f * f-->g * g-->h * ``` * * Or * * ```mermaid * %%{initialize: {"theme": "dark", logLevel: "debug" }}%% * graph LR * a-->b * b-->c * c-->d * d-->e * e-->f * f-->g * g-->h * ``` * @param {string} text The text defining the graph * @param {any} cnf * @returns {object} The json object representing the init passed to mermaid.initialize() */ var detectInit = function detectInit(text, cnf) { var inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/); var results = {}; if (Array.isArray(inits)) { var args = inits.map(function (init) { return init.args; }); directiveSanitizer(args); results = assignWithDepth(results, _toConsumableArray(args)); } else { results = inits.args; } if (results) { var type = detectType(text, cnf); ['config'].forEach(function (prop) { if (typeof results[prop] !== 'undefined') { if (type === 'flowchart-v2') { type = 'flowchart'; } results[type] = results[prop]; delete results[prop]; } }); } // Todo: refactor this, these results are never used return results; }; /** * @function detectDirective Detects the directive from the text. Text can be single line or * multiline. If type is null or omitted the first directive encountered in text will be returned * * ```mermaid * graph LR * %%{somedirective}%% * a-->b * b-->c * c-->d * d-->e * e-->f * f-->g * g-->h * ``` * @param {string} text The text defining the graph * @param {string | RegExp} type The directive to return (default: null) * @returns {object | Array} An object or Array representing the directive(s): { type: string, args: * object|null } matched by the input type if a single directive was found, that directive object * will be returned. */ var detectDirective = function detectDirective(text) { var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; try { var commentWithoutDirectives = new RegExp("[%]{2}(?![{]".concat(directiveWithoutOpen.source, ")(?=[}][%]{2}).*\n"), 'ig'); text = text.trim().replace(commentWithoutDirectives, '').replace(/'/gm, '"'); _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug("Detecting diagram directive".concat(type !== null ? ' type:' + type : '', " based on the text:").concat(text)); var match, result = []; while ((match = directive.exec(text)) !== null) { // This is necessary to avoid infinite loops with zero-width matches if (match.index === directive.lastIndex) { directive.lastIndex++; } if (match && !type || type && match[1] && match[1].match(type) || type && match[2] && match[2].match(type)) { var _type = match[1] ? match[1] : match[2]; var args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null; result.push({ type: _type, args: args }); } } if (result.length === 0) { result.push({ type: text, args: null }); } return result.length === 1 ? result[0] : result; } catch (error) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.error("ERROR: ".concat(error.message, " - Unable to parse directive\n ").concat(type !== null ? ' type:' + type : '', " based on the text:").concat(text)); return { type: null, args: null }; } }; /** * @function detectType Detects the type of the graph text. Takes into consideration the possible * existence of an %%init directive * * ```mermaid * %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%% * graph LR * a-->b * b-->c * c-->d * d-->e * e-->f * f-->g * g-->h * ``` * @param {string} text The text defining the graph * @param {{ * class: { defaultRenderer: string } | undefined; * state: { defaultRenderer: string } | undefined; * flowchart: { defaultRenderer: string } | undefined; * }} [cnf] * @returns {string} A graph definition key */ var detectType = function detectType(text, cnf) { text = text.replace(directive, '').replace(anyComment, '\n'); if (text.match(/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/)) { return 'c4'; } if (text.match(/^\s*sequenceDiagram/)) { return 'sequence'; } if (text.match(/^\s*gantt/)) { return 'gantt'; } if (text.match(/^\s*classDiagram-v2/)) { return 'classDiagram'; } if (text.match(/^\s*classDiagram/)) { if (cnf && cnf.class && cnf.class.defaultRenderer === 'dagre-wrapper') return 'classDiagram'; return 'class'; } if (text.match(/^\s*stateDiagram-v2/)) { return 'stateDiagram'; } if (text.match(/^\s*stateDiagram/)) { if (cnf && cnf.class && cnf.state.defaultRenderer === 'dagre-wrapper') return 'stateDiagram'; return 'state'; } if (text.match(/^\s*gitGraph/)) { return 'gitGraph'; } if (text.match(/^\s*flowchart/)) { return 'flowchart-v2'; } if (text.match(/^\s*info/)) { return 'info'; } if (text.match(/^\s*pie/)) { return 'pie'; } if (text.match(/^\s*erDiagram/)) { return 'er'; } if (text.match(/^\s*journey/)) { return 'journey'; } if (text.match(/^\s*requirement/) || text.match(/^\s*requirementDiagram/)) { return 'requirement'; } if (cnf && cnf.flowchart && cnf.flowchart.defaultRenderer === 'dagre-wrapper') return 'flowchart-v2'; return 'flowchart'; }; /** * Caches results of functions based on input * * @param {Function} fn Function to run * @param {Function} resolver Function that resolves to an ID given arguments the `fn` takes * @returns {Function} An optimized caching function */ var memoize = function memoize(fn, resolver) { var cache = {}; return function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var n = resolver ? resolver.apply(_this, args) : args[0]; if (n in cache) { return cache[n]; } else { var result = fn.apply(void 0, args); cache[n] = result; return result; } }; }; /** * @function isSubstringInArray Detects whether a substring in present in a given array * @param {string} str The substring to detect * @param {Array} arr The array to search * @returns {number} The array index containing the substring or -1 if not present */ var isSubstringInArray = function isSubstringInArray(str, arr) { for (var i = 0; i < arr.length; i++) { if (arr[i].match(str)) return i; } return -1; }; /** * Returns a d3 curve given a curve name * * @param {string | undefined} interpolate The interpolation name * @param {any} defaultCurve The default curve to return * @returns {import('d3-shape').CurveFactory} The curve factory to use */ var interpolateToCurve = function interpolateToCurve(interpolate, defaultCurve) { if (!interpolate) { return defaultCurve; } var curveName = "curve".concat(interpolate.charAt(0).toUpperCase() + interpolate.slice(1)); return d3CurveTypes[curveName] || defaultCurve; }; /** * Formats a URL string * * @param {string} linkStr String of the URL * @param {{ securityLevel: string }} config Configuration passed to MermaidJS * @returns {string | undefined} The formatted URL */ var formatUrl = function formatUrl(linkStr, config) { var url = linkStr.trim(); if (url) { if (config.securityLevel !== 'loose') { return (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl)(url); } return url; } }; /** * Runs a function * * @param {string} functionName A dot seperated path to the function relative to the `window` * @param {...any} params Parameters to pass to the function */ var runFunc = function runFunc(functionName) { var _obj; var arrPaths = functionName.split('.'); var len = arrPaths.length - 1; var fnName = arrPaths[len]; var obj = window; for (var i = 0; i < len; i++) { obj = obj[arrPaths[i]]; if (!obj) return; } for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { params[_key2 - 1] = arguments[_key2]; } (_obj = obj)[fnName].apply(_obj, params); }; /** * @typedef {object} Point A (x, y) point * @property {number} x The x value * @property {number} y The y value */ /** * Finds the distance between two points using the Distance Formula * * @param {Point} p1 The first point * @param {Point} p2 The second point * @returns {number} The distance */ var distance = function distance(p1, p2) { return p1 && p2 ? Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)) : 0; }; /** * @param {Point[]} points List of points * @returns {Point} * @todo Give this a description */ var traverseEdge = function traverseEdge(points) { var prevPoint; var totalDistance = 0; points.forEach(function (point) { totalDistance += distance(point, prevPoint); prevPoint = point; }); // Traverse half of total distance along points var remainingDistance = totalDistance / 2; var center = undefined; prevPoint = undefined; points.forEach(function (point) { if (prevPoint && !center) { var vectorDistance = distance(point, prevPoint); if (vectorDistance < remainingDistance) { remainingDistance -= vectorDistance; } else { // The point is remainingDistance from prevPoint in the vector between prevPoint and point // Calculate the coordinates var distanceRatio = remainingDistance / vectorDistance; if (distanceRatio <= 0) center = prevPoint; if (distanceRatio >= 1) center = { x: point.x, y: point.y }; if (distanceRatio > 0 && distanceRatio < 1) { center = { x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x, y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y }; } } } prevPoint = point; }); return center; }; /** * Alias for `traverseEdge` * * @param {Point[]} points List of points * @returns {Point} Return result of `transverseEdge` */ var calcLabelPosition = function calcLabelPosition(points) { if (points.length === 1) { return points[0]; } return traverseEdge(points); }; var calcCardinalityPosition = function calcCardinalityPosition(isRelationTypePresent, points, initialPosition) { var prevPoint; var totalDistance = 0; // eslint-disable-line _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('our points', points); if (points[0] !== initialPosition) { points = points.reverse(); } points.forEach(function (point) { totalDistance += distance(point, prevPoint); prevPoint = point; }); // Traverse only 25 total distance along points to find cardinality point var distanceToCardinalityPoint = 25; var remainingDistance = distanceToCardinalityPoint; var center; prevPoint = undefined; points.forEach(function (point) { if (prevPoint && !center) { var vectorDistance = distance(point, prevPoint); if (vectorDistance < remainingDistance) { remainingDistance -= vectorDistance; } else { // The point is remainingDistance from prevPoint in the vector between prevPoint and point // Calculate the coordinates var distanceRatio = remainingDistance / vectorDistance; if (distanceRatio <= 0) center = prevPoint; if (distanceRatio >= 1) center = { x: point.x, y: point.y }; if (distanceRatio > 0 && distanceRatio < 1) { center = { x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x, y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y }; } } } prevPoint = point; }); // if relation is present (Arrows will be added), change cardinality point off-set distance (d) var d = isRelationTypePresent ? 10 : 5; //Calculate Angle for x and y axis var angle = Math.atan2(points[0].y - center.y, points[0].x - center.x); var cardinalityPosition = { x: 0, y: 0 }; //Calculation cardinality position using angle, center point on the line/curve but pendicular and with offset-distance cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2; cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2; return cardinalityPosition; }; /** * Position ['start_left', 'start_right', 'end_left', 'end_right'] * * @param {any} terminalMarkerSize * @param {any} position * @param {any} _points * @returns {any} */ var calcTerminalLabelPosition = function calcTerminalLabelPosition(terminalMarkerSize, position, _points) { // Todo looking to faster cloning method var points = JSON.parse(JSON.stringify(_points)); var prevPoint; var totalDistance = 0; // eslint-disable-line _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('our points', points); if (position !== 'start_left' && position !== 'start_right') { points = points.reverse(); } points.forEach(function (point) { totalDistance += distance(point, prevPoint); prevPoint = point; }); // Traverse only 25 total distance along points to find cardinality point var distanceToCardinalityPoint = 25 + terminalMarkerSize; var remainingDistance = distanceToCardinalityPoint; var center; prevPoint = undefined; points.forEach(function (point) { if (prevPoint && !center) { var vectorDistance = distance(point, prevPoint); if (vectorDistance < remainingDistance) { remainingDistance -= vectorDistance; } else { // The point is remainingDistance from prevPoint in the vector between prevPoint and point // Calculate the coordinates var distanceRatio = remainingDistance / vectorDistance; if (distanceRatio <= 0) center = prevPoint; if (distanceRatio >= 1) center = { x: point.x, y: point.y }; if (distanceRatio > 0 && distanceRatio < 1) { center = { x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x, y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y }; } } } prevPoint = point; }); // if relation is present (Arrows will be added), change cardinality point off-set distance (d) var d = 10 + terminalMarkerSize * 0.5; //Calculate Angle for x and y axis var angle = Math.atan2(points[0].y - center.y, points[0].x - center.x); var cardinalityPosition = { x: 0, y: 0 }; //Calculation cardinality position using angle, center point on the line/curve but pendicular and with offset-distance cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2; cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2; if (position === 'start_left') { cardinalityPosition.x = Math.sin(angle + Math.PI) * d + (points[0].x + center.x) / 2; cardinalityPosition.y = -Math.cos(angle + Math.PI) * d + (points[0].y + center.y) / 2; } if (position === 'end_right') { cardinalityPosition.x = Math.sin(angle - Math.PI) * d + (points[0].x + center.x) / 2 - 5; cardinalityPosition.y = -Math.cos(angle - Math.PI) * d + (points[0].y + center.y) / 2 - 5; } if (position === 'end_left') { cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2 - 5; cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2 - 5; } return cardinalityPosition; }; /** * Gets styles from an array of declarations * * @param {string[]} arr Declarations * @returns {{ style: string; labelStyle: string }} The styles grouped as strings */ var getStylesFromArray = function getStylesFromArray(arr) { var style = ''; var labelStyle = ''; for (var i = 0; i < arr.length; i++) { if (typeof arr[i] !== 'undefined') { // add text properties to label style definition if (arr[i].startsWith('color:') || arr[i].startsWith('text-align:')) { labelStyle = labelStyle + arr[i] + ';'; } else { style = style + arr[i] + ';'; } } } return { style: style, labelStyle: labelStyle }; }; var cnt = 0; var generateId = function generateId() { cnt++; return 'id-' + Math.random().toString(36).substr(2, 12) + '-' + cnt; }; /** * @param {any} length * @returns {any} */ function makeid(length) { var result = ''; var characters = '0123456789abcdef'; var charactersLength = characters.length; for (var i = 0; i < length; i++) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); } return result; } var random = function random(options) { return makeid(options.length); }; /** * @function assignWithDepth Extends the functionality of {@link ObjectConstructor.assign} with the * ability to merge arbitrary-depth objects For each key in src with path `k` (recursively) * performs an Object.assign(dst[`k`], src[`k`]) with a slight change from the typical handling of * undefined for dst[`k`]: instead of raising an error, dst[`k`] is auto-initialized to {} and * effectively merged with src[`k`]

Additionally, dissimilar types will not clobber unless the * config.clobber parameter === true. Example: * * ```js * let config_0 = { foo: { bar: 'bar' }, bar: 'foo' }; * let config_1 = { foo: 'foo', bar: 'bar' }; * let result = assignWithDepth(config_0, config_1); * console.log(result); * //-> result: { foo: { bar: 'bar' }, bar: 'bar' } * ``` * * Traditional Object.assign would have clobbered foo in config_0 with foo in config_1. If src is a * destructured array of objects and dst is not an array, assignWithDepth will apply each element * of src to dst in order. * @param dst * @param src * @param config * @param dst * @param src * @param config * @param dst * @param src * @param config * @param {any} dst - The destination of the merge * @param {any} src - The source object(s) to merge into destination * @param {{ depth: number; clobber: boolean }} [config={ depth: 2, clobber: false }] - Depth: depth * to traverse within src and dst for merging - clobber: should dissimilar types clobber (default: * { depth: 2, clobber: false }). Default is `{ depth: 2, clobber: false }` * @returns {any} */ var assignWithDepth = function assignWithDepth(dst, src, config) { var _Object$assign = Object.assign({ depth: 2, clobber: false }, config), depth = _Object$assign.depth, clobber = _Object$assign.clobber; if (Array.isArray(src) && !Array.isArray(dst)) { src.forEach(function (s) { return assignWithDepth(dst, s, config); }); return dst; } else if (Array.isArray(src) && Array.isArray(dst)) { src.forEach(function (s) { if (dst.indexOf(s) === -1) { dst.push(s); } }); return dst; } if (typeof dst === 'undefined' || depth <= 0) { if (dst !== undefined && dst !== null && _typeof(dst) === 'object' && _typeof(src) === 'object') { return Object.assign(dst, src); } else { return src; } } if (typeof src !== 'undefined' && _typeof(dst) === 'object' && _typeof(src) === 'object') { Object.keys(src).forEach(function (key) { if (_typeof(src[key]) === 'object' && (dst[key] === undefined || _typeof(dst[key]) === 'object')) { if (dst[key] === undefined) { dst[key] = Array.isArray(src[key]) ? [] : {}; } dst[key] = assignWithDepth(dst[key], src[key], { depth: depth - 1, clobber: clobber }); } else if (clobber || _typeof(dst[key]) !== 'object' && _typeof(src[key]) !== 'object') { dst[key] = src[key]; } }); } return dst; }; var getTextObj = function getTextObj() { return { x: 0, y: 0, fill: undefined, anchor: 'start', style: '#666', width: 100, height: 100, textMargin: 0, rx: 0, ry: 0, valign: undefined }; }; /** * Adds text to an element * * @param {SVGElement} elem Element to add text to * @param {{ * text: string; * x: number; * y: number; * anchor: 'start' | 'middle' | 'end'; * fontFamily: string; * fontSize: string | number; * fontWeight: string | number; * fill: string; * class: string | undefined; * textMargin: number; * }} textData * @returns {SVGTextElement} Text element with given styling and content */ var drawSimpleText = function drawSimpleText(elem, textData) { // Remove and ignore br:s var nText = textData.text.replace(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex, ' '); var textElem = elem.append('text'); textElem.attr('x', textData.x); textElem.attr('y', textData.y); textElem.style('text-anchor', textData.anchor); textElem.style('font-family', textData.fontFamily); textElem.style('font-size', textData.fontSize); textElem.style('font-weight', textData.fontWeight); textElem.attr('fill', textData.fill); if (typeof textData.class !== 'undefined') { textElem.attr('class', textData.class); } var span = textElem.append('tspan'); span.attr('x', textData.x + textData.textMargin * 2); span.attr('fill', textData.fill); span.text(nText); return textElem; }; var wrapLabel = memoize(function (label, maxWidth, config) { if (!label) { return label; } config = Object.assign({ fontSize: 12, fontWeight: 400, fontFamily: 'Arial', joinWith: '
' }, config); if (_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex.test(label)) { return label; } var words = label.split(' '); var completedLines = []; var nextLine = ''; words.forEach(function (word, index) { var wordLength = calculateTextWidth("".concat(word, " "), config); var nextLineLength = calculateTextWidth(nextLine, config); if (wordLength > maxWidth) { var _breakString = breakString(word, maxWidth, '-', config), hyphenatedStrings = _breakString.hyphenatedStrings, remainingWord = _breakString.remainingWord; completedLines.push.apply(completedLines, [nextLine].concat(_toConsumableArray(hyphenatedStrings))); nextLine = remainingWord; } else if (nextLineLength + wordLength >= maxWidth) { completedLines.push(nextLine); nextLine = word; } else { nextLine = [nextLine, word].filter(Boolean).join(' '); } var currentWord = index + 1; var isLastWord = currentWord === words.length; if (isLastWord) { completedLines.push(nextLine); } }); return completedLines.filter(function (line) { return line !== ''; }).join(config.joinWith); }, function (label, maxWidth, config) { return "".concat(label, "-").concat(maxWidth, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily, "-").concat(config.joinWith); }); var breakString = memoize(function (word, maxWidth) { var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-'; var config = arguments.length > 3 ? arguments[3] : undefined; config = Object.assign({ fontSize: 12, fontWeight: 400, fontFamily: 'Arial', margin: 0 }, config); var characters = word.split(''); var lines = []; var currentLine = ''; characters.forEach(function (character, index) { var nextLine = "".concat(currentLine).concat(character); var lineWidth = calculateTextWidth(nextLine, config); if (lineWidth >= maxWidth) { var currentCharacter = index + 1; var isLastLine = characters.length === currentCharacter; var hyphenatedNextLine = "".concat(nextLine).concat(hyphenCharacter); lines.push(isLastLine ? nextLine : hyphenatedNextLine); currentLine = ''; } else { currentLine = nextLine; } }); return { hyphenatedStrings: lines, remainingWord: currentLine }; }, function (word, maxWidth) { var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-'; var config = arguments.length > 3 ? arguments[3] : undefined; return "".concat(word, "-").concat(maxWidth, "-").concat(hyphenCharacter, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily); }); /** * This calculates the text's height, taking into account the wrap breaks and both the statically * configured height, width, and the length of the text (in pixels). * * If the wrapped text text has greater height, we extend the height, so it's value won't overflow. * * @param {any} text The text to measure * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the resulting size * @returns {any} - The height for the given text */ var calculateTextHeight = function calculateTextHeight(text, config) { config = Object.assign({ fontSize: 12, fontWeight: 400, fontFamily: 'Arial', margin: 15 }, config); return calculateTextDimensions(text, config).height; }; /** * This calculates the width of the given text, font size and family. * * @param {any} text - The text to calculate the width of * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the resulting size * @returns {any} - The width for the given text */ var calculateTextWidth = function calculateTextWidth(text, config) { config = Object.assign({ fontSize: 12, fontWeight: 400, fontFamily: 'Arial' }, config); return calculateTextDimensions(text, config).width; }; /** * This calculates the dimensions of the given text, font size, font family, font weight, and margins. * * @param {any} text - The text to calculate the width of * @param {any} config - The config for fontSize, fontFamily, fontWeight, and margin all impacting * the resulting size * @returns - The width for the given text */ var calculateTextDimensions = memoize(function (text, config) { config = Object.assign({ fontSize: 12, fontWeight: 400, fontFamily: 'Arial' }, config); var _config = config, fontSize = _config.fontSize, fontFamily = _config.fontFamily, fontWeight = _config.fontWeight; if (!text) { return { width: 0, height: 0 }; } // We can't really know if the user supplied font family will render on the user agent; // thus, we'll take the max width between the user supplied font family, and a default // of sans-serif. var fontFamilies = ['sans-serif', fontFamily]; var lines = text.split(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex); var dims = []; var body = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('body'); // We don't want to leak DOM elements - if a removal operation isn't available // for any reason, do not continue. if (!body.remove) { return { width: 0, height: 0, lineHeight: 0 }; } var g = body.append('svg'); for (var _i = 0, _fontFamilies = fontFamilies; _i < _fontFamilies.length; _i++) { var _fontFamily = _fontFamilies[_i]; var cheight = 0; var dim = { width: 0, height: 0, lineHeight: 0 }; var _iterator = _createForOfIteratorHelper(lines), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var line = _step.value; var textObj = getTextObj(); textObj.text = line; var textElem = drawSimpleText(g, textObj).style('font-size', fontSize).style('font-weight', fontWeight).style('font-family', _fontFamily); var bBox = (textElem._groups || textElem)[0][0].getBBox(); dim.width = Math.round(Math.max(dim.width, bBox.width)); cheight = Math.round(bBox.height); dim.height += cheight; dim.lineHeight = Math.round(Math.max(dim.lineHeight, cheight)); } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } dims.push(dim); } g.remove(); 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; return dims[index]; }, function (text, config) { return "".concat(text, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily); }); /** * Applys d3 attributes * * @param {any} d3Elem D3 Element to apply the attributes onto * @param {[string, string][]} attrs Object.keys equivalent format of key to value mapping of attributes */ var d3Attrs = function d3Attrs(d3Elem, attrs) { var _iterator2 = _createForOfIteratorHelper(attrs), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var attr = _step2.value; d3Elem.attr(attr[0], attr[1]); } } catch (err) { _iterator2.e(err); } finally { _iterator2.f(); } }; /** * Gives attributes for an SVG's size given arguments * * @param {number} height The height of the SVG * @param {number} width The width of the SVG * @param {boolean} useMaxWidth Whether or not to use max-width and set width to 100% * @returns {Map<'height' | 'width' | 'style', string>} Attributes for the SVG */ var calculateSvgSizeAttrs = function calculateSvgSizeAttrs(height, width, useMaxWidth) { var attrs = new Map(); attrs.set('height', height); if (useMaxWidth) { attrs.set('width', '100%'); attrs.set('style', "max-width: ".concat(width, "px;")); } else { attrs.set('width', width); } return attrs; }; /** * Applies attributes from `calculateSvgSizeAttrs` * * @param {SVGSVGElement} svgElem The SVG Element to configure * @param {number} height The height of the SVG * @param {number} width The width of the SVG * @param {boolean} useMaxWidth Whether or not to use max-width and set width to 100% */ var configureSvgSize = function configureSvgSize(svgElem, height, width, useMaxWidth) { var attrs = calculateSvgSizeAttrs(height, width, useMaxWidth); d3Attrs(svgElem, attrs); }; var setupGraphViewbox = function setupGraphViewbox(graph, svgElem, padding, useMaxWidth) { var svgBounds = svgElem.node().getBBox(); var sWidth = svgBounds.width; var sHeight = svgBounds.height; var width = graph._label.width; var height = graph._label.height; var tx = 0; var ty = 0; if (sWidth > width) { tx = (sWidth - width) / 2 + padding; width = sWidth + padding * 2; } else { if (Math.abs(sWidth - width) >= 2 * padding + 1) { width = width - padding; } } if (sHeight > height) { ty = (sHeight - height) / 2 + padding; height = sHeight + padding * 2; } configureSvgSize(svgElem, height, width, useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding var vBox = "0 0 ".concat(width, " ").concat(height); _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('Graph.label', graph._label, 'swidth', sWidth, 'sheight', sHeight, 'width', width, 'height', height, 'tx', tx, 'ty', ty, 'vBox', vBox); svgElem.attr('viewBox', vBox); svgElem.select('g').attr('transform', "translate(".concat(tx, ", ").concat(ty, ")")); }; var initIdGenerator = /*#__PURE__*/function () { function iterator(deterministic, seed) { _classCallCheck(this, iterator); this.deterministic = deterministic; this.seed = seed; this.count = seed ? seed.length : 0; } _createClass(iterator, [{ key: "next", value: function next() { if (!this.deterministic) return Date.now(); return this.count++; } }]); return iterator; }(); var decoder; /** * Decodes HTML, source: {@link https://github.com/shrpne/entity-decode/blob/v2.0.1/browser.js} * * @param {string} html HTML as a string * @returns Unescaped HTML */ var entityDecode = function entityDecode(html) { decoder = decoder || document.createElement('div'); // Escape HTML before decoding for HTML Entities html = escape(html).replace(/%26/g, '&').replace(/%23/g, '#').replace(/%3B/g, ';'); // decoding decoder.innerHTML = html; return unescape(decoder.textContent); }; /** * Sanitizes directive objects * * @param {object} args Directive's JSON */ var directiveSanitizer = function directiveSanitizer(args) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('directiveSanitizer called with', args); if (_typeof(args) === 'object') { // check for array if (args.length) { args.forEach(function (arg) { return directiveSanitizer(arg); }); } else { // This is an object Object.keys(args).forEach(function (key) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('Checking key', key); if (key.indexOf('__') === 0) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting __ option', key); delete args[key]; } if (key.indexOf('proto') >= 0) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting proto option', key); delete args[key]; } if (key.indexOf('constr') >= 0) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting constr option', key); delete args[key]; } if (key.indexOf('themeCSS') >= 0) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitizing themeCss option'); args[key] = sanitizeCss(args[key]); } if (key.indexOf('fontFamily') >= 0) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitizing fontFamily option'); args[key] = sanitizeCss(args[key]); } if (key.indexOf('altFontFamily') >= 0) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitizing altFontFamily option'); args[key] = sanitizeCss(args[key]); } if (_defaultConfig__WEBPACK_IMPORTED_MODULE_4__.configKeys.indexOf(key) < 0) { _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting option', key); delete args[key]; } else { if (_typeof(args[key]) === 'object') { _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting object', key); directiveSanitizer(args[key]); } } }); } } if (args.themeVariables) { var kArr = Object.keys(args.themeVariables); for (var i = 0; i < kArr.length; i++) { var k = kArr[i]; var val = args.themeVariables[k]; if (val && val.match && !val.match(/^[a-zA-Z0-9#,";()%. ]+$/)) { args.themeVariables[k] = ''; } } } _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('After sanitization', args); }; var sanitizeCss = function sanitizeCss(str) { var startCnt = 0; var endCnt = 0; for (var i = 0; i < str.length; i++) { if (startCnt < endCnt) { return '{ /* ERROR: Unbalanced CSS */ }'; } if (str[i] === '{') { startCnt++; } else if (str[i] === '}') { endCnt++; } } if (startCnt !== endCnt) { return '{ /* ERROR: Unbalanced CSS */ }'; } // Todo add more checks here return str; }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ assignWithDepth: assignWithDepth, wrapLabel: wrapLabel, calculateTextHeight: calculateTextHeight, calculateTextWidth: calculateTextWidth, calculateTextDimensions: calculateTextDimensions, calculateSvgSizeAttrs: calculateSvgSizeAttrs, configureSvgSize: configureSvgSize, setupGraphViewbox: setupGraphViewbox, detectInit: detectInit, detectDirective: detectDirective, detectType: detectType, isSubstringInArray: isSubstringInArray, interpolateToCurve: interpolateToCurve, calcLabelPosition: calcLabelPosition, calcCardinalityPosition: calcCardinalityPosition, calcTerminalLabelPosition: calcTerminalLabelPosition, formatUrl: formatUrl, getStylesFromArray: getStylesFromArray, generateId: generateId, random: random, memoize: memoize, runFunc: runFunc, entityDecode: entityDecode, initIdGenerator: initIdGenerator, directiveSanitizer: directiveSanitizer, sanitizeCss: sanitizeCss }); /***/ }), /***/ "./node_modules/dagre-d3/index.js": /*!****************************************!*\ !*** ./node_modules/dagre-d3/index.js ***! \****************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @license * Copyright (c) 2012-2013 Chris Pettitt * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ module.exports = { graphlib: __webpack_require__(/*! ./lib/graphlib */ "./node_modules/dagre-d3/lib/graphlib.js"), dagre: __webpack_require__(/*! ./lib/dagre */ "./node_modules/dagre-d3/lib/dagre.js"), intersect: __webpack_require__(/*! ./lib/intersect */ "./node_modules/dagre-d3/lib/intersect/index.js"), render: __webpack_require__(/*! ./lib/render */ "./node_modules/dagre-d3/lib/render.js"), util: __webpack_require__(/*! ./lib/util */ "./node_modules/dagre-d3/lib/util.js"), version: __webpack_require__(/*! ./lib/version */ "./node_modules/dagre-d3/lib/version.js") }; /***/ }), /***/ "./node_modules/dagre-d3/lib/arrows.js": /*!*********************************************!*\ !*** ./node_modules/dagre-d3/lib/arrows.js ***! \*********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var util = __webpack_require__(/*! ./util */ "./node_modules/dagre-d3/lib/util.js"); module.exports = { "default": normal, "normal": normal, "vee": vee, "undirected": undirected }; function normal(parent, id, edge, type) { 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"); var path = marker.append("path") .attr("d", "M 0 0 L 10 5 L 0 10 z") .style("stroke-width", 1) .style("stroke-dasharray", "1,0"); util.applyStyle(path, edge[type + "Style"]); if (edge[type + "Class"]) { path.attr("class", edge[type + "Class"]); } } function vee(parent, id, edge, type) { 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"); var path = marker.append("path") .attr("d", "M 0 0 L 10 5 L 0 10 L 4 5 z") .style("stroke-width", 1) .style("stroke-dasharray", "1,0"); util.applyStyle(path, edge[type + "Style"]); if (edge[type + "Class"]) { path.attr("class", edge[type + "Class"]); } } function undirected(parent, id, edge, type) { 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"); var path = marker.append("path") .attr("d", "M 0 5 L 10 5") .style("stroke-width", 1) .style("stroke-dasharray", "1,0"); util.applyStyle(path, edge[type + "Style"]); if (edge[type + "Class"]) { path.attr("class", edge[type + "Class"]); } } /***/ }), /***/ "./node_modules/dagre-d3/lib/create-clusters.js": /*!******************************************************!*\ !*** ./node_modules/dagre-d3/lib/create-clusters.js ***! \******************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var util = __webpack_require__(/*! ./util */ "./node_modules/dagre-d3/lib/util.js"); var d3 = __webpack_require__(/*! ./d3 */ "./node_modules/dagre-d3/lib/d3.js"); var addLabel = __webpack_require__(/*! ./label/add-label */ "./node_modules/dagre-d3/lib/label/add-label.js"); module.exports = createClusters; function createClusters(selection, g) { var clusters = g.nodes().filter(function(v) { return util.isSubgraph(g, v); }); var svgClusters = selection.selectAll("g.cluster") .data(clusters, function(v) { return v; }); svgClusters.selectAll("*").remove(); svgClusters.enter().append("g") .attr("class", "cluster") .attr("id",function(v){ var node = g.node(v); return node.id; }) .style("opacity", 0); svgClusters = selection.selectAll("g.cluster"); util.applyTransition(svgClusters, g) .style("opacity", 1); svgClusters.each(function(v) { var node = g.node(v); var thisGroup = d3.select(this); d3.select(this).append("rect"); var labelGroup = thisGroup.append("g").attr("class", "label"); addLabel(labelGroup, node, node.clusterLabelPos); }); svgClusters.selectAll("rect").each(function(c) { var node = g.node(c); var domCluster = d3.select(this); util.applyStyle(domCluster, node.style); }); var exitSelection; if (svgClusters.exit) { exitSelection = svgClusters.exit(); } else { exitSelection = svgClusters.selectAll(null); // empty selection } util.applyTransition(exitSelection, g) .style("opacity", 0) .remove(); return svgClusters; } /***/ }), /***/ "./node_modules/dagre-d3/lib/create-edge-labels.js": /*!*********************************************************!*\ !*** ./node_modules/dagre-d3/lib/create-edge-labels.js ***! \*********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre-d3/lib/lodash.js"); var addLabel = __webpack_require__(/*! ./label/add-label */ "./node_modules/dagre-d3/lib/label/add-label.js"); var util = __webpack_require__(/*! ./util */ "./node_modules/dagre-d3/lib/util.js"); var d3 = __webpack_require__(/*! ./d3 */ "./node_modules/dagre-d3/lib/d3.js"); module.exports = createEdgeLabels; function createEdgeLabels(selection, g) { var svgEdgeLabels = selection.selectAll("g.edgeLabel") .data(g.edges(), function(e) { return util.edgeToId(e); }) .classed("update", true); svgEdgeLabels.exit().remove(); svgEdgeLabels.enter().append("g") .classed("edgeLabel", true) .style("opacity", 0); svgEdgeLabels = selection.selectAll("g.edgeLabel"); svgEdgeLabels.each(function(e) { var root = d3.select(this); root.select(".label").remove(); var edge = g.edge(e); var label = addLabel(root, g.edge(e), 0, 0).classed("label", true); var bbox = label.node().getBBox(); if (edge.labelId) { label.attr("id", edge.labelId); } if (!_.has(edge, "width")) { edge.width = bbox.width; } if (!_.has(edge, "height")) { edge.height = bbox.height; } }); var exitSelection; if (svgEdgeLabels.exit) { exitSelection = svgEdgeLabels.exit(); } else { exitSelection = svgEdgeLabels.selectAll(null); // empty selection } util.applyTransition(exitSelection, g) .style("opacity", 0) .remove(); return svgEdgeLabels; } /***/ }), /***/ "./node_modules/dagre-d3/lib/create-edge-paths.js": /*!********************************************************!*\ !*** ./node_modules/dagre-d3/lib/create-edge-paths.js ***! \********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre-d3/lib/lodash.js"); var intersectNode = __webpack_require__(/*! ./intersect/intersect-node */ "./node_modules/dagre-d3/lib/intersect/intersect-node.js"); var util = __webpack_require__(/*! ./util */ "./node_modules/dagre-d3/lib/util.js"); var d3 = __webpack_require__(/*! ./d3 */ "./node_modules/dagre-d3/lib/d3.js"); module.exports = createEdgePaths; function createEdgePaths(selection, g, arrows) { var previousPaths = selection.selectAll("g.edgePath") .data(g.edges(), function(e) { return util.edgeToId(e); }) .classed("update", true); var newPaths = enter(previousPaths, g); exit(previousPaths, g); var svgPaths = previousPaths.merge !== undefined ? previousPaths.merge(newPaths) : previousPaths; util.applyTransition(svgPaths, g) .style("opacity", 1); // Save DOM element in the path group, and set ID and class svgPaths.each(function(e) { var domEdge = d3.select(this); var edge = g.edge(e); edge.elem = this; if (edge.id) { domEdge.attr("id", edge.id); } util.applyClass(domEdge, edge["class"], (domEdge.classed("update") ? "update " : "") + "edgePath"); }); svgPaths.selectAll("path.path") .each(function(e) { var edge = g.edge(e); edge.arrowheadId = _.uniqueId("arrowhead"); var domEdge = d3.select(this) .attr("marker-end", function() { return "url(" + makeFragmentRef(location.href, edge.arrowheadId) + ")"; }) .style("fill", "none"); util.applyTransition(domEdge, g) .attr("d", function(e) { return calcPoints(g, e); }); util.applyStyle(domEdge, edge.style); }); svgPaths.selectAll("defs *").remove(); svgPaths.selectAll("defs") .each(function(e) { var edge = g.edge(e); var arrowhead = arrows[edge.arrowhead]; arrowhead(d3.select(this), edge.arrowheadId, edge, "arrowhead"); }); return svgPaths; } function makeFragmentRef(url, fragmentId) { var baseUrl = url.split("#")[0]; return baseUrl + "#" + fragmentId; } function calcPoints(g, e) { var edge = g.edge(e); var tail = g.node(e.v); var head = g.node(e.w); var points = edge.points.slice(1, edge.points.length - 1); points.unshift(intersectNode(tail, points[0])); points.push(intersectNode(head, points[points.length - 1])); return createLine(edge, points); } function createLine(edge, points) { var line = (d3.line || d3.svg.line)() .x(function(d) { return d.x; }) .y(function(d) { return d.y; }); (line.curve || line.interpolate)(edge.curve); return line(points); } function getCoords(elem) { var bbox = elem.getBBox(); var matrix = elem.ownerSVGElement.getScreenCTM() .inverse() .multiply(elem.getScreenCTM()) .translate(bbox.width / 2, bbox.height / 2); return { x: matrix.e, y: matrix.f }; } function enter(svgPaths, g) { var svgPathsEnter = svgPaths.enter().append("g") .attr("class", "edgePath") .style("opacity", 0); svgPathsEnter.append("path") .attr("class", "path") .attr("d", function(e) { var edge = g.edge(e); var sourceElem = g.node(e.v).elem; var points = _.range(edge.points.length).map(function() { return getCoords(sourceElem); }); return createLine(edge, points); }); svgPathsEnter.append("defs"); return svgPathsEnter; } function exit(svgPaths, g) { var svgPathExit = svgPaths.exit(); util.applyTransition(svgPathExit, g) .style("opacity", 0) .remove(); } /***/ }), /***/ "./node_modules/dagre-d3/lib/create-nodes.js": /*!***************************************************!*\ !*** ./node_modules/dagre-d3/lib/create-nodes.js ***! \***************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre-d3/lib/lodash.js"); var addLabel = __webpack_require__(/*! ./label/add-label */ "./node_modules/dagre-d3/lib/label/add-label.js"); var util = __webpack_require__(/*! ./util */ "./node_modules/dagre-d3/lib/util.js"); var d3 = __webpack_require__(/*! ./d3 */ "./node_modules/dagre-d3/lib/d3.js"); module.exports = createNodes; function createNodes(selection, g, shapes) { var simpleNodes = g.nodes().filter(function(v) { return !util.isSubgraph(g, v); }); var svgNodes = selection.selectAll("g.node") .data(simpleNodes, function(v) { return v; }) .classed("update", true); svgNodes.exit().remove(); svgNodes.enter().append("g") .attr("class", "node") .style("opacity", 0); svgNodes = selection.selectAll("g.node"); svgNodes.each(function(v) { var node = g.node(v); var thisGroup = d3.select(this); util.applyClass(thisGroup, node["class"], (thisGroup.classed("update") ? "update " : "") + "node"); thisGroup.select("g.label").remove(); var labelGroup = thisGroup.append("g").attr("class", "label"); var labelDom = addLabel(labelGroup, node); var shape = shapes[node.shape]; var bbox = _.pick(labelDom.node().getBBox(), "width", "height"); node.elem = this; if (node.id) { thisGroup.attr("id", node.id); } if (node.labelId) { labelGroup.attr("id", node.labelId); } if (_.has(node, "width")) { bbox.width = node.width; } if (_.has(node, "height")) { bbox.height = node.height; } bbox.width += node.paddingLeft + node.paddingRight; bbox.height += node.paddingTop + node.paddingBottom; labelGroup.attr("transform", "translate(" + ((node.paddingLeft - node.paddingRight) / 2) + "," + ((node.paddingTop - node.paddingBottom) / 2) + ")"); var root = d3.select(this); root.select(".label-container").remove(); var shapeSvg = shape(root, bbox, node).classed("label-container", true); util.applyStyle(shapeSvg, node.style); var shapeBBox = shapeSvg.node().getBBox(); node.width = shapeBBox.width; node.height = shapeBBox.height; }); var exitSelection; if (svgNodes.exit) { exitSelection = svgNodes.exit(); } else { exitSelection = svgNodes.selectAll(null); // empty selection } util.applyTransition(exitSelection, g) .style("opacity", 0) .remove(); return svgNodes; } /***/ }), /***/ "./node_modules/dagre-d3/lib/d3.js": /*!*****************************************!*\ !*** ./node_modules/dagre-d3/lib/d3.js ***! \*****************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { // Stub to get D3 either via NPM or from the global object var d3; if (!d3) { if (true) { try { d3 = __webpack_require__(/*! d3 */ "./node_modules/d3/src/index.js"); } catch (e) { // continue regardless of error } } } if (!d3) { d3 = window.d3; } module.exports = d3; /***/ }), /***/ "./node_modules/dagre-d3/lib/dagre.js": /*!********************************************!*\ !*** ./node_modules/dagre-d3/lib/dagre.js ***! \********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* global window */ var dagre; if (true) { try { dagre = __webpack_require__(/*! dagre */ "./node_modules/dagre/index.js"); } catch (e) { // continue regardless of error } } if (!dagre) { dagre = window.dagre; } module.exports = dagre; /***/ }), /***/ "./node_modules/dagre-d3/lib/graphlib.js": /*!***********************************************!*\ !*** ./node_modules/dagre-d3/lib/graphlib.js ***! \***********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* global window */ var graphlib; if (true) { try { graphlib = __webpack_require__(/*! graphlib */ "./node_modules/graphlib/index.js"); } catch (e) { // continue regardless of error } } if (!graphlib) { graphlib = window.graphlib; } module.exports = graphlib; /***/ }), /***/ "./node_modules/dagre-d3/lib/intersect/index.js": /*!******************************************************!*\ !*** ./node_modules/dagre-d3/lib/intersect/index.js ***! \******************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { module.exports = { node: __webpack_require__(/*! ./intersect-node */ "./node_modules/dagre-d3/lib/intersect/intersect-node.js"), circle: __webpack_require__(/*! ./intersect-circle */ "./node_modules/dagre-d3/lib/intersect/intersect-circle.js"), ellipse: __webpack_require__(/*! ./intersect-ellipse */ "./node_modules/dagre-d3/lib/intersect/intersect-ellipse.js"), polygon: __webpack_require__(/*! ./intersect-polygon */ "./node_modules/dagre-d3/lib/intersect/intersect-polygon.js"), rect: __webpack_require__(/*! ./intersect-rect */ "./node_modules/dagre-d3/lib/intersect/intersect-rect.js") }; /***/ }), /***/ "./node_modules/dagre-d3/lib/intersect/intersect-circle.js": /*!*****************************************************************!*\ !*** ./node_modules/dagre-d3/lib/intersect/intersect-circle.js ***! \*****************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var intersectEllipse = __webpack_require__(/*! ./intersect-ellipse */ "./node_modules/dagre-d3/lib/intersect/intersect-ellipse.js"); module.exports = intersectCircle; function intersectCircle(node, rx, point) { return intersectEllipse(node, rx, rx, point); } /***/ }), /***/ "./node_modules/dagre-d3/lib/intersect/intersect-ellipse.js": /*!******************************************************************!*\ !*** ./node_modules/dagre-d3/lib/intersect/intersect-ellipse.js ***! \******************************************************************/ /***/ ((module) => { module.exports = intersectEllipse; function intersectEllipse(node, rx, ry, point) { // Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html var cx = node.x; var cy = node.y; var px = cx - point.x; var py = cy - point.y; var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px); var dx = Math.abs(rx * ry * px / det); if (point.x < cx) { dx = -dx; } var dy = Math.abs(rx * ry * py / det); if (point.y < cy) { dy = -dy; } return {x: cx + dx, y: cy + dy}; } /***/ }), /***/ "./node_modules/dagre-d3/lib/intersect/intersect-line.js": /*!***************************************************************!*\ !*** ./node_modules/dagre-d3/lib/intersect/intersect-line.js ***! \***************************************************************/ /***/ ((module) => { module.exports = intersectLine; /* * Returns the point at which two lines, p and q, intersect or returns * undefined if they do not intersect. */ function intersectLine(p1, p2, q1, q2) { // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994, // p7 and p473. var a1, a2, b1, b2, c1, c2; var r1, r2 , r3, r4; var denom, offset, num; var x, y; // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x + // b1 y + c1 = 0. a1 = p2.y - p1.y; b1 = p1.x - p2.x; c1 = (p2.x * p1.y) - (p1.x * p2.y); // Compute r3 and r4. r3 = ((a1 * q1.x) + (b1 * q1.y) + c1); r4 = ((a1 * q2.x) + (b1 * q2.y) + c1); // Check signs of r3 and r4. If both point 3 and point 4 lie on // same side of line 1, the line segments do not intersect. if ((r3 !== 0) && (r4 !== 0) && sameSign(r3, r4)) { return /*DONT_INTERSECT*/; } // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0 a2 = q2.y - q1.y; b2 = q1.x - q2.x; c2 = (q2.x * q1.y) - (q1.x * q2.y); // Compute r1 and r2 r1 = (a2 * p1.x) + (b2 * p1.y) + c2; r2 = (a2 * p2.x) + (b2 * p2.y) + c2; // Check signs of r1 and r2. If both point 1 and point 2 lie // on same side of second line segment, the line segments do // not intersect. if ((r1 !== 0) && (r2 !== 0) && (sameSign(r1, r2))) { return /*DONT_INTERSECT*/; } // Line segments intersect: compute intersection point. denom = (a1 * b2) - (a2 * b1); if (denom === 0) { return /*COLLINEAR*/; } offset = Math.abs(denom / 2); // The denom/2 is to get rounding instead of truncating. It // is added or subtracted to the numerator, depending upon the // sign of the numerator. num = (b1 * c2) - (b2 * c1); x = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom); num = (a2 * c1) - (a1 * c2); y = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom); return { x: x, y: y }; } function sameSign(r1, r2) { return r1 * r2 > 0; } /***/ }), /***/ "./node_modules/dagre-d3/lib/intersect/intersect-node.js": /*!***************************************************************!*\ !*** ./node_modules/dagre-d3/lib/intersect/intersect-node.js ***! \***************************************************************/ /***/ ((module) => { module.exports = intersectNode; function intersectNode(node, point) { return node.intersect(point); } /***/ }), /***/ "./node_modules/dagre-d3/lib/intersect/intersect-polygon.js": /*!******************************************************************!*\ !*** ./node_modules/dagre-d3/lib/intersect/intersect-polygon.js ***! \******************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* eslint "no-console": off */ var intersectLine = __webpack_require__(/*! ./intersect-line */ "./node_modules/dagre-d3/lib/intersect/intersect-line.js"); module.exports = intersectPolygon; /* * Returns the point ({x, y}) at which the point argument intersects with the * node argument assuming that it has the shape specified by polygon. */ function intersectPolygon(node, polyPoints, point) { var x1 = node.x; var y1 = node.y; var intersections = []; var minX = Number.POSITIVE_INFINITY; var minY = Number.POSITIVE_INFINITY; polyPoints.forEach(function(entry) { minX = Math.min(minX, entry.x); minY = Math.min(minY, entry.y); }); var left = x1 - node.width / 2 - minX; var top = y1 - node.height / 2 - minY; for (var i = 0; i < polyPoints.length; i++) { var p1 = polyPoints[i]; var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0]; var intersect = intersectLine(node, point, {x: left + p1.x, y: top + p1.y}, {x: left + p2.x, y: top + p2.y}); if (intersect) { intersections.push(intersect); } } if (!intersections.length) { console.log("NO INTERSECTION FOUND, RETURN NODE CENTER", node); return node; } if (intersections.length > 1) { // More intersections, find the one nearest to edge end point intersections.sort(function(p, q) { var pdx = p.x - point.x; var pdy = p.y - point.y; var distp = Math.sqrt(pdx * pdx + pdy * pdy); var qdx = q.x - point.x; var qdy = q.y - point.y; var distq = Math.sqrt(qdx * qdx + qdy * qdy); return (distp < distq) ? -1 : (distp === distq ? 0 : 1); }); } return intersections[0]; } /***/ }), /***/ "./node_modules/dagre-d3/lib/intersect/intersect-rect.js": /*!***************************************************************!*\ !*** ./node_modules/dagre-d3/lib/intersect/intersect-rect.js ***! \***************************************************************/ /***/ ((module) => { module.exports = intersectRect; function intersectRect(node, point) { var x = node.x; var y = node.y; // Rectangle intersection algorithm from: // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes var dx = point.x - x; var dy = point.y - y; var w = node.width / 2; var h = node.height / 2; var sx, sy; if (Math.abs(dy) * w > Math.abs(dx) * h) { // Intersection is top or bottom of rect. if (dy < 0) { h = -h; } sx = dy === 0 ? 0 : h * dx / dy; sy = h; } else { // Intersection is left or right of rect. if (dx < 0) { w = -w; } sx = w; sy = dx === 0 ? 0 : w * dy / dx; } return {x: x + sx, y: y + sy}; } /***/ }), /***/ "./node_modules/dagre-d3/lib/label/add-html-label.js": /*!***********************************************************!*\ !*** ./node_modules/dagre-d3/lib/label/add-html-label.js ***! \***********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var util = __webpack_require__(/*! ../util */ "./node_modules/dagre-d3/lib/util.js"); module.exports = addHtmlLabel; function addHtmlLabel(root, node) { var fo = root .append("foreignObject") .attr("width", "100000"); var div = fo .append("xhtml:div"); div.attr("xmlns", "http://www.w3.org/1999/xhtml"); var label = node.label; switch(typeof label) { case "function": div.insert(label); break; case "object": // Currently we assume this is a DOM object. div.insert(function() { return label; }); break; default: div.html(label); } util.applyStyle(div, node.labelStyle); div.style("display", "inline-block"); // Fix for firefox div.style("white-space", "nowrap"); var client = div.node().getBoundingClientRect(); fo .attr("width", client.width) .attr("height", client.height); return fo; } /***/ }), /***/ "./node_modules/dagre-d3/lib/label/add-label.js": /*!******************************************************!*\ !*** ./node_modules/dagre-d3/lib/label/add-label.js ***! \******************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var addTextLabel = __webpack_require__(/*! ./add-text-label */ "./node_modules/dagre-d3/lib/label/add-text-label.js"); var addHtmlLabel = __webpack_require__(/*! ./add-html-label */ "./node_modules/dagre-d3/lib/label/add-html-label.js"); var addSVGLabel = __webpack_require__(/*! ./add-svg-label */ "./node_modules/dagre-d3/lib/label/add-svg-label.js"); module.exports = addLabel; function addLabel(root, node, location) { var label = node.label; var labelSvg = root.append("g"); // Allow the label to be a string, a function that returns a DOM element, or // a DOM element itself. if (node.labelType === "svg") { addSVGLabel(labelSvg, node); } else if (typeof label !== "string" || node.labelType === "html") { addHtmlLabel(labelSvg, node); } else { addTextLabel(labelSvg, node); } var labelBBox = labelSvg.node().getBBox(); var y; switch(location) { case "top": y = (-node.height / 2); break; case "bottom": y = (node.height / 2) - labelBBox.height; break; default: y = (-labelBBox.height / 2); } labelSvg.attr( "transform", "translate(" + (-labelBBox.width / 2) + "," + y + ")"); return labelSvg; } /***/ }), /***/ "./node_modules/dagre-d3/lib/label/add-svg-label.js": /*!**********************************************************!*\ !*** ./node_modules/dagre-d3/lib/label/add-svg-label.js ***! \**********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var util = __webpack_require__(/*! ../util */ "./node_modules/dagre-d3/lib/util.js"); module.exports = addSVGLabel; function addSVGLabel(root, node) { var domNode = root; domNode.node().appendChild(node.label); util.applyStyle(domNode, node.labelStyle); return domNode; } /***/ }), /***/ "./node_modules/dagre-d3/lib/label/add-text-label.js": /*!***********************************************************!*\ !*** ./node_modules/dagre-d3/lib/label/add-text-label.js ***! \***********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var util = __webpack_require__(/*! ../util */ "./node_modules/dagre-d3/lib/util.js"); module.exports = addTextLabel; /* * Attaches a text label to the specified root. Handles escape sequences. */ function addTextLabel(root, node) { var domNode = root.append("text"); var lines = processEscapeSequences(node.label).split("\n"); for (var i = 0; i < lines.length; i++) { domNode.append("tspan") .attr("xml:space", "preserve") .attr("dy", "1em") .attr("x", "1") .text(lines[i]); } util.applyStyle(domNode, node.labelStyle); return domNode; } function processEscapeSequences(text) { var newText = ""; var escaped = false; var ch; for (var i = 0; i < text.length; ++i) { ch = text[i]; if (escaped) { switch(ch) { case "n": newText += "\n"; break; default: newText += ch; } escaped = false; } else if (ch === "\\") { escaped = true; } else { newText += ch; } } return newText; } /***/ }), /***/ "./node_modules/dagre-d3/lib/lodash.js": /*!*********************************************!*\ !*** ./node_modules/dagre-d3/lib/lodash.js ***! \*********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* global window */ var lodash; if (true) { try { lodash = { defaults: __webpack_require__(/*! lodash/defaults */ "./node_modules/lodash/defaults.js"), each: __webpack_require__(/*! lodash/each */ "./node_modules/lodash/each.js"), isFunction: __webpack_require__(/*! lodash/isFunction */ "./node_modules/lodash/isFunction.js"), isPlainObject: __webpack_require__(/*! lodash/isPlainObject */ "./node_modules/lodash/isPlainObject.js"), pick: __webpack_require__(/*! lodash/pick */ "./node_modules/lodash/pick.js"), has: __webpack_require__(/*! lodash/has */ "./node_modules/lodash/has.js"), range: __webpack_require__(/*! lodash/range */ "./node_modules/lodash/range.js"), uniqueId: __webpack_require__(/*! lodash/uniqueId */ "./node_modules/lodash/uniqueId.js") }; } catch (e) { // continue regardless of error } } if (!lodash) { lodash = window._; } module.exports = lodash; /***/ }), /***/ "./node_modules/dagre-d3/lib/position-clusters.js": /*!********************************************************!*\ !*** ./node_modules/dagre-d3/lib/position-clusters.js ***! \********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var util = __webpack_require__(/*! ./util */ "./node_modules/dagre-d3/lib/util.js"); var d3 = __webpack_require__(/*! ./d3 */ "./node_modules/dagre-d3/lib/d3.js"); module.exports = positionClusters; function positionClusters(selection, g) { var created = selection.filter(function() { return !d3.select(this).classed("update"); }); function translate(v) { var node = g.node(v); return "translate(" + node.x + "," + node.y + ")"; } created.attr("transform", translate); util.applyTransition(selection, g) .style("opacity", 1) .attr("transform", translate); util.applyTransition(created.selectAll("rect"), g) .attr("width", function(v) { return g.node(v).width; }) .attr("height", function(v) { return g.node(v).height; }) .attr("x", function(v) { var node = g.node(v); return -node.width / 2; }) .attr("y", function(v) { var node = g.node(v); return -node.height / 2; }); } /***/ }), /***/ "./node_modules/dagre-d3/lib/position-edge-labels.js": /*!***********************************************************!*\ !*** ./node_modules/dagre-d3/lib/position-edge-labels.js ***! \***********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var util = __webpack_require__(/*! ./util */ "./node_modules/dagre-d3/lib/util.js"); var d3 = __webpack_require__(/*! ./d3 */ "./node_modules/dagre-d3/lib/d3.js"); var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre-d3/lib/lodash.js"); module.exports = positionEdgeLabels; function positionEdgeLabels(selection, g) { var created = selection.filter(function() { return !d3.select(this).classed("update"); }); function translate(e) { var edge = g.edge(e); return _.has(edge, "x") ? "translate(" + edge.x + "," + edge.y + ")" : ""; } created.attr("transform", translate); util.applyTransition(selection, g) .style("opacity", 1) .attr("transform", translate); } /***/ }), /***/ "./node_modules/dagre-d3/lib/position-nodes.js": /*!*****************************************************!*\ !*** ./node_modules/dagre-d3/lib/position-nodes.js ***! \*****************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var util = __webpack_require__(/*! ./util */ "./node_modules/dagre-d3/lib/util.js"); var d3 = __webpack_require__(/*! ./d3 */ "./node_modules/dagre-d3/lib/d3.js"); module.exports = positionNodes; function positionNodes(selection, g) { var created = selection.filter(function() { return !d3.select(this).classed("update"); }); function translate(v) { var node = g.node(v); return "translate(" + node.x + "," + node.y + ")"; } created.attr("transform", translate); util.applyTransition(selection, g) .style("opacity", 1) .attr("transform", translate); } /***/ }), /***/ "./node_modules/dagre-d3/lib/render.js": /*!*********************************************!*\ !*** ./node_modules/dagre-d3/lib/render.js ***! \*********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre-d3/lib/lodash.js"); var d3 = __webpack_require__(/*! ./d3 */ "./node_modules/dagre-d3/lib/d3.js"); var layout = (__webpack_require__(/*! ./dagre */ "./node_modules/dagre-d3/lib/dagre.js").layout); module.exports = render; // This design is based on http://bost.ocks.org/mike/chart/. function render() { var createNodes = __webpack_require__(/*! ./create-nodes */ "./node_modules/dagre-d3/lib/create-nodes.js"); var createClusters = __webpack_require__(/*! ./create-clusters */ "./node_modules/dagre-d3/lib/create-clusters.js"); var createEdgeLabels = __webpack_require__(/*! ./create-edge-labels */ "./node_modules/dagre-d3/lib/create-edge-labels.js"); var createEdgePaths = __webpack_require__(/*! ./create-edge-paths */ "./node_modules/dagre-d3/lib/create-edge-paths.js"); var positionNodes = __webpack_require__(/*! ./position-nodes */ "./node_modules/dagre-d3/lib/position-nodes.js"); var positionEdgeLabels = __webpack_require__(/*! ./position-edge-labels */ "./node_modules/dagre-d3/lib/position-edge-labels.js"); var positionClusters = __webpack_require__(/*! ./position-clusters */ "./node_modules/dagre-d3/lib/position-clusters.js"); var shapes = __webpack_require__(/*! ./shapes */ "./node_modules/dagre-d3/lib/shapes.js"); var arrows = __webpack_require__(/*! ./arrows */ "./node_modules/dagre-d3/lib/arrows.js"); var fn = function(svg, g) { preProcessGraph(g); var outputGroup = createOrSelectGroup(svg, "output"); var clustersGroup = createOrSelectGroup(outputGroup, "clusters"); var edgePathsGroup = createOrSelectGroup(outputGroup, "edgePaths"); var edgeLabels = createEdgeLabels(createOrSelectGroup(outputGroup, "edgeLabels"), g); var nodes = createNodes(createOrSelectGroup(outputGroup, "nodes"), g, shapes); layout(g); positionNodes(nodes, g); positionEdgeLabels(edgeLabels, g); createEdgePaths(edgePathsGroup, g, arrows); var clusters = createClusters(clustersGroup, g); positionClusters(clusters, g); postProcessGraph(g); }; fn.createNodes = function(value) { if (!arguments.length) return createNodes; createNodes = value; return fn; }; fn.createClusters = function(value) { if (!arguments.length) return createClusters; createClusters = value; return fn; }; fn.createEdgeLabels = function(value) { if (!arguments.length) return createEdgeLabels; createEdgeLabels = value; return fn; }; fn.createEdgePaths = function(value) { if (!arguments.length) return createEdgePaths; createEdgePaths = value; return fn; }; fn.shapes = function(value) { if (!arguments.length) return shapes; shapes = value; return fn; }; fn.arrows = function(value) { if (!arguments.length) return arrows; arrows = value; return fn; }; return fn; } var NODE_DEFAULT_ATTRS = { paddingLeft: 10, paddingRight: 10, paddingTop: 10, paddingBottom: 10, rx: 0, ry: 0, shape: "rect" }; var EDGE_DEFAULT_ATTRS = { arrowhead: "normal", curve: d3.curveLinear }; function preProcessGraph(g) { g.nodes().forEach(function(v) { var node = g.node(v); if (!_.has(node, "label") && !g.children(v).length) { node.label = v; } if (_.has(node, "paddingX")) { _.defaults(node, { paddingLeft: node.paddingX, paddingRight: node.paddingX }); } if (_.has(node, "paddingY")) { _.defaults(node, { paddingTop: node.paddingY, paddingBottom: node.paddingY }); } if (_.has(node, "padding")) { _.defaults(node, { paddingLeft: node.padding, paddingRight: node.padding, paddingTop: node.padding, paddingBottom: node.padding }); } _.defaults(node, NODE_DEFAULT_ATTRS); _.each(["paddingLeft", "paddingRight", "paddingTop", "paddingBottom"], function(k) { node[k] = Number(node[k]); }); // Save dimensions for restore during post-processing if (_.has(node, "width")) { node._prevWidth = node.width; } if (_.has(node, "height")) { node._prevHeight = node.height; } }); g.edges().forEach(function(e) { var edge = g.edge(e); if (!_.has(edge, "label")) { edge.label = ""; } _.defaults(edge, EDGE_DEFAULT_ATTRS); }); } function postProcessGraph(g) { _.each(g.nodes(), function(v) { var node = g.node(v); // Restore original dimensions if (_.has(node, "_prevWidth")) { node.width = node._prevWidth; } else { delete node.width; } if (_.has(node, "_prevHeight")) { node.height = node._prevHeight; } else { delete node.height; } delete node._prevWidth; delete node._prevHeight; }); } function createOrSelectGroup(root, name) { var selection = root.select("g." + name); if (selection.empty()) { selection = root.append("g").attr("class", name); } return selection; } /***/ }), /***/ "./node_modules/dagre-d3/lib/shapes.js": /*!*********************************************!*\ !*** ./node_modules/dagre-d3/lib/shapes.js ***! \*********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var intersectRect = __webpack_require__(/*! ./intersect/intersect-rect */ "./node_modules/dagre-d3/lib/intersect/intersect-rect.js"); var intersectEllipse = __webpack_require__(/*! ./intersect/intersect-ellipse */ "./node_modules/dagre-d3/lib/intersect/intersect-ellipse.js"); var intersectCircle = __webpack_require__(/*! ./intersect/intersect-circle */ "./node_modules/dagre-d3/lib/intersect/intersect-circle.js"); var intersectPolygon = __webpack_require__(/*! ./intersect/intersect-polygon */ "./node_modules/dagre-d3/lib/intersect/intersect-polygon.js"); module.exports = { rect: rect, ellipse: ellipse, circle: circle, diamond: diamond }; function rect(parent, bbox, node) { var shapeSvg = parent.insert("rect", ":first-child") .attr("rx", node.rx) .attr("ry", node.ry) .attr("x", -bbox.width / 2) .attr("y", -bbox.height / 2) .attr("width", bbox.width) .attr("height", bbox.height); node.intersect = function(point) { return intersectRect(node, point); }; return shapeSvg; } function ellipse(parent, bbox, node) { var rx = bbox.width / 2; var ry = bbox.height / 2; var shapeSvg = parent.insert("ellipse", ":first-child") .attr("x", -bbox.width / 2) .attr("y", -bbox.height / 2) .attr("rx", rx) .attr("ry", ry); node.intersect = function(point) { return intersectEllipse(node, rx, ry, point); }; return shapeSvg; } function circle(parent, bbox, node) { var r = Math.max(bbox.width, bbox.height) / 2; var shapeSvg = parent.insert("circle", ":first-child") .attr("x", -bbox.width / 2) .attr("y", -bbox.height / 2) .attr("r", r); node.intersect = function(point) { return intersectCircle(node, r, point); }; return shapeSvg; } // Circumscribe an ellipse for the bounding box with a diamond shape. I derived // the function to calculate the diamond shape from: // http://mathforum.org/kb/message.jspa?messageID=3750236 function diamond(parent, bbox, node) { var w = (bbox.width * Math.SQRT2) / 2; var h = (bbox.height * Math.SQRT2) / 2; var points = [ { x: 0, y: -h }, { x: -w, y: 0 }, { x: 0, y: h }, { x: w, y: 0 } ]; var shapeSvg = parent.insert("polygon", ":first-child") .attr("points", points.map(function(p) { return p.x + "," + p.y; }).join(" ")); node.intersect = function(p) { return intersectPolygon(node, points, p); }; return shapeSvg; } /***/ }), /***/ "./node_modules/dagre-d3/lib/util.js": /*!*******************************************!*\ !*** ./node_modules/dagre-d3/lib/util.js ***! \*******************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre-d3/lib/lodash.js"); // Public utility functions module.exports = { isSubgraph: isSubgraph, edgeToId: edgeToId, applyStyle: applyStyle, applyClass: applyClass, applyTransition: applyTransition }; /* * Returns true if the specified node in the graph is a subgraph node. A * subgraph node is one that contains other nodes. */ function isSubgraph(g, v) { return !!g.children(v).length; } function edgeToId(e) { return escapeId(e.v) + ":" + escapeId(e.w) + ":" + escapeId(e.name); } var ID_DELIM = /:/g; function escapeId(str) { return str ? String(str).replace(ID_DELIM, "\\:") : ""; } function applyStyle(dom, styleFn) { if (styleFn) { dom.attr("style", styleFn); } } function applyClass(dom, classFn, otherClasses) { if (classFn) { dom .attr("class", classFn) .attr("class", otherClasses + " " + dom.attr("class")); } } function applyTransition(selection, g) { var graph = g.graph(); if (_.isPlainObject(graph)) { var transition = graph.transition; if (_.isFunction(transition)) { return transition(selection); } } return selection; } /***/ }), /***/ "./node_modules/dagre-d3/lib/version.js": /*!**********************************************!*\ !*** ./node_modules/dagre-d3/lib/version.js ***! \**********************************************/ /***/ ((module) => { module.exports = "0.6.4"; /***/ }), /***/ "./node_modules/dagre/index.js": /*!*************************************!*\ !*** ./node_modules/dagre/index.js ***! \*************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* Copyright (c) 2012-2014 Chris Pettitt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ module.exports = { graphlib: __webpack_require__(/*! ./lib/graphlib */ "./node_modules/dagre/lib/graphlib.js"), layout: __webpack_require__(/*! ./lib/layout */ "./node_modules/dagre/lib/layout.js"), debug: __webpack_require__(/*! ./lib/debug */ "./node_modules/dagre/lib/debug.js"), util: { time: (__webpack_require__(/*! ./lib/util */ "./node_modules/dagre/lib/util.js").time), notime: (__webpack_require__(/*! ./lib/util */ "./node_modules/dagre/lib/util.js").notime) }, version: __webpack_require__(/*! ./lib/version */ "./node_modules/dagre/lib/version.js") }; /***/ }), /***/ "./node_modules/dagre/lib/acyclic.js": /*!*******************************************!*\ !*** ./node_modules/dagre/lib/acyclic.js ***! \*******************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre/lib/lodash.js"); var greedyFAS = __webpack_require__(/*! ./greedy-fas */ "./node_modules/dagre/lib/greedy-fas.js"); module.exports = { run: run, undo: undo }; function run(g) { var fas = (g.graph().acyclicer === "greedy" ? greedyFAS(g, weightFn(g)) : dfsFAS(g)); _.forEach(fas, function(e) { var label = g.edge(e); g.removeEdge(e); label.forwardName = e.name; label.reversed = true; g.setEdge(e.w, e.v, label, _.uniqueId("rev")); }); function weightFn(g) { return function(e) { return g.edge(e).weight; }; } } function dfsFAS(g) { var fas = []; var stack = {}; var visited = {}; function dfs(v) { if (_.has(visited, v)) { return; } visited[v] = true; stack[v] = true; _.forEach(g.outEdges(v), function(e) { if (_.has(stack, e.w)) { fas.push(e); } else { dfs(e.w); } }); delete stack[v]; } _.forEach(g.nodes(), dfs); return fas; } function undo(g) { _.forEach(g.edges(), function(e) { var label = g.edge(e); if (label.reversed) { g.removeEdge(e); var forwardName = label.forwardName; delete label.reversed; delete label.forwardName; g.setEdge(e.w, e.v, label, forwardName); } }); } /***/ }), /***/ "./node_modules/dagre/lib/add-border-segments.js": /*!*******************************************************!*\ !*** ./node_modules/dagre/lib/add-border-segments.js ***! \*******************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre/lib/lodash.js"); var util = __webpack_require__(/*! ./util */ "./node_modules/dagre/lib/util.js"); module.exports = addBorderSegments; function addBorderSegments(g) { function dfs(v) { var children = g.children(v); var node = g.node(v); if (children.length) { _.forEach(children, dfs); } if (_.has(node, "minRank")) { node.borderLeft = []; node.borderRight = []; for (var rank = node.minRank, maxRank = node.maxRank + 1; rank < maxRank; ++rank) { addBorderNode(g, "borderLeft", "_bl", v, node, rank); addBorderNode(g, "borderRight", "_br", v, node, rank); } } } _.forEach(g.children(), dfs); } function addBorderNode(g, prop, prefix, sg, sgNode, rank) { var label = { width: 0, height: 0, rank: rank, borderType: prop }; var prev = sgNode[prop][rank - 1]; var curr = util.addDummyNode(g, "border", label, prefix); sgNode[prop][rank] = curr; g.setParent(curr, sg); if (prev) { g.setEdge(prev, curr, { weight: 1 }); } } /***/ }), /***/ "./node_modules/dagre/lib/coordinate-system.js": /*!*****************************************************!*\ !*** ./node_modules/dagre/lib/coordinate-system.js ***! \*****************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre/lib/lodash.js"); module.exports = { adjust: adjust, undo: undo }; function adjust(g) { var rankDir = g.graph().rankdir.toLowerCase(); if (rankDir === "lr" || rankDir === "rl") { swapWidthHeight(g); } } function undo(g) { var rankDir = g.graph().rankdir.toLowerCase(); if (rankDir === "bt" || rankDir === "rl") { reverseY(g); } if (rankDir === "lr" || rankDir === "rl") { swapXY(g); swapWidthHeight(g); } } function swapWidthHeight(g) { _.forEach(g.nodes(), function(v) { swapWidthHeightOne(g.node(v)); }); _.forEach(g.edges(), function(e) { swapWidthHeightOne(g.edge(e)); }); } function swapWidthHeightOne(attrs) { var w = attrs.width; attrs.width = attrs.height; attrs.height = w; } function reverseY(g) { _.forEach(g.nodes(), function(v) { reverseYOne(g.node(v)); }); _.forEach(g.edges(), function(e) { var edge = g.edge(e); _.forEach(edge.points, reverseYOne); if (_.has(edge, "y")) { reverseYOne(edge); } }); } function reverseYOne(attrs) { attrs.y = -attrs.y; } function swapXY(g) { _.forEach(g.nodes(), function(v) { swapXYOne(g.node(v)); }); _.forEach(g.edges(), function(e) { var edge = g.edge(e); _.forEach(edge.points, swapXYOne); if (_.has(edge, "x")) { swapXYOne(edge); } }); } function swapXYOne(attrs) { var x = attrs.x; attrs.x = attrs.y; attrs.y = x; } /***/ }), /***/ "./node_modules/dagre/lib/data/list.js": /*!*********************************************!*\ !*** ./node_modules/dagre/lib/data/list.js ***! \*********************************************/ /***/ ((module) => { /* * Simple doubly linked list implementation derived from Cormen, et al., * "Introduction to Algorithms". */ module.exports = List; function List() { var sentinel = {}; sentinel._next = sentinel._prev = sentinel; this._sentinel = sentinel; } List.prototype.dequeue = function() { var sentinel = this._sentinel; var entry = sentinel._prev; if (entry !== sentinel) { unlink(entry); return entry; } }; List.prototype.enqueue = function(entry) { var sentinel = this._sentinel; if (entry._prev && entry._next) { unlink(entry); } entry._next = sentinel._next; sentinel._next._prev = entry; sentinel._next = entry; entry._prev = sentinel; }; List.prototype.toString = function() { var strs = []; var sentinel = this._sentinel; var curr = sentinel._prev; while (curr !== sentinel) { strs.push(JSON.stringify(curr, filterOutLinks)); curr = curr._prev; } return "[" + strs.join(", ") + "]"; }; function unlink(entry) { entry._prev._next = entry._next; entry._next._prev = entry._prev; delete entry._next; delete entry._prev; } function filterOutLinks(k, v) { if (k !== "_next" && k !== "_prev") { return v; } } /***/ }), /***/ "./node_modules/dagre/lib/debug.js": /*!*****************************************!*\ !*** ./node_modules/dagre/lib/debug.js ***! \*****************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre/lib/lodash.js"); var util = __webpack_require__(/*! ./util */ "./node_modules/dagre/lib/util.js"); var Graph = (__webpack_require__(/*! ./graphlib */ "./node_modules/dagre/lib/graphlib.js").Graph); module.exports = { debugOrdering: debugOrdering }; /* istanbul ignore next */ function debugOrdering(g) { var layerMatrix = util.buildLayerMatrix(g); var h = new Graph({ compound: true, multigraph: true }).setGraph({}); _.forEach(g.nodes(), function(v) { h.setNode(v, { label: v }); h.setParent(v, "layer" + g.node(v).rank); }); _.forEach(g.edges(), function(e) { h.setEdge(e.v, e.w, {}, e.name); }); _.forEach(layerMatrix, function(layer, i) { var layerV = "layer" + i; h.setNode(layerV, { rank: "same" }); _.reduce(layer, function(u, v) { h.setEdge(u, v, { style: "invis" }); return v; }); }); return h; } /***/ }), /***/ "./node_modules/dagre/lib/graphlib.js": /*!********************************************!*\ !*** ./node_modules/dagre/lib/graphlib.js ***! \********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* global window */ var graphlib; if (true) { try { graphlib = __webpack_require__(/*! graphlib */ "./node_modules/graphlib/index.js"); } catch (e) { // continue regardless of error } } if (!graphlib) { graphlib = window.graphlib; } module.exports = graphlib; /***/ }), /***/ "./node_modules/dagre/lib/greedy-fas.js": /*!**********************************************!*\ !*** ./node_modules/dagre/lib/greedy-fas.js ***! \**********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre/lib/lodash.js"); var Graph = (__webpack_require__(/*! ./graphlib */ "./node_modules/dagre/lib/graphlib.js").Graph); var List = __webpack_require__(/*! ./data/list */ "./node_modules/dagre/lib/data/list.js"); /* * A greedy heuristic for finding a feedback arc set for a graph. A feedback * arc set is a set of edges that can be removed to make a graph acyclic. * The algorithm comes from: P. Eades, X. Lin, and W. F. Smyth, "A fast and * effective heuristic for the feedback arc set problem." This implementation * adjusts that from the paper to allow for weighted edges. */ module.exports = greedyFAS; var DEFAULT_WEIGHT_FN = _.constant(1); function greedyFAS(g, weightFn) { if (g.nodeCount() <= 1) { return []; } var state = buildState(g, weightFn || DEFAULT_WEIGHT_FN); var results = doGreedyFAS(state.graph, state.buckets, state.zeroIdx); // Expand multi-edges return _.flatten(_.map(results, function(e) { return g.outEdges(e.v, e.w); }), true); } function doGreedyFAS(g, buckets, zeroIdx) { var results = []; var sources = buckets[buckets.length - 1]; var sinks = buckets[0]; var entry; while (g.nodeCount()) { while ((entry = sinks.dequeue())) { removeNode(g, buckets, zeroIdx, entry); } while ((entry = sources.dequeue())) { removeNode(g, buckets, zeroIdx, entry); } if (g.nodeCount()) { for (var i = buckets.length - 2; i > 0; --i) { entry = buckets[i].dequeue(); if (entry) { results = results.concat(removeNode(g, buckets, zeroIdx, entry, true)); break; } } } } return results; } function removeNode(g, buckets, zeroIdx, entry, collectPredecessors) { var results = collectPredecessors ? [] : undefined; _.forEach(g.inEdges(entry.v), function(edge) { var weight = g.edge(edge); var uEntry = g.node(edge.v); if (collectPredecessors) { results.push({ v: edge.v, w: edge.w }); } uEntry.out -= weight; assignBucket(buckets, zeroIdx, uEntry); }); _.forEach(g.outEdges(entry.v), function(edge) { var weight = g.edge(edge); var w = edge.w; var wEntry = g.node(w); wEntry["in"] -= weight; assignBucket(buckets, zeroIdx, wEntry); }); g.removeNode(entry.v); return results; } function buildState(g, weightFn) { var fasGraph = new Graph(); var maxIn = 0; var maxOut = 0; _.forEach(g.nodes(), function(v) { fasGraph.setNode(v, { v: v, "in": 0, out: 0 }); }); // Aggregate weights on nodes, but also sum the weights across multi-edges // into a single edge for the fasGraph. _.forEach(g.edges(), function(e) { var prevWeight = fasGraph.edge(e.v, e.w) || 0; var weight = weightFn(e); var edgeWeight = prevWeight + weight; fasGraph.setEdge(e.v, e.w, edgeWeight); maxOut = Math.max(maxOut, fasGraph.node(e.v).out += weight); maxIn = Math.max(maxIn, fasGraph.node(e.w)["in"] += weight); }); var buckets = _.range(maxOut + maxIn + 3).map(function() { return new List(); }); var zeroIdx = maxIn + 1; _.forEach(fasGraph.nodes(), function(v) { assignBucket(buckets, zeroIdx, fasGraph.node(v)); }); return { graph: fasGraph, buckets: buckets, zeroIdx: zeroIdx }; } function assignBucket(buckets, zeroIdx, entry) { if (!entry.out) { buckets[0].enqueue(entry); } else if (!entry["in"]) { buckets[buckets.length - 1].enqueue(entry); } else { buckets[entry.out - entry["in"] + zeroIdx].enqueue(entry); } } /***/ }), /***/ "./node_modules/dagre/lib/layout.js": /*!******************************************!*\ !*** ./node_modules/dagre/lib/layout.js ***! \******************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre/lib/lodash.js"); var acyclic = __webpack_require__(/*! ./acyclic */ "./node_modules/dagre/lib/acyclic.js"); var normalize = __webpack_require__(/*! ./normalize */ "./node_modules/dagre/lib/normalize.js"); var rank = __webpack_require__(/*! ./rank */ "./node_modules/dagre/lib/rank/index.js"); var normalizeRanks = (__webpack_require__(/*! ./util */ "./node_modules/dagre/lib/util.js").normalizeRanks); var parentDummyChains = __webpack_require__(/*! ./parent-dummy-chains */ "./node_modules/dagre/lib/parent-dummy-chains.js"); var removeEmptyRanks = (__webpack_require__(/*! ./util */ "./node_modules/dagre/lib/util.js").removeEmptyRanks); var nestingGraph = __webpack_require__(/*! ./nesting-graph */ "./node_modules/dagre/lib/nesting-graph.js"); var addBorderSegments = __webpack_require__(/*! ./add-border-segments */ "./node_modules/dagre/lib/add-border-segments.js"); var coordinateSystem = __webpack_require__(/*! ./coordinate-system */ "./node_modules/dagre/lib/coordinate-system.js"); var order = __webpack_require__(/*! ./order */ "./node_modules/dagre/lib/order/index.js"); var position = __webpack_require__(/*! ./position */ "./node_modules/dagre/lib/position/index.js"); var util = __webpack_require__(/*! ./util */ "./node_modules/dagre/lib/util.js"); var Graph = (__webpack_require__(/*! ./graphlib */ "./node_modules/dagre/lib/graphlib.js").Graph); module.exports = layout; function layout(g, opts) { var time = opts && opts.debugTiming ? util.time : util.notime; time("layout", function() { var layoutGraph = time(" buildLayoutGraph", function() { return buildLayoutGraph(g); }); time(" runLayout", function() { runLayout(layoutGraph, time); }); time(" updateInputGraph", function() { updateInputGraph(g, layoutGraph); }); }); } function runLayout(g, time) { time(" makeSpaceForEdgeLabels", function() { makeSpaceForEdgeLabels(g); }); time(" removeSelfEdges", function() { removeSelfEdges(g); }); time(" acyclic", function() { acyclic.run(g); }); time(" nestingGraph.run", function() { nestingGraph.run(g); }); time(" rank", function() { rank(util.asNonCompoundGraph(g)); }); time(" injectEdgeLabelProxies", function() { injectEdgeLabelProxies(g); }); time(" removeEmptyRanks", function() { removeEmptyRanks(g); }); time(" nestingGraph.cleanup", function() { nestingGraph.cleanup(g); }); time(" normalizeRanks", function() { normalizeRanks(g); }); time(" assignRankMinMax", function() { assignRankMinMax(g); }); time(" removeEdgeLabelProxies", function() { removeEdgeLabelProxies(g); }); time(" normalize.run", function() { normalize.run(g); }); time(" parentDummyChains", function() { parentDummyChains(g); }); time(" addBorderSegments", function() { addBorderSegments(g); }); time(" order", function() { order(g); }); time(" insertSelfEdges", function() { insertSelfEdges(g); }); time(" adjustCoordinateSystem", function() { coordinateSystem.adjust(g); }); time(" position", function() { position(g); }); time(" positionSelfEdges", function() { positionSelfEdges(g); }); time(" removeBorderNodes", function() { removeBorderNodes(g); }); time(" normalize.undo", function() { normalize.undo(g); }); time(" fixupEdgeLabelCoords", function() { fixupEdgeLabelCoords(g); }); time(" undoCoordinateSystem", function() { coordinateSystem.undo(g); }); time(" translateGraph", function() { translateGraph(g); }); time(" assignNodeIntersects", function() { assignNodeIntersects(g); }); time(" reversePoints", function() { reversePointsForReversedEdges(g); }); time(" acyclic.undo", function() { acyclic.undo(g); }); } /* * Copies final layout information from the layout graph back to the input * graph. This process only copies whitelisted attributes from the layout graph * to the input graph, so it serves as a good place to determine what * attributes can influence layout. */ function updateInputGraph(inputGraph, layoutGraph) { _.forEach(inputGraph.nodes(), function(v) { var inputLabel = inputGraph.node(v); var layoutLabel = layoutGraph.node(v); if (inputLabel) { inputLabel.x = layoutLabel.x; inputLabel.y = layoutLabel.y; if (layoutGraph.children(v).length) { inputLabel.width = layoutLabel.width; inputLabel.height = layoutLabel.height; } } }); _.forEach(inputGraph.edges(), function(e) { var inputLabel = inputGraph.edge(e); var layoutLabel = layoutGraph.edge(e); inputLabel.points = layoutLabel.points; if (_.has(layoutLabel, "x")) { inputLabel.x = layoutLabel.x; inputLabel.y = layoutLabel.y; } }); inputGraph.graph().width = layoutGraph.graph().width; inputGraph.graph().height = layoutGraph.graph().height; } var graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"]; var graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }; var graphAttrs = ["acyclicer", "ranker", "rankdir", "align"]; var nodeNumAttrs = ["width", "height"]; var nodeDefaults = { width: 0, height: 0 }; var edgeNumAttrs = ["minlen", "weight", "width", "height", "labeloffset"]; var edgeDefaults = { minlen: 1, weight: 1, width: 0, height: 0, labeloffset: 10, labelpos: "r" }; var edgeAttrs = ["labelpos"]; /* * Constructs a new graph from the input graph, which can be used for layout. * This process copies only whitelisted attributes from the input graph to the * layout graph. Thus this function serves as a good place to determine what * attributes can influence layout. */ function buildLayoutGraph(inputGraph) { var g = new Graph({ multigraph: true, compound: true }); var graph = canonicalize(inputGraph.graph()); g.setGraph(_.merge({}, graphDefaults, selectNumberAttrs(graph, graphNumAttrs), _.pick(graph, graphAttrs))); _.forEach(inputGraph.nodes(), function(v) { var node = canonicalize(inputGraph.node(v)); g.setNode(v, _.defaults(selectNumberAttrs(node, nodeNumAttrs), nodeDefaults)); g.setParent(v, inputGraph.parent(v)); }); _.forEach(inputGraph.edges(), function(e) { var edge = canonicalize(inputGraph.edge(e)); g.setEdge(e, _.merge({}, edgeDefaults, selectNumberAttrs(edge, edgeNumAttrs), _.pick(edge, edgeAttrs))); }); return g; } /* * This idea comes from the Gansner paper: to account for edge labels in our * layout we split each rank in half by doubling minlen and halving ranksep. * Then we can place labels at these mid-points between nodes. * * We also add some minimal padding to the width to push the label for the edge * away from the edge itself a bit. */ function makeSpaceForEdgeLabels(g) { var graph = g.graph(); graph.ranksep /= 2; _.forEach(g.edges(), function(e) { var edge = g.edge(e); edge.minlen *= 2; if (edge.labelpos.toLowerCase() !== "c") { if (graph.rankdir === "TB" || graph.rankdir === "BT") { edge.width += edge.labeloffset; } else { edge.height += edge.labeloffset; } } }); } /* * Creates temporary dummy nodes that capture the rank in which each edge's * label is going to, if it has one of non-zero width and height. We do this * so that we can safely remove empty ranks while preserving balance for the * label's position. */ function injectEdgeLabelProxies(g) { _.forEach(g.edges(), function(e) { var edge = g.edge(e); if (edge.width && edge.height) { var v = g.node(e.v); var w = g.node(e.w); var label = { rank: (w.rank - v.rank) / 2 + v.rank, e: e }; util.addDummyNode(g, "edge-proxy", label, "_ep"); } }); } function assignRankMinMax(g) { var maxRank = 0; _.forEach(g.nodes(), function(v) { var node = g.node(v); if (node.borderTop) { node.minRank = g.node(node.borderTop).rank; node.maxRank = g.node(node.borderBottom).rank; maxRank = _.max(maxRank, node.maxRank); } }); g.graph().maxRank = maxRank; } function removeEdgeLabelProxies(g) { _.forEach(g.nodes(), function(v) { var node = g.node(v); if (node.dummy === "edge-proxy") { g.edge(node.e).labelRank = node.rank; g.removeNode(v); } }); } function translateGraph(g) { var minX = Number.POSITIVE_INFINITY; var maxX = 0; var minY = Number.POSITIVE_INFINITY; var maxY = 0; var graphLabel = g.graph(); var marginX = graphLabel.marginx || 0; var marginY = graphLabel.marginy || 0; function getExtremes(attrs) { var x = attrs.x; var y = attrs.y; var w = attrs.width; var h = attrs.height; minX = Math.min(minX, x - w / 2); maxX = Math.max(maxX, x + w / 2); minY = Math.min(minY, y - h / 2); maxY = Math.max(maxY, y + h / 2); } _.forEach(g.nodes(), function(v) { getExtremes(g.node(v)); }); _.forEach(g.edges(), function(e) { var edge = g.edge(e); if (_.has(edge, "x")) { getExtremes(edge); } }); minX -= marginX; minY -= marginY; _.forEach(g.nodes(), function(v) { var node = g.node(v); node.x -= minX; node.y -= minY; }); _.forEach(g.edges(), function(e) { var edge = g.edge(e); _.forEach(edge.points, function(p) { p.x -= minX; p.y -= minY; }); if (_.has(edge, "x")) { edge.x -= minX; } if (_.has(edge, "y")) { edge.y -= minY; } }); graphLabel.width = maxX - minX + marginX; graphLabel.height = maxY - minY + marginY; } function assignNodeIntersects(g) { _.forEach(g.edges(), function(e) { var edge = g.edge(e); var nodeV = g.node(e.v); var nodeW = g.node(e.w); var p1, p2; if (!edge.points) { edge.points = []; p1 = nodeW; p2 = nodeV; } else { p1 = edge.points[0]; p2 = edge.points[edge.points.length - 1]; } edge.points.unshift(util.intersectRect(nodeV, p1)); edge.points.push(util.intersectRect(nodeW, p2)); }); } function fixupEdgeLabelCoords(g) { _.forEach(g.edges(), function(e) { var edge = g.edge(e); if (_.has(edge, "x")) { if (edge.labelpos === "l" || edge.labelpos === "r") { edge.width -= edge.labeloffset; } switch (edge.labelpos) { case "l": edge.x -= edge.width / 2 + edge.labeloffset; break; case "r": edge.x += edge.width / 2 + edge.labeloffset; break; } } }); } function reversePointsForReversedEdges(g) { _.forEach(g.edges(), function(e) { var edge = g.edge(e); if (edge.reversed) { edge.points.reverse(); } }); } function removeBorderNodes(g) { _.forEach(g.nodes(), function(v) { if (g.children(v).length) { var node = g.node(v); var t = g.node(node.borderTop); var b = g.node(node.borderBottom); var l = g.node(_.last(node.borderLeft)); var r = g.node(_.last(node.borderRight)); node.width = Math.abs(r.x - l.x); node.height = Math.abs(b.y - t.y); node.x = l.x + node.width / 2; node.y = t.y + node.height / 2; } }); _.forEach(g.nodes(), function(v) { if (g.node(v).dummy === "border") { g.removeNode(v); } }); } function removeSelfEdges(g) { _.forEach(g.edges(), function(e) { if (e.v === e.w) { var node = g.node(e.v); if (!node.selfEdges) { node.selfEdges = []; } node.selfEdges.push({ e: e, label: g.edge(e) }); g.removeEdge(e); } }); } function insertSelfEdges(g) { var layers = util.buildLayerMatrix(g); _.forEach(layers, function(layer) { var orderShift = 0; _.forEach(layer, function(v, i) { var node = g.node(v); node.order = i + orderShift; _.forEach(node.selfEdges, function(selfEdge) { util.addDummyNode(g, "selfedge", { width: selfEdge.label.width, height: selfEdge.label.height, rank: node.rank, order: i + (++orderShift), e: selfEdge.e, label: selfEdge.label }, "_se"); }); delete node.selfEdges; }); }); } function positionSelfEdges(g) { _.forEach(g.nodes(), function(v) { var node = g.node(v); if (node.dummy === "selfedge") { var selfNode = g.node(node.e.v); var x = selfNode.x + selfNode.width / 2; var y = selfNode.y; var dx = node.x - x; var dy = selfNode.height / 2; g.setEdge(node.e, node.label); g.removeNode(v); node.label.points = [ { x: x + 2 * dx / 3, y: y - dy }, { x: x + 5 * dx / 6, y: y - dy }, { x: x + dx , y: y }, { x: x + 5 * dx / 6, y: y + dy }, { x: x + 2 * dx / 3, y: y + dy } ]; node.label.x = node.x; node.label.y = node.y; } }); } function selectNumberAttrs(obj, attrs) { return _.mapValues(_.pick(obj, attrs), Number); } function canonicalize(attrs) { var newAttrs = {}; _.forEach(attrs, function(v, k) { newAttrs[k.toLowerCase()] = v; }); return newAttrs; } /***/ }), /***/ "./node_modules/dagre/lib/lodash.js": /*!******************************************!*\ !*** ./node_modules/dagre/lib/lodash.js ***! \******************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* global window */ var lodash; if (true) { try { lodash = { cloneDeep: __webpack_require__(/*! lodash/cloneDeep */ "./node_modules/lodash/cloneDeep.js"), constant: __webpack_require__(/*! lodash/constant */ "./node_modules/lodash/constant.js"), defaults: __webpack_require__(/*! lodash/defaults */ "./node_modules/lodash/defaults.js"), each: __webpack_require__(/*! lodash/each */ "./node_modules/lodash/each.js"), filter: __webpack_require__(/*! lodash/filter */ "./node_modules/lodash/filter.js"), find: __webpack_require__(/*! lodash/find */ "./node_modules/lodash/find.js"), flatten: __webpack_require__(/*! lodash/flatten */ "./node_modules/lodash/flatten.js"), forEach: __webpack_require__(/*! lodash/forEach */ "./node_modules/lodash/forEach.js"), forIn: __webpack_require__(/*! lodash/forIn */ "./node_modules/lodash/forIn.js"), has: __webpack_require__(/*! lodash/has */ "./node_modules/lodash/has.js"), isUndefined: __webpack_require__(/*! lodash/isUndefined */ "./node_modules/lodash/isUndefined.js"), last: __webpack_require__(/*! lodash/last */ "./node_modules/lodash/last.js"), map: __webpack_require__(/*! lodash/map */ "./node_modules/lodash/map.js"), mapValues: __webpack_require__(/*! lodash/mapValues */ "./node_modules/lodash/mapValues.js"), max: __webpack_require__(/*! lodash/max */ "./node_modules/lodash/max.js"), merge: __webpack_require__(/*! lodash/merge */ "./node_modules/lodash/merge.js"), min: __webpack_require__(/*! lodash/min */ "./node_modules/lodash/min.js"), minBy: __webpack_require__(/*! lodash/minBy */ "./node_modules/lodash/minBy.js"), now: __webpack_require__(/*! lodash/now */ "./node_modules/lodash/now.js"), pick: __webpack_require__(/*! lodash/pick */ "./node_modules/lodash/pick.js"), range: __webpack_require__(/*! lodash/range */ "./node_modules/lodash/range.js"), reduce: __webpack_require__(/*! lodash/reduce */ "./node_modules/lodash/reduce.js"), sortBy: __webpack_require__(/*! lodash/sortBy */ "./node_modules/lodash/sortBy.js"), uniqueId: __webpack_require__(/*! lodash/uniqueId */ "./node_modules/lodash/uniqueId.js"), values: __webpack_require__(/*! lodash/values */ "./node_modules/lodash/values.js"), zipObject: __webpack_require__(/*! lodash/zipObject */ "./node_modules/lodash/zipObject.js"), }; } catch (e) { // continue regardless of error } } if (!lodash) { lodash = window._; } module.exports = lodash; /***/ }), /***/ "./node_modules/dagre/lib/nesting-graph.js": /*!*************************************************!*\ !*** ./node_modules/dagre/lib/nesting-graph.js ***! \*************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre/lib/lodash.js"); var util = __webpack_require__(/*! ./util */ "./node_modules/dagre/lib/util.js"); module.exports = { run: run, cleanup: cleanup }; /* * A nesting graph creates dummy nodes for the tops and bottoms of subgraphs, * adds appropriate edges to ensure that all cluster nodes are placed between * these boundries, and ensures that the graph is connected. * * In addition we ensure, through the use of the minlen property, that nodes * and subgraph border nodes to not end up on the same rank. * * Preconditions: * * 1. Input graph is a DAG * 2. Nodes in the input graph has a minlen attribute * * Postconditions: * * 1. Input graph is connected. * 2. Dummy nodes are added for the tops and bottoms of subgraphs. * 3. The minlen attribute for nodes is adjusted to ensure nodes do not * get placed on the same rank as subgraph border nodes. * * The nesting graph idea comes from Sander, "Layout of Compound Directed * Graphs." */ function run(g) { var root = util.addDummyNode(g, "root", {}, "_root"); var depths = treeDepths(g); var height = _.max(_.values(depths)) - 1; // Note: depths is an Object not an array var nodeSep = 2 * height + 1; g.graph().nestingRoot = root; // Multiply minlen by nodeSep to align nodes on non-border ranks. _.forEach(g.edges(), function(e) { g.edge(e).minlen *= nodeSep; }); // Calculate a weight that is sufficient to keep subgraphs vertically compact var weight = sumWeights(g) + 1; // Create border nodes and link them up _.forEach(g.children(), function(child) { dfs(g, root, nodeSep, weight, height, depths, child); }); // Save the multiplier for node layers for later removal of empty border // layers. g.graph().nodeRankFactor = nodeSep; } function dfs(g, root, nodeSep, weight, height, depths, v) { var children = g.children(v); if (!children.length) { if (v !== root) { g.setEdge(root, v, { weight: 0, minlen: nodeSep }); } return; } var top = util.addBorderNode(g, "_bt"); var bottom = util.addBorderNode(g, "_bb"); var label = g.node(v); g.setParent(top, v); label.borderTop = top; g.setParent(bottom, v); label.borderBottom = bottom; _.forEach(children, function(child) { dfs(g, root, nodeSep, weight, height, depths, child); var childNode = g.node(child); var childTop = childNode.borderTop ? childNode.borderTop : child; var childBottom = childNode.borderBottom ? childNode.borderBottom : child; var thisWeight = childNode.borderTop ? weight : 2 * weight; var minlen = childTop !== childBottom ? 1 : height - depths[v] + 1; g.setEdge(top, childTop, { weight: thisWeight, minlen: minlen, nestingEdge: true }); g.setEdge(childBottom, bottom, { weight: thisWeight, minlen: minlen, nestingEdge: true }); }); if (!g.parent(v)) { g.setEdge(root, top, { weight: 0, minlen: height + depths[v] }); } } function treeDepths(g) { var depths = {}; function dfs(v, depth) { var children = g.children(v); if (children && children.length) { _.forEach(children, function(child) { dfs(child, depth + 1); }); } depths[v] = depth; } _.forEach(g.children(), function(v) { dfs(v, 1); }); return depths; } function sumWeights(g) { return _.reduce(g.edges(), function(acc, e) { return acc + g.edge(e).weight; }, 0); } function cleanup(g) { var graphLabel = g.graph(); g.removeNode(graphLabel.nestingRoot); delete graphLabel.nestingRoot; _.forEach(g.edges(), function(e) { var edge = g.edge(e); if (edge.nestingEdge) { g.removeEdge(e); } }); } /***/ }), /***/ "./node_modules/dagre/lib/normalize.js": /*!*********************************************!*\ !*** ./node_modules/dagre/lib/normalize.js ***! \*********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre/lib/lodash.js"); var util = __webpack_require__(/*! ./util */ "./node_modules/dagre/lib/util.js"); module.exports = { run: run, undo: undo }; /* * Breaks any long edges in the graph into short segments that span 1 layer * each. This operation is undoable with the denormalize function. * * Pre-conditions: * * 1. The input graph is a DAG. * 2. Each node in the graph has a "rank" property. * * Post-condition: * * 1. All edges in the graph have a length of 1. * 2. Dummy nodes are added where edges have been split into segments. * 3. The graph is augmented with a "dummyChains" attribute which contains * the first dummy in each chain of dummy nodes produced. */ function run(g) { g.graph().dummyChains = []; _.forEach(g.edges(), function(edge) { normalizeEdge(g, edge); }); } function normalizeEdge(g, e) { var v = e.v; var vRank = g.node(v).rank; var w = e.w; var wRank = g.node(w).rank; var name = e.name; var edgeLabel = g.edge(e); var labelRank = edgeLabel.labelRank; if (wRank === vRank + 1) return; g.removeEdge(e); var dummy, attrs, i; for (i = 0, ++vRank; vRank < wRank; ++i, ++vRank) { edgeLabel.points = []; attrs = { width: 0, height: 0, edgeLabel: edgeLabel, edgeObj: e, rank: vRank }; dummy = util.addDummyNode(g, "edge", attrs, "_d"); if (vRank === labelRank) { attrs.width = edgeLabel.width; attrs.height = edgeLabel.height; attrs.dummy = "edge-label"; attrs.labelpos = edgeLabel.labelpos; } g.setEdge(v, dummy, { weight: edgeLabel.weight }, name); if (i === 0) { g.graph().dummyChains.push(dummy); } v = dummy; } g.setEdge(v, w, { weight: edgeLabel.weight }, name); } function undo(g) { _.forEach(g.graph().dummyChains, function(v) { var node = g.node(v); var origLabel = node.edgeLabel; var w; g.setEdge(node.edgeObj, origLabel); while (node.dummy) { w = g.successors(v)[0]; g.removeNode(v); origLabel.points.push({ x: node.x, y: node.y }); if (node.dummy === "edge-label") { origLabel.x = node.x; origLabel.y = node.y; origLabel.width = node.width; origLabel.height = node.height; } v = w; node = g.node(v); } }); } /***/ }), /***/ "./node_modules/dagre/lib/order/add-subgraph-constraints.js": /*!******************************************************************!*\ !*** ./node_modules/dagre/lib/order/add-subgraph-constraints.js ***! \******************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); module.exports = addSubgraphConstraints; function addSubgraphConstraints(g, cg, vs) { var prev = {}, rootPrev; _.forEach(vs, function(v) { var child = g.parent(v), parent, prevChild; while (child) { parent = g.parent(child); if (parent) { prevChild = prev[parent]; prev[parent] = child; } else { prevChild = rootPrev; rootPrev = child; } if (prevChild && prevChild !== child) { cg.setEdge(prevChild, child); return; } child = parent; } }); /* function dfs(v) { var children = v ? g.children(v) : g.children(); if (children.length) { var min = Number.POSITIVE_INFINITY, subgraphs = []; _.each(children, function(child) { var childMin = dfs(child); if (g.children(child).length) { subgraphs.push({ v: child, order: childMin }); } min = Math.min(min, childMin); }); _.reduce(_.sortBy(subgraphs, "order"), function(prev, curr) { cg.setEdge(prev.v, curr.v); return curr; }); return min; } return g.node(v).order; } dfs(undefined); */ } /***/ }), /***/ "./node_modules/dagre/lib/order/barycenter.js": /*!****************************************************!*\ !*** ./node_modules/dagre/lib/order/barycenter.js ***! \****************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); module.exports = barycenter; function barycenter(g, movable) { return _.map(movable, function(v) { var inV = g.inEdges(v); if (!inV.length) { return { v: v }; } else { var result = _.reduce(inV, function(acc, e) { var edge = g.edge(e), nodeU = g.node(e.v); return { sum: acc.sum + (edge.weight * nodeU.order), weight: acc.weight + edge.weight }; }, { sum: 0, weight: 0 }); return { v: v, barycenter: result.sum / result.weight, weight: result.weight }; } }); } /***/ }), /***/ "./node_modules/dagre/lib/order/build-layer-graph.js": /*!***********************************************************!*\ !*** ./node_modules/dagre/lib/order/build-layer-graph.js ***! \***********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); var Graph = (__webpack_require__(/*! ../graphlib */ "./node_modules/dagre/lib/graphlib.js").Graph); module.exports = buildLayerGraph; /* * Constructs a graph that can be used to sort a layer of nodes. The graph will * contain all base and subgraph nodes from the request layer in their original * hierarchy and any edges that are incident on these nodes and are of the type * requested by the "relationship" parameter. * * Nodes from the requested rank that do not have parents are assigned a root * node in the output graph, which is set in the root graph attribute. This * makes it easy to walk the hierarchy of movable nodes during ordering. * * Pre-conditions: * * 1. Input graph is a DAG * 2. Base nodes in the input graph have a rank attribute * 3. Subgraph nodes in the input graph has minRank and maxRank attributes * 4. Edges have an assigned weight * * Post-conditions: * * 1. Output graph has all nodes in the movable rank with preserved * hierarchy. * 2. Root nodes in the movable layer are made children of the node * indicated by the root attribute of the graph. * 3. Non-movable nodes incident on movable nodes, selected by the * relationship parameter, are included in the graph (without hierarchy). * 4. Edges incident on movable nodes, selected by the relationship * parameter, are added to the output graph. * 5. The weights for copied edges are aggregated as need, since the output * graph is not a multi-graph. */ function buildLayerGraph(g, rank, relationship) { var root = createRootNode(g), result = new Graph({ compound: true }).setGraph({ root: root }) .setDefaultNodeLabel(function(v) { return g.node(v); }); _.forEach(g.nodes(), function(v) { var node = g.node(v), parent = g.parent(v); if (node.rank === rank || node.minRank <= rank && rank <= node.maxRank) { result.setNode(v); result.setParent(v, parent || root); // This assumes we have only short edges! _.forEach(g[relationship](v), function(e) { var u = e.v === v ? e.w : e.v, edge = result.edge(u, v), weight = !_.isUndefined(edge) ? edge.weight : 0; result.setEdge(u, v, { weight: g.edge(e).weight + weight }); }); if (_.has(node, "minRank")) { result.setNode(v, { borderLeft: node.borderLeft[rank], borderRight: node.borderRight[rank] }); } } }); return result; } function createRootNode(g) { var v; while (g.hasNode((v = _.uniqueId("_root")))); return v; } /***/ }), /***/ "./node_modules/dagre/lib/order/cross-count.js": /*!*****************************************************!*\ !*** ./node_modules/dagre/lib/order/cross-count.js ***! \*****************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); module.exports = crossCount; /* * A function that takes a layering (an array of layers, each with an array of * ordererd nodes) and a graph and returns a weighted crossing count. * * Pre-conditions: * * 1. Input graph must be simple (not a multigraph), directed, and include * only simple edges. * 2. Edges in the input graph must have assigned weights. * * Post-conditions: * * 1. The graph and layering matrix are left unchanged. * * This algorithm is derived from Barth, et al., "Bilayer Cross Counting." */ function crossCount(g, layering) { var cc = 0; for (var i = 1; i < layering.length; ++i) { cc += twoLayerCrossCount(g, layering[i-1], layering[i]); } return cc; } function twoLayerCrossCount(g, northLayer, southLayer) { // Sort all of the edges between the north and south layers by their position // in the north layer and then the south. Map these edges to the position of // their head in the south layer. var southPos = _.zipObject(southLayer, _.map(southLayer, function (v, i) { return i; })); var southEntries = _.flatten(_.map(northLayer, function(v) { return _.sortBy(_.map(g.outEdges(v), function(e) { return { pos: southPos[e.w], weight: g.edge(e).weight }; }), "pos"); }), true); // Build the accumulator tree var firstIndex = 1; while (firstIndex < southLayer.length) firstIndex <<= 1; var treeSize = 2 * firstIndex - 1; firstIndex -= 1; var tree = _.map(new Array(treeSize), function() { return 0; }); // Calculate the weighted crossings var cc = 0; _.forEach(southEntries.forEach(function(entry) { var index = entry.pos + firstIndex; tree[index] += entry.weight; var weightSum = 0; while (index > 0) { if (index % 2) { weightSum += tree[index + 1]; } index = (index - 1) >> 1; tree[index] += entry.weight; } cc += entry.weight * weightSum; })); return cc; } /***/ }), /***/ "./node_modules/dagre/lib/order/index.js": /*!***********************************************!*\ !*** ./node_modules/dagre/lib/order/index.js ***! \***********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); var initOrder = __webpack_require__(/*! ./init-order */ "./node_modules/dagre/lib/order/init-order.js"); var crossCount = __webpack_require__(/*! ./cross-count */ "./node_modules/dagre/lib/order/cross-count.js"); var sortSubgraph = __webpack_require__(/*! ./sort-subgraph */ "./node_modules/dagre/lib/order/sort-subgraph.js"); var buildLayerGraph = __webpack_require__(/*! ./build-layer-graph */ "./node_modules/dagre/lib/order/build-layer-graph.js"); var addSubgraphConstraints = __webpack_require__(/*! ./add-subgraph-constraints */ "./node_modules/dagre/lib/order/add-subgraph-constraints.js"); var Graph = (__webpack_require__(/*! ../graphlib */ "./node_modules/dagre/lib/graphlib.js").Graph); var util = __webpack_require__(/*! ../util */ "./node_modules/dagre/lib/util.js"); module.exports = order; /* * Applies heuristics to minimize edge crossings in the graph and sets the best * order solution as an order attribute on each node. * * Pre-conditions: * * 1. Graph must be DAG * 2. Graph nodes must be objects with a "rank" attribute * 3. Graph edges must have the "weight" attribute * * Post-conditions: * * 1. Graph nodes will have an "order" attribute based on the results of the * algorithm. */ function order(g) { var maxRank = util.maxRank(g), downLayerGraphs = buildLayerGraphs(g, _.range(1, maxRank + 1), "inEdges"), upLayerGraphs = buildLayerGraphs(g, _.range(maxRank - 1, -1, -1), "outEdges"); var layering = initOrder(g); assignOrder(g, layering); var bestCC = Number.POSITIVE_INFINITY, best; for (var i = 0, lastBest = 0; lastBest < 4; ++i, ++lastBest) { sweepLayerGraphs(i % 2 ? downLayerGraphs : upLayerGraphs, i % 4 >= 2); layering = util.buildLayerMatrix(g); var cc = crossCount(g, layering); if (cc < bestCC) { lastBest = 0; best = _.cloneDeep(layering); bestCC = cc; } } assignOrder(g, best); } function buildLayerGraphs(g, ranks, relationship) { return _.map(ranks, function(rank) { return buildLayerGraph(g, rank, relationship); }); } function sweepLayerGraphs(layerGraphs, biasRight) { var cg = new Graph(); _.forEach(layerGraphs, function(lg) { var root = lg.graph().root; var sorted = sortSubgraph(lg, root, cg, biasRight); _.forEach(sorted.vs, function(v, i) { lg.node(v).order = i; }); addSubgraphConstraints(lg, cg, sorted.vs); }); } function assignOrder(g, layering) { _.forEach(layering, function(layer) { _.forEach(layer, function(v, i) { g.node(v).order = i; }); }); } /***/ }), /***/ "./node_modules/dagre/lib/order/init-order.js": /*!****************************************************!*\ !*** ./node_modules/dagre/lib/order/init-order.js ***! \****************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); module.exports = initOrder; /* * Assigns an initial order value for each node by performing a DFS search * starting from nodes in the first rank. Nodes are assigned an order in their * rank as they are first visited. * * This approach comes from Gansner, et al., "A Technique for Drawing Directed * Graphs." * * Returns a layering matrix with an array per layer and each layer sorted by * the order of its nodes. */ function initOrder(g) { var visited = {}; var simpleNodes = _.filter(g.nodes(), function(v) { return !g.children(v).length; }); var maxRank = _.max(_.map(simpleNodes, function(v) { return g.node(v).rank; })); var layers = _.map(_.range(maxRank + 1), function() { return []; }); function dfs(v) { if (_.has(visited, v)) return; visited[v] = true; var node = g.node(v); layers[node.rank].push(v); _.forEach(g.successors(v), dfs); } var orderedVs = _.sortBy(simpleNodes, function(v) { return g.node(v).rank; }); _.forEach(orderedVs, dfs); return layers; } /***/ }), /***/ "./node_modules/dagre/lib/order/resolve-conflicts.js": /*!***********************************************************!*\ !*** ./node_modules/dagre/lib/order/resolve-conflicts.js ***! \***********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); module.exports = resolveConflicts; /* * Given a list of entries of the form {v, barycenter, weight} and a * constraint graph this function will resolve any conflicts between the * constraint graph and the barycenters for the entries. If the barycenters for * an entry would violate a constraint in the constraint graph then we coalesce * the nodes in the conflict into a new node that respects the contraint and * aggregates barycenter and weight information. * * This implementation is based on the description in Forster, "A Fast and * Simple Hueristic for Constrained Two-Level Crossing Reduction," thought it * differs in some specific details. * * Pre-conditions: * * 1. Each entry has the form {v, barycenter, weight}, or if the node has * no barycenter, then {v}. * * Returns: * * A new list of entries of the form {vs, i, barycenter, weight}. The list * `vs` may either be a singleton or it may be an aggregation of nodes * ordered such that they do not violate constraints from the constraint * graph. The property `i` is the lowest original index of any of the * elements in `vs`. */ function resolveConflicts(entries, cg) { var mappedEntries = {}; _.forEach(entries, function(entry, i) { var tmp = mappedEntries[entry.v] = { indegree: 0, "in": [], out: [], vs: [entry.v], i: i }; if (!_.isUndefined(entry.barycenter)) { tmp.barycenter = entry.barycenter; tmp.weight = entry.weight; } }); _.forEach(cg.edges(), function(e) { var entryV = mappedEntries[e.v]; var entryW = mappedEntries[e.w]; if (!_.isUndefined(entryV) && !_.isUndefined(entryW)) { entryW.indegree++; entryV.out.push(mappedEntries[e.w]); } }); var sourceSet = _.filter(mappedEntries, function(entry) { return !entry.indegree; }); return doResolveConflicts(sourceSet); } function doResolveConflicts(sourceSet) { var entries = []; function handleIn(vEntry) { return function(uEntry) { if (uEntry.merged) { return; } if (_.isUndefined(uEntry.barycenter) || _.isUndefined(vEntry.barycenter) || uEntry.barycenter >= vEntry.barycenter) { mergeEntries(vEntry, uEntry); } }; } function handleOut(vEntry) { return function(wEntry) { wEntry["in"].push(vEntry); if (--wEntry.indegree === 0) { sourceSet.push(wEntry); } }; } while (sourceSet.length) { var entry = sourceSet.pop(); entries.push(entry); _.forEach(entry["in"].reverse(), handleIn(entry)); _.forEach(entry.out, handleOut(entry)); } return _.map(_.filter(entries, function(entry) { return !entry.merged; }), function(entry) { return _.pick(entry, ["vs", "i", "barycenter", "weight"]); }); } function mergeEntries(target, source) { var sum = 0; var weight = 0; if (target.weight) { sum += target.barycenter * target.weight; weight += target.weight; } if (source.weight) { sum += source.barycenter * source.weight; weight += source.weight; } target.vs = source.vs.concat(target.vs); target.barycenter = sum / weight; target.weight = weight; target.i = Math.min(source.i, target.i); source.merged = true; } /***/ }), /***/ "./node_modules/dagre/lib/order/sort-subgraph.js": /*!*******************************************************!*\ !*** ./node_modules/dagre/lib/order/sort-subgraph.js ***! \*******************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); var barycenter = __webpack_require__(/*! ./barycenter */ "./node_modules/dagre/lib/order/barycenter.js"); var resolveConflicts = __webpack_require__(/*! ./resolve-conflicts */ "./node_modules/dagre/lib/order/resolve-conflicts.js"); var sort = __webpack_require__(/*! ./sort */ "./node_modules/dagre/lib/order/sort.js"); module.exports = sortSubgraph; function sortSubgraph(g, v, cg, biasRight) { var movable = g.children(v); var node = g.node(v); var bl = node ? node.borderLeft : undefined; var br = node ? node.borderRight: undefined; var subgraphs = {}; if (bl) { movable = _.filter(movable, function(w) { return w !== bl && w !== br; }); } var barycenters = barycenter(g, movable); _.forEach(barycenters, function(entry) { if (g.children(entry.v).length) { var subgraphResult = sortSubgraph(g, entry.v, cg, biasRight); subgraphs[entry.v] = subgraphResult; if (_.has(subgraphResult, "barycenter")) { mergeBarycenters(entry, subgraphResult); } } }); var entries = resolveConflicts(barycenters, cg); expandSubgraphs(entries, subgraphs); var result = sort(entries, biasRight); if (bl) { result.vs = _.flatten([bl, result.vs, br], true); if (g.predecessors(bl).length) { var blPred = g.node(g.predecessors(bl)[0]), brPred = g.node(g.predecessors(br)[0]); if (!_.has(result, "barycenter")) { result.barycenter = 0; result.weight = 0; } result.barycenter = (result.barycenter * result.weight + blPred.order + brPred.order) / (result.weight + 2); result.weight += 2; } } return result; } function expandSubgraphs(entries, subgraphs) { _.forEach(entries, function(entry) { entry.vs = _.flatten(entry.vs.map(function(v) { if (subgraphs[v]) { return subgraphs[v].vs; } return v; }), true); }); } function mergeBarycenters(target, other) { if (!_.isUndefined(target.barycenter)) { target.barycenter = (target.barycenter * target.weight + other.barycenter * other.weight) / (target.weight + other.weight); target.weight += other.weight; } else { target.barycenter = other.barycenter; target.weight = other.weight; } } /***/ }), /***/ "./node_modules/dagre/lib/order/sort.js": /*!**********************************************!*\ !*** ./node_modules/dagre/lib/order/sort.js ***! \**********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); var util = __webpack_require__(/*! ../util */ "./node_modules/dagre/lib/util.js"); module.exports = sort; function sort(entries, biasRight) { var parts = util.partition(entries, function(entry) { return _.has(entry, "barycenter"); }); var sortable = parts.lhs, unsortable = _.sortBy(parts.rhs, function(entry) { return -entry.i; }), vs = [], sum = 0, weight = 0, vsIndex = 0; sortable.sort(compareWithBias(!!biasRight)); vsIndex = consumeUnsortable(vs, unsortable, vsIndex); _.forEach(sortable, function (entry) { vsIndex += entry.vs.length; vs.push(entry.vs); sum += entry.barycenter * entry.weight; weight += entry.weight; vsIndex = consumeUnsortable(vs, unsortable, vsIndex); }); var result = { vs: _.flatten(vs, true) }; if (weight) { result.barycenter = sum / weight; result.weight = weight; } return result; } function consumeUnsortable(vs, unsortable, index) { var last; while (unsortable.length && (last = _.last(unsortable)).i <= index) { unsortable.pop(); vs.push(last.vs); index++; } return index; } function compareWithBias(bias) { return function(entryV, entryW) { if (entryV.barycenter < entryW.barycenter) { return -1; } else if (entryV.barycenter > entryW.barycenter) { return 1; } return !bias ? entryV.i - entryW.i : entryW.i - entryV.i; }; } /***/ }), /***/ "./node_modules/dagre/lib/parent-dummy-chains.js": /*!*******************************************************!*\ !*** ./node_modules/dagre/lib/parent-dummy-chains.js ***! \*******************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre/lib/lodash.js"); module.exports = parentDummyChains; function parentDummyChains(g) { var postorderNums = postorder(g); _.forEach(g.graph().dummyChains, function(v) { var node = g.node(v); var edgeObj = node.edgeObj; var pathData = findPath(g, postorderNums, edgeObj.v, edgeObj.w); var path = pathData.path; var lca = pathData.lca; var pathIdx = 0; var pathV = path[pathIdx]; var ascending = true; while (v !== edgeObj.w) { node = g.node(v); if (ascending) { while ((pathV = path[pathIdx]) !== lca && g.node(pathV).maxRank < node.rank) { pathIdx++; } if (pathV === lca) { ascending = false; } } if (!ascending) { while (pathIdx < path.length - 1 && g.node(pathV = path[pathIdx + 1]).minRank <= node.rank) { pathIdx++; } pathV = path[pathIdx]; } g.setParent(v, pathV); v = g.successors(v)[0]; } }); } // Find a path from v to w through the lowest common ancestor (LCA). Return the // full path and the LCA. function findPath(g, postorderNums, v, w) { var vPath = []; var wPath = []; var low = Math.min(postorderNums[v].low, postorderNums[w].low); var lim = Math.max(postorderNums[v].lim, postorderNums[w].lim); var parent; var lca; // Traverse up from v to find the LCA parent = v; do { parent = g.parent(parent); vPath.push(parent); } while (parent && (postorderNums[parent].low > low || lim > postorderNums[parent].lim)); lca = parent; // Traverse from w to LCA parent = w; while ((parent = g.parent(parent)) !== lca) { wPath.push(parent); } return { path: vPath.concat(wPath.reverse()), lca: lca }; } function postorder(g) { var result = {}; var lim = 0; function dfs(v) { var low = lim; _.forEach(g.children(v), dfs); result[v] = { low: low, lim: lim++ }; } _.forEach(g.children(), dfs); return result; } /***/ }), /***/ "./node_modules/dagre/lib/position/bk.js": /*!***********************************************!*\ !*** ./node_modules/dagre/lib/position/bk.js ***! \***********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); var Graph = (__webpack_require__(/*! ../graphlib */ "./node_modules/dagre/lib/graphlib.js").Graph); var util = __webpack_require__(/*! ../util */ "./node_modules/dagre/lib/util.js"); /* * This module provides coordinate assignment based on Brandes and Köpf, "Fast * and Simple Horizontal Coordinate Assignment." */ module.exports = { positionX: positionX, findType1Conflicts: findType1Conflicts, findType2Conflicts: findType2Conflicts, addConflict: addConflict, hasConflict: hasConflict, verticalAlignment: verticalAlignment, horizontalCompaction: horizontalCompaction, alignCoordinates: alignCoordinates, findSmallestWidthAlignment: findSmallestWidthAlignment, balance: balance }; /* * Marks all edges in the graph with a type-1 conflict with the "type1Conflict" * property. A type-1 conflict is one where a non-inner segment crosses an * inner segment. An inner segment is an edge with both incident nodes marked * with the "dummy" property. * * This algorithm scans layer by layer, starting with the second, for type-1 * conflicts between the current layer and the previous layer. For each layer * it scans the nodes from left to right until it reaches one that is incident * on an inner segment. It then scans predecessors to determine if they have * edges that cross that inner segment. At the end a final scan is done for all * nodes on the current rank to see if they cross the last visited inner * segment. * * This algorithm (safely) assumes that a dummy node will only be incident on a * single node in the layers being scanned. */ function findType1Conflicts(g, layering) { var conflicts = {}; function visitLayer(prevLayer, layer) { var // last visited node in the previous layer that is incident on an inner // segment. k0 = 0, // Tracks the last node in this layer scanned for crossings with a type-1 // segment. scanPos = 0, prevLayerLength = prevLayer.length, lastNode = _.last(layer); _.forEach(layer, function(v, i) { var w = findOtherInnerSegmentNode(g, v), k1 = w ? g.node(w).order : prevLayerLength; if (w || v === lastNode) { _.forEach(layer.slice(scanPos, i +1), function(scanNode) { _.forEach(g.predecessors(scanNode), function(u) { var uLabel = g.node(u), uPos = uLabel.order; if ((uPos < k0 || k1 < uPos) && !(uLabel.dummy && g.node(scanNode).dummy)) { addConflict(conflicts, u, scanNode); } }); }); scanPos = i + 1; k0 = k1; } }); return layer; } _.reduce(layering, visitLayer); return conflicts; } function findType2Conflicts(g, layering) { var conflicts = {}; function scan(south, southPos, southEnd, prevNorthBorder, nextNorthBorder) { var v; _.forEach(_.range(southPos, southEnd), function(i) { v = south[i]; if (g.node(v).dummy) { _.forEach(g.predecessors(v), function(u) { var uNode = g.node(u); if (uNode.dummy && (uNode.order < prevNorthBorder || uNode.order > nextNorthBorder)) { addConflict(conflicts, u, v); } }); } }); } function visitLayer(north, south) { var prevNorthPos = -1, nextNorthPos, southPos = 0; _.forEach(south, function(v, southLookahead) { if (g.node(v).dummy === "border") { var predecessors = g.predecessors(v); if (predecessors.length) { nextNorthPos = g.node(predecessors[0]).order; scan(south, southPos, southLookahead, prevNorthPos, nextNorthPos); southPos = southLookahead; prevNorthPos = nextNorthPos; } } scan(south, southPos, south.length, nextNorthPos, north.length); }); return south; } _.reduce(layering, visitLayer); return conflicts; } function findOtherInnerSegmentNode(g, v) { if (g.node(v).dummy) { return _.find(g.predecessors(v), function(u) { return g.node(u).dummy; }); } } function addConflict(conflicts, v, w) { if (v > w) { var tmp = v; v = w; w = tmp; } var conflictsV = conflicts[v]; if (!conflictsV) { conflicts[v] = conflictsV = {}; } conflictsV[w] = true; } function hasConflict(conflicts, v, w) { if (v > w) { var tmp = v; v = w; w = tmp; } return _.has(conflicts[v], w); } /* * Try to align nodes into vertical "blocks" where possible. This algorithm * attempts to align a node with one of its median neighbors. If the edge * connecting a neighbor is a type-1 conflict then we ignore that possibility. * If a previous node has already formed a block with a node after the node * we're trying to form a block with, we also ignore that possibility - our * blocks would be split in that scenario. */ function verticalAlignment(g, layering, conflicts, neighborFn) { var root = {}, align = {}, pos = {}; // We cache the position here based on the layering because the graph and // layering may be out of sync. The layering matrix is manipulated to // generate different extreme alignments. _.forEach(layering, function(layer) { _.forEach(layer, function(v, order) { root[v] = v; align[v] = v; pos[v] = order; }); }); _.forEach(layering, function(layer) { var prevIdx = -1; _.forEach(layer, function(v) { var ws = neighborFn(v); if (ws.length) { ws = _.sortBy(ws, function(w) { return pos[w]; }); var mp = (ws.length - 1) / 2; for (var i = Math.floor(mp), il = Math.ceil(mp); i <= il; ++i) { var w = ws[i]; if (align[v] === v && prevIdx < pos[w] && !hasConflict(conflicts, v, w)) { align[w] = v; align[v] = root[v] = root[w]; prevIdx = pos[w]; } } } }); }); return { root: root, align: align }; } function horizontalCompaction(g, layering, root, align, reverseSep) { // This portion of the algorithm differs from BK due to a number of problems. // Instead of their algorithm we construct a new block graph and do two // sweeps. The first sweep places blocks with the smallest possible // coordinates. The second sweep removes unused space by moving blocks to the // greatest coordinates without violating separation. var xs = {}, blockG = buildBlockGraph(g, layering, root, reverseSep), borderType = reverseSep ? "borderLeft" : "borderRight"; function iterate(setXsFunc, nextNodesFunc) { var stack = blockG.nodes(); var elem = stack.pop(); var visited = {}; while (elem) { if (visited[elem]) { setXsFunc(elem); } else { visited[elem] = true; stack.push(elem); stack = stack.concat(nextNodesFunc(elem)); } elem = stack.pop(); } } // First pass, assign smallest coordinates function pass1(elem) { xs[elem] = blockG.inEdges(elem).reduce(function(acc, e) { return Math.max(acc, xs[e.v] + blockG.edge(e)); }, 0); } // Second pass, assign greatest coordinates function pass2(elem) { var min = blockG.outEdges(elem).reduce(function(acc, e) { return Math.min(acc, xs[e.w] - blockG.edge(e)); }, Number.POSITIVE_INFINITY); var node = g.node(elem); if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) { xs[elem] = Math.max(xs[elem], min); } } iterate(pass1, blockG.predecessors.bind(blockG)); iterate(pass2, blockG.successors.bind(blockG)); // Assign x coordinates to all nodes _.forEach(align, function(v) { xs[v] = xs[root[v]]; }); return xs; } function buildBlockGraph(g, layering, root, reverseSep) { var blockGraph = new Graph(), graphLabel = g.graph(), sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep); _.forEach(layering, function(layer) { var u; _.forEach(layer, function(v) { var vRoot = root[v]; blockGraph.setNode(vRoot); if (u) { var uRoot = root[u], prevMax = blockGraph.edge(uRoot, vRoot); blockGraph.setEdge(uRoot, vRoot, Math.max(sepFn(g, v, u), prevMax || 0)); } u = v; }); }); return blockGraph; } /* * Returns the alignment that has the smallest width of the given alignments. */ function findSmallestWidthAlignment(g, xss) { return _.minBy(_.values(xss), function (xs) { var max = Number.NEGATIVE_INFINITY; var min = Number.POSITIVE_INFINITY; _.forIn(xs, function (x, v) { var halfWidth = width(g, v) / 2; max = Math.max(x + halfWidth, max); min = Math.min(x - halfWidth, min); }); return max - min; }); } /* * Align the coordinates of each of the layout alignments such that * left-biased alignments have their minimum coordinate at the same point as * the minimum coordinate of the smallest width alignment and right-biased * alignments have their maximum coordinate at the same point as the maximum * coordinate of the smallest width alignment. */ function alignCoordinates(xss, alignTo) { var alignToVals = _.values(alignTo), alignToMin = _.min(alignToVals), alignToMax = _.max(alignToVals); _.forEach(["u", "d"], function(vert) { _.forEach(["l", "r"], function(horiz) { var alignment = vert + horiz, xs = xss[alignment], delta; if (xs === alignTo) return; var xsVals = _.values(xs); delta = horiz === "l" ? alignToMin - _.min(xsVals) : alignToMax - _.max(xsVals); if (delta) { xss[alignment] = _.mapValues(xs, function(x) { return x + delta; }); } }); }); } function balance(xss, align) { return _.mapValues(xss.ul, function(ignore, v) { if (align) { return xss[align.toLowerCase()][v]; } else { var xs = _.sortBy(_.map(xss, v)); return (xs[1] + xs[2]) / 2; } }); } function positionX(g) { var layering = util.buildLayerMatrix(g); var conflicts = _.merge( findType1Conflicts(g, layering), findType2Conflicts(g, layering)); var xss = {}; var adjustedLayering; _.forEach(["u", "d"], function(vert) { adjustedLayering = vert === "u" ? layering : _.values(layering).reverse(); _.forEach(["l", "r"], function(horiz) { if (horiz === "r") { adjustedLayering = _.map(adjustedLayering, function(inner) { return _.values(inner).reverse(); }); } var neighborFn = (vert === "u" ? g.predecessors : g.successors).bind(g); var align = verticalAlignment(g, adjustedLayering, conflicts, neighborFn); var xs = horizontalCompaction(g, adjustedLayering, align.root, align.align, horiz === "r"); if (horiz === "r") { xs = _.mapValues(xs, function(x) { return -x; }); } xss[vert + horiz] = xs; }); }); var smallestWidth = findSmallestWidthAlignment(g, xss); alignCoordinates(xss, smallestWidth); return balance(xss, g.graph().align); } function sep(nodeSep, edgeSep, reverseSep) { return function(g, v, w) { var vLabel = g.node(v); var wLabel = g.node(w); var sum = 0; var delta; sum += vLabel.width / 2; if (_.has(vLabel, "labelpos")) { switch (vLabel.labelpos.toLowerCase()) { case "l": delta = -vLabel.width / 2; break; case "r": delta = vLabel.width / 2; break; } } if (delta) { sum += reverseSep ? delta : -delta; } delta = 0; sum += (vLabel.dummy ? edgeSep : nodeSep) / 2; sum += (wLabel.dummy ? edgeSep : nodeSep) / 2; sum += wLabel.width / 2; if (_.has(wLabel, "labelpos")) { switch (wLabel.labelpos.toLowerCase()) { case "l": delta = wLabel.width / 2; break; case "r": delta = -wLabel.width / 2; break; } } if (delta) { sum += reverseSep ? delta : -delta; } delta = 0; return sum; }; } function width(g, v) { return g.node(v).width; } /***/ }), /***/ "./node_modules/dagre/lib/position/index.js": /*!**************************************************!*\ !*** ./node_modules/dagre/lib/position/index.js ***! \**************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); var util = __webpack_require__(/*! ../util */ "./node_modules/dagre/lib/util.js"); var positionX = (__webpack_require__(/*! ./bk */ "./node_modules/dagre/lib/position/bk.js").positionX); module.exports = position; function position(g) { g = util.asNonCompoundGraph(g); positionY(g); _.forEach(positionX(g), function(x, v) { g.node(v).x = x; }); } function positionY(g) { var layering = util.buildLayerMatrix(g); var rankSep = g.graph().ranksep; var prevY = 0; _.forEach(layering, function(layer) { var maxHeight = _.max(_.map(layer, function(v) { return g.node(v).height; })); _.forEach(layer, function(v) { g.node(v).y = prevY + maxHeight / 2; }); prevY += maxHeight + rankSep; }); } /***/ }), /***/ "./node_modules/dagre/lib/rank/feasible-tree.js": /*!******************************************************!*\ !*** ./node_modules/dagre/lib/rank/feasible-tree.js ***! \******************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); var Graph = (__webpack_require__(/*! ../graphlib */ "./node_modules/dagre/lib/graphlib.js").Graph); var slack = (__webpack_require__(/*! ./util */ "./node_modules/dagre/lib/rank/util.js").slack); module.exports = feasibleTree; /* * Constructs a spanning tree with tight edges and adjusted the input node's * ranks to achieve this. A tight edge is one that is has a length that matches * its "minlen" attribute. * * The basic structure for this function is derived from Gansner, et al., "A * Technique for Drawing Directed Graphs." * * Pre-conditions: * * 1. Graph must be a DAG. * 2. Graph must be connected. * 3. Graph must have at least one node. * 5. Graph nodes must have been previously assigned a "rank" property that * respects the "minlen" property of incident edges. * 6. Graph edges must have a "minlen" property. * * Post-conditions: * * - Graph nodes will have their rank adjusted to ensure that all edges are * tight. * * Returns a tree (undirected graph) that is constructed using only "tight" * edges. */ function feasibleTree(g) { var t = new Graph({ directed: false }); // Choose arbitrary node from which to start our tree var start = g.nodes()[0]; var size = g.nodeCount(); t.setNode(start, {}); var edge, delta; while (tightTree(t, g) < size) { edge = findMinSlackEdge(t, g); delta = t.hasNode(edge.v) ? slack(g, edge) : -slack(g, edge); shiftRanks(t, g, delta); } return t; } /* * Finds a maximal tree of tight edges and returns the number of nodes in the * tree. */ function tightTree(t, g) { function dfs(v) { _.forEach(g.nodeEdges(v), function(e) { var edgeV = e.v, w = (v === edgeV) ? e.w : edgeV; if (!t.hasNode(w) && !slack(g, e)) { t.setNode(w, {}); t.setEdge(v, w, {}); dfs(w); } }); } _.forEach(t.nodes(), dfs); return t.nodeCount(); } /* * Finds the edge with the smallest slack that is incident on tree and returns * it. */ function findMinSlackEdge(t, g) { return _.minBy(g.edges(), function(e) { if (t.hasNode(e.v) !== t.hasNode(e.w)) { return slack(g, e); } }); } function shiftRanks(t, g, delta) { _.forEach(t.nodes(), function(v) { g.node(v).rank += delta; }); } /***/ }), /***/ "./node_modules/dagre/lib/rank/index.js": /*!**********************************************!*\ !*** ./node_modules/dagre/lib/rank/index.js ***! \**********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var rankUtil = __webpack_require__(/*! ./util */ "./node_modules/dagre/lib/rank/util.js"); var longestPath = rankUtil.longestPath; var feasibleTree = __webpack_require__(/*! ./feasible-tree */ "./node_modules/dagre/lib/rank/feasible-tree.js"); var networkSimplex = __webpack_require__(/*! ./network-simplex */ "./node_modules/dagre/lib/rank/network-simplex.js"); module.exports = rank; /* * Assigns a rank to each node in the input graph that respects the "minlen" * constraint specified on edges between nodes. * * This basic structure is derived from Gansner, et al., "A Technique for * Drawing Directed Graphs." * * Pre-conditions: * * 1. Graph must be a connected DAG * 2. Graph nodes must be objects * 3. Graph edges must have "weight" and "minlen" attributes * * Post-conditions: * * 1. Graph nodes will have a "rank" attribute based on the results of the * algorithm. Ranks can start at any index (including negative), we'll * fix them up later. */ function rank(g) { switch(g.graph().ranker) { case "network-simplex": networkSimplexRanker(g); break; case "tight-tree": tightTreeRanker(g); break; case "longest-path": longestPathRanker(g); break; default: networkSimplexRanker(g); } } // A fast and simple ranker, but results are far from optimal. var longestPathRanker = longestPath; function tightTreeRanker(g) { longestPath(g); feasibleTree(g); } function networkSimplexRanker(g) { networkSimplex(g); } /***/ }), /***/ "./node_modules/dagre/lib/rank/network-simplex.js": /*!********************************************************!*\ !*** ./node_modules/dagre/lib/rank/network-simplex.js ***! \********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); var feasibleTree = __webpack_require__(/*! ./feasible-tree */ "./node_modules/dagre/lib/rank/feasible-tree.js"); var slack = (__webpack_require__(/*! ./util */ "./node_modules/dagre/lib/rank/util.js").slack); var initRank = (__webpack_require__(/*! ./util */ "./node_modules/dagre/lib/rank/util.js").longestPath); var preorder = (__webpack_require__(/*! ../graphlib */ "./node_modules/dagre/lib/graphlib.js").alg.preorder); var postorder = (__webpack_require__(/*! ../graphlib */ "./node_modules/dagre/lib/graphlib.js").alg.postorder); var simplify = (__webpack_require__(/*! ../util */ "./node_modules/dagre/lib/util.js").simplify); module.exports = networkSimplex; // Expose some internals for testing purposes networkSimplex.initLowLimValues = initLowLimValues; networkSimplex.initCutValues = initCutValues; networkSimplex.calcCutValue = calcCutValue; networkSimplex.leaveEdge = leaveEdge; networkSimplex.enterEdge = enterEdge; networkSimplex.exchangeEdges = exchangeEdges; /* * The network simplex algorithm assigns ranks to each node in the input graph * and iteratively improves the ranking to reduce the length of edges. * * Preconditions: * * 1. The input graph must be a DAG. * 2. All nodes in the graph must have an object value. * 3. All edges in the graph must have "minlen" and "weight" attributes. * * Postconditions: * * 1. All nodes in the graph will have an assigned "rank" attribute that has * been optimized by the network simplex algorithm. Ranks start at 0. * * * A rough sketch of the algorithm is as follows: * * 1. Assign initial ranks to each node. We use the longest path algorithm, * which assigns ranks to the lowest position possible. In general this * leads to very wide bottom ranks and unnecessarily long edges. * 2. Construct a feasible tight tree. A tight tree is one such that all * edges in the tree have no slack (difference between length of edge * and minlen for the edge). This by itself greatly improves the assigned * rankings by shorting edges. * 3. Iteratively find edges that have negative cut values. Generally a * negative cut value indicates that the edge could be removed and a new * tree edge could be added to produce a more compact graph. * * Much of the algorithms here are derived from Gansner, et al., "A Technique * for Drawing Directed Graphs." The structure of the file roughly follows the * structure of the overall algorithm. */ function networkSimplex(g) { g = simplify(g); initRank(g); var t = feasibleTree(g); initLowLimValues(t); initCutValues(t, g); var e, f; while ((e = leaveEdge(t))) { f = enterEdge(t, g, e); exchangeEdges(t, g, e, f); } } /* * Initializes cut values for all edges in the tree. */ function initCutValues(t, g) { var vs = postorder(t, t.nodes()); vs = vs.slice(0, vs.length - 1); _.forEach(vs, function(v) { assignCutValue(t, g, v); }); } function assignCutValue(t, g, child) { var childLab = t.node(child); var parent = childLab.parent; t.edge(child, parent).cutvalue = calcCutValue(t, g, child); } /* * Given the tight tree, its graph, and a child in the graph calculate and * return the cut value for the edge between the child and its parent. */ function calcCutValue(t, g, child) { var childLab = t.node(child); var parent = childLab.parent; // True if the child is on the tail end of the edge in the directed graph var childIsTail = true; // The graph's view of the tree edge we're inspecting var graphEdge = g.edge(child, parent); // The accumulated cut value for the edge between this node and its parent var cutValue = 0; if (!graphEdge) { childIsTail = false; graphEdge = g.edge(parent, child); } cutValue = graphEdge.weight; _.forEach(g.nodeEdges(child), function(e) { var isOutEdge = e.v === child, other = isOutEdge ? e.w : e.v; if (other !== parent) { var pointsToHead = isOutEdge === childIsTail, otherWeight = g.edge(e).weight; cutValue += pointsToHead ? otherWeight : -otherWeight; if (isTreeEdge(t, child, other)) { var otherCutValue = t.edge(child, other).cutvalue; cutValue += pointsToHead ? -otherCutValue : otherCutValue; } } }); return cutValue; } function initLowLimValues(tree, root) { if (arguments.length < 2) { root = tree.nodes()[0]; } dfsAssignLowLim(tree, {}, 1, root); } function dfsAssignLowLim(tree, visited, nextLim, v, parent) { var low = nextLim; var label = tree.node(v); visited[v] = true; _.forEach(tree.neighbors(v), function(w) { if (!_.has(visited, w)) { nextLim = dfsAssignLowLim(tree, visited, nextLim, w, v); } }); label.low = low; label.lim = nextLim++; if (parent) { label.parent = parent; } else { // TODO should be able to remove this when we incrementally update low lim delete label.parent; } return nextLim; } function leaveEdge(tree) { return _.find(tree.edges(), function(e) { return tree.edge(e).cutvalue < 0; }); } function enterEdge(t, g, edge) { var v = edge.v; var w = edge.w; // For the rest of this function we assume that v is the tail and w is the // head, so if we don't have this edge in the graph we should flip it to // match the correct orientation. if (!g.hasEdge(v, w)) { v = edge.w; w = edge.v; } var vLabel = t.node(v); var wLabel = t.node(w); var tailLabel = vLabel; var flip = false; // If the root is in the tail of the edge then we need to flip the logic that // checks for the head and tail nodes in the candidates function below. if (vLabel.lim > wLabel.lim) { tailLabel = wLabel; flip = true; } var candidates = _.filter(g.edges(), function(edge) { return flip === isDescendant(t, t.node(edge.v), tailLabel) && flip !== isDescendant(t, t.node(edge.w), tailLabel); }); return _.minBy(candidates, function(edge) { return slack(g, edge); }); } function exchangeEdges(t, g, e, f) { var v = e.v; var w = e.w; t.removeEdge(v, w); t.setEdge(f.v, f.w, {}); initLowLimValues(t); initCutValues(t, g); updateRanks(t, g); } function updateRanks(t, g) { var root = _.find(t.nodes(), function(v) { return !g.node(v).parent; }); var vs = preorder(t, root); vs = vs.slice(1); _.forEach(vs, function(v) { var parent = t.node(v).parent, edge = g.edge(v, parent), flipped = false; if (!edge) { edge = g.edge(parent, v); flipped = true; } g.node(v).rank = g.node(parent).rank + (flipped ? edge.minlen : -edge.minlen); }); } /* * Returns true if the edge is in the tree. */ function isTreeEdge(tree, u, v) { return tree.hasEdge(u, v); } /* * Returns true if the specified node is descendant of the root node per the * assigned low and lim attributes in the tree. */ function isDescendant(tree, vLabel, rootLabel) { return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim; } /***/ }), /***/ "./node_modules/dagre/lib/rank/util.js": /*!*********************************************!*\ !*** ./node_modules/dagre/lib/rank/util.js ***! \*********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! ../lodash */ "./node_modules/dagre/lib/lodash.js"); module.exports = { longestPath: longestPath, slack: slack }; /* * Initializes ranks for the input graph using the longest path algorithm. This * algorithm scales well and is fast in practice, it yields rather poor * solutions. Nodes are pushed to the lowest layer possible, leaving the bottom * ranks wide and leaving edges longer than necessary. However, due to its * speed, this algorithm is good for getting an initial ranking that can be fed * into other algorithms. * * This algorithm does not normalize layers because it will be used by other * algorithms in most cases. If using this algorithm directly, be sure to * run normalize at the end. * * Pre-conditions: * * 1. Input graph is a DAG. * 2. Input graph node labels can be assigned properties. * * Post-conditions: * * 1. Each node will be assign an (unnormalized) "rank" property. */ function longestPath(g) { var visited = {}; function dfs(v) { var label = g.node(v); if (_.has(visited, v)) { return label.rank; } visited[v] = true; var rank = _.min(_.map(g.outEdges(v), function(e) { return dfs(e.w) - g.edge(e).minlen; })); if (rank === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3 rank === undefined || // return value of _.map([]) for Lodash 4 rank === null) { // return value of _.map([null]) rank = 0; } return (label.rank = rank); } _.forEach(g.sources(), dfs); } /* * Returns the amount of slack for the given edge. The slack is defined as the * difference between the length of the edge and its minimum length. */ function slack(g, e) { return g.node(e.w).rank - g.node(e.v).rank - g.edge(e).minlen; } /***/ }), /***/ "./node_modules/dagre/lib/util.js": /*!****************************************!*\ !*** ./node_modules/dagre/lib/util.js ***! \****************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /* eslint "no-console": off */ var _ = __webpack_require__(/*! ./lodash */ "./node_modules/dagre/lib/lodash.js"); var Graph = (__webpack_require__(/*! ./graphlib */ "./node_modules/dagre/lib/graphlib.js").Graph); module.exports = { addDummyNode: addDummyNode, simplify: simplify, asNonCompoundGraph: asNonCompoundGraph, successorWeights: successorWeights, predecessorWeights: predecessorWeights, intersectRect: intersectRect, buildLayerMatrix: buildLayerMatrix, normalizeRanks: normalizeRanks, removeEmptyRanks: removeEmptyRanks, addBorderNode: addBorderNode, maxRank: maxRank, partition: partition, time: time, notime: notime }; /* * Adds a dummy node to the graph and return v. */ function addDummyNode(g, type, attrs, name) { var v; do { v = _.uniqueId(name); } while (g.hasNode(v)); attrs.dummy = type; g.setNode(v, attrs); return v; } /* * Returns a new graph with only simple edges. Handles aggregation of data * associated with multi-edges. */ function simplify(g) { var simplified = new Graph().setGraph(g.graph()); _.forEach(g.nodes(), function(v) { simplified.setNode(v, g.node(v)); }); _.forEach(g.edges(), function(e) { var simpleLabel = simplified.edge(e.v, e.w) || { weight: 0, minlen: 1 }; var label = g.edge(e); simplified.setEdge(e.v, e.w, { weight: simpleLabel.weight + label.weight, minlen: Math.max(simpleLabel.minlen, label.minlen) }); }); return simplified; } function asNonCompoundGraph(g) { var simplified = new Graph({ multigraph: g.isMultigraph() }).setGraph(g.graph()); _.forEach(g.nodes(), function(v) { if (!g.children(v).length) { simplified.setNode(v, g.node(v)); } }); _.forEach(g.edges(), function(e) { simplified.setEdge(e, g.edge(e)); }); return simplified; } function successorWeights(g) { var weightMap = _.map(g.nodes(), function(v) { var sucs = {}; _.forEach(g.outEdges(v), function(e) { sucs[e.w] = (sucs[e.w] || 0) + g.edge(e).weight; }); return sucs; }); return _.zipObject(g.nodes(), weightMap); } function predecessorWeights(g) { var weightMap = _.map(g.nodes(), function(v) { var preds = {}; _.forEach(g.inEdges(v), function(e) { preds[e.v] = (preds[e.v] || 0) + g.edge(e).weight; }); return preds; }); return _.zipObject(g.nodes(), weightMap); } /* * Finds where a line starting at point ({x, y}) would intersect a rectangle * ({x, y, width, height}) if it were pointing at the rectangle's center. */ function intersectRect(rect, point) { var x = rect.x; var y = rect.y; // Rectangle intersection algorithm from: // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes var dx = point.x - x; var dy = point.y - y; var w = rect.width / 2; var h = rect.height / 2; if (!dx && !dy) { throw new Error("Not possible to find intersection inside of the rectangle"); } var sx, sy; if (Math.abs(dy) * w > Math.abs(dx) * h) { // Intersection is top or bottom of rect. if (dy < 0) { h = -h; } sx = h * dx / dy; sy = h; } else { // Intersection is left or right of rect. if (dx < 0) { w = -w; } sx = w; sy = w * dy / dx; } return { x: x + sx, y: y + sy }; } /* * Given a DAG with each node assigned "rank" and "order" properties, this * function will produce a matrix with the ids of each node. */ function buildLayerMatrix(g) { var layering = _.map(_.range(maxRank(g) + 1), function() { return []; }); _.forEach(g.nodes(), function(v) { var node = g.node(v); var rank = node.rank; if (!_.isUndefined(rank)) { layering[rank][node.order] = v; } }); return layering; } /* * Adjusts the ranks for all nodes in the graph such that all nodes v have * rank(v) >= 0 and at least one node w has rank(w) = 0. */ function normalizeRanks(g) { var min = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; })); _.forEach(g.nodes(), function(v) { var node = g.node(v); if (_.has(node, "rank")) { node.rank -= min; } }); } function removeEmptyRanks(g) { // Ranks may not start at 0, so we need to offset them var offset = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; })); var layers = []; _.forEach(g.nodes(), function(v) { var rank = g.node(v).rank - offset; if (!layers[rank]) { layers[rank] = []; } layers[rank].push(v); }); var delta = 0; var nodeRankFactor = g.graph().nodeRankFactor; _.forEach(layers, function(vs, i) { if (_.isUndefined(vs) && i % nodeRankFactor !== 0) { --delta; } else if (delta) { _.forEach(vs, function(v) { g.node(v).rank += delta; }); } }); } function addBorderNode(g, prefix, rank, order) { var node = { width: 0, height: 0 }; if (arguments.length >= 4) { node.rank = rank; node.order = order; } return addDummyNode(g, "border", node, prefix); } function maxRank(g) { return _.max(_.map(g.nodes(), function(v) { var rank = g.node(v).rank; if (!_.isUndefined(rank)) { return rank; } })); } /* * Partition a collection into two groups: `lhs` and `rhs`. If the supplied * function returns true for an entry it goes into `lhs`. Otherwise it goes * into `rhs. */ function partition(collection, fn) { var result = { lhs: [], rhs: [] }; _.forEach(collection, function(value) { if (fn(value)) { result.lhs.push(value); } else { result.rhs.push(value); } }); return result; } /* * Returns a new function that wraps `fn` with a timer. The wrapper logs the * time it takes to execute the function. */ function time(name, fn) { var start = _.now(); try { return fn(); } finally { console.log(name + " time: " + (_.now() - start) + "ms"); } } function notime(name, fn) { return fn(); } /***/ }), /***/ "./node_modules/dagre/lib/version.js": /*!*******************************************!*\ !*** ./node_modules/dagre/lib/version.js ***! \*******************************************/ /***/ ((module) => { module.exports = "0.8.5"; /***/ }), /***/ "./node_modules/dompurify/dist/purify.js": /*!***********************************************!*\ !*** ./node_modules/dompurify/dist/purify.js ***! \***********************************************/ /***/ (function(module) { /*! @license DOMPurify 2.3.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.8/LICENSE */ (function (global, factory) { true ? module.exports = factory() : 0; })(this, (function () { 'use strict'; function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var hasOwnProperty = Object.hasOwnProperty, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var freeze = Object.freeze, seal = Object.seal, create = Object.create; // eslint-disable-line import/no-mutable-exports var _ref = typeof Reflect !== 'undefined' && Reflect, apply = _ref.apply, construct = _ref.construct; if (!apply) { apply = function apply(fun, thisValue, args) { return fun.apply(thisValue, args); }; } if (!freeze) { freeze = function freeze(x) { return x; }; } if (!seal) { seal = function seal(x) { return x; }; } if (!construct) { construct = function construct(Func, args) { return _construct(Func, _toConsumableArray(args)); }; } var arrayForEach = unapply(Array.prototype.forEach); var arrayPop = unapply(Array.prototype.pop); var arrayPush = unapply(Array.prototype.push); var stringToLowerCase = unapply(String.prototype.toLowerCase); var stringMatch = unapply(String.prototype.match); var stringReplace = unapply(String.prototype.replace); var stringIndexOf = unapply(String.prototype.indexOf); var stringTrim = unapply(String.prototype.trim); var regExpTest = unapply(RegExp.prototype.test); var typeErrorCreate = unconstruct(TypeError); function unapply(func) { return function (thisArg) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return apply(func, thisArg, args); }; } function unconstruct(func) { return function () { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return construct(func, args); }; } /* Add properties to a lookup table */ function addToSet(set, array) { if (setPrototypeOf) { // Make 'in' and truthy checks like Boolean(set.constructor) // independent of any properties defined on Object.prototype. // Prevent prototype setters from intercepting set as a this value. setPrototypeOf(set, null); } var l = array.length; while (l--) { var element = array[l]; if (typeof element === 'string') { var lcElement = stringToLowerCase(element); if (lcElement !== element) { // Config presets (e.g. tags.js, attrs.js) are immutable. if (!isFrozen(array)) { array[l] = lcElement; } element = lcElement; } } set[element] = true; } return set; } /* Shallow clone an object */ function clone(object) { var newObject = create(null); var property; for (property in object) { if (apply(hasOwnProperty, object, [property])) { newObject[property] = object[property]; } } return newObject; } /* IE10 doesn't support __lookupGetter__ so lets' * simulate it. It also automatically checks * if the prop is function or getter and behaves * accordingly. */ function lookupGetter(object, prop) { while (object !== null) { var desc = getOwnPropertyDescriptor(object, prop); if (desc) { if (desc.get) { return unapply(desc.get); } if (typeof desc.value === 'function') { return unapply(desc.value); } } object = getPrototypeOf(object); } function fallbackValue(element) { console.warn('fallback value for', element); return null; } return fallbackValue; } var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']); var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default. // We still need to know them so that we can do namespace // checks properly in case one wants to add them to // allow-list. var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']); var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); // Similarly to SVG, we want to know all MathML elements, // even those that we disallow by default. var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']); var text = freeze(['#text']); var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']); var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']); var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape ); var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex ); var DOCTYPE_NAME = seal(/^html$/i); var getGlobal = function getGlobal() { return typeof window === 'undefined' ? null : window; }; /** * Creates a no-op policy for internal use only. * Don't export this function outside this module! * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory. * @param {Document} document The document object (to determine policy name suffix) * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types * are not supported). */ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) { if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') { return null; } // Allow the callers to control the unique policy name // by adding a data-tt-policy-suffix to the script element with the DOMPurify. // Policy creation with duplicate names throws in Trusted Types. var suffix = null; var ATTR_NAME = 'data-tt-policy-suffix'; if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) { suffix = document.currentScript.getAttribute(ATTR_NAME); } var policyName = 'dompurify' + (suffix ? '#' + suffix : ''); try { return trustedTypes.createPolicy(policyName, { createHTML: function createHTML(html) { return html; } }); } catch (_) { // Policy creation failed (most likely another DOMPurify script has // already run). Skip creating the policy, as this will only cause errors // if TT are enforced. console.warn('TrustedTypes policy ' + policyName + ' could not be created.'); return null; } }; function createDOMPurify() { var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); var DOMPurify = function DOMPurify(root) { return createDOMPurify(root); }; /** * Version label, exposed for easier checks * if DOMPurify is up to date or not */ DOMPurify.version = '2.3.8'; /** * Array of elements that DOMPurify removed during sanitation. * Empty if nothing was removed. */ DOMPurify.removed = []; if (!window || !window.document || window.document.nodeType !== 9) { // Not running in a browser, provide a factory function // so that you can pass your own Window DOMPurify.isSupported = false; return DOMPurify; } var originalDocument = window.document; var document = window.document; var DocumentFragment = window.DocumentFragment, HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter, _window$NamedNodeMap = window.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap, HTMLFormElement = window.HTMLFormElement, DOMParser = window.DOMParser, trustedTypes = window.trustedTypes; var ElementPrototype = Element.prototype; var cloneNode = lookupGetter(ElementPrototype, 'cloneNode'); var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling'); var getChildNodes = lookupGetter(ElementPrototype, 'childNodes'); var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a // new document created via createHTMLDocument. As per the spec // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries) // a new empty registry is used when creating a template contents owner // document, so we use that as our parent document to ensure nothing // is inherited. if (typeof HTMLTemplateElement === 'function') { var template = document.createElement('template'); if (template.content && template.content.ownerDocument) { document = template.content.ownerDocument; } } var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : ''; var _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName; var importNode = originalDocument.importNode; var documentMode = {}; try { documentMode = clone(document).documentMode ? document.documentMode : {}; } catch (_) {} var hooks = {}; /** * Expose whether this browser supports running the full DOMPurify. */ DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9; var MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE; var IS_ALLOWED_URI$1 = IS_ALLOWED_URI; /** * We consider the elements and attributes below to be safe. Ideally * don't add any new ones but feel free to remove unwanted ones. */ /* allowed element names */ var ALLOWED_TAGS = null; var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text))); /* Allowed attribute names */ var ALLOWED_ATTR = null; var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml))); /* * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements. * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements) * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list) * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`. */ var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, { tagNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, allowCustomizedBuiltInElements: { writable: true, configurable: false, enumerable: true, value: false } })); /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ var FORBID_TAGS = null; /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ var FORBID_ATTR = null; /* Decide if ARIA attributes are okay */ var ALLOW_ARIA_ATTR = true; /* Decide if custom data attributes are okay */ var ALLOW_DATA_ATTR = true; /* Decide if unknown protocols are okay */ var ALLOW_UNKNOWN_PROTOCOLS = false; /* Output should be safe for common template engines. * This means, DOMPurify removes data attributes, mustaches and ERB */ var SAFE_FOR_TEMPLATES = false; /* Decide if document with ... should be returned */ var WHOLE_DOCUMENT = false; /* Track whether config is already set on this instance of DOMPurify. */ var SET_CONFIG = false; /* Decide if all elements (e.g. style, script) must be children of * document.body. By default, browsers might move them to document.head */ var FORCE_BODY = false; /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported). * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead */ var RETURN_DOM = false; /* Decide if a DOM `DocumentFragment` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported) */ var RETURN_DOM_FRAGMENT = false; /* Try to return a Trusted Type object instead of a string, return a string in * case Trusted Types are not supported */ var RETURN_TRUSTED_TYPE = false; /* Output should be free from DOM clobbering attacks? */ var SANITIZE_DOM = true; /* Keep element content when removing element? */ var KEEP_CONTENT = true; /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead * of importing it into a new Document and returning a sanitized copy */ var IN_PLACE = false; /* Allow usage of profiles like html, svg and mathMl */ var USE_PROFILES = {}; /* Tags to ignore content of when KEEP_CONTENT is true */ var FORBID_CONTENTS = null; var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']); /* Tags that are safe for data: URIs */ var DATA_URI_TAGS = null; var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']); /* Attributes safe for values like "javascript:" */ var URI_SAFE_ATTRIBUTES = null; var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']); var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; /* Document namespace */ var NAMESPACE = HTML_NAMESPACE; var IS_EMPTY_INPUT = false; /* Parsing of strict XHTML documents */ var PARSER_MEDIA_TYPE; var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html']; var DEFAULT_PARSER_MEDIA_TYPE = 'text/html'; var transformCaseFunc; /* Keep a reference to config to pass to hooks */ var CONFIG = null; /* Ideally, do not touch anything below this line */ /* ______________________________________________ */ var formElement = document.createElement('form'); var isRegexOrFunction = function isRegexOrFunction(testValue) { return testValue instanceof RegExp || testValue instanceof Function; }; /** * _parseConfig * * @param {Object} cfg optional config literal */ // eslint-disable-next-line complexity var _parseConfig = function _parseConfig(cfg) { if (CONFIG && CONFIG === cfg) { return; } /* Shield configuration object from tampering */ if (!cfg || _typeof(cfg) !== 'object') { cfg = {}; } /* Shield configuration object from prototype pollution */ cfg = clone(cfg); /* Set configuration parameters */ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS; ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR; URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES; DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS; FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS) : DEFAULT_FORBID_CONTENTS; FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {}; FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {}; USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false; ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false RETURN_DOM = cfg.RETURN_DOM || false; // Default false RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false FORCE_BODY = cfg.FORCE_BODY || false; // Default false SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true IN_PLACE = cfg.IN_PLACE || false; // Default false IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1; NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') { CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; } PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is. transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) { return x; } : stringToLowerCase; if (SAFE_FOR_TEMPLATES) { ALLOW_DATA_ATTR = false; } if (RETURN_DOM_FRAGMENT) { RETURN_DOM = true; } /* Parse profile info */ if (USE_PROFILES) { ALLOWED_TAGS = addToSet({}, _toConsumableArray(text)); ALLOWED_ATTR = []; if (USE_PROFILES.html === true) { addToSet(ALLOWED_TAGS, html$1); addToSet(ALLOWED_ATTR, html); } if (USE_PROFILES.svg === true) { addToSet(ALLOWED_TAGS, svg$1); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.svgFilters === true) { addToSet(ALLOWED_TAGS, svgFilters); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.mathMl === true) { addToSet(ALLOWED_TAGS, mathMl$1); addToSet(ALLOWED_ATTR, mathMl); addToSet(ALLOWED_ATTR, xml); } } /* Merge configuration parameters */ if (cfg.ADD_TAGS) { if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { ALLOWED_TAGS = clone(ALLOWED_TAGS); } addToSet(ALLOWED_TAGS, cfg.ADD_TAGS); } if (cfg.ADD_ATTR) { if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { ALLOWED_ATTR = clone(ALLOWED_ATTR); } addToSet(ALLOWED_ATTR, cfg.ADD_ATTR); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR); } if (cfg.FORBID_CONTENTS) { if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { FORBID_CONTENTS = clone(FORBID_CONTENTS); } addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS); } /* Add #text in case KEEP_CONTENT is set to true */ if (KEEP_CONTENT) { ALLOWED_TAGS['#text'] = true; } /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ if (WHOLE_DOCUMENT) { addToSet(ALLOWED_TAGS, ['html', 'head', 'body']); } /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ if (ALLOWED_TAGS.table) { addToSet(ALLOWED_TAGS, ['tbody']); delete FORBID_TAGS.tbody; } // Prevent further manipulation of configuration. // Not available in IE8, Safari 5, etc. if (freeze) { freeze(cfg); } CONFIG = cfg; }; var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML // namespace. We need to specify them explicitly // so that they don't get erroneously deleted from // HTML namespace. var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']); /* Keep track of all possible SVG and MathML tags * so that we can perform the namespace checks * correctly. */ var ALL_SVG_TAGS = addToSet({}, svg$1); addToSet(ALL_SVG_TAGS, svgFilters); addToSet(ALL_SVG_TAGS, svgDisallowed); var ALL_MATHML_TAGS = addToSet({}, mathMl$1); addToSet(ALL_MATHML_TAGS, mathMlDisallowed); /** * * * @param {Element} element a DOM element whose namespace is being checked * @returns {boolean} Return false if the element has a * namespace that a spec-compliant parser would never * return. Return true otherwise. */ var _checkValidNamespace = function _checkValidNamespace(element) { var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode // can be null. We just simulate parent in this case. if (!parent || !parent.tagName) { parent = { namespaceURI: HTML_NAMESPACE, tagName: 'template' }; } var tagName = stringToLowerCase(element.tagName); var parentTagName = stringToLowerCase(parent.tagName); if (element.namespaceURI === SVG_NAMESPACE) { // The only way to switch from HTML namespace to SVG // is via . If it happens via any other tag, then // it should be killed. if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === 'svg'; } // The only way to switch from MathML to SVG is via // svg if parent is either or MathML // text integration points. if (parent.namespaceURI === MATHML_NAMESPACE) { return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); } // We only allow elements that are defined in SVG // spec. All others are disallowed in SVG namespace. return Boolean(ALL_SVG_TAGS[tagName]); } if (element.namespaceURI === MATHML_NAMESPACE) { // The only way to switch from HTML namespace to MathML // is via . If it happens via any other tag, then // it should be killed. if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === 'math'; } // The only way to switch from SVG to MathML is via // and HTML integration points if (parent.namespaceURI === SVG_NAMESPACE) { return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName]; } // We only allow elements that are defined in MathML // spec. All others are disallowed in MathML namespace. return Boolean(ALL_MATHML_TAGS[tagName]); } if (element.namespaceURI === HTML_NAMESPACE) { // The only way to switch from SVG to HTML is via // HTML integration points, and from MathML to HTML // is via MathML text integration points if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { return false; } if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { return false; } // We disallow tags that are specific for MathML // or SVG and should never appear in HTML namespace return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); } // The code should never reach this place (this means // that the element somehow got namespace that is not // HTML, SVG or MathML). Return false just in case. return false; }; /** * _forceRemove * * @param {Node} node a DOM node */ var _forceRemove = function _forceRemove(node) { arrayPush(DOMPurify.removed, { element: node }); try { // eslint-disable-next-line unicorn/prefer-dom-node-remove node.parentNode.removeChild(node); } catch (_) { try { node.outerHTML = emptyHTML; } catch (_) { node.remove(); } } }; /** * _removeAttribute * * @param {String} name an Attribute name * @param {Node} node a DOM node */ var _removeAttribute = function _removeAttribute(name, node) { try { arrayPush(DOMPurify.removed, { attribute: node.getAttributeNode(name), from: node }); } catch (_) { arrayPush(DOMPurify.removed, { attribute: null, from: node }); } node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes if (name === 'is' && !ALLOWED_ATTR[name]) { if (RETURN_DOM || RETURN_DOM_FRAGMENT) { try { _forceRemove(node); } catch (_) {} } else { try { node.setAttribute(name, ''); } catch (_) {} } } }; /** * _initDocument * * @param {String} dirty a string of dirty markup * @return {Document} a DOM, filled with the dirty markup */ var _initDocument = function _initDocument(dirty) { /* Create a HTML document */ var doc; var leadingWhitespace; if (FORCE_BODY) { dirty = '' + dirty; } else { /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ var matches = stringMatch(dirty, /^[\r\n\t ]+/); leadingWhitespace = matches && matches[0]; } if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') { // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict) dirty = '' + dirty + ''; } var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; /* * Use the DOMParser API by default, fallback later if needs be * DOMParser not work for svg when has multiple root element. */ if (NAMESPACE === HTML_NAMESPACE) { try { doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); } catch (_) {} } /* Use createHTMLDocument in case DOMParser is not available */ if (!doc || !doc.documentElement) { doc = implementation.createDocument(NAMESPACE, 'template', null); try { doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload; } catch (_) {// Syntax error if dirtyPayload is invalid xml } } var body = doc.body || doc.documentElement; if (dirty && leadingWhitespace) { body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null); } /* Work on whole document or just its body */ if (NAMESPACE === HTML_NAMESPACE) { return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0]; } return WHOLE_DOCUMENT ? doc.documentElement : body; }; /** * _createIterator * * @param {Document} root document/fragment to create iterator for * @return {Iterator} iterator instance */ var _createIterator = function _createIterator(root) { return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false); }; /** * _isClobbered * * @param {Node} elm element to check for clobbering attacks * @return {Boolean} true if clobbered, false if safe */ var _isClobbered = function _isClobbered(elm) { return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function'); }; /** * _isNode * * @param {Node} obj object to check whether it's a DOM node * @return {Boolean} true is object is a DOM node */ var _isNode = function _isNode(object) { return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'; }; /** * _executeHook * Execute user configurable hooks * * @param {String} entryPoint Name of the hook's entry point * @param {Node} currentNode node to work on with the hook * @param {Object} data additional hook parameters */ var _executeHook = function _executeHook(entryPoint, currentNode, data) { if (!hooks[entryPoint]) { return; } arrayForEach(hooks[entryPoint], function (hook) { hook.call(DOMPurify, currentNode, data, CONFIG); }); }; /** * _sanitizeElements * * @protect nodeName * @protect textContent * @protect removeChild * * @param {Node} currentNode to check for permission to exist * @return {Boolean} true if node was killed, false if left alive */ var _sanitizeElements = function _sanitizeElements(currentNode) { var content; /* Execute a hook if present */ _executeHook('beforeSanitizeElements', currentNode, null); /* Check if element is clobbered or can clobber */ if (_isClobbered(currentNode)) { _forceRemove(currentNode); return true; } /* Check if tagname contains Unicode */ if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) { _forceRemove(currentNode); return true; } /* Now let's check the element's type and name */ var tagName = transformCaseFunc(currentNode.nodeName); /* Execute a hook if present */ _executeHook('uponSanitizeElement', currentNode, { tagName: tagName, allowedTags: ALLOWED_TAGS }); /* Detect mXSS attempts abusing namespace confusion */ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { _forceRemove(currentNode); return true; } /* Mitigate a problem with templates inside select */ if (tagName === 'select' && regExpTest(/