@dyx9/rosetta 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/.env.example +59 -0
  2. package/LICENSE +21 -0
  3. package/README.md +101 -2
  4. package/bin/rosetta.js +10 -0
  5. package/build/dist/assets/abnfDiagram-WEYOIA3C-CwZlxHkI.js +1 -0
  6. package/build/dist/assets/arc-B0x0q6O1.js +1 -0
  7. package/build/dist/assets/architecture-WOLXFQ4H-CkOpgBe5.js +1 -0
  8. package/build/dist/assets/architectureDiagram-ZHVYKT53-DT2OTBIB.js +36 -0
  9. package/build/dist/assets/array-BifhSqXX.js +1 -0
  10. package/build/dist/assets/bash-CLZ0U2zV.js +1 -0
  11. package/build/dist/assets/blockDiagram-RJAE7QA3-DXKyW4Qj.js +140 -0
  12. package/build/dist/assets/c4Diagram-XDPPPE54-CqHMZj3I.js +38 -0
  13. package/build/dist/assets/channel-BmjZSxDJ.js +1 -0
  14. package/build/dist/assets/chunk-2E7WHVMD-DTKlOCW9.js +88 -0
  15. package/build/dist/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  16. package/build/dist/assets/chunk-4EMNKR2T-BsnKxZVc.js +1 -0
  17. package/build/dist/assets/chunk-55XCU76K-Ddul4yK8.js +1 -0
  18. package/build/dist/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  19. package/build/dist/assets/chunk-7S6XSTFO-D73i4Kfs.js +2 -0
  20. package/build/dist/assets/chunk-AQDTSKZB-DJMpZsbr.js +72 -0
  21. package/build/dist/assets/chunk-DSNLSHJZ-KWPl82ns.js +129 -0
  22. package/build/dist/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
  23. package/build/dist/assets/chunk-HAGFOTED-Co5xWe5K.js +62 -0
  24. package/build/dist/assets/chunk-HNE4Q36P-D9ufLjJL.js +1 -0
  25. package/build/dist/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
  26. package/build/dist/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  27. package/build/dist/assets/chunk-NGNAAXSQ-C2Wy9Xmz.js +136 -0
  28. package/build/dist/assets/chunk-NQOKRVIF-DuVeWA2D.js +213 -0
  29. package/build/dist/assets/chunk-UHW7PFBP-DrzHcxiz.js +1 -0
  30. package/build/dist/assets/chunk-VQ5W62QI-tyK9wvZy.js +1 -0
  31. package/build/dist/assets/chunk-WQQL4CDK-BtfOu2ju.js +10 -0
  32. package/build/dist/assets/chunk-XXDRQBXY-BFig8xVb.js +1 -0
  33. package/build/dist/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  34. package/build/dist/assets/chunk-YZO67HFG-Cw5eVjq1.js +1 -0
  35. package/build/dist/assets/chunk-ZAUX2LTX-CIpKyMEe.js +1 -0
  36. package/build/dist/assets/chunk-ZCHMQSOR-Djve8pwS.js +2 -0
  37. package/build/dist/assets/classDiagram-v2-4MYWR3UA-D4XAcUCd.js +217 -0
  38. package/build/dist/assets/cose-bilkent-JH36ORCC-DHRGyJqU.js +1 -0
  39. package/build/dist/assets/cynefin-EF2NZ3EQ-Cv-uxuqE.js +1 -0
  40. package/build/dist/assets/cynefinDiagram-WF24UDRP-MFe-UzcY.js +62 -0
  41. package/build/dist/assets/cytoscape.esm-BegBNzOV.js +321 -0
  42. package/build/dist/assets/dagre-NK4GIZVX-BsY0-Q-N.js +4 -0
  43. package/build/dist/assets/defaultLocale-BFoDCU3G.js +1 -0
  44. package/build/dist/assets/diagram-CBK3MWTC-9zfXZ0bX.js +24 -0
  45. package/build/dist/assets/diagram-I5XIIV2D-CfWjvEof.js +24 -0
  46. package/build/dist/assets/diagram-ODIL2UCW-BpJaYO2i.js +30 -0
  47. package/build/dist/assets/diagram-PFBEJUXE-CtpxT_FQ.js +3 -0
  48. package/build/dist/assets/diagram-RJA3I4VV-DuLQrOcT.js +41 -0
  49. package/build/dist/assets/diagram-TYUNFSNR-w6Mohdl5.js +200 -0
  50. package/build/dist/assets/dist-DI7WHQIh.js +1 -0
  51. package/build/dist/assets/ebnfDiagram-V4P3TTPT-DlwHfKyL.js +1 -0
  52. package/build/dist/assets/elk-QONTBCTQ-DEvtD9nx.js +27 -0
  53. package/build/dist/assets/erDiagram-KYQIGQAA-DQuhkec3.js +99 -0
  54. package/build/dist/assets/eventmodeling-K75KTNOO-BO57PAOs.js +1 -0
  55. package/build/dist/assets/flowDiagram-IUGLLWBU-B_Ib7Avh.js +1 -0
  56. package/build/dist/assets/ganttDiagram-R7GPNTJY-CDGbtnUY.js +292 -0
  57. package/build/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  58. package/build/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  59. package/build/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  60. package/build/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  61. package/build/dist/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  62. package/build/dist/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  63. package/build/dist/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  64. package/build/dist/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  65. package/build/dist/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  66. package/build/dist/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  67. package/build/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  68. package/build/dist/assets/gitGraph-VSP46ZUC-D9ZZKP8z.js +1 -0
  69. package/build/dist/assets/gitGraphDiagram-PDYL7XHY-Da8Oypep.js +106 -0
  70. package/build/dist/assets/github-dark-C-LZuMrd.js +1 -0
  71. package/build/dist/assets/github-light-EUqPIrTm.js +1 -0
  72. package/build/dist/assets/graphlib-DS17s2tU.js +1 -0
  73. package/build/dist/assets/index-Cf0aBmwz.css +2 -0
  74. package/build/dist/assets/index-Ct3brajV.js +471 -0
  75. package/build/dist/assets/info-OHQRW6UA-BF836x6L.js +1 -0
  76. package/build/dist/assets/infoDiagram-MVDRKAX5-DpOoH-IR.js +2 -0
  77. package/build/dist/assets/init-C-OQMol4.js +1 -0
  78. package/build/dist/assets/ishikawaDiagram-HPEHV2GE-DT-Ft7vW.js +70 -0
  79. package/build/dist/assets/javascript-BgS3c2Ky.js +1 -0
  80. package/build/dist/assets/journeyDiagram-BOSHW7O7-BAF7tJ1H.js +139 -0
  81. package/build/dist/assets/json-qhed-kSA.js +1 -0
  82. package/build/dist/assets/kanban-definition-FNSA4HC5-B_w2r2eo.js +89 -0
  83. package/build/dist/assets/katex-B_JcIwqj.js +257 -0
  84. package/build/dist/assets/line-DMjgRylK.js +1 -0
  85. package/build/dist/assets/linear-BEdVl1PM.js +1 -0
  86. package/build/dist/assets/mermaid-parser.core-BDmgiU7m.js +7 -0
  87. package/build/dist/assets/mermaid.core-8Kj_dqOs.js +44 -0
  88. package/build/dist/assets/mindmap-definition-6OY57UG3-DOcaArfN.js +98 -0
  89. package/build/dist/assets/ordinal-BDEzSJ7C.js +1 -0
  90. package/build/dist/assets/packet-JDAUHWVQ-zWLPVpvX.js +1 -0
  91. package/build/dist/assets/path-fybaL0A-.js +1 -0
  92. package/build/dist/assets/pegDiagram-ECIUJNBX-sYwsFyAl.js +1 -0
  93. package/build/dist/assets/pie-XZMESJXO-B-h0LV9S.js +1 -0
  94. package/build/dist/assets/pieDiagram-GNMPY74T-FToCIvky.js +39 -0
  95. package/build/dist/assets/python-gzcpVVnB.js +1 -0
  96. package/build/dist/assets/quadrantDiagram-D57K4MC3-tiXtbFLP.js +7 -0
  97. package/build/dist/assets/radar-ABXABTNO--ew_ZFJl.js +1 -0
  98. package/build/dist/assets/railroad-I3PHUGI6-cxsf_ZsE.js +1 -0
  99. package/build/dist/assets/railroad-abnf-LNEFI6M7-BIK-9C0Z.js +1 -0
  100. package/build/dist/assets/railroad-ebnf-DWYD2UWJ-BHw1M8VQ.js +1 -0
  101. package/build/dist/assets/railroad-peg-JR7BVNR7-MHCdZHAZ.js +1 -0
  102. package/build/dist/assets/railroadDiagram-Y72NRBL7-wjsZpnJA.js +1 -0
  103. package/build/dist/assets/requirementDiagram-EQYSW5RA-CHkzAP3w.js +84 -0
  104. package/build/dist/assets/rough.esm-Dy-Kn_BL.js +1 -0
  105. package/build/dist/assets/sankeyDiagram-SY24JHO5-BBLq6ndO.js +40 -0
  106. package/build/dist/assets/sequenceDiagram-BLEHNHQU-DW_h9VZQ.js +169 -0
  107. package/build/dist/assets/sizeCapture-INFHLROL-3uHXrFqA.js +1 -0
  108. package/build/dist/assets/src-MbiMZlpk.js +1 -0
  109. package/build/dist/assets/stateDiagram-v2-A6IESKWZ-BgpDkVUs.js +291 -0
  110. package/build/dist/assets/swimlanes-B3ENRKFQ-DJHWFYmN.js +1 -0
  111. package/build/dist/assets/swimlanesDiagram-AYQRV4AK-Cq_MGOxD.js +8 -0
  112. package/build/dist/assets/timeline-definition-JXYKGLGB-DQ-XYDnd.js +120 -0
  113. package/build/dist/assets/treeView-D4JQ5SDB-ydIf6KAy.js +1 -0
  114. package/build/dist/assets/treemap-SAJKECNS-CB6tZuFJ.js +1 -0
  115. package/build/dist/assets/typescript-bsJCZSQ-.js +1 -0
  116. package/build/dist/assets/usecaseDiagram-WPOLBNNX-D_A5G5wv.js +328 -0
  117. package/build/dist/assets/vennDiagram-Q3Y3IDCW-j2yUit_4.js +34 -0
  118. package/build/dist/assets/wardley-7MLQ67FV-BztBXEva.js +1 -0
  119. package/build/dist/assets/wardleyDiagram-IVAIDKWA-CyrXADWS.js +78 -0
  120. package/build/dist/assets/xychartDiagram-4URNHDU4-BM2yVuEH.js +7 -0
  121. package/build/dist/favicon.svg +1 -0
  122. package/build/dist/icons.svg +24 -0
  123. package/build/dist/index.html +14 -0
  124. package/build/server/agent/conversation.js +244 -0
  125. package/build/server/agent/harness.js +435 -0
  126. package/build/server/agent/sessions.js +222 -0
  127. package/build/server/agent/turn.js +56 -0
  128. package/build/server/config.js +92 -0
  129. package/build/server/http/auth.js +31 -0
  130. package/build/server/http/chat.js +67 -0
  131. package/build/server/http/feedback.js +30 -0
  132. package/build/server/http/routes.js +231 -0
  133. package/build/server/http/stream.js +39 -0
  134. package/build/server/http/util.js +40 -0
  135. package/build/server/index.js +112 -0
  136. package/build/server/records/operations.js +53 -0
  137. package/build/server/records/recording.js +186 -0
  138. package/build/server/records/turn-recording.js +151 -0
  139. package/build/server/stone/file-boundary.js +57 -0
  140. package/build/server/stone/prompt.js +83 -0
  141. package/build/server/stone/stone.js +245 -0
  142. package/build/server/stone/verify.js +141 -0
  143. package/build/src/shared/protocol.js +25 -0
  144. package/build/stones/example/AGENTS.md +25 -0
  145. package/build/stones/example/checks/hotspot.py +74 -0
  146. package/build/stones/example/checks/syntax.py +13 -0
  147. package/build/stones/example/constraints/rig-limits.md +15 -0
  148. package/build/stones/example/docs/reference.md +26 -0
  149. package/build/stones/example/examples/good/crossfade.py +15 -0
  150. package/build/stones/example/examples/violations/hotspot.py +17 -0
  151. package/build/stones/example/rosetta.json +23 -0
  152. package/build/stones/example/skills/writing-cues/SKILL.md +21 -0
  153. package/package.json +74 -4
@@ -0,0 +1,200 @@
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-MbiMZlpk.js";import{C as r,G as i,H as a,U as o,_ as s,a as c,at as l,b as u,d,et as f,q as p,s as m,v as h}from"./chunk-DSNLSHJZ-KWPl82ns.js";import{t as g}from"./channel-BmjZSxDJ.js";import{_,c as v}from"./chunk-7S6XSTFO-D73i4Kfs.js";import"./chunk-YZO67HFG-Cw5eVjq1.js";import"./chunk-AQDTSKZB-DJMpZsbr.js";import{t as y}from"./chunk-5VM5RSS4-ZNzvKenW.js";import"./chunk-UHW7PFBP-DrzHcxiz.js";import{i as b,n as x,o as S,r as C}from"./chunk-J5ZVWO5B-oDCd-gWO.js";import{a as w}from"./chunk-HAGFOTED-Co5xWe5K.js";import"./chunk-ZAUX2LTX-CIpKyMEe.js";import"./chunk-WQQL4CDK-BtfOu2ju.js";import{t as T}from"./chunk-55XCU76K-Ddul4yK8.js";import{t as E}from"./chunk-XXDRQBXY-BFig8xVb.js";import{t as D}from"./chunk-VQ5W62QI-tyK9wvZy.js";import"./chunk-HNE4Q36P-D9ufLjJL.js";import{i as O,n as k,r as A,t as j}from"./mermaid.core-8Kj_dqOs.js";var M={SHAPE_UNSUPPORTED:`SHAPE_UNSUPPORTED`,SHAPE_REMOVED:`SHAPE_REMOVED`,EDGE_OPERATOR_UNSUPPORTED:`EDGE_OPERATOR_UNSUPPORTED`,REFERENCE_EDGE_LABEL_REJECTED:`REFERENCE_EDGE_LABEL_REJECTED`,CONNECTOR_REF_UNRESOLVED:`CONNECTOR_REF_UNRESOLVED`,CONNECTOR_REF_NOT_A_CONNECTOR:`CONNECTOR_REF_NOT_A_CONNECTOR`,METADATA_KEY_MISAPPLIED:`METADATA_KEY_MISAPPLIED`,DUPLICATE_ID_NODE:`DUPLICATE_ID_NODE`,RESERVED_SYNTHETIC_ID:`RESERVED_SYNTHETIC_ID`,CONTAINMENT_VIOLATION:`CONTAINMENT_VIOLATION`,EDGE_SEMANTIC_CONTRADICTION:`EDGE_SEMANTIC_CONTRADICTION`,FLOW_NO_INPUT:`FLOW_NO_INPUT`},N=new Set([M.SHAPE_UNSUPPORTED,M.SHAPE_REMOVED,M.CONTAINMENT_VIOLATION]);new Set(Object.values(M).filter(e=>!N.has(e)));var P=new Map([[`task`,`roundedRect`],[`tool`,`subroutine`],[`input`,`lean-right`],[`decision`,`diamond`],[`refdoc`,`lin-doc`],[`action`,`hexagon`],[`round`,`rect`]]),ee=new Set(`doc.stadium.terminal.circle.trapezoid.inv_trapezoid.inv-trapezoid.doublecircle.double-circle.typeDeclaration.procs.lean_left.lean-left.in-out.cylinder.ellipse.odd.tag-rect.tagged-rectangle.delay.half-rounded-rectangle.lin-rect.lined-rectangle.win-pane.window-pane.curv-trap.curved-trapezoid`.split(`.`)),te=new Set([`roundedRect`,`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`lean-right`,`diamond`,`lin-doc`,`lined-document`,`hexagon`,`hex`,`connector`,`collapsedGroup`]),F=`roundedRect`;function I(e){return e&&(P.get(e)??e)}e(I,`resolveShapeAlias`);function ne(e,n){for(let r of e)if(!r.isGroup){if((!r.shape||r.shape===`squareRect`||r.shape===`rect`)&&(r.shape=F),ee.has(r.shape)){let e=`shape "${r.shape}" was removed in v0.8.1, using "${F}"`;n?.emitError?n.emitError(`SHAPE_REMOVED`,e,{nodeId:r.id}):t.warn(`agentflow: ${e}`),r.shape=F}else if(!te.has(r.shape)){let e=`shape "${r.shape}" is not supported, using "${F}"`;n?.emitWarning?n.emitWarning(`SHAPE_UNSUPPORTED`,e,{nodeId:r.id}):t.warn(`agentflow: ${e}`),r.shape=F}}}e(ne,`normaliseNodeShapes`);var L=new Map([[`tool`,0],[`task`,1],[`decision`,2],[`input`,3],[`refdoc`,4],[`connector`,5],[`action`,6]]),R=L.size,z=e(e=>`af-kind-${e}`,`kindClass`),B=[...L.keys()],V=e(e=>Math.max(1,e-R),`containerSlotCount`),H=e((e,t)=>{let n=R+e%V(t);return t>0?n%t:n},`containerSlot`);function re(e,t,n){let r=u().themeVariables?.borderColorArray,i=Array.isArray(r)?r.length:0,a=n.size;for(let r of e??[]){if(r.isGroup||r.shape===`collapsedGroup`){r.colorIndex=H(n.get(String(r.id))??a++,i);continue}let e=t(String(r.id));e&&L.has(e)&&(r.cssClasses=`${r.cssClasses??``} ${z(e)}`.replace(/\s+/g,` `).trim())}}e(re,`assignColorSlots`);var ie=`agentflow-`,ae=new Set([`shape`,`view`,`icon`,`img`,`form`,`pos`,`w`,`h`,`class`,`style`,`labelType`]),oe=new Set([`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`tool`]),se={flow:`flowGroup`};function ce(e){if(Array.isArray(e))return e.map(e=>ce(e));if(typeof e!=`object`||!e)return e;let t={};for(let n of Object.keys(e))n!==`__proto__`&&n!==`constructor`&&n!==`prototype`&&(t[n]=ce(e[n]));return t}e(ce,`stripPrototypeKeys`);function le(e){let t=!1,n=!1,r=0,i,a=[];for(let o of e.split(`
2
+ `)){if(i!==void 0){let e=o.length-o.trimStart().length;if(o.trim()===``||e>i){a.push(o);continue}i=void 0}let e=-1;for(let i=0;i<o.length;i++){let a=o[i];if(n)a===`\\`?i++:a===`"`&&(n=!1);else if(t)a===`'`&&(t=!1);else if(a===`"`)n=!0;else if(a===`'`)t=!0;else if(a===`#`&&(i===0||o[i-1]===` `||o[i-1]===` `)){e=i;break}else a===`[`||a===`{`?r++:(a===`]`||a===`}`)&&(r=Math.max(0,r-1))}if(t||n||r>0){a.push(o);continue}let s=e>=0?o.slice(0,e):o,c=e>=0?o.slice(e):``;/:\s*[>|][\d+-]*\s*$/.test(s)?(i=o.length-o.trimStart().length,a.push(o)):a.push(s.replace(/,([\t ]*)$/,`$1`)+c)}return a.join(`
3
+ `)}e(le,`stripLineTrailingCommas`);var ue=class{constructor(){this.vertexCounter=0,this.config=u(),this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.globalNodes=new Set,this.connectors=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.diagramId=``,this.preserveCommentsWhenParsing=!0,this.frontmatterLineOffset=0,this.elementMappings=[],this.bareVertexMappings=new WeakSet,this.diagnostics=[],this.postParseValidationRun=!1,this.funs=[],this.setAccTitle=o,this.setAccDescription=a,this.setDiagramTitle=p,this.getAccTitle=h,this.getAccDescription=s,this.getDiagramTitle=r,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addGlobal=this.addGlobal.bind(this),this.addConnector=this.addConnector.bind(this),this.addConnectorMapping=this.addConnectorMapping.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.setFrontmatterLineOffset=this.setFrontmatterLineOffset.bind(this),this.addVertexMapping=this.addVertexMapping.bind(this),this.extendVertexMapping=this.extendVertexMapping.bind(this),this.addEdgeMapping=this.addEdgeMapping.bind(this),this.addSubgraphMapping=this.addSubgraphMapping.bind(this),this.emitWarning=this.emitWarning.bind(this),this.emitError=this.emitError.bind(this),this.getDiagnostics=this.getDiagnostics.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen(`gen-2`)}static{e(this,`AgentFlowDB`)}sanitizeText(e){return m.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case`markdown`:case`string`:case`text`:return e;default:return`markdown`}}setDiagramId(e){this.diagramId=e}lookUpDomId(e){for(let t of this.vertices.values())if(t.id===e)return this.diagramId?`${this.diagramId}-${t.domId}`:t.domId;return this.diagramId?`${this.diagramId}-${e}`:e}addVertex(e,t,n,r,i,a,o={},s,c){if(!e||e.trim().length===0)return;let l;if(s!==void 0){let e;e=s.includes(`
4
+ `)?s+`
5
+ `:`{
6
+ `+s+`
7
+ }`;try{l=k(e,{schema:j})??{}}catch(e){let t=s.includes(`
8
+ `)?le(s):s;if(t!==s)try{l=k(t+`
9
+ `,{schema:j})??{}}catch{this.rethrowMetadataYamlError(e,s,c)}else this.rethrowMetadataYamlError(e,s,c)}l=ce(l)}let d;if(l&&typeof l.shape==`string`){let e=l;d=e.shape;let t=I(d);t&&t!==d&&(e.shape=t)}let f=this.subGraphLookup.get(e);if(f&&l){f.metadata={...f.metadata,...l};return}let p=this.connectors.get(e);if(p&&l){p.metadata={...p.metadata,...l};return}if(e===`connectors`)return;let m=this.edges.find(t=>t.id===e);if(m){let e=l;e?.animate!==void 0&&(m.animate=e.animate),e?.animation!==void 0&&(m.animation=e.animation),e?.curve!==void 0&&(m.interpolate=e.curve),l&&(m.metadata={...m.metadata,...l});return}let h,g=this.vertices.get(e);if(g===void 0&&(g={id:e,labelType:`text`,domId:ie+e+`-`+this.vertexCounter,styles:[],classes:[]},this.vertices.set(e,g)),this.vertexCounter++,t===void 0?g.text===void 0&&(g.text=e):(this.config=u(),h=this.sanitizeText(t.text.trim()),g.labelType=t.type,h.startsWith(`"`)&&h.endsWith(`"`)&&(h=h.substring(1,h.length-1)),g.text=h),n!==void 0&&(g.type=n),r?.forEach(e=>{g.styles.push(e)}),i?.forEach(e=>{g.classes.push(e)}),a!==void 0&&(g.dir=a),g.props===void 0?g.props=o:o!==void 0&&Object.assign(g.props,o),l){if(g.metadata={...g.metadata,...l},l.shape){let e=d??l.shape;if(typeof e!=`string`)throw this.positionedShapeError(`No such shape: ${JSON.stringify(e)}.`,c);if(e!==e.toLowerCase()||e.includes(`_`))throw this.positionedShapeError(`No such shape: ${e}. Shape names should be lowercase.`,c);if(!w(l.shape))throw this.positionedShapeError(`No such shape: ${l.shape}.`,c);g.type=l?.shape}l?.label&&(g.text=this.sanitizeText(l.label),g.labelType=this.sanitizeNodeLabelType(l?.labelType))}}positionedShapeError(e,t){let n=Error(e);if(!t)return n;let r=t.first_line+this.frontmatterLineOffset;return Object.assign(n,{hash:{text:``,token:null,line:r-1,loc:{first_line:r,last_line:t.last_line+this.frontmatterLineOffset,first_column:t.first_column,last_column:t.last_column},expected:[]}}),n}rethrowMetadataYamlError(t,n,r){let i=t;if(!i||i.name!==`YAMLException`||!i.mark||!r)throw t;let a;try{let t=!n.includes(`
10
+ `),o=t?`{
11
+ `+n+`
12
+ }`:n+`
13
+ `,s=r.first_line+this.frontmatterLineOffset,c=r.first_column+2,l=e((e,n)=>t?{line:s,column:c+(e===1?n:0)}:{line:s+e,column:e===0?c+n:n},`toSource`),u=l(i.mark.line,i.mark.column),d=i.reason??(i.message??``).split(`
14
+ `)[0].replace(/\s*\(\d+:\d+\)\s*$/,``),f=o.split(`
15
+ `),p=[];if(t)p.push(1);else for(let e=i.mark.line-1;e<=i.mark.line+1;e++)e<0||e>=f.length||(e!==f.length-1||f[e]!==``||e===i.mark.line)&&p.push(e);let m=Math.max(...p.map(e=>String(l(e,0).line).length)),h=[];for(let e of p){let t=l(e,0).line,n=` ${String(t).padStart(m)} | `;h.push(n+f[e].replace(/\t/g,`→`)),e===i.mark.line&&h.push(`-`.repeat(n.length+i.mark.column)+`^`)}a={message:`${d} (${u.line}:${u.column+1})
16
+
17
+ ${h.join(`
18
+ `)}`,markLine:u.line-1,markColumn:u.column,hash:{text:``,token:null,line:u.line-1,loc:{first_line:u.line,last_line:u.line,first_column:u.column,last_column:u.column+1},expected:[]}}}catch{}throw a&&(i.message=a.message,i.mark.line=a.markLine,i.mark.column=a.markColumn,i.hash=a.hash),i}addSingleLink(e,n,r,i){let a={start:e,end:n,type:void 0,text:``,labelType:`text`,classes:[],isUserDefinedId:!1,interpolate:this.edges.defaultInterpolate};t.info(`abc78 Got edge...`,a);let o=r.text;if(o!==void 0&&(a.text=this.sanitizeText(o.text.trim()),a.text.startsWith(`"`)&&a.text.endsWith(`"`)&&(a.text=a.text.substring(1,a.text.length-1)),a.labelType=this.sanitizeNodeLabelType(o.type)),r!==void 0&&(a.type=r.type,a.stroke=r.stroke,a.length=r.length>10?10:r.length,r.edgeSemantic&&(a.edgeSemantic=r.edgeSemantic)),i&&!this.edges.some(e=>e.id===i))a.id=i,a.isUserDefinedId=!0;else{let e=this.edges.filter(e=>e.start===a.start&&e.end===a.end);a.id=e.length===0?v(a.start,a.end,{counter:0,prefix:`L`}):v(a.start,a.end,{counter:e.length+1,prefix:`L`})}if(this.edges.length<(this.config.maxEdges??500))t.info(`Pushing edge...`),this.edges.push(a);else throw Error(`Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${this.config.maxEdges}.
19
+
20
+ Initialize mermaid with maxEdges set to a higher number to allow more edges.
21
+ You cannot set this config via configuration inside the diagram as it is a secure config.
22
+ You have to call mermaid.initialize.`)}isLinkData(e){return typeof e==`object`&&!!e&&`id`in e&&typeof e.id==`string`}addLink(e,n,r){let i=this.isLinkData(r)?r.id.replace(`@`,``):void 0;t.info(`addLink`,e,n,i);for(let t of e)for(let a of n){let o=t===e[e.length-1],s=a===n[0];o&&s?this.addSingleLink(t,a,r,i):this.addSingleLink(t,a,r,void 0)}}updateLinkInterpolate(e,t){e.forEach(e=>{if(e==="default")this.edges.defaultInterpolate=t;else{if(typeof e==`number`&&e>=this.edges.length)throw Error(`The index ${e} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`);this.edges[e].interpolate=t}})}updateLink(e,t){e.forEach(e=>{if(typeof e==`number`&&e>=this.edges.length)throw Error(`The index ${e} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`);e==="default"?this.edges.defaultStyle=t:(this.edges[e].style=t,(this.edges[e]?.style?.length??0)>0&&!this.edges[e]?.style?.some(e=>e?.startsWith(`fill`))&&this.edges[e]?.style?.push(`fill:none`))})}addClass(e,t){let n=t.join().replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);e.split(`,`).forEach(e=>{let t=this.classes.get(e);t===void 0&&(t={id:e,styles:[],textStyles:[]},this.classes.set(e,t)),n?.forEach(e=>{if(/color/.exec(e)){let n=e.replace(`fill`,`bgFill`);t.textStyles.push(n)}t.styles.push(e)})})}setDirection(e){this.direction=e.trim(),/.*</.exec(this.direction)&&(this.direction=`RL`),/.*\^/.exec(this.direction)&&(this.direction=`BT`),/.*>/.exec(this.direction)&&(this.direction=`LR`),/.*v/.exec(this.direction)&&(this.direction=`TB`),this.direction===`TD`&&(this.direction=`TB`)}setClass(e,t){for(let n of e.split(`,`)){let e=this.vertices.get(n);e&&e.classes.push(t);let r=this.edges.find(e=>e.id===n);r&&r.classes.push(t);let i=this.subGraphLookup.get(n);i&&i.classes.push(t)}}setTooltip(e,t){if(t!==void 0){t=this.sanitizeText(t);for(let n of e.split(`,`))this.tooltips.set(this.version===`gen-1`?this.lookUpDomId(n):n,t)}}setClickFun(e,t,n){if(u().securityLevel!==`loose`||t===void 0)return;let r=[];if(typeof n==`string`){r=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let e=0;e<r.length;e++){let t=r[e].trim();t.startsWith(`"`)&&t.endsWith(`"`)&&(t=t.substr(1,t.length-2)),r[e]=t}}r.length===0&&r.push(e);let i=this.vertices.get(e);i&&(i.haveCallback=!0,this.funs.push(()=>{let n=this.lookUpDomId(e),i=document.querySelector(`[id="${n}"]`);i!==null&&i.addEventListener(`click`,()=>{_.runFunc(t,...r)},!1)}))}setLink(e,t,n){e.split(`,`).forEach(e=>{let r=this.vertices.get(e);r!==void 0&&(r.link=_.formatUrl(t,this.config),r.linkTarget=n)}),this.setClass(e,`clickable`)}getTooltip(e){return this.tooltips.get(e)}setClickEvent(e,t,n){e.split(`,`).forEach(e=>{this.setClickFun(e,t,n)}),this.setClass(e,`clickable`)}bindFunctions(e){this.funs.forEach(t=>{t(e)})}getDirection(){return this.direction?.trim()}getVertices(){return this.vertices}getEdges(){return this.edges}isToolDefinition(e){return oe.has(e.type)}getTools(){let e=[];for(let t of this.vertices.values())this.isToolDefinition(t)&&e.push(t);return e}getClasses(){return this.classes}setupToolTips(e){let t=T();n(e).select(`svg`).selectAll(`g.node`).on(`mouseover`,e=>{let r=n(e.currentTarget),i=r.attr(`title`);if(i===null)return;let a=e.currentTarget?.getBoundingClientRect();t.transition().duration(200).style(`opacity`,`.9`),t.text(r.attr(`title`)).style(`left`,window.scrollX+a.left+(a.right-a.left)/2+`px`).style(`top`,window.scrollY+a.bottom+`px`),t.html(f.sanitize(i)),r.classed(`hover`,!0)}).on(`mouseout`,e=>{t.transition().duration(500).style(`opacity`,0),n(e.currentTarget).classed(`hover`,!1)})}clear(e=`gen-2`){this.vertices=new Map,this.classes=new Map,this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.subGraphs=[],this.subGraphLookup=new Map,this.globalNodes=new Set,this.connectors=new Map,this.subCount=0,this.tooltips=new Map,this.firstGraphFlag=!0,this.version=e,this.config=u(),this.diagramId=``,this.vertexCounter=0,this.direction=void 0,this.secCount=-1,this.posCrossRef=[],this.frontmatterLineOffset=0,this.elementMappings=[],this.bareVertexMappings=new WeakSet,this.diagnostics=[],this.postParseValidationRun=!1,c()}setGen(e){this.version=e||`gen-2`}defaultStyle(){return`fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;`}addSubGraph(n,r,i,a){let o=n?.text?.trim(),s=i?.text;n===i&&i?.text&&/\s/.exec(i.text)&&(o=void 0);let c=e(e=>{let t={boolean:{},number:{},string:{}},n=[],r;return{nodeList:e.filter(function(e){let i=typeof e;return e.stmt&&e.stmt===`dir`?(r=e.value,!1):e.trim()===``?!1:i in t?t[i].hasOwnProperty(e)?!1:t[i][e]=!0:!n.includes(e)&&n.push(e)}),dir:r}},`uniq`)(r.flat()),l=c.nodeList,d=c.dir,f=u().flowchart??{};if(d??=f.inheritDir?this.getDirection()??u().direction??void 0:void 0,this.version===`gen-1`)for(let e=0;e<l.length;e++)l[e]=this.lookUpDomId(l[e]);o??=`subGraph`+this.subCount,s||=``,s=this.sanitizeText(s),this.subCount+=1;let p={id:o,nodes:l.filter(e=>e!==o&&!this.globalNodes.has(e)),title:s.trim(),classes:[],dir:d,labelType:this.sanitizeNodeLabelType(i?.type),type:a??`flow`};t.info(`Adding`,p.id,p.nodes,p.dir),p.nodes=this.makeUniq(p,this.subGraphs).nodes;let m=this.getPosForId(o);if(m!==-1){let e=this.subGraphs[m];for(let t of p.nodes)e.nodes.includes(t)||e.nodes.push(t);p.title&&(e.title=p.title),p.dir&&(e.dir=p.dir),p.type&&(e.type=p.type),this.subGraphLookup.set(o,e)}else this.subGraphs.push(p),this.subGraphLookup.set(o,p);return o}addGlobal(e){for(let t of e.flat()){if(typeof t!=`string`)continue;let e=t.trim();e!==``&&this.globalNodes.add(e)}for(let e of this.subGraphs)e.nodes=e.nodes.filter(e=>!this.globalNodes.has(e))}getPosForId(e){for(let[t,n]of this.subGraphs.entries())if(n.id===e)return t;return-1}indexNodes2(e,t){let n=this.subGraphs[t].nodes;if(this.secCount+=1,this.secCount>2e3)return{result:!1,count:0};if(this.posCrossRef[this.secCount]=t,this.subGraphs[t].id===e)return{result:!0,count:0};let r=0,i=1;for(;r<n.length;){let t=this.getPosForId(n[r]);if(t>=0){let n=this.indexNodes2(e,t);if(n.result)return{result:!0,count:i+n.count};i+=n.count}r+=1}return{result:!1,count:i}}getDepthFirstPos(e){return this.posCrossRef[e]}indexNodes(){this.secCount=-1,this.subGraphs.length>0&&this.indexNodes2(`none`,this.subGraphs.length-1)}addConnector(e,t){let n=e?.text?.trim();if(!n)return``;let r=t?.text?.trim()??``,i=r.length>0?this.sanitizeText(r):n,a=this.connectors.get(n);return a?r.length>0&&(a.text=i):(a={id:n,labelType:`text`,domId:ie+n+`-`+this.vertexCounter,styles:[],classes:[],isConnector:!0,text:i},this.connectors.set(n,a),this.vertices.set(n,a),this.vertexCounter++),n}getSubGraphs(){return this.subGraphs}getConnectors(){return[...this.connectors.values()]}firstGraph(){return this.firstGraphFlag?(this.firstGraphFlag=!1,!0):!1}computeEdgeSemantic(e,t){if(e===`arrow_point`&&t===`normal`)return`sequence`;if(e===`arrow_cross`&&t===`normal`)return`failure`;if(e===`arrow_open`&&t===`dotted`)return`reference`}destructStartLink(e){let t=e.trim(),n=`normal`;return t.includes(`.`)&&(n=`dotted`),{type:`arrow_open`,stroke:n}}countChar(e,t){let n=t.length,r=0;for(let i=0;i<n;++i)t[i]===e&&++r;return r}destructEndLink(e){let t=e.trim(),n=t.slice(0,-1),r=`arrow_open`;switch(t.slice(-1)){case`x`:r=`arrow_cross`;break;case`>`:r=`arrow_point`;break;case`-`:case`.`:r=`arrow_open`,n=t}let i=`normal`,a=n.length-1,o=this.countChar(`.`,n);return o>0&&(i=`dotted`,a=o),{type:r,stroke:i,length:a}}destructLink(e,t){let n=this.destructEndLink(e),r;return t?(r=this.destructStartLink(t),r.stroke===n.stroke?(r.type=n.type,r.length=n.length,{...r,edgeSemantic:this.computeEdgeSemantic(r.type,r.stroke)}):{type:`INVALID`,stroke:`INVALID`}):{...n,edgeSemantic:this.computeEdgeSemantic(n.type,n.stroke)}}exists(e,t){for(let n of e)if(n.nodes.includes(t))return!0;return!1}makeUniq(e,t){let n=[];return e.nodes.forEach((r,i)=>{this.exists(t,r)||n.push(e.nodes[i])}),{nodes:n}}getTypeFromVertex(e){let t=typeof e.type==`string`?I(e.type):e.type;switch(t){case`square`:case void 0:return`squareRect`;case`round`:return`roundedRect`;case`ellipse`:return`ellipse`;default:return t}}findNode(e,t){return e.find(e=>e.id===t)}destructEdgeType(e){let t=`none`,n=`arrow_point`;switch(e){case`arrow_point`:case`arrow_circle`:case`arrow_cross`:case`arrow_hierarchy`:n=e;break;case`double_arrow_point`:case`double_arrow_circle`:case`double_arrow_cross`:t=e.replace(`double_`,``),n=t}return{arrowTypeStart:t,arrowTypeEnd:n}}addNodeFromVertex(e,t,n,r,i,a){let o=n.get(e.id),s=r.get(e.id)??!1,c=this.findNode(t,e.id);if(c)c.cssStyles=e.styles,c.cssCompiledStyles=this.getCompiledStyles(e.classes),c.cssClasses=e.classes.join(` `);else{let n={id:e.id,label:e.text,labelType:e.labelType,labelStyle:``,parentId:o,padding:i.flowchart?.padding||8,cssStyles:e.styles,cssCompiledStyles:this.getCompiledStyles([`default`,`node`,...e.classes]),cssClasses:`default `+e.classes.join(` `),dir:e.dir,domId:e.domId,look:a,link:e.link,linkTarget:e.linkTarget,tooltip:this.getTooltip(e.id),metadata:e.metadata};s?t.push({...n,isGroup:!0,shape:`rect`}):t.push({...n,isGroup:!1,shape:this.getTypeFromVertex(e),wrappingWidth:i.agentflow?.wrappingWidth,minWidth:i.agentflow?.minNodeWidth})}}getCompiledStyles(e){let t=[];for(let n of e){let e=this.classes.get(n);e?.styles&&(t=[...t,...e.styles??[]].map(e=>e.trim())),e?.textStyles&&(t=[...t,...e.textStyles??[]].map(e=>e.trim()))}return t}runPostParseValidators(){this.postParseValidationRun||=!0}getData(){this.runPostParseValidators();let t=u(),n=[],r=[],i=this.getSubGraphs(),a=new Map,o=new Map,s=new Set,c=new Map,l=e((e,t,n=new Set)=>{if(n.has(e))return;n.add(e);let r=this.subGraphLookup.get(e);if(r)for(let e of r.nodes)e===t||n.has(e)||(s.add(e),c.set(e,t),l(e,t,n))},`collectDescendants`);for(let e of i)e.metadata?.view===`collapsed`&&!s.has(e.id)&&l(e.id,e.id);let d=e((e,t)=>{let n=new Set,r=t;for(;r!==void 0&&!n.has(r);){if(r===e)return!0;n.add(r),r=a.get(r)}return!1},`wouldCloseContainmentCycle`);for(let e=i.length-1;e>=0;e--){let t=i[e];if(!s.has(t.id)){t.nodes.length>0&&o.set(t.id,!0);for(let e of t.nodes)d(e,t.id)?this.emitWarning(M.CONTAINMENT_VIOLATION,`Container "${t.id}" cannot contain "${e}" because "${e}" already contains it. The nesting that would close the loop is dropped.`,{nodeId:e}):a.set(e,t.id)}}for(let e=i.length-1;e>=0;e--){let r=i[e];if(!s.has(r.id)){if(r.metadata?.view===`collapsed`){let e={...r.metadata,containerType:r.type};n.push({id:r.id,label:r.title,labelStyle:``,labelType:r.labelType,parentId:a.get(r.id),padding:8,cssCompiledStyles:this.getCompiledStyles(r.classes),cssClasses:r.classes.join(` `),shape:`collapsedGroup`,dir:r.dir,isGroup:!1,look:t.look,metadata:e})}else n.push({id:r.id,label:r.title,labelStyle:``,labelType:r.labelType,parentId:a.get(r.id),padding:8,cssCompiledStyles:this.getCompiledStyles(r.classes),cssClasses:r.classes.join(` `),shape:se[r.type??`flow`],dir:r.dir,isGroup:!0,look:t.look,metadata:r.metadata})}}this.getVertices().forEach(e=>{s.has(e.id)||this.addNodeFromVertex(e,n,a,o,t,t.look||`classic`)});let f=this.getEdges();f.forEach((e,n)=>{let i=c.get(e.start)??e.start,a=c.get(e.end)??e.end;if(i===a&&e.start!==e.end)return;let{arrowTypeStart:o,arrowTypeEnd:s}=this.destructEdgeType(e.type),l=[...f.defaultStyle??[]];e.style&&l.push(...e.style);let u={id:v(i,a,{counter:n,prefix:`L`},e.id),isUserDefinedId:e.isUserDefinedId,start:i,end:a,type:e.type??`normal`,label:e.text,labelType:e.labelType,labelpos:`c`,thickness:e.stroke,minlen:e.length,classes:e?.stroke===`invisible`?``:`edge-thickness-normal edge-pattern-solid flowchart-link`,arrowTypeStart:e?.stroke===`invisible`||e?.type===`arrow_open`?`none`:o,arrowTypeEnd:e?.stroke===`invisible`||e?.type===`arrow_open`?`none`:s,arrowheadStyle:`fill: #333`,cssCompiledStyles:this.getCompiledStyles(e.classes),labelStyle:l,style:l,pattern:e.stroke,look:t.look,animate:e.animate,animation:e.animation,curve:e.interpolate||this.edges.defaultInterpolate||t.flowchart?.curve,metadata:e.metadata};r.push(u)}),ne(n,this);let p=new Map,m=new Map;for(let e of i){let t=a.get(e.id);t!==void 0&&m.set(t,[...m.get(t)??[],e.id])}let h=0,g=e(e=>{if(!p.has(e)){p.set(e,h++);for(let t of m.get(e)??[])g(t)}},`walkContainers`);for(let e of i)a.get(e.id)===void 0&&g(e.id);let _=new Set(this.getConnectors().map(e=>e.id));return re(n,e=>{if(_.has(e))return`connector`;let t=this.vertices.get(e);return t?this.deriveVertexKind(t,I(t.type)):void 0},p),{nodes:n,edges:r,other:{},config:t,connectors:this.getConnectors()}}defaultConfig(){return d.flowchart}deriveVertexKind(e,t){return this.isToolDefinition(e)?`tool`:t===`hexagon`||t===`hex`?`action`:t===`lean-right`||t===`lean_right`?`input`:t===`lin-doc`||t===`lined-document`?`refdoc`:t===`diamond`?`decision`:`task`}getSemanticModel(){this.runPostParseValidators();let e=new Set(this.subGraphs.map(e=>e.id)),t=[],n=[];for(let[r,i]of this.vertices){if(e.has(r))continue;if(i.isConnector){let e={id:r};if(i.text!==void 0&&i.text!==r&&(e.title=i.text),i.metadata&&Object.keys(i.metadata).length>0){let t={};for(let[e,n]of Object.entries(i.metadata))ae.has(e)||(t[e]=n);Object.keys(t).length>0&&(e.metadata=t)}n.push(e);continue}let a={id:r};i.text!==void 0&&(a.label=i.text);let o=typeof i.type==`string`?I(i.type):i.type;if(o!==void 0&&(a.shape=o),a.vertexKind=this.deriveVertexKind(i,o),i.metadata&&Object.keys(i.metadata).length>0){let e={};for(let[t,n]of Object.entries(i.metadata))ae.has(t)||(e[t]=n);Object.keys(e).length>0&&(a.metadata=e)}t.push(a)}let r={vertices:t,edges:this.edges.map(e=>{let t={start:e.start,end:e.end};return e.id!==void 0&&(t.id=e.id),typeof e.text==`string`&&e.text.length>0&&(t.label=e.text),e.type!==void 0&&(t.type=e.type),e.stroke!==void 0&&(t.stroke=e.stroke),e.edgeSemantic!==void 0&&(t.edgeSemantic=e.edgeSemantic),e.length!==void 0&&(t.length=e.length),e.metadata&&Object.keys(e.metadata).length>0&&(t.metadata={...e.metadata}),t}),subGraphs:this.subGraphs.map(e=>{let t={id:e.id,nodes:[...e.nodes]};if(e.type!==void 0&&(t.type=e.type),e.title!==void 0&&(t.title=e.title),e.dir!==void 0&&(t.direction=e.dir),e.metadata&&Object.keys(e.metadata).length>0){let n={};for(let[t,r]of Object.entries(e.metadata))ae.has(t)||(n[t]=r);Object.keys(n).length>0&&(t.metadata=n)}return t}),connectors:n,diagnostics:this.diagnostics};return this.direction!==void 0&&(r.direction=this.direction),r}setFrontmatterLineOffset(e){this.frontmatterLineOffset=e??0}toElementPosition(e){let t=e?.first_line??0,n=e?.first_column??0,r=e?.last_line??t,i=e?.last_column??n,[a,o]=e?.range??[0,0];return{startLine:t+this.frontmatterLineOffset,startColumn:n,endLine:r+this.frontmatterLineOffset,endColumn:i,startIndex:a,endIndex:o}}pushMapping(e,t,n){if(!e)return;let r={id:e,type:t,position:this.toElementPosition(n)};return this.elementMappings.push(r),r}addVertexMapping(e,t,n,r){let i=this.pushMapping(e,`vertex`,r);i&&n==null&&this.bareVertexMappings.add(i)}extendVertexMapping(e,t){if(!e||!t)return;let n=this.toElementPosition(t);for(let t=this.elementMappings.length-1;t>=0;t--){let r=this.elementMappings[t];if(r.type===`vertex`&&r.id===e){this.bareVertexMappings.has(r)&&(r.type=`attachment`,this.bareVertexMappings.delete(r)),(n.endLine>r.position.endLine||n.endLine===r.position.endLine&&n.endColumn>r.position.endColumn)&&(r.position.endLine=n.endLine,r.position.endColumn=n.endColumn,r.position.endIndex=n.endIndex);return}}this.pushMapping(e,`attachment`,t)}addEdgeMapping(e,t,n,r){let i=Array.isArray(t)?t.map(e=>typeof e==`string`?e:e?.id??``).filter(Boolean):[],a=i.length>0?i.join(`>`):`edge`;this.pushMapping(a,`edge`,r)}addSubgraphMapping(e,t,n,r){let i=(typeof e==`string`?e:e?.text)??``,a=this.toElementPosition(n),o=r?this.toElementPosition(r):a;i&&this.elementMappings.push({id:i,type:`subgraph`,position:{startLine:a.startLine,startColumn:a.startColumn,endLine:o.endLine,endColumn:o.endColumn,startIndex:a.startIndex,endIndex:o.endIndex}})}addConnectorMapping(e,t,n,r){let i=e?.text?.trim()??``;if(!i)return;let a=this.toElementPosition(n),o=r?this.toElementPosition(r):a;this.elementMappings.push({id:i,type:`connector`,position:{startLine:a.startLine,startColumn:a.startColumn,endLine:o.endLine,endColumn:o.endColumn,startIndex:a.startIndex,endIndex:o.endIndex}})}getElementMappings(){return[...this.elementMappings]}getElementById(e){return this.elementMappings.find(t=>t.id===e)}getElementsOnLine(e){return this.elementMappings.filter(t=>e>=t.position.startLine&&e<=t.position.endLine)}getElementAtPosition(t,n){let r=this.elementMappings.filter(e=>{let{startLine:r,startColumn:i,endLine:a,endColumn:o}=e.position;return!(t<r||t>a||t===r&&n<i||t===a&&n>o)});if(r.length===0)return;let i=e(({position:e})=>[e.endLine-e.startLine,e.endColumn-e.startColumn],`span`);return r.reduce((e,t)=>{let[n,r]=i(e),[a,o]=i(t);return a===n?o<r?t:e:a<n?t:e})}getMappingStats(){let e=0,t=0,n=0,r=0,i=0;for(let a of this.elementMappings)a.type===`vertex`?e++:a.type===`edge`?t++:a.type===`subgraph`?n++:a.type===`connector`?r++:a.type===`attachment`&&i++;return{vertices:e,edges:t,subgraphs:n,connectors:r,attachments:i,totalElements:this.elementMappings.length}}emitDiagnostic(e,n,r,i){let a=i?.nodeId??i?.edgeId,o=a?this.getElementById(a):void 0,s={id:e,severity:n,message:r,...i?.nodeId?{nodeId:i.nodeId}:{},...i?.edgeId&&!i?.nodeId?{edgeId:i.edgeId}:{},...o?{position:o.position}:{}};if(this.diagnostics.some(e=>e.id===s.id&&e.severity===s.severity&&e.message===s.message&&e.nodeId===s.nodeId&&e.edgeId===s.edgeId))return;this.diagnostics.push(s);let c=`agentflow[${e}]: ${r}`;n===`error`?t.error(c):t.warn(c)}emitWarning(e,t,n){this.emitDiagnostic(e,`warning`,t,n)}emitError(e,t,n){this.emitDiagnostic(e,`error`,t,n)}getDiagnostics(){return[...this.diagnostics]}},de={getClasses:e(function(e,t){return t.db.getClasses()},`getClasses`),draw:e(async function(e,n,r,i){t.debug(`Drawing agentflow diagram`,n);let{securityLevel:a,agentflow:o,layout:s}=u();i.db.setDiagramId(n),t.debug(`Before getData: `);let c=i.db.getData();t.debug(`Data: `,c);let l=E(n,a),d=i.db.getDirection();c.type=i.type,c.layoutAlgorithm=A(s),c.layoutAlgorithm===`dagre`&&s===`elk`&&t.warn("flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback."),c.direction=d,c.nodeSpacing=o?.nodeSpacing||50,c.rankSpacing=o?.rankSpacing||50,c.markers=[`point`,`circle`,`cross`,`hierarchy`],c.diagramId=n,t.debug(`REF1:`,c),await O(c,l);let f=o?.diagramPadding??8;_.insertTitle(l,`agentflowTitleText`,o?.titleTopMargin??0,i.db.getDiagramTitle()),D(l,f,`agentflow`,o?.useMaxWidth??!0)},`draw`)},fe=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,5],r=[1,4],i=[1,3],a=[1,6],o=[1,8,9,10,11,12,28,35,36,38,40,42,47,63,87,88,89,90,91,92,105,108,109,112,114,117,118,119,124,125,126,127,128],s=[2,2],c=[1,15],l=[1,16],u=[1,17],d=[1,18],f=[1,19],p=[1,26],m=[1,27],h=[1,28],g=[1,30],_=[1,31],v=[1,32],y=[1,55],b=[1,54],x=[1,34],S=[1,35],C=[1,36],w=[1,37],T=[1,38],E=[1,50],D=[1,52],O=[1,48],k=[1,53],A=[1,49],j=[1,56],M=[1,51],N=[1,57],P=[1,58],ee=[1,39],te=[1,40],F=[1,41],I=[1,42],ne=[1,43],L=[1,64],R=[1,8,9,10,11,12,28,33,35,36,38,40,42,47,63,87,88,89,90,91,92,105,108,109,112,114,117,118,119,124,125,126,127,128],z=[1,70],B=[1,68],V=[1,67],H=[1,69],re=[8,9,10,12,78,80,81],ie=[1,88],ae=[1,101],oe=[1,106],se=[1,105],ce=[1,102],le=[1,98],ue=[1,104],de=[1,100],fe=[1,107],pe=[1,103],me=[1,108],he=[1,99],ge=[8,9,10,11,12,43,78,80,81],U=[8,9,10,11,12,43,49,78,80,81],W=[8,9,10,11,12,30,43,47,49,51,53,55,57,59,61,63,66,68,70,71,73,78,80,81,92,105,108,109,112,114,117,118,119],_e=[8,9,10,12,47,63,78,80,81,92,105,108,109,112,114,117,118,119],ve=[47,63,92,105,108,109,112,114,117,118,119],ye=[1,131],be=[1,132],xe=[1,134],Se=[1,133],Ce=[47,63,65,77,92,105,108,109,112,114,117,118,119],we=[1,143],Te=[1,157],Ee=[1,158],De=[1,159],Oe=[1,162],ke=[1,161],Ae=[1,160],je=[1,145],Me=[1,147],Ne=[1,151],Pe=[1,139],Fe=[1,140],Ie=[1,152],Le=[1,153],Re=[1,154],ze=[1,155],Be=[1,156],Ve=[1,163],He=[1,164],Ue=[1,141],We=[1,142],Ge=[1,149],Ke=[1,144],qe=[1,148],Je=[1,146],Ye=[8,9,10,11,12,28,33,35,36,38,40,42,47,63,87,88,89,90,91,92,105,108,109,112,114,117,118,119,124,125,126,127,128],Xe=[1,168],Ze=[1,170],G=[8,9,10,12],K=[8,9,10,11,12,15,47,63,92,108,109,112,114,117,118,119],q=[1,190],J=[1,186],Y=[1,187],X=[1,191],Z=[1,188],Q=[1,189],Qe=[80,119,122],$=[8,9,10,11,12,13,15,28,30,33,35,36,43,47,63,78,87,88,89,90,91,92,93,108,112,114,117,118,119],$e=[11,109],et=[32,52,54,56,58,60,65,67,69,70,72,74,119,120,121],tt=[1,269],nt=[1,267],rt=[1,271],it=[1,265],at=[1,266],ot=[1,268],st=[1,270],ct=[1,272],lt=[1,292],ut=[8,9,10,12,109],dt=[8,9,10,11,12,63,87,108,109,112,113,114,115],ft={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,graphConfig:4,document:5,line:6,statement:7,COMMENT:8,SEMI:9,NEWLINE:10,SPACE:11,EOF:12,GRAPH:13,NODIR:14,DIR:15,FirstStmtSeparator:16,ending:17,endToken:18,spaceList:19,spaceListNewline:20,vertexStatement:21,separator:22,styleStatement:23,linkStyleStatement:24,classDefStatement:25,classStatement:26,clickStatement:27,flow:28,textNoTags:29,SQS:30,text:31,SQE:32,end:33,shapeData:34,global:35,connector:36,direction:37,acc_title:38,acc_title_value:39,acc_descr:40,acc_descr_value:41,acc_descr_multiline_value:42,SHAPE_DATA:43,link:44,node:45,styledVertex:46,AMP:47,vertex:48,STYLE_SEPARATOR:49,idString:50,DOUBLECIRCLESTART:51,DOUBLECIRCLEEND:52,PS:53,PE:54,"(-":55,"-)":56,STADIUMSTART:57,STADIUMEND:58,SUBROUTINESTART:59,SUBROUTINEEND:60,VERTEX_WITH_PROPS_START:61,"NODE_STRING[field]":62,COLON:63,"NODE_STRING[value]":64,PIPE:65,CYLINDERSTART:66,CYLINDEREND:67,DIAMOND_START:68,DIAMOND_STOP:69,TAGEND:70,TRAPSTART:71,TRAPEND:72,INVTRAPSTART:73,INVTRAPEND:74,linkStatement:75,arrowText:76,TESTSTR:77,START_LINK:78,edgeText:79,LINK:80,LINK_ID:81,edgeTextToken:82,STR:83,MD_STR:84,textToken:85,keywords:86,STYLE:87,LINKSTYLE:88,CLASSDEF:89,CLASS:90,CLICK:91,DOWN:92,UP:93,textNoTagsToken:94,stylesOpt:95,"idString[vertex]":96,"idString[class]":97,CALLBACKNAME:98,CALLBACKARGS:99,HREF:100,LINK_TARGET:101,"STR[link]":102,"STR[tooltip]":103,alphaNum:104,DEFAULT:105,numList:106,INTERPOLATE:107,NUM:108,COMMA:109,style:110,styleComponent:111,NODE_STRING:112,UNIT:113,BRKT:114,PCT:115,idStringToken:116,MINUS:117,MULT:118,UNICODE_TEXT:119,TEXT:120,TAGSTART:121,EDGE_TEXT:122,alphaNumToken:123,direction_tb:124,direction_bt:125,direction_rl:126,direction_lr:127,direction_td:128,$accept:0,$end:1},terminals_:{2:`error`,8:`COMMENT`,9:`SEMI`,10:`NEWLINE`,11:`SPACE`,12:`EOF`,13:`GRAPH`,14:`NODIR`,15:`DIR`,28:`flow`,30:`SQS`,32:`SQE`,33:`end`,35:`global`,36:`connector`,38:`acc_title`,39:`acc_title_value`,40:`acc_descr`,41:`acc_descr_value`,42:`acc_descr_multiline_value`,43:`SHAPE_DATA`,47:`AMP`,49:`STYLE_SEPARATOR`,51:`DOUBLECIRCLESTART`,52:`DOUBLECIRCLEEND`,53:`PS`,54:`PE`,55:`(-`,56:`-)`,57:`STADIUMSTART`,58:`STADIUMEND`,59:`SUBROUTINESTART`,60:`SUBROUTINEEND`,61:`VERTEX_WITH_PROPS_START`,62:`NODE_STRING[field]`,63:`COLON`,64:`NODE_STRING[value]`,65:`PIPE`,66:`CYLINDERSTART`,67:`CYLINDEREND`,68:`DIAMOND_START`,69:`DIAMOND_STOP`,70:`TAGEND`,71:`TRAPSTART`,72:`TRAPEND`,73:`INVTRAPSTART`,74:`INVTRAPEND`,77:`TESTSTR`,78:`START_LINK`,80:`LINK`,81:`LINK_ID`,83:`STR`,84:`MD_STR`,87:`STYLE`,88:`LINKSTYLE`,89:`CLASSDEF`,90:`CLASS`,91:`CLICK`,92:`DOWN`,93:`UP`,96:`idString[vertex]`,97:`idString[class]`,98:`CALLBACKNAME`,99:`CALLBACKARGS`,100:`HREF`,101:`LINK_TARGET`,102:`STR[link]`,103:`STR[tooltip]`,105:`DEFAULT`,107:`INTERPOLATE`,108:`NUM`,109:`COMMA`,112:`NODE_STRING`,113:`UNIT`,114:`BRKT`,115:`PCT`,117:`MINUS`,118:`MULT`,119:`UNICODE_TEXT`,120:`TEXT`,121:`TAGSTART`,122:`EDGE_TEXT`,124:`direction_tb`,125:`direction_bt`,126:`direction_rl`,127:`direction_lr`,128:`direction_td`},productions_:[0,[3,2],[5,0],[5,2],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[4,2],[4,2],[4,2],[4,2],[4,3],[17,2],[17,1],[18,1],[18,1],[18,1],[16,1],[16,1],[16,2],[16,1],[20,2],[20,2],[20,2],[20,1],[20,1],[20,1],[19,2],[19,1],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,9],[7,10],[7,6],[7,7],[7,4],[7,4],[7,7],[7,8],[7,4],[7,5],[7,1],[7,2],[7,2],[7,1],[22,1],[22,1],[22,1],[22,1],[34,2],[34,1],[21,4],[21,3],[21,4],[21,2],[21,2],[21,1],[45,1],[45,6],[45,5],[46,1],[46,3],[48,4],[48,4],[48,6],[48,4],[48,4],[48,4],[48,8],[48,4],[48,4],[48,4],[48,6],[48,4],[48,4],[48,4],[48,4],[48,4],[48,1],[44,2],[44,3],[44,3],[44,1],[44,3],[44,4],[79,1],[79,2],[79,1],[79,1],[75,1],[75,2],[76,3],[31,1],[31,2],[31,1],[31,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[29,1],[29,2],[29,1],[29,1],[25,5],[26,5],[27,2],[27,4],[27,3],[27,5],[27,3],[27,5],[27,5],[27,7],[27,2],[27,4],[27,2],[27,4],[27,4],[27,6],[23,5],[24,5],[24,5],[24,9],[24,9],[24,7],[24,7],[106,1],[106,3],[95,1],[95,3],[110,1],[110,2],[111,1],[111,1],[111,1],[111,1],[111,1],[111,1],[111,1],[111,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[85,1],[85,1],[85,1],[85,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[82,1],[82,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[50,1],[50,2],[104,1],[104,2],[37,1],[37,1],[37,1],[37,1],[37,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 2:this.$=[];break;case 3:(!Array.isArray(a[s])||a[s].length>0)&&a[s-1].push(a[s]),this.$=a[s-1];break;case 4:case 198:this.$=a[s];break;case 5:case 33:case 34:case 35:case 36:case 37:this.$=[];break;case 13:r.setDirection(`TB`),this.$=`TB`;break;case 14:r.setDirection(a[s-1]),this.$=a[s-1];break;case 32:this.$=a[s-1].nodes;break;case 38:this.$=r.addSubGraph(a[s-6],a[s-1],a[s-4],`flow`),r.addSubgraphMapping&&r.addSubgraphMapping(a[s-6],a[s-4],o[s-8],o[s]);break;case 39:this.$=r.addSubGraph(a[s-7],a[s-1],a[s-5],`flow`),r.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,a[s-3],o[s-3]),r.addSubgraphMapping&&r.addSubgraphMapping(a[s-7],a[s-5],o[s-9],o[s]);break;case 40:this.$=r.addSubGraph(a[s-3],a[s-1],{text:``,type:`text`},`flow`),r.addSubgraphMapping&&r.addSubgraphMapping(a[s-3],{text:``,type:`text`},o[s-5],o[s]);break;case 41:this.$=r.addSubGraph(a[s-4],a[s-1],{text:``,type:`text`},`flow`),r.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,a[s-3],o[s-3]),r.addSubgraphMapping&&r.addSubgraphMapping(a[s-4],{text:``,type:`text`},o[s-6],o[s]);break;case 42:this.$=r.addSubGraph(void 0,a[s-1],void 0,`flow`),r.addSubgraphMapping&&r.addSubgraphMapping(void 0,void 0,o[s-3],o[s]);break;case 43:r.addGlobal(a[s-1]),this.$=[];break;case 44:this.$=r.addConnector(a[s-4],a[s-2]),r.addConnectorMapping&&r.addConnectorMapping(a[s-4],a[s-2],o[s-6],o[s]);break;case 45:this.$=r.addConnector(a[s-5],a[s-3]),r.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,a[s-1],o[s-1]),r.addConnectorMapping&&r.addConnectorMapping(a[s-5],a[s-3],o[s-7],o[s]);break;case 46:this.$=r.addConnector(a[s-1],{text:``,type:`text`}),r.addConnectorMapping&&r.addConnectorMapping(a[s-1],{text:``,type:`text`},o[s-3],o[s]);break;case 47:this.$=r.addConnector(a[s-2],{text:``,type:`text`}),r.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,a[s-1],o[s-1]),r.addConnectorMapping&&r.addConnectorMapping(a[s-2],{text:``,type:`text`},o[s-4],o[s]);break;case 49:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 50:case 51:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 56:this.$=a[s-1]+a[s];break;case 57:this.$=a[s];break;case 58:r.addVertex(a[s-1][a[s-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,a[s],o[s]),r.extendVertexMapping&&r.extendVertexMapping(a[s-1][a[s-1].length-1],o[s]),r.addLink(a[s-3].stmt,a[s-1],a[s-2]),r.addEdgeMapping&&r.addEdgeMapping(a[s-3].stmt,a[s-1],a[s-2],this._$),this.$={stmt:a[s-1],nodes:a[s-1].concat(a[s-3].nodes)};break;case 59:r.addLink(a[s-2].stmt,a[s],a[s-1]),r.addEdgeMapping&&r.addEdgeMapping(a[s-2].stmt,a[s],a[s-1],this._$),this.$={stmt:a[s],nodes:a[s].concat(a[s-2].nodes)};break;case 60:r.addLink(a[s-3].stmt,a[s-1],a[s-2]),r.addEdgeMapping&&r.addEdgeMapping(a[s-3].stmt,a[s-1],a[s-2],this._$),this.$={stmt:a[s-1],nodes:a[s-1].concat(a[s-3].nodes)};break;case 61:this.$={stmt:a[s-1],nodes:a[s-1]};break;case 62:r.addVertex(a[s-1][a[s-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,a[s],o[s]),r.extendVertexMapping&&r.extendVertexMapping(a[s-1][a[s-1].length-1],o[s]),this.$={stmt:a[s-1],nodes:a[s-1],shapeData:a[s]};break;case 63:this.$={stmt:a[s],nodes:a[s]};break;case 64:this.$=[a[s]];break;case 65:r.addVertex(a[s-5][a[s-5].length-1],void 0,void 0,void 0,void 0,void 0,void 0,a[s-4],o[s-4]),r.extendVertexMapping&&r.extendVertexMapping(a[s-5][a[s-5].length-1],o[s-4]),this.$=a[s-5].concat(a[s]);break;case 66:this.$=a[s-4].concat(a[s]);break;case 67:this.$=a[s];break;case 68:this.$=a[s-2],r.setClass(a[s-2],a[s]);break;case 69:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`square`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`square`,this._$);break;case 70:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`doublecircle`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`doublecircle`,this._$);break;case 71:this.$=a[s-5],r.addVertex(a[s-5],a[s-2],`circle`),r.addVertexMapping&&r.addVertexMapping(a[s-5],a[s-2],`circle`,this._$);break;case 72:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`ellipse`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`ellipse`,this._$);break;case 73:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`stadium`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`stadium`,this._$);break;case 74:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`subroutine`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`subroutine`,this._$);break;case 75:this.$=a[s-7],r.addVertex(a[s-7],a[s-1],`rect`,void 0,void 0,void 0,Object.fromEntries([[a[s-5],a[s-3]]])),r.addVertexMapping&&r.addVertexMapping(a[s-7],a[s-1],`rect`,this._$);break;case 76:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`cylinder`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`cylinder`,this._$);break;case 77:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`round`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`round`,this._$);break;case 78:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`diamond`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`diamond`,this._$);break;case 79:this.$=a[s-5],r.addVertex(a[s-5],a[s-2],`hexagon`),r.addVertexMapping&&r.addVertexMapping(a[s-5],a[s-2],`hexagon`,this._$);break;case 80:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`odd`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`odd`,this._$);break;case 81:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`trapezoid`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`trapezoid`,this._$);break;case 82:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`inv_trapezoid`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`inv_trapezoid`,this._$);break;case 83:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`lean_right`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`lean_right`,this._$);break;case 84:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],`lean_left`),r.addVertexMapping&&r.addVertexMapping(a[s-3],a[s-1],`lean_left`,this._$);break;case 85:this.$=a[s],r.addVertex(a[s]),r.addVertexMapping&&r.addVertexMapping(a[s],void 0,void 0,this._$);break;case 86:a[s-1].text=a[s],this.$=a[s-1];break;case 87:case 88:a[s-2].text=a[s-1],this.$=a[s-2];break;case 89:this.$=a[s];break;case 90:var c=r.destructLink(a[s],a[s-2]);this.$={type:c.type,stroke:c.stroke,length:c.length,edgeSemantic:c.edgeSemantic,text:a[s-1]};break;case 91:var c=r.destructLink(a[s],a[s-2]);this.$={type:c.type,stroke:c.stroke,length:c.length,edgeSemantic:c.edgeSemantic,text:a[s-1],id:a[s-3]};break;case 92:this.$={text:a[s],type:`text`};break;case 93:this.$={text:a[s-1].text+``+a[s],type:a[s-1].type};break;case 94:this.$={text:a[s],type:`string`};break;case 95:this.$={text:a[s],type:`markdown`};break;case 96:var c=r.destructLink(a[s]);this.$={type:c.type,stroke:c.stroke,length:c.length,edgeSemantic:c.edgeSemantic};break;case 97:var c=r.destructLink(a[s]);this.$={type:c.type,stroke:c.stroke,length:c.length,edgeSemantic:c.edgeSemantic,id:a[s-1]};break;case 98:this.$=a[s-1];break;case 99:this.$={text:a[s],type:`text`};break;case 100:this.$={text:a[s-1].text+``+a[s],type:a[s-1].type};break;case 101:this.$={text:a[s],type:`string`};break;case 102:case 119:this.$={text:a[s],type:`markdown`};break;case 116:this.$={text:a[s],type:`text`};break;case 117:this.$={text:a[s-1].text+``+a[s],type:a[s-1].type};break;case 118:this.$={text:a[s],type:`text`};break;case 120:this.$=a[s-4],r.addClass(a[s-2],a[s]);break;case 121:this.$=a[s-4],r.setClass(a[s-2],a[s]);break;case 122:case 130:this.$=a[s-1],r.setClickEvent(a[s-1],a[s]);break;case 123:case 131:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-2]),r.setTooltip(a[s-3],a[s]);break;case 124:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 125:this.$=a[s-4],r.setClickEvent(a[s-4],a[s-3],a[s-2]),r.setTooltip(a[s-4],a[s]);break;case 126:this.$=a[s-2],r.setLink(a[s-2],a[s]);break;case 127:this.$=a[s-4],r.setLink(a[s-4],a[s-2]),r.setTooltip(a[s-4],a[s]);break;case 128:this.$=a[s-4],r.setLink(a[s-4],a[s-2],a[s]);break;case 129:this.$=a[s-6],r.setLink(a[s-6],a[s-4],a[s]),r.setTooltip(a[s-6],a[s-2]);break;case 132:this.$=a[s-1],r.setLink(a[s-1],a[s]);break;case 133:this.$=a[s-3],r.setLink(a[s-3],a[s-2]),r.setTooltip(a[s-3],a[s]);break;case 134:this.$=a[s-3],r.setLink(a[s-3],a[s-2],a[s]);break;case 135:this.$=a[s-5],r.setLink(a[s-5],a[s-4],a[s]),r.setTooltip(a[s-5],a[s-2]);break;case 136:this.$=a[s-4],r.addVertex(a[s-2],void 0,void 0,a[s]);break;case 137:this.$=a[s-4],r.updateLink([a[s-2]],a[s]);break;case 138:this.$=a[s-4],r.updateLink(a[s-2],a[s]);break;case 139:this.$=a[s-8],r.updateLinkInterpolate([a[s-6]],a[s-2]),r.updateLink([a[s-6]],a[s]);break;case 140:this.$=a[s-8],r.updateLinkInterpolate(a[s-6],a[s-2]),r.updateLink(a[s-6],a[s]);break;case 141:this.$=a[s-6],r.updateLinkInterpolate([a[s-4]],a[s]);break;case 142:this.$=a[s-6],r.updateLinkInterpolate(a[s-4],a[s]);break;case 143:case 145:this.$=[a[s]];break;case 144:case 146:a[s-2].push(a[s]),this.$=a[s-2];break;case 148:this.$=a[s-1]+a[s];break;case 196:this.$=a[s];break;case 197:this.$=a[s-1]+``+a[s];break;case 199:this.$=a[s-1]+``+a[s];break;case 200:this.$={stmt:`dir`,value:`TB`};break;case 201:this.$={stmt:`dir`,value:`BT`};break;case 202:this.$={stmt:`dir`,value:`RL`};break;case 203:this.$={stmt:`dir`,value:`LR`};break;case 204:this.$={stmt:`dir`,value:`TD`}}},`anonymous`),table:[{3:1,4:2,8:n,10:r,11:i,13:a},{1:[3]},t(o,s,{5:7}),{4:8,8:n,10:r,11:i,13:a},{4:9,8:n,10:r,11:i,13:a},{4:10,8:n,10:r,11:i,13:a},{14:[1,11],15:[1,12]},{1:[2,1],6:13,7:14,8:c,9:l,10:u,11:d,12:f,21:20,23:21,24:22,25:23,26:24,27:25,28:p,35:m,36:h,37:29,38:g,40:_,42:v,45:33,46:44,47:y,48:45,50:46,63:b,87:x,88:S,89:C,90:w,91:T,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P,124:ee,125:te,126:F,127:I,128:ne},t(o,[2,10]),t(o,[2,11]),t(o,[2,12]),t(o,[2,13]),{8:[1,63],9:[1,60],10:[1,61],11:L,16:59,19:62},t(R,[2,3]),t(R,[2,4]),t(R,[2,5]),t(R,[2,6]),t(R,[2,7]),t(R,[2,8]),t(R,[2,9]),{8:z,9:B,10:V,12:H,22:65,44:66,75:71,78:[1,72],80:[1,74],81:[1,73]},{8:z,9:B,10:V,12:H,22:75},{8:z,9:B,10:V,12:H,22:76},{8:z,9:B,10:V,12:H,22:77},{8:z,9:B,10:V,12:H,22:78},{8:z,9:B,10:V,12:H,22:79},{8:z,9:B,10:V,11:[1,80],12:H,22:81},{8:z,9:B,10:V,12:H,22:82},{11:[1,83]},t(R,[2,48]),{39:[1,84]},{41:[1,85]},t(R,[2,51]),t(re,[2,63],{19:86,34:87,11:L,43:ie}),{11:[1,89]},{11:[1,90]},{11:[1,91]},{11:[1,92]},{15:ae,47:oe,63:se,83:[1,96],92:ce,98:[1,93],100:[1,94],104:95,108:le,109:ue,112:de,114:fe,117:pe,118:me,119:he,123:97},t(R,[2,200]),t(R,[2,201]),t(R,[2,202]),t(R,[2,203]),t(R,[2,204]),t(ge,[2,64]),t(ge,[2,67],{49:[1,109]}),t(U,[2,85],{116:122,30:[1,110],47:y,51:[1,111],53:[1,112],55:[1,113],57:[1,114],59:[1,115],61:[1,116],63:b,66:[1,117],68:[1,118],70:[1,119],71:[1,120],73:[1,121],92:E,105:D,108:O,109:k,112:A,114:j,117:M,118:N,119:P}),t(W,[2,196]),t(W,[2,157]),t(W,[2,158]),t(W,[2,159]),t(W,[2,160]),t(W,[2,161]),t(W,[2,162]),t(W,[2,163]),t(W,[2,164]),t(W,[2,165]),t(W,[2,166]),t(W,[2,167]),t(o,[2,14]),t(o,[2,20]),t(o,[2,21]),{10:[1,123]},t(o,[2,23]),t(_e,[2,31],{19:124,11:L}),t(R,[2,32]),{45:125,46:44,47:y,48:45,50:46,63:b,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P},t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(ve,[2,89],{76:126,65:[1,128],77:[1,127]}),{79:129,82:130,83:ye,84:be,119:xe,122:Se},{78:[1,135],80:[1,136]},t(Ce,[2,96]),t(R,[2,33]),t(R,[2,34]),t(R,[2,35]),t(R,[2,36]),t(R,[2,37]),{11:we,13:Te,15:Ee,28:De,29:137,33:Oe,35:ke,36:Ae,47:je,63:Me,78:Ne,83:Pe,84:Fe,86:150,87:Ie,88:Le,89:Re,90:ze,91:Be,92:Ve,93:He,94:138,108:Ue,112:We,114:Ge,117:Ke,118:qe,119:Je},t(Ye,s,{5:165}),t(Ye,s,{5:166}),{11:we,13:Te,15:Ee,28:De,29:167,33:Oe,35:ke,36:Ae,47:je,63:Me,78:Ne,83:Pe,84:Fe,86:150,87:Ie,88:Le,89:Re,90:ze,91:Be,92:Ve,93:He,94:138,108:Ue,112:We,114:Ge,117:Ke,118:qe,119:Je},t(R,[2,49]),t(R,[2,50]),t(re,[2,61],{47:Xe}),t(re,[2,62],{19:169,11:L,43:Ze}),t(ge,[2,57]),{47:y,50:171,63:b,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P},{105:[1,172],106:173,108:[1,174]},{47:y,50:175,63:b,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P},{47:y,50:176,63:b,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P},t(G,[2,122],{11:[1,177],99:[1,178]}),{83:[1,179]},t(G,[2,130],{123:181,11:[1,180],15:ae,47:oe,63:se,92:ce,108:le,109:ue,112:de,114:fe,117:pe,118:me,119:he}),t(G,[2,132],{11:[1,182]}),t(K,[2,198]),t(K,[2,185]),t(K,[2,186]),t(K,[2,187]),t(K,[2,188]),t(K,[2,189]),t(K,[2,190]),t(K,[2,191]),t(K,[2,192]),t(K,[2,193]),t(K,[2,194]),t(K,[2,195]),{47:y,50:183,63:b,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P},{31:184,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{31:192,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{31:194,53:[1,193],70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{31:195,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{31:196,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{31:197,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{112:[1,198]},{31:199,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{31:200,68:[1,201],70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{31:202,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{31:203,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{31:204,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},t(W,[2,197]),t(o,[2,22]),t(_e,[2,30]),t(re,[2,59],{34:205,19:206,11:L,43:ie}),t(ve,[2,86],{11:[1,207]}),{11:[1,208]},{31:209,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{80:[1,210],82:211,119:xe,122:Se},t(Qe,[2,92]),t(Qe,[2,94]),t(Qe,[2,95]),t(Qe,[2,183]),t(Qe,[2,184]),{79:212,82:130,83:ye,84:be,119:xe,122:Se},t(Ce,[2,97]),{8:z,9:B,10:V,11:we,12:H,13:Te,15:Ee,22:214,28:De,30:[1,213],33:Oe,34:215,35:ke,36:Ae,43:ie,47:je,63:Me,78:Ne,86:150,87:Ie,88:Le,89:Re,90:ze,91:Be,92:Ve,93:He,94:216,108:Ue,112:We,114:Ge,117:Ke,118:qe,119:Je},t($,[2,116]),t($,[2,118]),t($,[2,119]),t($,[2,172]),t($,[2,173]),t($,[2,174]),t($,[2,175]),t($,[2,176]),t($,[2,177]),t($,[2,178]),t($,[2,179]),t($,[2,180]),t($,[2,181]),t($,[2,182]),t($,[2,103]),t($,[2,104]),t($,[2,105]),t($,[2,106]),t($,[2,107]),t($,[2,108]),t($,[2,109]),t($,[2,110]),t($,[2,111]),t($,[2,112]),t($,[2,113]),t($,[2,114]),t($,[2,115]),{6:13,7:14,8:c,9:l,10:u,11:d,12:f,21:20,23:21,24:22,25:23,26:24,27:25,28:p,33:[1,217],35:m,36:h,37:29,38:g,40:_,42:v,45:33,46:44,47:y,48:45,50:46,63:b,87:x,88:S,89:C,90:w,91:T,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P,124:ee,125:te,126:F,127:I,128:ne},{6:13,7:14,8:c,9:l,10:u,11:d,12:f,21:20,23:21,24:22,25:23,26:24,27:25,28:p,33:[1,218],35:m,36:h,37:29,38:g,40:_,42:v,45:33,46:44,47:y,48:45,50:46,63:b,87:x,88:S,89:C,90:w,91:T,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P,124:ee,125:te,126:F,127:I,128:ne},{8:z,9:B,10:V,11:we,12:H,13:Te,15:Ee,22:220,28:De,30:[1,219],33:Oe,34:221,35:ke,36:Ae,43:ie,47:je,63:Me,78:Ne,86:150,87:Ie,88:Le,89:Re,90:ze,91:Be,92:Ve,93:He,94:216,108:Ue,112:We,114:Ge,117:Ke,118:qe,119:Je},{11:L,19:222},{47:[1,223]},t(ge,[2,56]),{11:[1,224],47:y,63:b,92:E,105:D,108:O,109:k,112:A,114:j,116:122,117:M,118:N,119:P},{11:[1,225]},{11:[1,226],109:[1,227]},t($e,[2,143]),{11:[1,228],47:y,63:b,92:E,105:D,108:O,109:k,112:A,114:j,116:122,117:M,118:N,119:P},{11:[1,229],47:y,63:b,92:E,105:D,108:O,109:k,112:A,114:j,116:122,117:M,118:N,119:P},{83:[1,230]},t(G,[2,124],{11:[1,231]}),t(G,[2,126],{11:[1,232]}),{83:[1,233]},t(K,[2,199]),{83:[1,234],101:[1,235]},t(ge,[2,68],{116:122,47:y,63:b,92:E,105:D,108:O,109:k,112:A,114:j,117:M,118:N,119:P}),{32:[1,236],70:q,85:237,119:X,120:Z,121:Q},t(et,[2,99]),t(et,[2,101]),t(et,[2,102]),t(et,[2,168]),t(et,[2,169]),t(et,[2,170]),t(et,[2,171]),{52:[1,238],70:q,85:237,119:X,120:Z,121:Q},{31:239,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{54:[1,240],70:q,85:237,119:X,120:Z,121:Q},{56:[1,241],70:q,85:237,119:X,120:Z,121:Q},{58:[1,242],70:q,85:237,119:X,120:Z,121:Q},{60:[1,243],70:q,85:237,119:X,120:Z,121:Q},{63:[1,244]},{67:[1,245],70:q,85:237,119:X,120:Z,121:Q},{69:[1,246],70:q,85:237,119:X,120:Z,121:Q},{31:247,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},{32:[1,248],70:q,85:237,119:X,120:Z,121:Q},{70:q,72:[1,249],74:[1,250],85:237,119:X,120:Z,121:Q},{70:q,72:[1,252],74:[1,251],85:237,119:X,120:Z,121:Q},t(re,[2,58],{19:169,11:L,43:Ze}),t(re,[2,60],{47:Xe}),t(ve,[2,88]),t(ve,[2,87]),{65:[1,253],70:q,85:237,119:X,120:Z,121:Q},t(ve,[2,90]),t(Qe,[2,93]),{80:[1,254],82:211,119:xe,122:Se},{31:255,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},t(Ye,s,{5:256}),{8:z,9:B,10:V,12:H,22:257,43:Ze},t($,[2,117]),t(R,[2,42]),t(R,[2,43]),{31:258,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},t(R,[2,46]),{8:z,9:B,10:V,12:H,22:259,43:Ze},{46:260,47:y,48:45,50:46,63:b,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P},{11:L,19:261},{11:tt,63:nt,87:rt,95:262,108:it,110:263,111:264,112:at,113:ot,114:st,115:ct},{11:tt,63:nt,87:rt,95:273,107:[1,274],108:it,110:263,111:264,112:at,113:ot,114:st,115:ct},{11:tt,63:nt,87:rt,95:275,107:[1,276],108:it,110:263,111:264,112:at,113:ot,114:st,115:ct},{108:[1,277]},{11:tt,63:nt,87:rt,95:278,108:it,110:263,111:264,112:at,113:ot,114:st,115:ct},{47:y,50:279,63:b,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P},t(G,[2,123]),{83:[1,280]},{83:[1,281],101:[1,282]},t(G,[2,131]),t(G,[2,133],{11:[1,283]}),t(G,[2,134]),t(U,[2,69]),t(et,[2,100]),t(U,[2,70]),{54:[1,284],70:q,85:237,119:X,120:Z,121:Q},t(U,[2,77]),t(U,[2,72]),t(U,[2,73]),t(U,[2,74]),{112:[1,285]},t(U,[2,76]),t(U,[2,78]),{69:[1,286],70:q,85:237,119:X,120:Z,121:Q},t(U,[2,80]),t(U,[2,81]),t(U,[2,83]),t(U,[2,82]),t(U,[2,84]),t([11,47,63,92,105,108,109,112,114,117,118,119],[2,98]),t(ve,[2,91]),{32:[1,287],70:q,85:237,119:X,120:Z,121:Q},{6:13,7:14,8:c,9:l,10:u,11:d,12:f,21:20,23:21,24:22,25:23,26:24,27:25,28:p,33:[1,288],35:m,36:h,37:29,38:g,40:_,42:v,45:33,46:44,47:y,48:45,50:46,63:b,87:x,88:S,89:C,90:w,91:T,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P,124:ee,125:te,126:F,127:I,128:ne},t(Ye,s,{5:289}),{32:[1,290],70:q,85:237,119:X,120:Z,121:Q},t(R,[2,47]),t(ge,[2,66]),{46:291,47:y,48:45,50:46,63:b,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P},t(G,[2,136],{109:lt}),t(ut,[2,145],{111:293,11:tt,63:nt,87:rt,108:it,112:at,113:ot,114:st,115:ct}),t(dt,[2,147]),t(dt,[2,149]),t(dt,[2,150]),t(dt,[2,151]),t(dt,[2,152]),t(dt,[2,153]),t(dt,[2,154]),t(dt,[2,155]),t(dt,[2,156]),t(G,[2,137],{109:lt}),{11:[1,294]},t(G,[2,138],{109:lt}),{11:[1,295]},t($e,[2,144]),t(G,[2,120],{109:lt}),t(G,[2,121],{116:122,47:y,63:b,92:E,105:D,108:O,109:k,112:A,114:j,117:M,118:N,119:P}),t(G,[2,125]),t(G,[2,127],{11:[1,296]}),t(G,[2,128]),{101:[1,297]},{54:[1,298]},{65:[1,299]},{69:[1,300]},{8:z,9:B,10:V,12:H,22:301,34:302,43:ie},t(R,[2,40]),{6:13,7:14,8:c,9:l,10:u,11:d,12:f,21:20,23:21,24:22,25:23,26:24,27:25,28:p,33:[1,303],35:m,36:h,37:29,38:g,40:_,42:v,45:33,46:44,47:y,48:45,50:46,63:b,87:x,88:S,89:C,90:w,91:T,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P,124:ee,125:te,126:F,127:I,128:ne},{8:z,9:B,10:V,12:H,22:304,34:305,43:ie},t(ge,[2,65]),{11:tt,63:nt,87:rt,108:it,110:306,111:264,112:at,113:ot,114:st,115:ct},t(dt,[2,148]),{15:ae,47:oe,63:se,92:ce,104:307,108:le,109:ue,112:de,114:fe,117:pe,118:me,119:he,123:97},{15:ae,47:oe,63:se,92:ce,104:308,108:le,109:ue,112:de,114:fe,117:pe,118:me,119:he,123:97},{101:[1,309]},t(G,[2,135]),t(U,[2,71]),{31:310,70:q,83:J,84:Y,85:185,119:X,120:Z,121:Q},t(U,[2,79]),t(Ye,s,{5:311}),{8:z,9:B,10:V,12:H,22:312,43:Ze},t(R,[2,41]),t(R,[2,44]),{8:z,9:B,10:V,12:H,22:313,43:Ze},t(ut,[2,146],{111:293,11:tt,63:nt,87:rt,108:it,112:at,113:ot,114:st,115:ct}),t(G,[2,141],{123:181,11:[1,314],15:ae,47:oe,63:se,92:ce,108:le,109:ue,112:de,114:fe,117:pe,118:me,119:he}),t(G,[2,142],{123:181,11:[1,315],15:ae,47:oe,63:se,92:ce,108:le,109:ue,112:de,114:fe,117:pe,118:me,119:he}),t(G,[2,129]),{32:[1,316],70:q,85:237,119:X,120:Z,121:Q},{6:13,7:14,8:c,9:l,10:u,11:d,12:f,21:20,23:21,24:22,25:23,26:24,27:25,28:p,33:[1,317],35:m,36:h,37:29,38:g,40:_,42:v,45:33,46:44,47:y,48:45,50:46,63:b,87:x,88:S,89:C,90:w,91:T,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P,124:ee,125:te,126:F,127:I,128:ne},t(Ye,s,{5:318}),t(R,[2,45]),{11:tt,63:nt,87:rt,95:319,108:it,110:263,111:264,112:at,113:ot,114:st,115:ct},{11:tt,63:nt,87:rt,95:320,108:it,110:263,111:264,112:at,113:ot,114:st,115:ct},t(U,[2,75]),t(R,[2,38]),{6:13,7:14,8:c,9:l,10:u,11:d,12:f,21:20,23:21,24:22,25:23,26:24,27:25,28:p,33:[1,321],35:m,36:h,37:29,38:g,40:_,42:v,45:33,46:44,47:y,48:45,50:46,63:b,87:x,88:S,89:C,90:w,91:T,92:E,105:D,108:O,109:k,112:A,114:j,116:47,117:M,118:N,119:P,124:ee,125:te,126:F,127:I,128:ne},t(G,[2,139],{109:lt}),t(G,[2,140],{109:lt}),t(R,[2,39])],defaultActions:{},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
23
+ `+h.showPosition()+`
24
+ Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};ft.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,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},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:e(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=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),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;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).
25
+ `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
26
+ `+t+`^`},`showPosition`),test_match:e(function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={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},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},`test_match`),next:e(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext=``,this.match=``);for(var i=this._currentRules(),a=0;a<i.length;a++)if(n=this._input.match(this.rules[i[a]]),n&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),e!==!1)return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),e!==!1&&e):this._input===``?this.EOF:this.parseError(`Lexical error on line `+(this.yylineno+1)+`. Unrecognized text.
27
+ `+this.showPosition(),{text:``,token:null,line:this.yylineno})},`next`),lex:e(function(){return this.next()||this.lex()},`lex`),begin:e(function(e){this.conditionStack.push(e)},`begin`),popState:e(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},`popState`),_currentRules:e(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},`_currentRules`),topState:e(function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:`INITIAL`},`topState`),pushState:e(function(e){this.begin(e)},`pushState`),stateStackSize:e(function(){return this.conditionStack.length},`stateStackSize`),options:{},performAction:e(function(e,t,n,r){switch(n){case 0:return this.begin(`acc_title`),38;case 1:return this.popState(),`acc_title_value`;case 2:return this.begin(`acc_descr`),40;case 3:return this.popState(),`acc_descr_value`;case 4:this.begin(`acc_descr_multiline`);break;case 5:this.popState();break;case 6:return`acc_descr_multiline_value`;case 7:return this.pushState(`shapeData`),t.yytext=``,43;case 8:return this.pushState(`shapeDataStr`),43;case 9:return this.popState(),43;case 10:return t.yytext=t.yytext.replace(/\n\s*/g,`<br/>`),43;case 11:return 43;case 12:this.popState();break;case 13:this.begin(`callbackname`);break;case 14:this.popState();break;case 15:this.popState(),this.begin(`callbackargs`);break;case 16:return 98;case 17:this.popState();break;case 18:return 99;case 19:return`MD_STR`;case 20:this.popState();break;case 21:this.begin(`md_string`);break;case 22:return`STR`;case 23:this.popState();break;case 24:this.pushState(`string`);break;case 25:return 87;case 26:return 105;case 27:return 88;case 28:return 107;case 29:return 89;case 30:return 90;case 31:return 100;case 32:this.begin(`click`);break;case 33:this.popState();break;case 34:return 91;case 35:return e.lex.firstGraph()&&this.begin(`dir`),13;case 36:return 28;case 37:return 36;case 38:return 35;case 39:return 33;case 40:return 101;case 41:return 101;case 42:return 101;case 43:return 101;case 44:return this.popState(),14;case 45:return this.popState(),15;case 46:return this.popState(),15;case 47:return this.popState(),15;case 48:return this.popState(),15;case 49:return this.popState(),15;case 50:return this.popState(),15;case 51:return this.popState(),15;case 52:return this.popState(),15;case 53:return this.popState(),15;case 54:return this.popState(),15;case 55:return 124;case 56:return 125;case 57:return 126;case 58:return 127;case 59:return 128;case 60:return 81;case 61:return 108;case 62:return 114;case 63:return 49;case 64:return 63;case 65:return 47;case 66:return 9;case 67:return 109;case 68:return 118;case 69:return this.popState(),80;case 70:return this.pushState(`edgeText`),78;case 71:return 122;case 72:return 80;case 73:break;case 74:return this.popState(),56;case 75:return`TEXT`;case 76:return this.pushState(`ellipseText`),55;case 77:return this.popState(),58;case 78:return this.pushState(`text`),57;case 79:return this.popState(),60;case 80:return this.pushState(`text`),59;case 81:return 61;case 82:return this.pushState(`text`),70;case 83:return this.popState(),67;case 84:return this.pushState(`text`),66;case 85:return this.popState(),52;case 86:return this.pushState(`text`),51;case 87:break;case 88:return this.popState(),72;case 89:return this.popState(),74;case 90:return 120;case 91:return this.pushState(`trapText`),71;case 92:return this.pushState(`trapText`),73;case 93:return 121;case 94:return 70;case 95:return 93;case 96:return`SEP`;case 97:return 92;case 98:return 118;case 99:return 114;case 100:return 47;case 101:return 8;case 102:return 112;case 103:return 117;case 104:return 119;case 105:return this.popState(),65;case 106:return this.pushState(`text`),65;case 107:return this.popState(),54;case 108:return this.pushState(`text`),53;case 109:return this.popState(),32;case 110:return this.pushState(`text`),30;case 111:return this.popState(),69;case 112:return this.pushState(`text`),68;case 113:break;case 114:return`TEXT`;case 115:return`QUOTE`;case 116:return 10;case 117:return 11;case 118:return 12}},`anonymous`),rules:[/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:@\{)/,/^(?:["])/,/^(?:["])/,/^(?:[^\"]+)/,/^(?:[^}^"]+)/,/^(?:\})/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["][`])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:["])/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s])/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?:agentflow-beta\b)/,/^(?:flow\b)/,/^(?:connector\b)/,/^(?:global\b[ \t]*)/,/^(?:end\b[ \t]*)/,/^(?:_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]*)/,/^(?:.*direction\s+TD[^\n]*)/,/^(?:[^\s\"]+@(?=[^\{\"]))/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*--+[x>]\s*)/,/^(?:\s*--\s*)/,/^(?:[^-]|-(?!-)+)/,/^(?:\s*-\.+-\s*)/,/^(?:%%(?!\{)[^\n]*)/,/^(?:[-/\)][\)])/,/^(?:[^\(\)\[\]\{\}]|!\)+)/,/^(?:\(-)/,/^(?:\]\))/,/^(?:\(\[)/,/^(?:\]\])/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:>)/,/^(?:\)\])/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\(\(\()/,/^(?:%%(?!\{)[^\n]*)/,/^(?:[\\(?=\])][\]])/,/^(?:\/(?=\])\])/,/^(?:\/(?!\])|\\(?!\])|(?:[^\\\[\]\(\)\{\}\/%]+|(?!))+)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:\*)/,/^(?:#)/,/^(?:&)/,/^(?:[ \t]*%%(?!\{)[^\n]*)/,/^(?:([A-Za-z0-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])/,/^(?:\|)/,/^(?:\|)/,/^(?:\))/,/^(?:\()/,/^(?:\])/,/^(?:\[)/,/^(?:(\}))/,/^(?:\{)/,/^(?:%%(?!\{)[^\n]*)/,/^(?:(?:[^\[\]\(\)\{\}\|\"%]+|(?!))+)/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],conditions:{shapeDataEndBracket:{rules:[21,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},shapeDataStr:{rules:[9,10,21,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},shapeData:{rules:[8,11,12,21,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},callbackargs:{rules:[17,18,21,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},callbackname:{rules:[14,15,16,21,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},href:{rules:[21,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},click:{rules:[21,24,33,34,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},edgeText:{rules:[21,24,69,71,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},trapText:{rules:[21,24,76,78,80,84,86,87,88,89,90,91,92,106,108,110,112],inclusive:!1},ellipseText:{rules:[21,24,73,74,75,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},text:{rules:[21,24,76,77,78,79,80,83,84,85,86,91,92,105,106,107,108,109,110,111,112,113,114],inclusive:!1},vertex:{rules:[21,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},dir:{rules:[21,24,44,45,46,47,48,49,50,51,52,53,54,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},acc_descr_multiline:{rules:[5,6,21,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},acc_descr:{rules:[3,21,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},acc_title:{rules:[1,21,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},md_string:{rules:[19,20,21,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},string:{rules:[21,22,23,24,76,78,80,84,86,91,92,106,108,110,112],inclusive:!1},INITIAL:{rules:[0,2,4,7,13,21,24,25,26,27,28,29,30,31,32,35,36,37,38,39,40,41,42,43,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,72,76,78,80,81,82,84,86,91,92,93,94,95,96,97,98,99,100,101,102,103,104,106,108,110,112,115,116,117,118],inclusive:!0}}}})();function pt(){this.yy={}}return e(pt,`Parser`),pt.prototype=ft,ft.Parser=pt,new pt})();fe.parser=fe;var pe=fe,me=Object.assign({},pe);me.parse=e=>{let t=e.replace(/}[^\S\n]*\n/g,`}
28
+ `);return pe.parse(t)};var he=me,ge=e(t=>{let{theme:n,bkgColorArray:r,borderColorArray:i}=t;if(!b(n,i))return``;let a=S(t.look),o=C(r),s=x(t.THEME_COLOR_LIMIT,i),c=e(e=>i[e%i.length],`border`),l=e(e=>o?`fill: ${r[e%r.length]};`:``,`fill`),u=``;for(let e of B){let t=L.get(e),n=`[data-look="${a}"].node.${z(e)}`;u+=`
29
+
30
+ ${n} rect,
31
+ ${n} path,
32
+ ${n} polygon {
33
+ stroke: ${c(t)};
34
+ ${l(t)}
35
+ }
36
+ `}for(let t=0;t<V(s);t++){let n=H(t,s),r=`[data-look="${a}"][data-color-id="color-${n}"].cluster`,i=`[data-look="${a}"][data-color-id="color-${n}"].node`,o=e(e=>`${r} ${e}, ${i} ${e}`,`rule`);u+=`
37
+
38
+ ${o(`rect`)},
39
+ ${o(`path`)} {
40
+ stroke: ${c(n)};
41
+ ${l(n)}
42
+ }
43
+ `}return u},`genColor`),U=e((e,t)=>{let n=g,r=n(e,`r`),i=n(e,`g`),a=n(e,`b`);return l(r,i,a,t)},`fade`),W={parser:he,get db(){return new ue},renderer:de,styles:e(e=>`${ge(e)}
44
+ .label {
45
+ font-family: ${e.fontFamily};
46
+ color: ${e.nodeTextColor||e.textColor};
47
+ }
48
+ .cluster-label text {
49
+ fill: ${e.titleColor};
50
+ }
51
+ .cluster-label span {
52
+ color: ${e.titleColor};
53
+ }
54
+ .cluster-label span p {
55
+ background-color: transparent;
56
+ }
57
+
58
+ .label text,span {
59
+ fill: ${e.nodeTextColor||e.textColor};
60
+ color: ${e.nodeTextColor||e.textColor};
61
+ }
62
+
63
+ .node rect,
64
+ .node circle,
65
+ .node ellipse,
66
+ .node polygon,
67
+ .node path {
68
+ fill: ${e.mainBkg};
69
+ stroke: ${e.nodeBorder};
70
+ stroke-width: ${e.strokeWidth??1}px;
71
+ }
72
+ .rough-node .label text , .node .label text, .image-shape .label, .icon-shape .label {
73
+ text-anchor: middle;
74
+ }
75
+ .node .katex path {
76
+ fill: ${e.nodeTextColor||e.textColor};
77
+ stroke: ${e.nodeTextColor||e.textColor};
78
+ stroke-width: 1px;
79
+ }
80
+
81
+ .rough-node .label,.node .label, .image-shape .label, .icon-shape .label {
82
+ text-align: center;
83
+ }
84
+ .node.clickable {
85
+ cursor: pointer;
86
+ }
87
+
88
+
89
+ .root .anchor path {
90
+ fill: ${e.lineColor} !important;
91
+ stroke-width: 0;
92
+ stroke: ${e.lineColor};
93
+ }
94
+
95
+ .arrowheadPath {
96
+ fill: ${e.arrowheadColor};
97
+ }
98
+
99
+ .edgePaths .path {
100
+ stroke: ${e.lineColor};
101
+ stroke-width: ${e.strokeWidth??2}px;
102
+ }
103
+
104
+ .flowchart-link {
105
+ stroke: ${e.lineColor};
106
+ fill: none;
107
+ }
108
+
109
+ .edgeLabel {
110
+ background-color: ${e.edgeLabelBackground};
111
+ p {
112
+ background-color: ${e.edgeLabelBackground};
113
+ }
114
+ rect {
115
+ opacity: 0.5;
116
+ background-color: ${e.edgeLabelBackground};
117
+ fill: ${e.edgeLabelBackground};
118
+ }
119
+ text-align: center;
120
+ }
121
+
122
+ /* For html labels only */
123
+ .labelBkg {
124
+ background-color: ${U(e.edgeLabelBackground,.5)};
125
+ }
126
+
127
+ .cluster rect {
128
+ fill: ${e.clusterBkg};
129
+ stroke: ${e.clusterBorder};
130
+ stroke-width: 1px;
131
+ }
132
+
133
+ .flow-cluster rect {
134
+ fill: none;
135
+ stroke: ${e.clusterBorder};
136
+ stroke-width: 0.75px;
137
+ }
138
+
139
+ .node .collapsed-indicator {
140
+ fill: ${e.nodeBorder};
141
+ stroke: none;
142
+ stroke-width: 0;
143
+ opacity: 0.5;
144
+ }
145
+
146
+ .node .collapsed-separator {
147
+ stroke-width: 0.75px;
148
+ }
149
+
150
+ .cluster text {
151
+ fill: ${e.titleColor};
152
+ }
153
+
154
+ .cluster span {
155
+ color: ${e.titleColor};
156
+ }
157
+ /* .cluster div {
158
+ color: ${e.titleColor};
159
+ } */
160
+
161
+ div.mermaidTooltip {
162
+ position: absolute;
163
+ text-align: center;
164
+ max-width: 200px;
165
+ padding: 2px;
166
+ font-family: ${e.fontFamily};
167
+ font-size: 12px;
168
+ background: ${e.tertiaryColor};
169
+ border: 1px solid ${e.border2};
170
+ border-radius: 2px;
171
+ pointer-events: none;
172
+ z-index: 100;
173
+ }
174
+
175
+ .agentflowTitleText {
176
+ text-anchor: middle;
177
+ font-size: 18px;
178
+ fill: ${e.textColor};
179
+ }
180
+
181
+ rect.text {
182
+ fill: none;
183
+ stroke-width: 0;
184
+ }
185
+
186
+ .icon-shape, .image-shape {
187
+ background-color: ${e.edgeLabelBackground};
188
+ p {
189
+ background-color: ${e.edgeLabelBackground};
190
+ padding: 2px;
191
+ }
192
+ .label rect {
193
+ opacity: 0.5;
194
+ background-color: ${e.edgeLabelBackground};
195
+ fill: ${e.edgeLabelBackground};
196
+ }
197
+ text-align: center;
198
+ }
199
+ ${y()}
200
+ `,`getStyles`),init:e(e=>{e.agentflow??={},e.layout&&i({layout:e.layout}),e.flowchart??={},e.flowchart.arrowMarkerAbsolute=e.arrowMarkerAbsolute,i({flowchart:{arrowMarkerAbsolute:e.arrowMarkerAbsolute}})},`init`)};export{W as diagram};
@@ -0,0 +1 @@
1
+ import{n as e}from"./index-Ct3brajV.js";var t=Math.abs,n=Math.atan2,r=Math.cos,i=Math.max,a=Math.min,o=Math.sin,s=Math.sqrt,c=1e-12,l=Math.PI,u=l/2,d=2*l;function f(e){return e>1?0:e<-1?l:Math.acos(e)}function p(e){return e>=1?u:e<=-1?-u:Math.asin(e)}var m=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BLANK_URL=e.relativeFirstCharacters=e.whitespaceEscapeCharsRegex=e.urlSchemeRegex=e.ctrlCharactersRegex=e.htmlCtrlEntityRegex=e.htmlEntitiesRegex=e.invalidProtocolRegex=void 0,e.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,e.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,e.htmlCtrlEntityRegex=/&(newline|tab);/gi,e.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,e.urlSchemeRegex=/^.+(:|&colon;)/gim,e.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,e.relativeFirstCharacters=[`.`,`/`],e.BLANK_URL=`about:blank`})),h=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.sanitizeUrl=o;var t=m();function n(e){return t.relativeFirstCharacters.indexOf(e[0])>-1}function r(e){return e.replace(t.ctrlCharactersRegex,``).replace(t.htmlEntitiesRegex,function(e,t){return String.fromCharCode(t)})}function i(e){return URL.canParse(e)}function a(e){try{return decodeURIComponent(e)}catch{return e}}function o(e){if(!e)return t.BLANK_URL;var o,s=a(e.trim());do s=r(s).replace(t.htmlCtrlEntityRegex,``).replace(t.ctrlCharactersRegex,``).replace(t.whitespaceEscapeCharsRegex,``).trim(),s=a(s),o=s.match(t.ctrlCharactersRegex)||s.match(t.htmlEntitiesRegex)||s.match(t.htmlCtrlEntityRegex)||s.match(t.whitespaceEscapeCharsRegex);while(o&&o.length>0);var c=s;if(!c)return t.BLANK_URL;if(n(c))return c;var l=c.trimStart(),u=l.match(t.urlSchemeRegex);if(!u)return c;var d=u[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(d))return t.BLANK_URL;var f=l.replace(/\\/g,`/`);if(d===`mailto:`||d.includes(`://`))return f;if(d===`http:`||d===`https:`){if(!i(f))return t.BLANK_URL;var p=new URL(f);return p.protocol=p.protocol.toLowerCase(),p.hostname=p.hostname.toLowerCase(),p.toString()}return f}}));export{n as a,u as c,l as d,o as f,p as i,i as l,d as m,t as n,r as o,s as p,f as r,c as s,h as t,a as u};
@@ -0,0 +1 @@
1
+ import{f as e,t}from"./mermaid-parser.core-BDmgiU7m.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-MbiMZlpk.js";import"./chunk-DSNLSHJZ-KWPl82ns.js";import{n as i,r as a,t as o}from"./chunk-2E7WHVMD-DTKlOCW9.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-8Kj_dqOs.js";var c=e().RailroadEbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformChoice`),u=n(e=>{let t=e.elements.map(p);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformSequence`),d=n(e=>{switch(e.$type){case`EbnfTerminal`:return{type:`terminal`,value:e.value};case`EbnfNonTerminal`:return{type:`nonterminal`,name:e.name};case`EbnfSpecial`:return{type:`special`,text:e.text};case`EbnfGroup`:return l(e.element);case`EbnfOptional`:return{type:`optional`,element:l(e.element)};case`EbnfRepetition`:return{type:`repetition`,element:l(e.element),min:0,max:1/0};default:throw Error(`Unsupported EBNF primary node: ${e.$type}`)}},`transformPrimary`),f=n((e,t)=>{switch(t.$type){case`EbnfOptionalPostfix`:return{type:`optional`,element:e};case`EbnfZeroOrMorePostfix`:return{type:`repetition`,element:e,min:0,max:1/0};case`EbnfOneOrMorePostfix`:return{type:`repetition`,element:e,min:1,max:1/0};case`EbnfExceptionPostfix`:return{type:`sequence`,elements:[e,{type:`terminal`,value:`-`},d(t.except)]};default:throw Error(`Unsupported EBNF postfix node: ${t.$type}`)}},`transformPostfix`),p=n(e=>e.postfixes.reduce((e,t)=>f(e,t),d(e.base)),`transformTerm`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[EBNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[EBNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[EBNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};